[英]HL7 with Mirth: How to avoid Segments with double sequence numbers?
Using the Mirth Connect Interoperability server I'm trying to construct a message in HL7 . 我正在使用Mirth Connect互操作性服务器在HL7中构造一条消息。 I'm trying to add a number of custom OBX segments to the message, but Mirth is giving me a hard time.
我正在尝试向消息中添加许多自定义OBX段 ,但是Mirth给了我很大的麻烦。
In my template I've got a line saying this: 在我的模板中,有一行这样说:
OBX|1|ED|CODE^NAME^COMPANY||^application^pdf^Base64^VeryLongBase64String||||||F
and in a custom script I also want to add some more info manually: 在自定义脚本中,我还想手动添加更多信息:
createSegment('OBX', tmp, 1);
tmp['OBX'][1]['OBX.1']['OBX.1.1'] = 1;
tmp['OBX'][1]['OBX.2']['OBX.2.1'] = "ST";
createSegment('OBX', tmp, 2);
tmp['OBX'][2]['OBX.1']['OBX.1.1'] = 2;
tmp['OBX'][2]['OBX.2']['OBX.2.1'] = "ST";
This creates the following message: 这将创建以下消息:
MSH|^~\&|COMPANY|COMPANY|||20161011120822||ORU^R01|0000029|1|2.4|||AL|NE
PID|1||9999999^^^LOCAL^PI||||19861020|F|
STUFF^L|||20161011120822|20161011120822|
OBX|1|ED|Q001^121^THECOMPANY||^application^pdf^Base64^VeryLongBase64String||||||F
OBX|1|ST
OBX|2|ST
But as you can see I've got two lines which start with OBX|1|
但是您可以看到,我有两行以
OBX|1|
开头 , so I changed commented out the first three lines of my script so that I start from OBX|2|
,因此我更改了脚本的前三行的注释,以便从
OBX|2|
开始OBX|2|
with the extra information: 带有额外的信息:
//createSegment('OBX', tmp, 1);
//tmp['OBX'][1]['OBX.1']['OBX.1.1'] = 1;
//tmp['OBX'][1]['OBX.2']['OBX.2.1'] = "ST";
createSegment('OBX', tmp, 2);
tmp['OBX'][2]['OBX.1']['OBX.1.1'] = 2;
tmp['OBX'][2]['OBX.2']['OBX.2.1'] = "ST";
but that gives me an error, saying: 但这给了我一个错误,说:
Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransformerException:
CHANNEL: test setup
CONNECTOR: sourceConnector
SCRIPT SOURCE: TRANSFORMER
SOURCE CODE:
46: //createSegment('OBX', tmp, 1);
47: //tmp['OBX'][1]['OBX.1']['OBX.1.1'] = 1;
48: //tmp['OBX'][1]['OBX.2']['OBX.2.1'] = "ST";
49: createSegment('OBX', tmp, 2);
50: tmp['OBX'][2]['OBX.1']['OBX.1.1'] = 2;
51: tmp['OBX'][2]['OBX.2']['OBX.2.1'] = "ST";
52:
LINE NUMBER: 50
DETAILS: TypeError: Cannot read property "OBX.1" from undefined
at 682bcffd-73bf-405b-af83-ba83b19d86ab:50 (doTransform)
at 682bcffd-73bf-405b-af83-ba83b19d86ab:126 (doScript)
at 682bcffd-73bf-405b-af83-ba83b19d86ab:128
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.call(JavaScriptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.call(JavaScriptFilterTransformer.java:119)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Why can't I add new segments with sequence number 2 if 1 already exists? 如果已经存在1,为什么不能添加序列号2的新段? And why does it accept two OBX lines starting with the same sequence number?
为什么它接受两条以相同序列号开头的OBX行?
All tips are welcome! 欢迎所有提示!
Try this: 尝试这个:
createSegment('OBX', tmp, 1);
tmp['OBX'][1]['OBX.1']['OBX.1.1'] = 2;
tmp['OBX'][1]['OBX.2']['OBX.2.1'] = "ST";
createSegment('OBX', tmp, 2);
tmp['OBX'][2]['OBX.1']['OBX.1.1'] = 3;
tmp['OBX'][2]['OBX.2']['OBX.2.1'] = "ST";
The first OBX is tmp['OBX'][0]['OBX.1']['OBX.1.1'] = 1; 第一个OBX是tmp ['OBX'] [0] ['OBX.1'] ['OBX.1.1'] = 1; It's that [0] which is the first OBX instance.
[0]是第一个OBX实例。 so when you added "tmp['OBX'][1]['OBX.1']['OBX.1.1'] = 1;"
因此,当您添加“ tmp ['OBX'] [1] ['OBX.1'] ['OBX.1.1'] = 1;”时, you added the second OBX|1|
您添加了第二个OBX | 1 | when it should have been coded like above.
何时应该像上面这样编码。
createSegment(segmentName, msg, i) where i is the segment instance. createSegment(segmentName,msg,i),其中i是细分实例。
You could also just create the XML element directly and append the segment to the end of your message http://wso2.com/project/mashup/0.2/docs/e4xquickstart.html 您也可以直接创建XML元素,并将该段附加到消息的末尾http://wso2.com/project/mashup/0.2/docs/e4xquickstart.html
var obx = <OBX/>;
obx['OBX.1']['OBX.1.1'] = 2;
obx['OBX.2']['OBX.2.1'] = "ST";
tmp.appendChild(obx);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.