source: WorldVistAEHR/trunk/r/GEN_MED_REC_IO-GMRY/GMRYSE2.m@ 701

Last change on this file since 701 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1GMRYSE2 ;HIRMFO/YH-ITEMIZED PATIENT I/O REPORT BY SHIFT PART 3 ;3/11/97
2 ;;4.0;Intake/Output;**2**;Apr 25, 1997
3SUM ;
4 S (GSAVEH,GCURDT,GDATE)=0 F II=0:0 S GDATE=$O(^TMP($J,"GMRY",GDATE)) D:GDATE'>0 SDATE Q:GMROUT!(GDATE'>0) D:GCURDT'=GDATE SDATE Q:GMROUT D SHIFT Q:GMROUT
5 K GHOLD Q
6SHIFT ;
7 S (GCSFT,GSFT)="" F II=0:0 S GSFT=$O(^TMP($J,"GMRY",GDATE,GSFT)) D:GCSFT'=GSFT WSHIFT Q:GSFT=""!(GMROUT) D CHKHD Q:GMROUT S GSHIFT=$S(GSFT="SH-1":"NIGHT",GSFT="SH-2":"DAY",GSFT="SH-3":"EVENING",1:" ") W ?2,GSHIFT_":",! D IOSUM Q:GMROUT
8 Q
9IOSUM ;
10 S GIO="",(GPRT(1),GPRT(2),GPRT(3))=0 F II=0:0 S GIO=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO)) Q:GIO=""!(GMROUT) W ?4,"ITEMIZED "_$S(GIO="IV":"IV INTAKE",GIO="IN":"NON-IV INTAKE",GIO="OUT":"OUTPUT",1:""),! S GHOLD=0 D IOTIME Q:GMROUT
11 Q
12IOTIME ;
13 S GHR=0 F II=0:0 S GHR=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR)) Q:GHR'>0!(GMROUT) S GOPT=$S(GIO="IN"!(GIO="OUT"):"IOTYPE",GIO="IV":"SUMIV",1:"") Q:GOPT="" D @GOPT Q:GMROUT
14 Q
15IOTYPE ;
16 S GTYPE="" F S GTYPE=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GTYPE)) Q:GTYPE=""!(GMROUT) S GSUB=0 F S GSUB=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GTYPE,GSUB)) Q:GSUB'>0!(GMROUT) D ADD Q:GMROUT
17 Q
18ADD ;
19 I GIO="IN",$D(GTYPI(GTYPE)) D Q
20 . S GIN=GTYPI(GTYPE),GDATA=^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GTYPE,GSUB),GAMOUNT=$P(GDATA,"^"),GIN(GIN)=GIN(GIN)+GAMOUNT,GTOTIN(GIN)=GTOTIN(GIN)+GAMOUNT
21 . I GAMOUNT'>0,GAMOUNT'="0" S (GSIP(GIN),GDIP(GIN),GRNDIP)="+"
22 . D NPOS^GMRYSE1 Q
23 I GIO="OUT",$D(GOUT(GTYPE)) D Q
24 . S GDATA=^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GTYPE,GSUB),GAMOUNT=$P(GDATA,"^"),GOUT(GTYPE)=GOUT(GTYPE)+GAMOUNT,GTOTOUT(GTYPE)=GTOTOUT(GTYPE)+GAMOUNT
25 . I GAMOUNT'>0,GAMOUNT'="0" S (GSOP(GTYPE),GDOP(GTYPE),GRNDOP)="+"
26 . D NPOS^GMRYSE1 Q
27 I GIO="IV" D Q
28 . S GAMOUNT=GAMT Q:GAMOUNT>2000000 S GIN(GIN)=GIN(GIN)+GAMOUNT,GTOTIN(GIN)=GTOTIN(GIN)+GAMOUNT
29 . I $P(GDATA,"^",6)="*" S (GSIP(GIN),GDIP(GIN),GRNDIP)="+"
30 Q
31SUMIV ;
32 S GIVDT=0 F II=0:0 S GIVDT=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT)) Q:GIVDT'>0!(GMROUT) D IVLINE Q:GMROUT
33 Q
34IVLINE ;
35 S GIVTYP="" F S GIVTYP=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT,GIVTYP)) Q:GIVTYP=""!(GMROUT) S GSUB=0 F S GSUB=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT,GIVTYP,GSUB)) Q:GSUB'>0!GMROUT D WIVINF^GMRYSE3 Q:GMROUT
36 Q
37WSHIFT ;
38 D CHKHD Q:GMROUT
39 I GCSFT="" S GCSFT=GSFT Q
40 D CHKHD Q:GMROUT W !,?2,"*** ",GSHIFT," shift total: ",! D CHKHD Q:GMROUT
41 W ?6,"Intake:",! F II=1:1:GN(1) Q:GMROUT D
42 . I GIN(II)>0!(GSIP(II)="+") D CHKHD Q:GMROUT D ILABEL^GMRYSE1 W ?8,GLAB," ",$E(GMRDOT,1,18-$L(GLAB)),?25," ",$S(GIN(II)=0&(GSIP(II)="+"):GSIP(II),1:GIN(II)_GSIP(II))_" mls",!
43 Q:GMROUT
44 D CHKHD Q:GMROUT W ?6,"Output:",! F II=1:1:GN(2) D G:GMROUT Q2
45 . I GOUT(II)>0!(GSOP(II)="+") D CHKHD Q:GMROUT D OLABEL^GMRYSE1 W ?8,GLAB," ",$E(GMRDOT,1,18-$L(GLAB)),?25," ",$S(GOUT(II)=0&(GSOP(II)="+"):GSOP(II),1:GOUT(II)_GSOP(II))_" mls",!
46 S:GSFT'="" GCSFT=GSFT D INISHFT^GMRYRP3,SHFTP^GMRYSE1
47Q2 Q
48SDATE ;
49 I GCURDT=0 S GCURDT=GDATE S GY=$E(GCURDT,4,5)_"/"_$E(GCURDT,6,7)_"/"_$E(GCURDT,2,3) W GY,! Q
50 D DAYTOT Q:GDATE'>0!(GMROUT) S GCURDT=GDATE,GY=$E(GCURDT,4,5)_"/"_$E(GCURDT,6,7)_"/"_$E(GCURDT,2,3) D CHKHD Q:GMROUT W GMRX,!,GY,!
51 Q
52DAYTOT ;
53 D CHKHD Q:GMROUT W $E(GMRX,1,21),!,"Summary for: ",GY,! D CHKHD Q:GMROUT W ?2,"Intake:",! S GTOTLI=0 F II=1:1:GN(1) Q:GMROUT I GTOTIN(II)>0!(GDIP(II)="+") D CHKHD Q:GMROUT D ILABEL^GMRYSE1,WRITEI
54 Q:GMROUT I GRPT<9 D CHKHD Q:GMROUT W ?2,"Output:",! S GTOTLO=0 F II=1:1:GN(2) I GTOTOUT(II)>0!(GDOP(II)="+") D CHKHD G:GMROUT Q3 D OLABEL^GMRYSE1 D
55 . W ?4,GLAB," ",$E(GMRDOT,1,18-$L(GLAB)),?25," ",$S(GTOTOUT(II)=0&(GDOP(II)="+"):GDOP(II),1:GTOTOUT(II)_GDOP(II))_" mls",! S GTOTLO=GTOTLO+GTOTOUT(II)
56 D CHKHD Q:GMROUT W ?2,"Total intake measured: ",$S(GTOTLI=0&(GRNDIP="+"):GRNDIP,1:GTOTLI_GRNDIP)_" mls",! D:GRPT<9 CHKHD Q:GMROUT W:GRPT<9 ?2,"Total output measured: ",$S(GTOTLO=0&(GRNDOP="+"):GRNDOP,1:GTOTLO_GRNDOP)_" mls",!
57 D INITOT^GMRYRP3,DAYP^GMRYSE1 S (GRNDIP,GRNDOP)=""
58Q3 Q
59CHKHD ;
60 I ($Y+10)>IOSL D HEADER2^GMRYSE1
61 Q
62WRITEI W ?4,GLAB," ",$E(GMRDOT,1,18-$L(GLAB)),?25," ",$S(GTOTIN(II)=0&(GDIP(II)="+"):GDIP(II),1:GTOTIN(II)_GDIP(II))_" mls",! S GTOTLI=GTOTLI+GTOTIN(II) Q
Note: See TracBrowser for help on using the repository browser.