Announcement

Collapse
No announcement yet.

Not another post asking for ordering fields...

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

  • Not another post asking for ordering fields...

    Hi,
    I have to order fields in a message.
    Problem is that I have 12 steps to create my outgoing message.
    One of them is the hated "tmp=msg".
    My outgoing message looks like:

    MSH
    PID
    OBR
    OBX (UP TO 17)
    ORC
    TQ1
    SPM

    And should be like
    MSH
    PID
    ORC
    OBR
    OBX (UP TO 17)
    TQ1
    SPM

    I cant use outgoing template, and some of the solutions found in the forum simply dont work.

    Can you please help?
    mirth is 3.3.1

    Thanks in advance

  • #2
    Woah! easy there buddy!

    so why can't you use outbound template? Is it by choice?

    If you cannot and still want to send an HL7 message built, do it alternatively, by building an xml, and then Serializing the xml into an HL7v2 message.
    Something like shown in this thread
    http://www.mirthcorp.com/community/f...ltiple+message

    But I would still suggest using an outbound template. Use this message in the outbound template, I am sure it will work

    MSH|^~\&||||||||||||||||||||||||||||||
    PID|||||||||||||||||||||||||||||||
    ORC||||||||||||||||||||||||||||||
    OBR||||||||||||||||||||||||||||||
    OBX|1||||||||||||||||||||||||||||
    TQ1|||||||||||
    SPM||||||||||


    For the OBX you would need to go through a loop to map against the 17 OBX coming in inbound.

    Code:
    noOfOBX=msg['OBX'].length() //17
    
    while(i<noOfOBX) 
    {
    tmp['OBX'][i]['OBX.1']['OBX.1.1']=msg['OBX'][i]['OBX.1']['OBX.1.1'];
    .
    .
    .
    
    and so on
    }
    HL7v2.7 Certified Control Specialist!

    Comment


    • #3
      Sorry, it does not work (using templates)

      It should be because of many of the transformations I have done.
      Mostly, because of my incoming message is in that secuence:
      msh
      pid
      obr
      obx
      nte
      ...
      and I've got this tmp=msg.

      I have read the post you suggested but does not help in my case.

      Any suggestion? Maybe connecting the preprocessor to order the segments?
      thanks.

      Comment


      • #4
        Please share your channel and we can understand ur situation.

        Comment


        • #5
          Originally posted by obsessio View Post
          Please share your channel and we can understand ur situation.
          Thanks, instead of it I'll post a incoming message.
          Outcome should be equal but ORC segment in his place

          MSH|^~\&|MYSYSTEM|350311|ESBHUGCDN|350311|20160602 124155||ORU^R01^ORU_R01|461|P|2.5|||AL|NE|ESP|8859/1PID|1||324945^^^HIS&&ISO^^PI^^^^350311&&99CENTROS _SCS~|324945|APE^JUAN JOSE|APE2|19540126|MOBR|1||1191^MYSYSTEM|24338-6^Panel gases^LN|||||||O||||Arterial^||||||||||COBX|1|NM|1 9996-8^Oxygen/​Inspired gas Respiratory system --on ventilator^LN||21.0|%|||||F|||^||||DEVICE^DEPARTAM ENTO-090R0568N0006OBX|2|NM|6298-4^Potassium [Moles/volume] in Blood^LN||4.1|mmol/L|3,5-5,5|N|||F|||^||||DEVICE^DEPARTAMENTO-090R0568N0006OBX|3|NM|2947-0^Sodium [Moles/volume] in Blood^LN||140|mmol/L|135-145|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|4|NM|2069-3^Chloride [Moles/volume] in Blood^LN||102|mmol/L|98-105|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|5|NM|55782-7^Hemoglobin [Mass/volume] in Blood by Oximetry^LN||14.9|g/dL|13-16,4|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|6|NM|11558-4^pH of Blood ^LN||7.450||7,350-7,450|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|7|NM|33254-4^pH of Arterial blood adjusted to patients actual temperature^LN||7.450|||N|||F|||||||DEVICE^DEPARTA MENTO-090R0568N0006|^OBX|8|NM|11557-6^Carbon dioxide [Partial pressure] in Blood^LN||41.2|mmHg|35-45|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|9|NM|34705-4^Carbon dioxide [Partial pressure] adjusted to patients actual temperature in Blood^LN||41.2|mmHg|35-45|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|10|NM|72721-4^Base excess.100% oxygenated [Moles/volume] standard in Arterial blood by calculation^LN||4.6|mmol/L||H|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|11|NM|1963-8^Bicarbonate [Moles/volume] in Serum] standard in Arterial blood by calculation^LN||28.0|mmol/L||H|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|12|NM|47596-2^Calcium.ionized [Moles/volume] in Blood by Ion-selective membrane electrode (ISE)^LN||1.22|mmol/L|1,15-1,29|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|13|NM|11556-8^Oxygen [Partial pressure] in Blood^LN||19.1|Vol%||N|||F|||||||DEVICE^DEPARTAMEN TO-090R0568N0006|^OBX|14|NM|2339-0^Glucose [Mass/volume] in Blood^LN||6.6|mmol/L|98-105|H|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|15|NM|42719-5^Bilirubin.total [Mass/volume] in Blood^LN||0|micromol/L||N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|16|NM|59032-3^Lactate [Mass/volume] in Blood^LN||1.4|mmol/L|0,5-2|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|17|NM|39533-5^Deoxyhemoglobin [Mass/volume] in Blood^LN||7.2|%||H|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|18|NM|11559-2^Fractional oxyhemoglobin in Blood^LN||91.4|%|94-98|L|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|19|NM|20564-1^Oxygen saturation in Blood^LN||92.7|%|95-99|L|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|20|NM|31157-1^Carboxyhemoglobin [Mass/volume] in Blood^LN||1.0|%|0-1|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|21|NM|2613-8^Methemoglobin [Presence] in Blood^LN||0.4|%|0-1,5|N|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|22|NM|11556-8^Oxygen [Partial pressure] in Blood^LN||60.8|mmHg|75-100|L|||F|||||||DEVICE^DEPARTAMENTO-090R0568N0006|^OBX|23|NM|19254-2^Oxygen [Partial pressure] adjusted to patients actual temperature in Blood^LN||60.8|mmHg||N|||F|||||||DEVICE^DEPARTAMEN TO-090R0568N0006|^OBX|24|NM|19996-8^Oxygen/Inspired gas^on ventilator^LN||24.12|mmHg||N|||F|||||||DEVICE^DEPA RTAMENTO-090R0568N0006|^OBX|25|NM|60834-9^Blood temperature^LN||37.0|Cel|||||F|||||||DEVICE^DEPART AMENTO-090R0568N0006|^ORC|SC||1191^MYSYSTEM|||||||||||||| ||||HOSPITAL^^^^^^FI^^^350311TQ1||||||||2016060212 4155|RSPM||||122552005^Muestra de sangre arterial^SCT

          Comment


          • #6
            Hi guys, solved!!!!

            as simple as:
            PHP Code:
            tmp['MSH']=msg['MSH'];
            tmp['PID']=msg['PID'];
            tmp['ORC']=msg['ORC'];
            tmp['OBR']=msg['OBR'];
            tmp['TQ1']=msg['TQ1'];
            var 
            len=msg['OBX'].length();
            for(
            i=0;i<len;i++)
                {
                    
            tmp['OBX'][i]=msg['OBX'][i];
                }

            tmp['SPM']=msg['SPM']; 

            Comment

            Working...
            X