VistA-FOIAVistA/r/GEN_MED_REC_IO-GMRY/GMRYFLW0.m

49 lines
3.0 KiB
Mathematica

GMRYFLW0 ;HIRMFO/YH-INTRAVENOUS INFUSION FLOW SHEET ;1/25/93
;;4.0;Intake/Output;;Apr 25, 1997
EN1 ;IV FLOW SHEET
S GMROUT=0,GRPT=8 D DATE^GMRYRP1 G:GMROUT Q S GMROP(1)=$S($D(GMRNUR):"WARDPAT^GMRYUT4",1:"MASPT^GMRYRP5") D @GMROP(1) G:GMROUT Q
DEV W !,$C(7),"** THIS REPORT NEEDS 132 COLUMNS - PORT/LAND **" D DEV^GMRYRP0 I POP G Q
I IOM<81 D ^%ZISC G DEV
I $D(IO("Q")) K IO("Q"),IO("C") S ZTDESC="IV FLOW SHEET",ZTRTN="START^GMRYFLW0",ZTIO=ION_";"_IOM_";"_IOSL D LOOP,^%ZTLOAD D Q2^GMRYRP0 K GMRNAM,GMRWARD Q
START ;
U IO
S GPC=0,GDASH="",$P(GDASH,"-",132)="",GBLNK="",$P(GBLNK," ",132)="",GMROUT=0
S GLINE="" F I=8,5,20,4,4,5,16,16,4,4,5,13 S GLINE=GLINE_$E(GBLNK,1,I)_"|"
S GLINE=$E(GLINE_GBLNK,1,132),GQT=0,GQ=0
I "Pp"[GMREDB D PATIENT^GMRYUT9,SETARRY,REPORT^GMRYFLW1,Q,Q2^GMRYRP0 Q
I "SsWw"[GMREDB D:$D(GMRNUR) PATIENT^GMRYUT11
G:'$D(^TMP("GMRPT",$J)) Q
S GROOM="" F J=0:0 S GROOM=$O(^TMP("GMRPT",$J,GROOM)) Q:GROOM=""!GMROUT S GBED="" F J=0:0 S GBED=$O(^TMP("GMRPT",$J,GROOM,GBED)) Q:GBED=""!GMROUT S DFN=0 F J=0:0 S DFN=$O(^TMP("GMRPT",$J,GROOM,GBED,DFN)) Q:DFN'>0!GMROUT D PRNT Q:GMROUT
D Q D Q2^GMRYRP0 K GMRNAM,GMRWARD Q
LOOP F X="GNRMBD(","^TMP(""GMRPT"",$J,","GMROUT","GMRNUR","GMRFIN","GMRSTRT","GMREDB","GRPT","DFN","GMRCOL","GMRWARD","GMRWARD(" S ZTSAVE(X)=""
Q
PRNT S (GQ,GQT)=0 D PT^GMRYUT0,SETARRY,REPORT^GMRYFLW1
Q
Q ;
K GMRVHLOC,GMRVWLOC,GMROP,GMROUT,GMREDB,GMRFIN,GST,GDC,GDTIME,GTOTAL,GSTM,GMRSTRT,GCATH,GBLNK,GDASH,GSDA,GSDAY,GDATE,GLEFT,GABSORB,GRPT,GSTAR,GDA,GMRY,GSAVE,GSAVEH,GMRHLOC,GDATA D Q^GMRYRP0
K SSN,GMRAGE,GMRBED,GMRBTH,GMRDIAG,GMRHLOC,GMRNAM,GMRSEX,GMRADM,GMRWARD,VAROOT,I,X,Y,DFN Q
SETARRY ;SET IV DATA IN ^TMP($J,"GMR" AND SITE CARE IN ^TMP($J,"GMRY", FOR EACH PATIENT
K ^TMP($J) I $D(^GMR(126,"B",DFN)) S GSAVEH=0,DA(1)=$O(^GMR(126,"B",DFN,0)) D SAVEIV,IVM
Q
IVM ;SET IV MAINTENANCE IN ^TMP($J,"GMRY"
Q:'$D(^GMR(126,DFN,"IVM","B"))
S GSITE="" F S GSITE=$O(^GMR(126,DA(1),"IVM","B",GSITE)) Q:GSITE="" S DA=$O(^(GSITE,0)) Q:DA'>0 D SCARE
Q
SCARE ;
Q:'$D(^GMR(126,DA(1),"IVM",DA,1,"C"))
S GSTRT=0 F S GSTRT=$O(^GMR(126,DA(1),"IVM",DA,1,"C",GSTRT)) Q:GSTRT'>0 S GMRINDT=9999999-GSTRT I '(GMRINDT<GMRSTRT!(GMRINDT>GMRFIN)) S GDA=0 F S GDA=$O(^GMR(126,DA(1),"IVM",DA,1,"C",GSTRT,GDA)) Q:GDA'>0 D SETUT
Q
SETUT S GDATA=^GMR(126,DA(1),"IVM",DA,1,GDA,0) I $P(GDATA,"^",7)'="" S ^TMP($J,"GMR",+$P(GDATA,"^",7),GMRINDT,999)=^(0) Q
S ^TMP($J,"GMRY",GSITE,GMRINDT,999)=GDATA Q
SAVEIV ;SET ^TMP($J,"GMR" FOR IV INTAKE
I '$D(^GMR(126,DA(1),"IV","C")) Q
S GIVSTRT=0 F JJ=0:0 S GIVSTRT=$O(^GMR(126,DA(1),"IV","C",GIVSTRT)) Q:GIVSTRT'>0 S GMRINDT=9999999-GIVSTRT Q:GMRINDT<GMRSTRT I GMRINDT'>GMRFIN D IV
Q
IV ;
S DA=0 F S DA=$O(^GMR(126,DA(1),"IV","C",GIVSTRT,DA)) Q:DA'>0 Q:'$D(^GMR(126,DA(1),"IV",DA,0)) D IVDA
Q
IVDA ;
S GSITE=$P($G(^GMR(126,DA(1),"IV",DA,0)),"^",2),GSTRT=$P($G(^(0)),"^") Q:GSITE="" S ^TMP($J,"GMRY",GSITE,GMRINDT,DA)=$P(^(0)_"^^^^^","^",1,13)
S $P(^TMP($J,"GMRY",GSITE,GMRINDT,DA),"^",13)=$P($G(^GMR(126,DA(1),"IV",DA,3)),"^") ;IV PORT
Q