org.eclipse.ohf.ihe.pix.consumer
Class PixConsumerResponse

java.lang.Object
  extended by org.eclipse.ohf.hl7v2.core.utilities.Worker
      extended by org.eclipse.ohf.hl7v2.core.message.model.Node
          extended by org.eclipse.ohf.hl7v2.core.message.model.ModelProvider
              extended by org.eclipse.ohf.hl7v2.core.message.model.Message
                  extended by org.eclipse.ohf.ihe.common.hl7v2.message.PixPdqMessage
                      extended by org.eclipse.ohf.ihe.pix.consumer.PixConsumerResponse
All Implemented Interfaces:
HL7_Constants

public class PixConsumerResponse
extends PixPdqMessage

QBP^Q23 Return Corresponding Identifiers

IHE HL7 Segments: MSH,MSA,[ERR],QAK,QPD,[PID]
IHE HL7 Standard: HL7 2.5

Within PID, only PID-3 (IDs) and PID-5 (Names) are returned.

Author:
Sondra Renly

Field Summary
 
Fields inherited from class org.eclipse.ohf.hl7v2.core.message.model.Node
MODE_TYPE_SEGMENT, NODE_TYPE_COMPONENT, NODE_TYPE_FIELD, NODE_TYPE_LIST, NODE_TYPE_MESSAGE, NODE_TYPE_SUBCOMPONENT
 
Fields inherited from class org.eclipse.ohf.hl7v2.core.utilities.Worker
hecAccepted, hecApplicationError, hecBadField, hecBadMessage, hecBadSegCode, hecConformance, hecDataTypeError, hecDefinitionError, hecDuplicateKey, hecDuplicateMsgId, hecHL7LibraryError, hecInternalError, hecNoDefinitions, hecNoTableValue, hecRecordLocked, hecRequiredField, hecRequiredSeg, hecSequenceError, hecSuperfluousSeg, hecUnknownKey, hecUnsEvntCode, hecUnsMsgType, hecUnsProcID, hecUnsVersion, hecValidationFailed, hecXML
 
Fields inherited from interface org.eclipse.ohf.ihe.common.hl7v2.message.HL7_Constants
DSC, DSC_1, DSC_2, ERR, EVN, EVN_2_1, MRG, MRG_1_1, MRG_1_4_1, MRG_1_4_2, MRG_1_4_3, MSA, MSH, MSH_10, MSH_11_1, MSH_11_1_PRODUCTION, MSH_12, MSH_18_1, MSH_18_1_ASCII, MSH_3_1, MSH_3_1_DEFAULT, MSH_3_2, MSH_3_3, MSH_4_1, MSH_4_1_DEFAULT, MSH_4_2, MSH_4_3, MSH_5_1, MSH_5_1_DEFAULT, MSH_5_2, MSH_5_3, MSH_6_1, MSH_6_1_DEFAULT, MSH_6_2, MSH_6_3, MSH_7, PD1, PID, PID_11_1, PID_11_10, PID_11_2, PID_11_3, PID_11_4, PID_11_5, PID_11_6, PID_11_7, PID_11_8, PID_11_9, PID_13_1, PID_14_1, PID_18_1, PID_18_4_1, PID_18_4_2, PID_18_4_3, PID_3_1, PID_3_4_1, PID_3_4_1_DEFAULT, PID_3_4_2, PID_3_4_2_DEFAULT, PID_3_4_3, PID_3_4_3_DEFAULT, PID_5_1, PID_5_2, PID_5_3, PID_5_4, PID_5_5, PID_5_6, PID_7_1, PID_8, PV1, PV1_2, PV1_2_INPATIENT, PV1_2_OUTPATIENT, QAK, QPD, QPD_1_1, QPD_1_2, QPD_1_3, QPD_1_4, QPD_1_5, QPD_1_6, QPD_2, QPD_3_1, QPD_3_4_1, QPD_3_4_2, QPD_3_4_3, QPD_8_4_1, QPD_8_4_2, QPD_8_4_3, RCP, RCP_1, RCP_1_IMMEDIATE, RCP_2_1, RCP_2_2_1, RCP_2_2_1_RECORDS
 
Constructor Summary
PixConsumerResponse(org.eclipse.ohf.hl7v2.core.message.MessageManager globalFactory)
          Constructs a PIX response message.
 
