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