GMVDS0 ;HIOFO/YH,FT-DISPLAY LATEST VITALS/MEASUREMENTS ;6/7/07
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #4290 - ^PXRMINDX global (controlled)
; #10061 - ^VADPT calls (supported)
; #10104 - ^XLFSTR calls (supported)
;
EN1 ; ENTRY TO DISPLAY VITALS {called from GMVDS1}
N GAPICAL,GRADIAL,GBRACHI,OK
N GMVCLIO,GMVLOOP,GMVQLIST,GMVQNAME,GMVSUPOX
S GAPICAL=$O(^GMRD(120.52,"B","APICAL",0)),GRADIAL=$O(^GMRD(120.52,"B","RADIAL",0)),GBRACHI=$O(^GMRD(120.52,"B","BRACHIAL",0))
F GMRX=1:1:$L(GMRSTR,";") S X=$P(GMRSTR,";",GMRX) Q:'$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 GMRDAT=9999999,GMRDATS="" I GMR(X)'="" 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) W !,"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 GMRVX(0)=GMRDATA(X,GMVD,GMVD(1)) S GMRVX=X D EN1^GMVSAS0
. W ! W:GMRVDT(1)=0 $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 W ?12,"("_GMRVDT_") " S GMRVDT(1)=1
. I X="T" W ?29,GMRVX(0)_" F ("_$J(+GMRVX(0)-32*5/9,0,1)_" C)"
. I X="WT" W ?29,GMRVX(0)_" lb ("_$J(GMRVX(0)/2.2,0,2)_" kg)" S GMRVWT=GMRVX(0)/2.2
. I X="HT" W ?29,$S(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$S(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_" ("_$J(GMRVX(0)*2.54,0,2)_" cm)" S GMRVHT=(GMRVX(0)*2.54)/100
. I X="CG" W ?29,GMRVX(0)_" in ("_$J(+GMRVX(0)/.3937,0,2)_" cm)"
. I X="CVP" W ?29,GMRVX(0)_" cmH2O ("_$J(GMRVX(0)/1.36,0,1)_" mmHg)"
. I X="PO2" W ?29,GMRVX(0)_"% "
. I X="P"!(X="R")!(X="BP") W ?29,GMRVX(0)
. I X="PN" D
. . I "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR(GMRVX(0)) W ?9,GMRVX(0) Q
. . I GMRVX(0)=0 W ?29,GMRVX(0)_" - No pain " Q
. . I GMRVX(0)=99 W ?29,GMRVX(0)_" - Unable to respond " Q
. . I GMRVX(0)=10 W ?29,GMRVX(0)_" - Worst imaginable pain " Q
. . W ?29,GMRVX(0) Q
. W $S('$D(GMRVX(1)):"",'GMRVX(1):"",1:"*") K GMRVX
. D CHAR
. I X="WT",$G(GMRVWT)>0,$G(GMRVHT)>0 W !,"BMI: " S GMRVHT(1)=$J(GMRVWT/(GMRVHT*GMRVHT),0,0) W ?29,GMRVHT(1)_$S(GMRVHT(1)>27:"*",1:"")
. Q
Q W !
K GMRVWT,GMRVHT,GMR,GMVD,GBP,GMRVARY,GMRVDA,GMRDATA,GMVDM,GLIN,GMRZZ Q:$D(GLOC)
K GMRVDT,GMROUT,DFN,%Y,GMRL,GMRDT,DIC,GMRDAT,GMRDATS,GMRSTR,GMRX,GMRVX,POP D KVAR^VADPT K VA
Q
SETDATAR ;
S Y=0
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 GMVLOOP=0,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
.S GMVSUPOX=$P(GMVCLIO(0),U,10) ;supplemental oxygen
.D SETNODE
.;D:X="BP"!(X="P") SETBP^GMVDS2
.Q
Q
SETNODE ; {called from GMVDS2}
N G
S GMRL=$G(GMRL,"")
I X'="P" S G=$P(GMRL,"^",8) Q:"REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR(G)
I X="P" S OK=0,G=$P(GMRL,"^",8) D Q:'OK
.I "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR(G) Q
.I GMVCLIO(5)="" S OK=1 Q
.F GMVLOOP=1:1 Q:$P(GMVCLIO(5),U,GMVLOOP)=""!(OK=1) D
..I $P(GMVCLIO(5),U,GMVLOOP)=GAPICAL S OK=1 Q
..I $P(GMVCLIO(5),U,GMVLOOP)=GBRACHI S OK=1 Q
..I $P(GMVCLIO(5),U,GMVLOOP)=GRADIAL S OK=1
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,"^"),Y)=$P(GMRL,"^",8),GMRDATS=1
S GMRVARY(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^GMVCHAR(GMVD(1),.GMRVARY,5)
S GMRZZ=GMRVARY(X,GMVD,GMVD(1))
S:GMRZZ'=""&(X'="PO2") GMRZZ="("_GMRZZ_")"
I X="PO2",GMVSUPOX'="" S GMRVPO=GMVSUPOX W "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)_" " W:GMRZZ'="" !,?29,"- ",GMRZZ K GMRZZ Q
W:GMRZZ'="" GMRZZ K GMRZZ
Q
GMVDS0 ;HIOFO/YH,FT-DISPLAY LATEST VITALS/MEASUREMENTS ;6/7/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #4290 - ^PXRMINDX global (controlled)
+5 ; #10061 - ^VADPT calls (supported)
+6 ; #10104 - ^XLFSTR calls (supported)
+7 ;
EN1 ; ENTRY TO DISPLAY VITALS {called from GMVDS1}
+1 NEW GAPICAL,GRADIAL,GBRACHI,OK
+2 NEW GMVCLIO,GMVLOOP,GMVQLIST,GMVQNAME,GMVSUPOX
+3 SET GAPICAL=$ORDER(^GMRD(120.52,"B","APICAL",0))
SET GRADIAL=$ORDER(^GMRD(120.52,"B","RADIAL",0))
SET GBRACHI=$ORDER(^GMRD(120.52,"B","BRACHIAL",0))
+4 FOR GMRX=1:1:$LENGTH(GMRSTR,";")
SET X=$PIECE(GMRSTR,";",GMRX)
IF '$DATA(^GMRD(120.51,"C",X))
QUIT
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 GMRDAT=9999999
SET GMRDATS=""
IF GMR(X)'=""
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)
WRITE !,"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 GMRVX(0)=GMRDATA(X,GMVD,GMVD(1))
SET GMRVX=X
DO EN1^GMVSAS0
+11 WRITE !
IF GMRVDT(1)=0
WRITE $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)_": "
+12 IF GMRVDT(1)=0
WRITE ?12,"("_GMRVDT_") "
SET GMRVDT(1)=1
+13 IF X="T"
WRITE ?29,GMRVX(0)_" F ("_$JUSTIFY(+GMRVX(0)-32*5/9,0,1)_" C)"
+14 IF X="WT"
WRITE ?29,GMRVX(0)_" lb ("_$JUSTIFY(GMRVX(0)/2.2,0,2)_" kg)"
SET GMRVWT=GMRVX(0)/2.2
+15 IF X="HT"
WRITE ?29,$SELECT(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$SELECT(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_" ("_$JUSTIFY(GMRVX(0)*2.54,0,2)_" cm)"
SET GMRVHT=(GMRVX(0)*2.54)/100
+16 IF X="CG"
WRITE ?29,GMRVX(0)_" in ("_$JUSTIFY(+GMRVX(0)/.3937,0,2)_" cm)"
+17 IF X="CVP"
WRITE ?29,GMRVX(0)_" cmH2O ("_$JUSTIFY(GMRVX(0)/1.36,0,1)_" mmHg)"
+18 IF X="PO2"
WRITE ?29,GMRVX(0)_"% "
+19 IF X="P"!(X="R")!(X="BP")
WRITE ?29,GMRVX(0)
+20 IF X="PN"
Begin DoDot:2
+21 IF "UNAVAILABLEPASSREFUSED"[$$UP^XLFSTR(GMRVX(0))
WRITE ?9,GMRVX(0)
QUIT
+22 IF GMRVX(0)=0
WRITE ?29,GMRVX(0)_" - No pain "
QUIT
+23 IF GMRVX(0)=99
WRITE ?29,GMRVX(0)_" - Unable to respond "
QUIT
+24 IF GMRVX(0)=10
WRITE ?29,GMRVX(0)_" - Worst imaginable pain "
QUIT
+25 WRITE ?29,GMRVX(0)
QUIT
End DoDot:2
+26 WRITE $SELECT('$DATA(GMRVX(1)):"",'GMRVX(1):"",1:"*")
KILL GMRVX
+27 DO CHAR
+28 IF X="WT"
IF $GET(GMRVWT)>0
IF $GET(GMRVHT)>0
WRITE !,"BMI: "
SET GMRVHT(1)=$JUSTIFY(GMRVWT/(GMRVHT*GMRVHT),0,0)
WRITE ?29,GMRVHT(1)_$SELECT(GMRVHT(1)>27:"*",1:"")
+29 QUIT
End DoDot:1
Q WRITE !
+1 KILL GMRVWT,GMRVHT,GMR,GMVD,GBP,GMRVARY,GMRVDA,GMRDATA,GMVDM,GLIN,GMRZZ
IF $DATA(GLOC)
QUIT
+2 KILL GMRVDT,GMROUT,DFN,%Y,GMRL,GMRDT,DIC,GMRDAT,GMRDATS,GMRSTR,GMRX,GMRVX,POP
DO KVAR^VADPT
KILL VA
+3 QUIT
SETDATAR ;
+1 SET Y=0
+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 GMVLOOP=0
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
End DoDot:2
+15 ;supplemental oxygen
SET GMVSUPOX=$PIECE(GMVCLIO(0),U,10)
+16 DO SETNODE
+17 ;D:X="BP"!(X="P") SETBP^GMVDS2
+18 QUIT
End DoDot:1
+19 QUIT
SETNODE ; {called from GMVDS2}
+1 NEW G
+2 SET GMRL=$GET(GMRL,"")
+3 IF X'="P"
SET G=$PIECE(GMRL,"^",8)
IF "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR(G)
QUIT
+4 IF X="P"
SET OK=0
SET G=$PIECE(GMRL,"^",8)
Begin DoDot:1
+5 IF "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR(G)
QUIT
+6 IF GMVCLIO(5)=""
SET OK=1
QUIT
+7 FOR GMVLOOP=1:1
IF $PIECE(GMVCLIO(5),U,GMVLOOP)=""!(OK=1)
QUIT
Begin DoDot:2
+8 IF $PIECE(GMVCLIO(5),U,GMVLOOP)=GAPICAL
SET OK=1
QUIT
+9 IF $PIECE(GMVCLIO(5),U,GMVLOOP)=GBRACHI
SET OK=1
QUIT
+10 IF $PIECE(GMVCLIO(5),U,GMVLOOP)=GRADIAL
SET OK=1
End DoDot:2
End DoDot:1
IF 'OK
QUIT
+11 ;adding trailing zeros to time if necessary
SET GMRL1=$PIECE(GMRL,"^")
+12 SET $PIECE(GMRL1,".",2)=$PIECE(GMRL1,".",2)_"0000"
+13 SET $PIECE(GMRL1,".",2)=$EXTRACT($PIECE(GMRL1,".",2),1,4)
+14 SET $PIECE(GMRL,"^")=GMRL1
+15 KILL GMRL1
+16 SET GMRDATA(X,$PIECE(GMRL,"^"),Y)=$PIECE(GMRL,"^",8)
SET GMRDATS=1
+17 SET GMRVARY(X,$PIECE(GMRL,U,1),Y)=GMVQLIST
+18 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^GMVCHAR(GMVD(1),.GMRVARY,5)
+2 SET GMRZZ=GMRVARY(X,GMVD,GMVD(1))
+3 IF GMRZZ'=""&(X'="PO2")
SET GMRZZ="("_GMRZZ_")"
+4 IF X="PO2"
IF GMVSUPOX'=""
SET GMRVPO=GMVSUPOX
WRITE "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)_" "
IF GMRZZ'=""
WRITE !,?29,"- ",GMRZZ
KILL GMRZZ
QUIT
+5 IF GMRZZ'=""
WRITE GMRZZ
KILL GMRZZ
+6 QUIT