使用 Mirth Connect 将 XML 转换为 HL7 消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5303623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 14:36:35  来源:igfitidea点击:

Convert XML to HL7 messages using Mirth Connect

xmlhl7mirth

提问by jwesonga

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?

我正在使用 Mirth Connect v2.0 并陷入一项任务,即从 XML 到 HL7 v3 的转换。我已经连接到 Ms-Access 数据库(医院系统在 Access 中),我已经设置了通道并将连接器类型设置为目标选项卡中的文件编写器。当我部署通道时,我可以看到日志文件中填充了 XML 格式的记录,现在我被困在如何将 XML 消息转换/转换为 HL7。有什么指点吗?

回答by NullRef

In the channel Summarytab

在频道摘要选项卡中

  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 Sourcetab click Edit Transformeron the left sidebar

  3. In the Edit Transformerwindow on the left select the Message Templatestab.

  4. You can load sample files into the Inboundand Outboundtemplates using the little folder icons.

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

  1. 单击“设置数据类型”并确保源入站设置为 XML,源出站设置为 HL7 v3,目标出站设置为 HL7 v3。

  2. Source选项卡上单击左侧边栏上的Edit Transformer

  3. 在左侧的Edit Transformer窗口中,选择Message Templates选项卡。

  4. 您可以使用小文件夹图标将示例文件加载到入站出站模板中。

  5. 您可以在入站和出站模板之间拖放节点以创建转换。

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

这是非常标准的 Mirth 东西,所以我希望我没有过于简单化。希望这能让你朝着正确的方向前进。

回答by kkrgr8

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

我正在使用示例 xml 数据将 XML 转换为 hl7,您可以使用自己的。您可以将以下代码粘贴到 soure 变压器中:

  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

不要忘记在源出站中创建 HL& 模板

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

sample XML

示例 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>

回答by Jim Garrison

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).

您可能想要使用 XSLT,但所需的实际代码将取决于您的数据库架构以及它如何转换为 XML。解决您的特定转换问题超出了 StackOverflow 问题的指导方针,除非您可以使问题更加具体(即“我做了 X,期待 Y 而得到 Z)”。

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.

似乎有许多产品可以进行这种类型的转换。我在谷歌上搜索了很多“xml to HL7”。我建议你从那里开始。