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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v28.segment;
035
036// import ca.uhn.hl7v2.model.v28.group.*;
037import ca.uhn.hl7v2.model.v28.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 ACC message segment (Accident). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>ACC-1: Accident Date/Time (DTM) <b>optional </b>
053     * <li>ACC-2: Accident Code (CWE) <b>optional </b>
054     * <li>ACC-3: Accident Location (ST) <b>optional </b>
055     * <li>ACC-4: Auto Accident State (CWE) <b>optional </b>
056     * <li>ACC-5: Accident Job Related Indicator (ID) <b>optional </b>
057     * <li>ACC-6: Accident Death Indicator (ID) <b>optional </b>
058     * <li>ACC-7: Entered By (XCN) <b>optional </b>
059     * <li>ACC-8: Accident Description (ST) <b>optional </b>
060     * <li>ACC-9: Brought In By (ST) <b>optional </b>
061     * <li>ACC-10: Police Notified Indicator (ID) <b>optional </b>
062     * <li>ACC-11: Accident Address (XAD) <b>optional </b>
063     * <li>ACC-12: Degree of patient liability (NM) <b>optional </b>
064     * <li>ACC-13: Accident Identifier (EI) <b>optional repeating</b>
065 * </ul>
066 */
067@SuppressWarnings("unused")
068public class ACC extends AbstractSegment {
069
070    /** 
071     * Creates a new ACC segment
072     */
073    public ACC(Group parent, ModelClassFactory factory) {
074       super(parent, factory);
075       init(factory);
076    }
077
078    private void init(ModelClassFactory factory) {
079       try {
080                                  this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Accident Date/Time");
081                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Accident Code");
082                                  this.add(ST.class, false, 1, 0, new Object[]{ getMessage() }, "Accident Location");
083                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Auto Accident State");
084                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Accident Job Related Indicator");
085                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Accident Death Indicator");
086                                  this.add(XCN.class, false, 1, 0, new Object[]{ getMessage() }, "Entered By");
087                                  this.add(ST.class, false, 1, 0, new Object[]{ getMessage() }, "Accident Description");
088                                  this.add(ST.class, false, 1, 0, new Object[]{ getMessage() }, "Brought In By");
089                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Police Notified Indicator");
090                                  this.add(XAD.class, false, 1, 0, new Object[]{ getMessage() }, "Accident Address");
091                                  this.add(NM.class, false, 1, 0, new Object[]{ getMessage() }, "Degree of patient liability");
092                                  this.add(EI.class, false, 0, 0, new Object[]{ getMessage() }, "Accident Identifier");
093       } catch(HL7Exception e) {
094          log.error("Unexpected error creating ACC - this is probably a bug in the source code generator.", e);
095       }
096    }
097
098
099
100    /**
101     * Returns
102     * ACC-1: "Accident Date/Time" - creates it if necessary
103     */
104    public DTM getAccidentDateTime() { 
105                DTM retVal = this.getTypedField(1, 0);
106                return retVal;
107    }
108    
109    /**
110     * Returns
111     * ACC-1: "Accident Date/Time" - creates it if necessary
112     */
113    public DTM getAcc1_AccidentDateTime() { 
114                DTM retVal = this.getTypedField(1, 0);
115                return retVal;
116    }
117
118
119
120    /**
121     * Returns
122     * ACC-2: "Accident Code" - creates it if necessary
123     */
124    public CWE getAccidentCode() { 
125                CWE retVal = this.getTypedField(2, 0);
126                return retVal;
127    }
128    
129    /**
130     * Returns
131     * ACC-2: "Accident Code" - creates it if necessary
132     */
133    public CWE getAcc2_AccidentCode() { 
134                CWE retVal = this.getTypedField(2, 0);
135                return retVal;
136    }
137
138
139
140    /**
141     * Returns
142     * ACC-3: "Accident Location" - creates it if necessary
143     */
144    public ST getAccidentLocation() { 
145                ST retVal = this.getTypedField(3, 0);
146                return retVal;
147    }
148    
149    /**
150     * Returns
151     * ACC-3: "Accident Location" - creates it if necessary
152     */
153    public ST getAcc3_AccidentLocation() { 
154                ST retVal = this.getTypedField(3, 0);
155                return retVal;
156    }
157
158
159
160    /**
161     * Returns
162     * ACC-4: "Auto Accident State" - creates it if necessary
163     */
164    public CWE getAutoAccidentState() { 
165                CWE retVal = this.getTypedField(4, 0);
166                return retVal;
167    }
168    
169    /**
170     * Returns
171     * ACC-4: "Auto Accident State" - creates it if necessary
172     */
173    public CWE getAcc4_AutoAccidentState() { 
174                CWE retVal = this.getTypedField(4, 0);
175                return retVal;
176    }
177
178
179
180    /**
181     * Returns
182     * ACC-5: "Accident Job Related Indicator" - creates it if necessary
183     */
184    public ID getAccidentJobRelatedIndicator() { 
185                ID retVal = this.getTypedField(5, 0);
186                return retVal;
187    }
188    
189    /**
190     * Returns
191     * ACC-5: "Accident Job Related Indicator" - creates it if necessary
192     */
193    public ID getAcc5_AccidentJobRelatedIndicator() { 
194                ID retVal = this.getTypedField(5, 0);
195                return retVal;
196    }
197
198
199
200    /**
201     * Returns
202     * ACC-6: "Accident Death Indicator" - creates it if necessary
203     */
204    public ID getAccidentDeathIndicator() { 
205                ID retVal = this.getTypedField(6, 0);
206                return retVal;
207    }
208    
209    /**
210     * Returns
211     * ACC-6: "Accident Death Indicator" - creates it if necessary
212     */
213    public ID getAcc6_AccidentDeathIndicator() { 
214                ID retVal = this.getTypedField(6, 0);
215                return retVal;
216    }
217
218
219
220    /**
221     * Returns
222     * ACC-7: "Entered By" - creates it if necessary
223     */
224    public XCN getEnteredBy() { 
225                XCN retVal = this.getTypedField(7, 0);
226                return retVal;
227    }
228    
229    /**
230     * Returns
231     * ACC-7: "Entered By" - creates it if necessary
232     */
233    public XCN getAcc7_EnteredBy() { 
234                XCN retVal = this.getTypedField(7, 0);
235                return retVal;
236    }
237
238
239
240    /**
241     * Returns
242     * ACC-8: "Accident Description" - creates it if necessary
243     */
244    public ST getAccidentDescription() { 
245                ST retVal = this.getTypedField(8, 0);
246                return retVal;
247    }
248    
249    /**
250     * Returns
251     * ACC-8: "Accident Description" - creates it if necessary
252     */
253    public ST getAcc8_AccidentDescription() { 
254                ST retVal = this.getTypedField(8, 0);
255                return retVal;
256    }
257
258
259
260    /**
261     * Returns
262     * ACC-9: "Brought In By" - creates it if necessary
263     */
264    public ST getBroughtInBy() { 
265                ST retVal = this.getTypedField(9, 0);
266                return retVal;
267    }
268    
269    /**
270     * Returns
271     * ACC-9: "Brought In By" - creates it if necessary
272     */
273    public ST getAcc9_BroughtInBy() { 
274                ST retVal = this.getTypedField(9, 0);
275                return retVal;
276    }
277
278
279
280    /**
281     * Returns
282     * ACC-10: "Police Notified Indicator" - creates it if necessary
283     */
284    public ID getPoliceNotifiedIndicator() { 
285                ID retVal = this.getTypedField(10, 0);
286                return retVal;
287    }
288    
289    /**
290     * Returns
291     * ACC-10: "Police Notified Indicator" - creates it if necessary
292     */
293    public ID getAcc10_PoliceNotifiedIndicator() { 
294                ID retVal = this.getTypedField(10, 0);
295                return retVal;
296    }
297
298
299
300    /**
301     * Returns
302     * ACC-11: "Accident Address" - creates it if necessary
303     */
304    public XAD getAccidentAddress() { 
305                XAD retVal = this.getTypedField(11, 0);
306                return retVal;
307    }
308    
309    /**
310     * Returns
311     * ACC-11: "Accident Address" - creates it if necessary
312     */
313    public XAD getAcc11_AccidentAddress() { 
314                XAD retVal = this.getTypedField(11, 0);
315                return retVal;
316    }
317
318
319
320    /**
321     * Returns
322     * ACC-12: "Degree of patient liability" - creates it if necessary
323     */
324    public NM getDegreeOfPatientLiability() { 
325                NM retVal = this.getTypedField(12, 0);
326                return retVal;
327    }
328    
329    /**
330     * Returns
331     * ACC-12: "Degree of patient liability" - creates it if necessary
332     */
333    public NM getAcc12_DegreeOfPatientLiability() { 
334                NM retVal = this.getTypedField(12, 0);
335                return retVal;
336    }
337
338
339    /**
340     * Returns all repetitions of Accident Identifier (ACC-13).
341     */
342    public EI[] getAccidentIdentifier() {
343        EI[] retVal = this.getTypedField(13, new EI[0]);
344        return retVal;
345    }
346
347
348    /**
349     * Returns all repetitions of Accident Identifier (ACC-13).
350     */
351    public EI[] getAcc13_AccidentIdentifier() {
352        EI[] retVal = this.getTypedField(13, new EI[0]);
353        return retVal;
354    }
355
356
357    /**
358     * Returns a count of the current number of repetitions of Accident Identifier (ACC-13).
359     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
360     * it will return zero.
361     */
362    public int getAccidentIdentifierReps() {
363        return this.getReps(13);
364    }
365
366
367    /**
368     * Returns a specific repetition of
369     * ACC-13: "Accident Identifier" - creates it if necessary
370     *
371     * @param rep The repetition index (0-indexed)
372     */
373    public EI getAccidentIdentifier(int rep) { 
374                EI retVal = this.getTypedField(13, rep);
375                return retVal;
376    }
377
378    /**
379     * Returns a specific repetition of
380     * ACC-13: "Accident Identifier" - creates it if necessary
381     *
382     * @param rep The repetition index (0-indexed)
383     */
384    public EI getAcc13_AccidentIdentifier(int rep) { 
385                EI retVal = this.getTypedField(13, rep);
386                return retVal;
387    }
388
389    /**
390     * Returns a count of the current number of repetitions of Accident Identifier (ACC-13).
391     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
392     * it will return zero.
393     */
394    public int getAcc13_AccidentIdentifierReps() {
395        return this.getReps(13);
396    }
397
398
399    /**
400     * Inserts a repetition of
401     * ACC-13: "Accident Identifier" at a specific index
402     *
403     * @param rep The repetition index (0-indexed)
404     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
405     */
406    public EI insertAccidentIdentifier(int rep) throws HL7Exception { 
407        return (EI) super.insertRepetition(13, rep);
408    }
409
410
411    /**
412     * Inserts a repetition of
413     * ACC-13: "Accident Identifier" at a specific index
414     *
415     * @param rep The repetition index (0-indexed)
416     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
417     */
418    public EI insertAcc13_AccidentIdentifier(int rep) throws HL7Exception { 
419        return (EI) super.insertRepetition(13, rep);
420    }
421
422
423    /**
424     * Removes a repetition of
425     * ACC-13: "Accident Identifier" at a specific index
426     *
427     * @param rep The repetition index (0-indexed)
428     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
429     */
430    public EI removeAccidentIdentifier(int rep) throws HL7Exception { 
431        return (EI) super.removeRepetition(13, rep);
432    }
433
434
435    /**
436     * Removes a repetition of
437     * ACC-13: "Accident Identifier" at a specific index
438     *
439     * @param rep The repetition index (0-indexed)
440     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
441     */
442    public EI removeAcc13_AccidentIdentifier(int rep) throws HL7Exception { 
443        return (EI) super.removeRepetition(13, rep);
444    }
445
446
447
448
449
450
451    /** {@inheritDoc} */   
452    protected Type createNewTypeWithoutReflection(int field) {
453       switch (field) {
454          case 0: return new DTM(getMessage());
455          case 1: return new CWE(getMessage());
456          case 2: return new ST(getMessage());
457          case 3: return new CWE(getMessage());
458          case 4: return new ID(getMessage(), new Integer( 136 ));
459          case 5: return new ID(getMessage(), new Integer( 136 ));
460          case 6: return new XCN(getMessage());
461          case 7: return new ST(getMessage());
462          case 8: return new ST(getMessage());
463          case 9: return new ID(getMessage(), new Integer( 136 ));
464          case 10: return new XAD(getMessage());
465          case 11: return new NM(getMessage());
466          case 12: return new EI(getMessage());
467          default: return null;
468       }
469   }
470
471
472}
473