Announcement

Collapse
No announcement yet.

Modify Response From Receiving System

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

  • Modify Response From Receiving System

    Hello, new to MIrth (2 Days).
    Building a Query response connector.
    How do I pull the value from PID.3.1 to another segment (See RED code ine below)?


    This is the ACK from the EMR - NO PHI TEST Patient
    MSH|^~\&|||||20191104140617||ADR^A19|99|T|2.3||||| |||||
    MSA|AA|1182112391-00000001|
    QRD|20171018|R|I|20171018161533|||1|1160005^^^^^^^ ^^^^COV|DEM
    PID|1||1160005^^^COV^COV||ZZZCLIN DOC^GILBERT||19560402|M|||00000 WEST ELM^^SAGINAW^MI^48603^US^^^SAGINAW|SAGINAW|(989)99 9-9999^^7||||||000-00-0000|||||N||||||N|
    PV1|1




    Mirth Connect Server 3.8.1




    // This script executes once after a message has been processed
    // Responses returned from here will be stored as "Postprocessor" in the response map
    new ACKGenerator();
    var serializer = SerializerFactory.getSerializer('HL7V2');
    var ack = new XML(serializer.toXML(ACKGenerator().generateAckRes ponse(message.getConnectorMessages().get(0).getRaw Data(),'AA','')));
    ack.MSH['MSH.9']['MSH.9.1'] = "QBP";
    ack.MSH['MSH.9']['MSH.9.2'] = "Q22";
    ack.MSH['MSH.9']['MSH.9.3'] = "QBP_Q21";
    ack.MSH['MSH.12']['MSH.12.1'] = "2.5";
    //Build QAK - GE VC150
    ack.QAK['QAK.1']['QAK.1.1'] = "EPIC721 Query";
    ack.QAK['QAK.2']['QAK.2.1'] = "OK";
    ack.QAK['QAK.4']['QAK.4.1'] = "1";
    ack.QAK['QAK.5']['QAK.5.1'] = "1";
    ack.QAK['QAK.6']['QAK.6.1'] = "0";
    //Build QPD - GE VC150
    ack.QPD['QPD.1']['QPD.1.1'] = "EPIC PDQ Query";
    ack.QPD['QPD.2']['QPD.2.1'] = "EPIC721 Query";
    ack.QPD['QPD.3']['QPD.3.1'] = "@PID.3.1";
    //Can't Get This Line to Work
    ack.QPD['QPD.3']['QPD.3.2'] = ack.PID['PID.3']['PID.3.1'];

  • #2
    Figured it out

    In the Destination Response Transformer

    Code:
    tmp['MSH']['MSH.3']['MSH.3.1'] = msg['MSH']['MSH.3']['MSH.3.1'].toString();
    tmp['MSH']['MSH.4']['MSH.4.1'] = msg['MSH']['MSH.4']['MSH.4.1'].toString();
    tmp['MSH']['MSH.5']['MSH.5.1'] = msg['MSH']['MSH.5']['MSH.5.1'].toString();
    tmp['MSH']['MSH.6']['MSH.6.1'] = msg['MSH']['MSH.6']['MSH.6.1'].toString();
    tmp['MSH']['MSH.7']['MSH.7.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString();
    tmp['MSH']['MSH.8']['MSH.8.1'] = msg['MSH']['MSH.8']['MSH.8.1'].toString();
    tmp['MSH']['MSH.9']['MSH.9.1'] = "RSP";
    tmp['MSH']['MSH.9']['MSH.9.2'] = "K22";
    tmp['MSH']['MSH.9']['MSH.9.3'] = "RSP_K22";
    tmp['MSH']['MSH.10']['MSH.10.1'] = msg['MSH']['MSH.10']['MSH.10.1'].toString(); 
    tmp['MSH']['MSH.11']['MSH.11.1'] = msg['MSH']['MSH.11']['MSH.11.1'].toString();
    tmp['MSH']['MSH.12']['MSH.12.1'] = msg['MSH']['MSH.12']['MSH.12.1'].toString();
    //Map EPIC722 ACK MSA
    tmp['MSA']['MSA.1']['MSA.1.1'] = msg['MSA']['MSA.1']['MSA.1.1'].toString();
    tmp['MSA']['MSA.2']['MSA.2.1'] = msg['MSA']['MSA.2']['MSA.2.1'].toString();
    //Map EPIC722 ACK QAK
    tmp['QAK']['QAK.1']['QAK.1.1'] = "MPIQUERY";
    
    if (msg['MSA']['MSA.3']['MSA.3.1'].toString() == 'NO PATIENT FOUND'){
    	tmp['QAK']['QAK.2']['QAK.2.1'] = msg['MSA']['MSA.3']['MSA.3.1'].toString();
    	tmp['QAK']['QAK.4']['QAK.4.1'] = "0";
    	tmp['QAK']['QAK.5']['QAK.5.1'] = "0";
    	tmp['QAK']['QAK.6']['QAK.6.1'] = "0";
    } else { 
    	tmp['QAK']['QAK.2']['QAK.2.1'] = "OK";
    	tmp['QAK']['QAK.4']['QAK.4.1'] = msg['QRD']['QRD.7']['QRD.7.1'].toString();
    	tmp['QAK']['QAK.5']['QAK.5.1'] = msg['QRD']['QRD.7']['QRD.7.1'].toString();
    	tmp['QAK']['QAK.6']['QAK.6.1'] = "0";
    }
    
    		
    //tmp['QAK']['QAK.3']['QAK.3.1'] = ;
    //tmp['QAK']['QAK.4']['QAK.4.1'] = ;
    //tmp['QAK']['QAK.5']['QAK.5.1'] = ;
    //tmp['QAK']['QAK.6']['QAK.6.1'] = ;
    //Map EPIC722 ACK QPD
    tmp['QPD']['QPD.1']['QPD.1.1'] = "EPIC722 MPI DEM QUERY";
    tmp['QPD']['QPD.2']['QPD.2.1'] = msg['QRD']['QRD.4']['QRD.4.1'].toString();
    tmp['QPD']['QPD.3']['QPD.3.1'] = "@PID.3.1";
    tmp['QPD']['QPD.3']['QPD.3.2'] = msg['PID']['PID.3']['PID.3.1'].toString();
    //Map EPIC722 ACK PID
    tmp['PID']['PID.1']['PID.1.1'] = msg['PID']['PID.1']['PID.1.1'].toString();
    tmp['PID']['PID.2']['PID.2.1'] = msg['PID']['PID.2']['PID.2.1'].toString();
    tmp['PID']['PID.3']['PID.3.1'] = msg['PID']['PID.3']['PID.3.1'].toString();
    //tmp['PID']['PID.4']['PID.4.1'] = ;
    tmp['PID']['PID.5']['PID.5.1'] = msg['PID']['PID.5']['PID.5.1'].toString();
    tmp['PID']['PID.5']['PID.5.2'] = msg['PID']['PID.5']['PID.5.2'].toString();
    //tmp['PID']['PID.6']['PID.6.1'] = ;
    tmp['PID']['PID.7']['PID.7.1'] = msg['PID']['PID.7']['PID.7.1'].toString();
    tmp['PID']['PID.8']['PID.8.1'] = msg['PID']['PID.8']['PID.8.1'].toString();
    //Map EPIC722 ACK PV1
    tmp['PV1']['PV1.1']['PV1.1.1'] = msg['PV1']['PV1.1']['PV1.1.1'].toString();
    tmp['PV1']['PV1.2']['PV1.2.1'] = msg['PV1']['PV1.2']['PV1.2.1'].toString();
    tmp['PV1']['PV1.3']['PV1.3.2'] = msg['PV1']['PV1.3']['PV1.3.2'].toString();
    tmp['PV1']['PV1.3']['PV1.3.3'] = msg['PV1']['PV1.3']['PV1.3.3'].toString();
    tmp['PV1']['PV1.3']['PV1.3.4'] = msg['PV1']['PV1.3']['PV1.3.4'].toString();
    tmp['PV1']['PV1.19']['PV1.19.1'] = msg['PV1']['PV1.19']['PV1.19.1'].toString();

    Comment


    • #3
      Welcome to Mirth!

      Unless you are intentionally excluding fields, you can remove your outbound template entirely and then msg will pass through. You can make in place changes to msg rather than needing to map each field to tmp.

      If there are fields you are intentionally excluding from certain segments, you still may be able to shorten your code a bit by doing something like

      Code:
      tmp['MSH'] = msg['MSH'].copy();
      tmp['MSH']['MSH.9']['MSH.9.1'] = "RSP";
      tmp['MSH']['MSH.9']['MSH.9.2'] = "K22";
      tmp['MSH']['MSH.9']['MSH.9.3'] = "RSP_K22";

      Comment

      Working...
      X