GMTSVSS ; SLC/KER - Selected Vital Signs ; 02/27/2002
;;2.7;Health Summary;**8,20,28,35,49,78,107**;Oct 20, 1995;Build 3
;
; External References
; DBIA 4791 EN1^GMVHS
; DBIA 10141 $$VERSION^XPDUTL
; DBIA 10015 EN^DIQ1
; DBIA 10022 %XY^%RCR
;
; Health Summary patch GMTS*2.7*35 will require
; Vitals version 4.0, patch GMRV*4.0*7
;
OUTPAT ; Outpatient Select Vitals Signs Main control
N CNT,COL,COLL,HDR,GMTSDA,GMTSDT,GMTSF,GMTSI,GMW,GMRVSTR,LOOP,MAX,ROW,WIDTH
K ^UTILITY($J,"GMRVD") S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:100)
S GMTSI=0 F S GMTSI=$O(GMTSEG(GMTSEGN,120.51,GMTSI)) Q:GMTSI'>0 S GMTSDA=GMTSEG(GMTSEGN,120.51,GMTSI) D BLDSTR
Q:'$D(GMRVSTR)
S GMRVSTR(0)=GMTSBEG_U_GMTSEND_U_MAX_U_1
; Set to only get Vital Sign for Clinics
S GMRVSTR("LT")="^C^"
;D BLDHDR,EN1^GMRVUT0
D BLDHDR,EN1^GMVHS
; If no data, display most recent inpatient measurements
I '$D(^UTILITY($J,"GMRVD")) D Q
. D CKP^GMTSUP Q:$D(GMTSQIT) W "*** No Outpatient measurements ***",!!
. S MAX=1 D ENVS
S ROW=1 D NXTROW
D WRTHDR,WRTHDR1
S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
I $O(COL(ROW)) F ROW=2:1 Q:'$D(COL(ROW))!($D(GMTSQIT)) D
. D NXTROW
. W !! D WRTHDR,WRTHDR1
. S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
K ^UTILITY($J,"GMRVD"),GMTSVMVR
Q
ENVS ; Set up for extraction routine
N CNT,COL,COLL,HDR,HDR1,GMTSDA,GMTSDT,GMTSF,GMTSI,GMW,LOOP,ROW,WIDTH
K ^UTILITY($J,"GMRVD"),GMRVSTR("LT")
S MAX=$S(+($G(MAX))>0:MAX,+($G(MAX))'>0&(+($G(GMTSNDM))>0):+($G(GMTSNDM)),1:100)
S GMTSI=0 F S GMTSI=$O(GMTSEG(GMTSEGN,120.51,GMTSI)) Q:GMTSI'>0 S GMTSDA=GMTSEG(GMTSEGN,120.51,GMTSI) D BLDSTR
Q:'$D(GMRVSTR)
S GMRVSTR(0)=GMTSBEG_U_GMTSEND_U_MAX_U_1
;D BLDHDR,EN1^GMRVUT0
D BLDHDR,EN1^GMVHS
I '$D(^UTILITY($J,"GMRVD")) Q
S ROW=1 D NXTROW
D WRTHDR,WRTHDR1
S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
I $O(COL(ROW)) F ROW=2:1 Q:'$D(COL(ROW))!($D(GMTSQIT)) D
. D NXTROW
. W !! D WRTHDR,WRTHDR1
. S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
K ^UTILITY($J,"GMRVD"),GMTSVMVR
Q
BLDSTR ; Builds GMRVSTR string for extract call
N DA,DIC,DIQ,DR,VIT
S GMTSVMVR=+$$VERSION^XPDUTL("GMRV")
S DIQ="VIT(",DIQ(0)="E",DIC=120.51,DR="1",DA=GMTSDA
D EN^DIQ1 S VIT=VIT(120.51,DA,1,"E")
S GMRVSTR=$S($D(GMRVSTR):GMRVSTR_";"_VIT,1:VIT)
Q
BLDHDR ; Builds the HDR array
N ABB,GMTSI S COL=18
F GMTSI=1:1:$L(GMRVSTR,";") D
. S (HDR(GMTSI-1),ABB)=$P(GMRVSTR,";",GMTSI)
. S HDR(GMTSI-1)=HDR(GMTSI-1)_U
. S HDR(GMTSI-1)=HDR(GMTSI-1)_$S(ABB="BP":"BP",ABB="PN":"PAIN",ABB="HT":"HEIGHT",ABB="WT":"WEIGHT",ABB="P":"PULSE",ABB="R":"RESP",ABB="T":"TEMP",ABB="PO2":"POx",1:ABB)
. ;p.107 added "PN" and set to 18 to accomodate "Unable to Respond"
. S WIDTH=HDR(GMTSI-1)
. S WIDTH=$S($P(WIDTH,U)="T":13,$P(WIDTH,U)="P":8,$P(WIDTH,U)="R":12,$P(WIDTH,U)="WT":20,$P(WIDTH,U)="CG":34,$P(WIDTH,U)="CVP":16,$P(WIDTH,U)="HT":13,$P(WIDTH,U)="PO2":13,$P(WIDTH,U)="PN":18,1:12)
. S COLL=$P(COL,U,GMTSI)+WIDTH
. S COL=COL_U
. S COL=COL_COLL
. S HDR(GMTSI-1)=HDR(GMTSI-1)_U_COLL_U_WIDTH
S ROW=1,COL(ROW)=18,COLL=18,CNT=0
F LOOP=0:1 Q:'$D(HDR(LOOP)) D
. I $P(HDR(LOOP),U,4)+COLL'>80 D Q
. . S COLL=$P(HDR(LOOP),U,4)+COLL
. . S COL(ROW)=COL(ROW)_U_COLL
. . S HDR1(ROW,CNT)=HDR(LOOP)
. . S CNT=CNT+1
. . K HDR(LOOP)
. S ROW=ROW+1,COL(ROW)=18,COLL=18,CNT=0
. S COLL=$P(HDR(LOOP),U,4)+COLL
. S COL(ROW)=COL(ROW)_U_COLL
. S HDR1(ROW,CNT)=HDR(LOOP)
. S CNT=CNT+1
. K HDR(LOOP)
Q
WRTHDR ; Writes Header
N GMI
D CKP^GMTSUP Q:$D(GMTSQIT) W "Measurement DT"
I GMTSVMVR'>3 F GMI=0:1:5 D CKP^GMTSUP Q:'$D(HDR(GMI))!($D(GMTSQIT)) D
. W ?$P(COL,U,GMI+1),$P(HDR(GMI),U,2)
I GMTSVMVR>3 S GMI="" F S GMI=$O(HDR(GMI)) Q:(GMI="") Q:('$D(HDR(GMI)))!($D(GMTSQIT)) D CKP^GMTSUP D
. W ?$P(COL,U,GMI+1),$P(HDR(GMI),U,2)
D CKP^GMTSUP Q:$D(GMTSQIT) W !
Q
WRTHDR1 ; Writes 2nd line of header
N GMI
I GMTSVMVR'>3 F GMI=0:1:5 D CKP^GMTSUP Q:'$D(HDR(GMI))!($D(GMTSQIT)) D
. I $P(HDR(GMI),U)="HT" W ?$P(COL,U,GMI+1),"IN(CM)"
. I $P(HDR(GMI),U)="WT" W ?$P(COL,U,GMI+1),"LB(KG)"
. I $P(HDR(GMI),U)="T" W ?$P(COL,U,GMI+1),"F(C)"
I GMTSVMVR>3 S GMI="" F S GMI=$O(HDR(GMI)) Q:(GMI="") Q:('$D(HDR(GMI)))!($D(GMTSQIT)) D CKP^GMTSUP D
. I $P(HDR(GMI),U)="HT" W ?$P(COL,U,GMI+1),"IN(CM)"
. I $P(HDR(GMI),U)="WT" W ?$P(COL,U,GMI+1),"LB(KG)[BMI]"
. I $P(HDR(GMI),U)="T" W ?$P(COL,U,GMI+1),"F(C)"
. I $P(HDR(GMI),U)="CVP" W ?$P(COL,U,GMI+1),"CMH20(MMHG)"
. I $P(HDR(GMI),U)="PO2" W ?$P(COL,U,GMI+1),"(L/MIN)(%)"
. I $P(HDR(GMI),U)="CG" W ?$P(COL,U,GMI+1),"IN(CM)"
D CKP^GMTSUP Q:$D(GMTSQIT) W !!
Q
WRT ; Writes vitals record for one observation time
N GMLEN,GMTSBMI,GMTSI,GMTSVAL,GMTDT,GMTSVI,GMTSVT,GMTSMET,GMTSPERC,GMTSLMIN,GMTSQUAL,IEN,X
S GMTSVI="",X=9999999-GMTSDT D REGDTM4^GMTSU S GMTDT=X
D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG WRTHDR,WRTHDR1 W GMTDT
I GMTSVMVR'>3 F GMTSI=0:1:5 S GMTSVI=$O(HDR(GMTSVI)) Q:GMTSVI=""!($D(GMTSQIT)) D
. S GMTSVT=$P(HDR(GMTSVI),U),IEN=$O(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,0))
. I +IEN D CKP^GMTSUP Q:$D(GMTSQIT) D
. . S GMTSVAL=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,8)
. . W ?$P(COL,U,GMTSI+1),GMTSVAL
. . S GMTSMET=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,13) I GMTSMET'="" W "("_$P(^(+IEN),U,13)_")"
. . Q
. Q
I GMTSVMVR>3 F GMTSI=0:1 S GMTSVI=$O(HDR(GMTSVI)) Q:GMTSVI=""!($D(GMTSQIT)) D
. S GMTSVT=$P(HDR(GMTSVI),U),IEN=$O(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,0))
. I +IEN D CKP^GMTSUP Q:$D(GMTSQIT) D
. . S GMTSVAL=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,8)
. . S:GMTSVT="PN"&(GMTSVAL=99) GMTSVAL="Unable to Respond" ;p.107 changed from "No Response" to "Unable to Respond"
. . S:GMTSVT="P"&(GMTSVAL?1A.E) GMTSVAL=$E(GMTSVAL,1,7)
. . W ?$P(COL,U,GMTSI+1),GMTSVAL
. . S GMTSMET=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,13,17)
. . S GMTSLMIN=$P(GMTSMET,U,3),GMTSPERC=$P(GMTSMET,U,4)
. . S GMTSQUAL=$P(GMTSMET,U,5) S:GMTSQUAL]"" GMTSQUAL=$E(GMTSQUAL,1,15)
. . S GMTSBMI=$P(GMTSMET,U,2),GMTSMET=$P(GMTSMET,U,1)
. . I GMTSMET'="" W "("_GMTSMET_")" ; centigrade/kilos/centimeters
. . I GMTSBMI'="" W "["_GMTSBMI_"]" ; body mass index
. . I GMTSLMIN'=""!(GMTSPERC'="") W "["_GMTSLMIN_"]["_GMTSPERC_"]" ; [liters/min supplemental O2][% supplemental O2]
. . I GMTSVT="CG",GMTSQUAL]"" W "["_GMTSQUAL_"]" ; qualifiers
. . Q
. Q
Q
NXTROW ; Get the Next Row of Vital Signs
Q:$G(ROW)'>0 K HDR S %X="HDR1(ROW,",%Y="HDR(" D %XY^%RCR
S COL=COL(ROW) K %X,%Y
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSVSS 6955 printed Dec 13, 2024@02:00:42 Page 2
GMTSVSS ; SLC/KER - Selected Vital Signs ; 02/27/2002
+1 ;;2.7;Health Summary;**8,20,28,35,49,78,107**;Oct 20, 1995;Build 3
+2 ;
+3 ; External References
+4 ; DBIA 4791 EN1^GMVHS
+5 ; DBIA 10141 $$VERSION^XPDUTL
+6 ; DBIA 10015 EN^DIQ1
+7 ; DBIA 10022 %XY^%RCR
+8 ;
+9 ; Health Summary patch GMTS*2.7*35 will require
+10 ; Vitals version 4.0, patch GMRV*4.0*7
+11 ;
OUTPAT ; Outpatient Select Vitals Signs Main control
+1 NEW CNT,COL,COLL,HDR,GMTSDA,GMTSDT,GMTSF,GMTSI,GMW,GMRVSTR,LOOP,MAX,ROW,WIDTH
+2 KILL ^UTILITY($JOB,"GMRVD")
SET MAX=$SELECT(+($GET(GMTSNDM))>0:+($GET(GMTSNDM)),1:100)
+3 SET GMTSI=0
FOR
SET GMTSI=$ORDER(GMTSEG(GMTSEGN,120.51,GMTSI))
if GMTSI'>0
QUIT
SET GMTSDA=GMTSEG(GMTSEGN,120.51,GMTSI)
DO BLDSTR
+4 if '$DATA(GMRVSTR)
QUIT
+5 SET GMRVSTR(0)=GMTSBEG_U_GMTSEND_U_MAX_U_1
+6 ; Set to only get Vital Sign for Clinics
+7 SET GMRVSTR("LT")="^C^"
+8 ;D BLDHDR,EN1^GMRVUT0
+9 DO BLDHDR
DO EN1^GMVHS
+10 ; If no data, display most recent inpatient measurements
+11 IF '$DATA(^UTILITY($JOB,"GMRVD"))
Begin DoDot:1
+12 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE "*** No Outpatient measurements ***",!!
+13 SET MAX=1
DO ENVS
End DoDot:1
QUIT
+14 SET ROW=1
DO NXTROW
+15 DO WRTHDR
DO WRTHDR1
+16 SET GMTSDT=""
FOR GMTSF=1:1:MAX
SET GMTSDT=$ORDER(^UTILITY($JOB,"GMRVD",GMTSDT))
if GMTSDT'>0
QUIT
DO WRT
if $DATA(GMTSQIT)
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE !
+17 IF $ORDER(COL(ROW))
FOR ROW=2:1
if '$DATA(COL(ROW))!($DATA(GMTSQIT))
QUIT
Begin DoDot:1
+18 DO NXTROW
+19 WRITE !!
DO WRTHDR
DO WRTHDR1
+20 SET GMTSDT=""
FOR GMTSF=1:1:MAX
SET GMTSDT=$ORDER(^UTILITY($JOB,"GMRVD",GMTSDT))
if GMTSDT'>0
QUIT
DO WRT
if $DATA(GMTSQIT)
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE !
End DoDot:1
+21 KILL ^UTILITY($JOB,"GMRVD"),GMTSVMVR
+22 QUIT
ENVS ; Set up for extraction routine
+1 NEW CNT,COL,COLL,HDR,HDR1,GMTSDA,GMTSDT,GMTSF,GMTSI,GMW,LOOP,ROW,WIDTH
+2 KILL ^UTILITY($JOB,"GMRVD"),GMRVSTR("LT")
+3 SET MAX=$SELECT(+($GET(MAX))>0:MAX,+($GET(MAX))'>0&(+($GET(GMTSNDM))>0):+($GET(GMTSNDM)),1:100)
+4 SET GMTSI=0
FOR
SET GMTSI=$ORDER(GMTSEG(GMTSEGN,120.51,GMTSI))
if GMTSI'>0
QUIT
SET GMTSDA=GMTSEG(GMTSEGN,120.51,GMTSI)
DO BLDSTR
+5 if '$DATA(GMRVSTR)
QUIT
+6 SET GMRVSTR(0)=GMTSBEG_U_GMTSEND_U_MAX_U_1
+7 ;D BLDHDR,EN1^GMRVUT0
+8 DO BLDHDR
DO EN1^GMVHS
+9 IF '$DATA(^UTILITY($JOB,"GMRVD"))
QUIT
+10 SET ROW=1
DO NXTROW
+11 DO WRTHDR
DO WRTHDR1
+12 SET GMTSDT=""
FOR GMTSF=1:1:MAX
SET GMTSDT=$ORDER(^UTILITY($JOB,"GMRVD",GMTSDT))
if GMTSDT'>0
QUIT
DO WRT
if $DATA(GMTSQIT)
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE !
+13 IF $ORDER(COL(ROW))
FOR ROW=2:1
if '$DATA(COL(ROW))!($DATA(GMTSQIT))
QUIT
Begin DoDot:1
+14 DO NXTROW
+15 WRITE !!
DO WRTHDR
DO WRTHDR1
+16 SET GMTSDT=""
FOR GMTSF=1:1:MAX
SET GMTSDT=$ORDER(^UTILITY($JOB,"GMRVD",GMTSDT))
if GMTSDT'>0
QUIT
DO WRT
if $DATA(GMTSQIT)
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE !
End DoDot:1
+17 KILL ^UTILITY($JOB,"GMRVD"),GMTSVMVR
+18 QUIT
BLDSTR ; Builds GMRVSTR string for extract call
+1 NEW DA,DIC,DIQ,DR,VIT
+2 SET GMTSVMVR=+$$VERSION^XPDUTL("GMRV")
+3 SET DIQ="VIT("
SET DIQ(0)="E"
SET DIC=120.51
SET DR="1"
SET DA=GMTSDA
+4 DO EN^DIQ1
SET VIT=VIT(120.51,DA,1,"E")
+5 SET GMRVSTR=$SELECT($DATA(GMRVSTR):GMRVSTR_";"_VIT,1:VIT)
+6 QUIT
BLDHDR ; Builds the HDR array
+1 NEW ABB,GMTSI
SET COL=18
+2 FOR GMTSI=1:1:$LENGTH(GMRVSTR,";")
Begin DoDot:1
+3 SET (HDR(GMTSI-1),ABB)=$PIECE(GMRVSTR,";",GMTSI)
+4 SET HDR(GMTSI-1)=HDR(GMTSI-1)_U
+5 SET HDR(GMTSI-1)=HDR(GMTSI-1)_$SELECT(ABB="BP":"BP",ABB="PN":"PAIN",ABB="HT":"HEIGHT",ABB="WT":"WEIGHT",ABB="P":"PULSE",ABB="R":"RESP",ABB="T":"TEMP",ABB="PO2":"POx",1:ABB)
+6 ;p.107 added "PN" and set to 18 to accomodate "Unable to Respond"
+7 SET WIDTH=HDR(GMTSI-1)
+8 SET WIDTH=$SELECT($PIECE(WIDTH,U)="T":13,$PIECE(WIDTH,U)="P":8,$PIECE(WIDTH,U)="R":12,$PIECE(WIDTH,U)="WT":20,$PIECE(WIDTH,U)="CG":34,$PIECE(WIDTH,U)="CVP":16,$PIECE(WIDTH,U)="HT":13,$PIECE(WIDTH,U)="PO2":13,$PIECE(WIDTH,U)="PN":18,1:12
)
+9 SET COLL=$PIECE(COL,U,GMTSI)+WIDTH
+10 SET COL=COL_U
+11 SET COL=COL_COLL
+12 SET HDR(GMTSI-1)=HDR(GMTSI-1)_U_COLL_U_WIDTH
End DoDot:1
+13 SET ROW=1
SET COL(ROW)=18
SET COLL=18
SET CNT=0
+14 FOR LOOP=0:1
if '$DATA(HDR(LOOP))
QUIT
Begin DoDot:1
+15 IF $PIECE(HDR(LOOP),U,4)+COLL'>80
Begin DoDot:2
+16 SET COLL=$PIECE(HDR(LOOP),U,4)+COLL
+17 SET COL(ROW)=COL(ROW)_U_COLL
+18 SET HDR1(ROW,CNT)=HDR(LOOP)
+19 SET CNT=CNT+1
+20 KILL HDR(LOOP)
End DoDot:2
QUIT
+21 SET ROW=ROW+1
SET COL(ROW)=18
SET COLL=18
SET CNT=0
+22 SET COLL=$PIECE(HDR(LOOP),U,4)+COLL
+23 SET COL(ROW)=COL(ROW)_U_COLL
+24 SET HDR1(ROW,CNT)=HDR(LOOP)
+25 SET CNT=CNT+1
+26 KILL HDR(LOOP)
End DoDot:1
+27 QUIT
WRTHDR ; Writes Header
+1 NEW GMI
+2 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE "Measurement DT"
+3 IF GMTSVMVR'>3
FOR GMI=0:1:5
DO CKP^GMTSUP
if '$DATA(HDR(GMI))!($DATA(GMTSQIT))
QUIT
Begin DoDot:1
+4 WRITE ?$PIECE(COL,U,GMI+1),$PIECE(HDR(GMI),U,2)
End DoDot:1
+5 IF GMTSVMVR>3
SET GMI=""
FOR
SET GMI=$ORDER(HDR(GMI))
if (GMI="")
QUIT
if ('$DATA(HDR(GMI)))!($DATA(GMTSQIT))
QUIT
DO CKP^GMTSUP
Begin DoDot:1
+6 WRITE ?$PIECE(COL,U,GMI+1),$PIECE(HDR(GMI),U,2)
End DoDot:1
+7 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE !
+8 QUIT
WRTHDR1 ; Writes 2nd line of header
+1 NEW GMI
+2 IF GMTSVMVR'>3
FOR GMI=0:1:5
DO CKP^GMTSUP
if '$DATA(HDR(GMI))!($DATA(GMTSQIT))
QUIT
Begin DoDot:1
+3 IF $PIECE(HDR(GMI),U)="HT"
WRITE ?$PIECE(COL,U,GMI+1),"IN(CM)"
+4 IF $PIECE(HDR(GMI),U)="WT"
WRITE ?$PIECE(COL,U,GMI+1),"LB(KG)"
+5 IF $PIECE(HDR(GMI),U)="T"
WRITE ?$PIECE(COL,U,GMI+1),"F(C)"
End DoDot:1
+6 IF GMTSVMVR>3
SET GMI=""
FOR
SET GMI=$ORDER(HDR(GMI))
if (GMI="")
QUIT
if ('$DATA(HDR(GMI)))!($DATA(GMTSQIT))
QUIT
DO CKP^GMTSUP
Begin DoDot:1
+7 IF $PIECE(HDR(GMI),U)="HT"
WRITE ?$PIECE(COL,U,GMI+1),"IN(CM)"
+8 IF $PIECE(HDR(GMI),U)="WT"
WRITE ?$PIECE(COL,U,GMI+1),"LB(KG)[BMI]"
+9 IF $PIECE(HDR(GMI),U)="T"
WRITE ?$PIECE(COL,U,GMI+1),"F(C)"
+10 IF $PIECE(HDR(GMI),U)="CVP"
WRITE ?$PIECE(COL,U,GMI+1),"CMH20(MMHG)"
+11 IF $PIECE(HDR(GMI),U)="PO2"
WRITE ?$PIECE(COL,U,GMI+1),"(L/MIN)(%)"
+12 IF $PIECE(HDR(GMI),U)="CG"
WRITE ?$PIECE(COL,U,GMI+1),"IN(CM)"
End DoDot:1
+13 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE !!
+14 QUIT
WRT ; Writes vitals record for one observation time
+1 NEW GMLEN,GMTSBMI,GMTSI,GMTSVAL,GMTDT,GMTSVI,GMTSVT,GMTSMET,GMTSPERC,GMTSLMIN,GMTSQUAL,IEN,X
+2 SET GMTSVI=""
SET X=9999999-GMTSDT
DO REGDTM4^GMTSU
SET GMTDT=X
+3 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO WRTHDR
DO WRTHDR1
WRITE GMTDT
+4 IF GMTSVMVR'>3
FOR GMTSI=0:1:5
SET GMTSVI=$ORDER(HDR(GMTSVI))
if GMTSVI=""!($DATA(GMTSQIT))
QUIT
Begin DoDot:1
+5 SET GMTSVT=$PIECE(HDR(GMTSVI),U)
SET IEN=$ORDER(^UTILITY($JOB,"GMRVD",GMTSDT,GMTSVT,0))
+6 IF +IEN
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
Begin DoDot:2
+7 SET GMTSVAL=$PIECE(^UTILITY($JOB,"GMRVD",GMTSDT,GMTSVT,+IEN),U,8)
+8 WRITE ?$PIECE(COL,U,GMTSI+1),GMTSVAL
+9 SET GMTSMET=$PIECE(^UTILITY($JOB,"GMRVD",GMTSDT,GMTSVT,+IEN),U,13)
IF GMTSMET'=""
WRITE "("_$PIECE(^(+IEN),U,13)_")"
+10 QUIT
End DoDot:2
+11 QUIT
End DoDot:1
+12 IF GMTSVMVR>3
FOR GMTSI=0:1
SET GMTSVI=$ORDER(HDR(GMTSVI))
if GMTSVI=""!($DATA(GMTSQIT))
QUIT
Begin DoDot:1
+13 SET GMTSVT=$PIECE(HDR(GMTSVI),U)
SET IEN=$ORDER(^UTILITY($JOB,"GMRVD",GMTSDT,GMTSVT,0))
+14 IF +IEN
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
Begin DoDot:2
+15 SET GMTSVAL=$PIECE(^UTILITY($JOB,"GMRVD",GMTSDT,GMTSVT,+IEN),U,8)
+16 ;p.107 changed from "No Response" to "Unable to Respond"
if GMTSVT="PN"&(GMTSVAL=99)
SET GMTSVAL="Unable to Respond"
+17 if GMTSVT="P"&(GMTSVAL?1A.E)
SET GMTSVAL=$EXTRACT(GMTSVAL,1,7)
+18 WRITE ?$PIECE(COL,U,GMTSI+1),GMTSVAL
+19 SET GMTSMET=$PIECE(^UTILITY($JOB,"GMRVD",GMTSDT,GMTSVT,+IEN),U,13,17)
+20 SET GMTSLMIN=$PIECE(GMTSMET,U,3)
SET GMTSPERC=$PIECE(GMTSMET,U,4)
+21 SET GMTSQUAL=$PIECE(GMTSMET,U,5)
if GMTSQUAL]""
SET GMTSQUAL=$EXTRACT(GMTSQUAL,1,15)
+22 SET GMTSBMI=$PIECE(GMTSMET,U,2)
SET GMTSMET=$PIECE(GMTSMET,U,1)
+23 ; centigrade/kilos/centimeters
IF GMTSMET'=""
WRITE "("_GMTSMET_")"
+24 ; body mass index
IF GMTSBMI'=""
WRITE "["_GMTSBMI_"]"
+25 ; [liters/min supplemental O2][% supplemental O2]
IF GMTSLMIN'=""!(GMTSPERC'="")
WRITE "["_GMTSLMIN_"]["_GMTSPERC_"]"
+26 ; qualifiers
IF GMTSVT="CG"
IF GMTSQUAL]""
WRITE "["_GMTSQUAL_"]"
+27 QUIT
End DoDot:2
+28 QUIT
End DoDot:1
+29 QUIT
NXTROW ; Get the Next Row of Vital Signs
+1 if $GET(ROW)'>0
QUIT
KILL HDR
SET %X="HDR1(ROW,"
SET %Y="HDR("
DO %XY^%RCR
+2 SET COL=COL(ROW)
KILL %X,%Y
+3 QUIT