source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SDPMHLA.m@ 636

Last change on this file since 636 was 628, checked in by George Lilly, 14 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1SDPMHLA ; BPFO/JRC - HL 7 ACKNOWLEDGEMENT HANDLER ; 3/30/04 11:20am
2 ;;5.3;SCHEDULING;**313**;AUG 13, 1993
3 ;
4 ;====================================================================
5 ;Additional Performance Monitors process acknowledgement routine
6 ;
7 ;This routine takes and enhanced mode acknowledgement message
8 ;from Austin passes it to HL7 and it matches it to the originating
9 ;message from the information contained in the message ID.
10 ;
11 ;Input
12 ; Acknowledgment message from AAC
13 ;Output
14 ; Bulletin to 'SD PM NOTIFICATION TIU' when a rejection message
15 ; is found
16 ;====================================================================
17ACKR01 ; Receives the ACK messages
18 ; Input : All variables set by the HL7 package
19 N SDACK,SDPARAM,HLNODE,I,X
20 ;Get message text
21 S ^TMP("SDPRUACK",$H)="START PROCESS"
22 F I=1:1 X HLNEXT Q:(HLQUIT'>0) D
23 . S SDMSG(I,1)=HLNODE
24 . ; Check for segment length greater than 245
25 . S X=0 F S X=+$O(HLNODE(X)) Q:('X) S SDMSG(I,(X+1))=HLNODE(X)
26 ;
27 M ^TMP("SDPRUACK",$H,"HL")=SDMSG
28 ; Analyze the message and take appropriate response
29 ; Quit if there is no valid message header
30 Q:$P(SDMSG(1,1),"^")'="MSH"
31 ;
32 S X=1,SDPARAM=""
33 F S X=+$O(SDMSG(X)) Q:('X) D
34 . I $P(SDMSG(X,1),"^")="MSA" D
35 .. D PROCESS(SDMSG(X,1),.SDPARAM)
36 Q
37 ;
38NOTIFY ; Task sending of response notification
39 Q:$O(SDPARAM(""))=""
40 D SENDIT
41 Q
42SENDIT ; Notify mail group that a error message was received
43 ; Input : MSGARY() - Array containing HL7 Message received
44 ; Ouput : None
45 N MSGTXT,XMY,XMTEXT,XMDUZ,XMDT,XMZ,LINE,XMB,XMCHAN,XMSUB
46 ;
47 S MSGTEXT(1)=" "
48 S MSGTEXT(2)="TIU's Performance Indicator National Rollup encountered an error while"
49 S MSGTEXT(3)="processing HL7 message '"_MSGID_"'. If necessary, use option 'Performance"
50 S MSGTEXT(4)="Monitor Retransmit Report (AAC)' to retransmit it."
51 S MSGTEXT(5)=" "
52 S MSGTEXT(6)="Encounter date range: "_$$FMTE^XLFDT(STADATE,1)_" to "_$$FMTE^XLFDT(ENDDATE,1)
53 S MSGTEXT(7)=" "
54 S MSGTEXT(8)="Please contact Austin Automation Center's help desk."
55 S XMSUB="SD ENC PERF MON Error Message"
56 S XMTEXT="MSGTEXT("
57 S XMY("G.SD PM NOTIFICATION TIU")=""
58 S XMCHAN=1
59 S XMDUZ="Performance Indicator"
60 ;S XMB="SDPM REJECT"
61 S XMDT=DT
62 D ^XMD
63 Q
64 ;
65PROCESS(SDMSG,SDPARAM) ;Process incoming acknowledgment
66 ;
67 N ACK,MSGID,PMSG,MNODE,STADATE,ENDDATE
68 ;
69 Q:$G(SDMSG)']""
70 ;
71 S ACK=$P(SDMSG,HL("FS"),2) ; Get acknowledgment code
72 ; If the acknowledgementcode is AA, then do not send notification
73 Q:ACK="AA"
74 ; Get outgoing message ID
75 S MSGID=$P(SDMSG,HL("FS"),3)
76 S MSGID=$E(MSGID,4,$L(MSGID))
77 ; Set rejection message for SDPM acknowledgement message
78 S:'(ACK="AA") SDPARAM(4)=$S(ACK="AE":"Application Error",ACK="AR":"Application Reject",1:"Unknown Error")
79 ; Retrieve HL7 parent message ID
80 S PMSG=$P($G(^HL(772,MSGID,0)),HL("FS"),8) ;IA # 4069
81 ; Retrieve HL7 message 'OBR' node
82 S MNODE=^HL(772,MSGID,"IN",1,0) ;IA # 4069
83 ; Retrieve date range
84 S RANGE=$P($G(^HL(772,MSGID,"IN",1,0)),HL("FS"),28) ;IA # 4069
85 S STADATE=$P($G(RANGE),"~",4),ENDDATE=$P($G(RANGE),"~",5)
86 ; Convert date from HL7 to FM format
87 S STADATE=$$HL7TFM^XLFDT(STADATE),ENDDATE=$$HL7TFM^XLFDT(ENDDATE)
88 D NOTIFY
89 Q
Note: See TracBrowser for help on using the repository browser.