Pergunta

I'm working with Mirth Connect v2.0 and getting stuck on one task, transformation of XML to HL7 v3. I've connected to an Ms-Access Database (the hospital system is in Access), I've set up the channel and set the Connector Type to File Writer in the destination tab. When I deploy the channel I can see the log file is populated with the records in XML format, now I'm stuck on how to convert/transform the XML message to HL7. Any pointers out there?

Foi útil?

Solução

In the channel Summary tab

  1. Click "Set Data Types" and make sure the Source inbound is set to XML and the Source outbound is set to HL7 v3 and the destination outbound is set to HL7 v3.

  2. On the Source tab click Edit Transformer on the left sidebar

  3. In the Edit Transformer window on the left select the Message Templates tab.

  4. You can load sample files into the Inbound and Outbound templates using the little folder icons.

  5. You can drag and drop nodes between the inbound and the outbound templates to create your transform.

This is pretty standard Mirth stuff so I hope I haven't oversimplified. Hope this gets you moving in the right direction.

Outras dicas

I am converting XML into hl7 using sample xml data, you can use your own. You can paste the below code in soure transformer:

  var length = msg['orderList']['order'].length();
   var rcount = 0;
   for(var i=0;i<length;i++)
   {
    var SEG = new XML("<OBR/>");
    SEG['OBR.1']['OBR.1.1']=i+1;
    SEG['OBR.16']['OBR.16.1']=msg['orderList']['order'][i]['provider'].toString();
    tmp['OBR'][i]=SEG;
    var reslen = msg['orderList']['order'][i]['result'].length();
    logger.info(reslen);
    for(var j=0;j<reslen;j++)
    {
        var RSEG = new XML("<OBX/>");
        RSEG['OBX.1']['OBX.1.1'] = rcount;
        RSEG['OBX.3']['OBX.3.1'] = msg['orderList']['order'][i]['result'][j]['resultcode'].toString();
        RSEG['OBX.3']['OBX.3.2']=msg['orderList']['order'][i]['result'][j]['text'].toString();
        RSEG['OBX.7'] = msg['orderList']['order'][i]['result'][j]['range'].toString();
        RSEG['OBX.6']['OBX.6.2'] = msg['orderList']['order'][i]['result'][j]['unit'].toString();
        tmp['OBX'][rcount]=RSEG;
        rcount++;
    }
}
logger.info(**SerializerFactory.getSerializer('HL7V2').fromXML(tmp)**);

Dont forgot to create a HL& template in source outbound

**MSH|^~\&|||||||||
PID|||||||||||||||||||||||||||
ORC|||||||||||||||||||**

sample XML

<PatientOrder>
<patient>
<name><fullname>XXXXXXXXXXX, XXXX.</fullname><firstname>XXXXX</firstname><lastname>XXXXX</lastname></name>
<address>
<address1>XXXXXX XXXX XXXX Med XXXX</address1><address2>Information XXXXX Fl</address2><address3>XXXX XXXX St  </address3><address4>XXXXXX XXXXXX, XX XXXXX</address4><telephone>XXX/XXXX-XXXX</telephone><fax>XXX/XXX-XXX</fax><latitude>X2.XXXXX</latitude><longitude>-X1.XXXXX</longitude></address>
</patient>
<orderList>
 <order>
    <provider>57423</provider>
    <result>result
            <resultcode>7685-1</resultcode>
            <text>Hemoglobin test2</text>
            <resultdate></resultdate>
            <range>3to52</range>
            <unit>mg</unit>
        </result>
        <result>result
            <resultcode>7685-1</resultcode>
            <text>Hemoglobin test2</text>
            <resultdate></resultdate>
            <range>3to52</range>
            <unit>mg</unit>
        </result>
    </order>
<order>
    <provider>57423</provider>
    <result>result
            <resultcode>7685-1</resultcode>
            <text>Hemoglobin test2</text>
            <resultdate></resultdate>
            <range>3to52</range>
            <unit>mg</unit>
        </result>
    </order>
</orderList>
</PatientOrder>

You probably want to use XSLT, but the actual code required will depend on your database schema and how it's converted to XML. Solving YOUR specific conversion problem is beyond the guidelines for StackOverflow questions unless you can make the question MUCH more specific (i.e. "I did X, expecting Y and got Z instead).

There appear to be many products that will do this type of conversion. I found a lot of hits Googling for "xml to HL7". I suggest you start there.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top