【问题标题】:Is it possible to skip parsing some field in HAPI?是否可以跳过解析 HAPI 中的某些字段?
【发布时间】:2015-10-30 01:57:30
【问题描述】:

我正在使用 Apache Camel、Mina2 和 HAPI 来接收 HL7 v2 消息。我注意到解组和创建 Message 对象需要花费大量时间。当我有更大的消息时,这个时间会增加。

我的消息有大约 120 个 OBX 段,我只使用 OBX 3 和 OBX 5 字段。我在 OBX 5 之后测试了手动删除字段,发现性能有所提高。有没有办法告诉 HAPI 在 OBX 5 之后不要解析任何字段?

【问题讨论】:

    标签: apache-camel hl7 mina hapi hl7-v2


    【解决方案1】:

    您可以扩展 ca.uhn.hl7v2.parser.PipeParser 并覆盖 Segment 解析方法。

    @Override
    public void parse(Segment destination, String segment, EncodingCharacters encodingChars, Integer theRepetition) throws HL7Exception {
        if(!"OBX".equals(destination.getName()) || destination.getParent().getParent().getAll("OBSERVATION").length <= 5) {
            super.parse(destination, segment, encodingChars, theRepetition);
        }
    }
    

    使用它来解析您的消息,它只会解析 ORDER_DETAIL 中的前 5 个 OBSERVATIONS。

    【讨论】:

      猜你喜欢
      • 2015-03-27
      • 2014-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多