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 INV message segment.
/// This segment has the following fields:<ol>
///<li>INV-1: Substance Identifier (CE)</li>
///<li>INV-2: Substance Status (CE)</li>
///<li>INV-3: Substance Type (CE)</li>
///<li>INV-4: Inventory Container Identifier (CE)</li>
///<li>INV-5: Container Carrier Identifier (CE)</li>
///<li>INV-6: Position on Carrier (CE)</li>
///<li>INV-7: Initial Quantity (NM)</li>
///<li>INV-8: Current Quantity (NM)</li>
///<li>INV-9: Available Quantity (NM)</li>
///<li>INV-10: Consumption Quantity (NM)</li>
///<li>INV-11: Quantity Units (CE)</li>
///<li>INV-12: Expiration Date/Time (TS)</li>
///<li>INV-13: First Used Date/Time (TS)</li>
///<li>INV-14: On Board Stability Duration (TQ)</li>
///<li>INV-15: Test/Fluid Identifier(s) (CE)</li>
///<li>INV-16: Manufacturer Lot Number (ST)</li>
///<li>INV-17: Manufacturer Identifier (CE)</li>
///<li>INV-18: Supplier Identifier (CE)</li>
///<li>INV-19: On Board Stability Time (CQ)</li>
///<li>INV-20: Target Value (CQ)</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 INV : AbstractSegment {
/**
* Creates a INV (Inventory Detail) segment object that belongs to the given
* message.
*/
public INV(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(CE), true, 1, 250, new System.Object[]{message}, "Substance Identifier");
this.add(typeof(CE), true, 0, 250, new System.Object[]{message}, "Substance Status");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Substance Type");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Inventory Container Identifier");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Container Carrier Identifier");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Position on Carrier");
this.add(typeof(NM), false, 1, 20, new System.Object[]{message}, "Initial Quantity");
this.add(typeof(NM), false, 1, 20, new System.Object[]{message}, "Current Quantity");
this.add(typeof(NM), false, 1, 20, new System.Object[]{message}, "Available Quantity");
this.add(typeof(NM), false, 1, 20, new System.Object[]{message}, "Consumption Quantity");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Quantity Units");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Expiration Date/Time");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "First Used Date/Time");
this.add(typeof(TQ), false, 1, 200, new System.Object[]{message}, "On Board Stability Duration");
this.add(typeof(CE), false, 0, 250, new System.Object[]{message}, "Test/Fluid Identifier(s)");
this.add(typeof(ST), false, 1, 200, new System.Object[]{message}, "Manufacturer Lot Number");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Manufacturer Identifier");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Supplier Identifier");
this.add(typeof(CQ), false, 1, 20, new System.Object[]{message}, "On Board Stability Time");
this.add(typeof(CQ), false, 1, 20, new System.Object[]{message}, "Target Value");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Substance Identifier(INV-1).
///</summary>
public CE SubstanceIdentifier
{
get{
CE ret = null;
try
{
IType t = this.GetField(1, 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 Substance Status(INV-2).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CE GetSubstanceStatus(int rep)
{
CE ret = null;
try
{
IType t = this.GetField(2, 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 Substance Status (INV-2).
///</summary>
public CE[] GetSubstanceStatus() {
CE[] ret = null;
try {
IType[] t = this.GetField(2);
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 Substance Status (INV-2).
///</summary>
public int SubstanceStatusRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(2);
}
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 Substance Type(INV-3).
///</summary>
public CE SubstanceType
{
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 Inventory Container Identifier(INV-4).
///</summary>
public CE InventoryContainerIdentifier
{
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 Container Carrier Identifier(INV-5).
///</summary>
public CE ContainerCarrierIdentifier
{
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 Position on Carrier(INV-6).
///</summary>
public CE PositionOnCarrier
{
get{
CE ret = null;
try
{
IType t = this.GetField(6, 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 Initial Quantity(INV-7).
///</summary>
public NM InitialQuantity
{
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 Current Quantity(INV-8).
///</summary>
public NM CurrentQuantity
{
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 Available Quantity(INV-9).
///</summary>
public NM AvailableQuantity
{
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 Consumption Quantity(INV-10).
///</summary>
public NM ConsumptionQuantity
{
get{
NM ret = null;
try
{
IType t = this.GetField(10, 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 Quantity Units(INV-11).
///</summary>
public CE QuantityUnits
{
get{
CE ret = null;
try
{
IType t = this.GetField(11, 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 Expiration Date/Time(INV-12).
///</summary>
public TS ExpirationDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(12, 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 First Used Date/Time(INV-13).
///</summary>
public TS FirstUsedDateTime
{
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 On Board Stability Duration(INV-14).
///</summary>
public TQ OnBoardStabilityDuration
{
get{
TQ ret = null;
try
{
IType t = this.GetField(14, 0);
ret = (TQ)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 Test/Fluid Identifier(s)(INV-15).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CE GetTestFluidIdentifierS(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 Test/Fluid Identifier(s) (INV-15).
///</summary>
public CE[] GetTestFluidIdentifierS() {
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 Test/Fluid Identifier(s) (INV-15).
///</summary>
public int TestFluidIdentifierSRepetitionsUsed
{
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);
}
}
}
///<summary>
/// Returns Manufacturer Lot Number(INV-16).
///</summary>
public ST ManufacturerLotNumber
{
get{
ST ret = null;
try
{
IType t = this.GetField(16, 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 Manufacturer Identifier(INV-17).
///</summary>
public CE ManufacturerIdentifier
{
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 Supplier Identifier(INV-18).
///</summary>
public CE SupplierIdentifier
{
get{
CE ret = null;
try
{
IType t = this.GetField(18, 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 On Board Stability Time(INV-19).
///</summary>
public CQ OnBoardStabilityTime
{
get{
CQ ret = null;
try
{
IType t = this.GetField(19, 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 Target Value(INV-20).
///</summary>
public CQ TargetValue
{
get{
CQ ret = null;
try
{
IType t = this.GetField(20, 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;
}
}
}}
|