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 AIG message segment.
/// This segment has the following fields:<ol>
///<li>AIG-1: Set ID - AIG (SI)</li>
///<li>AIG-2: Segment Action Code (ID)</li>
///<li>AIG-3: Resource ID (CE)</li>
///<li>AIG-4: Resource Type (CE)</li>
///<li>AIG-5: Resource Group (CE)</li>
///<li>AIG-6: Resource Quantity (NM)</li>
///<li>AIG-7: Resource Quantity Units (CE)</li>
///<li>AIG-8: Start Date/Time (TS)</li>
///<li>AIG-9: Start Date/Time Offset (NM)</li>
///<li>AIG-10: Start Date/Time Offset Units (CE)</li>
///<li>AIG-11: Duration (NM)</li>
///<li>AIG-12: Duration Units (CE)</li>
///<li>AIG-13: Allow Substitution Code (IS)</li>
///<li>AIG-14: Filler Status Code (CE)</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 AIG : AbstractSegment {
/**
* Creates a AIG (Appointment Information - General Resource) segment object that belongs to the given
* message.
*/
public AIG(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(SI), true, 1, 4, new System.Object[]{message}, "Set ID - AIG");
this.add(typeof(ID), false, 1, 3, new System.Object[]{message, 206}, "Segment Action Code");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Resource ID");
this.add(typeof(CE), true, 1, 250, new System.Object[]{message}, "Resource Type");
this.add(typeof(CE), false, 0, 250, new System.Object[]{message}, "Resource Group");
this.add(typeof(NM), false, 1, 5, new System.Object[]{message}, "Resource Quantity");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Resource Quantity Units");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Start Date/Time");
this.add(typeof(NM), false, 1, 20, new System.Object[]{message}, "Start Date/Time Offset");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Start Date/Time Offset Units");
this.add(typeof(NM), false, 1, 20, new System.Object[]{message}, "Duration");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Duration Units");
this.add(typeof(IS), false, 1, 10, new System.Object[]{message, 279}, "Allow Substitution Code");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Filler Status Code");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Set ID - AIG(AIG-1).
///</summary>
public SI SetIDAIG
{
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 Segment Action Code(AIG-2).
///</summary>
public ID SegmentActionCode
{
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 Resource ID(AIG-3).
///</summary>
public CE ResourceID
{
get{
CE ret = null;
try
{
IType t = this.GetField(3, 0);
ret = (CE)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 Resource Type(AIG-4).
///</summary>
public CE ResourceType
{
get{
CE ret = null;
try
{
IType t = this.GetField(4, 0);
ret = (CE)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 Resource Group(AIG-5).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CE GetResourceGroup(int rep)
{
CE ret = null;
try
{
IType t = this.GetField(5, rep);
ret = (CE)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 Resource Group (AIG-5).
///</summary>
public CE[] GetResourceGroup() {
CE[] ret = null;
try {
IType[] t = this.GetField(5);
ret = new CE[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (CE)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 Resource Group (AIG-5).
///</summary>
public int ResourceGroupRepetitionsUsed
{
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 Resource Quantity(AIG-6).
///</summary>
public NM ResourceQuantity
{
get{
NM ret = null;
try
{
IType t = this.GetField(6, 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 Resource Quantity Units(AIG-7).
///</summary>
public CE ResourceQuantityUnits
{
get{
CE ret = null;
try
{
IType t = this.GetField(7, 0);
ret = (CE)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 Start Date/Time(AIG-8).
///</summary>
public TS StartDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (TS)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 Start Date/Time Offset(AIG-9).
///</summary>
public NM StartDateTimeOffset
{
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 Start Date/Time Offset Units(AIG-10).
///</summary>
public CE StartDateTimeOffsetUnits
{
get{
CE ret = null;
try
{
IType t = this.GetField(10, 0);
ret = (CE)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 Duration(AIG-11).
///</summary>
public NM Duration
{
get{
NM ret = null;
try
{
IType t = this.GetField(11, 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 Duration Units(AIG-12).
///</summary>
public CE DurationUnits
{
get{
CE ret = null;
try
{
IType t = this.GetField(12, 0);
ret = (CE)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 Allow Substitution Code(AIG-13).
///</summary>
public IS AllowSubstitutionCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(13, 0);
ret = (IS)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 Filler Status Code(AIG-14).
///</summary>
public CE FillerStatusCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(14, 0);
ret = (CE)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;
}
}
}}
|