source: WorldVistAEHR/trunk/r/DIETETICS-FH/FHNO31.m@ 1375

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

initial load of WorldVistAEHR

File size: 5.4 KB
RevLine 
[613]1FHNO31 ; HISC/REL - Supplemental Feeding Lists (cont) ;4/27/93 11:26
2 ;;5.5;DIETETICS;**5,8**;Jan 28, 2005;Build 28
3 K C F L=0:0 S L=$O(^FH(118,L)) Q:L<1 I '$D(^FH(118,L,"I")) S C(L)=$P(^(0),"^",1)
4 D NOW^%DTC S (NOW,DTP)=%,DT=%\1 D DTP^FH S X1=DT,X2=-14 D C^%DTC S OLD=+X
5 K ^TMP("FH",$J) S PG=0
6 F KK=0:0 S KK=$O(^FH(119.6,KK)) Q:KK<1 S X=^(KK,0) D F0
7 S NXW="" F KK=0:0 S NXW=$O(^TMP("FH",$J,NXW)) Q:NXW="" F WRD=0:0 S WRD=$O(^TMP("FH",$J,NXW,WRD)) Q:WRD<1 D F2
8 Q
9 ;
10F0 I XX="S" S K1=$P(X,"^",9) I WRDS,K1'=WRDS Q
11 I XX="W",WRDS,KK'=WRDS Q
12 S K1=$S(XX="W":"",K1<1:99,K1<10:"0"_K1,1:K1),P0=$P(X,"^",4),P0=$S(P0<1:99,P0<10:"0"_P0,1:P0)
13 S WRDN=$P(^FH(119.6,KK,0),"^",1),^TMP("FH",$J,K1_P0_$E(WRDN,1,26),KK)="" Q
14 ;
15F2 S WRDN=$P(^FH(119.6,WRD,0),"^",1)
16 ;I $O(^FHPT("AW",WRD,0))<1 Q
17 K ^TMP($J) F FHDFN=0:0 S FHDFN=$O(^FHPT("AW",WRD,FHDFN)) Q:FHDFN<1 S ADM=$G(^FHPT("AW",WRD,FHDFN)) D RM
18 ;PROCESS outpatient SF.
19 I '$D(^TMP($J)) D OSF I $D(^TMP($J)) D HDR D OSF1 Q
20 ;
21 Q:'$D(^TMP($J)) D HDR
22 S (NR,RM)="",FHPAR=0 I XX="S",WRDS S FHPAR=$P($G(^FH(119.74,WRDS,0)),"^",5)="Y"
23L2 S NR=$O(^TMP($J,"P",NR)) I NR="" W ! D:FHPAR ING Q
24 S FHDFN=""
25L3 S FHDFN=$O(^TMP($J,"P",NR,FHDFN)) G:FHDFN="" L2 S ADM=$G(^TMP($J,"P",NR,FHDFN)) G:ADM<1 L3 D PATNAME^FHOMUTL G:DFN="" L2 S Y(0)=^DPT(DFN,0) D PID^FHDPA
26 S RM=$S(PRN="R":NR,$D(^DPT(DFN,.101)):^(.101),1:"")
27 S (NO,Y)="" I $D(^FHPT(FHDFN,"A",ADM,0)) S NO=$P(^(0),"^",7),IS=$P(^(0),"^",10)
28 G:'NO L3 S Y=^FHPT(FHDFN,"A",ADM,"SF",NO,0),NM=$P(Y,"^",4),LST=$P(Y,"^",30)\1
29 I IS S IS=$P($G(^FH(119.4,IS,0)),"^",3) S:IS'="N" IS=""
30 I NM S NM=$P(^FH(118.1,NM,0),"^",2) I NM="" S NM=$P(^(0),"^",1)
31 D:$Y>(IOSL-8) HDR W !!,RM,?13,$E($P(Y(0),"^",1),1,24),?38,BID
32 W ?47,$E(NM,1,10) W:IS'="" ?60,"*NURSE" W ?69,$E(LST,4,5),"-",$E(LST,6,7) W:LST<OLD "*"
33 D ALG^FHCLN W !,"ALLERGIES: ",$S(ALG="":"NONE ON FILE",1:ALG)
34 S L=4 F K1=1:1:3 S K=0,N(K1)="" F K2=1:1:4 S Z=$P(Y,U,L+1),Q=$P(Y,U,L+2),L=L+2 I Z'="" S:'Q Q=1 S:N(K1)'="" N(K1)=N(K1)_"; " S N(K1)=N(K1)_Q_" "_$S($D(C(Z)):C(Z),$D(^FH(118,+Z,0)):$P(^(0),"^",1),1:"") I FHPAR D L4
35 F K1=1:1:3 I N(K1)'="" W !?8,$P("10AM; 2PM; 8PM",";",K1),?14,N(K1)
36 G L3
37 ;
38L4 S:'$D(^TMP($J,"I",K1,Z)) ^TMP($J,"I",K1,Z)=0 S ^(Z)=^(Z)+Q Q
39ING Q:'$D(^TMP($J,"I")) S DTP=DT D DTP^FH W @IOF,!,WRDN," INGREDIENT LIST FOR ",DTP
40 W !!,"--- 10 AM ---",?26,"--- 2 PM ---",?52,"--- 8 PM ---",! S (N(1),N(2),N(3))=.5
41 F L=0:0 Q:(N(1)+N(2)+N(3))=0 W ! F K=1:1:3 S:N(K)>0 N(K)=$O(^TMP($J,"I",K,N(K))) I N(K)>0 S Z=N(K) W ?(K-1*26),$J(^(Z),4,0)," ",$S($D(C(Z)):C(Z),$D(^FH(118,+Z,0)):$P(^(0),"^",1),1:"")
42 W ! Q
43RM ;
44 D PATNAME^FHOMUTL I DFN="" Q
45 Q:'$D(^DPT(DFN,0)) Q:ADM<1
46 Q:'$D(^FHPT(FHDFN,"A",ADM,0)) S X1=^(0),NO=$P(X1,"^",7) Q:'NO
47 D CHK Q:'NO
48 I PRN="R" S RM=$G(^DPT(DFN,.101))
49 E S RM=$P($G(^DPT(DFN,0)),"^",1)
50 S:RM="" RM=" "
51 S ^TMP($J,"P",RM,FHDFN)=ADM Q
52 ;
53CHK S FHORD=$P(X1,"^",2),X1=$P(X1,"^",3) G:FHORD<1 C1
54 I X1>1,X1'>NOW G C2
55C0 I '$D(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0)) G C2
56 S X1=$P(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0),"^",7) I X1'="",X1'="X" S NO=""
57C1 K FHORD,A1,K,X1 Q
58C2 S A1=0 F K=0:0 S K=$O(^FHPT(FHDFN,"A",ADM,"AC",K)) Q:K<1!(K>NOW) S A1=K
59 G:'A1 C1 S FHORD=$P(^FHPT(FHDFN,"A",ADM,"AC",A1,0),"^",2) G:FHORD'<1 C0
60 K ^FHPT(FHDFN,"A",ADM,"AC",A1) G C2
61 ;
62HDR ; Print Header
63 W:'($E(IOST,1,2)'="C-"&'PG) @IOF S PG=PG+1
64 W !?10,"W A R D S U P P L E M E N T A L F E E D I N G L I S T",?72,"Page ",PG
65 W !!,"Ward: ",WRDN,?61,DTP
66 W !!,"ROOM",?13,"PATIENT",?39,"ID# SUPP MENU",?60,"ISOLAT",?69,"REVIEW" Q
67 ;
68OSF ;outpatient SFs
69 F FHDFN=0:0 S FHDFN=$O(^FHPT("RM",DT,FHDFN)) Q:FHDFN'>0 F ADM=0:0 S ADM=$O(^FHPT("RM",DT,FHDFN,ADM)) Q:ADM'>0 D
70 .S X1=$G(^FHPT(FHDFN,"OP",ADM,0)),FHNO=$P($G(^FHPT(FHDFN,"OP",ADM,"SF",0)),U,3) Q:'$G(FHNO)
71 .S FHMEAL=$P(X1,U,4),FHOWARD=$P(X1,U,3)
72 .I (WRD'=FHOWARD)!(FHMEAL="") Q
73 .S FHSFDAT=""
74 .I $D(^FHPT(FHDFN,"OP",ADM,"SF",FHNO,0)) S FHSFDAT=^(0)
75 .Q:$P(FHSFDAT,U,32)
76 .S RM=$S(FHMEAL="N":2,FHMEAL="E":3,1:1)
77 .I $G(FHOWARD),($G(^FH(119.6,FHOWARD,0))) S WRDN=$P($G(^FH(119.6,FHOWARD,0)),U,1)
78 .S P1=$S(FHMEAL="N":13,FHMEAL="E":21,1:5)
79 .D PATNAME^FHOMUTL
80 .S RM="",RMIEN=$P(X1,U,18) I $G(RMIEN),$D(^DG(405.4,RMIEN,0)) S RM=$E($P(^DG(405.4,RMIEN,0),U,1),1,10)
81 .S:RM="" RM=" "
82 .I PRN="A" S ^TMP($J,"P",FHPTNM,RM,ADM)=FHDFN
83 .I PRN="R" S ^TMP($J,"P",RM,FHPTNM,ADM)=FHDFN
84 .;S ^TMP($J,"P",FHPTNM,RM,ADM)=FHDFN
85 Q
86 ;
87OSF1 S FHPTN="",FHPAR=0 I XX="S",WRDS S FHPAR=$P($G(^FH(119.74,WRDS,0)),"^",5)="Y"
88OL2 S FHPTN=$O(^TMP($J,"P",FHPTN)) I FHPTN="" W ! D:FHPAR ING Q
89 S NR="",ADM=0
90 ;
91OL3 S NR=$O(^TMP($J,"P",FHPTN,NR)) G:NR="" OL2
92 S RM=$S(PRN="R":FHPTN,1:NR)
93OL4 S ADM=$O(^TMP($J,"P",FHPTN,NR,ADM)) G:ADM<1 OL3 S FHDFN=^TMP($J,"P",FHPTN,NR,ADM) D PATNAME^FHOMUTL
94 S (NO,Y,IS)="" I $D(^FHPT(FHDFN,"OP",ADM,0)) S NO=$P(^FHPT(FHDFN,"OP",ADM,"SF",0),"^",3),IS=$P(^FHPT(FHDFN,0),"^",5)
95 G:'NO OL4 S Y=^FHPT(FHDFN,"OP",ADM,"SF",NO,0),NM=$P(Y,"^",4),LST=$P(Y,"^",30)\1
96 I IS S IS=$P($G(^FH(119.4,IS,0)),"^",3) S:IS'="N" IS=""
97 I NM S NM=$P(^FH(118.1,NM,0),"^",2) I NM="" S NM=$P(^(0),"^",1)
98 D:$Y>(IOSL-8) HDR I $D(FHPTSAV),FHPTSAV'=FHPTN W !
99 W !,RM,?13,$E(FHPTNM,1,24),?38,FHBID
100 W ?47,$E(NM,1,10) W:IS'="" ?60,"*NURSE" W ?69,$E(LST,4,5),"-",$E(LST,6,7) W:LST<OLD "*"
101 D ALG^FHCLN W !,"ALLERGIES: ",$S(ALG="":"NONE ON FILE",1:ALG)
102 S L=4 F K1=1:1:3 S K=0,N(K1)="" F K2=1:1:4 S Z=$P(Y,U,L+1),Q=$P(Y,U,L+2),L=L+2 I Z'="" S:'Q Q=1 S:N(K1)'="" N(K1)=N(K1)_"; " S N(K1)=N(K1)_Q_" "_$S($D(C(Z)):C(Z),$D(^FH(118,+Z,0)):$P(^(0),"^",1),1:"") I FHPAR D L4
103 F K1=1:1:3 I N(K1)'="" W !?8,$P("10AM; 2PM; 8PM",";",K1),?14,N(K1)
104 S FHPTSAV=FHPTN
105 G OL4
Note: See TracBrowser for help on using the repository browser.