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.segment;
009    
010    // import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.datatype.*;
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.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 PR1 message segment (PR1 - procedures segment). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PR1-1: Set ID - PR1 (SI) <b> </b>
027         * <li>PR1-2: Procedure Coding Method (IS) <b>optional </b>
028         * <li>PR1-3: Procedure Code (CE) <b> </b>
029         * <li>PR1-4: Procedure Description (ST) <b>optional </b>
030         * <li>PR1-5: Procedure Date/Time (TS) <b> </b>
031         * <li>PR1-6: Procedure Functional Type (IS) <b> </b>
032         * <li>PR1-7: Procedure Minutes (NM) <b>optional </b>
033         * <li>PR1-8: Anesthesiologist (XCN) <b>optional repeating</b>
034         * <li>PR1-9: Anesthesia Code (IS) <b>optional </b>
035         * <li>PR1-10: Anesthesia Minutes (NM) <b>optional </b>
036         * <li>PR1-11: Surgeon (XCN) <b>optional repeating</b>
037         * <li>PR1-12: Procedure Practitioner (XCN) <b>optional repeating</b>
038         * <li>PR1-13: Consent Code (CE) <b>optional </b>
039         * <li>PR1-14: Procedure Priority (NM) <b>optional </b>
040         * <li>PR1-15: Associated Diagnosis Code (CE) <b>optional </b>
041         * <li>PR1-16: Procedure Code Modifier (CE) <b>optional repeating</b>
042     * </ul>
043     */
044    public class PR1 extends AbstractSegment {
045    
046        /** 
047         * Creates a new PR1 segment
048         */
049        public PR1(Group parent, ModelClassFactory factory) {
050           super(parent, factory);
051           init(factory);
052        }
053    
054        private void init(ModelClassFactory factory) {
055           try {
056                                      this.add(SI.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - PR1");
057                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Procedure Coding Method");
058                                      this.add(CE.class, true, 1, 80, new Object[]{ getMessage(), new Integer(88) }, "Procedure Code");
059                                      this.add(ST.class, false, 1, 40, new Object[]{ getMessage(), new Integer(0) }, "Procedure Description");
060                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Procedure Date/Time");
061                                      this.add(IS.class, true, 1, 2, new Object[]{ getMessage() }, "Procedure Functional Type");
062                                      this.add(NM.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Procedure Minutes");
063                                      this.add(XCN.class, false, 0, 120, new Object[]{ getMessage(), new Integer(10) }, "Anesthesiologist");
064                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Anesthesia Code");
065                                      this.add(NM.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Anesthesia Minutes");
066                                      this.add(XCN.class, false, 0, 120, new Object[]{ getMessage(), new Integer(10) }, "Surgeon");
067                                      this.add(XCN.class, false, 0, 230, new Object[]{ getMessage(), new Integer(10) }, "Procedure Practitioner");
068                                      this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(59) }, "Consent Code");
069                                      this.add(NM.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Procedure Priority");
070                                      this.add(CE.class, false, 1, 80, new Object[]{ getMessage(), new Integer(51) }, "Associated Diagnosis Code");
071                                      this.add(CE.class, false, 0, 80, new Object[]{ getMessage(), new Integer(340) }, "Procedure Code Modifier");
072           } catch(HL7Exception e) {
073              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PR1 - this is probably a bug in the source code generator.", e);
074           }
075        }
076    
077    
078    
079        /**
080         * Returns
081         * PR1-1: "Set ID - PR1" - creates it if necessary
082         */
083        public SI getSetIDPR1() { 
084            SI ret = null;
085            try {
086                Type t = this.getField(1, 0);
087                ret = (SI)t;
088            } catch (ClassCastException cce) {
089                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
090                throw new RuntimeException(cce);
091            } catch (HL7Exception he) {
092                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
093                throw new RuntimeException(he);
094            }
095            return ret;
096        }
097    
098    
099        /**
100         * Returns
101         * PR1-1: "Set ID - PR1" - creates it if necessary
102         */
103        public SI getPr11_SetIDPR1() { 
104            SI ret = null;
105            try {
106                Type t = this.getField(1, 0);
107                ret = (SI)t;
108            } catch (ClassCastException cce) {
109                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
110                throw new RuntimeException(cce);
111            } catch (HL7Exception he) {
112                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
113                throw new RuntimeException(he);
114            }
115            return ret;
116        }
117    
118    
119    
120        /**
121         * Returns
122         * PR1-2: "Procedure Coding Method" - creates it if necessary
123         */
124        public IS getProcedureCodingMethod() { 
125            IS ret = null;
126            try {
127                Type t = this.getField(2, 0);
128                ret = (IS)t;
129            } catch (ClassCastException cce) {
130                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
131                throw new RuntimeException(cce);
132            } catch (HL7Exception he) {
133                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
134                throw new RuntimeException(he);
135            }
136            return ret;
137        }
138    
139    
140        /**
141         * Returns
142         * PR1-2: "Procedure Coding Method" - creates it if necessary
143         */
144        public IS getPr12_ProcedureCodingMethod() { 
145            IS ret = null;
146            try {
147                Type t = this.getField(2, 0);
148                ret = (IS)t;
149            } catch (ClassCastException cce) {
150                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
151                throw new RuntimeException(cce);
152            } catch (HL7Exception he) {
153                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
154                throw new RuntimeException(he);
155            }
156            return ret;
157        }
158    
159    
160    
161        /**
162         * Returns
163         * PR1-3: "Procedure Code" - creates it if necessary
164         */
165        public CE getProcedureCode() { 
166            CE ret = null;
167            try {
168                Type t = this.getField(3, 0);
169                ret = (CE)t;
170            } catch (ClassCastException cce) {
171                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
172                throw new RuntimeException(cce);
173            } catch (HL7Exception he) {
174                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
175                throw new RuntimeException(he);
176            }
177            return ret;
178        }
179    
180    
181        /**
182         * Returns
183         * PR1-3: "Procedure Code" - creates it if necessary
184         */
185        public CE getPr13_ProcedureCode() { 
186            CE ret = null;
187            try {
188                Type t = this.getField(3, 0);
189                ret = (CE)t;
190            } catch (ClassCastException cce) {
191                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
192                throw new RuntimeException(cce);
193            } catch (HL7Exception he) {
194                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
195                throw new RuntimeException(he);
196            }
197            return ret;
198        }
199    
200    
201    
202        /**
203         * Returns
204         * PR1-4: "Procedure Description" - creates it if necessary
205         */
206        public ST getProcedureDescription() { 
207            ST ret = null;
208            try {
209                Type t = this.getField(4, 0);
210                ret = (ST)t;
211            } catch (ClassCastException cce) {
212                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
213                throw new RuntimeException(cce);
214            } catch (HL7Exception he) {
215                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
216                throw new RuntimeException(he);
217            }
218            return ret;
219        }
220    
221    
222        /**
223         * Returns
224         * PR1-4: "Procedure Description" - creates it if necessary
225         */
226        public ST getPr14_ProcedureDescription() { 
227            ST ret = null;
228            try {
229                Type t = this.getField(4, 0);
230                ret = (ST)t;
231            } catch (ClassCastException cce) {
232                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
233                throw new RuntimeException(cce);
234            } catch (HL7Exception he) {
235                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
236                throw new RuntimeException(he);
237            }
238            return ret;
239        }
240    
241    
242    
243        /**
244         * Returns
245         * PR1-5: "Procedure Date/Time" - creates it if necessary
246         */
247        public TS getProcedureDateTime() { 
248            TS ret = null;
249            try {
250                Type t = this.getField(5, 0);
251                ret = (TS)t;
252            } catch (ClassCastException cce) {
253                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
254                throw new RuntimeException(cce);
255            } catch (HL7Exception he) {
256                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
257                throw new RuntimeException(he);
258            }
259            return ret;
260        }
261    
262    
263        /**
264         * Returns
265         * PR1-5: "Procedure Date/Time" - creates it if necessary
266         */
267        public TS getPr15_ProcedureDateTime() { 
268            TS ret = null;
269            try {
270                Type t = this.getField(5, 0);
271                ret = (TS)t;
272            } catch (ClassCastException cce) {
273                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
274                throw new RuntimeException(cce);
275            } catch (HL7Exception he) {
276                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
277                throw new RuntimeException(he);
278            }
279            return ret;
280        }
281    
282    
283    
284        /**
285         * Returns
286         * PR1-6: "Procedure Functional Type" - creates it if necessary
287         */
288        public IS getProcedureFunctionalType() { 
289            IS ret = null;
290            try {
291                Type t = this.getField(6, 0);
292                ret = (IS)t;
293            } catch (ClassCastException cce) {
294                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
295                throw new RuntimeException(cce);
296            } catch (HL7Exception he) {
297                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
298                throw new RuntimeException(he);
299            }
300            return ret;
301        }
302    
303    
304        /**
305         * Returns
306         * PR1-6: "Procedure Functional Type" - creates it if necessary
307         */
308        public IS getPr16_ProcedureFunctionalType() { 
309            IS ret = null;
310            try {
311                Type t = this.getField(6, 0);
312                ret = (IS)t;
313            } catch (ClassCastException cce) {
314                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
315                throw new RuntimeException(cce);
316            } catch (HL7Exception he) {
317                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
318                throw new RuntimeException(he);
319            }
320            return ret;
321        }
322    
323    
324    
325        /**
326         * Returns
327         * PR1-7: "Procedure Minutes" - creates it if necessary
328         */
329        public NM getProcedureMinutes() { 
330            NM ret = null;
331            try {
332                Type t = this.getField(7, 0);
333                ret = (NM)t;
334            } catch (ClassCastException cce) {
335                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
336                throw new RuntimeException(cce);
337            } catch (HL7Exception he) {
338                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
339                throw new RuntimeException(he);
340            }
341            return ret;
342        }
343    
344    
345        /**
346         * Returns
347         * PR1-7: "Procedure Minutes" - creates it if necessary
348         */
349        public NM getPr17_ProcedureMinutes() { 
350            NM ret = null;
351            try {
352                Type t = this.getField(7, 0);
353                ret = (NM)t;
354            } catch (ClassCastException cce) {
355                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
356                throw new RuntimeException(cce);
357            } catch (HL7Exception he) {
358                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
359                throw new RuntimeException(he);
360            }
361            return ret;
362        }
363    
364    
365        /**
366         * Returns all repetitions of Anesthesiologist (PR1-8).
367         */
368        public XCN[] getAnesthesiologist() {
369            XCN[] ret = null;
370            try {
371                Type[] t = this.getField(8);  
372                ret = new XCN[t.length];
373                for (int i = 0; i < ret.length; i++) {
374                    ret[i] = (XCN)t[i];
375                }
376            } catch (ClassCastException cce) {
377                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
378                throw new RuntimeException(cce);
379            } catch (HL7Exception he) {
380                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
381                throw new RuntimeException(he);
382            }
383            return ret;
384        }
385    
386    
387        /**
388         * Returns a count of the current number of repetitions of Anesthesiologist (PR1-8).
389         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
390         * it will return zero.
391         */
392        public int getAnesthesiologistReps() {
393            XCN[] ret = null;
394            try {
395                Type[] t = this.getField(8);
396                return t.length;  
397            } catch (ClassCastException cce) {
398                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
399                throw new RuntimeException(cce);
400            } catch (HL7Exception he) {
401                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
402                throw new RuntimeException(he);
403            }
404        }
405    
406    
407        /**
408         * Returns a specific repetition of
409         * PR1-8: "Anesthesiologist" - creates it if necessary
410         *
411         * @param rep The repetition index (0-indexed)
412         */
413        public XCN getAnesthesiologist(int rep) { 
414            XCN ret = null;
415            try {
416                Type t = this.getField(8, rep);
417                ret = (XCN)t;
418            } catch (ClassCastException cce) {
419                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
420                throw new RuntimeException(cce);
421            } catch (HL7Exception he) {
422                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
423                throw new RuntimeException(he);
424            }
425            return ret;
426        }
427    
428        /**
429         * Returns a specific repetition of
430         * PR1-8: "Anesthesiologist" - creates it if necessary
431         *
432         * @param rep The repetition index (0-indexed)
433         */
434        public XCN getPr18_Anesthesiologist(int rep) { 
435            XCN ret = null;
436            try {
437                Type t = this.getField(8, rep);
438                ret = (XCN)t;
439            } catch (ClassCastException cce) {
440                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
441                throw new RuntimeException(cce);
442            } catch (HL7Exception he) {
443                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
444                throw new RuntimeException(he);
445            }
446            return ret;
447        }
448    
449    
450        /**
451         * Returns a count of the current number of repetitions of Anesthesiologist (PR1-8).
452         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
453         * it will return zero.
454         */
455        public int getPr18_AnesthesiologistReps() {
456            XCN[] ret = null;
457            try {
458                Type[] t = this.getField(8);
459                return t.length;  
460            } catch (ClassCastException cce) {
461                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
462                throw new RuntimeException(cce);
463            } catch (HL7Exception he) {
464                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
465                throw new RuntimeException(he);
466            }
467        }
468    
469    
470    
471        /**
472         * Inserts a repetition of
473         * PR1-8: "Anesthesiologist" at a specific index
474         *
475         * @param rep The repetition index (0-indexed)
476         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
477         */
478        public XCN insertAnesthesiologist(int rep) throws HL7Exception { 
479            return (XCN) super.insertRepetition(8, rep);
480        }
481    
482    
483    
484        /**
485         * Inserts a repetition of
486         * PR1-8: "Anesthesiologist" at a specific index
487         *
488         * @param rep The repetition index (0-indexed)
489         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
490         */
491        public XCN insertPr18_Anesthesiologist(int rep) throws HL7Exception { 
492            return (XCN) super.insertRepetition(8, rep);
493        }
494    
495    
496        /**
497         * Removes a repetition of
498         * PR1-8: "Anesthesiologist" at a specific index
499         *
500         * @param rep The repetition index (0-indexed)
501         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
502         */
503        public XCN removeAnesthesiologist(int rep) throws HL7Exception { 
504            return (XCN) super.removeRepetition(8, rep);
505        }
506    
507    
508        /**
509         * Removes a repetition of
510         * PR1-8: "Anesthesiologist" at a specific index
511         *
512         * @param rep The repetition index (0-indexed)
513         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
514         */
515        public XCN removePr18_Anesthesiologist(int rep) throws HL7Exception { 
516            return (XCN) super.removeRepetition(8, rep);
517        }
518    
519    
520    
521    
522        /**
523         * Returns
524         * PR1-9: "Anesthesia Code" - creates it if necessary
525         */
526        public IS getAnesthesiaCode() { 
527            IS ret = null;
528            try {
529                Type t = this.getField(9, 0);
530                ret = (IS)t;
531            } catch (ClassCastException cce) {
532                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
533                throw new RuntimeException(cce);
534            } catch (HL7Exception he) {
535                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
536                throw new RuntimeException(he);
537            }
538            return ret;
539        }
540    
541    
542        /**
543         * Returns
544         * PR1-9: "Anesthesia Code" - creates it if necessary
545         */
546        public IS getPr19_AnesthesiaCode() { 
547            IS ret = null;
548            try {
549                Type t = this.getField(9, 0);
550                ret = (IS)t;
551            } catch (ClassCastException cce) {
552                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
553                throw new RuntimeException(cce);
554            } catch (HL7Exception he) {
555                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
556                throw new RuntimeException(he);
557            }
558            return ret;
559        }
560    
561    
562    
563        /**
564         * Returns
565         * PR1-10: "Anesthesia Minutes" - creates it if necessary
566         */
567        public NM getAnesthesiaMinutes() { 
568            NM ret = null;
569            try {
570                Type t = this.getField(10, 0);
571                ret = (NM)t;
572            } catch (ClassCastException cce) {
573                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
574                throw new RuntimeException(cce);
575            } catch (HL7Exception he) {
576                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
577                throw new RuntimeException(he);
578            }
579            return ret;
580        }
581    
582    
583        /**
584         * Returns
585         * PR1-10: "Anesthesia Minutes" - creates it if necessary
586         */
587        public NM getPr110_AnesthesiaMinutes() { 
588            NM ret = null;
589            try {
590                Type t = this.getField(10, 0);
591                ret = (NM)t;
592            } catch (ClassCastException cce) {
593                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
594                throw new RuntimeException(cce);
595            } catch (HL7Exception he) {
596                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
597                throw new RuntimeException(he);
598            }
599            return ret;
600        }
601    
602    
603        /**
604         * Returns all repetitions of Surgeon (PR1-11).
605         */
606        public XCN[] getSurgeon() {
607            XCN[] ret = null;
608            try {
609                Type[] t = this.getField(11);  
610                ret = new XCN[t.length];
611                for (int i = 0; i < ret.length; i++) {
612                    ret[i] = (XCN)t[i];
613                }
614            } catch (ClassCastException cce) {
615                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
616                throw new RuntimeException(cce);
617            } catch (HL7Exception he) {
618                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
619                throw new RuntimeException(he);
620            }
621            return ret;
622        }
623    
624    
625        /**
626         * Returns a count of the current number of repetitions of Surgeon (PR1-11).
627         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
628         * it will return zero.
629         */
630        public int getSurgeonReps() {
631            XCN[] ret = null;
632            try {
633                Type[] t = this.getField(11);
634                return t.length;  
635            } catch (ClassCastException cce) {
636                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
637                throw new RuntimeException(cce);
638            } catch (HL7Exception he) {
639                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
640                throw new RuntimeException(he);
641            }
642        }
643    
644    
645        /**
646         * Returns a specific repetition of
647         * PR1-11: "Surgeon" - creates it if necessary
648         *
649         * @param rep The repetition index (0-indexed)
650         */
651        public XCN getSurgeon(int rep) { 
652            XCN ret = null;
653            try {
654                Type t = this.getField(11, rep);
655                ret = (XCN)t;
656            } catch (ClassCastException cce) {
657                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
658                throw new RuntimeException(cce);
659            } catch (HL7Exception he) {
660                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
661                throw new RuntimeException(he);
662            }
663            return ret;
664        }
665    
666        /**
667         * Returns a specific repetition of
668         * PR1-11: "Surgeon" - creates it if necessary
669         *
670         * @param rep The repetition index (0-indexed)
671         */
672        public XCN getPr111_Surgeon(int rep) { 
673            XCN ret = null;
674            try {
675                Type t = this.getField(11, rep);
676                ret = (XCN)t;
677            } catch (ClassCastException cce) {
678                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
679                throw new RuntimeException(cce);
680            } catch (HL7Exception he) {
681                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
682                throw new RuntimeException(he);
683            }
684            return ret;
685        }
686    
687    
688        /**
689         * Returns a count of the current number of repetitions of Surgeon (PR1-11).
690         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
691         * it will return zero.
692         */
693        public int getPr111_SurgeonReps() {
694            XCN[] ret = null;
695            try {
696                Type[] t = this.getField(11);
697                return t.length;  
698            } catch (ClassCastException cce) {
699                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
700                throw new RuntimeException(cce);
701            } catch (HL7Exception he) {
702                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
703                throw new RuntimeException(he);
704            }
705        }
706    
707    
708    
709        /**
710         * Inserts a repetition of
711         * PR1-11: "Surgeon" at a specific index
712         *
713         * @param rep The repetition index (0-indexed)
714         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
715         */
716        public XCN insertSurgeon(int rep) throws HL7Exception { 
717            return (XCN) super.insertRepetition(11, rep);
718        }
719    
720    
721    
722        /**
723         * Inserts a repetition of
724         * PR1-11: "Surgeon" at a specific index
725         *
726         * @param rep The repetition index (0-indexed)
727         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
728         */
729        public XCN insertPr111_Surgeon(int rep) throws HL7Exception { 
730            return (XCN) super.insertRepetition(11, rep);
731        }
732    
733    
734        /**
735         * Removes a repetition of
736         * PR1-11: "Surgeon" at a specific index
737         *
738         * @param rep The repetition index (0-indexed)
739         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
740         */
741        public XCN removeSurgeon(int rep) throws HL7Exception { 
742            return (XCN) super.removeRepetition(11, rep);
743        }
744    
745    
746        /**
747         * Removes a repetition of
748         * PR1-11: "Surgeon" at a specific index
749         *
750         * @param rep The repetition index (0-indexed)
751         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
752         */
753        public XCN removePr111_Surgeon(int rep) throws HL7Exception { 
754            return (XCN) super.removeRepetition(11, rep);
755        }
756    
757    
758    
759        /**
760         * Returns all repetitions of Procedure Practitioner (PR1-12).
761         */
762        public XCN[] getProcedurePractitioner() {
763            XCN[] ret = null;
764            try {
765                Type[] t = this.getField(12);  
766                ret = new XCN[t.length];
767                for (int i = 0; i < ret.length; i++) {
768                    ret[i] = (XCN)t[i];
769                }
770            } catch (ClassCastException cce) {
771                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
772                throw new RuntimeException(cce);
773            } catch (HL7Exception he) {
774                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
775                throw new RuntimeException(he);
776            }
777            return ret;
778        }
779    
780    
781        /**
782         * Returns a count of the current number of repetitions of Procedure Practitioner (PR1-12).
783         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
784         * it will return zero.
785         */
786        public int getProcedurePractitionerReps() {
787            XCN[] ret = null;
788            try {
789                Type[] t = this.getField(12);
790                return t.length;  
791            } catch (ClassCastException cce) {
792                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
793                throw new RuntimeException(cce);
794            } catch (HL7Exception he) {
795                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
796                throw new RuntimeException(he);
797            }
798        }
799    
800    
801        /**
802         * Returns a specific repetition of
803         * PR1-12: "Procedure Practitioner" - creates it if necessary
804         *
805         * @param rep The repetition index (0-indexed)
806         */
807        public XCN getProcedurePractitioner(int rep) { 
808            XCN ret = null;
809            try {
810                Type t = this.getField(12, rep);
811                ret = (XCN)t;
812            } catch (ClassCastException cce) {
813                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
814                throw new RuntimeException(cce);
815            } catch (HL7Exception he) {
816                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
817                throw new RuntimeException(he);
818            }
819            return ret;
820        }
821    
822        /**
823         * Returns a specific repetition of
824         * PR1-12: "Procedure Practitioner" - creates it if necessary
825         *
826         * @param rep The repetition index (0-indexed)
827         */
828        public XCN getPr112_ProcedurePractitioner(int rep) { 
829            XCN ret = null;
830            try {
831                Type t = this.getField(12, rep);
832                ret = (XCN)t;
833            } catch (ClassCastException cce) {
834                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
835                throw new RuntimeException(cce);
836            } catch (HL7Exception he) {
837                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
838                throw new RuntimeException(he);
839            }
840            return ret;
841        }
842    
843    
844        /**
845         * Returns a count of the current number of repetitions of Procedure Practitioner (PR1-12).
846         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
847         * it will return zero.
848         */
849        public int getPr112_ProcedurePractitionerReps() {
850            XCN[] ret = null;
851            try {
852                Type[] t = this.getField(12);
853                return t.length;  
854            } catch (ClassCastException cce) {
855                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
856                throw new RuntimeException(cce);
857            } catch (HL7Exception he) {
858                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
859                throw new RuntimeException(he);
860            }
861        }
862    
863    
864    
865        /**
866         * Inserts a repetition of
867         * PR1-12: "Procedure Practitioner" at a specific index
868         *
869         * @param rep The repetition index (0-indexed)
870         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
871         */
872        public XCN insertProcedurePractitioner(int rep) throws HL7Exception { 
873            return (XCN) super.insertRepetition(12, rep);
874        }
875    
876    
877    
878        /**
879         * Inserts a repetition of
880         * PR1-12: "Procedure Practitioner" at a specific index
881         *
882         * @param rep The repetition index (0-indexed)
883         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
884         */
885        public XCN insertPr112_ProcedurePractitioner(int rep) throws HL7Exception { 
886            return (XCN) super.insertRepetition(12, rep);
887        }
888    
889    
890        /**
891         * Removes a repetition of
892         * PR1-12: "Procedure Practitioner" at a specific index
893         *
894         * @param rep The repetition index (0-indexed)
895         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
896         */
897        public XCN removeProcedurePractitioner(int rep) throws HL7Exception { 
898            return (XCN) super.removeRepetition(12, rep);
899        }
900    
901    
902        /**
903         * Removes a repetition of
904         * PR1-12: "Procedure Practitioner" at a specific index
905         *
906         * @param rep The repetition index (0-indexed)
907         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
908         */
909        public XCN removePr112_ProcedurePractitioner(int rep) throws HL7Exception { 
910            return (XCN) super.removeRepetition(12, rep);
911        }
912    
913    
914    
915    
916        /**
917         * Returns
918         * PR1-13: "Consent Code" - creates it if necessary
919         */
920        public CE getConsentCode() { 
921            CE ret = null;
922            try {
923                Type t = this.getField(13, 0);
924                ret = (CE)t;
925            } catch (ClassCastException cce) {
926                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
927                throw new RuntimeException(cce);
928            } catch (HL7Exception he) {
929                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
930                throw new RuntimeException(he);
931            }
932            return ret;
933        }
934    
935    
936        /**
937         * Returns
938         * PR1-13: "Consent Code" - creates it if necessary
939         */
940        public CE getPr113_ConsentCode() { 
941            CE ret = null;
942            try {
943                Type t = this.getField(13, 0);
944                ret = (CE)t;
945            } catch (ClassCastException cce) {
946                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
947                throw new RuntimeException(cce);
948            } catch (HL7Exception he) {
949                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
950                throw new RuntimeException(he);
951            }
952            return ret;
953        }
954    
955    
956    
957        /**
958         * Returns
959         * PR1-14: "Procedure Priority" - creates it if necessary
960         */
961        public NM getProcedurePriority() { 
962            NM ret = null;
963            try {
964                Type t = this.getField(14, 0);
965                ret = (NM)t;
966            } catch (ClassCastException cce) {
967                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
968                throw new RuntimeException(cce);
969            } catch (HL7Exception he) {
970                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
971                throw new RuntimeException(he);
972            }
973            return ret;
974        }
975    
976    
977        /**
978         * Returns
979         * PR1-14: "Procedure Priority" - creates it if necessary
980         */
981        public NM getPr114_ProcedurePriority() { 
982            NM ret = null;
983            try {
984                Type t = this.getField(14, 0);
985                ret = (NM)t;
986            } catch (ClassCastException cce) {
987                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
988                throw new RuntimeException(cce);
989            } catch (HL7Exception he) {
990                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
991                throw new RuntimeException(he);
992            }
993            return ret;
994        }
995    
996    
997    
998        /**
999         * Returns
1000         * PR1-15: "Associated Diagnosis Code" - creates it if necessary
1001         */
1002        public CE getAssociatedDiagnosisCode() { 
1003            CE ret = null;
1004            try {
1005                Type t = this.getField(15, 0);
1006                ret = (CE)t;
1007            } catch (ClassCastException cce) {
1008                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1009                throw new RuntimeException(cce);
1010            } catch (HL7Exception he) {
1011                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1012                throw new RuntimeException(he);
1013            }
1014            return ret;
1015        }
1016    
1017    
1018        /**
1019         * Returns
1020         * PR1-15: "Associated Diagnosis Code" - creates it if necessary
1021         */
1022        public CE getPr115_AssociatedDiagnosisCode() { 
1023            CE ret = null;
1024            try {
1025                Type t = this.getField(15, 0);
1026                ret = (CE)t;
1027            } catch (ClassCastException cce) {
1028                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1029                throw new RuntimeException(cce);
1030            } catch (HL7Exception he) {
1031                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1032                throw new RuntimeException(he);
1033            }
1034            return ret;
1035        }
1036    
1037    
1038        /**
1039         * Returns all repetitions of Procedure Code Modifier (PR1-16).
1040         */
1041        public CE[] getProcedureCodeModifier() {
1042            CE[] ret = null;
1043            try {
1044                Type[] t = this.getField(16);  
1045                ret = new CE[t.length];
1046                for (int i = 0; i < ret.length; i++) {
1047                    ret[i] = (CE)t[i];
1048                }
1049            } catch (ClassCastException cce) {
1050                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1051                throw new RuntimeException(cce);
1052            } catch (HL7Exception he) {
1053                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1054                throw new RuntimeException(he);
1055            }
1056            return ret;
1057        }
1058    
1059    
1060        /**
1061         * Returns a count of the current number of repetitions of Procedure Code Modifier (PR1-16).
1062         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1063         * it will return zero.
1064         */
1065        public int getProcedureCodeModifierReps() {
1066            CE[] ret = null;
1067            try {
1068                Type[] t = this.getField(16);
1069                return t.length;  
1070            } catch (ClassCastException cce) {
1071                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1072                throw new RuntimeException(cce);
1073            } catch (HL7Exception he) {
1074                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1075                throw new RuntimeException(he);
1076            }
1077        }
1078    
1079    
1080        /**
1081         * Returns a specific repetition of
1082         * PR1-16: "Procedure Code Modifier" - creates it if necessary
1083         *
1084         * @param rep The repetition index (0-indexed)
1085         */
1086        public CE getProcedureCodeModifier(int rep) { 
1087            CE ret = null;
1088            try {
1089                Type t = this.getField(16, rep);
1090                ret = (CE)t;
1091            } catch (ClassCastException cce) {
1092                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1093                throw new RuntimeException(cce);
1094            } catch (HL7Exception he) {
1095                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1096                throw new RuntimeException(he);
1097            }
1098            return ret;
1099        }
1100    
1101        /**
1102         * Returns a specific repetition of
1103         * PR1-16: "Procedure Code Modifier" - creates it if necessary
1104         *
1105         * @param rep The repetition index (0-indexed)
1106         */
1107        public CE getPr116_ProcedureCodeModifier(int rep) { 
1108            CE ret = null;
1109            try {
1110                Type t = this.getField(16, rep);
1111                ret = (CE)t;
1112            } catch (ClassCastException cce) {
1113                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1114                throw new RuntimeException(cce);
1115            } catch (HL7Exception he) {
1116                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1117                throw new RuntimeException(he);
1118            }
1119            return ret;
1120        }
1121    
1122    
1123        /**
1124         * Returns a count of the current number of repetitions of Procedure Code Modifier (PR1-16).
1125         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1126         * it will return zero.
1127         */
1128        public int getPr116_ProcedureCodeModifierReps() {
1129            CE[] ret = null;
1130            try {
1131                Type[] t = this.getField(16);
1132                return t.length;  
1133            } catch (ClassCastException cce) {
1134                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1135                throw new RuntimeException(cce);
1136            } catch (HL7Exception he) {
1137                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1138                throw new RuntimeException(he);
1139            }
1140        }
1141    
1142    
1143    
1144        /**
1145         * Inserts a repetition of
1146         * PR1-16: "Procedure Code Modifier" at a specific index
1147         *
1148         * @param rep The repetition index (0-indexed)
1149         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1150         */
1151        public CE insertProcedureCodeModifier(int rep) throws HL7Exception { 
1152            return (CE) super.insertRepetition(16, rep);
1153        }
1154    
1155    
1156    
1157        /**
1158         * Inserts a repetition of
1159         * PR1-16: "Procedure Code Modifier" at a specific index
1160         *
1161         * @param rep The repetition index (0-indexed)
1162         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1163         */
1164        public CE insertPr116_ProcedureCodeModifier(int rep) throws HL7Exception { 
1165            return (CE) super.insertRepetition(16, rep);
1166        }
1167    
1168    
1169        /**
1170         * Removes a repetition of
1171         * PR1-16: "Procedure Code Modifier" at a specific index
1172         *
1173         * @param rep The repetition index (0-indexed)
1174         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1175         */
1176        public CE removeProcedureCodeModifier(int rep) throws HL7Exception { 
1177            return (CE) super.removeRepetition(16, rep);
1178        }
1179    
1180    
1181        /**
1182         * Removes a repetition of
1183         * PR1-16: "Procedure Code Modifier" at a specific index
1184         *
1185         * @param rep The repetition index (0-indexed)
1186         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1187         */
1188        public CE removePr116_ProcedureCodeModifier(int rep) throws HL7Exception { 
1189            return (CE) super.removeRepetition(16, rep);
1190        }
1191    
1192    
1193    
1194    
1195    
1196    
1197        /** {@inheritDoc} */   
1198        protected Type createNewTypeWithoutReflection(int field) {
1199           switch (field) {
1200              case 0: return new SI(getMessage());
1201              case 1: return new IS(getMessage(), new Integer( 89 ));
1202              case 2: return new CE(getMessage());
1203              case 3: return new ST(getMessage());
1204              case 4: return new TS(getMessage());
1205              case 5: return new IS(getMessage(), new Integer( 230 ));
1206              case 6: return new NM(getMessage());
1207              case 7: return new XCN(getMessage());
1208              case 8: return new IS(getMessage(), new Integer( 19 ));
1209              case 9: return new NM(getMessage());
1210              case 10: return new XCN(getMessage());
1211              case 11: return new XCN(getMessage());
1212              case 12: return new CE(getMessage());
1213              case 13: return new NM(getMessage());
1214              case 14: return new CE(getMessage());
1215              case 15: return new CE(getMessage());
1216              default: return null;
1217           }
1218       }
1219    
1220    
1221    }
1222