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.v23.segment;
35  
36  // import ca.uhn.hl7v2.model.v23.group.*;
37  import ca.uhn.hl7v2.model.v23.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 (Patient Demographic). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>PD1-1: Living Dependency (IS) <b>optional </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 Indicator (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, 1, 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(310) }, "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, 2, new Object[]{ getMessage(), new Integer(136) }, "Separate Bill");
88                                    this.add(CX.class, false, 0, 2, new Object[]{ getMessage() }, "Duplicate Patient");
89                                    this.add(CE.class, false, 1, 1, new Object[]{ getMessage() }, "Publicity Indicator");
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      /**
99       * Returns
100      * PD1-1: "Living Dependency" - creates it if necessary
101      */
102     public IS getLivingDependency() { 
103 		IS retVal = this.getTypedField(1, 0);
104 		return retVal;
105     }
106     
107     /**
108      * Returns
109      * PD1-1: "Living Dependency" - creates it if necessary
110      */
111     public IS getPd11_LivingDependency() { 
112 		IS retVal = this.getTypedField(1, 0);
113 		return retVal;
114     }
115 
116 
117 
118     /**
119      * Returns
120      * PD1-2: "Living Arrangement" - creates it if necessary
121      */
122     public IS getLivingArrangement() { 
123 		IS retVal = this.getTypedField(2, 0);
124 		return retVal;
125     }
126     
127     /**
128      * Returns
129      * PD1-2: "Living Arrangement" - creates it if necessary
130      */
131     public IS getPd12_LivingArrangement() { 
132 		IS retVal = this.getTypedField(2, 0);
133 		return retVal;
134     }
135 
136 
137     /**
138      * Returns all repetitions of Patient Primary Facility (PD1-3).
139      */
140     public XON[] getPatientPrimaryFacility() {
141     	XON[] retVal = this.getTypedField(3, new XON[0]);
142     	return retVal;
143     }
144 
145 
146     /**
147      * Returns all repetitions of Patient Primary Facility (PD1-3).
148      */
149     public XON[] getPd13_PatientPrimaryFacility() {
150     	XON[] retVal = this.getTypedField(3, new XON[0]);
151     	return retVal;
152     }
153 
154 
155     /**
156      * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3).
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 getPatientPrimaryFacilityReps() {
161     	return this.getReps(3);
162     }
163 
164 
165     /**
166      * Returns a specific repetition of
167      * PD1-3: "Patient Primary Facility" - creates it if necessary
168      *
169      * @param rep The repetition index (0-indexed)
170      */
171     public XON getPatientPrimaryFacility(int rep) { 
172 		XON retVal = this.getTypedField(3, rep);
173 		return retVal;
174     }
175 
176     /**
177      * Returns a specific repetition of
178      * PD1-3: "Patient Primary Facility" - creates it if necessary
179      *
180      * @param rep The repetition index (0-indexed)
181      */
182     public XON getPd13_PatientPrimaryFacility(int rep) { 
183 		XON retVal = this.getTypedField(3, rep);
184 		return retVal;
185     }
186 
187     /**
188      * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3).
189      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
190      * it will return zero.
191      */
192     public int getPd13_PatientPrimaryFacilityReps() {
193     	return this.getReps(3);
194     }
195 
196 
197     /**
198      * Inserts a repetition of
199      * PD1-3: "Patient Primary Facility" at a specific index
200      *
201      * @param rep The repetition index (0-indexed)
202      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
203      */
204     public XON insertPatientPrimaryFacility(int rep) throws HL7Exception { 
205         return (XON) super.insertRepetition(3, rep);
206     }
207 
208 
209     /**
210      * Inserts a repetition of
211      * PD1-3: "Patient Primary Facility" at a specific index
212      *
213      * @param rep The repetition index (0-indexed)
214      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
215      */
216     public XON insertPd13_PatientPrimaryFacility(int rep) throws HL7Exception { 
217         return (XON) super.insertRepetition(3, rep);
218     }
219 
220 
221     /**
222      * Removes a repetition of
223      * PD1-3: "Patient Primary Facility" at a specific index
224      *
225      * @param rep The repetition index (0-indexed)
226      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
227      */
228     public XON removePatientPrimaryFacility(int rep) throws HL7Exception { 
229         return (XON) super.removeRepetition(3, rep);
230     }
231 
232 
233     /**
234      * Removes a repetition of
235      * PD1-3: "Patient Primary Facility" at a specific index
236      *
237      * @param rep The repetition index (0-indexed)
238      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
239      */
240     public XON removePd13_PatientPrimaryFacility(int rep) throws HL7Exception { 
241         return (XON) super.removeRepetition(3, rep);
242     }
243 
244 
245 
246     /**
247      * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
248      */
249     public XCN[] getPatientPrimaryCareProviderNameIDNo() {
250     	XCN[] retVal = this.getTypedField(4, new XCN[0]);
251     	return retVal;
252     }
253 
254 
255     /**
256      * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
257      */
258     public XCN[] getPd14_PatientPrimaryCareProviderNameIDNo() {
259     	XCN[] retVal = this.getTypedField(4, new XCN[0]);
260     	return retVal;
261     }
262 
263 
264     /**
265      * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
266      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
267      * it will return zero.
268      */
269     public int getPatientPrimaryCareProviderNameIDNoReps() {
270     	return this.getReps(4);
271     }
272 
273 
274     /**
275      * Returns a specific repetition of
276      * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary
277      *
278      * @param rep The repetition index (0-indexed)
279      */
280     public XCN getPatientPrimaryCareProviderNameIDNo(int rep) { 
281 		XCN retVal = this.getTypedField(4, rep);
282 		return retVal;
283     }
284 
285     /**
286      * Returns a specific repetition of
287      * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary
288      *
289      * @param rep The repetition index (0-indexed)
290      */
291     public XCN getPd14_PatientPrimaryCareProviderNameIDNo(int rep) { 
292 		XCN retVal = this.getTypedField(4, rep);
293 		return retVal;
294     }
295 
296     /**
297      * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4).
298      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
299      * it will return zero.
300      */
301     public int getPd14_PatientPrimaryCareProviderNameIDNoReps() {
302     	return this.getReps(4);
303     }
304 
305 
306     /**
307      * Inserts a repetition of
308      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
309      *
310      * @param rep The repetition index (0-indexed)
311      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
312      */
313     public XCN insertPatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
314         return (XCN) super.insertRepetition(4, rep);
315     }
316 
317 
318     /**
319      * Inserts a repetition of
320      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
321      *
322      * @param rep The repetition index (0-indexed)
323      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
324      */
325     public XCN insertPd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
326         return (XCN) super.insertRepetition(4, rep);
327     }
328 
329 
330     /**
331      * Removes a repetition of
332      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
333      *
334      * @param rep The repetition index (0-indexed)
335      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
336      */
337     public XCN removePatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
338         return (XCN) super.removeRepetition(4, rep);
339     }
340 
341 
342     /**
343      * Removes a repetition of
344      * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index
345      *
346      * @param rep The repetition index (0-indexed)
347      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
348      */
349     public XCN removePd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 
350         return (XCN) super.removeRepetition(4, rep);
351     }
352 
353 
354 
355 
356     /**
357      * Returns
358      * PD1-5: "Student Indicator" - creates it if necessary
359      */
360     public IS getStudentIndicator() { 
361 		IS retVal = this.getTypedField(5, 0);
362 		return retVal;
363     }
364     
365     /**
366      * Returns
367      * PD1-5: "Student Indicator" - creates it if necessary
368      */
369     public IS getPd15_StudentIndicator() { 
370 		IS retVal = this.getTypedField(5, 0);
371 		return retVal;
372     }
373 
374 
375 
376     /**
377      * Returns
378      * PD1-6: "Handicap" - creates it if necessary
379      */
380     public IS getHandicap() { 
381 		IS retVal = this.getTypedField(6, 0);
382 		return retVal;
383     }
384     
385     /**
386      * Returns
387      * PD1-6: "Handicap" - creates it if necessary
388      */
389     public IS getPd16_Handicap() { 
390 		IS retVal = this.getTypedField(6, 0);
391 		return retVal;
392     }
393 
394 
395 
396     /**
397      * Returns
398      * PD1-7: "Living Will" - creates it if necessary
399      */
400     public IS getLivingWill() { 
401 		IS retVal = this.getTypedField(7, 0);
402 		return retVal;
403     }
404     
405     /**
406      * Returns
407      * PD1-7: "Living Will" - creates it if necessary
408      */
409     public IS getPd17_LivingWill() { 
410 		IS retVal = this.getTypedField(7, 0);
411 		return retVal;
412     }
413 
414 
415 
416     /**
417      * Returns
418      * PD1-8: "Organ Donor" - creates it if necessary
419      */
420     public IS getOrganDonor() { 
421 		IS retVal = this.getTypedField(8, 0);
422 		return retVal;
423     }
424     
425     /**
426      * Returns
427      * PD1-8: "Organ Donor" - creates it if necessary
428      */
429     public IS getPd18_OrganDonor() { 
430 		IS retVal = this.getTypedField(8, 0);
431 		return retVal;
432     }
433 
434 
435 
436     /**
437      * Returns
438      * PD1-9: "Separate Bill" - creates it if necessary
439      */
440     public ID getSeparateBill() { 
441 		ID retVal = this.getTypedField(9, 0);
442 		return retVal;
443     }
444     
445     /**
446      * Returns
447      * PD1-9: "Separate Bill" - creates it if necessary
448      */
449     public ID getPd19_SeparateBill() { 
450 		ID retVal = this.getTypedField(9, 0);
451 		return retVal;
452     }
453 
454 
455     /**
456      * Returns all repetitions of Duplicate Patient (PD1-10).
457      */
458     public CX[] getDuplicatePatient() {
459     	CX[] retVal = this.getTypedField(10, new CX[0]);
460     	return retVal;
461     }
462 
463 
464     /**
465      * Returns all repetitions of Duplicate Patient (PD1-10).
466      */
467     public CX[] getPd110_DuplicatePatient() {
468     	CX[] retVal = this.getTypedField(10, new CX[0]);
469     	return retVal;
470     }
471 
472 
473     /**
474      * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10).
475      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
476      * it will return zero.
477      */
478     public int getDuplicatePatientReps() {
479     	return this.getReps(10);
480     }
481 
482 
483     /**
484      * Returns a specific repetition of
485      * PD1-10: "Duplicate Patient" - creates it if necessary
486      *
487      * @param rep The repetition index (0-indexed)
488      */
489     public CX getDuplicatePatient(int rep) { 
490 		CX retVal = this.getTypedField(10, rep);
491 		return retVal;
492     }
493 
494     /**
495      * Returns a specific repetition of
496      * PD1-10: "Duplicate Patient" - creates it if necessary
497      *
498      * @param rep The repetition index (0-indexed)
499      */
500     public CX getPd110_DuplicatePatient(int rep) { 
501 		CX retVal = this.getTypedField(10, rep);
502 		return retVal;
503     }
504 
505     /**
506      * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10).
507      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
508      * it will return zero.
509      */
510     public int getPd110_DuplicatePatientReps() {
511     	return this.getReps(10);
512     }
513 
514 
515     /**
516      * Inserts a repetition of
517      * PD1-10: "Duplicate Patient" at a specific index
518      *
519      * @param rep The repetition index (0-indexed)
520      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
521      */
522     public CX insertDuplicatePatient(int rep) throws HL7Exception { 
523         return (CX) super.insertRepetition(10, rep);
524     }
525 
526 
527     /**
528      * Inserts a repetition of
529      * PD1-10: "Duplicate Patient" at a specific index
530      *
531      * @param rep The repetition index (0-indexed)
532      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
533      */
534     public CX insertPd110_DuplicatePatient(int rep) throws HL7Exception { 
535         return (CX) super.insertRepetition(10, rep);
536     }
537 
538 
539     /**
540      * Removes a repetition of
541      * PD1-10: "Duplicate Patient" at a specific index
542      *
543      * @param rep The repetition index (0-indexed)
544      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
545      */
546     public CX removeDuplicatePatient(int rep) throws HL7Exception { 
547         return (CX) super.removeRepetition(10, rep);
548     }
549 
550 
551     /**
552      * Removes a repetition of
553      * PD1-10: "Duplicate Patient" at a specific index
554      *
555      * @param rep The repetition index (0-indexed)
556      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
557      */
558     public CX removePd110_DuplicatePatient(int rep) throws HL7Exception { 
559         return (CX) super.removeRepetition(10, rep);
560     }
561 
562 
563 
564 
565     /**
566      * Returns
567      * PD1-11: "Publicity Indicator" - creates it if necessary
568      */
569     public CE getPublicityIndicator() { 
570 		CE retVal = this.getTypedField(11, 0);
571 		return retVal;
572     }
573     
574     /**
575      * Returns
576      * PD1-11: "Publicity Indicator" - creates it if necessary
577      */
578     public CE getPd111_PublicityIndicator() { 
579 		CE retVal = this.getTypedField(11, 0);
580 		return retVal;
581     }
582 
583 
584 
585     /**
586      * Returns
587      * PD1-12: "Protection Indicator" - creates it if necessary
588      */
589     public ID getProtectionIndicator() { 
590 		ID retVal = this.getTypedField(12, 0);
591 		return retVal;
592     }
593     
594     /**
595      * Returns
596      * PD1-12: "Protection Indicator" - creates it if necessary
597      */
598     public ID getPd112_ProtectionIndicator() { 
599 		ID retVal = this.getTypedField(12, 0);
600 		return retVal;
601     }
602 
603 
604 
605 
606 
607     /** {@inheritDoc} */   
608     protected Type createNewTypeWithoutReflection(int field) {
609        switch (field) {
610           case 0: return new IS(getMessage(), new Integer( 223 ));
611           case 1: return new IS(getMessage(), new Integer( 220 ));
612           case 2: return new XON(getMessage());
613           case 3: return new XCN(getMessage());
614           case 4: return new IS(getMessage(), new Integer( 231 ));
615           case 5: return new IS(getMessage(), new Integer( 310 ));
616           case 6: return new IS(getMessage(), new Integer( 315 ));
617           case 7: return new IS(getMessage(), new Integer( 316 ));
618           case 8: return new ID(getMessage(), new Integer( 136 ));
619           case 9: return new CX(getMessage());
620           case 10: return new CE(getMessage());
621           case 11: return new ID(getMessage(), new Integer( 136 ));
622           default: return null;
623        }
624    }
625 
626 
627 }
628