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.v25.segment;
35  
36  // import ca.uhn.hl7v2.model.v25.group.*;
37  import ca.uhn.hl7v2.model.v25.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 PDA message segment (Patient Death and Autopsy). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>PDA-1: Death Cause Code (CE) <b>optional repeating</b>
53       * <li>PDA-2: Death Location (PL) <b>optional </b>
54       * <li>PDA-3: Death Certified Indicator (ID) <b>optional </b>
55       * <li>PDA-4: Death Certificate Signed Date/Time (TS) <b>optional </b>
56       * <li>PDA-5: Death Certified By (XCN) <b>optional </b>
57       * <li>PDA-6: Autopsy Indicator (ID) <b>optional </b>
58       * <li>PDA-7: Autopsy Start and End Date/Time (DR) <b>optional </b>
59       * <li>PDA-8: Autopsy Performed By (XCN) <b>optional </b>
60       * <li>PDA-9: Coroner Indicator (ID) <b>optional </b>
61   * </ul>
62   */
63  @SuppressWarnings("unused")
64  public class PDA extends AbstractSegment {
65  
66      /** 
67       * Creates a new PDA segment
68       */
69      public PDA(Group parent, ModelClassFactory factory) {
70         super(parent, factory);
71         init(factory);
72      }
73  
74      private void init(ModelClassFactory factory) {
75         try {
76                                    this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Death Cause Code");
77                                    this.add(PL.class, false, 1, 80, new Object[]{ getMessage() }, "Death Location");
78                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Death Certified Indicator");
79                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Death Certificate Signed Date/Time");
80                                    this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "Death Certified By");
81                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Autopsy Indicator");
82                                    this.add(DR.class, false, 1, 53, new Object[]{ getMessage() }, "Autopsy Start and End Date/Time");
83                                    this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "Autopsy Performed By");
84                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Coroner Indicator");
85         } catch(HL7Exception e) {
86            log.error("Unexpected error creating PDA - this is probably a bug in the source code generator.", e);
87         }
88      }
89  
90  
91      /**
92       * Returns all repetitions of Death Cause Code (PDA-1).
93       */
94      public CE[] getDeathCauseCode() {
95      	CE[] retVal = this.getTypedField(1, new CE[0]);
96      	return retVal;
97      }
98  
99  
100     /**
101      * Returns all repetitions of Death Cause Code (PDA-1).
102      */
103     public CE[] getPda1_DeathCauseCode() {
104     	CE[] retVal = this.getTypedField(1, new CE[0]);
105     	return retVal;
106     }
107 
108 
109     /**
110      * Returns a count of the current number of repetitions of Death Cause Code (PDA-1).
111      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
112      * it will return zero.
113      */
114     public int getDeathCauseCodeReps() {
115     	return this.getReps(1);
116     }
117 
118 
119     /**
120      * Returns a specific repetition of
121      * PDA-1: "Death Cause Code" - creates it if necessary
122      *
123      * @param rep The repetition index (0-indexed)
124      */
125     public CE getDeathCauseCode(int rep) { 
126 		CE retVal = this.getTypedField(1, rep);
127 		return retVal;
128     }
129 
130     /**
131      * Returns a specific repetition of
132      * PDA-1: "Death Cause Code" - creates it if necessary
133      *
134      * @param rep The repetition index (0-indexed)
135      */
136     public CE getPda1_DeathCauseCode(int rep) { 
137 		CE retVal = this.getTypedField(1, rep);
138 		return retVal;
139     }
140 
141     /**
142      * Returns a count of the current number of repetitions of Death Cause Code (PDA-1).
143      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
144      * it will return zero.
145      */
146     public int getPda1_DeathCauseCodeReps() {
147     	return this.getReps(1);
148     }
149 
150 
151     /**
152      * Inserts a repetition of
153      * PDA-1: "Death Cause Code" at a specific index
154      *
155      * @param rep The repetition index (0-indexed)
156      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
157      */
158     public CE insertDeathCauseCode(int rep) throws HL7Exception { 
159         return (CE) super.insertRepetition(1, rep);
160     }
161 
162 
163     /**
164      * Inserts a repetition of
165      * PDA-1: "Death Cause Code" at a specific index
166      *
167      * @param rep The repetition index (0-indexed)
168      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
169      */
170     public CE insertPda1_DeathCauseCode(int rep) throws HL7Exception { 
171         return (CE) super.insertRepetition(1, rep);
172     }
173 
174 
175     /**
176      * Removes a repetition of
177      * PDA-1: "Death Cause Code" at a specific index
178      *
179      * @param rep The repetition index (0-indexed)
180      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
181      */
182     public CE removeDeathCauseCode(int rep) throws HL7Exception { 
183         return (CE) super.removeRepetition(1, rep);
184     }
185 
186 
187     /**
188      * Removes a repetition of
189      * PDA-1: "Death Cause Code" at a specific index
190      *
191      * @param rep The repetition index (0-indexed)
192      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
193      */
194     public CE removePda1_DeathCauseCode(int rep) throws HL7Exception { 
195         return (CE) super.removeRepetition(1, rep);
196     }
197 
198 
199 
200 
201     /**
202      * Returns
203      * PDA-2: "Death Location" - creates it if necessary
204      */
205     public PL getDeathLocation() { 
206 		PL retVal = this.getTypedField(2, 0);
207 		return retVal;
208     }
209     
210     /**
211      * Returns
212      * PDA-2: "Death Location" - creates it if necessary
213      */
214     public PL getPda2_DeathLocation() { 
215 		PL retVal = this.getTypedField(2, 0);
216 		return retVal;
217     }
218 
219 
220 
221     /**
222      * Returns
223      * PDA-3: "Death Certified Indicator" - creates it if necessary
224      */
225     public ID getDeathCertifiedIndicator() { 
226 		ID retVal = this.getTypedField(3, 0);
227 		return retVal;
228     }
229     
230     /**
231      * Returns
232      * PDA-3: "Death Certified Indicator" - creates it if necessary
233      */
234     public ID getPda3_DeathCertifiedIndicator() { 
235 		ID retVal = this.getTypedField(3, 0);
236 		return retVal;
237     }
238 
239 
240 
241     /**
242      * Returns
243      * PDA-4: "Death Certificate Signed Date/Time" - creates it if necessary
244      */
245     public TS getDeathCertificateSignedDateTime() { 
246 		TS retVal = this.getTypedField(4, 0);
247 		return retVal;
248     }
249     
250     /**
251      * Returns
252      * PDA-4: "Death Certificate Signed Date/Time" - creates it if necessary
253      */
254     public TS getPda4_DeathCertificateSignedDateTime() { 
255 		TS retVal = this.getTypedField(4, 0);
256 		return retVal;
257     }
258 
259 
260 
261     /**
262      * Returns
263      * PDA-5: "Death Certified By" - creates it if necessary
264      */
265     public XCN getDeathCertifiedBy() { 
266 		XCN retVal = this.getTypedField(5, 0);
267 		return retVal;
268     }
269     
270     /**
271      * Returns
272      * PDA-5: "Death Certified By" - creates it if necessary
273      */
274     public XCN getPda5_DeathCertifiedBy() { 
275 		XCN retVal = this.getTypedField(5, 0);
276 		return retVal;
277     }
278 
279 
280 
281     /**
282      * Returns
283      * PDA-6: "Autopsy Indicator" - creates it if necessary
284      */
285     public ID getAutopsyIndicator() { 
286 		ID retVal = this.getTypedField(6, 0);
287 		return retVal;
288     }
289     
290     /**
291      * Returns
292      * PDA-6: "Autopsy Indicator" - creates it if necessary
293      */
294     public ID getPda6_AutopsyIndicator() { 
295 		ID retVal = this.getTypedField(6, 0);
296 		return retVal;
297     }
298 
299 
300 
301     /**
302      * Returns
303      * PDA-7: "Autopsy Start and End Date/Time" - creates it if necessary
304      */
305     public DR getAutopsyStartAndEndDateTime() { 
306 		DR retVal = this.getTypedField(7, 0);
307 		return retVal;
308     }
309     
310     /**
311      * Returns
312      * PDA-7: "Autopsy Start and End Date/Time" - creates it if necessary
313      */
314     public DR getPda7_AutopsyStartAndEndDateTime() { 
315 		DR retVal = this.getTypedField(7, 0);
316 		return retVal;
317     }
318 
319 
320 
321     /**
322      * Returns
323      * PDA-8: "Autopsy Performed By" - creates it if necessary
324      */
325     public XCN getAutopsyPerformedBy() { 
326 		XCN retVal = this.getTypedField(8, 0);
327 		return retVal;
328     }
329     
330     /**
331      * Returns
332      * PDA-8: "Autopsy Performed By" - creates it if necessary
333      */
334     public XCN getPda8_AutopsyPerformedBy() { 
335 		XCN retVal = this.getTypedField(8, 0);
336 		return retVal;
337     }
338 
339 
340 
341     /**
342      * Returns
343      * PDA-9: "Coroner Indicator" - creates it if necessary
344      */
345     public ID getCoronerIndicator() { 
346 		ID retVal = this.getTypedField(9, 0);
347 		return retVal;
348     }
349     
350     /**
351      * Returns
352      * PDA-9: "Coroner Indicator" - creates it if necessary
353      */
354     public ID getPda9_CoronerIndicator() { 
355 		ID retVal = this.getTypedField(9, 0);
356 		return retVal;
357     }
358 
359 
360 
361 
362 
363     /** {@inheritDoc} */   
364     protected Type createNewTypeWithoutReflection(int field) {
365        switch (field) {
366           case 0: return new CE(getMessage());
367           case 1: return new PL(getMessage());
368           case 2: return new ID(getMessage(), new Integer( 136 ));
369           case 3: return new TS(getMessage());
370           case 4: return new XCN(getMessage());
371           case 5: return new ID(getMessage(), new Integer( 136 ));
372           case 6: return new DR(getMessage());
373           case 7: return new XCN(getMessage());
374           case 8: return new ID(getMessage(), new Integer( 136 ));
375           default: return null;
376        }
377    }
378 
379 
380 }
381