001    /*
002     * This class is an auto-generated source file for a HAPI
003     * HL7 v2.x standard structure class.
004     *
005     * For more information, visit: http://hl7api.sourceforge.net/
006     */
007    
008    package ca.uhn.hl7v2.model.v231.segment;
009    
010    // import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.datatype.*;
012    import ca.uhn.log.HapiLogFactory;
013    import ca.uhn.hl7v2.HL7Exception;
014    import ca.uhn.hl7v2.parser.ModelClassFactory;
015    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016    import ca.uhn.hl7v2.model.AbstractMessage;
017    import ca.uhn.hl7v2.model.Group;
018    import ca.uhn.hl7v2.model.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 PID message segment (PID - patient identification segment). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PID-1: Set ID - PID (SI) <b>optional </b>
027         * <li>PID-2: Patient ID (CX) <b>optional </b>
028         * <li>PID-3: Patient Identifier List (CX) <b> repeating</b>
029         * <li>PID-4: Alternate Patient ID - PID (CX) <b>optional repeating</b>
030         * <li>PID-5: Patient Name (XPN) <b> repeating</b>
031         * <li>PID-6: Mother’s Maiden Name (XPN) <b>optional repeating</b>
032         * <li>PID-7: Date/Time Of Birth (TS) <b>optional </b>
033         * <li>PID-8: Sex (IS) <b>optional </b>
034         * <li>PID-9: Patient Alias (XPN) <b>optional repeating</b>
035         * <li>PID-10: Race (CE) <b>optional repeating</b>
036         * <li>PID-11: Patient Address (XAD) <b>optional repeating</b>
037         * <li>PID-12: County Code (IS) <b>optional </b>
038         * <li>PID-13: Phone Number - Home (XTN) <b>optional repeating</b>
039         * <li>PID-14: Phone Number - Business (XTN) <b>optional repeating</b>
040         * <li>PID-15: Primary Language (CE) <b>optional </b>
041         * <li>PID-16: Marital Status (CE) <b>optional </b>
042         * <li>PID-17: Religion (CE) <b>optional </b>
043         * <li>PID-18: Patient Account Number (CX) <b>optional </b>
044         * <li>PID-19: SSN Number - Patient (ST) <b>optional </b>
045         * <li>PID-20: Driver's License Number - Patient (DLN) <b>optional </b>
046         * <li>PID-21: Mother's Identifier (CX) <b>optional repeating</b>
047         * <li>PID-22: Ethnic Group (CE) <b>optional repeating</b>
048         * <li>PID-23: Birth Place (ST) <b>optional </b>
049         * <li>PID-24: Multiple Birth Indicator (ID) <b>optional </b>
050         * <li>PID-25: Birth Order (NM) <b>optional </b>
051         * <li>PID-26: Citizenship (CE) <b>optional repeating</b>
052         * <li>PID-27: Veterans Military Status (CE) <b>optional </b>
053         * <li>PID-28: Nationality (CE) <b>optional </b>
054         * <li>PID-29: Patient Death Date and Time (TS) <b>optional </b>
055         * <li>PID-30: Patient Death Indicator (ID) <b>optional </b>
056     * </ul>
057     */
058    public class PID extends AbstractSegment {
059    
060        /** 
061         * Creates a new PID segment
062         */
063        public PID(Group parent, ModelClassFactory factory) {
064           super(parent, factory);
065           init(factory);
066        }
067    
068        private void init(ModelClassFactory factory) {
069           try {
070                                      this.add(SI.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - PID");
071                                      this.add(CX.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Patient ID");
072                                      this.add(CX.class, true, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "Patient Identifier List");
073                                      this.add(CX.class, false, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "Alternate Patient ID - PID");
074                                      this.add(XPN.class, true, 0, 48, new Object[]{ getMessage(), new Integer(0) }, "Patient Name");
075                                      this.add(XPN.class, false, 0, 48, new Object[]{ getMessage(), new Integer(0) }, "Mother’s Maiden Name");
076                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Date/Time Of Birth");
077                                      this.add(IS.class, false, 1, 1, new Object[]{ getMessage() }, "Sex");
078                                      this.add(XPN.class, false, 0, 48, new Object[]{ getMessage(), new Integer(0) }, "Patient Alias");
079                                      this.add(CE.class, false, 0, 80, new Object[]{ getMessage(), new Integer(5) }, "Race");
080                                      this.add(XAD.class, false, 0, 106, new Object[]{ getMessage(), new Integer(0) }, "Patient Address");
081                                      this.add(IS.class, false, 1, 4, new Object[]{ getMessage() }, "County Code");
082                                      this.add(XTN.class, false, 0, 40, new Object[]{ getMessage(), new Integer(0) }, "Phone Number - Home");
083                                      this.add(XTN.class, false, 0, 40, new Object[]{ getMessage(), new Integer(0) }, "Phone Number - Business");
084                                      this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(296) }, "Primary Language");
085                                      this.add(CE.class, false, 1, 80, new Object[]{ getMessage(), new Integer(2) }, "Marital Status");
086                                      this.add(CE.class, false, 1, 80, new Object[]{ getMessage(), new Integer(6) }, "Religion");
087                                      this.add(CX.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Patient Account Number");
088                                      this.add(ST.class, false, 1, 16, new Object[]{ getMessage(), new Integer(0) }, "SSN Number - Patient");
089                                      this.add(DLN.class, false, 1, 25, new Object[]{ getMessage(), new Integer(0) }, "Driver's License Number - Patient");
090                                      this.add(CX.class, false, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "Mother's Identifier");
091                                      this.add(CE.class, false, 0, 80, new Object[]{ getMessage(), new Integer(189) }, "Ethnic Group");
092                                      this.add(ST.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Birth Place");
093                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Multiple Birth Indicator");
094                                      this.add(NM.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Birth Order");
095                                      this.add(CE.class, false, 0, 80, new Object[]{ getMessage(), new Integer(171) }, "Citizenship");
096                                      this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(172) }, "Veterans Military Status");
097                                      this.add(CE.class, false, 1, 80, new Object[]{ getMessage(), new Integer(212) }, "Nationality");
098                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Patient Death Date and Time");
099                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Patient Death Indicator");
100           } catch(HL7Exception e) {
101              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PID - this is probably a bug in the source code generator.", e);
102           }
103        }
104    
105    
106    
107        /**
108         * Returns
109         * PID-1: "Set ID - PID" - creates it if necessary
110         */
111        public SI getSetIDPID() { 
112            SI ret = null;
113            try {
114                Type t = this.getField(1, 0);
115                ret = (SI)t;
116            } catch (ClassCastException cce) {
117                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
118                throw new RuntimeException(cce);
119            } catch (HL7Exception he) {
120                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
121                throw new RuntimeException(he);
122            }
123            return ret;
124        }
125    
126    
127        /**
128         * Returns
129         * PID-1: "Set ID - PID" - creates it if necessary
130         */
131        public SI getPid1_SetIDPID() { 
132            SI ret = null;
133            try {
134                Type t = this.getField(1, 0);
135                ret = (SI)t;
136            } catch (ClassCastException cce) {
137                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
138                throw new RuntimeException(cce);
139            } catch (HL7Exception he) {
140                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
141                throw new RuntimeException(he);
142            }
143            return ret;
144        }
145    
146    
147    
148        /**
149         * Returns
150         * PID-2: "Patient ID" - creates it if necessary
151         */
152        public CX getPatientID() { 
153            CX ret = null;
154            try {
155                Type t = this.getField(2, 0);
156                ret = (CX)t;
157            } catch (ClassCastException cce) {
158                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
159                throw new RuntimeException(cce);
160            } catch (HL7Exception he) {
161                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
162                throw new RuntimeException(he);
163            }
164            return ret;
165        }
166    
167    
168        /**
169         * Returns
170         * PID-2: "Patient ID" - creates it if necessary
171         */
172        public CX getPid2_PatientID() { 
173            CX ret = null;
174            try {
175                Type t = this.getField(2, 0);
176                ret = (CX)t;
177            } catch (ClassCastException cce) {
178                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
179                throw new RuntimeException(cce);
180            } catch (HL7Exception he) {
181                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
182                throw new RuntimeException(he);
183            }
184            return ret;
185        }
186    
187    
188        /**
189         * Returns all repetitions of Patient Identifier List (PID-3).
190         */
191        public CX[] getPatientIdentifierList() {
192            CX[] ret = null;
193            try {
194                Type[] t = this.getField(3);  
195                ret = new CX[t.length];
196                for (int i = 0; i < ret.length; i++) {
197                    ret[i] = (CX)t[i];
198                }
199            } catch (ClassCastException cce) {
200                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
201                throw new RuntimeException(cce);
202            } catch (HL7Exception he) {
203                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
204                throw new RuntimeException(he);
205            }
206            return ret;
207        }
208    
209    
210        /**
211         * Returns a count of the current number of repetitions of Patient Identifier List (PID-3).
212         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
213         * it will return zero.
214         */
215        public int getPatientIdentifierListReps() {
216            CX[] ret = null;
217            try {
218                Type[] t = this.getField(3);
219                return t.length;  
220            } catch (ClassCastException cce) {
221                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
222                throw new RuntimeException(cce);
223            } catch (HL7Exception he) {
224                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
225                throw new RuntimeException(he);
226            }
227        }
228    
229    
230        /**
231         * Returns a specific repetition of
232         * PID-3: "Patient Identifier List" - creates it if necessary
233         *
234         * @param rep The repetition index (0-indexed)
235         */
236        public CX getPatientIdentifierList(int rep) { 
237            CX ret = null;
238            try {
239                Type t = this.getField(3, rep);
240                ret = (CX)t;
241            } catch (ClassCastException cce) {
242                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
243                throw new RuntimeException(cce);
244            } catch (HL7Exception he) {
245                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
246                throw new RuntimeException(he);
247            }
248            return ret;
249        }
250    
251        /**
252         * Returns a specific repetition of
253         * PID-3: "Patient Identifier List" - creates it if necessary
254         *
255         * @param rep The repetition index (0-indexed)
256         */
257        public CX getPid3_PatientIdentifierList(int rep) { 
258            CX ret = null;
259            try {
260                Type t = this.getField(3, rep);
261                ret = (CX)t;
262            } catch (ClassCastException cce) {
263                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
264                throw new RuntimeException(cce);
265            } catch (HL7Exception he) {
266                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
267                throw new RuntimeException(he);
268            }
269            return ret;
270        }
271    
272    
273        /**
274         * Returns a count of the current number of repetitions of Patient Identifier List (PID-3).
275         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
276         * it will return zero.
277         */
278        public int getPid3_PatientIdentifierListReps() {
279            CX[] ret = null;
280            try {
281                Type[] t = this.getField(3);
282                return t.length;  
283            } catch (ClassCastException cce) {
284                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
285                throw new RuntimeException(cce);
286            } catch (HL7Exception he) {
287                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
288                throw new RuntimeException(he);
289            }
290        }
291    
292    
293    
294        /**
295         * Inserts a repetition of
296         * PID-3: "Patient Identifier List" at a specific index
297         *
298         * @param rep The repetition index (0-indexed)
299         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
300         */
301        public CX insertPatientIdentifierList(int rep) throws HL7Exception { 
302            return (CX) super.insertRepetition(3, rep);
303        }
304    
305    
306    
307        /**
308         * Inserts a repetition of
309         * PID-3: "Patient Identifier List" at a specific index
310         *
311         * @param rep The repetition index (0-indexed)
312         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
313         */
314        public CX insertPid3_PatientIdentifierList(int rep) throws HL7Exception { 
315            return (CX) super.insertRepetition(3, rep);
316        }
317    
318    
319        /**
320         * Removes a repetition of
321         * PID-3: "Patient Identifier List" at a specific index
322         *
323         * @param rep The repetition index (0-indexed)
324         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
325         */
326        public CX removePatientIdentifierList(int rep) throws HL7Exception { 
327            return (CX) super.removeRepetition(3, rep);
328        }
329    
330    
331        /**
332         * Removes a repetition of
333         * PID-3: "Patient Identifier List" at a specific index
334         *
335         * @param rep The repetition index (0-indexed)
336         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
337         */
338        public CX removePid3_PatientIdentifierList(int rep) throws HL7Exception { 
339            return (CX) super.removeRepetition(3, rep);
340        }
341    
342    
343    
344        /**
345         * Returns all repetitions of Alternate Patient ID - PID (PID-4).
346         */
347        public CX[] getAlternatePatientIDPID() {
348            CX[] ret = null;
349            try {
350                Type[] t = this.getField(4);  
351                ret = new CX[t.length];
352                for (int i = 0; i < ret.length; i++) {
353                    ret[i] = (CX)t[i];
354                }
355            } catch (ClassCastException cce) {
356                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
357                throw new RuntimeException(cce);
358            } catch (HL7Exception he) {
359                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
360                throw new RuntimeException(he);
361            }
362            return ret;
363        }
364    
365    
366        /**
367         * Returns a count of the current number of repetitions of Alternate Patient ID - PID (PID-4).
368         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
369         * it will return zero.
370         */
371        public int getAlternatePatientIDPIDReps() {
372            CX[] ret = null;
373            try {
374                Type[] t = this.getField(4);
375                return t.length;  
376            } catch (ClassCastException cce) {
377                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
378                throw new RuntimeException(cce);
379            } catch (HL7Exception he) {
380                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
381                throw new RuntimeException(he);
382            }
383        }
384    
385    
386        /**
387         * Returns a specific repetition of
388         * PID-4: "Alternate Patient ID - PID" - creates it if necessary
389         *
390         * @param rep The repetition index (0-indexed)
391         */
392        public CX getAlternatePatientIDPID(int rep) { 
393            CX ret = null;
394            try {
395                Type t = this.getField(4, rep);
396                ret = (CX)t;
397            } catch (ClassCastException cce) {
398                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
399                throw new RuntimeException(cce);
400            } catch (HL7Exception he) {
401                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
402                throw new RuntimeException(he);
403            }
404            return ret;
405        }
406    
407        /**
408         * Returns a specific repetition of
409         * PID-4: "Alternate Patient ID - PID" - creates it if necessary
410         *
411         * @param rep The repetition index (0-indexed)
412         */
413        public CX getPid4_AlternatePatientIDPID(int rep) { 
414            CX ret = null;
415            try {
416                Type t = this.getField(4, rep);
417                ret = (CX)t;
418            } catch (ClassCastException cce) {
419                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
420                throw new RuntimeException(cce);
421            } catch (HL7Exception he) {
422                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
423                throw new RuntimeException(he);
424            }
425            return ret;
426        }
427    
428    
429        /**
430         * Returns a count of the current number of repetitions of Alternate Patient ID - PID (PID-4).
431         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
432         * it will return zero.
433         */
434        public int getPid4_AlternatePatientIDPIDReps() {
435            CX[] ret = null;
436            try {
437                Type[] t = this.getField(4);
438                return t.length;  
439            } catch (ClassCastException cce) {
440                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
441                throw new RuntimeException(cce);
442            } catch (HL7Exception he) {
443                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
444                throw new RuntimeException(he);
445            }
446        }
447    
448    
449    
450        /**
451         * Inserts a repetition of
452         * PID-4: "Alternate Patient ID - PID" at a specific index
453         *
454         * @param rep The repetition index (0-indexed)
455         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
456         */
457        public CX insertAlternatePatientIDPID(int rep) throws HL7Exception { 
458            return (CX) super.insertRepetition(4, rep);
459        }
460    
461    
462    
463        /**
464         * Inserts a repetition of
465         * PID-4: "Alternate Patient ID - PID" at a specific index
466         *
467         * @param rep The repetition index (0-indexed)
468         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
469         */
470        public CX insertPid4_AlternatePatientIDPID(int rep) throws HL7Exception { 
471            return (CX) super.insertRepetition(4, rep);
472        }
473    
474    
475        /**
476         * Removes a repetition of
477         * PID-4: "Alternate Patient ID - PID" at a specific index
478         *
479         * @param rep The repetition index (0-indexed)
480         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
481         */
482        public CX removeAlternatePatientIDPID(int rep) throws HL7Exception { 
483            return (CX) super.removeRepetition(4, rep);
484        }
485    
486    
487        /**
488         * Removes a repetition of
489         * PID-4: "Alternate Patient ID - PID" at a specific index
490         *
491         * @param rep The repetition index (0-indexed)
492         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
493         */
494        public CX removePid4_AlternatePatientIDPID(int rep) throws HL7Exception { 
495            return (CX) super.removeRepetition(4, rep);
496        }
497    
498    
499    
500        /**
501         * Returns all repetitions of Patient Name (PID-5).
502         */
503        public XPN[] getPatientName() {
504            XPN[] ret = null;
505            try {
506                Type[] t = this.getField(5);  
507                ret = new XPN[t.length];
508                for (int i = 0; i < ret.length; i++) {
509                    ret[i] = (XPN)t[i];
510                }
511            } catch (ClassCastException cce) {
512                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
513                throw new RuntimeException(cce);
514            } catch (HL7Exception he) {
515                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
516                throw new RuntimeException(he);
517            }
518            return ret;
519        }
520    
521    
522        /**
523         * Returns a count of the current number of repetitions of Patient Name (PID-5).
524         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
525         * it will return zero.
526         */
527        public int getPatientNameReps() {
528            XPN[] ret = null;
529            try {
530                Type[] t = this.getField(5);
531                return t.length;  
532            } catch (ClassCastException cce) {
533                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
534                throw new RuntimeException(cce);
535            } catch (HL7Exception he) {
536                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
537                throw new RuntimeException(he);
538            }
539        }
540    
541    
542        /**
543         * Returns a specific repetition of
544         * PID-5: "Patient Name" - creates it if necessary
545         *
546         * @param rep The repetition index (0-indexed)
547         */
548        public XPN getPatientName(int rep) { 
549            XPN ret = null;
550            try {
551                Type t = this.getField(5, rep);
552                ret = (XPN)t;
553            } catch (ClassCastException cce) {
554                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
555                throw new RuntimeException(cce);
556            } catch (HL7Exception he) {
557                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
558                throw new RuntimeException(he);
559            }
560            return ret;
561        }
562    
563        /**
564         * Returns a specific repetition of
565         * PID-5: "Patient Name" - creates it if necessary
566         *
567         * @param rep The repetition index (0-indexed)
568         */
569        public XPN getPid5_PatientName(int rep) { 
570            XPN ret = null;
571            try {
572                Type t = this.getField(5, rep);
573                ret = (XPN)t;
574            } catch (ClassCastException cce) {
575                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
576                throw new RuntimeException(cce);
577            } catch (HL7Exception he) {
578                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
579                throw new RuntimeException(he);
580            }
581            return ret;
582        }
583    
584    
585        /**
586         * Returns a count of the current number of repetitions of Patient Name (PID-5).
587         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
588         * it will return zero.
589         */
590        public int getPid5_PatientNameReps() {
591            XPN[] ret = null;
592            try {
593                Type[] t = this.getField(5);
594                return t.length;  
595            } catch (ClassCastException cce) {
596                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
597                throw new RuntimeException(cce);
598            } catch (HL7Exception he) {
599                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
600                throw new RuntimeException(he);
601            }
602        }
603    
604    
605    
606        /**
607         * Inserts a repetition of
608         * PID-5: "Patient Name" at a specific index
609         *
610         * @param rep The repetition index (0-indexed)
611         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
612         */
613        public XPN insertPatientName(int rep) throws HL7Exception { 
614            return (XPN) super.insertRepetition(5, rep);
615        }
616    
617    
618    
619        /**
620         * Inserts a repetition of
621         * PID-5: "Patient Name" at a specific index
622         *
623         * @param rep The repetition index (0-indexed)
624         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
625         */
626        public XPN insertPid5_PatientName(int rep) throws HL7Exception { 
627            return (XPN) super.insertRepetition(5, rep);
628        }
629    
630    
631        /**
632         * Removes a repetition of
633         * PID-5: "Patient Name" at a specific index
634         *
635         * @param rep The repetition index (0-indexed)
636         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
637         */
638        public XPN removePatientName(int rep) throws HL7Exception { 
639            return (XPN) super.removeRepetition(5, rep);
640        }
641    
642    
643        /**
644         * Removes a repetition of
645         * PID-5: "Patient Name" at a specific index
646         *
647         * @param rep The repetition index (0-indexed)
648         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
649         */
650        public XPN removePid5_PatientName(int rep) throws HL7Exception { 
651            return (XPN) super.removeRepetition(5, rep);
652        }
653    
654    
655    
656        /**
657         * Returns all repetitions of Mother’s Maiden Name (PID-6).
658         */
659        public XPN[] getMotherSMaidenName() {
660            XPN[] ret = null;
661            try {
662                Type[] t = this.getField(6);  
663                ret = new XPN[t.length];
664                for (int i = 0; i < ret.length; i++) {
665                    ret[i] = (XPN)t[i];
666                }
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 a count of the current number of repetitions of Mother’s Maiden Name (PID-6).
680         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
681         * it will return zero.
682         */
683        public int getMotherSMaidenNameReps() {
684            XPN[] ret = null;
685            try {
686                Type[] t = this.getField(6);
687                return t.length;  
688            } catch (ClassCastException cce) {
689                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
690                throw new RuntimeException(cce);
691            } catch (HL7Exception he) {
692                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
693                throw new RuntimeException(he);
694            }
695        }
696    
697    
698        /**
699         * Returns a specific repetition of
700         * PID-6: "Mother’s Maiden Name" - creates it if necessary
701         *
702         * @param rep The repetition index (0-indexed)
703         */
704        public XPN getMotherSMaidenName(int rep) { 
705            XPN ret = null;
706            try {
707                Type t = this.getField(6, rep);
708                ret = (XPN)t;
709            } catch (ClassCastException cce) {
710                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
711                throw new RuntimeException(cce);
712            } catch (HL7Exception he) {
713                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
714                throw new RuntimeException(he);
715            }
716            return ret;
717        }
718    
719        /**
720         * Returns a specific repetition of
721         * PID-6: "Mother’s Maiden Name" - creates it if necessary
722         *
723         * @param rep The repetition index (0-indexed)
724         */
725        public XPN getPid6_MotherSMaidenName(int rep) { 
726            XPN ret = null;
727            try {
728                Type t = this.getField(6, rep);
729                ret = (XPN)t;
730            } catch (ClassCastException cce) {
731                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
732                throw new RuntimeException(cce);
733            } catch (HL7Exception he) {
734                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
735                throw new RuntimeException(he);
736            }
737            return ret;
738        }
739    
740    
741        /**
742         * Returns a count of the current number of repetitions of Mother’s Maiden Name (PID-6).
743         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
744         * it will return zero.
745         */
746        public int getPid6_MotherSMaidenNameReps() {
747            XPN[] ret = null;
748            try {
749                Type[] t = this.getField(6);
750                return t.length;  
751            } catch (ClassCastException cce) {
752                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
753                throw new RuntimeException(cce);
754            } catch (HL7Exception he) {
755                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
756                throw new RuntimeException(he);
757            }
758        }
759    
760    
761    
762        /**
763         * Inserts a repetition of
764         * PID-6: "Mother’s Maiden Name" at a specific index
765         *
766         * @param rep The repetition index (0-indexed)
767         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
768         */
769        public XPN insertMotherSMaidenName(int rep) throws HL7Exception { 
770            return (XPN) super.insertRepetition(6, rep);
771        }
772    
773    
774    
775        /**
776         * Inserts a repetition of
777         * PID-6: "Mother’s Maiden Name" at a specific index
778         *
779         * @param rep The repetition index (0-indexed)
780         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
781         */
782        public XPN insertPid6_MotherSMaidenName(int rep) throws HL7Exception { 
783            return (XPN) super.insertRepetition(6, rep);
784        }
785    
786    
787        /**
788         * Removes a repetition of
789         * PID-6: "Mother’s Maiden Name" at a specific index
790         *
791         * @param rep The repetition index (0-indexed)
792         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
793         */
794        public XPN removeMotherSMaidenName(int rep) throws HL7Exception { 
795            return (XPN) super.removeRepetition(6, rep);
796        }
797    
798    
799        /**
800         * Removes a repetition of
801         * PID-6: "Mother’s Maiden Name" at a specific index
802         *
803         * @param rep The repetition index (0-indexed)
804         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
805         */
806        public XPN removePid6_MotherSMaidenName(int rep) throws HL7Exception { 
807            return (XPN) super.removeRepetition(6, rep);
808        }
809    
810    
811    
812    
813        /**
814         * Returns
815         * PID-7: "Date/Time Of Birth" - creates it if necessary
816         */
817        public TS getDateTimeOfBirth() { 
818            TS ret = null;
819            try {
820                Type t = this.getField(7, 0);
821                ret = (TS)t;
822            } catch (ClassCastException cce) {
823                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
824                throw new RuntimeException(cce);
825            } catch (HL7Exception he) {
826                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
827                throw new RuntimeException(he);
828            }
829            return ret;
830        }
831    
832    
833        /**
834         * Returns
835         * PID-7: "Date/Time Of Birth" - creates it if necessary
836         */
837        public TS getPid7_DateTimeOfBirth() { 
838            TS ret = null;
839            try {
840                Type t = this.getField(7, 0);
841                ret = (TS)t;
842            } catch (ClassCastException cce) {
843                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
844                throw new RuntimeException(cce);
845            } catch (HL7Exception he) {
846                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
847                throw new RuntimeException(he);
848            }
849            return ret;
850        }
851    
852    
853    
854        /**
855         * Returns
856         * PID-8: "Sex" - creates it if necessary
857         */
858        public IS getSex() { 
859            IS ret = null;
860            try {
861                Type t = this.getField(8, 0);
862                ret = (IS)t;
863            } catch (ClassCastException cce) {
864                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
865                throw new RuntimeException(cce);
866            } catch (HL7Exception he) {
867                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
868                throw new RuntimeException(he);
869            }
870            return ret;
871        }
872    
873    
874        /**
875         * Returns
876         * PID-8: "Sex" - creates it if necessary
877         */
878        public IS getPid8_Sex() { 
879            IS ret = null;
880            try {
881                Type t = this.getField(8, 0);
882                ret = (IS)t;
883            } catch (ClassCastException cce) {
884                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
885                throw new RuntimeException(cce);
886            } catch (HL7Exception he) {
887                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
888                throw new RuntimeException(he);
889            }
890            return ret;
891        }
892    
893    
894        /**
895         * Returns all repetitions of Patient Alias (PID-9).
896         */
897        public XPN[] getPatientAlias() {
898            XPN[] ret = null;
899            try {
900                Type[] t = this.getField(9);  
901                ret = new XPN[t.length];
902                for (int i = 0; i < ret.length; i++) {
903                    ret[i] = (XPN)t[i];
904                }
905            } catch (ClassCastException cce) {
906                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
907                throw new RuntimeException(cce);
908            } catch (HL7Exception he) {
909                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
910                throw new RuntimeException(he);
911            }
912            return ret;
913        }
914    
915    
916        /**
917         * Returns a count of the current number of repetitions of Patient Alias (PID-9).
918         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
919         * it will return zero.
920         */
921        public int getPatientAliasReps() {
922            XPN[] ret = null;
923            try {
924                Type[] t = this.getField(9);
925                return t.length;  
926            } catch (ClassCastException cce) {
927                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
928                throw new RuntimeException(cce);
929            } catch (HL7Exception he) {
930                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
931                throw new RuntimeException(he);
932            }
933        }
934    
935    
936        /**
937         * Returns a specific repetition of
938         * PID-9: "Patient Alias" - creates it if necessary
939         *
940         * @param rep The repetition index (0-indexed)
941         */
942        public XPN getPatientAlias(int rep) { 
943            XPN ret = null;
944            try {
945                Type t = this.getField(9, rep);
946                ret = (XPN)t;
947            } catch (ClassCastException cce) {
948                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
949                throw new RuntimeException(cce);
950            } catch (HL7Exception he) {
951                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
952                throw new RuntimeException(he);
953            }
954            return ret;
955        }
956    
957        /**
958         * Returns a specific repetition of
959         * PID-9: "Patient Alias" - creates it if necessary
960         *
961         * @param rep The repetition index (0-indexed)
962         */
963        public XPN getPid9_PatientAlias(int rep) { 
964            XPN ret = null;
965            try {
966                Type t = this.getField(9, rep);
967                ret = (XPN)t;
968            } catch (ClassCastException cce) {
969                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
970                throw new RuntimeException(cce);
971            } catch (HL7Exception he) {
972                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
973                throw new RuntimeException(he);
974            }
975            return ret;
976        }
977    
978    
979        /**
980         * Returns a count of the current number of repetitions of Patient Alias (PID-9).
981         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
982         * it will return zero.
983         */
984        public int getPid9_PatientAliasReps() {
985            XPN[] ret = null;
986            try {
987                Type[] t = this.getField(9);
988                return t.length;  
989            } catch (ClassCastException cce) {
990                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
991                throw new RuntimeException(cce);
992            } catch (HL7Exception he) {
993                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
994                throw new RuntimeException(he);
995            }
996        }
997    
998    
999    
1000        /**
1001         * Inserts a repetition of
1002         * PID-9: "Patient Alias" at a specific index
1003         *
1004         * @param rep The repetition index (0-indexed)
1005         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1006         */
1007        public XPN insertPatientAlias(int rep) throws HL7Exception { 
1008            return (XPN) super.insertRepetition(9, rep);
1009        }
1010    
1011    
1012    
1013        /**
1014         * Inserts a repetition of
1015         * PID-9: "Patient Alias" at a specific index
1016         *
1017         * @param rep The repetition index (0-indexed)
1018         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1019         */
1020        public XPN insertPid9_PatientAlias(int rep) throws HL7Exception { 
1021            return (XPN) super.insertRepetition(9, rep);
1022        }
1023    
1024    
1025        /**
1026         * Removes a repetition of
1027         * PID-9: "Patient Alias" at a specific index
1028         *
1029         * @param rep The repetition index (0-indexed)
1030         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1031         */
1032        public XPN removePatientAlias(int rep) throws HL7Exception { 
1033            return (XPN) super.removeRepetition(9, rep);
1034        }
1035    
1036    
1037        /**
1038         * Removes a repetition of
1039         * PID-9: "Patient Alias" at a specific index
1040         *
1041         * @param rep The repetition index (0-indexed)
1042         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1043         */
1044        public XPN removePid9_PatientAlias(int rep) throws HL7Exception { 
1045            return (XPN) super.removeRepetition(9, rep);
1046        }
1047    
1048    
1049    
1050        /**
1051         * Returns all repetitions of Race (PID-10).
1052         */
1053        public CE[] getRace() {
1054            CE[] ret = null;
1055            try {
1056                Type[] t = this.getField(10);  
1057                ret = new CE[t.length];
1058                for (int i = 0; i < ret.length; i++) {
1059                    ret[i] = (CE)t[i];
1060                }
1061            } catch (ClassCastException cce) {
1062                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1063                throw new RuntimeException(cce);
1064            } catch (HL7Exception he) {
1065                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1066                throw new RuntimeException(he);
1067            }
1068            return ret;
1069        }
1070    
1071    
1072        /**
1073         * Returns a count of the current number of repetitions of Race (PID-10).
1074         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1075         * it will return zero.
1076         */
1077        public int getRaceReps() {
1078            CE[] ret = null;
1079            try {
1080                Type[] t = this.getField(10);
1081                return t.length;  
1082            } catch (ClassCastException cce) {
1083                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1084                throw new RuntimeException(cce);
1085            } catch (HL7Exception he) {
1086                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1087                throw new RuntimeException(he);
1088            }
1089        }
1090    
1091    
1092        /**
1093         * Returns a specific repetition of
1094         * PID-10: "Race" - creates it if necessary
1095         *
1096         * @param rep The repetition index (0-indexed)
1097         */
1098        public CE getRace(int rep) { 
1099            CE ret = null;
1100            try {
1101                Type t = this.getField(10, rep);
1102                ret = (CE)t;
1103            } catch (ClassCastException cce) {
1104                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1105                throw new RuntimeException(cce);
1106            } catch (HL7Exception he) {
1107                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1108                throw new RuntimeException(he);
1109            }
1110            return ret;
1111        }
1112    
1113        /**
1114         * Returns a specific repetition of
1115         * PID-10: "Race" - creates it if necessary
1116         *
1117         * @param rep The repetition index (0-indexed)
1118         */
1119        public CE getPid10_Race(int rep) { 
1120            CE ret = null;
1121            try {
1122                Type t = this.getField(10, rep);
1123                ret = (CE)t;
1124            } catch (ClassCastException cce) {
1125                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1126                throw new RuntimeException(cce);
1127            } catch (HL7Exception he) {
1128                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1129                throw new RuntimeException(he);
1130            }
1131            return ret;
1132        }
1133    
1134    
1135        /**
1136         * Returns a count of the current number of repetitions of Race (PID-10).
1137         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1138         * it will return zero.
1139         */
1140        public int getPid10_RaceReps() {
1141            CE[] ret = null;
1142            try {
1143                Type[] t = this.getField(10);
1144                return t.length;  
1145            } catch (ClassCastException cce) {
1146                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1147                throw new RuntimeException(cce);
1148            } catch (HL7Exception he) {
1149                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1150                throw new RuntimeException(he);
1151            }
1152        }
1153    
1154    
1155    
1156        /**
1157         * Inserts a repetition of
1158         * PID-10: "Race" at a specific index
1159         *
1160         * @param rep The repetition index (0-indexed)
1161         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1162         */
1163        public CE insertRace(int rep) throws HL7Exception { 
1164            return (CE) super.insertRepetition(10, rep);
1165        }
1166    
1167    
1168    
1169        /**
1170         * Inserts a repetition of
1171         * PID-10: "Race" at a specific index
1172         *
1173         * @param rep The repetition index (0-indexed)
1174         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1175         */
1176        public CE insertPid10_Race(int rep) throws HL7Exception { 
1177            return (CE) super.insertRepetition(10, rep);
1178        }
1179    
1180    
1181        /**
1182         * Removes a repetition of
1183         * PID-10: "Race" at a specific index
1184         *
1185         * @param rep The repetition index (0-indexed)
1186         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1187         */
1188        public CE removeRace(int rep) throws HL7Exception { 
1189            return (CE) super.removeRepetition(10, rep);
1190        }
1191    
1192    
1193        /**
1194         * Removes a repetition of
1195         * PID-10: "Race" at a specific index
1196         *
1197         * @param rep The repetition index (0-indexed)
1198         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1199         */
1200        public CE removePid10_Race(int rep) throws HL7Exception { 
1201            return (CE) super.removeRepetition(10, rep);
1202        }
1203    
1204    
1205    
1206        /**
1207         * Returns all repetitions of Patient Address (PID-11).
1208         */
1209        public XAD[] getPatientAddress() {
1210            XAD[] ret = null;
1211            try {
1212                Type[] t = this.getField(11);  
1213                ret = new XAD[t.length];
1214                for (int i = 0; i < ret.length; i++) {
1215                    ret[i] = (XAD)t[i];
1216                }
1217            } catch (ClassCastException cce) {
1218                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1219                throw new RuntimeException(cce);
1220            } catch (HL7Exception he) {
1221                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1222                throw new RuntimeException(he);
1223            }
1224            return ret;
1225        }
1226    
1227    
1228        /**
1229         * Returns a count of the current number of repetitions of Patient Address (PID-11).
1230         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1231         * it will return zero.
1232         */
1233        public int getPatientAddressReps() {
1234            XAD[] ret = null;
1235            try {
1236                Type[] t = this.getField(11);
1237                return t.length;  
1238            } catch (ClassCastException cce) {
1239                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1240                throw new RuntimeException(cce);
1241            } catch (HL7Exception he) {
1242                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1243                throw new RuntimeException(he);
1244            }
1245        }
1246    
1247    
1248        /**
1249         * Returns a specific repetition of
1250         * PID-11: "Patient Address" - creates it if necessary
1251         *
1252         * @param rep The repetition index (0-indexed)
1253         */
1254        public XAD getPatientAddress(int rep) { 
1255            XAD ret = null;
1256            try {
1257                Type t = this.getField(11, rep);
1258                ret = (XAD)t;
1259            } catch (ClassCastException cce) {
1260                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1261                throw new RuntimeException(cce);
1262            } catch (HL7Exception he) {
1263                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1264                throw new RuntimeException(he);
1265            }
1266            return ret;
1267        }
1268    
1269        /**
1270         * Returns a specific repetition of
1271         * PID-11: "Patient Address" - creates it if necessary
1272         *
1273         * @param rep The repetition index (0-indexed)
1274         */
1275        public XAD getPid11_PatientAddress(int rep) { 
1276            XAD ret = null;
1277            try {
1278                Type t = this.getField(11, rep);
1279                ret = (XAD)t;
1280            } catch (ClassCastException cce) {
1281                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1282                throw new RuntimeException(cce);
1283            } catch (HL7Exception he) {
1284                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1285                throw new RuntimeException(he);
1286            }
1287            return ret;
1288        }
1289    
1290    
1291        /**
1292         * Returns a count of the current number of repetitions of Patient Address (PID-11).
1293         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1294         * it will return zero.
1295         */
1296        public int getPid11_PatientAddressReps() {
1297            XAD[] ret = null;
1298            try {
1299                Type[] t = this.getField(11);
1300                return t.length;  
1301            } catch (ClassCastException cce) {
1302                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1303                throw new RuntimeException(cce);
1304            } catch (HL7Exception he) {
1305                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1306                throw new RuntimeException(he);
1307            }
1308        }
1309    
1310    
1311    
1312        /**
1313         * Inserts a repetition of
1314         * PID-11: "Patient Address" at a specific index
1315         *
1316         * @param rep The repetition index (0-indexed)
1317         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1318         */
1319        public XAD insertPatientAddress(int rep) throws HL7Exception { 
1320            return (XAD) super.insertRepetition(11, rep);
1321        }
1322    
1323    
1324    
1325        /**
1326         * Inserts a repetition of
1327         * PID-11: "Patient Address" at a specific index
1328         *
1329         * @param rep The repetition index (0-indexed)
1330         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1331         */
1332        public XAD insertPid11_PatientAddress(int rep) throws HL7Exception { 
1333            return (XAD) super.insertRepetition(11, rep);
1334        }
1335    
1336    
1337        /**
1338         * Removes a repetition of
1339         * PID-11: "Patient Address" at a specific index
1340         *
1341         * @param rep The repetition index (0-indexed)
1342         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1343         */
1344        public XAD removePatientAddress(int rep) throws HL7Exception { 
1345            return (XAD) super.removeRepetition(11, rep);
1346        }
1347    
1348    
1349        /**
1350         * Removes a repetition of
1351         * PID-11: "Patient Address" at a specific index
1352         *
1353         * @param rep The repetition index (0-indexed)
1354         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1355         */
1356        public XAD removePid11_PatientAddress(int rep) throws HL7Exception { 
1357            return (XAD) super.removeRepetition(11, rep);
1358        }
1359    
1360    
1361    
1362    
1363        /**
1364         * Returns
1365         * PID-12: "County Code" - creates it if necessary
1366         */
1367        public IS getCountyCode() { 
1368            IS ret = null;
1369            try {
1370                Type t = this.getField(12, 0);
1371                ret = (IS)t;
1372            } catch (ClassCastException cce) {
1373                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1374                throw new RuntimeException(cce);
1375            } catch (HL7Exception he) {
1376                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1377                throw new RuntimeException(he);
1378            }
1379            return ret;
1380        }
1381    
1382    
1383        /**
1384         * Returns
1385         * PID-12: "County Code" - creates it if necessary
1386         */
1387        public IS getPid12_CountyCode() { 
1388            IS ret = null;
1389            try {
1390                Type t = this.getField(12, 0);
1391                ret = (IS)t;
1392            } catch (ClassCastException cce) {
1393                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1394                throw new RuntimeException(cce);
1395            } catch (HL7Exception he) {
1396                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1397                throw new RuntimeException(he);
1398            }
1399            return ret;
1400        }
1401    
1402    
1403        /**
1404         * Returns all repetitions of Phone Number - Home (PID-13).
1405         */
1406        public XTN[] getPhoneNumberHome() {
1407            XTN[] ret = null;
1408            try {
1409                Type[] t = this.getField(13);  
1410                ret = new XTN[t.length];
1411                for (int i = 0; i < ret.length; i++) {
1412                    ret[i] = (XTN)t[i];
1413                }
1414            } catch (ClassCastException cce) {
1415                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1416                throw new RuntimeException(cce);
1417            } catch (HL7Exception he) {
1418                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1419                throw new RuntimeException(he);
1420            }
1421            return ret;
1422        }
1423    
1424    
1425        /**
1426         * Returns a count of the current number of repetitions of Phone Number - Home (PID-13).
1427         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1428         * it will return zero.
1429         */
1430        public int getPhoneNumberHomeReps() {
1431            XTN[] ret = null;
1432            try {
1433                Type[] t = this.getField(13);
1434                return t.length;  
1435            } catch (ClassCastException cce) {
1436                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1437                throw new RuntimeException(cce);
1438            } catch (HL7Exception he) {
1439                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1440                throw new RuntimeException(he);
1441            }
1442        }
1443    
1444    
1445        /**
1446         * Returns a specific repetition of
1447         * PID-13: "Phone Number - Home" - creates it if necessary
1448         *
1449         * @param rep The repetition index (0-indexed)
1450         */
1451        public XTN getPhoneNumberHome(int rep) { 
1452            XTN ret = null;
1453            try {
1454                Type t = this.getField(13, rep);
1455                ret = (XTN)t;
1456            } catch (ClassCastException cce) {
1457                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1458                throw new RuntimeException(cce);
1459            } catch (HL7Exception he) {
1460                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1461                throw new RuntimeException(he);
1462            }
1463            return ret;
1464        }
1465    
1466        /**
1467         * Returns a specific repetition of
1468         * PID-13: "Phone Number - Home" - creates it if necessary
1469         *
1470         * @param rep The repetition index (0-indexed)
1471         */
1472        public XTN getPid13_PhoneNumberHome(int rep) { 
1473            XTN ret = null;
1474            try {
1475                Type t = this.getField(13, rep);
1476                ret = (XTN)t;
1477            } catch (ClassCastException cce) {
1478                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1479                throw new RuntimeException(cce);
1480            } catch (HL7Exception he) {
1481                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1482                throw new RuntimeException(he);
1483            }
1484            return ret;
1485        }
1486    
1487    
1488        /**
1489         * Returns a count of the current number of repetitions of Phone Number - Home (PID-13).
1490         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1491         * it will return zero.
1492         */
1493        public int getPid13_PhoneNumberHomeReps() {
1494            XTN[] ret = null;
1495            try {
1496                Type[] t = this.getField(13);
1497                return t.length;  
1498            } catch (ClassCastException cce) {
1499                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1500                throw new RuntimeException(cce);
1501            } catch (HL7Exception he) {
1502                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1503                throw new RuntimeException(he);
1504            }
1505        }
1506    
1507    
1508    
1509        /**
1510         * Inserts a repetition of
1511         * PID-13: "Phone Number - Home" at a specific index
1512         *
1513         * @param rep The repetition index (0-indexed)
1514         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1515         */
1516        public XTN insertPhoneNumberHome(int rep) throws HL7Exception { 
1517            return (XTN) super.insertRepetition(13, rep);
1518        }
1519    
1520    
1521    
1522        /**
1523         * Inserts a repetition of
1524         * PID-13: "Phone Number - Home" at a specific index
1525         *
1526         * @param rep The repetition index (0-indexed)
1527         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1528         */
1529        public XTN insertPid13_PhoneNumberHome(int rep) throws HL7Exception { 
1530            return (XTN) super.insertRepetition(13, rep);
1531        }
1532    
1533    
1534        /**
1535         * Removes a repetition of
1536         * PID-13: "Phone Number - Home" at a specific index
1537         *
1538         * @param rep The repetition index (0-indexed)
1539         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1540         */
1541        public XTN removePhoneNumberHome(int rep) throws HL7Exception { 
1542            return (XTN) super.removeRepetition(13, rep);
1543        }
1544    
1545    
1546        /**
1547         * Removes a repetition of
1548         * PID-13: "Phone Number - Home" at a specific index
1549         *
1550         * @param rep The repetition index (0-indexed)
1551         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1552         */
1553        public XTN removePid13_PhoneNumberHome(int rep) throws HL7Exception { 
1554            return (XTN) super.removeRepetition(13, rep);
1555        }
1556    
1557    
1558    
1559        /**
1560         * Returns all repetitions of Phone Number - Business (PID-14).
1561         */
1562        public XTN[] getPhoneNumberBusiness() {
1563            XTN[] ret = null;
1564            try {
1565                Type[] t = this.getField(14);  
1566                ret = new XTN[t.length];
1567                for (int i = 0; i < ret.length; i++) {
1568                    ret[i] = (XTN)t[i];
1569                }
1570            } catch (ClassCastException cce) {
1571                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1572                throw new RuntimeException(cce);
1573            } catch (HL7Exception he) {
1574                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1575                throw new RuntimeException(he);
1576            }
1577            return ret;
1578        }
1579    
1580    
1581        /**
1582         * Returns a count of the current number of repetitions of Phone Number - Business (PID-14).
1583         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1584         * it will return zero.
1585         */
1586        public int getPhoneNumberBusinessReps() {
1587            XTN[] ret = null;
1588            try {
1589                Type[] t = this.getField(14);
1590                return t.length;  
1591            } catch (ClassCastException cce) {
1592                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1593                throw new RuntimeException(cce);
1594            } catch (HL7Exception he) {
1595                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1596                throw new RuntimeException(he);
1597            }
1598        }
1599    
1600    
1601        /**
1602         * Returns a specific repetition of
1603         * PID-14: "Phone Number - Business" - creates it if necessary
1604         *
1605         * @param rep The repetition index (0-indexed)
1606         */
1607        public XTN getPhoneNumberBusiness(int rep) { 
1608            XTN ret = null;
1609            try {
1610                Type t = this.getField(14, rep);
1611                ret = (XTN)t;
1612            } catch (ClassCastException cce) {
1613                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1614                throw new RuntimeException(cce);
1615            } catch (HL7Exception he) {
1616                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1617                throw new RuntimeException(he);
1618            }
1619            return ret;
1620        }
1621    
1622        /**
1623         * Returns a specific repetition of
1624         * PID-14: "Phone Number - Business" - creates it if necessary
1625         *
1626         * @param rep The repetition index (0-indexed)
1627         */
1628        public XTN getPid14_PhoneNumberBusiness(int rep) { 
1629            XTN ret = null;
1630            try {
1631                Type t = this.getField(14, rep);
1632                ret = (XTN)t;
1633            } catch (ClassCastException cce) {
1634                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1635                throw new RuntimeException(cce);
1636            } catch (HL7Exception he) {
1637                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1638                throw new RuntimeException(he);
1639            }
1640            return ret;
1641        }
1642    
1643    
1644        /**
1645         * Returns a count of the current number of repetitions of Phone Number - Business (PID-14).
1646         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1647         * it will return zero.
1648         */
1649        public int getPid14_PhoneNumberBusinessReps() {
1650            XTN[] ret = null;
1651            try {
1652                Type[] t = this.getField(14);
1653                return t.length;  
1654            } catch (ClassCastException cce) {
1655                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1656                throw new RuntimeException(cce);
1657            } catch (HL7Exception he) {
1658                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1659                throw new RuntimeException(he);
1660            }
1661        }
1662    
1663    
1664    
1665        /**
1666         * Inserts a repetition of
1667         * PID-14: "Phone Number - Business" at a specific index
1668         *
1669         * @param rep The repetition index (0-indexed)
1670         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1671         */
1672        public XTN insertPhoneNumberBusiness(int rep) throws HL7Exception { 
1673            return (XTN) super.insertRepetition(14, rep);
1674        }
1675    
1676    
1677    
1678        /**
1679         * Inserts a repetition of
1680         * PID-14: "Phone Number - Business" at a specific index
1681         *
1682         * @param rep The repetition index (0-indexed)
1683         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1684         */
1685        public XTN insertPid14_PhoneNumberBusiness(int rep) throws HL7Exception { 
1686            return (XTN) super.insertRepetition(14, rep);
1687        }
1688    
1689    
1690        /**
1691         * Removes a repetition of
1692         * PID-14: "Phone Number - Business" at a specific index
1693         *
1694         * @param rep The repetition index (0-indexed)
1695         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1696         */
1697        public XTN removePhoneNumberBusiness(int rep) throws HL7Exception { 
1698            return (XTN) super.removeRepetition(14, rep);
1699        }
1700    
1701    
1702        /**
1703         * Removes a repetition of
1704         * PID-14: "Phone Number - Business" at a specific index
1705         *
1706         * @param rep The repetition index (0-indexed)
1707         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1708         */
1709        public XTN removePid14_PhoneNumberBusiness(int rep) throws HL7Exception { 
1710            return (XTN) super.removeRepetition(14, rep);
1711        }
1712    
1713    
1714    
1715    
1716        /**
1717         * Returns
1718         * PID-15: "Primary Language" - creates it if necessary
1719         */
1720        public CE getPrimaryLanguage() { 
1721            CE ret = null;
1722            try {
1723                Type t = this.getField(15, 0);
1724                ret = (CE)t;
1725            } catch (ClassCastException cce) {
1726                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1727                throw new RuntimeException(cce);
1728            } catch (HL7Exception he) {
1729                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1730                throw new RuntimeException(he);
1731            }
1732            return ret;
1733        }
1734    
1735    
1736        /**
1737         * Returns
1738         * PID-15: "Primary Language" - creates it if necessary
1739         */
1740        public CE getPid15_PrimaryLanguage() { 
1741            CE ret = null;
1742            try {
1743                Type t = this.getField(15, 0);
1744                ret = (CE)t;
1745            } catch (ClassCastException cce) {
1746                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1747                throw new RuntimeException(cce);
1748            } catch (HL7Exception he) {
1749                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1750                throw new RuntimeException(he);
1751            }
1752            return ret;
1753        }
1754    
1755    
1756    
1757        /**
1758         * Returns
1759         * PID-16: "Marital Status" - creates it if necessary
1760         */
1761        public CE getMaritalStatus() { 
1762            CE ret = null;
1763            try {
1764                Type t = this.getField(16, 0);
1765                ret = (CE)t;
1766            } catch (ClassCastException cce) {
1767                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1768                throw new RuntimeException(cce);
1769            } catch (HL7Exception he) {
1770                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1771                throw new RuntimeException(he);
1772            }
1773            return ret;
1774        }
1775    
1776    
1777        /**
1778         * Returns
1779         * PID-16: "Marital Status" - creates it if necessary
1780         */
1781        public CE getPid16_MaritalStatus() { 
1782            CE ret = null;
1783            try {
1784                Type t = this.getField(16, 0);
1785                ret = (CE)t;
1786            } catch (ClassCastException cce) {
1787                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1788                throw new RuntimeException(cce);
1789            } catch (HL7Exception he) {
1790                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1791                throw new RuntimeException(he);
1792            }
1793            return ret;
1794        }
1795    
1796    
1797    
1798        /**
1799         * Returns
1800         * PID-17: "Religion" - creates it if necessary
1801         */
1802        public CE getReligion() { 
1803            CE ret = null;
1804            try {
1805                Type t = this.getField(17, 0);
1806                ret = (CE)t;
1807            } catch (ClassCastException cce) {
1808                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1809                throw new RuntimeException(cce);
1810            } catch (HL7Exception he) {
1811                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1812                throw new RuntimeException(he);
1813            }
1814            return ret;
1815        }
1816    
1817    
1818        /**
1819         * Returns
1820         * PID-17: "Religion" - creates it if necessary
1821         */
1822        public CE getPid17_Religion() { 
1823            CE ret = null;
1824            try {
1825                Type t = this.getField(17, 0);
1826                ret = (CE)t;
1827            } catch (ClassCastException cce) {
1828                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1829                throw new RuntimeException(cce);
1830            } catch (HL7Exception he) {
1831                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1832                throw new RuntimeException(he);
1833            }
1834            return ret;
1835        }
1836    
1837    
1838    
1839        /**
1840         * Returns
1841         * PID-18: "Patient Account Number" - creates it if necessary
1842         */
1843        public CX getPatientAccountNumber() { 
1844            CX ret = null;
1845            try {
1846                Type t = this.getField(18, 0);
1847                ret = (CX)t;
1848            } catch (ClassCastException cce) {
1849                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1850                throw new RuntimeException(cce);
1851            } catch (HL7Exception he) {
1852                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1853                throw new RuntimeException(he);
1854            }
1855            return ret;
1856        }
1857    
1858    
1859        /**
1860         * Returns
1861         * PID-18: "Patient Account Number" - creates it if necessary
1862         */
1863        public CX getPid18_PatientAccountNumber() { 
1864            CX ret = null;
1865            try {
1866                Type t = this.getField(18, 0);
1867                ret = (CX)t;
1868            } catch (ClassCastException cce) {
1869                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1870                throw new RuntimeException(cce);
1871            } catch (HL7Exception he) {
1872                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1873                throw new RuntimeException(he);
1874            }
1875            return ret;
1876        }
1877    
1878    
1879    
1880        /**
1881         * Returns
1882         * PID-19: "SSN Number - Patient" - creates it if necessary
1883         */
1884        public ST getSSNNumberPatient() { 
1885            ST ret = null;
1886            try {
1887                Type t = this.getField(19, 0);
1888                ret = (ST)t;
1889            } catch (ClassCastException cce) {
1890                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1891                throw new RuntimeException(cce);
1892            } catch (HL7Exception he) {
1893                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1894                throw new RuntimeException(he);
1895            }
1896            return ret;
1897        }
1898    
1899    
1900        /**
1901         * Returns
1902         * PID-19: "SSN Number - Patient" - creates it if necessary
1903         */
1904        public ST getPid19_SSNNumberPatient() { 
1905            ST ret = null;
1906            try {
1907                Type t = this.getField(19, 0);
1908                ret = (ST)t;
1909            } catch (ClassCastException cce) {
1910                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1911                throw new RuntimeException(cce);
1912            } catch (HL7Exception he) {
1913                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1914                throw new RuntimeException(he);
1915            }
1916            return ret;
1917        }
1918    
1919    
1920    
1921        /**
1922         * Returns
1923         * PID-20: "Driver's License Number - Patient" - creates it if necessary
1924         */
1925        public DLN getDriverSLicenseNumberPatient() { 
1926            DLN ret = null;
1927            try {
1928                Type t = this.getField(20, 0);
1929                ret = (DLN)t;
1930            } catch (ClassCastException cce) {
1931                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1932                throw new RuntimeException(cce);
1933            } catch (HL7Exception he) {
1934                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1935                throw new RuntimeException(he);
1936            }
1937            return ret;
1938        }
1939    
1940    
1941        /**
1942         * Returns
1943         * PID-20: "Driver's License Number - Patient" - creates it if necessary
1944         */
1945        public DLN getPid20_DriverSLicenseNumberPatient() { 
1946            DLN ret = null;
1947            try {
1948                Type t = this.getField(20, 0);
1949                ret = (DLN)t;
1950            } catch (ClassCastException cce) {
1951                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1952                throw new RuntimeException(cce);
1953            } catch (HL7Exception he) {
1954                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1955                throw new RuntimeException(he);
1956            }
1957            return ret;
1958        }
1959    
1960    
1961        /**
1962         * Returns all repetitions of Mother's Identifier (PID-21).
1963         */
1964        public CX[] getMotherSIdentifier() {
1965            CX[] ret = null;
1966            try {
1967                Type[] t = this.getField(21);  
1968                ret = new CX[t.length];
1969                for (int i = 0; i < ret.length; i++) {
1970                    ret[i] = (CX)t[i];
1971                }
1972            } catch (ClassCastException cce) {
1973                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1974                throw new RuntimeException(cce);
1975            } catch (HL7Exception he) {
1976                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1977                throw new RuntimeException(he);
1978            }
1979            return ret;
1980        }
1981    
1982    
1983        /**
1984         * Returns a count of the current number of repetitions of Mother's Identifier (PID-21).
1985         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1986         * it will return zero.
1987         */
1988        public int getMotherSIdentifierReps() {
1989            CX[] ret = null;
1990            try {
1991                Type[] t = this.getField(21);
1992                return t.length;  
1993            } catch (ClassCastException cce) {
1994                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1995                throw new RuntimeException(cce);
1996            } catch (HL7Exception he) {
1997                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1998                throw new RuntimeException(he);
1999            }
2000        }
2001    
2002    
2003        /**
2004         * Returns a specific repetition of
2005         * PID-21: "Mother's Identifier" - creates it if necessary
2006         *
2007         * @param rep The repetition index (0-indexed)
2008         */
2009        public CX getMotherSIdentifier(int rep) { 
2010            CX ret = null;
2011            try {
2012                Type t = this.getField(21, rep);
2013                ret = (CX)t;
2014            } catch (ClassCastException cce) {
2015                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2016                throw new RuntimeException(cce);
2017            } catch (HL7Exception he) {
2018                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2019                throw new RuntimeException(he);
2020            }
2021            return ret;
2022        }
2023    
2024        /**
2025         * Returns a specific repetition of
2026         * PID-21: "Mother's Identifier" - creates it if necessary
2027         *
2028         * @param rep The repetition index (0-indexed)
2029         */
2030        public CX getPid21_MotherSIdentifier(int rep) { 
2031            CX ret = null;
2032            try {
2033                Type t = this.getField(21, rep);
2034                ret = (CX)t;
2035            } catch (ClassCastException cce) {
2036                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2037                throw new RuntimeException(cce);
2038            } catch (HL7Exception he) {
2039                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2040                throw new RuntimeException(he);
2041            }
2042            return ret;
2043        }
2044    
2045    
2046        /**
2047         * Returns a count of the current number of repetitions of Mother's Identifier (PID-21).
2048         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2049         * it will return zero.
2050         */
2051        public int getPid21_MotherSIdentifierReps() {
2052            CX[] ret = null;
2053            try {
2054                Type[] t = this.getField(21);
2055                return t.length;  
2056            } catch (ClassCastException cce) {
2057                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2058                throw new RuntimeException(cce);
2059            } catch (HL7Exception he) {
2060                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2061                throw new RuntimeException(he);
2062            }
2063        }
2064    
2065    
2066    
2067        /**
2068         * Inserts a repetition of
2069         * PID-21: "Mother's Identifier" at a specific index
2070         *
2071         * @param rep The repetition index (0-indexed)
2072         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2073         */
2074        public CX insertMotherSIdentifier(int rep) throws HL7Exception { 
2075            return (CX) super.insertRepetition(21, rep);
2076        }
2077    
2078    
2079    
2080        /**
2081         * Inserts a repetition of
2082         * PID-21: "Mother's Identifier" at a specific index
2083         *
2084         * @param rep The repetition index (0-indexed)
2085         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2086         */
2087        public CX insertPid21_MotherSIdentifier(int rep) throws HL7Exception { 
2088            return (CX) super.insertRepetition(21, rep);
2089        }
2090    
2091    
2092        /**
2093         * Removes a repetition of
2094         * PID-21: "Mother's Identifier" at a specific index
2095         *
2096         * @param rep The repetition index (0-indexed)
2097         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2098         */
2099        public CX removeMotherSIdentifier(int rep) throws HL7Exception { 
2100            return (CX) super.removeRepetition(21, rep);
2101        }
2102    
2103    
2104        /**
2105         * Removes a repetition of
2106         * PID-21: "Mother's Identifier" at a specific index
2107         *
2108         * @param rep The repetition index (0-indexed)
2109         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2110         */
2111        public CX removePid21_MotherSIdentifier(int rep) throws HL7Exception { 
2112            return (CX) super.removeRepetition(21, rep);
2113        }
2114    
2115    
2116    
2117        /**
2118         * Returns all repetitions of Ethnic Group (PID-22).
2119         */
2120        public CE[] getEthnicGroup() {
2121            CE[] ret = null;
2122            try {
2123                Type[] t = this.getField(22);  
2124                ret = new CE[t.length];
2125                for (int i = 0; i < ret.length; i++) {
2126                    ret[i] = (CE)t[i];
2127                }
2128            } catch (ClassCastException cce) {
2129                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2130                throw new RuntimeException(cce);
2131            } catch (HL7Exception he) {
2132                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2133                throw new RuntimeException(he);
2134            }
2135            return ret;
2136        }
2137    
2138    
2139        /**
2140         * Returns a count of the current number of repetitions of Ethnic Group (PID-22).
2141         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2142         * it will return zero.
2143         */
2144        public int getEthnicGroupReps() {
2145            CE[] ret = null;
2146            try {
2147                Type[] t = this.getField(22);
2148                return t.length;  
2149            } catch (ClassCastException cce) {
2150                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2151                throw new RuntimeException(cce);
2152            } catch (HL7Exception he) {
2153                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2154                throw new RuntimeException(he);
2155            }
2156        }
2157    
2158    
2159        /**
2160         * Returns a specific repetition of
2161         * PID-22: "Ethnic Group" - creates it if necessary
2162         *
2163         * @param rep The repetition index (0-indexed)
2164         */
2165        public CE getEthnicGroup(int rep) { 
2166            CE ret = null;
2167            try {
2168                Type t = this.getField(22, rep);
2169                ret = (CE)t;
2170            } catch (ClassCastException cce) {
2171                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2172                throw new RuntimeException(cce);
2173            } catch (HL7Exception he) {
2174                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2175                throw new RuntimeException(he);
2176            }
2177            return ret;
2178        }
2179    
2180        /**
2181         * Returns a specific repetition of
2182         * PID-22: "Ethnic Group" - creates it if necessary
2183         *
2184         * @param rep The repetition index (0-indexed)
2185         */
2186        public CE getPid22_EthnicGroup(int rep) { 
2187            CE ret = null;
2188            try {
2189                Type t = this.getField(22, rep);
2190                ret = (CE)t;
2191            } catch (ClassCastException cce) {
2192                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2193                throw new RuntimeException(cce);
2194            } catch (HL7Exception he) {
2195                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2196                throw new RuntimeException(he);
2197            }
2198            return ret;
2199        }
2200    
2201    
2202        /**
2203         * Returns a count of the current number of repetitions of Ethnic Group (PID-22).
2204         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2205         * it will return zero.
2206         */
2207        public int getPid22_EthnicGroupReps() {
2208            CE[] ret = null;
2209            try {
2210                Type[] t = this.getField(22);
2211                return t.length;  
2212            } catch (ClassCastException cce) {
2213                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2214                throw new RuntimeException(cce);
2215            } catch (HL7Exception he) {
2216                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2217                throw new RuntimeException(he);
2218            }
2219        }
2220    
2221    
2222    
2223        /**
2224         * Inserts a repetition of
2225         * PID-22: "Ethnic Group" at a specific index
2226         *
2227         * @param rep The repetition index (0-indexed)
2228         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2229         */
2230        public CE insertEthnicGroup(int rep) throws HL7Exception { 
2231            return (CE) super.insertRepetition(22, rep);
2232        }
2233    
2234    
2235    
2236        /**
2237         * Inserts a repetition of
2238         * PID-22: "Ethnic Group" at a specific index
2239         *
2240         * @param rep The repetition index (0-indexed)
2241         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2242         */
2243        public CE insertPid22_EthnicGroup(int rep) throws HL7Exception { 
2244            return (CE) super.insertRepetition(22, rep);
2245        }
2246    
2247    
2248        /**
2249         * Removes a repetition of
2250         * PID-22: "Ethnic Group" at a specific index
2251         *
2252         * @param rep The repetition index (0-indexed)
2253         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2254         */
2255        public CE removeEthnicGroup(int rep) throws HL7Exception { 
2256            return (CE) super.removeRepetition(22, rep);
2257        }
2258    
2259    
2260        /**
2261         * Removes a repetition of
2262         * PID-22: "Ethnic Group" at a specific index
2263         *
2264         * @param rep The repetition index (0-indexed)
2265         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2266         */
2267        public CE removePid22_EthnicGroup(int rep) throws HL7Exception { 
2268            return (CE) super.removeRepetition(22, rep);
2269        }
2270    
2271    
2272    
2273    
2274        /**
2275         * Returns
2276         * PID-23: "Birth Place" - creates it if necessary
2277         */
2278        public ST getBirthPlace() { 
2279            ST ret = null;
2280            try {
2281                Type t = this.getField(23, 0);
2282                ret = (ST)t;
2283            } catch (ClassCastException cce) {
2284                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2285                throw new RuntimeException(cce);
2286            } catch (HL7Exception he) {
2287                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2288                throw new RuntimeException(he);
2289            }
2290            return ret;
2291        }
2292    
2293    
2294        /**
2295         * Returns
2296         * PID-23: "Birth Place" - creates it if necessary
2297         */
2298        public ST getPid23_BirthPlace() { 
2299            ST ret = null;
2300            try {
2301                Type t = this.getField(23, 0);
2302                ret = (ST)t;
2303            } catch (ClassCastException cce) {
2304                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2305                throw new RuntimeException(cce);
2306            } catch (HL7Exception he) {
2307                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2308                throw new RuntimeException(he);
2309            }
2310            return ret;
2311        }
2312    
2313    
2314    
2315        /**
2316         * Returns
2317         * PID-24: "Multiple Birth Indicator" - creates it if necessary
2318         */
2319        public ID getMultipleBirthIndicator() { 
2320            ID ret = null;
2321            try {
2322                Type t = this.getField(24, 0);
2323                ret = (ID)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         * PID-24: "Multiple Birth Indicator" - creates it if necessary
2338         */
2339        public ID getPid24_MultipleBirthIndicator() { 
2340            ID ret = null;
2341            try {
2342                Type t = this.getField(24, 0);
2343                ret = (ID)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        /**
2357         * Returns
2358         * PID-25: "Birth Order" - creates it if necessary
2359         */
2360        public NM getBirthOrder() { 
2361            NM ret = null;
2362            try {
2363                Type t = this.getField(25, 0);
2364                ret = (NM)t;
2365            } catch (ClassCastException cce) {
2366                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2367                throw new RuntimeException(cce);
2368            } catch (HL7Exception he) {
2369                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2370                throw new RuntimeException(he);
2371            }
2372            return ret;
2373        }
2374    
2375    
2376        /**
2377         * Returns
2378         * PID-25: "Birth Order" - creates it if necessary
2379         */
2380        public NM getPid25_BirthOrder() { 
2381            NM ret = null;
2382            try {
2383                Type t = this.getField(25, 0);
2384                ret = (NM)t;
2385            } catch (ClassCastException cce) {
2386                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2387                throw new RuntimeException(cce);
2388            } catch (HL7Exception he) {
2389                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2390                throw new RuntimeException(he);
2391            }
2392            return ret;
2393        }
2394    
2395    
2396        /**
2397         * Returns all repetitions of Citizenship (PID-26).
2398         */
2399        public CE[] getCitizenship() {
2400            CE[] ret = null;
2401            try {
2402                Type[] t = this.getField(26);  
2403                ret = new CE[t.length];
2404                for (int i = 0; i < ret.length; i++) {
2405                    ret[i] = (CE)t[i];
2406                }
2407            } catch (ClassCastException cce) {
2408                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2409                throw new RuntimeException(cce);
2410            } catch (HL7Exception he) {
2411                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2412                throw new RuntimeException(he);
2413            }
2414            return ret;
2415        }
2416    
2417    
2418        /**
2419         * Returns a count of the current number of repetitions of Citizenship (PID-26).
2420         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2421         * it will return zero.
2422         */
2423        public int getCitizenshipReps() {
2424            CE[] ret = null;
2425            try {
2426                Type[] t = this.getField(26);
2427                return t.length;  
2428            } catch (ClassCastException cce) {
2429                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2430                throw new RuntimeException(cce);
2431            } catch (HL7Exception he) {
2432                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2433                throw new RuntimeException(he);
2434            }
2435        }
2436    
2437    
2438        /**
2439         * Returns a specific repetition of
2440         * PID-26: "Citizenship" - creates it if necessary
2441         *
2442         * @param rep The repetition index (0-indexed)
2443         */
2444        public CE getCitizenship(int rep) { 
2445            CE ret = null;
2446            try {
2447                Type t = this.getField(26, rep);
2448                ret = (CE)t;
2449            } catch (ClassCastException cce) {
2450                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2451                throw new RuntimeException(cce);
2452            } catch (HL7Exception he) {
2453                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2454                throw new RuntimeException(he);
2455            }
2456            return ret;
2457        }
2458    
2459        /**
2460         * Returns a specific repetition of
2461         * PID-26: "Citizenship" - creates it if necessary
2462         *
2463         * @param rep The repetition index (0-indexed)
2464         */
2465        public CE getPid26_Citizenship(int rep) { 
2466            CE ret = null;
2467            try {
2468                Type t = this.getField(26, rep);
2469                ret = (CE)t;
2470            } catch (ClassCastException cce) {
2471                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2472                throw new RuntimeException(cce);
2473            } catch (HL7Exception he) {
2474                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2475                throw new RuntimeException(he);
2476            }
2477            return ret;
2478        }
2479    
2480    
2481        /**
2482         * Returns a count of the current number of repetitions of Citizenship (PID-26).
2483         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
2484         * it will return zero.
2485         */
2486        public int getPid26_CitizenshipReps() {
2487            CE[] ret = null;
2488            try {
2489                Type[] t = this.getField(26);
2490                return t.length;  
2491            } catch (ClassCastException cce) {
2492                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2493                throw new RuntimeException(cce);
2494            } catch (HL7Exception he) {
2495                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2496                throw new RuntimeException(he);
2497            }
2498        }
2499    
2500    
2501    
2502        /**
2503         * Inserts a repetition of
2504         * PID-26: "Citizenship" at a specific index
2505         *
2506         * @param rep The repetition index (0-indexed)
2507         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2508         */
2509        public CE insertCitizenship(int rep) throws HL7Exception { 
2510            return (CE) super.insertRepetition(26, rep);
2511        }
2512    
2513    
2514    
2515        /**
2516         * Inserts a repetition of
2517         * PID-26: "Citizenship" at a specific index
2518         *
2519         * @param rep The repetition index (0-indexed)
2520         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2521         */
2522        public CE insertPid26_Citizenship(int rep) throws HL7Exception { 
2523            return (CE) super.insertRepetition(26, rep);
2524        }
2525    
2526    
2527        /**
2528         * Removes a repetition of
2529         * PID-26: "Citizenship" at a specific index
2530         *
2531         * @param rep The repetition index (0-indexed)
2532         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2533         */
2534        public CE removeCitizenship(int rep) throws HL7Exception { 
2535            return (CE) super.removeRepetition(26, rep);
2536        }
2537    
2538    
2539        /**
2540         * Removes a repetition of
2541         * PID-26: "Citizenship" at a specific index
2542         *
2543         * @param rep The repetition index (0-indexed)
2544         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
2545         */
2546        public CE removePid26_Citizenship(int rep) throws HL7Exception { 
2547            return (CE) super.removeRepetition(26, rep);
2548        }
2549    
2550    
2551    
2552    
2553        /**
2554         * Returns
2555         * PID-27: "Veterans Military Status" - creates it if necessary
2556         */
2557        public CE getVeteransMilitaryStatus() { 
2558            CE ret = null;
2559            try {
2560                Type t = this.getField(27, 0);
2561                ret = (CE)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         * PID-27: "Veterans Military Status" - creates it if necessary
2576         */
2577        public CE getPid27_VeteransMilitaryStatus() { 
2578            CE ret = null;
2579            try {
2580                Type t = this.getField(27, 0);
2581                ret = (CE)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         * PID-28: "Nationality" - creates it if necessary
2597         */
2598        public CE getNationality() { 
2599            CE ret = null;
2600            try {
2601                Type t = this.getField(28, 0);
2602                ret = (CE)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         * PID-28: "Nationality" - creates it if necessary
2617         */
2618        public CE getPid28_Nationality() { 
2619            CE ret = null;
2620            try {
2621                Type t = this.getField(28, 0);
2622                ret = (CE)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        /**
2636         * Returns
2637         * PID-29: "Patient Death Date and Time" - creates it if necessary
2638         */
2639        public TS getPatientDeathDateAndTime() { 
2640            TS ret = null;
2641            try {
2642                Type t = this.getField(29, 0);
2643                ret = (TS)t;
2644            } catch (ClassCastException cce) {
2645                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2646                throw new RuntimeException(cce);
2647            } catch (HL7Exception he) {
2648                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2649                throw new RuntimeException(he);
2650            }
2651            return ret;
2652        }
2653    
2654    
2655        /**
2656         * Returns
2657         * PID-29: "Patient Death Date and Time" - creates it if necessary
2658         */
2659        public TS getPid29_PatientDeathDateAndTime() { 
2660            TS ret = null;
2661            try {
2662                Type t = this.getField(29, 0);
2663                ret = (TS)t;
2664            } catch (ClassCastException cce) {
2665                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2666                throw new RuntimeException(cce);
2667            } catch (HL7Exception he) {
2668                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2669                throw new RuntimeException(he);
2670            }
2671            return ret;
2672        }
2673    
2674    
2675    
2676        /**
2677         * Returns
2678         * PID-30: "Patient Death Indicator" - creates it if necessary
2679         */
2680        public ID getPatientDeathIndicator() { 
2681            ID ret = null;
2682            try {
2683                Type t = this.getField(30, 0);
2684                ret = (ID)t;
2685            } catch (ClassCastException cce) {
2686                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2687                throw new RuntimeException(cce);
2688            } catch (HL7Exception he) {
2689                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2690                throw new RuntimeException(he);
2691            }
2692            return ret;
2693        }
2694    
2695    
2696        /**
2697         * Returns
2698         * PID-30: "Patient Death Indicator" - creates it if necessary
2699         */
2700        public ID getPid30_PatientDeathIndicator() { 
2701            ID ret = null;
2702            try {
2703                Type t = this.getField(30, 0);
2704                ret = (ID)t;
2705            } catch (ClassCastException cce) {
2706                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
2707                throw new RuntimeException(cce);
2708            } catch (HL7Exception he) {
2709                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
2710                throw new RuntimeException(he);
2711            }
2712            return ret;
2713        }
2714    
2715    
2716    
2717    
2718    
2719        /** {@inheritDoc} */   
2720        protected Type createNewTypeWithoutReflection(int field) {
2721           switch (field) {
2722              case 0: return new SI(getMessage());
2723              case 1: return new CX(getMessage());
2724              case 2: return new CX(getMessage());
2725              case 3: return new CX(getMessage());
2726              case 4: return new XPN(getMessage());
2727              case 5: return new XPN(getMessage());
2728              case 6: return new TS(getMessage());
2729              case 7: return new IS(getMessage(), new Integer( 1 ));
2730              case 8: return new XPN(getMessage());
2731              case 9: return new CE(getMessage());
2732              case 10: return new XAD(getMessage());
2733              case 11: return new IS(getMessage(), new Integer( 289 ));
2734              case 12: return new XTN(getMessage());
2735              case 13: return new XTN(getMessage());
2736              case 14: return new CE(getMessage());
2737              case 15: return new CE(getMessage());
2738              case 16: return new CE(getMessage());
2739              case 17: return new CX(getMessage());
2740              case 18: return new ST(getMessage());
2741              case 19: return new DLN(getMessage());
2742              case 20: return new CX(getMessage());
2743              case 21: return new CE(getMessage());
2744              case 22: return new ST(getMessage());
2745              case 23: return new ID(getMessage(), new Integer( 136 ));
2746              case 24: return new NM(getMessage());
2747              case 25: return new CE(getMessage());
2748              case 26: return new CE(getMessage());
2749              case 27: return new CE(getMessage());
2750              case 28: return new TS(getMessage());
2751              case 29: return new ID(getMessage(), new Integer( 136 ));
2752              default: return null;
2753           }
2754       }
2755    
2756    
2757    }
2758