RAHLEXF ;HIRMFO/BNT - RAD/NUC MED HL7 Exceptions filer;01/06/99
;;5.0;Radiology/Nuclear Medicine;**12,25,47**;Mar 16, 1998;Build 21
;
;
; This routine is called from the bridge routine (^RAHLTCPB or TCPX)
; when an error occurs while processing an HL7 Message.
; The error is stored in the HL7 Message Exceptions File (#79.3)
; And, if requested, sent to the HL7 MAIL GROUP for this application
;
Q
ENX(HLRADT,RAMSG) ; Entry point called from Bridge routine.
N RAEXFIL,RADT,RAPT,RAEX,RAERRX,SFAC,X,Y,RALNGCS,RAUSR
;
; File number of Exceptions File
S RAEXFIL=79.3
;
; Date and Time of HL7 Transaction
S HLRADT=$E(HLRADT,1,14)
S X=HLRADT,RADT=$$FMDATE^HLFNC(X)
;
; Radiology Patient Number
S RAPT=$G(^TMP("RARPT-REC",$J,RASUB,"RADFN"))
S RAPT="`"_RAPT
;
; Radiology Case Number
S RALNGCS=$G(^TMP("RARPT-REC",$J,RASUB,"RALONGCN"))
S RALNGCS=$P(RALNGCS,"-",$L(RALNGCS,"-"))
;
; Error (Exception) Text
S RAERRX=RAERR
;
; Sending Application Name
S SFAC=$G(HL("SAN"))
;
; Name of Verifying Physician or Interpreting staff (COTS unit user)
S RAUSR=$G(^TMP("RARPT-REC",$J,RASUB,"RAVERF"))
I RAUSR]"" D
. D FIND^DIC(200,"",".01","AX",RAUSR,"","","","","RAOUT")
. Q:'$D(RAOUT("DILIST","ID",1,.01))
. S RAUSR=RAOUT("DILIST","ID",1,.01)
;
; RAMSG = IEN of entry in file 773 - Message Administration file.
;
;
; Go File the exception
D RAERR
;
; Send mail message
D MAIL(SFAC,$G(HL("SAF")),RAERR,RALNGCS,$P(RAPT,"`",2),RADT,RAUSR)
;
D EXIT
;
Q
EN1 ; Entry point called from Bridge routine.
N RAEXFIL,RADT,RAPT,RAEX,RAERRX,SFAC,X,Y,RALNGCS,RAUSR,HLRADT,RAMSG
;
; File number of Exceptions File
S RAEXFIL=79.3
;
; Date and Time of HL7 Transaction
S HLRADT=$E($P($G(^TMP("RARPT-HL7",$J,1)),"|",7),1,14)
S X=HLRADT,RADT=$$FMDATE^HLFNC(X)
;
; Radiology Patient Number
S RAPT=$G(^TMP("RARPT-REC",$J,RASUB,"RADFN"))
S RAPT="`"_RAPT
;
; Radiology Case Number
S RALNGCS=$G(^TMP("RARPT-REC",$J,RASUB,"RALONGCN"))
S RALNGCS=$P(RALNGCS,"-",$L(RALNGCS,"-"))
;
; Error (Exception) Text
S RAERRX=RAERR
;
; Sending Application Name
S SFAC=$G(HL("SAN"))
;
; Name of Verifying Physician or Interpreting staff (COTS unit user)
S RAUSR=$G(^TMP("RARPT-REC",$J,RASUB,"RAVERF"))
I RAUSR]"" D
. D FIND^DIC(200,"",".01","AX",RAUSR,"","","","","RAOUT")
. Q:'$D(RAOUT("DILIST","ID",1,.01))
. S RAUSR=RAOUT("DILIST","ID",1,.01)
;
; IEN of entry in file 773 - Message Administration file.
S RAMSG=$P(^TMP("RARPT-HL7",$J,1),"|",10)
;
; Go File the exception
D RAERR
;
; Send mail message
D MAIL(SFAC,$G(HL("SAF")),RAERR,RALNGCS,$P(RAPT,"`",2),RADT,RAUSR)
;
D EXIT
;
Q
RAERR ; Build array and update Exceptions File.
S RAEX(0,RAEXFIL,"+1,",.01)=RADT
S RAEX(0,RAEXFIL,"+1,",.02)=SFAC
S RAEX(0,RAEXFIL,"+1,",1)=RAERRX
S:$G(RAPT)]"" RAEX(0,RAEXFIL,"+1,",.03)=RAPT
S:$G(RALNGCS)]"" RAEX(0,RAEXFIL,"+1,",.04)=RALNGCS
S:$G(RAUSR)]"" RAEX(0,RAEXFIL,"+1,",.06)=RAUSR
S:$G(RAMSG)]"" RAEX(0,RAEXFIL,"+1,",.05)=RAMSG
D UPDATE^DIE("E","RAEX(0)","")
Q
;
MAIL(SAN,SAF,RAERR,RACN,RADFN,RADT,RAUSR) ; Send mail message with error text.
;
; INPUT PARAMETERS:
; SAN = HL7 Sending Application (Required)
; SAF = Sending Facility Name
; RAERR = Error Message to display (Required)
; RACN = Radiology Case Number
; RADFN = Rad Patient File (#70) IEN
; RADT = Date & Time of HL7 message (FileMan format)
; RAUSR = Name of Verifying Physician
;
N RAERTXT,RAMGP,XMY,XMDUZ,XMSUB,Y
;
S RAMGP=$P($$GETAPP^HLCS2(SAN),"^",1) ; Get mail group
Q:RAMGP=""
;
S RAPT=$P($G(^DPT(+RADFN,0)),"^")
S:RAPT="" RAPT="UNKNOWN"
;
S RACN=$S($G(RACN)]"":$G(RACN),1:"???")
S RAUSR=$S($G(RAUSR)]"":$G(RAUSR),1:"UNKNOWN")
S Y=RADT D DD^%DT S RADT=$S(Y]"":Y,1:"UNKNOWN DATE/TIME")
S SAF=$S($G(SAF)]"":$G(SAF),1:SAN)
;
S XMDUZ="Rad HL7 Interface Processor"
;
S XMSUB="HL7 message from "_SAF_" application rejected."
;
S RAERTXT(1)="There was a problem processing an HL7 message sent by "
S RAERTXT(2)=SAF_" on "_RADT_"."
I $G(HLMTIENS)'="" S RAERTXT(2)=RAERTXT(2)_" Message ien = "_HLMTIENS
S RAERTXT(3)=""
S RAERTXT(4)="The report entered on Case #"_RACN_" for "_RAPT
S RAERTXT(5)="was rejected by Radiology/Nuclear Medicine."
S RAERTXT(6)=""
S RAERTXT(7)="The reason given was:"
S RAERTXT(8)=RAERR
S RAERTXT(9)=""
S RAERTXT(10)="( This message has been sent to G."_RAMGP
S RAERTXT(11)=" and to the verifying physician, "_RAUSR_" )"
S XMTEXT="RAERTXT("
;
S:$O(^XMB(3.8,"B",RAMGP,0)) XMY("G."_RAMGP)="" ; send to group
S:$G(RAUSR)]"" XMY(RAUSR)="" ; send to dictating doctor
;
D ^XMD
;
Q
EXIT ; Kill variables and return to bridge routine..
K RAEX,RADT,RAERRX,RAPT,SFAC,RAEXFIL,RALNGCS,RAUSR,RAMSG,X,Y
Q
RAHLEXF ;HIRMFO/BNT - RAD/NUC MED HL7 Exceptions filer;01/06/99
+1 ;;5.0;Radiology/Nuclear Medicine;**12,25,47**;Mar 16, 1998;Build 21
+2 ;
+3 ;
+4 ; This routine is called from the bridge routine (^RAHLTCPB or TCPX)
+5 ; when an error occurs while processing an HL7 Message.
+6 ; The error is stored in the HL7 Message Exceptions File (#79.3)
+7 ; And, if requested, sent to the HL7 MAIL GROUP for this application
+8 ;
+9 QUIT
ENX(HLRADT,RAMSG) ; Entry point called from Bridge routine.
+1 NEW RAEXFIL,RADT,RAPT,RAEX,RAERRX,SFAC,X,Y,RALNGCS,RAUSR
+2 ;
+3 ; File number of Exceptions File
+4 SET RAEXFIL=79.3
+5 ;
+6 ; Date and Time of HL7 Transaction
+7 SET HLRADT=$EXTRACT(HLRADT,1,14)
+8 SET X=HLRADT
SET RADT=$$FMDATE^HLFNC(X)
+9 ;
+10 ; Radiology Patient Number
+11 SET RAPT=$GET(^TMP("RARPT-REC",$JOB,RASUB,"RADFN"))
+12 SET RAPT="`"_RAPT
+13 ;
+14 ; Radiology Case Number
+15 SET RALNGCS=$GET(^TMP("RARPT-REC",$JOB,RASUB,"RALONGCN"))
+16 SET RALNGCS=$PIECE(RALNGCS,"-",$LENGTH(RALNGCS,"-"))
+17 ;
+18 ; Error (Exception) Text
+19 SET RAERRX=RAERR
+20 ;
+21 ; Sending Application Name
+22 SET SFAC=$GET(HL("SAN"))
+23 ;
+24 ; Name of Verifying Physician or Interpreting staff (COTS unit user)
+25 SET RAUSR=$GET(^TMP("RARPT-REC",$JOB,RASUB,"RAVERF"))
+26 IF RAUSR]""
Begin DoDot:1
+27 DO FIND^DIC(200,"",".01","AX",RAUSR,"","","","","RAOUT")
+28 IF '$DATA(RAOUT("DILIST","ID",1,.01))
QUIT
+29 SET RAUSR=RAOUT("DILIST","ID",1,.01)
End DoDot:1
+30 ;
+31 ; RAMSG = IEN of entry in file 773 - Message Administration file.
+32 ;
+33 ;
+34 ; Go File the exception
+35 DO RAERR
+36 ;
+37 ; Send mail message
+38 DO MAIL(SFAC,$GET(HL("SAF")),RAERR,RALNGCS,$PIECE(RAPT,"`",2),RADT,RAUSR)
+39 ;
+40 DO EXIT
+41 ;
+42 QUIT
EN1 ; Entry point called from Bridge routine.
+1 NEW RAEXFIL,RADT,RAPT,RAEX,RAERRX,SFAC,X,Y,RALNGCS,RAUSR,HLRADT,RAMSG
+2 ;
+3 ; File number of Exceptions File
+4 SET RAEXFIL=79.3
+5 ;
+6 ; Date and Time of HL7 Transaction
+7 SET HLRADT=$EXTRACT($PIECE($GET(^TMP("RARPT-HL7",$JOB,1)),"|",7),1,14)
+8 SET X=HLRADT
SET RADT=$$FMDATE^HLFNC(X)
+9 ;
+10 ; Radiology Patient Number
+11 SET RAPT=$GET(^TMP("RARPT-REC",$JOB,RASUB,"RADFN"))
+12 SET RAPT="`"_RAPT
+13 ;
+14 ; Radiology Case Number
+15 SET RALNGCS=$GET(^TMP("RARPT-REC",$JOB,RASUB,"RALONGCN"))
+16 SET RALNGCS=$PIECE(RALNGCS,"-",$LENGTH(RALNGCS,"-"))
+17 ;
+18 ; Error (Exception) Text
+19 SET RAERRX=RAERR
+20 ;
+21 ; Sending Application Name
+22 SET SFAC=$GET(HL("SAN"))
+23 ;
+24 ; Name of Verifying Physician or Interpreting staff (COTS unit user)
+25 SET RAUSR=$GET(^TMP("RARPT-REC",$JOB,RASUB,"RAVERF"))
+26 IF RAUSR]""
Begin DoDot:1
+27 DO FIND^DIC(200,"",".01","AX",RAUSR,"","","","","RAOUT")
+28 IF '$DATA(RAOUT("DILIST","ID",1,.01))
QUIT
+29 SET RAUSR=RAOUT("DILIST","ID",1,.01)
End DoDot:1
+30 ;
+31 ; IEN of entry in file 773 - Message Administration file.
+32 SET RAMSG=$PIECE(^TMP("RARPT-HL7",$JOB,1),"|",10)
+33 ;
+34 ; Go File the exception
+35 DO RAERR
+36 ;
+37 ; Send mail message
+38 DO MAIL(SFAC,$GET(HL("SAF")),RAERR,RALNGCS,$PIECE(RAPT,"`",2),RADT,RAUSR)
+39 ;
+40 DO EXIT
+41 ;
+42 QUIT
RAERR ; Build array and update Exceptions File.
+1 SET RAEX(0,RAEXFIL,"+1,",.01)=RADT
+2 SET RAEX(0,RAEXFIL,"+1,",.02)=SFAC
+3 SET RAEX(0,RAEXFIL,"+1,",1)=RAERRX
+4 IF $GET(RAPT)]""
SET RAEX(0,RAEXFIL,"+1,",.03)=RAPT
+5 IF $GET(RALNGCS)]""
SET RAEX(0,RAEXFIL,"+1,",.04)=RALNGCS
+6 IF $GET(RAUSR)]""
SET RAEX(0,RAEXFIL,"+1,",.06)=RAUSR
+7 IF $GET(RAMSG)]""
SET RAEX(0,RAEXFIL,"+1,",.05)=RAMSG
+8 DO UPDATE^DIE("E","RAEX(0)","")
+9 QUIT
+10 ;
MAIL(SAN,SAF,RAERR,RACN,RADFN,RADT,RAUSR) ; Send mail message with error text.
+1 ;
+2 ; INPUT PARAMETERS:
+3 ; SAN = HL7 Sending Application (Required)
+4 ; SAF = Sending Facility Name
+5 ; RAERR = Error Message to display (Required)
+6 ; RACN = Radiology Case Number
+7 ; RADFN = Rad Patient File (#70) IEN
+8 ; RADT = Date & Time of HL7 message (FileMan format)
+9 ; RAUSR = Name of Verifying Physician
+10 ;
+11 NEW RAERTXT,RAMGP,XMY,XMDUZ,XMSUB,Y
+12 ;
+13 ; Get mail group
SET RAMGP=$PIECE($$GETAPP^HLCS2(SAN),"^",1)
+14 IF RAMGP=""
QUIT
+15 ;
+16 SET RAPT=$PIECE($GET(^DPT(+RADFN,0)),"^")
+17 IF RAPT=""
SET RAPT="UNKNOWN"
+18 ;
+19 SET RACN=$SELECT($GET(RACN)]"":$GET(RACN),1:"???")
+20 SET RAUSR=$SELECT($GET(RAUSR)]"":$GET(RAUSR),1:"UNKNOWN")
+21 SET Y=RADT
DO DD^%DT
SET RADT=$SELECT(Y]"":Y,1:"UNKNOWN DATE/TIME")
+22 SET SAF=$SELECT($GET(SAF)]"":$GET(SAF),1:SAN)
+23 ;
+24 SET XMDUZ="Rad HL7 Interface Processor"
+25 ;
+26 SET XMSUB="HL7 message from "_SAF_" application rejected."
+27 ;
+28 SET RAERTXT(1)="There was a problem processing an HL7 message sent by "
+29 SET RAERTXT(2)=SAF_" on "_RADT_"."
+30 IF $GET(HLMTIENS)'=""
SET RAERTXT(2)=RAERTXT(2)_" Message ien = "_HLMTIENS
+31 SET RAERTXT(3)=""
+32 SET RAERTXT(4)="The report entered on Case #"_RACN_" for "_RAPT
+33 SET RAERTXT(5)="was rejected by Radiology/Nuclear Medicine."
+34 SET RAERTXT(6)=""
+35 SET RAERTXT(7)="The reason given was:"
+36 SET RAERTXT(8)=RAERR
+37 SET RAERTXT(9)=""
+38 SET RAERTXT(10)="( This message has been sent to G."_RAMGP
+39 SET RAERTXT(11)=" and to the verifying physician, "_RAUSR_" )"
+40 SET XMTEXT="RAERTXT("
+41 ;
+42 ; send to group
IF $ORDER(^XMB(3.8,"B",RAMGP,0))
SET XMY("G."_RAMGP)=""
+43 ; send to dictating doctor
IF $GET(RAUSR)]""
SET XMY(RAUSR)=""
+44 ;
+45 DO ^XMD
+46 ;
+47 QUIT
EXIT ; Kill variables and return to bridge routine..
+1 KILL RAEX,RADT,RAERRX,RAPT,SFAC,RAEXFIL,RALNGCS,RAUSR,RAMSG,X,Y
+2 QUIT