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 ORM_O01_ORDER_DETAIL 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: OBR (Observation Request) <b> </b></li>
028                     * <li>2: RQD (Requisition Detail) <b> </b></li>
029                     * <li>3: RQ1 (Requisition Detail-1) <b> </b></li>
030                     * <li>4: RXO (Pharmacy/Treatment Order) <b> </b></li>
031                     * <li>5: ODS (Dietary Orders, Supplements, and Preferences) <b> </b></li>
032                     * <li>6: ODT (Diet Tray Instructions) <b> </b></li>
033                     * <li>7: NTE (Notes and Comments) <b>optional repeating</b></li>
034                     * <li>8: CTD (Contact Data) <b>optional </b></li>
035                     * <li>9: DG1 (Diagnosis) <b>optional repeating</b></li>
036                     * <li>10: ORM_O01_OBSERVATION (a Group object) <b>optional repeating</b></li>
037     * </ul>
038     */
039    public class ORM_O01_ORDER_DETAIL extends AbstractGroup {
040    
041        /** 
042         * Creates a new ORM_O01_ORDER_DETAIL group
043         */
044        public ORM_O01_ORDER_DETAIL(Group parent, ModelClassFactory factory) {
045           super(parent, factory);
046           init(factory);
047        }
048    
049        private void init(ModelClassFactory factory) {
050           try {
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(CTD.class, false, false);
059                              this.add(DG1.class, false, true);
060                              this.add(ORM_O01_OBSERVATION.class, false, true);
061           } catch(HL7Exception e) {
062              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORM_O01_ORDER_DETAIL - this is probably a bug in the source code generator.", e);
063           }
064        }
065    
066        /** 
067         * Returns "2.4"
068         */
069        public String getVersion() {
070           return "2.4";
071        }
072    
073    
074    
075        /**
076         * Returns
077         * OBR (Observation Request) - creates it if necessary
078         */
079        public OBR getOBR() { 
080           OBR ret = null;
081           try {
082              ret = (OBR)this.get("OBR");
083           } catch(HL7Exception e) {
084              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
085              throw new RuntimeException(e);
086           }
087           return ret;
088        }
089    
090    
091    
092    
093        /**
094         * Returns
095         * RQD (Requisition Detail) - creates it if necessary
096         */
097        public RQD getRQD() { 
098           RQD ret = null;
099           try {
100              ret = (RQD)this.get("RQD");
101           } catch(HL7Exception e) {
102              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
103              throw new RuntimeException(e);
104           }
105           return ret;
106        }
107    
108    
109    
110    
111        /**
112         * Returns
113         * RQ1 (Requisition Detail-1) - creates it if necessary
114         */
115        public RQ1 getRQ1() { 
116           RQ1 ret = null;
117           try {
118              ret = (RQ1)this.get("RQ1");
119           } catch(HL7Exception e) {
120              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
121              throw new RuntimeException(e);
122           }
123           return ret;
124        }
125    
126    
127    
128    
129        /**
130         * Returns
131         * RXO (Pharmacy/Treatment Order) - creates it if necessary
132         */
133        public RXO getRXO() { 
134           RXO ret = null;
135           try {
136              ret = (RXO)this.get("RXO");
137           } catch(HL7Exception e) {
138              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
139              throw new RuntimeException(e);
140           }
141           return ret;
142        }
143    
144    
145    
146    
147        /**
148         * Returns
149         * ODS (Dietary Orders, Supplements, and Preferences) - creates it if necessary
150         */
151        public ODS getODS() { 
152           ODS ret = null;
153           try {
154              ret = (ODS)this.get("ODS");
155           } catch(HL7Exception e) {
156              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
157              throw new RuntimeException(e);
158           }
159           return ret;
160        }
161    
162    
163    
164    
165        /**
166         * Returns
167         * ODT (Diet Tray Instructions) - creates it if necessary
168         */
169        public ODT getODT() { 
170           ODT ret = null;
171           try {
172              ret = (ODT)this.get("ODT");
173           } catch(HL7Exception e) {
174              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
175              throw new RuntimeException(e);
176           }
177           return ret;
178        }
179    
180    
181    
182    
183        /**
184         * Returns
185         * the first repetition of 
186         * NTE (Notes and Comments) - creates it if necessary
187         */
188        public NTE getNTE() { 
189           NTE ret = null;
190           try {
191              ret = (NTE)this.get("NTE");
192           } catch(HL7Exception e) {
193              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
194              throw new RuntimeException(e);
195           }
196           return ret;
197        }
198    
199    
200        /**
201         * Returns a specific repetition of
202         * NTE (Notes and Comments) - creates it if necessary
203         *
204         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
205         * @throws HL7Exception if the repetition requested is more than one 
206         *     greater than the number of existing repetitions.
207         */
208        public NTE getNTE(int rep) { 
209           NTE ret = null;
210           try {
211              ret = (NTE)this.get("NTE", rep);
212           } catch(HL7Exception e) {
213              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
214              throw new RuntimeException(e);
215           }
216           return ret;
217        }
218    
219        /** 
220         * Returns the number of existing repetitions of NTE 
221         */ 
222        public int getNTEReps() { 
223            int reps = -1; 
224            try { 
225                reps = this.getAll("NTE").length; 
226            } catch (HL7Exception e) { 
227                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
228                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
229                throw new RuntimeException(message);
230            } 
231            return reps; 
232        } 
233    
234        /**
235         * Inserts a specific repetition of NTE (Notes and Comments)
236         * @see AbstractGroup#insertRepetition(Structure, int) 
237         */
238        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
239           super.insertRepetition("NTE", structure, rep);
240        }
241    
242    
243        /**
244         * Inserts a specific repetition of NTE (Notes and Comments)
245         * @see AbstractGroup#insertRepetition(Structure, int) 
246         */
247        public NTE insertNTE(int rep) throws HL7Exception { 
248           return (NTE)super.insertRepetition("NTE", rep);
249        }
250    
251    
252        /**
253         * Removes a specific repetition of NTE (Notes and Comments)
254         * @see AbstractGroup#removeRepetition(String, int) 
255         */
256        public NTE removeNTE(int rep) throws HL7Exception { 
257           return (NTE)super.removeRepetition("NTE", rep);
258        }
259    
260    
261    
262        /**
263         * Returns
264         * CTD (Contact Data) - creates it if necessary
265         */
266        public CTD getCTD() { 
267           CTD ret = null;
268           try {
269              ret = (CTD)this.get("CTD");
270           } catch(HL7Exception e) {
271              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
272              throw new RuntimeException(e);
273           }
274           return ret;
275        }
276    
277    
278    
279    
280        /**
281         * Returns
282         * the first repetition of 
283         * DG1 (Diagnosis) - creates it if necessary
284         */
285        public DG1 getDG1() { 
286           DG1 ret = null;
287           try {
288              ret = (DG1)this.get("DG1");
289           } catch(HL7Exception e) {
290              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
291              throw new RuntimeException(e);
292           }
293           return ret;
294        }
295    
296    
297        /**
298         * Returns a specific repetition of
299         * DG1 (Diagnosis) - creates it if necessary
300         *
301         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
302         * @throws HL7Exception if the repetition requested is more than one 
303         *     greater than the number of existing repetitions.
304         */
305        public DG1 getDG1(int rep) { 
306           DG1 ret = null;
307           try {
308              ret = (DG1)this.get("DG1", rep);
309           } catch(HL7Exception e) {
310              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
311              throw new RuntimeException(e);
312           }
313           return ret;
314        }
315    
316        /** 
317         * Returns the number of existing repetitions of DG1 
318         */ 
319        public int getDG1Reps() { 
320            int reps = -1; 
321            try { 
322                reps = this.getAll("DG1").length; 
323            } catch (HL7Exception e) { 
324                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
325                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
326                throw new RuntimeException(message);
327            } 
328            return reps; 
329        } 
330    
331        /**
332         * Inserts a specific repetition of DG1 (Diagnosis)
333         * @see AbstractGroup#insertRepetition(Structure, int) 
334         */
335        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
336           super.insertRepetition("DG1", structure, rep);
337        }
338    
339    
340        /**
341         * Inserts a specific repetition of DG1 (Diagnosis)
342         * @see AbstractGroup#insertRepetition(Structure, int) 
343         */
344        public DG1 insertDG1(int rep) throws HL7Exception { 
345           return (DG1)super.insertRepetition("DG1", rep);
346        }
347    
348    
349        /**
350         * Removes a specific repetition of DG1 (Diagnosis)
351         * @see AbstractGroup#removeRepetition(String, int) 
352         */
353        public DG1 removeDG1(int rep) throws HL7Exception { 
354           return (DG1)super.removeRepetition("DG1", rep);
355        }
356    
357    
358    
359        /**
360         * Returns
361         * the first repetition of 
362         * OBSERVATION (a Group object) - creates it if necessary
363         */
364        public ORM_O01_OBSERVATION getOBSERVATION() { 
365           ORM_O01_OBSERVATION ret = null;
366           try {
367              ret = (ORM_O01_OBSERVATION)this.get("OBSERVATION");
368           } catch(HL7Exception e) {
369              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
370              throw new RuntimeException(e);
371           }
372           return ret;
373        }
374    
375    
376        /**
377         * Returns a specific repetition of
378         * OBSERVATION (a Group object) - creates it if necessary
379         *
380         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
381         * @throws HL7Exception if the repetition requested is more than one 
382         *     greater than the number of existing repetitions.
383         */
384        public ORM_O01_OBSERVATION getOBSERVATION(int rep) { 
385           ORM_O01_OBSERVATION ret = null;
386           try {
387              ret = (ORM_O01_OBSERVATION)this.get("OBSERVATION", rep);
388           } catch(HL7Exception e) {
389              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
390              throw new RuntimeException(e);
391           }
392           return ret;
393        }
394    
395        /** 
396         * Returns the number of existing repetitions of OBSERVATION 
397         */ 
398        public int getOBSERVATIONReps() { 
399            int reps = -1; 
400            try { 
401                reps = this.getAll("OBSERVATION").length; 
402            } catch (HL7Exception e) { 
403                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
404                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
405                throw new RuntimeException(message);
406            } 
407            return reps; 
408        } 
409    
410        /**
411         * Inserts a specific repetition of OBSERVATION (a Group object)
412         * @see AbstractGroup#insertRepetition(Structure, int) 
413         */
414        public void insertOBSERVATION(ORM_O01_OBSERVATION structure, int rep) throws HL7Exception { 
415           super.insertRepetition("OBSERVATION", structure, rep);
416        }
417    
418    
419        /**
420         * Inserts a specific repetition of OBSERVATION (a Group object)
421         * @see AbstractGroup#insertRepetition(Structure, int) 
422         */
423        public ORM_O01_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception { 
424           return (ORM_O01_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
425        }
426    
427    
428        /**
429         * Removes a specific repetition of OBSERVATION (a Group object)
430         * @see AbstractGroup#removeRepetition(String, int) 
431         */
432        public ORM_O01_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception { 
433           return (ORM_O01_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
434        }
435    
436    
437    
438    }
439