0

使用 HL7 v2 文件后,我试图将它们编组为 HAPI HL7 对象。路线示例将是:

from("file:C:\\routes\\in").unmarshal(new HL7DataFormat()).log("Success!");

不幸的是,我得到了例外:

ca.uhn.hl7v2.parser.EncodingNotSupportedException: Determine encoding for message. The following is the first 50 chars of the message for reference, although this may not be where the issue is: MSH|^~\&|...

我发现每条被解析的消息前面都有 \u000B 符号,这导致解析器无法找到“MSH”标头。

当然,我可以通过简单的字符串操作来修复它,例如:

from("file:C:\\routes\\in")
            .convertBodyTo(String.class)
            .transform().simple("${in.body.trim()}")
            .unmarshal(new HL7DataFormat())
            .log("Success!");

但在我看来,这不是最好的解决方案。我发现,如果使用 MLLP 协议,相同的符号在消息的前面,HL7 编解码器应该处理它。http://camel.apache.org/hl7.html

问题: 是否可以使用 HL7Codec 之类的文件或 FTP 组件来处理转换为字符串/解析?

4

1 回答 1

0

\u000B是标准 HL7 消息最小低层协议的起始字节(标记)。然后消息通常应以字节\u001C\u000D (结束标记)结束。

虽然您可以讨论文件上 MLLP 的需求,但根据 Apache Camel 的文档,您应该能够使用HL7MLLPCodec 类获得纯 HL7 消息字符串

于 2014-06-16T13:12:12.793 回答