001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045import org.hl7.fhir.exceptions.FHIRFormatError;
046/**
047 * Actual or  potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, a research study or other healthcare setting factors that requires additional monitoring, treatment, or hospitalization, or that results in death.
048 */
049@ResourceDef(name="AdverseEvent", profile="http://hl7.org/fhir/StructureDefinition/AdverseEvent")
050public class AdverseEvent extends DomainResource {
051
052    public enum AdverseEventCategory {
053        /**
054         * null
055         */
056        AE, 
057        /**
058         * null
059         */
060        PAE, 
061        /**
062         * added to help the parsers with the generic types
063         */
064        NULL;
065        public static AdverseEventCategory fromCode(String codeString) throws FHIRException {
066            if (codeString == null || "".equals(codeString))
067                return null;
068        if ("AE".equals(codeString))
069          return AE;
070        if ("PAE".equals(codeString))
071          return PAE;
072        if (Configuration.isAcceptInvalidEnums())
073          return null;
074        else
075          throw new FHIRException("Unknown AdverseEventCategory code '"+codeString+"'");
076        }
077        public String toCode() {
078          switch (this) {
079            case AE: return "AE";
080            case PAE: return "PAE";
081            default: return "?";
082          }
083        }
084        public String getSystem() {
085          switch (this) {
086            case AE: return "http://hl7.org/fhir/adverse-event-category";
087            case PAE: return "http://hl7.org/fhir/adverse-event-category";
088            default: return "?";
089          }
090        }
091        public String getDefinition() {
092          switch (this) {
093            case AE: return "";
094            case PAE: return "";
095            default: return "?";
096          }
097        }
098        public String getDisplay() {
099          switch (this) {
100            case AE: return "Adverse Event";
101            case PAE: return "Potential Adverse Event";
102            default: return "?";
103          }
104        }
105    }
106
107  public static class AdverseEventCategoryEnumFactory implements EnumFactory<AdverseEventCategory> {
108    public AdverseEventCategory fromCode(String codeString) throws IllegalArgumentException {
109      if (codeString == null || "".equals(codeString))
110            if (codeString == null || "".equals(codeString))
111                return null;
112        if ("AE".equals(codeString))
113          return AdverseEventCategory.AE;
114        if ("PAE".equals(codeString))
115          return AdverseEventCategory.PAE;
116        throw new IllegalArgumentException("Unknown AdverseEventCategory code '"+codeString+"'");
117        }
118        public Enumeration<AdverseEventCategory> fromType(Base code) throws FHIRException {
119          if (code == null)
120            return null;
121          if (code.isEmpty())
122            return new Enumeration<AdverseEventCategory>(this);
123          String codeString = ((PrimitiveType) code).asStringValue();
124          if (codeString == null || "".equals(codeString))
125            return null;
126        if ("AE".equals(codeString))
127          return new Enumeration<AdverseEventCategory>(this, AdverseEventCategory.AE);
128        if ("PAE".equals(codeString))
129          return new Enumeration<AdverseEventCategory>(this, AdverseEventCategory.PAE);
130        throw new FHIRException("Unknown AdverseEventCategory code '"+codeString+"'");
131        }
132    public String toCode(AdverseEventCategory code) {
133      if (code == AdverseEventCategory.AE)
134        return "AE";
135      if (code == AdverseEventCategory.PAE)
136        return "PAE";
137      return "?";
138      }
139    public String toSystem(AdverseEventCategory code) {
140      return code.getSystem();
141      }
142    }
143
144    public enum AdverseEventCausality {
145        /**
146         * null
147         */
148        CAUSALITY1, 
149        /**
150         * null
151         */
152        CAUSALITY2, 
153        /**
154         * added to help the parsers with the generic types
155         */
156        NULL;
157        public static AdverseEventCausality fromCode(String codeString) throws FHIRException {
158            if (codeString == null || "".equals(codeString))
159                return null;
160        if ("causality1".equals(codeString))
161          return CAUSALITY1;
162        if ("causality2".equals(codeString))
163          return CAUSALITY2;
164        if (Configuration.isAcceptInvalidEnums())
165          return null;
166        else
167          throw new FHIRException("Unknown AdverseEventCausality code '"+codeString+"'");
168        }
169        public String toCode() {
170          switch (this) {
171            case CAUSALITY1: return "causality1";
172            case CAUSALITY2: return "causality2";
173            default: return "?";
174          }
175        }
176        public String getSystem() {
177          switch (this) {
178            case CAUSALITY1: return "http://hl7.org/fhir/adverse-event-causality";
179            case CAUSALITY2: return "http://hl7.org/fhir/adverse-event-causality";
180            default: return "?";
181          }
182        }
183        public String getDefinition() {
184          switch (this) {
185            case CAUSALITY1: return "";
186            case CAUSALITY2: return "";
187            default: return "?";
188          }
189        }
190        public String getDisplay() {
191          switch (this) {
192            case CAUSALITY1: return "causality1 placeholder";
193            case CAUSALITY2: return "causality2 placeholder";
194            default: return "?";
195          }
196        }
197    }
198
199  public static class AdverseEventCausalityEnumFactory implements EnumFactory<AdverseEventCausality> {
200    public AdverseEventCausality fromCode(String codeString) throws IllegalArgumentException {
201      if (codeString == null || "".equals(codeString))
202            if (codeString == null || "".equals(codeString))
203                return null;
204        if ("causality1".equals(codeString))
205          return AdverseEventCausality.CAUSALITY1;
206        if ("causality2".equals(codeString))
207          return AdverseEventCausality.CAUSALITY2;
208        throw new IllegalArgumentException("Unknown AdverseEventCausality code '"+codeString+"'");
209        }
210        public Enumeration<AdverseEventCausality> fromType(Base code) throws FHIRException {
211          if (code == null)
212            return null;
213          if (code.isEmpty())
214            return new Enumeration<AdverseEventCausality>(this);
215          String codeString = ((PrimitiveType) code).asStringValue();
216          if (codeString == null || "".equals(codeString))
217            return null;
218        if ("causality1".equals(codeString))
219          return new Enumeration<AdverseEventCausality>(this, AdverseEventCausality.CAUSALITY1);
220        if ("causality2".equals(codeString))
221          return new Enumeration<AdverseEventCausality>(this, AdverseEventCausality.CAUSALITY2);
222        throw new FHIRException("Unknown AdverseEventCausality code '"+codeString+"'");
223        }
224    public String toCode(AdverseEventCausality code) {
225      if (code == AdverseEventCausality.CAUSALITY1)
226        return "causality1";
227      if (code == AdverseEventCausality.CAUSALITY2)
228        return "causality2";
229      return "?";
230      }
231    public String toSystem(AdverseEventCausality code) {
232      return code.getSystem();
233      }
234    }
235
236    @Block()
237    public static class AdverseEventSuspectEntityComponent extends BackboneElement implements IBaseBackboneElement {
238        /**
239         * Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.
240         */
241        @Child(name = "instance", type = {Substance.class, Medication.class, MedicationAdministration.class, MedicationStatement.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
242        @Description(shortDefinition="Refers to the specific entity that caused the adverse event", formalDefinition="Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device." )
243        protected Reference instance;
244
245        /**
246         * The actual object that is the target of the reference (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
247         */
248        protected Resource instanceTarget;
249
250        /**
251         * causality1 | causality2.
252         */
253        @Child(name = "causality", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
254        @Description(shortDefinition="causality1 | causality2", formalDefinition="causality1 | causality2." )
255        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality")
256        protected Enumeration<AdverseEventCausality> causality;
257
258        /**
259         * assess1 | assess2.
260         */
261        @Child(name = "causalityAssessment", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
262        @Description(shortDefinition="assess1 | assess2", formalDefinition="assess1 | assess2." )
263        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-assess")
264        protected CodeableConcept causalityAssessment;
265
266        /**
267         * AdverseEvent.suspectEntity.causalityProductRelatedness.
268         */
269        @Child(name = "causalityProductRelatedness", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
270        @Description(shortDefinition="AdverseEvent.suspectEntity.causalityProductRelatedness", formalDefinition="AdverseEvent.suspectEntity.causalityProductRelatedness." )
271        protected StringType causalityProductRelatedness;
272
273        /**
274         * method1 | method2.
275         */
276        @Child(name = "causalityMethod", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
277        @Description(shortDefinition="method1 | method2", formalDefinition="method1 | method2." )
278        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-method")
279        protected CodeableConcept causalityMethod;
280
281        /**
282         * AdverseEvent.suspectEntity.causalityAuthor.
283         */
284        @Child(name = "causalityAuthor", type = {Practitioner.class, PractitionerRole.class}, order=6, min=0, max=1, modifier=false, summary=true)
285        @Description(shortDefinition="AdverseEvent.suspectEntity.causalityAuthor", formalDefinition="AdverseEvent.suspectEntity.causalityAuthor." )
286        protected Reference causalityAuthor;
287
288        /**
289         * The actual object that is the target of the reference (AdverseEvent.suspectEntity.causalityAuthor.)
290         */
291        protected Resource causalityAuthorTarget;
292
293        /**
294         * result1 | result2.
295         */
296        @Child(name = "causalityResult", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
297        @Description(shortDefinition="result1 | result2", formalDefinition="result1 | result2." )
298        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-result")
299        protected CodeableConcept causalityResult;
300
301        private static final long serialVersionUID = -815429592L;
302
303    /**
304     * Constructor
305     */
306      public AdverseEventSuspectEntityComponent() {
307        super();
308      }
309
310    /**
311     * Constructor
312     */
313      public AdverseEventSuspectEntityComponent(Reference instance) {
314        super();
315        this.instance = instance;
316      }
317
318        /**
319         * @return {@link #instance} (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
320         */
321        public Reference getInstance() { 
322          if (this.instance == null)
323            if (Configuration.errorOnAutoCreate())
324              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.instance");
325            else if (Configuration.doAutoCreate())
326              this.instance = new Reference(); // cc
327          return this.instance;
328        }
329
330        public boolean hasInstance() { 
331          return this.instance != null && !this.instance.isEmpty();
332        }
333
334        /**
335         * @param value {@link #instance} (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
336         */
337        public AdverseEventSuspectEntityComponent setInstance(Reference value)  { 
338          this.instance = value;
339          return this;
340        }
341
342        /**
343         * @return {@link #instance} 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. (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
344         */
345        public Resource getInstanceTarget() { 
346          return this.instanceTarget;
347        }
348
349        /**
350         * @param value {@link #instance} 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. (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
351         */
352        public AdverseEventSuspectEntityComponent setInstanceTarget(Resource value) { 
353          this.instanceTarget = value;
354          return this;
355        }
356
357        /**
358         * @return {@link #causality} (causality1 | causality2.). This is the underlying object with id, value and extensions. The accessor "getCausality" gives direct access to the value
359         */
360        public Enumeration<AdverseEventCausality> getCausalityElement() { 
361          if (this.causality == null)
362            if (Configuration.errorOnAutoCreate())
363              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causality");
364            else if (Configuration.doAutoCreate())
365              this.causality = new Enumeration<AdverseEventCausality>(new AdverseEventCausalityEnumFactory()); // bb
366          return this.causality;
367        }
368
369        public boolean hasCausalityElement() { 
370          return this.causality != null && !this.causality.isEmpty();
371        }
372
373        public boolean hasCausality() { 
374          return this.causality != null && !this.causality.isEmpty();
375        }
376
377        /**
378         * @param value {@link #causality} (causality1 | causality2.). This is the underlying object with id, value and extensions. The accessor "getCausality" gives direct access to the value
379         */
380        public AdverseEventSuspectEntityComponent setCausalityElement(Enumeration<AdverseEventCausality> value) { 
381          this.causality = value;
382          return this;
383        }
384
385        /**
386         * @return causality1 | causality2.
387         */
388        public AdverseEventCausality getCausality() { 
389          return this.causality == null ? null : this.causality.getValue();
390        }
391
392        /**
393         * @param value causality1 | causality2.
394         */
395        public AdverseEventSuspectEntityComponent setCausality(AdverseEventCausality value) { 
396          if (value == null)
397            this.causality = null;
398          else {
399            if (this.causality == null)
400              this.causality = new Enumeration<AdverseEventCausality>(new AdverseEventCausalityEnumFactory());
401            this.causality.setValue(value);
402          }
403          return this;
404        }
405
406        /**
407         * @return {@link #causalityAssessment} (assess1 | assess2.)
408         */
409        public CodeableConcept getCausalityAssessment() { 
410          if (this.causalityAssessment == null)
411            if (Configuration.errorOnAutoCreate())
412              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causalityAssessment");
413            else if (Configuration.doAutoCreate())
414              this.causalityAssessment = new CodeableConcept(); // cc
415          return this.causalityAssessment;
416        }
417
418        public boolean hasCausalityAssessment() { 
419          return this.causalityAssessment != null && !this.causalityAssessment.isEmpty();
420        }
421
422        /**
423         * @param value {@link #causalityAssessment} (assess1 | assess2.)
424         */
425        public AdverseEventSuspectEntityComponent setCausalityAssessment(CodeableConcept value)  { 
426          this.causalityAssessment = value;
427          return this;
428        }
429
430        /**
431         * @return {@link #causalityProductRelatedness} (AdverseEvent.suspectEntity.causalityProductRelatedness.). This is the underlying object with id, value and extensions. The accessor "getCausalityProductRelatedness" gives direct access to the value
432         */
433        public StringType getCausalityProductRelatednessElement() { 
434          if (this.causalityProductRelatedness == null)
435            if (Configuration.errorOnAutoCreate())
436              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causalityProductRelatedness");
437            else if (Configuration.doAutoCreate())
438              this.causalityProductRelatedness = new StringType(); // bb
439          return this.causalityProductRelatedness;
440        }
441
442        public boolean hasCausalityProductRelatednessElement() { 
443          return this.causalityProductRelatedness != null && !this.causalityProductRelatedness.isEmpty();
444        }
445
446        public boolean hasCausalityProductRelatedness() { 
447          return this.causalityProductRelatedness != null && !this.causalityProductRelatedness.isEmpty();
448        }
449
450        /**
451         * @param value {@link #causalityProductRelatedness} (AdverseEvent.suspectEntity.causalityProductRelatedness.). This is the underlying object with id, value and extensions. The accessor "getCausalityProductRelatedness" gives direct access to the value
452         */
453        public AdverseEventSuspectEntityComponent setCausalityProductRelatednessElement(StringType value) { 
454          this.causalityProductRelatedness = value;
455          return this;
456        }
457
458        /**
459         * @return AdverseEvent.suspectEntity.causalityProductRelatedness.
460         */
461        public String getCausalityProductRelatedness() { 
462          return this.causalityProductRelatedness == null ? null : this.causalityProductRelatedness.getValue();
463        }
464
465        /**
466         * @param value AdverseEvent.suspectEntity.causalityProductRelatedness.
467         */
468        public AdverseEventSuspectEntityComponent setCausalityProductRelatedness(String value) { 
469          if (Utilities.noString(value))
470            this.causalityProductRelatedness = null;
471          else {
472            if (this.causalityProductRelatedness == null)
473              this.causalityProductRelatedness = new StringType();
474            this.causalityProductRelatedness.setValue(value);
475          }
476          return this;
477        }
478
479        /**
480         * @return {@link #causalityMethod} (method1 | method2.)
481         */
482        public CodeableConcept getCausalityMethod() { 
483          if (this.causalityMethod == null)
484            if (Configuration.errorOnAutoCreate())
485              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causalityMethod");
486            else if (Configuration.doAutoCreate())
487              this.causalityMethod = new CodeableConcept(); // cc
488          return this.causalityMethod;
489        }
490
491        public boolean hasCausalityMethod() { 
492          return this.causalityMethod != null && !this.causalityMethod.isEmpty();
493        }
494
495        /**
496         * @param value {@link #causalityMethod} (method1 | method2.)
497         */
498        public AdverseEventSuspectEntityComponent setCausalityMethod(CodeableConcept value)  { 
499          this.causalityMethod = value;
500          return this;
501        }
502
503        /**
504         * @return {@link #causalityAuthor} (AdverseEvent.suspectEntity.causalityAuthor.)
505         */
506        public Reference getCausalityAuthor() { 
507          if (this.causalityAuthor == null)
508            if (Configuration.errorOnAutoCreate())
509              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causalityAuthor");
510            else if (Configuration.doAutoCreate())
511              this.causalityAuthor = new Reference(); // cc
512          return this.causalityAuthor;
513        }
514
515        public boolean hasCausalityAuthor() { 
516          return this.causalityAuthor != null && !this.causalityAuthor.isEmpty();
517        }
518
519        /**
520         * @param value {@link #causalityAuthor} (AdverseEvent.suspectEntity.causalityAuthor.)
521         */
522        public AdverseEventSuspectEntityComponent setCausalityAuthor(Reference value)  { 
523          this.causalityAuthor = value;
524          return this;
525        }
526
527        /**
528         * @return {@link #causalityAuthor} 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. (AdverseEvent.suspectEntity.causalityAuthor.)
529         */
530        public Resource getCausalityAuthorTarget() { 
531          return this.causalityAuthorTarget;
532        }
533
534        /**
535         * @param value {@link #causalityAuthor} 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. (AdverseEvent.suspectEntity.causalityAuthor.)
536         */
537        public AdverseEventSuspectEntityComponent setCausalityAuthorTarget(Resource value) { 
538          this.causalityAuthorTarget = value;
539          return this;
540        }
541
542        /**
543         * @return {@link #causalityResult} (result1 | result2.)
544         */
545        public CodeableConcept getCausalityResult() { 
546          if (this.causalityResult == null)
547            if (Configuration.errorOnAutoCreate())
548              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causalityResult");
549            else if (Configuration.doAutoCreate())
550              this.causalityResult = new CodeableConcept(); // cc
551          return this.causalityResult;
552        }
553
554        public boolean hasCausalityResult() { 
555          return this.causalityResult != null && !this.causalityResult.isEmpty();
556        }
557
558        /**
559         * @param value {@link #causalityResult} (result1 | result2.)
560         */
561        public AdverseEventSuspectEntityComponent setCausalityResult(CodeableConcept value)  { 
562          this.causalityResult = value;
563          return this;
564        }
565
566        protected void listChildren(List<Property> children) {
567          super.listChildren(children);
568          children.add(new Property("instance", "Reference(Substance|Medication|MedicationAdministration|MedicationStatement|Device)", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance));
569          children.add(new Property("causality", "code", "causality1 | causality2.", 0, 1, causality));
570          children.add(new Property("causalityAssessment", "CodeableConcept", "assess1 | assess2.", 0, 1, causalityAssessment));
571          children.add(new Property("causalityProductRelatedness", "string", "AdverseEvent.suspectEntity.causalityProductRelatedness.", 0, 1, causalityProductRelatedness));
572          children.add(new Property("causalityMethod", "CodeableConcept", "method1 | method2.", 0, 1, causalityMethod));
573          children.add(new Property("causalityAuthor", "Reference(Practitioner|PractitionerRole)", "AdverseEvent.suspectEntity.causalityAuthor.", 0, 1, causalityAuthor));
574          children.add(new Property("causalityResult", "CodeableConcept", "result1 | result2.", 0, 1, causalityResult));
575        }
576
577        @Override
578        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
579          switch (_hash) {
580          case 555127957: /*instance*/  return new Property("instance", "Reference(Substance|Medication|MedicationAdministration|MedicationStatement|Device)", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
581          case -1446450521: /*causality*/  return new Property("causality", "code", "causality1 | causality2.", 0, 1, causality);
582          case 830609609: /*causalityAssessment*/  return new Property("causalityAssessment", "CodeableConcept", "assess1 | assess2.", 0, 1, causalityAssessment);
583          case -1983069286: /*causalityProductRelatedness*/  return new Property("causalityProductRelatedness", "string", "AdverseEvent.suspectEntity.causalityProductRelatedness.", 0, 1, causalityProductRelatedness);
584          case -1320366488: /*causalityMethod*/  return new Property("causalityMethod", "CodeableConcept", "method1 | method2.", 0, 1, causalityMethod);
585          case -1649139950: /*causalityAuthor*/  return new Property("causalityAuthor", "Reference(Practitioner|PractitionerRole)", "AdverseEvent.suspectEntity.causalityAuthor.", 0, 1, causalityAuthor);
586          case -1177238108: /*causalityResult*/  return new Property("causalityResult", "CodeableConcept", "result1 | result2.", 0, 1, causalityResult);
587          default: return super.getNamedProperty(_hash, _name, _checkValid);
588          }
589
590        }
591
592      @Override
593      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
594        switch (hash) {
595        case 555127957: /*instance*/ return this.instance == null ? new Base[0] : new Base[] {this.instance}; // Reference
596        case -1446450521: /*causality*/ return this.causality == null ? new Base[0] : new Base[] {this.causality}; // Enumeration<AdverseEventCausality>
597        case 830609609: /*causalityAssessment*/ return this.causalityAssessment == null ? new Base[0] : new Base[] {this.causalityAssessment}; // CodeableConcept
598        case -1983069286: /*causalityProductRelatedness*/ return this.causalityProductRelatedness == null ? new Base[0] : new Base[] {this.causalityProductRelatedness}; // StringType
599        case -1320366488: /*causalityMethod*/ return this.causalityMethod == null ? new Base[0] : new Base[] {this.causalityMethod}; // CodeableConcept
600        case -1649139950: /*causalityAuthor*/ return this.causalityAuthor == null ? new Base[0] : new Base[] {this.causalityAuthor}; // Reference
601        case -1177238108: /*causalityResult*/ return this.causalityResult == null ? new Base[0] : new Base[] {this.causalityResult}; // CodeableConcept
602        default: return super.getProperty(hash, name, checkValid);
603        }
604
605      }
606
607      @Override
608      public Base setProperty(int hash, String name, Base value) throws FHIRException {
609        switch (hash) {
610        case 555127957: // instance
611          this.instance = castToReference(value); // Reference
612          return value;
613        case -1446450521: // causality
614          value = new AdverseEventCausalityEnumFactory().fromType(castToCode(value));
615          this.causality = (Enumeration) value; // Enumeration<AdverseEventCausality>
616          return value;
617        case 830609609: // causalityAssessment
618          this.causalityAssessment = castToCodeableConcept(value); // CodeableConcept
619          return value;
620        case -1983069286: // causalityProductRelatedness
621          this.causalityProductRelatedness = castToString(value); // StringType
622          return value;
623        case -1320366488: // causalityMethod
624          this.causalityMethod = castToCodeableConcept(value); // CodeableConcept
625          return value;
626        case -1649139950: // causalityAuthor
627          this.causalityAuthor = castToReference(value); // Reference
628          return value;
629        case -1177238108: // causalityResult
630          this.causalityResult = castToCodeableConcept(value); // CodeableConcept
631          return value;
632        default: return super.setProperty(hash, name, value);
633        }
634
635      }
636
637      @Override
638      public Base setProperty(String name, Base value) throws FHIRException {
639        if (name.equals("instance")) {
640          this.instance = castToReference(value); // Reference
641        } else if (name.equals("causality")) {
642          value = new AdverseEventCausalityEnumFactory().fromType(castToCode(value));
643          this.causality = (Enumeration) value; // Enumeration<AdverseEventCausality>
644        } else if (name.equals("causalityAssessment")) {
645          this.causalityAssessment = castToCodeableConcept(value); // CodeableConcept
646        } else if (name.equals("causalityProductRelatedness")) {
647          this.causalityProductRelatedness = castToString(value); // StringType
648        } else if (name.equals("causalityMethod")) {
649          this.causalityMethod = castToCodeableConcept(value); // CodeableConcept
650        } else if (name.equals("causalityAuthor")) {
651          this.causalityAuthor = castToReference(value); // Reference
652        } else if (name.equals("causalityResult")) {
653          this.causalityResult = castToCodeableConcept(value); // CodeableConcept
654        } else
655          return super.setProperty(name, value);
656        return value;
657      }
658
659      @Override
660      public Base makeProperty(int hash, String name) throws FHIRException {
661        switch (hash) {
662        case 555127957:  return getInstance(); 
663        case -1446450521:  return getCausalityElement();
664        case 830609609:  return getCausalityAssessment(); 
665        case -1983069286:  return getCausalityProductRelatednessElement();
666        case -1320366488:  return getCausalityMethod(); 
667        case -1649139950:  return getCausalityAuthor(); 
668        case -1177238108:  return getCausalityResult(); 
669        default: return super.makeProperty(hash, name);
670        }
671
672      }
673
674      @Override
675      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
676        switch (hash) {
677        case 555127957: /*instance*/ return new String[] {"Reference"};
678        case -1446450521: /*causality*/ return new String[] {"code"};
679        case 830609609: /*causalityAssessment*/ return new String[] {"CodeableConcept"};
680        case -1983069286: /*causalityProductRelatedness*/ return new String[] {"string"};
681        case -1320366488: /*causalityMethod*/ return new String[] {"CodeableConcept"};
682        case -1649139950: /*causalityAuthor*/ return new String[] {"Reference"};
683        case -1177238108: /*causalityResult*/ return new String[] {"CodeableConcept"};
684        default: return super.getTypesForProperty(hash, name);
685        }
686
687      }
688
689      @Override
690      public Base addChild(String name) throws FHIRException {
691        if (name.equals("instance")) {
692          this.instance = new Reference();
693          return this.instance;
694        }
695        else if (name.equals("causality")) {
696          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.causality");
697        }
698        else if (name.equals("causalityAssessment")) {
699          this.causalityAssessment = new CodeableConcept();
700          return this.causalityAssessment;
701        }
702        else if (name.equals("causalityProductRelatedness")) {
703          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.causalityProductRelatedness");
704        }
705        else if (name.equals("causalityMethod")) {
706          this.causalityMethod = new CodeableConcept();
707          return this.causalityMethod;
708        }
709        else if (name.equals("causalityAuthor")) {
710          this.causalityAuthor = new Reference();
711          return this.causalityAuthor;
712        }
713        else if (name.equals("causalityResult")) {
714          this.causalityResult = new CodeableConcept();
715          return this.causalityResult;
716        }
717        else
718          return super.addChild(name);
719      }
720
721      public AdverseEventSuspectEntityComponent copy() {
722        AdverseEventSuspectEntityComponent dst = new AdverseEventSuspectEntityComponent();
723        copyValues(dst);
724        dst.instance = instance == null ? null : instance.copy();
725        dst.causality = causality == null ? null : causality.copy();
726        dst.causalityAssessment = causalityAssessment == null ? null : causalityAssessment.copy();
727        dst.causalityProductRelatedness = causalityProductRelatedness == null ? null : causalityProductRelatedness.copy();
728        dst.causalityMethod = causalityMethod == null ? null : causalityMethod.copy();
729        dst.causalityAuthor = causalityAuthor == null ? null : causalityAuthor.copy();
730        dst.causalityResult = causalityResult == null ? null : causalityResult.copy();
731        return dst;
732      }
733
734      @Override
735      public boolean equalsDeep(Base other_) {
736        if (!super.equalsDeep(other_))
737          return false;
738        if (!(other_ instanceof AdverseEventSuspectEntityComponent))
739          return false;
740        AdverseEventSuspectEntityComponent o = (AdverseEventSuspectEntityComponent) other_;
741        return compareDeep(instance, o.instance, true) && compareDeep(causality, o.causality, true) && compareDeep(causalityAssessment, o.causalityAssessment, true)
742           && compareDeep(causalityProductRelatedness, o.causalityProductRelatedness, true) && compareDeep(causalityMethod, o.causalityMethod, true)
743           && compareDeep(causalityAuthor, o.causalityAuthor, true) && compareDeep(causalityResult, o.causalityResult, true)
744          ;
745      }
746
747      @Override
748      public boolean equalsShallow(Base other_) {
749        if (!super.equalsShallow(other_))
750          return false;
751        if (!(other_ instanceof AdverseEventSuspectEntityComponent))
752          return false;
753        AdverseEventSuspectEntityComponent o = (AdverseEventSuspectEntityComponent) other_;
754        return compareValues(causality, o.causality, true) && compareValues(causalityProductRelatedness, o.causalityProductRelatedness, true)
755          ;
756      }
757
758      public boolean isEmpty() {
759        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(instance, causality, causalityAssessment
760          , causalityProductRelatedness, causalityMethod, causalityAuthor, causalityResult);
761      }
762
763  public String fhirType() {
764    return "AdverseEvent.suspectEntity";
765
766  }
767
768  }
769
770    /**
771     * The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate.
772     */
773    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
774    @Description(shortDefinition="Business identifier for the event", formalDefinition="The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate." )
775    protected Identifier identifier;
776
777    /**
778     * The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.
779     */
780    @Child(name = "category", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
781    @Description(shortDefinition="AE | PAE \rAn adverse event is an event that caused harm to a patient,  an adverse reaction is a something that is a subject-specific event that is a result of an exposure to a medication, food, device or environmental substance, a potential adverse event is something that occurred and that could have caused harm to a patient but did not", formalDefinition="The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject." )
782    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-category")
783    protected Enumeration<AdverseEventCategory> category;
784
785    /**
786     * This element defines the specific type of event that occurred or that was prevented from occurring.
787     */
788    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
789    @Description(shortDefinition="actual | potential", formalDefinition="This element defines the specific type of event that occurred or that was prevented from occurring." )
790    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-type")
791    protected CodeableConcept type;
792
793    /**
794     * This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.
795     */
796    @Child(name = "subject", type = {Patient.class, ResearchSubject.class, Medication.class, Device.class}, order=3, min=0, max=1, modifier=false, summary=true)
797    @Description(shortDefinition="Subject or group impacted by event", formalDefinition="This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented." )
798    protected Reference subject;
799
800    /**
801     * The actual object that is the target of the reference (This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.)
802     */
803    protected Resource subjectTarget;
804
805    /**
806     * The date (and perhaps time) when the adverse event occurred.
807     */
808    @Child(name = "date", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
809    @Description(shortDefinition="When the event occurred", formalDefinition="The date (and perhaps time) when the adverse event occurred." )
810    protected DateTimeType date;
811
812    /**
813     * Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).
814     */
815    @Child(name = "reaction", type = {Condition.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
816    @Description(shortDefinition="Adverse Reaction Events linked to exposure to substance", formalDefinition="Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical)." )
817    protected List<Reference> reaction;
818    /**
819     * The actual objects that are the target of the reference (Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).)
820     */
821    protected List<Condition> reactionTarget;
822
823
824    /**
825     * The information about where the adverse event occurred.
826     */
827    @Child(name = "location", type = {Location.class}, order=6, min=0, max=1, modifier=false, summary=true)
828    @Description(shortDefinition="Location where adverse event occurred", formalDefinition="The information about where the adverse event occurred." )
829    protected Reference location;
830
831    /**
832     * The actual object that is the target of the reference (The information about where the adverse event occurred.)
833     */
834    protected Location locationTarget;
835
836    /**
837     * Describes the seriousness or severity of the adverse event.
838     */
839    @Child(name = "seriousness", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
840    @Description(shortDefinition="Mild | Moderate | Severe", formalDefinition="Describes the seriousness or severity of the adverse event." )
841    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-seriousness")
842    protected CodeableConcept seriousness;
843
844    /**
845     * Describes the type of outcome from the adverse event.
846     */
847    @Child(name = "outcome", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
848    @Description(shortDefinition="resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown", formalDefinition="Describes the type of outcome from the adverse event." )
849    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-outcome")
850    protected CodeableConcept outcome;
851
852    /**
853     * Information on who recorded the adverse event.  May be the patient or a practitioner.
854     */
855    @Child(name = "recorder", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=9, min=0, max=1, modifier=false, summary=true)
856    @Description(shortDefinition="Who recorded the adverse event", formalDefinition="Information on who recorded the adverse event.  May be the patient or a practitioner." )
857    protected Reference recorder;
858
859    /**
860     * The actual object that is the target of the reference (Information on who recorded the adverse event.  May be the patient or a practitioner.)
861     */
862    protected Resource recorderTarget;
863
864    /**
865     * Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).
866     */
867    @Child(name = "eventParticipant", type = {Practitioner.class, Device.class}, order=10, min=0, max=1, modifier=false, summary=true)
868    @Description(shortDefinition="Who  was involved in the adverse event or the potential adverse event", formalDefinition="Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness)." )
869    protected Reference eventParticipant;
870
871    /**
872     * The actual object that is the target of the reference (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
873     */
874    protected Resource eventParticipantTarget;
875
876    /**
877     * Describes the adverse event in text.
878     */
879    @Child(name = "description", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=true)
880    @Description(shortDefinition="Description of the adverse event", formalDefinition="Describes the adverse event in text." )
881    protected StringType description;
882
883    /**
884     * Describes the entity that is suspected to have caused the adverse event.
885     */
886    @Child(name = "suspectEntity", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
887    @Description(shortDefinition="The suspected agent causing the adverse event", formalDefinition="Describes the entity that is suspected to have caused the adverse event." )
888    protected List<AdverseEventSuspectEntityComponent> suspectEntity;
889
890    /**
891     * AdverseEvent.subjectMedicalHistory.
892     */
893    @Child(name = "subjectMedicalHistory", type = {Condition.class, Observation.class, AllergyIntolerance.class, FamilyMemberHistory.class, Immunization.class, Procedure.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
894    @Description(shortDefinition="AdverseEvent.subjectMedicalHistory", formalDefinition="AdverseEvent.subjectMedicalHistory." )
895    protected List<Reference> subjectMedicalHistory;
896    /**
897     * The actual objects that are the target of the reference (AdverseEvent.subjectMedicalHistory.)
898     */
899    protected List<Resource> subjectMedicalHistoryTarget;
900
901
902    /**
903     * AdverseEvent.referenceDocument.
904     */
905    @Child(name = "referenceDocument", type = {DocumentReference.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
906    @Description(shortDefinition="AdverseEvent.referenceDocument", formalDefinition="AdverseEvent.referenceDocument." )
907    protected List<Reference> referenceDocument;
908    /**
909     * The actual objects that are the target of the reference (AdverseEvent.referenceDocument.)
910     */
911    protected List<DocumentReference> referenceDocumentTarget;
912
913
914    /**
915     * AdverseEvent.study.
916     */
917    @Child(name = "study", type = {ResearchStudy.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
918    @Description(shortDefinition="AdverseEvent.study", formalDefinition="AdverseEvent.study." )
919    protected List<Reference> study;
920    /**
921     * The actual objects that are the target of the reference (AdverseEvent.study.)
922     */
923    protected List<ResearchStudy> studyTarget;
924
925
926    private static final long serialVersionUID = 156251238L;
927
928  /**
929   * Constructor
930   */
931    public AdverseEvent() {
932      super();
933    }
934
935    /**
936     * @return {@link #identifier} (The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate.)
937     */
938    public Identifier getIdentifier() { 
939      if (this.identifier == null)
940        if (Configuration.errorOnAutoCreate())
941          throw new Error("Attempt to auto-create AdverseEvent.identifier");
942        else if (Configuration.doAutoCreate())
943          this.identifier = new Identifier(); // cc
944      return this.identifier;
945    }
946
947    public boolean hasIdentifier() { 
948      return this.identifier != null && !this.identifier.isEmpty();
949    }
950
951    /**
952     * @param value {@link #identifier} (The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate.)
953     */
954    public AdverseEvent setIdentifier(Identifier value)  { 
955      this.identifier = value;
956      return this;
957    }
958
959    /**
960     * @return {@link #category} (The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
961     */
962    public Enumeration<AdverseEventCategory> getCategoryElement() { 
963      if (this.category == null)
964        if (Configuration.errorOnAutoCreate())
965          throw new Error("Attempt to auto-create AdverseEvent.category");
966        else if (Configuration.doAutoCreate())
967          this.category = new Enumeration<AdverseEventCategory>(new AdverseEventCategoryEnumFactory()); // bb
968      return this.category;
969    }
970
971    public boolean hasCategoryElement() { 
972      return this.category != null && !this.category.isEmpty();
973    }
974
975    public boolean hasCategory() { 
976      return this.category != null && !this.category.isEmpty();
977    }
978
979    /**
980     * @param value {@link #category} (The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
981     */
982    public AdverseEvent setCategoryElement(Enumeration<AdverseEventCategory> value) { 
983      this.category = value;
984      return this;
985    }
986
987    /**
988     * @return The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.
989     */
990    public AdverseEventCategory getCategory() { 
991      return this.category == null ? null : this.category.getValue();
992    }
993
994    /**
995     * @param value The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.
996     */
997    public AdverseEvent setCategory(AdverseEventCategory value) { 
998      if (value == null)
999        this.category = null;
1000      else {
1001        if (this.category == null)
1002          this.category = new Enumeration<AdverseEventCategory>(new AdverseEventCategoryEnumFactory());
1003        this.category.setValue(value);
1004      }
1005      return this;
1006    }
1007
1008    /**
1009     * @return {@link #type} (This element defines the specific type of event that occurred or that was prevented from occurring.)
1010     */
1011    public CodeableConcept getType() { 
1012      if (this.type == null)
1013        if (Configuration.errorOnAutoCreate())
1014          throw new Error("Attempt to auto-create AdverseEvent.type");
1015        else if (Configuration.doAutoCreate())
1016          this.type = new CodeableConcept(); // cc
1017      return this.type;
1018    }
1019
1020    public boolean hasType() { 
1021      return this.type != null && !this.type.isEmpty();
1022    }
1023
1024    /**
1025     * @param value {@link #type} (This element defines the specific type of event that occurred or that was prevented from occurring.)
1026     */
1027    public AdverseEvent setType(CodeableConcept value)  { 
1028      this.type = value;
1029      return this;
1030    }
1031
1032    /**
1033     * @return {@link #subject} (This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.)
1034     */
1035    public Reference getSubject() { 
1036      if (this.subject == null)
1037        if (Configuration.errorOnAutoCreate())
1038          throw new Error("Attempt to auto-create AdverseEvent.subject");
1039        else if (Configuration.doAutoCreate())
1040          this.subject = new Reference(); // cc
1041      return this.subject;
1042    }
1043
1044    public boolean hasSubject() { 
1045      return this.subject != null && !this.subject.isEmpty();
1046    }
1047
1048    /**
1049     * @param value {@link #subject} (This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.)
1050     */
1051    public AdverseEvent setSubject(Reference value)  { 
1052      this.subject = value;
1053      return this;
1054    }
1055
1056    /**
1057     * @return {@link #subject} 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. (This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.)
1058     */
1059    public Resource getSubjectTarget() { 
1060      return this.subjectTarget;
1061    }
1062
1063    /**
1064     * @param value {@link #subject} 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. (This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.)
1065     */
1066    public AdverseEvent setSubjectTarget(Resource value) { 
1067      this.subjectTarget = value;
1068      return this;
1069    }
1070
1071    /**
1072     * @return {@link #date} (The date (and perhaps time) when the adverse event occurred.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1073     */
1074    public DateTimeType getDateElement() { 
1075      if (this.date == null)
1076        if (Configuration.errorOnAutoCreate())
1077          throw new Error("Attempt to auto-create AdverseEvent.date");
1078        else if (Configuration.doAutoCreate())
1079          this.date = new DateTimeType(); // bb
1080      return this.date;
1081    }
1082
1083    public boolean hasDateElement() { 
1084      return this.date != null && !this.date.isEmpty();
1085    }
1086
1087    public boolean hasDate() { 
1088      return this.date != null && !this.date.isEmpty();
1089    }
1090
1091    /**
1092     * @param value {@link #date} (The date (and perhaps time) when the adverse event occurred.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1093     */
1094    public AdverseEvent setDateElement(DateTimeType value) { 
1095      this.date = value;
1096      return this;
1097    }
1098
1099    /**
1100     * @return The date (and perhaps time) when the adverse event occurred.
1101     */
1102    public Date getDate() { 
1103      return this.date == null ? null : this.date.getValue();
1104    }
1105
1106    /**
1107     * @param value The date (and perhaps time) when the adverse event occurred.
1108     */
1109    public AdverseEvent setDate(Date value) { 
1110      if (value == null)
1111        this.date = null;
1112      else {
1113        if (this.date == null)
1114          this.date = new DateTimeType();
1115        this.date.setValue(value);
1116      }
1117      return this;
1118    }
1119
1120    /**
1121     * @return {@link #reaction} (Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).)
1122     */
1123    public List<Reference> getReaction() { 
1124      if (this.reaction == null)
1125        this.reaction = new ArrayList<Reference>();
1126      return this.reaction;
1127    }
1128
1129    /**
1130     * @return Returns a reference to <code>this</code> for easy method chaining
1131     */
1132    public AdverseEvent setReaction(List<Reference> theReaction) { 
1133      this.reaction = theReaction;
1134      return this;
1135    }
1136
1137    public boolean hasReaction() { 
1138      if (this.reaction == null)
1139        return false;
1140      for (Reference item : this.reaction)
1141        if (!item.isEmpty())
1142          return true;
1143      return false;
1144    }
1145
1146    public Reference addReaction() { //3
1147      Reference t = new Reference();
1148      if (this.reaction == null)
1149        this.reaction = new ArrayList<Reference>();
1150      this.reaction.add(t);
1151      return t;
1152    }
1153
1154    public AdverseEvent addReaction(Reference t) { //3
1155      if (t == null)
1156        return this;
1157      if (this.reaction == null)
1158        this.reaction = new ArrayList<Reference>();
1159      this.reaction.add(t);
1160      return this;
1161    }
1162
1163    /**
1164     * @return The first repetition of repeating field {@link #reaction}, creating it if it does not already exist
1165     */
1166    public Reference getReactionFirstRep() { 
1167      if (getReaction().isEmpty()) {
1168        addReaction();
1169      }
1170      return getReaction().get(0);
1171    }
1172
1173    /**
1174     * @deprecated Use Reference#setResource(IBaseResource) instead
1175     */
1176    @Deprecated
1177    public List<Condition> getReactionTarget() { 
1178      if (this.reactionTarget == null)
1179        this.reactionTarget = new ArrayList<Condition>();
1180      return this.reactionTarget;
1181    }
1182
1183    /**
1184     * @deprecated Use Reference#setResource(IBaseResource) instead
1185     */
1186    @Deprecated
1187    public Condition addReactionTarget() { 
1188      Condition r = new Condition();
1189      if (this.reactionTarget == null)
1190        this.reactionTarget = new ArrayList<Condition>();
1191      this.reactionTarget.add(r);
1192      return r;
1193    }
1194
1195    /**
1196     * @return {@link #location} (The information about where the adverse event occurred.)
1197     */
1198    public Reference getLocation() { 
1199      if (this.location == null)
1200        if (Configuration.errorOnAutoCreate())
1201          throw new Error("Attempt to auto-create AdverseEvent.location");
1202        else if (Configuration.doAutoCreate())
1203          this.location = new Reference(); // cc
1204      return this.location;
1205    }
1206
1207    public boolean hasLocation() { 
1208      return this.location != null && !this.location.isEmpty();
1209    }
1210
1211    /**
1212     * @param value {@link #location} (The information about where the adverse event occurred.)
1213     */
1214    public AdverseEvent setLocation(Reference value)  { 
1215      this.location = value;
1216      return this;
1217    }
1218
1219    /**
1220     * @return {@link #location} 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 information about where the adverse event occurred.)
1221     */
1222    public Location getLocationTarget() { 
1223      if (this.locationTarget == null)
1224        if (Configuration.errorOnAutoCreate())
1225          throw new Error("Attempt to auto-create AdverseEvent.location");
1226        else if (Configuration.doAutoCreate())
1227          this.locationTarget = new Location(); // aa
1228      return this.locationTarget;
1229    }
1230
1231    /**
1232     * @param value {@link #location} 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 information about where the adverse event occurred.)
1233     */
1234    public AdverseEvent setLocationTarget(Location value) { 
1235      this.locationTarget = value;
1236      return this;
1237    }
1238
1239    /**
1240     * @return {@link #seriousness} (Describes the seriousness or severity of the adverse event.)
1241     */
1242    public CodeableConcept getSeriousness() { 
1243      if (this.seriousness == null)
1244        if (Configuration.errorOnAutoCreate())
1245          throw new Error("Attempt to auto-create AdverseEvent.seriousness");
1246        else if (Configuration.doAutoCreate())
1247          this.seriousness = new CodeableConcept(); // cc
1248      return this.seriousness;
1249    }
1250
1251    public boolean hasSeriousness() { 
1252      return this.seriousness != null && !this.seriousness.isEmpty();
1253    }
1254
1255    /**
1256     * @param value {@link #seriousness} (Describes the seriousness or severity of the adverse event.)
1257     */
1258    public AdverseEvent setSeriousness(CodeableConcept value)  { 
1259      this.seriousness = value;
1260      return this;
1261    }
1262
1263    /**
1264     * @return {@link #outcome} (Describes the type of outcome from the adverse event.)
1265     */
1266    public CodeableConcept getOutcome() { 
1267      if (this.outcome == null)
1268        if (Configuration.errorOnAutoCreate())
1269          throw new Error("Attempt to auto-create AdverseEvent.outcome");
1270        else if (Configuration.doAutoCreate())
1271          this.outcome = new CodeableConcept(); // cc
1272      return this.outcome;
1273    }
1274
1275    public boolean hasOutcome() { 
1276      return this.outcome != null && !this.outcome.isEmpty();
1277    }
1278
1279    /**
1280     * @param value {@link #outcome} (Describes the type of outcome from the adverse event.)
1281     */
1282    public AdverseEvent setOutcome(CodeableConcept value)  { 
1283      this.outcome = value;
1284      return this;
1285    }
1286
1287    /**
1288     * @return {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
1289     */
1290    public Reference getRecorder() { 
1291      if (this.recorder == null)
1292        if (Configuration.errorOnAutoCreate())
1293          throw new Error("Attempt to auto-create AdverseEvent.recorder");
1294        else if (Configuration.doAutoCreate())
1295          this.recorder = new Reference(); // cc
1296      return this.recorder;
1297    }
1298
1299    public boolean hasRecorder() { 
1300      return this.recorder != null && !this.recorder.isEmpty();
1301    }
1302
1303    /**
1304     * @param value {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
1305     */
1306    public AdverseEvent setRecorder(Reference value)  { 
1307      this.recorder = value;
1308      return this;
1309    }
1310
1311    /**
1312     * @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. (Information on who recorded the adverse event.  May be the patient or a practitioner.)
1313     */
1314    public Resource getRecorderTarget() { 
1315      return this.recorderTarget;
1316    }
1317
1318    /**
1319     * @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. (Information on who recorded the adverse event.  May be the patient or a practitioner.)
1320     */
1321    public AdverseEvent setRecorderTarget(Resource value) { 
1322      this.recorderTarget = value;
1323      return this;
1324    }
1325
1326    /**
1327     * @return {@link #eventParticipant} (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
1328     */
1329    public Reference getEventParticipant() { 
1330      if (this.eventParticipant == null)
1331        if (Configuration.errorOnAutoCreate())
1332          throw new Error("Attempt to auto-create AdverseEvent.eventParticipant");
1333        else if (Configuration.doAutoCreate())
1334          this.eventParticipant = new Reference(); // cc
1335      return this.eventParticipant;
1336    }
1337
1338    public boolean hasEventParticipant() { 
1339      return this.eventParticipant != null && !this.eventParticipant.isEmpty();
1340    }
1341
1342    /**
1343     * @param value {@link #eventParticipant} (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
1344     */
1345    public AdverseEvent setEventParticipant(Reference value)  { 
1346      this.eventParticipant = value;
1347      return this;
1348    }
1349
1350    /**
1351     * @return {@link #eventParticipant} 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. (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
1352     */
1353    public Resource getEventParticipantTarget() { 
1354      return this.eventParticipantTarget;
1355    }
1356
1357    /**
1358     * @param value {@link #eventParticipant} 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. (Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).)
1359     */
1360    public AdverseEvent setEventParticipantTarget(Resource value) { 
1361      this.eventParticipantTarget = value;
1362      return this;
1363    }
1364
1365    /**
1366     * @return {@link #description} (Describes the adverse event in text.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1367     */
1368    public StringType getDescriptionElement() { 
1369      if (this.description == null)
1370        if (Configuration.errorOnAutoCreate())
1371          throw new Error("Attempt to auto-create AdverseEvent.description");
1372        else if (Configuration.doAutoCreate())
1373          this.description = new StringType(); // bb
1374      return this.description;
1375    }
1376
1377    public boolean hasDescriptionElement() { 
1378      return this.description != null && !this.description.isEmpty();
1379    }
1380
1381    public boolean hasDescription() { 
1382      return this.description != null && !this.description.isEmpty();
1383    }
1384
1385    /**
1386     * @param value {@link #description} (Describes the adverse event in text.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1387     */
1388    public AdverseEvent setDescriptionElement(StringType value) { 
1389      this.description = value;
1390      return this;
1391    }
1392
1393    /**
1394     * @return Describes the adverse event in text.
1395     */
1396    public String getDescription() { 
1397      return this.description == null ? null : this.description.getValue();
1398    }
1399
1400    /**
1401     * @param value Describes the adverse event in text.
1402     */
1403    public AdverseEvent setDescription(String value) { 
1404      if (Utilities.noString(value))
1405        this.description = null;
1406      else {
1407        if (this.description == null)
1408          this.description = new StringType();
1409        this.description.setValue(value);
1410      }
1411      return this;
1412    }
1413
1414    /**
1415     * @return {@link #suspectEntity} (Describes the entity that is suspected to have caused the adverse event.)
1416     */
1417    public List<AdverseEventSuspectEntityComponent> getSuspectEntity() { 
1418      if (this.suspectEntity == null)
1419        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
1420      return this.suspectEntity;
1421    }
1422
1423    /**
1424     * @return Returns a reference to <code>this</code> for easy method chaining
1425     */
1426    public AdverseEvent setSuspectEntity(List<AdverseEventSuspectEntityComponent> theSuspectEntity) { 
1427      this.suspectEntity = theSuspectEntity;
1428      return this;
1429    }
1430
1431    public boolean hasSuspectEntity() { 
1432      if (this.suspectEntity == null)
1433        return false;
1434      for (AdverseEventSuspectEntityComponent item : this.suspectEntity)
1435        if (!item.isEmpty())
1436          return true;
1437      return false;
1438    }
1439
1440    public AdverseEventSuspectEntityComponent addSuspectEntity() { //3
1441      AdverseEventSuspectEntityComponent t = new AdverseEventSuspectEntityComponent();
1442      if (this.suspectEntity == null)
1443        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
1444      this.suspectEntity.add(t);
1445      return t;
1446    }
1447
1448    public AdverseEvent addSuspectEntity(AdverseEventSuspectEntityComponent t) { //3
1449      if (t == null)
1450        return this;
1451      if (this.suspectEntity == null)
1452        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
1453      this.suspectEntity.add(t);
1454      return this;
1455    }
1456
1457    /**
1458     * @return The first repetition of repeating field {@link #suspectEntity}, creating it if it does not already exist
1459     */
1460    public AdverseEventSuspectEntityComponent getSuspectEntityFirstRep() { 
1461      if (getSuspectEntity().isEmpty()) {
1462        addSuspectEntity();
1463      }
1464      return getSuspectEntity().get(0);
1465    }
1466
1467    /**
1468     * @return {@link #subjectMedicalHistory} (AdverseEvent.subjectMedicalHistory.)
1469     */
1470    public List<Reference> getSubjectMedicalHistory() { 
1471      if (this.subjectMedicalHistory == null)
1472        this.subjectMedicalHistory = new ArrayList<Reference>();
1473      return this.subjectMedicalHistory;
1474    }
1475
1476    /**
1477     * @return Returns a reference to <code>this</code> for easy method chaining
1478     */
1479    public AdverseEvent setSubjectMedicalHistory(List<Reference> theSubjectMedicalHistory) { 
1480      this.subjectMedicalHistory = theSubjectMedicalHistory;
1481      return this;
1482    }
1483
1484    public boolean hasSubjectMedicalHistory() { 
1485      if (this.subjectMedicalHistory == null)
1486        return false;
1487      for (Reference item : this.subjectMedicalHistory)
1488        if (!item.isEmpty())
1489          return true;
1490      return false;
1491    }
1492
1493    public Reference addSubjectMedicalHistory() { //3
1494      Reference t = new Reference();
1495      if (this.subjectMedicalHistory == null)
1496        this.subjectMedicalHistory = new ArrayList<Reference>();
1497      this.subjectMedicalHistory.add(t);
1498      return t;
1499    }
1500
1501    public AdverseEvent addSubjectMedicalHistory(Reference t) { //3
1502      if (t == null)
1503        return this;
1504      if (this.subjectMedicalHistory == null)
1505        this.subjectMedicalHistory = new ArrayList<Reference>();
1506      this.subjectMedicalHistory.add(t);
1507      return this;
1508    }
1509
1510    /**
1511     * @return The first repetition of repeating field {@link #subjectMedicalHistory}, creating it if it does not already exist
1512     */
1513    public Reference getSubjectMedicalHistoryFirstRep() { 
1514      if (getSubjectMedicalHistory().isEmpty()) {
1515        addSubjectMedicalHistory();
1516      }
1517      return getSubjectMedicalHistory().get(0);
1518    }
1519
1520    /**
1521     * @deprecated Use Reference#setResource(IBaseResource) instead
1522     */
1523    @Deprecated
1524    public List<Resource> getSubjectMedicalHistoryTarget() { 
1525      if (this.subjectMedicalHistoryTarget == null)
1526        this.subjectMedicalHistoryTarget = new ArrayList<Resource>();
1527      return this.subjectMedicalHistoryTarget;
1528    }
1529
1530    /**
1531     * @return {@link #referenceDocument} (AdverseEvent.referenceDocument.)
1532     */
1533    public List<Reference> getReferenceDocument() { 
1534      if (this.referenceDocument == null)
1535        this.referenceDocument = new ArrayList<Reference>();
1536      return this.referenceDocument;
1537    }
1538
1539    /**
1540     * @return Returns a reference to <code>this</code> for easy method chaining
1541     */
1542    public AdverseEvent setReferenceDocument(List<Reference> theReferenceDocument) { 
1543      this.referenceDocument = theReferenceDocument;
1544      return this;
1545    }
1546
1547    public boolean hasReferenceDocument() { 
1548      if (this.referenceDocument == null)
1549        return false;
1550      for (Reference item : this.referenceDocument)
1551        if (!item.isEmpty())
1552          return true;
1553      return false;
1554    }
1555
1556    public Reference addReferenceDocument() { //3
1557      Reference t = new Reference();
1558      if (this.referenceDocument == null)
1559        this.referenceDocument = new ArrayList<Reference>();
1560      this.referenceDocument.add(t);
1561      return t;
1562    }
1563
1564    public AdverseEvent addReferenceDocument(Reference t) { //3
1565      if (t == null)
1566        return this;
1567      if (this.referenceDocument == null)
1568        this.referenceDocument = new ArrayList<Reference>();
1569      this.referenceDocument.add(t);
1570      return this;
1571    }
1572
1573    /**
1574     * @return The first repetition of repeating field {@link #referenceDocument}, creating it if it does not already exist
1575     */
1576    public Reference getReferenceDocumentFirstRep() { 
1577      if (getReferenceDocument().isEmpty()) {
1578        addReferenceDocument();
1579      }
1580      return getReferenceDocument().get(0);
1581    }
1582
1583    /**
1584     * @deprecated Use Reference#setResource(IBaseResource) instead
1585     */
1586    @Deprecated
1587    public List<DocumentReference> getReferenceDocumentTarget() { 
1588      if (this.referenceDocumentTarget == null)
1589        this.referenceDocumentTarget = new ArrayList<DocumentReference>();
1590      return this.referenceDocumentTarget;
1591    }
1592
1593    /**
1594     * @deprecated Use Reference#setResource(IBaseResource) instead
1595     */
1596    @Deprecated
1597    public DocumentReference addReferenceDocumentTarget() { 
1598      DocumentReference r = new DocumentReference();
1599      if (this.referenceDocumentTarget == null)
1600        this.referenceDocumentTarget = new ArrayList<DocumentReference>();
1601      this.referenceDocumentTarget.add(r);
1602      return r;
1603    }
1604
1605    /**
1606     * @return {@link #study} (AdverseEvent.study.)
1607     */
1608    public List<Reference> getStudy() { 
1609      if (this.study == null)
1610        this.study = new ArrayList<Reference>();
1611      return this.study;
1612    }
1613
1614    /**
1615     * @return Returns a reference to <code>this</code> for easy method chaining
1616     */
1617    public AdverseEvent setStudy(List<Reference> theStudy) { 
1618      this.study = theStudy;
1619      return this;
1620    }
1621
1622    public boolean hasStudy() { 
1623      if (this.study == null)
1624        return false;
1625      for (Reference item : this.study)
1626        if (!item.isEmpty())
1627          return true;
1628      return false;
1629    }
1630
1631    public Reference addStudy() { //3
1632      Reference t = new Reference();
1633      if (this.study == null)
1634        this.study = new ArrayList<Reference>();
1635      this.study.add(t);
1636      return t;
1637    }
1638
1639    public AdverseEvent addStudy(Reference t) { //3
1640      if (t == null)
1641        return this;
1642      if (this.study == null)
1643        this.study = new ArrayList<Reference>();
1644      this.study.add(t);
1645      return this;
1646    }
1647
1648    /**
1649     * @return The first repetition of repeating field {@link #study}, creating it if it does not already exist
1650     */
1651    public Reference getStudyFirstRep() { 
1652      if (getStudy().isEmpty()) {
1653        addStudy();
1654      }
1655      return getStudy().get(0);
1656    }
1657
1658    /**
1659     * @deprecated Use Reference#setResource(IBaseResource) instead
1660     */
1661    @Deprecated
1662    public List<ResearchStudy> getStudyTarget() { 
1663      if (this.studyTarget == null)
1664        this.studyTarget = new ArrayList<ResearchStudy>();
1665      return this.studyTarget;
1666    }
1667
1668    /**
1669     * @deprecated Use Reference#setResource(IBaseResource) instead
1670     */
1671    @Deprecated
1672    public ResearchStudy addStudyTarget() { 
1673      ResearchStudy r = new ResearchStudy();
1674      if (this.studyTarget == null)
1675        this.studyTarget = new ArrayList<ResearchStudy>();
1676      this.studyTarget.add(r);
1677      return r;
1678    }
1679
1680      protected void listChildren(List<Property> children) {
1681        super.listChildren(children);
1682        children.add(new Property("identifier", "Identifier", "The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate.", 0, 1, identifier));
1683        children.add(new Property("category", "code", "The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.", 0, 1, category));
1684        children.add(new Property("type", "CodeableConcept", "This element defines the specific type of event that occurred or that was prevented from occurring.", 0, 1, type));
1685        children.add(new Property("subject", "Reference(Patient|ResearchSubject|Medication|Device)", "This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.", 0, 1, subject));
1686        children.add(new Property("date", "dateTime", "The date (and perhaps time) when the adverse event occurred.", 0, 1, date));
1687        children.add(new Property("reaction", "Reference(Condition)", "Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).", 0, java.lang.Integer.MAX_VALUE, reaction));
1688        children.add(new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location));
1689        children.add(new Property("seriousness", "CodeableConcept", "Describes the seriousness or severity of the adverse event.", 0, 1, seriousness));
1690        children.add(new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event.", 0, 1, outcome));
1691        children.add(new Property("recorder", "Reference(Patient|Practitioner|RelatedPerson)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder));
1692        children.add(new Property("eventParticipant", "Reference(Practitioner|Device)", "Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).", 0, 1, eventParticipant));
1693        children.add(new Property("description", "string", "Describes the adverse event in text.", 0, 1, description));
1694        children.add(new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity));
1695        children.add(new Property("subjectMedicalHistory", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure)", "AdverseEvent.subjectMedicalHistory.", 0, java.lang.Integer.MAX_VALUE, subjectMedicalHistory));
1696        children.add(new Property("referenceDocument", "Reference(DocumentReference)", "AdverseEvent.referenceDocument.", 0, java.lang.Integer.MAX_VALUE, referenceDocument));
1697        children.add(new Property("study", "Reference(ResearchStudy)", "AdverseEvent.study.", 0, java.lang.Integer.MAX_VALUE, study));
1698      }
1699
1700      @Override
1701      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1702        switch (_hash) {
1703        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate.", 0, 1, identifier);
1704        case 50511102: /*category*/  return new Property("category", "code", "The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.", 0, 1, category);
1705        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "This element defines the specific type of event that occurred or that was prevented from occurring.", 0, 1, type);
1706        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|ResearchSubject|Medication|Device)", "This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.", 0, 1, subject);
1707        case 3076014: /*date*/  return new Property("date", "dateTime", "The date (and perhaps time) when the adverse event occurred.", 0, 1, date);
1708        case -867509719: /*reaction*/  return new Property("reaction", "Reference(Condition)", "Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).", 0, java.lang.Integer.MAX_VALUE, reaction);
1709        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location);
1710        case -1551003909: /*seriousness*/  return new Property("seriousness", "CodeableConcept", "Describes the seriousness or severity of the adverse event.", 0, 1, seriousness);
1711        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event.", 0, 1, outcome);
1712        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Patient|Practitioner|RelatedPerson)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder);
1713        case 270753849: /*eventParticipant*/  return new Property("eventParticipant", "Reference(Practitioner|Device)", "Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).", 0, 1, eventParticipant);
1714        case -1724546052: /*description*/  return new Property("description", "string", "Describes the adverse event in text.", 0, 1, description);
1715        case -1957422662: /*suspectEntity*/  return new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity);
1716        case -1685245681: /*subjectMedicalHistory*/  return new Property("subjectMedicalHistory", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure)", "AdverseEvent.subjectMedicalHistory.", 0, java.lang.Integer.MAX_VALUE, subjectMedicalHistory);
1717        case 1013971334: /*referenceDocument*/  return new Property("referenceDocument", "Reference(DocumentReference)", "AdverseEvent.referenceDocument.", 0, java.lang.Integer.MAX_VALUE, referenceDocument);
1718        case 109776329: /*study*/  return new Property("study", "Reference(ResearchStudy)", "AdverseEvent.study.", 0, java.lang.Integer.MAX_VALUE, study);
1719        default: return super.getNamedProperty(_hash, _name, _checkValid);
1720        }
1721
1722      }
1723
1724      @Override
1725      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1726        switch (hash) {
1727        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1728        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Enumeration<AdverseEventCategory>
1729        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1730        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1731        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
1732        case -867509719: /*reaction*/ return this.reaction == null ? new Base[0] : this.reaction.toArray(new Base[this.reaction.size()]); // Reference
1733        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1734        case -1551003909: /*seriousness*/ return this.seriousness == null ? new Base[0] : new Base[] {this.seriousness}; // CodeableConcept
1735        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
1736        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
1737        case 270753849: /*eventParticipant*/ return this.eventParticipant == null ? new Base[0] : new Base[] {this.eventParticipant}; // Reference
1738        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1739        case -1957422662: /*suspectEntity*/ return this.suspectEntity == null ? new Base[0] : this.suspectEntity.toArray(new Base[this.suspectEntity.size()]); // AdverseEventSuspectEntityComponent
1740        case -1685245681: /*subjectMedicalHistory*/ return this.subjectMedicalHistory == null ? new Base[0] : this.subjectMedicalHistory.toArray(new Base[this.subjectMedicalHistory.size()]); // Reference
1741        case 1013971334: /*referenceDocument*/ return this.referenceDocument == null ? new Base[0] : this.referenceDocument.toArray(new Base[this.referenceDocument.size()]); // Reference
1742        case 109776329: /*study*/ return this.study == null ? new Base[0] : this.study.toArray(new Base[this.study.size()]); // Reference
1743        default: return super.getProperty(hash, name, checkValid);
1744        }
1745
1746      }
1747
1748      @Override
1749      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1750        switch (hash) {
1751        case -1618432855: // identifier
1752          this.identifier = castToIdentifier(value); // Identifier
1753          return value;
1754        case 50511102: // category
1755          value = new AdverseEventCategoryEnumFactory().fromType(castToCode(value));
1756          this.category = (Enumeration) value; // Enumeration<AdverseEventCategory>
1757          return value;
1758        case 3575610: // type
1759          this.type = castToCodeableConcept(value); // CodeableConcept
1760          return value;
1761        case -1867885268: // subject
1762          this.subject = castToReference(value); // Reference
1763          return value;
1764        case 3076014: // date
1765          this.date = castToDateTime(value); // DateTimeType
1766          return value;
1767        case -867509719: // reaction
1768          this.getReaction().add(castToReference(value)); // Reference
1769          return value;
1770        case 1901043637: // location
1771          this.location = castToReference(value); // Reference
1772          return value;
1773        case -1551003909: // seriousness
1774          this.seriousness = castToCodeableConcept(value); // CodeableConcept
1775          return value;
1776        case -1106507950: // outcome
1777          this.outcome = castToCodeableConcept(value); // CodeableConcept
1778          return value;
1779        case -799233858: // recorder
1780          this.recorder = castToReference(value); // Reference
1781          return value;
1782        case 270753849: // eventParticipant
1783          this.eventParticipant = castToReference(value); // Reference
1784          return value;
1785        case -1724546052: // description
1786          this.description = castToString(value); // StringType
1787          return value;
1788        case -1957422662: // suspectEntity
1789          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value); // AdverseEventSuspectEntityComponent
1790          return value;
1791        case -1685245681: // subjectMedicalHistory
1792          this.getSubjectMedicalHistory().add(castToReference(value)); // Reference
1793          return value;
1794        case 1013971334: // referenceDocument
1795          this.getReferenceDocument().add(castToReference(value)); // Reference
1796          return value;
1797        case 109776329: // study
1798          this.getStudy().add(castToReference(value)); // Reference
1799          return value;
1800        default: return super.setProperty(hash, name, value);
1801        }
1802
1803      }
1804
1805      @Override
1806      public Base setProperty(String name, Base value) throws FHIRException {
1807        if (name.equals("identifier")) {
1808          this.identifier = castToIdentifier(value); // Identifier
1809        } else if (name.equals("category")) {
1810          value = new AdverseEventCategoryEnumFactory().fromType(castToCode(value));
1811          this.category = (Enumeration) value; // Enumeration<AdverseEventCategory>
1812        } else if (name.equals("type")) {
1813          this.type = castToCodeableConcept(value); // CodeableConcept
1814        } else if (name.equals("subject")) {
1815          this.subject = castToReference(value); // Reference
1816        } else if (name.equals("date")) {
1817          this.date = castToDateTime(value); // DateTimeType
1818        } else if (name.equals("reaction")) {
1819          this.getReaction().add(castToReference(value));
1820        } else if (name.equals("location")) {
1821          this.location = castToReference(value); // Reference
1822        } else if (name.equals("seriousness")) {
1823          this.seriousness = castToCodeableConcept(value); // CodeableConcept
1824        } else if (name.equals("outcome")) {
1825          this.outcome = castToCodeableConcept(value); // CodeableConcept
1826        } else if (name.equals("recorder")) {
1827          this.recorder = castToReference(value); // Reference
1828        } else if (name.equals("eventParticipant")) {
1829          this.eventParticipant = castToReference(value); // Reference
1830        } else if (name.equals("description")) {
1831          this.description = castToString(value); // StringType
1832        } else if (name.equals("suspectEntity")) {
1833          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value);
1834        } else if (name.equals("subjectMedicalHistory")) {
1835          this.getSubjectMedicalHistory().add(castToReference(value));
1836        } else if (name.equals("referenceDocument")) {
1837          this.getReferenceDocument().add(castToReference(value));
1838        } else if (name.equals("study")) {
1839          this.getStudy().add(castToReference(value));
1840        } else
1841          return super.setProperty(name, value);
1842        return value;
1843      }
1844
1845      @Override
1846      public Base makeProperty(int hash, String name) throws FHIRException {
1847        switch (hash) {
1848        case -1618432855:  return getIdentifier(); 
1849        case 50511102:  return getCategoryElement();
1850        case 3575610:  return getType(); 
1851        case -1867885268:  return getSubject(); 
1852        case 3076014:  return getDateElement();
1853        case -867509719:  return addReaction(); 
1854        case 1901043637:  return getLocation(); 
1855        case -1551003909:  return getSeriousness(); 
1856        case -1106507950:  return getOutcome(); 
1857        case -799233858:  return getRecorder(); 
1858        case 270753849:  return getEventParticipant(); 
1859        case -1724546052:  return getDescriptionElement();
1860        case -1957422662:  return addSuspectEntity(); 
1861        case -1685245681:  return addSubjectMedicalHistory(); 
1862        case 1013971334:  return addReferenceDocument(); 
1863        case 109776329:  return addStudy(); 
1864        default: return super.makeProperty(hash, name);
1865        }
1866
1867      }
1868
1869      @Override
1870      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1871        switch (hash) {
1872        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1873        case 50511102: /*category*/ return new String[] {"code"};
1874        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1875        case -1867885268: /*subject*/ return new String[] {"Reference"};
1876        case 3076014: /*date*/ return new String[] {"dateTime"};
1877        case -867509719: /*reaction*/ return new String[] {"Reference"};
1878        case 1901043637: /*location*/ return new String[] {"Reference"};
1879        case -1551003909: /*seriousness*/ return new String[] {"CodeableConcept"};
1880        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
1881        case -799233858: /*recorder*/ return new String[] {"Reference"};
1882        case 270753849: /*eventParticipant*/ return new String[] {"Reference"};
1883        case -1724546052: /*description*/ return new String[] {"string"};
1884        case -1957422662: /*suspectEntity*/ return new String[] {};
1885        case -1685245681: /*subjectMedicalHistory*/ return new String[] {"Reference"};
1886        case 1013971334: /*referenceDocument*/ return new String[] {"Reference"};
1887        case 109776329: /*study*/ return new String[] {"Reference"};
1888        default: return super.getTypesForProperty(hash, name);
1889        }
1890
1891      }
1892
1893      @Override
1894      public Base addChild(String name) throws FHIRException {
1895        if (name.equals("identifier")) {
1896          this.identifier = new Identifier();
1897          return this.identifier;
1898        }
1899        else if (name.equals("category")) {
1900          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.category");
1901        }
1902        else if (name.equals("type")) {
1903          this.type = new CodeableConcept();
1904          return this.type;
1905        }
1906        else if (name.equals("subject")) {
1907          this.subject = new Reference();
1908          return this.subject;
1909        }
1910        else if (name.equals("date")) {
1911          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.date");
1912        }
1913        else if (name.equals("reaction")) {
1914          return addReaction();
1915        }
1916        else if (name.equals("location")) {
1917          this.location = new Reference();
1918          return this.location;
1919        }
1920        else if (name.equals("seriousness")) {
1921          this.seriousness = new CodeableConcept();
1922          return this.seriousness;
1923        }
1924        else if (name.equals("outcome")) {
1925          this.outcome = new CodeableConcept();
1926          return this.outcome;
1927        }
1928        else if (name.equals("recorder")) {
1929          this.recorder = new Reference();
1930          return this.recorder;
1931        }
1932        else if (name.equals("eventParticipant")) {
1933          this.eventParticipant = new Reference();
1934          return this.eventParticipant;
1935        }
1936        else if (name.equals("description")) {
1937          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.description");
1938        }
1939        else if (name.equals("suspectEntity")) {
1940          return addSuspectEntity();
1941        }
1942        else if (name.equals("subjectMedicalHistory")) {
1943          return addSubjectMedicalHistory();
1944        }
1945        else if (name.equals("referenceDocument")) {
1946          return addReferenceDocument();
1947        }
1948        else if (name.equals("study")) {
1949          return addStudy();
1950        }
1951        else
1952          return super.addChild(name);
1953      }
1954
1955  public String fhirType() {
1956    return "AdverseEvent";
1957
1958  }
1959
1960      public AdverseEvent copy() {
1961        AdverseEvent dst = new AdverseEvent();
1962        copyValues(dst);
1963        dst.identifier = identifier == null ? null : identifier.copy();
1964        dst.category = category == null ? null : category.copy();
1965        dst.type = type == null ? null : type.copy();
1966        dst.subject = subject == null ? null : subject.copy();
1967        dst.date = date == null ? null : date.copy();
1968        if (reaction != null) {
1969          dst.reaction = new ArrayList<Reference>();
1970          for (Reference i : reaction)
1971            dst.reaction.add(i.copy());
1972        };
1973        dst.location = location == null ? null : location.copy();
1974        dst.seriousness = seriousness == null ? null : seriousness.copy();
1975        dst.outcome = outcome == null ? null : outcome.copy();
1976        dst.recorder = recorder == null ? null : recorder.copy();
1977        dst.eventParticipant = eventParticipant == null ? null : eventParticipant.copy();
1978        dst.description = description == null ? null : description.copy();
1979        if (suspectEntity != null) {
1980          dst.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
1981          for (AdverseEventSuspectEntityComponent i : suspectEntity)
1982            dst.suspectEntity.add(i.copy());
1983        };
1984        if (subjectMedicalHistory != null) {
1985          dst.subjectMedicalHistory = new ArrayList<Reference>();
1986          for (Reference i : subjectMedicalHistory)
1987            dst.subjectMedicalHistory.add(i.copy());
1988        };
1989        if (referenceDocument != null) {
1990          dst.referenceDocument = new ArrayList<Reference>();
1991          for (Reference i : referenceDocument)
1992            dst.referenceDocument.add(i.copy());
1993        };
1994        if (study != null) {
1995          dst.study = new ArrayList<Reference>();
1996          for (Reference i : study)
1997            dst.study.add(i.copy());
1998        };
1999        return dst;
2000      }
2001
2002      protected AdverseEvent typedCopy() {
2003        return copy();
2004      }
2005
2006      @Override
2007      public boolean equalsDeep(Base other_) {
2008        if (!super.equalsDeep(other_))
2009          return false;
2010        if (!(other_ instanceof AdverseEvent))
2011          return false;
2012        AdverseEvent o = (AdverseEvent) other_;
2013        return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true) && compareDeep(type, o.type, true)
2014           && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true) && compareDeep(reaction, o.reaction, true)
2015           && compareDeep(location, o.location, true) && compareDeep(seriousness, o.seriousness, true) && compareDeep(outcome, o.outcome, true)
2016           && compareDeep(recorder, o.recorder, true) && compareDeep(eventParticipant, o.eventParticipant, true)
2017           && compareDeep(description, o.description, true) && compareDeep(suspectEntity, o.suspectEntity, true)
2018           && compareDeep(subjectMedicalHistory, o.subjectMedicalHistory, true) && compareDeep(referenceDocument, o.referenceDocument, true)
2019           && compareDeep(study, o.study, true);
2020      }
2021
2022      @Override
2023      public boolean equalsShallow(Base other_) {
2024        if (!super.equalsShallow(other_))
2025          return false;
2026        if (!(other_ instanceof AdverseEvent))
2027          return false;
2028        AdverseEvent o = (AdverseEvent) other_;
2029        return compareValues(category, o.category, true) && compareValues(date, o.date, true) && compareValues(description, o.description, true)
2030          ;
2031      }
2032
2033      public boolean isEmpty() {
2034        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, category, type
2035          , subject, date, reaction, location, seriousness, outcome, recorder, eventParticipant
2036          , description, suspectEntity, subjectMedicalHistory, referenceDocument, study);
2037      }
2038
2039  @Override
2040  public ResourceType getResourceType() {
2041    return ResourceType.AdverseEvent;
2042   }
2043
2044 /**
2045   * Search parameter: <b>date</b>
2046   * <p>
2047   * Description: <b>When the event occurred</b><br>
2048   * Type: <b>date</b><br>
2049   * Path: <b>AdverseEvent.date</b><br>
2050   * </p>
2051   */
2052  @SearchParamDefinition(name="date", path="AdverseEvent.date", description="When the event occurred", type="date" )
2053  public static final String SP_DATE = "date";
2054 /**
2055   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2056   * <p>
2057   * Description: <b>When the event occurred</b><br>
2058   * Type: <b>date</b><br>
2059   * Path: <b>AdverseEvent.date</b><br>
2060   * </p>
2061   */
2062  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2063
2064 /**
2065   * Search parameter: <b>recorder</b>
2066   * <p>
2067   * Description: <b>Who recorded the adverse event</b><br>
2068   * Type: <b>reference</b><br>
2069   * Path: <b>AdverseEvent.recorder</b><br>
2070   * </p>
2071   */
2072  @SearchParamDefinition(name="recorder", path="AdverseEvent.recorder", description="Who recorded the adverse event", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Patient.class, Practitioner.class, RelatedPerson.class } )
2073  public static final String SP_RECORDER = "recorder";
2074 /**
2075   * <b>Fluent Client</b> search parameter constant for <b>recorder</b>
2076   * <p>
2077   * Description: <b>Who recorded the adverse event</b><br>
2078   * Type: <b>reference</b><br>
2079   * Path: <b>AdverseEvent.recorder</b><br>
2080   * </p>
2081   */
2082  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECORDER);
2083
2084/**
2085   * Constant for fluent queries to be used to add include statements. Specifies
2086   * the path value of "<b>AdverseEvent:recorder</b>".
2087   */
2088  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECORDER = new ca.uhn.fhir.model.api.Include("AdverseEvent:recorder").toLocked();
2089
2090 /**
2091   * Search parameter: <b>study</b>
2092   * <p>
2093   * Description: <b>AdverseEvent.study</b><br>
2094   * Type: <b>reference</b><br>
2095   * Path: <b>AdverseEvent.study</b><br>
2096   * </p>
2097   */
2098  @SearchParamDefinition(name="study", path="AdverseEvent.study", description="AdverseEvent.study", type="reference", target={ResearchStudy.class } )
2099  public static final String SP_STUDY = "study";
2100 /**
2101   * <b>Fluent Client</b> search parameter constant for <b>study</b>
2102   * <p>
2103   * Description: <b>AdverseEvent.study</b><br>
2104   * Type: <b>reference</b><br>
2105   * Path: <b>AdverseEvent.study</b><br>
2106   * </p>
2107   */
2108  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam STUDY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_STUDY);
2109
2110/**
2111   * Constant for fluent queries to be used to add include statements. Specifies
2112   * the path value of "<b>AdverseEvent:study</b>".
2113   */
2114  public static final ca.uhn.fhir.model.api.Include INCLUDE_STUDY = new ca.uhn.fhir.model.api.Include("AdverseEvent:study").toLocked();
2115
2116 /**
2117   * Search parameter: <b>reaction</b>
2118   * <p>
2119   * Description: <b>Adverse Reaction Events linked to exposure to substance</b><br>
2120   * Type: <b>reference</b><br>
2121   * Path: <b>AdverseEvent.reaction</b><br>
2122   * </p>
2123   */
2124  @SearchParamDefinition(name="reaction", path="AdverseEvent.reaction", description="Adverse Reaction Events linked to exposure to substance", type="reference", target={Condition.class } )
2125  public static final String SP_REACTION = "reaction";
2126 /**
2127   * <b>Fluent Client</b> search parameter constant for <b>reaction</b>
2128   * <p>
2129   * Description: <b>Adverse Reaction Events linked to exposure to substance</b><br>
2130   * Type: <b>reference</b><br>
2131   * Path: <b>AdverseEvent.reaction</b><br>
2132   * </p>
2133   */
2134  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REACTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REACTION);
2135
2136/**
2137   * Constant for fluent queries to be used to add include statements. Specifies
2138   * the path value of "<b>AdverseEvent:reaction</b>".
2139   */
2140  public static final ca.uhn.fhir.model.api.Include INCLUDE_REACTION = new ca.uhn.fhir.model.api.Include("AdverseEvent:reaction").toLocked();
2141
2142 /**
2143   * Search parameter: <b>seriousness</b>
2144   * <p>
2145   * Description: <b>Mild | Moderate | Severe</b><br>
2146   * Type: <b>token</b><br>
2147   * Path: <b>AdverseEvent.seriousness</b><br>
2148   * </p>
2149   */
2150  @SearchParamDefinition(name="seriousness", path="AdverseEvent.seriousness", description="Mild | Moderate | Severe", type="token" )
2151  public static final String SP_SERIOUSNESS = "seriousness";
2152 /**
2153   * <b>Fluent Client</b> search parameter constant for <b>seriousness</b>
2154   * <p>
2155   * Description: <b>Mild | Moderate | Severe</b><br>
2156   * Type: <b>token</b><br>
2157   * Path: <b>AdverseEvent.seriousness</b><br>
2158   * </p>
2159   */
2160  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIOUSNESS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERIOUSNESS);
2161
2162 /**
2163   * Search parameter: <b>subject</b>
2164   * <p>
2165   * Description: <b>Subject or group impacted by event</b><br>
2166   * Type: <b>reference</b><br>
2167   * Path: <b>AdverseEvent.subject</b><br>
2168   * </p>
2169   */
2170  @SearchParamDefinition(name="subject", path="AdverseEvent.subject", description="Subject or group impacted by event", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Device.class, Medication.class, Patient.class, ResearchSubject.class } )
2171  public static final String SP_SUBJECT = "subject";
2172 /**
2173   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2174   * <p>
2175   * Description: <b>Subject or group impacted by event</b><br>
2176   * Type: <b>reference</b><br>
2177   * Path: <b>AdverseEvent.subject</b><br>
2178   * </p>
2179   */
2180  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2181
2182/**
2183   * Constant for fluent queries to be used to add include statements. Specifies
2184   * the path value of "<b>AdverseEvent:subject</b>".
2185   */
2186  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("AdverseEvent:subject").toLocked();
2187
2188 /**
2189   * Search parameter: <b>substance</b>
2190   * <p>
2191   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
2192   * Type: <b>reference</b><br>
2193   * Path: <b>AdverseEvent.suspectEntity.instance</b><br>
2194   * </p>
2195   */
2196  @SearchParamDefinition(name="substance", path="AdverseEvent.suspectEntity.instance", description="Refers to the specific entity that caused the adverse event", type="reference", target={Device.class, Medication.class, MedicationAdministration.class, MedicationStatement.class, Substance.class } )
2197  public static final String SP_SUBSTANCE = "substance";
2198 /**
2199   * <b>Fluent Client</b> search parameter constant for <b>substance</b>
2200   * <p>
2201   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
2202   * Type: <b>reference</b><br>
2203   * Path: <b>AdverseEvent.suspectEntity.instance</b><br>
2204   * </p>
2205   */
2206  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE);
2207
2208/**
2209   * Constant for fluent queries to be used to add include statements. Specifies
2210   * the path value of "<b>AdverseEvent:substance</b>".
2211   */
2212  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE = new ca.uhn.fhir.model.api.Include("AdverseEvent:substance").toLocked();
2213
2214 /**
2215   * Search parameter: <b>location</b>
2216   * <p>
2217   * Description: <b>Location where adverse event occurred</b><br>
2218   * Type: <b>reference</b><br>
2219   * Path: <b>AdverseEvent.location</b><br>
2220   * </p>
2221   */
2222  @SearchParamDefinition(name="location", path="AdverseEvent.location", description="Location where adverse event occurred", type="reference", target={Location.class } )
2223  public static final String SP_LOCATION = "location";
2224 /**
2225   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2226   * <p>
2227   * Description: <b>Location where adverse event occurred</b><br>
2228   * Type: <b>reference</b><br>
2229   * Path: <b>AdverseEvent.location</b><br>
2230   * </p>
2231   */
2232  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2233
2234/**
2235   * Constant for fluent queries to be used to add include statements. Specifies
2236   * the path value of "<b>AdverseEvent:location</b>".
2237   */
2238  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("AdverseEvent:location").toLocked();
2239
2240 /**
2241   * Search parameter: <b>category</b>
2242   * <p>
2243   * Description: <b>AE | PAE 
2244An adverse event is an event that caused harm to a patient,  an adverse reaction is a something that is a subject-specific event that is a result of an exposure to a medication, food, device or environmental substance, a potential adverse event is something that occurred and that could have caused harm to a patient but did not</b><br>
2245   * Type: <b>token</b><br>
2246   * Path: <b>AdverseEvent.category</b><br>
2247   * </p>
2248   */
2249  @SearchParamDefinition(name="category", path="AdverseEvent.category", description="AE | PAE \rAn adverse event is an event that caused harm to a patient,  an adverse reaction is a something that is a subject-specific event that is a result of an exposure to a medication, food, device or environmental substance, a potential adverse event is something that occurred and that could have caused harm to a patient but did not", type="token" )
2250  public static final String SP_CATEGORY = "category";
2251 /**
2252   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2253   * <p>
2254   * Description: <b>AE | PAE 
2255An adverse event is an event that caused harm to a patient,  an adverse reaction is a something that is a subject-specific event that is a result of an exposure to a medication, food, device or environmental substance, a potential adverse event is something that occurred and that could have caused harm to a patient but did not</b><br>
2256   * Type: <b>token</b><br>
2257   * Path: <b>AdverseEvent.category</b><br>
2258   * </p>
2259   */
2260  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2261
2262 /**
2263   * Search parameter: <b>type</b>
2264   * <p>
2265   * Description: <b>actual | potential</b><br>
2266   * Type: <b>token</b><br>
2267   * Path: <b>AdverseEvent.type</b><br>
2268   * </p>
2269   */
2270  @SearchParamDefinition(name="type", path="AdverseEvent.type", description="actual | potential", type="token" )
2271  public static final String SP_TYPE = "type";
2272 /**
2273   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2274   * <p>
2275   * Description: <b>actual | potential</b><br>
2276   * Type: <b>token</b><br>
2277   * Path: <b>AdverseEvent.type</b><br>
2278   * </p>
2279   */
2280  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2281
2282
2283}
2284