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 IAM message segment.
/// This segment has the following fields:<ol>
///<li>IAM-1: Set ID - IAM (SI)</li>
///<li>IAM-2: Allergen Type Code (CE)</li>
///<li>IAM-3: Allergen Code/Mnemonic/Description (CE)</li>
///<li>IAM-4: Allergy Severity Code (CE)</li>
///<li>IAM-5: Allergy Reaction Code (ST)</li>
///<li>IAM-6: Allergy Action Code (CNE)</li>
///<li>IAM-7: Allergy Unique Identifier (EI)</li>
///<li>IAM-8: Action Reason (ST)</li>
///<li>IAM-9: Sensitivity to Causative Agent Code (CE)</li>
///<li>IAM-10: Allergen Group Code/Mnemonic/Description (CE)</li>
///<li>IAM-11: Onset Date (DT)</li>
///<li>IAM-12: Onset Date Text (ST)</li>
///<li>IAM-13: Reported Date/Time (TS)</li>
///<li>IAM-14: Reported By (XPN)</li>
///<li>IAM-15: Relationship to Patient Code (CE)</li>
///<li>IAM-16: Alert Device Code (CE)</li>
///<li>IAM-17: Allergy Clinical Status Code (CE)</li>
///<li>IAM-18: Statused by Person (XCN)</li>
///<li>IAM-19: Statused by Organization (XON)</li>
///<li>IAM-20: Statused at Date/Time (TS)</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 IAM : AbstractSegment {
/**
* Creates a IAM (Patient Adverse Reaction Information) segment object that belongs to the given
* message.
*/
public IAM(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(SI), true, 1, 4, new System.Object[]{message}, "Set ID - IAM");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Allergen Type Code");
this.add(typeof(CE), true, 1, 250, new System.Object[]{message}, "Allergen Code/Mnemonic/Description");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Allergy Severity Code");
this.add(typeof(ST), false, 0, 15, new System.Object[]{message}, "Allergy Reaction Code");
this.add(typeof(CNE), true, 1, 250, new System.Object[]{message}, "Allergy Action Code");
this.add(typeof(EI), false, 1, 427, new System.Object[]{message}, "Allergy Unique Identifier");
this.add(typeof(ST), false, 1, 60, new System.Object[]{message}, "Action Reason");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Sensitivity to Causative Agent Code");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Allergen Group Code/Mnemonic/Description");
this.add(typeof(DT), false, 1, 8, new System.Object[]{message}, "Onset Date");
this.add(typeof(ST), false, 1, 60, new System.Object[]{message}, "Onset Date Text");
this.add(typeof(TS), false, 1, 8, new System.Object[]{message}, "Reported Date/Time");
this.add(typeof(XPN), false, 1, 250, new System.Object[]{message}, "Reported By");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Relationship to Patient Code");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Alert Device Code");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Allergy Clinical Status Code");
this.add(typeof(XCN), false, 1, 250, new System.Object[]{message}, "Statused by Person");
this.add(typeof(XON), false, 1, 250, new System.Object[]{message}, "Statused by Organization");
this.add(typeof(TS), false, 1, 8, new System.Object[]{message}, "Statused at Date/Time");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Set ID - IAM(IAM-1).
///</summary>
public SI SetIDIAM
{
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 Allergen Type Code(IAM-2).
///</summary>
public CE AllergenTypeCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(2, 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 Allergen Code/Mnemonic/Description(IAM-3).
///</summary>
public CE AllergenCodeMnemonicDescription
{
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 Allergy Severity Code(IAM-4).
///</summary>
public CE AllergySeverityCode
{
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 Allergy Reaction Code(IAM-5).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ST GetAllergyReactionCode(int rep)
{
ST ret = null;
try
{
IType t = this.GetField(5, rep);
ret = (ST)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 Allergy Reaction Code (IAM-5).
///</summary>
public ST[] GetAllergyReactionCode() {
ST[] ret = null;
try {
IType[] t = this.GetField(5);
ret = new ST[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (ST)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 Allergy Reaction Code (IAM-5).
///</summary>
public int AllergyReactionCodeRepetitionsUsed
{
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 Allergy Action Code(IAM-6).
///</summary>
public CNE AllergyActionCode
{
get{
CNE ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (CNE)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 Allergy Unique Identifier(IAM-7).
///</summary>
public EI AllergyUniqueIdentifier
{
get{
EI ret = null;
try
{
IType t = this.GetField(7, 0);
ret = (EI)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 Action Reason(IAM-8).
///</summary>
public ST ActionReason
{
get{
ST ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (ST)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 Sensitivity to Causative Agent Code(IAM-9).
///</summary>
public CE SensitivityToCausativeAgentCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(9, 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 Allergen Group Code/Mnemonic/Description(IAM-10).
///</summary>
public CE AllergenGroupCodeMnemonicDescription
{
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 Onset Date(IAM-11).
///</summary>
public DT OnsetDate
{
get{
DT ret = null;
try
{
IType t = this.GetField(11, 0);
ret = (DT)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 Onset Date Text(IAM-12).
///</summary>
public ST OnsetDateText
{
get{
ST ret = null;
try
{
IType t = this.GetField(12, 0);
ret = (ST)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 Reported Date/Time(IAM-13).
///</summary>
public TS ReportedDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(13, 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 Reported By(IAM-14).
///</summary>
public XPN ReportedBy
{
get{
XPN ret = null;
try
{
IType t = this.GetField(14, 0);
ret = (XPN)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 Relationship to Patient Code(IAM-15).
///</summary>
public CE RelationshipToPatientCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(15, 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 Alert Device Code(IAM-16).
///</summary>
public CE AlertDeviceCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(16, 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 Allergy Clinical Status Code(IAM-17).
///</summary>
public CE AllergyClinicalStatusCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(17, 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 Statused by Person(IAM-18).
///</summary>
public XCN StatusedByPerson
{
get{
XCN ret = null;
try
{
IType t = this.GetField(18, 0);
ret = (XCN)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 Statused by Organization(IAM-19).
///</summary>
public XON StatusedByOrganization
{
get{
XON ret = null;
try
{
IType t = this.GetField(19, 0);
ret = (XON)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 Statused at Date/Time(IAM-20).
///</summary>
public TS StatusedAtDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(20, 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;
}
}
}}
|