001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import org.hl7.fhir.exceptions.FHIRException;
047import org.hl7.fhir.utilities.Utilities;
048/**
049 * Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.
050 */
051@ResourceDef(name="AllergyIntolerance", profile="http://hl7.org/fhir/Profile/AllergyIntolerance")
052public class AllergyIntolerance extends DomainResource {
053
054    public enum AllergyIntoleranceStatus {
055        /**
056         * An active record of a reaction to the identified Substance.
057         */
058        ACTIVE, 
059        /**
060         * A low level of certainty about the propensity for a reaction to the identified Substance.
061         */
062        UNCONFIRMED, 
063        /**
064         * A high level of certainty about the propensity for a reaction to the identified Substance, which may include clinical evidence by testing or rechallenge.
065         */
066        CONFIRMED, 
067        /**
068         * An inactive record of a reaction to the identified Substance.
069         */
070        INACTIVE, 
071        /**
072         * A reaction to the identified Substance has been clinically reassessed by testing or rechallenge and considered to be resolved.
073         */
074        RESOLVED, 
075        /**
076         * 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.
077         */
078        REFUTED, 
079        /**
080         * The statement was entered in error and is not valid.
081         */
082        ENTEREDINERROR, 
083        /**
084         * added to help the parsers
085         */
086        NULL;
087        public static AllergyIntoleranceStatus fromCode(String codeString) throws FHIRException {
088            if (codeString == null || "".equals(codeString))
089                return null;
090        if ("active".equals(codeString))
091          return ACTIVE;
092        if ("unconfirmed".equals(codeString))
093          return UNCONFIRMED;
094        if ("confirmed".equals(codeString))
095          return CONFIRMED;
096        if ("inactive".equals(codeString))
097          return INACTIVE;
098        if ("resolved".equals(codeString))
099          return RESOLVED;
100        if ("refuted".equals(codeString))
101          return REFUTED;
102        if ("entered-in-error".equals(codeString))
103          return ENTEREDINERROR;
104        throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
105        }
106        public String toCode() {
107          switch (this) {
108            case ACTIVE: return "active";
109            case UNCONFIRMED: return "unconfirmed";
110            case CONFIRMED: return "confirmed";
111            case INACTIVE: return "inactive";
112            case RESOLVED: return "resolved";
113            case REFUTED: return "refuted";
114            case ENTEREDINERROR: return "entered-in-error";
115            case NULL: return null;
116            default: return "?";
117          }
118        }
119        public String getSystem() {
120          switch (this) {
121            case ACTIVE: return "http://hl7.org/fhir/allergy-intolerance-status";
122            case UNCONFIRMED: return "http://hl7.org/fhir/allergy-intolerance-status";
123            case CONFIRMED: return "http://hl7.org/fhir/allergy-intolerance-status";
124            case INACTIVE: return "http://hl7.org/fhir/allergy-intolerance-status";
125            case RESOLVED: return "http://hl7.org/fhir/allergy-intolerance-status";
126            case REFUTED: return "http://hl7.org/fhir/allergy-intolerance-status";
127            case ENTEREDINERROR: return "http://hl7.org/fhir/allergy-intolerance-status";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132        public String getDefinition() {
133          switch (this) {
134            case ACTIVE: return "An active record of a reaction to the identified Substance.";
135            case UNCONFIRMED: return "A low level of certainty about the propensity for a reaction to the identified Substance.";
136            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.";
137            case INACTIVE: return "An inactive record of a reaction to the identified Substance.";
138            case RESOLVED: return "A reaction to the identified Substance has been clinically reassessed by testing or rechallenge and considered to be resolved.";
139            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.";
140            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
141            case NULL: return null;
142            default: return "?";
143          }
144        }
145        public String getDisplay() {
146          switch (this) {
147            case ACTIVE: return "Active";
148            case UNCONFIRMED: return "Unconfirmed";
149            case CONFIRMED: return "Confirmed";
150            case INACTIVE: return "Inactive";
151            case RESOLVED: return "Resolved";
152            case REFUTED: return "Refuted";
153            case ENTEREDINERROR: return "Entered In Error";
154            case NULL: return null;
155            default: return "?";
156          }
157        }
158    }
159
160  public static class AllergyIntoleranceStatusEnumFactory implements EnumFactory<AllergyIntoleranceStatus> {
161    public AllergyIntoleranceStatus fromCode(String codeString) throws IllegalArgumentException {
162      if (codeString == null || "".equals(codeString))
163            if (codeString == null || "".equals(codeString))
164                return null;
165        if ("active".equals(codeString))
166          return AllergyIntoleranceStatus.ACTIVE;
167        if ("unconfirmed".equals(codeString))
168          return AllergyIntoleranceStatus.UNCONFIRMED;
169        if ("confirmed".equals(codeString))
170          return AllergyIntoleranceStatus.CONFIRMED;
171        if ("inactive".equals(codeString))
172          return AllergyIntoleranceStatus.INACTIVE;
173        if ("resolved".equals(codeString))
174          return AllergyIntoleranceStatus.RESOLVED;
175        if ("refuted".equals(codeString))
176          return AllergyIntoleranceStatus.REFUTED;
177        if ("entered-in-error".equals(codeString))
178          return AllergyIntoleranceStatus.ENTEREDINERROR;
179        throw new IllegalArgumentException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
180        }
181        public Enumeration<AllergyIntoleranceStatus> fromType(Base code) throws FHIRException {
182          if (code == null || code.isEmpty())
183            return null;
184          String codeString = ((PrimitiveType) code).asStringValue();
185          if (codeString == null || "".equals(codeString))
186            return null;
187        if ("active".equals(codeString))
188          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.ACTIVE);
189        if ("unconfirmed".equals(codeString))
190          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.UNCONFIRMED);
191        if ("confirmed".equals(codeString))
192          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.CONFIRMED);
193        if ("inactive".equals(codeString))
194          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.INACTIVE);
195        if ("resolved".equals(codeString))
196          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.RESOLVED);
197        if ("refuted".equals(codeString))
198          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.REFUTED);
199        if ("entered-in-error".equals(codeString))
200          return new Enumeration<AllergyIntoleranceStatus>(this, AllergyIntoleranceStatus.ENTEREDINERROR);
201        throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
202        }
203    public String toCode(AllergyIntoleranceStatus code) {
204      if (code == AllergyIntoleranceStatus.ACTIVE)
205        return "active";
206      if (code == AllergyIntoleranceStatus.UNCONFIRMED)
207        return "unconfirmed";
208      if (code == AllergyIntoleranceStatus.CONFIRMED)
209        return "confirmed";
210      if (code == AllergyIntoleranceStatus.INACTIVE)
211        return "inactive";
212      if (code == AllergyIntoleranceStatus.RESOLVED)
213        return "resolved";
214      if (code == AllergyIntoleranceStatus.REFUTED)
215        return "refuted";
216      if (code == AllergyIntoleranceStatus.ENTEREDINERROR)
217        return "entered-in-error";
218      return "?";
219      }
220    }
221
222    public enum AllergyIntoleranceCriticality {
223        /**
224         * The potential clinical impact of a future reaction is estimated as low risk: exposure to substance is unlikely to result in a life threatening or organ system threatening outcome. Future exposure to the Substance is considered a relative contra-indication.
225         */
226        CRITL, 
227        /**
228         * The potential clinical impact of a future reaction is estimated as high risk: exposure to substance may result in a life threatening or organ system threatening outcome. Future exposure to the Substance may be considered an absolute contra-indication.
229         */
230        CRITH, 
231        /**
232         * Unable to assess the potential clinical impact with the information available.
233         */
234        CRITU, 
235        /**
236         * added to help the parsers
237         */
238        NULL;
239        public static AllergyIntoleranceCriticality fromCode(String codeString) throws FHIRException {
240            if (codeString == null || "".equals(codeString))
241                return null;
242        if ("CRITL".equals(codeString))
243          return CRITL;
244        if ("CRITH".equals(codeString))
245          return CRITH;
246        if ("CRITU".equals(codeString))
247          return CRITU;
248        throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
249        }
250        public String toCode() {
251          switch (this) {
252            case CRITL: return "CRITL";
253            case CRITH: return "CRITH";
254            case CRITU: return "CRITU";
255            case NULL: return null;
256            default: return "?";
257          }
258        }
259        public String getSystem() {
260          switch (this) {
261            case CRITL: return "http://hl7.org/fhir/allergy-intolerance-criticality";
262            case CRITH: return "http://hl7.org/fhir/allergy-intolerance-criticality";
263            case CRITU: return "http://hl7.org/fhir/allergy-intolerance-criticality";
264            case NULL: return null;
265            default: return "?";
266          }
267        }
268        public String getDefinition() {
269          switch (this) {
270            case CRITL: return "The potential clinical impact of a future reaction is estimated as low risk: exposure to substance is unlikely to result in a life threatening or organ system threatening outcome. Future exposure to the Substance is considered a relative contra-indication.";
271            case CRITH: return "The potential clinical impact of a future reaction is estimated as high risk: exposure to substance may result in a life threatening or organ system threatening outcome. Future exposure to the Substance may be considered an absolute contra-indication.";
272            case CRITU: return "Unable to assess the potential clinical impact with the information available.";
273            case NULL: return null;
274            default: return "?";
275          }
276        }
277        public String getDisplay() {
278          switch (this) {
279            case CRITL: return "Low Risk";
280            case CRITH: return "High Risk";
281            case CRITU: return "Unable to determine";
282            case NULL: return null;
283            default: return "?";
284          }
285        }
286    }
287
288  public static class AllergyIntoleranceCriticalityEnumFactory implements EnumFactory<AllergyIntoleranceCriticality> {
289    public AllergyIntoleranceCriticality fromCode(String codeString) throws IllegalArgumentException {
290      if (codeString == null || "".equals(codeString))
291            if (codeString == null || "".equals(codeString))
292                return null;
293        if ("CRITL".equals(codeString))
294          return AllergyIntoleranceCriticality.CRITL;
295        if ("CRITH".equals(codeString))
296          return AllergyIntoleranceCriticality.CRITH;
297        if ("CRITU".equals(codeString))
298          return AllergyIntoleranceCriticality.CRITU;
299        throw new IllegalArgumentException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
300        }
301        public Enumeration<AllergyIntoleranceCriticality> fromType(Base code) throws FHIRException {
302          if (code == null || code.isEmpty())
303            return null;
304          String codeString = ((PrimitiveType) code).asStringValue();
305          if (codeString == null || "".equals(codeString))
306            return null;
307        if ("CRITL".equals(codeString))
308          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.CRITL);
309        if ("CRITH".equals(codeString))
310          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.CRITH);
311        if ("CRITU".equals(codeString))
312          return new Enumeration<AllergyIntoleranceCriticality>(this, AllergyIntoleranceCriticality.CRITU);
313        throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
314        }
315    public String toCode(AllergyIntoleranceCriticality code) {
316      if (code == AllergyIntoleranceCriticality.CRITL)
317        return "CRITL";
318      if (code == AllergyIntoleranceCriticality.CRITH)
319        return "CRITH";
320      if (code == AllergyIntoleranceCriticality.CRITU)
321        return "CRITU";
322      return "?";
323      }
324    }
325
326    public enum AllergyIntoleranceType {
327        /**
328         * A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other "allergy-like" reactions, including pseudoallergy.
329         */
330        ALLERGY, 
331        /**
332         * 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).
333         */
334        INTOLERANCE, 
335        /**
336         * added to help the parsers
337         */
338        NULL;
339        public static AllergyIntoleranceType fromCode(String codeString) throws FHIRException {
340            if (codeString == null || "".equals(codeString))
341                return null;
342        if ("allergy".equals(codeString))
343          return ALLERGY;
344        if ("intolerance".equals(codeString))
345          return INTOLERANCE;
346        throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
347        }
348        public String toCode() {
349          switch (this) {
350            case ALLERGY: return "allergy";
351            case INTOLERANCE: return "intolerance";
352            case NULL: return null;
353            default: return "?";
354          }
355        }
356        public String getSystem() {
357          switch (this) {
358            case ALLERGY: return "http://hl7.org/fhir/allergy-intolerance-type";
359            case INTOLERANCE: return "http://hl7.org/fhir/allergy-intolerance-type";
360            case NULL: return null;
361            default: return "?";
362          }
363        }
364        public String getDefinition() {
365          switch (this) {
366            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.";
367            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).";
368            case NULL: return null;
369            default: return "?";
370          }
371        }
372        public String getDisplay() {
373          switch (this) {
374            case ALLERGY: return "Allergy";
375            case INTOLERANCE: return "Intolerance";
376            case NULL: return null;
377            default: return "?";
378          }
379        }
380    }
381
382  public static class AllergyIntoleranceTypeEnumFactory implements EnumFactory<AllergyIntoleranceType> {
383    public AllergyIntoleranceType fromCode(String codeString) throws IllegalArgumentException {
384      if (codeString == null || "".equals(codeString))
385            if (codeString == null || "".equals(codeString))
386                return null;
387        if ("allergy".equals(codeString))
388          return AllergyIntoleranceType.ALLERGY;
389        if ("intolerance".equals(codeString))
390          return AllergyIntoleranceType.INTOLERANCE;
391        throw new IllegalArgumentException("Unknown AllergyIntoleranceType code '"+codeString+"'");
392        }
393        public Enumeration<AllergyIntoleranceType> fromType(Base code) throws FHIRException {
394          if (code == null || code.isEmpty())
395            return null;
396          String codeString = ((PrimitiveType) code).asStringValue();
397          if (codeString == null || "".equals(codeString))
398            return null;
399        if ("allergy".equals(codeString))
400          return new Enumeration<AllergyIntoleranceType>(this, AllergyIntoleranceType.ALLERGY);
401        if ("intolerance".equals(codeString))
402          return new Enumeration<AllergyIntoleranceType>(this, AllergyIntoleranceType.INTOLERANCE);
403        throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
404        }
405    public String toCode(AllergyIntoleranceType code) {
406      if (code == AllergyIntoleranceType.ALLERGY)
407        return "allergy";
408      if (code == AllergyIntoleranceType.INTOLERANCE)
409        return "intolerance";
410      return "?";
411      }
412    }
413
414    public enum AllergyIntoleranceCategory {
415        /**
416         * Any substance consumed to provide nutritional support for the body.
417         */
418        FOOD, 
419        /**
420         * Substances administered to achieve a physiological effect.
421         */
422        MEDICATION, 
423        /**
424         * Substances that are encountered in the environment.
425         */
426        ENVIRONMENT, 
427        /**
428         * Other substances that are not covered by any other category.
429         */
430        OTHER, 
431        /**
432         * added to help the parsers
433         */
434        NULL;
435        public static AllergyIntoleranceCategory fromCode(String codeString) throws FHIRException {
436            if (codeString == null || "".equals(codeString))
437                return null;
438        if ("food".equals(codeString))
439          return FOOD;
440        if ("medication".equals(codeString))
441          return MEDICATION;
442        if ("environment".equals(codeString))
443          return ENVIRONMENT;
444        if ("other".equals(codeString))
445          return OTHER;
446        throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
447        }
448        public String toCode() {
449          switch (this) {
450            case FOOD: return "food";
451            case MEDICATION: return "medication";
452            case ENVIRONMENT: return "environment";
453            case OTHER: return "other";
454            case NULL: return null;
455            default: return "?";
456          }
457        }
458        public String getSystem() {
459          switch (this) {
460            case FOOD: return "http://hl7.org/fhir/allergy-intolerance-category";
461            case MEDICATION: return "http://hl7.org/fhir/allergy-intolerance-category";
462            case ENVIRONMENT: return "http://hl7.org/fhir/allergy-intolerance-category";
463            case OTHER: return "http://hl7.org/fhir/allergy-intolerance-category";
464            case NULL: return null;
465            default: return "?";
466          }
467        }
468        public String getDefinition() {
469          switch (this) {
470            case FOOD: return "Any substance consumed to provide nutritional support for the body.";
471            case MEDICATION: return "Substances administered to achieve a physiological effect.";
472            case ENVIRONMENT: return "Substances that are encountered in the environment.";
473            case OTHER: return "Other substances that are not covered by any other category.";
474            case NULL: return null;
475            default: return "?";
476          }
477        }
478        public String getDisplay() {
479          switch (this) {
480            case FOOD: return "Food";
481            case MEDICATION: return "Medication";
482            case ENVIRONMENT: return "Environment";
483            case OTHER: return "Other";
484            case NULL: return null;
485            default: return "?";
486          }
487        }
488    }
489
490  public static class AllergyIntoleranceCategoryEnumFactory implements EnumFactory<AllergyIntoleranceCategory> {
491    public AllergyIntoleranceCategory fromCode(String codeString) throws IllegalArgumentException {
492      if (codeString == null || "".equals(codeString))
493            if (codeString == null || "".equals(codeString))
494                return null;
495        if ("food".equals(codeString))
496          return AllergyIntoleranceCategory.FOOD;
497        if ("medication".equals(codeString))
498          return AllergyIntoleranceCategory.MEDICATION;
499        if ("environment".equals(codeString))
500          return AllergyIntoleranceCategory.ENVIRONMENT;
501        if ("other".equals(codeString))
502          return AllergyIntoleranceCategory.OTHER;
503        throw new IllegalArgumentException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
504        }
505        public Enumeration<AllergyIntoleranceCategory> fromType(Base code) throws FHIRException {
506          if (code == null || code.isEmpty())
507            return null;
508          String codeString = ((PrimitiveType) code).asStringValue();
509          if (codeString == null || "".equals(codeString))
510            return null;
511        if ("food".equals(codeString))
512          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.FOOD);
513        if ("medication".equals(codeString))
514          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.MEDICATION);
515        if ("environment".equals(codeString))
516          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.ENVIRONMENT);
517        if ("other".equals(codeString))
518          return new Enumeration<AllergyIntoleranceCategory>(this, AllergyIntoleranceCategory.OTHER);
519        throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
520        }
521    public String toCode(AllergyIntoleranceCategory code) {
522      if (code == AllergyIntoleranceCategory.FOOD)
523        return "food";
524      if (code == AllergyIntoleranceCategory.MEDICATION)
525        return "medication";
526      if (code == AllergyIntoleranceCategory.ENVIRONMENT)
527        return "environment";
528      if (code == AllergyIntoleranceCategory.OTHER)
529        return "other";
530      return "?";
531      }
532    }
533
534    public enum AllergyIntoleranceCertainty {
535        /**
536         * There is a low level of clinical certainty that the reaction was caused by the identified Substance.
537         */
538        UNLIKELY, 
539        /**
540         * There is a high level of clinical certainty that the reaction was caused by the identified Substance.
541         */
542        LIKELY, 
543        /**
544         * There is a very high level of clinical certainty that the reaction was due to the identified Substance, which may include clinical evidence by testing or rechallenge.
545         */
546        CONFIRMED, 
547        /**
548         * added to help the parsers
549         */
550        NULL;
551        public static AllergyIntoleranceCertainty fromCode(String codeString) throws FHIRException {
552            if (codeString == null || "".equals(codeString))
553                return null;
554        if ("unlikely".equals(codeString))
555          return UNLIKELY;
556        if ("likely".equals(codeString))
557          return LIKELY;
558        if ("confirmed".equals(codeString))
559          return CONFIRMED;
560        throw new FHIRException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
561        }
562        public String toCode() {
563          switch (this) {
564            case UNLIKELY: return "unlikely";
565            case LIKELY: return "likely";
566            case CONFIRMED: return "confirmed";
567            case NULL: return null;
568            default: return "?";
569          }
570        }
571        public String getSystem() {
572          switch (this) {
573            case UNLIKELY: return "http://hl7.org/fhir/reaction-event-certainty";
574            case LIKELY: return "http://hl7.org/fhir/reaction-event-certainty";
575            case CONFIRMED: return "http://hl7.org/fhir/reaction-event-certainty";
576            case NULL: return null;
577            default: return "?";
578          }
579        }
580        public String getDefinition() {
581          switch (this) {
582            case UNLIKELY: return "There is a low level of clinical certainty that the reaction was caused by the identified Substance.";
583            case LIKELY: return "There is a high level of clinical certainty that the reaction was caused by the identified Substance.";
584            case CONFIRMED: return "There is a very high level of clinical certainty that the reaction was due to the identified Substance, which may include clinical evidence by testing or rechallenge.";
585            case NULL: return null;
586            default: return "?";
587          }
588        }
589        public String getDisplay() {
590          switch (this) {
591            case UNLIKELY: return "Unlikely";
592            case LIKELY: return "Likely";
593            case CONFIRMED: return "Confirmed";
594            case NULL: return null;
595            default: return "?";
596          }
597        }
598    }
599
600  public static class AllergyIntoleranceCertaintyEnumFactory implements EnumFactory<AllergyIntoleranceCertainty> {
601    public AllergyIntoleranceCertainty fromCode(String codeString) throws IllegalArgumentException {
602      if (codeString == null || "".equals(codeString))
603            if (codeString == null || "".equals(codeString))
604                return null;
605        if ("unlikely".equals(codeString))
606          return AllergyIntoleranceCertainty.UNLIKELY;
607        if ("likely".equals(codeString))
608          return AllergyIntoleranceCertainty.LIKELY;
609        if ("confirmed".equals(codeString))
610          return AllergyIntoleranceCertainty.CONFIRMED;
611        throw new IllegalArgumentException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
612        }
613        public Enumeration<AllergyIntoleranceCertainty> fromType(Base code) throws FHIRException {
614          if (code == null || code.isEmpty())
615            return null;
616          String codeString = ((PrimitiveType) code).asStringValue();
617          if (codeString == null || "".equals(codeString))
618            return null;
619        if ("unlikely".equals(codeString))
620          return new Enumeration<AllergyIntoleranceCertainty>(this, AllergyIntoleranceCertainty.UNLIKELY);
621        if ("likely".equals(codeString))
622          return new Enumeration<AllergyIntoleranceCertainty>(this, AllergyIntoleranceCertainty.LIKELY);
623        if ("confirmed".equals(codeString))
624          return new Enumeration<AllergyIntoleranceCertainty>(this, AllergyIntoleranceCertainty.CONFIRMED);
625        throw new FHIRException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
626        }
627    public String toCode(AllergyIntoleranceCertainty code) {
628      if (code == AllergyIntoleranceCertainty.UNLIKELY)
629        return "unlikely";
630      if (code == AllergyIntoleranceCertainty.LIKELY)
631        return "likely";
632      if (code == AllergyIntoleranceCertainty.CONFIRMED)
633        return "confirmed";
634      return "?";
635      }
636    }
637
638    public enum AllergyIntoleranceSeverity {
639        /**
640         * Causes mild physiological effects.
641         */
642        MILD, 
643        /**
644         * Causes moderate physiological effects.
645         */
646        MODERATE, 
647        /**
648         * Causes severe physiological effects.
649         */
650        SEVERE, 
651        /**
652         * added to help the parsers
653         */
654        NULL;
655        public static AllergyIntoleranceSeverity fromCode(String codeString) throws FHIRException {
656            if (codeString == null || "".equals(codeString))
657                return null;
658        if ("mild".equals(codeString))
659          return MILD;
660        if ("moderate".equals(codeString))
661          return MODERATE;
662        if ("severe".equals(codeString))
663          return SEVERE;
664        throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
665        }
666        public String toCode() {
667          switch (this) {
668            case MILD: return "mild";
669            case MODERATE: return "moderate";
670            case SEVERE: return "severe";
671            case NULL: return null;
672            default: return "?";
673          }
674        }
675        public String getSystem() {
676          switch (this) {
677            case MILD: return "http://hl7.org/fhir/reaction-event-severity";
678            case MODERATE: return "http://hl7.org/fhir/reaction-event-severity";
679            case SEVERE: return "http://hl7.org/fhir/reaction-event-severity";
680            case NULL: return null;
681            default: return "?";
682          }
683        }
684        public String getDefinition() {
685          switch (this) {
686            case MILD: return "Causes mild physiological effects.";
687            case MODERATE: return "Causes moderate physiological effects.";
688            case SEVERE: return "Causes severe physiological effects.";
689            case NULL: return null;
690            default: return "?";
691          }
692        }
693        public String getDisplay() {
694          switch (this) {
695            case MILD: return "Mild";
696            case MODERATE: return "Moderate";
697            case SEVERE: return "Severe";
698            case NULL: return null;
699            default: return "?";
700          }
701        }
702    }
703
704  public static class AllergyIntoleranceSeverityEnumFactory implements EnumFactory<AllergyIntoleranceSeverity> {
705    public AllergyIntoleranceSeverity fromCode(String codeString) throws IllegalArgumentException {
706      if (codeString == null || "".equals(codeString))
707            if (codeString == null || "".equals(codeString))
708                return null;
709        if ("mild".equals(codeString))
710          return AllergyIntoleranceSeverity.MILD;
711        if ("moderate".equals(codeString))
712          return AllergyIntoleranceSeverity.MODERATE;
713        if ("severe".equals(codeString))
714          return AllergyIntoleranceSeverity.SEVERE;
715        throw new IllegalArgumentException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
716        }
717        public Enumeration<AllergyIntoleranceSeverity> fromType(Base code) throws FHIRException {
718          if (code == null || code.isEmpty())
719            return null;
720          String codeString = ((PrimitiveType) code).asStringValue();
721          if (codeString == null || "".equals(codeString))
722            return null;
723        if ("mild".equals(codeString))
724          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.MILD);
725        if ("moderate".equals(codeString))
726          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.MODERATE);
727        if ("severe".equals(codeString))
728          return new Enumeration<AllergyIntoleranceSeverity>(this, AllergyIntoleranceSeverity.SEVERE);
729        throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
730        }
731    public String toCode(AllergyIntoleranceSeverity code) {
732      if (code == AllergyIntoleranceSeverity.MILD)
733        return "mild";
734      if (code == AllergyIntoleranceSeverity.MODERATE)
735        return "moderate";
736      if (code == AllergyIntoleranceSeverity.SEVERE)
737        return "severe";
738      return "?";
739      }
740    }
741
742    @Block()
743    public static class AllergyIntoleranceReactionComponent extends BackboneElement implements IBaseBackboneElement {
744        /**
745         * Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.
746         */
747        @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
748        @Description(shortDefinition="Specific substance considered to be responsible for event", formalDefinition="Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance." )
749        protected CodeableConcept substance;
750
751        /**
752         * Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
753         */
754        @Child(name = "certainty", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
755        @Description(shortDefinition="unlikely | likely | confirmed - clinical certainty about the specific substance", formalDefinition="Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event." )
756        protected Enumeration<AllergyIntoleranceCertainty> certainty;
757
758        /**
759         * Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.
760         */
761        @Child(name = "manifestation", type = {CodeableConcept.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
762        @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." )
763        protected List<CodeableConcept> manifestation;
764
765        /**
766         * Text description about the reaction as a whole, including details of the manifestation if required.
767         */
768        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
769        @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." )
770        protected StringType description;
771
772        /**
773         * Record of the date and/or time of the onset of the Reaction.
774         */
775        @Child(name = "onset", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
776        @Description(shortDefinition="Date(/time) when manifestations showed", formalDefinition="Record of the date and/or time of the onset of the Reaction." )
777        protected DateTimeType onset;
778
779        /**
780         * Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
781         */
782        @Child(name = "severity", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
783        @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." )
784        protected Enumeration<AllergyIntoleranceSeverity> severity;
785
786        /**
787         * Identification of the route by which the subject was exposed to the substance.
788         */
789        @Child(name = "exposureRoute", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
790        @Description(shortDefinition="How the subject was exposed to the substance", formalDefinition="Identification of the route by which the subject was exposed to the substance." )
791        protected CodeableConcept exposureRoute;
792
793        /**
794         * Additional text about the adverse reaction event not captured in other fields.
795         */
796        @Child(name = "note", type = {Annotation.class}, order=8, min=0, max=1, modifier=false, summary=false)
797        @Description(shortDefinition="Text about event not captured in other fields", formalDefinition="Additional text about the adverse reaction event not captured in other fields." )
798        protected Annotation note;
799
800        private static final long serialVersionUID = -765664367L;
801
802    /*
803     * Constructor
804     */
805      public AllergyIntoleranceReactionComponent() {
806        super();
807      }
808
809        /**
810         * @return {@link #substance} (Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.)
811         */
812        public CodeableConcept getSubstance() { 
813          if (this.substance == null)
814            if (Configuration.errorOnAutoCreate())
815              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.substance");
816            else if (Configuration.doAutoCreate())
817              this.substance = new CodeableConcept(); // cc
818          return this.substance;
819        }
820
821        public boolean hasSubstance() { 
822          return this.substance != null && !this.substance.isEmpty();
823        }
824
825        /**
826         * @param value {@link #substance} (Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.)
827         */
828        public AllergyIntoleranceReactionComponent setSubstance(CodeableConcept value) { 
829          this.substance = value;
830          return this;
831        }
832
833        /**
834         * @return {@link #certainty} (Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.). This is the underlying object with id, value and extensions. The accessor "getCertainty" gives direct access to the value
835         */
836        public Enumeration<AllergyIntoleranceCertainty> getCertaintyElement() { 
837          if (this.certainty == null)
838            if (Configuration.errorOnAutoCreate())
839              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.certainty");
840            else if (Configuration.doAutoCreate())
841              this.certainty = new Enumeration<AllergyIntoleranceCertainty>(new AllergyIntoleranceCertaintyEnumFactory()); // bb
842          return this.certainty;
843        }
844
845        public boolean hasCertaintyElement() { 
846          return this.certainty != null && !this.certainty.isEmpty();
847        }
848
849        public boolean hasCertainty() { 
850          return this.certainty != null && !this.certainty.isEmpty();
851        }
852
853        /**
854         * @param value {@link #certainty} (Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.). This is the underlying object with id, value and extensions. The accessor "getCertainty" gives direct access to the value
855         */
856        public AllergyIntoleranceReactionComponent setCertaintyElement(Enumeration<AllergyIntoleranceCertainty> value) { 
857          this.certainty = value;
858          return this;
859        }
860
861        /**
862         * @return Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
863         */
864        public AllergyIntoleranceCertainty getCertainty() { 
865          return this.certainty == null ? null : this.certainty.getValue();
866        }
867
868        /**
869         * @param value Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
870         */
871        public AllergyIntoleranceReactionComponent setCertainty(AllergyIntoleranceCertainty value) { 
872          if (value == null)
873            this.certainty = null;
874          else {
875            if (this.certainty == null)
876              this.certainty = new Enumeration<AllergyIntoleranceCertainty>(new AllergyIntoleranceCertaintyEnumFactory());
877            this.certainty.setValue(value);
878          }
879          return this;
880        }
881
882        /**
883         * @return {@link #manifestation} (Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.)
884         */
885        public List<CodeableConcept> getManifestation() { 
886          if (this.manifestation == null)
887            this.manifestation = new ArrayList<CodeableConcept>();
888          return this.manifestation;
889        }
890
891        public boolean hasManifestation() { 
892          if (this.manifestation == null)
893            return false;
894          for (CodeableConcept item : this.manifestation)
895            if (!item.isEmpty())
896              return true;
897          return false;
898        }
899
900        /**
901         * @return {@link #manifestation} (Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.)
902         */
903    // syntactic sugar
904        public CodeableConcept addManifestation() { //3
905          CodeableConcept t = new CodeableConcept();
906          if (this.manifestation == null)
907            this.manifestation = new ArrayList<CodeableConcept>();
908          this.manifestation.add(t);
909          return t;
910        }
911
912    // syntactic sugar
913        public AllergyIntoleranceReactionComponent addManifestation(CodeableConcept t) { //3
914          if (t == null)
915            return this;
916          if (this.manifestation == null)
917            this.manifestation = new ArrayList<CodeableConcept>();
918          this.manifestation.add(t);
919          return this;
920        }
921
922        /**
923         * @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
924         */
925        public StringType getDescriptionElement() { 
926          if (this.description == null)
927            if (Configuration.errorOnAutoCreate())
928              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.description");
929            else if (Configuration.doAutoCreate())
930              this.description = new StringType(); // bb
931          return this.description;
932        }
933
934        public boolean hasDescriptionElement() { 
935          return this.description != null && !this.description.isEmpty();
936        }
937
938        public boolean hasDescription() { 
939          return this.description != null && !this.description.isEmpty();
940        }
941
942        /**
943         * @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
944         */
945        public AllergyIntoleranceReactionComponent setDescriptionElement(StringType value) { 
946          this.description = value;
947          return this;
948        }
949
950        /**
951         * @return Text description about the reaction as a whole, including details of the manifestation if required.
952         */
953        public String getDescription() { 
954          return this.description == null ? null : this.description.getValue();
955        }
956
957        /**
958         * @param value Text description about the reaction as a whole, including details of the manifestation if required.
959         */
960        public AllergyIntoleranceReactionComponent setDescription(String value) { 
961          if (Utilities.noString(value))
962            this.description = null;
963          else {
964            if (this.description == null)
965              this.description = new StringType();
966            this.description.setValue(value);
967          }
968          return this;
969        }
970
971        /**
972         * @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
973         */
974        public DateTimeType getOnsetElement() { 
975          if (this.onset == null)
976            if (Configuration.errorOnAutoCreate())
977              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.onset");
978            else if (Configuration.doAutoCreate())
979              this.onset = new DateTimeType(); // bb
980          return this.onset;
981        }
982
983        public boolean hasOnsetElement() { 
984          return this.onset != null && !this.onset.isEmpty();
985        }
986
987        public boolean hasOnset() { 
988          return this.onset != null && !this.onset.isEmpty();
989        }
990
991        /**
992         * @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
993         */
994        public AllergyIntoleranceReactionComponent setOnsetElement(DateTimeType value) { 
995          this.onset = value;
996          return this;
997        }
998
999        /**
1000         * @return Record of the date and/or time of the onset of the Reaction.
1001         */
1002        public Date getOnset() { 
1003          return this.onset == null ? null : this.onset.getValue();
1004        }
1005
1006        /**
1007         * @param value Record of the date and/or time of the onset of the Reaction.
1008         */
1009        public AllergyIntoleranceReactionComponent setOnset(Date value) { 
1010          if (value == null)
1011            this.onset = null;
1012          else {
1013            if (this.onset == null)
1014              this.onset = new DateTimeType();
1015            this.onset.setValue(value);
1016          }
1017          return this;
1018        }
1019
1020        /**
1021         * @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
1022         */
1023        public Enumeration<AllergyIntoleranceSeverity> getSeverityElement() { 
1024          if (this.severity == null)
1025            if (Configuration.errorOnAutoCreate())
1026              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.severity");
1027            else if (Configuration.doAutoCreate())
1028              this.severity = new Enumeration<AllergyIntoleranceSeverity>(new AllergyIntoleranceSeverityEnumFactory()); // bb
1029          return this.severity;
1030        }
1031
1032        public boolean hasSeverityElement() { 
1033          return this.severity != null && !this.severity.isEmpty();
1034        }
1035
1036        public boolean hasSeverity() { 
1037          return this.severity != null && !this.severity.isEmpty();
1038        }
1039
1040        /**
1041         * @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
1042         */
1043        public AllergyIntoleranceReactionComponent setSeverityElement(Enumeration<AllergyIntoleranceSeverity> value) { 
1044          this.severity = value;
1045          return this;
1046        }
1047
1048        /**
1049         * @return Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
1050         */
1051        public AllergyIntoleranceSeverity getSeverity() { 
1052          return this.severity == null ? null : this.severity.getValue();
1053        }
1054
1055        /**
1056         * @param value Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
1057         */
1058        public AllergyIntoleranceReactionComponent setSeverity(AllergyIntoleranceSeverity value) { 
1059          if (value == null)
1060            this.severity = null;
1061          else {
1062            if (this.severity == null)
1063              this.severity = new Enumeration<AllergyIntoleranceSeverity>(new AllergyIntoleranceSeverityEnumFactory());
1064            this.severity.setValue(value);
1065          }
1066          return this;
1067        }
1068
1069        /**
1070         * @return {@link #exposureRoute} (Identification of the route by which the subject was exposed to the substance.)
1071         */
1072        public CodeableConcept getExposureRoute() { 
1073          if (this.exposureRoute == null)
1074            if (Configuration.errorOnAutoCreate())
1075              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.exposureRoute");
1076            else if (Configuration.doAutoCreate())
1077              this.exposureRoute = new CodeableConcept(); // cc
1078          return this.exposureRoute;
1079        }
1080
1081        public boolean hasExposureRoute() { 
1082          return this.exposureRoute != null && !this.exposureRoute.isEmpty();
1083        }
1084
1085        /**
1086         * @param value {@link #exposureRoute} (Identification of the route by which the subject was exposed to the substance.)
1087         */
1088        public AllergyIntoleranceReactionComponent setExposureRoute(CodeableConcept value) { 
1089          this.exposureRoute = value;
1090          return this;
1091        }
1092
1093        /**
1094         * @return {@link #note} (Additional text about the adverse reaction event not captured in other fields.)
1095         */
1096        public Annotation getNote() { 
1097          if (this.note == null)
1098            if (Configuration.errorOnAutoCreate())
1099              throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.note");
1100            else if (Configuration.doAutoCreate())
1101              this.note = new Annotation(); // cc
1102          return this.note;
1103        }
1104
1105        public boolean hasNote() { 
1106          return this.note != null && !this.note.isEmpty();
1107        }
1108
1109        /**
1110         * @param value {@link #note} (Additional text about the adverse reaction event not captured in other fields.)
1111         */
1112        public AllergyIntoleranceReactionComponent setNote(Annotation value) { 
1113          this.note = value;
1114          return this;
1115        }
1116
1117        protected void listChildren(List<Property> childrenList) {
1118          super.listChildren(childrenList);
1119          childrenList.add(new Property("substance", "CodeableConcept", "Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.", 0, java.lang.Integer.MAX_VALUE, substance));
1120          childrenList.add(new Property("certainty", "code", "Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.", 0, java.lang.Integer.MAX_VALUE, certainty));
1121          childrenList.add(new Property("manifestation", "CodeableConcept", "Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.", 0, java.lang.Integer.MAX_VALUE, manifestation));
1122          childrenList.add(new Property("description", "string", "Text description about the reaction as a whole, including details of the manifestation if required.", 0, java.lang.Integer.MAX_VALUE, description));
1123          childrenList.add(new Property("onset", "dateTime", "Record of the date and/or time of the onset of the Reaction.", 0, java.lang.Integer.MAX_VALUE, onset));
1124          childrenList.add(new Property("severity", "code", "Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.", 0, java.lang.Integer.MAX_VALUE, severity));
1125          childrenList.add(new Property("exposureRoute", "CodeableConcept", "Identification of the route by which the subject was exposed to the substance.", 0, java.lang.Integer.MAX_VALUE, exposureRoute));
1126          childrenList.add(new Property("note", "Annotation", "Additional text about the adverse reaction event not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note));
1127        }
1128
1129      @Override
1130      public void setProperty(String name, Base value) throws FHIRException {
1131        if (name.equals("substance"))
1132          this.substance = castToCodeableConcept(value); // CodeableConcept
1133        else if (name.equals("certainty"))
1134          this.certainty = new AllergyIntoleranceCertaintyEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCertainty>
1135        else if (name.equals("manifestation"))
1136          this.getManifestation().add(castToCodeableConcept(value));
1137        else if (name.equals("description"))
1138          this.description = castToString(value); // StringType
1139        else if (name.equals("onset"))
1140          this.onset = castToDateTime(value); // DateTimeType
1141        else if (name.equals("severity"))
1142          this.severity = new AllergyIntoleranceSeverityEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceSeverity>
1143        else if (name.equals("exposureRoute"))
1144          this.exposureRoute = castToCodeableConcept(value); // CodeableConcept
1145        else if (name.equals("note"))
1146          this.note = castToAnnotation(value); // Annotation
1147        else
1148          super.setProperty(name, value);
1149      }
1150
1151      @Override
1152      public Base addChild(String name) throws FHIRException {
1153        if (name.equals("substance")) {
1154          this.substance = new CodeableConcept();
1155          return this.substance;
1156        }
1157        else if (name.equals("certainty")) {
1158          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.certainty");
1159        }
1160        else if (name.equals("manifestation")) {
1161          return addManifestation();
1162        }
1163        else if (name.equals("description")) {
1164          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.description");
1165        }
1166        else if (name.equals("onset")) {
1167          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.onset");
1168        }
1169        else if (name.equals("severity")) {
1170          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.severity");
1171        }
1172        else if (name.equals("exposureRoute")) {
1173          this.exposureRoute = new CodeableConcept();
1174          return this.exposureRoute;
1175        }
1176        else if (name.equals("note")) {
1177          this.note = new Annotation();
1178          return this.note;
1179        }
1180        else
1181          return super.addChild(name);
1182      }
1183
1184      public AllergyIntoleranceReactionComponent copy() {
1185        AllergyIntoleranceReactionComponent dst = new AllergyIntoleranceReactionComponent();
1186        copyValues(dst);
1187        dst.substance = substance == null ? null : substance.copy();
1188        dst.certainty = certainty == null ? null : certainty.copy();
1189        if (manifestation != null) {
1190          dst.manifestation = new ArrayList<CodeableConcept>();
1191          for (CodeableConcept i : manifestation)
1192            dst.manifestation.add(i.copy());
1193        };
1194        dst.description = description == null ? null : description.copy();
1195        dst.onset = onset == null ? null : onset.copy();
1196        dst.severity = severity == null ? null : severity.copy();
1197        dst.exposureRoute = exposureRoute == null ? null : exposureRoute.copy();
1198        dst.note = note == null ? null : note.copy();
1199        return dst;
1200      }
1201
1202      @Override
1203      public boolean equalsDeep(Base other) {
1204        if (!super.equalsDeep(other))
1205          return false;
1206        if (!(other instanceof AllergyIntoleranceReactionComponent))
1207          return false;
1208        AllergyIntoleranceReactionComponent o = (AllergyIntoleranceReactionComponent) other;
1209        return compareDeep(substance, o.substance, true) && compareDeep(certainty, o.certainty, true) && compareDeep(manifestation, o.manifestation, true)
1210           && compareDeep(description, o.description, true) && compareDeep(onset, o.onset, true) && compareDeep(severity, o.severity, true)
1211           && compareDeep(exposureRoute, o.exposureRoute, true) && compareDeep(note, o.note, true);
1212      }
1213
1214      @Override
1215      public boolean equalsShallow(Base other) {
1216        if (!super.equalsShallow(other))
1217          return false;
1218        if (!(other instanceof AllergyIntoleranceReactionComponent))
1219          return false;
1220        AllergyIntoleranceReactionComponent o = (AllergyIntoleranceReactionComponent) other;
1221        return compareValues(certainty, o.certainty, true) && compareValues(description, o.description, true)
1222           && compareValues(onset, o.onset, true) && compareValues(severity, o.severity, true);
1223      }
1224
1225      public boolean isEmpty() {
1226        return super.isEmpty() && (substance == null || substance.isEmpty()) && (certainty == null || certainty.isEmpty())
1227           && (manifestation == null || manifestation.isEmpty()) && (description == null || description.isEmpty())
1228           && (onset == null || onset.isEmpty()) && (severity == null || severity.isEmpty()) && (exposureRoute == null || exposureRoute.isEmpty())
1229           && (note == null || note.isEmpty());
1230      }
1231
1232  public String fhirType() {
1233    return "AllergyIntolerance.reaction";
1234
1235  }
1236
1237  }
1238
1239    /**
1240     * 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).
1241     */
1242    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1243    @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)." )
1244    protected List<Identifier> identifier;
1245
1246    /**
1247     * Record of the date and/or time of the onset of the Allergy or Intolerance.
1248     */
1249    @Child(name = "onset", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1250    @Description(shortDefinition="Date(/time) when manifestations showed", formalDefinition="Record of the date and/or time of the onset of the Allergy or Intolerance." )
1251    protected DateTimeType onset;
1252
1253    /**
1254     * Date when the sensitivity was recorded.
1255     */
1256    @Child(name = "recordedDate", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1257    @Description(shortDefinition="When recorded", formalDefinition="Date when the sensitivity was recorded." )
1258    protected DateTimeType recordedDate;
1259
1260    /**
1261     * Individual who recorded the record and takes responsibility for its conten.
1262     */
1263    @Child(name = "recorder", type = {Practitioner.class, Patient.class}, order=3, min=0, max=1, modifier=false, summary=true)
1264    @Description(shortDefinition="Who recorded the sensitivity", formalDefinition="Individual who recorded the record and takes responsibility for its conten." )
1265    protected Reference recorder;
1266
1267    /**
1268     * The actual object that is the target of the reference (Individual who recorded the record and takes responsibility for its conten.)
1269     */
1270    protected Resource recorderTarget;
1271
1272    /**
1273     * The patient who has the allergy or intolerance.
1274     */
1275    @Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
1276    @Description(shortDefinition="Who the sensitivity is for", formalDefinition="The patient who has the allergy or intolerance." )
1277    protected Reference patient;
1278
1279    /**
1280     * The actual object that is the target of the reference (The patient who has the allergy or intolerance.)
1281     */
1282    protected Patient patientTarget;
1283
1284    /**
1285     * The source of the information about the allergy that is recorded.
1286     */
1287    @Child(name = "reporter", type = {Patient.class, RelatedPerson.class, Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
1288    @Description(shortDefinition="Source of the information about the allergy", formalDefinition="The source of the information about the allergy that is recorded." )
1289    protected Reference reporter;
1290
1291    /**
1292     * The actual object that is the target of the reference (The source of the information about the allergy that is recorded.)
1293     */
1294    protected Resource reporterTarget;
1295
1296    /**
1297     * Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.
1298     */
1299    @Child(name = "substance", type = {CodeableConcept.class}, order=6, min=1, max=1, modifier=false, summary=true)
1300    @Description(shortDefinition="Substance, (or class) considered to be responsible for risk", formalDefinition="Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk." )
1301    protected CodeableConcept substance;
1302
1303    /**
1304     * Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.
1305     */
1306    @Child(name = "status", type = {CodeType.class}, order=7, min=0, max=1, modifier=true, summary=true)
1307    @Description(shortDefinition="active | unconfirmed | confirmed | inactive | resolved | refuted | entered-in-error", formalDefinition="Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance." )
1308    protected Enumeration<AllergyIntoleranceStatus> status;
1309
1310    /**
1311     * Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.
1312     */
1313    @Child(name = "criticality", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1314    @Description(shortDefinition="CRITL | CRITH | CRITU", formalDefinition="Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance." )
1315    protected Enumeration<AllergyIntoleranceCriticality> criticality;
1316
1317    /**
1318     * Identification of the underlying physiological mechanism for the reaction risk.
1319     */
1320    @Child(name = "type", type = {CodeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1321    @Description(shortDefinition="allergy | intolerance - Underlying mechanism (if known)", formalDefinition="Identification of the underlying physiological mechanism for the reaction risk." )
1322    protected Enumeration<AllergyIntoleranceType> type;
1323
1324    /**
1325     * Category of the identified Substance.
1326     */
1327    @Child(name = "category", type = {CodeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1328    @Description(shortDefinition="food | medication | environment | other - Category of Substance", formalDefinition="Category of the identified Substance." )
1329    protected Enumeration<AllergyIntoleranceCategory> category;
1330
1331    /**
1332     * Represents the date and/or time of the last known occurrence of a reaction event.
1333     */
1334    @Child(name = "lastOccurence", type = {DateTimeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
1335    @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." )
1336    protected DateTimeType lastOccurence;
1337
1338    /**
1339     * Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.
1340     */
1341    @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=1, modifier=false, summary=false)
1342    @Description(shortDefinition="Additional text not captured in other fields", formalDefinition="Additional narrative about the propensity for the Adverse Reaction, not captured in other fields." )
1343    protected Annotation note;
1344
1345    /**
1346     * Details about each adverse reaction event linked to exposure to the identified Substance.
1347     */
1348    @Child(name = "reaction", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1349    @Description(shortDefinition="Adverse Reaction Events linked to exposure to substance", formalDefinition="Details about each adverse reaction event linked to exposure to the identified Substance." )
1350    protected List<AllergyIntoleranceReactionComponent> reaction;
1351
1352    private static final long serialVersionUID = -1657522921L;
1353
1354  /*
1355   * Constructor
1356   */
1357    public AllergyIntolerance() {
1358      super();
1359    }
1360
1361  /*
1362   * Constructor
1363   */
1364    public AllergyIntolerance(Reference patient, CodeableConcept substance) {
1365      super();
1366      this.patient = patient;
1367      this.substance = substance;
1368    }
1369
1370    /**
1371     * @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).)
1372     */
1373    public List<Identifier> getIdentifier() { 
1374      if (this.identifier == null)
1375        this.identifier = new ArrayList<Identifier>();
1376      return this.identifier;
1377    }
1378
1379    public boolean hasIdentifier() { 
1380      if (this.identifier == null)
1381        return false;
1382      for (Identifier item : this.identifier)
1383        if (!item.isEmpty())
1384          return true;
1385      return false;
1386    }
1387
1388    /**
1389     * @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).)
1390     */
1391    // syntactic sugar
1392    public Identifier addIdentifier() { //3
1393      Identifier t = new Identifier();
1394      if (this.identifier == null)
1395        this.identifier = new ArrayList<Identifier>();
1396      this.identifier.add(t);
1397      return t;
1398    }
1399
1400    // syntactic sugar
1401    public AllergyIntolerance addIdentifier(Identifier t) { //3
1402      if (t == null)
1403        return this;
1404      if (this.identifier == null)
1405        this.identifier = new ArrayList<Identifier>();
1406      this.identifier.add(t);
1407      return this;
1408    }
1409
1410    /**
1411     * @return {@link #onset} (Record of the date and/or time of the onset of the Allergy or Intolerance.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
1412     */
1413    public DateTimeType getOnsetElement() { 
1414      if (this.onset == null)
1415        if (Configuration.errorOnAutoCreate())
1416          throw new Error("Attempt to auto-create AllergyIntolerance.onset");
1417        else if (Configuration.doAutoCreate())
1418          this.onset = new DateTimeType(); // bb
1419      return this.onset;
1420    }
1421
1422    public boolean hasOnsetElement() { 
1423      return this.onset != null && !this.onset.isEmpty();
1424    }
1425
1426    public boolean hasOnset() { 
1427      return this.onset != null && !this.onset.isEmpty();
1428    }
1429
1430    /**
1431     * @param value {@link #onset} (Record of the date and/or time of the onset of the Allergy or Intolerance.). This is the underlying object with id, value and extensions. The accessor "getOnset" gives direct access to the value
1432     */
1433    public AllergyIntolerance setOnsetElement(DateTimeType value) { 
1434      this.onset = value;
1435      return this;
1436    }
1437
1438    /**
1439     * @return Record of the date and/or time of the onset of the Allergy or Intolerance.
1440     */
1441    public Date getOnset() { 
1442      return this.onset == null ? null : this.onset.getValue();
1443    }
1444
1445    /**
1446     * @param value Record of the date and/or time of the onset of the Allergy or Intolerance.
1447     */
1448    public AllergyIntolerance setOnset(Date value) { 
1449      if (value == null)
1450        this.onset = null;
1451      else {
1452        if (this.onset == null)
1453          this.onset = new DateTimeType();
1454        this.onset.setValue(value);
1455      }
1456      return this;
1457    }
1458
1459    /**
1460     * @return {@link #recordedDate} (Date when the sensitivity was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
1461     */
1462    public DateTimeType getRecordedDateElement() { 
1463      if (this.recordedDate == null)
1464        if (Configuration.errorOnAutoCreate())
1465          throw new Error("Attempt to auto-create AllergyIntolerance.recordedDate");
1466        else if (Configuration.doAutoCreate())
1467          this.recordedDate = new DateTimeType(); // bb
1468      return this.recordedDate;
1469    }
1470
1471    public boolean hasRecordedDateElement() { 
1472      return this.recordedDate != null && !this.recordedDate.isEmpty();
1473    }
1474
1475    public boolean hasRecordedDate() { 
1476      return this.recordedDate != null && !this.recordedDate.isEmpty();
1477    }
1478
1479    /**
1480     * @param value {@link #recordedDate} (Date when the sensitivity was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
1481     */
1482    public AllergyIntolerance setRecordedDateElement(DateTimeType value) { 
1483      this.recordedDate = value;
1484      return this;
1485    }
1486
1487    /**
1488     * @return Date when the sensitivity was recorded.
1489     */
1490    public Date getRecordedDate() { 
1491      return this.recordedDate == null ? null : this.recordedDate.getValue();
1492    }
1493
1494    /**
1495     * @param value Date when the sensitivity was recorded.
1496     */
1497    public AllergyIntolerance setRecordedDate(Date value) { 
1498      if (value == null)
1499        this.recordedDate = null;
1500      else {
1501        if (this.recordedDate == null)
1502          this.recordedDate = new DateTimeType();
1503        this.recordedDate.setValue(value);
1504      }
1505      return this;
1506    }
1507
1508    /**
1509     * @return {@link #recorder} (Individual who recorded the record and takes responsibility for its conten.)
1510     */
1511    public Reference getRecorder() { 
1512      if (this.recorder == null)
1513        if (Configuration.errorOnAutoCreate())
1514          throw new Error("Attempt to auto-create AllergyIntolerance.recorder");
1515        else if (Configuration.doAutoCreate())
1516          this.recorder = new Reference(); // cc
1517      return this.recorder;
1518    }
1519
1520    public boolean hasRecorder() { 
1521      return this.recorder != null && !this.recorder.isEmpty();
1522    }
1523
1524    /**
1525     * @param value {@link #recorder} (Individual who recorded the record and takes responsibility for its conten.)
1526     */
1527    public AllergyIntolerance setRecorder(Reference value) { 
1528      this.recorder = value;
1529      return this;
1530    }
1531
1532    /**
1533     * @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 conten.)
1534     */
1535    public Resource getRecorderTarget() { 
1536      return this.recorderTarget;
1537    }
1538
1539    /**
1540     * @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 conten.)
1541     */
1542    public AllergyIntolerance setRecorderTarget(Resource value) { 
1543      this.recorderTarget = value;
1544      return this;
1545    }
1546
1547    /**
1548     * @return {@link #patient} (The patient who has the allergy or intolerance.)
1549     */
1550    public Reference getPatient() { 
1551      if (this.patient == null)
1552        if (Configuration.errorOnAutoCreate())
1553          throw new Error("Attempt to auto-create AllergyIntolerance.patient");
1554        else if (Configuration.doAutoCreate())
1555          this.patient = new Reference(); // cc
1556      return this.patient;
1557    }
1558
1559    public boolean hasPatient() { 
1560      return this.patient != null && !this.patient.isEmpty();
1561    }
1562
1563    /**
1564     * @param value {@link #patient} (The patient who has the allergy or intolerance.)
1565     */
1566    public AllergyIntolerance setPatient(Reference value) { 
1567      this.patient = value;
1568      return this;
1569    }
1570
1571    /**
1572     * @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.)
1573     */
1574    public Patient getPatientTarget() { 
1575      if (this.patientTarget == null)
1576        if (Configuration.errorOnAutoCreate())
1577          throw new Error("Attempt to auto-create AllergyIntolerance.patient");
1578        else if (Configuration.doAutoCreate())
1579          this.patientTarget = new Patient(); // aa
1580      return this.patientTarget;
1581    }
1582
1583    /**
1584     * @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.)
1585     */
1586    public AllergyIntolerance setPatientTarget(Patient value) { 
1587      this.patientTarget = value;
1588      return this;
1589    }
1590
1591    /**
1592     * @return {@link #reporter} (The source of the information about the allergy that is recorded.)
1593     */
1594    public Reference getReporter() { 
1595      if (this.reporter == null)
1596        if (Configuration.errorOnAutoCreate())
1597          throw new Error("Attempt to auto-create AllergyIntolerance.reporter");
1598        else if (Configuration.doAutoCreate())
1599          this.reporter = new Reference(); // cc
1600      return this.reporter;
1601    }
1602
1603    public boolean hasReporter() { 
1604      return this.reporter != null && !this.reporter.isEmpty();
1605    }
1606
1607    /**
1608     * @param value {@link #reporter} (The source of the information about the allergy that is recorded.)
1609     */
1610    public AllergyIntolerance setReporter(Reference value) { 
1611      this.reporter = value;
1612      return this;
1613    }
1614
1615    /**
1616     * @return {@link #reporter} 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.)
1617     */
1618    public Resource getReporterTarget() { 
1619      return this.reporterTarget;
1620    }
1621
1622    /**
1623     * @param value {@link #reporter} 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.)
1624     */
1625    public AllergyIntolerance setReporterTarget(Resource value) { 
1626      this.reporterTarget = value;
1627      return this;
1628    }
1629
1630    /**
1631     * @return {@link #substance} (Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.)
1632     */
1633    public CodeableConcept getSubstance() { 
1634      if (this.substance == null)
1635        if (Configuration.errorOnAutoCreate())
1636          throw new Error("Attempt to auto-create AllergyIntolerance.substance");
1637        else if (Configuration.doAutoCreate())
1638          this.substance = new CodeableConcept(); // cc
1639      return this.substance;
1640    }
1641
1642    public boolean hasSubstance() { 
1643      return this.substance != null && !this.substance.isEmpty();
1644    }
1645
1646    /**
1647     * @param value {@link #substance} (Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.)
1648     */
1649    public AllergyIntolerance setSubstance(CodeableConcept value) { 
1650      this.substance = value;
1651      return this;
1652    }
1653
1654    /**
1655     * @return {@link #status} (Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1656     */
1657    public Enumeration<AllergyIntoleranceStatus> getStatusElement() { 
1658      if (this.status == null)
1659        if (Configuration.errorOnAutoCreate())
1660          throw new Error("Attempt to auto-create AllergyIntolerance.status");
1661        else if (Configuration.doAutoCreate())
1662          this.status = new Enumeration<AllergyIntoleranceStatus>(new AllergyIntoleranceStatusEnumFactory()); // bb
1663      return this.status;
1664    }
1665
1666    public boolean hasStatusElement() { 
1667      return this.status != null && !this.status.isEmpty();
1668    }
1669
1670    public boolean hasStatus() { 
1671      return this.status != null && !this.status.isEmpty();
1672    }
1673
1674    /**
1675     * @param value {@link #status} (Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1676     */
1677    public AllergyIntolerance setStatusElement(Enumeration<AllergyIntoleranceStatus> value) { 
1678      this.status = value;
1679      return this;
1680    }
1681
1682    /**
1683     * @return Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.
1684     */
1685    public AllergyIntoleranceStatus getStatus() { 
1686      return this.status == null ? null : this.status.getValue();
1687    }
1688
1689    /**
1690     * @param value Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.
1691     */
1692    public AllergyIntolerance setStatus(AllergyIntoleranceStatus value) { 
1693      if (value == null)
1694        this.status = null;
1695      else {
1696        if (this.status == null)
1697          this.status = new Enumeration<AllergyIntoleranceStatus>(new AllergyIntoleranceStatusEnumFactory());
1698        this.status.setValue(value);
1699      }
1700      return this;
1701    }
1702
1703    /**
1704     * @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
1705     */
1706    public Enumeration<AllergyIntoleranceCriticality> getCriticalityElement() { 
1707      if (this.criticality == null)
1708        if (Configuration.errorOnAutoCreate())
1709          throw new Error("Attempt to auto-create AllergyIntolerance.criticality");
1710        else if (Configuration.doAutoCreate())
1711          this.criticality = new Enumeration<AllergyIntoleranceCriticality>(new AllergyIntoleranceCriticalityEnumFactory()); // bb
1712      return this.criticality;
1713    }
1714
1715    public boolean hasCriticalityElement() { 
1716      return this.criticality != null && !this.criticality.isEmpty();
1717    }
1718
1719    public boolean hasCriticality() { 
1720      return this.criticality != null && !this.criticality.isEmpty();
1721    }
1722
1723    /**
1724     * @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
1725     */
1726    public AllergyIntolerance setCriticalityElement(Enumeration<AllergyIntoleranceCriticality> value) { 
1727      this.criticality = value;
1728      return this;
1729    }
1730
1731    /**
1732     * @return Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.
1733     */
1734    public AllergyIntoleranceCriticality getCriticality() { 
1735      return this.criticality == null ? null : this.criticality.getValue();
1736    }
1737
1738    /**
1739     * @param value Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.
1740     */
1741    public AllergyIntolerance setCriticality(AllergyIntoleranceCriticality value) { 
1742      if (value == null)
1743        this.criticality = null;
1744      else {
1745        if (this.criticality == null)
1746          this.criticality = new Enumeration<AllergyIntoleranceCriticality>(new AllergyIntoleranceCriticalityEnumFactory());
1747        this.criticality.setValue(value);
1748      }
1749      return this;
1750    }
1751
1752    /**
1753     * @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
1754     */
1755    public Enumeration<AllergyIntoleranceType> getTypeElement() { 
1756      if (this.type == null)
1757        if (Configuration.errorOnAutoCreate())
1758          throw new Error("Attempt to auto-create AllergyIntolerance.type");
1759        else if (Configuration.doAutoCreate())
1760          this.type = new Enumeration<AllergyIntoleranceType>(new AllergyIntoleranceTypeEnumFactory()); // bb
1761      return this.type;
1762    }
1763
1764    public boolean hasTypeElement() { 
1765      return this.type != null && !this.type.isEmpty();
1766    }
1767
1768    public boolean hasType() { 
1769      return this.type != null && !this.type.isEmpty();
1770    }
1771
1772    /**
1773     * @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
1774     */
1775    public AllergyIntolerance setTypeElement(Enumeration<AllergyIntoleranceType> value) { 
1776      this.type = value;
1777      return this;
1778    }
1779
1780    /**
1781     * @return Identification of the underlying physiological mechanism for the reaction risk.
1782     */
1783    public AllergyIntoleranceType getType() { 
1784      return this.type == null ? null : this.type.getValue();
1785    }
1786
1787    /**
1788     * @param value Identification of the underlying physiological mechanism for the reaction risk.
1789     */
1790    public AllergyIntolerance setType(AllergyIntoleranceType value) { 
1791      if (value == null)
1792        this.type = null;
1793      else {
1794        if (this.type == null)
1795          this.type = new Enumeration<AllergyIntoleranceType>(new AllergyIntoleranceTypeEnumFactory());
1796        this.type.setValue(value);
1797      }
1798      return this;
1799    }
1800
1801    /**
1802     * @return {@link #category} (Category of the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1803     */
1804    public Enumeration<AllergyIntoleranceCategory> getCategoryElement() { 
1805      if (this.category == null)
1806        if (Configuration.errorOnAutoCreate())
1807          throw new Error("Attempt to auto-create AllergyIntolerance.category");
1808        else if (Configuration.doAutoCreate())
1809          this.category = new Enumeration<AllergyIntoleranceCategory>(new AllergyIntoleranceCategoryEnumFactory()); // bb
1810      return this.category;
1811    }
1812
1813    public boolean hasCategoryElement() { 
1814      return this.category != null && !this.category.isEmpty();
1815    }
1816
1817    public boolean hasCategory() { 
1818      return this.category != null && !this.category.isEmpty();
1819    }
1820
1821    /**
1822     * @param value {@link #category} (Category of the identified Substance.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1823     */
1824    public AllergyIntolerance setCategoryElement(Enumeration<AllergyIntoleranceCategory> value) { 
1825      this.category = value;
1826      return this;
1827    }
1828
1829    /**
1830     * @return Category of the identified Substance.
1831     */
1832    public AllergyIntoleranceCategory getCategory() { 
1833      return this.category == null ? null : this.category.getValue();
1834    }
1835
1836    /**
1837     * @param value Category of the identified Substance.
1838     */
1839    public AllergyIntolerance setCategory(AllergyIntoleranceCategory value) { 
1840      if (value == null)
1841        this.category = null;
1842      else {
1843        if (this.category == null)
1844          this.category = new Enumeration<AllergyIntoleranceCategory>(new AllergyIntoleranceCategoryEnumFactory());
1845        this.category.setValue(value);
1846      }
1847      return this;
1848    }
1849
1850    /**
1851     * @return {@link #lastOccurence} (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 "getLastOccurence" gives direct access to the value
1852     */
1853    public DateTimeType getLastOccurenceElement() { 
1854      if (this.lastOccurence == null)
1855        if (Configuration.errorOnAutoCreate())
1856          throw new Error("Attempt to auto-create AllergyIntolerance.lastOccurence");
1857        else if (Configuration.doAutoCreate())
1858          this.lastOccurence = new DateTimeType(); // bb
1859      return this.lastOccurence;
1860    }
1861
1862    public boolean hasLastOccurenceElement() { 
1863      return this.lastOccurence != null && !this.lastOccurence.isEmpty();
1864    }
1865
1866    public boolean hasLastOccurence() { 
1867      return this.lastOccurence != null && !this.lastOccurence.isEmpty();
1868    }
1869
1870    /**
1871     * @param value {@link #lastOccurence} (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 "getLastOccurence" gives direct access to the value
1872     */
1873    public AllergyIntolerance setLastOccurenceElement(DateTimeType value) { 
1874      this.lastOccurence = value;
1875      return this;
1876    }
1877
1878    /**
1879     * @return Represents the date and/or time of the last known occurrence of a reaction event.
1880     */
1881    public Date getLastOccurence() { 
1882      return this.lastOccurence == null ? null : this.lastOccurence.getValue();
1883    }
1884
1885    /**
1886     * @param value Represents the date and/or time of the last known occurrence of a reaction event.
1887     */
1888    public AllergyIntolerance setLastOccurence(Date value) { 
1889      if (value == null)
1890        this.lastOccurence = null;
1891      else {
1892        if (this.lastOccurence == null)
1893          this.lastOccurence = new DateTimeType();
1894        this.lastOccurence.setValue(value);
1895      }
1896      return this;
1897    }
1898
1899    /**
1900     * @return {@link #note} (Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.)
1901     */
1902    public Annotation getNote() { 
1903      if (this.note == null)
1904        if (Configuration.errorOnAutoCreate())
1905          throw new Error("Attempt to auto-create AllergyIntolerance.note");
1906        else if (Configuration.doAutoCreate())
1907          this.note = new Annotation(); // cc
1908      return this.note;
1909    }
1910
1911    public boolean hasNote() { 
1912      return this.note != null && !this.note.isEmpty();
1913    }
1914
1915    /**
1916     * @param value {@link #note} (Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.)
1917     */
1918    public AllergyIntolerance setNote(Annotation value) { 
1919      this.note = value;
1920      return this;
1921    }
1922
1923    /**
1924     * @return {@link #reaction} (Details about each adverse reaction event linked to exposure to the identified Substance.)
1925     */
1926    public List<AllergyIntoleranceReactionComponent> getReaction() { 
1927      if (this.reaction == null)
1928        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
1929      return this.reaction;
1930    }
1931
1932    public boolean hasReaction() { 
1933      if (this.reaction == null)
1934        return false;
1935      for (AllergyIntoleranceReactionComponent item : this.reaction)
1936        if (!item.isEmpty())
1937          return true;
1938      return false;
1939    }
1940
1941    /**
1942     * @return {@link #reaction} (Details about each adverse reaction event linked to exposure to the identified Substance.)
1943     */
1944    // syntactic sugar
1945    public AllergyIntoleranceReactionComponent addReaction() { //3
1946      AllergyIntoleranceReactionComponent t = new AllergyIntoleranceReactionComponent();
1947      if (this.reaction == null)
1948        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
1949      this.reaction.add(t);
1950      return t;
1951    }
1952
1953    // syntactic sugar
1954    public AllergyIntolerance addReaction(AllergyIntoleranceReactionComponent t) { //3
1955      if (t == null)
1956        return this;
1957      if (this.reaction == null)
1958        this.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
1959      this.reaction.add(t);
1960      return this;
1961    }
1962
1963      protected void listChildren(List<Property> childrenList) {
1964        super.listChildren(childrenList);
1965        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
1966        childrenList.add(new Property("onset", "dateTime", "Record of the date and/or time of the onset of the Allergy or Intolerance.", 0, java.lang.Integer.MAX_VALUE, onset));
1967        childrenList.add(new Property("recordedDate", "dateTime", "Date when the sensitivity was recorded.", 0, java.lang.Integer.MAX_VALUE, recordedDate));
1968        childrenList.add(new Property("recorder", "Reference(Practitioner|Patient)", "Individual who recorded the record and takes responsibility for its conten.", 0, java.lang.Integer.MAX_VALUE, recorder));
1969        childrenList.add(new Property("patient", "Reference(Patient)", "The patient who has the allergy or intolerance.", 0, java.lang.Integer.MAX_VALUE, patient));
1970        childrenList.add(new Property("reporter", "Reference(Patient|RelatedPerson|Practitioner)", "The source of the information about the allergy that is recorded.", 0, java.lang.Integer.MAX_VALUE, reporter));
1971        childrenList.add(new Property("substance", "CodeableConcept", "Identification of a substance, or a class of substances, that is considered to be responsible for the adverse reaction risk.", 0, java.lang.Integer.MAX_VALUE, substance));
1972        childrenList.add(new Property("status", "code", "Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified Substance.", 0, java.lang.Integer.MAX_VALUE, status));
1973        childrenList.add(new Property("criticality", "code", "Estimate of the potential clinical harm, or seriousness, of the reaction to the identified Substance.", 0, java.lang.Integer.MAX_VALUE, criticality));
1974        childrenList.add(new Property("type", "code", "Identification of the underlying physiological mechanism for the reaction risk.", 0, java.lang.Integer.MAX_VALUE, type));
1975        childrenList.add(new Property("category", "code", "Category of the identified Substance.", 0, java.lang.Integer.MAX_VALUE, category));
1976        childrenList.add(new Property("lastOccurence", "dateTime", "Represents the date and/or time of the last known occurrence of a reaction event.", 0, java.lang.Integer.MAX_VALUE, lastOccurence));
1977        childrenList.add(new Property("note", "Annotation", "Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.", 0, java.lang.Integer.MAX_VALUE, note));
1978        childrenList.add(new Property("reaction", "", "Details about each adverse reaction event linked to exposure to the identified Substance.", 0, java.lang.Integer.MAX_VALUE, reaction));
1979      }
1980
1981      @Override
1982      public void setProperty(String name, Base value) throws FHIRException {
1983        if (name.equals("identifier"))
1984          this.getIdentifier().add(castToIdentifier(value));
1985        else if (name.equals("onset"))
1986          this.onset = castToDateTime(value); // DateTimeType
1987        else if (name.equals("recordedDate"))
1988          this.recordedDate = castToDateTime(value); // DateTimeType
1989        else if (name.equals("recorder"))
1990          this.recorder = castToReference(value); // Reference
1991        else if (name.equals("patient"))
1992          this.patient = castToReference(value); // Reference
1993        else if (name.equals("reporter"))
1994          this.reporter = castToReference(value); // Reference
1995        else if (name.equals("substance"))
1996          this.substance = castToCodeableConcept(value); // CodeableConcept
1997        else if (name.equals("status"))
1998          this.status = new AllergyIntoleranceStatusEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceStatus>
1999        else if (name.equals("criticality"))
2000          this.criticality = new AllergyIntoleranceCriticalityEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCriticality>
2001        else if (name.equals("type"))
2002          this.type = new AllergyIntoleranceTypeEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceType>
2003        else if (name.equals("category"))
2004          this.category = new AllergyIntoleranceCategoryEnumFactory().fromType(value); // Enumeration<AllergyIntoleranceCategory>
2005        else if (name.equals("lastOccurence"))
2006          this.lastOccurence = castToDateTime(value); // DateTimeType
2007        else if (name.equals("note"))
2008          this.note = castToAnnotation(value); // Annotation
2009        else if (name.equals("reaction"))
2010          this.getReaction().add((AllergyIntoleranceReactionComponent) value);
2011        else
2012          super.setProperty(name, value);
2013      }
2014
2015      @Override
2016      public Base addChild(String name) throws FHIRException {
2017        if (name.equals("identifier")) {
2018          return addIdentifier();
2019        }
2020        else if (name.equals("onset")) {
2021          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.onset");
2022        }
2023        else if (name.equals("recordedDate")) {
2024          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.recordedDate");
2025        }
2026        else if (name.equals("recorder")) {
2027          this.recorder = new Reference();
2028          return this.recorder;
2029        }
2030        else if (name.equals("patient")) {
2031          this.patient = new Reference();
2032          return this.patient;
2033        }
2034        else if (name.equals("reporter")) {
2035          this.reporter = new Reference();
2036          return this.reporter;
2037        }
2038        else if (name.equals("substance")) {
2039          this.substance = new CodeableConcept();
2040          return this.substance;
2041        }
2042        else if (name.equals("status")) {
2043          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.status");
2044        }
2045        else if (name.equals("criticality")) {
2046          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.criticality");
2047        }
2048        else if (name.equals("type")) {
2049          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.type");
2050        }
2051        else if (name.equals("category")) {
2052          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.category");
2053        }
2054        else if (name.equals("lastOccurence")) {
2055          throw new FHIRException("Cannot call addChild on a primitive type AllergyIntolerance.lastOccurence");
2056        }
2057        else if (name.equals("note")) {
2058          this.note = new Annotation();
2059          return this.note;
2060        }
2061        else if (name.equals("reaction")) {
2062          return addReaction();
2063        }
2064        else
2065          return super.addChild(name);
2066      }
2067
2068  public String fhirType() {
2069    return "AllergyIntolerance";
2070
2071  }
2072
2073      public AllergyIntolerance copy() {
2074        AllergyIntolerance dst = new AllergyIntolerance();
2075        copyValues(dst);
2076        if (identifier != null) {
2077          dst.identifier = new ArrayList<Identifier>();
2078          for (Identifier i : identifier)
2079            dst.identifier.add(i.copy());
2080        };
2081        dst.onset = onset == null ? null : onset.copy();
2082        dst.recordedDate = recordedDate == null ? null : recordedDate.copy();
2083        dst.recorder = recorder == null ? null : recorder.copy();
2084        dst.patient = patient == null ? null : patient.copy();
2085        dst.reporter = reporter == null ? null : reporter.copy();
2086        dst.substance = substance == null ? null : substance.copy();
2087        dst.status = status == null ? null : status.copy();
2088        dst.criticality = criticality == null ? null : criticality.copy();
2089        dst.type = type == null ? null : type.copy();
2090        dst.category = category == null ? null : category.copy();
2091        dst.lastOccurence = lastOccurence == null ? null : lastOccurence.copy();
2092        dst.note = note == null ? null : note.copy();
2093        if (reaction != null) {
2094          dst.reaction = new ArrayList<AllergyIntoleranceReactionComponent>();
2095          for (AllergyIntoleranceReactionComponent i : reaction)
2096            dst.reaction.add(i.copy());
2097        };
2098        return dst;
2099      }
2100
2101      protected AllergyIntolerance typedCopy() {
2102        return copy();
2103      }
2104
2105      @Override
2106      public boolean equalsDeep(Base other) {
2107        if (!super.equalsDeep(other))
2108          return false;
2109        if (!(other instanceof AllergyIntolerance))
2110          return false;
2111        AllergyIntolerance o = (AllergyIntolerance) other;
2112        return compareDeep(identifier, o.identifier, true) && compareDeep(onset, o.onset, true) && compareDeep(recordedDate, o.recordedDate, true)
2113           && compareDeep(recorder, o.recorder, true) && compareDeep(patient, o.patient, true) && compareDeep(reporter, o.reporter, true)
2114           && compareDeep(substance, o.substance, true) && compareDeep(status, o.status, true) && compareDeep(criticality, o.criticality, true)
2115           && compareDeep(type, o.type, true) && compareDeep(category, o.category, true) && compareDeep(lastOccurence, o.lastOccurence, true)
2116           && compareDeep(note, o.note, true) && compareDeep(reaction, o.reaction, true);
2117      }
2118
2119      @Override
2120      public boolean equalsShallow(Base other) {
2121        if (!super.equalsShallow(other))
2122          return false;
2123        if (!(other instanceof AllergyIntolerance))
2124          return false;
2125        AllergyIntolerance o = (AllergyIntolerance) other;
2126        return compareValues(onset, o.onset, true) && compareValues(recordedDate, o.recordedDate, true) && compareValues(status, o.status, true)
2127           && compareValues(criticality, o.criticality, true) && compareValues(type, o.type, true) && compareValues(category, o.category, true)
2128           && compareValues(lastOccurence, o.lastOccurence, true);
2129      }
2130
2131      public boolean isEmpty() {
2132        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (onset == null || onset.isEmpty())
2133           && (recordedDate == null || recordedDate.isEmpty()) && (recorder == null || recorder.isEmpty())
2134           && (patient == null || patient.isEmpty()) && (reporter == null || reporter.isEmpty()) && (substance == null || substance.isEmpty())
2135           && (status == null || status.isEmpty()) && (criticality == null || criticality.isEmpty())
2136           && (type == null || type.isEmpty()) && (category == null || category.isEmpty()) && (lastOccurence == null || lastOccurence.isEmpty())
2137           && (note == null || note.isEmpty()) && (reaction == null || reaction.isEmpty());
2138      }
2139
2140  @Override
2141  public ResourceType getResourceType() {
2142    return ResourceType.AllergyIntolerance;
2143   }
2144
2145  @SearchParamDefinition(name="severity", path="AllergyIntolerance.reaction.severity", description="mild | moderate | severe (of event as a whole)", type="token" )
2146  public static final String SP_SEVERITY = "severity";
2147  @SearchParamDefinition(name="date", path="AllergyIntolerance.recordedDate", description="When recorded", type="date" )
2148  public static final String SP_DATE = "date";
2149  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier", description="External ids for this item", type="token" )
2150  public static final String SP_IDENTIFIER = "identifier";
2151  @SearchParamDefinition(name="manifestation", path="AllergyIntolerance.reaction.manifestation", description="Clinical symptoms/signs associated with the Event", type="token" )
2152  public static final String SP_MANIFESTATION = "manifestation";
2153  @SearchParamDefinition(name="recorder", path="AllergyIntolerance.recorder", description="Who recorded the sensitivity", type="reference" )
2154  public static final String SP_RECORDER = "recorder";
2155  @SearchParamDefinition(name="substance", path="AllergyIntolerance.substance | AllergyIntolerance.reaction.substance", description="Substance, (or class) considered to be responsible for risk", type="token" )
2156  public static final String SP_SUBSTANCE = "substance";
2157  @SearchParamDefinition(name="criticality", path="AllergyIntolerance.criticality", description="CRITL | CRITH | CRITU", type="token" )
2158  public static final String SP_CRITICALITY = "criticality";
2159  @SearchParamDefinition(name="reporter", path="AllergyIntolerance.reporter", description="Source of the information about the allergy", type="reference" )
2160  public static final String SP_REPORTER = "reporter";
2161  @SearchParamDefinition(name="type", path="AllergyIntolerance.type", description="allergy | intolerance - Underlying mechanism (if known)", type="token" )
2162  public static final String SP_TYPE = "type";
2163  @SearchParamDefinition(name="onset", path="AllergyIntolerance.reaction.onset", description="Date(/time) when manifestations showed", type="date" )
2164  public static final String SP_ONSET = "onset";
2165  @SearchParamDefinition(name="route", path="AllergyIntolerance.reaction.exposureRoute", description="How the subject was exposed to the substance", type="token" )
2166  public static final String SP_ROUTE = "route";
2167  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient", description="Who the sensitivity is for", type="reference" )
2168  public static final String SP_PATIENT = "patient";
2169  @SearchParamDefinition(name="category", path="AllergyIntolerance.category", description="food | medication | environment | other - Category of Substance", type="token" )
2170  public static final String SP_CATEGORY = "category";
2171  @SearchParamDefinition(name="last-date", path="AllergyIntolerance.lastOccurence", description="Date(/time) of last known occurrence of a reaction", type="date" )
2172  public static final String SP_LASTDATE = "last-date";
2173  @SearchParamDefinition(name="status", path="AllergyIntolerance.status", description="active | unconfirmed | confirmed | inactive | resolved | refuted | entered-in-error", type="token" )
2174  public static final String SP_STATUS = "status";
2175
2176}