using System;
using NHapi.Base.Log;
using NHapi.Model.V251.Group;
using NHapi.Model.V251.Segment;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
namespace NHapi.Model.V251.Message{
///<summary>
/// Represents a ORU_R30 message structure (see chapter 7.3.4). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: SFT (Software Segment) optional repeating</li>
///<li>2: PID (Patient Identification) </li>
///<li>3: PD1 (Patient Additional Demographic) optional </li>
///<li>4: ORU_R30_VISIT (a Group object) optional </li>
///<li>5: ORC (Common Order) </li>
///<li>6: OBR (Observation Request) </li>
///<li>7: NTE (Notes and Comments) optional repeating</li>
///<li>8: ORU_R30_TIMING_QTY (a Group object) </li>
///<li>9: ORU_R30_OBSERVATION (a Group object) repeating</li>
///</ol>
///</summary>
[Serializable]
public class ORU_R30 : AbstractMessage {
///<summary>
/// Creates a new ORU_R30 Group with custom IModelClassFactory.
///</summary>
public ORU_R30(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new ORU_R30 Group with DefaultModelClassFactory.
///</summary>
public ORU_R30() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for ORU_R30. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(SFT), false, true);
this.add(typeof(PID), true, false);
this.add(typeof(PD1), false, false);
this.add(typeof(ORU_R30_VISIT), false, false);
this.add(typeof(ORC), true, false);
this.add(typeof(OBR), true, false);
this.add(typeof(NTE), false, true);
this.add(typeof(ORU_R30_TIMING_QTY), true, false);
this.add(typeof(ORU_R30_OBSERVATION), true, true);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error creating ORU_R30 - this is probably a bug in the source code generator.", e);
}
}
///<summary>
/// Returns MSH (Message Header) - creates it if necessary
///</summary>
public MSH MSH {
get{
MSH ret = null;
try {
ret = (MSH)this.GetStructure("MSH");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of SFT (Software Segment) - creates it if necessary
///</summary>
public SFT GetSFT() {
SFT ret = null;
try {
ret = (SFT)this.GetStructure("SFT");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of SFT
/// * (Software Segment) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public SFT GetSFT(int rep) {
return (SFT)this.GetStructure("SFT", rep);
}
/**
* Returns the number of existing repetitions of SFT
*/
public int SFTRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("SFT").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.getHapiLog(GetType()).error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
///<summary>
/// Returns PID (Patient Identification) - creates it if necessary
///</summary>
public PID PID {
get{
PID ret = null;
try {
ret = (PID)this.GetStructure("PID");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns PD1 (Patient Additional Demographic) - creates it if necessary
///</summary>
public PD1 PD1 {
get{
PD1 ret = null;
try {
ret = (PD1)this.GetStructure("PD1");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns ORU_R30_VISIT (a Group object) - creates it if necessary
///</summary>
public ORU_R30_VISIT VISIT {
get{
ORU_R30_VISIT ret = null;
try {
ret = (ORU_R30_VISIT)this.GetStructure("VISIT");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns ORC (Common Order) - creates it if necessary
///</summary>
public ORC ORC {
get{
ORC ret = null;
try {
ret = (ORC)this.GetStructure("ORC");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns OBR (Observation Request) - creates it if necessary
///</summary>
public OBR OBR {
get{
OBR ret = null;
try {
ret = (OBR)this.GetStructure("OBR");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of NTE (Notes and Comments) - creates it if necessary
///</summary>
public NTE GetNTE() {
NTE ret = null;
try {
ret = (NTE)this.GetStructure("NTE");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of NTE
/// * (Notes and Comments) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public NTE GetNTE(int rep) {
return (NTE)this.GetStructure("NTE", rep);
}
/**
* Returns the number of existing repetitions of NTE
*/
public int NTERepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("NTE").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.getHapiLog(GetType()).error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
///<summary>
/// Returns ORU_R30_TIMING_QTY (a Group object) - creates it if necessary
///</summary>
public ORU_R30_TIMING_QTY TIMING_QTY {
get{
ORU_R30_TIMING_QTY ret = null;
try {
ret = (ORU_R30_TIMING_QTY)this.GetStructure("TIMING_QTY");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of ORU_R30_OBSERVATION (a Group object) - creates it if necessary
///</summary>
public ORU_R30_OBSERVATION GetOBSERVATION() {
ORU_R30_OBSERVATION ret = null;
try {
ret = (ORU_R30_OBSERVATION)this.GetStructure("OBSERVATION");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of ORU_R30_OBSERVATION
/// * (a Group object) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public ORU_R30_OBSERVATION GetOBSERVATION(int rep) {
return (ORU_R30_OBSERVATION)this.GetStructure("OBSERVATION", rep);
}
/**
* Returns the number of existing repetitions of ORU_R30_OBSERVATION
*/
public int OBSERVATIONRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("OBSERVATION").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.getHapiLog(GetType()).error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
}
}
|