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 AIL message segment.
/// This segment has the following fields:<ol>
///<li>AIL-1: Set ID - AIL (SI)</li>
///<li>AIL-2: Segment Action Code (ID)</li>
///<li>AIL-3: Location Resource ID (PL)</li>
///<li>AIL-4: Location Type-AIL (CE)</li>
///<li>AIL-5: Location Group (CE)</li>
///<li>AIL-6: Start Date/Time (TS)</li>
///<li>AIL-7: Start Date/Time Offset (NM)</li>
///<li>AIL-8: Start Date/Time Offset Units (CE)</li>
///<li>AIL-9: Duration (NM)</li>
///<li>AIL-10: Duration Units (CE)</li>
///<li>AIL-11: Allow Substitution Code (IS)</li>
///<li>AIL-12: 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 AIL : AbstractSegment {
/**
* Creates a AIL (Appointment Information - Location Resource) segment object that belongs to the given
* message.
*/
public AIL(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(SI), true, 1, 4, new System.Object[]{message}, "Set ID - AIL");
this.add(typeof(ID), false, 1, 3, new System.Object[]{message, 206}, "Segment Action Code");
this.add(typeof(PL), false, 0, 80, new System.Object[]{message}, "Location Resource ID");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Location Type-AIL");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Location Group");
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 - AIL(AIL-1).
///</summary>
public SI SetIDAIL
{
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(AIL-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 a single repetition of Location Resource ID(AIL-3).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public PL GetLocationResourceID(int rep)
{
PL ret = null;
try
{
IType t = this.GetField(3, rep);
ret = (PL)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 Location Resource ID (AIL-3).
///</summary>
public PL[] GetLocationResourceID() {
PL[] ret = null;
try {
IType[] t = this.GetField(3);
ret = new PL[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (PL)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 Location Resource ID (AIL-3).
///</summary>
public int LocationResourceIDRepetitionsUsed
{
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 Location Type-AIL(AIL-4).
///</summary>
public CE LocationTypeAIL
{
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 Location Group(AIL-5).
///</summary>
public CE LocationGroup
{
get{
CE ret = null;
try
{
IType t = this.GetField(5, 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(AIL-6).
///</summary>
public TS StartDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(6, 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(AIL-7).
///</summary>
public NM StartDateTimeOffset
{
get{
NM ret = null;
try
{
IType t = this.GetField(7, 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(AIL-8).
///</summary>
public CE StartDateTimeOffsetUnits
{
get{
CE ret = null;
try
{
IType t = this.GetField(8, 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(AIL-9).
///</summary>
public NM Duration
{
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 Duration Units(AIL-10).
///</summary>
public CE DurationUnits
{
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 Allow Substitution Code(AIL-11).
///</summary>
public IS AllowSubstitutionCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(11, 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(AIL-12).
///</summary>
public CE FillerStatusCode
{
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;
}
}
}}
|