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