Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDPMHLA

SDPMHLA.m

Go to the documentation of this file.
  1. SDPMHLA ; BPFO/JRC - HL 7 ACKNOWLEDGEMENT HANDLER ; 3/30/04 11:20am
  1. ;;5.3;SCHEDULING;**313**;AUG 13, 1993
  1. ;
  1. ;====================================================================
  1. ;Additional Performance Monitors process acknowledgement routine
  1. ;
  1. ;This routine takes and enhanced mode acknowledgement message
  1. ;from Austin passes it to HL7 and it matches it to the originating
  1. ;message from the information contained in the message ID.
  1. ;
  1. ;Input
  1. ; Acknowledgment message from AAC
  1. ;Output
  1. ; Bulletin to 'SD PM NOTIFICATION TIU' when a rejection message
  1. ; is found
  1. ;====================================================================
  1. ACKR01 ; Receives the ACK messages
  1. ; Input : All variables set by the HL7 package
  1. N SDACK,SDPARAM,HLNODE,I,X
  1. ;Get message text
  1. S ^TMP("SDPRUACK",$H)="START PROCESS"
  1. F I=1:1 X HLNEXT Q:(HLQUIT'>0) D
  1. . S SDMSG(I,1)=HLNODE
  1. . ; Check for segment length greater than 245
  1. . S X=0 F S X=+$O(HLNODE(X)) Q:('X) S SDMSG(I,(X+1))=HLNODE(X)
  1. ;
  1. M ^TMP("SDPRUACK",$H,"HL")=SDMSG
  1. ; Analyze the message and take appropriate response
  1. ; Quit if there is no valid message header
  1. Q:$P(SDMSG(1,1),"^")'="MSH"
  1. ;
  1. S X=1,SDPARAM=""
  1. F S X=+$O(SDMSG(X)) Q:('X) D
  1. . I $P(SDMSG(X,1),"^")="MSA" D
  1. .. D PROCESS(SDMSG(X,1),.SDPARAM)
  1. Q
  1. ;
  1. NOTIFY ; Task sending of response notification
  1. Q:$O(SDPARAM(""))=""
  1. D SENDIT
  1. Q
  1. SENDIT ; Notify mail group that a error message was received
  1. ; Input : MSGARY() - Array containing HL7 Message received
  1. ; Ouput : None
  1. N MSGTXT,XMY,XMTEXT,XMDUZ,XMDT,XMZ,LINE,XMB,XMCHAN,XMSUB
  1. ;
  1. S MSGTEXT(1)=" "
  1. S MSGTEXT(2)="TIU's Performance Indicator National Rollup encountered an error while"
  1. S MSGTEXT(3)="processing HL7 message '"_MSGID_"'. If necessary, use option 'Performance"
  1. S MSGTEXT(4)="Monitor Retransmit Report (AAC)' to retransmit it."
  1. S MSGTEXT(5)=" "
  1. S MSGTEXT(6)="Encounter date range: "_$$FMTE^XLFDT(STADATE,1)_" to "_$$FMTE^XLFDT(ENDDATE,1)
  1. S MSGTEXT(7)=" "
  1. S MSGTEXT(8)="Please contact Austin Automation Center's help desk."
  1. S XMSUB="SD ENC PERF MON Error Message"
  1. S XMTEXT="MSGTEXT("
  1. S XMY("G.SD PM NOTIFICATION TIU")=""
  1. S XMCHAN=1
  1. S XMDUZ="Performance Indicator"
  1. ;S XMB="SDPM REJECT"
  1. S XMDT=DT
  1. D ^XMD
  1. Q
  1. ;
  1. PROCESS(SDMSG,SDPARAM) ;Process incoming acknowledgment
  1. ;
  1. N ACK,MSGID,PMSG,MNODE,STADATE,ENDDATE
  1. ;
  1. Q:$G(SDMSG)']""
  1. ;
  1. S ACK=$P(SDMSG,HL("FS"),2) ; Get acknowledgment code
  1. ; If the acknowledgementcode is AA, then do not send notification
  1. Q:ACK="AA"
  1. ; Get outgoing message ID
  1. S MSGID=$P(SDMSG,HL("FS"),3)
  1. S MSGID=$E(MSGID,4,$L(MSGID))
  1. ; Set rejection message for SDPM acknowledgement message
  1. S:'(ACK="AA") SDPARAM(4)=$S(ACK="AE":"Application Error",ACK="AR":"Application Reject",1:"Unknown Error")
  1. ; Retrieve HL7 parent message ID
  1. S PMSG=$P($G(^HL(772,MSGID,0)),HL("FS"),8) ;IA # 4069
  1. ; Retrieve HL7 message 'OBR' node
  1. S MNODE=^HL(772,MSGID,"IN",1,0) ;IA # 4069
  1. ; Retrieve date range
  1. S RANGE=$P($G(^HL(772,MSGID,"IN",1,0)),HL("FS"),28) ;IA # 4069
  1. S STADATE=$P($G(RANGE),"~",4),ENDDATE=$P($G(RANGE),"~",5)
  1. ; Convert date from HL7 to FM format
  1. S STADATE=$$HL7TFM^XLFDT(STADATE),ENDDATE=$$HL7TFM^XLFDT(ENDDATE)
  1. D NOTIFY
  1. Q