简体   繁体   English

使用Mirth将多个NTE段添加到HL7消息

[英]Adding Multiple NTE segments to HL7 message with Mirth

I am trying to add multiple NTE lines to the end of HL7 messages using Mirth. 我正在尝试使用Mirth将多个NTE行添加到HL7消息的末尾。 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();

But... 但...

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();

I can't just use the tmp=msg because it will simply overwrite the previous line. 我不能只使用tmp = msg,因为它只会覆盖前一行。

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. 我不确定你为什么需要(在这个特定的例子中)将出站模板分配给入站 - 无论如何,Mirth会为你做这件事。

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. 为了清楚起见,我以这种扩展方式离开了它。

You can simply do something like... 你可以简单地做一些像......

var segmentCount = 0;
var nteSegment = createSegment('NTE', msg, segmentCount++);
nteSegment[NTE.1][NTE.1.1] = "1";
nteSegment[NTE.3][NTE.3.1] = "Performed at 123 Radiology".toString();

var nteSegment2 = createSegment('NTE', msg, segmentCount++);
nteSegment2[NTE.1][NTE.1.1] = "2";
nteSegment2[NTE.3][NTE.3.1] = "123 Radiology Drive STE 100".toString();

Or you can create loop and add content from list. 或者您可以创建循环并从列表中添加内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM