问题描述
我正在接收HL7消息2.5.1版本.
I am receiving HL7 messages version 2.5.1.
MSH|..
PID|..
PV1|..
ORC|..
IN1|1|...
IN1|2|....
因此,在上面的示例中, IN1 在重复,但是当我尝试使用TERSER解析第二个IN1段时,它会抛出异常 不要创建结构IN1的重复#1-此结构是非重复的" .
So in the above example IN1 is repeating, however when i try to Parse the second IN1 segment with TERSER it throws an exception "Can't create repetition #1 of Structure IN1 - this Structure is non-repeating".
This is what i have tried so far
string insurance = terser.Get("/.INSURANCE/.IN1(0)-1"); // Works fine
string insurance = terser.Get("/.INSURANCE/.IN1(1)-1"); // Throws exception
string insurance = terser.Get("/.INSURANCE(0)/.IN1(0)-1"); // Works fine
string insurance = terser.Get("/.INSURANCE(1)/.IN1(0)-1"); // Throws exception
推荐答案
您很近,但是您正在IN1上使用一个重复组,它不是一个重复片段.请记住,INSURANCE组重复的细分不是:
You are close but you are using a repeating group on IN1 which is not a repeating segment. Remember INSURANCE group is repeating the segments within are not:
Try:
/.INSURANCE(0)/.IN1-1"
/.INSURANCE(1)/.IN1-1"
"/.INSURANCE(1)/.IN1(0)-1"
works because there's only one IN1 segment in the group (rep 0 defaults to the 1st segment in the group):
从 Terser api中阅读该部分在组上:
From the Terser api read up on the section on groups:
group_spec:[."] group_name_pattern
group_spec: ["."] group_name_pattern
在这里,一个.表示应搜索该组(使用 SegmentFinder)从消息中的当前位置开始.这 通配符""和?"代表任意数量的任意字符, 和一个任意字符.例如,"M "和 ?S?"匹配MSH.名称与给定名称匹配的第一组 group_name_pattern将被匹配.
Here, a . indicates that the group should be searched for (using a SegmentFinder) starting at the current location in the message. The wildcards "" and "?" represent any number of arbitrary characters, and a single arbitrary character, respectively. For example, "M" and "?S?" match MSH. The first group with a name that matches the given group_name_pattern will be matched.
segment_spec类似于group_spec.
The segment_spec is analogous to the group_spec.
另一个示例是SIU_S12消息中的以下子组件:
As another example, the following subcomponent in an SIU_S12 message:
msg.getSIU_S12_RGSAISNTEAIGNTEAILNTEAIPNTE(1).getSIU_S12_AIGNTE().getAIG().getResourceGroup(1).getIdentifier();
msg.getSIU_S12_RGSAISNTEAIGNTEAILNTEAIPNTE(1).getSIU_S12_AIGNTE().getAIG().getResourceGroup(1).getIdentifier();
...
:/SIU_S12_RGSAISNTEAIGNTEAILNTEAIPNTE(1)/SIU_S12_AIGNTE/AIG-5(1)-1/ AIG (1)/SIU_S12_AIGNTE/AIG-5(1)-1/ AIG (1)/.AIG-5(1)
is referenced by all of the following location_spec: /SIU_S12_RGSAISNTEAIGNTEAILNTEAIPNTE(1)/SIU_S12_AIGNTE/AIG-5(1)-1 /AIG(1)/SIU_S12_AIGNTE/AIG-5(1)-1 /AIG(1)/.AIG-5(1)
搜索功能仅迭代每个组的rep 0.因此,如果 在此示例中,期望第一组的rep 0代替rep 1, 以下语法也可以使用(因为只有一个AIG 段在SUI_S12中的位置):
The search function only iterates through rep 0 of each group. Thus if rep 0 of the first group in this example was desired instead of rep 1, the following syntax would also work (since there is only one AIG segment position in SUI_S12):
/.AIG-5(1)
这篇关于无法使用HAPI TERSER解析HL7中的多个IN1段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!