Method Summary
 java.lang.String getControlId()
          MSA-2 Message Control ID This field contains the message control ID of the message sent by the sending system.
 java.lang.String[] getErrorCode(int segmentIndex)
          ERR-3 HL7 Error Code Identifies the HL7 (communications) error code.
 int getErrorCountByRepeat()
          The number of errors found in the query response using repeats.
 int getErrorCountBySegment()
          The number of errors found in the query response using segments.
 java.lang.String[] getErrorLocation(int segmentIndex, int repeatIndex)
          ERR-2 Error Location Identifies the location in a message related to the identified error, warning or message.
 java.lang.String getErrorSeverity(int segmentIndex, boolean expandString)
          ERR-4 Error Severity Identifies the severity of an application error.
 int getPatientCount()
          The number of patients found in the query response.
 java.lang.String[] getPatientIdentifier(int patientIndex, int identifierIndex)
          PID-3 Patient ID (internal) This field contains the list of identifiers (one or more) used by the healthcare facility to uniquely identify a patient (e.g., medical record number, billing number, birth registry, national unique individual identifier, etc).
 int getPatientIdentifierCount(int patientIndex)
          The number of patient IDs found for a patient in the query response.
 java.lang.String[] getPatientName(int patientIndex, int patientNameIndex)
          PID-5-1 Patient Name This field contains the names of the patient, the primary or legal name of the patient is reported first.
 int getPatientNameCount(int patientIndex)
          PID-5 Patient Name The number of patient names found for a patient in the query response.
 java.lang.String getPatientNameDegree(int patientIndex, int patientNameIndex)
          PID-5-6 Patient Name - Degree
 java.lang.String getPatientNameFamilyName(int patientIndex, int patientNameIndex)
          PID-5-1 Patient Name - Family Name
 java.lang.String getPatientNameGivenName(int patientIndex, int patientNameIndex)
          PID-5-2 Patient Name - Given Name
 java.lang.String getPatientNameOtherName(int patientIndex, int patientNameIndex)
          PID-5-3 Patient Name - Other Name
 java.lang.String getPatientNamePrefix(int patientIndex, int patientNameIndex)
          PID-5-5 Patient Name - Prefix
 java.lang.String getPatientNameSuffix(int patientIndex, int patientNameIndex)
          PID-5-4 Patient Name - Suffix
 java.lang.String[] getQueryName()
          QPD-1 Query Name This field contains the name of the query.
 java.lang.String getQueryStatus(boolean expandString)
          QAK-2 Query Response Status This field may be valued by the initiating system to identify the query, and may be used to match response messages to the originating query.
 java.lang.String getQueryTag()
          QPD-2 Query Tag This field may be valued by the initiating system to identify the query, and may be used to match response messages to the originating query.
 java.lang.String getResponseAckCode(boolean expandString)
          MSA-1 Acknowledgement Code This field contains an acknowledgment code, see message processing rules.
 boolean hasError()
          Response contains 1 or more error segments.
 void init()
          Initialize message after load finished
 
Methods inherited from class org.eclipse.ohf.ihe.common.hl7v2.message.PixPdqMessage
changeDefaultCharacterSet, changeDefaultControlId, changeDefaultProcessEnvironment, changeDefaultReceivingApplication, changeDefaultRecievingFacility, changeDefaultSendingApplication, changeDefaultSendingFacility, getCharacterSet, getMessageControlID, getProcessEnvironment, getReceivingApplication, getReceivingFacility, getSendingApplication, getSendingFacility, setField, setNonNullElement
 
Methods inherited from class org.eclipse.ohf.hl7v2.core.message.model.Message
addMSHFromFields, addMSHFromFields, bindToMSH, clear, clearContent, elementName, equals, forceElement, getDefaultFormat, getDelimiters, getElement, getEvent, getMessageId, getMessageType, getSegments, getStructId, getStructure, hasStructId, resolveVariableTypes, setDefaultFormat, setDelimiters, setEvent, setMessageId, setMessageType, setStructId, testIsElement
 
Methods inherited from class org.eclipse.ohf.hl7v2.core.message.model.ModelProvider
getDefinitions, getVersion, getVersionDefinition, setDefinitions, setVersion
 
Methods inherited from class org.eclipse.ohf.hl7v2.core.message.model.Node
getOwner, hasOwner, isElement, setOwner
 
