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 IIM message segment.
/// This segment has the following fields:<ol>
///<li>IIM-1: Primary Key Value - IIM (CWE)</li>
///<li>IIM-2: Service Item Code (CWE)</li>
///<li>IIM-3: Inventory Lot Number (ST)</li>
///<li>IIM-4: Inventory Expiration Date (TS)</li>
///<li>IIM-5: Inventory Manufacturer Name (CWE)</li>
///<li>IIM-6: Inventory Location (CWE)</li>
///<li>IIM-7: Inventory Received Date (TS)</li>
///<li>IIM-8: Inventory Received Quantity (NM)</li>
///<li>IIM-9: Inventory Received Quantity Unit (CWE)</li>
///<li>IIM-10: Inventory Received Item Cost (MO)</li>
///<li>IIM-11: Inventory On Hand Date (TS)</li>
///<li>IIM-12: Inventory On Hand Quantity (NM)</li>
///<li>IIM-13: Inventory On Hand Quantity Unit (CWE)</li>
///<li>IIM-14: Procedure Code (CE)</li>
///<li>IIM-15: Procedure Code Modifier (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 IIM : AbstractSegment {
/**
* Creates a IIM (Inventory Item Master) segment object that belongs to the given
* message.
*/
public IIM(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(CWE), true, 1, 250, new System.Object[]{message}, "Primary Key Value - IIM");
this.add(typeof(CWE), true, 1, 250, new System.Object[]{message}, "Service Item Code");
this.add(typeof(ST), false, 1, 250, new System.Object[]{message}, "Inventory Lot Number");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Inventory Expiration Date");
this.add(typeof(CWE), false, 1, 250, new System.Object[]{message}, "Inventory Manufacturer Name");
this.add(typeof(CWE), false, 1, 250, new System.Object[]{message}, "Inventory Location");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Inventory Received Date");
this.add(typeof(NM), false, 1, 12, new System.Object[]{message}, "Inventory Received Quantity");
this.add(typeof(CWE), false, 1, 250, new System.Object[]{message}, "Inventory Received Quantity Unit");
this.add(typeof(MO), false, 1, 12, new System.Object[]{message}, "Inventory Received Item Cost");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Inventory On Hand Date");
this.add(typeof(NM), false, 1, 12, new System.Object[]{message}, "Inventory On Hand Quantity");
this.add(typeof(CWE), false, 1, 250, new System.Object[]{message}, "Inventory On Hand Quantity Unit");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Procedure Code");
this.add(typeof(CE), false, 0, 250, new System.Object[]{message}, "Procedure Code Modifier");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Primary Key Value - IIM(IIM-1).
///</summary>
public CWE PrimaryKeyValueIIM
{
get{
CWE ret = null;
try
{
IType t = this.GetField(1, 0);
ret = (CWE)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 Service Item Code(IIM-2).
///</summary>
public CWE ServiceItemCode
{
get{
CWE ret = null;
try
{
IType t = this.GetField(2, 0);
ret = (CWE)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 Inventory Lot Number(IIM-3).
///</summary>
public ST InventoryLotNumber
{
get{
ST ret = null;
try
{
IType t = this.GetField(3, 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 Inventory Expiration Date(IIM-4).
///</summary>
public TS InventoryExpirationDate
{
get{
TS ret = null;
try
{
IType t = this.GetField(4, 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 Inventory Manufacturer Name(IIM-5).
///</summary>
public CWE InventoryManufacturerName
{
get{
CWE ret = null;
try
{
IType t = this.GetField(5, 0);
ret = (CWE)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 Inventory Location(IIM-6).
///</summary>
public CWE InventoryLocation
{
get{
CWE ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (CWE)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 Inventory Received Date(IIM-7).
///</summary>
public TS InventoryReceivedDate
{
get{
TS ret = null;
try
{
IType t = this.GetField(7, 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 Inventory Received Quantity(IIM-8).
///</summary>
public NM InventoryReceivedQuantity
{
get{
NM ret = null;
try
{
IType t = this.GetField(8, 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 Inventory Received Quantity Unit(IIM-9).
///</summary>
public CWE InventoryReceivedQuantityUnit
{
get{
CWE ret = null;
try
{
IType t = this.GetField(9, 0);
ret = (CWE)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 Inventory Received Item Cost(IIM-10).
///</summary>
public MO InventoryReceivedItemCost
{
get{
MO ret = null;
try
{
IType t = this.GetField(10, 0);
ret = (MO)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 Inventory On Hand Date(IIM-11).
///</summary>
public TS InventoryOnHandDate
{
get{
TS ret = null;
try
{
IType t = this.GetField(11, 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 Inventory On Hand Quantity(IIM-12).
///</summary>
public NM InventoryOnHandQuantity
{
get{
NM ret = null;
try
{
IType t = this.GetField(12, 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 Inventory On Hand Quantity Unit(IIM-13).
///</summary>
public CWE InventoryOnHandQuantityUnit
{
get{
CWE ret = null;
try
{
IType t = this.GetField(13, 0);
ret = (CWE)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 Procedure Code(IIM-14).
///</summary>
public CE ProcedureCode
{
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;
}
}
///<summary>
/// Returns a single repetition of Procedure Code Modifier(IIM-15).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CE GetProcedureCodeModifier(int rep)
{
CE ret = null;
try
{
IType t = this.GetField(15, 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 Procedure Code Modifier (IIM-15).
///</summary>
public CE[] GetProcedureCodeModifier() {
CE[] ret = null;
try {
IType[] t = this.GetField(15);
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 Procedure Code Modifier (IIM-15).
///</summary>
public int ProcedureCodeModifierRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(15);
}
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);
}
}
}
}}
|