source: FOIAVistA/trunk/r/DIETETICS-FH/FHASP1.m@ 1163

Last change on this file since 1163 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1FHASP1 ; HISC/REL/JH - Nutrition Profile (cont) ;5/2/01 10:14
2 ;;5.5;DIETETICS;**8,9**;Jan 28, 2005;Build 7
3 ;
4 I '$G(FHET) S X="T-365",%DT="XT" D ^%DT S FHET=Y K %DT
5 S DTP=FHET D DTP^FH S FHENDATE=DTP
6 S N1=0
7 W !!?22,"Dietetic Encounters since ",FHENDATE
8 F FHET=FHET:0 S FHET=$O(^FHEN("AP",DFN,FHET)) Q:FHET<1!(ANS="^") F ASN=0:0 S ASN=$O(^FHEN("AP",DFN,FHET,ASN)) Q:ASN<1 D:$Y'<S1 HF^FHASP Q:ANS="^" D LST
9 Q:ANS="^"
10 I 'N1 W !!?5,"No Encounters recorded since ",FHENDATE
11 S FHZ115="P"_DFN D CHECK^FHOMDPA I FHDFN="" Q
12 S FADM=$O(^FHPT(FHDFN,"A",""),-1) S FADM=$S($G(ADM):$G(ADM),FADM:FADM,1:"") G:FADM="" F1
13 D:$Y'<(S1-6) HF^FHASP Q:ANS="^" W !!?28,$S($G(ADM):"Current",1:"Last")," Admission Monitors" S N1=0
14 ; F NDT=0:0 S NDT=$O(^FHPT(FHDFN,"A",FADM,"MO","AC",NDT)) Q:NDT<1 F K=0:0 S K=$O(^FHPT(FHDFN,"A",FADM,"MO","AC",NDT,K)) Q:K<1 D MO
15 S FHTTLM="",FHTTLM=$P($G(^FHPT(FHDFN,"A",FADM,"MO",0)),U,3)
16 I FHTTLM="" W !,"No Monitors on file." G F1
17 S FHMONS=$S(FHTTLM-FHNUM<0:0,1:FHTTLM-FHNUM)
18 F NDT=FHMONS:0 S NDT=$O(^FHPT(FHDFN,"A",FADM,"MO",NDT)) Q:NDT<1!(ANS="^") S K=NDT D MO
19 Q:ANS="^" I 'N1 W !,"No Monitors on file."
20F1 D:$Y'<(S1-6) HF^FHASP Q:ANS="^" W !!?32,"Food Preferences" D DISP
21 W !!?27,"Future Clinic Appointments" S N1=0
22 ;
23 ;patch #41
24 ;F NDT=NOW:0 S NDT=$O(^DPT(DFN,"S",NDT)) Q:NDT'>0 S Z=^(NDT,0) I "I"[$P(Z,"^",2) D CLIN Q:ANS="^"
25 K ^TMP($J)
26 S FHCNT=""
27 D GETAPPT^SDAMA201(DFN,"1;2;12","R",DT,,.FHCNT,"")
28 G:'$D(^TMP($J,"SDAMA201","GETAPPT")) NOAPP
29 I $D(^TMP($J,"SDAMA201","GETAPPT")) S FHTMP=$NA(^TMP($J,"SDAMA201","GETAPPT"))
30 I $D(@FHTMP@("ERROR")) D PRERR
31 I $G(FHCNT) F FHI=0:0 S FHI=$O(@FHTMP@(FHI)) Q:FHI'>0 D CLIN I ANS="^" K ^TMP($J) Q
32 K ^TMP($J)
33 ;end changes in patch #41
34 Q:ANS="^"
35NOAPP I 'N1 W !!?5,"No scheduled appointments."
36 D FOOT^FHASP Q
37LST S X0=$G(^FHEN(ASN,0)) Q:$P(X0,"^",4)<3
38 S X1=$G(^FHEN(ASN,"P",DFN,0))
39 W:'N1 ! S N1=N1+1,DTP=$P(X0,"^",2) D DTP^FH W !?5,$E(DTP,1,9)," " S Y=$P(X0,"^",4),Y=$P($G(^FH(115.6,+Y,0)),"^",1) W Y I $P(X0,"^",7)="F" W " (FU)"
40 S Y=$P(X0,"^",9) W ", ",$S(Y="G":"Group",1:"Individual")
41 S Y=$P(X0,"^",11) W:Y'="" !?10,Y S Y=$P(X1,"^",4) W:Y'="" !?10,Y Q
42 ;patch #41
43CLIN ;S SC=+$P(Z,"^",1),Y=$P($G(^SC(SC,0)),"^",1) Q:Y=""
44 S NDT=@FHTMP@(FHI,1)
45 S SC=$P(@FHTMP@(FHI,2),U,1)
46 S Y=$P(@FHTMP@(FHI,2),U,2) Q:Y=""
47 D:$Y'<S1 HF^FHASP Q:ANS="^" W:'N1 ! S N1=N1+1,DTP=NDT D DTP^FH W !?5,DTP,?25,Y Q
48 ;D:$Y'<S1 HF^FHASP Q:ANS="^" W:'N1 ! S N1=N1+1,DTP=NDT D DTP^FH W !?5,DTP,?25,Y W:$P(Z,"^",11) " (Collateral)" Q
49 ;end changes in patch #41
50DISP ; Display Food Preferences
51 W !?26,"Likes",?58,"DisLikes",!
52 K P S P1=1 F K=0:0 S K=$O(^FHPT(FHDFN,"P",K)) Q:K<1 S X=^(K,0) D SP
53 W ! S (M,MM)="" F S M=$O(P(M)) Q:M="" I $D(P(M)) W $P(M,"~",2) D S MM=M
54 . S (P1,P2)=0 F S:P1'="" P1=$O(P(M,"L",P1)) S X1=$S(P1>0:P(M,"L",P1),1:"") S:P2'="" P2=$O(P(M,"D",P2)) S X2=$S(P2>0:P(M,"D",P2),1:"") Q:P1=""&(P2="") D P0 Q:ANS="^" W:MM'=M !
55 . Q
56 Q:ANS="^"
57 I $O(P(""))="" W !,"No Food Preferences on file",!
58 Q
59P0 I X1'="" W ?12 S X=X1 D P1 S X1=X
60 I X2'="" W ?46 S X=X2 D P1 S X2=X
61 Q:X1=""&(X2="") D:$Y'<S1 HF^FHASP Q:ANS="^" W ! G P0
62P1 I $L(X)<34 W X S X="" Q
63 F KK=35:-1:1 Q:$E(X,KK-1,KK)=", "
64 W $E(X,1,KK-2) S X=$E(X,KK+1,999) Q
65SP Q:'$P(X,U) S M1=$P(X,"^",2) S:M1="A"!(M1="") M1="BNE" S Z=$G(^FH(115.2,+X,0)) Q:$P(Z,U)=""!($P(Z,U,2)="") S L1=$P(Z,"^",1),KK=$P(Z,"^",2),M="",DAS=$P(X,"^",4)
66 I KK="L" S Q=$P(X,"^",3),L1=$S(Q:Q,1:1)_" "_L1
67 I M1="BNE" S M="1~All Meals" G SP1
68 S Z1=$E(M1,1) I Z1'="" S M=$S(Z1="B":"2~Break",Z1="N":"3~Noon",1:"4~Even")
69 S Z1=$E(M1,2) I Z1'="" S M=M_","_$S(Z1="B":"Break",Z1="N":"Noon",1:"Even")
70SP1 S:'$D(P(M,KK,P1)) P(M,KK,P1)="" I $L(P(M,KK,P1))+$L(L1)<255 S P(M,KK,P1)=P(M,KK,P1)_$S(P(M,KK,P1)="":"",1:", ")_L1_$S(DAS="Y":" (D)",1:"")
71 E S:'$D(P(M,KK,K)) P(M,KK,K)="" S P(M,KK,K)=L1_$S(DAS="Y":" (D)",1:"") S P1=K
72 Q
73MO ; Display Monitors
74 S Y=$G(^FHPT(FHDFN,"A",FADM,"MO",K,0)) Q:Y="" S N1=N1+1
75 D:$Y'<S1 HF^FHASP Q:ANS="^"
76 W !,$P(Y,"^",1) S DTP=$P(Y,"^",2) D DTP^FH W ", ",DTP
77 S COM=$P(Y,"^",3) W:COM'="" !?5,"Action: ",COM Q
78PRERR ;if Scheduling API returns an error, print error in the report.
79 S FHER=$O(@FHTMP@("ERROR",0))
80 W !!,"*** ERROR in Scheduling API ***"
81 W !,"***",@FHTMP@("ERROR",FHER)," !!!",!
82 Q
Note: See TracBrowser for help on using the repository browser.