Methods inherited from class org.eclipse.ohf.hl7v2.core.utilities.Worker
condition
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixConsumerResponse

public PixConsumerResponse(org.eclipse.ohf.hl7v2.core.message.MessageManager globalFactory)
                    throws PixConsumerException
Constructs a PIX response message.

Parameters:
globalFactory - - message manager
Throws:
PixConsumerException
Method Detail

init

public void init()
Initialize message after load finished


hasError

public boolean hasError()
Response contains 1 or more error segments.

Returns:
hasERR

getResponseAckCode

public java.lang.String getResponseAckCode(boolean expandString)
                                    throws PixConsumerException
MSA-1 Acknowledgement Code This field contains an acknowledgment code, see message processing rules. AA Original mode: Application Accept Enhanced mode: Application acknowledgment: Accept AE Original mode: Application Error Enhanced mode: Application acknowledgment: Error AR Original mode: Application Reject Enhanced mode: Application acknowledgment: Reject CA Enhanced mode: Accept acknowledgment: Commit Accept CE Enhanced mode: Accept acknowledgment: Commit Error CR Enhanced mode: Accept acknowledgment: Commit Reject

Parameters:
expandString -
Returns:
Acknowledgement Code (ID)
Throws:
PixConsumerException

getControlId

public java.lang.String getControlId()
                              throws PixConsumerException
MSA-2 Message Control ID This field contains the message control ID of the message sent by the sending system. It allows the sending system to associate this response with the message for which it is intended.

Returns:
ControlID (ST)
Throws:
PixConsumerException

getErrorCountBySegment

public int getErrorCountBySegment()
The number of errors found in the query response using segments.

Returns:
count

getErrorCountByRepeat

public int getErrorCountByRepeat()
The number of errors found in the query response using repeats.

Returns:
count

getErrorLocation

public java.lang.String[] getErrorLocation(int segmentIndex,
                                           int repeatIndex)
                                    throws PixConsumerException
ERR-2 Error Location Identifies the location in a message related to the identified error, warning or message. If multiple repetitions are present, the error results from the values in a combination of places.

Parameters:
segmentIndex - - the segment to use (0 to PixConsumerResponse.getErrorCountBySegment()-1) use 0 for primary if multiple errors reported with repeats rather than different segments
repeatIndex - - the repetition to return (0 to PixConsumerResponse.getErrorCountByRepeat()-1) use 0 for primary if multiple errors reported in different segments rather than by repeat
Returns:
Error Location (ERL) 6 components* String[0] - SegmentID String[1] - SegmentSequence String[2] - FieldPosition String[3] - FieldRepetition String[4] - ComponentNumber String[5] - SubComponentNumber *supports repetitions
Throws:
PixConsumerException

getErrorCode

public java.lang.String[] getErrorCode(int segmentIndex)
                                throws PixConsumerException
ERR-3 HL7 Error Code Identifies the HL7 (communications) error code.

Parameters:
segmentIndex - - the segment to use (0 to PixConsumerResponse.getErrorCountBySegment()-1) use 0 for primary if multiple errors reported with repeats rather than different segments
Returns:
Error Code (CWE) 7 components String[0] - Identifier String[1] - Text String[2] - NameOfCodingSystem String[3] - AlternateIdentifier String[4] - CodingSystemVersionID String[5] - AlternateCodingSystemVersionID String[6] - OriginalText
Throws:
PixConsumerException

getErrorSeverity

public java.lang.String getErrorSeverity(int segmentIndex,
                                         boolean expandString)
                                  throws PixConsumerException
ERR-4 Error Severity Identifies the severity of an application error. Knowing if something is Error, Warning or Information is intrinsic to how an application handles the content. W warning I information E error

Parameters:
segmentIndex - - the segment to use (0 to PixConsumerResponse.getErrorCountBySegment()-1) use 0 for primary if multiple errors reported with repeats rather than different segments
expandString -
Returns:
Error Severity (ID)
Throws:
PixConsumerException

getQueryStatus

public java.lang.String getQueryStatus(boolean expandString)
                                throws PixConsumerException
QAK-2 Query Response Status This field may be valued by the initiating system to identify the query, and may be used to match response messages to the originating query. HL7 Table 0208 - Query Response Status (v2.5) Value Description OK Data found, no errors (this is the default) NF No data found, no errors AE Application error AR Application reject

