001package org.hl7.fhir.dstu3.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu3
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056
057import org.hl7.fhir.exceptions.FHIRException;
058import org.hl7.fhir.exceptions.FHIRFormatError;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.utilities.Utilities;
061
062import ca.uhn.fhir.model.api.annotation.Block;
063import ca.uhn.fhir.model.api.annotation.Child;
064import ca.uhn.fhir.model.api.annotation.Description;
065import ca.uhn.fhir.model.api.annotation.ResourceDef;
066import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
067/**
068 * Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.
069 */
070@ResourceDef(name="AllergyIntolerance", profile="http://hl7.org/fhir/Profile/AllergyIntolerance")
071public class AllergyIntolerance extends DomainResource {
072
073    public enum AllergyIntoleranceClinicalStatus {
074        /**
075         * An active record of a risk of a reaction to the identified substance.
076         */
077        ACTIVE, 
078        /**
079         * An inactivated record of a risk of a reaction to the identified substance.
080         */
081        INACTIVE, 
082        /**
083         * A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered to be resolved.
084         */
085        RESOLVED, 
086        /**
087         * added to help the parsers with the generic types
088         */
089        NULL;
090        public static AllergyIntoleranceClinicalStatus fromCode(String codeString) throws FHIRException {
091            if (codeString == null || "".equals(codeString))
092                return null;
093        if ("active".equals(codeString))
094          return ACTIVE;
095        if ("inactive".equals(codeString))
096          return INACTIVE;
097        if ("resolved".equals(codeString))
098          return RESOLVED;
099        if (Configuration.isAcceptInvalidEnums())
100          return null;
101        else
102          throw new FHIRException("Unknown AllergyIntoleranceClinicalStatus code '"+codeString+"'");
103        }
104        public String toCode() {
105          switch (this) {
106            case ACTIVE: return "active";
107            case INACTIVE: return "inactive";
108            case RESOLVED: return "resolved";
109            default: return "?";
110          }
111        }
112        public String getSystem() {
113          switch (this) {
114            case ACTIVE: return "http://hl7.org/fhir/allergy-clinical-status";
115            case INACTIVE: return "http://hl7.org/fhir/allergy-clinical-status";
116            case RESOLVED: return "http://hl7.org/fhir/allergy-clinical-status";
117            default: return "?";
118          }
119        }
120        public String getDefinition() {
121          switch (this) {
122            case ACTIVE: return "An active record of a risk of a reaction to the identified substance.";
123            case INACTIVE: return "An inactivated record of a risk of a reaction to the identified substance.";
124            case RESOLVED: return "A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered to be resolved.";
125            default: return "?";
126          }
127        }
128        public String getDisplay() {
129          switch (this) {
130            case ACTIVE: return "Active";
131            case INACTIVE: return "Inactive";
132            case RESOLVED: return "Resolved";
133            default: return "?";
134          }
135        }
136    }
137
138  public static class AllergyIntoleranceClinicalStatusEnumFactory implements EnumFactory<AllergyIntoleranceClinicalStatus> {
139    public AllergyIntoleranceClinicalStatus fromCode(String codeString) throws IllegalArgumentException {
140      if (codeString == null || "".equals(codeString))
141            if (codeString == null || "".equals(codeString))
142                return null;
143        if ("active".equals(codeString))
144          return AllergyIntoleranceClinicalStatus.ACTIVE;
145        if ("inactive".equals(codeString))
146          return AllergyIntoleranceClinicalStatus.INACTIVE;
147        if ("resolved".equals(codeString))
148          return AllergyIntoleranceClinicalStatus.RESOLVED;
149        throw new IllegalArgumentException("Unknown AllergyIntoleranceClinicalStatus code '"+codeString+"'");
150        }
151        public Enumeration<AllergyIntoleranceClinicalStatus> fromType(Base code) throws FHIRException {
152          if (code == null)
153            return null;
154          if (code.isEmpty())
155            return new Enumeration<AllergyIntoleranceClinicalStatus>(this);
156          String codeString = ((PrimitiveType) code).asStringValue();
157          if (codeString == null || "".equals(codeString))
158            return null;
159        if ("active".equals(codeString))
160          return new Enumeration<AllergyIntoleranceClinicalStatus>(this, AllergyIntoleranceClinicalStatus.ACTIVE);
161        if ("inactive".equals(codeString))
162          return new Enumeration<AllergyIntoleranceClinicalStatus>(this, AllergyIntoleranceClinicalStatus.INACTIVE);
163        if ("resolved".equals(codeString))
164          return new Enumeration<AllergyIntoleranceClinicalStatus>(this, AllergyIntoleranceClinicalStatus.RESOLVED);
165        throw new FHIRException("Unknown AllergyIntoleranceClinicalStatus code '"+codeString+"'");
166        }
167    public String toCode(AllergyIntoleranceClinicalStatus code) {
168      if (code == AllergyIntoleranceClinicalStatus.ACTIVE)
169        return "active";
170      if (code == AllergyIntoleranceClinicalStatus.INACTIVE)
171        return "inactive";
172      if (code == AllergyIntoleranceClinicalStatus.RESOLVED)
173        return "resolved";
174      return "?";
175      }
176    public String toSystem(AllergyIntoleranceClinicalStatus code) {
177      return code.getSystem();
178      }
179    }
180
181    public enum AllergyIntoleranceVerificationStatus {
182        /**
183         * A low level of certainty about the propensity for a reaction to the identified substance.
184         */
185        UNCONFIRMED, 
186        /**
187         * A high level of certainty about the propensity for a reaction to the identified substance, which may include clinical evidence by testing or rechallenge.
188         */
189        CONFIRMED, 
190        /**
191         * A propensity for a reaction to the identified substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.
192         */
193        REFUTED, 
194        /**
195         * The statement was entered in error and is not valid.
196         */
197        ENTEREDINERROR, 
198        /**
199         * added to help the parsers with the generic types
200         */
201        NULL;
202        public static AllergyIntoleranceVerificationStatus fromCode(String codeString) throws FHIRException {
203            if (codeString == null || "".equals(codeString))
204                return null;
205        if ("unconfirmed".equals(codeString))
206          return UNCONFIRMED;
207        if ("confirmed".equals(codeString))
208          return CONFIRMED;
209        if ("refuted".equals(codeString))
210          return REFUTED;
211        if ("entered-in-error".equals(codeString))
212          return ENTEREDINERROR;
213        if (Configuration.isAcceptInvalidEnums())
214          return null;
215        else
216          throw new FHIRException("Unknown AllergyIntoleranceVerificationStatus code '"+codeString+"'");
217        }
218        public String toCode() {
219          switch (this) {
220            case UNCONFIRMED: return "unconfirmed";
221            case CONFIRMED: return "confirmed";
222            case REFUTED: return "refuted";
223            case ENTEREDINERROR: return "entered-in-error";
224            default: return "?";
225          }
226        }
227        public String getSystem() {
228          switch (this) {
229            case UNCONFIRMED: return "http://hl7.org/fhir/allergy-verification-status";
230            case CONFIRMED: return "http://hl7.org/fhir/allergy-verification-status";
231            case REFUTED: return "http://hl7.org/fhir/allergy-verification-status";
232            case ENTEREDINERROR: return "http://hl7.org/fhir/allergy-verification-status";
233            default: return "?";
234          }
235        }
236        public String getDefinition() {
237          switch (this) {
238            case UNCONFIRMED: return "A low level of certainty about the propensity for a reaction to the identified substance.";
239            case CONFIRMED: return "A high level of certainty about the propensity for a reaction to the identified substance, which may include clinical evidence by testing or rechallenge.";
240            case REFUTED: return "A propensity for a reaction to the identified substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.";
241            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
242            default: return "?";
243          }
244        }
245        public String getDisplay() {
246          switch (this) {
247            case UNCONFIRMED: return "Unconfirmed";
248            case CONFIRMED: return "Confirmed";
249            case REFUTED: return "Refuted";
250            case ENTEREDINERROR: return "Entered In Error";
251            default: return "?";
252          }
253        }
254    }
255
256  public static class AllergyIntoleranceVerificationStatusEnumFactory implements EnumFactory<AllergyIntoleranceVerificationStatus> {
257    public AllergyIntoleranceVerificationStatus fromCode(String codeString) throws IllegalArgumentException {
258      if (codeString == null || "".equals(codeString))
259            if (codeString == null || "".equals(codeString))
260                return null;
261        if ("unconfirmed".equals(codeString))
262          return AllergyIntoleranceVerificationStatus.UNCONFIRMED;
263        if ("confirmed".equals(codeString))
264          return AllergyIntoleranceVerificationStatus.CONFIRMED;
265        if ("refuted".equals(codeString))
266          return AllergyIntoleranceVerificationStatus.REFUTED;
267        if ("entered-in-error".equals(codeString))
268          return AllergyIntoleranceVerificationStatus.ENTEREDINERROR;
269        throw new IllegalArgumentException("Unknown AllergyIntoleranceVerificationStatus code '"+codeString+"'");
270        }
271        public Enumeration<AllergyIntoleranceVerificationStatus> fromType(Base code) throws FHIRException {
272          if (code == null)
273            return null;
274          if (code.isEmpty())
275            return new Enumeration<AllergyIntoleranceVerificationStatus>(this);
276          String codeString = ((PrimitiveType) code).asStringValue();
277          if (codeString == null || "".equals(codeString))
278            return null;
279        if ("unconfirmed".equals(codeString))
280          return new Enumeration<AllergyIntoleranceVerificationStatus>(this, AllergyIntoleranceVerificationStatus.UNCONFIRMED);
281        if ("confirmed".equals(codeString))
282          return new Enumeration<AllergyIntoleranceVerificationStatus>(this, AllergyIntoleranceVerificationStatus.CONFIRMED);
283        if ("refuted".equals(codeString))
284          return new Enumeration<AllergyIntoleranceVerificationStatus>(this, AllergyIntoleranceVerificationStatus.REFUTED);
285        if ("entered-in-error".equals(codeString))
286          return new Enumeration<AllergyIntoleranceVerificationStatus>(this, AllergyIntoleranceVerificationStatus.ENTEREDINERROR);
287        throw new FHIRException("Unknown AllergyIntoleranceVerificationStatus code '"+codeString+"'");
288        }
289    public String toCode(AllergyIntoleranceVerificationStatus code) {
290      if (code == AllergyIntoleranceVerificationStatus.UNCONFIRMED)
291        return "unconfirmed";
292      if (code == AllergyIntoleranceVerificationStatus.CONFIRMED)
293        return "confirmed";
294      if (code == AllergyIntoleranceVerificationStatus.REFUTED)
295        return "refuted";
296      if (code == AllergyIntoleranceVerificationStatus.ENTEREDINERROR)
297        return "entered-in-error";
298      return "?";
299      }
300    public String toSystem(AllergyIntoleranceVerificationStatus code) {
301      return code.getSystem();
302      }
303    }
304
305    public enum AllergyIntoleranceType {
306        /**
307         * A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other "allergy-like" reactions, including pseudoallergy.
308         */
309        ALLERGY, 
310        /**
311         * A propensity for adverse reactions to a substance that is not judged to be allergic or "allergy-like".  These reactions are typically (but not necessarily) non-immune.  They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).
312         */
313        INTOLERANCE, 
314        /**
315         * added to help the parsers with the generic types
316         */
317        NULL;
318        public static AllergyIntoleranceType fromCode(String codeString) throws FHIRException {
319            if (codeString == null || "".equals(codeString))
320                return null;
321        if ("allergy".equals(codeString))
322          return ALLERGY;
323        if ("intolerance".equals(codeString))
324          return INTOLERANCE;
325        if (Configuration.isAcceptInvalidEnums())
326          return null;
327        else
328          throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
329        }
330        public String toCode() {
331          switch (this) {
332            case ALLERGY: return "allergy";
333            case INTOLERANCE: return "intolerance";
334            default: return "?";
335          }
336        }
337        public String getSystem() {
338          switch (this) {
339            case ALLERGY: return "http://hl7.org/fhir/allergy-intolerance-type";
340            case INTOLERANCE: return "http://hl7.org/fhir/allergy-intolerance-type";
341            default: return "?";
342          }
343        }
344        public String getDefinition() {
345          switch (this) {
346            case ALLERGY: return "A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other \"allergy-like\" reactions, including pseudoallergy.";
347            case INTOLERANCE: return "A propensity for adverse reactions to a substance that is not judged to be allergic or \"allergy-like\".  These reactions are typically (but not necessarily) non-immune.  They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).";
348            default: return "?";
349          }
350        }
351        public String getDisplay() {
352          switch (this) {
353            case ALLERGY: return "Allergy";
354            case INTOLERANCE: return "Intolerance";
355            default: return "?";
356          }
357        }
358    }
359
360  public static class AllergyIntoleranceTypeEnumFactory implements EnumFactory<AllergyIntoleranceType> {
361    public AllergyIntoleranceType fromCode(String codeString) throws IllegalArgumentException {
362      if (codeString == null || "".equals(codeString))
363            if (codeString == null || "".equals(codeString))
364                return null;
365        if ("allergy".equals(codeString))
366          return AllergyIntoleranceType.ALLERGY;
367        if ("intolerance".equals(codeString))
368          return AllergyIntoleranceType.INTOLERANCE;
369        throw new IllegalArgumentException("Unknown AllergyIntoleranceType code '"+codeString+"'");
370        }
371        public Enumeration<AllergyIntoleranceType> fromType(Base code) throws FHIRException {
372          if (code == null)
373            return null;
374          if (code.isEmpty())
375            return new Enumeration<AllergyIntoleranceType>(this);
376          String codeString = ((PrimitiveType) code).asStringValue();
377          if (codeString == null || "".equals(codeString))
378            return null;
379        if ("allergy".equals(codeString))
380          return new Enumeration<AllergyIntoleranceType>(this, AllergyIntoleranceType.ALLERGY);
381        if ("intolerance".equals(codeString))
382          return new Enumeration<AllergyIntoleranceType>(this, AllergyIntoleranceType.INTOLERANCE);
383        throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
384        }
385    public String toCode(AllergyIntoleranceType code) {
386      if (code == AllergyIntoleranceType.ALLERGY)
387        return "allergy";
388      if (code == AllergyIntoleranceType.INTOLERANCE)
389        return "intolerance";
390      return "?";
391      }
392    public String toSystem(AllergyIntoleranceType code) {
393      return code.getSystem();
394      }
395    }
396
397    public enum AllergyIntoleranceCategory {
398        /**
399         * Any substance consumed to provide nutritional support for the body.
400         */
401        FOOD, 
402        /**
403         * Substances administered to achieve a physiological effect.
404         */
405        MEDICATION, 
406        /**
407         * Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.
408         */
409        ENVIRONMENT, 
410        /**
411         * A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies.  There are other biologic products, such as tissues, that are not typically associated with allergies.
412         */
413        BIOLOGIC, 
414        /**
415         * added to help the parsers with the generic types
416         */
417        NULL;
418        public static AllergyIntoleranceCategory fromCode(String codeString) throws FHIRException {
419            if (codeString == null || "".equals(codeString))
420                return null;
421        if ("food".equals(codeString))
422          return FOOD;
423        if ("medication".equals(codeString))
424          return MEDICATION;
425        if ("environment".equals(codeString))
426          return ENVIRONMENT;
427        if ("biologic".equals(codeString))
428          return BIOLOGIC;
429        if (Configuration.isAcceptInvalidEnums())
430          return null;
431        else
432          throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
433        }
434        public String toCode() {
435          switch (this) {
436            case FOOD: return "food";
437            case MEDICATION: return "medication";
438            case ENVIRONMENT: return "environment";
439            case BIOLOGIC: return "biologic";
440            default: return "?";
441          }
442        }
443        public String getSystem() {
444          switch (this) {
445            case FOOD: return "http://hl7.org/fhir/allergy-intolerance-category";
446            case MEDICATION: return "http://hl7.org/fhir/allergy-intolerance-category";
447            case ENVIRONMENT: return "http://hl7.org/fhir/allergy-intolerance-category";
448            case BIOLOGIC: return "http://hl7.org/fhir/allergy-intolerance-category";
449            default: return "?";
450          }
451        }
452        public String getDefinition() {
453          switch (this) {
454            case FOOD: return "Any substance consumed to provide nutritional support for the body.";
455            case MEDICATION: return "Substances administered to achieve a physiological effect.";
456            case ENVIRONMENT: return "Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.";
457            case BIOLOGIC: return "A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies.  There are other biologic products, such as tissues, that are not typically associated with allergies.";
458            default: return "?";
459          }
460        }
461        public String getDisplay() {
462          switch (this) {
463            case FOOD: return "Food";
464            case MEDICATION: return "Medication";
465            case ENVIRONMENT: return "Environment";
466            case BIOLOGIC: return "Biologic";
467            default: return "?";
468          }
469        }
470    }
471
472  public static class AllergyIntoleranceCategoryEnumFactory implements EnumFactory<AllergyIntoleranceCategory> {
473    public AllergyIntoleranceCategory fromCode(String codeString) throws IllegalArgumentException {
474      if (codeString == null || "".equals(codeString))
475            if (codeString == null || "".equals(codeString))
476                return null;
477        if ("food".equals(codeString))
478          return AllergyIntoleranceCategory.FOOD;
479        if ("medication".equals(codeString))
480          return AllergyIntoleranceCategory.MEDICATION;
481        if ("environment".equals(codeString))
482          return AllergyIntoleranceCategory.ENVIRONMENT;
483        if ("biologic".equals(codeString))
484          return AllergyIntoleranceCategory.BIOLOGIC;
485        throw new IllegalArgumentException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
486        }
487        public Enumeration<AllergyIntoleranceCategory> fromType(Base code) throws FHIRException {
488          if (code == null)
489            return null;
490          if (code.isEmpty())
491            return new Enumeration<AllergyIntoleranceCategory>(this);
492          String codeString = ((PrimitiveType) code).asStringValue();
493          if (codeString == null || "".equals(codeString))
494            return null;
495        if ("food".equals(codeString))
496          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.FOOD);
497        if ("medication".equals(codeString))
498          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.MEDICATION);
499        if ("environment".equals(codeString))
500          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.ENVIRONMENT);
501        if ("biologic".equals(codeString))
502          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.BIOLOGIC);
503        throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
504        }
505    public String toCode(AllergyIntoleranceCategory code) {
506      if (code == AllergyIntoleranceCategory.FOOD)
507        return "food";
508      if (code == AllergyIntoleranceCategory.MEDICATION)
509        return "medication";
510      if (code == AllergyIntoleranceCategory.ENVIRONMENT)
511        return "environment";
512      if (code == AllergyIntoleranceCategory.BIOLOGIC)
513        return "biologic";
514      return "?";
515      }
516    public String toSystem(AllergyIntoleranceCategory code) {
517      return code.getSystem();
518      }
519    }
520
521    public enum AllergyIntoleranceCriticality {
522        /**
523         * Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.
524         */
525        LOW, 
526        /**
527         * Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.
528         */
529        HIGH, 
530        /**
531         * Unable to assess the worst case result of a future exposure.
532         */
533        UNABLETOASSESS, 
534        /**
535         * added to help the parsers with the generic types
536         */
537        NULL;
538        public static AllergyIntoleranceCriticality fromCode(String codeString) throws FHIRException {
539            if (codeString == null || "".equals(codeString))
540                return null;
541        if ("low".equals(codeString))
542          return LOW;
543        if ("high".equals(codeString))
544          return HIGH;
545        if ("unable-to-assess".equals(codeString))
546          return UNABLETOASSESS;
547        if (Configuration.isAcceptInvalidEnums())
548          return null;
549        else
550          throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
551        }
552        public String toCode() {
553          switch (this) {
554            case LOW: return "low";
555            case HIGH: return "high";
556            case UNABLETOASSESS: return "unable-to-assess";
557            default: return "?";
558          }
559        }
560        public String getSystem() {
561          switch (this) {
562            case LOW: return "http://hl7.org/fhir/allergy-intolerance-criticality";
563            case HIGH: return "http://hl7.org/fhir/allergy-intolerance-criticality";
564            case UNABLETOASSESS: return "http://hl7.org/fhir/allergy-intolerance-criticality";
565            default: return "?";
566          }
567        }
568        public String getDefinition() {
569          switch (this) {
570            case LOW: return "Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.";
571            case HIGH: return "Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.";
572            case UNABLETOASSESS: return "Unable to assess the worst case result of a future exposure.";
573            default: return "?";
574          }
575        }
576        public String getDisplay() {
577          switch (this) {
578            case LOW: return "Low Risk";
579            case HIGH: return "High Risk";
580            case UNABLETOASSESS: return "Unable to Assess Risk";
581            default: return "?";
582          }
583        }
584    }
585
586  public static class AllergyIntoleranceCriticalityEnumFactory implements EnumFactory<AllergyIntoleranceCriticality> {
587    public AllergyIntoleranceCriticality fromCode(String codeString) throws IllegalArgumentException {
588      if (codeString == null || "".equals(codeString))
589            if (codeString == null || "".equals(codeString))
590                return null;
591        if ("low".equals(codeString))
592          return AllergyIntoleranceCriticality.LOW;
593        if ("high".equals(codeString))
594          return AllergyIntoleranceCriticality.HIGH;
595        if ("unable-to-assess".equals(codeString))
596          return AllergyIntoleranceCriticality.UNABLETOASSESS;
597        throw new IllegalArgumentException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
598        }
599        public Enumeration<AllergyIntoleranceCriticality> fromType(Base code) throws FHIRException {
600          if (code == null)
601            return null;
602          if (code.isEmpty())
603            return new Enumeration<AllergyIntoleranceCriticality>(this);
604          String codeString = ((PrimitiveType) code).asStringValue();
605          if (codeString == null || "".equals(codeString))
606            return null;
607        if ("low".equals(codeString))
608          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.LOW);
609        if ("high".equals(codeString))
610          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.HIGH);
611        if ("unable-to-assess".equals(codeString))
612          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.UNABLETOASSESS);
613        throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
614        }
615    public String toCode(AllergyIntoleranceCriticality code) {
616      if (code == AllergyIntoleranceCriticality.LOW)
617        return "low";
618      if (code == AllergyIntoleranceCriticality.HIGH)
619        return "high";
620      if (code == AllergyIntoleranceCriticality.UNABLETOASSESS)
621        return "unable-to-assess";
622      return "?";
623      }
624    public String toSystem(AllergyIntoleranceCriticality code) {
625      return code.getSystem();
626      }
627    }
628
629    public enum AllergyIntoleranceSeverity {
630        /**
631         * Causes mild physiological effects.
632         */
633        MILD, 
634        /**
635         * Causes moderate physiological effects.
636         */
637        MODERATE, 
638        /**
639         * Causes severe physiological effects.
640         */
641        SEVERE, 
642        /**
643         * added to help the parsers with the generic types
644         */
645        NULL;
646        public static AllergyIntoleranceSeverity fromCode(String codeString) throws FHIRException {
647            if (codeString == null || "".equals(codeString))
648                return null;
649        if ("mild".equals(codeString))
650          return MILD;
651        if ("moderate".equals(codeString))
652          return MODERATE;
653        if ("severe".equals(codeString))
654          return SEVERE;
655        if (Configuration.isAcceptInvalidEnums())
656          return null;
657        else
658          throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
659        }
660        public String toCode() {
661          switch (this) {
662            case MILD: return "mild";
663            case MODERATE: return "moderate";
664            case SEVERE: return "severe";
665            default: return "?";
666          }
667        }
668        public String getSystem() {
669          switch (this) {
670            case MILD: return "http://hl7.org/fhir/reaction-event-severity";
671            case MODERATE: return "http://hl7.org/fhir/reaction-event-severity";
672            case SEVERE: return "http://hl7.org/fhir/reaction-event-severity";
673            default: return "?";
674          }
675        }
676        public String getDefinition() {
677          switch (this) {
678            case MILD: return "Causes mild physiological effects.";
679            case MODERATE: return "Causes moderate physiological effects.";
680            case SEVERE: return "Causes severe physiological effects.";
681            default: return "?";
682          }
683        }
684        public String getDisplay() {
685          switch (this) {
686            case MILD: return "Mild";
687            case MODERATE: return "Moderate";
688            case SEVERE: return "Severe";
689            default: return "?";
690          }
691        }
692    }
693
694  public static class AllergyIntoleranceSeverityEnumFactory implements EnumFactory<AllergyIntoleranceSeverity> {
695    public AllergyIntoleranceSeverity fromCode(String codeString) throws IllegalArgumentException {
696      if (codeString == null || "".equals(codeString))
697            if (codeString == null || "".equals(codeString))
698                return null;
699        if ("mild".equals(codeString))
700          return AllergyIntoleranceSeverity.MILD;
701        if ("moderate".equals(codeString))
702          return AllergyIntoleranceSeverity.MODERATE;
703        if ("severe".equals(codeString))
704          return AllergyIntoleranceSeverity.SEVERE;
705        throw new IllegalArgumentException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
706        }
707        public Enumeration<AllergyIntoleranceSeverity> fromType(Base code) throws FHIRException {
708          if (code == null)
709            return null;
710          if (code.isEmpty())
711            return new Enumeration<AllergyIntoleranceSeverity>(this);
712          String codeString = ((PrimitiveType) code).asStringValue();
713          if (codeString == null || "".equals(codeString))
714            return null;
715        if ("mild".equals(codeString))
716          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.MILD);
717        if ("moderate".equals(codeString))
718          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.MODERATE);
719        if ("severe".equals(codeString))
720          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.SEVERE);
721        throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
722        }
723    public String toCode(AllergyIntoleranceSeverity code) {
724      if (code == AllergyIntoleranceSeverity.MILD)
725        return "mild";
726      if (code == AllergyIntoleranceSeverity.MODERATE)
727        return "moderate";
728      if (code == AllergyIntoleranceSeverity.SEVERE)
729        return "severe";
730      return "?";
731      }
732    public String toSystem(AllergyIntoleranceSeverity code) {
733      return code.getSystem();
734      }
735    }
736
737    @Block()
738    public static class AllergyIntoleranceReactionComponent extends BackboneElement implements IBaseBackboneElement {
739        /**
740         * Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'.
741         */
742        @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
743        @Description(shortDefinition="Specific substance or pharmaceutical product considered to be responsible for event", formalDefinition="Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'." )
744        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-code")
745        protected CodeableConcept substance;
746
747        /**
748         * Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.
749         */
750        @Child(name = "manifestation", type = {CodeableConcept.class}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
751        @Description(shortDefinition="Clinical symptoms/signs associated with the Event", formalDefinition="Clinical symptoms and/or signs that are observed or associated with the adverse reaction event." )
752        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
753        protected List<CodeableConcept> manifestation;
754
755        /**
756         * Text description about the reaction as a whole, including details of the manifestation if required.
757         */
758        @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
759        @Description(shortDefinition="Description of the event as a whole", formalDefinition="Text description about the reaction as a whole, including details of the manifestation if required." )
760        protected StringType description;
761
762        /**
763         * Record of the date and/or time of the onset of the Reaction.
764         */
765        @Child(name = "onset", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
766        @Description(shortDefinition="Date(/time) when manifestations showed", formalDefinition="Record of the date and/or time of the onset of the Reaction." )
767        protected DateTimeType onset;
768
769        /**
770         * Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
771         */
772        @Child(name = "severity", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
773        @Description(shortDefinition="mild | moderate | severe (of event as a whole)", formalDefinition="Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations." )
774        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reaction-event-severity")
775        protected Enumeration<AllergyIntoleranceSeverity> severity;
776
777        /**
778         * Identification of the route by which the subject was exposed to the substance.
779         */
780        @Child(name = "exposureRoute", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
781        @Description(shortDefinition="How the subject was exposed to the substance", formalDefinition="Identification of the route by which the subject was exposed to the substance." )
782        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/route-codes")
783        protected CodeableConcept exposureRoute;
784
785        /**
786         * Additional text about the adverse reaction event not captured in other fields.
787         */
788        @Child(name = "note", type = {Annotation.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
789        @Description(shortDefinition="Text about event not captured in other fields", formalDefinition="Additional text about the adverse reaction event not captured in other fields." )
790        protected List<Annotation> note;
791
792        private static final long serialVersionUID = -752118516L;
793
794    /**
795     * Constructor
796     */
797      public AllergyIntoleranceReactionComponent() {
798        super();
799      }
800
801        /**
802         * @return {@link #substance} (Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'.)
803         */
804        public CodeableConcept getSubstance() { 
805          if (this.substance == null)
806            if (Configuration.errorOnAutoCreate())
807              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.substance");
808            else if (Configuration.doAutoCreate())
809              this.substance = new CodeableConcept(); // cc
810          return this.substance;
811        }
812
813        public boolean hasSubstance() { 
814          return this.substance != null && !this.substance.isEmpty();
815        }
816
817        /**
818         * @param value {@link #substance} (Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'.)
819         */
820        public AllergyIntoleranceReactionComponent setSubstance(CodeableConcept value)  { 
821          this.substance = value;
822          return this;
823        }
824
825        /**
826         * @return {@link #manifestation} (Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.)
827         */
828        public List<CodeableConcept> getManifestation() { 
829          if (this.manifestation == null)
830            this.manifestation = new ArrayList<CodeableConcept>();
831          return this.manifestation;
832        }
833
834        /**
835         * @return Returns a reference to <code>this</code> for easy method chaining
836         */
837        public AllergyIntoleranceReactionComponent setManifestation(List<CodeableConcept> theManifestation) { 
838          this.manifestation = theManifestation;
839          return this;
840        }
841
842        public boolean hasManifestation() { 
843          if (this.manifestation == null)
844            return false;
845          for (CodeableConcept item : this.manifestation)
846            if (!item.isEmpty())
847              return true;
848          return false;
849        }
850
851        public CodeableConcept addManifestation() { //3
852          CodeableConcept t = new CodeableConcept();
853          if (this.manifestation == null)
854            this.manifestation = new ArrayList<CodeableConcept>();
855          this.manifestation.add(t);
856          return t;
857        }
858
859        public AllergyIntoleranceReactionComponent addManifestation(CodeableConcept t) { //3
860          if (t == null)
861            return this;
862          if (this.manifestation == null)
863            this.manifestation = new ArrayList<CodeableConcept>();
864          this.manifestation.add(t);
865          return this;
866        }
867
868        /**
869         * @return The first repetition of repeating field {@link #manifestation}, creating it if it does not already exist
870         */
871        public CodeableConcept getManifestationFirstRep() { 
872          if (getManifestation().isEmpty()) {
873            addManifestation();
874          }
875          return getManifestation().get(0);
876        }
877
878        /**
879         * @return {@link #description} (Text description about the reaction as a whole, including details of the manifestation if required.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
880         */
881        public StringType getDescriptionElement() { 
882          if (this.description == null)
883            if (Configuration.errorOnAutoCreate())
884              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.description");
885            else if (Configuration.doAutoCreate())
886              this.description = new StringType(); // bb
887          return this.description;
888        }
889
890        public boolean hasDescriptionElement() { 
891          return this.description != null && !this.description.isEmpty();
892        }
893
894        public boolean hasDescription() { 
895          return this.description != null && !this.description.isEmpty();
896        }
897
898        /**
899         * @param value {@link #description} (Text description about the reaction as a whole, including details of the manifestation if required.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
900         */
901        public AllergyIntoleranceReactionComponent setDescriptionElement(StringType value) { 
902          this.description = value;
903          return this;
904        }
905
906        /**
907         * @return Text description about the reaction as a whole, including details of the manifestation if required.
908         */
909        public String getDescription() { 
910          return this.description == null ? null : this.description.getValue();
911        }
912
913        /**
914         * @param value Text description about the reaction as a whole, including details of the manifestation if required.
915         */
916        public AllergyIntoleranceReactionComponent setDescription(String value) { 
917          if (Utilities.noString(value))
918            this.description = null;
919          else {
920            if (this.description == null)
921              this.description = new StringType();
922            this.description.setValue(value);
923          }
924          return this;
925        }
926
927        /**
928         * @return {@link #onset} (Record of the date and/or time of the onset of the Reaction.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
929         */
930        public DateTimeType getOnsetElement() { 
931          if (this.onset == null)
932            if (Configuration.errorOnAutoCreate())
933              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.onset");
934            else if (Configuration.doAutoCreate())
935              this.onset = new DateTimeType(); // bb
936          return this.onset;
937        }
938
939        public boolean hasOnsetElement() { 
940          return this.onset != null && !this.onset.isEmpty();
941        }
942
943        public boolean hasOnset() { 
944          return this.onset != null && !this.onset.isEmpty();
945        }
946
947        /**
948         * @param value {@link #onset} (Record of the date and/or time of the onset of the Reaction.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
949         */
950        public AllergyIntoleranceReactionComponent setOnsetElement(DateTimeType value) { 
951          this.onset = value;
952          return this;
953        }
954
955        /**
956         * @return Record of the date and/or time of the onset of the Reaction.
957         */
958        public Date getOnset() { 
959          return this.onset == null ? null : this.onset.getValue();
960        }
961
962        /**
963         * @param value Record of the date and/or time of the onset of the Reaction.
964         */
965        public AllergyIntoleranceReactionComponent setOnset(Date value) { 
966          if (value == null)
967            this.onset = null;
968          else {
969            if (this.onset == null)
970              this.onset = new DateTimeType();
971            this.onset.setValue(value);
972          }
973          return this;
974        }
975
976        /**
977         * @return {@link #severity} (Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
978         */
979        public Enumeration<AllergyIntoleranceSeverity> getSeverityElement() { 
980          if (this.severity == null)
981            if (Configuration.errorOnAutoCreate())
982              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.severity");
983            else if (Configuration.doAutoCreate())
984              this.severity = new Enumeration<AllergyIntoleranceSeverity>(new AllergyIntoleranceSeverityEnumFactory()); // bb
985          return this.severity;
986        }
987
988        public boolean hasSeverityElement() { 
989          return this.severity != null && !this.severity.isEmpty();
990        }
991
992        public boolean hasSeverity() { 
993          return this.severity != null && !this.severity.isEmpty();
994        }
995
996        /**
997         * @param value {@link #severity} (Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
998         */
999        public AllergyIntoleranceReactionComponent setSeverityElement(Enumeration<AllergyIntoleranceSeverity> value) { 
1000          this.severity = value;
1001          return this;
1002        }
1003
1004        /**
1005         * @return Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
1006         */
1007        public AllergyIntoleranceSeverity getSeverity() { 
1008          return this.severity == null ? null : this.severity.getValue();
1009        }
1010
1011        /**
1012         * @param value Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
1013         */
1014        public AllergyIntoleranceReactionComponent setSeverity(AllergyIntoleranceSeverity value) { 
1015          if (value == null)
1016            this.severity = null;
1017          else {
1018            if (this.severity == null)
1019              this.severity = new Enumeration<AllergyIntoleranceSeverity>(new AllergyIntoleranceSeverityEnumFactory());
1020            this.severity.setValue(value);
1021          }
1022          return this;
1023        }
1024
1025        /**
1026         * @return {@link #exposureRoute} (Identification of the route by which the subject was exposed to the substance.)
1027         */
1028        public CodeableConcept getExposureRoute() { 
1029          if (this.exposureRoute == null)
1030            if (Configuration.errorOnAutoCreate())
1031              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.exposureRoute");
1032            else if (Configuration.doAutoCreate())
1033              this.exposureRoute = new CodeableConcept(); // cc
1034          return this.exposureRoute;
1035        }
1036
1037        public boolean hasExposureRoute() { 
1038          return this.exposureRoute != null && !this.exposureRoute.isEmpty();
1039        }
1040
1041        /**
1042         * @param value {@link #exposureRoute} (Identification of the route by which the subject was exposed to the substance.)
1043         */
1044        public AllergyIntoleranceReactionComponent setExposureRoute(CodeableConcept value)  { 
1045          this.exposureRoute = value;
1046          return this;
1047        }
1048
1049        /**
1050         * @return {@link #note} (Additional text about the adverse reaction event not captured in other fields.)
1051         */
1052        public List<Annotation> getNote() { 
1053          if (this.note == null)
1054            this.note = new ArrayList<Annotation>();
1055          return this.note;
1056        }
1057
1058        /**
1059         * @return Returns a reference to <code>this</code> for easy method chaining
1060         */
1061        public AllergyIntoleranceReactionComponent setNote(List<Annotation> theNote) { 
1062          this.note = theNote;
1063          return this;
1064        }
1065
1066        public boolean hasNote() { 
1067          if (this.note == null)
1068            return false;
1069          for (Annotation item : this.note)
1070            if (!item.isEmpty())
1071              return true;
1072          return false;
1073        }
1074
1075        public Annotation addNote() { //3
1076          Annotation t = new Annotation();
1077          if (this.note == null)
1078            this.note = new ArrayList<Annotation>();
1079          this.note.add(t);
1080          return t;
1081        }
1082
1083        public AllergyIntoleranceReactionComponent addNote(Annotation t) { //3
1084          if (t == null)
1085            return this;
1086          if (this.note == null)
1087            this.note = new ArrayList<Annotation>();
1088          this.note.add(t);
1089          return this;
1090        }
1091
1092        /**
1093         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1094         */
1095        public Annotation getNoteFirstRep() { 
1096          if (getNote().isEmpty()) {
1097            addNote();
1098          }
1099          return getNote().get(0);
1100        }
1101
1102        protected void listChildren(List<Property> children) {
1103          super.listChildren(children);
1104          children.add(new Property("substance", "CodeableConcept", "Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'.", 0, 1, substance));
1105          children.add(new Property("manifestation", "CodeableConcept", "Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.", 0, java.lang.Integer.MAX_VALUE, manifestation));
1106          children.add(new Property("description", "string", "Text description about the reaction as a whole, including details of the manifestation if required.", 0, 1, description));
1107          children.add(new Property("onset", "dateTime", "Record of the date and/or time of the onset of the Reaction.", 0, 1, onset));
1108          children.add(new Property("severity", "code", "Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.", 0, 1, severity));
1109          children.add(new Property("exposureRoute", "CodeableConcept", "Identification of the route by which the subject was exposed to the substance.", 0, 1, exposureRoute));
1110          children.add(new Property("note", "Annotation", "Additional text about the adverse reaction event not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note));
1111        }
1112
1113        @Override
1114        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1115          switch (_hash) {
1116          case 530040176: /*substance*/  return new Property("substance", "CodeableConcept", "Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'.", 0, 1, substance);
1117          case 1115984422: /*manifestation*/  return new Property("manifestation", "CodeableConcept", "Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.", 0, java.lang.Integer.MAX_VALUE, manifestation);
1118          case -1724546052: /*description*/  return new Property("description", "string", "Text description about the reaction as a whole, including details of the manifestation if required.", 0, 1, description);
1119          case 105901603: /*onset*/  return new Property("onset", "dateTime", "Record of the date and/or time of the onset of the Reaction.", 0, 1, onset);
1120          case 1478300413: /*severity*/  return new Property("severity", "code", "Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.", 0, 1, severity);
1121          case 421286274: /*exposureRoute*/  return new Property("exposureRoute", "CodeableConcept", "Identification of the route by which the subject was exposed to the substance.", 0, 1, exposureRoute);
1122          case 3387378: /*note*/  return new Property("note", "Annotation", "Additional text about the adverse reaction event not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note);
1123          default: return super.getNamedProperty(_hash, _name, _checkValid);
1124          }
1125
1126        }
1127
1128      @Override
1129      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1130        switch (hash) {
1131        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept
1132        case 1115984422: /*manifestation*/ return this.manifestation == null ? new Base[0] : this.manifestation.toArray(new Base[this.manifestation.size()]); // CodeableConcept
1133        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1134        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // DateTimeType
1135        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<AllergyIntoleranceSeverity>
1136        case 421286274: /*exposureRoute*/ return this.exposureRoute == null ? new Base[0] : new Base[] {this.exposureRoute}; // CodeableConcept
1137        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1138        default: return super.getProperty(hash, name, checkValid);
1139        }
1140
1141      }
1142
1143      @Override
1144      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1145        switch (hash) {
1146        case 530040176: // substance
1147          this.substance = castToCodeableConcept(value); // CodeableConcept
1148          return value;
1149        case 1115984422: // manifestation
1150          this.getManifestation().add(castToCodeableConcept(value)); // CodeableConcept
1151          return value;
1152        case -1724546052: // description
1153          this.description = castToString(value); // StringType
1154          return value;
1155        case 105901603: // onset
1156          this.onset = castToDateTime(value); // DateTimeType
1157          return value;
1158        case 1478300413: // severity
1159          value = new AllergyIntoleranceSeverityEnumFactory().fromType(castToCode(value));
1160          this.severity = (Enumeration) value; // Enumeration<AllergyIntoleranceSeverity>
1161          return value;
1162        case 421286274: // exposureRoute
1163          this.exposureRoute = castToCodeableConcept(value); // CodeableConcept
1164          return value;
1165        case 3387378: // note
1166          this.getNote().add(castToAnnotation(value)); // Annotation
1167          return value;
1168        default: return super.setProperty(hash, name, value);
1169        }
1170
1171      }
1172
1173      @Override
1174      public Base setProperty(String name, Base value) throws FHIRException {
1175        if (name.equals("substance")) {
1176          this.substance = castToCodeableConcept(value); // CodeableConcept
1177        } else if (name.equals("manifestation")) {
1178          this.getManifestation().add(castToCodeableConcept(value));
1179        } else if (name.equals("description")) {
1180          this.description = castToString(value); // StringType
1181        } else if (name.equals("onset")) {
1182          this.onset = castToDateTime(value); // DateTimeType
1183        } else if (name.equals("severity")) {
1184          value = new AllergyIntoleranceSeverityEnumFactory().fromType(castToCode(value));
1185          this.severity = (Enumeration) value; // Enumeration<AllergyIntoleranceSeverity>
1186        } else if (name.equals("exposureRoute")) {
1187          this.exposureRoute = castToCodeableConcept(value); // CodeableConcept
1188        } else if (name.equals("note")) {
1189          this.getNote().add(castToAnnotation(value));
1190        } else
1191          return super.setProperty(name, value);
1192        return value;
1193      }
1194
1195      @Override
1196      public Base makeProperty(int hash, String name) throws FHIRException {
1197        switch (hash) {
1198        case 530040176:  return getSubstance(); 
1199        case 1115984422:  return addManifestation(); 
1200        case -1724546052:  return getDescriptionElement();
1201        case 105901603:  return getOnsetElement();
1202        case 1478300413:  return getSeverityElement();
1203        case 421286274:  return getExposureRoute(); 
1204        case 3387378:  return addNote(); 
1205        default: return super.makeProperty(hash, name);
1206        }
1207
1208      }
1209
1210      @Override
1211      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1212        switch (hash) {
1213        case 530040176: /*substance*/ return new String[] {"CodeableConcept"};
1214        case 1115984422: /*manifestation*/ return new String[] {"CodeableConcept"};
1215        case -1724546052: /*description*/ return new String[] {"string"};
1216        case 105901603: /*onset*/ return new String[] {"dateTime"};
1217        case 1478300413: /*severity*/ return new String[] {"code"};
1218        case 421286274: /*exposureRoute*/ return new String[] {"CodeableConcept"};
1219        case 3387378: /*note*/ return new String[] {"Annotation"};
1220        default: return super.getTypesForProperty(hash, name);
1221        }
1222
1223      }
1224
1225      @Override
1226      public Base addChild(String name) throws FHIRException {
1227        if (name.equals("substance")) {
1228          this.substance = new CodeableConcept();
1229          return this.substance;
1230        }
1231        else if (name.equals("manifestation")) {
1232          return addManifestation();
1233        }
1234        else if (name.equals("description")) {
1235          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.description");
1236        }
1237        else if (name.equals("onset")) {
1238          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.onset");
1239        }
1240        else if (name.equals("severity")) {
1241          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.severity");
1242        }
1243        else if (name.equals("exposureRoute")) {
1244          this.exposureRoute = new CodeableConcept();
1245          return this.exposureRoute;
1246        }
1247        else if (name.equals("note")) {
1248          return addNote();
1249        }
1250        else
1251          return super.addChild(name);
1252      }
1253
1254      public AllergyIntoleranceReactionComponent copy() {
1255        AllergyIntoleranceReactionComponent dst = new AllergyIntoleranceReactionComponent();
1256        copyValues(dst);
1257        dst.substance = substance == null ? null : substance.copy();
1258        if (manifestation != null) {
1259          dst.manifestation = new ArrayList<CodeableConcept>();
1260          for (CodeableConcept i : manifestation)
1261            dst.manifestation.add(i.copy());
1262        };
1263        dst.description = description == null ? null : description.copy();
1264        dst.onset = onset == null ? null : onset.copy();
1265        dst.severity = severity == null ? null : severity.copy();
1266        dst.exposureRoute = exposureRoute == null ? null : exposureRoute.copy();
1267        if (note != null) {
1268          dst.note = new ArrayList<Annotation>();
1269          for (Annotation i : note)
1270            dst.note.add(i.copy());
1271        };
1272        return dst;
1273      }
1274
1275      @Override
1276      public boolean equalsDeep(Base other_) {
1277        if (!super.equalsDeep(other_))
1278          return false;
1279        if (!(other_ instanceof AllergyIntoleranceReactionComponent))
1280          return false;
1281        AllergyIntoleranceReactionComponent o = (AllergyIntoleranceReactionComponent) other_;
1282        return compareDeep(substance, o.substance, true) && compareDeep(manifestation, o.manifestation, true)
1283           && compareDeep(description, o.description, true) && compareDeep(onset, o.onset, true) && compareDeep(severity, o.severity, true)
1284           && compareDeep(exposureRoute, o.exposureRoute, true) && compareDeep(note, o.note, true);
1285      }
1286
1287      @Override
1288      public boolean equalsShallow(Base other_) {
1289        if (!super.equalsShallow(other_))
1290          return false;
1291        if (!(other_ instanceof AllergyIntoleranceReactionComponent))
1292          return false;
1293        AllergyIntoleranceReactionComponent o = (AllergyIntoleranceReactionComponent) other_;
1294        return compareValues(description, o.description, true) && compareValues(onset, o.onset, true) && compareValues(severity, o.severity, true)
1295          ;
1296      }
1297
1298      public boolean isEmpty() {
1299        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, manifestation, description
1300          , onset, severity, exposureRoute, note);
1301      }
1302
1303  public String fhirType() {
1304    return "AllergyIntolerance.reaction";
1305
1306  }
1307
1308  }
1309
1310    /**
1311     * This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
1312     */
1313    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1314    @Description(shortDefinition="External ids for this item", formalDefinition="This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
1315    protected List<Identifier> identifier;
1316
1317    /**
1318     * The clinical status of the allergy or intolerance.
1319     */
1320    @Child(name = "clinicalStatus", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1321    @Description(shortDefinition="active | inactive | resolved", formalDefinition="The clinical status of the allergy or intolerance." )
1322    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergy-clinical-status")
1323    protected Enumeration<AllergyIntoleranceClinicalStatus> clinicalStatus;
1324
1325    /**
1326     * Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).
1327     */
1328    @Child(name = "verificationStatus", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1329    @Description(shortDefinition="unconfirmed | confirmed | refuted | entered-in-error", formalDefinition="Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product)." )
1330    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergy-verification-status")
1331    protected Enumeration<AllergyIntoleranceVerificationStatus> verificationStatus;
1332
1333    /**
1334     * Identification of the underlying physiological mechanism for the reaction risk.
1335     */
1336    @Child(name = "type", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1337    @Description(shortDefinition="allergy | intolerance - Underlying mechanism (if known)", formalDefinition="Identification of the underlying physiological mechanism for the reaction risk." )
1338    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergy-intolerance-type")
1339    protected Enumeration<AllergyIntoleranceType> type;
1340
1341    /**
1342     * Category of the identified substance.
1343     */
1344    @Child(name = "category", type = {CodeType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1345    @Description(shortDefinition="food | medication | environment | biologic", formalDefinition="Category of the identified substance." )
1346    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergy-intolerance-category")
1347    protected List<Enumeration<AllergyIntoleranceCategory>> category;
1348
1349    /**
1350     * Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.
1351     */
1352    @Child(name = "criticality", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1353    @Description(shortDefinition="low | high | unable-to-assess", formalDefinition="Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance." )
1354    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality")
1355    protected Enumeration<AllergyIntoleranceCriticality> criticality;
1356
1357    /**
1358     * Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., "Latex"), an allergy or intolerance condition (e.g., "Latex allergy"), or a negated/excluded code for a specific substance or class (e.g., "No latex allergy") or a general or categorical negated statement (e.g.,  "No known allergy", "No known drug allergies").
1359     */
1360    @Child(name = "code", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
1361    @Description(shortDefinition="Code that identifies the allergy or intolerance", formalDefinition="Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., \"Latex\"), an allergy or intolerance condition (e.g., \"Latex allergy\"), or a negated/excluded code for a specific substance or class (e.g., \"No latex allergy\") or a general or categorical negated statement (e.g.,  \"No known allergy\", \"No known drug allergies\")." )
1362    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergyintolerance-code")
1363    protected CodeableConcept code;
1364
1365    /**
1366     * The patient who has the allergy or intolerance.
1367     */
1368    @Child(name = "patient", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
1369    @Description(shortDefinition="Who the sensitivity is for", formalDefinition="The patient who has the allergy or intolerance." )
1370    protected Reference patient;
1371
1372    /**
1373     * The actual object that is the target of the reference (The patient who has the allergy or intolerance.)
1374     */
1375    protected Patient patientTarget;
1376
1377    /**
1378     * Estimated or actual date,  date-time, or age when allergy or intolerance was identified.
1379     */
1380    @Child(name = "onset", type = {DateTimeType.class, Age.class, Period.class, Range.class, StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
1381    @Description(shortDefinition="When allergy or intolerance was identified", formalDefinition="Estimated or actual date,  date-time, or age when allergy or intolerance was identified." )
1382    protected Type onset;
1383
1384    /**
1385     * The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.
1386     */
1387    @Child(name = "assertedDate", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1388    @Description(shortDefinition="Date record was believed accurate", formalDefinition="The date on which the existance of the AllergyIntolerance was first asserted or acknowledged." )
1389    protected DateTimeType assertedDate;
1390
1391    /**
1392     * Individual who recorded the record and takes responsibility for its content.
1393     */
1394    @Child(name = "recorder", type = {Practitioner.class, Patient.class}, order=10, min=0, max=1, modifier=false, summary=false)
1395    @Description(shortDefinition="Who recorded the sensitivity", formalDefinition="Individual who recorded the record and takes responsibility for its content." )
1396    protected Reference recorder;
1397
1398    /**
1399     * The actual object that is the target of the reference (Individual who recorded the record and takes responsibility for its content.)
1400     */
1401    protected Resource recorderTarget;
1402
1403    /**
1404     * The source of the information about the allergy that is recorded.
1405     */
1406    @Child(name = "asserter", type = {Patient.class, RelatedPerson.class, Practitioner.class}, order=11, min=0, max=1, modifier=false, summary=true)
1407    @Description(shortDefinition="Source of the information about the allergy", formalDefinition="The source of the information about the allergy that is recorded." )
1408    protected Reference asserter;
1409
1410    /**
1411     * The actual object that is the target of the reference (The source of the information about the allergy that is recorded.)
1412     */
1413    protected Resource asserterTarget;
1414
1415    /**
1416     * Represents the date and/or time of the last known occurrence of a reaction event.
1417     */
1418    @Child(name = "lastOccurrence", type = {DateTimeType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1419    @Description(shortDefinition="Date(/time) of last known occurrence of a reaction", formalDefinition="Represents the date and/or time of the last known occurrence of a reaction event." )
1420    protected DateTimeType lastOccurrence;
1421
1422    /**
1423     * Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.
1424     */
1425    @Child(name = "note", type = {Annotation.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1426    @Description(shortDefinition="Additional text not captured in other fields", formalDefinition="Additional narrative about the propensity for the Adverse Reaction, not captured in other fields." )
1427    protected List<Annotation> note;
1428
1429    /**
1430     * Details about each adverse reaction event linked to exposure to the identified substance.
1431     */
1432    @Child(name = "reaction", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1433    @Description(shortDefinition="Adverse Reaction Events linked to exposure to substance", formalDefinition="Details about each adverse reaction event linked to exposure to the identified substance." )
1434    protected List<AllergyIntoleranceReactionComponent> reaction;
1435
1436    private static final long serialVersionUID = 948924623L;
1437
1438  /**
1439   * Constructor
1440   */
1441    public AllergyIntolerance() {
1442      super();
1443    }
1444
1445  /**
1446   * Constructor
1447   */
1448    public AllergyIntolerance(Enumeration<AllergyIntoleranceVerificationStatus> verificationStatus, Reference patient) {
1449      super();
1450      this.verificationStatus = verificationStatus;
1451      this.patient = patient;
1452    }
1453
1454    /**
1455     * @return {@link #identifier} (This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
1456     */
1457    public List<Identifier> getIdentifier() { 
1458      if (this.identifier == null)
1459        this.identifier = new ArrayList<Identifier>();
1460      return this.identifier;
1461    }
1462
1463    /**
1464     * @return Returns a reference to <code>this</code> for easy method chaining
1465     */
1466    public AllergyIntolerance setIdentifier(List<Identifier> theIdentifier) { 
1467      this.identifier = theIdentifier;
1468      return this;
1469    }
1470
1471    public boolean hasIdentifier() { 
1472      if (this.identifier == null)
1473        return false;
1474      for (Identifier item : this.identifier)
1475        if (!item.isEmpty())
1476          return true;
1477      return false;
1478    }
1479
1480    public Identifier addIdentifier() { //3
1481      Identifier t = new Identifier();
1482      if (this.identifier == null)
1483        this.identifier = new ArrayList<Identifier>();
1484      this.identifier.add(t);
1485      return t;
1486    }
1487
1488    public AllergyIntolerance addIdentifier(Identifier t) { //3
1489      if (t == null)
1490        return this;
1491      if (this.identifier == null)
1492        this.identifier = new ArrayList<Identifier>();
1493      this.identifier.add(t);
1494      return this;
1495    }
1496
1497    /**
1498     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1499     */
1500    public Identifier getIdentifierFirstRep() { 
1501      if (getIdentifier().isEmpty()) {
1502        addIdentifier();
1503      }
1504      return getIdentifier().get(0);
1505    }
1506
1507    /**
1508     * @return {@link #clinicalStatus} (The clinical status of the allergy or intolerance.). This is the underlying object with id, value and extensions. The accessor "getClinicalStatus" gives direct access to the value
1509     */
1510    public Enumeration<AllergyIntoleranceClinicalStatus> getClinicalStatusElement() { 
1511      if (this.clinicalStatus == null)
1512        if (Configuration.errorOnAutoCreate())
1513          throw new Error("Attempt to auto-create AllergyIntolerance.clinicalStatus");
1514        else if (Configuration.doAutoCreate())
1515          this.clinicalStatus = new Enumeration<AllergyIntoleranceClinicalStatus>(new AllergyIntoleranceClinicalStatusEnumFactory()); // bb
1516      return this.clinicalStatus;
1517    }
1518
1519    public boolean hasClinicalStatusElement() { 
1520      return this.clinicalStatus != null && !this.clinicalStatus.isEmpty();
1521    }
1522
1523    public boolean hasClinicalStatus() { 
1524      return this.clinicalStatus != null && !this.clinicalStatus.isEmpty();
1525    }
1526
1527    /**
1528     * @param value {@link #clinicalStatus} (The clinical status of the allergy or intolerance.). This is the underlying object with id, value and extensions. The accessor "getClinicalStatus" gives direct access to the value
1529     */
1530    public AllergyIntolerance setClinicalStatusElement(Enumeration<AllergyIntoleranceClinicalStatus> value) { 
1531      this.clinicalStatus = value;
1532      return this;
1533    }
1534
1535    /**
1536     * @return The clinical status of the allergy or intolerance.
1537     */
1538    public AllergyIntoleranceClinicalStatus getClinicalStatus() { 
1539      return this.clinicalStatus == null ? null : this.clinicalStatus.getValue();
1540    }
1541
1542    /**
1543     * @param value The clinical status of the allergy or intolerance.
1544     */
1545    public AllergyIntolerance setClinicalStatus(AllergyIntoleranceClinicalStatus value) { 
1546      if (value == null)
1547        this.clinicalStatus = null;
1548      else {
1549        if (this.clinicalStatus == null)
1550          this.clinicalStatus = new Enumeration<AllergyIntoleranceClinicalStatus>(new AllergyIntoleranceClinicalStatusEnumFactory());
1551        this.clinicalStatus.setValue(value);
1552      }
1553      return this;
1554    }
1555
1556    /**
1557     * @return {@link #verificationStatus} (Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).). This is the underlying object with id, value and extensions. The accessor "getVerificationStatus" gives direct access to the value
1558     */
1559    public Enumeration<AllergyIntoleranceVerificationStatus> getVerificationStatusElement() { 
1560      if (this.verificationStatus == null)
1561        if (Configuration.errorOnAutoCreate())
1562          throw new Error("Attempt to auto-create AllergyIntolerance.verificationStatus");
1563        else if (Configuration.doAutoCreate())
1564          this.verificationStatus = new Enumeration<AllergyIntoleranceVerificationStatus>(new AllergyIntoleranceVerificationStatusEnumFactory()); // bb
1565      return this.verificationStatus;
1566    }
1567
1568    public boolean hasVerificationStatusElement() { 
1569      return this.verificationStatus != null && !this.verificationStatus.isEmpty();
1570    }
1571
1572    public boolean hasVerificationStatus() { 
1573      return this.verificationStatus != null && !this.verificationStatus.isEmpty();
1574    }
1575
1576    /**
1577     * @param value {@link #verificationStatus} (Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).). This is the underlying object with id, value and extensions. The accessor "getVerificationStatus" gives direct access to the value
1578     */
1579    public AllergyIntolerance setVerificationStatusElement(Enumeration<AllergyIntoleranceVerificationStatus> value) { 
1580      this.verificationStatus = value;
1581      return this;
1582    }
1583
1584    /**
1585     * @return Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).
1586     */
1587    public AllergyIntoleranceVerificationStatus getVerificationStatus() { 
1588      return this.verificationStatus == null ? null : this.verificationStatus.getValue();
1589    }
1590
1591    /**
1592     * @param value Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).
1593     */
1594    public AllergyIntolerance setVerificationStatus(AllergyIntoleranceVerificationStatus value) { 
1595        if (this.verificationStatus == null)
1596          this.verificationStatus = new Enumeration<AllergyIntoleranceVerificationStatus>(new AllergyIntoleranceVerificationStatusEnumFactory());
1597        this.verificationStatus.setValue(value);
1598      return this;
1599    }
1600
1601    /**
1602     * @return {@link #type} (Identification of the underlying physiological mechanism for the reaction risk.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1603     */
1604    public Enumeration<AllergyIntoleranceType> getTypeElement() { 
1605      if (this.type == null)
1606        if (Configuration.errorOnAutoCreate())
1607          throw new Error("Attempt to auto-create AllergyIntolerance.type");
1608        else if (Configuration.doAutoCreate())
1609          this.type = new Enumeration<AllergyIntoleranceType>(new AllergyIntoleranceTypeEnumFactory()); // bb
1610      return this.type;
1611    }
1612
1613    public boolean hasTypeElement() { 
1614      return this.type != null && !this.type.isEmpty();
1615    }
1616
1617    public boolean hasType() { 
1618      return this.type != null && !this.type.isEmpty();
1619    }
1620
1621    /**
1622     * @param value {@link #type} (Identification of the underlying physiological mechanism for the reaction risk.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1623     */
1624    public AllergyIntolerance setTypeElement(Enumeration<AllergyIntoleranceType> value) { 
1625      this.type = value;
1626      return this;
1627    }
1628
1629    /**
1630     * @return Identification of the underlying physiological mechanism for the reaction risk.
1631     */
1632    public AllergyIntoleranceType getType() { 
1633      return this.type == null ? null : this.type.getValue();
1634    }
1635
1636    /**
1637     * @param value Identification of the underlying physiological mechanism for the reaction risk.
1638     */
1639    public AllergyIntolerance setType(AllergyIntoleranceType value) { 
1640      if (value == null)
1641        this.type = null;
1642      else {
1643        if (this.type == null)
1644          this.type = new Enumeration<AllergyIntoleranceType>(new AllergyIntoleranceTypeEnumFactory());
1645        this.type.setValue(value);
1646      }
1647      return this;
1648    }
1649
1650    /**
1651     * @return {@link #category} (Category of the identified substance.)
1652     */
1653    public List<Enumeration<AllergyIntoleranceCategory>> getCategory() { 
1654      if (this.category == null)
1655        this.category = new ArrayList<Enumeration<AllergyIntoleranceCategory>>();
1656      return this.category;
1657    }
1658
1659    /**
1660     * @return Returns a reference to <code>this</code> for easy method chaining
1661     */
1662    public AllergyIntolerance setCategory(List<Enumeration<AllergyIntoleranceCategory>> theCategory) { 
1663      this.category = theCategory;
1664      return this;
1665    }
1666
1667    public boolean hasCategory() { 
1668      if (this.category == null)
1669        return false;
1670      for (Enumeration<AllergyIntoleranceCategory> item : this.category)
1671        if (!item.isEmpty())
1672          return true;
1673      return false;
1674    }
1675
1676    /**
1677     * @return {@link #category} (Category of the identified substance.)
1678     */
1679    public Enumeration<AllergyIntoleranceCategory> addCategoryElement() {//2 
1680      Enumeration<AllergyIntoleranceCategory> t = new Enumeration<AllergyIntoleranceCategory>(new AllergyIntoleranceCategoryEnumFactory());
1681      if (this.category == null)
1682        this.category = new ArrayList<Enumeration<AllergyIntoleranceCategory>>();
1683      this.category.add(t);
1684      return t;
1685    }
1686
1687    /**
1688     * @param value {@link #category} (Category of the identified substance.)
1689     */
1690    public AllergyIntolerance addCategory(AllergyIntoleranceCategory value) { //1
1691      Enumeration<AllergyIntoleranceCategory> t = new Enumeration<AllergyIntoleranceCategory>(new AllergyIntoleranceCategoryEnumFactory());
1692      t.setValue(value);
1693      if (this.category == null)
1694        this.category = new ArrayList<Enumeration<AllergyIntoleranceCategory>>();
1695      this.category.add(t);
1696      return this;
1697    }
1698
1699    /**
1700     * @param value {@link #category} (Category of the identified substance.)
1701     */
1702    public boolean hasCategory(AllergyIntoleranceCategory value) { 
1703      if (this.category == null)
1704        return false;
1705      for (Enumeration<AllergyIntoleranceCategory> v : this.category)
1706        if (v.getValue().equals(value)) // code
1707          return true;
1708      return false;
1709    }
1710
1711    /**
1712     * @return {@link #criticality} (Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.). This is the underlying object with id, value and extensions. The accessor "getCriticality" gives direct access to the value
1713     */
1714    public Enumeration<AllergyIntoleranceCriticality> getCriticalityElement() { 
1715      if (this.criticality == null)
1716        if (Configuration.errorOnAutoCreate())
1717          throw new Error("Attempt to auto-create AllergyIntolerance.criticality");
1718        else if (Configuration.doAutoCreate())
1719          this.criticality = new Enumeration<AllergyIntoleranceCriticality>(new AllergyIntoleranceCriticalityEnumFactory()); // bb
1720      return this.criticality;
1721    }
1722
1723    public boolean hasCriticalityElement() { 
1724      return this.criticality != null && !this.criticality.isEmpty();
1725    }
1726
1727    public boolean hasCriticality() { 
1728      return this.criticality != null && !this.criticality.isEmpty();
1729    }
1730
1731    /**
1732     * @param value {@link #criticality} (Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.). This is the underlying object with id, value and extensions. The accessor "getCriticality" gives direct access to the value
1733     */
1734    public AllergyIntolerance setCriticalityElement(Enumeration<AllergyIntoleranceCriticality> value) { 
1735      this.criticality = value;
1736      return this;
1737    }
1738
1739    /**
1740     * @return Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.
1741     */
1742    public AllergyIntoleranceCriticality getCriticality() { 
1743      return this.criticality == null ? null : this.criticality.getValue();
1744    }
1745
1746    /**
1747     * @param value Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.
1748     */
1749    public AllergyIntolerance setCriticality(AllergyIntoleranceCriticality value) { 
1750      if (value == null)
1751        this.criticality = null;
1752      else {
1753        if (this.criticality == null)
1754          this.criticality = new Enumeration<AllergyIntoleranceCriticality>(new AllergyIntoleranceCriticalityEnumFactory());
1755        this.criticality.setValue(value);
1756      }
1757      return this;
1758    }
1759
1760    /**
1761     * @return {@link #code} (Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., "Latex"), an allergy or intolerance condition (e.g., "Latex allergy"), or a negated/excluded code for a specific substance or class (e.g., "No latex allergy") or a general or categorical negated statement (e.g.,  "No known allergy", "No known drug allergies").)
1762     */
1763    public CodeableConcept getCode() { 
1764      if (this.code == null)
1765        if (Configuration.errorOnAutoCreate())
1766          throw new Error("Attempt to auto-create AllergyIntolerance.code");
1767        else if (Configuration.doAutoCreate())
1768          this.code = new CodeableConcept(); // cc
1769      return this.code;
1770    }
1771
1772    public boolean hasCode() { 
1773      return this.code != null && !this.code.isEmpty();
1774    }
1775
1776    /**
1777     * @param value {@link #code} (Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., "Latex"), an allergy or intolerance condition (e.g., "Latex allergy"), or a negated/excluded code for a specific substance or class (e.g., "No latex allergy") or a general or categorical negated statement (e.g.,  "No known allergy", "No known drug allergies").)
1778     */
1779    public AllergyIntolerance setCode(CodeableConcept value)  { 
1780      this.code = value;
1781      return this;
1782    }
1783
1784    /**
1785     * @return {@link #patient} (The patient who has the allergy or intolerance.)
1786     */
1787    public Reference getPatient() { 
1788      if (this.patient == null)
1789        if (Configuration.errorOnAutoCreate())
1790          throw new Error("Attempt to auto-create AllergyIntolerance.patient");
1791        else if (Configuration.doAutoCreate())
1792          this.patient = new Reference(); // cc
1793      return this.patient;
1794    }
1795
1796    public boolean hasPatient() { 
1797      return this.patient != null && !this.patient.isEmpty();
1798    }
1799
1800    /**
1801     * @param value {@link #patient} (The patient who has the allergy or intolerance.)
1802     */
1803    public AllergyIntolerance setPatient(Reference value)  { 
1804      this.patient = value;
1805      return this;
1806    }
1807
1808    /**
1809     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient who has the allergy or intolerance.)
1810     */
1811    public Patient getPatientTarget() { 
1812      if (this.patientTarget == null)
1813        if (Configuration.errorOnAutoCreate())
1814          throw new Error("Attempt to auto-create AllergyIntolerance.patient");
1815        else if (Configuration.doAutoCreate())
1816          this.patientTarget = new Patient(); // aa
1817      return this.patientTarget;
1818    }
1819
1820    /**
1821     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient who has the allergy or intolerance.)
1822     */
1823    public AllergyIntolerance setPatientTarget(Patient value) { 
1824      this.patientTarget = value;
1825      return this;
1826    }
1827
1828    /**
1829     * @return {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1830     */
1831    public Type getOnset() { 
1832      return this.onset;
1833    }
1834
1835    /**
1836     * @return {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1837     */
1838    public DateTimeType getOnsetDateTimeType() throws FHIRException { 
1839      if (this.onset == null)
1840        return null;
1841      if (!(this.onset instanceof DateTimeType))
1842        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.onset.getClass().getName()+" was encountered");
1843      return (DateTimeType) this.onset;
1844    }
1845
1846    public boolean hasOnsetDateTimeType() { 
1847      return this != null && this.onset instanceof DateTimeType;
1848    }
1849
1850    /**
1851     * @return {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1852     */
1853    public Age getOnsetAge() throws FHIRException { 
1854      if (this.onset == null)
1855        return null;
1856      if (!(this.onset instanceof Age))
1857        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.onset.getClass().getName()+" was encountered");
1858      return (Age) this.onset;
1859    }
1860
1861    public boolean hasOnsetAge() { 
1862      return this != null && this.onset instanceof Age;
1863    }
1864
1865    /**
1866     * @return {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1867     */
1868    public Period getOnsetPeriod() throws FHIRException { 
1869      if (this.onset == null)
1870        return null;
1871      if (!(this.onset instanceof Period))
1872        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.onset.getClass().getName()+" was encountered");
1873      return (Period) this.onset;
1874    }
1875
1876    public boolean hasOnsetPeriod() { 
1877      return this != null && this.onset instanceof Period;
1878    }
1879
1880    /**
1881     * @return {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1882     */
1883    public Range getOnsetRange() throws FHIRException { 
1884      if (this.onset == null)
1885        return null;
1886      if (!(this.onset instanceof Range))
1887        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.onset.getClass().getName()+" was encountered");
1888      return (Range) this.onset;
1889    }
1890
1891    public boolean hasOnsetRange() { 
1892      return this != null && this.onset instanceof Range;
1893    }
1894
1895    /**
1896     * @return {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1897     */
1898    public StringType getOnsetStringType() throws FHIRException { 
1899      if (this.onset == null)
1900        return null;
1901      if (!(this.onset instanceof StringType))
1902        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.onset.getClass().getName()+" was encountered");
1903      return (StringType) this.onset;
1904    }
1905
1906    public boolean hasOnsetStringType() { 
1907      return this != null && this.onset instanceof StringType;
1908    }
1909
1910    public boolean hasOnset() { 
1911      return this.onset != null && !this.onset.isEmpty();
1912    }
1913
1914    /**
1915     * @param value {@link #onset} (Estimated or actual date,  date-time, or age when allergy or intolerance was identified.)
1916     */
1917    public AllergyIntolerance setOnset(Type value) throws FHIRFormatError { 
1918      if (value != null && !(value instanceof DateTimeType || value instanceof Age || value instanceof Period || value instanceof Range || value instanceof StringType))
1919        throw new FHIRFormatError("Not the right type for AllergyIntolerance.onset[x]: "+value.fhirType());
1920      this.onset = value;
1921      return this;
1922    }
1923
1924    /**
1925     * @return {@link #assertedDate} (The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.). This is the underlying object with id, value and extensions. The accessor "getAssertedDate" gives direct access to the value
1926     */
1927    public DateTimeType getAssertedDateElement() { 
1928      if (this.assertedDate == null)
1929        if (Configuration.errorOnAutoCreate())
1930          throw new Error("Attempt to auto-create AllergyIntolerance.assertedDate");
1931        else if (Configuration.doAutoCreate())
1932          this.assertedDate = new DateTimeType(); // bb
1933      return this.assertedDate;
1934    }
1935
1936    public boolean hasAssertedDateElement() { 
1937      return this.assertedDate != null && !this.assertedDate.isEmpty();
1938    }
1939
1940    public boolean hasAssertedDate() { 
1941      return this.assertedDate != null && !this.assertedDate.isEmpty();
1942    }
1943
1944    /**
1945     * @param value {@link #assertedDate} (The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.). This is the underlying object with id, value and extensions. The accessor "getAssertedDate" gives direct access to the value
1946     */
1947    public AllergyIntolerance setAssertedDateElement(DateTimeType value) { 
1948      this.assertedDate = value;
1949      return this;
1950    }
1951
1952    /**
1953     * @return The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.
1954     */
1955    public Date getAssertedDate() { 
1956      return this.assertedDate == null ? null : this.assertedDate.getValue();
1957    }
1958
1959    /**
1960     * @param value The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.
1961     */
1962    public AllergyIntolerance setAssertedDate(Date value) { 
1963      if (value == null)
1964        this.assertedDate = null;
1965      else {
1966        if (this.assertedDate == null)
1967          this.assertedDate = new DateTimeType();
1968        this.assertedDate.setValue(value);
1969      }
1970      return this;
1971    }
1972
1973    /**
1974     * @return {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1975     */
1976    public Reference getRecorder() { 
1977      if (this.recorder == null)
1978        if (Configuration.errorOnAutoCreate())
1979          throw new Error("Attempt to auto-create AllergyIntolerance.recorder");
1980        else if (Configuration.doAutoCreate())
1981          this.recorder = new Reference(); // cc
1982      return this.recorder;
1983    }
1984
1985    public boolean hasRecorder() { 
1986      return this.recorder != null && !this.recorder.isEmpty();
1987    }
1988
1989    /**
1990     * @param value {@link #recorder} (Individual who recorded the record and takes responsibility for its content.)
1991     */
1992    public AllergyIntolerance setRecorder(Reference value)  { 
1993      this.recorder = value;
1994      return this;
1995    }
1996
1997    /**
1998     * @return {@link #recorder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Individual who recorded the record and takes responsibility for its content.)
1999     */
2000    public Resource getRecorderTarget() { 
2001      return this.recorderTarget;
2002    }
2003
2004    /**
2005     * @param value {@link #recorder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Individual who recorded the record and takes responsibility for its content.)
2006     */
2007    public AllergyIntolerance setRecorderTarget(Resource value) { 
2008      this.recorderTarget = value;
2009      return this;
2010    }
2011
2012    /**
2013     * @return {@link #asserter} (The source of the information about the allergy that is recorded.)
2014     */
2015    public Reference getAsserter() { 
2016      if (this.asserter == null)
2017        if (Configuration.errorOnAutoCreate())
2018          throw new Error("Attempt to auto-create AllergyIntolerance.asserter");
2019        else if (Configuration.doAutoCreate())
2020          this.asserter = new Reference(); // cc
2021      return this.asserter;
2022    }
2023
2024    public boolean hasAsserter() { 
2025      return this.asserter != null && !this.asserter.isEmpty();
2026    }
2027
2028    /**
2029     * @param value {@link #asserter} (The source of the information about the allergy that is recorded.)
2030     */
2031    public AllergyIntolerance setAsserter(Reference value)  { 
2032      this.asserter = value;
2033      return this;
2034    }
2035
2036    /**
2037     * @return {@link #asserter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The source of the information about the allergy that is recorded.)
2038     */
2039    public Resource getAsserterTarget() { 
2040      return this.asserterTarget;
2041    }
2042
2043    /**
2044     * @param value {@link #asserter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The source of the information about the allergy that is recorded.)
2045     */
2046    public AllergyIntolerance setAsserterTarget(Resource value) { 
2047      this.asserterTarget = value;
2048      return this;
2049    }
2050
2051    /**
2052     * @return {@link #lastOccurrence} (Represents the date and/or time of the last known occurrence of a reaction event.). This is the underlying object with id, value and extensions. The accessor "getLastOccurrence" gives direct access to the value
2053     */
2054    public DateTimeType getLastOccurrenceElement() { 
2055      if (this.lastOccurrence == null)
2056        if (Configuration.errorOnAutoCreate())
2057          throw new Error("Attempt to auto-create AllergyIntolerance.lastOccurrence");
2058        else if (Configuration.doAutoCreate())
2059          this.lastOccurrence = new DateTimeType(); // bb
2060      return this.lastOccurrence;
2061    }
2062
2063    public boolean hasLastOccurrenceElement() { 
2064      return this.lastOccurrence != null && !this.lastOccurrence.isEmpty();
2065    }
2066
2067    public boolean hasLastOccurrence() { 
2068      return this.lastOccurrence != null && !this.lastOccurrence.isEmpty();
2069    }
2070
2071    /**
2072     * @param value {@link #lastOccurrence} (Represents the date and/or time of the last known occurrence of a reaction event.). This is the underlying object with id, value and extensions. The accessor "getLastOccurrence" gives direct access to the value
2073     */
2074    public AllergyIntolerance setLastOccurrenceElement(DateTimeType value) { 
2075      this.lastOccurrence = value;
2076      return this;
2077    }
2078
2079    /**
2080     * @return Represents the date and/or time of the last known occurrence of a reaction event.
2081     */
2082    public Date getLastOccurrence() { 
2083      return this.lastOccurrence == null ? null : this.lastOccurrence.getValue();
2084    }
2085
2086    /**
2087     * @param value Represents the date and/or time of the last known occurrence of a reaction event.
2088     */
2089    public AllergyIntolerance setLastOccurrence(Date value) { 
2090      if (value == null)
2091        this.lastOccurrence = null;
2092      else {
2093        if (this.lastOccurrence == null)
2094          this.lastOccurrence = new DateTimeType();
2095        this.lastOccurrence.setValue(value);
2096      }
2097      return this;
2098    }
2099
2100    /**
2101     * @return {@link #note} (Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.)
2102     */
2103    public List<Annotation> getNote() { 
2104      if (this.note == null)
2105        this.note = new ArrayList<Annotation>();
2106      return this.note;
2107    }
2108
2109    /**
2110     * @return Returns a reference to <code>this</code> for easy method chaining
2111     */
2112    public AllergyIntolerance setNote(List<Annotation> theNote) { 
2113      this.note = theNote;
2114      return this;
2115    }
2116
2117    public boolean hasNote() { 
2118      if (this.note == null)
2119        return false;
2120      for (Annotation item : this.note)
2121        if (!item.isEmpty())
2122          return true;
2123      return false;
2124    }
2125
2126    public Annotation addNote() { //3
2127      Annotation t = new Annotation();
2128      if (this.note == null)
2129        this.note = new ArrayList<Annotation>();
2130      this.note.add(t);
2131      return t;
2132    }
2133
2134    public AllergyIntolerance addNote(Annotation t) { //3
2135      if (t == null)
2136        return this;
2137      if (this.note == null)
2138        this.note = new ArrayList<Annotation>();
2139      this.note.add(t);
2140      return this;
2141    }
2142
2143    /**
2144     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2145     */
2146    public Annotation getNoteFirstRep() { 
2147      if (getNote().isEmpty()) {
2148        addNote();
2149      }
2150      return getNote().get(0);
2151    }
2152
2153    /**
2154     * @return {@link #reaction} (Details about each adverse reaction event linked to exposure to the identified substance.)
2155     */
2156    public List<AllergyIntoleranceReactionComponent> getReaction() { 
2157      if (this.reaction == null)
2158        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2159      return this.reaction;
2160    }
2161
2162    /**
2163     * @return Returns a reference to <code>this</code> for easy method chaining
2164     */
2165    public AllergyIntolerance setReaction(List<AllergyIntoleranceReactionComponent> theReaction) { 
2166      this.reaction = theReaction;
2167      return this;
2168    }
2169
2170    public boolean hasReaction() { 
2171      if (this.reaction == null)
2172        return false;
2173      for (AllergyIntoleranceReactionComponent item : this.reaction)
2174        if (!item.isEmpty())
2175          return true;
2176      return false;
2177    }
2178
2179    public AllergyIntoleranceReactionComponent addReaction() { //3
2180      AllergyIntoleranceReactionComponent t = new AllergyIntoleranceReactionComponent();
2181      if (this.reaction == null)
2182        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2183      this.reaction.add(t);
2184      return t;
2185    }
2186
2187    public AllergyIntolerance addReaction(AllergyIntoleranceReactionComponent t) { //3
2188      if (t == null)
2189        return this;
2190      if (this.reaction == null)
2191        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2192      this.reaction.add(t);
2193      return this;
2194    }
2195
2196    /**
2197     * @return The first repetition of repeating field {@link #reaction}, creating it if it does not already exist
2198     */
2199    public AllergyIntoleranceReactionComponent getReactionFirstRep() { 
2200      if (getReaction().isEmpty()) {
2201        addReaction();
2202      }
2203      return getReaction().get(0);
2204    }
2205
2206      protected void listChildren(List<Property> children) {
2207        super.listChildren(children);
2208        children.add(new Property("identifier", "Identifier", "This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
2209        children.add(new Property("clinicalStatus", "code", "The clinical status of the allergy or intolerance.", 0, 1, clinicalStatus));
2210        children.add(new Property("verificationStatus", "code", "Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).", 0, 1, verificationStatus));
2211        children.add(new Property("type", "code", "Identification of the underlying physiological mechanism for the reaction risk.", 0, 1, type));
2212        children.add(new Property("category", "code", "Category of the identified substance.", 0, java.lang.Integer.MAX_VALUE, category));
2213        children.add(new Property("criticality", "code", "Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.", 0, 1, criticality));
2214        children.add(new Property("code", "CodeableConcept", "Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., \"Latex\"), an allergy or intolerance condition (e.g., \"Latex allergy\"), or a negated/excluded code for a specific substance or class (e.g., \"No latex allergy\") or a general or categorical negated statement (e.g.,  \"No known allergy\", \"No known drug allergies\").", 0, 1, code));
2215        children.add(new Property("patient", "Reference(Patient)", "The patient who has the allergy or intolerance.", 0, 1, patient));
2216        children.add(new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset));
2217        children.add(new Property("assertedDate", "dateTime", "The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.", 0, 1, assertedDate));
2218        children.add(new Property("recorder", "Reference(Practitioner|Patient)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder));
2219        children.add(new Property("asserter", "Reference(Patient|RelatedPerson|Practitioner)", "The source of the information about the allergy that is recorded.", 0, 1, asserter));
2220        children.add(new Property("lastOccurrence", "dateTime", "Represents the date and/or time of the last known occurrence of a reaction event.", 0, 1, lastOccurrence));
2221        children.add(new Property("note", "Annotation", "Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note));
2222        children.add(new Property("reaction", "", "Details about each adverse reaction event linked to exposure to the identified substance.", 0, java.lang.Integer.MAX_VALUE, reaction));
2223      }
2224
2225      @Override
2226      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2227        switch (_hash) {
2228        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier);
2229        case -462853915: /*clinicalStatus*/  return new Property("clinicalStatus", "code", "The clinical status of the allergy or intolerance.", 0, 1, clinicalStatus);
2230        case -842509843: /*verificationStatus*/  return new Property("verificationStatus", "code", "Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).", 0, 1, verificationStatus);
2231        case 3575610: /*type*/  return new Property("type", "code", "Identification of the underlying physiological mechanism for the reaction risk.", 0, 1, type);
2232        case 50511102: /*category*/  return new Property("category", "code", "Category of the identified substance.", 0, java.lang.Integer.MAX_VALUE, category);
2233        case -1608054609: /*criticality*/  return new Property("criticality", "code", "Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.", 0, 1, criticality);
2234        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., \"Latex\"), an allergy or intolerance condition (e.g., \"Latex allergy\"), or a negated/excluded code for a specific substance or class (e.g., \"No latex allergy\") or a general or categorical negated statement (e.g.,  \"No known allergy\", \"No known drug allergies\").", 0, 1, code);
2235        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient who has the allergy or intolerance.", 0, 1, patient);
2236        case -1886216323: /*onset[x]*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2237        case 105901603: /*onset*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2238        case -1701663010: /*onsetDateTime*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2239        case -1886241828: /*onsetAge*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2240        case -1545082428: /*onsetPeriod*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2241        case -186664742: /*onsetRange*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2242        case -1445342188: /*onsetString*/  return new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date,  date-time, or age when allergy or intolerance was identified.", 0, 1, onset);
2243        case -174231629: /*assertedDate*/  return new Property("assertedDate", "dateTime", "The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.", 0, 1, assertedDate);
2244        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Practitioner|Patient)", "Individual who recorded the record and takes responsibility for its content.", 0, 1, recorder);
2245        case -373242253: /*asserter*/  return new Property("asserter", "Reference(Patient|RelatedPerson|Practitioner)", "The source of the information about the allergy that is recorded.", 0, 1, asserter);
2246        case 1896977671: /*lastOccurrence*/  return new Property("lastOccurrence", "dateTime", "Represents the date and/or time of the last known occurrence of a reaction event.", 0, 1, lastOccurrence);
2247        case 3387378: /*note*/  return new Property("note", "Annotation", "Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note);
2248        case -867509719: /*reaction*/  return new Property("reaction", "", "Details about each adverse reaction event linked to exposure to the identified substance.", 0, java.lang.Integer.MAX_VALUE, reaction);
2249        default: return super.getNamedProperty(_hash, _name, _checkValid);
2250        }
2251
2252      }
2253
2254      @Override
2255      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2256        switch (hash) {
2257        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2258        case -462853915: /*clinicalStatus*/ return this.clinicalStatus == null ? new Base[0] : new Base[] {this.clinicalStatus}; // Enumeration<AllergyIntoleranceClinicalStatus>
2259        case -842509843: /*verificationStatus*/ return this.verificationStatus == null ? new Base[0] : new Base[] {this.verificationStatus}; // Enumeration<AllergyIntoleranceVerificationStatus>
2260        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<AllergyIntoleranceType>
2261        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // Enumeration<AllergyIntoleranceCategory>
2262        case -1608054609: /*criticality*/ return this.criticality == null ? new Base[0] : new Base[] {this.criticality}; // Enumeration<AllergyIntoleranceCriticality>
2263        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2264        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2265        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // Type
2266        case -174231629: /*assertedDate*/ return this.assertedDate == null ? new Base[0] : new Base[] {this.assertedDate}; // DateTimeType
2267        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
2268        case -373242253: /*asserter*/ return this.asserter == null ? new Base[0] : new Base[] {this.asserter}; // Reference
2269        case 1896977671: /*lastOccurrence*/ return this.lastOccurrence == null ? new Base[0] : new Base[] {this.lastOccurrence}; // DateTimeType
2270        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2271        case -867509719: /*reaction*/ return this.reaction == null ? new Base[0] : this.reaction.toArray(new Base[this.reaction.size()]); // AllergyIntoleranceReactionComponent
2272        default: return super.getProperty(hash, name, checkValid);
2273        }
2274
2275      }
2276
2277      @Override
2278      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2279        switch (hash) {
2280        case -1618432855: // identifier
2281          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2282          return value;
2283        case -462853915: // clinicalStatus
2284          value = new AllergyIntoleranceClinicalStatusEnumFactory().fromType(castToCode(value));
2285          this.clinicalStatus = (Enumeration) value; // Enumeration<AllergyIntoleranceClinicalStatus>
2286          return value;
2287        case -842509843: // verificationStatus
2288          value = new AllergyIntoleranceVerificationStatusEnumFactory().fromType(castToCode(value));
2289          this.verificationStatus = (Enumeration) value; // Enumeration<AllergyIntoleranceVerificationStatus>
2290          return value;
2291        case 3575610: // type
2292          value = new AllergyIntoleranceTypeEnumFactory().fromType(castToCode(value));
2293          this.type = (Enumeration) value; // Enumeration<AllergyIntoleranceType>
2294          return value;
2295        case 50511102: // category
2296          value = new AllergyIntoleranceCategoryEnumFactory().fromType(castToCode(value));
2297          this.getCategory().add((Enumeration) value); // Enumeration<AllergyIntoleranceCategory>
2298          return value;
2299        case -1608054609: // criticality
2300          value = new AllergyIntoleranceCriticalityEnumFactory().fromType(castToCode(value));
2301          this.criticality = (Enumeration) value; // Enumeration<AllergyIntoleranceCriticality>
2302          return value;
2303        case 3059181: // code
2304          this.code = castToCodeableConcept(value); // CodeableConcept
2305          return value;
2306        case -791418107: // patient
2307          this.patient = castToReference(value); // Reference
2308          return value;
2309        case 105901603: // onset
2310          this.onset = castToType(value); // Type
2311          return value;
2312        case -174231629: // assertedDate
2313          this.assertedDate = castToDateTime(value); // DateTimeType
2314          return value;
2315        case -799233858: // recorder
2316          this.recorder = castToReference(value); // Reference
2317          return value;
2318        case -373242253: // asserter
2319          this.asserter = castToReference(value); // Reference
2320          return value;
2321        case 1896977671: // lastOccurrence
2322          this.lastOccurrence = castToDateTime(value); // DateTimeType
2323          return value;
2324        case 3387378: // note
2325          this.getNote().add(castToAnnotation(value)); // Annotation
2326          return value;
2327        case -867509719: // reaction
2328          this.getReaction().add((AllergyIntoleranceReactionComponent) value); // AllergyIntoleranceReactionComponent
2329          return value;
2330        default: return super.setProperty(hash, name, value);
2331        }
2332
2333      }
2334
2335      @Override
2336      public Base setProperty(String name, Base value) throws FHIRException {
2337        if (name.equals("identifier")) {
2338          this.getIdentifier().add(castToIdentifier(value));
2339        } else if (name.equals("clinicalStatus")) {
2340          value = new AllergyIntoleranceClinicalStatusEnumFactory().fromType(castToCode(value));
2341          this.clinicalStatus = (Enumeration) value; // Enumeration<AllergyIntoleranceClinicalStatus>
2342        } else if (name.equals("verificationStatus")) {
2343          value = new AllergyIntoleranceVerificationStatusEnumFactory().fromType(castToCode(value));
2344          this.verificationStatus = (Enumeration) value; // Enumeration<AllergyIntoleranceVerificationStatus>
2345        } else if (name.equals("type")) {
2346          value = new AllergyIntoleranceTypeEnumFactory().fromType(castToCode(value));
2347          this.type = (Enumeration) value; // Enumeration<AllergyIntoleranceType>
2348        } else if (name.equals("category")) {
2349          value = new AllergyIntoleranceCategoryEnumFactory().fromType(castToCode(value));
2350          this.getCategory().add((Enumeration) value);
2351        } else if (name.equals("criticality")) {
2352          value = new AllergyIntoleranceCriticalityEnumFactory().fromType(castToCode(value));
2353          this.criticality = (Enumeration) value; // Enumeration<AllergyIntoleranceCriticality>
2354        } else if (name.equals("code")) {
2355          this.code = castToCodeableConcept(value); // CodeableConcept
2356        } else if (name.equals("patient")) {
2357          this.patient = castToReference(value); // Reference
2358        } else if (name.equals("onset[x]")) {
2359          this.onset = castToType(value); // Type
2360        } else if (name.equals("assertedDate")) {
2361          this.assertedDate = castToDateTime(value); // DateTimeType
2362        } else if (name.equals("recorder")) {
2363          this.recorder = castToReference(value); // Reference
2364        } else if (name.equals("asserter")) {
2365          this.asserter = castToReference(value); // Reference
2366        } else if (name.equals("lastOccurrence")) {
2367          this.lastOccurrence = castToDateTime(value); // DateTimeType
2368        } else if (name.equals("note")) {
2369          this.getNote().add(castToAnnotation(value));
2370        } else if (name.equals("reaction")) {
2371          this.getReaction().add((AllergyIntoleranceReactionComponent) value);
2372        } else
2373          return super.setProperty(name, value);
2374        return value;
2375      }
2376
2377      @Override
2378      public Base makeProperty(int hash, String name) throws FHIRException {
2379        switch (hash) {
2380        case -1618432855:  return addIdentifier(); 
2381        case -462853915:  return getClinicalStatusElement();
2382        case -842509843:  return getVerificationStatusElement();
2383        case 3575610:  return getTypeElement();
2384        case 50511102:  return addCategoryElement();
2385        case -1608054609:  return getCriticalityElement();
2386        case 3059181:  return getCode(); 
2387        case -791418107:  return getPatient(); 
2388        case -1886216323:  return getOnset(); 
2389        case 105901603:  return getOnset(); 
2390        case -174231629:  return getAssertedDateElement();
2391        case -799233858:  return getRecorder(); 
2392        case -373242253:  return getAsserter(); 
2393        case 1896977671:  return getLastOccurrenceElement();
2394        case 3387378:  return addNote(); 
2395        case -867509719:  return addReaction(); 
2396        default: return super.makeProperty(hash, name);
2397        }
2398
2399      }
2400
2401      @Override
2402      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2403        switch (hash) {
2404        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2405        case -462853915: /*clinicalStatus*/ return new String[] {"code"};
2406        case -842509843: /*verificationStatus*/ return new String[] {"code"};
2407        case 3575610: /*type*/ return new String[] {"code"};
2408        case 50511102: /*category*/ return new String[] {"code"};
2409        case -1608054609: /*criticality*/ return new String[] {"code"};
2410        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2411        case -791418107: /*patient*/ return new String[] {"Reference"};
2412        case 105901603: /*onset*/ return new String[] {"dateTime", "Age", "Period", "Range", "string"};
2413        case -174231629: /*assertedDate*/ return new String[] {"dateTime"};
2414        case -799233858: /*recorder*/ return new String[] {"Reference"};
2415        case -373242253: /*asserter*/ return new String[] {"Reference"};
2416        case 1896977671: /*lastOccurrence*/ return new String[] {"dateTime"};
2417        case 3387378: /*note*/ return new String[] {"Annotation"};
2418        case -867509719: /*reaction*/ return new String[] {};
2419        default: return super.getTypesForProperty(hash, name);
2420        }
2421
2422      }
2423
2424      @Override
2425      public Base addChild(String name) throws FHIRException {
2426        if (name.equals("identifier")) {
2427          return addIdentifier();
2428        }
2429        else if (name.equals("clinicalStatus")) {
2430          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.clinicalStatus");
2431        }
2432        else if (name.equals("verificationStatus")) {
2433          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.verificationStatus");
2434        }
2435        else if (name.equals("type")) {
2436          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.type");
2437        }
2438        else if (name.equals("category")) {
2439          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.category");
2440        }
2441        else if (name.equals("criticality")) {
2442          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.criticality");
2443        }
2444        else if (name.equals("code")) {
2445          this.code = new CodeableConcept();
2446          return this.code;
2447        }
2448        else if (name.equals("patient")) {
2449          this.patient = new Reference();
2450          return this.patient;
2451        }
2452        else if (name.equals("onsetDateTime")) {
2453          this.onset = new DateTimeType();
2454          return this.onset;
2455        }
2456        else if (name.equals("onsetAge")) {
2457          this.onset = new Age();
2458          return this.onset;
2459        }
2460        else if (name.equals("onsetPeriod")) {
2461          this.onset = new Period();
2462          return this.onset;
2463        }
2464        else if (name.equals("onsetRange")) {
2465          this.onset = new Range();
2466          return this.onset;
2467        }
2468        else if (name.equals("onsetString")) {
2469          this.onset = new StringType();
2470          return this.onset;
2471        }
2472        else if (name.equals("assertedDate")) {
2473          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.assertedDate");
2474        }
2475        else if (name.equals("recorder")) {
2476          this.recorder = new Reference();
2477          return this.recorder;
2478        }
2479        else if (name.equals("asserter")) {
2480          this.asserter = new Reference();
2481          return this.asserter;
2482        }
2483        else if (name.equals("lastOccurrence")) {
2484          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.lastOccurrence");
2485        }
2486        else if (name.equals("note")) {
2487          return addNote();
2488        }
2489        else if (name.equals("reaction")) {
2490          return addReaction();
2491        }
2492        else
2493          return super.addChild(name);
2494      }
2495
2496  public String fhirType() {
2497    return "AllergyIntolerance";
2498
2499  }
2500
2501      public AllergyIntolerance copy() {
2502        AllergyIntolerance dst = new AllergyIntolerance();
2503        copyValues(dst);
2504        if (identifier != null) {
2505          dst.identifier = new ArrayList<Identifier>();
2506          for (Identifier i : identifier)
2507            dst.identifier.add(i.copy());
2508        };
2509        dst.clinicalStatus = clinicalStatus == null ? null : clinicalStatus.copy();
2510        dst.verificationStatus = verificationStatus == null ? null : verificationStatus.copy();
2511        dst.type = type == null ? null : type.copy();
2512        if (category != null) {
2513          dst.category = new ArrayList<Enumeration<AllergyIntoleranceCategory>>();
2514          for (Enumeration<AllergyIntoleranceCategory> i : category)
2515            dst.category.add(i.copy());
2516        };
2517        dst.criticality = criticality == null ? null : criticality.copy();
2518        dst.code = code == null ? null : code.copy();
2519        dst.patient = patient == null ? null : patient.copy();
2520        dst.onset = onset == null ? null : onset.copy();
2521        dst.assertedDate = assertedDate == null ? null : assertedDate.copy();
2522        dst.recorder = recorder == null ? null : recorder.copy();
2523        dst.asserter = asserter == null ? null : asserter.copy();
2524        dst.lastOccurrence = lastOccurrence == null ? null : lastOccurrence.copy();
2525        if (note != null) {
2526          dst.note = new ArrayList<Annotation>();
2527          for (Annotation i : note)
2528            dst.note.add(i.copy());
2529        };
2530        if (reaction != null) {
2531          dst.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2532          for (AllergyIntoleranceReactionComponent i : reaction)
2533            dst.reaction.add(i.copy());
2534        };
2535        return dst;
2536      }
2537
2538      protected AllergyIntolerance typedCopy() {
2539        return copy();
2540      }
2541
2542      @Override
2543      public boolean equalsDeep(Base other_) {
2544        if (!super.equalsDeep(other_))
2545          return false;
2546        if (!(other_ instanceof AllergyIntolerance))
2547          return false;
2548        AllergyIntolerance o = (AllergyIntolerance) other_;
2549        return compareDeep(identifier, o.identifier, true) && compareDeep(clinicalStatus, o.clinicalStatus, true)
2550           && compareDeep(verificationStatus, o.verificationStatus, true) && compareDeep(type, o.type, true)
2551           && compareDeep(category, o.category, true) && compareDeep(criticality, o.criticality, true) && compareDeep(code, o.code, true)
2552           && compareDeep(patient, o.patient, true) && compareDeep(onset, o.onset, true) && compareDeep(assertedDate, o.assertedDate, true)
2553           && compareDeep(recorder, o.recorder, true) && compareDeep(asserter, o.asserter, true) && compareDeep(lastOccurrence, o.lastOccurrence, true)
2554           && compareDeep(note, o.note, true) && compareDeep(reaction, o.reaction, true);
2555      }
2556
2557      @Override
2558      public boolean equalsShallow(Base other_) {
2559        if (!super.equalsShallow(other_))
2560          return false;
2561        if (!(other_ instanceof AllergyIntolerance))
2562          return false;
2563        AllergyIntolerance o = (AllergyIntolerance) other_;
2564        return compareValues(clinicalStatus, o.clinicalStatus, true) && compareValues(verificationStatus, o.verificationStatus, true)
2565           && compareValues(type, o.type, true) && compareValues(category, o.category, true) && compareValues(criticality, o.criticality, true)
2566           && compareValues(assertedDate, o.assertedDate, true) && compareValues(lastOccurrence, o.lastOccurrence, true)
2567          ;
2568      }
2569
2570      public boolean isEmpty() {
2571        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, clinicalStatus
2572          , verificationStatus, type, category, criticality, code, patient, onset, assertedDate
2573          , recorder, asserter, lastOccurrence, note, reaction);
2574      }
2575
2576  @Override
2577  public ResourceType getResourceType() {
2578    return ResourceType.AllergyIntolerance;
2579   }
2580
2581 /**
2582   * Search parameter: <b>severity</b>
2583   * <p>
2584   * Description: <b>mild | moderate | severe (of event as a whole)</b><br>
2585   * Type: <b>token</b><br>
2586   * Path: <b>AllergyIntolerance.reaction.severity</b><br>
2587   * </p>
2588   */
2589  @SearchParamDefinition(name="severity", path="AllergyIntolerance.reaction.severity", description="mild | moderate | severe (of event as a whole)", type="token" )
2590  public static final String SP_SEVERITY = "severity";
2591 /**
2592   * <b>Fluent Client</b> search parameter constant for <b>severity</b>
2593   * <p>
2594   * Description: <b>mild | moderate | severe (of event as a whole)</b><br>
2595   * Type: <b>token</b><br>
2596   * Path: <b>AllergyIntolerance.reaction.severity</b><br>
2597   * </p>
2598   */
2599  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SEVERITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SEVERITY);
2600
2601 /**
2602   * Search parameter: <b>date</b>
2603   * <p>
2604   * Description: <b>Date record was believed accurate</b><br>
2605   * Type: <b>date</b><br>
2606   * Path: <b>AllergyIntolerance.assertedDate</b><br>
2607   * </p>
2608   */
2609  @SearchParamDefinition(name="date", path="AllergyIntolerance.assertedDate", description="Date record was believed accurate", type="date" )
2610  public static final String SP_DATE = "date";
2611 /**
2612   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2613   * <p>
2614   * Description: <b>Date record was believed accurate</b><br>
2615   * Type: <b>date</b><br>
2616   * Path: <b>AllergyIntolerance.assertedDate</b><br>
2617   * </p>
2618   */
2619  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2620
2621 /**
2622   * Search parameter: <b>identifier</b>
2623   * <p>
2624   * Description: <b>External ids for this item</b><br>
2625   * Type: <b>token</b><br>
2626   * Path: <b>AllergyIntolerance.identifier</b><br>
2627   * </p>
2628   */
2629  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier", description="External ids for this item", type="token" )
2630  public static final String SP_IDENTIFIER = "identifier";
2631 /**
2632   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2633   * <p>
2634   * Description: <b>External ids for this item</b><br>
2635   * Type: <b>token</b><br>
2636   * Path: <b>AllergyIntolerance.identifier</b><br>
2637   * </p>
2638   */
2639  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2640
2641 /**
2642   * Search parameter: <b>manifestation</b>
2643   * <p>
2644   * Description: <b>Clinical symptoms/signs associated with the Event</b><br>
2645   * Type: <b>token</b><br>
2646   * Path: <b>AllergyIntolerance.reaction.manifestation</b><br>
2647   * </p>
2648   */
2649  @SearchParamDefinition(name="manifestation", path="AllergyIntolerance.reaction.manifestation", description="Clinical symptoms/signs associated with the Event", type="token" )
2650  public static final String SP_MANIFESTATION = "manifestation";
2651 /**
2652   * <b>Fluent Client</b> search parameter constant for <b>manifestation</b>
2653   * <p>
2654   * Description: <b>Clinical symptoms/signs associated with the Event</b><br>
2655   * Type: <b>token</b><br>
2656   * Path: <b>AllergyIntolerance.reaction.manifestation</b><br>
2657   * </p>
2658   */
2659  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MANIFESTATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MANIFESTATION);
2660
2661 /**
2662   * Search parameter: <b>recorder</b>
2663   * <p>
2664   * Description: <b>Who recorded the sensitivity</b><br>
2665   * Type: <b>reference</b><br>
2666   * Path: <b>AllergyIntolerance.recorder</b><br>
2667   * </p>
2668   */
2669  @SearchParamDefinition(name="recorder", path="AllergyIntolerance.recorder", description="Who recorded the sensitivity", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Patient.class, Practitioner.class } )
2670  public static final String SP_RECORDER = "recorder";
2671 /**
2672   * <b>Fluent Client</b> search parameter constant for <b>recorder</b>
2673   * <p>
2674   * Description: <b>Who recorded the sensitivity</b><br>
2675   * Type: <b>reference</b><br>
2676   * Path: <b>AllergyIntolerance.recorder</b><br>
2677   * </p>
2678   */
2679  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECORDER);
2680
2681/**
2682   * Constant for fluent queries to be used to add include statements. Specifies
2683   * the path value of "<b>AllergyIntolerance:recorder</b>".
2684   */
2685  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECORDER = new ca.uhn.fhir.model.api.Include("AllergyIntolerance:recorder").toLocked();
2686
2687 /**
2688   * Search parameter: <b>code</b>
2689   * <p>
2690   * Description: <b>Code that identifies the allergy or intolerance</b><br>
2691   * Type: <b>token</b><br>
2692   * Path: <b>AllergyIntolerance.code, AllergyIntolerance.reaction.substance</b><br>
2693   * </p>
2694   */
2695  @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance", description="Code that identifies the allergy or intolerance", type="token" )
2696  public static final String SP_CODE = "code";
2697 /**
2698   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2699   * <p>
2700   * Description: <b>Code that identifies the allergy or intolerance</b><br>
2701   * Type: <b>token</b><br>
2702   * Path: <b>AllergyIntolerance.code, AllergyIntolerance.reaction.substance</b><br>
2703   * </p>
2704   */
2705  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2706
2707 /**
2708   * Search parameter: <b>verification-status</b>
2709   * <p>
2710   * Description: <b>unconfirmed | confirmed | refuted | entered-in-error</b><br>
2711   * Type: <b>token</b><br>
2712   * Path: <b>AllergyIntolerance.verificationStatus</b><br>
2713   * </p>
2714   */
2715  @SearchParamDefinition(name="verification-status", path="AllergyIntolerance.verificationStatus", description="unconfirmed | confirmed | refuted | entered-in-error", type="token" )
2716  public static final String SP_VERIFICATION_STATUS = "verification-status";
2717 /**
2718   * <b>Fluent Client</b> search parameter constant for <b>verification-status</b>
2719   * <p>
2720   * Description: <b>unconfirmed | confirmed | refuted | entered-in-error</b><br>
2721   * Type: <b>token</b><br>
2722   * Path: <b>AllergyIntolerance.verificationStatus</b><br>
2723   * </p>
2724   */
2725  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERIFICATION_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERIFICATION_STATUS);
2726
2727 /**
2728   * Search parameter: <b>criticality</b>
2729   * <p>
2730   * Description: <b>low | high | unable-to-assess</b><br>
2731   * Type: <b>token</b><br>
2732   * Path: <b>AllergyIntolerance.criticality</b><br>
2733   * </p>
2734   */
2735  @SearchParamDefinition(name="criticality", path="AllergyIntolerance.criticality", description="low | high | unable-to-assess", type="token" )
2736  public static final String SP_CRITICALITY = "criticality";
2737 /**
2738   * <b>Fluent Client</b> search parameter constant for <b>criticality</b>
2739   * <p>
2740   * Description: <b>low | high | unable-to-assess</b><br>
2741   * Type: <b>token</b><br>
2742   * Path: <b>AllergyIntolerance.criticality</b><br>
2743   * </p>
2744   */
2745  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CRITICALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CRITICALITY);
2746
2747 /**
2748   * Search parameter: <b>clinical-status</b>
2749   * <p>
2750   * Description: <b>active | inactive | resolved</b><br>
2751   * Type: <b>token</b><br>
2752   * Path: <b>AllergyIntolerance.clinicalStatus</b><br>
2753   * </p>
2754   */
2755  @SearchParamDefinition(name="clinical-status", path="AllergyIntolerance.clinicalStatus", description="active | inactive | resolved", type="token" )
2756  public static final String SP_CLINICAL_STATUS = "clinical-status";
2757 /**
2758   * <b>Fluent Client</b> search parameter constant for <b>clinical-status</b>
2759   * <p>
2760   * Description: <b>active | inactive | resolved</b><br>
2761   * Type: <b>token</b><br>
2762   * Path: <b>AllergyIntolerance.clinicalStatus</b><br>
2763   * </p>
2764   */
2765  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLINICAL_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLINICAL_STATUS);
2766
2767 /**
2768   * Search parameter: <b>type</b>
2769   * <p>
2770   * Description: <b>allergy | intolerance - Underlying mechanism (if known)</b><br>
2771   * Type: <b>token</b><br>
2772   * Path: <b>AllergyIntolerance.type</b><br>
2773   * </p>
2774   */
2775  @SearchParamDefinition(name="type", path="AllergyIntolerance.type", description="allergy | intolerance - Underlying mechanism (if known)", type="token" )
2776  public static final String SP_TYPE = "type";
2777 /**
2778   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2779   * <p>
2780   * Description: <b>allergy | intolerance - Underlying mechanism (if known)</b><br>
2781   * Type: <b>token</b><br>
2782   * Path: <b>AllergyIntolerance.type</b><br>
2783   * </p>
2784   */
2785  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2786
2787 /**
2788   * Search parameter: <b>onset</b>
2789   * <p>
2790   * Description: <b>Date(/time) when manifestations showed</b><br>
2791   * Type: <b>date</b><br>
2792   * Path: <b>AllergyIntolerance.reaction.onset</b><br>
2793   * </p>
2794   */
2795  @SearchParamDefinition(name="onset", path="AllergyIntolerance.reaction.onset", description="Date(/time) when manifestations showed", type="date" )
2796  public static final String SP_ONSET = "onset";
2797 /**
2798   * <b>Fluent Client</b> search parameter constant for <b>onset</b>
2799   * <p>
2800   * Description: <b>Date(/time) when manifestations showed</b><br>
2801   * Type: <b>date</b><br>
2802   * Path: <b>AllergyIntolerance.reaction.onset</b><br>
2803   * </p>
2804   */
2805  public static final ca.uhn.fhir.rest.gclient.DateClientParam ONSET = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ONSET);
2806
2807 /**
2808   * Search parameter: <b>route</b>
2809   * <p>
2810   * Description: <b>How the subject was exposed to the substance</b><br>
2811   * Type: <b>token</b><br>
2812   * Path: <b>AllergyIntolerance.reaction.exposureRoute</b><br>
2813   * </p>
2814   */
2815  @SearchParamDefinition(name="route", path="AllergyIntolerance.reaction.exposureRoute", description="How the subject was exposed to the substance", type="token" )
2816  public static final String SP_ROUTE = "route";
2817 /**
2818   * <b>Fluent Client</b> search parameter constant for <b>route</b>
2819   * <p>
2820   * Description: <b>How the subject was exposed to the substance</b><br>
2821   * Type: <b>token</b><br>
2822   * Path: <b>AllergyIntolerance.reaction.exposureRoute</b><br>
2823   * </p>
2824   */
2825  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROUTE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROUTE);
2826
2827 /**
2828   * Search parameter: <b>asserter</b>
2829   * <p>
2830   * Description: <b>Source of the information about the allergy</b><br>
2831   * Type: <b>reference</b><br>
2832   * Path: <b>AllergyIntolerance.asserter</b><br>
2833   * </p>
2834   */
2835  @SearchParamDefinition(name="asserter", path="AllergyIntolerance.asserter", description="Source of the information about the allergy", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Patient.class, Practitioner.class, RelatedPerson.class } )
2836  public static final String SP_ASSERTER = "asserter";
2837 /**
2838   * <b>Fluent Client</b> search parameter constant for <b>asserter</b>
2839   * <p>
2840   * Description: <b>Source of the information about the allergy</b><br>
2841   * Type: <b>reference</b><br>
2842   * Path: <b>AllergyIntolerance.asserter</b><br>
2843   * </p>
2844   */
2845  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ASSERTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ASSERTER);
2846
2847/**
2848   * Constant for fluent queries to be used to add include statements. Specifies
2849   * the path value of "<b>AllergyIntolerance:asserter</b>".
2850   */
2851  public static final ca.uhn.fhir.model.api.Include INCLUDE_ASSERTER = new ca.uhn.fhir.model.api.Include("AllergyIntolerance:asserter").toLocked();
2852
2853 /**
2854   * Search parameter: <b>patient</b>
2855   * <p>
2856   * Description: <b>Who the sensitivity is for</b><br>
2857   * Type: <b>reference</b><br>
2858   * Path: <b>AllergyIntolerance.patient</b><br>
2859   * </p>
2860   */
2861  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient", description="Who the sensitivity is for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2862  public static final String SP_PATIENT = "patient";
2863 /**
2864   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2865   * <p>
2866   * Description: <b>Who the sensitivity is for</b><br>
2867   * Type: <b>reference</b><br>
2868   * Path: <b>AllergyIntolerance.patient</b><br>
2869   * </p>
2870   */
2871  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2872
2873/**
2874   * Constant for fluent queries to be used to add include statements. Specifies
2875   * the path value of "<b>AllergyIntolerance:patient</b>".
2876   */
2877  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AllergyIntolerance:patient").toLocked();
2878
2879 /**
2880   * Search parameter: <b>category</b>
2881   * <p>
2882   * Description: <b>food | medication | environment | biologic</b><br>
2883   * Type: <b>token</b><br>
2884   * Path: <b>AllergyIntolerance.category</b><br>
2885   * </p>
2886   */
2887  @SearchParamDefinition(name="category", path="AllergyIntolerance.category", description="food | medication | environment | biologic", type="token" )
2888  public static final String SP_CATEGORY = "category";
2889 /**
2890   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2891   * <p>
2892   * Description: <b>food | medication | environment | biologic</b><br>
2893   * Type: <b>token</b><br>
2894   * Path: <b>AllergyIntolerance.category</b><br>
2895   * </p>
2896   */
2897  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2898
2899 /**
2900   * Search parameter: <b>last-date</b>
2901   * <p>
2902   * Description: <b>Date(/time) of last known occurrence of a reaction</b><br>
2903   * Type: <b>date</b><br>
2904   * Path: <b>AllergyIntolerance.lastOccurrence</b><br>
2905   * </p>
2906   */
2907  @SearchParamDefinition(name="last-date", path="AllergyIntolerance.lastOccurrence", description="Date(/time) of last known occurrence of a reaction", type="date" )
2908  public static final String SP_LAST_DATE = "last-date";
2909 /**
2910   * <b>Fluent Client</b> search parameter constant for <b>last-date</b>
2911   * <p>
2912   * Description: <b>Date(/time) of last known occurrence of a reaction</b><br>
2913   * Type: <b>date</b><br>
2914   * Path: <b>AllergyIntolerance.lastOccurrence</b><br>
2915   * </p>
2916   */
2917  public static final ca.uhn.fhir.rest.gclient.DateClientParam LAST_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_LAST_DATE);
2918
2919
2920}
2921