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