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.segment;
009    
010    // import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.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 PV2 message segment (Patient visit - additional information). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PV2-1: Prior Pending Location (PL) <b>optional </b>
027         * <li>PV2-2: Accommodation Code (CE) <b>optional </b>
028         * <li>PV2-3: Admit Reason (CE) <b>optional </b>
029         * <li>PV2-4: Transfer Reason (CE) <b>optional </b>
030         * <li>PV2-5: Patient Valuables (ST) <b>optional repeating</b>
031         * <li>PV2-6: Patient Valuables Location (ST) <b>optional </b>
032         * <li>PV2-7: Visit User Code (IS) <b>optional repeating</b>
033         * <li>PV2-8: Expected Admit Date/Time (TS) <b>optional </b>
034         * <li>PV2-9: Expected Discharge Date/Time (TS) <b>optional </b>
035         * <li>PV2-10: Estimated Length of Inpatient Stay (NM) <b>optional </b>
036         * <li>PV2-11: Actual Length of Inpatient Stay (NM) <b>optional </b>
037         * <li>PV2-12: Visit Description (ST) <b>optional </b>
038         * <li>PV2-13: Referral Source Code (XCN) <b>optional repeating</b>
039         * <li>PV2-14: Previous Service Date (DT) <b>optional </b>
040         * <li>PV2-15: Employment Illness Related Indicator (ID) <b>optional </b>
041         * <li>PV2-16: Purge Status Code (IS) <b>optional </b>
042         * <li>PV2-17: Purge Status Date (DT) <b>optional </b>
043         * <li>PV2-18: Special Program Code (IS) <b>optional </b>
044         * <li>PV2-19: Retention Indicator (ID) <b>optional </b>
045         * <li>PV2-20: Expected Number of Insurance Plans (NM) <b>optional </b>
046         * <li>PV2-21: Visit Publicity Code (IS) <b>optional </b>
047         * <li>PV2-22: Visit Protection Indicator (ID) <b>optional </b>
048         * <li>PV2-23: Clinic Organization Name (XON) <b>optional repeating</b>
049         * <li>PV2-24: Patient Status Code (IS) <b>optional </b>
050         * <li>PV2-25: Visit Priority Code (IS) <b>optional </b>
051         * <li>PV2-26: Previous Treatment Date (DT) <b>optional </b>
052         * <li>PV2-27: Expected Discharge Disposition (IS) <b>optional </b>
053         * <li>PV2-28: Signature on File Date (DT) <b>optional </b>
054         * <li>PV2-29: First Similar Illness Date (DT) <b>optional </b>
055         * <li>PV2-30: Patient Charge Adjustment Code (CE) <b>optional </b>
056         * <li>PV2-31: Recurring Service Code (IS) <b>optional </b>
057         * <li>PV2-32: Billing Media Code (ID) <b>optional </b>
058         * <li>PV2-33: Expected Surgery Date and Time (TS) <b>optional </b>
059         * <li>PV2-34: Military Partnership Code (ID) <b>optional </b>
060         * <li>PV2-35: Military Non-Availability Code (ID) <b>optional </b>
061         * <li>PV2-36: Newborn Baby Indicator (ID) <b>optional </b>
062         * <li>PV2-37: Baby Detained Indicator (ID) <b>optional </b>
063         * <li>PV2-38: Mode of Arrival Code (CE) <b>optional </b>
064         * <li>PV2-39: Recreational Drug Use Code (CE) <b>optional repeating</b>
065         * <li>PV2-40: Admission Level of Care Code (CE) <b>optional </b>
066         * <li>PV2-41: Precaution Code (CE) <b>optional repeating</b>
067         * <li>PV2-42: Patient Condition Code (CE) <b>optional </b>
068         * <li>PV2-43: Living Will Code (IS) <b>optional </b>
069         * <li>PV2-44: Organ Donor Code (IS) <b>optional </b>
070         * <li>PV2-45: Advance Directive Code (CE) <b>optional repeating</b>
071         * <li>PV2-46: Patient Status Effective Date (DT) <b>optional </b>
072         * <li>PV2-47: Expected LOA Return Date/Time (TS) <b>optional </b>
073     * </ul>
074     */
075    public class PV2 extends AbstractSegment {
076    
077        /** 
078         * Creates a new PV2 segment
079         */
080        public PV2(Group parent, ModelClassFactory factory) {
081           super(parent, factory);
082           init(factory);
083        }
084    
085        private void init(ModelClassFactory factory) {
086           try {
087                                      this.add(PL.class, false, 1, 80, new Object[]{ getMessage(), new Integer(0) }, "Prior Pending Location");
088                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(129) }, "Accommodation Code");
089                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Admit Reason");
090                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Transfer Reason");
091                                      this.add(ST.class, false, 0, 25, new Object[]{ getMessage(), new Integer(0) }, "Patient Valuables");
092                                      this.add(ST.class, false, 1, 25, new Object[]{ getMessage(), new Integer(0) }, "Patient Valuables Location");
093                                      this.add(IS.class, false, 0, 2, new Object[]{ getMessage() }, "Visit User Code");
094                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Expected Admit Date/Time");
095                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Expected Discharge Date/Time");
096                                      this.add(NM.class, false, 1, 3, new Object[]{ getMessage(), new Integer(0) }, "Estimated Length of Inpatient Stay");
097                                      this.add(NM.class, false, 1, 3, new Object[]{ getMessage(), new Integer(0) }, "Actual Length of Inpatient Stay");
098                                      this.add(ST.class, false, 1, 50, new Object[]{ getMessage(), new Integer(0) }, "Visit Description");
099                                      this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Referral Source Code");
100                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Previous Service Date");
101                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Employment Illness Related Indicator");
102                                      this.add(IS.class, false, 1, 1, new Object[]{ getMessage() }, "Purge Status Code");
103                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Purge Status Date");
104                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Special Program Code");
105                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Retention Indicator");
106                                      this.add(NM.class, false, 1, 1, new Object[]{ getMessage(), new Integer(0) }, "Expected Number of Insurance Plans");
107                                      this.add(IS.class, false, 1, 1, new Object[]{ getMessage() }, "Visit Publicity Code");
108                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Visit Protection Indicator");
109                                      this.add(XON.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Clinic Organization Name");
110                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Patient Status Code");
111                                      this.add(IS.class, false, 1, 1, new Object[]{ getMessage() }, "Visit Priority Code");
112                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Previous Treatment Date");
113                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Expected Discharge Disposition");
114                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Signature on File Date");
115                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "First Similar Illness Date");
116                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(218) }, "Patient Charge Adjustment Code");
117                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Recurring Service Code");
118                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Billing Media Code");
119                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Expected Surgery Date and Time");
120                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Military Partnership Code");
121                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Military Non-Availability Code");
122                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Newborn Baby Indicator");
123                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Baby Detained Indicator");
124                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(430) }, "Mode of Arrival Code");
125                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(431) }, "Recreational Drug Use Code");
126                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(432) }, "Admission Level of Care Code");
127                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(433) }, "Precaution Code");
128                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(434) }, "Patient Condition Code");
129                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Living Will Code");
130                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Organ Donor Code");
131                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(435) }, "Advance Directive Code");
132                                      this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Patient Status Effective Date");
133                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Expected LOA Return Date/Time");
134           } catch(HL7Exception e) {
135              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PV2 - this is probably a bug in the source code generator.", e);
136           }
137        }
138    
139    
140    
141        /**
142         * Returns
143         * PV2-1: "Prior Pending Location" - creates it if necessary
144         */
145        public PL getPriorPendingLocation() { 
146            PL ret = null;
147            try {
148                Type t = this.getField(1, 0);
149                ret = (PL)t;
150            } catch (ClassCastException cce) {
151                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
152                throw new RuntimeException(cce);
153            } catch (HL7Exception he) {
154                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
155                throw new RuntimeException(he);
156            }
157            return ret;
158        }
159    
160    
161        /**
162         * Returns
163         * PV2-1: "Prior Pending Location" - creates it if necessary
164         */
165        public PL getPv21_PriorPendingLocation() { 
166            PL ret = null;
167            try {
168                Type t = this.getField(1, 0);
169                ret = (PL)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        /**
183         * Returns
184         * PV2-2: "Accommodation Code" - creates it if necessary
185         */
186        public CE getAccommodationCode() { 
187            CE ret = null;
188            try {
189                Type t = this.getField(2, 0);
190                ret = (CE)t;
191            } catch (ClassCastException cce) {
192                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
193                throw new RuntimeException(cce);
194            } catch (HL7Exception he) {
195                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
196                throw new RuntimeException(he);
197            }
198            return ret;
199        }
200    
201    
202        /**
203         * Returns
204         * PV2-2: "Accommodation Code" - creates it if necessary
205         */
206        public CE getPv22_AccommodationCode() { 
207            CE ret = null;
208            try {
209                Type t = this.getField(2, 0);
210                ret = (CE)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        /**
224         * Returns
225         * PV2-3: "Admit Reason" - creates it if necessary
226         */
227        public CE getAdmitReason() { 
228            CE ret = null;
229            try {
230                Type t = this.getField(3, 0);
231                ret = (CE)t;
232            } catch (ClassCastException cce) {
233                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
234                throw new RuntimeException(cce);
235            } catch (HL7Exception he) {
236                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
237                throw new RuntimeException(he);
238            }
239            return ret;
240        }
241    
242    
243        /**
244         * Returns
245         * PV2-3: "Admit Reason" - creates it if necessary
246         */
247        public CE getPv23_AdmitReason() { 
248            CE ret = null;
249            try {
250                Type t = this.getField(3, 0);
251                ret = (CE)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        /**
265         * Returns
266         * PV2-4: "Transfer Reason" - creates it if necessary
267         */
268        public CE getTransferReason() { 
269            CE ret = null;
270            try {
271                Type t = this.getField(4, 0);
272                ret = (CE)t;
273            } catch (ClassCastException cce) {
274                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
275                throw new RuntimeException(cce);
276            } catch (HL7Exception he) {
277                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
278                throw new RuntimeException(he);
279            }
280            return ret;
281        }
282    
283    
284        /**
285         * Returns
286         * PV2-4: "Transfer Reason" - creates it if necessary
287         */
288        public CE getPv24_TransferReason() { 
289            CE ret = null;
290            try {
291                Type t = this.getField(4, 0);
292                ret = (CE)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 all repetitions of Patient Valuables (PV2-5).
306         */
307        public ST[] getPatientValuables() {
308            ST[] ret = null;
309            try {
310                Type[] t = this.getField(5);  
311                ret = new ST[t.length];
312                for (int i = 0; i < ret.length; i++) {
313                    ret[i] = (ST)t[i];
314                }
315            } catch (ClassCastException cce) {
316                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
317                throw new RuntimeException(cce);
318            } catch (HL7Exception he) {
319                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
320                throw new RuntimeException(he);
321            }
322            return ret;
323        }
324    
325    
326        /**
327         * Returns a count of the current number of repetitions of Patient Valuables (PV2-5).
328         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
329         * it will return zero.
330         */
331        public int getPatientValuablesReps() {
332            ST[] ret = null;
333            try {
334                Type[] t = this.getField(5);
335                return t.length;  
336            } catch (ClassCastException cce) {
337                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
338                throw new RuntimeException(cce);
339            } catch (HL7Exception he) {
340                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
341                throw new RuntimeException(he);
342            }
343        }
344    
345    
346        /**
347         * Returns a specific repetition of
348         * PV2-5: "Patient Valuables" - creates it if necessary
349         *
350         * @param rep The repetition index (0-indexed)
351         */
352        public ST getPatientValuables(int rep) { 
353            ST ret = null;
354            try {
355                Type t = this.getField(5, rep);
356                ret = (ST)t;
357            } catch (ClassCastException cce) {
358                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
359                throw new RuntimeException(cce);
360            } catch (HL7Exception he) {
361                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
362                throw new RuntimeException(he);
363            }
364            return ret;
365        }
366    
367        /**
368         * Returns a specific repetition of
369         * PV2-5: "Patient Valuables" - creates it if necessary
370         *
371         * @param rep The repetition index (0-indexed)
372         */
373        public ST getPv25_PatientValuables(int rep) { 
374            ST ret = null;
375            try {
376                Type t = this.getField(5, rep);
377                ret = (ST)t;
378            } catch (ClassCastException cce) {
379                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
380                throw new RuntimeException(cce);
381            } catch (HL7Exception he) {
382                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
383                throw new RuntimeException(he);
384            }
385            return ret;
386        }
387    
388    
389        /**
390         * Returns a count of the current number of repetitions of Patient Valuables (PV2-5).
391         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
392         * it will return zero.
393         */
394        public int getPv25_PatientValuablesReps() {
395            ST[] ret = null;
396            try {
397                Type[] t = this.getField(5);
398                return t.length;  
399            } catch (ClassCastException cce) {
400                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
401                throw new RuntimeException(cce);
402            } catch (HL7Exception he) {
403                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
404                throw new RuntimeException(he);
405            }
406        }
407    
408    
409    
410        /**
411         * Inserts a repetition of
412         * PV2-5: "Patient Valuables" at a specific index
413         *
414         * @param rep The repetition index (0-indexed)
415         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
416         */
417        public ST insertPatientValuables(int rep) throws HL7Exception { 
418            return (ST) super.insertRepetition(5, rep);
419        }
420    
421    
422    
423        /**
424         * Inserts a repetition of
425         * PV2-5: "Patient Valuables" at a specific index
426         *
427         * @param rep The repetition index (0-indexed)
428         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
429         */
430        public ST insertPv25_PatientValuables(int rep) throws HL7Exception { 
431            return (ST) super.insertRepetition(5, rep);
432        }
433    
434    
435        /**
436         * Removes a repetition of
437         * PV2-5: "Patient Valuables" at a specific index
438         *
439         * @param rep The repetition index (0-indexed)
440         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
441         */
442        public ST removePatientValuables(int rep) throws HL7Exception { 
443            return (ST) super.removeRepetition(5, rep);
444        }
445    
446    
447        /**
448         * Removes a repetition of
449         * PV2-5: "Patient Valuables" at a specific index
450         *
451         * @param rep The repetition index (0-indexed)
452         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
453         */
454        public ST removePv25_PatientValuables(int rep) throws HL7Exception { 
455            return (ST) super.removeRepetition(5, rep);
456        }
457    
458    
459    
460    
461        /**
462         * Returns
463         * PV2-6: "Patient Valuables Location" - creates it if necessary
464         */
465        public ST getPatientValuablesLocation() { 
466            ST ret = null;
467            try {
468                Type t = this.getField(6, 0);
469                ret = (ST)t;
470            } catch (ClassCastException cce) {
471                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
472                throw new RuntimeException(cce);
473            } catch (HL7Exception he) {
474                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
475                throw new RuntimeException(he);
476            }
477            return ret;
478        }
479    
480    
481        /**
482         * Returns
483         * PV2-6: "Patient Valuables Location" - creates it if necessary
484         */
485        public ST getPv26_PatientValuablesLocation() { 
486            ST ret = null;
487            try {
488                Type t = this.getField(6, 0);
489                ret = (ST)t;
490            } catch (ClassCastException cce) {
491                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
492                throw new RuntimeException(cce);
493            } catch (HL7Exception he) {
494                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
495                throw new RuntimeException(he);
496            }
497            return ret;
498        }
499    
500    
501        /**
502         * Returns all repetitions of Visit User Code (PV2-7).
503         */
504        public IS[] getVisitUserCode() {
505            IS[] ret = null;
506            try {
507                Type[] t = this.getField(7);  
508                ret = new IS[t.length];
509                for (int i = 0; i < ret.length; i++) {
510                    ret[i] = (IS)t[i];
511                }
512            } catch (ClassCastException cce) {
513                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
514                throw new RuntimeException(cce);
515            } catch (HL7Exception he) {
516                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
517                throw new RuntimeException(he);
518            }
519            return ret;
520        }
521    
522    
523        /**
524         * Returns a count of the current number of repetitions of Visit User Code (PV2-7).
525         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
526         * it will return zero.
527         */
528        public int getVisitUserCodeReps() {
529            IS[] ret = null;
530            try {
531                Type[] t = this.getField(7);
532                return t.length;  
533            } catch (ClassCastException cce) {
534                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
535                throw new RuntimeException(cce);
536            } catch (HL7Exception he) {
537                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
538                throw new RuntimeException(he);
539            }
540        }
541    
542    
543        /**
544         * Returns a specific repetition of
545         * PV2-7: "Visit User Code" - creates it if necessary
546         *
547         * @param rep The repetition index (0-indexed)
548         */
549        public IS getVisitUserCode(int rep) { 
550            IS ret = null;
551            try {
552                Type t = this.getField(7, rep);
553                ret = (IS)t;
554            } catch (ClassCastException cce) {
555                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
556                throw new RuntimeException(cce);
557            } catch (HL7Exception he) {
558                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
559                throw new RuntimeException(he);
560            }
561            return ret;
562        }
563    
564        /**
565         * Returns a specific repetition of
566         * PV2-7: "Visit User Code" - creates it if necessary
567         *
568         * @param rep The repetition index (0-indexed)
569         */
570        public IS getPv27_VisitUserCode(int rep) { 
571            IS ret = null;
572            try {
573                Type t = this.getField(7, rep);
574                ret = (IS)t;
575            } catch (ClassCastException cce) {
576                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
577                throw new RuntimeException(cce);
578            } catch (HL7Exception he) {
579                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
580                throw new RuntimeException(he);
581            }
582            return ret;
583        }
584    
585    
586        /**
587         * Returns a count of the current number of repetitions of Visit User Code (PV2-7).
588         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
589         * it will return zero.
590         */
591        public int getPv27_VisitUserCodeReps() {
592            IS[] ret = null;
593            try {
594                Type[] t = this.getField(7);
595                return t.length;  
596            } catch (ClassCastException cce) {
597                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
598                throw new RuntimeException(cce);
599            } catch (HL7Exception he) {
600                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
601                throw new RuntimeException(he);
602            }
603        }
604    
605    
606    
607        /**
608         * Inserts a repetition of
609         * PV2-7: "Visit User Code" at a specific index
610         *
611         * @param rep The repetition index (0-indexed)
612         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
613         */
614        public IS insertVisitUserCode(int rep) throws HL7Exception { 
615            return (IS) super.insertRepetition(7, rep);
616        }
617    
618    
619    
620        /**
621         * Inserts a repetition of
622         * PV2-7: "Visit User Code" at a specific index
623         *
624         * @param rep The repetition index (0-indexed)
625         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
626         */
627        public IS insertPv27_VisitUserCode(int rep) throws HL7Exception { 
628            return (IS) super.insertRepetition(7, rep);
629        }
630    
631    
632        /**
633         * Removes a repetition of
634         * PV2-7: "Visit User Code" at a specific index
635         *
636         * @param rep The repetition index (0-indexed)
637         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
638         */
639        public IS removeVisitUserCode(int rep) throws HL7Exception { 
640            return (IS) super.removeRepetition(7, rep);
641        }
642    
643    
644        /**
645         * Removes a repetition of
646         * PV2-7: "Visit User Code" at a specific index
647         *
648         * @param rep The repetition index (0-indexed)
649         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
650         */
651        public IS removePv27_VisitUserCode(int rep) throws HL7Exception { 
652            return (IS) super.removeRepetition(7, rep);
653        }
654    
655    
656    
657    
658        /**
659         * Returns
660         * PV2-8: "Expected Admit Date/Time" - creates it if necessary
661         */
662        public TS getExpectedAdmitDateTime() { 
663            TS ret = null;
664            try {
665                Type t = this.getField(8, 0);
666                ret = (TS)t;
667            } catch (ClassCastException cce) {
668                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
669                throw new RuntimeException(cce);
670            } catch (HL7Exception he) {
671                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
672                throw new RuntimeException(he);
673            }
674            return ret;
675        }
676    
677    
678        /**
679         * Returns
680         * PV2-8: "Expected Admit Date/Time" - creates it if necessary
681         */
682        public TS getPv28_ExpectedAdmitDateTime() { 
683            TS ret = null;
684            try {
685                Type t = this.getField(8, 0);
686                ret = (TS)t;
687            } catch (ClassCastException cce) {
688                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
689                throw new RuntimeException(cce);
690            } catch (HL7Exception he) {
691                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
692                throw new RuntimeException(he);
693            }
694            return ret;
695        }
696    
697    
698    
699        /**
700         * Returns
701         * PV2-9: "Expected Discharge Date/Time" - creates it if necessary
702         */
703        public TS getExpectedDischargeDateTime() { 
704            TS ret = null;
705            try {
706                Type t = this.getField(9, 0);
707                ret = (TS)t;
708            } catch (ClassCastException cce) {
709                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
710                throw new RuntimeException(cce);
711            } catch (HL7Exception he) {
712                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
713                throw new RuntimeException(he);
714            }
715            return ret;
716        }
717    
718    
719        /**
720         * Returns
721         * PV2-9: "Expected Discharge Date/Time" - creates it if necessary
722         */
723        public TS getPv29_ExpectedDischargeDateTime() { 
724            TS ret = null;
725            try {
726                Type t = this.getField(9, 0);
727                ret = (TS)t;
728            } catch (ClassCastException cce) {
729                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
730                throw new RuntimeException(cce);
731            } catch (HL7Exception he) {
732                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
733                throw new RuntimeException(he);
734            }
735            return ret;
736        }
737    
738    
739    
740        /**
741         * Returns
742         * PV2-10: "Estimated Length of Inpatient Stay" - creates it if necessary
743         */
744        public NM getEstimatedLengthOfInpatientStay() { 
745            NM ret = null;
746            try {
747                Type t = this.getField(10, 0);
748                ret = (NM)t;
749            } catch (ClassCastException cce) {
750                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
751                throw new RuntimeException(cce);
752            } catch (HL7Exception he) {
753                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
754                throw new RuntimeException(he);
755            }
756            return ret;
757        }
758    
759    
760        /**
761         * Returns
762         * PV2-10: "Estimated Length of Inpatient Stay" - creates it if necessary
763         */
764        public NM getPv210_EstimatedLengthOfInpatientStay() { 
765            NM ret = null;
766            try {
767                Type t = this.getField(10, 0);
768                ret = (NM)t;
769            } catch (ClassCastException cce) {
770                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
771                throw new RuntimeException(cce);
772            } catch (HL7Exception he) {
773                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
774                throw new RuntimeException(he);
775            }
776            return ret;
777        }
778    
779    
780    
781        /**
782         * Returns
783         * PV2-11: "Actual Length of Inpatient Stay" - creates it if necessary
784         */
785        public NM getActualLengthOfInpatientStay() { 
786            NM ret = null;
787            try {
788                Type t = this.getField(11, 0);
789                ret = (NM)t;
790            } catch (ClassCastException cce) {
791                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
792                throw new RuntimeException(cce);
793            } catch (HL7Exception he) {
794                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
795                throw new RuntimeException(he);
796            }
797            return ret;
798        }
799    
800    
801        /**
802         * Returns
803         * PV2-11: "Actual Length of Inpatient Stay" - creates it if necessary
804         */
805        public NM getPv211_ActualLengthOfInpatientStay() { 
806            NM ret = null;
807            try {
808                Type t = this.getField(11, 0);
809                ret = (NM)t;
810            } catch (ClassCastException cce) {
811                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
812                throw new RuntimeException(cce);
813            } catch (HL7Exception he) {
814                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
815                throw new RuntimeException(he);
816            }
817            return ret;
818        }
819    
820    
821    
822        /**
823         * Returns
824         * PV2-12: "Visit Description" - creates it if necessary
825         */
826        public ST getVisitDescription() { 
827            ST ret = null;
828            try {
829                Type t = this.getField(12, 0);
830                ret = (ST)t;
831            } catch (ClassCastException cce) {
832                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
833                throw new RuntimeException(cce);
834            } catch (HL7Exception he) {
835                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
836                throw new RuntimeException(he);
837            }
838            return ret;
839        }
840    
841    
842        /**
843         * Returns
844         * PV2-12: "Visit Description" - creates it if necessary
845         */
846        public ST getPv212_VisitDescription() { 
847            ST ret = null;
848            try {
849                Type t = this.getField(12, 0);
850                ret = (ST)t;
851            } catch (ClassCastException cce) {
852                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
853                throw new RuntimeException(cce);
854            } catch (HL7Exception he) {
855                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
856                throw new RuntimeException(he);
857            }
858            return ret;
859        }
860    
861    
862        /**
863         * Returns all repetitions of Referral Source Code (PV2-13).
864         */
865        public XCN[] getReferralSourceCode() {
866            XCN[] ret = null;
867            try {
868                Type[] t = this.getField(13);  
869                ret = new XCN[t.length];
870                for (int i = 0; i < ret.length; i++) {
871                    ret[i] = (XCN)t[i];
872                }
873            } catch (ClassCastException cce) {
874                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
875                throw new RuntimeException(cce);
876            } catch (HL7Exception he) {
877                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
878                throw new RuntimeException(he);
879            }
880            return ret;
881        }
882    
883    
884        /**
885         * Returns a count of the current number of repetitions of Referral Source Code (PV2-13).
886         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
887         * it will return zero.
888         */
889        public int getReferralSourceCodeReps() {
890            XCN[] ret = null;
891            try {
892                Type[] t = this.getField(13);
893                return t.length;  
894            } catch (ClassCastException cce) {
895                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
896                throw new RuntimeException(cce);
897            } catch (HL7Exception he) {
898                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
899                throw new RuntimeException(he);
900            }
901        }
902    
903    
904        /**
905         * Returns a specific repetition of
906         * PV2-13: "Referral Source Code" - creates it if necessary
907         *
908         * @param rep The repetition index (0-indexed)
909         */
910        public XCN getReferralSourceCode(int rep) { 
911            XCN ret = null;
912            try {
913                Type t = this.getField(13, rep);
914                ret = (XCN)t;
915            } catch (ClassCastException cce) {
916                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
917                throw new RuntimeException(cce);
918            } catch (HL7Exception he) {
919                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
920                throw new RuntimeException(he);
921            }
922            return ret;
923        }
924    
925        /**
926         * Returns a specific repetition of
927         * PV2-13: "Referral Source Code" - creates it if necessary
928         *
929         * @param rep The repetition index (0-indexed)
930         */
931        public XCN getPv213_ReferralSourceCode(int rep) { 
932            XCN ret = null;
933            try {
934                Type t = this.getField(13, rep);
935                ret = (XCN)t;
936            } catch (ClassCastException cce) {
937                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
938                throw new RuntimeException(cce);
939            } catch (HL7Exception he) {
940                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
941                throw new RuntimeException(he);
942            }
943            return ret;
944        }
945    
946    
947        /**
948         * Returns a count of the current number of repetitions of Referral Source Code (PV2-13).
949         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
950         * it will return zero.
951         */
952        public int getPv213_ReferralSourceCodeReps() {
953            XCN[] ret = null;
954            try {
955                Type[] t = this.getField(13);
956                return t.length;  
957            } catch (ClassCastException cce) {
958                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
959                throw new RuntimeException(cce);
960            } catch (HL7Exception he) {
961                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
962                throw new RuntimeException(he);
963            }
964        }
965    
966    
967    
968        /**
969         * Inserts a repetition of
970         * PV2-13: "Referral Source Code" at a specific index
971         *
972         * @param rep The repetition index (0-indexed)
973         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
974         */
975        public XCN insertReferralSourceCode(int rep) throws HL7Exception { 
976            return (XCN) super.insertRepetition(13, rep);
977        }
978    
979    
980    
981        /**
982         * Inserts a repetition of
983         * PV2-13: "Referral Source Code" at a specific index
984         *
985         * @param rep The repetition index (0-indexed)
986         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
987         */
988        public XCN insertPv213_ReferralSourceCode(int rep) throws HL7Exception { 
989            return (XCN) super.insertRepetition(13, rep);
990        }
991    
992    
993        /**
994         * Removes a repetition of
995         * PV2-13: "Referral Source Code" at a specific index
996         *
997         * @param rep The repetition index (0-indexed)
998         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
999         */
1000        public XCN removeReferralSourceCode(int rep) throws HL7Exception { 
1001            return (XCN) super.removeRepetition(13, rep);
1002        }
1003    
1004    
1005        /**
1006         * Removes a repetition of
1007         * PV2-13: "Referral Source Code" at a specific index
1008         *
1009         * @param rep The repetition index (0-indexed)
1010         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1011         */
1012        public XCN removePv213_ReferralSourceCode(int rep) throws HL7Exception { 
1013            return (XCN) super.removeRepetition(13, rep);
1014        }
1015    
1016    
1017    
1018    
1019        /**
1020         * Returns
1021         * PV2-14: "Previous Service Date" - creates it if necessary
1022         */
1023        public DT getPreviousServiceDate() { 
1024            DT ret = null;
1025            try {
1026                Type t = this.getField(14, 0);
1027                ret = (DT)t;
1028            } catch (ClassCastException cce) {
1029                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1030                throw new RuntimeException(cce);
1031            } catch (HL7Exception he) {
1032                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1033                throw new RuntimeException(he);
1034            }
1035            return ret;
1036        }
1037    
1038    
1039        /**
1040         * Returns
1041         * PV2-14: "Previous Service Date" - creates it if necessary
1042         */
1043        public DT getPv214_PreviousServiceDate() { 
1044            DT ret = null;
1045            try {
1046                Type t = this.getField(14, 0);
1047                ret = (DT)t;
1048            } catch (ClassCastException cce) {
1049                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1050                throw new RuntimeException(cce);
1051            } catch (HL7Exception he) {
1052                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1053                throw new RuntimeException(he);
1054            }
1055            return ret;
1056        }
1057    
1058    
1059    
1060        /**
1061         * Returns
1062         * PV2-15: "Employment Illness Related Indicator" - creates it if necessary
1063         */
1064        public ID getEmploymentIllnessRelatedIndicator() { 
1065            ID ret = null;
1066            try {
1067                Type t = this.getField(15, 0);
1068                ret = (ID)t;
1069            } catch (ClassCastException cce) {
1070                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1071                throw new RuntimeException(cce);
1072            } catch (HL7Exception he) {
1073                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1074                throw new RuntimeException(he);
1075            }
1076            return ret;
1077        }
1078    
1079    
1080        /**
1081         * Returns
1082         * PV2-15: "Employment Illness Related Indicator" - creates it if necessary
1083         */
1084        public ID getPv215_EmploymentIllnessRelatedIndicator() { 
1085            ID ret = null;
1086            try {
1087                Type t = this.getField(15, 0);
1088                ret = (ID)t;
1089            } catch (ClassCastException cce) {
1090                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1091                throw new RuntimeException(cce);
1092            } catch (HL7Exception he) {
1093                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1094                throw new RuntimeException(he);
1095            }
1096            return ret;
1097        }
1098    
1099    
1100    
1101        /**
1102         * Returns
1103         * PV2-16: "Purge Status Code" - creates it if necessary
1104         */
1105        public IS getPurgeStatusCode() { 
1106            IS ret = null;
1107            try {
1108                Type t = this.getField(16, 0);
1109                ret = (IS)t;
1110            } catch (ClassCastException cce) {
1111                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1112                throw new RuntimeException(cce);
1113            } catch (HL7Exception he) {
1114                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1115                throw new RuntimeException(he);
1116            }
1117            return ret;
1118        }
1119    
1120    
1121        /**
1122         * Returns
1123         * PV2-16: "Purge Status Code" - creates it if necessary
1124         */
1125        public IS getPv216_PurgeStatusCode() { 
1126            IS ret = null;
1127            try {
1128                Type t = this.getField(16, 0);
1129                ret = (IS)t;
1130            } catch (ClassCastException cce) {
1131                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1132                throw new RuntimeException(cce);
1133            } catch (HL7Exception he) {
1134                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1135                throw new RuntimeException(he);
1136            }
1137            return ret;
1138        }
1139    
1140    
1141    
1142        /**
1143         * Returns
1144         * PV2-17: "Purge Status Date" - creates it if necessary
1145         */
1146        public DT getPurgeStatusDate() { 
1147            DT ret = null;
1148            try {
1149                Type t = this.getField(17, 0);
1150                ret = (DT)t;
1151            } catch (ClassCastException cce) {
1152                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1153                throw new RuntimeException(cce);
1154            } catch (HL7Exception he) {
1155                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1156                throw new RuntimeException(he);
1157            }
1158            return ret;
1159        }
1160    
1161    
1162        /**
1163         * Returns
1164         * PV2-17: "Purge Status Date" - creates it if necessary
1165         */
1166        public DT getPv217_PurgeStatusDate() { 
1167            DT ret = null;
1168            try {
1169                Type t = this.getField(17, 0);
1170                ret = (DT)t;
1171            } catch (ClassCastException cce) {
1172                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1173                throw new RuntimeException(cce);
1174            } catch (HL7Exception he) {
1175                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1176                throw new RuntimeException(he);
1177            }
1178            return ret;
1179        }
1180    
1181    
1182    
1183        /**
1184         * Returns
1185         * PV2-18: "Special Program Code" - creates it if necessary
1186         */
1187        public IS getSpecialProgramCode() { 
1188            IS ret = null;
1189            try {
1190                Type t = this.getField(18, 0);
1191                ret = (IS)t;
1192            } catch (ClassCastException cce) {
1193                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1194                throw new RuntimeException(cce);
1195            } catch (HL7Exception he) {
1196                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1197                throw new RuntimeException(he);
1198            }
1199            return ret;
1200        }
1201    
1202    
1203        /**
1204         * Returns
1205         * PV2-18: "Special Program Code" - creates it if necessary
1206         */
1207        public IS getPv218_SpecialProgramCode() { 
1208            IS ret = null;
1209            try {
1210                Type t = this.getField(18, 0);
1211                ret = (IS)t;
1212            } catch (ClassCastException cce) {
1213                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1214                throw new RuntimeException(cce);
1215            } catch (HL7Exception he) {
1216                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1217                throw new RuntimeException(he);
1218            }
1219            return ret;
1220        }
1221    
1222    
1223    
1224        /**
1225         * Returns
1226         * PV2-19: "Retention Indicator" - creates it if necessary
1227         */
1228        public ID getRetentionIndicator() { 
1229            ID ret = null;
1230            try {
1231                Type t = this.getField(19, 0);
1232                ret = (ID)t;
1233            } catch (ClassCastException cce) {
1234                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1235                throw new RuntimeException(cce);
1236            } catch (HL7Exception he) {
1237                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1238                throw new RuntimeException(he);
1239            }
1240            return ret;
1241        }
1242    
1243    
1244        /**
1245         * Returns
1246         * PV2-19: "Retention Indicator" - creates it if necessary
1247         */
1248        public ID getPv219_RetentionIndicator() { 
1249            ID ret = null;
1250            try {
1251                Type t = this.getField(19, 0);
1252                ret = (ID)t;
1253            } catch (ClassCastException cce) {
1254                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1255                throw new RuntimeException(cce);
1256            } catch (HL7Exception he) {
1257                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1258                throw new RuntimeException(he);
1259            }
1260            return ret;
1261        }
1262    
1263    
1264    
1265        /**
1266         * Returns
1267         * PV2-20: "Expected Number of Insurance Plans" - creates it if necessary
1268         */
1269        public NM getExpectedNumberOfInsurancePlans() { 
1270            NM ret = null;
1271            try {
1272                Type t = this.getField(20, 0);
1273                ret = (NM)t;
1274            } catch (ClassCastException cce) {
1275                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1276                throw new RuntimeException(cce);
1277            } catch (HL7Exception he) {
1278                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1279                throw new RuntimeException(he);
1280            }
1281            return ret;
1282        }
1283    
1284    
1285        /**
1286         * Returns
1287         * PV2-20: "Expected Number of Insurance Plans" - creates it if necessary
1288         */
1289        public NM getPv220_ExpectedNumberOfInsurancePlans() { 
1290            NM ret = null;
1291            try {
1292                Type t = this.getField(20, 0);
1293                ret = (NM)t;
1294            } catch (ClassCastException cce) {
1295                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1296                throw new RuntimeException(cce);
1297            } catch (HL7Exception he) {
1298                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1299                throw new RuntimeException(he);
1300            }
1301            return ret;
1302        }
1303    
1304    
1305    
1306        /**
1307         * Returns
1308         * PV2-21: "Visit Publicity Code" - creates it if necessary
1309         */
1310        public IS getVisitPublicityCode() { 
1311            IS ret = null;
1312            try {
1313                Type t = this.getField(21, 0);
1314                ret = (IS)t;
1315            } catch (ClassCastException cce) {
1316                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1317                throw new RuntimeException(cce);
1318            } catch (HL7Exception he) {
1319                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1320                throw new RuntimeException(he);
1321            }
1322            return ret;
1323        }
1324    
1325    
1326        /**
1327         * Returns
1328         * PV2-21: "Visit Publicity Code" - creates it if necessary
1329         */
1330        public IS getPv221_VisitPublicityCode() { 
1331            IS ret = null;
1332            try {
1333                Type t = this.getField(21, 0);
1334                ret = (IS)t;
1335            } catch (ClassCastException cce) {
1336                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1337                throw new RuntimeException(cce);
1338            } catch (HL7Exception he) {
1339                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1340                throw new RuntimeException(he);
1341            }
1342            return ret;
1343        }
1344    
1345    
1346    
1347        /**
1348         * Returns
1349         * PV2-22: "Visit Protection Indicator" - creates it if necessary
1350         */
1351        public ID getVisitProtectionIndicator() { 
1352            ID ret = null;
1353            try {
1354                Type t = this.getField(22, 0);
1355                ret = (ID)t;
1356            } catch (ClassCastException cce) {
1357                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1358                throw new RuntimeException(cce);
1359            } catch (HL7Exception he) {
1360                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1361                throw new RuntimeException(he);
1362            }
1363            return ret;
1364        }
1365    
1366    
1367        /**
1368         * Returns
1369         * PV2-22: "Visit Protection Indicator" - creates it if necessary
1370         */
1371        public ID getPv222_VisitProtectionIndicator() { 
1372            ID ret = null;
1373            try {
1374                Type t = this.getField(22, 0);
1375                ret = (ID)t;
1376            } catch (ClassCastException cce) {
1377                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1378                throw new RuntimeException(cce);
1379            } catch (HL7Exception he) {
1380                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1381                throw new RuntimeException(he);
1382            }
1383            return ret;
1384        }
1385    
1386    
1387        /**
1388         * Returns all repetitions of Clinic Organization Name (PV2-23).
1389         */
1390        public XON[] getClinicOrganizationName() {
1391            XON[] ret = null;
1392            try {
1393                Type[] t = this.getField(23);  
1394                ret = new XON[t.length];
1395                for (int i = 0; i < ret.length; i++) {
1396                    ret[i] = (XON)t[i];
1397                }
1398            } catch (ClassCastException cce) {
1399                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1400                throw new RuntimeException(cce);
1401            } catch (HL7Exception he) {
1402                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1403                throw new RuntimeException(he);
1404            }
1405            return ret;
1406        }
1407    
1408    
1409        /**
1410         * Returns a count of the current number of repetitions of Clinic Organization Name (PV2-23).
1411         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1412         * it will return zero.
1413         */
1414        public int getClinicOrganizationNameReps() {
1415            XON[] ret = null;
1416            try {
1417                Type[] t = this.getField(23);
1418                return t.length;  
1419            } catch (ClassCastException cce) {
1420                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1421                throw new RuntimeException(cce);
1422            } catch (HL7Exception he) {
1423                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1424                throw new RuntimeException(he);
1425            }
1426        }
1427    
1428    
1429        /**
1430         * Returns a specific repetition of
1431         * PV2-23: "Clinic Organization Name" - creates it if necessary
1432         *
1433         * @param rep The repetition index (0-indexed)
1434         */
1435        public XON getClinicOrganizationName(int rep) { 
1436            XON ret = null;
1437            try {
1438                Type t = this.getField(23, rep);
1439                ret = (XON)t;
1440            } catch (ClassCastException cce) {
1441                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1442                throw new RuntimeException(cce);
1443            } catch (HL7Exception he) {
1444                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1445                throw new RuntimeException(he);
1446            }
1447            return ret;
1448        }
1449    
1450        /**
1451         * Returns a specific repetition of
1452         * PV2-23: "Clinic Organization Name" - creates it if necessary
1453         *
1454         * @param rep The repetition index (0-indexed)
1455         */
1456        public XON getPv223_ClinicOrganizationName(int rep) { 
1457            XON ret = null;
1458            try {
1459                Type t = this.getField(23, rep);
1460                ret = (XON)t;
1461            } catch (ClassCastException cce) {
1462                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1463                throw new RuntimeException(cce);
1464            } catch (HL7Exception he) {
1465                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1466                throw new RuntimeException(he);
1467            }
1468            return ret;
1469        }
1470    
1471    
1472        /**
1473         * Returns a count of the current number of repetitions of Clinic Organization Name (PV2-23).
1474         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1475         * it will return zero.
1476         */
1477        public int getPv223_ClinicOrganizationNameReps() {
1478            XON[] ret = null;
1479            try {
1480                Type[] t = this.getField(23);
1481                return t.length;  
1482            } catch (ClassCastException cce) {
1483                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1484                throw new RuntimeException(cce);
1485            } catch (HL7Exception he) {
1486                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1487                throw new RuntimeException(he);
1488            }
1489        }
1490    
1491    
1492    
1493        /**
1494         * Inserts a repetition of
1495         * PV2-23: "Clinic Organization Name" at a specific index
1496         *
1497         * @param rep The repetition index (0-indexed)
1498         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1499         */
1500        public XON insertClinicOrganizationName(int rep) throws HL7Exception { 
1501            return (XON) super.insertRepetition(23, rep);
1502        }
1503    
1504    
1505    
1506        /**
1507         * Inserts a repetition of
1508         * PV2-23: "Clinic Organization Name" at a specific index
1509         *
1510         * @param rep The repetition index (0-indexed)
1511         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1512         */
1513        public XON insertPv223_ClinicOrganizationName(int rep) throws HL7Exception { 
1514            return (XON) super.insertRepetition(23, rep);
1515        }
1516    
1517    
1518        /**
1519         * Removes a repetition of
1520         * PV2-23: "Clinic Organization Name" at a specific index
1521         *
1522         * @param rep The repetition index (0-indexed)
1523         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1524         */
1525        public XON removeClinicOrganizationName(int rep) throws HL7Exception { 
1526            return (XON) super.removeRepetition(23, rep);
1527        }
1528    
1529    
1530        /**
1531         * Removes a repetition of
1532         * PV2-23: "Clinic Organization Name" at a specific index
1533         *
1534         * @param rep The repetition index (0-indexed)
1535         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1536         */
1537        public XON removePv223_ClinicOrganizationName(int rep) throws HL7Exception { 
1538            return (XON) super.removeRepetition(23, rep);
1539        }
1540    
1541    
1542    
1543    
1544        /**
1545         * Returns
1546         * PV2-24: "Patient Status Code" - creates it if necessary
1547         */
1548        public IS getPatientStatusCode() { 
1549            IS ret = null;
1550            try {
1551                Type t = this.getField(24, 0);
1552                ret = (IS)t;
1553            } catch (ClassCastException cce) {
1554                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1555                throw new RuntimeException(cce);
1556            } catch (HL7Exception he) {
1557                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1558                throw new RuntimeException(he);
1559            }
1560            return ret;
1561        }
1562    
1563    
1564        /**
1565         * Returns
1566         * PV2-24: "Patient Status Code" - creates it if necessary
1567         */
1568        public IS getPv224_PatientStatusCode() { 
1569            IS ret = null;
1570            try {
1571                Type t = this.getField(24, 0);
1572                ret = (IS)t;
1573            } catch (ClassCastException cce) {
1574                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1575                throw new RuntimeException(cce);
1576            } catch (HL7Exception he) {
1577                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1578                throw new RuntimeException(he);
1579            }
1580            return ret;
1581        }
1582    
1583    
1584    
1585        /**
1586         * Returns
1587         * PV2-25: "Visit Priority Code" - creates it if necessary
1588         */
1589        public IS getVisitPriorityCode() { 
1590            IS ret = null;
1591            try {
1592                Type t = this.getField(25, 0);
1593                ret = (IS)t;
1594            } catch (ClassCastException cce) {
1595                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1596                throw new RuntimeException(cce);
1597            } catch (HL7Exception he) {
1598                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1599                throw new RuntimeException(he);
1600            }
1601            return ret;
1602        }
1603    
1604    
1605        /**
1606         * Returns
1607         * PV2-25: "Visit Priority Code" - creates it if necessary
1608         */
1609        public IS getPv225_VisitPriorityCode() { 
1610            IS ret = null;
1611            try {
1612                Type t = this.getField(25, 0);
1613                ret = (IS)t;
1614            } catch (ClassCastException cce) {
1615                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1616                throw new RuntimeException(cce);
1617            } catch (HL7Exception he) {
1618                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1619                throw new RuntimeException(he);
1620            }
1621            return ret;
1622        }
1623    
1624    
1625    
1626        /**
1627         * Returns
1628         * PV2-26: "Previous Treatment Date" - creates it if necessary
1629         */
1630        public DT getPreviousTreatmentDate() { 
1631            DT ret = null;
1632            try {
1633                Type t = this.getField(26, 0);
1634                ret = (DT)t;
1635            } catch (ClassCastException cce) {
1636                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1637                throw new RuntimeException(cce);
1638            } catch (HL7Exception he) {
1639                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1640                throw new RuntimeException(he);
1641            }
1642            return ret;
1643        }
1644    
1645    
1646        /**
1647         * Returns
1648         * PV2-26: "Previous Treatment Date" - creates it if necessary
1649         */
1650        public DT getPv226_PreviousTreatmentDate() { 
1651            DT ret = null;
1652            try {
1653                Type t = this.getField(26, 0);
1654                ret = (DT)t;
1655            } catch (ClassCastException cce) {
1656                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1657                throw new RuntimeException(cce);
1658            } catch (HL7Exception he) {
1659                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1660                throw new RuntimeException(he);
1661            }
1662            return ret;
1663        }
1664    
1665    
1666    
1667        /**
1668         * Returns
1669         * PV2-27: "Expected Discharge Disposition" - creates it if necessary
1670         */
1671        public IS getExpectedDischargeDisposition() { 
1672            IS ret = null;
1673            try {
1674                Type t = this.getField(27, 0);
1675                ret = (IS)t;
1676            } catch (ClassCastException cce) {
1677                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1678                throw new RuntimeException(cce);
1679            } catch (HL7Exception he) {
1680                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1681                throw new RuntimeException(he);
1682            }
1683            return ret;
1684        }
1685    
1686    
1687        /**
1688         * Returns
1689         * PV2-27: "Expected Discharge Disposition" - creates it if necessary
1690         */
1691        public IS getPv227_ExpectedDischargeDisposition() { 
1692            IS ret = null;
1693            try {
1694                Type t = this.getField(27, 0);
1695                ret = (IS)t;
1696            } catch (ClassCastException cce) {
1697                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1698                throw new RuntimeException(cce);
1699            } catch (HL7Exception he) {
1700                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1701                throw new RuntimeException(he);
1702            }
1703            return ret;
1704        }
1705    
1706    
1707    
1708        /**
1709         * Returns
1710         * PV2-28: "Signature on File Date" - creates it if necessary
1711         */
1712        public DT getSignatureOnFileDate() { 
1713            DT ret = null;
1714            try {
1715                Type t = this.getField(28, 0);
1716                ret = (DT)t;
1717            } catch (ClassCastException cce) {
1718                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1719                throw new RuntimeException(cce);
1720            } catch (HL7Exception he) {
1721                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1722                throw new RuntimeException(he);
1723            }
1724            return ret;
1725        }
1726    
1727    
1728        /**
1729         * Returns
1730         * PV2-28: "Signature on File Date" - creates it if necessary
1731         */
1732        public DT getPv228_SignatureOnFileDate() { 
1733            DT ret = null;
1734            try {
1735                Type t = this.getField(28, 0);
1736                ret = (DT)t;
1737            } catch (ClassCastException cce) {
1738                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1739                throw new RuntimeException(cce);
1740            } catch (HL7Exception he) {
1741                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1742                throw new RuntimeException(he);
1743            }
1744            return ret;
1745        }
1746    
1747    
1748    
1749        /**
1750         * Returns
1751         * PV2-29: "First Similar Illness Date" - creates it if necessary
1752         */
1753        public DT getFirstSimilarIllnessDate() { 
1754            DT ret = null;
1755            try {
1756                Type t = this.getField(29, 0);
1757                ret = (DT)t;
1758            } catch (ClassCastException cce) {
1759                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1760                throw new RuntimeException(cce);
1761            } catch (HL7Exception he) {
1762                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1763                throw new RuntimeException(he);
1764            }
1765            return ret;
1766        }
1767    
1768    
1769        /**
1770         * Returns
1771         * PV2-29: "First Similar Illness Date" - creates it if necessary
1772         */
1773        public DT getPv229_FirstSimilarIllnessDate() { 
1774            DT ret = null;
1775            try {
1776                Type t = this.getField(29, 0);
1777                ret = (DT)t;
1778            } catch (ClassCastException cce) {
1779                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1780                throw new RuntimeException(cce);
1781            } catch (HL7Exception he) {
1782                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1783                throw new RuntimeException(he);
1784            }
1785            return ret;
1786        }
1787    
1788    
1789    
1790        /**
1791         * Returns
1792         * PV2-30: "Patient Charge Adjustment Code" - creates it if necessary
1793         */
1794        public CE getPatientChargeAdjustmentCode() { 
1795            CE ret = null;
1796            try {
1797                Type t = this.getField(30, 0);
1798                ret = (CE)t;
1799            } catch (ClassCastException cce) {
1800                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1801                throw new RuntimeException(cce);
1802            } catch (HL7Exception he) {
1803                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1804                throw new RuntimeException(he);
1805            }
1806            return ret;
1807        }
1808    
1809    
1810        /**
1811         * Returns
1812         * PV2-30: "Patient Charge Adjustment Code" - creates it if necessary
1813         */
1814        public CE getPv230_PatientChargeAdjustmentCode() { 
1815            CE ret = null;
1816            try {
1817                Type t = this.getField(30, 0);
1818                ret = (CE)t;
1819            } catch (ClassCastException cce) {
1820                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1821                throw new RuntimeException(cce);
1822            } catch (HL7Exception he) {
1823                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1824                throw new RuntimeException(he);
1825            }
1826            return ret;
1827        }
1828    
1829    
1830    
1831        /**
1832         * Returns
1833         * PV2-31: "Recurring Service Code" - creates it if necessary
1834         */
1835        public IS getRecurringServiceCode() { 
1836            IS ret = null;
1837            try {
1838                Type t = this.getField(31, 0);
1839                ret = (IS)t;
1840            } catch (ClassCastException cce) {
1841                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1842                throw new RuntimeException(cce);
1843            } catch (HL7Exception he) {
1844                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1845                throw new RuntimeException(he);
1846            }
1847            return ret;
1848        }
1849    
1850    
1851        /**
1852         * Returns
1853         * PV2-31: "Recurring Service Code" - creates it if necessary
1854         */
1855        public IS getPv231_RecurringServiceCode() { 
1856            IS ret = null;
1857            try {
1858                Type t = this.getField(31, 0);
1859                ret = (IS)t;
1860            } catch (ClassCastException cce) {
1861                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1862                throw new RuntimeException(cce);
1863            } catch (HL7Exception he) {
1864                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1865                throw new RuntimeException(he);
1866            }
1867            return ret;
1868        }
1869    
1870    
1871    
1872        /**
1873         * Returns
1874         * PV2-32: "Billing Media Code" - creates it if necessary
1875         */
1876        public ID getBillingMediaCode() { 
1877            ID ret = null;
1878            try {
1879                Type t = this.getField(32, 0);
1880                ret = (ID)t;
1881            } catch (ClassCastException cce) {
1882                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1883                throw new RuntimeException(cce);
1884            } catch (HL7Exception he) {
1885                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1886                throw new RuntimeException(he);
1887            }
1888            return ret;
1889        }
1890    
1891    
1892        /**
1893         * Returns
1894         * PV2-32: "Billing Media Code" - creates it if necessary
1895         */
1896        public ID getPv232_BillingMediaCode() { 
1897            ID ret = null;
1898            try {
1899                Type t = this.getField(32, 0);
1900                ret = (ID)t;
1901            } catch (ClassCastException cce) {
1902                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1903                throw new RuntimeException(cce);
1904            } catch (HL7Exception he) {
1905                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1906                throw new RuntimeException(he);
1907            }
1908            return ret;
1909        }
1910    
1911    
1912    
1913        /**
1914         * Returns
1915         * PV2-33: "Expected Surgery Date and Time" - creates it if necessary
1916         */
1917        public TS getExpectedSurgeryDateAndTime() { 
1918            TS ret = null;
1919            try {
1920                Type t = this.getField(33, 0);
1921                ret = (TS)t;
1922            } catch (ClassCastException cce) {
1923                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1924                throw new RuntimeException(cce);
1925            } catch (HL7Exception he) {
1926                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1927                throw new RuntimeException(he);
1928            }
1929            return ret;
1930        }
1931    
1932    
1933        /**
1934         * Returns
1935         * PV2-33: "Expected Surgery Date and Time" - creates it if necessary
1936         */
1937        public TS getPv233_ExpectedSurgeryDateAndTime() { 
1938            TS ret = null;
1939            try {
1940                Type t = this.getField(33, 0);
1941                ret = (TS)t;
1942            } catch (ClassCastException cce) {
1943                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1944                throw new RuntimeException(cce);
1945            } catch (HL7Exception he) {
1946                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1947                throw new RuntimeException(he);
1948            }
1949            return ret;
1950        }
1951    
1952    
1953    
1954        /**
1955         * Returns
1956         * PV2-34: "Military Partnership Code" - creates it if necessary
1957         */
1958        public ID getMilitaryPartnershipCode() { 
1959            ID ret = null;
1960            try {
1961                Type t = this.getField(34, 0);
1962                ret = (ID)t;
1963            } catch (ClassCastException cce) {
1964                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1965                throw new RuntimeException(cce);
1966            } catch (HL7Exception he) {
1967                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1968                throw new RuntimeException(he);
1969            }
1970            return ret;
1971        }
1972    
1973    
1974        /**
1975         * Returns
1976         * PV2-34: "Military Partnership Code" - creates it if necessary
1977         */
1978        public ID getPv234_MilitaryPartnershipCode() { 
1979            ID ret = null;
1980            try {
1981                Type t = this.getField(34, 0);
1982                ret = (ID)t;
1983            } catch (ClassCastException cce) {
1984                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1985                throw new RuntimeException(cce);
1986            } catch (HL7Exception he) {
1987                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1988                throw new RuntimeException(he);
1989            }
1990            return ret;
1991        }
1992    
1993    
1994    
1995        /**
1996         * Returns
1997         * PV2-35: "Military Non-Availability Code" - creates it if necessary
1998         */
1999        public ID getMilitaryNonAvailabilityCode() { 
2000            ID ret = null;
2001            try {
2002                Type t = this.getField(35, 0);
2003                ret = (ID)t;
2004            } catch (ClassCastException cce) {
2005                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2006                throw new RuntimeException(cce);
2007            } catch (HL7Exception he) {
2008                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2009                throw new RuntimeException(he);
2010            }
2011            return ret;
2012        }
2013    
2014    
2015        /**
2016         * Returns
2017         * PV2-35: "Military Non-Availability Code" - creates it if necessary
2018         */
2019        public ID getPv235_MilitaryNonAvailabilityCode() { 
2020            ID ret = null;
2021            try {
2022                Type t = this.getField(35, 0);
2023                ret = (ID)t;
2024            } catch (ClassCastException cce) {
2025                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2026                throw new RuntimeException(cce);
2027            } catch (HL7Exception he) {
2028                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2029                throw new RuntimeException(he);
2030            }
2031            return ret;
2032        }
2033    
2034    
2035    
2036        /**
2037         * Returns
2038         * PV2-36: "Newborn Baby Indicator" - creates it if necessary
2039         */
2040        public ID getNewbornBabyIndicator() { 
2041            ID ret = null;
2042            try {
2043                Type t = this.getField(36, 0);
2044                ret = (ID)t;
2045            } catch (ClassCastException cce) {
2046                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2047                throw new RuntimeException(cce);
2048            } catch (HL7Exception he) {
2049                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2050                throw new RuntimeException(he);
2051            }
2052            return ret;
2053        }
2054    
2055    
2056        /**
2057         * Returns
2058         * PV2-36: "Newborn Baby Indicator" - creates it if necessary
2059         */
2060        public ID getPv236_NewbornBabyIndicator() { 
2061            ID ret = null;
2062            try {
2063                Type t = this.getField(36, 0);
2064                ret = (ID)t;
2065            } catch (ClassCastException cce) {
2066                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2067                throw new RuntimeException(cce);
2068            } catch (HL7Exception he) {
2069                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2070                throw new RuntimeException(he);
2071            }
2072            return ret;
2073        }
2074    
2075    
2076    
2077        /**
2078         * Returns
2079         * PV2-37: "Baby Detained Indicator" - creates it if necessary
2080         */
2081        public ID getBabyDetainedIndicator() { 
2082            ID ret = null;
2083            try {
2084                Type t = this.getField(37, 0);
2085                ret = (ID)t;
2086            } catch (ClassCastException cce) {
2087                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2088                throw new RuntimeException(cce);
2089            } catch (HL7Exception he) {
2090                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2091                throw new RuntimeException(he);
2092            }
2093            return ret;
2094        }
2095    
2096    
2097        /**
2098         * Returns
2099         * PV2-37: "Baby Detained Indicator" - creates it if necessary
2100         */
2101        public ID getPv237_BabyDetainedIndicator() { 
2102            ID ret = null;
2103            try {
2104                Type t = this.getField(37, 0);
2105                ret = (ID)t;
2106            } catch (ClassCastException cce) {
2107                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2108                throw new RuntimeException(cce);
2109            } catch (HL7Exception he) {
2110                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2111                throw new RuntimeException(he);
2112            }
2113            return ret;
2114        }
2115    
2116    
2117    
2118        /**
2119         * Returns
2120         * PV2-38: "Mode of Arrival Code" - creates it if necessary
2121         */
2122        public CE getModeOfArrivalCode() { 
2123            CE ret = null;
2124            try {
2125                Type t = this.getField(38, 0);
2126                ret = (CE)t;
2127            } catch (ClassCastException cce) {
2128                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2129                throw new RuntimeException(cce);
2130            } catch (HL7Exception he) {
2131                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2132                throw new RuntimeException(he);
2133            }
2134            return ret;
2135        }
2136    
2137    
2138        /**
2139         * Returns
2140         * PV2-38: "Mode of Arrival Code" - creates it if necessary
2141         */
2142        public CE getPv238_ModeOfArrivalCode() { 
2143            CE ret = null;
2144            try {
2145                Type t = this.getField(38, 0);
2146                ret = (CE)t;
2147            } catch (ClassCastException cce) {
2148                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2149                throw new RuntimeException(cce);
2150            } catch (HL7Exception he) {
2151                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2152                throw new RuntimeException(he);
2153            }
2154            return ret;
2155        }
2156    
2157    
2158        /**
2159         * Returns all repetitions of Recreational Drug Use Code (PV2-39).
2160         */
2161        public CE[] getRecreationalDrugUseCode() {
2162            CE[] ret = null;
2163            try {
2164                Type[] t = this.getField(39);  
2165                ret = new CE[t.length];
2166                for (int i = 0; i < ret.length; i++) {
2167                    ret[i] = (CE)t[i];
2168                }
2169            } catch (ClassCastException cce) {
2170                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2171                throw new RuntimeException(cce);
2172            } catch (HL7Exception he) {
2173                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2174                throw new RuntimeException(he);
2175            }
2176            return ret;
2177        }
2178    
2179    
2180        /**
2181         * Returns a count of the current number of repetitions of Recreational Drug Use Code (PV2-39).
2182         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2183         * it will return zero.
2184         */
2185        public int getRecreationalDrugUseCodeReps() {
2186            CE[] ret = null;
2187            try {
2188                Type[] t = this.getField(39);
2189                return t.length;  
2190            } catch (ClassCastException cce) {
2191                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2192                throw new RuntimeException(cce);
2193            } catch (HL7Exception he) {
2194                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2195                throw new RuntimeException(he);
2196            }
2197        }
2198    
2199    
2200        /**
2201         * Returns a specific repetition of
2202         * PV2-39: "Recreational Drug Use Code" - creates it if necessary
2203         *
2204         * @param rep The repetition index (0-indexed)
2205         */
2206        public CE getRecreationalDrugUseCode(int rep) { 
2207            CE ret = null;
2208            try {
2209                Type t = this.getField(39, rep);
2210                ret = (CE)t;
2211            } catch (ClassCastException cce) {
2212                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2213                throw new RuntimeException(cce);
2214            } catch (HL7Exception he) {
2215                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2216                throw new RuntimeException(he);
2217            }
2218            return ret;
2219        }
2220    
2221        /**
2222         * Returns a specific repetition of
2223         * PV2-39: "Recreational Drug Use Code" - creates it if necessary
2224         *
2225         * @param rep The repetition index (0-indexed)
2226         */
2227        public CE getPv239_RecreationalDrugUseCode(int rep) { 
2228            CE ret = null;
2229            try {
2230                Type t = this.getField(39, rep);
2231                ret = (CE)t;
2232            } catch (ClassCastException cce) {
2233                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2234                throw new RuntimeException(cce);
2235            } catch (HL7Exception he) {
2236                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2237                throw new RuntimeException(he);
2238            }
2239            return ret;
2240        }
2241    
2242    
2243        /**
2244         * Returns a count of the current number of repetitions of Recreational Drug Use Code (PV2-39).
2245         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2246         * it will return zero.
2247         */
2248        public int getPv239_RecreationalDrugUseCodeReps() {
2249            CE[] ret = null;
2250            try {
2251                Type[] t = this.getField(39);
2252                return t.length;  
2253            } catch (ClassCastException cce) {
2254                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2255                throw new RuntimeException(cce);
2256            } catch (HL7Exception he) {
2257                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2258                throw new RuntimeException(he);
2259            }
2260        }
2261    
2262    
2263    
2264        /**
2265         * Inserts a repetition of
2266         * PV2-39: "Recreational Drug Use Code" at a specific index
2267         *
2268         * @param rep The repetition index (0-indexed)
2269         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2270         */
2271        public CE insertRecreationalDrugUseCode(int rep) throws HL7Exception { 
2272            return (CE) super.insertRepetition(39, rep);
2273        }
2274    
2275    
2276    
2277        /**
2278         * Inserts a repetition of
2279         * PV2-39: "Recreational Drug Use Code" at a specific index
2280         *
2281         * @param rep The repetition index (0-indexed)
2282         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2283         */
2284        public CE insertPv239_RecreationalDrugUseCode(int rep) throws HL7Exception { 
2285            return (CE) super.insertRepetition(39, rep);
2286        }
2287    
2288    
2289        /**
2290         * Removes a repetition of
2291         * PV2-39: "Recreational Drug Use Code" at a specific index
2292         *
2293         * @param rep The repetition index (0-indexed)
2294         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2295         */
2296        public CE removeRecreationalDrugUseCode(int rep) throws HL7Exception { 
2297            return (CE) super.removeRepetition(39, rep);
2298        }
2299    
2300    
2301        /**
2302         * Removes a repetition of
2303         * PV2-39: "Recreational Drug Use Code" at a specific index
2304         *
2305         * @param rep The repetition index (0-indexed)
2306         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2307         */
2308        public CE removePv239_RecreationalDrugUseCode(int rep) throws HL7Exception { 
2309            return (CE) super.removeRepetition(39, rep);
2310        }
2311    
2312    
2313    
2314    
2315        /**
2316         * Returns
2317         * PV2-40: "Admission Level of Care Code" - creates it if necessary
2318         */
2319        public CE getAdmissionLevelOfCareCode() { 
2320            CE ret = null;
2321            try {
2322                Type t = this.getField(40, 0);
2323                ret = (CE)t;
2324            } catch (ClassCastException cce) {
2325                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2326                throw new RuntimeException(cce);
2327            } catch (HL7Exception he) {
2328                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2329                throw new RuntimeException(he);
2330            }
2331            return ret;
2332        }
2333    
2334    
2335        /**
2336         * Returns
2337         * PV2-40: "Admission Level of Care Code" - creates it if necessary
2338         */
2339        public CE getPv240_AdmissionLevelOfCareCode() { 
2340            CE ret = null;
2341            try {
2342                Type t = this.getField(40, 0);
2343                ret = (CE)t;
2344            } catch (ClassCastException cce) {
2345                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2346                throw new RuntimeException(cce);
2347            } catch (HL7Exception he) {
2348                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2349                throw new RuntimeException(he);
2350            }
2351            return ret;
2352        }
2353    
2354    
2355        /**
2356         * Returns all repetitions of Precaution Code (PV2-41).
2357         */
2358        public CE[] getPrecautionCode() {
2359            CE[] ret = null;
2360            try {
2361                Type[] t = this.getField(41);  
2362                ret = new CE[t.length];
2363                for (int i = 0; i < ret.length; i++) {
2364                    ret[i] = (CE)t[i];
2365                }
2366            } catch (ClassCastException cce) {
2367                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2368                throw new RuntimeException(cce);
2369            } catch (HL7Exception he) {
2370                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2371                throw new RuntimeException(he);
2372            }
2373            return ret;
2374        }
2375    
2376    
2377        /**
2378         * Returns a count of the current number of repetitions of Precaution Code (PV2-41).
2379         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2380         * it will return zero.
2381         */
2382        public int getPrecautionCodeReps() {
2383            CE[] ret = null;
2384            try {
2385                Type[] t = this.getField(41);
2386                return t.length;  
2387            } catch (ClassCastException cce) {
2388                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2389                throw new RuntimeException(cce);
2390            } catch (HL7Exception he) {
2391                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2392                throw new RuntimeException(he);
2393            }
2394        }
2395    
2396    
2397        /**
2398         * Returns a specific repetition of
2399         * PV2-41: "Precaution Code" - creates it if necessary
2400         *
2401         * @param rep The repetition index (0-indexed)
2402         */
2403        public CE getPrecautionCode(int rep) { 
2404            CE ret = null;
2405            try {
2406                Type t = this.getField(41, rep);
2407                ret = (CE)t;
2408            } catch (ClassCastException cce) {
2409                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2410                throw new RuntimeException(cce);
2411            } catch (HL7Exception he) {
2412                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2413                throw new RuntimeException(he);
2414            }
2415            return ret;
2416        }
2417    
2418        /**
2419         * Returns a specific repetition of
2420         * PV2-41: "Precaution Code" - creates it if necessary
2421         *
2422         * @param rep The repetition index (0-indexed)
2423         */
2424        public CE getPv241_PrecautionCode(int rep) { 
2425            CE ret = null;
2426            try {
2427                Type t = this.getField(41, rep);
2428                ret = (CE)t;
2429            } catch (ClassCastException cce) {
2430                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2431                throw new RuntimeException(cce);
2432            } catch (HL7Exception he) {
2433                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2434                throw new RuntimeException(he);
2435            }
2436            return ret;
2437        }
2438    
2439    
2440        /**
2441         * Returns a count of the current number of repetitions of Precaution Code (PV2-41).
2442         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2443         * it will return zero.
2444         */
2445        public int getPv241_PrecautionCodeReps() {
2446            CE[] ret = null;
2447            try {
2448                Type[] t = this.getField(41);
2449                return t.length;  
2450            } catch (ClassCastException cce) {
2451                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2452                throw new RuntimeException(cce);
2453            } catch (HL7Exception he) {
2454                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2455                throw new RuntimeException(he);
2456            }
2457        }
2458    
2459    
2460    
2461        /**
2462         * Inserts a repetition of
2463         * PV2-41: "Precaution Code" at a specific index
2464         *
2465         * @param rep The repetition index (0-indexed)
2466         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2467         */
2468        public CE insertPrecautionCode(int rep) throws HL7Exception { 
2469            return (CE) super.insertRepetition(41, rep);
2470        }
2471    
2472    
2473    
2474        /**
2475         * Inserts a repetition of
2476         * PV2-41: "Precaution Code" at a specific index
2477         *
2478         * @param rep The repetition index (0-indexed)
2479         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2480         */
2481        public CE insertPv241_PrecautionCode(int rep) throws HL7Exception { 
2482            return (CE) super.insertRepetition(41, rep);
2483        }
2484    
2485    
2486        /**
2487         * Removes a repetition of
2488         * PV2-41: "Precaution Code" at a specific index
2489         *
2490         * @param rep The repetition index (0-indexed)
2491         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2492         */
2493        public CE removePrecautionCode(int rep) throws HL7Exception { 
2494            return (CE) super.removeRepetition(41, rep);
2495        }
2496    
2497    
2498        /**
2499         * Removes a repetition of
2500         * PV2-41: "Precaution Code" at a specific index
2501         *
2502         * @param rep The repetition index (0-indexed)
2503         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2504         */
2505        public CE removePv241_PrecautionCode(int rep) throws HL7Exception { 
2506            return (CE) super.removeRepetition(41, rep);
2507        }
2508    
2509    
2510    
2511    
2512        /**
2513         * Returns
2514         * PV2-42: "Patient Condition Code" - creates it if necessary
2515         */
2516        public CE getPatientConditionCode() { 
2517            CE ret = null;
2518            try {
2519                Type t = this.getField(42, 0);
2520                ret = (CE)t;
2521            } catch (ClassCastException cce) {
2522                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2523                throw new RuntimeException(cce);
2524            } catch (HL7Exception he) {
2525                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2526                throw new RuntimeException(he);
2527            }
2528            return ret;
2529        }
2530    
2531    
2532        /**
2533         * Returns
2534         * PV2-42: "Patient Condition Code" - creates it if necessary
2535         */
2536        public CE getPv242_PatientConditionCode() { 
2537            CE ret = null;
2538            try {
2539                Type t = this.getField(42, 0);
2540                ret = (CE)t;
2541            } catch (ClassCastException cce) {
2542                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2543                throw new RuntimeException(cce);
2544            } catch (HL7Exception he) {
2545                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2546                throw new RuntimeException(he);
2547            }
2548            return ret;
2549        }
2550    
2551    
2552    
2553        /**
2554         * Returns
2555         * PV2-43: "Living Will Code" - creates it if necessary
2556         */
2557        public IS getLivingWillCode() { 
2558            IS ret = null;
2559            try {
2560                Type t = this.getField(43, 0);
2561                ret = (IS)t;
2562            } catch (ClassCastException cce) {
2563                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2564                throw new RuntimeException(cce);
2565            } catch (HL7Exception he) {
2566                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2567                throw new RuntimeException(he);
2568            }
2569            return ret;
2570        }
2571    
2572    
2573        /**
2574         * Returns
2575         * PV2-43: "Living Will Code" - creates it if necessary
2576         */
2577        public IS getPv243_LivingWillCode() { 
2578            IS ret = null;
2579            try {
2580                Type t = this.getField(43, 0);
2581                ret = (IS)t;
2582            } catch (ClassCastException cce) {
2583                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2584                throw new RuntimeException(cce);
2585            } catch (HL7Exception he) {
2586                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2587                throw new RuntimeException(he);
2588            }
2589            return ret;
2590        }
2591    
2592    
2593    
2594        /**
2595         * Returns
2596         * PV2-44: "Organ Donor Code" - creates it if necessary
2597         */
2598        public IS getOrganDonorCode() { 
2599            IS ret = null;
2600            try {
2601                Type t = this.getField(44, 0);
2602                ret = (IS)t;
2603            } catch (ClassCastException cce) {
2604                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2605                throw new RuntimeException(cce);
2606            } catch (HL7Exception he) {
2607                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2608                throw new RuntimeException(he);
2609            }
2610            return ret;
2611        }
2612    
2613    
2614        /**
2615         * Returns
2616         * PV2-44: "Organ Donor Code" - creates it if necessary
2617         */
2618        public IS getPv244_OrganDonorCode() { 
2619            IS ret = null;
2620            try {
2621                Type t = this.getField(44, 0);
2622                ret = (IS)t;
2623            } catch (ClassCastException cce) {
2624                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2625                throw new RuntimeException(cce);
2626            } catch (HL7Exception he) {
2627                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2628                throw new RuntimeException(he);
2629            }
2630            return ret;
2631        }
2632    
2633    
2634        /**
2635         * Returns all repetitions of Advance Directive Code (PV2-45).
2636         */
2637        public CE[] getAdvanceDirectiveCode() {
2638            CE[] ret = null;
2639            try {
2640                Type[] t = this.getField(45);  
2641                ret = new CE[t.length];
2642                for (int i = 0; i < ret.length; i++) {
2643                    ret[i] = (CE)t[i];
2644                }
2645            } catch (ClassCastException cce) {
2646                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2647                throw new RuntimeException(cce);
2648            } catch (HL7Exception he) {
2649                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2650                throw new RuntimeException(he);
2651            }
2652            return ret;
2653        }
2654    
2655    
2656        /**
2657         * Returns a count of the current number of repetitions of Advance Directive Code (PV2-45).
2658         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2659         * it will return zero.
2660         */
2661        public int getAdvanceDirectiveCodeReps() {
2662            CE[] ret = null;
2663            try {
2664                Type[] t = this.getField(45);
2665                return t.length;  
2666            } catch (ClassCastException cce) {
2667                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2668                throw new RuntimeException(cce);
2669            } catch (HL7Exception he) {
2670                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2671                throw new RuntimeException(he);
2672            }
2673        }
2674    
2675    
2676        /**
2677         * Returns a specific repetition of
2678         * PV2-45: "Advance Directive Code" - creates it if necessary
2679         *
2680         * @param rep The repetition index (0-indexed)
2681         */
2682        public CE getAdvanceDirectiveCode(int rep) { 
2683            CE ret = null;
2684            try {
2685                Type t = this.getField(45, rep);
2686                ret = (CE)t;
2687            } catch (ClassCastException cce) {
2688                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2689                throw new RuntimeException(cce);
2690            } catch (HL7Exception he) {
2691                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2692                throw new RuntimeException(he);
2693            }
2694            return ret;
2695        }
2696    
2697        /**
2698         * Returns a specific repetition of
2699         * PV2-45: "Advance Directive Code" - creates it if necessary
2700         *
2701         * @param rep The repetition index (0-indexed)
2702         */
2703        public CE getPv245_AdvanceDirectiveCode(int rep) { 
2704            CE ret = null;
2705            try {
2706                Type t = this.getField(45, rep);
2707                ret = (CE)t;
2708            } catch (ClassCastException cce) {
2709                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2710                throw new RuntimeException(cce);
2711            } catch (HL7Exception he) {
2712                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2713                throw new RuntimeException(he);
2714            }
2715            return ret;
2716        }
2717    
2718    
2719        /**
2720         * Returns a count of the current number of repetitions of Advance Directive Code (PV2-45).
2721         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2722         * it will return zero.
2723         */
2724        public int getPv245_AdvanceDirectiveCodeReps() {
2725            CE[] ret = null;
2726            try {
2727                Type[] t = this.getField(45);
2728                return t.length;  
2729            } catch (ClassCastException cce) {
2730                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2731                throw new RuntimeException(cce);
2732            } catch (HL7Exception he) {
2733                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2734                throw new RuntimeException(he);
2735            }
2736        }
2737    
2738    
2739    
2740        /**
2741         * Inserts a repetition of
2742         * PV2-45: "Advance Directive Code" at a specific index
2743         *
2744         * @param rep The repetition index (0-indexed)
2745         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2746         */
2747        public CE insertAdvanceDirectiveCode(int rep) throws HL7Exception { 
2748            return (CE) super.insertRepetition(45, rep);
2749        }
2750    
2751    
2752    
2753        /**
2754         * Inserts a repetition of
2755         * PV2-45: "Advance Directive Code" at a specific index
2756         *
2757         * @param rep The repetition index (0-indexed)
2758         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2759         */
2760        public CE insertPv245_AdvanceDirectiveCode(int rep) throws HL7Exception { 
2761            return (CE) super.insertRepetition(45, rep);
2762        }
2763    
2764    
2765        /**
2766         * Removes a repetition of
2767         * PV2-45: "Advance Directive Code" at a specific index
2768         *
2769         * @param rep The repetition index (0-indexed)
2770         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2771         */
2772        public CE removeAdvanceDirectiveCode(int rep) throws HL7Exception { 
2773            return (CE) super.removeRepetition(45, rep);
2774        }
2775    
2776    
2777        /**
2778         * Removes a repetition of
2779         * PV2-45: "Advance Directive Code" at a specific index
2780         *
2781         * @param rep The repetition index (0-indexed)
2782         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2783         */
2784        public CE removePv245_AdvanceDirectiveCode(int rep) throws HL7Exception { 
2785            return (CE) super.removeRepetition(45, rep);
2786        }
2787    
2788    
2789    
2790    
2791        /**
2792         * Returns
2793         * PV2-46: "Patient Status Effective Date" - creates it if necessary
2794         */
2795        public DT getPatientStatusEffectiveDate() { 
2796            DT ret = null;
2797            try {
2798                Type t = this.getField(46, 0);
2799                ret = (DT)t;
2800            } catch (ClassCastException cce) {
2801                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2802                throw new RuntimeException(cce);
2803            } catch (HL7Exception he) {
2804                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2805                throw new RuntimeException(he);
2806            }
2807            return ret;
2808        }
2809    
2810    
2811        /**
2812         * Returns
2813         * PV2-46: "Patient Status Effective Date" - creates it if necessary
2814         */
2815        public DT getPv246_PatientStatusEffectiveDate() { 
2816            DT ret = null;
2817            try {
2818                Type t = this.getField(46, 0);
2819                ret = (DT)t;
2820            } catch (ClassCastException cce) {
2821                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2822                throw new RuntimeException(cce);
2823            } catch (HL7Exception he) {
2824                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2825                throw new RuntimeException(he);
2826            }
2827            return ret;
2828        }
2829    
2830    
2831    
2832        /**
2833         * Returns
2834         * PV2-47: "Expected LOA Return Date/Time" - creates it if necessary
2835         */
2836        public TS getExpectedLOAReturnDateTime() { 
2837            TS ret = null;
2838            try {
2839                Type t = this.getField(47, 0);
2840                ret = (TS)t;
2841            } catch (ClassCastException cce) {
2842                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2843                throw new RuntimeException(cce);
2844            } catch (HL7Exception he) {
2845                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2846                throw new RuntimeException(he);
2847            }
2848            return ret;
2849        }
2850    
2851    
2852        /**
2853         * Returns
2854         * PV2-47: "Expected LOA Return Date/Time" - creates it if necessary
2855         */
2856        public TS getPv247_ExpectedLOAReturnDateTime() { 
2857            TS ret = null;
2858            try {
2859                Type t = this.getField(47, 0);
2860                ret = (TS)t;
2861            } catch (ClassCastException cce) {
2862                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2863                throw new RuntimeException(cce);
2864            } catch (HL7Exception he) {
2865                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2866                throw new RuntimeException(he);
2867            }
2868            return ret;
2869        }
2870    
2871    
2872    
2873    
2874    
2875        /** {@inheritDoc} */   
2876        protected Type createNewTypeWithoutReflection(int field) {
2877           switch (field) {
2878              case 0: return new PL(getMessage());
2879              case 1: return new CE(getMessage());
2880              case 2: return new CE(getMessage());
2881              case 3: return new CE(getMessage());
2882              case 4: return new ST(getMessage());
2883              case 5: return new ST(getMessage());
2884              case 6: return new IS(getMessage(), new Integer( 130 ));
2885              case 7: return new TS(getMessage());
2886              case 8: return new TS(getMessage());
2887              case 9: return new NM(getMessage());
2888              case 10: return new NM(getMessage());
2889              case 11: return new ST(getMessage());
2890              case 12: return new XCN(getMessage());
2891              case 13: return new DT(getMessage());
2892              case 14: return new ID(getMessage(), new Integer( 136 ));
2893              case 15: return new IS(getMessage(), new Integer( 213 ));
2894              case 16: return new DT(getMessage());
2895              case 17: return new IS(getMessage(), new Integer( 214 ));
2896              case 18: return new ID(getMessage(), new Integer( 136 ));
2897              case 19: return new NM(getMessage());
2898              case 20: return new IS(getMessage(), new Integer( 215 ));
2899              case 21: return new ID(getMessage(), new Integer( 136 ));
2900              case 22: return new XON(getMessage());
2901              case 23: return new IS(getMessage(), new Integer( 216 ));
2902              case 24: return new IS(getMessage(), new Integer( 217 ));
2903              case 25: return new DT(getMessage());
2904              case 26: return new IS(getMessage(), new Integer( 112 ));
2905              case 27: return new DT(getMessage());
2906              case 28: return new DT(getMessage());
2907              case 29: return new CE(getMessage());
2908              case 30: return new IS(getMessage(), new Integer( 219 ));
2909              case 31: return new ID(getMessage(), new Integer( 136 ));
2910              case 32: return new TS(getMessage());
2911              case 33: return new ID(getMessage(), new Integer( 136 ));
2912              case 34: return new ID(getMessage(), new Integer( 136 ));
2913              case 35: return new ID(getMessage(), new Integer( 136 ));
2914              case 36: return new ID(getMessage(), new Integer( 136 ));
2915              case 37: return new CE(getMessage());
2916              case 38: return new CE(getMessage());
2917              case 39: return new CE(getMessage());
2918              case 40: return new CE(getMessage());
2919              case 41: return new CE(getMessage());
2920              case 42: return new IS(getMessage(), new Integer( 315 ));
2921              case 43: return new IS(getMessage(), new Integer( 316 ));
2922              case 44: return new CE(getMessage());
2923              case 45: return new DT(getMessage());
2924              case 46: return new TS(getMessage());
2925              default: return null;
2926           }
2927       }
2928    
2929    
2930    }
2931