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