org.openhealthexchange.openpixpdq.ihe.registry
Class HL7

java.lang.Object
  extended by org.openhealthexchange.openpixpdq.ihe.registry.HL7

public class HL7
extends java.lang.Object

This class implements a number of HL7 parsing and generation utilities used by the XDS Repository Actors. The HAPI code could not be used in this class because the repository uses partial message pieces. It was easier just to implement them directly.

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

Constructor Summary
HL7()
           
 
Method Summary
static void fromCX(com.misyshealthcare.connect.base.PatientID pid, java.lang.String cx)
          Decodes an HL7 CX identifier string into a PatientID.
static java.util.Date fromDT(java.lang.String date)
          Decodes a DT data type into a Java date object.
static java.util.Date fromDTM(java.lang.String dtm)
          Extracts a Java date object from a DTM date/time type.
static com.misyshealthcare.connect.base.SharedEnums.SexType fromSex(java.lang.String code)
          Decodes and HL7 adminstrative sex value into a SexType enum.
static com.misyshealthcare.connect.base.demographicdata.Address fromXAD(java.lang.String xad)
          Decodes an HL7 XAD data type into an Address.
static com.misyshealthcare.connect.base.clinicaldata.Provider fromXCN(java.lang.String xcn)
          Extracts a Provide from an HL7 XCN data type.
static java.lang.String fromXON(java.lang.String xon)
          Gets the institution string from an HL7 encoded XON.
static boolean fromXPN(PersonName personName, java.lang.String xpn)
          Decodes an HL7 XPN data type and put the name fields into a PersonName
static com.misyshealthcare.connect.net.Identifier getAssigningAuthorityFromCX(java.lang.String cx)
          Gets the Assigning Authority component from an HL7 CX identifier string.
static com.misyshealthcare.connect.net.Identifier getAssigningAuthorityFromCXAuth(java.lang.String aa)
          Gets the Assigning Authority component from an HL7 CX identifier Authority string.
static java.lang.String getCXauthority(java.lang.String input)
          Gets the 'assigning authority' component from an HL7 CX string.
static java.lang.String getCXid(java.lang.String input)
          Gets the 'id' component from an HL7 CX string.
static java.lang.String getIdFromCX(java.lang.String cx)
          Gets the ID component from an HL7 CX identifier string.
static java.lang.String toCX(java.util.List<PatientIdentifier> pids)
          Generates a CX list from a list of PatientIdentifier.
static java.lang.String toCX(java.lang.String id, com.misyshealthcare.connect.net.Identifier authority)
          Generates a CX data type from an ID and an AssigningAuthority.
static java.lang.String toCX(java.lang.String id, java.lang.String authority)
          Generates a CX data type from an ID and an AssigningAuthority.
static java.lang.String toCXAuth(com.misyshealthcare.connect.net.Identifier authority)
          Generates a CX data type from an AssigningAuthority.
static java.lang.String toDT(java.util.Date date)
          Generates a DT date type from a Java date object.
static java.lang.String toDTM(java.util.Date date)
          Generates a DTM date/time type from a Java date object.
static java.lang.String toSex(com.misyshealthcare.connect.base.SharedEnums.SexType sex)
          Converts an enum gender value to the coded value used in XDS HL7 PID-8 messages.
static java.lang.String toXAD(com.misyshealthcare.connect.base.demographicdata.Address address)
          Generates an XAD data type from an Address object.
static java.lang.String toXCN(com.misyshealthcare.connect.base.clinicaldata.Provider person)
          Generates an XCN name data type from a Provider.
static java.lang.String toXON(java.lang.String institution)
          Generates an XON data type from a string.
static java.lang.String toXPN(PersonName personName)
          Generates an XPN name data type from a Patient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HL7

public HL7()
Method Detail

toCX

public static java.lang.String toCX(java.lang.String id,
                                    com.misyshealthcare.connect.net.Identifier authority)
Generates a CX data type from an ID and an AssigningAuthority.

Parameters:
id - The ID
Returns:
The CX formatted type (conforming to XDS requirements)

toCX

public static java.lang.String toCX(java.util.List<PatientIdentifier> pids)
Generates a CX list from a list of PatientIdentifier.

Parameters:
pids - The PatientIdentifier List
Returns:
The CX formatted type (conforming to XDS requirements)

toCX

public static java.lang.String toCX(java.lang.String id,
                                    java.lang.String authority)
Generates a CX data type from an ID and an AssigningAuthority.

Parameters:
id - The ID
authority - The assigning authority
Returns:
The CX formatted type (conforming to XDS requirements)

toCXAuth

public static java.lang.String toCXAuth(com.misyshealthcare.connect.net.Identifier authority)
Generates a CX data type from an AssigningAuthority.

