GMVSC2 ;HIRMFO/YH,FT-CUMULATIVE V/M - CONTINUED ;10/30/07 10:16
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #10104 - ^XLFSTR calls (supported)
;
SETLN ; {called from GMVSC1}
N GMRVPO,GMVLOOP,GMVQNAME
K GMRVARY
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^GMVSAS0
. 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^GMVSAS0
. D EN1^GMVUTL 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^GMVUTL 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^GMVUTL 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)"
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^GMVBMI(.GMRBMI) W:GMRBMI>0 !,?4,"Body Mass Index: "_GMRBMI
K Z
Q
HDR ; Report header
I 'GMR1ST D FOOTER^GMVSC0
W:$Y>0 @IOF
S GMRPG=GMRPG+1,GFLAG=1 ;what is GFLAG?
W !,GMRPDT,?25,"Cumulative Vitals/Measurements Report",?70,"Page ",GMRPG
W !?25,GMVRANGE ;report date range
W !,$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)",!
; include date range in header
S GMR1ST=0
Q
BLNK ;
F I=1:1:$L(Z) Q:$E(Z,I)'=" "
S Z=$E(Z,I,$L(Z))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMVSC2 3447 printed Dec 13, 2024@01:59:55 Page 2
GMVSC2 ;HIRMFO/YH,FT-CUMULATIVE V/M - CONTINUED ;10/30/07 10:16
+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 ; {called from GMVSC1}
+1 NEW GMRVPO,GMVLOOP,GMVQNAME
+2 KILL GMRVARY
+3 SET GMRVER=$PIECE(^TMP($JOB,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",1)
+4 SET GMRVARY=$PIECE(^TMP($JOB,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",3)
+5 if IOSL<($Y+9)
DO HDR
if GMROUT
QUIT
WRITE !
if GMRVER
WRITE "(E)"
+6 IF GPRT(GMRVTY)=0
Begin DoDot:1
+7 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
:"")
+8 IF GMRVTY="PN"
WRITE ?4,"Pain: "
End DoDot:1
+9 SET GPRT(GMRVTY)=1
+10 SET GMRDAT=$PIECE(^TMP($JOB,"GMRV",GMRDATE,GMRVTY,GMRVDA),"|",2)
+11 IF "PRBPCVPCGPO2PN"[GMRVTY
SET GMRVX=GMRVTY
SET GMRVX(0)=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+12 IF "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR(GMRVX(0))
WRITE ?9,GMRVX(0)
QUIT
+13 IF GMRVTY="PN"
Begin DoDot:2
+14 IF GMRVX(0)=0
WRITE ?9,GMRVX(0)_" - No pain"
QUIT
+15 IF GMRVX(0)=99
WRITE ?9,GMRVX(0)_" - Unable to respond"
QUIT
+16 IF GMRVX(0)=10
WRITE ?9,GMRVX(0)_" - Worst imaginable pain"
QUIT
+17 WRITE ?9,GMRVX(0)
QUIT
End DoDot:2
+18 ;I GMRVTY'="PN" W ?9,GMRVX(0)
+19 DO EN1^GMVSAS0
+20 IF GMRVTY="P"
IF "^"_GPEDIS_"^"[GMRVARY
IF $PIECE(GMRDAT,"^",8)=1
SET GMRVX(1)=""
+21 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:"*")
+22 IF GMRVTY="CG"
WRITE " in ("_$JUSTIFY(Z/.3937,0,2)_" cm)"
+23 IF GMRVTY="CVP"
WRITE " cmH2O ("_$JUSTIFY(Z/1.36,0,1)_" mmHg)"
+24 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
+25 IF GMRVTY="T"
SET X=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+26 IF X'>0
WRITE ?9,X
QUIT
+27 SET GMRVX=GMRVTY
SET GMRVX(0)=X
DO EN1^GMVSAS0
+28 DO EN1^GMVUTL
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
+29 IF GMRVTY="HT"
SET X=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+30 IF X'>0
WRITE ?9,X
QUIT
+31 DO EN2^GMVUTL
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
+32 IF GMRVTY="WT"
SET X=$PIECE(GMRDAT,"^",8)
Begin DoDot:1
+33 IF X'>0
WRITE ?9,X
QUIT
+34 DO EN3^GMVUTL
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
+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^GMVBMI(.GMRBMI)
if GMRBMI>0
WRITE !,?4,"Body Mass Index: "_GMRBMI
+45 KILL Z
+46 QUIT
HDR ; Report header
+1 IF 'GMR1ST
DO FOOTER^GMVSC0
+2 if $Y>0
WRITE @IOF
+3 ;what is GFLAG?
SET GMRPG=GMRPG+1
SET GFLAG=1
+4 WRITE !,GMRPDT,?25,"Cumulative Vitals/Measurements Report",?70,"Page ",GMRPG
+5 ;report date range
WRITE !?25,GMVRANGE
+6 WRITE !,$EXTRACT(GMRDSH,1,78)
+7 IF 'GMR1ST
IF $PIECE(GMRDATE,".")=GMRDATE(0)
WRITE !,$EXTRACT(GMRDATE(0),4,5)_"/"_$EXTRACT(GMRDATE(0),6,7)_"/"_$EXTRACT(GMRDATE,2,3)_" (continued)",!
+8 ; include date range in header
+9 SET GMR1ST=0
+10 QUIT
BLNK ;
+1 FOR I=1:1:$LENGTH(Z)
if $EXTRACT(Z,I)'=" "
QUIT
+2 SET Z=$EXTRACT(Z,I,$LENGTH(Z))
+3 QUIT