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 PD1 message segment (PD1 - patient additional demographic segment).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>PD1-1: Living Dependency (IS) <b>optional repeating</b>
027 * <li>PD1-2: Living Arrangement (IS) <b>optional </b>
028 * <li>PD1-3: Patient Primary Facility (XON) <b>optional repeating</b>
029 * <li>PD1-4: Patient Primary Care Provider Name & ID No. (XCN) <b>optional repeating</b>
030 * <li>PD1-5: Student Indicator (IS) <b>optional </b>
031 * <li>PD1-6: Handicap (IS) <b>optional </b>
032 * <li>PD1-7: Living Will (IS) <b>optional </b>
033 * <li>PD1-8: Organ Donor (IS) <b>optional </b>
034 * <li>PD1-9: Separate Bill (ID) <b>optional </b>
035 * <li>PD1-10: Duplicate Patient (CX) <b>optional repeating</b>
036 * <li>PD1-11: Publicity Code (CE) <b>optional </b>
037 * <li>PD1-12: Protection Indicator (ID) <b>optional </b>
038 * </ul>
039 */
040 public class PD1 extends AbstractSegment {
041
042 /**
043 * Creates a new PD1 segment
044 */
045 public PD1(Group parent, ModelClassFactory factory) {
046 super(parent, factory);
047 init(factory);
048 }
049
050 private void init(ModelClassFactory factory) {
051 try {
052 this.add(IS.class, false, 0, 2, new Object[]{ getMessage() }, "Living Dependency");
053 this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Living Arrangement");
054 this.add(XON.class, false, 0, 90, new Object[]{ getMessage(), new Integer(0) }, "Patient Primary Facility");
055 this.add(XCN.class, false, 0, 90, new Object[]{ getMessage(), new Integer(0) }, "Patient Primary Care Provider Name & ID No.");
056 this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Student Indicator");
057 this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Handicap");
058 this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Living Will");
059 this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Organ Donor");
060 this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Separate Bill");
061 this.add(CX.class, false, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "Duplicate Patient");
062 this.add(CE.class, false, 1, 80, new Object[]{ getMessage(), new Integer(215) }, "Publicity Code");
063 this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Protection Indicator");
064 } catch(HL7Exception e) {
065 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PD1 - this is probably a bug in the source code generator.", e);
066 }
067 }
068
069
070 /**
071 * Returns all repetitions of Living Dependency (PD1-1).
072 */
073 public IS[] getLivingDependency() {
074 IS[] ret = null;
075 try {
076 Type[] t = this.getField(1);
077 ret = new IS[t.length];
078 for (int i = 0; i < ret.length; i++) {
079 ret[i] = (IS)t[i];
080 }
081 } catch (ClassCastException cce) {
082 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
083 throw new RuntimeException(cce);
084 } catch (HL7Exception he) {
085 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
086 throw new RuntimeException(he);
087 }
088 return ret;
089 }
090
091
092 /**
093 * Returns a count of the current number of repetitions of Living Dependency (PD1-1).
094 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
095 * it will return zero.
096 */
097 public int getLivingDependencyReps() {
098 IS[] ret = null;
099 try {
100 Type[] t = this.getField(1);
101 return t.length;
102 } catch (ClassCastException cce) {
103 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
104 throw new RuntimeException(cce);
105 } catch (HL7Exception he) {
106 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
107 throw new RuntimeException(he);
108 }
109 }
110
111
112 /**
113 * Returns a specific repetition of
114 * PD1-1: "Living Dependency" - creates it if necessary
115 *
116 * @param rep The repetition index (0-indexed)
117 */
118 public IS getLivingDependency(int rep) {
119 IS ret = null;
120 try {
121 Type t = this.getField(1, rep);
122 ret = (IS)t;
123 } catch (ClassCastException cce) {
124 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
125 throw new RuntimeException(cce);
126 } catch (HL7Exception he) {
127 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
128 throw new RuntimeException(he);
129 }
130 return ret;
131 }
132
133 /**
134 * Returns a specific repetition of
135 * PD1-1: "Living Dependency" - creates it if necessary
136 *
137 * @param rep The repetition index (0-indexed)
138 */
139 public IS getPd11_LivingDependency(int rep) {
140 IS ret = null;
141 try {
142 Type t = this.getField(1, rep);
143 ret = (IS)t;
144 } catch (ClassCastException cce) {
145 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
146 throw new RuntimeException(cce);
147 } catch (HL7Exception he) {
148 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
149 throw new RuntimeException(he);
150 }
151 return ret;
152 }
153
154
155 /**
156 * Returns a count of the current number of repetitions of Living Dependency (PD1-1).
157 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
158 * it will return zero.
159 */
160 public int getPd11_LivingDependencyReps() {
161 IS[] ret = null;
162 try {
163 Type[] t = this.getField(1);
164 return t.length;
165 } catch (ClassCastException cce) {
166 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
167 throw new RuntimeException(cce);
168 } catch (HL7Exception he) {
169 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
170 throw new RuntimeException(he);
171 }
172 }
173
174
175
176 /**
177 * Inserts a repetition of
178 * PD1-1: "Living Dependency" at a specific index
179 *
180 * @param rep The repetition index (0-indexed)
181 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
182 */
183 public IS insertLivingDependency(int rep) throws HL7Exception {
184 return (IS) super.insertRepetition(1, rep);
185 }
186
187
188
189 /**
190 * Inserts a repetition of
191 * PD1-1: "Living Dependency" at a specific index
192 *
193 * @param rep The repetition index (0-indexed)
194 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
195 */
196 public IS insertPd11_LivingDependency(int rep) throws HL7Exception {
197 return (IS) super.insertRepetition(1, rep);
198 }
199
200
201 /**
202 * Removes a repetition of
203 * PD1-1: "Living Dependency" at a specific index
204 *
205 * @param rep The repetition index (0-indexed)
206 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
207 */
208 public IS removeLivingDependency(int rep) throws HL7Exception {
209 return (IS) super.removeRepetition(1, rep);
210 }
211
212
213 /**
214 * Removes a repetition of
215 * PD1-1: "Living Dependency" at a specific index
216 *
217 * @param rep The repetition index (0-indexed)
218 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
219 */
220 public IS removePd11_LivingDependency(int rep) throws HL7Exception {
221 return (IS) super.removeRepetition(1, rep);
222 }
223
224
225
226
227 /**
228 * Returns
229 * PD1-2: "Living Arrangement" - creates it if necessary
230 */
231 public IS getLivingArrangement() {
232 IS ret = null;
233 try {
234 Type t = this.getField(2, 0);
235 ret = (IS)t;
236 } catch (ClassCastException cce) {
237 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
238 throw new RuntimeException(cce);
239 } catch (HL7Exception he) {
240 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
241 throw new RuntimeException(he);
242 }
243 return ret;
244 }
245
246
247 /**
248 * Returns
249 * PD1-2: "Living Arrangement" - creates it if necessary
250 */
251 public IS getPd12_LivingArrangement() {
252 IS ret = null;
253 try {
254 Type t = this.getField(2, 0);
255 ret = (IS)t;
256 } catch (ClassCastException cce) {
257 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
258 throw new RuntimeException(cce);
259 } catch (HL7Exception he) {
260 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
261 throw new RuntimeException(he);
262 }
263 return ret;
264 }
265
266
267 /**
268 * Returns all repetitions of Patient Primary Facility (PD1-3).
269 */
270 public XON[] getPatientPrimaryFacility() {
271 XON[] ret = null;
272 try {
273 Type[] t = this.getField(3);
274 ret = new XON[t.length];
275 for (int i = 0; i < ret.length; i++) {
276 ret[i] = (XON)t[i];
277 }
278 } catch (ClassCastException cce) {
279 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
280 throw new RuntimeException(cce);
281 } catch (HL7Exception he) {
282 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
283 throw new RuntimeException(he);
284 }
285 return ret;
286 }
287
288
289 /**
290 * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3).
291 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
292 * it will return zero.
293 */
294 public int getPatientPrimaryFacilityReps() {
295 XON[] ret = null;
296 try {
297 Type[] t = this.getField(3);
298 return t.length;
299 } catch (ClassCastException cce) {
300 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
301 throw new RuntimeException(cce);
302 } catch (HL7Exception he) {
303 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
304 throw new RuntimeException(he);
305 }
306 }
307
308
309 /**
310 * Returns a specific repetition of
311 * PD1-3: "Patient Primary Facility" - creates it if necessary
312 *
313 * @param rep The repetition index (0-indexed)
314 */
315 public XON getPatientPrimaryFacility(int rep) {
316 XON ret = null;
317 try {
318 Type t = this.getField(3, rep);
319 ret = (XON)t;
320 } catch (ClassCastException cce) {
321 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
322 throw new RuntimeException(cce);
323 } catch (HL7Exception he) {
324 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
325 throw new RuntimeException(he);
326 }
327 return ret;
328 }
329
330 /**
331 * Returns a specific repetition of
332 * PD1-3: "Patient Primary Facility" - creates it if necessary
333 *
334 * @param rep The repetition index (0-indexed)
335 */
336 public XON getPd13_PatientPrimaryFacility(int rep) {
337 XON ret = null;
338 try {
339 Type t = this.getField(3, rep);
340 ret = (XON)t;
341 } catch (ClassCastException cce) {
342 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
343 throw new RuntimeException(cce);
344 } catch (HL7Exception he) {
345 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
346 throw new RuntimeException(he);
347 }
348 return ret;
349 }
350
351
352 /**
353 * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3).
354 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
355 * it will return zero.
356 */
357 public int getPd13_PatientPrimaryFacilityReps() {
358 XON[] ret = null;
359 try {
360 Type[] t = this.getField(3);
361 return t.length;
362 } catch (ClassCastException cce) {
363 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
364 throw new RuntimeException(cce);
365 } catch (HL7Exception he) {
366 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
367 throw new RuntimeException(he);
368 }
369 }
370
371
372
373 /**
374 * Inserts a repetition of
375 * PD1-3: "Patient Primary Facility" at a specific index
376 *
377 * @param rep The repetition index (0-indexed)
378 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
379 */
380 public XON insertPatientPrimaryFacility(int rep) throws HL7Exception {
381 return (XON) super.insertRepetition(3, rep);
382 }
383
384
385
386 /**
387 * Inserts a repetition of
388 * PD1-3: "Patient Primary Facility" at a specific index
389 *
390 * @param rep The repetition index (0-indexed)
391 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
392 */
393 public XON insertPd13_PatientPrimaryFacility(int rep) throws HL7Exception {
394 return (XON) super.insertRepetition(3, rep);
395 }
396
397
398 /**
399 * Removes a repetition of
400 * PD1-3: "Patient Primary Facility" at a specific index
401 *
402 * @param rep The repetition index (0-indexed)
403 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
404 */
405 public XON removePatientPrimaryFacility(int rep) throws HL7Exception {
406 return (XON) super.removeRepetition(3, rep);
407 }
408
409
410 /**
411 * Removes a repetition of
412 * PD1-3: "Patient Primary Facility" at a specific index
413 *
414 * @param rep The repetition index (0-indexed)
415 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
416 */
417 public XON removePd13_PatientPrimaryFacility(int rep) throws HL7Exception {
418 return (XON) super.removeRepetition(3, rep);
419 }
420
421
422
423 /**
424 * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
425 */
426 public XCN[] getPatientPrimaryCareProviderNameIDNo() {
427 XCN[] ret = null;
428 try {
429 Type[] t = this.getField(4);
430 ret = new XCN[t.length];
431 for (int i = 0; i < ret.length; i++) {
432 ret[i] = (XCN)t[i];
433 }
434 } catch (ClassCastException cce) {
435 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
436 throw new RuntimeException(cce);
437 } catch (HL7Exception he) {
438 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
439 throw new RuntimeException(he);
440 }
441 return ret;
442 }
443
444
445 /**
446 * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
447 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
448 * it will return zero.
449 */
450 public int getPatientPrimaryCareProviderNameIDNoReps() {
451 XCN[] ret = null;
452 try {
453 Type[] t = this.getField(4);
454 return t.length;
455 } catch (ClassCastException cce) {
456 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
457 throw new RuntimeException(cce);
458 } catch (HL7Exception he) {
459 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
460 throw new RuntimeException(he);
461 }
462 }
463
464
465 /**
466 * Returns a specific repetition of
467 * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary
468 *
469 * @param rep The repetition index (0-indexed)
470 */
471 public XCN getPatientPrimaryCareProviderNameIDNo(int rep) {
472 XCN ret = null;
473 try {
474 Type t = this.getField(4, rep);
475 ret = (XCN)t;
476 } catch (ClassCastException cce) {
477 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
478 throw new RuntimeException(cce);
479 } catch (HL7Exception he) {
480 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
481 throw new RuntimeException(he);
482 }
483 return ret;
484 }
485
486 /**
487 * Returns a specific repetition of
488 * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary
489 *
490 * @param rep The repetition index (0-indexed)
491 */
492 public XCN getPd14_PatientPrimaryCareProviderNameIDNo(int rep) {
493 XCN ret = null;
494 try {
495 Type t = this.getField(4, rep);
496 ret = (XCN)t;
497 } catch (ClassCastException cce) {
498 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
499 throw new RuntimeException(cce);
500 } catch (HL7Exception he) {
501 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
502 throw new RuntimeException(he);
503 }
504 return ret;
505 }
506
507
508 /**
509 * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
510 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
511 * it will return zero.
512 */
513 public int getPd14_PatientPrimaryCareProviderNameIDNoReps() {
514 XCN[] ret = null;
515 try {
516 Type[] t = this.getField(4);
517 return t.length;
518 } catch (ClassCastException cce) {
519 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
520 throw new RuntimeException(cce);
521 } catch (HL7Exception he) {
522 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
523 throw new RuntimeException(he);
524 }
525 }
526
527
528
529 /**
530 * Inserts a repetition of
531 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
532 *
533 * @param rep The repetition index (0-indexed)
534 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
535 */
536 public XCN insertPatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception {
537 return (XCN) super.insertRepetition(4, rep);
538 }
539
540
541
542 /**
543 * Inserts a repetition of
544 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
545 *
546 * @param rep The repetition index (0-indexed)
547 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
548 */
549 public XCN insertPd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception {
550 return (XCN) super.insertRepetition(4, rep);
551 }
552
553
554 /**
555 * Removes a repetition of
556 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
557 *
558 * @param rep The repetition index (0-indexed)
559 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
560 */
561 public XCN removePatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception {
562 return (XCN) super.removeRepetition(4, rep);
563 }
564
565
566 /**
567 * Removes a repetition of
568 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
569 *
570 * @param rep The repetition index (0-indexed)
571 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
572 */
573 public XCN removePd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception {
574 return (XCN) super.removeRepetition(4, rep);
575 }
576
577
578
579
580 /**
581 * Returns
582 * PD1-5: "Student Indicator" - creates it if necessary
583 */
584 public IS getStudentIndicator() {
585 IS ret = null;
586 try {
587 Type t = this.getField(5, 0);
588 ret = (IS)t;
589 } catch (ClassCastException cce) {
590 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
591 throw new RuntimeException(cce);
592 } catch (HL7Exception he) {
593 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
594 throw new RuntimeException(he);
595 }
596 return ret;
597 }
598
599
600 /**
601 * Returns
602 * PD1-5: "Student Indicator" - creates it if necessary
603 */
604 public IS getPd15_StudentIndicator() {
605 IS ret = null;
606 try {
607 Type t = this.getField(5, 0);
608 ret = (IS)t;
609 } catch (ClassCastException cce) {
610 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
611 throw new RuntimeException(cce);
612 } catch (HL7Exception he) {
613 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
614 throw new RuntimeException(he);
615 }
616 return ret;
617 }
618
619
620
621 /**
622 * Returns
623 * PD1-6: "Handicap" - creates it if necessary
624 */
625 public IS getHandicap() {
626 IS ret = null;
627 try {
628 Type t = this.getField(6, 0);
629 ret = (IS)t;
630 } catch (ClassCastException cce) {
631 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
632 throw new RuntimeException(cce);
633 } catch (HL7Exception he) {
634 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
635 throw new RuntimeException(he);
636 }
637 return ret;
638 }
639
640
641 /**
642 * Returns
643 * PD1-6: "Handicap" - creates it if necessary
644 */
645 public IS getPd16_Handicap() {
646 IS ret = null;
647 try {
648 Type t = this.getField(6, 0);
649 ret = (IS)t;
650 } catch (ClassCastException cce) {
651 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
652 throw new RuntimeException(cce);
653 } catch (HL7Exception he) {
654 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
655 throw new RuntimeException(he);
656 }
657 return ret;
658 }
659
660
661
662 /**
663 * Returns
664 * PD1-7: "Living Will" - creates it if necessary
665 */
666 public IS getLivingWill() {
667 IS ret = null;
668 try {
669 Type t = this.getField(7, 0);
670 ret = (IS)t;
671 } catch (ClassCastException cce) {
672 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
673 throw new RuntimeException(cce);
674 } catch (HL7Exception he) {
675 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
676 throw new RuntimeException(he);
677 }
678 return ret;
679 }
680
681
682 /**
683 * Returns
684 * PD1-7: "Living Will" - creates it if necessary
685 */
686 public IS getPd17_LivingWill() {
687 IS ret = null;
688 try {
689 Type t = this.getField(7, 0);
690 ret = (IS)t;
691 } catch (ClassCastException cce) {
692 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
693 throw new RuntimeException(cce);
694 } catch (HL7Exception he) {
695 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
696 throw new RuntimeException(he);
697 }
698 return ret;
699 }
700
701
702
703 /**
704 * Returns
705 * PD1-8: "Organ Donor" - creates it if necessary
706 */
707 public IS getOrganDonor() {
708 IS ret = null;
709 try {
710 Type t = this.getField(8, 0);
711 ret = (IS)t;
712 } catch (ClassCastException cce) {
713 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
714 throw new RuntimeException(cce);
715 } catch (HL7Exception he) {
716 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
717 throw new RuntimeException(he);
718 }
719 return ret;
720 }
721
722
723 /**
724 * Returns
725 * PD1-8: "Organ Donor" - creates it if necessary
726 */
727 public IS getPd18_OrganDonor() {
728 IS ret = null;
729 try {
730 Type t = this.getField(8, 0);
731 ret = (IS)t;
732 } catch (ClassCastException cce) {
733 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
734 throw new RuntimeException(cce);
735 } catch (HL7Exception he) {
736 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
737 throw new RuntimeException(he);
738 }
739 return ret;
740 }
741
742
743
744 /**
745 * Returns
746 * PD1-9: "Separate Bill" - creates it if necessary
747 */
748 public ID getSeparateBill() {
749 ID ret = null;
750 try {
751 Type t = this.getField(9, 0);
752 ret = (ID)t;
753 } catch (ClassCastException cce) {
754 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
755 throw new RuntimeException(cce);
756 } catch (HL7Exception he) {
757 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
758 throw new RuntimeException(he);
759 }
760 return ret;
761 }
762
763
764 /**
765 * Returns
766 * PD1-9: "Separate Bill" - creates it if necessary
767 */
768 public ID getPd19_SeparateBill() {
769 ID ret = null;
770 try {
771 Type t = this.getField(9, 0);
772 ret = (ID)t;
773 } catch (ClassCastException cce) {
774 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
775 throw new RuntimeException(cce);
776 } catch (HL7Exception he) {
777 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
778 throw new RuntimeException(he);
779 }
780 return ret;
781 }
782
783
784 /**
785 * Returns all repetitions of Duplicate Patient (PD1-10).
786 */
787 public CX[] getDuplicatePatient() {
788 CX[] ret = null;
789 try {
790 Type[] t = this.getField(10);
791 ret = new CX[t.length];
792 for (int i = 0; i < ret.length; i++) {
793 ret[i] = (CX)t[i];
794 }
795 } catch (ClassCastException cce) {
796 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
797 throw new RuntimeException(cce);
798 } catch (HL7Exception he) {
799 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
800 throw new RuntimeException(he);
801 }
802 return ret;
803 }
804
805
806 /**
807 * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10).
808 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
809 * it will return zero.
810 */
811 public int getDuplicatePatientReps() {
812 CX[] ret = null;
813 try {
814 Type[] t = this.getField(10);
815 return t.length;
816 } catch (ClassCastException cce) {
817 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
818 throw new RuntimeException(cce);
819 } catch (HL7Exception he) {
820 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
821 throw new RuntimeException(he);
822 }
823 }
824
825
826 /**
827 * Returns a specific repetition of
828 * PD1-10: "Duplicate Patient" - creates it if necessary
829 *
830 * @param rep The repetition index (0-indexed)
831 */
832 public CX getDuplicatePatient(int rep) {
833 CX ret = null;
834 try {
835 Type t = this.getField(10, rep);
836 ret = (CX)t;
837 } catch (ClassCastException cce) {
838 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
839 throw new RuntimeException(cce);
840 } catch (HL7Exception he) {
841 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
842 throw new RuntimeException(he);
843 }
844 return ret;
845 }
846
847 /**
848 * Returns a specific repetition of
849 * PD1-10: "Duplicate Patient" - creates it if necessary
850 *
851 * @param rep The repetition index (0-indexed)
852 */
853 public CX getPd110_DuplicatePatient(int rep) {
854 CX ret = null;
855 try {
856 Type t = this.getField(10, rep);
857 ret = (CX)t;
858 } catch (ClassCastException cce) {
859 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
860 throw new RuntimeException(cce);
861 } catch (HL7Exception he) {
862 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
863 throw new RuntimeException(he);
864 }
865 return ret;
866 }
867
868
869 /**
870 * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10).
871 * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
872 * it will return zero.
873 */
874 public int getPd110_DuplicatePatientReps() {
875 CX[] ret = null;
876 try {
877 Type[] t = this.getField(10);
878 return t.length;
879 } catch (ClassCastException cce) {
880 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
881 throw new RuntimeException(cce);
882 } catch (HL7Exception he) {
883 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
884 throw new RuntimeException(he);
885 }
886 }
887
888
889
890 /**
891 * Inserts a repetition of
892 * PD1-10: "Duplicate Patient" at a specific index
893 *
894 * @param rep The repetition index (0-indexed)
895 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
896 */
897 public CX insertDuplicatePatient(int rep) throws HL7Exception {
898 return (CX) super.insertRepetition(10, rep);
899 }
900
901
902
903 /**
904 * Inserts a repetition of
905 * PD1-10: "Duplicate Patient" at a specific index
906 *
907 * @param rep The repetition index (0-indexed)
908 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
909 */
910 public CX insertPd110_DuplicatePatient(int rep) throws HL7Exception {
911 return (CX) super.insertRepetition(10, rep);
912 }
913
914
915 /**
916 * Removes a repetition of
917 * PD1-10: "Duplicate Patient" at a specific index
918 *
919 * @param rep The repetition index (0-indexed)
920 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
921 */
922 public CX removeDuplicatePatient(int rep) throws HL7Exception {
923 return (CX) super.removeRepetition(10, rep);
924 }
925
926
927 /**
928 * Removes a repetition of
929 * PD1-10: "Duplicate Patient" at a specific index
930 *
931 * @param rep The repetition index (0-indexed)
932 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
933 */
934 public CX removePd110_DuplicatePatient(int rep) throws HL7Exception {
935 return (CX) super.removeRepetition(10, rep);
936 }
937
938
939
940
941 /**
942 * Returns
943 * PD1-11: "Publicity Code" - creates it if necessary
944 */
945 public CE getPublicityCode() {
946 CE ret = null;
947 try {
948 Type t = this.getField(11, 0);
949 ret = (CE)t;
950 } catch (ClassCastException cce) {
951 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
952 throw new RuntimeException(cce);
953 } catch (HL7Exception he) {
954 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
955 throw new RuntimeException(he);
956 }
957 return ret;
958 }
959
960
961 /**
962 * Returns
963 * PD1-11: "Publicity Code" - creates it if necessary
964 */
965 public CE getPd111_PublicityCode() {
966 CE ret = null;
967 try {
968 Type t = this.getField(11, 0);
969 ret = (CE)t;
970 } catch (ClassCastException cce) {
971 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
972 throw new RuntimeException(cce);
973 } catch (HL7Exception he) {
974 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
975 throw new RuntimeException(he);
976 }
977 return ret;
978 }
979
980
981
982 /**
983 * Returns
984 * PD1-12: "Protection Indicator" - creates it if necessary
985 */
986 public ID getProtectionIndicator() {
987 ID ret = null;
988 try {
989 Type t = this.getField(12, 0);
990 ret = (ID)t;
991 } catch (ClassCastException cce) {
992 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
993 throw new RuntimeException(cce);
994 } catch (HL7Exception he) {
995 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
996 throw new RuntimeException(he);
997 }
998 return ret;
999 }
1000
1001
1002 /**
1003 * Returns
1004 * PD1-12: "Protection Indicator" - creates it if necessary
1005 */
1006 public ID getPd112_ProtectionIndicator() {
1007 ID ret = null;
1008 try {
1009 Type t = this.getField(12, 0);
1010 ret = (ID)t;
1011 } catch (ClassCastException cce) {
1012 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
1013 throw new RuntimeException(cce);
1014 } catch (HL7Exception he) {
1015 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
1016 throw new RuntimeException(he);
1017 }
1018 return ret;
1019 }
1020
1021
1022
1023
1024
1025 /** {@inheritDoc} */
1026 protected Type createNewTypeWithoutReflection(int field) {
1027 switch (field) {
1028 case 0: return new IS(getMessage(), new Integer( 223 ));
1029 case 1: return new IS(getMessage(), new Integer( 220 ));
1030 case 2: return new XON(getMessage());
1031 case 3: return new XCN(getMessage());
1032 case 4: return new IS(getMessage(), new Integer( 231 ));
1033 case 5: return new IS(getMessage(), new Integer( 295 ));
1034 case 6: return new IS(getMessage(), new Integer( 315 ));
1035 case 7: return new IS(getMessage(), new Integer( 316 ));
1036 case 8: return new ID(getMessage(), new Integer( 136 ));
1037 case 9: return new CX(getMessage());
1038 case 10: return new CE(getMessage());
1039 case 11: return new ID(getMessage(), new Integer( 136 ));
1040 default: return null;
1041 }
1042 }
1043
1044
1045 }
1046