POST HL7 message error

Hi For Creating a new patient do I need to install some new module. I am currently using standalone 2.6.

Currently in the test of REST Web Services I am sending URI = /openmrs-standalone/ws/rest/v1/hl7 Body content = {“hl7”:“MSH|^~&|FORMENTRY|LOCAL|HL7LISTENER|LOCAL|20091123101300^0|HUP|ADT^A28^ADT_A05|9166768|P|2.5|1|||AL||ASCII\r\nEVN|A28|20091123101300|||1\r\nPID|||1003C3^^^OpenMRS ID||Patient^Demo^OldId||20011114|M|||20371^02^2400^724||||||724^Y||||||02|||11|20371|724^DEUT^N||N”}

And I am getting Error.

Hullo Tiwari thanks for the good work.Try to go through this link hope it will help you.:slight_smile: HERE

Can you paste the contents of the server log at pastebin.com?

@dkayiwa

https://pastebin.com/Q9sgJZNS

Can you take a look at this for an example of the format expected to create a patient? https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/HL7MessageController1_8Test.java

@dkayiwa Went through your link, compared the message with the message that I was trying to send, found out that there was one ‘/’ missing before the ‘&’ and that’s what the Tomcat logs said.

Anyhow the message to be send is

MSH|^~\&|REST|LOCAL|HL7HANDLER|OPENMRS|20091123101300^0|HUP|ORU^R01^ORU_R01|9166768|P|2.5|1|||AL||ASCIIEVN|A28|20091123101300|||1PID|||1003C3^^^OpenMRS ID||Patient^Demo^OldId||20011114|M|||20371^02^2400^724||||||724^Y||||||02|||11|20371|724^DEUT^N||N

NOW although I am getting a success message in the UI

BUT the message is not getting processed and is stuck in the hl7 errors

The error in the TOMCAT logs are –

ERROR - HL7ServiceImpl.setFatalError(742) |2017-07-20 16:31:08,010| ca.uhn.hl7v2.HL7Exception: Error while processing HL7 message: ORU_R01 INFO - LoggingAdvice.invoke(115) |2017-07-20 16:31:08,013| In method HL7Service.saveHL7InError. Arguments: HL7InError=HL7InError[hashCode=99bbc33,uuid=1d6e59cd-821b-448c-812d-61d86284c685], INFO - LoggingAdvice.invoke(155) |2017-07-20 16:31:08,015| Exiting method saveHL7InError INFO - LoggingAdvice.invoke(115) |2017-07-20 16:31:08,016| In method HL7Service.purgeHL7InQueue. Arguments: HL7InQueue=HL7InQueue[hashCode=4bfb92dd,uuid=4a35bafb-e1c2-4f29-95d6-3f25f76eeaf7], INFO - LoggingAdvice.invoke(155) |2017-07-20 16:31:08,019| Exiting method purgeHL7InQueue INFO - LoggingAdvice.invoke(115) |2017-07-20 16:32:26,875| In method ReportService.deleteOldReportRequests. Arguments: INFO - LoggingAdvice.invoke(155) |2017-07-20 16:32:26,877| Exiting method deleteOldReportRequests

What are the error details? You can also get them from the “hl7_in_error” database table.

@dkayiwa

Yes the error log is saying that… Missing patient identifier in PID segment. It looks like the message that I am sending is still not perfect if somebody could find any error in this message format then it will be very helpful.

MSH|^~&|REST|LOCAL|HL7HANDLER|OPENMRS|20140331101300^0|HUP|ORU^R01^ORU_R01|test|P|2.5|1|||AL||ASCII|EVN|A28|20140331101300|||1|PID|||1991^^^Old Identification Number||Rest^Created^Patient||20011114000000|M|||20371^02^2400^724||||||724^Y||||||02|||11|20371|724^DEUT^N||N

Here are the complete logs https://pastebin.com/79rCnzcC

What is the id for “Old Identification Number” patient identifier type?

This is the Old identification id - 8d79403a-c2cc-11de-8d13-0010c6dffd0f

I mean the numeric id

The numeric id is 2.

Did you eventually figure this out?

Nope. Changed the id to 2 from 1 in HL7 message but the error didn’t change.

Replace “ORU^R01^ORU_R01” with “ADT^A28^ADT_A05” Secondly, the “I” before “PID|||1991^^^Old Identification” should not be there.

In summary, your message should be as below:

MSH|^~\&|REST|LOCAL|HL7HANDLER|OPENMRS|20140331101300^0|HUP|ADT^A28^ADT_A05|ADD PERSON INFO|P|2.5|1|||AL||ASCII|\r EVN|A28|20140331101300|||1\r PID|||1991^^^Old Identification Number||Rest^Created^Patient||20011114000000|M|||20371^02^2400^724||||||724^Y||||||02|||11|20371|724^DEUT^N||N

@dkayiwa Tried using your message but still I’m getting the message in hl7_errors

ca.uhn.hl7v2.HL7Exception: No route for hl7 message: ADT_A05. Make sure you have a module installed that registers a hl7handler for this type Here is the complete log https://pastebin.com/ZbqZDUV8

Which module should I install which registers hl7handler?

Can you paste the exact message you are posting at pastebin.com?