ORQQVI ;SLC/STAFF - Functions which return patient vital and I/O data ; Jan 5, 2024@1:35
;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,198,215,250,260,285,286,414,524,557,560,608**;Dec 17, 1997;Build 15
;Per VA Directive 6402, this routine should not be modified.
;
; Reference to EN1^GMRVUT0 in ICR #1446 (^UTILITY is the return from this call)
; Reference to EN^GMVPXRM in ICR #3647
; Reference to FIND1^DIC in ICR #2051
; Reference to ^PXRMINDX in ICR #4290
; Reference to ^XPAR in ICR #2263
;
VITALS(ORY,DFN,ORSDT,OREDT) ; return patient's vital measurements taken between start date/time and end date/time
;ORY: return variable, results are returned in the format:
; vital measurement ien^vital type^date/time taken^rate
;DFN: patient identifier from Patient File [#2]
;ORSDT: start date/time in Fileman format
;OREDT: end date/time in Fileman format
K ^UTILITY($J,"GMRVD")
S GMRVSTR="BP;HT;WT;T;R;P;PN" ;dee 2/12/99 added PN
S GMRVSTR(0)=ORSDT_"^"_OREDT_"^"_"^"
D EN1^GMRVUT0
N ORT,ORD,ORI,I
S ORT="",ORD=0,ORI=0,I=0
F S ORT=$O(^UTILITY($J,"GMRVD",ORT)) Q:ORT="" D
.F S ORD=$O(^UTILITY($J,"GMRVD",ORT,ORD)) Q:ORD<1 D
..F S ORI=$O(^UTILITY($J,"GMRVD",ORT,ORD,ORI)) Q:ORI<1 D
...S I=I+1
...S ORY(I)=ORI_"^"_ORT_"^"_$P(^UTILITY($J,"GMRVD",ORT,ORD,ORI),"^",8)_"^"_$P(^(ORI),"^")
I I=0 S ORY(1)="^No vitals found."
K GMRVSTR
Q
;
XFASTVIT(ORY,DFN,F1,F2) ; return patient's most recent vital measurements
;ORY: return variable, results are returned in the format:
; vital measurement ien^vital type^rate^date/time taken
;DFN: patient identifier from Patient File [#2]
; F1 & F2 are ignored
;
N CNT
S CNT=0
D LSTVITAL("TEMPERATURE","T",DFN,.ORY,.CNT)
D LSTVITAL("PULSE","P",DFN,.ORY,.CNT)
D LSTVITAL("RESPIRATION","R",DFN,.ORY,.CNT)
D LSTVITAL("BLOOD PRESSURE","BP",DFN,.ORY,.CNT)
D LSTVITAL("HEIGHT","HT",DFN,.ORY,.CNT)
D LSTVITAL("WEIGHT","WT",DFN,.ORY,.CNT)
D LSTVITAL("PAIN","PN",DFN,ORY,.CNT) ;dee 2/11/99
Q
;
XVITAL(VITAL,ABBREV,DFN,ORY,CNT) ; get vital measurement
N DATA,IDT,IEN,OK,VTYPE
S VTYPE=$$FIND1^DIC(120.51,"","BX",VITAL,"","","ERR")
I 'VTYPE Q
S OK=0,IDT=0 F S IDT=$O(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT),-1) Q:IDT<1 D Q:OK
.S IEN="" F S IEN=$O(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT,IEN)) Q:$L(IEN)<1 D Q:OK
..D EN^GMVPXRM(.DATA,IEN,"I")
..I $P(DATA(1),U)=-1 Q
..S CNT=CNT+1,OK=1
..S ORY(CNT)=IEN_U_ABBREV_U_$P(DATA(7),U)_U_$P(DATA(1),U)
Q
;
NOTEVIT(ORY,DFN,NOTEIEN,PARAM1) ;
N VSTR,NOTEDATE
D NOTEVSTR^ORWPCE(.VSTR,NOTEIEN)
Q:$P(VSTR,";",2)=""
D FASTVIT(.ORY,DFN,$P(VSTR,";",2),,$G(PARAM1))
Q
;
FASTVIT(ORY,DFN,F1,F2,PARAM1) ; return patient's most recent vital measurements
; in date range
;ORY: return variable, results are returned in the format:
; vital measurement ien^vital type^rate^date/time taken
;DFN: patient identifier from Patient File [#2]
; F1: starting date/time range
; F2: ending date/time range
;
N CNT,DT1,DT2
S CNT=0
I $G(F1)>0 D
. I $G(F2)="",F1["." S DT1=$P(F1,".",1)_"."_$E($P(F1,".",2),1,4)
. E S DT1=F1
E S DT1=1
S DT2=$S($G(F2)>0:F2,DT1>1:DT1,1:9999998)
;
D LSTVITAL("TEMPERATURE","T",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("PULSE","P",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("RESPIRATION","R",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("BLOOD PRESSURE","BP",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("HEIGHT","HT",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("WEIGHT","WT",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("PAIN","PN",DFN,.ORY,.CNT,DT1,DT2) ;dee 2/11/99
D LSTVITAL("PULSE OXIMETRY","PO2",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("CENTRAL VENOUS PRESSURE","CVP",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("CIRCUMFERENCE/GIRTH","CG",DFN,.ORY,.CNT,DT1,DT2)
D LSTVITAL("BODY MASS INDEX","BMI",DFN,.ORY,.CNT,DT1,DT2)
I $G(PARAM1),$$GET^XPAR("ALL","ORQQVI METRIC FIRST",1,"I") D SWAP(.ORY)
Q
;
VITAL(VITAL,ABBREV,DFN,ORY,CNT,F1,F2) ;
; get most recent *valid* vital measurement
N STOP
S STOP=0 F D Q:STOP
.D LSTVITAL(VITAL,ABBREV,DFN,.ORY,.CNT,F1,F2)
.I $D(ORY)=0 S STOP=1 Q ;if no vital, exit
.;if not a valid vital, search for earlier entry
.I "Pass,Unavailable,Refused"[$P(ORY(1),U,3) D Q
..S F2=$P(ORY(1),U,4)-.0000001
..K ORY
..S CNT=0
.S STOP=1 Q ;for the moment just use any value.
Q
;
LSTVITAL(VITAL,ABBREV,DFN,ORY,CNT,F1,F2) ;
;get most recent vital measurement in date range
I ABBREV="BMI" D BMILAST^ORWGAPIX(DFN,.ORY,.CNT) Q
N DATA,IDT,ENDIDT,IEN,LOOP,OK,QUALS,VTYPE,MVAL,VALUE
S VTYPE=$$FIND1^DIC(120.51,"","BX",VITAL,"","","ERR")
I 'VTYPE Q
S OK=0
S IDT=F2+$S(F2#1:.0000001,1:.7)
S ENDIDT=F1-.0000001
F S IDT=$O(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT),-1) Q:IDT<ENDIDT!'IDT D Q:OK
.S IEN="" F S IEN=$O(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT,IEN)) Q:$L(IEN)<1 D Q:OK
..D EN^GMVPXRM(.DATA,IEN,"B")
..I $P(DATA(1),U)=-1 Q
..S CNT=CNT+1,OK=1,VALUE=$P(DATA(7),U)
..S QUALS(CNT)=""
..F LOOP=1:1 Q:'$D(DATA(12,LOOP)) D
...S QUALS(CNT)=QUALS(CNT)_$S(QUALS(CNT)="":"",1:",")_$P(DATA(12,LOOP),U,2)
..; changed to display 'POX' rather than 'PO2' per CQ 10592
..S ORY(CNT)=IEN_U_$S(ABBREV="PO2":"POX",1:ABBREV)_U_VALUE_U_$P(DATA(1),U)
..I $P(ORY(CNT),"^",2)="T" D ; Temperature.
...S ORY(CNT)=ORY(CNT)_"^"_VALUE_$S($E(VALUE):" F",1:"")
...S MVAL=+VALUE
...Q:'MVAL
...S MVAL=MVAL-32
...S MVAL=$J((MVAL*(5/9)),3,1)
...S ORY(CNT)=ORY(CNT)_"^("_MVAL_" C)"
..I $P(ORY(CNT),"^",2)="P" D ; Pulse.
...S ORY(CNT)=ORY(CNT)_"^"_VALUE
..I $P(ORY(CNT),"^",2)="R" D ; Respiration.
...S ORY(CNT)=ORY(CNT)_"^"_VALUE
..I $P(ORY(CNT),"^",2)="BP" D ; Blood Pressure.
...S ORY(CNT)=ORY(CNT)_"^"_VALUE
..I $P(ORY(CNT),"^",2)="HT" D ; Height.
...S ORY(CNT)=ORY(CNT)_"^"_VALUE_$S($E(VALUE):" in",1:"")
...S MVAL=+VALUE
...Q:'MVAL
...S MVAL=$J((MVAL*2.54),3,2)
...S ORY(CNT)=ORY(CNT)_"^("_MVAL_" cm)"
..I $P(ORY(CNT),"^",2)="WT" D ; Weight.
...S ORY(CNT)=ORY(CNT)_"^"_VALUE_$S($E(VALUE):" lb",1:"")
...S MVAL=+VALUE
...Q:'MVAL
...; changed 2.2 to 2.20462262 per CQ 10637
...S MVAL=$J((MVAL/2.20462262),3,2)
...S ORY(CNT)=ORY(CNT)_"^("_MVAL_" kg)"
..I $P(ORY(CNT),"^",2)="PN" D ; Pain
...S ORY(CNT)=ORY(CNT)_"^"_VALUE
..; looks for 'POX' rather than 'PO2' due to change for CQ 10592 above
..I $P(ORY(CNT),"^",2)="POX" D ; Pulse Oximetry.
...S ORY(CNT)=ORY(CNT)_"^"_$P(ORY(CNT),"^",3)
...S $P(ORY(CNT),U,8)=$P(DATA(8),U)
..I $P(ORY(CNT),"^",2)="CVP" D ; Central Venous Pressure.
...S ORY(CNT)=ORY(CNT)_"^"_$P(ORY(CNT),"^",3)
...S MVAL=$P(ORY(CNT),"^",3)
...I MVAL'=+MVAL,+MVAL=0 S ORY(CNT)=ORY(CNT)_"^",$P(ORY(CNT),U,7)="" Q
...S MVAL=$J((MVAL/1.36),3,1)
...S ORY(CNT)=ORY(CNT)_" cmH20^("_MVAL_" mmHg)"
..I $P(ORY(CNT),"^",2)="CG" D ; Circumference Girth.
...S ORY(CNT)=ORY(CNT)_"^"_$P(ORY(CNT),"^",3)
...S MVAL=$P(ORY(CNT),"^",3)
...I MVAL'=+MVAL,+MVAL=0 S ORY(CNT)=ORY(CNT)_"^",$P(ORY(CNT),U,7)="" Q
...S MVAL=$J((MVAL*2.54),3,1)
...S ORY(CNT)=ORY(CNT)_" in^("_MVAL_" cm)"
..S $P(ORY(CNT),U,7)=QUALS(CNT)
Q
SWAP(ORREC) ;
I '$D(ORREC) Q
N S1,A,B S S1=0
F S S1=$O(ORREC(S1)) Q:'S1 D
. I $P(ORREC(S1),"^",6)="" Q
. S A="("_$P(ORREC(S1),"^",5)_")",B=$P(ORREC(S1),"^",6),B=$E(B,2,$L(B)-1)
. S $P(ORREC(S1),"^",3)=+B,$P(ORREC(S1),"^",5)=B,$P(ORREC(S1),"^",6)=A
Q
SWPVIT(ORY,DFN,PARAM1,F1,F2) ;
D FASTVIT(.ORY,DFN,$G(F1),$G(F2),PARAM1)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORQQVI 7390 printed Dec 13, 2024@02:33:48 Page 2
ORQQVI ;SLC/STAFF - Functions which return patient vital and I/O data ; Jan 5, 2024@1:35
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,198,215,250,260,285,286,414,524,557,560,608**;Dec 17, 1997;Build 15
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; Reference to EN1^GMRVUT0 in ICR #1446 (^UTILITY is the return from this call)
+5 ; Reference to EN^GMVPXRM in ICR #3647
+6 ; Reference to FIND1^DIC in ICR #2051
+7 ; Reference to ^PXRMINDX in ICR #4290
+8 ; Reference to ^XPAR in ICR #2263
+9 ;
VITALS(ORY,DFN,ORSDT,OREDT) ; return patient's vital measurements taken between start date/time and end date/time
+1 ;ORY: return variable, results are returned in the format:
+2 ; vital measurement ien^vital type^date/time taken^rate
+3 ;DFN: patient identifier from Patient File [#2]
+4 ;ORSDT: start date/time in Fileman format
+5 ;OREDT: end date/time in Fileman format
+6 KILL ^UTILITY($JOB,"GMRVD")
+7 ;dee 2/12/99 added PN
SET GMRVSTR="BP;HT;WT;T;R;P;PN"
+8 SET GMRVSTR(0)=ORSDT_"^"_OREDT_"^"_"^"
+9 DO EN1^GMRVUT0
+10 NEW ORT,ORD,ORI,I
+11 SET ORT=""
SET ORD=0
SET ORI=0
SET I=0
+12 FOR
SET ORT=$ORDER(^UTILITY($JOB,"GMRVD",ORT))
if ORT=""
QUIT
Begin DoDot:1
+13 FOR
SET ORD=$ORDER(^UTILITY($JOB,"GMRVD",ORT,ORD))
if ORD<1
QUIT
Begin DoDot:2
+14 FOR
SET ORI=$ORDER(^UTILITY($JOB,"GMRVD",ORT,ORD,ORI))
if ORI<1
QUIT
Begin DoDot:3
+15 SET I=I+1
+16 SET ORY(I)=ORI_"^"_ORT_"^"_$PIECE(^UTILITY($JOB,"GMRVD",ORT,ORD,ORI),"^",8)_"^"_$PIECE(^(ORI),"^")
End DoDot:3
End DoDot:2
End DoDot:1
+17 IF I=0
SET ORY(1)="^No vitals found."
+18 KILL GMRVSTR
+19 QUIT
+20 ;
XFASTVIT(ORY,DFN,F1,F2) ; return patient's most recent vital measurements
+1 ;ORY: return variable, results are returned in the format:
+2 ; vital measurement ien^vital type^rate^date/time taken
+3 ;DFN: patient identifier from Patient File [#2]
+4 ; F1 & F2 are ignored
+5 ;
+6 NEW CNT
+7 SET CNT=0
+8 DO LSTVITAL("TEMPERATURE","T",DFN,.ORY,.CNT)
+9 DO LSTVITAL("PULSE","P",DFN,.ORY,.CNT)
+10 DO LSTVITAL("RESPIRATION","R",DFN,.ORY,.CNT)
+11 DO LSTVITAL("BLOOD PRESSURE","BP",DFN,.ORY,.CNT)
+12 DO LSTVITAL("HEIGHT","HT",DFN,.ORY,.CNT)
+13 DO LSTVITAL("WEIGHT","WT",DFN,.ORY,.CNT)
+14 ;dee 2/11/99
DO LSTVITAL("PAIN","PN",DFN,ORY,.CNT)
+15 QUIT
+16 ;
XVITAL(VITAL,ABBREV,DFN,ORY,CNT) ; get vital measurement
+1 NEW DATA,IDT,IEN,OK,VTYPE
+2 SET VTYPE=$$FIND1^DIC(120.51,"","BX",VITAL,"","","ERR")
+3 IF 'VTYPE
QUIT
+4 SET OK=0
SET IDT=0
FOR
SET IDT=$ORDER(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT),-1)
if IDT<1
QUIT
Begin DoDot:1
+5 SET IEN=""
FOR
SET IEN=$ORDER(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT,IEN))
if $LENGTH(IEN)<1
QUIT
Begin DoDot:2
+6 DO EN^GMVPXRM(.DATA,IEN,"I")
+7 IF $PIECE(DATA(1),U)=-1
QUIT
+8 SET CNT=CNT+1
SET OK=1
+9 SET ORY(CNT)=IEN_U_ABBREV_U_$PIECE(DATA(7),U)_U_$PIECE(DATA(1),U)
End DoDot:2
if OK
QUIT
End DoDot:1
if OK
QUIT
+10 QUIT
+11 ;
NOTEVIT(ORY,DFN,NOTEIEN,PARAM1) ;
+1 NEW VSTR,NOTEDATE
+2 DO NOTEVSTR^ORWPCE(.VSTR,NOTEIEN)
+3 if $PIECE(VSTR,";",2)=""
QUIT
+4 DO FASTVIT(.ORY,DFN,$PIECE(VSTR,";",2),,$GET(PARAM1))
+5 QUIT
+6 ;
FASTVIT(ORY,DFN,F1,F2,PARAM1) ; return patient's most recent vital measurements
+1 ; in date range
+2 ;ORY: return variable, results are returned in the format:
+3 ; vital measurement ien^vital type^rate^date/time taken
+4 ;DFN: patient identifier from Patient File [#2]
+5 ; F1: starting date/time range
+6 ; F2: ending date/time range
+7 ;
+8 NEW CNT,DT1,DT2
+9 SET CNT=0
+10 IF $GET(F1)>0
Begin DoDot:1
+11 IF $GET(F2)=""
IF F1["."
SET DT1=$PIECE(F1,".",1)_"."_$EXTRACT($PIECE(F1,".",2),1,4)
+12 IF '$TEST
SET DT1=F1
End DoDot:1
+13 IF '$TEST
SET DT1=1
+14 SET DT2=$SELECT($GET(F2)>0:F2,DT1>1:DT1,1:9999998)
+15 ;
+16 DO LSTVITAL("TEMPERATURE","T",DFN,.ORY,.CNT,DT1,DT2)
+17 DO LSTVITAL("PULSE","P",DFN,.ORY,.CNT,DT1,DT2)
+18 DO LSTVITAL("RESPIRATION","R",DFN,.ORY,.CNT,DT1,DT2)
+19 DO LSTVITAL("BLOOD PRESSURE","BP",DFN,.ORY,.CNT,DT1,DT2)
+20 DO LSTVITAL("HEIGHT","HT",DFN,.ORY,.CNT,DT1,DT2)
+21 DO LSTVITAL("WEIGHT","WT",DFN,.ORY,.CNT,DT1,DT2)
+22 ;dee 2/11/99
DO LSTVITAL("PAIN","PN",DFN,.ORY,.CNT,DT1,DT2)
+23 DO LSTVITAL("PULSE OXIMETRY","PO2",DFN,.ORY,.CNT,DT1,DT2)
+24 DO LSTVITAL("CENTRAL VENOUS PRESSURE","CVP",DFN,.ORY,.CNT,DT1,DT2)
+25 DO LSTVITAL("CIRCUMFERENCE/GIRTH","CG",DFN,.ORY,.CNT,DT1,DT2)
+26 DO LSTVITAL("BODY MASS INDEX","BMI",DFN,.ORY,.CNT,DT1,DT2)
+27 IF $GET(PARAM1)
IF $$GET^XPAR("ALL","ORQQVI METRIC FIRST",1,"I")
DO SWAP(.ORY)
+28 QUIT
+29 ;
VITAL(VITAL,ABBREV,DFN,ORY,CNT,F1,F2) ;
+1 ; get most recent *valid* vital measurement
+2 NEW STOP
+3 SET STOP=0
FOR
Begin DoDot:1
+4 DO LSTVITAL(VITAL,ABBREV,DFN,.ORY,.CNT,F1,F2)
+5 ;if no vital, exit
IF $DATA(ORY)=0
SET STOP=1
QUIT
+6 ;if not a valid vital, search for earlier entry
+7 IF "Pass,Unavailable,Refused"[$PIECE(ORY(1),U,3)
Begin DoDot:2
+8 SET F2=$PIECE(ORY(1),U,4)-.0000001
+9 KILL ORY
+10 SET CNT=0
End DoDot:2
QUIT
+11 ;for the moment just use any value.
SET STOP=1
QUIT
End DoDot:1
if STOP
QUIT
+12 QUIT
+13 ;
LSTVITAL(VITAL,ABBREV,DFN,ORY,CNT,F1,F2) ;
+1 ;get most recent vital measurement in date range
+2 IF ABBREV="BMI"
DO BMILAST^ORWGAPIX(DFN,.ORY,.CNT)
QUIT
+3 NEW DATA,IDT,ENDIDT,IEN,LOOP,OK,QUALS,VTYPE,MVAL,VALUE
+4 SET VTYPE=$$FIND1^DIC(120.51,"","BX",VITAL,"","","ERR")
+5 IF 'VTYPE
QUIT
+6 SET OK=0
+7 SET IDT=F2+$SELECT(F2#1:.0000001,1:.7)
+8 SET ENDIDT=F1-.0000001
+9 FOR
SET IDT=$ORDER(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT),-1)
if IDT<ENDIDT!'IDT
QUIT
Begin DoDot:1
+10 SET IEN=""
FOR
SET IEN=$ORDER(^PXRMINDX(120.5,"PI",DFN,VTYPE,IDT,IEN))
if $LENGTH(IEN)<1
QUIT
Begin DoDot:2
+11 DO EN^GMVPXRM(.DATA,IEN,"B")
+12 IF $PIECE(DATA(1),U)=-1
QUIT
+13 SET CNT=CNT+1
SET OK=1
SET VALUE=$PIECE(DATA(7),U)
+14 SET QUALS(CNT)=""
+15 FOR LOOP=1:1
if '$DATA(DATA(12,LOOP))
QUIT
Begin DoDot:3
+16 SET QUALS(CNT)=QUALS(CNT)_$SELECT(QUALS(CNT)="":"",1:",")_$PIECE(DATA(12,LOOP),U,2)
End DoDot:3
+17 ; changed to display 'POX' rather than 'PO2' per CQ 10592
+18 SET ORY(CNT)=IEN_U_$SELECT(ABBREV="PO2":"POX",1:ABBREV)_U_VALUE_U_$PIECE(DATA(1),U)
+19 ; Temperature.
IF $PIECE(ORY(CNT),"^",2)="T"
Begin DoDot:3
+20 SET ORY(CNT)=ORY(CNT)_"^"_VALUE_$SELECT($EXTRACT(VALUE):" F",1:"")
+21 SET MVAL=+VALUE
+22 if 'MVAL
QUIT
+23 SET MVAL=MVAL-32
+24 SET MVAL=$JUSTIFY((MVAL*(5/9)),3,1)
+25 SET ORY(CNT)=ORY(CNT)_"^("_MVAL_" C)"
End DoDot:3
+26 ; Pulse.
IF $PIECE(ORY(CNT),"^",2)="P"
Begin DoDot:3
+27 SET ORY(CNT)=ORY(CNT)_"^"_VALUE
End DoDot:3
+28 ; Respiration.
IF $PIECE(ORY(CNT),"^",2)="R"
Begin DoDot:3
+29 SET ORY(CNT)=ORY(CNT)_"^"_VALUE
End DoDot:3
+30 ; Blood Pressure.
IF $PIECE(ORY(CNT),"^",2)="BP"
Begin DoDot:3
+31 SET ORY(CNT)=ORY(CNT)_"^"_VALUE
End DoDot:3
+32 ; Height.
IF $PIECE(ORY(CNT),"^",2)="HT"
Begin DoDot:3
+33 SET ORY(CNT)=ORY(CNT)_"^"_VALUE_$SELECT($EXTRACT(VALUE):" in",1:"")
+34 SET MVAL=+VALUE
+35 if 'MVAL
QUIT
+36 SET MVAL=$JUSTIFY((MVAL*2.54),3,2)
+37 SET ORY(CNT)=ORY(CNT)_"^("_MVAL_" cm)"
End DoDot:3
+38 ; Weight.
IF $PIECE(ORY(CNT),"^",2)="WT"
Begin DoDot:3
+39 SET ORY(CNT)=ORY(CNT)_"^"_VALUE_$SELECT($EXTRACT(VALUE):" lb",1:"")
+40 SET MVAL=+VALUE
+41 if 'MVAL
QUIT
+42 ; changed 2.2 to 2.20462262 per CQ 10637
+43 SET MVAL=$JUSTIFY((MVAL/2.20462262),3,2)
+44 SET ORY(CNT)=ORY(CNT)_"^("_MVAL_" kg)"
End DoDot:3
+45 ; Pain
IF $PIECE(ORY(CNT),"^",2)="PN"
Begin DoDot:3
+46 SET ORY(CNT)=ORY(CNT)_"^"_VALUE
End DoDot:3
+47 ; looks for 'POX' rather than 'PO2' due to change for CQ 10592 above
+48 ; Pulse Oximetry.
IF $PIECE(ORY(CNT),"^",2)="POX"
Begin DoDot:3
+49 SET ORY(CNT)=ORY(CNT)_"^"_$PIECE(ORY(CNT),"^",3)
+50 SET $PIECE(ORY(CNT),U,8)=$PIECE(DATA(8),U)
End DoDot:3
+51 ; Central Venous Pressure.
IF $PIECE(ORY(CNT),"^",2)="CVP"
Begin DoDot:3
+52 SET ORY(CNT)=ORY(CNT)_"^"_$PIECE(ORY(CNT),"^",3)
+53 SET MVAL=$PIECE(ORY(CNT),"^",3)
+54 IF MVAL'=+MVAL
IF +MVAL=0
SET ORY(CNT)=ORY(CNT)_"^"
SET $PIECE(ORY(CNT),U,7)=""
QUIT
+55 SET MVAL=$JUSTIFY((MVAL/1.36),3,1)
+56 SET ORY(CNT)=ORY(CNT)_" cmH20^("_MVAL_" mmHg)"
End DoDot:3
+57 ; Circumference Girth.
IF $PIECE(ORY(CNT),"^",2)="CG"
Begin DoDot:3
+58 SET ORY(CNT)=ORY(CNT)_"^"_$PIECE(ORY(CNT),"^",3)
+59 SET MVAL=$PIECE(ORY(CNT),"^",3)
+60 IF MVAL'=+MVAL
IF +MVAL=0
SET ORY(CNT)=ORY(CNT)_"^"
SET $PIECE(ORY(CNT),U,7)=""
QUIT
+61 SET MVAL=$JUSTIFY((MVAL*2.54),3,1)
+62 SET ORY(CNT)=ORY(CNT)_" in^("_MVAL_" cm)"
End DoDot:3
+63 SET $PIECE(ORY(CNT),U,7)=QUALS(CNT)
End DoDot:2
if OK
QUIT
End DoDot:1
if OK
QUIT
+64 QUIT
SWAP(ORREC) ;
+1 IF '$DATA(ORREC)
QUIT
+2 NEW S1,A,B
SET S1=0
+3 FOR
SET S1=$ORDER(ORREC(S1))
if 'S1
QUIT
Begin DoDot:1
+4 IF $PIECE(ORREC(S1),"^",6)=""
QUIT
+5 SET A="("_$PIECE(ORREC(S1),"^",5)_")"
SET B=$PIECE(ORREC(S1),"^",6)
SET B=$EXTRACT(B,2,$LENGTH(B)-1)
+6 SET $PIECE(ORREC(S1),"^",3)=+B
SET $PIECE(ORREC(S1),"^",5)=B
SET $PIECE(ORREC(S1),"^",6)=A
End DoDot:1
+7 QUIT
SWPVIT(ORY,DFN,PARAM1,F1,F2) ;
+1 DO FASTVIT(.ORY,DFN,$GET(F1),$GET(F2),PARAM1)
+2 QUIT