PXRMVITL ;SLC/PKR - Handle vitals findings. ;07/31/2020
;;2.0;CLINICAL REMINDERS;**6,12,17,18,42**;Feb 04, 2005;Build 245
;
;===============
EVALFI(DFN,DEFARR,ENODE,FIEVAL) ;Evaluate vital measurement findings.
D EVALFI^PXRMINDX(DFN,.DEFARR,ENODE,.FIEVAL)
Q
;
;===============
EVALPL(FINDPA,ENODE,TERMARR,PLIST) ;Evaluate vital measurement
;term findings for patient lists.
D EVALPL^PXRMINDL(.FINDPA,ENODE,.TERMARR,PLIST)
Q
;
;===============
EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate vital measurement
;terms.
D EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
Q
;
;===============
GETDATA(DAS,FIEVT) ;Return data for a GMRV Vital Measurement entry.
N EM,IND,GMRVDATA,STOP,TEMP,TYPE
;DBIA #3647
D EN^GMVPXRM(.GMRVDATA,DAS,"I")
I $P(GMRVDATA(1),U,1)=-1 D Q
. S ^TMP("PXRMXMZ",$J,1,0)="Found GMRV entry "_DAS_" in the index, but it does not exist in ^GMR(120.5"
. D SEND^PXRMMSG("PXRMXMZ","Bad entry in Vitals index.","",DUZ)
S FIEVT("TYPE")=$$EXTERNAL^DILFD(120.5,.03,"",GMRVDATA(3),.EM)
;DBIA #10040
S TEMP=$S(+GMRVDATA(5)'=0:^SC(GMRVDATA(5),0),1:"")
S FIEVT("HOSPITAL LOCATION")=$P(TEMP,U,1)
S FIEVT("LOCATION TYPE")=$P(TEMP,U,3)
S STOP=$P(TEMP,U,7)
S FIEVT("ENTERED BY")=$P(^VA(200,GMRVDATA(6),0),U,1)
S (FIEVT("RATE"),FIEVT("VALUE"))=$P(GMRVDATA(7),U,1)
I FIEVT("TYPE")="BLOOD PRESSURE",FIEVT("RATE")["/" D
. S FIEVT("SYSTOLIC")=$P(FIEVT("RATE"),"/",1)
. S FIEVT("DIASTOLIC")=$P(FIEVT("RATE"),"/",$L(FIEVT("RATE"),"/"))
I GMRVDATA(8)'="" S FIEVT("SUPPLEMENTAL O2")=GMRVDATA(8)
S IND=0
;Load the external form of the qualifiers.
F S IND=$O(GMRVDATA(12,IND)) Q:IND="" D
. S TEMP=$P(GMRVDATA(12,IND),U,1)
.;DBIA #4504
. I TEMP'="" S FIEVT("QUALIFIER",IND)=$P($G(^GMRD(120.52,+TEMP,0)),U,1)
;DBIA #557
I STOP'="" S FIEVT("STOP CODE")=$P(^DIC(40.7,STOP,0),U,1,2)
E S FIEVT("STOP CODE")=""
Q
;
;===============
MHVOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
N DATE,EM,IND,JND,NAME,NOUT,RATE,TEMP,TEXTOUT,TYPE
S TYPE=$$EXTERNAL^DILFD(120.5,.03,"",IFIEVAL("TYPE"),.EM)
S NAME="Vital Measurement: "_TYPE_" = "
S IND=0
F S IND=+$O(IFIEVAL(IND)) Q:IND=0 D
. S RATE=$G(IFIEVAL(IND,"VALUE"))
. I RATE="" S RATE="MISSING"
. S DATE=IFIEVAL(IND,"DATE")
. S TEMP=NAME_RATE_" ("_$$EDATE^PXRMDATE(DATE)_")"
. D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
. F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
S NLINES=NLINES+1,TEXT(NLINES)=""
Q
;
;===============
OUTPUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the clinical
;maintenance output.
N DATE,EM,IND,JND,NOUT,RATE,TEMP,TEXTOUT,TYPE
S NLINES=NLINES+1
S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Vital Measurement: "_IFIEVAL("TYPE")
S IND=0
F S IND=+$O(IFIEVAL(IND)) Q:IND=0 D
. S DATE=IFIEVAL(IND,"DATE")
. S TEMP=$$EDATE^PXRMDATE(DATE)
. S RATE=$G(IFIEVAL(IND,"VALUE"))
. I RATE="" S RATE="MISSING"
. S TEMP=TEMP_"; rate - "_RATE
. D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
. F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
.;If there is a supplemental O2 display it.
. I $D(IFIEVAL("SUPPLEMENTAL O2")) S NLINES=NLINES+1,TEXT(NLINES)=" Supplemental O2: "_IFIEVAL("SUPPLEMENTAL O2")
.;If there are qualifiers display them.
. I $D(IFIEVAL(IND,"QUALIFIER")) D
.. S TEMP="Qualifiers:"
.. N QIND S QIND=0
.. S QIND=$O(IFIEVAL(IND,"QUALIFIER",QIND)) S TEMP=TEMP_" "_IFIEVAL(IND,"QUALIFIER",QIND)
.. F S QIND=$O(IFIEVAL(IND,"QUALIFIER",QIND)) Q:QIND="" S TEMP=TEMP_", "_IFIEVAL(IND,"QUALIFIER",QIND)
.. D FORMATS^PXRMTEXT(INDENT+3,PXRMRM,TEMP,.NOUT,.TEXTOUT)
.. F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
S NLINES=NLINES+1,TEXT(NLINES)=""
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMVITL 3762 printed Oct 16, 2024@17:50:45 Page 2
PXRMVITL ;SLC/PKR - Handle vitals findings. ;07/31/2020
+1 ;;2.0;CLINICAL REMINDERS;**6,12,17,18,42**;Feb 04, 2005;Build 245
+2 ;
+3 ;===============
EVALFI(DFN,DEFARR,ENODE,FIEVAL) ;Evaluate vital measurement findings.
+1 DO EVALFI^PXRMINDX(DFN,.DEFARR,ENODE,.FIEVAL)
+2 QUIT
+3 ;
+4 ;===============
EVALPL(FINDPA,ENODE,TERMARR,PLIST) ;Evaluate vital measurement
+1 ;term findings for patient lists.
+2 DO EVALPL^PXRMINDL(.FINDPA,ENODE,.TERMARR,PLIST)
+3 QUIT
+4 ;
+5 ;===============
EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate vital measurement
+1 ;terms.
+2 DO EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
+3 QUIT
+4 ;
+5 ;===============
GETDATA(DAS,FIEVT) ;Return data for a GMRV Vital Measurement entry.
+1 NEW EM,IND,GMRVDATA,STOP,TEMP,TYPE
+2 ;DBIA #3647
+3 DO EN^GMVPXRM(.GMRVDATA,DAS,"I")
+4 IF $PIECE(GMRVDATA(1),U,1)=-1
Begin DoDot:1
+5 SET ^TMP("PXRMXMZ",$JOB,1,0)="Found GMRV entry "_DAS_" in the index, but it does not exist in ^GMR(120.5"
+6 DO SEND^PXRMMSG("PXRMXMZ","Bad entry in Vitals index.","",DUZ)
End DoDot:1
QUIT
+7 SET FIEVT("TYPE")=$$EXTERNAL^DILFD(120.5,.03,"",GMRVDATA(3),.EM)
+8 ;DBIA #10040
+9 SET TEMP=$SELECT(+GMRVDATA(5)'=0:^SC(GMRVDATA(5),0),1:"")
+10 SET FIEVT("HOSPITAL LOCATION")=$PIECE(TEMP,U,1)
+11 SET FIEVT("LOCATION TYPE")=$PIECE(TEMP,U,3)
+12 SET STOP=$PIECE(TEMP,U,7)
+13 SET FIEVT("ENTERED BY")=$PIECE(^VA(200,GMRVDATA(6),0),U,1)
+14 SET (FIEVT("RATE"),FIEVT("VALUE"))=$PIECE(GMRVDATA(7),U,1)
+15 IF FIEVT("TYPE")="BLOOD PRESSURE"
IF FIEVT("RATE")["/"
Begin DoDot:1
+16 SET FIEVT("SYSTOLIC")=$PIECE(FIEVT("RATE"),"/",1)
+17 SET FIEVT("DIASTOLIC")=$PIECE(FIEVT("RATE"),"/",$LENGTH(FIEVT("RATE"),"/"))
End DoDot:1
+18 IF GMRVDATA(8)'=""
SET FIEVT("SUPPLEMENTAL O2")=GMRVDATA(8)
+19 SET IND=0
+20 ;Load the external form of the qualifiers.
+21 FOR
SET IND=$ORDER(GMRVDATA(12,IND))
if IND=""
QUIT
Begin DoDot:1
+22 SET TEMP=$PIECE(GMRVDATA(12,IND),U,1)
+23 ;DBIA #4504
+24 IF TEMP'=""
SET FIEVT("QUALIFIER",IND)=$PIECE($GET(^GMRD(120.52,+TEMP,0)),U,1)
End DoDot:1
+25 ;DBIA #557
+26 IF STOP'=""
SET FIEVT("STOP CODE")=$PIECE(^DIC(40.7,STOP,0),U,1,2)
+27 IF '$TEST
SET FIEVT("STOP CODE")=""
+28 QUIT
+29 ;
+30 ;===============
MHVOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
+1 NEW DATE,EM,IND,JND,NAME,NOUT,RATE,TEMP,TEXTOUT,TYPE
+2 SET TYPE=$$EXTERNAL^DILFD(120.5,.03,"",IFIEVAL("TYPE"),.EM)
+3 SET NAME="Vital Measurement: "_TYPE_" = "
+4 SET IND=0
+5 FOR
SET IND=+$ORDER(IFIEVAL(IND))
if IND=0
QUIT
Begin DoDot:1
+6 SET RATE=$GET(IFIEVAL(IND,"VALUE"))
+7 IF RATE=""
SET RATE="MISSING"
+8 SET DATE=IFIEVAL(IND,"DATE")
+9 SET TEMP=NAME_RATE_" ("_$$EDATE^PXRMDATE(DATE)_")"
+10 DO FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+11 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
End DoDot:1
+12 SET NLINES=NLINES+1
SET TEXT(NLINES)=""
+13 QUIT
+14 ;
+15 ;===============
OUTPUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the clinical
+1 ;maintenance output.
+2 NEW DATE,EM,IND,JND,NOUT,RATE,TEMP,TEXTOUT,TYPE
+3 SET NLINES=NLINES+1
+4 SET TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Vital Measurement: "_IFIEVAL("TYPE")
+5 SET IND=0
+6 FOR
SET IND=+$ORDER(IFIEVAL(IND))
if IND=0
QUIT
Begin DoDot:1
+7 SET DATE=IFIEVAL(IND,"DATE")
+8 SET TEMP=$$EDATE^PXRMDATE(DATE)
+9 SET RATE=$GET(IFIEVAL(IND,"VALUE"))
+10 IF RATE=""
SET RATE="MISSING"
+11 SET TEMP=TEMP_"; rate - "_RATE
+12 DO FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+13 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
+14 ;If there is a supplemental O2 display it.
+15 IF $DATA(IFIEVAL("SUPPLEMENTAL O2"))
SET NLINES=NLINES+1
SET TEXT(NLINES)=" Supplemental O2: "_IFIEVAL("SUPPLEMENTAL O2")
+16 ;If there are qualifiers display them.
+17 IF $DATA(IFIEVAL(IND,"QUALIFIER"))
Begin DoDot:2
+18 SET TEMP="Qualifiers:"
+19 NEW QIND
SET QIND=0
+20 SET QIND=$ORDER(IFIEVAL(IND,"QUALIFIER",QIND))
SET TEMP=TEMP_" "_IFIEVAL(IND,"QUALIFIER",QIND)
+21 FOR
SET QIND=$ORDER(IFIEVAL(IND,"QUALIFIER",QIND))
if QIND=""
QUIT
SET TEMP=TEMP_", "_IFIEVAL(IND,"QUALIFIER",QIND)
+22 DO FORMATS^PXRMTEXT(INDENT+3,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+23 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
End DoDot:2
End DoDot:1
+24 SET NLINES=NLINES+1
SET TEXT(NLINES)=""
+25 QUIT
+26 ;