有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java在HL7中“Repeate”、“Component”和“SubComponent”是什么意思?

我根据找到的文档为HL7构建了一个解析器,并认为它工作得很好——直到我得到了测试数据的示例。我根据以下假设构建了它:

  • ~是一个“重复”字符。基本上意味着传递的字段值是给定值的数组
  • ^表示该字段由数组表示,但期望数组项用于构建最终值
  • &^类似,但它是^内部的嵌套数组

考虑到我掌握的测试数据,这些假设似乎不太准确。有人能帮我弄清楚什么是正确的解释方法吗


共 (2) 个答案

  1. # 1 楼答案

    在构建解析器时,我将进一步介绍一些细节

    请参阅this参考资料:

    (x0D)   Segment separator
    |       Field separator, aka pipe
    ^       Component separator, aka hat
    &       Sub-component separator
    ~       Field repeat separator
    \       Escape character
    

    The segment separator is not negotiable. It is always a carriage return (ASCII 13 or HEX 0D). The others are suggested values only, but usually used as indicated above. The HL7 standard lets you choose your own as long as you show them in the MSH segment.

    The MSH is the first segment of all HL7 messages (except HL7 batch messages). The field separator is presented as the 4th character in the message and it also represents the first field of the MSH segment. Since the first field of the MSH is typically only a pipe,’|’, counting MSH fields becomes tricky. Field 2 of the MSH (MSH-2) contains the other separator characters in this order: component, field repeat, escape, and sub-component.

    Thus, the following is an example of the beginning of an HL7 message: MSH|^~\&|…

    如上所述:

    • ~表示为该特定字段提供了多个值。因此,就编程语言而言,它是一个数组、列表或类似的数据结构。你的假设是正确的
    • ^表示给定字段的组成部分。这意味着,一个字段可能有多个组件。所有这些组件组合表示最终值。我认为,在编程语言术语中,这不应该与数组有关。这里的例子是人名。整个人名是单个数据,它以姓氏、给定姓名等形式拆分。如您所见,这不是一个数组。这不是多个值;这是将单个值拆分为多个子值。因此,您可以将其视为classstruct而不是数组,如Composition
    • &是子组件,与上述组件类似,区别在于,它进一步将给定组件中的数据拆分为子组件。同样,我认为这应该与特定于语言的classstruct链接,而不是数组

    此外,上面列出的字符是默认字符,最常用于所述目的。但是,它们是可以改变的。基本上,这些字符是在^{}中的每条消息中定义的。请注意,第一个字段始终是字段分隔符(|),这是不可协商的。因此,下一个(第二个)字段保存编码字符。在编写解析器时,您应该从这里读取编码字符,并相应地进一步使用它们

    字符的顺序也定义为here

    2.24.1.2 Encoding characters (ST) 00002 Definition: This field contains the four characters in the following order: the component separator, repetition separator, escape character, and subcomponent separator. Recommended values are ^~\&, (ASCII 94, 126, 92, and 38, respectively).

    请参考这些关于HL7 Escape Sequencesconventionsterms使用的其他答案

  2. # 2 楼答案

    分隔符是在MSH-1/2字段中定义的,可以根据消息的不同而有所不同。如果您正在编写解析器,那么您需要阅读实际的规范。见HL7第2章。它包含关于正确解析的详细说明,包括伪代码和流程图