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