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 BPO message segment.
/// This segment has the following fields:<ol>
///<li>BPO-1: Set ID - BPO (SI)</li>
///<li>BPO-2: BP Universal Service ID (CWE)</li>
///<li>BPO-3: BP Processing Requirements (CWE)</li>
///<li>BPO-4: BP Quantity (NM)</li>
///<li>BPO-5: BP Amount (NM)</li>
///<li>BPO-6: BP Units (CE)</li>
///<li>BPO-7: BP Intended Use Date/Time (TS)</li>
///<li>BPO-8: BP Intended Dispense From Location (PL)</li>
///<li>BPO-9: BP Intended Dispense From Address (XAD)</li>
///<li>BPO-10: BP Requested Dispense Date/Time (TS)</li>
///<li>BPO-11: BP Requested Dispense To Location (PL)</li>
///<li>BPO-12: BP Requested Dispense To Address (XAD)</li>
///<li>BPO-13: BP Indication for Use (CWE)</li>
///<li>BPO-14: BP Informed Consent Indicator (ID)</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 BPO : AbstractSegment {
/**
* Creates a BPO (Blood product order) segment object that belongs to the given
* message.
*/
public BPO(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(SI), true, 1, 4, new System.Object[]{message}, "Set ID - BPO");
this.add(typeof(CWE), true, 1, 250, new System.Object[]{message}, "BP Universal Service ID");
this.add(typeof(CWE), false, 0, 250, new System.Object[]{message}, "BP Processing Requirements");
this.add(typeof(NM), true, 1, 5, new System.Object[]{message}, "BP Quantity");
this.add(typeof(NM), false, 1, 5, new System.Object[]{message}, "BP Amount");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "BP Units");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "BP Intended Use Date/Time");
this.add(typeof(PL), false, 1, 80, new System.Object[]{message}, "BP Intended Dispense From Location");
this.add(typeof(XAD), false, 1, 250, new System.Object[]{message}, "BP Intended Dispense From Address");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "BP Requested Dispense Date/Time");
this.add(typeof(PL), false, 1, 80, new System.Object[]{message}, "BP Requested Dispense To Location");
this.add(typeof(XAD), false, 1, 250, new System.Object[]{message}, "BP Requested Dispense To Address");
this.add(typeof(CWE), false, 0, 250, new System.Object[]{message}, "BP Indication for Use");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 136}, "BP Informed Consent Indicator");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Set ID - BPO(BPO-1).
///</summary>
public SI SetIDBPO
{
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 BP Universal Service ID(BPO-2).
///</summary>
public CWE BPUniversalServiceID
{
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 a single repetition of BP Processing Requirements(BPO-3).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CWE GetBPProcessingRequirements(int rep)
{
CWE ret = null;
try
{
IType t = this.GetField(3, rep);
ret = (CWE)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 BP Processing Requirements (BPO-3).
///</summary>
public CWE[] GetBPProcessingRequirements() {
CWE[] ret = null;
try {
IType[] t = this.GetField(3);
ret = new CWE[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (CWE)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 BP Processing Requirements (BPO-3).
///</summary>
public int BPProcessingRequirementsRepetitionsUsed
{
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 BP Quantity(BPO-4).
///</summary>
public NM BPQuantity
{
get{
NM ret = null;
try
{
IType t = this.GetField(4, 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 BP Amount(BPO-5).
///</summary>
public NM BPAmount
{
get{
NM ret = null;
try
{
IType t = this.GetField(5, 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 BP Units(BPO-6).
///</summary>
public CE BPUnits
{
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 BP Intended Use Date/Time(BPO-7).
///</summary>
public TS BPIntendedUseDateTime
{
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 BP Intended Dispense From Location(BPO-8).
///</summary>
public PL BPIntendedDispenseFromLocation
{
get{
PL ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (PL)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 BP Intended Dispense From Address(BPO-9).
///</summary>
public XAD BPIntendedDispenseFromAddress
{
get{
XAD ret = null;
try
{
IType t = this.GetField(9, 0);
ret = (XAD)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 BP Requested Dispense Date/Time(BPO-10).
///</summary>
public TS BPRequestedDispenseDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(10, 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 BP Requested Dispense To Location(BPO-11).
///</summary>
public PL BPRequestedDispenseToLocation
{
get{
PL ret = null;
try
{
IType t = this.GetField(11, 0);
ret = (PL)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 BP Requested Dispense To Address(BPO-12).
///</summary>
public XAD BPRequestedDispenseToAddress
{
get{
XAD ret = null;
try
{
IType t = this.GetField(12, 0);
ret = (XAD)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 BP Indication for Use(BPO-13).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CWE GetBPIndicationForUse(int rep)
{
CWE ret = null;
try
{
IType t = this.GetField(13, rep);
ret = (CWE)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 BP Indication for Use (BPO-13).
///</summary>
public CWE[] GetBPIndicationForUse() {
CWE[] ret = null;
try {
IType[] t = this.GetField(13);
ret = new CWE[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (CWE)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 BP Indication for Use (BPO-13).
///</summary>
public int BPIndicationForUseRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(13);
}
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 BP Informed Consent Indicator(BPO-14).
///</summary>
public ID BPInformedConsentIndicator
{
get{
ID ret = null;
try
{
IType t = this.GetField(14, 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;
}
}
}}
|