Mirth:用 XML 对象中的内容覆盖 msg 对象

发布于 2024-08-15 06:25:21 字数 1211 浏览 9 评论 0原文

任务是将 XML 对象从 Channel-A 发送到 Channel-B

<MyMessage>
<ID>42</ID>
<hl7v2>
    MSH|^~\&|LAB|....
    PID|1|....
</hl7v2>
</MyMessage>

通道通信的步骤:

  • 在 Channel-B 的源转换器中,提取 HL7v2 内容
  • 用提取的内容覆盖 Channel-B 中当前的 msg 对象
  • 继续其他 Channel-B 源转换器并期望正常引用 msg['PID']['PID.5']

好消息是我可以将 HL7v2“有效负载”提取到变量中。问题或困难在于重置 msg 对象或任何其他对象,以便能够按预期引用 HL7 属性。

当我使用 SerializerFactory.getHL7Serializer 创建新变量时,它会使用标签 进行包装。

channelMap.put('MessageID', msg['ID']); //successful
channelMap.put('v2payload',msg['HL7v2']); //also looks good

var v2Msg = SerializerFactory.getHL7Serializer(false,false,true).toXML(msg['HL7v2']);

channelMap.put('v2Msg', v2Msg );

alt text 链接到全尺寸图像

问题:您对如何覆盖 msg 对象有什么建议吗?

我如何开始引用消息,如下所示:

msg['PID']['PID.5']

当前条件

  • 接收通道的输入类型是 XML,
  • 需要从中提取所有属性XML 对象; ID是稍后在目的地使用的数据库PK。

The task is to send an XML object from Channel-A to Channel-B

<MyMessage>
<ID>42</ID>
<hl7v2>
    MSH|^~\&|LAB|....
    PID|1|....
</hl7v2>
</MyMessage>

The steps of the channel communication:

  • in the Channel-B's source transformer, extract the HL7v2 contents
  • OVERWRITE the current msg object in Channel-B with the extracted contents
  • continue in the other Channel-B source transformers and expecting to reference msg['PID']['PID.5'] as normal.

The good news is that I can extract the HL7v2 'payload' into a variable. The problem or difficulty is resetting the msg object, or any other object to be able to reference the HL7 properties as expected.

When I create a new variable with the SerializerFactory.getHL7Serializer, it wraps with the tags <HL7Message>.

channelMap.put('MessageID', msg['ID']); //successful
channelMap.put('v2payload',msg['HL7v2']); //also looks good

var v2Msg = SerializerFactory.getHL7Serializer(false,false,true).toXML(msg['HL7v2']);

channelMap.put('v2Msg', v2Msg );

alt text link to full size image

Question: Do you have any suggestions on how to overwrite the msg object?

How can I start referencing the msg as such:

msg['PID']['PID.5']

Current Conditions

  • the receiving channel's input type is XML
  • the need is to take extract all the properties from that XML object; ID is a database PK to be used later in the destination.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

究竟谁懂我的在乎 2024-08-22 06:25:21

很抱歉,我原来的答案因我自己的情况的特殊性而陷入困境。我已经重新设计和测试以确保这在您的场景中有效。

发送通道 - 将原始 hl7 包装到 xml 结构中,并转发到名为 ReceiveXML 的通道。我已在源转换器中对此进行了编码,但您应该在适合您的地方对其进行编码。

var wrappedHL7 = <MyMessage><ID>123</ID>
                      <hl7v2>{messageObject.getRawData()}</hl7v2>
                 </MyMessage>;

router.routeMessage("ReceiveXML", wrappedHL7);

接收通道 - 从 xml 中提取 hl7,将其转换为 xml,然后分配回 msg 对象。我已将其编码在源过滤器中 - 因此“返回 true;”

msg = new XML(SerializerFactory.getHL7Serializer(false,false,true).toXML(msg['hl7v2'].toString()));
return true;

I'm sorry my original answer was bogged down with the peculiarities of my own scenario. I have reworked and tested to ensure that this works in your scenario.

Sending Channel - wraps the raw hl7 into your xml structure, and forwards to a channel called ReceiveXML. I have coded this in the Source Transformer, but you should code it where it works for you.

var wrappedHL7 = <MyMessage><ID>123</ID>
                      <hl7v2>{messageObject.getRawData()}</hl7v2>
                 </MyMessage>;

router.routeMessage("ReceiveXML", wrappedHL7);

Receiving Channel - extracts the hl7 from the xml, converts it to xml, and assigns back to the msg object. I have coded this in the source Filter - hence "return true;"

msg = new XML(SerializerFactory.getHL7Serializer(false,false,true).toXML(msg['hl7v2'].toString()));
return true;
ぺ禁宫浮华殁 2024-08-22 06:25:21

您所要做的就是将传入的 xml 消息放入入站模板区域,然后使用消息树将所需的 XML 信息拖放到连接器的 javascript 部分。

All you have to do is put your incoming xml message into the inbound template area in mirth and then use the message tree to drag and drop the info from the XML that you need to the javascript section of the connector.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文