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

GMRYFLW1.m

Go to the documentation of this file.
GMRYFLW1 ;HIRMFO/YH-INTRAVENOUS INFUSION FLOW SHEET CONT. ;8/9/96
 ;;4.0;Intake/Output;;Apr 25, 1997
REPORT I "Pp"[GMREDB D HEADER1^GMRYFLW2 G:GMROUT Q1 I '$D(^TMP($J)) W !!,"NO DATA FOR THIS REPORT",!!!!!!!! G Q2
 I "SsWw"[GMREDB D HEADER1^GMRYFLW2 I '$D(^TMP($J)) W !!,?5,"NO DATA FOR THIS REPORT",!!!!!!!! G Q2
 S GST="",GDATA(1)=GLINE I $D(^TMP($J,"GMRY")) S (GSTM,GSDAY)=0,GSITE="" F  S GSITE=$O(^TMP($J,"GMRY",GSITE)) Q:GSITE=""!GMROUT  S GDTIME=0 F  S GDTIME=$O(^TMP($J,"GMRY",GSITE,GDTIME)) Q:GDTIME'>0!GMROUT  D LINE Q:GMROUT
 I 'GMROUT,$D(^TMP($J,"GMR")) D
 .S GNOIV=1,GIN=0 F  S GIN=$O(^TMP($J,"GMR",GIN)) Q:GIN'>0  D NXT
 W:'GMROUT GDATA(1),!
Q I 'GMROUT&(IOSL'<($Y+$S($E(IOST)="P":6,1:11))) F X=1:1 W GLINE,! Q:IOSL<($Y+$S($E(IOST)="P":6,1:11))
Q2 I 'GMROUT D FOOTER^GMRYFLW2 I $E(IOST)="C" W "Press return to continue or ^ to quit " S X="" R X:DTIME S:'$T!(X["^") GMROUT=1
Q1 K ^TMP($J),GPORT,GHOLD,GREASON,GSCOND,GNOIV Q
LINE ;
 S GIN=0 F  S GIN=$O(^TMP($J,"GMRY",GSITE,GDTIME,GIN)) Q:GIN'>0!GMROUT  D IVLINE:GIN<999,WRT^GMRYFLW2:GIN=999 Q:GMROUT
 Q
IVLINE ;
 S (GDATA(2),GDATA)=^TMP($J,"GMRY",GSITE,GDTIME,GIN) S GTOTAL=+$P(GDATA,"^",5),GDATE=$P(GDTIME,"."),(GHOLD,GTIME)=GDTIME,GDC=$S($P(GDATA,"^",9)'="":$P(GDATA,"^",9,11),1:"") D I Q:GMROUT  D LINE2^GMRYFLW2 Q:GMROUT
 G:$P(GDATA,"^",4)="L" NXT
 I $D(^GMR(126,DFN,"IV",GIN,"IN",0)) D GMRUT^GMRYFLW2
 I $D(^GMR(126,DFN,"IV",GIN,"TITR",0)) D GMRTITR^GMRYFLW2
 I '$D(^TMP($J,"GMR",GIN)) Q
NXT S (GIN(2),GDT)=0 F  S GDT=$O(^TMP($J,"GMR",GIN,GDT)) Q:GDT'>0!GMROUT  S GDA=0 F  S GDA=$O(^TMP($J,"GMR",GIN,GDT,GDA)) Q:GDA'>0!GMROUT  D IN:GDA<998,IC:GDA=999,TR:GDA=998
 K ^TMP($J,"GMR",GIN) W GLINE,! Q
I ;IV RECORD
 S GSOL=$P(GDATA,"^",3),GPORT=$P(GDATA,"^",13),GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",7))
 D WRTDT^GMRYFLW2 S GDATA(1)=$E(GDATA(1),1,15)_$E($P(GSOL,";")_GBLNK,1,20)_$E(GDATA(1),36,132)
 S GDATA(1)=$E(GDATA(1),1,36)_$S($P(GDATA,"^",12)'="":$E($P(GDATA,"^",12)_"   ",1,4),1:"    ")_$E(GDATA(1),41,132)
 I $P(GDATA,"^",4)="L" D FLUSH^GMRYFLW2 Q
 S GDATA(1)=$E(GDATA(1),1,41)_$E($P(GDATA,"^",5)_"    ",1,4)_$E(GDATA(1),46,132),GDATA(1)=$E(GDATA(1),1,46)_"0    |"_$E($P(GDATA,"^",2)_GBLNK,1,16)_"|"
 S GCATH=$E($P(GDATA,"^",6)_GBLNK,1,16) S GDATA(1)=GDATA(1)_GCATH_$E(GLINE,86,132)
 I '$D(^TMP($J,"GMRY",GSITE,GDTIME,999))&('$D(^TMP($J,"GMR",GIN,GDTIME,999))) D WRTLINE^GMRYFLW2 Q
 I $D(^TMP($J,"GMRY",GSITE,GDTIME,999)) S GDATA=^(999) D TUBE Q:GMROUT  K ^TMP($J,"GMRY",GSITE,GDTIME,999) Q
 I $D(^TMP($J,"GMR",GIN,GDTIME,999)) S GDATA=^(999) D TUBE Q:GMROUT  K ^TMP($J,"GMR",GIN,GDTIME,999) S GDATA=GDATA(2) Q
 Q
IC ;SITECARE
 S GDATA=^TMP($J,"GMR",GIN,GDT,GDA),GDATE=$P(GDT,"."),GTIME=GDT D WRTDT^GMRYFLW2 Q:GMROUT 
 S GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",5)) S GNURSE=$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20)),GDATA(1)=$E(GDATA(1),1,15)_GNURSE_$E(GDATA(1),36,132)
 D TUBE
 Q
TUBE S GDATA(1)=$E(GDATA(1),1,86)_$S($P(GDATA,"^",3)["Y":"yes ",1:"no  ")_"|"_$S($P(GDATA,"^",4)["Y":"yes ",1:"no  ")_$E(GLINE,96,132)
 S GSCOND=$P($G(GDATA),"^",2),GLEN=$L(GSCOND,",")
 S GDATA(1)=$E(GDATA(1),1,116)_$S(GLEN>0:$E($P(GSCOND,",")_GBLNK,1,13),1:"NO REDNESS/PA")
 I $D(GNOIV) D
 .S GSITE=$P($G(^GMR(126,DFN,"IV",GIN,0)),"^",2),GPORT=$G(^GMR(126,DFN,"IV",GIN,3))
 .S GDATA(1)=$E(GDATA(1),1,52)_$E(GSITE_GBLNK,1,16)_"|"_$E(GPORT_GBLNK,1,15)_$E(GDATA(1),85,132)
 .Q
 D WRTLINE^GMRYFLW2
 I $G(GLEN)>1 D  F G=2:1:GLEN S GDATA(1)=$E(GLINE,1,116)_$E($P(GSCOND,",",G)_GBLNK,2,13) D WRTLINE^GMRYFLW2
 Q
TR ;INFUSION RATE
 S GDATA=^TMP($J,"GMR",GIN,GDT,GDA),GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",3)),GDATE=$P(GDT,"."),GTIME=GDT D WRTDT^GMRYFLW2 Q:GMROUT
 S GDATA(1)=$E(GDATA(1),1,15)_$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20))_"|"_$E($S(+$P(GDATA,"^",2)>0:$P(GDATA,"^",2)_"    ",1:"*    "),1,4)_$E(GLINE,41,132)
 D WRTLINE^GMRYFLW2 Q
IN ;
 S GIN(2)=GIN(2)+1,GDATA=^TMP($J,"GMR",GIN,GDT,GDA),GDATE=$P(GDT,"."),GTIME=GDT D WRTDT^GMRYFLW2 Q:GMROUT
 S GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",4)) S GDATA(1)=$E(GDATA(1),1,15)_$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20))_$E(GDATA(1),36,132)
 S GABSORB=$S($P(GDATA,"^",2)["*":"*",1:GTOTAL-$P(GDATA,"^",2)),GDATA(1)=$E(GDATA(1),1,41)_$E($P(GDATA,"^",2)_GBLNK,1,4)_"|"_$E(GABSORB_GBLNK,1,5)_$E(GDATA(1),52,132)
 S GREASON="",GREASON(1)=0
 I GIN(1)=GIN(2)&(GDC'="") D  K ^TMP($J,"GMRY",GSITE,+$P(GDC,"^"),999)
 .S GREASON=$P($G(GDC),"^",3) I GREASON'="" K ^UTILITY($J,"W") S X=GREASON,DIWF="",DIWL=0,DIWR=13 D ^DIWP S GREASON(1)=+$G(^UTILITY($J,"W",0))
 .S GDATA(1)=$E(GDATA(1),1,96)_"yes  |"_$E($G(^UTILITY($J,"W",0,1,0))_GBLNK,1,13)_$E(GDATA(1),116,132)
 .I $D(^TMP($J,"GMRY",GSITE,+$P(GDC,"^"),999)) S GDATA=^(999) D DC^GMRYFLW2
 D WRTLINE^GMRYFLW2
 S GLEN(1)=$L($G(GSCOND),","),GLEN=$S(GREASON(1)>GLEN(1)!(GREASON(1)=GLEN(1)):GREASON(1),GLEN(1)>GREASON(1):GLEN(1),1:0)
 I GLEN>1 D SCOND^GMRYFLW2
 Q