nHapiNET/nHapi

Cannot get the diagnosis description in ORM_O01

Closed this issue · 5 comments

Hi @ALL !

Describe the bug:
I cannot get the diagnosis description from the ORM_O01 message by using nhapi.

var ourPipeParser = new PipeParser();
var hl7Message = ourPipeParser.Parse(hl7Msg);
string examReason = data.GetORDER().ORDER_DETAIL.GetDG1().DiagnosisDescription.Value; // return an empty string
Platform.Log(LogLevel.Error, "---- ExamReason: " + examReason);

But, I using the hl7 tool and it getting ok.
GetDescriptionByTool

And, there is my hl7 message:

MSH|^~\&|RIS|ABC|||1234|1148|ORM^O01|1234|P|2.3||||||UNICODE UTF-8
PID|1||1234||nguyen^a b c||12345678|F|||patient address test
PV1||O|||||||||||||||||1234
DG1||||test diagnosis description
ORC|NW|1234|1234||||||1234|||1234^Tran^c d e
OBR|1|1234|1234|2394^Chup Xquang abc [ben trai]

Environmental Details:

  • OS: Windows Server 2019
  • Target .Net Framework
  • Version 4.0
  • HL7 Version: 2.3

@dinhnam2901 what version of nHapi does this relate to?

Having done a brief inspection, it looks like your message is nonstandard (some of the segments are in the wrong order), if you move the DG1 to the end so it's your last segment then it will become standard and the code you supplied show include a value.

Change your message to the following:

MSH|^~\&|RIS|ABC|||1234|1148|ORM^O01|1234|P|2.3||||||UNICODE UTF-8
PID|1||1234||nguyen^a b c||12345678|F|||patient address test
PV1||O|||||||||||||||||1234
ORC|NW|1234|1234||||||1234|||1234^Tran^c d e
OBR|1|1234|1234|2394^Chup Xquang abc [ben trai]
DG1||||test diagnosis description

Hapi test panel also shows this, because DG1 came before OCR and OBR it makes them all look like they are nonstandard.

image

After the order is corrected:
image

The order of the segments is important in hl7.

I see.
Thank you so much!

No Problem!
let me know if that fixes your issue.

Yeah, I was corrected as same as your suggestion, and it work correctly!