GMRVSC2 ;HIOFO/YH,FT-CUMULATIVE V/M - CONTINUED ;9/27/07
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #10104 - ^XLFSTR calls (supported)
;
SETLN ;
N GMVLOOP,GMVQNAME,GMRVPO
S GMRVER=$P(^TMP($J,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",1)
S GMRVARY=$P(^TMP($J,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",3)
D:IOSL<($Y+9) HDR Q:GMROUT W ! W:GMRVER "(E)"
I GPRT(GMRVTY)=0 D
. W ?4,$S(GMRVTY="T":"T: ",GMRVTY="P":"P: ",GMRVTY="R":"R: ",GMRVTY="BP":"B/P: ",GMRVTY="WT":"Wt: ",GMRVTY="HT":"Ht: ",GMRVTY="CG":"Circumference/Girth: ",GMRVTY="CVP":"Central Venous Pressure: ",GMRVTY="PO2":"Pulse Oximetry: ",1:"")
. I GMRVTY="PN" W ?4,"Pain: "
S GPRT(GMRVTY)=1
S GMRDAT=$P(^TMP($J,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",2)
I "PRBPCVPCGPO2PN"[GMRVTY S GMRVX=GMRVTY,GMRVX(0)=$P(GMRDAT,"^",8) D
. I "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR(GMRVX(0)) W ?9,GMRVX(0) Q
. I GMRVTY="PN" D
. . I GMRVX(0)=0 W ?9,GMRVX(0)_" - No pain" Q
. . I GMRVX(0)=99 W ?9,GMRVX(0)_" - Unable to respond" Q
. . I GMRVX(0)=10 W ?9,GMRVX(0)_" - Worst imaginable pain" Q
. . W ?9,GMRVX(0) Q
. ;I GMRVTY'="PN" W ?9,GMRVX(0)
. D EN1^GMRVSAS0
. I GMRVTY="P","^"_GPEDIS_"^"[GMRVARY,$P(GMRDAT,"^",8)=1 S GMRVX(1)=""
. S Z=$S(GMRVTY="CG":$J($P(GMRDAT,"^",8),0,2),GMRVTY="CVP":$J($P(GMRDAT,"^",8),0,1),GMRVTY'="BP":$J($P(GMRDAT,"^",8),3,0),1:$P(GMRDAT,"^",8)) D:GMRVTY'="BP" BLNK W:GMRVTY'="PN" ?9,Z_$S('$D(GMRVX(1)):" ",'GMRVX(1):"",1:"*")
. I GMRVTY="CG" W " in ("_$J(Z/.3937,0,2)_" cm)"
. I GMRVTY="CVP" W " cmH2O ("_$J(Z/1.36,0,1)_" mmHg)"
. I GMRVTY="PO2" S GMRVPO=$P(GMRDAT,"^",10) W "%"_$S(GMRVPO'="":" with supplemental O2 "_$S(GMRVPO["l/min":$P(GMRVPO," l/min")_"L/min",1:"")_$S(GMRVPO["l/min":$P(GMRVPO," l/min",2),1:GMRVPO),1:"")
I GMRVTY="T" S X=$P(GMRDAT,"^",8) D
. I X'>0 W ?9,X Q
. S GMRVX=GMRVTY,GMRVX(0)=X D EN1^GMRVSAS0
. D EN1^GMRVUTL S:'Y Y="" S Z=$J(X,5,1) D BLNK W ?9,Z_" F " S Z=$J(Y,4,1) D BLNK W "("_Z_" C)"_$S('$D(GMRVX(1)):" ",'GMRVX(1):"",1:"*")
I GMRVTY="HT" S X=$P(GMRDAT,"^",8) D
. I X'>0 W ?9,X Q
. D EN2^GMRVUTL S:'Y Y="" S Z=$J(X,5,2) D BLNK W ?9,Z_" in " S Z=$J(Y,5,2) D BLNK W "("_Z_" cm)" I 'GMRVER S GMRVHT=Z/100
I GMRVTY="WT" S X=$P(GMRDAT,"^",8) D
. I X'>0 W ?9,X Q
. D EN3^GMRVUTL S:'Y Y="" S Z=$J(X,7,2) D BLNK W ?9,Z_" lb " S Z=$J(Y,6,2) D BLNK W "("_Z_" kg)"
Q:+$P(GMRDAT,"^",8)'>0&(+$P($G(^GMR(120.5,GMRVDA,5,0)),"^",4)'>0) S GMRVITY=+$P(GMRDAT,"^",3)
S GMRZZ=""
F GMVLOOP=1:1 Q:$P(GMRVARY,U,GMVLOOP)="" D
.S GMVQNAME=$$FIELD^GMVGETQL($P(GMRVARY,U,GMVLOOP),1,"E")
.Q:GMVQNAME=""!(GMVQNAME=-1)
.S GMRZZ=GMRZZ_$S(GMRZZ'="":", ",1:"")_GMVQNAME
I "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR($P(GMRDAT,U,8)) Q
S GMRVITY=+$P(GMRDAT,"^",3)
S:GMRZZ'=""&(GMRVTY'="PO2") GMRZZ=" ("_GMRZZ_")"
I GMRZZ'="" W:GMRVTY="PO2" !,?8," via " W GMRZZ
I GMRVTY="WT",'GMRVER S GMRBMI="",GMRBMI(1)=$P(GMRDAT,"^"),GMRBMI(2)=+$P(GMRDAT,"^",8) D CALBMI^GMRVBMI(.GMRBMI) W:GMRBMI>0 !,?4,"Body Mass Index: "_GMRBMI
K Z Q
HDR ;
I 'GMR1ST D FOOTER^GMRVSC0
I $E(IOST)'="P",'GMR1ST W "Press return to continue ""^"" to escape " R X:DTIME I X="^"!'$T S GMROUT=1 Q
W:'($E(IOST)'="C"&'$D(GFLAG)) @IOF S GMRPG=GMRPG+1,GFLAG=1
W !,GMRPDT,?25,"Cumulative Vitals/Measurements Report",?70,"Page ",GMRPG,!!,$E(GMRDSH,1,78)
I 'GMR1ST,$P(GMRDATE,".")=GMRDATE(0) W !,$E(GMRDATE(0),4,5)_"/"_$E(GMRDATE(0),6,7)_"/"_$E(GMRDATE,2,3)_" (continued)",!
S GMR1ST=0
Q
BLNK ;
F I=1:1:$L(Z) Q:$E(Z,I)'=" "
S Z=$E(Z,I,$L(Z))
Q
GMRVSC2 ;HIOFO/YH,FT-CUMULATIVE V/M - CONTINUED ;9/27/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #10104 - ^XLFSTR calls (supported)
+5 ;
SETLN ;
+1 NEW GMVLOOP,GMVQNAME,GMRVPO
+2 SET GMRVER=$PIECE(^TMP($JOB,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",1)
+3 SET GMRVARY=$PIECE(^TMP($JOB,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",3)
+4 IF IOSL<($Y+9)
DO HDR
IF GMROUT
QUIT
WRITE !
IF GMRVER
WRITE "(E)"
+5 IF GPRT(GMRVTY)=0
Begin DoDot:1
+6 WRITE ?4,$SELECT(GMRVTY="T":"T: ",GMRVTY="P":"P: ",GMRVTY="R":"R: ",GMRVTY="BP":"B/P: ",GMRVTY="WT":"Wt: ",GMRVTY="HT":"Ht: ",GMRVTY="CG":"Circumference/Girth: ",GMRVTY="CVP":"Central Venous Pressure: ",GMRVTY="PO2":"Pulse Oximetry: ",1
:"")
+7 IF GMRVTY="PN"
WRITE ?4,"Pain: "
End DoDot:1
+8 SET GPRT(GMRVTY)=1
+9 SET GMRDAT=$PIECE(^TMP($JOB,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",2)
+10 IF "PRBPCVPCGPO2PN"[GMRVTY
SET GMRVX=GMRVTY
SET GMRVX(0)=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+11 IF "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR(GMRVX(0))
WRITE ?9,GMRVX(0)
QUIT
+12 IF GMRVTY="PN"
Begin DoDot:2
+13 IF GMRVX(0)=0
WRITE ?9,GMRVX(0)_" - No pain"
QUIT
+14 IF GMRVX(0)=99
WRITE ?9,GMRVX(0)_" - Unable to respond"
QUIT
+15 IF GMRVX(0)=10
WRITE ?9,GMRVX(0)_" - Worst imaginable pain"
QUIT
+16 WRITE ?9,GMRVX(0)
QUIT
End DoDot:2
+17 ;I GMRVTY'="PN" W ?9,GMRVX(0)
+18 DO EN1^GMRVSAS0
+19 IF GMRVTY="P"
IF "^"_GPEDIS_"^"[GMRVARY
IF $PIECE(GMRDAT,"^",8)=1
SET GMRVX(1)=""
+20 SET Z=$SELECT(GMRVTY="CG":$JUSTIFY($PIECE(GMRDAT,"^",8),0,2),GMRVTY="CVP":$JUSTIFY($PIECE(GMRDAT,"^",8),0,1),GMRVTY'="BP":$JUSTIFY($PIECE(GMRDAT,"^",8),3,0),1:$PIECE(GMRDAT,"^",8))
IF GMRVTY'="BP"
DO BLNK
IF GMRVTY'="PN"
WRITE ?9,Z_$SELECT('$DATA(GMRVX(1)):" ",'GMRVX(1):"",1:"*")
+21 IF GMRVTY="CG"
WRITE " in ("_$JUSTIFY(Z/.3937,0,2)_" cm)"
+22 IF GMRVTY="CVP"
WRITE " cmH2O ("_$JUSTIFY(Z/1.36,0,1)_" mmHg)"
+23 IF GMRVTY="PO2"
SET GMRVPO=$PIECE(GMRDAT,"^",10)
WRITE "%"_$SELECT(GMRVPO'="":" with supplemental O2 "_$SELECT(GMRVPO["l/min":$PIECE(GMRVPO," l/min")_"L/min",1:"")_$SELECT(GMRVPO["l/min":$PIECE(GMRVPO," l/min",2),1:GMRVPO),1:"")
End DoDot:1
+24 IF GMRVTY="T"
SET X=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+25 IF X'>0
WRITE ?9,X
QUIT
+26 SET GMRVX=GMRVTY
SET GMRVX(0)=X
DO EN1^GMRVSAS0
+27 DO EN1^GMRVUTL
IF 'Y
SET Y=""
SET Z=$JUSTIFY(X,5,1)
DO BLNK
WRITE ?9,Z_" F "
SET Z=$JUSTIFY(Y,4,1)
DO BLNK
WRITE "("_Z_" C)"_$SELECT('$DATA(GMRVX(1)):" ",'GMRVX(1):"",1:"*")
End DoDot:1
+28 IF GMRVTY="HT"
SET X=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+29 IF X'>0
WRITE ?9,X
QUIT
+30 DO EN2^GMRVUTL
IF 'Y
SET Y=""
SET Z=$JUSTIFY(X,5,2)
DO BLNK
WRITE ?9,Z_" in "
SET Z=$JUSTIFY(Y,5,2)
DO BLNK
WRITE "("_Z_" cm)"
IF 'GMRVER
SET GMRVHT=Z/100
End DoDot:1
+31 IF GMRVTY="WT"
SET X=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+32 IF X'>0
WRITE ?9,X
QUIT
+33 DO EN3^GMRVUTL
IF 'Y
SET Y=""
SET Z=$JUSTIFY(X,7,2)
DO BLNK
WRITE ?9,Z_" lb "
SET Z=$JUSTIFY(Y,6,2)
DO BLNK
WRITE "("_Z_" kg)"
End DoDot:1
+34 IF +$PIECE(GMRDAT,"^",8)'>0&(+$PIECE($GET(^GMR(120.5,GMRVDA,5,0)),"^",4)'>0)
QUIT
SET GMRVITY=+$PIECE(GMRDAT,"^",3)
+35 SET GMRZZ=""
+36 FOR GMVLOOP=1:1
IF $PIECE(GMRVARY,U,GMVLOOP)=""
QUIT
Begin DoDot:1
+37 SET GMVQNAME=$$FIELD^GMVGETQL($PIECE(GMRVARY,U,GMVLOOP),1,"E")
+38 IF GMVQNAME=""!(GMVQNAME=-1)
QUIT
+39 SET GMRZZ=GMRZZ_$SELECT(GMRZZ'="":", ",1:"")_GMVQNAME
End DoDot:1
+40 IF "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR($PIECE(GMRDAT,U,8))
QUIT
+41 SET GMRVITY=+$PIECE(GMRDAT,"^",3)
+42 IF GMRZZ'=""&(GMRVTY'="PO2")
SET GMRZZ=" ("_GMRZZ_")"
+43 IF GMRZZ'=""
IF GMRVTY="PO2"
WRITE !,?8," via "
WRITE GMRZZ
+44 IF GMRVTY="WT"
IF 'GMRVER
SET GMRBMI=""
SET GMRBMI(1)=$PIECE(GMRDAT,"^")
SET GMRBMI(2)=+$PIECE(GMRDAT,"^",8)
DO CALBMI^GMRVBMI(.GMRBMI)
IF GMRBMI>0
WRITE !,?4,"Body Mass Index: "_GMRBMI
+45 KILL Z
QUIT
HDR ;
+1 IF 'GMR1ST
DO FOOTER^GMRVSC0
+2 IF $EXTRACT(IOST)'="P"
IF 'GMR1ST
WRITE "Press return to continue ""^"" to escape "
READ X:DTIME
IF X="^"!'$TEST
SET GMROUT=1
QUIT
+3 IF '($EXTRACT(IOST)'="C"&'$DATA(GFLAG))
WRITE @IOF
SET GMRPG=GMRPG+1
SET GFLAG=1
+4 WRITE !,GMRPDT,?25,"Cumulative Vitals/Measurements Report",?70,"Page ",GMRPG,!!,$EXTRACT(GMRDSH,1,78)
+5 IF 'GMR1ST
IF $PIECE(GMRDATE,".")=GMRDATE(0)
WRITE !,$EXTRACT(GMRDATE(0),4,5)_"/"_$EXTRACT(GMRDATE(0),6,7)_"/"_$EXTRACT(GMRDATE,2,3)_" (continued)",!
+6 SET GMR1ST=0
+7 QUIT
BLNK ;
+1 FOR I=1:1:$LENGTH(Z)
IF $EXTRACT(Z,I)'=" "
QUIT
+2 SET Z=$EXTRACT(Z,I,$LENGTH(Z))
+3 QUIT