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 QRD message segment.
/// This segment has the following fields:<ol>
///<li>QRD-1: Query Date/Time (TS)</li>
///<li>QRD-2: Query Format Code (ID)</li>
///<li>QRD-3: Query Priority (ID)</li>
///<li>QRD-4: Query ID (ST)</li>
///<li>QRD-5: Deferred Response Type (ID)</li>
///<li>QRD-6: Deferred Response Date/Time (TS)</li>
///<li>QRD-7: Quantity Limited Request (CQ)</li>
///<li>QRD-8: Who Subject Filter (XCN)</li>
///<li>QRD-9: What Subject Filter (CE)</li>
///<li>QRD-10: What Department Data Code (CE)</li>
///<li>QRD-11: What Data Code Value Qual. (VR)</li>
///<li>QRD-12: Query Results Level (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 QRD : AbstractSegment {
/**
* Creates a QRD (Original-Style Query Definition) segment object that belongs to the given
* message.
*/
public QRD(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(TS), true, 1, 26, new System.Object[]{message}, "Query Date/Time");
this.add(typeof(ID), true, 1, 1, new System.Object[]{message, 106}, "Query Format Code");
this.add(typeof(ID), true, 1, 1, new System.Object[]{message, 91}, "Query Priority");
this.add(typeof(ST), true, 1, 10, new System.Object[]{message}, "Query ID");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 107}, "Deferred Response Type");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Deferred Response Date/Time");
this.add(typeof(CQ), true, 1, 10, new System.Object[]{message}, "Quantity Limited Request");
this.add(typeof(XCN), true, 0, 250, new System.Object[]{message}, "Who Subject Filter");
this.add(typeof(CE), true, 0, 250, new System.Object[]{message}, "What Subject Filter");
this.add(typeof(CE), true, 0, 250, new System.Object[]{message}, "What Department Data Code");
this.add(typeof(VR), false, 0, 20, new System.Object[]{message}, "What Data Code Value Qual.");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 108}, "Query Results Level");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Query Date/Time(QRD-1).
///</summary>
public TS QueryDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(1, 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 Query Format Code(QRD-2).
///</summary>
public ID QueryFormatCode
{
get{
ID ret = null;
try
{
IType t = this.GetField(2, 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;
}
}
///<summary>
/// Returns Query Priority(QRD-3).
///</summary>
public ID QueryPriority
{
get{
ID ret = null;
try
{
IType t = this.GetField(3, 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;
}
}
///<summary>
/// Returns Query ID(QRD-4).
///</summary>
public ST QueryID
{
get{
ST ret = null;
try
{
IType t = this.GetField(4, 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 Deferred Response Type(QRD-5).
///</summary>
public ID DeferredResponseType
{
get{
ID ret = null;
try
{
IType t = this.GetField(5, 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;
}
}
///<summary>
/// Returns Deferred Response Date/Time(QRD-6).
///</summary>
public TS DeferredResponseDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(6, 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 Quantity Limited Request(QRD-7).
///</summary>
public CQ QuantityLimitedRequest
{
get{
CQ ret = null;
try
{
IType t = this.GetField(7, 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 a single repetition of Who Subject Filter(QRD-8).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XCN GetWhoSubjectFilter(int rep)
{
XCN ret = null;
try
{
IType t = this.GetField(8, rep);
ret = (XCN)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 Who Subject Filter (QRD-8).
///</summary>
public XCN[] GetWhoSubjectFilter() {
XCN[] ret = null;
try {
IType[] t = this.GetField(8);
ret = new XCN[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XCN)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 Who Subject Filter (QRD-8).
///</summary>
public int WhoSubjectFilterRepetitionsUsed
{
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 a single repetition of What Subject Filter(QRD-9).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CE GetWhatSubjectFilter(int rep)
{
CE ret = null;
try
{
IType t = this.GetField(9, 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 What Subject Filter (QRD-9).
///</summary>
public CE[] GetWhatSubjectFilter() {
CE[] ret = null;
try {
IType[] t = this.GetField(9);
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 What Subject Filter (QRD-9).
///</summary>
public int WhatSubjectFilterRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(9);
}
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 a single repetition of What Department Data Code(QRD-10).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CE GetWhatDepartmentDataCode(int rep)
{
CE ret = null;
try
{
IType t = this.GetField(10, 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 What Department Data Code (QRD-10).
///</summary>
public CE[] GetWhatDepartmentDataCode() {
CE[] ret = null;
try {
IType[] t = this.GetField(10);
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 What Department Data Code (QRD-10).
///</summary>
public int WhatDepartmentDataCodeRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(10);
}
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 a single repetition of What Data Code Value Qual.(QRD-11).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public VR GetWhatDataCodeValueQual(int rep)
{
VR ret = null;
try
{
IType t = this.GetField(11, rep);
ret = (VR)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 What Data Code Value Qual. (QRD-11).
///</summary>
public VR[] GetWhatDataCodeValueQual() {
VR[] ret = null;
try {
IType[] t = this.GetField(11);
ret = new VR[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (VR)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 What Data Code Value Qual. (QRD-11).
///</summary>
public int WhatDataCodeValueQualRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(11);
}
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 Query Results Level(QRD-12).
///</summary>
public ID QueryResultsLevel
{
get{
ID ret = null;
try
{
IType t = this.GetField(12, 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;
}
}
}}
|