BPXRMEA ; IHS/MSC/MGH - Handle V Measurement findings. ;08-Nov-2013 12:59;DU
;;2.0;CLINICAL REMINDERS;**1001**;Feb 04, 2005;Build 21
;
;=============================================================
EVALFI(DFN,DEFARR,ENODE,FIEVAL) ;Evaluate V measurement findings.
D EVALFI^PXRMINDX(DFN,.DEFARR,ENODE,.FIEVAL)
Q
;
;=============================================================
EVALPL(FINDPA,ENODE,TERMARR,PLIST) ;Evaluate V measurement findings
;for patient lists.
D EVALPL^PXRMINDL(.FINDPA,ENODE,.TERMARR,PLIST)
Q
;
;=============================================================
EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate V measurement terms.
D EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
Q
;
;=============================================================
GETDATA(DAS,FIEVT) ;Return data, for a specified V measurement entry.
N MEADATA,EM,IND,STOP
D VMEA^BPXRMPX(.MEADATA,DAS,"I")
I $P(MEADATA(1),U,1)=-1 D Q
. S ^TMP("PXRMXMZ",$J,1,0)="Found V MEASURMENT entry "_DAS_" in the index, but not in the V measurement file"
. D SEND^PXRMMSG("Bad entry in MeasurementASSOC PROBLEM index.")
Q:$D(MEADATA(11))>10
S FIEVT("TYPE")=$$EXTERNAL^DILFD(9999999.07,.03,"",MEADATA(3),.EM)
S TEMP=$S(+MEADATA(5)'=0:^SC(MEADATA(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)
I +MEADATA(6) D
.S FIEVT("ENTERED BY")=$P(^VA(200,MEADATA(6),0),U,1)
S (FIEVT("RATE"),FIEVT("VALUE"))=$P(MEADATA(7),U,1)
S IND=0
;Load the external form of the qualifiers.
F S IND=$O(MEADATA(12,IND)) Q:IND="" D
. S TEMP=$P(MEADATA(12,IND),U,1)
.I TEMP'="" S FIEVT("QUALIFIER",IND)=$P($G(^GMRD(120.52,+TEMP,0)),U,1)
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 EM,FIEN,IND,JND,NAME,NOUT,PNAME,RESULT,TEMP,TEXTOUT,VDATE
S FIEN=$P(IFIEVAL("FINDING"),";",1)
S TEMP=^AUTTMSR(FIEN,0)
S PNAME=$P(TEMP,U,1)
S NAME=$$INSCHR^PXRMEXLC(INDENT," ")_"Vital: "_PNAME_" = "
S IND=0
F S IND=+$O(IFIEVAL(IND)) Q:IND=0 D
. S RESULT=$G(IFIEVAL(IND,"VALUE"))
. ;I RESULT'="" S RESULT=$$EXTERNAL^DILFD(9000010.01,.04,"",RESULT,.EM)
. S VDATE=IFIEVAL(IND,"DATE")
. S TEMP=NAME_RESULT_" ("_$$EDATE^PXRMDATE(VDATE)_")"
. 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 EM,FIEN,IND,JND,NOUT,PNAME,RESULT,TEMP,TEXTOUT,VDATE
S FIEN=$P(IFIEVAL("FINDING"),";",1)
S PNAME=$P(^AUTTMSR(FIEN,0),U,1)
S NLINES=NLINES+1
S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Vital: "_PNAME
S IND=0
F S IND=+$O(IFIEVAL(IND)) Q:IND=0 D
. S VDATE=IFIEVAL(IND,"DATE")
. S TEMP=$$EDATE^PXRMDATE(VDATE)
. S RESULT=$G(IFIEVAL(IND,"VALUE"))
. I RESULT'="" D
.. S TEMP=TEMP_" result - "_RESULT
.. ;S TEMP=TEMP_$$EXTERNAL^DILFD(9000010.01,.04,"",RESULT,.EM)
. D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
. F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
. ;I IFIEVAL(IND,"COMMENTS")'="" D
. ;S TEMP="Comments: "_IFIEVAL(IND,"COMMENTS")
. ;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
;
SEVALFI(FILENUM,SNODE,DFN,ITEM,NGET,SDIR,BDT,EDT,NFOUND,FLIST) ;Find data
BPXRMEA ; IHS/MSC/MGH - Handle V Measurement findings. ;08-Nov-2013 12:59;DU
+1 ;;2.0;CLINICAL REMINDERS;**1001**;Feb 04, 2005;Build 21
+2 ;
+3 ;=============================================================
EVALFI(DFN,DEFARR,ENODE,FIEVAL) ;Evaluate V measurement findings.
+1 DO EVALFI^PXRMINDX(DFN,.DEFARR,ENODE,.FIEVAL)
+2 QUIT
+3 ;
+4 ;=============================================================
EVALPL(FINDPA,ENODE,TERMARR,PLIST) ;Evaluate V measurement findings
+1 ;for patient lists.
+2 DO EVALPL^PXRMINDL(.FINDPA,ENODE,.TERMARR,PLIST)
+3 QUIT
+4 ;
+5 ;=============================================================
EVALTERM(DFN,FINDPA,ENODE,TERMARR,TFIEVAL) ;Evaluate V measurement terms.
+1 DO EVALTERM^PXRMINDX(DFN,.FINDPA,ENODE,.TERMARR,.TFIEVAL)
+2 QUIT
+3 ;
+4 ;=============================================================
GETDATA(DAS,FIEVT) ;Return data, for a specified V measurement entry.
+1 NEW MEADATA,EM,IND,STOP
+2 DO VMEA^BPXRMPX(.MEADATA,DAS,"I")
+3 IF $PIECE(MEADATA(1),U,1)=-1
Begin DoDot:1
+4 SET ^TMP("PXRMXMZ",$JOB,1,0)="Found V MEASURMENT entry "_DAS_" in the index, but not in the V measurement file"
+5 DO SEND^PXRMMSG("Bad entry in MeasurementASSOC PROBLEM index.")
End DoDot:1
QUIT
+6 IF $DATA(MEADATA(11))>10
QUIT
+7 SET FIEVT("TYPE")=$$EXTERNAL^DILFD(9999999.07,.03,"",MEADATA(3),.EM)
+8 SET TEMP=$SELECT(+MEADATA(5)'=0:^SC(MEADATA(5),0),1:"")
+9 SET FIEVT("HOSPITAL LOCATION")=$PIECE(TEMP,U,1)
+10 SET FIEVT("LOCATION TYPE")=$PIECE(TEMP,U,3)
+11 SET STOP=$PIECE(TEMP,U,7)
+12 IF +MEADATA(6)
Begin DoDot:1
+13 SET FIEVT("ENTERED BY")=$PIECE(^VA(200,MEADATA(6),0),U,1)
End DoDot:1
+14 SET (FIEVT("RATE"),FIEVT("VALUE"))=$PIECE(MEADATA(7),U,1)
+15 SET IND=0
+16 ;Load the external form of the qualifiers.
+17 FOR
SET IND=$ORDER(MEADATA(12,IND))
IF IND=""
QUIT
Begin DoDot:1
+18 SET TEMP=$PIECE(MEADATA(12,IND),U,1)
+19 IF TEMP'=""
SET FIEVT("QUALIFIER",IND)=$PIECE($GET(^GMRD(120.52,+TEMP,0)),U,1)
End DoDot:1
+20 IF STOP'=""
SET FIEVT("STOP CODE")=$PIECE(^DIC(40.7,STOP,0),U,1,2)
+21 IF '$TEST
SET FIEVT("STOP CODE")=""
+22 QUIT
+23 ;
+24 ;=============================================================
MHVOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
+1 NEW EM,FIEN,IND,JND,NAME,NOUT,PNAME,RESULT,TEMP,TEXTOUT,VDATE
+2 SET FIEN=$PIECE(IFIEVAL("FINDING"),";",1)
+3 SET TEMP=^AUTTMSR(FIEN,0)
+4 SET PNAME=$PIECE(TEMP,U,1)
+5 SET NAME=$$INSCHR^PXRMEXLC(INDENT," ")_"Vital: "_PNAME_" = "
+6 SET IND=0
+7 FOR
SET IND=+$ORDER(IFIEVAL(IND))
IF IND=0
QUIT
Begin DoDot:1
+8 SET RESULT=$GET(IFIEVAL(IND,"VALUE"))
+9 ;I RESULT'="" S RESULT=$$EXTERNAL^DILFD(9000010.01,.04,"",RESULT,.EM)
+10 SET VDATE=IFIEVAL(IND,"DATE")
+11 SET TEMP=NAME_RESULT_" ("_$$EDATE^PXRMDATE(VDATE)_")"
+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)
End DoDot:1
+14 SET NLINES=NLINES+1
SET TEXT(NLINES)=""
+15 QUIT
+16 ;
+17 ;=============================================================
OUTPUT(INDENT,IFIEVAL,NLINES,TEXT) ;Produce the clinical
+1 ;maintenance output.
+2 NEW EM,FIEN,IND,JND,NOUT,PNAME,RESULT,TEMP,TEXTOUT,VDATE
+3 SET FIEN=$PIECE(IFIEVAL("FINDING"),";",1)
+4 SET PNAME=$PIECE(^AUTTMSR(FIEN,0),U,1)
+5 SET NLINES=NLINES+1
+6 SET TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Vital: "_PNAME
+7 SET IND=0
+8 FOR
SET IND=+$ORDER(IFIEVAL(IND))
IF IND=0
QUIT
Begin DoDot:1
+9 SET VDATE=IFIEVAL(IND,"DATE")
+10 SET TEMP=$$EDATE^PXRMDATE(VDATE)
+11 SET RESULT=$GET(IFIEVAL(IND,"VALUE"))
+12 IF RESULT'=""
Begin DoDot:2
+13 SET TEMP=TEMP_" result - "_RESULT
+14 ;S TEMP=TEMP_$$EXTERNAL^DILFD(9000010.01,.04,"",RESULT,.EM)
End DoDot:2
+15 DO FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+16 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
+17 ;I IFIEVAL(IND,"COMMENTS")'="" D
+18 ;S TEMP="Comments: "_IFIEVAL(IND,"COMMENTS")
+19 ;D FORMATS^PXRMTEXT(INDENT+3,PXRMRM,TEMP,.NOUT,.TEXTOUT)
+20 ;F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
End DoDot:1
+21 SET NLINES=NLINES+1
SET TEXT(NLINES)=""
+22 QUIT
+23 ;
SEVALFI(FILENUM,SNODE,DFN,ITEM,NGET,SDIR,BDT,EDT,NFOUND,FLIST) ;Find data