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