using System;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
using NHapi.Model.V251.Datatype;
using NHapi.Base.Log;
namespace NHapi.Model.V251.Segment{
///<summary>
/// Represents an HL7 TQ2 message segment.
/// This segment has the following fields:<ol>
///<li>TQ2-1: Set ID - TQ2 (SI)</li>
///<li>TQ2-2: Sequence/Results Flag (ID)</li>
///<li>TQ2-3: Related Placer Number (EI)</li>
///<li>TQ2-4: Related Filler Number (EI)</li>
///<li>TQ2-5: Related Placer Group Number (EI)</li>
///<li>TQ2-6: Sequence Condition Code (ID)</li>
///<li>TQ2-7: Cyclic Entry/Exit Indicator (ID)</li>
///<li>TQ2-8: Sequence Condition Time Interval (CQ)</li>
///<li>TQ2-9: Cyclic Group Maximum Number of Repeats (NM)</li>
///<li>TQ2-10: Special Service Request Relationship (ID)</li>
///</ol>
/// The get...() methods return data from individual fields. These methods
/// do not throw exceptions and may therefore have to handle exceptions internally.
/// If an exception is handled internally, it is logged and null is returned.
/// This is not expected to happen - if it does happen this indicates not so much
/// an exceptional circumstance as a bug in the code for this class.
///</summary>
[Serializable]
public class TQ2 : AbstractSegment {
/**
* Creates a TQ2 (Timing/Quantity Relationship) segment object that belongs to the given
* message.
*/
public TQ2(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(SI), false, 1, 4, new System.Object[]{message}, "Set ID - TQ2");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 503}, "Sequence/Results Flag");
this.add(typeof(EI), false, 0, 22, new System.Object[]{message}, "Related Placer Number");
this.add(typeof(EI), false, 0, 22, new System.Object[]{message}, "Related Filler Number");
this.add(typeof(EI), false, 0, 22, new System.Object[]{message}, "Related Placer Group Number");
this.add(typeof(ID), false, 1, 2, new System.Object[]{message, 504}, "Sequence Condition Code");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 505}, "Cyclic Entry/Exit Indicator");
this.add(typeof(CQ), false, 1, 20, new System.Object[]{message}, "Sequence Condition Time Interval");
this.add(typeof(NM), false, 1, 10, new System.Object[]{message}, "Cyclic Group Maximum Number of Repeats");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 506}, "Special Service Request Relationship");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Set ID - TQ2(TQ2-1).
///</summary>
public SI SetIDTQ2
{
get{
SI ret = null;
try
{
IType t = this.GetField(1, 0);
ret = (SI)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Sequence/Results Flag(TQ2-2).
///</summary>
public ID SequenceResultsFlag
{
get{
ID ret = null;
try
{
IType t = this.GetField(2, 0);
ret = (ID)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns a single repetition of Related Placer Number(TQ2-3).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public EI GetRelatedPlacerNumber(int rep)
{
EI ret = null;
try
{
IType t = this.GetField(3, rep);
ret = (EI)t;
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
///<summary>
/// Returns all repetitions of Related Placer Number (TQ2-3).
///</summary>
public EI[] GetRelatedPlacerNumber() {
EI[] ret = null;
try {
IType[] t = this.GetField(3);
ret = new EI[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (EI)t[i];
}
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
return ret;
}
///<summary>
/// Returns the total repetitions of Related Placer Number (TQ2-3).
///</summary>
public int RelatedPlacerNumberRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(3);
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
///<summary>
/// Returns a single repetition of Related Filler Number(TQ2-4).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public EI GetRelatedFillerNumber(int rep)
{
EI ret = null;
try
{
IType t = this.GetField(4, rep);
ret = (EI)t;
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
///<summary>
/// Returns all repetitions of Related Filler Number (TQ2-4).
///</summary>
public EI[] GetRelatedFillerNumber() {
EI[] ret = null;
try {
IType[] t = this.GetField(4);
ret = new EI[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (EI)t[i];
}
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
return ret;
}
///<summary>
/// Returns the total repetitions of Related Filler Number (TQ2-4).
///</summary>
public int RelatedFillerNumberRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(4);
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
///<summary>
/// Returns a single repetition of Related Placer Group Number(TQ2-5).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public EI GetRelatedPlacerGroupNumber(int rep)
{
EI ret = null;
try
{
IType t = this.GetField(5, rep);
ret = (EI)t;
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
///<summary>
/// Returns all repetitions of Related Placer Group Number (TQ2-5).
///</summary>
public EI[] GetRelatedPlacerGroupNumber() {
EI[] ret = null;
try {
IType[] t = this.GetField(5);
ret = new EI[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (EI)t[i];
}
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
return ret;
}
///<summary>
/// Returns the total repetitions of Related Placer Group Number (TQ2-5).
///</summary>
public int RelatedPlacerGroupNumberRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(5);
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
///<summary>
/// Returns Sequence Condition Code(TQ2-6).
///</summary>
public ID SequenceConditionCode
{
get{
ID ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (ID)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Cyclic Entry/Exit Indicator(TQ2-7).
///</summary>
public ID CyclicEntryExitIndicator
{
get{
ID ret = null;
try
{
IType t = this.GetField(7, 0);
ret = (ID)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Sequence Condition Time Interval(TQ2-8).
///</summary>
public CQ SequenceConditionTimeInterval
{
get{
CQ ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (CQ)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Cyclic Group Maximum Number of Repeats(TQ2-9).
///</summary>
public NM CyclicGroupMaximumNumberOfRepeats
{
get{
NM ret = null;
try
{
IType t = this.GetField(9, 0);
ret = (NM)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Special Service Request Relationship(TQ2-10).
///</summary>
public ID SpecialServiceRequestRelationship
{
get{
ID ret = null;
try
{
IType t = this.GetField(10, 0);
ret = (ID)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
}}
|