124 lines
5.4 KiB
Mathematica
124 lines
5.4 KiB
Mathematica
FHOMRMD ;Hines OIFO/RTK/FAI RECURRING MEALS REVIEW/DISPLAY ;10/20/04 13:22
|
|
;;5.5;DIETETICS;**1,5**;Jan 28, 2005;Build 53
|
|
;patch #5 - added outpatient SOs & SFs.
|
|
;
|
|
DISP ;
|
|
S X1=STDT,X2=-1 D C^%DTC S STDT=X
|
|
I '$O(^FHPT(FHDFN,"OP","B",STDT)) W !!,"No Recurring Meals to Display" Q
|
|
K FHLIST S EX="",NUM=0 D HDR I $G(ENDT)="" S ENDT=9999999.99
|
|
F FHRMDT=STDT:0 S FHRMDT=$O(^FHPT(FHDFN,"OP","B",FHRMDT)) Q:FHRMDT'>0!(FHRMDT>ENDT)!(EX=U) F FHRNUM=0:0 S FHRNUM=$O(^FHPT(FHDFN,"OP","B",FHRMDT,FHRNUM)) Q:FHRNUM'>0!(EX=U) D
|
|
.S FHNODE=$G(^FHPT(FHDFN,"OP",FHRNUM,0))
|
|
.S FHRM=$P(FHNODE,U,1)
|
|
.S NUM=NUM+1,PAD=$S($L(NUM)<3:3-$L(NUM),1:1) W !?PAD,NUM
|
|
.S FHLIST(NUM)=FHRNUM_"^"_FHRM
|
|
.S FHDOW=$$DOW^XLFDT(FHRM),FHDOW=$E(FHDOW,1,3)
|
|
.S FHDTP=$$FMTE^XLFDT(FHRM,"P") W ?6,FHDOW," - ",$E(FHDTP,1,12)
|
|
.S FHLPT=$P(FHNODE,U,3),FHLOCZN=$G(^FH(119.6,FHLPT,0)) D
|
|
..S FHLOC=$E($P(FHLOCZN,U,1),1,10),FHSERV=$P(FHLOCZN,U,10)
|
|
..S FHSRV=$S(FHSERV["T":$P(FHLOCZN,U,5),FHSERV["C":$P(FHLOCZN,U,6),1:"")
|
|
..I FHSRV="" S FHSRVPT="" Q
|
|
..S FHSRVPT=$P($G(^FH(119.72,FHSRV,0)),U,1)
|
|
..Q
|
|
.W ?26,FHLOC,?38,$E(FHSRVPT,1,9)
|
|
.W ?51,$P(FHNODE,U,4),?56,$P(FHNODE,U,5)
|
|
.I $P($G(^FH(119.6,FHLPT,1)),U,4)="Y" D DIETPAT W ?60,$E(FHDIETP,1,12)
|
|
.I $P($G(^FH(119.6,FHLPT,1)),U,4)'="Y" S FHDPTR=$P(FHNODE,U,2) Q:FHDPTR="" W ?60,$E($P($G(^FH(111,FHDPTR,0)),U,1),1,12)
|
|
.S FHSTAT=$P(FHNODE,U,15) I FHSTAT="C" W ?76,"C"
|
|
.I $Y>(IOSL-4) D PG I EX=U Q
|
|
.I $D(^FHPT(FHDFN,"OP",FHRNUM,1)) D
|
|
..S FHNODE1=$G(^FHPT(FHDFN,"OP",FHRNUM,1))
|
|
..S FHSTATA=$P(FHNODE1,U,5) I FHSTATA="C" W !?7,"Additional Orders: ",$E($P(FHNODE1,U,1),1,46),?76,"C" Q
|
|
..W !?7,"Additional Orders: ",$P(FHNODE1,U,1)
|
|
.I $D(^FHPT(FHDFN,"OP",FHRNUM,2)) D
|
|
..S FHNODE2=$G(^FHPT(FHDFN,"OP",FHRNUM,2))
|
|
..S FHEL=FHNODE2
|
|
..W !?7,"Early/Late Tray Time: ",$P(FHEL,U,1)
|
|
..W " Bagged Meal: ",$P(FHEL,U,2)
|
|
..S FHSTATE=$P(FHNODE2,U,6) I FHSTATE="C" W ?76,"C"
|
|
.I $D(^FHPT(FHDFN,"OP",FHRNUM,3)) D
|
|
..S FHNODE3=$G(^FHPT(FHDFN,"OP",FHRNUM,3))
|
|
..S FHTU=FHNODE3
|
|
..W !?7,"Tubefeeding: " S FHSTATT=$P(FHTU,U,5) I FHSTATT="C" W ?76,"C"
|
|
..F FHTZ=0:0 S FHTZ=$O(^FHPT(FHDFN,"OP",FHRNUM,"TF",FHTZ)) Q:FHTZ'>0 D
|
|
...S FHTUZN=$G(^FHPT(FHDFN,"OP",FHRNUM,"TF",FHTZ,0))
|
|
...S FHTUPTR=$P(FHTUZN,U,1),FHTUSTR=$P(FHTUZN,U,2)
|
|
...W !?9,$P($G(^FH(118.2,FHTUPTR,0)),U,1)," Strength: "
|
|
...W $S(FHTUSTR=1:"1/4",FHTUSTR=2:"1/2",FHTUSTR=3:"3/4",1:"FULL")
|
|
...I $P(FHTUZN,U,3)["CC" D ;print ml instead of cc.
|
|
....S QUA=$P(FHTUZN,U,3)
|
|
....S QUAFI=$P(QUA,"CC",1),QUASE=$P(QUA,"CC",2)
|
|
....S $P(FHTUZN,U,3)=QUAFI_"ML"_QUASE
|
|
...W " Quantity: ",$P(FHTUZN,U,3)
|
|
..W !?7,"Total ML's: ",$P(FHTU,U,2)," Total KCALS/DAY: ",$P(FHTU,U,3)
|
|
..S FHTCOMM=$P(FHTU,U,1) I FHTCOMM'="" W !?7,"Comment: ",FHTCOMM
|
|
.;outpatient SOs.
|
|
.I $D(^FHPT(FHDFN,"OP",FHRNUM,"SP")) D
|
|
..I $Y>(IOSL-4) D PG I EX=U Q
|
|
..W !,?7,"Standing Orders:"
|
|
..S FHTZSOL=23,FHTZCNT=0
|
|
..F FHTZ=0:0 S FHTZ=$O(^FHPT(FHDFN,"OP",FHRNUM,"SP",FHTZ)) Q:FHTZ'>0 D
|
|
...S FHTZSO=$G(^FHPT(FHDFN,"OP",FHRNUM,"SP",FHTZ,0))
|
|
...S FHTZSO2=$P(FHTZSO,U,2)
|
|
...S FHTZSO6=$P(FHTZSO,U,6)
|
|
...S FHTZSO8=$P(FHTZSO,U,8)
|
|
...S FHTZSOCN="" I FHTZSO6'="" S FHTZSOCN=" (C) "
|
|
...I $G(FHTZSO2),$D(^FH(118.3,FHTZSO2,0)) D
|
|
....S FHTZSON=$P(^FH(118.3,FHTZSO2,0),U,1)
|
|
....S FHTZSOL=FHTZSOL+$L(FHTZSON)+$L(FHTZSOCN)+7
|
|
....I FHTZSOL>80 W !,?23 S FHTZSOL=30+$L(FHTZSON)+$L(FHTZSOCN),FHTZCNT=0
|
|
....I $G(FHTZCNT) W ", ",FHTZSON,FHTZSOCN," = ",FHTZSO8
|
|
....E W " ",FHTZSON,FHTZSOCN," = ",FHTZSO8
|
|
....S FHTZCNT=FHTZCNT+1
|
|
.I $D(^FHPT(FHDFN,"OP",FHRNUM,"SF")) D
|
|
..Q:'$D(^FHPT(FHDFN,"OP",FHRNUM,"SF",0))
|
|
..S SF=""
|
|
..I $D(^FHPT(FHDFN,"OP",FHRNUM,"SF",0)) S SF=$P(^(0),U,3)
|
|
..Q:'SF
|
|
..S FHSFDAT=$G(^FHPT(FHDFN,"OP",FHRNUM,"SF",SF,0))
|
|
..I SF,$P(FHSFDAT,U,32) Q
|
|
..I $Y>(IOSL-4) D PG I EX=U Q
|
|
..W !,?7,"Supplemental Feeding: " I $P(FHSFDAT,U,4),$D(^FH(118.1,$P(FHSFDAT,U,4),0)) W $P(^(0),U,1)
|
|
..S FHSF10=$P(FHSFDAT,U,5,12)
|
|
..S FHSF2=$P(FHSFDAT,U,13,20)
|
|
..S FHSF8=$P(FHSFDAT,U,21,28)
|
|
..I FHSF10'["^^^^^^^" D
|
|
...W !,?9,"10AM:"
|
|
...F FHI=1,3,5,7 S FHSF1=$P(FHSF10,U,FHI) I FHSF1,$D(^FH(118,FHSF1,0)) W " ",$P(^FH(118,FHSF1,0),U,1)," = ",$S('$P(FHSF10,U,FHI+1):1,1:$P(FHSF10,U,FHI+1))
|
|
..I FHSF2'["^^^^^^^" D
|
|
...I $Y>(IOSL-4) D PG I EX=U Q
|
|
...W !,?9,"2PM:"
|
|
...F FHI=1,3,5,7 S FHSF1=$P(FHSF2,U,FHI) I FHSF1,$D(^FH(118,FHSF1,0)) W " ",$P(^FH(118,FHSF1,0),U,1)," = ",$S('$P(FHSF2,U,FHI+1):1,1:$P(FHSF2,U,FHI+1))
|
|
..I FHSF8'["^^^^^^^" D
|
|
...I $Y>(IOSL-4) D PG I EX=U Q
|
|
...W !,?9,"8PM:"
|
|
...F FHI=1,3,5,7 S FHSF1=$P(FHSF8,U,FHI) I FHSF1,$D(^FH(118,FHSF1,0)) W " ",$P(^FH(118,FHSF1,0),U,1)," = ",$S('$P(FHSF8,U,FHI+1):1,1:$P(FHSF8,U,FHI+1))
|
|
.Q
|
|
W ! Q
|
|
DIETPAT ;
|
|
S FHDIETS=$P($G(^FHPT(FHDFN,"OP",FHRNUM,0)),U,7,11)
|
|
S FHDIETP=""
|
|
F PCE=1:1:5 D
|
|
.S FHDPTR=$P(FHDIETS,U,PCE) I FHDPTR="" Q
|
|
.S FHDNM=$P($G(^FH(111,FHDPTR,0)),U,7)
|
|
.I FHDNM="" S FHDNM=$P($G(^FH(111,FHDPTR,0)),U,1)
|
|
.S FHDIETP=FHDIETP_FHDNM_"," Q
|
|
S FHDIETP=$E(FHDIETP,1,$L(FHDIETP)-1)
|
|
Q
|
|
PG ;
|
|
Q:$O(^FHPT(FHDFN,"OP","B",FHRMDT))'>0
|
|
I IOST?1"C".E W ! K DIR S DIR(0)="E" D ^DIR I 'Y S EX=U Q
|
|
D HDR Q
|
|
HDR ;
|
|
I $G(FHPP)'=1 W:$Y @IOF
|
|
K FHPP W !?15,"R E C U R R I N G M E A L S"
|
|
W !!?3,"NAME: " D PATNAME^FHOMUTL W FHPTNM," ",FHSSN
|
|
W !!?27,"Ordering",?38,"Service"
|
|
W !?2,"#",?6,"Date/Time",?27,"Location",?38,"Point"
|
|
W ?50,"Meal",?55,"Bag",?60,"Diet Ordered",?74,"Status"
|
|
W !?1,"===",?6,"==================",?26,"=========="
|
|
W ?38,"==========",?50,"====",?55,"===",?60,"============",?74,"======"
|
|
Q
|
|
END ;
|
|
K EX,FHDIET,FHDIETP,FHDIETS,FHDTP,FHFIND,FHLOC,FHLPT,FHNODE,FHRM
|
|
K FHRNUM,FHDPTR,FHDNM,FHTZCNT,FHTZSON,FHTZSOCN,FHTZSO8,FHTZSOL,FHTZSO2,FHTZSO6,FHTZ,FHTZSO Q
|