简体   繁体   English

NHapi不完整的消息部分编码且没有错误?

[英]NHapi incomplete messages encoded partially and without error?

In NHapi, I'm attempting to create a pipe-encoded ORM. 在NHapi中,我试图创建一个管道编码的ORM。 When I parser.Encode() my populated message, only some of the segments are printed. 当我解析填充的消息parser.Encode()时,仅打印一些段。 Notably among the missing segments is MSH! MSH尤其是缺少的部分!

I don't know for sure, but I believe that the encoder is skipping segments that it considers to be incomplete. 我不确定,但我相信编码器会跳过它认为不完整的片段。

I have given values for the required fields MSH-1, 2, 9, 10, 11, and 12, but I cannot get the MSH segment to encode. 我已经为MSH-1、2、9、10、11和12的必填字段提供了值,但我无法获取要编码的MSH段。

If I am right that the MSH segment's incompleteness is causing this omission: Is there any way to have the PipeEncoder or some other validator throw exceptions if messages are not complete? 如果我是对的,则MSH段的不完整导致了这一遗漏: 如果消息不完整,是否可以通过任何方法让PipeEncoder或其他验证程序抛出异常?

And: In any case, why is the MSH segment not encoding? 并且: 无论如何,为什么MSH段不编码?

Perhaps this could help someone, so I won't just close it. 也许这可以帮助某人,所以我不会仅仅关闭它。 I was printing these encoded messages to the Console and seeing only two segments, and jumbled at that, though I wasn't familiar enough with HL7 to realize. 我当时将这些编码的消息打印到控制台上,并且仅看到两个部分,但对此感到有些困惑,尽管我对HL7并不十分了解。

What was happening was that NHapi's '\\r' single newline character (rather than "\\r\\n") was merely overwriting each line with the next segment. 发生的事情是NHapi的'\\ r'单个换行符(而不是“ \\ r \\ n”)仅覆盖了下一段的每一行。 My PID segment was long enough to wrap, getting me to the second line and the two segments. 我的PID段足够长,可以包装,使我进入第二行和这两段。

That was dumb. 真傻

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM