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