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