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 ORR_O02_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: OBR (Observation Request) <b> </b></li>
029 * <li>3: RQD (Requisition Detail) <b> </b></li>
030 * <li>4: RQ1 (Requisition Detail-1) <b> </b></li>
031 * <li>5: RXO (Pharmacy/Treatment Order) <b> </b></li>
032 * <li>6: ODS (Dietary Orders, Supplements, and Preferences) <b> </b></li>
033 * <li>7: ODT (Diet Tray Instructions) <b> </b></li>
034 * <li>8: NTE (Notes and Comments) <b>optional repeating</b></li>
035 * <li>9: CTI (Clinical Trial Identification) <b>optional repeating</b></li>
036 * </ul>
037 */
038 public class ORR_O02_ORDER extends AbstractGroup {
039
040 /**
041 * Creates a new ORR_O02_ORDER group
042 */
043 public ORR_O02_ORDER(Group parent, ModelClassFactory factory) {
044 super(parent, factory);
045 init(factory);
046 }
047
048 private void init(ModelClassFactory factory) {
049 try {
050 this.add(ORC.class, true, false);
051 this.add(OBR.class, true, false);
052 this.add(RQD.class, true, false);
053 this.add(RQ1.class, true, false);
054 this.add(RXO.class, true, false);
055 this.add(ODS.class, true, false);
056 this.add(ODT.class, true, false);
057 this.add(NTE.class, false, true);
058 this.add(CTI.class, false, true);
059 } catch(HL7Exception e) {
060 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORR_O02_ORDER - this is probably a bug in the source code generator.", e);
061 }
062 }
063
064 /**
065 * Returns "2.4"
066 */
067 public String getVersion() {
068 return "2.4";
069 }
070
071
072
073 /**
074 * Returns
075 * ORC (Common Order) - creates it if necessary
076 */
077 public ORC getORC() {
078 ORC ret = null;
079 try {
080 ret = (ORC)this.get("ORC");
081 } catch(HL7Exception e) {
082 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
083 throw new RuntimeException(e);
084 }
085 return ret;
086 }
087
088
089
090
091 /**
092 * Returns
093 * OBR (Observation Request) - creates it if necessary
094 */
095 public OBR getOBR() {
096 OBR ret = null;
097 try {
098 ret = (OBR)this.get("OBR");
099 } catch(HL7Exception e) {
100 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
101 throw new RuntimeException(e);
102 }
103 return ret;
104 }
105
106
107
108
109 /**
110 * Returns
111 * RQD (Requisition Detail) - creates it if necessary
112 */
113 public RQD getRQD() {
114 RQD ret = null;
115 try {
116 ret = (RQD)this.get("RQD");
117 } catch(HL7Exception e) {
118 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
119 throw new RuntimeException(e);
120 }
121 return ret;
122 }
123
124
125
126
127 /**
128 * Returns
129 * RQ1 (Requisition Detail-1) - creates it if necessary
130 */
131 public RQ1 getRQ1() {
132 RQ1 ret = null;
133 try {
134 ret = (RQ1)this.get("RQ1");
135 } catch(HL7Exception e) {
136 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
137 throw new RuntimeException(e);
138 }
139 return ret;
140 }
141
142
143
144
145 /**
146 * Returns
147 * RXO (Pharmacy/Treatment Order) - creates it if necessary
148 */
149 public RXO getRXO() {
150 RXO ret = null;
151 try {
152 ret = (RXO)this.get("RXO");
153 } catch(HL7Exception e) {
154 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
155 throw new RuntimeException(e);
156 }
157 return ret;
158 }
159
160
161
162
163 /**
164 * Returns
165 * ODS (Dietary Orders, Supplements, and Preferences) - creates it if necessary
166 */
167 public ODS getODS() {
168 ODS ret = null;
169 try {
170 ret = (ODS)this.get("ODS");
171 } catch(HL7Exception e) {
172 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
173 throw new RuntimeException(e);
174 }
175 return ret;
176 }
177
178
179
180
181 /**
182 * Returns
183 * ODT (Diet Tray Instructions) - creates it if necessary
184 */
185 public ODT getODT() {
186 ODT ret = null;
187 try {
188 ret = (ODT)this.get("ODT");
189 } catch(HL7Exception e) {
190 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
191 throw new RuntimeException(e);
192 }
193 return ret;
194 }
195
196
197
198
199 /**
200 * Returns
201 * the first repetition of
202 * NTE (Notes and Comments) - creates it if necessary
203 */
204 public NTE getNTE() {
205 NTE ret = null;
206 try {
207 ret = (NTE)this.get("NTE");
208 } catch(HL7Exception e) {
209 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
210 throw new RuntimeException(e);
211 }
212 return ret;
213 }
214
215
216 /**
217 * Returns a specific repetition of
218 * NTE (Notes and Comments) - creates it if necessary
219 *
220 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
221 * @throws HL7Exception if the repetition requested is more than one
222 * greater than the number of existing repetitions.
223 */
224 public NTE getNTE(int rep) {
225 NTE ret = null;
226 try {
227 ret = (NTE)this.get("NTE", rep);
228 } catch(HL7Exception e) {
229 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
230 throw new RuntimeException(e);
231 }
232 return ret;
233 }
234
235 /**
236 * Returns the number of existing repetitions of NTE
237 */
238 public int getNTEReps() {
239 int reps = -1;
240 try {
241 reps = this.getAll("NTE").length;
242 } catch (HL7Exception e) {
243 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
244 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
245 throw new RuntimeException(message);
246 }
247 return reps;
248 }
249
250 /**
251 * Inserts a specific repetition of NTE (Notes and Comments)
252 * @see AbstractGroup#insertRepetition(Structure, int)
253 */
254 public void insertNTE(NTE structure, int rep) throws HL7Exception {
255 super.insertRepetition("NTE", structure, rep);
256 }
257
258
259 /**
260 * Inserts a specific repetition of NTE (Notes and Comments)
261 * @see AbstractGroup#insertRepetition(Structure, int)
262 */
263 public NTE insertNTE(int rep) throws HL7Exception {
264 return (NTE)super.insertRepetition("NTE", rep);
265 }
266
267
268 /**
269 * Removes a specific repetition of NTE (Notes and Comments)
270 * @see AbstractGroup#removeRepetition(String, int)
271 */
272 public NTE removeNTE(int rep) throws HL7Exception {
273 return (NTE)super.removeRepetition("NTE", rep);
274 }
275
276
277
278 /**
279 * Returns
280 * the first repetition of
281 * CTI (Clinical Trial Identification) - creates it if necessary
282 */
283 public CTI getCTI() {
284 CTI ret = null;
285 try {
286 ret = (CTI)this.get("CTI");
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 * Returns a specific repetition of
297 * CTI (Clinical Trial Identification) - creates it if necessary
298 *
299 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
300 * @throws HL7Exception if the repetition requested is more than one
301 * greater than the number of existing repetitions.
302 */
303 public CTI getCTI(int rep) {
304 CTI ret = null;
305 try {
306 ret = (CTI)this.get("CTI", rep);
307 } catch(HL7Exception e) {
308 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
309 throw new RuntimeException(e);
310 }
311 return ret;
312 }
313
314 /**
315 * Returns the number of existing repetitions of CTI
316 */
317 public int getCTIReps() {
318 int reps = -1;
319 try {
320 reps = this.getAll("CTI").length;
321 } catch (HL7Exception e) {
322 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
323 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
324 throw new RuntimeException(message);
325 }
326 return reps;
327 }
328
329 /**
330 * Inserts a specific repetition of CTI (Clinical Trial Identification)
331 * @see AbstractGroup#insertRepetition(Structure, int)
332 */
333 public void insertCTI(CTI structure, int rep) throws HL7Exception {
334 super.insertRepetition("CTI", structure, rep);
335 }
336
337
338 /**
339 * Inserts a specific repetition of CTI (Clinical Trial Identification)
340 * @see AbstractGroup#insertRepetition(Structure, int)
341 */
342 public CTI insertCTI(int rep) throws HL7Exception {
343 return (CTI)super.insertRepetition("CTI", rep);
344 }
345
346
347 /**
348 * Removes a specific repetition of CTI (Clinical Trial Identification)
349 * @see AbstractGroup#removeRepetition(String, int)
350 */
351 public CTI removeCTI(int rep) throws HL7Exception {
352 return (CTI)super.removeRepetition("CTI", rep);
353 }
354
355
356
357 }
358