Adding Multiple NTE segments to HL7 message with Mirth

北城余情 提交于 2019-12-06 03:55:47

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!