source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAHLEXF.m@ 1800

Last change on this file since 1800 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1RAHLEXF ;HIRMFO/BNT - RAD/NUC MED HL7 Exceptions filer;01/06/99
2 ;;5.0;Radiology/Nuclear Medicine;**12,25**;Mar 16, 1998
3 ;
4 ;
5 ; This routine is called from the bridge routine (^RAHLTCPB) when an
6 ; error occurs while processing an HL7 Message.
7 ; The error is stored in the HL7 Message Exceptions File (#79.3)
8 ; And, if requested, sent to the HL7 MAIL GROUP for this application
9 ;
10 Q
11EN1 ; Entry point called from Bridge routine.
12 N RAEXFIL,RADT,RAPT,RAEX,RAERRX,SFAC,X,Y,RALNGCS,RAUSR,HLRADT,RAMSG
13 ;
14 ; File number of Exceptions File
15 S RAEXFIL=79.3
16 ;
17 ; Date and Time of HL7 Transaction
18 S HLRADT=$E($P($G(^TMP("RARPT-HL7",$J,1)),"|",7),1,14)
19 S X=HLRADT,RADT=$$FMDATE^HLFNC(X)
20 ;
21 ; Radiology Patient Number
22 S RAPT=$G(^TMP("RARPT-REC",$J,RASUB,"RADFN"))
23 S RAPT="`"_RAPT
24 ;
25 ; Radiology Case Number
26 S RALNGCS=$P($G(^TMP("RARPT-REC",$J,RASUB,"RALONGCN")),"-",2)
27 ;
28 ; Error (Exception) Text
29 S RAERRX=RAERR
30 ;
31 ; Sending Application Name
32 S SFAC=$G(HL("SAN"))
33 ;
34 ; Name of Verifying Physician or Interpreting staff (COTS unit user)
35 S RAUSR=$G(^TMP("RARPT-REC",$J,RASUB,"RAVERF"))
36 I RAUSR]"" D
37 . D FIND^DIC(200,"",".01","AX",RAUSR,"","","","","RAOUT")
38 . Q:'$D(RAOUT("DILIST","ID",1,.01))
39 . S RAUSR=RAOUT("DILIST","ID",1,.01)
40 ;
41 ; IEN of entry in file 773 - Message Administration file.
42 S RAMSG=$P(^TMP("RARPT-HL7",$J,1),"|",10)
43 ;
44 ; Go File the exception
45 D RAERR
46 ;
47 ; Send mail message
48 D MAIL(SFAC,$G(HL("SAF")),RAERR,RALNGCS,$P(RAPT,"`",2),RADT,RAUSR)
49 ;
50 D EXIT
51 ;
52 Q
53RAERR ; Build array and update Exceptions File.
54 S RAEX(0,RAEXFIL,"+1,",.01)=RADT
55 S RAEX(0,RAEXFIL,"+1,",.02)=SFAC
56 S RAEX(0,RAEXFIL,"+1,",1)=RAERRX
57 S:$G(RAPT)]"" RAEX(0,RAEXFIL,"+1,",.03)=RAPT
58 S:$G(RALNGCS)]"" RAEX(0,RAEXFIL,"+1,",.04)=RALNGCS
59 S:$G(RAUSR)]"" RAEX(0,RAEXFIL,"+1,",.06)=RAUSR
60 S:$G(RAMSG)]"" RAEX(0,RAEXFIL,"+1,",.05)=RAMSG
61 D UPDATE^DIE("E","RAEX(0)","")
62 Q
63 ;
64MAIL(SAN,SAF,RAERR,RACN,RADFN,RADT,RAUSR) ; Send mail message with error text.
65 ;
66 ; INPUT PARAMETERS:
67 ; SAN = HL7 Sending Application (Required)
68 ; SAF = Sending Facility Name
69 ; RAERR = Error Message to display (Required)
70 ; RACN = Radiology Case Number
71 ; RADFN = Rad Patient File (#70) IEN
72 ; RADT = Date & Time of HL7 message (FileMan format)
73 ; RAUSR = Name of Verifying Physician
74 ;
75 N RAERTXT,RAMGP,XMY,XMDUZ,XMSUB,Y
76 ;
77 S RAMGP=$P($$GETAPP^HLCS2(SAN),"^",1) ; Get mail group
78 Q:RAMGP=""
79 ;
80 S RAPT=$P($G(^DPT(+RADFN,0)),"^")
81 S:RAPT="" RAPT="UNKNOWN"
82 ;
83 S RACN=$S($G(RACN)]"":$G(RACN),1:"???")
84 S RAUSR=$S($G(RAUSR)]"":$G(RAUSR),1:"UNKOWN")
85 S Y=RADT D DD^%DT S RADT=$S(Y]"":Y,1:"UNKOWN DATE/TIME")
86 S SAF=$S($G(SAF)]"":$G(SAF),1:SAN)
87 ;
88 S XMDUZ="Rad HL7 Interface Processor"
89 ;
90 S XMSUB="HL7 message from "_SAF_" application rejected."
91 ;
92 S RAERTXT(1)="There was a problem processing an HL7 message sent by "
93 S RAERTXT(2)=SAF_" on "_RADT_"."
94 S RAERTXT(3)=""
95 S RAERTXT(4)="The report entered on Case #"_RACN_" for "_RAPT
96 S RAERTXT(5)="was rejected by Radiology/Nuclear Medicine."
97 S RAERTXT(6)=""
98 S RAERTXT(7)="The reason given was:"
99 S RAERTXT(8)=RAERR
100 S RAERTXT(9)=""
101 S RAERTXT(10)="( This message has been sent to G."_RAMGP
102 S RAERTXT(11)=" and to the verifying physician, "_RAUSR_" )"
103 S XMTEXT="RAERTXT("
104 ;
105 S:$O(^XMB(3.8,"B",RAMGP,0)) XMY("G."_RAMGP)="" ; send to group
106 S:$G(RAUSR)]"" XMY(RAUSR)="" ; send to dictating doctor
107 ;
108 D ^XMD
109 ;
110 Q
111EXIT ; Kill variables and return to bridge routine..
112 K RAEX,RADT,RAERRX,RAPT,SFAC,RAEXFIL,RALNGCS,RAUSR,RAMSG,X,Y
113 Q
Note: See TracBrowser for help on using the repository browser.