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 SRM_S01 message structure (see chapter 10.3). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: ARQ (Appointment Request) </li>
///<li>2: APR (Appointment Preferences) optional </li>
///<li>3: NTE (Notes and Comments) optional repeating</li>
///<li>4: SRM_S01_PATIENT (a Group object) </li>
///<li>5: SRM_S01_RESOURCES (a Group object) repeating</li>
///</ol>
///</summary>
[Serializable]
public class SRM_S01 : AbstractMessage {
///<summary>
/// Creates a new SRM_S01 Group with custom IModelClassFactory.
///</summary>
public SRM_S01(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new SRM_S01 Group with DefaultModelClassFactory.
///</summary>
public SRM_S01() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for SRM_S01. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(ARQ), true, false);
this.add(typeof(APR), false, false);
this.add(typeof(NTE), false, true);
this.add(typeof(SRM_S01_PATIENT), true, false);
this.add(typeof(SRM_S01_RESOURCES), true, true);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error creating SRM_S01 - 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 ARQ (Appointment Request) - creates it if necessary
///</summary>
public ARQ ARQ {
get{
ARQ ret = null;
try {
ret = (ARQ)this.GetStructure("ARQ");
} 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 APR (Appointment Preferences) - creates it if necessary
///</summary>
public APR APR {
get{
APR ret = null;
try {
ret = (APR)this.GetStructure("APR");
} 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 SRM_S01_PATIENT (a Group object) - creates it if necessary
///</summary>
public SRM_S01_PATIENT PATIENT {
get{
SRM_S01_PATIENT ret = null;
try {
ret = (SRM_S01_PATIENT)this.GetStructure("PATIENT");
} 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 SRM_S01_RESOURCES (a Group object) - creates it if necessary
///</summary>
public SRM_S01_RESOURCES GetRESOURCES() {
SRM_S01_RESOURCES ret = null;
try {
ret = (SRM_S01_RESOURCES)this.GetStructure("RESOURCES");
} 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 SRM_S01_RESOURCES
/// * (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 SRM_S01_RESOURCES GetRESOURCES(int rep) {
return (SRM_S01_RESOURCES)this.GetStructure("RESOURCES", rep);
}
/**
* Returns the number of existing repetitions of SRM_S01_RESOURCES
*/
public int RESOURCESRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("RESOURCES").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;
}
}
}
}
|