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