ca.uhn.hl7v2.model.v22.segment.PV2 Maven / Gradle / Ivy
/*
* This class is an auto-generated source file for a HAPI
* HL7 v2.x standard structure class.
*
* For more information, visit: http://hl7api.sourceforge.net/
*/
package ca.uhn.hl7v2.model.v22.segment;
// import ca.uhn.hl7v2.model.v22.group.*;
import ca.uhn.hl7v2.model.v22.datatype.*;
import ca.uhn.log.HapiLogFactory;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
import ca.uhn.hl7v2.model.AbstractMessage;
import ca.uhn.hl7v2.model.Group;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.AbstractSegment;
import ca.uhn.hl7v2.model.Varies;
/**
*Represents an HL7 PV2 message segment (PATIENT VISIT - additional information).
* This segment has the following fields:
*
* - PV2-1: Prior Pending Location (CM_INTERNAL_LOCATION) optional
*
- PV2-2: Accommodation Code (CE) optional
*
- PV2-3: Admit Reason (CE) optional
*
- PV2-4: Transfer Reason (CE) optional
*
- PV2-5: Patient Valuables (ST) optional repeating
*
- PV2-6: Patient Valuables Location (ST) optional
*
- PV2-7: Visit User Code (ID) optional
*
- PV2-8: Expected Admit Date (DT) optional
*
- PV2-9: Expected Discharge Date (DT) optional
*
*/
public class PV2 extends AbstractSegment {
/**
* Creates a new PV2 segment
*/
public PV2(Group parent, ModelClassFactory factory) {
super(parent, factory);
init(factory);
}
private void init(ModelClassFactory factory) {
try {
this.add(CM_INTERNAL_LOCATION.class, false, 1, 12, new Object[]{ getMessage(), new Integer(0) }, "Prior Pending Location");
this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(129) }, "Accommodation Code");
this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Admit Reason");
this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Transfer Reason");
this.add(ST.class, false, 0, 25, new Object[]{ getMessage(), new Integer(0) }, "Patient Valuables");
this.add(ST.class, false, 1, 25, new Object[]{ getMessage(), new Integer(0) }, "Patient Valuables Location");
this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "Visit User Code");
this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Expected Admit Date");
this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Expected Discharge Date");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PV2 - this is probably a bug in the source code generator.", e);
}
}
/**
* Returns
* PV2-1: "Prior Pending Location" - creates it if necessary
*/
public CM_INTERNAL_LOCATION getPriorPendingLocation() {
CM_INTERNAL_LOCATION ret = null;
try {
Type t = this.getField(1, 0);
ret = (CM_INTERNAL_LOCATION)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-1: "Prior Pending Location" - creates it if necessary
*/
public CM_INTERNAL_LOCATION getPv21_PriorPendingLocation() {
CM_INTERNAL_LOCATION ret = null;
try {
Type t = this.getField(1, 0);
ret = (CM_INTERNAL_LOCATION)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-2: "Accommodation Code" - creates it if necessary
*/
public CE getAccommodationCode() {
CE ret = null;
try {
Type t = this.getField(2, 0);
ret = (CE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-2: "Accommodation Code" - creates it if necessary
*/
public CE getPv22_AccommodationCode() {
CE ret = null;
try {
Type t = this.getField(2, 0);
ret = (CE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-3: "Admit Reason" - creates it if necessary
*/
public CE getAdmitReason() {
CE ret = null;
try {
Type t = this.getField(3, 0);
ret = (CE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-3: "Admit Reason" - creates it if necessary
*/
public CE getPv23_AdmitReason() {
CE ret = null;
try {
Type t = this.getField(3, 0);
ret = (CE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-4: "Transfer Reason" - creates it if necessary
*/
public CE getTransferReason() {
CE ret = null;
try {
Type t = this.getField(4, 0);
ret = (CE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-4: "Transfer Reason" - creates it if necessary
*/
public CE getPv24_TransferReason() {
CE ret = null;
try {
Type t = this.getField(4, 0);
ret = (CE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns all repetitions of Patient Valuables (PV2-5).
*/
public ST[] getPatientValuables() {
ST[] ret = null;
try {
Type[] t = this.getField(5);
ret = new ST[t.length];
for (int i = 0; i < ret.length; i++) {
ret[i] = (ST)t[i];
}
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns a count of the current number of repetitions of Patient Valuables (PV2-5).
* This method does not create a repetition, so if no repetitions have currently been defined or accessed,
* it will return zero.
*/
public int getPatientValuablesReps() {
ST[] ret = null;
try {
Type[] t = this.getField(5);
return t.length;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
}
/**
* Returns a specific repetition of
* PV2-5: "Patient Valuables" - creates it if necessary
*
* @param rep The repetition index (0-indexed)
*/
public ST getPatientValuables(int rep) {
ST ret = null;
try {
Type t = this.getField(5, rep);
ret = (ST)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns a specific repetition of
* PV2-5: "Patient Valuables" - creates it if necessary
*
* @param rep The repetition index (0-indexed)
*/
public ST getPv25_PatientValuables(int rep) {
ST ret = null;
try {
Type t = this.getField(5, rep);
ret = (ST)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns a count of the current number of repetitions of Patient Valuables (PV2-5).
* This method does not create a repetition, so if no repetitions have currently been defined or accessed,
* it will return zero.
*/
public int getPv25_PatientValuablesReps() {
ST[] ret = null;
try {
Type[] t = this.getField(5);
return t.length;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
}
/**
* Inserts a repetition of
* PV2-5: "Patient Valuables" at a specific index
*
* @param rep The repetition index (0-indexed)
* @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
*/
public ST insertPatientValuables(int rep) throws HL7Exception {
return (ST) super.insertRepetition(5, rep);
}
/**
* Inserts a repetition of
* PV2-5: "Patient Valuables" at a specific index
*
* @param rep The repetition index (0-indexed)
* @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
*/
public ST insertPv25_PatientValuables(int rep) throws HL7Exception {
return (ST) super.insertRepetition(5, rep);
}
/**
* Removes a repetition of
* PV2-5: "Patient Valuables" at a specific index
*
* @param rep The repetition index (0-indexed)
* @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
*/
public ST removePatientValuables(int rep) throws HL7Exception {
return (ST) super.removeRepetition(5, rep);
}
/**
* Removes a repetition of
* PV2-5: "Patient Valuables" at a specific index
*
* @param rep The repetition index (0-indexed)
* @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
*/
public ST removePv25_PatientValuables(int rep) throws HL7Exception {
return (ST) super.removeRepetition(5, rep);
}
/**
* Returns
* PV2-6: "Patient Valuables Location" - creates it if necessary
*/
public ST getPatientValuablesLocation() {
ST ret = null;
try {
Type t = this.getField(6, 0);
ret = (ST)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-6: "Patient Valuables Location" - creates it if necessary
*/
public ST getPv26_PatientValuablesLocation() {
ST ret = null;
try {
Type t = this.getField(6, 0);
ret = (ST)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-7: "Visit User Code" - creates it if necessary
*/
public ID getVisitUserCode() {
ID ret = null;
try {
Type t = this.getField(7, 0);
ret = (ID)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-7: "Visit User Code" - creates it if necessary
*/
public ID getPv27_VisitUserCode() {
ID ret = null;
try {
Type t = this.getField(7, 0);
ret = (ID)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-8: "Expected Admit Date" - creates it if necessary
*/
public DT getExpectedAdmitDate() {
DT ret = null;
try {
Type t = this.getField(8, 0);
ret = (DT)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-8: "Expected Admit Date" - creates it if necessary
*/
public DT getPv28_ExpectedAdmitDate() {
DT ret = null;
try {
Type t = this.getField(8, 0);
ret = (DT)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-9: "Expected Discharge Date" - creates it if necessary
*/
public DT getExpectedDischargeDate() {
DT ret = null;
try {
Type t = this.getField(9, 0);
ret = (DT)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* PV2-9: "Expected Discharge Date" - creates it if necessary
*/
public DT getPv29_ExpectedDischargeDate() {
DT ret = null;
try {
Type t = this.getField(9, 0);
ret = (DT)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/** {@inheritDoc} */
protected Type createNewTypeWithoutReflection(int field) {
switch (field) {
case 0: return new CM_INTERNAL_LOCATION(getMessage());
case 1: return new CE(getMessage());
case 2: return new CE(getMessage());
case 3: return new CE(getMessage());
case 4: return new ST(getMessage());
case 5: return new ST(getMessage());
case 6: return new ID(getMessage(), new Integer( 130 ));
case 7: return new DT(getMessage());
case 8: return new DT(getMessage());
default: return null;
}
}
}