Announcement

Collapse
No announcement yet.

Process HL7 ACK from multiple destination

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Process HL7 ACK from multiple destination

    I have a channel with 4 destinations. Each destination will filter the message and only one of them will accept the message. On top of this, all 4 destinations replay with AA on a different port. I need to receive the response and pass the same back to the original application can someone guide me on how to achieve this.

    In the response dropdown, I can only select one destination but while processing its not fixed which destination will reply back with ACK and so need to accept ACK from all four destinations.

    This is strictly HL7 based channel and I am using 3.6.1 version of mirth.

  • #2
    The post-processor can be used for this. It can access the responses from all 4 destinations and return the appropriate one for that message. You'll probably have to generate your own ACK if there is an error sending to the destination, which you can also do in the post-processor.

    Comment


    • #3
      Thank you Agermano.

      I have postprocess script with below code but somehow it is not sending ACK back to source. I do have postprocess selected as response.

      The destinations are sending a CA message and I need to convert them to AA message before I pass to the original application. Below code only contains logic for 2 destinations but i have same if the condition for other destinations too.
      Code:
      // Get the response from each destination.
      var string_response1 = responseMap.get('d1').getMessage();
      var response1 = new XML($r('d1').getMessage());
      var string_response2 = responseMap.get('d2').getMessage();
      var response2 = new XML($r('d2').getMessage());
      
      if (responseMap.get('d1').getStatus() == "SUCCESS")
      {
      	var msg = new XML(SerializerFactory.getSerializer('HL7V2').toXML(string_response1));
      	var ackreponse = msg['MSA']['MSA.1']['MSA.1.1'].toString();
      	if  (ackreponse == "CA");
      	{
      		 msg['MSA']['MSA.1']['MSA.1.1'] = 'AA';
      		 return msg;
      	}
      }
      
      if (responseMap.get('d2').getStatus() == "SUCCESS")
      {
      	var msg = new XML(SerializerFactory.getSerializer('HL7V2').toXML(string_response2));
      	var ackreponse = msg['MSA']['MSA.1']['MSA.1.1'].toString();
      	if  (ackreponse == "CA");
      	{
      		 msg['MSA']['MSA.1']['MSA.1.1'] = 'AA';
      		 return msg;
      	}
      }
      
      return msg;
      Last edited by Mits87; 12-12-2018, 02:39 PM.

      Comment


      • #4
        I think it's not working because Response.getStatus() returns a Status, not a string.

        Try this, and see if it helps:

        Code:
        if (responseMap.get('d1').getStatus().equals(Status.SENT))
        Also, you'll need to figure out what to send back if neither of them have a SENT Status. Right now when you return msg at the end it will be undefined.

        You can use the ACKGenerator class from the User API to create a new response from your inbound message. http://javadocs.mirthcorp.com/connec...Generator.html

        Comment


        • #5
          Thanks again Agermano. Actually, I was receiving XML ACK instead HL7 so just had to use below code to convert XML to HL7.
          SerializerFactory.getSerializer('HL7V2').toXML(msg )

          Comment

          Working...
          X