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