001 /*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 */
007
008 package ca.uhn.hl7v2.model.v24.group;
009
010 import ca.uhn.hl7v2.model.v24.segment.*;
011
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.AbstractGroup;
019 import ca.uhn.hl7v2.model.GenericSegment;
020
021 /**
022 * <p>Represents a OMN_O07_ORDER group structure (a Group object).
023 * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
024 * This Group contains the following elements:
025 * </p>
026 * <ul>
027 * <li>1: ORC (Common Order) <b> </b></li>
028 * <li>2: RQD (Requisition Detail) <b> </b></li>
029 * <li>3: RQ1 (Requisition Detail-1) <b>optional </b></li>
030 * <li>4: NTE (Notes and Comments) <b>optional repeating</b></li>
031 * <li>5: OMN_O07_OBSERVATION (a Group object) <b>optional repeating</b></li>
032 * <li>6: BLG (Billing) <b>optional </b></li>
033 * </ul>
034 */
035 public class OMN_O07_ORDER extends AbstractGroup {
036
037 /**
038 * Creates a new OMN_O07_ORDER group
039 */
040 public OMN_O07_ORDER(Group parent, ModelClassFactory factory) {
041 super(parent, factory);
042 init(factory);
043 }
044
045 private void init(ModelClassFactory factory) {
046 try {
047 this.add(ORC.class, true, false);
048 this.add(RQD.class, true, false);
049 this.add(RQ1.class, false, false);
050 this.add(NTE.class, false, true);
051 this.add(OMN_O07_OBSERVATION.class, false, true);
052 this.add(BLG.class, false, false);
053 } catch(HL7Exception e) {
054 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OMN_O07_ORDER - this is probably a bug in the source code generator.", e);
055 }
056 }
057
058 /**
059 * Returns "2.4"
060 */
061 public String getVersion() {
062 return "2.4";
063 }
064
065
066
067 /**
068 * Returns
069 * ORC (Common Order) - creates it if necessary
070 */
071 public ORC getORC() {
072 ORC ret = null;
073 try {
074 ret = (ORC)this.get("ORC");
075 } catch(HL7Exception e) {
076 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
077 throw new RuntimeException(e);
078 }
079 return ret;
080 }
081
082
083
084
085 /**
086 * Returns
087 * RQD (Requisition Detail) - creates it if necessary
088 */
089 public RQD getRQD() {
090 RQD ret = null;
091 try {
092 ret = (RQD)this.get("RQD");
093 } catch(HL7Exception e) {
094 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
095 throw new RuntimeException(e);
096 }
097 return ret;
098 }
099
100
101
102
103 /**
104 * Returns
105 * RQ1 (Requisition Detail-1) - creates it if necessary
106 */
107 public RQ1 getRQ1() {
108 RQ1 ret = null;
109 try {
110 ret = (RQ1)this.get("RQ1");
111 } catch(HL7Exception e) {
112 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
113 throw new RuntimeException(e);
114 }
115 return ret;
116 }
117
118
119
120
121 /**
122 * Returns
123 * the first repetition of
124 * NTE (Notes and Comments) - creates it if necessary
125 */
126 public NTE getNTE() {
127 NTE ret = null;
128 try {
129 ret = (NTE)this.get("NTE");
130 } catch(HL7Exception e) {
131 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
132 throw new RuntimeException(e);
133 }
134 return ret;
135 }
136
137
138 /**
139 * Returns a specific repetition of
140 * NTE (Notes and Comments) - creates it if necessary
141 *
142 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
143 * @throws HL7Exception if the repetition requested is more than one
144 * greater than the number of existing repetitions.
145 */
146 public NTE getNTE(int rep) {
147 NTE ret = null;
148 try {
149 ret = (NTE)this.get("NTE", rep);
150 } catch(HL7Exception e) {
151 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
152 throw new RuntimeException(e);
153 }
154 return ret;
155 }
156
157 /**
158 * Returns the number of existing repetitions of NTE
159 */
160 public int getNTEReps() {
161 int reps = -1;
162 try {
163 reps = this.getAll("NTE").length;
164 } catch (HL7Exception e) {
165 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
166 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
167 throw new RuntimeException(message);
168 }
169 return reps;
170 }
171
172 /**
173 * Inserts a specific repetition of NTE (Notes and Comments)
174 * @see AbstractGroup#insertRepetition(Structure, int)
175 */
176 public void insertNTE(NTE structure, int rep) throws HL7Exception {
177 super.insertRepetition("NTE", structure, rep);
178 }
179
180
181 /**
182 * Inserts a specific repetition of NTE (Notes and Comments)
183 * @see AbstractGroup#insertRepetition(Structure, int)
184 */
185 public NTE insertNTE(int rep) throws HL7Exception {
186 return (NTE)super.insertRepetition("NTE", rep);
187 }
188
189
190 /**
191 * Removes a specific repetition of NTE (Notes and Comments)
192 * @see AbstractGroup#removeRepetition(String, int)
193 */
194 public NTE removeNTE(int rep) throws HL7Exception {
195 return (NTE)super.removeRepetition("NTE", rep);
196 }
197
198
199
200 /**
201 * Returns
202 * the first repetition of
203 * OBSERVATION (a Group object) - creates it if necessary
204 */
205 public OMN_O07_OBSERVATION getOBSERVATION() {
206 OMN_O07_OBSERVATION ret = null;
207 try {
208 ret = (OMN_O07_OBSERVATION)this.get("OBSERVATION");
209 } catch(HL7Exception e) {
210 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
211 throw new RuntimeException(e);
212 }
213 return ret;
214 }
215
216
217 /**
218 * Returns a specific repetition of
219 * OBSERVATION (a Group object) - creates it if necessary
220 *
221 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
222 * @throws HL7Exception if the repetition requested is more than one
223 * greater than the number of existing repetitions.
224 */
225 public OMN_O07_OBSERVATION getOBSERVATION(int rep) {
226 OMN_O07_OBSERVATION ret = null;
227 try {
228 ret = (OMN_O07_OBSERVATION)this.get("OBSERVATION", rep);
229 } catch(HL7Exception e) {
230 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
231 throw new RuntimeException(e);
232 }
233 return ret;
234 }
235
236 /**
237 * Returns the number of existing repetitions of OBSERVATION
238 */
239 public int getOBSERVATIONReps() {
240 int reps = -1;
241 try {
242 reps = this.getAll("OBSERVATION").length;
243 } catch (HL7Exception e) {
244 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
245 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
246 throw new RuntimeException(message);
247 }
248 return reps;
249 }
250
251 /**
252 * Inserts a specific repetition of OBSERVATION (a Group object)
253 * @see AbstractGroup#insertRepetition(Structure, int)
254 */
255 public void insertOBSERVATION(OMN_O07_OBSERVATION structure, int rep) throws HL7Exception {
256 super.insertRepetition("OBSERVATION", structure, rep);
257 }
258
259
260 /**
261 * Inserts a specific repetition of OBSERVATION (a Group object)
262 * @see AbstractGroup#insertRepetition(Structure, int)
263 */
264 public OMN_O07_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception {
265 return (OMN_O07_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
266 }
267
268
269 /**
270 * Removes a specific repetition of OBSERVATION (a Group object)
271 * @see AbstractGroup#removeRepetition(String, int)
272 */
273 public OMN_O07_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception {
274 return (OMN_O07_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
275 }
276
277
278
279 /**
280 * Returns
281 * BLG (Billing) - creates it if necessary
282 */
283 public BLG getBLG() {
284 BLG ret = null;
285 try {
286 ret = (BLG)this.get("BLG");
287 } catch(HL7Exception e) {
288 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
289 throw new RuntimeException(e);
290 }
291 return ret;
292 }
293
294
295
296
297 }
298