GMRVSR2 ;HIRMFO/YH-PATIENT VITAL SIGNS-I/O SF 511 GRAPH - 2 ;5/8/97
;;4.0;Vitals/Measurements;**1,9**;Apr 25, 1997
SETT ; SET GMRT
S GMRT(1)=$S(GMRTY="B":"BLOOD PRESSURE",GMRTY="P":"PULSE",GMRTY="R":"RESPIRATION",GMRTY="T":"TEMPERATURE",GMRTY="H":"HEIGHT",GMRTY="W":"WEIGHT",GMRTY="CG":"CIRCUMFERENCE/GIRTH",GMRTY="PO2":"PULSE OXIMETRY",1:"")
I GMRT(1)="" S GMRT(1)=$S(GMRTY="CVP":"CENTRAL VENOUS PRESSURE",1:"")
I GMRT(1)="" S GMRT(1)=$S(GMRTY="PN":"PAIN",1:"")
Q:GMRT(1)=""
S GMRT=$O(^GMRD(120.51,"B",GMRT(1),""))
I GMRT>0 F GMRX=GMRS:0 S GMRX=$O(^GMR(120.5,"AA",DFN,GMRT,GMRX)) Q:GMRX>GMRQ!(GMRX'>0) F GMREN=0:0 S GMREN=$O(^GMR(120.5,"AA",DFN,GMRT,GMRX,GMREN)) Q:GMREN'>0 I '$D(^GMR(120.5,GMREN,2)) D BLDARR
Q
BLDARR ; BUILD DATA ARRAY
S GMRDAT=$S($D(^GMR(120.5,GMREN,0)):^(0),1:""),GMRVX=GMRTY,GMRVX(0)=$P(GMRDAT,"^",8) D:GMRVX(0)>0!(GMRVX(0)<0)!($E(GMRVX(0))="0") EN1^GMRVSAS0
K GMRVARY S GMRVARY="" I $P($G(^GMR(120.5,GMREN,5,0)),"^",4)>0 D CHAR^GMRVCHAR(GMREN,.GMRVARY,GMRT)
K GG S GG="" I $O(GMRVARY(0)) D
. S GG(1)=0 F S GG(1)=$O(GMRVARY(GG(1))) Q:GG(1)'>0 S GG(2)=0 F S GG(2)=$O(GMRVARY(GG(1),GG(2))) Q:GG(2)'>0 S GG(3)="" F S GG(3)=$O(GMRVARY(GG(1),GG(2),GG(3))) Q:GG(3)="" S GG=GG_$S(GG="":"",1:";")_GG(3)
S ^TMP($J,"GMR",GMRTY,9999999-GMRX,$P(GMRDAT,"^",8))=GG_"^"_$S('$D(GMRVX(1)):"",'GMRVX(1):"",1:1)_"^^"_$P(GMRDAT,"^",10)
K GG Q
GMRVSR2 ;HIRMFO/YH-PATIENT VITAL SIGNS-I/O SF 511 GRAPH - 2 ;5/8/97
+1 ;;4.0;Vitals/Measurements;**1,9**;Apr 25, 1997
SETT ; SET GMRT
+1 SET GMRT(1)=$SELECT(GMRTY="B":"BLOOD PRESSURE",GMRTY="P":"PULSE",GMRTY="R":"RESPIRATION",GMRTY="T":"TEMPERATURE",GMRTY="H":"HEIGHT",GMRTY="W":"WEIGHT",GMRTY="CG":"CIRCUMFERENCE/GIRTH",GMRTY="PO2":"PULSE OXIMETRY",1:"")
+2 IF GMRT(1)=""
SET GMRT(1)=$SELECT(GMRTY="CVP":"CENTRAL VENOUS PRESSURE",1:"")
+3 IF GMRT(1)=""
SET GMRT(1)=$SELECT(GMRTY="PN":"PAIN",1:"")
+4 IF GMRT(1)=""
QUIT
+5 SET GMRT=$ORDER(^GMRD(120.51,"B",GMRT(1),""))
+6 IF GMRT>0
FOR GMRX=GMRS:0
SET GMRX=$ORDER(^GMR(120.5,"AA",DFN,GMRT,GMRX))
IF GMRX>GMRQ!(GMRX'>0)
QUIT
FOR GMREN=0:0
SET GMREN=$ORDER(^GMR(120.5,"AA",DFN,GMRT,GMRX,GMREN))
IF GMREN'>0
QUIT
IF '$DATA(^GMR(120.5,GMREN,2))
DO BLDARR
+7 QUIT
BLDARR ; BUILD DATA ARRAY
+1 SET GMRDAT=$SELECT($DATA(^GMR(120.5,GMREN,0)):^(0),1:"")
SET GMRVX=GMRTY
SET GMRVX(0)=$PIECE(GMRDAT,"^",8)
IF GMRVX(0)>0!(GMRVX(0)<0)!($EXTRACT(GMRVX(0))="0")
DO EN1^GMRVSAS0
+2 KILL GMRVARY
SET GMRVARY=""
IF $PIECE($GET(^GMR(120.5,GMREN,5,0)),"^",4)>0
DO CHAR^GMRVCHAR(GMREN,.GMRVARY,GMRT)
+3 KILL GG
SET GG=""
IF $ORDER(GMRVARY(0))
Begin DoDot:1
+4 SET GG(1)=0
FOR
SET GG(1)=$ORDER(GMRVARY(GG(1)))
IF GG(1)'>0
QUIT
SET GG(2)=0
FOR
SET GG(2)=$ORDER(GMRVARY(GG(1),GG(2)))
IF GG(2)'>0
QUIT
SET GG(3)=""
FOR
SET GG(3)=$ORDER(GMRVARY(GG(1),GG(2),GG(3)))
IF GG(3)=""
QUIT
SET GG=GG_$SELECT(GG="":"",1:";")_GG(3)
End DoDot:1
+5 SET ^TMP($JOB,"GMR",GMRTY,9999999-GMRX,$PIECE(GMRDAT,"^",8))=GG_"^"_$SELECT('$DATA(GMRVX(1)):"",'GMRVX(1):"",1:1)_"^^"_$PIECE(GMRDAT,"^",10)
+6 KILL GG
QUIT