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 GP2 message segment.
/// This segment has the following fields:<ol>
///<li>GP2-1: Revenue Code (IS)</li>
///<li>GP2-2: Number of Service Units (NM)</li>
///<li>GP2-3: Charge (CP)</li>
///<li>GP2-4: Reimbursement Action Code (IS)</li>
///<li>GP2-5: Denial or Rejection Code (IS)</li>
///<li>GP2-6: OCE Edit Code (IS)</li>
///<li>GP2-7: Ambulatory Payment Classification Code (CE)</li>
///<li>GP2-8: Modifier Edit Code (IS)</li>
///<li>GP2-9: Payment Adjustment Code (IS)</li>
///<li>GP2-10: Packaging Status Code (IS)</li>
///<li>GP2-11: Expected CMS Payment Amount (CP)</li>
///<li>GP2-12: Reimbursement Type Code (IS)</li>
///<li>GP2-13: Co-Pay Amount (CP)</li>
///<li>GP2-14: Pay Rate per Service Unit (NM)</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 GP2 : AbstractSegment {
/**
* Creates a GP2 (Grouping/Reimbursement - Procedure Line Item) segment object that belongs to the given
* message.
*/
public GP2(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(IS), false, 1, 3, new System.Object[]{message, 456}, "Revenue Code");
this.add(typeof(NM), false, 1, 7, new System.Object[]{message}, "Number of Service Units");
this.add(typeof(CP), false, 1, 12, new System.Object[]{message}, "Charge");
this.add(typeof(IS), false, 1, 1, new System.Object[]{message, 459}, "Reimbursement Action Code");
this.add(typeof(IS), false, 1, 1, new System.Object[]{message, 460}, "Denial or Rejection Code");
this.add(typeof(IS), false, 0, 3, new System.Object[]{message, 458}, "OCE Edit Code");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Ambulatory Payment Classification Code");
this.add(typeof(IS), false, 0, 1, new System.Object[]{message, 467}, "Modifier Edit Code");
this.add(typeof(IS), false, 1, 1, new System.Object[]{message, 468}, "Payment Adjustment Code");
this.add(typeof(IS), false, 1, 1, new System.Object[]{message, 469}, "Packaging Status Code");
this.add(typeof(CP), false, 1, 12, new System.Object[]{message}, "Expected CMS Payment Amount");
this.add(typeof(IS), false, 1, 2, new System.Object[]{message, 470}, "Reimbursement Type Code");
this.add(typeof(CP), false, 1, 12, new System.Object[]{message}, "Co-Pay Amount");
this.add(typeof(NM), false, 1, 4, new System.Object[]{message}, "Pay Rate per Service Unit");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Revenue Code(GP2-1).
///</summary>
public IS RevenueCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(1, 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 Number of Service Units(GP2-2).
///</summary>
public NM NumberOfServiceUnits
{
get{
NM ret = null;
try
{
IType t = this.GetField(2, 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 Charge(GP2-3).
///</summary>
public CP Charge
{
get{
CP ret = null;
try
{
IType t = this.GetField(3, 0);
ret = (CP)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 Reimbursement Action Code(GP2-4).
///</summary>
public IS ReimbursementActionCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(4, 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 Denial or Rejection Code(GP2-5).
///</summary>
public IS DenialOrRejectionCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(5, 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 a single repetition of OCE Edit Code(GP2-6).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public IS GetOCEEditCode(int rep)
{
IS ret = null;
try
{
IType t = this.GetField(6, rep);
ret = (IS)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 OCE Edit Code (GP2-6).
///</summary>
public IS[] GetOCEEditCode() {
IS[] ret = null;
try {
IType[] t = this.GetField(6);
ret = new IS[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (IS)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 OCE Edit Code (GP2-6).
///</summary>
public int OCEEditCodeRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(6);
}
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 Ambulatory Payment Classification Code(GP2-7).
///</summary>
public CE AmbulatoryPaymentClassificationCode
{
get{
CE ret = null;
try
{
IType t = this.GetField(7, 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 Modifier Edit Code(GP2-8).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public IS GetModifierEditCode(int rep)
{
IS ret = null;
try
{
IType t = this.GetField(8, rep);
ret = (IS)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 Modifier Edit Code (GP2-8).
///</summary>
public IS[] GetModifierEditCode() {
IS[] ret = null;
try {
IType[] t = this.GetField(8);
ret = new IS[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (IS)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 Modifier Edit Code (GP2-8).
///</summary>
public int ModifierEditCodeRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(8);
}
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 Payment Adjustment Code(GP2-9).
///</summary>
public IS PaymentAdjustmentCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(9, 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 Packaging Status Code(GP2-10).
///</summary>
public IS PackagingStatusCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(10, 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 Expected CMS Payment Amount(GP2-11).
///</summary>
public CP ExpectedCMSPaymentAmount
{
get{
CP ret = null;
try
{
IType t = this.GetField(11, 0);
ret = (CP)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 Reimbursement Type Code(GP2-12).
///</summary>
public IS ReimbursementTypeCode
{
get{
IS ret = null;
try
{
IType t = this.GetField(12, 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 Co-Pay Amount(GP2-13).
///</summary>
public CP CoPayAmount
{
get{
CP ret = null;
try
{
IType t = this.GetField(13, 0);
ret = (CP)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 Pay Rate per Service Unit(GP2-14).
///</summary>
public NM PayRatePerServiceUnit
{
get{
NM ret = null;
try
{
IType t = this.GetField(14, 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;
}
}
}}
|