This project page is still a work in progress and not meant for actual work yet.
There currently is no way for openmrs to send HL7 messages out from openmrs. There are several ways to receive HL7 (see HL7 wiki page).
The admin of a system should be able to say what and to whom a message should be generated. For example, hospital is running openmrs and needs another system X to be notified every time a new patient is registered. The X system needs to receive an ADTA28 HL7 message on every PatientService.savePatient action with a new patient.
There is a tool called Mirth that could be used to do the sending. Openmrs would simply have to notify Mirth and give it a serialized object and Mirth deals with who/where/how to send it.
An output queue table needs to be written similar to the HL7 input queue. The only difference is that a specified destination is required as well. Also should record acknowledgements from remote side.
A jsp page is needed on the admin screen to manage where the current system wants to send HL7 messages.
A set of openmrs object to HL7 messages will need to be written. e.g. turn the saving of a Patient object into the creation of an HL7 ADTA28 message. Or saving of an Encounter object to an ORUR01 message.
Hl7 output generation may be customized based on user inputs. Inputs are quite important when generating many of the segments. I believe that we should include default values which the user may override based on his preferences.
Furthermore, the hl7 output may be retrieved either as an xml message or as an pipe delimited message. The user should be allowed to pick the format of the message.
What is the structure of our hl7 message ? will we convert a single encounter into one hl7 message, or can an entire list of objects be transformed into a single hl7 message ?
How shall we fill in the ORC and OBR segments ?
The existing OpenMRS system does not allow to send HL7 messages and allows only incoming messages. As per the requirements, we have created new HL7 messages using the HAPI(hl7 API) library to enable OpenMRS systems to be able to send messages. A web page also enlists the outgoing messages saved in the database.
To incorporate the above mentioned changes, we created a new HL7OutQueue table in the database. This table stores the ADT A05 and the ORU RO1 messages that are generated on the save of any patient or save of an encounter. These messages are rendered on a web page under the "View HL7 OutQueue Messages" tab.
We have used the v2.5 of the HAPI (hl7 API) library to generate new ADT A05 and ORU RO1 message.
The following are the files that were created by us:
====FILE NAME============= ===================FILE PATH================= ==================Purpose===============
HL7OutQueue.java openmrs\api\src\main\java\org\openmrs\hl7 Class file for the new table in the database
hl7OutQueue.jsp openmrs\webapp\target\openmrs\WEB-INF\view\admin\hl7 JSP page listing the HL7 OutQueue messages saved in the database
Hl7OutQueueListController.java openmrs\web\src\main\java\org\openmrs\hl7\web\controller The controller between the HL7OutQueue view and class (model).
HL7ADTA28Encoder.java openmrs\api\src\main\java\org\openmrs\hl7\handler The file that encodes new HL7 ADTA05 messages
HL7ORURO1Encoder.java openmrs\api\src\main\java\org\openmrs\hl7\handler The file that encodes new HL7 ORUR01 messages
The future work of this project is to send the messages over the network and allowing the admin to choose the destination to which the messages are to be sent.