View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v231.segment;
35  
36  // import ca.uhn.hl7v2.model.v231.group.*;
37  import ca.uhn.hl7v2.model.v231.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 PD1 message segment (PD1 - patient additional demographic segment). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>PD1-1: Living Dependency (IS) <b>optional repeating</b>
53       * <li>PD1-2: Living Arrangement (IS) <b>optional </b>
54       * <li>PD1-3: Patient Primary Facility (XON) <b>optional repeating</b>
55       * <li>PD1-4: Patient Primary Care Provider Name & ID No. (XCN) <b>optional repeating</b>
56       * <li>PD1-5: Student Indicator (IS) <b>optional </b>
57       * <li>PD1-6: Handicap (IS) <b>optional </b>
58       * <li>PD1-7: Living Will (IS) <b>optional </b>
59       * <li>PD1-8: Organ Donor (IS) <b>optional </b>
60       * <li>PD1-9: Separate Bill (ID) <b>optional </b>
61       * <li>PD1-10: Duplicate Patient (CX) <b>optional repeating</b>
62       * <li>PD1-11: Publicity Code (CE) <b>optional </b>
63       * <li>PD1-12: Protection Indicator (ID) <b>optional </b>
64   * </ul>
65   */
66  @SuppressWarnings("unused")
67  public class PD1 extends AbstractSegment {
68  
69      /** 
70       * Creates a new PD1 segment
71       */
72      public PD1(Group parent, ModelClassFactory factory) {
73         super(parent, factory);
74         init(factory);
75      }
76  
77      private void init(ModelClassFactory factory) {
78         try {
79                                                this.add(IS.class, false, 0, 2, new Object[]{ getMessage(), new Integer(223) }, "Living Dependency");
80                                                this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(220) }, "Living Arrangement");
81                                    this.add(XON.class, false, 0, 90, new Object[]{ getMessage() }, "Patient Primary Facility");
82                                    this.add(XCN.class, false, 0, 90, new Object[]{ getMessage() }, "Patient Primary Care Provider Name & ID No.");
83                                                this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(231) }, "Student Indicator");
84                                                this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(295) }, "Handicap");
85                                                this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(315) }, "Living Will");
86                                                this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(316) }, "Organ Donor");
87                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Separate Bill");
88                                    this.add(CX.class, false, 0, 20, new Object[]{ getMessage() }, "Duplicate Patient");
89                                    this.add(CE.class, false, 1, 80, new Object[]{ getMessage() }, "Publicity Code");
90                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Protection Indicator");
91         } catch(HL7Exception e) {
92            log.error("Unexpected error creating PD1 - this is probably a bug in the source code generator.", e);
93         }
94      }
95  
96  
97      /**
98       * Returns all repetitions of Living Dependency (PD1-1).
99       */
100     public IS[] getLivingDependency() {
101     	IS[] retVal = this.getTypedField(1, new IS[0]);
102     	return retVal;
103     }
104 
105 
106     /**
107      * Returns all repetitions of Living Dependency (PD1-1).
108      */
109     public IS[] getPd11_LivingDependency() {
110     	IS[] retVal = this.getTypedField(1, new IS[0]);
111     	return retVal;
112     }
113 
114 
115     /**
116      * Returns a count of the current number of repetitions of Living Dependency (PD1-1).
117      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
118      * it will return zero.
119      */
120     public int getLivingDependencyReps() {
121     	return this.getReps(1);
122     }
123 
124 
125     /**
126      * Returns a specific repetition of
127      * PD1-1: "Living Dependency" - creates it if necessary
128      *
129      * @param rep The repetition index (0-indexed)
130      */
131     public IS getLivingDependency(int rep) { 
132 		IS retVal = this.getTypedField(1, rep);
133 		return retVal;
134     }
135 
136     /**
137      * Returns a specific repetition of
138      * PD1-1: "Living Dependency" - creates it if necessary
139      *
140      * @param rep The repetition index (0-indexed)
141      */
142     public IS getPd11_LivingDependency(int rep) { 
143 		IS retVal = this.getTypedField(1, rep);
144 		return retVal;
145     }
146 
147     /**
148      * Returns a count of the current number of repetitions of Living Dependency (PD1-1).
149      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
150      * it will return zero.
151      */
152     public int getPd11_LivingDependencyReps() {
153     	return this.getReps(1);
154     }
155 
156 
157     /**
158      * Inserts a repetition of
159      * PD1-1: "Living Dependency" at a specific index
160      *
161      * @param rep The repetition index (0-indexed)
162      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
163      */
164     public IS insertLivingDependency(int rep) throws HL7Exception { 
165         return (IS) super.insertRepetition(1, rep);
166     }
167 
168 
169     /**
170      * Inserts a repetition of
171      * PD1-1: "Living Dependency" at a specific index
172      *
173      * @param rep The repetition index (0-indexed)
174      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
175      */
176     public IS insertPd11_LivingDependency(int rep) throws HL7Exception { 
177         return (IS) super.insertRepetition(1, rep);
178     }
179 
180 
181     /**
182      * Removes a repetition of
183      * PD1-1: "Living Dependency" at a specific index
184      *
185      * @param rep The repetition index (0-indexed)
186      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
187      */
188     public IS removeLivingDependency(int rep) throws HL7Exception { 
189         return (IS) super.removeRepetition(1, rep);
190     }
191 
192 
193     /**
194      * Removes a repetition of
195      * PD1-1: "Living Dependency" at a specific index
196      *
197      * @param rep The repetition index (0-indexed)
198      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
199      */
200     public IS removePd11_LivingDependency(int rep) throws HL7Exception { 
201         return (IS) super.removeRepetition(1, rep);
202     }
203 
204 
205 
206 
207     /**
208      * Returns
209      * PD1-2: "Living Arrangement" - creates it if necessary
210      */
211     public IS getLivingArrangement() { 
212 		IS retVal = this.getTypedField(2, 0);
213 		return retVal;
214     }
215     
216     /**
217      * Returns
218      * PD1-2: "Living Arrangement" - creates it if necessary
219      */
220     public IS getPd12_LivingArrangement() { 
221 		IS retVal = this.getTypedField(2, 0);
222 		return retVal;
223     }
224 
225 
226     /**
227      * Returns all repetitions of Patient Primary Facility (PD1-3).
228      */
229     public XON[] getPatientPrimaryFacility() {
230     	XON[] retVal = this.getTypedField(3, new XON[0]);
231     	return retVal;
232     }
233 
234 
235     /**
236      * Returns all repetitions of Patient Primary Facility (PD1-3).
237      */
238     public XON[] getPd13_PatientPrimaryFacility() {
239     	XON[] retVal = this.getTypedField(3, new XON[0]);
240     	return retVal;
241     }
242 
243 
244     /**
245      * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3).
246      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
247      * it will return zero.
248      */
249     public int getPatientPrimaryFacilityReps() {
250     	return this.getReps(3);
251     }
252 
253 
254     /**
255      * Returns a specific repetition of
256      * PD1-3: "Patient Primary Facility" - creates it if necessary
257      *
258      * @param rep The repetition index (0-indexed)
259      */
260     public XON getPatientPrimaryFacility(int rep) { 
261 		XON retVal = this.getTypedField(3, rep);
262 		return retVal;
263     }
264 
265     /**
266      * Returns a specific repetition of
267      * PD1-3: "Patient Primary Facility" - creates it if necessary
268      *
269      * @param rep The repetition index (0-indexed)
270      */
271     public XON getPd13_PatientPrimaryFacility(int rep) { 
272 		XON retVal = this.getTypedField(3, rep);
273 		return retVal;
274     }
275 
276     /**
277      * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3).
278      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
279      * it will return zero.
280      */
281     public int getPd13_PatientPrimaryFacilityReps() {
282     	return this.getReps(3);
283     }
284 
285 
286     /**
287      * Inserts a repetition of
288      * PD1-3: "Patient Primary Facility" at a specific index
289      *
290      * @param rep The repetition index (0-indexed)
291      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
292      */
293     public XON insertPatientPrimaryFacility(int rep) throws HL7Exception { 
294         return (XON) super.insertRepetition(3, rep);
295     }
296 
297 
298     /**
299      * Inserts a repetition of
300      * PD1-3: "Patient Primary Facility" at a specific index
301      *
302      * @param rep The repetition index (0-indexed)
303      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
304      */
305     public XON insertPd13_PatientPrimaryFacility(int rep) throws HL7Exception { 
306         return (XON) super.insertRepetition(3, rep);
307     }
308 
309 
310     /**
311      * Removes a repetition of
312      * PD1-3: "Patient Primary Facility" at a specific index
313      *
314      * @param rep The repetition index (0-indexed)
315      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
316      */
317     public XON removePatientPrimaryFacility(int rep) throws HL7Exception { 
318         return (XON) super.removeRepetition(3, rep);
319     }
320 
321 
322     /**
323      * Removes a repetition of
324      * PD1-3: "Patient Primary Facility" at a specific index
325      *
326      * @param rep The repetition index (0-indexed)
327      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
328      */
329     public XON removePd13_PatientPrimaryFacility(int rep) throws HL7Exception { 
330         return (XON) super.removeRepetition(3, rep);
331     }
332 
333 
334 
335     /**
336      * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
337      */
338     public XCN[] getPatientPrimaryCareProviderNameIDNo() {
339     	XCN[] retVal = this.getTypedField(4, new XCN[0]);
340     	return retVal;
341     }
342 
343 
344     /**
345      * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
346      */
347     public XCN[] getPd14_PatientPrimaryCareProviderNameIDNo() {
348     	XCN[] retVal = this.getTypedField(4, new XCN[0]);
349     	return retVal;
350     }
351 
352 
353     /**
354      * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
355      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
356      * it will return zero.
357      */
358     public int getPatientPrimaryCareProviderNameIDNoReps() {
359     	return this.getReps(4);
360     }
361 
362 
363     /**
364      * Returns a specific repetition of
365      * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary
366      *
367      * @param rep The repetition index (0-indexed)
368      */
369     public XCN getPatientPrimaryCareProviderNameIDNo(int rep) { 
370 		XCN retVal = this.getTypedField(4, rep);
371 		return retVal;
372     }
373 
374     /**
375      * Returns a specific repetition of
376      * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary
377      *
378      * @param rep The repetition index (0-indexed)
379      */
380     public XCN getPd14_PatientPrimaryCareProviderNameIDNo(int rep) { 
381 		XCN retVal = this.getTypedField(4, rep);
382 		return retVal;
383     }
384 
385     /**
386      * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
387      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
388      * it will return zero.
389      */
390     public int getPd14_PatientPrimaryCareProviderNameIDNoReps() {
391     	return this.getReps(4);
392     }
393 
394 
395     /**
396      * Inserts a repetition of
397      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
398      *
399      * @param rep The repetition index (0-indexed)
400      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
401      */
402     public XCN insertPatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
403         return (XCN) super.insertRepetition(4, rep);
404     }
405 
406 
407     /**
408      * Inserts a repetition of
409      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
410      *
411      * @param rep The repetition index (0-indexed)
412      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
413      */
414     public XCN insertPd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
415         return (XCN) super.insertRepetition(4, rep);
416     }
417 
418 
419     /**
420      * Removes a repetition of
421      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
422      *
423      * @param rep The repetition index (0-indexed)
424      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
425      */
426     public XCN removePatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
427         return (XCN) super.removeRepetition(4, rep);
428     }
429 
430 
431     /**
432      * Removes a repetition of
433      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
434      *
435      * @param rep The repetition index (0-indexed)
436      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
437      */
438     public XCN removePd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
439         return (XCN) super.removeRepetition(4, rep);
440     }
441 
442 
443 
444 
445     /**
446      * Returns
447      * PD1-5: "Student Indicator" - creates it if necessary
448      */
449     public IS getStudentIndicator() { 
450 		IS retVal = this.getTypedField(5, 0);
451 		return retVal;
452     }
453     
454     /**
455      * Returns
456      * PD1-5: "Student Indicator" - creates it if necessary
457      */
458     public IS getPd15_StudentIndicator() { 
459 		IS retVal = this.getTypedField(5, 0);
460 		return retVal;
461     }
462 
463 
464 
465     /**
466      * Returns
467      * PD1-6: "Handicap" - creates it if necessary
468      */
469     public IS getHandicap() { 
470 		IS retVal = this.getTypedField(6, 0);
471 		return retVal;
472     }
473     
474     /**
475      * Returns
476      * PD1-6: "Handicap" - creates it if necessary
477      */
478     public IS getPd16_Handicap() { 
479 		IS retVal = this.getTypedField(6, 0);
480 		return retVal;
481     }
482 
483 
484 
485     /**
486      * Returns
487      * PD1-7: "Living Will" - creates it if necessary
488      */
489     public IS getLivingWill() { 
490 		IS retVal = this.getTypedField(7, 0);
491 		return retVal;
492     }
493     
494     /**
495      * Returns
496      * PD1-7: "Living Will" - creates it if necessary
497      */
498     public IS getPd17_LivingWill() { 
499 		IS retVal = this.getTypedField(7, 0);
500 		return retVal;
501     }
502 
503 
504 
505     /**
506      * Returns
507      * PD1-8: "Organ Donor" - creates it if necessary
508      */
509     public IS getOrganDonor() { 
510 		IS retVal = this.getTypedField(8, 0);
511 		return retVal;
512     }
513     
514     /**
515      * Returns
516      * PD1-8: "Organ Donor" - creates it if necessary
517      */
518     public IS getPd18_OrganDonor() { 
519 		IS retVal = this.getTypedField(8, 0);
520 		return retVal;
521     }
522 
523 
524 
525     /**
526      * Returns
527      * PD1-9: "Separate Bill" - creates it if necessary
528      */
529     public ID getSeparateBill() { 
530 		ID retVal = this.getTypedField(9, 0);
531 		return retVal;
532     }
533     
534     /**
535      * Returns
536      * PD1-9: "Separate Bill" - creates it if necessary
537      */
538     public ID getPd19_SeparateBill() { 
539 		ID retVal = this.getTypedField(9, 0);
540 		return retVal;
541     }
542 
543 
544     /**
545      * Returns all repetitions of Duplicate Patient (PD1-10).
546      */
547     public CX[] getDuplicatePatient() {
548     	CX[] retVal = this.getTypedField(10, new CX[0]);
549     	return retVal;
550     }
551 
552 
553     /**
554      * Returns all repetitions of Duplicate Patient (PD1-10).
555      */
556     public CX[] getPd110_DuplicatePatient() {
557     	CX[] retVal = this.getTypedField(10, new CX[0]);
558     	return retVal;
559     }
560 
561 
562     /**
563      * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10).
564      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
565      * it will return zero.
566      */
567     public int getDuplicatePatientReps() {
568     	return this.getReps(10);
569     }
570 
571 
572     /**
573      * Returns a specific repetition of
574      * PD1-10: "Duplicate Patient" - creates it if necessary
575      *
576      * @param rep The repetition index (0-indexed)
577      */
578     public CX getDuplicatePatient(int rep) { 
579 		CX retVal = this.getTypedField(10, rep);
580 		return retVal;
581     }
582 
583     /**
584      * Returns a specific repetition of
585      * PD1-10: "Duplicate Patient" - creates it if necessary
586      *
587      * @param rep The repetition index (0-indexed)
588      */
589     public CX getPd110_DuplicatePatient(int rep) { 
590 		CX retVal = this.getTypedField(10, rep);
591 		return retVal;
592     }
593 
594     /**
595      * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10).
596      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
597      * it will return zero.
598      */
599     public int getPd110_DuplicatePatientReps() {
600     	return this.getReps(10);
601     }
602 
603 
604     /**
605      * Inserts a repetition of
606      * PD1-10: "Duplicate Patient" at a specific index
607      *
608      * @param rep The repetition index (0-indexed)
609      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
610      */
611     public CX insertDuplicatePatient(int rep) throws HL7Exception { 
612         return (CX) super.insertRepetition(10, rep);
613     }
614 
615 
616     /**
617      * Inserts a repetition of
618      * PD1-10: "Duplicate Patient" at a specific index
619      *
620      * @param rep The repetition index (0-indexed)
621      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
622      */
623     public CX insertPd110_DuplicatePatient(int rep) throws HL7Exception { 
624         return (CX) super.insertRepetition(10, rep);
625     }
626 
627 
628     /**
629      * Removes a repetition of
630      * PD1-10: "Duplicate Patient" at a specific index
631      *
632      * @param rep The repetition index (0-indexed)
633      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
634      */
635     public CX removeDuplicatePatient(int rep) throws HL7Exception { 
636         return (CX) super.removeRepetition(10, rep);
637     }
638 
639 
640     /**
641      * Removes a repetition of
642      * PD1-10: "Duplicate Patient" at a specific index
643      *
644      * @param rep The repetition index (0-indexed)
645      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
646      */
647     public CX removePd110_DuplicatePatient(int rep) throws HL7Exception { 
648         return (CX) super.removeRepetition(10, rep);
649     }
650 
651 
652 
653 
654     /**
655      * Returns
656      * PD1-11: "Publicity Code" - creates it if necessary
657      */
658     public CE getPublicityCode() { 
659 		CE retVal = this.getTypedField(11, 0);
660 		return retVal;
661     }
662     
663     /**
664      * Returns
665      * PD1-11: "Publicity Code" - creates it if necessary
666      */
667     public CE getPd111_PublicityCode() { 
668 		CE retVal = this.getTypedField(11, 0);
669 		return retVal;
670     }
671 
672 
673 
674     /**
675      * Returns
676      * PD1-12: "Protection Indicator" - creates it if necessary
677      */
678     public ID getProtectionIndicator() { 
679 		ID retVal = this.getTypedField(12, 0);
680 		return retVal;
681     }
682     
683     /**
684      * Returns
685      * PD1-12: "Protection Indicator" - creates it if necessary
686      */
687     public ID getPd112_ProtectionIndicator() { 
688 		ID retVal = this.getTypedField(12, 0);
689 		return retVal;
690     }
691 
692 
693 
694 
695 
696     /** {@inheritDoc} */   
697     protected Type createNewTypeWithoutReflection(int field) {
698        switch (field) {
699           case 0: return new IS(getMessage(), new Integer( 223 ));
700           case 1: return new IS(getMessage(), new Integer( 220 ));
701           case 2: return new XON(getMessage());
702           case 3: return new XCN(getMessage());
703           case 4: return new IS(getMessage(), new Integer( 231 ));
704           case 5: return new IS(getMessage(), new Integer( 295 ));
705           case 6: return new IS(getMessage(), new Integer( 315 ));
706           case 7: return new IS(getMessage(), new Integer( 316 ));
707           case 8: return new ID(getMessage(), new Integer( 136 ));
708           case 9: return new CX(getMessage());
709           case 10: return new CE(getMessage());
710           case 11: return new ID(getMessage(), new Integer( 136 ));
711           default: return null;
712        }
713    }
714 
715 
716 }
717