GMVSAS0 ;HIOFO/RM,YH,FT-CALCULATE ABNORMAL V/S ;11/8/01 14:36
;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
;
; This routine uses the following IAs:
; <None>
;
EN1 ; SENT GMRVX = "T","P","R","BP","CG","PO2" AS VITAL TYPE CODE, GMRVX(0) AS VITAL
; DATA. RETURN GMRVX(1)=0 IF WITHING NORMAL RANGE, 1 IF ABNORMAL
N GMRVSBSH,GMRVSBSL,GMRVHI,GMRVLO,GMRVADAT,GMRVBP2
S GMRVX(1)=0 Q:'$D(GMRVX)#2 Q:'$D(GMRVX)\2 Q:GMRVX(0)="" Q:'$D(^GMRD(120.57,1,1))
I "TPRBPCGPO2"']GMRVX Q
S GMRVSBSH=$S(GMRVX="T":1,GMRVX="P":3,GMRVX="R":5,GMRVX="CVP":11,GMRVX="B"!(GMRVX="BP"):7,1:0) Q:GMRVX'="PO2"&(GMRVSBSH'>0)
S GMRVSBSL=$S(GMRVX="T":2,GMRVX="P":4,GMRVX="R":6,GMRVX="CVP":12,GMRVX="PO2":13,GMRVX="B"!(GMRVX="BP"):9,1:0) Q:GMRVSBSL'>0
I GMRVX="BP"!(GMRVX="B") S GMRVSBSH(0)=8,GMRVSBSL(0)=10
S GMRVADAT=^GMRD(120.57,1,1)
S GMRVHI=$S(GMRVSBSH>0:$P(GMRVADAT,"^",GMRVSBSH),1:0),GMRVLO=$S(GMRVSBSL>0:$P(GMRVADAT,"^",GMRVSBSL),1:0)
I GMRVX="PO2" S:GMRVX(0)'>GMRVLO GMRVX(1)=1 Q
I GMRVX="BP"!(GMRVX="B") S GMRVHI(0)=$P(GMRVADAT,"^",GMRVSBSH(0)),GMRVLO(0)=$P(GMRVADAT,"^",GMRVSBSL(0)),GMRVBP2=$S($P(GMRVX(0),"/",3)="":$P(GMRVX(0),"/",2),1:$P(GMRVX(0),"/",3))
S GMRVX(1)=0
I $P(GMRVX(0),"/")'<GMRVHI!($P(GMRVX(0),"/")'>GMRVLO) S GMRVX(1)=1
Q:(GMRVX="BP"!(GMRVX="B"))&($G(GMRVBP2)="")
I (GMRVX="BP"!(GMRVX="B")),(GMRVBP2'<GMRVHI(0)!(GMRVBP2'>GMRVLO(0))) S GMRVX(1)=1
Q
GMVSAS0 ;HIOFO/RM,YH,FT-CALCULATE ABNORMAL V/S ;11/8/01 14:36
+1 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
+2 ;
+3 ; This routine uses the following IAs:
+4 ; <None>
+5 ;
EN1 ; SENT GMRVX = "T","P","R","BP","CG","PO2" AS VITAL TYPE CODE, GMRVX(0) AS VITAL
+1 ; DATA. RETURN GMRVX(1)=0 IF WITHING NORMAL RANGE, 1 IF ABNORMAL
+2 NEW GMRVSBSH,GMRVSBSL,GMRVHI,GMRVLO,GMRVADAT,GMRVBP2
+3 SET GMRVX(1)=0
IF '$DATA(GMRVX)#2
QUIT
IF '$DATA(GMRVX)\2
QUIT
IF GMRVX(0)=""
QUIT
IF '$DATA(^GMRD(120.57,1,1))
QUIT
+4 IF "TPRBPCGPO2"']GMRVX
QUIT
+5 SET GMRVSBSH=$SELECT(GMRVX="T":1,GMRVX="P":3,GMRVX="R":5,GMRVX="CVP":11,GMRVX="B"!(GMRVX="BP"):7,1:0)
IF GMRVX'="PO2"&(GMRVSBSH'>0)
QUIT
+6 SET GMRVSBSL=$SELECT(GMRVX="T":2,GMRVX="P":4,GMRVX="R":6,GMRVX="CVP":12,GMRVX="PO2":13,GMRVX="B"!(GMRVX="BP"):9,1:0)
IF GMRVSBSL'>0
QUIT
+7 IF GMRVX="BP"!(GMRVX="B")
SET GMRVSBSH(0)=8
SET GMRVSBSL(0)=10
+8 SET GMRVADAT=^GMRD(120.57,1,1)
+9 SET GMRVHI=$SELECT(GMRVSBSH>0:$PIECE(GMRVADAT,"^",GMRVSBSH),1:0)
SET GMRVLO=$SELECT(GMRVSBSL>0:$PIECE(GMRVADAT,"^",GMRVSBSL),1:0)
+10 IF GMRVX="PO2"
IF GMRVX(0)'>GMRVLO
SET GMRVX(1)=1
QUIT
+11 IF GMRVX="BP"!(GMRVX="B")
SET GMRVHI(0)=$PIECE(GMRVADAT,"^",GMRVSBSH(0))
SET GMRVLO(0)=$PIECE(GMRVADAT,"^",GMRVSBSL(0))
SET GMRVBP2=$SELECT($PIECE(GMRVX(0),"/",3)="":$PIECE(GMRVX(0),"/",2),1:$PIECE(GMRVX(0),"/",3))
+12 SET GMRVX(1)=0
+13 IF $PIECE(GMRVX(0),"/")'<GMRVHI!($PIECE(GMRVX(0),"/")'>GMRVLO)
SET GMRVX(1)=1
+14 IF (GMRVX="BP"!(GMRVX="B"))&($GET(GMRVBP2)="")
QUIT
+15 IF (GMRVX="BP"!(GMRVX="B"))
IF (GMRVBP2'<GMRVHI(0)!(GMRVBP2'>GMRVLO(0)))
SET GMRVX(1)=1
+16 QUIT