GMRYRP3 ;HIRMFO/YH-PATIENT INTAKE/OUTPUT REPORT HEADING ;3/27/97
;;4.0;Intake/Output;;Apr 25, 1997
REPORT1 ;
I 'GQT S GMRX="",$P(GMRX,"-",IOM)="" D TITLE
S GOP=$S(GRPT=1:"D H1",GRPT>1&(GRPT<5):"D H2",GRPT=5!(GRPT=10):"D H3",1:"") Q:GOP="" X GOP
Q
I GQT&(GRPT=1) D FOOTER
I GQT,'GQ,$E(IOST)="C",(GRPT=1!(GRPT=4)) W "Press return to continue or ^ to quit " R X:DTIME I '$T!("^"=X) S GMROUT=1 Q
S GQ=0 W:'($E(IOST)'="C"&'GPC) @IOF
S GQT=1,GPC=GPC+1 S GG=$S(GRPT=1:23,1:20) W !,?GG,"PATIENT INTAKE/OUTPUT SUMMARY",$S(GRPT=2:" (CURRENT)",GRPT=3:" (PREVIOUS DAY)",GRPT=4:" (48 HRS)",1:" ") K GG
D INP^VADPT S GMRVHLOC=$P($G(^DIC(42,+$G(VAIN(4)),44)),"^")
S GFACI=$S(GMRVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMRVHLOC,3,"I"),.01,"I"),1:"")
W !,GMRDT1 W:GRPT=1!(GRPT=4) " - "_GMRDT2 W:GRPT>1&(GRPT<5) " WARD: ",GMRWARD(1)_$S(GFACI'="":" - "_GFACI,1:"") K GFACI W ?70,"PAGE: ",GPC,! W GLN(1),!,GLN(2),!,GLN(3)
W !,$E(GMRX,1,GMRCOL),! Q
BODY ;
I '$D(^TMP($J,"GMRY")) W:GRPT<5 !," NO DATA FOR THIS PERIOD",!! S GQT=1 Q
D INITOT,INISHFT,SHFTP,DAYP S (GRNDIP,GRNDOP)="" D SUM^GMRYRP4
Q
INITOT ;
F II=1:1:GN(1) S GTOTIN(II)=0
F II=1:1:GN(2) S GTOTOUT(II)=0
Q
INISHFT ;
F II=1:1:GN(1) S GIN(II)=0
F II=1:1:GN(2) S GOUT(II)=0
Q
W GMRNAM W:SSN'="" ?17,SSN W:GMRBTH'="" ?32,GMRBTH W:GMRAGE'="" ?42,"(",GMRAGE," YRS)" W:GMRSEX'="" ?53,GMRSEX
W !,"UNIT: " W:GMRWARD(1)'="" ?7,GMRWARD(1) W ?33,"RM/BED: " W:GMRBED'="" ?41,GMRBED W !
D INP^VADPT S GMRVHLOC=$P($G(^DIC(42,+$G(VAIN(4)),44)),"^")
W "DIVISION: "_$S(GMRVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMRVHLOC,3,"I"),.01,"I"),1:""),!
Q
TITLE ;CREATE HEADER FOR I/O SUMMARY REPORT,GTYPI(TYPE)=ORDER,GTYP(O)=ORDER
S GBLNK="",$P(GBLNK," ",80)="",GN(1)=3,GN(2)=0,GLN(1)="INPUT"_$E(GBLNK,1,12),GLN(2)="IV |BLOOD|PARNT|",GLN(3)="FLUID|PRDCT|NUTRI|",GLN(4)=$E(GBLNK,1,16)
F GNN=0:0 S GNN=$O(^GMRD(126.56,"C",GNN)) Q:GNN'>0 D
.S GNN(1)=$O(^GMRD(126.56,"C",GNN,0)) Q:GNN(1)'>0 S GN(1)=GN(1)+1,GLN(1)=GLN(1)_" ",GLN(2)=GLN(2)_" |",GLN(3)=GLN(3)_$E($P(^GMRD(126.56,GNN(1),0),"^")_GBLNK,1,5)_"|",GTYPI(GNN(1))=GN(1)
S GLN(4)=$E(GBLNK,1,GN(1)*6-1)_"|",GLN(1)=GLN(1)_"|OUTPUT"
F GNN=0:0 S GNN=$O(^GMRD(126.58,"C",GNN)) Q:GNN'>0 S GNN(1)=$O(^GMRD(126.58,"C",GNN,0)) Q:GNN(1)'>0 S GN(2)=GN(2)+1,GLN(2)=GLN(2)_" |",GLN(3)=GLN(3)_$E($P(^GMRD(126.58,GNN(1),0),"^")_GBLNK,1,5)_"|",GTYPO(GNN(1))=GN(2)
S GLN(5)="" F GNN=1:1:(GN(1)+GN(2)) S GLN(5)=GLN(5)_" 0|"
Q
H1 ;I/O SUMMARY BY PT
D HEADER Q:GMROUT S GQT=1 D BODY D:'GMROUT FOOTER I $E(IOST)="C"&'GMROUT W "Press return to continue " R X:DTIME S:'$T!(X["^") GMROUT=1 Q
Q
H2 ;I/O SUMMARY
S:GRPT=4 GQ=1 D:('GQT!($E(IOST)="C"))!(GQT&($E(IOST)'="C")&(($Y+5)>IOSL)) HEADER Q:GMROUT W !,"RM/BED : ",GMRBED,?20,GMRNAM,?40,SSN,! D BODY
I $E(IOST)="C"&'GMROUT W "Return to continue or ^ to quit " R X:DTIME S:'$T!(X["^") GMROUT=1 Q
Q
H3 ;SF511 REPORT
D BODY Q
BLANK F X=1:1 W ! Q:IOSL<($Y+$S($E(IOST)="P":4,1:5))
Q
SHFTP ;FIELD TO SAVE '+' CODE FOR SHIFT TOTAL
F II=1:1:GN(1) S GSIP(II)=""
F II=1:1:GN(2) S GSOP(II)=""
Q
DAYP ;FIELD TO SAVE '+' CODE FOR DAY TOTAL
F II=1:1:GN(1) S GDIP(II)=""
F II=1:1:GN(2) S GDOP(II)=""
Q
GMRYRP3 ;HIRMFO/YH-PATIENT INTAKE/OUTPUT REPORT HEADING ;3/27/97
+1 ;;4.0;Intake/Output;;Apr 25, 1997
REPORT1 ;
+1 IF 'GQT
SET GMRX=""
SET $PIECE(GMRX,"-",IOM)=""
DO TITLE
+2 SET GOP=$SELECT(GRPT=1:"D H1",GRPT>1&(GRPT<5):"D H2",GRPT=5!(GRPT=10):"D H3",1:"")
IF GOP=""
QUIT
XECUTE GOP
+3 QUIT
+1 IF GQT&(GRPT=1)
DO FOOTER
+2 IF GQT
IF 'GQ
IF $EXTRACT(IOST)="C"
IF (GRPT=1!(GRPT=4))
WRITE "Press return to continue or ^ to quit "
READ X:DTIME
IF '$TEST!("^"=X)
SET GMROUT=1
QUIT
+3 SET GQ=0
IF '($EXTRACT(IOST)'="C"&'GPC)
WRITE @IOF
+4 SET GQT=1
SET GPC=GPC+1
SET GG=$SELECT(GRPT=1:23,1:20)
WRITE !,?GG,"PATIENT INTAKE/OUTPUT SUMMARY",$SELECT(GRPT=2:" (CURRENT)",GRPT=3:" (PREVIOUS DAY)",GRPT=4:" (48 HRS)",1:" ")
KILL GG
+5 DO INP^VADPT
SET GMRVHLOC=$PIECE($GET(^DIC(42,+$GET(VAIN(4)),44)),"^")
+6 SET GFACI=$SELECT(GMRVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMRVHLOC,3,"I"),.01,"I"),1:"")
+7 WRITE !,GMRDT1
IF GRPT=1!(GRPT=4)
WRITE " - "_GMRDT2
IF GRPT>1&(GRPT<5)
WRITE " WARD: ",GMRWARD(1)_$SELECT(GFACI'="":" - "_GFACI,1:"")
KILL GFACI
WRITE ?70,"PAGE: ",GPC,!
WRITE GLN(1),!,GLN(2),!,GLN(3)
+8 WRITE !,$EXTRACT(GMRX,1,GMRCOL),!
QUIT
BODY ;
+1 IF '$DATA(^TMP($JOB,"GMRY"))
IF GRPT<5
WRITE !," NO DATA FOR THIS PERIOD",!!
SET GQT=1
QUIT
+2 DO INITOT
DO INISHFT
DO SHFTP
DO DAYP
SET (GRNDIP,GRNDOP)=""
DO SUM^GMRYRP4
+3 QUIT
INITOT ;
+1 FOR II=1:1:GN(1)
SET GTOTIN(II)=0
+2 FOR II=1:1:GN(2)
SET GTOTOUT(II)=0
+3 QUIT
INISHFT ;
+1 FOR II=1:1:GN(1)
SET GIN(II)=0
+2 FOR II=1:1:GN(2)
SET GOUT(II)=0
+3 QUIT
+1 WRITE GMRNAM
IF SSN'=""
WRITE ?17,SSN
IF GMRBTH'=""
WRITE ?32,GMRBTH
IF GMRAGE'=""
WRITE ?42,"(",GMRAGE," YRS)"
IF GMRSEX'=""
WRITE ?53,GMRSEX
+2 WRITE !,"UNIT: "
IF GMRWARD(1)'=""
WRITE ?7,GMRWARD(1)
WRITE ?33,"RM/BED: "
IF GMRBED'=""
WRITE ?41,GMRBED
WRITE !
+3 DO INP^VADPT
SET GMRVHLOC=$PIECE($GET(^DIC(42,+$GET(VAIN(4)),44)),"^")
+4 WRITE "DIVISION: "_$SELECT(GMRVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMRVHLOC,3,"I"),.01,"I"),1:""),!
+5 QUIT
TITLE ;CREATE HEADER FOR I/O SUMMARY REPORT,GTYPI(TYPE)=ORDER,GTYP(O)=ORDER
+1 SET GBLNK=""
SET $PIECE(GBLNK," ",80)=""
SET GN(1)=3
SET GN(2)=0
SET GLN(1)="INPUT"_$EXTRACT(GBLNK,1,12)
SET GLN(2)="IV |BLOOD|PARNT|"
SET GLN(3)="FLUID|PRDCT|NUTRI|"
SET GLN(4)=$EXTRACT(GBLNK,1,16)
+2 FOR GNN=0:0
SET GNN=$ORDER(^GMRD(126.56,"C",GNN))
IF GNN'>0
QUIT
Begin DoDot:1
+3 SET GNN(1)=$ORDER(^GMRD(126.56,"C",GNN,0))
IF GNN(1)'>0
QUIT
SET GN(1)=GN(1)+1
SET GLN(1)=GLN(1)_" "
SET GLN(2)=GLN(2)_" |"
SET GLN(3)=GLN(3)_$EXTRACT($PIECE(^GMRD(126.56,GNN(1),0),"^")_GBLNK,1,5)_"|"
SET GTYPI(GNN(1))=GN(1)
End DoDot:1
+4 SET GLN(4)=$EXTRACT(GBLNK,1,GN(1)*6-1)_"|"
SET GLN(1)=GLN(1)_"|OUTPUT"
+5 FOR GNN=0:0
SET GNN=$ORDER(^GMRD(126.58,"C",GNN))
IF GNN'>0
QUIT
SET GNN(1)=$ORDER(^GMRD(126.58,"C",GNN,0))
IF GNN(1)'>0
QUIT
SET GN(2)=GN(2)+1
SET GLN(2)=GLN(2)_" |"
SET GLN(3)=GLN(3)_$EXTRACT($PIECE(^GMRD(126.58,GNN(1),0),"^")_GBLNK,1,5)_"|"
SET GTYPO(GNN(1))=GN(2)
+6 SET GLN(5)=""
FOR GNN=1:1:(GN(1)+GN(2))
SET GLN(5)=GLN(5)_" 0|"
+7 QUIT
H1 ;I/O SUMMARY BY PT
+1 DO HEADER
IF GMROUT
QUIT
SET GQT=1
DO BODY
IF 'GMROUT
DO FOOTER
IF $EXTRACT(IOST)="C"&'GMROUT
WRITE "Press return to continue "
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
QUIT
+2 QUIT
H2 ;I/O SUMMARY
+1 IF GRPT=4
SET GQ=1
IF ('GQT!($EXTRACT(IOST)="C"))!(GQT&($EXTRACT(IOST)'="C")&(($Y+5)>IOSL))
DO HEADER
IF GMROUT
QUIT
WRITE !,"RM/BED : ",GMRBED,?20,GMRNAM,?40,SSN,!
DO BODY
+2 IF $EXTRACT(IOST)="C"&'GMROUT
WRITE "Return to continue or ^ to quit "
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
QUIT
+3 QUIT
H3 ;SF511 REPORT
+1 DO BODY
QUIT
BLANK FOR X=1:1
WRITE !
IF IOSL<($Y+$SELECT($EXTRACT(IOST)="P"
QUIT
+1 QUIT
SHFTP ;FIELD TO SAVE '+' CODE FOR SHIFT TOTAL
+1 FOR II=1:1:GN(1)
SET GSIP(II)=""
+2 FOR II=1:1:GN(2)
SET GSOP(II)=""
+3 QUIT
DAYP ;FIELD TO SAVE '+' CODE FOR DAY TOTAL
+1 FOR II=1:1:GN(1)
SET GDIP(II)=""
+2 FOR II=1:1:GN(2)
SET GDOP(II)=""
+3 QUIT