GMVLAT0 ;HOIFO/YH,FT-DISPLAY LATEST VITALS/MEASUREMENTS FOR A PATIENT ;9/27/07
;;5.0;GEN. MED. REC. - VITALS;**1,3,23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #4290 - ^PXRMINDX global (controlled)
; #10104 - ^XLFSTR calls (supported)
;
EN1(DFN) ; Entry to extract the latest vitals/measurements for a patient
;called by GETLAT^GMVGETD
N G,GJ,GBLANK,GMVCLIO,GMVLOOP,GMVQARRY,GMVQLIST,GMVQNAME,GMVUSER,GMVNUMBR,X,Y
S GJ=0,GBLANK=""
F X="T","P","R","PO2","BP","HT","WT","CVP","CG","PN" I $D(^GMRD(120.51,"C",X)) S GMR(X)=$O(^GMRD(120.51,"C",X,"")),Y=$P($G(^GMRD(120.51,GMR(X),0)),"^") Q:Y=""
K GMRDT,GMRVWT,GMRVHT
S X=""
F S X=$O(GMR(X)) Q:X="" S GMRDATS="",GMRDAT=9999999 I GMR(X)>0 F S GMRDAT=$O(^PXRMINDX(120.5,"PI",DFN,+GMR(X),GMRDAT),-1) Q:$S(GMRDAT'>0:1,GMRDATS>0:1,1:0) D SETDATAR
I '($D(GMRDATA)\10) S GJ=GJ+1,^TMP($J,"GRPC",GJ)="There are no results to report " G Q
F X="T","P","R","PO2","BP","HT","WT","CVP","CG","PN" I $D(GMRDATA(X)) S GMRVDT="",(GMRVDT(1),GMVD)=0 F S GMVD=$O(GMRDATA(X,GMVD)) Q:GMVD'>0 D WRTDT S GMVD(1)=0 F S GMVD(1)=$O(GMRDATA(X,GMVD,GMVD(1))) Q:$L(GMVD(1))'>0 D
. S GMVNUMBR=$P(GMRDATA(X,GMVD,GMVD(1)),U,8)
. Q:GMVNUMBR="" ;RATE cannot be null
.; set flag to indicate RATE is a numeric reading
. S GMVNUMBR=$$NUMBER(GMVNUMBR)
. S GMVUSER=$P(GMRDATA(X,GMVD,GMVD(1)),U,6) ;user ien
. S GMVUSER=$$PERSON^GMVUTL1(GMVUSER) ;user name
. S GJ=GJ+1,^TMP($J,"GRPC",GJ)="",GMRVX(0)=$P(GMRDATA(X,GMVD,GMVD(1)),U,8) S GMRVX=X D:GMVNUMBR EN1^GMVSAS0
.S:GMRVDT(1)=0 ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_$S(X="BP":"B/P",X="P":"Pulse",X="R":"Resp.",X="T":"Temp.",X="HT":"Ht.",X="CG":"Circ/Girth",X="WT":"Wt.",X="PO2":"Pulse Ox",X="PN":"Pain",1:X)_":"
.I GMRVDT(1)=0 S GBLANK=$$REPEAT^XLFSTR(" ",13-$L(^TMP($J,"GRPC",GJ))),^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GBLANK_"("_GMRVDT_") " S GMRVDT(1)=1
.S GBLANK=$$REPEAT^XLFSTR(" ",31-$L(^TMP($J,"GRPC",GJ))),^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GBLANK
. I X="T" S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0)_$S(GMVNUMBR=1:" F ("_$J(+GMRVX(0)-32*5/9,0,1)_" C)",1:"")
.I X="WT" S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0)_$S(GMVNUMBR=1:" lb ("_$J(GMRVX(0)*.45359237,0,2)_" kg)",1:"") S GMRVWT=GMRVX(0)/2.2
.I X="HT" D
..S GMRVHT=(GMRVX(0)*2.54)/100
..I GMVNUMBR=0 S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0) Q
..S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_$S(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$S(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_$S(GMVNUMBR=1:" ("_$J(GMRVX(0)*2.54,0,2)_" cm)",1:"")
..Q
.I X="CG" S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0)_$S(GMVNUMBR=1:" in ("_$J(+GMRVX(0)/.3937,0,2)_" cm)",1:"")
.I X="CVP" S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0)_$S(GMVNUMBR=1:" cmH2O ("_$J(GMRVX(0)/1.36,0,1)_" mmHg)",1:"")
.I X="PO2" S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0)_$S(GMVNUMBR=1:"% ",1:"")
.I X="P"!(X="R")!(X="BP") S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GMRVX(0)
.I X="PN" D S ^TMP($J,"GRPC",GJ)=^(GJ)_GMRVX(0)
..Q:'GMVNUMBR ;not a number
..I GMRVX(0)=0 S GMRVX(0)="0 - No pain" Q
..I GMRVX(0)=99 S GMRVX(0)="99 - Unable to respond" Q
..I GMRVX(0)=10 S GMRVX(0)="Pain class - 10 Worst imaginable pain" Q
..Q
.S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_$S('$D(GMRVX(1)):"",'GMRVX(1):"",1:"*") K GMRVX
.D CHAR
.I X="WT",$G(GMRVWT)>0,$G(GMRVHT)>0 D
..S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_" _"_GMVUSER
..S GJ=GJ+1,GMRVHT(1)=$J(GMRVWT/(GMRVHT*GMRVHT),0,2),^TMP($J,"GRPC",GJ)="Body Mass Index:",GMVUSER="" D
...S GBLANK=$$REPEAT^XLFSTR(" ",29-$L(^TMP($J,"GRPC",GJ))),^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_GBLANK_GMRVHT(1)_$S(GMRVHT(1)>27:"*",1:"")
...Q
..Q
.S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_" "_$S(GMVUSER]"":"_",1:"")_GMVUSER_"_"_$S(GMVD(1)=+GMVD(1):"Vitals",1:"CLIO")
.Q
Q ; kill variables and quit
K GMRVWT,GMRVHT,GMR,GMVD,GBP,GMRVARY,GMRVDA,GMRDATA,GMVDM,GLIN,GMRZZ
K GMRVDT,GMROUT,%Y,GMRL,GMRDT,DIC,GMRDAT,GMRDATS,GMRSTR,GMRX,GMRVX,POP
Q
SETDATAR ; get record IEN if not marked as entered-in-error
S Y=""
F S Y=$O(^PXRMINDX(120.5,"PI",DFN,GMR(X),GMRDAT,Y)) Q:$L(Y)'>0!GMRDATS D
.I Y=+Y D
..D F1205^GMVUTL(.GMVCLIO,Y)
.I Y'=+Y D
..D CLIO^GMVUTL(.GMVCLIO,Y)
.S GMVCLIO(0)=$G(GMVCLIO(0)),GMVCLIO(5)=$G(GMVCLIO(5))
.I GMVCLIO(0)=""!($P(GMVCLIO(0),U,8)="") Q
.S GMRL=GMVCLIO(0)
.S GMVQLIST=""
.F GMVLOOP=1:1 Q:$P(GMVCLIO(5),U,GMVLOOP)="" D
..S GMVQNAME=$$FIELD^GMVGETQL($P(GMVCLIO(5),U,GMVLOOP),1,"E")
..I GMVQNAME=""!(GMVQNAME=-1) Q
..S GMVQLIST=GMVQLIST_$S(GMVQLIST'="":",",1:"")_GMVQNAME
..Q
.D SETNODE
.Q
Q
SETNODE ; Set record node
S GMRL1=$P(GMRL,"^") ;adding trailing zeros to time if necessary
S $P(GMRL1,".",2)=$P(GMRL1,".",2)_"0000"
S $P(GMRL1,".",2)=$E($P(GMRL1,".",2),1,4)
S $P(GMRL,"^")=GMRL1
K GMRL1
S GMRDATA(X,$P(GMRL,U,1),Y)=GMRL,GMRDATS=1
S GMVQARRY(X,$P(GMRL,U,1),Y)=GMVQLIST
Q
WRTDT ;
S GMRVDT=$E(GMVD,4,5)_"/"_$E(GMVD,6,7)_"/"_$E(GMVD,2,3)_"@"_$E($P(GMVD,".",2),1,2)_$S($E($P(GMVD,".",2),3,4)'="":":"_$E($P(GMVD,".",2),3,4),1:"")
Q
CHAR ;
;S GMRZZ=$$WRITECH(GMVD(1),.GMRVARY,5)
S GMRZZ=GMVQARRY(X,GMVD,GMVD(1))
S:GMRZZ'=""&(X'="PO2") GMRZZ="("_GMRZZ_")"
I X="PO2",$P(GMRDATA(X,GMVD,GMVD(1)),U,10)'="" S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_"with supplemental O2" D
. S GPO2=$P(GMRDATA(X,GMVD,GMVD(1)),U,10)
. S ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_" "_$S(GPO2["l/min":$P(GPO2," l/min")_" L/min",1:"")_$S(GPO2["l/min":$P(GPO2," l/min",2),1:GPO2)
. K GPO2
S:GMRZZ'="" ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_" "_GMRZZ K GMRZZ Q
S:$G(GMRZZ)'="" ^TMP($J,"GRPC",GJ)=^TMP($J,"GRPC",GJ)_" "_GMRZZ K GMRZZ
Q
;SETBP ;
;D SETBP^GMVLATS
;Q
;WRITECH(GDA,GARRY,GN);
; Input data:
; GDA - Pointer to the patient vitals/measurements data file #120.5
; GARRY - qualifier data array for a measurement
; GARRY(GDA,Print order,qualifier data)
; GN - Number of print order to print
;N GMRVDA,GDATA
;S GDATA="",GMRVDA(1)=0
;F S GMRVDA(1)=$O(GARRY(GDA,GMRVDA(1))) Q:GMRVDA(1)'>0!(GMRVDA(1)>GN) S GMRVDA(2)="" F S GMRVDA(2)=$O(GARRY(GDA,GMRVDA(1),GMRVDA(2))) Q:GMRVDA(2)="" D
;. S GDATA=GDATA_","_GMRVDA(2)
;. Q
;I $E(GDATA,1)="," S GDATA=$E(GDATA,2,$L(GDATA)) ;strip off leading comma
;Q GDATA
;
NUMBER(GMVRATE) ; Function determines if the RATE has a numeric reading or one
; of the text codes (e.g. REFUSED).
; Returns 0 if GMVRATE has a text code
; 1 if a numeric reading
N GMVYES
S GMVRATE=$G(GMVRATE)
S GMVYES=1
I "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR(GMVRATE) S GMVYES=0
Q GMVYES
;
GMVLAT0 ;HOIFO/YH,FT-DISPLAY LATEST VITALS/MEASUREMENTS FOR A PATIENT ;9/27/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**1,3,23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #4290 - ^PXRMINDX global (controlled)
+5 ; #10104 - ^XLFSTR calls (supported)
+6 ;
EN1(DFN) ; Entry to extract the latest vitals/measurements for a patient
+1 ;called by GETLAT^GMVGETD
+2 NEW G,GJ,GBLANK,GMVCLIO,GMVLOOP,GMVQARRY,GMVQLIST,GMVQNAME,GMVUSER,GMVNUMBR,X,Y
+3 SET GJ=0
SET GBLANK=""
+4 FOR X="T","P","R","PO2","BP","HT","WT","CVP","CG","PN"
IF $DATA(^GMRD(120.51,"C",X))
SET GMR(X)=$ORDER(^GMRD(120.51,"C",X,""))
SET Y=$PIECE($GET(^GMRD(120.51,GMR(X),0)),"^")
IF Y=""
QUIT
+5 KILL GMRDT,GMRVWT,GMRVHT
+6 SET X=""
+7 FOR
SET X=$ORDER(GMR(X))
IF X=""
QUIT
SET GMRDATS=""
SET GMRDAT=9999999
IF GMR(X)>0
FOR
SET GMRDAT=$ORDER(^PXRMINDX(120.5,"PI",DFN,+GMR(X),GMRDAT),-1)
IF $SELECT(GMRDAT'>0
QUIT
DO SETDATAR
+8 IF '($DATA(GMRDATA)\10)
SET GJ=GJ+1
SET ^TMP($JOB,"GRPC",GJ)="There are no results to report "
GOTO Q
+9 FOR X="T","P","R","PO2","BP","HT","WT","CVP","CG","PN"
IF $DATA(GMRDATA(X))
SET GMRVDT=""
SET (GMRVDT(1),GMVD)=0
FOR
SET GMVD=$ORDER(GMRDATA(X,GMVD))
IF GMVD'>0
QUIT
DO WRTDT
SET GMVD(1)=0
FOR
SET GMVD(1)=$ORDER(GMRDATA(X,GMVD,GMVD(1)))
IF $LENGTH(GMVD(1))'>0
QUIT
Begin DoDot:1
+10 SET GMVNUMBR=$PIECE(GMRDATA(X,GMVD,GMVD(1)),U,8)
+11 ;RATE cannot be null
IF GMVNUMBR=""
QUIT
+12 ; set flag to indicate RATE is a numeric reading
+13 SET GMVNUMBR=$$NUMBER(GMVNUMBR)
+14 ;user ien
SET GMVUSER=$PIECE(GMRDATA(X,GMVD,GMVD(1)),U,6)
+15 ;user name
SET GMVUSER=$$PERSON^GMVUTL1(GMVUSER)
+16 SET GJ=GJ+1
SET ^TMP($JOB,"GRPC",GJ)=""
SET GMRVX(0)=$PIECE(GMRDATA(X,GMVD,GMVD(1)),U,8)
SET GMRVX=X
IF GMVNUMBR
DO EN1^GMVSAS0
+17 IF GMRVDT(1)=0
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_$SELECT(X="BP":"B/P",X="P":"Pulse",X="R":"Resp.",X="T":"Temp.",X="HT":"Ht.",X="CG":"Circ/Girth",X="WT":"Wt.",X="PO2":"Pulse Ox",X="PN":"Pain",1:X)_":"
+18 IF GMRVDT(1)=0
SET GBLANK=$$REPEAT^XLFSTR(" ",13-$LENGTH(^TMP($JOB,"GRPC",GJ)))
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GBLANK_"("_GMRVDT_") "
SET GMRVDT(1)=1
+19 SET GBLANK=$$REPEAT^XLFSTR(" ",31-$LENGTH(^TMP($JOB,"GRPC",GJ)))
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GBLANK
+20 IF X="T"
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)_$SELECT(GMVNUMBR=1:" F ("_$JUSTIFY(+GMRVX(0)-32*5/9,0,1)_" C)",1:"")
+21 IF X="WT"
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)_$SELECT(GMVNUMBR=1:" lb ("_$JUSTIFY(GMRVX(0)*.45359237,0,2)_" kg)",1:"")
SET GMRVWT=GMRVX(0)/2.2
+22 IF X="HT"
Begin DoDot:2
+23 SET GMRVHT=(GMRVX(0)*2.54)/100
+24 IF GMVNUMBR=0
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)
QUIT
+25 SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_$SELECT(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$SELECT(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_$SELECT(GMVNUMBR=1:" ("_$JUSTIFY(GMRVX(0)*2.54,0,2)_" cm)",1:"")
+26 QUIT
End DoDot:2
+27 IF X="CG"
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)_$SELECT(GMVNUMBR=1:" in ("_$JUSTIFY(+GMRVX(0)/.3937,0,2)_" cm)",1:"")
+28 IF X="CVP"
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)_$SELECT(GMVNUMBR=1:" cmH2O ("_$JUSTIFY(GMRVX(0)/1.36,0,1)_" mmHg)",1:"")
+29 IF X="PO2"
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)_$SELECT(GMVNUMBR=1:"% ",1:"")
+30 IF X="P"!(X="R")!(X="BP")
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GMRVX(0)
+31 IF X="PN"
Begin DoDot:2
+32 ;not a number
IF 'GMVNUMBR
QUIT
+33 IF GMRVX(0)=0
SET GMRVX(0)="0 - No pain"
QUIT
+34 IF GMRVX(0)=99
SET GMRVX(0)="99 - Unable to respond"
QUIT
+35 IF GMRVX(0)=10
SET GMRVX(0)="Pain class - 10 Worst imaginable pain"
QUIT
+36 QUIT
End DoDot:2
SET ^TMP($JOB,"GRPC",GJ)=^(GJ)_GMRVX(0)
+37 SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_$SELECT('$DATA(GMRVX(1)):"",'GMRVX(1):"",1:"*")
KILL GMRVX
+38 DO CHAR
+39 IF X="WT"
IF $GET(GMRVWT)>0
IF $GET(GMRVHT)>0
Begin DoDot:2
+40 SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_" _"_GMVUSER
+41 SET GJ=GJ+1
SET GMRVHT(1)=$JUSTIFY(GMRVWT/(GMRVHT*GMRVHT),0,2)
SET ^TMP($JOB,"GRPC",GJ)="Body Mass Index:"
SET GMVUSER=""
Begin DoDot:3
+42 SET GBLANK=$$REPEAT^XLFSTR(" ",29-$LENGTH(^TMP($JOB,"GRPC",GJ)))
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_GBLANK_GMRVHT(1)_$SELECT(GMRVHT(1)>27:"*",1:"")
+43 QUIT
End DoDot:3
+44 QUIT
End DoDot:2
+45 SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_" "_$SELECT(GMVUSER]"":"_",1:"")_GMVUSER_"_"_$SELECT(GMVD(1)=+GMVD(1):"Vitals",1:"CLIO")
+46 QUIT
End DoDot:1
Q ; kill variables and quit
+1 KILL GMRVWT,GMRVHT,GMR,GMVD,GBP,GMRVARY,GMRVDA,GMRDATA,GMVDM,GLIN,GMRZZ
+2 KILL GMRVDT,GMROUT,%Y,GMRL,GMRDT,DIC,GMRDAT,GMRDATS,GMRSTR,GMRX,GMRVX,POP
+3 QUIT
SETDATAR ; get record IEN if not marked as entered-in-error
+1 SET Y=""
+2 FOR
SET Y=$ORDER(^PXRMINDX(120.5,"PI",DFN,GMR(X),GMRDAT,Y))
IF $LENGTH(Y)'>0!GMRDATS
QUIT
Begin DoDot:1
+3 IF Y=+Y
Begin DoDot:2
+4 DO F1205^GMVUTL(.GMVCLIO,Y)
End DoDot:2
+5 IF Y'=+Y
Begin DoDot:2
+6 DO CLIO^GMVUTL(.GMVCLIO,Y)
End DoDot:2
+7 SET GMVCLIO(0)=$GET(GMVCLIO(0))
SET GMVCLIO(5)=$GET(GMVCLIO(5))
+8 IF GMVCLIO(0)=""!($PIECE(GMVCLIO(0),U,8)="")
QUIT
+9 SET GMRL=GMVCLIO(0)
+10 SET GMVQLIST=""
+11 FOR GMVLOOP=1:1
IF $PIECE(GMVCLIO(5),U,GMVLOOP)=""
QUIT
Begin DoDot:2
+12 SET GMVQNAME=$$FIELD^GMVGETQL($PIECE(GMVCLIO(5),U,GMVLOOP),1,"E")
+13 IF GMVQNAME=""!(GMVQNAME=-1)
QUIT
+14 SET GMVQLIST=GMVQLIST_$SELECT(GMVQLIST'="":",",1:"")_GMVQNAME
+15 QUIT
End DoDot:2
+16 DO SETNODE
+17 QUIT
End DoDot:1
+18 QUIT
SETNODE ; Set record node
+1 ;adding trailing zeros to time if necessary
SET GMRL1=$PIECE(GMRL,"^")
+2 SET $PIECE(GMRL1,".",2)=$PIECE(GMRL1,".",2)_"0000"
+3 SET $PIECE(GMRL1,".",2)=$EXTRACT($PIECE(GMRL1,".",2),1,4)
+4 SET $PIECE(GMRL,"^")=GMRL1
+5 KILL GMRL1
+6 SET GMRDATA(X,$PIECE(GMRL,U,1),Y)=GMRL
SET GMRDATS=1
+7 SET GMVQARRY(X,$PIECE(GMRL,U,1),Y)=GMVQLIST
+8 QUIT
WRTDT ;
+1 SET GMRVDT=$EXTRACT(GMVD,4,5)_"/"_$EXTRACT(GMVD,6,7)_"/"_$EXTRACT(GMVD,2,3)_"@"_$EXTRACT($PIECE(GMVD,".",2),1,2)_$SELECT($EXTRACT($PIECE(GMVD,".",2),3,4)'="":":"_$EXTRACT($PIECE(GMVD,".",2),3,4),1:"")
+2 QUIT
CHAR ;
+1 ;S GMRZZ=$$WRITECH(GMVD(1),.GMRVARY,5)
+2 SET GMRZZ=GMVQARRY(X,GMVD,GMVD(1))
+3 IF GMRZZ'=""&(X'="PO2")
SET GMRZZ="("_GMRZZ_")"
+4 IF X="PO2"
IF $PIECE(GMRDATA(X,GMVD,GMVD(1)),U,10)'=""
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_"with supplemental O2"
Begin DoDot:1
+5 SET GPO2=$PIECE(GMRDATA(X,GMVD,GMVD(1)),U,10)
+6 SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_" "_$SELECT(GPO2["l/min":$PIECE(GPO2," l/min")_" L/min",1:"")_$SELECT(GPO2["l/min":$PIECE(GPO2," l/min",2),1:GPO2)
+7 KILL GPO2
End DoDot:1
+8 IF GMRZZ'=""
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_" "_GMRZZ
KILL GMRZZ
QUIT
+9 IF $GET(GMRZZ)'=""
SET ^TMP($JOB,"GRPC",GJ)=^TMP($JOB,"GRPC",GJ)_" "_GMRZZ
KILL GMRZZ
+10 QUIT
+11 ;SETBP ;
+12 ;D SETBP^GMVLATS
+13 ;Q
+14 ;WRITECH(GDA,GARRY,GN);
+15 ; Input data:
+16 ; GDA - Pointer to the patient vitals/measurements data file #120.5
+17 ; GARRY - qualifier data array for a measurement
+18 ; GARRY(GDA,Print order,qualifier data)
+19 ; GN - Number of print order to print
+20 ;N GMRVDA,GDATA
+21 ;S GDATA="",GMRVDA(1)=0
+22 ;F S GMRVDA(1)=$O(GARRY(GDA,GMRVDA(1))) Q:GMRVDA(1)'>0!(GMRVDA(1)>GN) S GMRVDA(2)="" F S GMRVDA(2)=$O(GARRY(GDA,GMRVDA(1),GMRVDA(2))) Q:GMRVDA(2)="" D
+23 ;. S GDATA=GDATA_","_GMRVDA(2)
+24 ;. Q
+25 ;I $E(GDATA,1)="," S GDATA=$E(GDATA,2,$L(GDATA)) ;strip off leading comma
+26 ;Q GDATA
+27 ;
NUMBER(GMVRATE) ; Function determines if the RATE has a numeric reading or one
+1 ; of the text codes (e.g. REFUSED).
+2 ; Returns 0 if GMVRATE has a text code
+3 ; 1 if a numeric reading
+4 NEW GMVYES
+5 SET GMVRATE=$GET(GMVRATE)
+6 SET GMVYES=1
+7 IF "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR(GMVRATE)
SET GMVYES=0
+8 QUIT GMVYES
+9 ;