GMVGGR2 ;HOIFO/YH,FT-SET ^TMP($J) GLOBAL ;6/6/07
;;5.0;GEN. MED. REC. - VITALS;**3,23**;Oct 31, 2002;Build 25
;CONTINUTATION OF GMVGGR1
;
; This routine uses the following IAs:
; #10061 - ^VADPT calls (supported)
;
GRAPH ;
D:GMR=0 SETV
I '$D(^TMP($J,"GMRVG")) S GN=GN+1,^TMP($J,GN)="NO DATA",RESULT=$NA(^TMP($J)) Q
K GMRQUAL S GDT=0 F S GDT=$O(^TMP($J,"GMRVG",GDT)) Q:GDT'>0 D
. S:GMR=0 GN=GN+1,^TMP($J,GN)="^^^^^^^^^^^^^^^^^^^^^" D DATE
. S GI="" F S GI=$O(^TMP($J,"GMRVG",GDT,GI)) Q:GI="" D
. . S GK="" F S GK=$O(^TMP($J,"GMRVG",GDT,GI,GK)) Q:GK="" D SETA
D KVAR^VADPT K VA
;RETURN CALL ROUTINE WITH QUALIFIERS
I GMR=1,$D(GMRQUAL) D
. S (GQ,GQ(1))=""
. F S GQ=$O(GMRQUAL(GQ)) Q:GQ="" D
. . S I=0,GQ(1)=$S(GQ="T":"TEMPERATURE",GQ="P":"PULSE",GQ="R":"RESPIRATION",GQ="B":"BLOOD PRESSURE",GQ="H":"HEIGHT",GQ="W":"WEIGHT",GQ="CVP":"CVP",GQ="PO2":"PULSE OXIMETRY",GQ="CG":"CIRCUMFERENCE/GIRTH",1:"")
. . Q:GQ(1)="" S GN=GN+1,^TMP($J,GN)=GQ(1)_"--- "
. . S GQ(2)="" F S GQ(2)=$O(GMRQUAL(GQ,GQ(2))) Q:GQ(2)="" S I=I+1 S:I>1 ^TMP($J,GN)=^(GN)_"," S ^TMP($J,GN)=^TMP($J,GN)_" "_GQ(2)
K GQ,GG,GI,GMRVJ,GSYNO,GHOLD,GLINE,GMRQUAL
K ^TMP($J,"GMR"),^TMP($J,"GMRVG")
S RESULT=$NA(^TMP($J))
Q
SETV ;Set patient data in ^TMP($J,"GMRK" global
D DEM^VADPT,INP^VADPT
S GN=1,^TMP($J,GN)=$S(VADM(1)'="":VADM(1),1:" ")_" "_$S(VADM(2)'="":$E($P(VADM(2),"^",2),8,11),1:" ")_" "_$S($D(VADM(3)):$P(VADM(3),"^",2),1:" ")_" "_$S($D(VADM(4)):VADM(4),1:" ")_" (Yrs)"
S ^TMP($J,GN)=^(GN)_" "_$S($D(VADM(5)):$P(VADM(5),"^",2),1:" ")
S GN=2,^TMP($J,GN)="Unit: "_$P($G(VAIN(4)),"^",2)_" Room: "_$P($G(VAIN(5)),"-",1,2)
I '$D(GMRVHLOC) S GMRVHLOC=$$HOSPLOC^GMVUTL1(+$G(VAIN(4)))
S GN=3,^TMP($J,GN)="Division: "_$$DIVISION^GMVUTL1(+GMRVHLOC)
S GN=4,^TMP($J,GN)=GSTRFIN
Q
DATE ;
S:GMR=0 $P(^TMP($J,GN),"^")=$E(GDT,4,5)_"-"_$E(GDT,6,7)_"-"_$E(GDT,2,3)
S:GMR=0 Y=$E($P(GDT,".",2)_"000000",1,6),$P(^TMP($J,GN),"^",2)=$E(Y,1,2)_":"_$E(Y,3,4)_":"_$E(Y,5,6)
Q
SETA ;Store measurements in ^TMP($J, global
N GMVNODE
S GMVNODE=$G(^TMP($J,"GMRVG",GDT,GI,GK))
S $P(^TMP($J,GN),"^",22)=$P(GMVNODE,U,5)
S $P(^TMP($J,GN),"^",23)=$P(GMVNODE,U,6)
S $P(^TMP($J,GN),"^",24)=$P(GMVNODE,U,7)
S GK(1)=GK
I GK(1)="Unavailable" S GK(1)="Unavail"
I GI="I" S:GMR=0 $P(^TMP($J,GN),"^",17)=GK(1) Q
I GI="O" S:GMR=0 $P(^TMP($J,GN),"^",18)=GK(1) Q
I GI="PN" S:GMR=0 $P(^TMP($J,GN),"^",19)=GK(1) Q
S (GMRSITE,GMRSITE(1),GINF,GMRVJ)=""
I GK(1)'="" D Q:GMR=1
. S GMRSITE(1)=$P(GMVNODE,U,1),GMRVJ=$P(GMVNODE,U,2),GINF=$P(GMVNODE,U,4)
. I GMRSITE(1)'="" D SYNOARY^GMVLGQU
I GI="R" S $P(^TMP($J,GN),"^",5)=GK(1)_$S(GMRVJ=1:"*",1:"")_"- "_GMRSITE Q
I GI="H" D Q
. S $P(^TMP($J,GN),"^",11)=GK(1)_"- "_GMRSITE,$P(^TMP($J,GN),"^",12)=$S(GK(1)>0:$J(GK(1)*2.54,0,2),1:"") S:GK(1)>0 GMRHT=(GK(1)*2.54)/100
I GI="PO2" D Q
. S (GINF(1),GINF(2))="" I GINF'="" D PO2^GMVLGQU(.GINF)
. S $P(^TMP($J,GN),"^",6)=GK(1)_$S(GMRVJ=1:"*",1:"")_"- "_GMRSITE_"-"_GINF(1)_"-"_GINF(2)
I GI="CVP" D Q
. S $P(^TMP($J,GN),"^",15)=$S(GK(1)>0!(GK(1)<0):$J(GK(1),0,1),1:GK(1))_$S(GMRVJ=1:"*",1:"")
. S $P(^TMP($J,GN),"^",16)=$S(GK(1)>0!(GK(1)<0)!($E(GK(1))="0"):$J(GK(1)/1.36,0,1),1:"")_$S(GMRVJ=1:"*",1:"")
I GI="CG" D Q
. S $P(^TMP($J,GN),"^",13)=GK(1)_"- "_GMRSITE,$P(^TMP($J,GN),"^",14)=$S(GK(1)>0:$J(GK(1)/.3937,0,2),1:"")
I GI="B",GK(1)'="" S $P(^TMP($J,GN),"^",7)=GK(1)_$S(GMRVJ=1:"*",1:"")_"- "_GMRSITE
I GI="W" S $P(^TMP($J,GN),"^",8)=GK(1)_"- "_GMRSITE,$P(^(GN),"^",9)=$S(GK(1)>0:$J(GK(1)*.45359237,0,2),1:"")
I GK(1)>0,GI="W" D Q
. S GHOLD=GI,GMRBMI="",GMRBMI(1)=GDT,GMRBMI(2)=GK(1) D CALBMI^GMVBMI(.GMRBMI) S GI=GHOLD
. S $P(^TMP($J,GN),"^",10)=GMRBMI K GMRBMI
I GI="T" S $P(^TMP($J,GN),"^",3)=GK(1)_$S(GMRVJ=1:"*",1:"")_"- "_GMRSITE Q
I GI="P" S $P(^TMP($J,GN),"^",4)=GK(1)_$S(GMRVJ=1:"*",1:"")_"- "_GMRSITE
Q
GMVGGR2 ;HOIFO/YH,FT-SET ^TMP($J) GLOBAL ;6/6/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**3,23**;Oct 31, 2002;Build 25
+2 ;CONTINUTATION OF GMVGGR1
+3 ;
+4 ; This routine uses the following IAs:
+5 ; #10061 - ^VADPT calls (supported)
+6 ;
GRAPH ;
+1 IF GMR=0
DO SETV
+2 IF '$DATA(^TMP($JOB,"GMRVG"))
SET GN=GN+1
SET ^TMP($JOB,GN)="NO DATA"
SET RESULT=$NAME(^TMP($JOB))
QUIT
+3 KILL GMRQUAL
SET GDT=0
FOR
SET GDT=$ORDER(^TMP($JOB,"GMRVG",GDT))
IF GDT'>0
QUIT
Begin DoDot:1
+4 IF GMR=0
SET GN=GN+1
SET ^TMP($JOB,GN)="^^^^^^^^^^^^^^^^^^^^^"
DO DATE
+5 SET GI=""
FOR
SET GI=$ORDER(^TMP($JOB,"GMRVG",GDT,GI))
IF GI=""
QUIT
Begin DoDot:2
+6 SET GK=""
FOR
SET GK=$ORDER(^TMP($JOB,"GMRVG",GDT,GI,GK))
IF GK=""
QUIT
DO SETA
End DoDot:2
End DoDot:1
+7 DO KVAR^VADPT
KILL VA
+8 ;RETURN CALL ROUTINE WITH QUALIFIERS
+9 IF GMR=1
IF $DATA(GMRQUAL)
Begin DoDot:1
+10 SET (GQ,GQ(1))=""
+11 FOR
SET GQ=$ORDER(GMRQUAL(GQ))
IF GQ=""
QUIT
Begin DoDot:2
+12 SET I=0
SET GQ(1)=$SELECT(GQ="T":"TEMPERATURE",GQ="P":"PULSE",GQ="R":"RESPIRATION",GQ="B":"BLOOD PRESSURE",GQ="H":"HEIGHT",GQ="W":"WEIGHT",GQ="CVP":"CVP",GQ="PO2":"PULSE OXIMETRY",GQ="CG":"CIRCUMFERENCE/GIRTH",1:"")
+13 IF GQ(1)=""
QUIT
SET GN=GN+1
SET ^TMP($JOB,GN)=GQ(1)_"--- "
+14 SET GQ(2)=""
FOR
SET GQ(2)=$ORDER(GMRQUAL(GQ,GQ(2)))
IF GQ(2)=""
QUIT
SET I=I+1
IF I>1
SET ^TMP($JOB,GN)=^(GN)_","
SET ^TMP($JOB,GN)=^TMP($JOB,GN)_" "_GQ(2)
End DoDot:2
End DoDot:1
+15 KILL GQ,GG,GI,GMRVJ,GSYNO,GHOLD,GLINE,GMRQUAL
+16 KILL ^TMP($JOB,"GMR"),^TMP($JOB,"GMRVG")
+17 SET RESULT=$NAME(^TMP($JOB))
+18 QUIT
SETV ;Set patient data in ^TMP($J,"GMRK" global
+1 DO DEM^VADPT
DO INP^VADPT
+2 SET GN=1
SET ^TMP($JOB,GN)=$SELECT(VADM(1)'="":VADM(1),1:" ")_" "_$SELECT(VADM(2)'="":$EXTRACT($PIECE(VADM(2),"^",2),8,11),1:" ")_" "_$SELECT($DATA(VADM(3)):$PIECE(VADM(3),"^",2),1:" ")_" "_$SELECT($DATA(VADM(4)):VADM(4),1:" ")_" (Yrs)"
+3 SET ^TMP($JOB,GN)=^(GN)_" "_$SELECT($DATA(VADM(5)):$PIECE(VADM(5),"^",2),1:" ")
+4 SET GN=2
SET ^TMP($JOB,GN)="Unit: "_$PIECE($GET(VAIN(4)),"^",2)_" Room: "_$PIECE($GET(VAIN(5)),"-",1,2)
+5 IF '$DATA(GMRVHLOC)
SET GMRVHLOC=$$HOSPLOC^GMVUTL1(+$GET(VAIN(4)))
+6 SET GN=3
SET ^TMP($JOB,GN)="Division: "_$$DIVISION^GMVUTL1(+GMRVHLOC)
+7 SET GN=4
SET ^TMP($JOB,GN)=GSTRFIN
+8 QUIT
DATE ;
+1 IF GMR=0
SET $PIECE(^TMP($JOB,GN),"^")=$EXTRACT(GDT,4,5)_"-"_$EXTRACT(GDT,6,7)_"-"_$EXTRACT(GDT,2,3)
+2 IF GMR=0
SET Y=$EXTRACT($PIECE(GDT,".",2)_"000000",1,6)
SET $PIECE(^TMP($JOB,GN),"^",2)=$EXTRACT(Y,1,2)_":"_$EXTRACT(Y,3,4)_":"_$EXTRACT(Y,5,6)
+3 QUIT
SETA ;Store measurements in ^TMP($J, global
+1 NEW GMVNODE
+2 SET GMVNODE=$GET(^TMP($JOB,"GMRVG",GDT,GI,GK))
+3 SET $PIECE(^TMP($JOB,GN),"^",22)=$PIECE(GMVNODE,U,5)
+4 SET $PIECE(^TMP($JOB,GN),"^",23)=$PIECE(GMVNODE,U,6)
+5 SET $PIECE(^TMP($JOB,GN),"^",24)=$PIECE(GMVNODE,U,7)
+6 SET GK(1)=GK
+7 IF GK(1)="Unavailable"
SET GK(1)="Unavail"
+8 IF GI="I"
IF GMR=0
SET $PIECE(^TMP($JOB,GN),"^",17)=GK(1)
QUIT
+9 IF GI="O"
IF GMR=0
SET $PIECE(^TMP($JOB,GN),"^",18)=GK(1)
QUIT
+10 IF GI="PN"
IF GMR=0
SET $PIECE(^TMP($JOB,GN),"^",19)=GK(1)
QUIT
+11 SET (GMRSITE,GMRSITE(1),GINF,GMRVJ)=""
+12 IF GK(1)'=""
Begin DoDot:1
+13 SET GMRSITE(1)=$PIECE(GMVNODE,U,1)
SET GMRVJ=$PIECE(GMVNODE,U,2)
SET GINF=$PIECE(GMVNODE,U,4)
+14 IF GMRSITE(1)'=""
DO SYNOARY^GMVLGQU
End DoDot:1
IF GMR=1
QUIT
+15 IF GI="R"
SET $PIECE(^TMP($JOB,GN),"^",5)=GK(1)_$SELECT(GMRVJ=1:"*",1:"")_"- "_GMRSITE
QUIT
+16 IF GI="H"
Begin DoDot:1
+17 SET $PIECE(^TMP($JOB,GN),"^",11)=GK(1)_"- "_GMRSITE
SET $PIECE(^TMP($JOB,GN),"^",12)=$SELECT(GK(1)>0:$JUSTIFY(GK(1)*2.54,0,2),1:"")
IF GK(1)>0
SET GMRHT=(GK(1)*2.54)/100
End DoDot:1
QUIT
+18 IF GI="PO2"
Begin DoDot:1
+19 SET (GINF(1),GINF(2))=""
IF GINF'=""
DO PO2^GMVLGQU(.GINF)
+20 SET $PIECE(^TMP($JOB,GN),"^",6)=GK(1)_$SELECT(GMRVJ=1:"*",1:"")_"- "_GMRSITE_"-"_GINF(1)_"-"_GINF(2)
End DoDot:1
QUIT
+21 IF GI="CVP"
Begin DoDot:1
+22 SET $PIECE(^TMP($JOB,GN),"^",15)=$SELECT(GK(1)>0!(GK(1)<0):$JUSTIFY(GK(1),0,1),1:GK(1))_$SELECT(GMRVJ=1:"*",1:"")
+23 SET $PIECE(^TMP($JOB,GN),"^",16)=$SELECT(GK(1)>0!(GK(1)<0)!($EXTRACT(GK(1))="0"):$JUSTIFY(GK(1)/1.36,0,1),1:"")_$SELECT(GMRVJ=1:"*",1:"")
End DoDot:1
QUIT
+24 IF GI="CG"
Begin DoDot:1
+25 SET $PIECE(^TMP($JOB,GN),"^",13)=GK(1)_"- "_GMRSITE
SET $PIECE(^TMP($JOB,GN),"^",14)=$SELECT(GK(1)>0:$JUSTIFY(GK(1)/.3937,0,2),1:"")
End DoDot:1
QUIT
+26 IF GI="B"
IF GK(1)'=""
SET $PIECE(^TMP($JOB,GN),"^",7)=GK(1)_$SELECT(GMRVJ=1:"*",1:"")_"- "_GMRSITE
+27 IF GI="W"
SET $PIECE(^TMP($JOB,GN),"^",8)=GK(1)_"- "_GMRSITE
SET $PIECE(^(GN),"^",9)=$SELECT(GK(1)>0:$JUSTIFY(GK(1)*.45359237,0,2),1:"")
+28 IF GK(1)>0
IF GI="W"
Begin DoDot:1
+29 SET GHOLD=GI
SET GMRBMI=""
SET GMRBMI(1)=GDT
SET GMRBMI(2)=GK(1)
DO CALBMI^GMVBMI(.GMRBMI)
SET GI=GHOLD
+30 SET $PIECE(^TMP($JOB,GN),"^",10)=GMRBMI
KILL GMRBMI
End DoDot:1
QUIT
+31 IF GI="T"
SET $PIECE(^TMP($JOB,GN),"^",3)=GK(1)_$SELECT(GMRVJ=1:"*",1:"")_"- "_GMRSITE
QUIT
+32 IF GI="P"
SET $PIECE(^TMP($JOB,GN),"^",4)=GK(1)_$SELECT(GMRVJ=1:"*",1:"")_"- "_GMRSITE
+33 QUIT