Parameters:
authority - The assigning authority
Returns:
The CX formatted type

fromCX

public static void fromCX(com.misyshealthcare.connect.base.PatientID pid,
                          java.lang.String cx)
Decodes an HL7 CX identifier string into a PatientID.

This method is used directly in some Mesa testing programs.

Parameters:
pid - The PatientID to hold the decoded patient ID
cx - The CX string holding the patient ID to decode

getIdFromCX

public static java.lang.String getIdFromCX(java.lang.String cx)
Gets the ID component from an HL7 CX identifier string.

Parameters:
cx - The CX string holding the ID to decode

getAssigningAuthorityFromCX

public static com.misyshealthcare.connect.net.Identifier getAssigningAuthorityFromCX(java.lang.String cx)
Gets the Assigning Authority component from an HL7 CX identifier string.

Parameters:
cx - The CX string holding the Assigning Authority to decode

getAssigningAuthorityFromCXAuth

public static com.misyshealthcare.connect.net.Identifier getAssigningAuthorityFromCXAuth(java.lang.String aa)
Gets the Assigning Authority component from an HL7 CX identifier Authority string.

Parameters:
aa - The CXAuth string holding the Assigning Authority to decode

toDTM

public static java.lang.String toDTM(java.util.Date date)
Generates a DTM date/time type from a Java date object. The date and time is converted to GMT before formatting.

Parameters:
date - The Java date to format
Returns:
The DTM formatted date/time

fromDTM

public static java.util.Date fromDTM(java.lang.String dtm)
Extracts a Java date object from a DTM date/time type. The date is converted from GMT to the local time zone.

Parameters:
dtm - The HL7 encoded DTM
Returns:
The Java date

toDT

public static java.lang.String toDT(java.util.Date date)
Generates a DT date type from a Java date object. The date is formatted in local time.

Parameters:
date - The Java date to format
Returns:
The DT formatted date

fromDT

public static java.util.Date fromDT(java.lang.String date)
Decodes a DT data type into a Java date object.

Parameters:
date - The DT date string
Returns:
The Java date object

toXAD

public static java.lang.String toXAD(com.misyshealthcare.connect.base.demographicdata.Address address)
Generates an XAD data type from an Address object.

Parameters:
address - The address to format
Returns:
The XAD formatted address string

fromXAD

public static com.misyshealthcare.connect.base.demographicdata.Address fromXAD(java.lang.String xad)
Decodes an HL7 XAD data type into an Address.

Parameters:
xad - The XAD encoded address
Returns:
The decoded address

toXON

public static java.lang.String toXON(java.lang.String institution)
Generates an XON data type from a string.

Parameters:
institution - The string to be formatted
Returns:
The XON formatted string

fromXON

public static java.lang.String fromXON(java.lang.String xon)
Gets the institution string from an HL7 encoded XON.

Parameters:
xon - The XON to decode
Returns:
The institution

toXCN

public static java.lang.String toXCN(com.misyshealthcare.connect.base.clinicaldata.Provider person)
Generates an XCN name data type from a Provider.

Parameters:
person - The person's name to be formatted
Returns:
The XCN formatted name string

fromXCN

public static com.misyshealthcare.connect.base.clinicaldata.Provider fromXCN(java.lang.String xcn)
Extracts a Provide from an HL7 XCN data type.

Parameters:
xcn - The XCN to decode
Returns:
The resulting Provider

toXPN

public static java.lang.String toXPN(PersonName personName)
Generates an XPN name data type from a Patient.

Parameters:
personName - The patient's name to be formatted
Returns:
The XPN formatted name string

fromXPN

public static boolean fromXPN(PersonName personName,
                              java.lang.String xpn)
Decodes an HL7 XPN data type and put the name fields into a PersonName

Parameters:
personName - The PersonName to get the name
xpn - The XPN data type to decode
Returns:
True if the name was decoded

toSex

public static java.lang.String toSex(com.misyshealthcare.connect.base.SharedEnums.SexType sex)
Converts an enum gender value to the coded value used in XDS HL7 PID-8 messages.

Parameters:
sex - The gender enum to convert
Returns:
The XDS HL7 value

fromSex

public static com.misyshealthcare.connect.base.SharedEnums.SexType fromSex(java.lang.String code)
Decodes and HL7 adminstrative sex value into a SexType enum.

Parameters:
code - The adminstrative sex code to decode
Returns:
The gender enum value

getCXid

public static java.lang.String getCXid(java.lang.String input)
Gets the 'id' component from an HL7 CX string.

Parameters:
input - The CX string
Returns:
The 'id' component of the string

getCXauthority

public static java.lang.String getCXauthority(java.lang.String input)
Gets the 'assigning authority' component from an HL7 CX string.

Parameters:
input - The CX string
Returns:
The 'assigning authority' component