Parameters:
expandString -
Returns:
Query Status (ID)
Throws:
PixConsumerException

getQueryName

public java.lang.String[] getQueryName()
                                throws PixConsumerException
QPD-1 Query Name This field contains the name of the query.

Returns:
Query Name (CE) 6 components String[0] - Identifier String[1] - Text String[2] - NameOfCodingSystem String[3] - AlternateIdentifier String[4] - AlternateText String[5] - AlternateCodingSystem
Throws:
PixConsumerException

getQueryTag

public java.lang.String getQueryTag()
                             throws PixConsumerException
QPD-2 Query Tag This field may be valued by the initiating system to identify the query, and may be used to match response messages to the originating query.

Returns:
query tag from message
Throws:
PixConsumerException

getPatientCount

public int getPatientCount()
The number of patients found in the query response.

Returns:
count

getPatientIdentifierCount

public int getPatientIdentifierCount(int patientIndex)
                              throws PixConsumerException
The number of patient IDs found for a patient in the query response.

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
Returns:
count of IDs for 1 patient
Throws:
PixConsumerException

getPatientIdentifier

public java.lang.String[] getPatientIdentifier(int patientIndex,
                                               int identifierIndex)
                                        throws PixConsumerException
PID-3 Patient ID (internal) This field contains the list of identifiers (one or more) used by the healthcare facility to uniquely identify a patient (e.g., medical record number, billing number, birth registry, national unique individual identifier, etc).

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
identifierIndex - - the ID to return (0 to PixConsumerResponse.getPatientIdentifierCount()-1)
Returns:
Patient Identifier (CX) reduced to 2 components & subcomponents String[0] - Identifier String[1] - AssigningAuthority namespaceId String[2] - AssigningAuthority universalId String[3] - assigningAuthority universalIdType
Throws:
PixConsumerException

getPatientNameCount

public int getPatientNameCount(int patientIndex)
PID-5 Patient Name The number of patient names found for a patient in the query response.

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
Returns:
count of names for 1 patient
Throws:
PdqConsumerException

getPatientName

public java.lang.String[] getPatientName(int patientIndex,
                                         int patientNameIndex)
                                  throws PixConsumerException
PID-5-1 Patient Name This field contains the names of the patient, the primary or legal name of the patient is reported first.

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Patient Name (XPN) reduced to 6 components String[0] - FamilyName String[1] - GivenName String[2] - MiddleName String[3] - Suffix String[4] - Prefix String[5] - Degree
Throws:
PixConsumerException

getPatientNameFamilyName

public java.lang.String getPatientNameFamilyName(int patientIndex,
                                                 int patientNameIndex)
                                          throws PixConsumerException
PID-5-1 Patient Name - Family Name

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Patient Name Family Name (FN)
Throws:
PixConsumerException

getPatientNameGivenName

public java.lang.String getPatientNameGivenName(int patientIndex,
                                                int patientNameIndex)
                                         throws PixConsumerException
PID-5-2 Patient Name - Given Name

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Patient Name Given Name (ST)
Throws:
PixConsumerException

getPatientNameOtherName

public java.lang.String getPatientNameOtherName(int patientIndex,
                                                int patientNameIndex)
                                         throws PixConsumerException
PID-5-3 Patient Name - Other Name

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Patient Name Second and Further Names (ST)
Throws:
PixConsumerException

getPatientNameSuffix

public java.lang.String getPatientNameSuffix(int patientIndex,
                                             int patientNameIndex)
                                      throws PixConsumerException
PID-5-4 Patient Name - Suffix

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Suffix (ST)
Throws:
PixConsumerException

getPatientNamePrefix

public java.lang.String getPatientNamePrefix(int patientIndex,
                                             int patientNameIndex)
                                      throws PixConsumerException
PID-5-5 Patient Name - Prefix

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Prefix (ST)
Throws:
PixConsumerException

getPatientNameDegree

public java.lang.String getPatientNameDegree(int patientIndex,
                                             int patientNameIndex)
                                      throws PixConsumerException
PID-5-6 Patient Name - Degree

Parameters:
patientIndex - - the patient to use (0 to PixConsumerResponse.getPatientCount()-1)
patientNameIndex - - the name to return (0 to PixConsumerResponse.getPatientNameCount()-1) the primary or legal name of the patient is reported first
Returns:
Degree (IS)
Throws:
PixConsumerException