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

82 lines
4.6 KiB
Mathematica

FHOMPP1 ;Hines OIFO/RTK Patient Profile for CPRS (continued) ;6/07/04 9:05
;;5.5;DIETETICS;**1**;Jan 28, 2005
;
S FHB="" F I=1:1:80 S FHB=FHB_" "
S X1=STDT,X2=-1 D C^%DTC S STDT=X
I '$O(^FHPT(FHDFN,"OP","B",STDT)) S N=1 D NEWL^FHOMPP S ^TMP($J,"FHPROF",DFN,FHX)="No Recurring Meals to Display" Q
K FHLIST S EX="",NUM=0 D HDR
F FHRMDT=STDT:0 S FHRMDT=$O(^FHPT(FHDFN,"OP","B",FHRMDT)) Q:FHRMDT'>0!(EX=U) F FHRNUM=0:0 S FHRNUM=$O(^FHPT(FHDFN,"OP","B",FHRMDT,FHRNUM)) Q:FHRNUM'>0!(EX=U) D
.S NUM=NUM+1,FHNODE=$G(^FHPT(FHDFN,"OP",FHRNUM,0))
.S FHRM=$P(FHNODE,U,1)
.S FHDOW=$$DOW^XLFDT(FHRM),FHDOW=$E(FHDOW,1,3)
.S FHDTP=$$FMTE^XLFDT(FHRM,"P") S N=0 D NEWL^FHOMPP S ^TMP($J,"FHPROF",DFN,FHX)=NUM S FHJ=7 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_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
.S FHJ=27 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_FHLOC
.S FHJ=39 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_$E(FHSRVPT,1,9)
.S FHJ=52 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_$P(FHNODE,U,4)
.S FHJ=57 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_$P(FHNODE,U,5)
.I $P($G(^FH(119.6,FHLPT,1)),U,4)="Y" D DIETPAT S FHJ=61 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_$E(FHDIETP,1,12)
.E S FHDPTR=$P(FHNODE,U,2) S FHJ=61 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_$E($P($G(^FH(111,FHDPTR,0)),U,1),1,12)
.S FHSTAT=$P(FHNODE,U,15) I FHSTAT="C" S FHJ=77 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_"C"
.I $D(^FHPT(FHDFN,"OP",FHRNUM,1)) D
..S N=0 D NEWL^FHOMPP
..S FHNODE1=$G(^FHPT(FHDFN,"OP",FHRNUM,1))
..S FHSTATA=$P(FHNODE1,U,5) I FHSTATA="C" S ^TMP($J,"FHPROF",DFN,FHX)=" Additional Orders: "_$E($P(FHNODE1,U,1),1,46) S FHJ=77 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_"C" Q
..S ^TMP($J,"FHPROF",DFN,FHX)=" Additional Orders: "_$P(FHNODE1,U,1)
.I $D(^FHPT(FHDFN,"OP",FHRNUM,2)) D
..S N=0 D NEWL^FHOMPP
..S FHNODE2=$G(^FHPT(FHDFN,"OP",FHRNUM,2))
..S FHEL=FHNODE2
..S ^TMP($J,"FHPROF",DFN,FHX)=" Early/Late Tray Time: "_$P(FHEL,U,1)_" Bagged Meal: "_$P(FHEL,U,2)
..S FHSTATE=$P(FHNODE2,U,6) I FHSTATE="C" S FHJ=77 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_"C" Q
.I $D(^FHPT(FHDFN,"OP",FHRNUM,3)) D
..S N=0 D NEWL^FHOMPP
..S FHNODE3=$G(^FHPT(FHDFN,"OP",FHRNUM,3))
..S FHTU=FHNODE3
..S ^TMP($J,"FHPROF",DFN,FHX)=" Tubefeeding: " S FHSTATT=$P(FHTU,U,5) I FHSTATT="C" S FHJ=77 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_"C"
..S N=0 D NEWL^FHOMPP
..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)
...I $P(FHTUZN,U,3)["CC" D
....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
...S ^TMP($J,"FHPROF",DFN,FHX)=" "_$P($G(^FH(118.2,FHTUPTR,0)),U,1)_" Strength: "_$S(FHTUSTR=1:"1/4",FHTUSTR=2:"1/2",FHTUSTR=3:"3/4",1:"FULL")_" Quantity: "_$P(FHTUZN,U,3)
...S N=0 D NEWL^FHOMPP
...S ^TMP($J,"FHPROF",DFN,FHX)=" Total ML's: "_$P(FHTU,U,2)_" Total KCALS/DAY: "_$P(FHTU,U,3)
..S FHTCOMM=$P(FHTU,U,1) I FHTCOMM'="" S N=0 D NEWL^FHOMPP S ^TMP($J,"FHPROF",DFN,FHX)="Comment: "_FHTCOMM
.Q
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
HDR ;
;S ^TMP($J,"FHPROF",DFN,FHX)=" OUTPATIENT NAME: " D PATNAME^FHOMUTL S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_FHPTNM_" "_FHSSN
;S FHJ=66 D PAD S ^TMP($J,"FHPROF",DFN,FHX)=^TMP($J,"FHPROF",DFN,FHX)_PAD_FHSEX_" Age "_FHAGE
S N=1 D NEWL^FHOMPP
S ^TMP($J,"FHPROF",DFN,FHX)=" Ordering Service"
S N=0 D NEWL^FHOMPP
S ^TMP($J,"FHPROF",DFN,FHX)=" # Date/Time Location Point Meal Bag Diet Ordered Status"
S N=0 D NEWL^FHOMPP
S ^TMP($J,"FHPROF",DFN,FHX)="=== ================== ========== ========== ==== === ============ ======"
Q
PAD ;
S FHU=^TMP($J,"FHPROF",DFN,FHX),A=$L(FHU),PAD=$E(FHB,1,FHJ-A)
Q
END ;
K EX,FHDIET,FHDIETP,FHDIETS,FHDTP,FHFIND,FHLOC,FHLPT,FHNODE,FHRM
K FHRNUM,FHDPTR,FHDNM Q