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