FHMNPRT ;Hines OIFO/RTK - Dietetics Monitor Report Print ;02/08/06 10:29
;;5.5;DIETETICS;**4**;Jan 28, 2005;Build 32
;
PRINT ;
K FHMNTT S PG=0,EX="" D NOW^%DTC S Y=X D DD^%DT S FHNDT=Y D HDR
S (ALLMON,M1,M2,M3,M4,M5)=0
I FHNXIEN'="ALL",'$D(FHDATA(FHNXIEN)) D MESSAGE Q
I FHNXIEN'="ALL" S ZZ=FHNXIEN D DISP,D1END Q
I FHNXIEN="ALL" S ZZ="" F S ZZ=$O(FHDATA(ZZ)) Q:ZZ=""!(EX=U) D
.D DISP
.S ALLMON=ALLMON+MON
.S M1=M1+MON1,M2=M2+MON2,M3=M3+MON3,M4=M4+MON4,M5=M5+MON5
.Q
I FHNXIEN'="ALL"!(EX=U) D END Q
I ALLMON=0 W !!?5,"NO PATIENTS WITH MONITORS IN GIVEN DATE RANGE" D END Q
W !!?16,"Totals for ALL ",$S(FHSORT="C":"Clinicians.......: ",1:"Wards............: "),$J(ALLMON,3)
W !?16,"Monitor: Albumin ...............: ",$J(M1,3)," ",$J(((M1/ALLMON)*100),1,2),"%"
W !?16,"Monitor: BMI .....................: ",$J(M2,3)," ",$J(((M2/ALLMON)*100),1,2),"%"
W !?16,"Monitor: NPO+Clr Liq > 3 days...: ",$J(M3,3)," ",$J(((M3/ALLMON)*100),1,2),"%"
W !?16,"Monitor: On Hyperals............: ",$J(M4,3)," ",$J(((M4/ALLMON)*100),1,2),"%"
W !?16,"Monitor: On Tubefeeding.........: ",$J(M5,3)," ",$J(((M5/ALLMON)*100),1,2),"%"
I $Y>(IOSL-4) D PG I EX=U Q
W !!!,"TOTAL ADMISSIONS....:",?23,FHTADM
W !,"TOTAL MONITORS......:",?23,ALLMON
I FHTADM>0 W !,"PERCENTAGE..........:",?23,$J(((ALLMON/FHTADM)*100),1,2),"%"
;
D1END I IOST?1"C".E,EX'=U W ! K DIR S DIR(0)="E" D ^DIR
D END Q
DISP ;
I FHSORT="C" W !!?25,"CLINICIAN: ",ZZ
I FHSORT="W" W !!?25,"WARD: ",ZZ
S (TOT,MON,MON1,MON2,MON3,MON4,MON5)=0
F YY=0:0 S YY=$O(FHDATA(ZZ,YY)) Q:YY'>0 D
.F HH=0:0 S HH=$O(FHDATA(ZZ,YY,HH)) Q:HH'>0!(EX=U) D
..I $Y>(IOSL-4) D PG I EX=U Q
..S DFN=$P(FHDATA(ZZ,YY,HH),U,5)
..S Y=YY X ^DD("DD") W !,Y
..W ?13,$P(FHDATA(ZZ,YY,HH),U,1)
..W ?39,$P(FHDATA(ZZ,YY,HH),U,2)
..W ?47,$P(FHDATA(ZZ,YY,HH),U,6)
..I $P(FHDATA(ZZ,YY,HH),U,3)="Yes" D
...F NUM=0:0 S NUM=$O(FHMON(DFN,HH,NUM)) Q:NUM'>0!(EX=U) D
....I NUM'=1 W !
....S MON=MON+1,MONTYP=$P($P(FHMON(DFN,HH,NUM),U,1),": ",2)
....S PC=$S(MONTYP["Albumin":1,MONTYP["BMI":2,MONTYP["NPO+Clr":3,MONTYP["Hyper":4,1:5)
....I $G(FHMNTT(ZZ))="" S FHMNTT(ZZ)=""
....S $P(FHMNTT(ZZ),U,PC)=$P(FHMNTT(ZZ),U,PC)+1
....W ?56,MONTYP I $Y>(IOSL-4) D PG I EX=U Q
....Q
...Q
..S TOT=TOT+1
..Q
.Q
I EX=U Q
W !!?16,"Total Number of Monitors........: ",$J(MON,3) I $Y>(IOSL-4) D PG I EX=U Q
S PCE=$P(FHMNTT(ZZ),U,1) I PCE>0 W !?16,"Monitor: Albumin ...............: ",$J(PCE,3)," ",$J(((PCE/MON)*100),1,2),"%" S MON1=PCE I $Y>(IOSL-4) D PG I EX=U Q
S PCE=$P(FHMNTT(ZZ),U,2) I PCE>0 W !?16,"Monitor: BMI .....................: ",$J(PCE,3)," ",$J(((PCE/MON)*100),1,2),"%" S MON2=PCE I $Y>(IOSL-4) D PG I EX=U Q
S PCE=$P(FHMNTT(ZZ),U,3) I PCE>0 W !?16,"Monitor: NPO+Clr Liq > 3 days...: ",$J(PCE,3)," ",$J(((PCE/MON)*100),1,2),"%" S MON3=PCE I $Y>(IOSL-4) D PG I EX=U Q
S PCE=$P(FHMNTT(ZZ),U,4) I PCE>0 W !?16,"Monitor: On Hyperals............: ",$J(PCE,3)," ",$J(((PCE/MON)*100),1,2),"%" S MON4=PCE I $Y>(IOSL-4) D PG I EX=U Q
S PCE=$P(FHMNTT(ZZ),U,5) I PCE>0 W !?16,"Monitor: On Tubefeeding.........: ",$J(PCE,3)," ",$J(((PCE/MON)*100),1,2),"%" S MON5=PCE
W ! Q
;
MESSAGE ;
W !!?5,"NO PATIENTS WITH MONITORS IN GIVEN DATE RANGE"
W !?10,"FOR THIS ",$S(FHSORT="C":"CLINICIAN",1:"WARD"),": ",FHNXIEN
Q
END K FHMNTT,HH,M1,M2,M3,M4,M5,MON,MON1,MON2,MON3,MON4,MON5,MONTYP
K NUM,PC,PCE,PG,PER,TOT,YY
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 ;Header
W:$Y @IOF W !,FHNDT,?60,"Page: " S PG=PG+1 W PG,!!
W "Admission",?13,"Patient",?39,"SSN",?45,"Status",?56,"Monitor(s)"
W ! F Z=1:1:79 W "="
Q
FHMNPRT ;Hines OIFO/RTK - Dietetics Monitor Report Print ;02/08/06 10:29
+1 ;;5.5;DIETETICS;**4**;Jan 28, 2005;Build 32
+2 ;
PRINT ;
+1 KILL FHMNTT
SET PG=0
SET EX=""
DO NOW^%DTC
SET Y=X
DO DD^%DT
SET FHNDT=Y
DO HDR
+2 SET (ALLMON,M1,M2,M3,M4,M5)=0
+3 IF FHNXIEN'="ALL"
IF '$DATA(FHDATA(FHNXIEN))
DO MESSAGE
QUIT
+4 IF FHNXIEN'="ALL"
SET ZZ=FHNXIEN
DO DISP
DO D1END
QUIT
+5 IF FHNXIEN="ALL"
SET ZZ=""
FOR
SET ZZ=$ORDER(FHDATA(ZZ))
IF ZZ=""!(EX=U)
QUIT
Begin DoDot:1
+6 DO DISP
+7 SET ALLMON=ALLMON+MON
+8 SET M1=M1+MON1
SET M2=M2+MON2
SET M3=M3+MON3
SET M4=M4+MON4
SET M5=M5+MON5
+9 QUIT
End DoDot:1
+10 IF FHNXIEN'="ALL"!(EX=U)
DO END
QUIT
+11 IF ALLMON=0
WRITE !!?5,"NO PATIENTS WITH MONITORS IN GIVEN DATE RANGE"
DO END
QUIT
+12 WRITE !!?16,"Totals for ALL ",$SELECT(FHSORT="C":"Clinicians.......: ",1:"Wards............: "),$JUSTIFY(ALLMON,3)
+13 WRITE !?16,"Monitor: Albumin ...............: ",$JUSTIFY(M1,3)," ",$JUSTIFY(((M1/ALLMON)*100),1,2),"%"
+14 WRITE !?16,"Monitor: BMI .....................: ",$JUSTIFY(M2,3)," ",$JUSTIFY(((M2/ALLMON)*100),1,2),"%"
+15 WRITE !?16,"Monitor: NPO+Clr Liq > 3 days...: ",$JUSTIFY(M3,3)," ",$JUSTIFY(((M3/ALLMON)*100),1,2),"%"
+16 WRITE !?16,"Monitor: On Hyperals............: ",$JUSTIFY(M4,3)," ",$JUSTIFY(((M4/ALLMON)*100),1,2),"%"
+17 WRITE !?16,"Monitor: On Tubefeeding.........: ",$JUSTIFY(M5,3)," ",$JUSTIFY(((M5/ALLMON)*100),1,2),"%"
+18 IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+19 WRITE !!!,"TOTAL ADMISSIONS....:",?23,FHTADM
+20 WRITE !,"TOTAL MONITORS......:",?23,ALLMON
+21 IF FHTADM>0
WRITE !,"PERCENTAGE..........:",?23,$JUSTIFY(((ALLMON/FHTADM)*100),1,2),"%"
+22 ;
D1END IF IOST?1"C".E
IF EX'=U
WRITE !
KILL DIR
SET DIR(0)="E"
DO ^DIR
+1 DO END
QUIT
DISP ;
+1 IF FHSORT="C"
WRITE !!?25,"CLINICIAN: ",ZZ
+2 IF FHSORT="W"
WRITE !!?25,"WARD: ",ZZ
+3 SET (TOT,MON,MON1,MON2,MON3,MON4,MON5)=0
+4 FOR YY=0:0
SET YY=$ORDER(FHDATA(ZZ,YY))
IF YY'>0
QUIT
Begin DoDot:1
+5 FOR HH=0:0
SET HH=$ORDER(FHDATA(ZZ,YY,HH))
IF HH'>0!(EX=U)
QUIT
Begin DoDot:2
+6 IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+7 SET DFN=$PIECE(FHDATA(ZZ,YY,HH),U,5)
+8 SET Y=YY
XECUTE ^DD("DD")
WRITE !,Y
+9 WRITE ?13,$PIECE(FHDATA(ZZ,YY,HH),U,1)
+10 WRITE ?39,$PIECE(FHDATA(ZZ,YY,HH),U,2)
+11 WRITE ?47,$PIECE(FHDATA(ZZ,YY,HH),U,6)
+12 IF $PIECE(FHDATA(ZZ,YY,HH),U,3)="Yes"
Begin DoDot:3
+13 FOR NUM=0:0
SET NUM=$ORDER(FHMON(DFN,HH,NUM))
IF NUM'>0!(EX=U)
QUIT
Begin DoDot:4
+14 IF NUM'=1
WRITE !
+15 SET MON=MON+1
SET MONTYP=$PIECE($PIECE(FHMON(DFN,HH,NUM),U,1),": ",2)
+16 SET PC=$SELECT(MONTYP["Albumin":1,MONTYP["BMI":2,MONTYP["NPO+Clr":3,MONTYP["Hyper":4,1:5)
+17 IF $GET(FHMNTT(ZZ))=""
SET FHMNTT(ZZ)=""
+18 SET $PIECE(FHMNTT(ZZ),U,PC)=$PIECE(FHMNTT(ZZ),U,PC)+1
+19 WRITE ?56,MONTYP
IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+20 QUIT
End DoDot:4
+21 QUIT
End DoDot:3
+22 SET TOT=TOT+1
+23 QUIT
End DoDot:2
+24 QUIT
End DoDot:1
+25 IF EX=U
QUIT
+26 WRITE !!?16,"Total Number of Monitors........: ",$JUSTIFY(MON,3)
IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+27 SET PCE=$PIECE(FHMNTT(ZZ),U,1)
IF PCE>0
WRITE !?16,"Monitor: Albumin ...............: ",$JUSTIFY(PCE,3)," ",$JUSTIFY(((PCE/MON)*100),1,2),"%"
SET MON1=PCE
IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+28 SET PCE=$PIECE(FHMNTT(ZZ),U,2)
IF PCE>0
WRITE !?16,"Monitor: BMI .....................: ",$JUSTIFY(PCE,3)," ",$JUSTIFY(((PCE/MON)*100),1,2),"%"
SET MON2=PCE
IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+29 SET PCE=$PIECE(FHMNTT(ZZ),U,3)
IF PCE>0
WRITE !?16,"Monitor: NPO+Clr Liq > 3 days...: ",$JUSTIFY(PCE,3)," ",$JUSTIFY(((PCE/MON)*100),1,2),"%"
SET MON3=PCE
IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+30 SET PCE=$PIECE(FHMNTT(ZZ),U,4)
IF PCE>0
WRITE !?16,"Monitor: On Hyperals............: ",$JUSTIFY(PCE,3)," ",$JUSTIFY(((PCE/MON)*100),1,2),"%"
SET MON4=PCE
IF $Y>(IOSL-4)
DO PG
IF EX=U
QUIT
+31 SET PCE=$PIECE(FHMNTT(ZZ),U,5)
IF PCE>0
WRITE !?16,"Monitor: On Tubefeeding.........: ",$JUSTIFY(PCE,3)," ",$JUSTIFY(((PCE/MON)*100),1,2),"%"
SET MON5=PCE
+32 WRITE !
QUIT
+33 ;
MESSAGE ;
+1 WRITE !!?5,"NO PATIENTS WITH MONITORS IN GIVEN DATE RANGE"
+2 WRITE !?10,"FOR THIS ",$SELECT(FHSORT="C":"CLINICIAN",1:"WARD"),": ",FHNXIEN
+3 QUIT
END KILL FHMNTT,HH,M1,M2,M3,M4,M5,MON,MON1,MON2,MON3,MON4,MON5,MONTYP
+1 KILL NUM,PC,PCE,PG,PER,TOT,YY
+2 QUIT
PG ;
+1 IF IOST?1"C".E
WRITE !
KILL DIR
SET DIR(0)="E"
DO ^DIR
IF 'Y
SET EX=U
QUIT
+2 DO HDR
QUIT
HDR ;Header
+1 IF $Y
WRITE @IOF
WRITE !,FHNDT,?60,"Page: "
SET PG=PG+1
WRITE PG,!!
+2 WRITE "Admission",?13,"Patient",?39,"SSN",?45,"Status",?56,"Monitor(s)"
+3 WRITE !
FOR Z=1:1:79
WRITE "="
+4 QUIT