VistA-WorldVistAEHR/r/DIETETICS-FH/FHOMSS1.m

60 lines
2.6 KiB
Mathematica

FHOMSS1 ;Hines OIFO/RTK SPECIAL MEALS STATUS LIST ;4/11/03 10:05
;;5.5;DIETETICS;**5**;Jan 28, 2005;Build 53
;
LIST ; Display for cancel/print/authorize screens - First build data in ^TMP
K ^TMP($J),FHLIST S NUM=0,EX="",ENDT=9999999
F FHSMDT=STDT:0 S FHSMDT=$O(^FHPT("SM",FHSMDT)) Q:FHSMDT'>0!(FHSMDT>ENDT) D
.F FHDFN=0:0 S FHDFN=$O(^FHPT("SM",FHSMDT,FHDFN)) Q:FHDFN'>0 D
..S FHSMDTX=$E(FHSMDT,1,7)
..S FHZN=$G(^FHPT(FHDFN,"SM",FHSMDT,0)),FHST=$P(FHZN,U,2) I FHST="C" Q
..I FHS'[FHST Q
..D PATNAME^FHOMUTL I FHDFN="" Q
..S FHLOC=$P(FHZN,U,3) Q:FHLOC=""
..S FHPRORD=$P($G(^FH(119.6,FHLOC,0)),U,4) I FHPRORD="" S FHPRORD=99
..S FHPRORD=$S(FHPRORD<1:99,FHPRORD<10:"0"_FHPRORD,1:FHPRORD)
..S FHLOCNM=$P($G(^FH(119.6,FHLOC,0)),U,1),FHML=$P(FHZN,U,9)
..S FHML=$S(FHML="B":1,FHML="N":2,FHML="E":3)
..S ^TMP($J,FHPRORD_"~"_FHLOCNM,FHSMDTX_"."_FHML,FHPTNM_"~"_FHDFN)=FHZN
..Q
.Q
I '$D(^TMP($J)) Q
D HDR
S FHLSRT="" F S FHLSRT=$O(^TMP($J,FHLSRT)) Q:FHLSRT=""!(EX=U) D
.F FHSMDT=STDT:0 S FHSMDT=$O(^TMP($J,FHLSRT,FHSMDT)) Q:FHSMDT'>0!(FHSMDT>ENDT)!(EX=U) D
..S FHPTN="" F S FHPTN=$O(^TMP($J,FHLSRT,FHSMDT,FHPTN)) Q:FHPTN=""!(EX=U) D
...S FHNODE=$G(^TMP($J,FHLSRT,FHSMDT,FHPTN)),FHSMDTX=$P(FHNODE,U,1)
...S NUM=NUM+1,PAD=$S($L(NUM)=1:" ",1:"") W !,PAD,NUM
...S FHDFN=$P(FHPTN,"~",2) D PATNAME^FHOMUTL W ?4,$E(FHPTNM,1,17)
...S FHSTAT=$P(FHNODE,U,2),FHSTAT=$S(FHSTAT="P":"PENDING",FHSTAT="A":"AUTH",FHSTAT="D":"DENIED",1:"CANCEL")
...S FHD=$$FMTE^XLFDT(FHSMDTX,"P") W ?22,$E(FHD,1,12)
...S FHLPT=$P(FHNODE,U,3),FHLOC=$E($P($G(^FH(119.6,FHLPT,0)),U,1),1,9)
...S FHRMBD=$P(FHNODE,U,13),FHRMBNM=""
...I FHRMBD'="" S FHRMBNM=$E($P($G(^DG(405.4,FHRMBD,0)),U,1),1,9)
...W ?35,FHLOC,?45,FHRMBNM
...S FHDPT=$P(FHNODE,U,4),FHDIET=$E($P($G(^FH(111,FHDPT,0)),U,1),1,12)
...W ?55,FHDIET
...S FHMEAL=$P(FHNODE,U,9) W ?69,FHMEAL,?73,FHSTAT
...S FHLIST(NUM)=FHDFN_"^"_FHSMDTX
...I $E(FHSTAT,1)="D" D
....S FHDENY=$P(FHNODE,U,6) W !?6,"Denied by: "
....I FHDENY'="" W $P($G(^VA(200,FHDENY,0)),U,1)
...S FHCOMM=$P(FHNODE,U,8) I FHCOMM'="" W !?6,"Comment: ",FHCOMM
...I $D(^FHPT(FHDFN,"SM",FHSMDTX,1)) D
....S FHEL=$G(^FHPT(FHDFN,"SM",FHSMDTX,1))
....W !?6,"Early/Late Tray Time: ",$P(FHEL,U,1)
....W " Bagged Meal: ",$P(FHEL,U,2)
.I $Y>(IOSL-4) D PG I EX=U Q
.Q
Q
PG ;
I IOST?1"C".E W ! K DIR S DIR(0)="E" D ^DIR I 'Y S EX=U Q
D HDR Q
HDR ;
W:$Y @IOF
W !?5,"S P E C I A L M E A L S S T A T U S R E P O R T"
W !!!?1,"#",?6,"Name",?23,"Date/Time",?35,"Location",?45,"Room-Bed"
W ?55,"Diet Ordered",?68,"Meal",?73,"Status"
W !,"===",?4,"=================",?22,"============"
W ?35,"========= =========",?55,"============",?68,"====",?73,"======="
Q