org.openmrs.hl7.handler
Class ORUR01Handler

java.lang.Object
  extended by org.openmrs.hl7.handler.ORUR01Handler
All Implemented Interfaces:
ca.uhn.hl7v2.app.Application

public class ORUR01Handler
extends java.lang.Object
implements ca.uhn.hl7v2.app.Application

Parses ORUR01 messages into openmrs Encounter objects Usage: GenericParser parser = new GenericParser(); MessageTypeRouter router = new MessageTypeRouter(); router.registerApplication("ORU", "R01", new ORUR01Handler()); Message hl7message = parser.parse(somehl7string);

See Also:
HL7InQueueProcessor

Constructor Summary
ORUR01Handler()
           
 
Method Summary
 boolean canProcess(ca.uhn.hl7v2.model.Message message)
          Always returns true, assuming that the router calling this handler will only call this handler with ORU_R01 messages.
protected  Concept getConcept(java.lang.String hl7ConceptId, java.lang.String codingSystem, java.lang.String uid)
          Get a concept object representing this conceptId and coding system.
If codingSystem is 99DCT, then a new Concept with the given conceptId is returned.
Otherwise, the coding system is looked up in the ConceptMap for an openmrs concept mapped to that code.
 java.util.List<ca.uhn.hl7v2.model.v25.segment.NK1> getNK1List(ca.uhn.hl7v2.model.v25.message.ORU_R01 oru)
          finds NK1 segments in an ORU_R01 message.
 ca.uhn.hl7v2.model.Message processMessage(ca.uhn.hl7v2.model.Message message)
          Processes an ORU R01 event message
protected  void processNK1(Patient patient, ca.uhn.hl7v2.model.v25.segment.NK1 nk1)
          process an NK1 segment and add relationships if needed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ORUR01Handler

public ORUR01Handler()
Method Detail

canProcess

public boolean canProcess(ca.uhn.hl7v2.model.Message message)
Always returns true, assuming that the router calling this handler will only call this handler with ORU_R01 messages.

Specified by:
canProcess in interface ca.uhn.hl7v2.app.Application
Returns:
true

processMessage

public ca.uhn.hl7v2.model.Message processMessage(ca.uhn.hl7v2.model.Message message)
                                          throws ca.uhn.hl7v2.app.ApplicationException
Processes an ORU R01 event message

Specified by:
processMessage in interface ca.uhn.hl7v2.app.Application
Throws:
ca.uhn.hl7v2.app.ApplicationException
Expected behavior:
create encounter and obs from hl7 message, create basic concept proposal, create concept proposal and with obs alongside, not create problem list observation with concept proposals, append to an existing encounter, create obs group for OBRs, create obs valueCodedName, fail on empty concept proposals, fail on empty concept answers, set value_Coded matching a boolean concept for obs if the answer is 0 or 1 and Question datatype is coded, set value as boolean for obs if the answer is 0 or 1 and Question datatype is Boolean, set value_Numeric for obs if Question datatype is Numeric and the answer is either 0 or 1, set value_Numeric for obs if Question datatype is Numeric, fail if question datatype is coded and a boolean is not a valid answer, fail if question datatype is neither Boolean nor numeric nor coded

processNK1

protected void processNK1(Patient patient,
                          ca.uhn.hl7v2.model.v25.segment.NK1 nk1)
                   throws ca.uhn.hl7v2.HL7Exception
process an NK1 segment and add relationships if needed

Parameters:
patient -
nk1 -
Throws:
ca.uhn.hl7v2.HL7Exception
Expected behavior:
create a relationship from a NK1 segment, not create a relationship if one exists, create a person if the relative is not found, fail if the coding system is not 99REL, fail if the relationship identifier is formatted improperly, fail if the relationship type is not found

getNK1List

public java.util.List<ca.uhn.hl7v2.model.v25.segment.NK1> getNK1List(ca.uhn.hl7v2.model.v25.message.ORU_R01 oru)
                                                              throws ca.uhn.hl7v2.HL7Exception
finds NK1 segments in an ORU_R01 message. all HAPI-rendered Messages have at least one NK1 segment but if the original message truly does not contain an NK1, the setID will be null on the generated NK1

Parameters:
oru - ORU_R01 message to be parsed for NK1 segments
Returns:
list of not-null NK1 segments
Throws:
ca.uhn.hl7v2.HL7Exception

getConcept

protected Concept getConcept(java.lang.String hl7ConceptId,
                             java.lang.String codingSystem,
                             java.lang.String uid)
                      throws ca.uhn.hl7v2.HL7Exception
Get a concept object representing this conceptId and coding system.
If codingSystem is 99DCT, then a new Concept with the given conceptId is returned.
Otherwise, the coding system is looked up in the ConceptMap for an openmrs concept mapped to that code.

Parameters:
hl7ConceptId - the given hl7 conceptId
codingSystem - the coding system for this conceptid (e.g. 99DCT)
uid - unique string for this message for any error reporting purposes
Returns:
a Concept object or null if no conceptId with given coding system found
Throws:
ca.uhn.hl7v2.HL7Exception
Expected behavior:
return null if codingSystem not found, return a Concept if given local coding system, return a mapped Concept if given a valid mapping

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change