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.v25.segment;
035
036// import ca.uhn.hl7v2.model.v25.group.*;
037import ca.uhn.hl7v2.model.v25.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 IAM message segment (Patient Adverse Reaction Information). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>IAM-1: Set ID - IAM (SI) <b> </b>
053     * <li>IAM-2: Allergen Type Code (CE) <b>optional </b>
054     * <li>IAM-3: Allergen Code/Mnemonic/Description (CE) <b> </b>
055     * <li>IAM-4: Allergy Severity Code (CE) <b>optional </b>
056     * <li>IAM-5: Allergy Reaction Code (ST) <b>optional repeating</b>
057     * <li>IAM-6: Allergy Action Code (CNE) <b> </b>
058     * <li>IAM-7: Allergy Unique Identifier (EI) <b>optional </b>
059     * <li>IAM-8: Action Reason (ST) <b>optional </b>
060     * <li>IAM-9: Sensitivity to Causative Agent Code (CE) <b>optional </b>
061     * <li>IAM-10: Allergen Group Code/Mnemonic/Description (CE) <b>optional </b>
062     * <li>IAM-11: Onset Date (DT) <b>optional </b>
063     * <li>IAM-12: Onset Date Text (ST) <b>optional </b>
064     * <li>IAM-13: Reported Date/Time (TS) <b>optional </b>
065     * <li>IAM-14: Reported By (XPN) <b>optional </b>
066     * <li>IAM-15: Relationship to Patient Code (CE) <b>optional </b>
067     * <li>IAM-16: Alert Device Code (CE) <b>optional </b>
068     * <li>IAM-17: Allergy Clinical Status Code (CE) <b>optional </b>
069     * <li>IAM-18: Statused by Person (XCN) <b>optional </b>
070     * <li>IAM-19: Statused by Organization (XON) <b>optional </b>
071     * <li>IAM-20: Statused at Date/Time (TS) <b>optional </b>
072 * </ul>
073 */
074@SuppressWarnings("unused")
075public class IAM extends AbstractSegment {
076
077    /** 
078     * Creates a new IAM segment
079     */
080    public IAM(Group parent, ModelClassFactory factory) {
081       super(parent, factory);
082       init(factory);
083    }
084
085    private void init(ModelClassFactory factory) {
086       try {
087                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - IAM");
088                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Allergen Type Code");
089                                  this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Allergen Code/Mnemonic/Description");
090                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Allergy Severity Code");
091                                  this.add(ST.class, false, 0, 15, new Object[]{ getMessage() }, "Allergy Reaction Code");
092                                  this.add(CNE.class, true, 1, 250, new Object[]{ getMessage() }, "Allergy Action Code");
093                                  this.add(EI.class, false, 1, 427, new Object[]{ getMessage() }, "Allergy Unique Identifier");
094                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Action Reason");
095                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Sensitivity to Causative Agent Code");
096                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Allergen Group Code/Mnemonic/Description");
097                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Onset Date");
098                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Onset Date Text");
099                                  this.add(TS.class, false, 1, 8, new Object[]{ getMessage() }, "Reported Date/Time");
100                                  this.add(XPN.class, false, 1, 250, new Object[]{ getMessage() }, "Reported By");
101                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Relationship to Patient Code");
102                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Alert Device Code");
103                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Allergy Clinical Status Code");
104                                  this.add(XCN.class, false, 1, 250, new Object[]{ getMessage() }, "Statused by Person");
105                                  this.add(XON.class, false, 1, 250, new Object[]{ getMessage() }, "Statused by Organization");
106                                  this.add(TS.class, false, 1, 8, new Object[]{ getMessage() }, "Statused at Date/Time");
107       } catch(HL7Exception e) {
108          log.error("Unexpected error creating IAM - this is probably a bug in the source code generator.", e);
109       }
110    }
111
112
113
114    /**
115     * Returns
116     * IAM-1: "Set ID - IAM" - creates it if necessary
117     */
118    public SI getSetIDIAM() { 
119                SI retVal = this.getTypedField(1, 0);
120                return retVal;
121    }
122    
123    /**
124     * Returns
125     * IAM-1: "Set ID - IAM" - creates it if necessary
126     */
127    public SI getIam1_SetIDIAM() { 
128                SI retVal = this.getTypedField(1, 0);
129                return retVal;
130    }
131
132
133
134    /**
135     * Returns
136     * IAM-2: "Allergen Type Code" - creates it if necessary
137     */
138    public CE getAllergenTypeCode() { 
139                CE retVal = this.getTypedField(2, 0);
140                return retVal;
141    }
142    
143    /**
144     * Returns
145     * IAM-2: "Allergen Type Code" - creates it if necessary
146     */
147    public CE getIam2_AllergenTypeCode() { 
148                CE retVal = this.getTypedField(2, 0);
149                return retVal;
150    }
151
152
153
154    /**
155     * Returns
156     * IAM-3: "Allergen Code/Mnemonic/Description" - creates it if necessary
157     */
158    public CE getAllergenCodeMnemonicDescription() { 
159                CE retVal = this.getTypedField(3, 0);
160                return retVal;
161    }
162    
163    /**
164     * Returns
165     * IAM-3: "Allergen Code/Mnemonic/Description" - creates it if necessary
166     */
167    public CE getIam3_AllergenCodeMnemonicDescription() { 
168                CE retVal = this.getTypedField(3, 0);
169                return retVal;
170    }
171
172
173
174    /**
175     * Returns
176     * IAM-4: "Allergy Severity Code" - creates it if necessary
177     */
178    public CE getAllergySeverityCode() { 
179                CE retVal = this.getTypedField(4, 0);
180                return retVal;
181    }
182    
183    /**
184     * Returns
185     * IAM-4: "Allergy Severity Code" - creates it if necessary
186     */
187    public CE getIam4_AllergySeverityCode() { 
188                CE retVal = this.getTypedField(4, 0);
189                return retVal;
190    }
191
192
193    /**
194     * Returns all repetitions of Allergy Reaction Code (IAM-5).
195     */
196    public ST[] getAllergyReactionCode() {
197        ST[] retVal = this.getTypedField(5, new ST[0]);
198        return retVal;
199    }
200
201
202    /**
203     * Returns all repetitions of Allergy Reaction Code (IAM-5).
204     */
205    public ST[] getIam5_AllergyReactionCode() {
206        ST[] retVal = this.getTypedField(5, new ST[0]);
207        return retVal;
208    }
209
210
211    /**
212     * Returns a count of the current number of repetitions of Allergy Reaction Code (IAM-5).
213     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
214     * it will return zero.
215     */
216    public int getAllergyReactionCodeReps() {
217        return this.getReps(5);
218    }
219
220
221    /**
222     * Returns a specific repetition of
223     * IAM-5: "Allergy Reaction Code" - creates it if necessary
224     *
225     * @param rep The repetition index (0-indexed)
226     */
227    public ST getAllergyReactionCode(int rep) { 
228                ST retVal = this.getTypedField(5, rep);
229                return retVal;
230    }
231
232    /**
233     * Returns a specific repetition of
234     * IAM-5: "Allergy Reaction Code" - creates it if necessary
235     *
236     * @param rep The repetition index (0-indexed)
237     */
238    public ST getIam5_AllergyReactionCode(int rep) { 
239                ST retVal = this.getTypedField(5, rep);
240                return retVal;
241    }
242
243    /**
244     * Returns a count of the current number of repetitions of Allergy Reaction Code (IAM-5).
245     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
246     * it will return zero.
247     */
248    public int getIam5_AllergyReactionCodeReps() {
249        return this.getReps(5);
250    }
251
252
253    /**
254     * Inserts a repetition of
255     * IAM-5: "Allergy Reaction Code" at a specific index
256     *
257     * @param rep The repetition index (0-indexed)
258     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
259     */
260    public ST insertAllergyReactionCode(int rep) throws HL7Exception { 
261        return (ST) super.insertRepetition(5, rep);
262    }
263
264
265    /**
266     * Inserts a repetition of
267     * IAM-5: "Allergy Reaction Code" at a specific index
268     *
269     * @param rep The repetition index (0-indexed)
270     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
271     */
272    public ST insertIam5_AllergyReactionCode(int rep) throws HL7Exception { 
273        return (ST) super.insertRepetition(5, rep);
274    }
275
276
277    /**
278     * Removes a repetition of
279     * IAM-5: "Allergy Reaction Code" at a specific index
280     *
281     * @param rep The repetition index (0-indexed)
282     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
283     */
284    public ST removeAllergyReactionCode(int rep) throws HL7Exception { 
285        return (ST) super.removeRepetition(5, rep);
286    }
287
288
289    /**
290     * Removes a repetition of
291     * IAM-5: "Allergy Reaction Code" at a specific index
292     *
293     * @param rep The repetition index (0-indexed)
294     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
295     */
296    public ST removeIam5_AllergyReactionCode(int rep) throws HL7Exception { 
297        return (ST) super.removeRepetition(5, rep);
298    }
299
300
301
302
303    /**
304     * Returns
305     * IAM-6: "Allergy Action Code" - creates it if necessary
306     */
307    public CNE getAllergyActionCode() { 
308                CNE retVal = this.getTypedField(6, 0);
309                return retVal;
310    }
311    
312    /**
313     * Returns
314     * IAM-6: "Allergy Action Code" - creates it if necessary
315     */
316    public CNE getIam6_AllergyActionCode() { 
317                CNE retVal = this.getTypedField(6, 0);
318                return retVal;
319    }
320
321
322
323    /**
324     * Returns
325     * IAM-7: "Allergy Unique Identifier" - creates it if necessary
326     */
327    public EI getAllergyUniqueIdentifier() { 
328                EI retVal = this.getTypedField(7, 0);
329                return retVal;
330    }
331    
332    /**
333     * Returns
334     * IAM-7: "Allergy Unique Identifier" - creates it if necessary
335     */
336    public EI getIam7_AllergyUniqueIdentifier() { 
337                EI retVal = this.getTypedField(7, 0);
338                return retVal;
339    }
340
341
342
343    /**
344     * Returns
345     * IAM-8: "Action Reason" - creates it if necessary
346     */
347    public ST getActionReason() { 
348                ST retVal = this.getTypedField(8, 0);
349                return retVal;
350    }
351    
352    /**
353     * Returns
354     * IAM-8: "Action Reason" - creates it if necessary
355     */
356    public ST getIam8_ActionReason() { 
357                ST retVal = this.getTypedField(8, 0);
358                return retVal;
359    }
360
361
362
363    /**
364     * Returns
365     * IAM-9: "Sensitivity to Causative Agent Code" - creates it if necessary
366     */
367    public CE getSensitivityToCausativeAgentCode() { 
368                CE retVal = this.getTypedField(9, 0);
369                return retVal;
370    }
371    
372    /**
373     * Returns
374     * IAM-9: "Sensitivity to Causative Agent Code" - creates it if necessary
375     */
376    public CE getIam9_SensitivityToCausativeAgentCode() { 
377                CE retVal = this.getTypedField(9, 0);
378                return retVal;
379    }
380
381
382
383    /**
384     * Returns
385     * IAM-10: "Allergen Group Code/Mnemonic/Description" - creates it if necessary
386     */
387    public CE getAllergenGroupCodeMnemonicDescription() { 
388                CE retVal = this.getTypedField(10, 0);
389                return retVal;
390    }
391    
392    /**
393     * Returns
394     * IAM-10: "Allergen Group Code/Mnemonic/Description" - creates it if necessary
395     */
396    public CE getIam10_AllergenGroupCodeMnemonicDescription() { 
397                CE retVal = this.getTypedField(10, 0);
398                return retVal;
399    }
400
401
402
403    /**
404     * Returns
405     * IAM-11: "Onset Date" - creates it if necessary
406     */
407    public DT getOnsetDate() { 
408                DT retVal = this.getTypedField(11, 0);
409                return retVal;
410    }
411    
412    /**
413     * Returns
414     * IAM-11: "Onset Date" - creates it if necessary
415     */
416    public DT getIam11_OnsetDate() { 
417                DT retVal = this.getTypedField(11, 0);
418                return retVal;
419    }
420
421
422
423    /**
424     * Returns
425     * IAM-12: "Onset Date Text" - creates it if necessary
426     */
427    public ST getOnsetDateText() { 
428                ST retVal = this.getTypedField(12, 0);
429                return retVal;
430    }
431    
432    /**
433     * Returns
434     * IAM-12: "Onset Date Text" - creates it if necessary
435     */
436    public ST getIam12_OnsetDateText() { 
437                ST retVal = this.getTypedField(12, 0);
438                return retVal;
439    }
440
441
442
443    /**
444     * Returns
445     * IAM-13: "Reported Date/Time" - creates it if necessary
446     */
447    public TS getReportedDateTime() { 
448                TS retVal = this.getTypedField(13, 0);
449                return retVal;
450    }
451    
452    /**
453     * Returns
454     * IAM-13: "Reported Date/Time" - creates it if necessary
455     */
456    public TS getIam13_ReportedDateTime() { 
457                TS retVal = this.getTypedField(13, 0);
458                return retVal;
459    }
460
461
462
463    /**
464     * Returns
465     * IAM-14: "Reported By" - creates it if necessary
466     */
467    public XPN getReportedBy() { 
468                XPN retVal = this.getTypedField(14, 0);
469                return retVal;
470    }
471    
472    /**
473     * Returns
474     * IAM-14: "Reported By" - creates it if necessary
475     */
476    public XPN getIam14_ReportedBy() { 
477                XPN retVal = this.getTypedField(14, 0);
478                return retVal;
479    }
480
481
482
483    /**
484     * Returns
485     * IAM-15: "Relationship to Patient Code" - creates it if necessary
486     */
487    public CE getRelationshipToPatientCode() { 
488                CE retVal = this.getTypedField(15, 0);
489                return retVal;
490    }
491    
492    /**
493     * Returns
494     * IAM-15: "Relationship to Patient Code" - creates it if necessary
495     */
496    public CE getIam15_RelationshipToPatientCode() { 
497                CE retVal = this.getTypedField(15, 0);
498                return retVal;
499    }
500
501
502
503    /**
504     * Returns
505     * IAM-16: "Alert Device Code" - creates it if necessary
506     */
507    public CE getAlertDeviceCode() { 
508                CE retVal = this.getTypedField(16, 0);
509                return retVal;
510    }
511    
512    /**
513     * Returns
514     * IAM-16: "Alert Device Code" - creates it if necessary
515     */
516    public CE getIam16_AlertDeviceCode() { 
517                CE retVal = this.getTypedField(16, 0);
518                return retVal;
519    }
520
521
522
523    /**
524     * Returns
525     * IAM-17: "Allergy Clinical Status Code" - creates it if necessary
526     */
527    public CE getAllergyClinicalStatusCode() { 
528                CE retVal = this.getTypedField(17, 0);
529                return retVal;
530    }
531    
532    /**
533     * Returns
534     * IAM-17: "Allergy Clinical Status Code" - creates it if necessary
535     */
536    public CE getIam17_AllergyClinicalStatusCode() { 
537                CE retVal = this.getTypedField(17, 0);
538                return retVal;
539    }
540
541
542
543    /**
544     * Returns
545     * IAM-18: "Statused by Person" - creates it if necessary
546     */
547    public XCN getStatusedByPerson() { 
548                XCN retVal = this.getTypedField(18, 0);
549                return retVal;
550    }
551    
552    /**
553     * Returns
554     * IAM-18: "Statused by Person" - creates it if necessary
555     */
556    public XCN getIam18_StatusedByPerson() { 
557                XCN retVal = this.getTypedField(18, 0);
558                return retVal;
559    }
560
561
562
563    /**
564     * Returns
565     * IAM-19: "Statused by Organization" - creates it if necessary
566     */
567    public XON getStatusedByOrganization() { 
568                XON retVal = this.getTypedField(19, 0);
569                return retVal;
570    }
571    
572    /**
573     * Returns
574     * IAM-19: "Statused by Organization" - creates it if necessary
575     */
576    public XON getIam19_StatusedByOrganization() { 
577                XON retVal = this.getTypedField(19, 0);
578                return retVal;
579    }
580
581
582
583    /**
584     * Returns
585     * IAM-20: "Statused at Date/Time" - creates it if necessary
586     */
587    public TS getStatusedAtDateTime() { 
588                TS retVal = this.getTypedField(20, 0);
589                return retVal;
590    }
591    
592    /**
593     * Returns
594     * IAM-20: "Statused at Date/Time" - creates it if necessary
595     */
596    public TS getIam20_StatusedAtDateTime() { 
597                TS retVal = this.getTypedField(20, 0);
598                return retVal;
599    }
600
601
602
603
604
605    /** {@inheritDoc} */   
606    protected Type createNewTypeWithoutReflection(int field) {
607       switch (field) {
608          case 0: return new SI(getMessage());
609          case 1: return new CE(getMessage());
610          case 2: return new CE(getMessage());
611          case 3: return new CE(getMessage());
612          case 4: return new ST(getMessage());
613          case 5: return new CNE(getMessage());
614          case 6: return new EI(getMessage());
615          case 7: return new ST(getMessage());
616          case 8: return new CE(getMessage());
617          case 9: return new CE(getMessage());
618          case 10: return new DT(getMessage());
619          case 11: return new ST(getMessage());
620          case 12: return new TS(getMessage());
621          case 13: return new XPN(getMessage());
622          case 14: return new CE(getMessage());
623          case 15: return new CE(getMessage());
624          case 16: return new CE(getMessage());
625          case 17: return new XCN(getMessage());
626          case 18: return new XON(getMessage());
627          case 19: return new TS(getMessage());
628          default: return null;
629       }
630   }
631
632
633}
634