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.v231.message;
009    
010    import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.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 ADT_A03 message structure (see chapter ?). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (MSH - message header segment) <b> </b></li>
024                     * <li>2: EVN (EVN - event type segment) <b> </b></li>
025                     * <li>3: PID (PID - patient identification segment) <b> </b></li>
026                     * <li>4: PD1 (PD1 - patient additional demographic segment) <b>optional </b></li>
027                     * <li>5: PV1 (PV1 - patient visit segment-) <b> </b></li>
028                     * <li>6: PV2 (PV2 - patient visit - additional information segment) <b>optional </b></li>
029                     * <li>7: DB1 (DB1 - Disability segment) <b>optional repeating</b></li>
030                     * <li>8: DG1 (DG1 - diagnosis segment) <b>optional repeating</b></li>
031                     * <li>9: DRG (DRG - diagnosis related group segment) <b>optional </b></li>
032                     * <li>10: ADT_A03_PR1ROL (a Group object) <b>optional repeating</b></li>
033                     * <li>11: OBX (OBX - observation/result segment) <b>optional repeating</b></li>
034     * </ul>
035     */
036    public class ADT_A03 extends AbstractMessage  {
037    
038        /**
039         * Creates a new ADT_A03 message with DefaultModelClassFactory. 
040         */ 
041        public ADT_A03() { 
042           this(new DefaultModelClassFactory());
043        }
044    
045        /** 
046         * Creates a new ADT_A03 message with custom ModelClassFactory.
047         */
048        public ADT_A03(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(EVN.class, true, false);
057                              this.add(PID.class, true, false);
058                              this.add(PD1.class, false, false);
059                              this.add(PV1.class, true, false);
060                              this.add(PV2.class, false, false);
061                              this.add(DB1.class, false, true);
062                              this.add(DG1.class, false, true);
063                              this.add(DRG.class, false, false);
064                              this.add(ADT_A03_PR1ROL.class, false, true);
065                              this.add(OBX.class, false, true);
066           } catch(HL7Exception e) {
067              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ADT_A03 - this is probably a bug in the source code generator.", e);
068           }
069        }
070    
071        /** 
072         * Returns "2.3.1"
073         */
074        public String getVersion() {
075           return "2.3.1";
076        }
077    
078    
079    
080        /**
081         * Returns
082         * MSH (MSH - message header segment) - 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         * EVN (EVN - event type segment) - creates it if necessary
101         */
102        public EVN getEVN() { 
103           EVN ret = null;
104           try {
105              ret = (EVN)this.get("EVN");
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         * PID (PID - patient identification segment) - creates it if necessary
119         */
120        public PID getPID() { 
121           PID ret = null;
122           try {
123              ret = (PID)this.get("PID");
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         * PD1 (PD1 - patient additional demographic segment) - creates it if necessary
137         */
138        public PD1 getPD1() { 
139           PD1 ret = null;
140           try {
141              ret = (PD1)this.get("PD1");
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         * PV1 (PV1 - patient visit segment-) - creates it if necessary
155         */
156        public PV1 getPV1() { 
157           PV1 ret = null;
158           try {
159              ret = (PV1)this.get("PV1");
160           } catch(HL7Exception e) {
161              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
162              throw new RuntimeException(e);
163           }
164           return ret;
165        }
166    
167    
168    
169    
170        /**
171         * Returns
172         * PV2 (PV2 - patient visit - additional information segment) - creates it if necessary
173         */
174        public PV2 getPV2() { 
175           PV2 ret = null;
176           try {
177              ret = (PV2)this.get("PV2");
178           } catch(HL7Exception e) {
179              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
180              throw new RuntimeException(e);
181           }
182           return ret;
183        }
184    
185    
186    
187    
188        /**
189         * Returns
190         * the first repetition of 
191         * DB1 (DB1 - Disability segment) - creates it if necessary
192         */
193        public DB1 getDB1() { 
194           DB1 ret = null;
195           try {
196              ret = (DB1)this.get("DB1");
197           } catch(HL7Exception e) {
198              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
199              throw new RuntimeException(e);
200           }
201           return ret;
202        }
203    
204    
205        /**
206         * Returns a specific repetition of
207         * DB1 (DB1 - Disability segment) - creates it if necessary
208         *
209         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
210         * @throws HL7Exception if the repetition requested is more than one 
211         *     greater than the number of existing repetitions.
212         */
213        public DB1 getDB1(int rep) { 
214           DB1 ret = null;
215           try {
216              ret = (DB1)this.get("DB1", rep);
217           } catch(HL7Exception e) {
218              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
219              throw new RuntimeException(e);
220           }
221           return ret;
222        }
223    
224        /** 
225         * Returns the number of existing repetitions of DB1 
226         */ 
227        public int getDB1Reps() { 
228            int reps = -1; 
229            try { 
230                reps = this.getAll("DB1").length; 
231            } catch (HL7Exception e) { 
232                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
233                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
234                throw new RuntimeException(message);
235            } 
236            return reps; 
237        } 
238    
239        /**
240         * Inserts a specific repetition of DB1 (DB1 - Disability segment)
241         * @see AbstractGroup\#insertRepetition(Structure, int) 
242         */
243        public void insertDB1(DB1 structure, int rep) throws HL7Exception { 
244           super.insertRepetition( "DB1", structure, rep);
245        }
246    
247    
248        /**
249         * Inserts a specific repetition of DB1 (DB1 - Disability segment)
250         * @see AbstractGroup\#insertRepetition(Structure, int) 
251         */
252        public DB1 insertDB1(int rep) throws HL7Exception { 
253           return (DB1)super.insertRepetition("DB1", rep);
254        }
255    
256    
257        /**
258         * Removes a specific repetition of DB1 (DB1 - Disability segment)
259         * @see AbstractGroup\#removeRepetition(String, int) 
260         */
261        public DB1 removeDB1(int rep) throws HL7Exception { 
262           return (DB1)super.removeRepetition("DB1", rep);
263        }
264    
265    
266    
267        /**
268         * Returns
269         * the first repetition of 
270         * DG1 (DG1 - diagnosis segment) - creates it if necessary
271         */
272        public DG1 getDG1() { 
273           DG1 ret = null;
274           try {
275              ret = (DG1)this.get("DG1");
276           } catch(HL7Exception e) {
277              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
278              throw new RuntimeException(e);
279           }
280           return ret;
281        }
282    
283    
284        /**
285         * Returns a specific repetition of
286         * DG1 (DG1 - diagnosis segment) - creates it if necessary
287         *
288         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
289         * @throws HL7Exception if the repetition requested is more than one 
290         *     greater than the number of existing repetitions.
291         */
292        public DG1 getDG1(int rep) { 
293           DG1 ret = null;
294           try {
295              ret = (DG1)this.get("DG1", rep);
296           } catch(HL7Exception e) {
297              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
298              throw new RuntimeException(e);
299           }
300           return ret;
301        }
302    
303        /** 
304         * Returns the number of existing repetitions of DG1 
305         */ 
306        public int getDG1Reps() { 
307            int reps = -1; 
308            try { 
309                reps = this.getAll("DG1").length; 
310            } catch (HL7Exception e) { 
311                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
312                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
313                throw new RuntimeException(message);
314            } 
315            return reps; 
316        } 
317    
318        /**
319         * Inserts a specific repetition of DG1 (DG1 - diagnosis segment)
320         * @see AbstractGroup\#insertRepetition(Structure, int) 
321         */
322        public void insertDG1(DG1 structure, int rep) throws HL7Exception { 
323           super.insertRepetition( "DG1", structure, rep);
324        }
325    
326    
327        /**
328         * Inserts a specific repetition of DG1 (DG1 - diagnosis segment)
329         * @see AbstractGroup\#insertRepetition(Structure, int) 
330         */
331        public DG1 insertDG1(int rep) throws HL7Exception { 
332           return (DG1)super.insertRepetition("DG1", rep);
333        }
334    
335    
336        /**
337         * Removes a specific repetition of DG1 (DG1 - diagnosis segment)
338         * @see AbstractGroup\#removeRepetition(String, int) 
339         */
340        public DG1 removeDG1(int rep) throws HL7Exception { 
341           return (DG1)super.removeRepetition("DG1", rep);
342        }
343    
344    
345    
346        /**
347         * Returns
348         * DRG (DRG - diagnosis related group segment) - creates it if necessary
349         */
350        public DRG getDRG() { 
351           DRG ret = null;
352           try {
353              ret = (DRG)this.get("DRG");
354           } catch(HL7Exception e) {
355              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
356              throw new RuntimeException(e);
357           }
358           return ret;
359        }
360    
361    
362    
363    
364        /**
365         * Returns
366         * the first repetition of 
367         * PR1ROL (a Group object) - creates it if necessary
368         */
369        public ADT_A03_PR1ROL getPR1ROL() { 
370           ADT_A03_PR1ROL ret = null;
371           try {
372              ret = (ADT_A03_PR1ROL)this.get("PR1ROL");
373           } catch(HL7Exception e) {
374              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
375              throw new RuntimeException(e);
376           }
377           return ret;
378        }
379    
380    
381        /**
382         * Returns a specific repetition of
383         * PR1ROL (a Group object) - creates it if necessary
384         *
385         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
386         * @throws HL7Exception if the repetition requested is more than one 
387         *     greater than the number of existing repetitions.
388         */
389        public ADT_A03_PR1ROL getPR1ROL(int rep) { 
390           ADT_A03_PR1ROL ret = null;
391           try {
392              ret = (ADT_A03_PR1ROL)this.get("PR1ROL", rep);
393           } catch(HL7Exception e) {
394              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
395              throw new RuntimeException(e);
396           }
397           return ret;
398        }
399    
400        /** 
401         * Returns the number of existing repetitions of PR1ROL 
402         */ 
403        public int getPR1ROLReps() { 
404            int reps = -1; 
405            try { 
406                reps = this.getAll("PR1ROL").length; 
407            } catch (HL7Exception e) { 
408                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
409                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
410                throw new RuntimeException(message);
411            } 
412            return reps; 
413        } 
414    
415        /**
416         * Inserts a specific repetition of PR1ROL (a Group object)
417         * @see AbstractGroup\#insertRepetition(Structure, int) 
418         */
419        public void insertPR1ROL(ADT_A03_PR1ROL structure, int rep) throws HL7Exception { 
420           super.insertRepetition( "PR1ROL", structure, rep);
421        }
422    
423    
424        /**
425         * Inserts a specific repetition of PR1ROL (a Group object)
426         * @see AbstractGroup\#insertRepetition(Structure, int) 
427         */
428        public ADT_A03_PR1ROL insertPR1ROL(int rep) throws HL7Exception { 
429           return (ADT_A03_PR1ROL)super.insertRepetition("PR1ROL", rep);
430        }
431    
432    
433        /**
434         * Removes a specific repetition of PR1ROL (a Group object)
435         * @see AbstractGroup\#removeRepetition(String, int) 
436         */
437        public ADT_A03_PR1ROL removePR1ROL(int rep) throws HL7Exception { 
438           return (ADT_A03_PR1ROL)super.removeRepetition("PR1ROL", rep);
439        }
440    
441    
442    
443        /**
444         * Returns
445         * the first repetition of 
446         * OBX (OBX - observation/result segment) - creates it if necessary
447         */
448        public OBX getOBX() { 
449           OBX ret = null;
450           try {
451              ret = (OBX)this.get("OBX");
452           } catch(HL7Exception e) {
453              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
454              throw new RuntimeException(e);
455           }
456           return ret;
457        }
458    
459    
460        /**
461         * Returns a specific repetition of
462         * OBX (OBX - observation/result segment) - creates it if necessary
463         *
464         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
465         * @throws HL7Exception if the repetition requested is more than one 
466         *     greater than the number of existing repetitions.
467         */
468        public OBX getOBX(int rep) { 
469           OBX ret = null;
470           try {
471              ret = (OBX)this.get("OBX", rep);
472           } catch(HL7Exception e) {
473              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
474              throw new RuntimeException(e);
475           }
476           return ret;
477        }
478    
479        /** 
480         * Returns the number of existing repetitions of OBX 
481         */ 
482        public int getOBXReps() { 
483            int reps = -1; 
484            try { 
485                reps = this.getAll("OBX").length; 
486            } catch (HL7Exception e) { 
487                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
488                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
489                throw new RuntimeException(message);
490            } 
491            return reps; 
492        } 
493    
494        /**
495         * Inserts a specific repetition of OBX (OBX - observation/result segment)
496         * @see AbstractGroup\#insertRepetition(Structure, int) 
497         */
498        public void insertOBX(OBX structure, int rep) throws HL7Exception { 
499           super.insertRepetition( "OBX", structure, rep);
500        }
501    
502    
503        /**
504         * Inserts a specific repetition of OBX (OBX - observation/result segment)
505         * @see AbstractGroup\#insertRepetition(Structure, int) 
506         */
507        public OBX insertOBX(int rep) throws HL7Exception { 
508           return (OBX)super.insertRepetition("OBX", rep);
509        }
510    
511    
512        /**
513         * Removes a specific repetition of OBX (OBX - observation/result segment)
514         * @see AbstractGroup\#removeRepetition(String, int) 
515         */
516        public OBX removeOBX(int rep) throws HL7Exception { 
517           return (OBX)super.removeRepetition("OBX", rep);
518        }
519    
520    
521    
522    }
523