Mirth:用 XML 对象中的内容覆盖 msg 对象
任务是将 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 );
问题:您对如何覆盖 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 );
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很抱歉,我原来的答案因我自己的情况的特殊性而陷入困境。我已经重新设计和测试以确保这在您的场景中有效。
发送通道 - 将原始 hl7 包装到 xml 结构中,并转发到名为 ReceiveXML 的通道。我已在源转换器中对此进行了编码,但您应该在适合您的地方对其进行编码。
接收通道 - 从 xml 中提取 hl7,将其转换为 xml,然后分配回 msg 对象。我已将其编码在源过滤器中 - 因此“返回 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.
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;"
您所要做的就是将传入的 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.