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