ca.uhn.hl7v2.model.v21.segment.OBX 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.v21.segment;
// import ca.uhn.hl7v2.model.v21.group.*;
import ca.uhn.hl7v2.model.v21.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 OBX message segment (RESULT).
* This segment has the following fields:
*
* - OBX-1: SET ID - OBSERVATION SIMPLE (SI) optional
*
- OBX-2: VALUE TYPE (ID) optional
*
- OBX-3: OBSERVATION IDENTIFIER (CE)
*
- OBX-4: OBSERVATION SUB-ID (NM) optional
*
- OBX-5: OBSERVATION RESULTS (Varies)
*
- OBX-6: UNITS (ID) optional
*
- OBX-7: REFERENCES RANGE (ST) optional
*
- OBX-8: ABNORMAL FLAGS (ST) optional repeating
*
- OBX-9: PROBABILITY (NM) optional
*
- OBX-10: NATURE OF ABNORMAL TEST (ID) optional
*
- OBX-11: OBSERV RESULT STATUS (ID) optional
*
- OBX-12: DATE LAST OBS NORMAL VALUES (TS) optional
*
*/
public class OBX extends AbstractSegment {
/**
* Creates a new OBX segment
*/
public OBX(Group parent, ModelClassFactory factory) {
super(parent, factory);
init(factory);
}
private void init(ModelClassFactory factory) {
try {
this.add(SI.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "SET ID - OBSERVATION SIMPLE");
this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "VALUE TYPE");
this.add(CE.class, true, 1, 80, new Object[]{ getMessage(), new Integer(0) }, "OBSERVATION IDENTIFIER");
this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "OBSERVATION SUB-ID");
this.add(Varies.class, true, 1, 65, new Object[]{ getMessage(), new Integer(0) }, "OBSERVATION RESULTS");
this.add(ID.class, false, 1, 20, new Object[]{ getMessage() }, "UNITS");
this.add(ST.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "REFERENCES RANGE");
this.add(ST.class, false, 5, 10, new Object[]{ getMessage(), new Integer(78) }, "ABNORMAL FLAGS");
this.add(NM.class, false, 1, 5, new Object[]{ getMessage(), new Integer(0) }, "PROBABILITY");
this.add(ID.class, false, 1, 5, new Object[]{ getMessage() }, "NATURE OF ABNORMAL TEST");
this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "OBSERV RESULT STATUS");
this.add(TS.class, false, 1, 19, new Object[]{ getMessage(), new Integer(0) }, "DATE LAST OBS NORMAL VALUES");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
}
}
/**
* Returns
* OBX-1: "SET ID - OBSERVATION SIMPLE" - creates it if necessary
*/
public SI getSETIDOBSERVATIONSIMPLE() {
SI ret = null;
try {
Type t = this.getField(1, 0);
ret = (SI)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
* OBX-1: "SET ID - OBSERVATION SIMPLE" - creates it if necessary
*/
public SI getObx1_SETIDOBSERVATIONSIMPLE() {
SI ret = null;
try {
Type t = this.getField(1, 0);
ret = (SI)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
* OBX-2: "VALUE TYPE" - creates it if necessary
*/
public ID getVALUETYPE() {
ID ret = null;
try {
Type t = this.getField(2, 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
* OBX-2: "VALUE TYPE" - creates it if necessary
*/
public ID getObx2_VALUETYPE() {
ID ret = null;
try {
Type t = this.getField(2, 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
* OBX-3: "OBSERVATION IDENTIFIER" - creates it if necessary
*/
public CE getOBSERVATIONIDENTIFIER() {
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
* OBX-3: "OBSERVATION IDENTIFIER" - creates it if necessary
*/
public CE getObx3_OBSERVATIONIDENTIFIER() {
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
* OBX-4: "OBSERVATION SUB-ID" - creates it if necessary
*/
public NM getOBSERVATIONSUBID() {
NM ret = null;
try {
Type t = this.getField(4, 0);
ret = (NM)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
* OBX-4: "OBSERVATION SUB-ID" - creates it if necessary
*/
public NM getObx4_OBSERVATIONSUBID() {
NM ret = null;
try {
Type t = this.getField(4, 0);
ret = (NM)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
* OBX-5: "OBSERVATION RESULTS" - creates it if necessary
*/
public Varies getOBSERVATIONRESULTS() {
Varies ret = null;
try {
Type t = this.getField(5, 0);
ret = (Varies)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
* OBX-5: "OBSERVATION RESULTS" - creates it if necessary
*/
public Varies getObx5_OBSERVATIONRESULTS() {
Varies ret = null;
try {
Type t = this.getField(5, 0);
ret = (Varies)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
* OBX-6: "UNITS" - creates it if necessary
*/
public ID getUNITS() {
ID ret = null;
try {
Type t = this.getField(6, 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
* OBX-6: "UNITS" - creates it if necessary
*/
public ID getObx6_UNITS() {
ID ret = null;
try {
Type t = this.getField(6, 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
* OBX-7: "REFERENCES RANGE" - creates it if necessary
*/
public ST getREFERENCESRANGE() {
ST ret = null;
try {
Type t = this.getField(7, 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
* OBX-7: "REFERENCES RANGE" - creates it if necessary
*/
public ST getObx7_REFERENCESRANGE() {
ST ret = null;
try {
Type t = this.getField(7, 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 all repetitions of ABNORMAL FLAGS (OBX-8).
*/
public ST[] getABNORMALFLAGS() {
ST[] ret = null;
try {
Type[] t = this.getField(8);
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 ABNORMAL FLAGS (OBX-8).
* This method does not create a repetition, so if no repetitions have currently been defined or accessed,
* it will return zero.
*/
public int getABNORMALFLAGSReps() {
ST[] ret = null;
try {
Type[] t = this.getField(8);
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
* OBX-8: "ABNORMAL FLAGS" - creates it if necessary
*
* @param rep The repetition index (0-indexed)
*/
public ST getABNORMALFLAGS(int rep) {
ST ret = null;
try {
Type t = this.getField(8, 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
* OBX-8: "ABNORMAL FLAGS" - creates it if necessary
*
* @param rep The repetition index (0-indexed)
*/
public ST getObx8_ABNORMALFLAGS(int rep) {
ST ret = null;
try {
Type t = this.getField(8, 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 ABNORMAL FLAGS (OBX-8).
* This method does not create a repetition, so if no repetitions have currently been defined or accessed,
* it will return zero.
*/
public int getObx8_ABNORMALFLAGSReps() {
ST[] ret = null;
try {
Type[] t = this.getField(8);
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
* OBX-8: "ABNORMAL FLAGS" 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 insertABNORMALFLAGS(int rep) throws HL7Exception {
return (ST) super.insertRepetition(8, rep);
}
/**
* Inserts a repetition of
* OBX-8: "ABNORMAL FLAGS" 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 insertObx8_ABNORMALFLAGS(int rep) throws HL7Exception {
return (ST) super.insertRepetition(8, rep);
}
/**
* Removes a repetition of
* OBX-8: "ABNORMAL FLAGS" 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 removeABNORMALFLAGS(int rep) throws HL7Exception {
return (ST) super.removeRepetition(8, rep);
}
/**
* Removes a repetition of
* OBX-8: "ABNORMAL FLAGS" 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 removeObx8_ABNORMALFLAGS(int rep) throws HL7Exception {
return (ST) super.removeRepetition(8, rep);
}
/**
* Returns
* OBX-9: "PROBABILITY" - creates it if necessary
*/
public NM getPROBABILITY() {
NM ret = null;
try {
Type t = this.getField(9, 0);
ret = (NM)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
* OBX-9: "PROBABILITY" - creates it if necessary
*/
public NM getObx9_PROBABILITY() {
NM ret = null;
try {
Type t = this.getField(9, 0);
ret = (NM)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
* OBX-10: "NATURE OF ABNORMAL TEST" - creates it if necessary
*/
public ID getNATUREOFABNORMALTEST() {
ID ret = null;
try {
Type t = this.getField(10, 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
* OBX-10: "NATURE OF ABNORMAL TEST" - creates it if necessary
*/
public ID getObx10_NATUREOFABNORMALTEST() {
ID ret = null;
try {
Type t = this.getField(10, 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
* OBX-11: "OBSERV RESULT STATUS" - creates it if necessary
*/
public ID getOBSERVRESULTSTATUS() {
ID ret = null;
try {
Type t = this.getField(11, 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
* OBX-11: "OBSERV RESULT STATUS" - creates it if necessary
*/
public ID getObx11_OBSERVRESULTSTATUS() {
ID ret = null;
try {
Type t = this.getField(11, 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
* OBX-12: "DATE LAST OBS NORMAL VALUES" - creates it if necessary
*/
public TS getDATELASTOBSNORMALVALUES() {
TS ret = null;
try {
Type t = this.getField(12, 0);
ret = (TS)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
* OBX-12: "DATE LAST OBS NORMAL VALUES" - creates it if necessary
*/
public TS getObx12_DATELASTOBSNORMALVALUES() {
TS ret = null;
try {
Type t = this.getField(12, 0);
ret = (TS)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 SI(getMessage());
case 1: return new ID(getMessage(), new Integer( 125 ));
case 2: return new CE(getMessage());
case 3: return new NM(getMessage());
case 4: return new Varies(getMessage());
case 5: return new ID(getMessage(), new Integer( 0 ));
case 6: return new ST(getMessage());
case 7: return new ST(getMessage());
case 8: return new NM(getMessage());
case 9: return new ID(getMessage(), new Integer( 80 ));
case 10: return new ID(getMessage(), new Integer( 85 ));
case 11: return new TS(getMessage());
default: return null;
}
}
}