使用Mirth Connect Interoperability server我試圖在HL7構建一條消息。我試圖在消息中添加一些自定義的OBX segments,但是Mirth給了我很大的幫助。HL7與歡樂:如何避免雙序列號段?
在我的模板我有一條線這樣說:
OBX|1|ED|CODE^NAME^COMPANY||^application^pdf^Base64^VeryLongBase64String||||||F
,並在自定義腳本我也想手動添加一些更多的信息:
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";
這產生了以下消息:
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
但是正如你所看到的,我已經有兩行以開頭,所以我改變註釋掉的前三行我的腳本,使我從OBX|2|
開始有額外信息:
//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";
但給我一個錯誤,他說:
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)
爲什麼如果1已經存在,我是否添加序列號爲2的新片段?爲什麼它接受兩個以相同序列號開始的OBX行?
歡迎所有提示!