Announcement

Collapse
No announcement yet.

Break HL7 msg into several messages

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

  • Break HL7 msg into several messages

    Need guidance on how to break an ORM message with several OBR|OBX|NTE's into separate messages for each OBR|OBX|NTE combo.
    Each message will only have 1 each OBR|OBX|NTE combo


    Original message:

    MSH|^~\&|EMR^1ST FLOOR||PMD|TEST FACILITY - UTAH|20180510||ORM^O01|11867-6071-41|P|2.3.1
    PID||16|||TEST09^JAX||20020101|M|||1002 NO WHERE ST^^SANDY^UT^84070||^^555^5550001||||||555550003|
    NTE|1|DISPATCH NOTES||||||||||
    ORC|NW|36||36||||||||1568438653^LALLY^THOMAS^^^^^^ ^^^^NPI||^^^^303^3799371|||||||||2|^^WHEAT RIDGE^CO^80033
    OBR|1|36|788f6cd3-9c4d-4657-b2e5-37ca743cf101|74018^ABDOMEN^HCPC^1^PAIN LOCALIZED TO UPPER ABDOMEN|ASAP|20180510|
    OBX|1|ST|R10.1^PATIENT COMPLAINT^ICD10||PAIN LOCALIZED TO UPPER ABDOMEN||||||R|
    NTE|1|Something here||
    OBR|2|36|c0799337-0f8c-4304-a4b6-36e8e9a06bd7|71046^CHEST 2 VIEWS^HCPC^1^CHEST PAIN ON BREATHING|ASAP|20180510|
    OBX|1|ST|R07.1^PATIENT COMPLAINT^ICD10||CHEST PAIN ON BREATHING||||||R|
    NTE|1|Something here||

    First new msg with the first OBR|OBX|NTE combo copying MSH|PID|NTE|ORC

    MSH|^~\&|EMR^1ST FLOOR^1ST FLOOR||PMD|TEST FACILITY - UTAH|20180510||ORM^O01|11867-6071-41|P|2.3.1
    PID||16|||TEST09^JAX||20020101|M|||1002 NO WHERE ST^^SANDY^UT^84070||^^555^5550001||||||555550003|
    NTE|1|DISPATCH NOTES||||||||||
    ORC|NW|36||36||||||||1568438653^LALLY^THOMAS^^^^^^ ^^^^NPI||^^^^303^3799371|||||||||2|^^WHEAT RIDGE^CO^80033
    OBR|1|36|788f6cd3-9c4d-4657-b2e5-37ca743cf101|74018^ABDOMEN^HCPC^1^PAIN LOCALIZED TO UPPER ABDOMEN|ASAP|20180510|
    OBX|1|ST|R10.1^PATIENT COMPLAINT^ICD10||PAIN LOCALIZED TO UPPER ABDOMEN||||||R|
    NTE|1|Something here||



    2nd new msg with the 2nd OBR|OBX|NTE combo copying MSH|PID|NTE|ORC

    MSH|^~\&|EMR^1ST FLOOR^1ST FLOOR||PMD|TEST FACILITY - UTAH|20180510||ORM^O01|11867-6071-41|P|2.3.1
    PID||16|||TEST09^JAX||20020101|M|||1002 NO WHERE ST^^SANDY^UT^84070||^^555^5550001||||||555550003|
    NTE|1|DISPATCH NOTES||||||||||
    ORC|NW|36||36||||||||1568438653^LALLY^THOMAS^^^^^^ ^^^^NPI||^^^^303^3799371|||||||||2|^^WHEAT RIDGE^CO^80033
    OBR|2|36|c0799337-0f8c-4304-a4b6-36e8e9a06bd7|71046^CHEST 2 VIEWS^HCPC^1^CHEST PAIN ON BREATHING|ASAP|20180510|
    OBX|1|ST|R07.1^PATIENT COMPLAINT^ICD10||CHEST PAIN ON BREATHING||||||R|
    NTE|1|Something here||

  • #2
    Hello,


    giving your HL7 example, i develop a JavaScript code in the Transformer in order to split and build up again the HL7 message. It can be done in another way and this is just a "quick fix"
    Create a new channel that receives HL7 with name "HL7Receiver" and on the channel that receives the full HL7 to split, put this code on the Transformer:


    Code:
    var arrOBR=[];
    var arrOBX=[];
    var arrNTE=[];
    
    var xml;
    
    for each (var seg in msg.children())
    {
        if(seg.name() == "OBR")
            arrOBR.push(seg);
    
        if(seg.name() == "OBX")
            arrOBX.push(seg);
    
        if(seg.name() == "NTE")
            arrNTE.push(seg);
    }
    
    for each(var i=0; i<arrOBR.length; i++)
    {
        xml=new XML();
        
        xml="<HL7Message>" + 
                msg['MSH'].toString() + "\r\n" +
                msg['PID'].toString() + "\r\n" +
                msg['NTE'][0].toString() + "\r\n" +
                msg['ORC'].toString() + "\r\n" +
                arrOBR[i].toString() + "\r\n" +
                arrOBX[i].toString() + "\r\n" +
                arrNTE[i].toString() + 
            "</HL7Message>";
    
        tmp=xml;
        router.routeMessage('HL7Receiver', SerializerFactory.getSerializer('HL7V2').fromXML(tmp));
    }
    Note: in this code i assume that the same amount of OBR - OBX - NTE is the same. I'm not handling exceptions.
    And the Transformer Outbound message type should be XML Type.
    Last edited by AlexNeiva; 05-23-2018, 05:44 AM.
    Best Regards,
    Alex Neiva

    Comment


    • #3
      Thank you!!

      This worked perfectly! I had to take out the .toString() but it works perfectly!
      Thank you so much.

      Comment

      Working...
      X