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