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