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.message;
009    
010    import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.segment.*;
012    
013    import ca.uhn.log.HapiLogFactory;
014    import ca.uhn.hl7v2.HL7Exception;
015    import ca.uhn.hl7v2.parser.ModelClassFactory;
016    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017    import ca.uhn.hl7v2.model.AbstractMessage;
018    
019    /**
020     * <p>Represents a RCI_I05 message structure (see chapter 11). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (Message Header) <b> </b></li>
024                     * <li>2: MSA (Message Acknowledgment) <b> </b></li>
025                     * <li>3: QRD (Original-Style Query Definition) <b> </b></li>
026                     * <li>4: QRF (Original Style Query Filter) <b>optional </b></li>
027                     * <li>5: RCI_I05_PROVIDER (a Group object) <b> repeating</b></li>
028                     * <li>6: PID (Patient identification) <b> </b></li>
029                     * <li>7: DG1 (Diagnosis) <b>optional repeating</b></li>
030                     * <li>8: DRG (Diagnosis Related Group) <b>optional repeating</b></li>
031                     * <li>9: AL1 (Patient allergy information) <b>optional repeating</b></li>
032                     * <li>10: RCI_I05_OBSERVATION (a Group object) <b>optional repeating</b></li>
033                     * <li>11: NTE (Notes and Comments) <b>optional repeating</b></li>
034     * </ul>
035     */
036    public class RCI_I05 extends AbstractMessage  {
037    
038        /**
039         * Creates a new RCI_I05 message with DefaultModelClassFactory. 
040         */ 
041        public RCI_I05() { 
042           this(new DefaultModelClassFactory());
043        }
044    
045        /** 
046         * Creates a new RCI_I05 message with custom ModelClassFactory.
047         */
048        public RCI_I05(ModelClassFactory factory) {
049           super(factory);
050           init(factory);
051        }
052    
053        private void init(ModelClassFactory factory) {
054           try {
055                              this.add(MSH.class, true, false);
056                              this.add(MSA.class, true, false);
057                              this.add(QRD.class, true, false);
058                              this.add(QRF.class, false, false);
059                              this.add(RCI_I05_PROVIDER.class, true, true);
060                              this.add(PID.class, true, false);
061                              this.add(DG1.class, false, true);
062                              this.add(DRG.class, false, true);
063                              this.add(AL1.class, false, true);
064                              this.add(RCI_I05_OBSERVATION.class, false, true);
065                              this.add(NTE.class, false, true);
066           } catch(HL7Exception e) {
067              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RCI_I05 - this is probably a bug in the source code generator.", e);
068           }
069        }
070    
071        /** 
072         * Returns "2.4"
073         */
074        public String getVersion() {
075           return "2.4";
076        }
077    
078    
079    
080        /**
081         * Returns
082         * MSH (Message Header) - creates it if necessary
083         */
084        public MSH getMSH() { 
085           MSH ret = null;
086           try {
087              ret = (MSH)this.get("MSH");
088           } catch(HL7Exception e) {
089              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
090              throw new RuntimeException(e);
091           }
092           return ret;
093        }
094    
095    
096    
097    
098        /**
099         * Returns
100         * MSA (Message Acknowledgment) - creates it if necessary
101         */
102        public MSA getMSA() { 
103           MSA ret = null;
104           try {
105              ret = (MSA)this.get("MSA");
106           } catch(HL7Exception e) {
107              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
108              throw new RuntimeException(e);
109           }
110           return ret;
111        }
112    
113    
114    
115    
116        /**
117         * Returns
118         * QRD (Original-Style Query Definition) - creates it if necessary
119         */
120        public QRD getQRD() { 
121           QRD ret = null;
122           try {
123              ret = (QRD)this.get("QRD");
124           } catch(HL7Exception e) {
125              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
126              throw new RuntimeException(e);
127           }
128           return ret;
129        }
130    
131    
132    
133    
134        /**
135         * Returns
136         * QRF (Original Style Query Filter) - creates it if necessary
137         */
138        public QRF getQRF() { 
139           QRF ret = null;
140           try {
141              ret = (QRF)this.get("QRF");
142           } catch(HL7Exception e) {
143              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
144              throw new RuntimeException(e);
145           }
146           return ret;
147        }
148    
149    
150    
151    
152        /**
153         * Returns
154         * the first repetition of 
155         * PROVIDER (a Group object) - creates it if necessary
156         */
157        public RCI_I05_PROVIDER getPROVIDER() { 
158           RCI_I05_PROVIDER ret = null;
159           try {
160              ret = (RCI_I05_PROVIDER)this.get("PROVIDER");
161           } catch(HL7Exception e) {
162              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
163              throw new RuntimeException(e);
164           }
165           return ret;
166        }
167    
168    
169        /**
170         * Returns a specific repetition of
171         * PROVIDER (a Group object) - creates it if necessary
172         *
173         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
174         * @throws HL7Exception if the repetition requested is more than one 
175         *     greater than the number of existing repetitions.
176         */
177        public RCI_I05_PROVIDER getPROVIDER(int rep) { 
178           RCI_I05_PROVIDER ret = null;
179           try {
180              ret = (RCI_I05_PROVIDER)this.get("PROVIDER", rep);
181           } catch(HL7Exception e) {
182              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
183              throw new RuntimeException(e);
184           }
185           return ret;
186        }
187    
188        /** 
189         * Returns the number of existing repetitions of PROVIDER 
190         */ 
191        public int getPROVIDERReps() { 
192            int reps = -1; 
193            try { 
194                reps = this.getAll("PROVIDER").length; 
195            } catch (HL7Exception e) { 
196                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
197                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
198                throw new RuntimeException(message);
199            } 
200            return reps; 
201        } 
202    
203        /**
204         * Inserts a specific repetition of PROVIDER (a Group object)
205         * @see AbstractGroup\#insertRepetition(Structure, int) 
206         */
207        public void insertPROVIDER(RCI_I05_PROVIDER structure, int rep) throws HL7Exception { 
208           super.insertRepetition( "PROVIDER", structure, rep);
209        }
210    
211    
212        /**
213         * Inserts a specific repetition of PROVIDER (a Group object)
214         * @see AbstractGroup\#insertRepetition(Structure, int) 
215         */
216        public RCI_I05_PROVIDER insertPROVIDER(int rep) throws HL7Exception { 
217           return (RCI_I05_PROVIDER)super.insertRepetition("PROVIDER", rep);
218        }
219    
220    
221        /**
222         * Removes a specific repetition of PROVIDER (a Group object)
223         * @see AbstractGroup\#removeRepetition(String, int) 
224         */
225        public RCI_I05_PROVIDER removePROVIDER(int rep) throws HL7Exception { 
226           return (RCI_I05_PROVIDER)super.removeRepetition("PROVIDER", rep);
227        }
228    
229    
230    
231        /**
232         * Returns
233         * PID (Patient identification) - creates it if necessary
234         */
235        public PID getPID() { 
236           PID ret = null;
237           try {
238              ret = (PID)this.get("PID");
239           } catch(HL7Exception e) {
240              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
241              throw new RuntimeException(e);
242           }
243           return ret;
244        }
245    
246    
247    
248    
249        /**
250         * Returns
251         * the first repetition of 
252         * DG1 (Diagnosis) - creates it if necessary
253         */
254        public DG1 getDG1() { 
255           DG1 ret = null;
256           try {
257              ret = (DG1)this.get("DG1");
258           } catch(HL7Exception e) {
259              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
260              throw new RuntimeException(e);
261           }
262           return ret;
263        }
264    
265    
266        /**
267         * Returns a specific repetition of
268         * DG1 (Diagnosis) - creates it if necessary
269         *
270         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
271         * @throws HL7Exception if the repetition requested is more than one 
272         *     greater than the number of existing repetitions.
273         */
274        public DG1 getDG1(int rep) { 
275           DG1 ret = null;
276           try {
277              ret = (DG1)this.get("DG1", rep);
278           } catch(HL7Exception e) {
279              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
280              throw new RuntimeException(e);
281           }
282           return ret;
283        }
284    
285        /** 
286         * Returns the number of existing repetitions of DG1 
287         */ 
288        public int getDG1Reps() { 
289            int reps = -1; 
290            try { 
291                reps = this.getAll("DG1").length; 
292            } catch (HL7Exception e) { 
293                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
294                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
295                throw new RuntimeException(message);
296            } 
297            return reps; 
298        } 
299    
300        /**
301         * Inserts a specific repetition of DG1 (Diagnosis)
302         * @see AbstractGroup\#insertRepetition(Structure, int) 
303         */
304        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
305           super.insertRepetition( "DG1", structure, rep);
306        }
307    
308    
309        /**
310         * Inserts a specific repetition of DG1 (Diagnosis)
311         * @see AbstractGroup\#insertRepetition(Structure, int) 
312         */
313        public DG1 insertDG1(int rep) throws HL7Exception { 
314           return (DG1)super.insertRepetition("DG1", rep);
315        }
316    
317    
318        /**
319         * Removes a specific repetition of DG1 (Diagnosis)
320         * @see AbstractGroup\#removeRepetition(String, int) 
321         */
322        public DG1 removeDG1(int rep) throws HL7Exception { 
323           return (DG1)super.removeRepetition("DG1", rep);
324        }
325    
326    
327    
328        /**
329         * Returns
330         * the first repetition of 
331         * DRG (Diagnosis Related Group) - creates it if necessary
332         */
333        public DRG getDRG() { 
334           DRG ret = null;
335           try {
336              ret = (DRG)this.get("DRG");
337           } catch(HL7Exception e) {
338              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
339              throw new RuntimeException(e);
340           }
341           return ret;
342        }
343    
344    
345        /**
346         * Returns a specific repetition of
347         * DRG (Diagnosis Related Group) - creates it if necessary
348         *
349         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
350         * @throws HL7Exception if the repetition requested is more than one 
351         *     greater than the number of existing repetitions.
352         */
353        public DRG getDRG(int rep) { 
354           DRG ret = null;
355           try {
356              ret = (DRG)this.get("DRG", rep);
357           } catch(HL7Exception e) {
358              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
359              throw new RuntimeException(e);
360           }
361           return ret;
362        }
363    
364        /** 
365         * Returns the number of existing repetitions of DRG 
366         */ 
367        public int getDRGReps() { 
368            int reps = -1; 
369            try { 
370                reps = this.getAll("DRG").length; 
371            } catch (HL7Exception e) { 
372                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
373                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
374                throw new RuntimeException(message);
375            } 
376            return reps; 
377        } 
378    
379        /**
380         * Inserts a specific repetition of DRG (Diagnosis Related Group)
381         * @see AbstractGroup\#insertRepetition(Structure, int) 
382         */
383        public void insertDRG(DRG structure, int rep) throws HL7Exception { 
384           super.insertRepetition( "DRG", structure, rep);
385        }
386    
387    
388        /**
389         * Inserts a specific repetition of DRG (Diagnosis Related Group)
390         * @see AbstractGroup\#insertRepetition(Structure, int) 
391         */
392        public DRG insertDRG(int rep) throws HL7Exception { 
393           return (DRG)super.insertRepetition("DRG", rep);
394        }
395    
396    
397        /**
398         * Removes a specific repetition of DRG (Diagnosis Related Group)
399         * @see AbstractGroup\#removeRepetition(String, int) 
400         */
401        public DRG removeDRG(int rep) throws HL7Exception { 
402           return (DRG)super.removeRepetition("DRG", rep);
403        }
404    
405    
406    
407        /**
408         * Returns
409         * the first repetition of 
410         * AL1 (Patient allergy information) - creates it if necessary
411         */
412        public AL1 getAL1() { 
413           AL1 ret = null;
414           try {
415              ret = (AL1)this.get("AL1");
416           } catch(HL7Exception e) {
417              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
418              throw new RuntimeException(e);
419           }
420           return ret;
421        }
422    
423    
424        /**
425         * Returns a specific repetition of
426         * AL1 (Patient allergy information) - creates it if necessary
427         *
428         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
429         * @throws HL7Exception if the repetition requested is more than one 
430         *     greater than the number of existing repetitions.
431         */
432        public AL1 getAL1(int rep) { 
433           AL1 ret = null;
434           try {
435              ret = (AL1)this.get("AL1", rep);
436           } catch(HL7Exception e) {
437              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
438              throw new RuntimeException(e);
439           }
440           return ret;
441        }
442    
443        /** 
444         * Returns the number of existing repetitions of AL1 
445         */ 
446        public int getAL1Reps() { 
447            int reps = -1; 
448            try { 
449                reps = this.getAll("AL1").length; 
450            } catch (HL7Exception e) { 
451                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
452                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
453                throw new RuntimeException(message);
454            } 
455            return reps; 
456        } 
457    
458        /**
459         * Inserts a specific repetition of AL1 (Patient allergy information)
460         * @see AbstractGroup\#insertRepetition(Structure, int) 
461         */
462        public void insertAL1(AL1 structure, int rep) throws HL7Exception { 
463           super.insertRepetition( "AL1", structure, rep);
464        }
465    
466    
467        /**
468         * Inserts a specific repetition of AL1 (Patient allergy information)
469         * @see AbstractGroup\#insertRepetition(Structure, int) 
470         */
471        public AL1 insertAL1(int rep) throws HL7Exception { 
472           return (AL1)super.insertRepetition("AL1", rep);
473        }
474    
475    
476        /**
477         * Removes a specific repetition of AL1 (Patient allergy information)
478         * @see AbstractGroup\#removeRepetition(String, int) 
479         */
480        public AL1 removeAL1(int rep) throws HL7Exception { 
481           return (AL1)super.removeRepetition("AL1", rep);
482        }
483    
484    
485    
486        /**
487         * Returns
488         * the first repetition of 
489         * OBSERVATION (a Group object) - creates it if necessary
490         */
491        public RCI_I05_OBSERVATION getOBSERVATION() { 
492           RCI_I05_OBSERVATION ret = null;
493           try {
494              ret = (RCI_I05_OBSERVATION)this.get("OBSERVATION");
495           } catch(HL7Exception e) {
496              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
497              throw new RuntimeException(e);
498           }
499           return ret;
500        }
501    
502    
503        /**
504         * Returns a specific repetition of
505         * OBSERVATION (a Group object) - creates it if necessary
506         *
507         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
508         * @throws HL7Exception if the repetition requested is more than one 
509         *     greater than the number of existing repetitions.
510         */
511        public RCI_I05_OBSERVATION getOBSERVATION(int rep) { 
512           RCI_I05_OBSERVATION ret = null;
513           try {
514              ret = (RCI_I05_OBSERVATION)this.get("OBSERVATION", rep);
515           } catch(HL7Exception e) {
516              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
517              throw new RuntimeException(e);
518           }
519           return ret;
520        }
521    
522        /** 
523         * Returns the number of existing repetitions of OBSERVATION 
524         */ 
525        public int getOBSERVATIONReps() { 
526            int reps = -1; 
527            try { 
528                reps = this.getAll("OBSERVATION").length; 
529            } catch (HL7Exception e) { 
530                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
531                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
532                throw new RuntimeException(message);
533            } 
534            return reps; 
535        } 
536    
537        /**
538         * Inserts a specific repetition of OBSERVATION (a Group object)
539         * @see AbstractGroup\#insertRepetition(Structure, int) 
540         */
541        public void insertOBSERVATION(RCI_I05_OBSERVATION structure, int rep) throws HL7Exception { 
542           super.insertRepetition( "OBSERVATION", structure, rep);
543        }
544    
545    
546        /**
547         * Inserts a specific repetition of OBSERVATION (a Group object)
548         * @see AbstractGroup\#insertRepetition(Structure, int) 
549         */
550        public RCI_I05_OBSERVATION insertOBSERVATION(int rep) throws HL7Exception { 
551           return (RCI_I05_OBSERVATION)super.insertRepetition("OBSERVATION", rep);
552        }
553    
554    
555        /**
556         * Removes a specific repetition of OBSERVATION (a Group object)
557         * @see AbstractGroup\#removeRepetition(String, int) 
558         */
559        public RCI_I05_OBSERVATION removeOBSERVATION(int rep) throws HL7Exception { 
560           return (RCI_I05_OBSERVATION)super.removeRepetition("OBSERVATION", rep);
561        }
562    
563    
564    
565        /**
566         * Returns
567         * the first repetition of 
568         * NTE (Notes and Comments) - creates it if necessary
569         */
570        public NTE getNTE() { 
571           NTE ret = null;
572           try {
573              ret = (NTE)this.get("NTE");
574           } catch(HL7Exception e) {
575              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
576              throw new RuntimeException(e);
577           }
578           return ret;
579        }
580    
581    
582        /**
583         * Returns a specific repetition of
584         * NTE (Notes and Comments) - creates it if necessary
585         *
586         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
587         * @throws HL7Exception if the repetition requested is more than one 
588         *     greater than the number of existing repetitions.
589         */
590        public NTE getNTE(int rep) { 
591           NTE ret = null;
592           try {
593              ret = (NTE)this.get("NTE", rep);
594           } catch(HL7Exception e) {
595              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
596              throw new RuntimeException(e);
597           }
598           return ret;
599        }
600    
601        /** 
602         * Returns the number of existing repetitions of NTE 
603         */ 
604        public int getNTEReps() { 
605            int reps = -1; 
606            try { 
607                reps = this.getAll("NTE").length; 
608            } catch (HL7Exception e) { 
609                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
610                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
611                throw new RuntimeException(message);
612            } 
613            return reps; 
614        } 
615    
616        /**
617         * Inserts a specific repetition of NTE (Notes and Comments)
618         * @see AbstractGroup\#insertRepetition(Structure, int) 
619         */
620        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
621           super.insertRepetition( "NTE", structure, rep);
622        }
623    
624    
625        /**
626         * Inserts a specific repetition of NTE (Notes and Comments)
627         * @see AbstractGroup\#insertRepetition(Structure, int) 
628         */
629        public NTE insertNTE(int rep) throws HL7Exception { 
630           return (NTE)super.insertRepetition("NTE", rep);
631        }
632    
633    
634        /**
635         * Removes a specific repetition of NTE (Notes and Comments)
636         * @see AbstractGroup\#removeRepetition(String, int) 
637         */
638        public NTE removeNTE(int rep) throws HL7Exception { 
639           return (NTE)super.removeRepetition("NTE", rep);
640        }
641    
642    
643    
644    }
645