VPSVTL02 ;ALBANY/KC - Patient Vitals RPC;08/14/14 09:28
;;1.0;VA POINT OF SERVICE (KIOSKS);**10**;July 8, 2015;Build 16
;;Per VHA Directive 2004-038, this routine should not be modified.
;
; External Reference DBIA#
; ------------------------
; #3217 DDR FIND1 (Supported)
; #4815 GMVDCSAV (Controlled)
; #6207 ABBVAL GMVUTL (Controlled)
Q
WRITE(VPSARR,VPSNUM,VPSTYP,VTYP,VVAL,DTM,BY,LOC,QLFS,OX) ;
;
; INPUT
; VPSNUM - Parameter Value - patient SSN OR DFN OR ICN OR VIC/CAC (REQUIRED)
; VPSTYP - Parameter TYPE - SSN or DFN OR ICN OR VIC/CAC (REQUIRED)
; VTYP - Parameter for Vital Type
; VVAL - Rate for the Vital Type
; DTM - Date Time
; BY - Vitals entered by (user in File #200)
; LOC - Hospital location (File 44)
; QLFS - String of Qualifiers for this vital entry (Q1:Q2:Q3) (SITTING:R ARM)
; OX = Oxygen flow rate and percentage value (1 l/min 90%)
;
; OUTPUT
; VPSARR -
; If error
; VPSARR=0^Error message
; otherwise
; VPSARR=1(^Alert of abnormal vital vlaue - optional)
;
;
;
;
N CNT,DFN,DDR,RES,VTIEN,ALERT
S CNT=0
S ALERT=""
K VPSARR
S VPSARR=1
S DFN=$$VALIDATE^VPSRPC1($G(VPSTYP),$G(VPSNUM))
I $G(BY)="" S BY=$G(DUZ)
I +DFN<0 S VPSARR="0^"_$P(DFN,"^",2) Q
I $G(VVAL)="" S VPSARR="0^Missing vital measurement value" Q
I $G(VTYP)="" S VPSARR="0^Missing vital type" Q
I VTYP="T",((+VVAL<45)!(+VVAL>120)) S VPSARR="0^Invalid vital measurement value for temperature of "_VVAL Q
I VTYP="BP",VVAL'?1.N."/".N S VPSARR="0^Invalid vital measurement value for BP of "_VVAL Q
I VTYP="BP" D
. N DIA,SYT
. S SYT=$P(VVAL,"/")
. S DIA=$P(VVAL,"/",2)
. I SYT<0!(SYT>300)!(DIA<0)!(DIA>300) S VPSARR="0^Invalid vital measurement value for BP of "_VVAL
I VTYP'="BP",VVAL'?1.E S VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL Q
I VTYP="PN",VVAL<0!((VVAL>10)&(VVAL'=99)) S VPSARR="0^Invalid vital measurement value for Pain of "_VVAL Q
I VTYP="PO2",VVAL<0!(VVAL>100) S VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL Q
I VTYP="P",VVAL<0!(VVAL>300) S VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL Q
I VTYP="R",VVAL<0!(VVAL>100) S VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL Q
I VTYP="WT",VVAL<0!(VVAL>1500) S VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL Q
I VTYP="HT",VVAL<10!(VVAL>100) S VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL Q
;
Q:$P(VPSARR,U)=0
; Find Vital Type IEN using Vital Type Abbrev.
S RES=""
S DDR("FILE")=120.51
S DDR("VALUE")=VTYP
S DDR("FLAGS")="MX"
D FIND1C^DDR2(.RES,.DDR)
S VTIEN=+$G(RES(1))
I VTIEN=0 S VPSARR="0^Invalid Vital Type ("_VTYP_")" Q
N RK
S RK=$$ABBVAL^GMVUTL7(VTIEN)
I $L(RK)>0 D
. I +VVAL>$P(RK,U)!(+VVAL<$P(RK,U,2)) S ALERT="Abnormal value of "_VVAL_" for vital type "_VTYP
. I VTYP="BP",+$P(VVAL,"/",2)>$P(RK,U,3)!(+$P(VVAL,"/",2)<$P(RK,U,4)) S ALERT="Abnormal value of "_VVAL_" for vital type "_VTYP
;
;
; Find Qualifier IENs
G:$G(QLFS)="" DT1
K RES
N QL,QIEN,ER,QIENS,I
S DDR("FILE")=120.52
S DDR("FLAGS")="MX"
S ER=0
S QIENS=""
F I=1:1:$L(QLFS,":") S QL=$P(QLFS,":",I) D
. S DDR("VALUE")=QL
. D FIND1C^DDR2(.RES,.DDR)
. S QIEN=+$G(RES(1))
. I QIEN=0 S VPSARR="0^Invalid Qualifier ("_QL_")",ER=1 Q
. S QIENS=QIENS_":"_QIEN
Q:ER
; Remove leading colon
S QIENS=$E(QIENS,2,999)
;
DT1 ;
I $$DTCHK^VPSVTL01($G(DTM)) S VPSARR="0^Invalid or missing Date time" Q
; Set up variables for call to store vitals by calling EN1^GMVDCSAV
; GMVDATA has the following data:
; piece1^piece2^piece3^piece4^piece5
; where:
; piece1 = date/time in FileMan internal format
; piece2 = patient number from FILE 2 (i.e., DFN)
; piece3 = vital type, a semi-colon, the reading, a semi-colon, and
; oxygen flow rate and percentage values [optional] (e.g.,
; 21;99;1 l/min 90%)
; piece4 = hospital location (FILE 44) pointer value
; piece5 = FILE 200 user number (i.e., DUZ), an asterisk, and the
; qualifier (File 120.52) internal entry numbers separated by
; colons (e.g., 547*50:65)
; Example:
; > S GMVDATA="3051011.1635^134^1;120/80;^67^87*2:38:50:75"
; > D EN1^GMVDCSAV(.RESULT,GMVDATA)
N GMVDATA,RESULT
S GMVDATA=DTM_U_DFN_U_VTIEN_";"_$G(VVAL)_";"_$G(OX)_U_$G(LOC)_U_$G(BY)_"*"_$G(QIENS)
D EN1^GMVDCSAV(.RESULT,GMVDATA)
I $G(RESULT(0))="" S VPSARR=1
E I RESULT(0)="ERROR" S VPSARR="0^"_$O(RESULT(""),-1)
I VPSARR=1,ALERT]"" S VPSARR="1^"_ALERT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVPSVTL02 4745 printed Nov 22, 2024@17:53:36 Page 2
VPSVTL02 ;ALBANY/KC - Patient Vitals RPC;08/14/14 09:28
+1 ;;1.0;VA POINT OF SERVICE (KIOSKS);**10**;July 8, 2015;Build 16
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; External Reference DBIA#
+5 ; ------------------------
+6 ; #3217 DDR FIND1 (Supported)
+7 ; #4815 GMVDCSAV (Controlled)
+8 ; #6207 ABBVAL GMVUTL (Controlled)
+9 QUIT
WRITE(VPSARR,VPSNUM,VPSTYP,VTYP,VVAL,DTM,BY,LOC,QLFS,OX) ;
+1 ;
+2 ; INPUT
+3 ; VPSNUM - Parameter Value - patient SSN OR DFN OR ICN OR VIC/CAC (REQUIRED)
+4 ; VPSTYP - Parameter TYPE - SSN or DFN OR ICN OR VIC/CAC (REQUIRED)
+5 ; VTYP - Parameter for Vital Type
+6 ; VVAL - Rate for the Vital Type
+7 ; DTM - Date Time
+8 ; BY - Vitals entered by (user in File #200)
+9 ; LOC - Hospital location (File 44)
+10 ; QLFS - String of Qualifiers for this vital entry (Q1:Q2:Q3) (SITTING:R ARM)
+11 ; OX = Oxygen flow rate and percentage value (1 l/min 90%)
+12 ;
+13 ; OUTPUT
+14 ; VPSARR -
+15 ; If error
+16 ; VPSARR=0^Error message
+17 ; otherwise
+18 ; VPSARR=1(^Alert of abnormal vital vlaue - optional)
+19 ;
+20 ;
+21 ;
+22 ;
+23 NEW CNT,DFN,DDR,RES,VTIEN,ALERT
+24 SET CNT=0
+25 SET ALERT=""
+26 KILL VPSARR
+27 SET VPSARR=1
+28 SET DFN=$$VALIDATE^VPSRPC1($GET(VPSTYP),$GET(VPSNUM))
+29 IF $GET(BY)=""
SET BY=$GET(DUZ)
+30 IF +DFN<0
SET VPSARR="0^"_$PIECE(DFN,"^",2)
QUIT
+31 IF $GET(VVAL)=""
SET VPSARR="0^Missing vital measurement value"
QUIT
+32 IF $GET(VTYP)=""
SET VPSARR="0^Missing vital type"
QUIT
+33 IF VTYP="T"
IF ((+VVAL<45)!(+VVAL>120))
SET VPSARR="0^Invalid vital measurement value for temperature of "_VVAL
QUIT
+34 IF VTYP="BP"
IF VVAL'?1.N."/".N
SET VPSARR="0^Invalid vital measurement value for BP of "_VVAL
QUIT
+35 IF VTYP="BP"
Begin DoDot:1
+36 NEW DIA,SYT
+37 SET SYT=$PIECE(VVAL,"/")
+38 SET DIA=$PIECE(VVAL,"/",2)
+39 IF SYT<0!(SYT>300)!(DIA<0)!(DIA>300)
SET VPSARR="0^Invalid vital measurement value for BP of "_VVAL
End DoDot:1
+40 IF VTYP'="BP"
IF VVAL'?1.E
SET VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL
QUIT
+41 IF VTYP="PN"
IF VVAL<0!((VVAL>10)&(VVAL'=99))
SET VPSARR="0^Invalid vital measurement value for Pain of "_VVAL
QUIT
+42 IF VTYP="PO2"
IF VVAL<0!(VVAL>100)
SET VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL
QUIT
+43 IF VTYP="P"
IF VVAL<0!(VVAL>300)
SET VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL
QUIT
+44 IF VTYP="R"
IF VVAL<0!(VVAL>100)
SET VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL
QUIT
+45 IF VTYP="WT"
IF VVAL<0!(VVAL>1500)
SET VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL
QUIT
+46 IF VTYP="HT"
IF VVAL<10!(VVAL>100)
SET VPSARR="0^Invalid vital measurement value for "_VTYP_" of "_VVAL
QUIT
+47 ;
+48 if $PIECE(VPSARR,U)=0
QUIT
+49 ; Find Vital Type IEN using Vital Type Abbrev.
+50 SET RES=""
+51 SET DDR("FILE")=120.51
+52 SET DDR("VALUE")=VTYP
+53 SET DDR("FLAGS")="MX"
+54 DO FIND1C^DDR2(.RES,.DDR)
+55 SET VTIEN=+$GET(RES(1))
+56 IF VTIEN=0
SET VPSARR="0^Invalid Vital Type ("_VTYP_")"
QUIT
+57 NEW RK
+58 SET RK=$$ABBVAL^GMVUTL7(VTIEN)
+59 IF $LENGTH(RK)>0
Begin DoDot:1
+60 IF +VVAL>$PIECE(RK,U)!(+VVAL<$PIECE(RK,U,2))
SET ALERT="Abnormal value of "_VVAL_" for vital type "_VTYP
+61 IF VTYP="BP"
IF +$PIECE(VVAL,"/",2)>$PIECE(RK,U,3)!(+$PIECE(VVAL,"/",2)<$PIECE(RK,U,4))
SET ALERT="Abnormal value of "_VVAL_" for vital type "_VTYP
End DoDot:1
+62 ;
+63 ;
+64 ; Find Qualifier IENs
+65 if $GET(QLFS)=""
GOTO DT1
+66 KILL RES
+67 NEW QL,QIEN,ER,QIENS,I
+68 SET DDR("FILE")=120.52
+69 SET DDR("FLAGS")="MX"
+70 SET ER=0
+71 SET QIENS=""
+72 FOR I=1:1:$LENGTH(QLFS,":")
SET QL=$PIECE(QLFS,":",I)
Begin DoDot:1
+73 SET DDR("VALUE")=QL
+74 DO FIND1C^DDR2(.RES,.DDR)
+75 SET QIEN=+$GET(RES(1))
+76 IF QIEN=0
SET VPSARR="0^Invalid Qualifier ("_QL_")"
SET ER=1
QUIT
+77 SET QIENS=QIENS_":"_QIEN
End DoDot:1
+78 if ER
QUIT
+79 ; Remove leading colon
+80 SET QIENS=$EXTRACT(QIENS,2,999)
+81 ;
DT1 ;
+1 IF $$DTCHK^VPSVTL01($GET(DTM))
SET VPSARR="0^Invalid or missing Date time"
QUIT
+2 ; Set up variables for call to store vitals by calling EN1^GMVDCSAV
+3 ; GMVDATA has the following data:
+4 ; piece1^piece2^piece3^piece4^piece5
+5 ; where:
+6 ; piece1 = date/time in FileMan internal format
+7 ; piece2 = patient number from FILE 2 (i.e., DFN)
+8 ; piece3 = vital type, a semi-colon, the reading, a semi-colon, and
+9 ; oxygen flow rate and percentage values [optional] (e.g.,
+10 ; 21;99;1 l/min 90%)
+11 ; piece4 = hospital location (FILE 44) pointer value
+12 ; piece5 = FILE 200 user number (i.e., DUZ), an asterisk, and the
+13 ; qualifier (File 120.52) internal entry numbers separated by
+14 ; colons (e.g., 547*50:65)
+15 ; Example:
+16 ; > S GMVDATA="3051011.1635^134^1;120/80;^67^87*2:38:50:75"
+17 ; > D EN1^GMVDCSAV(.RESULT,GMVDATA)
+18 NEW GMVDATA,RESULT
+19 SET GMVDATA=DTM_U_DFN_U_VTIEN_";"_$GET(VVAL)_";"_$GET(OX)_U_$GET(LOC)_U_$GET(BY)_"*"_$GET(QIENS)
+20 DO EN1^GMVDCSAV(.RESULT,GMVDATA)
+21 IF $GET(RESULT(0))=""
SET VPSARR=1
+22 IF '$TEST
IF RESULT(0)="ERROR"
SET VPSARR="0^"_$ORDER(RESULT(""),-1)
+23 IF VPSARR=1
IF ALERT]""
SET VPSARR="1^"_ALERT
+24 QUIT