org.openhealthexchange.openpixpdq.ihe.impl_v2.hl7
Class HL7v25

java.lang.Object
  extended by org.openhealthexchange.openpixpdq.ihe.impl_v2.hl7.HL7v25

public class HL7v25
extends java.lang.Object

The utility class for HL7 v2.5 messages.

Version:
1.0 - Nov 22, 2005
Author:
Jim Firby

Field Summary
static java.lang.String birhtdateFormat
           
 
Constructor Summary
HL7v25()
           
 
Method Summary
static com.misyshealthcare.connect.net.Identifier extractAssigningAuthority(ca.uhn.hl7v2.model.GenericComposite composite)
          Extracts assigning authority from a GenericComposite.
static PatientIdentifier extractId(ca.uhn.hl7v2.model.GenericComposite composite, com.misyshealthcare.connect.net.IConnectionDescription connection)
          Extracts ID with assigning authority from a GenericComposite.
static java.lang.String getErrorString(ca.uhn.hl7v2.model.v25.segment.ERR err, java.lang.String type)
          Creates a human-readable string our of an HL7 ERR segment.
static void populateDSC(ca.uhn.hl7v2.model.v25.segment.DSC dsc, java.lang.String pointer)
          Populates DSC segment
static void populateERR(ca.uhn.hl7v2.model.v25.segment.ERR err, java.lang.String segmentId, java.lang.String sequence, java.lang.String fieldPosition, java.lang.String fieldRepetition, java.lang.String componentNumber, java.lang.String hl7ErrorCode, java.lang.String hl7ErrorText)
          Populates ERR segment.
static void populateMSA(ca.uhn.hl7v2.model.v25.segment.MSA msa, java.lang.String acknowledgmentCode, java.lang.String messageControlId)
          Populates MSA segment, used by, for example, PIX Query response
static void populateMSH(ca.uhn.hl7v2.model.v25.segment.MSH msh, java.lang.String type, java.lang.String event, java.lang.String id, com.misyshealthcare.connect.net.IConnectionDescription connection)
          Populates an HL7 v2.5 MSH segment according to the IHE standard
static void populateMSH(ca.uhn.hl7v2.model.v25.segment.MSH msh, java.lang.String type, java.lang.String event, java.lang.String id, com.misyshealthcare.connect.net.Identifier sendingApplication, com.misyshealthcare.connect.net.Identifier sendingFacility, com.misyshealthcare.connect.net.Identifier receivingApplication, com.misyshealthcare.connect.net.Identifier receivingFacility)
          Populates an HL7 v2.5 MSH segment according to the IHE standard
static void populateQAK(ca.uhn.hl7v2.model.v25.segment.QAK qak, java.lang.String queryTag, java.lang.String responseStatus)
          Populates QAK segment.
static void populateQAK(ca.uhn.hl7v2.model.v25.segment.QAK qak, java.lang.String queryTag, java.lang.String responseStatus, int totalNum, int thisNum, int remainingNum)
          Populates QAK segment.
static java.util.Date unformatDTM(ca.uhn.hl7v2.model.v25.datatype.DTM dtm, boolean doTime)
          Turns an HL7 v2.5 DTM structure into a Java Date object.
static void updateMSH(ca.uhn.hl7v2.model.v25.segment.MSH msh, java.lang.String id)
          Updates an HL7 v2.5 message header for a repeat use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

birhtdateFormat

public static final java.lang.String birhtdateFormat
See Also:
Constant Field Values
Constructor Detail

HL7v25

public HL7v25()
Method Detail

populateMSH

public static void populateMSH(ca.uhn.hl7v2.model.v25.segment.MSH msh,
                               java.lang.String type,
                               java.lang.String event,
                               java.lang.String id,
                               com.misyshealthcare.connect.net.IConnectionDescription connection)
                        throws ca.uhn.hl7v2.model.DataTypeException,
                               IheConfigurationException
Populates an HL7 v2.5 MSH segment according to the IHE standard

Parameters:
msh - the MSH segment
type - the type of message the segment belongs to
event - the event that triggered this message
id - the message control ID for this message
Throws:
ca.uhn.hl7v2.model.DataTypeException - When supplied data is inappropriate
IheConfigurationException - When the connection to which this will be sent if not configured properly

populateMSH

public static void populateMSH(ca.uhn.hl7v2.model.v25.segment.MSH msh,
                               java.lang.String type,
                               java.lang.String event,
                               java.lang.String id,
                               com.misyshealthcare.connect.net.Identifier sendingApplication,
                               com.misyshealthcare.connect.net.Identifier sendingFacility,
                               com.misyshealthcare.connect.net.Identifier receivingApplication,
                               com.misyshealthcare.connect.net.Identifier receivingFacility)
                        throws ca.uhn.hl7v2.model.DataTypeException
Populates an HL7 v2.5 MSH segment according to the IHE standard

Parameters:
msh - the MSH segment
type - the type of message the segment belongs to
event - the event that triggered this message
id - the message control ID for this message
sendingApplication - the sending application
sendingFacility - the sending facility
receivingApplication - the receiving application
receivingFacility - the receiving facility
Throws:
ca.uhn.hl7v2.model.DataTypeException - When supplied data is inappropriate

updateMSH

public static void updateMSH(ca.uhn.hl7v2.model.v25.segment.MSH msh,
                             java.lang.String id)
                      throws ca.uhn.hl7v2.model.DataTypeException
