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