Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FHOMRR1

FHOMRR1.m

Go to the documentation of this file.
FHOMRR1 ;Hines OIFO/RTK RECURRING MEALS REVIEW/DISPLAY  ;2/04/03  14:05
 ;;5.5;DIETETICS;**1,5**;Jan 28, 2005;Build 53
 ;11/30/05 patch 5 - added outpatient standing order & SFs.
 ;
STRT K FHPSDT D GETOPT^FHOMUTL I FHFIND=0 Q
 I STDT="" Q
 D ENDATE^FHOMUTL I ENDT="" Q
 S ENDT=ENDT_.99
 D DEV D STRT Q
 ;I IOST?1"C".E W ! K DIR S DIR(0)="E" D ^DIR Q
 ;
DEV ;get device and set up queue
 W ! K %ZIS,IOP S %ZIS="Q" D ^%ZIS Q:POP
 I '$D(IO("Q")) U IO D DISP,^%ZISC,END Q
 S ZTRTN="DISP^FHOMRR1"
 S ZTSAVE("STDT")="",ZTSAVE("FHDFN")=""
 S ZTDESC="Outpatient Meals Recurring Meals Display" D ^%ZTLOAD
 D ^%ZISC K %ZIS,IOP
 D END Q
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)) Q:FHNODE=""
 .I $P(FHNODE,U,15)="C" Q
 .S FHRM=$P(FHNODE,U,1)
 .S NUM=NUM+1,PAD=$S($L(NUM)=1:" ",1:"") W !,PAD,NUM
 .S FHLIST(NUM)=FHRNUM_"^"_FHRM
 .S FHDTP=$$FMTE^XLFDT(FHRM,"P") W ?5,$E(FHDTP,1,12)
 .S FHRMBD=$P(FHNODE,U,18),FHRMBNM=""
 .I FHRMBD'="" S FHRMBNM=$E($P($G(^DG(405.4,FHRMBD,0)),U,1),1,11)
 .S FHLPT=$P(FHNODE,U,3),FHLOCZN=$G(^FH(119.6,FHLPT,0)) D
 ..S FHLOC=$E($P(FHLOCZN,U,1),1,11),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 ?19,FHLOC,?31,FHRMBNM,?44,$E(FHSRVPT,1,11),?58,$P(FHNODE,U,4)
 .I $P($G(^FH(119.6,FHLPT,1)),U,4)="Y" D DIETPAT W ?63,$E(FHDIETP,1,17)
 .I $P($G(^FH(119.6,FHLPT,1)),U,4)'="Y" S FHDPTR=$P(FHNODE,U,2) Q:FHDPTR=""  W ?63,$E($P($G(^FH(111,FHDPTR,0)),U,1),1,17)
 .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)) I $P(FHNODE1,U,5)="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 I $P(FHNODE2,U,6)="C" Q
 ..W !?7,"Early/Late Tray Time: ",$P(FHEL,U,1)
 ..W "  Bagged Meal: ",$P(FHEL,U,2)
 .I $D(^FHPT(FHDFN,"OP",FHRNUM,3)) D
 ..S FHNODE3=$G(^FHPT(FHDFN,"OP",FHRNUM,3))
 ..S FHTU=FHNODE3 I $P(FHTU,U,5)="C" Q
 ..W !?7,"Tubefeeding: "
 ..F FHTZ=0:0 S FHTZ=$O(^FHPT(FHDFN,"OP",FHRNUM,"TF",FHTZ)) Q:FHTZ'>0!(EX=U)  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)
 ...I $Y>(IOSL-4) D PG I EX=U Q
 ..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
 .Q:EX=U  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'="" QUIT     ;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
 .Q:EX=U  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))
 ..Q:EX=U  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 !?5,"R E C U R R I N G   M E A L   D I S P L A Y"
 W !!?3,"OUTPATIENT NAME: " D PATNAME^FHOMUTL W FHPTNM,"   ",FHSSN
 W ?65,FHSEX," Age ",FHAGE
 W !!," #",?5,"Date/Time",?19,"Location    Room-Bed",?44,"Service Pnt"
 W ?57,"Meal",?63,"Diet Ordered"
 W !,"===",?5,"============",?19,"=========== ==========="
 W ?44,"===========",?57,"====",?63,"================="
 Q
END ;
 K ENDT,EX,FHDIET,FHDIETP,FHDIETS,FHDTP,FHFIND,FHLOC,FHLPT,FHNODE,FHRM,DIR,BID,DFN,FHDFN
 K FHRNUM,FHDPTR,FHDNM,FHAGE,FHBID,FHDFN,FHDOB,FHDOW,FHDTDF,FHI,FHLIST,FHLOCZN,FHPCZN
 K FHPTNM,FHRMDT,FHSERV,FHSEX,FHSF1,FHSF10,FHSF2,FHSF8,FHSFDAT,FHSRV,FHSRVPT,FHSSN,FHTZ,FHTZCNT,FHTZSO
 K FHTZSO2,FHTZSO6,FHTZSO8,FHTZSOCN,FHTZSOL,FHTZSON,FHZ115,FILE,FLAG,IEN,IEN200,J,NUM,PAD,PCE,PID,POP,SF,STDT
 Q