Updates an HL7 v2.5 message header for a repeat use.

Parameters:
msh - the message header to update
id - the new message control id for this header
Throws:
ca.uhn.hl7v2.model.DataTypeException - When the date/time cannot be set

getErrorString

public static java.lang.String getErrorString(ca.uhn.hl7v2.model.v25.segment.ERR err,
                                              java.lang.String type)
Creates a human-readable string our of an HL7 ERR segment.

Parameters:
err - the ERR segment
type - use either "PIX" or "PDQ";
Returns:
the error string

unformatDTM

public static java.util.Date unformatDTM(ca.uhn.hl7v2.model.v25.datatype.DTM dtm,
                                         boolean doTime)
                                  throws ca.uhn.hl7v2.model.DataTypeException
Turns an HL7 v2.5 DTM structure into a Java Date object.

Parameters:
dtm - the DTM structure
doTime - True if the time should be included in the result
Returns:
the Date object holding the DTM date/time
Throws:
ca.uhn.hl7v2.model.DataTypeException - When there is a problem extracting the HL7 data from the DTM

populateMSA

public static void populateMSA(ca.uhn.hl7v2.model.v25.segment.MSA msa,
                               java.lang.String acknowledgmentCode,
                               java.lang.String messageControlId)
                        throws ca.uhn.hl7v2.model.DataTypeException
Populates MSA segment, used by, for example, PIX Query response

Parameters:
msa - the Message Acknowledgment segment
acknowledgmentCode - the two letter of acknowledgment code
messageControlId - the message control Id
Throws:
ca.uhn.hl7v2.model.DataTypeException - When MSA segment values cannot be set

populateQAK

public static void populateQAK(ca.uhn.hl7v2.model.v25.segment.QAK qak,
                               java.lang.String queryTag,
                               java.lang.String responseStatus,
                               int totalNum,
                               int thisNum,
                               int remainingNum)
                        throws ca.uhn.hl7v2.model.DataTypeException
Populates QAK segment.

Parameters:
qak - the query acknowledgment segment
queryTag - the query tag
responseStatus - the response status
totalNum - the total number of records found by this query
thisNum - the the number of records returned in this pay-load
remainingNum - the remaining number of records yet to be returned
Throws:
ca.uhn.hl7v2.model.DataTypeException - When QAK segment values cannot be set.

populateQAK

public static void populateQAK(ca.uhn.hl7v2.model.v25.segment.QAK qak,
                               java.lang.String queryTag,
                               java.lang.String responseStatus)
                        throws ca.uhn.hl7v2.model.DataTypeException
Populates QAK segment.

Parameters:
qak - The query acknowledgment segment
queryTag - The query tag
responseStatus - The response status
Throws:
ca.uhn.hl7v2.model.DataTypeException - When QAK segment values cannot be set.

populateDSC

public static void populateDSC(ca.uhn.hl7v2.model.v25.segment.DSC dsc,
                               java.lang.String pointer)
                        throws ca.uhn.hl7v2.model.DataTypeException
Populates DSC segment

Parameters:
dsc - the DSC segment to be populated
pointer - the pointer id
Throws:
ca.uhn.hl7v2.model.DataTypeException - When DSC segment values cannot be set.

populateERR

public static void populateERR(ca.uhn.hl7v2.model.v25.segment.ERR err,
                               java.lang.String segmentId,
                               java.lang.String sequence,
                               java.lang.String fieldPosition,
                               java.lang.String fieldRepetition,
                               java.lang.String componentNumber,
                               java.lang.String hl7ErrorCode,
                               java.lang.String hl7ErrorText)
                        throws ca.uhn.hl7v2.model.DataTypeException,
                               ca.uhn.hl7v2.HL7Exception
Populates ERR segment.

Parameters:
err - the ERR segment to be populated
segmentId - the id of the segment that caused the error
sequence - the sequence of the segment
fieldPosition - the field position where the error is
fieldRepetition - the repetition of the error field
componentNumber - the component number in the error field
hl7ErrorCode - the HL7 error code
hl7ErrorText - the HL7 error text
Throws:
ca.uhn.hl7v2.model.DataTypeException - When ERR segment values cannot be set.
ca.uhn.hl7v2.HL7Exception - When HL7 related issue happens

extractId

public static PatientIdentifier extractId(ca.uhn.hl7v2.model.GenericComposite composite,
                                          com.misyshealthcare.connect.net.IConnectionDescription connection)
                                   throws ca.uhn.hl7v2.model.DataTypeException
Extracts ID with assigning authority from a GenericComposite.

Parameters:
composite - a composite data
connection - the connection description
Returns:
the PatientIdentifier
Throws:
ca.uhn.hl7v2.model.DataTypeException

extractAssigningAuthority

public static com.misyshealthcare.connect.net.Identifier extractAssigningAuthority(ca.uhn.hl7v2.model.GenericComposite composite)
                                                                            throws ca.uhn.hl7v2.model.DataTypeException
Extracts assigning authority from a GenericComposite. The GenericComposite has to be either PDQ-8 (in PDQ Query) or PID-4 (in PIX Query).

Parameters:
composite - the composite data
Returns:
the assigning authority
Throws:
ca.uhn.hl7v2.model.DataTypeException - if there is any data type error