nHapiNET / nHapi

nHapi is the .Net port of the original Java project HAPI.
Mozilla Public License 2.0
277 stars 156 forks source link

Cannot get the diagnosis description in ORM_O01 #213

Closed dinhnam2901 closed 3 years ago

dinhnam2901 commented 3 years ago

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:

milkshakeuk commented 3 years ago

@dinhnam2901 what version of nHapi does this relate to?

milkshakeuk commented 3 years ago

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.

dinhnam2901 commented 3 years ago

I see. Thank you so much!

milkshakeuk commented 3 years ago

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

dinhnam2901 commented 3 years ago

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