使用Mirth将多个NTE段添加到HL7消息 [英] Adding Multiple NTE segments to HL7 message with Mirth

查看:149
本文介绍了使用Mirth将多个NTE段添加到HL7消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Mirth将多个NTE行添加到HL7消息的末尾。我可以使用例如添加一行:

I am trying to add multiple NTE lines to the end of HL7 messages using Mirth. I can add a single line using for example:

tmp=msg;
msg['NTE']['NTE.1']="1".toString();
msg['NTE']['NTE.3']="Performed at 123 Radiology".toString();

但是......

当我想在下面添加一行:

When I want to add a line below that:

msg['NTE']['NTE.1']="2".toString();
msg['NTE']['NTE.3']="123 Radiology Drive STE 100".toString();

我不能只使用tmp = msg,因为它只会覆盖前一行。

I can't just use the tmp=msg because it will simply overwrite the previous line.

最后我试图在消息的末尾添加这样的内容:

In the end I am trying to add something like this to the end of the message:

NTE|1||Test performed at Radiology Imaging
NTE|2||123 Test Road
NTE|3||Chicago, IL 55555

内容是静态的,我只需要了解如何分别创建每一行。

The content is static, I just need to understand how to create each line separately.

推荐答案

我不确定你为什么需要(在这个特定的例子中)将出站模板分配给入站 - 欢乐会这样做无论如何,对你而言。

I'm not sure why you need (in this particular example) to assign outbound template to inbound - Mirth will do that for you anyway.

产生所需结果的代码可能是这样的:

The code to produce the required result may be like this:

var segCount = 0;

createSegment('NTE', msg);
msg['NTE'][segCount]['NTE.1']['NTE.1.1'] = segCount;
msg['NTE'][segCount]['NTE.3']['NTE.3.1'] = "Test performed at Radiology Imaging";

createSegmentAfter('NTE', msg['NTE'][segCount]);
msg['NTE'][++segCount]['NTE.1']['NTE.1.1'] = segCount;
msg['NTE'][segCount]['NTE.3']['NTE.3.1'] = "123 Test Road";

createSegmentAfter('NTE', msg['NTE'][segCount]);
msg['NTE'][++segCount]['NTE.1']['NTE.1.1'] = segCount;
msg['NTE'][segCount]['NTE.3']['NTE.3.1'] = "Chicago, IL 55555";

如果将所需数据作为数组传递,则可以进一步循环并简化此代码。为了清楚起见,我以这种扩展方式离开了它。

If you pass the required data as an array, you may loop and simplify this code even further. I left it in this expanded way for clarity.

这篇关于使用Mirth将多个NTE段添加到HL7消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