001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
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 Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * An event (i.e. any change to current patient status) that may be related to unintended effects on a patient or research subject.  The unintended effects may require additional monitoring, treatment or hospitalization or may result in death.  The AdverseEvent resource also extends to potential or avoided events that could have had such effects.
070 */
071@ResourceDef(name="AdverseEvent", profile="http://hl7.org/fhir/StructureDefinition/AdverseEvent")
072public class AdverseEvent extends DomainResource {
073
074    public enum AdverseEventStatus {
075        /**
076         * null
077         */
078        INPROGRESS, 
079        /**
080         * null
081         */
082        COMPLETED, 
083        /**
084         * null
085         */
086        ENTEREDINERROR, 
087        /**
088         * null
089         */
090        UNKNOWN, 
091        /**
092         * added to help the parsers with the generic types
093         */
094        NULL;
095        public static AdverseEventStatus fromCode(String codeString) throws FHIRException {
096            if (codeString == null || "".equals(codeString))
097                return null;
098        if ("in-progress".equals(codeString))
099          return INPROGRESS;
100        if ("completed".equals(codeString))
101          return COMPLETED;
102        if ("entered-in-error".equals(codeString))
103          return ENTEREDINERROR;
104        if ("unknown".equals(codeString))
105          return UNKNOWN;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown AdverseEventStatus code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case INPROGRESS: return "in-progress";
114            case COMPLETED: return "completed";
115            case ENTEREDINERROR: return "entered-in-error";
116            case UNKNOWN: return "unknown";
117            default: return "?";
118          }
119        }
120        public String getSystem() {
121          switch (this) {
122            case INPROGRESS: return "http://hl7.org/fhir/event-status";
123            case COMPLETED: return "http://hl7.org/fhir/event-status";
124            case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
125            case UNKNOWN: return "http://hl7.org/fhir/event-status";
126            default: return "?";
127          }
128        }
129        public String getDefinition() {
130          switch (this) {
131            case INPROGRESS: return "";
132            case COMPLETED: return "";
133            case ENTEREDINERROR: return "";
134            case UNKNOWN: return "";
135            default: return "?";
136          }
137        }
138        public String getDisplay() {
139          switch (this) {
140            case INPROGRESS: return "in-progress";
141            case COMPLETED: return "completed";
142            case ENTEREDINERROR: return "entered-in-error";
143            case UNKNOWN: return "unknown";
144            default: return "?";
145          }
146        }
147    }
148
149  public static class AdverseEventStatusEnumFactory implements EnumFactory<AdverseEventStatus> {
150    public AdverseEventStatus fromCode(String codeString) throws IllegalArgumentException {
151      if (codeString == null || "".equals(codeString))
152            if (codeString == null || "".equals(codeString))
153                return null;
154        if ("in-progress".equals(codeString))
155          return AdverseEventStatus.INPROGRESS;
156        if ("completed".equals(codeString))
157          return AdverseEventStatus.COMPLETED;
158        if ("entered-in-error".equals(codeString))
159          return AdverseEventStatus.ENTEREDINERROR;
160        if ("unknown".equals(codeString))
161          return AdverseEventStatus.UNKNOWN;
162        throw new IllegalArgumentException("Unknown AdverseEventStatus code '"+codeString+"'");
163        }
164        public Enumeration<AdverseEventStatus> fromType(Base code) throws FHIRException {
165          if (code == null)
166            return null;
167          if (code.isEmpty())
168            return new Enumeration<AdverseEventStatus>(this);
169          String codeString = ((PrimitiveType) code).asStringValue();
170          if (codeString == null || "".equals(codeString))
171            return null;
172        if ("in-progress".equals(codeString))
173          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.INPROGRESS);
174        if ("completed".equals(codeString))
175          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.COMPLETED);
176        if ("entered-in-error".equals(codeString))
177          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.ENTEREDINERROR);
178        if ("unknown".equals(codeString))
179          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.UNKNOWN);
180        throw new FHIRException("Unknown AdverseEventStatus code '"+codeString+"'");
181        }
182    public String toCode(AdverseEventStatus code) {
183      if (code == AdverseEventStatus.INPROGRESS)
184        return "in-progress";
185      if (code == AdverseEventStatus.COMPLETED)
186        return "completed";
187      if (code == AdverseEventStatus.ENTEREDINERROR)
188        return "entered-in-error";
189      if (code == AdverseEventStatus.UNKNOWN)
190        return "unknown";
191      return "?";
192      }
193    public String toSystem(AdverseEventStatus code) {
194      return code.getSystem();
195      }
196    }
197
198    public enum AdverseEventActuality {
199        /**
200         * The adverse event actually happened regardless of whether anyone was affected or harmed.
201         */
202        ACTUAL, 
203        /**
204         * A potential adverse event.
205         */
206        POTENTIAL, 
207        /**
208         * added to help the parsers with the generic types
209         */
210        NULL;
211        public static AdverseEventActuality fromCode(String codeString) throws FHIRException {
212            if (codeString == null || "".equals(codeString))
213                return null;
214        if ("actual".equals(codeString))
215          return ACTUAL;
216        if ("potential".equals(codeString))
217          return POTENTIAL;
218        if (Configuration.isAcceptInvalidEnums())
219          return null;
220        else
221          throw new FHIRException("Unknown AdverseEventActuality code '"+codeString+"'");
222        }
223        public String toCode() {
224          switch (this) {
225            case ACTUAL: return "actual";
226            case POTENTIAL: return "potential";
227            default: return "?";
228          }
229        }
230        public String getSystem() {
231          switch (this) {
232            case ACTUAL: return "http://hl7.org/fhir/adverse-event-actuality";
233            case POTENTIAL: return "http://hl7.org/fhir/adverse-event-actuality";
234            default: return "?";
235          }
236        }
237        public String getDefinition() {
238          switch (this) {
239            case ACTUAL: return "The adverse event actually happened regardless of whether anyone was affected or harmed.";
240            case POTENTIAL: return "A potential adverse event.";
241            default: return "?";
242          }
243        }
244        public String getDisplay() {
245          switch (this) {
246            case ACTUAL: return "Adverse Event";
247            case POTENTIAL: return "Potential Adverse Event";
248            default: return "?";
249          }
250        }
251    }
252
253  public static class AdverseEventActualityEnumFactory implements EnumFactory<AdverseEventActuality> {
254    public AdverseEventActuality fromCode(String codeString) throws IllegalArgumentException {
255      if (codeString == null || "".equals(codeString))
256            if (codeString == null || "".equals(codeString))
257                return null;
258        if ("actual".equals(codeString))
259          return AdverseEventActuality.ACTUAL;
260        if ("potential".equals(codeString))
261          return AdverseEventActuality.POTENTIAL;
262        throw new IllegalArgumentException("Unknown AdverseEventActuality code '"+codeString+"'");
263        }
264        public Enumeration<AdverseEventActuality> fromType(Base code) throws FHIRException {
265          if (code == null)
266            return null;
267          if (code.isEmpty())
268            return new Enumeration<AdverseEventActuality>(this);
269          String codeString = ((PrimitiveType) code).asStringValue();
270          if (codeString == null || "".equals(codeString))
271            return null;
272        if ("actual".equals(codeString))
273          return new Enumeration<AdverseEventActuality>(this, AdverseEventActuality.ACTUAL);
274        if ("potential".equals(codeString))
275          return new Enumeration<AdverseEventActuality>(this, AdverseEventActuality.POTENTIAL);
276        throw new FHIRException("Unknown AdverseEventActuality code '"+codeString+"'");
277        }
278    public String toCode(AdverseEventActuality code) {
279      if (code == AdverseEventActuality.ACTUAL)
280        return "actual";
281      if (code == AdverseEventActuality.POTENTIAL)
282        return "potential";
283      return "?";
284      }
285    public String toSystem(AdverseEventActuality code) {
286      return code.getSystem();
287      }
288    }
289
290    @Block()
291    public static class AdverseEventParticipantComponent extends BackboneElement implements IBaseBackboneElement {
292        /**
293         * Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.
294         */
295        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
296        @Description(shortDefinition="Type of involvement", formalDefinition="Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant." )
297        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-participant-function")
298        protected CodeableConcept function;
299
300        /**
301         * Indicates who or what participated in the event.
302         */
303        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class, Device.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=true)
304        @Description(shortDefinition="Who was involved in the adverse event or the potential adverse event", formalDefinition="Indicates who or what participated in the event." )
305        protected Reference actor;
306
307        private static final long serialVersionUID = -576943815L;
308
309    /**
310     * Constructor
311     */
312      public AdverseEventParticipantComponent() {
313        super();
314      }
315
316    /**
317     * Constructor
318     */
319      public AdverseEventParticipantComponent(Reference actor) {
320        super();
321        this.actor = actor;
322      }
323
324        /**
325         * @return {@link #function} (Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.)
326         */
327        public CodeableConcept getFunction() { 
328          if (this.function == null)
329            if (Configuration.errorOnAutoCreate())
330              throw new Error("Attempt to auto-create AdverseEventParticipantComponent.function");
331            else if (Configuration.doAutoCreate())
332              this.function = new CodeableConcept(); // cc
333          return this.function;
334        }
335
336        public boolean hasFunction() { 
337          return this.function != null && !this.function.isEmpty();
338        }
339
340        /**
341         * @param value {@link #function} (Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.)
342         */
343        public AdverseEventParticipantComponent setFunction(CodeableConcept value) { 
344          this.function = value;
345          return this;
346        }
347
348        /**
349         * @return {@link #actor} (Indicates who or what participated in the event.)
350         */
351        public Reference getActor() { 
352          if (this.actor == null)
353            if (Configuration.errorOnAutoCreate())
354              throw new Error("Attempt to auto-create AdverseEventParticipantComponent.actor");
355            else if (Configuration.doAutoCreate())
356              this.actor = new Reference(); // cc
357          return this.actor;
358        }
359
360        public boolean hasActor() { 
361          return this.actor != null && !this.actor.isEmpty();
362        }
363
364        /**
365         * @param value {@link #actor} (Indicates who or what participated in the event.)
366         */
367        public AdverseEventParticipantComponent setActor(Reference value) { 
368          this.actor = value;
369          return this;
370        }
371
372        protected void listChildren(List<Property> children) {
373          super.listChildren(children);
374          children.add(new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.", 0, 1, function));
375          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what participated in the event.", 0, 1, actor));
376        }
377
378        @Override
379        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
380          switch (_hash) {
381          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.", 0, 1, function);
382          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what participated in the event.", 0, 1, actor);
383          default: return super.getNamedProperty(_hash, _name, _checkValid);
384          }
385
386        }
387
388      @Override
389      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
390        switch (hash) {
391        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
392        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
393        default: return super.getProperty(hash, name, checkValid);
394        }
395
396      }
397
398      @Override
399      public Base setProperty(int hash, String name, Base value) throws FHIRException {
400        switch (hash) {
401        case 1380938712: // function
402          this.function = castToCodeableConcept(value); // CodeableConcept
403          return value;
404        case 92645877: // actor
405          this.actor = castToReference(value); // Reference
406          return value;
407        default: return super.setProperty(hash, name, value);
408        }
409
410      }
411
412      @Override
413      public Base setProperty(String name, Base value) throws FHIRException {
414        if (name.equals("function")) {
415          this.function = castToCodeableConcept(value); // CodeableConcept
416        } else if (name.equals("actor")) {
417          this.actor = castToReference(value); // Reference
418        } else
419          return super.setProperty(name, value);
420        return value;
421      }
422
423      @Override
424      public Base makeProperty(int hash, String name) throws FHIRException {
425        switch (hash) {
426        case 1380938712:  return getFunction();
427        case 92645877:  return getActor();
428        default: return super.makeProperty(hash, name);
429        }
430
431      }
432
433      @Override
434      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
435        switch (hash) {
436        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
437        case 92645877: /*actor*/ return new String[] {"Reference"};
438        default: return super.getTypesForProperty(hash, name);
439        }
440
441      }
442
443      @Override
444      public Base addChild(String name) throws FHIRException {
445        if (name.equals("function")) {
446          this.function = new CodeableConcept();
447          return this.function;
448        }
449        else if (name.equals("actor")) {
450          this.actor = new Reference();
451          return this.actor;
452        }
453        else
454          return super.addChild(name);
455      }
456
457      public AdverseEventParticipantComponent copy() {
458        AdverseEventParticipantComponent dst = new AdverseEventParticipantComponent();
459        copyValues(dst);
460        return dst;
461      }
462
463      public void copyValues(AdverseEventParticipantComponent dst) {
464        super.copyValues(dst);
465        dst.function = function == null ? null : function.copy();
466        dst.actor = actor == null ? null : actor.copy();
467      }
468
469      @Override
470      public boolean equalsDeep(Base other_) {
471        if (!super.equalsDeep(other_))
472          return false;
473        if (!(other_ instanceof AdverseEventParticipantComponent))
474          return false;
475        AdverseEventParticipantComponent o = (AdverseEventParticipantComponent) other_;
476        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
477      }
478
479      @Override
480      public boolean equalsShallow(Base other_) {
481        if (!super.equalsShallow(other_))
482          return false;
483        if (!(other_ instanceof AdverseEventParticipantComponent))
484          return false;
485        AdverseEventParticipantComponent o = (AdverseEventParticipantComponent) other_;
486        return true;
487      }
488
489      public boolean isEmpty() {
490        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
491      }
492
493  public String fhirType() {
494    return "AdverseEvent.participant";
495
496  }
497
498  }
499
500    @Block()
501    public static class AdverseEventSuspectEntityComponent extends BackboneElement implements IBaseBackboneElement {
502        /**
503         * Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.
504         */
505        @Child(name = "instance", type = {CodeableConcept.class, Immunization.class, Procedure.class, Substance.class, Medication.class, MedicationAdministration.class, MedicationUsage.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
506        @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." )
507        protected Type instance;
508
509        /**
510         * Information on the possible cause of the event.
511         */
512        @Child(name = "causality", type = {}, order=2, min=0, max=1, modifier=false, summary=true)
513        @Description(shortDefinition="Information on the possible cause of the event", formalDefinition="Information on the possible cause of the event." )
514        protected AdverseEventSuspectEntityCausalityComponent causality;
515
516        private static final long serialVersionUID = -1692034806L;
517
518    /**
519     * Constructor
520     */
521      public AdverseEventSuspectEntityComponent() {
522        super();
523      }
524
525    /**
526     * Constructor
527     */
528      public AdverseEventSuspectEntityComponent(Type instance) {
529        super();
530        this.instance = instance;
531      }
532
533        /**
534         * @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.)
535         */
536        public Type getInstance() { 
537          return this.instance;
538        }
539
540        /**
541         * @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.)
542         */
543        public CodeableConcept getInstanceCodeableConcept() throws FHIRException { 
544          if (this.instance == null)
545            this.instance = new CodeableConcept();
546          if (!(this.instance instanceof CodeableConcept))
547            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.instance.getClass().getName()+" was encountered");
548          return (CodeableConcept) this.instance;
549        }
550
551        public boolean hasInstanceCodeableConcept() { 
552          return this != null && this.instance instanceof CodeableConcept;
553        }
554
555        /**
556         * @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.)
557         */
558        public Reference getInstanceReference() throws FHIRException { 
559          if (this.instance == null)
560            this.instance = new Reference();
561          if (!(this.instance instanceof Reference))
562            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.instance.getClass().getName()+" was encountered");
563          return (Reference) this.instance;
564        }
565
566        public boolean hasInstanceReference() { 
567          return this != null && this.instance instanceof Reference;
568        }
569
570        public boolean hasInstance() { 
571          return this.instance != null && !this.instance.isEmpty();
572        }
573
574        /**
575         * @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.)
576         */
577        public AdverseEventSuspectEntityComponent setInstance(Type value) { 
578          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
579            throw new Error("Not the right type for AdverseEvent.suspectEntity.instance[x]: "+value.fhirType());
580          this.instance = value;
581          return this;
582        }
583
584        /**
585         * @return {@link #causality} (Information on the possible cause of the event.)
586         */
587        public AdverseEventSuspectEntityCausalityComponent getCausality() { 
588          if (this.causality == null)
589            if (Configuration.errorOnAutoCreate())
590              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causality");
591            else if (Configuration.doAutoCreate())
592              this.causality = new AdverseEventSuspectEntityCausalityComponent(); // cc
593          return this.causality;
594        }
595
596        public boolean hasCausality() { 
597          return this.causality != null && !this.causality.isEmpty();
598        }
599
600        /**
601         * @param value {@link #causality} (Information on the possible cause of the event.)
602         */
603        public AdverseEventSuspectEntityComponent setCausality(AdverseEventSuspectEntityCausalityComponent value) { 
604          this.causality = value;
605          return this;
606        }
607
608        protected void listChildren(List<Property> children) {
609          super.listChildren(children);
610          children.add(new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|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));
611          children.add(new Property("causality", "", "Information on the possible cause of the event.", 0, 1, causality));
612        }
613
614        @Override
615        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
616          switch (_hash) {
617          case -2101998645: /*instance[x]*/  return new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|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);
618          case 555127957: /*instance*/  return new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|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);
619          case 697546316: /*instanceCodeableConcept*/  return new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|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);
620          case -1675877834: /*instanceReference*/  return new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|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);
621          case -1446450521: /*causality*/  return new Property("causality", "", "Information on the possible cause of the event.", 0, 1, causality);
622          default: return super.getNamedProperty(_hash, _name, _checkValid);
623          }
624
625        }
626
627      @Override
628      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
629        switch (hash) {
630        case 555127957: /*instance*/ return this.instance == null ? new Base[0] : new Base[] {this.instance}; // Type
631        case -1446450521: /*causality*/ return this.causality == null ? new Base[0] : new Base[] {this.causality}; // AdverseEventSuspectEntityCausalityComponent
632        default: return super.getProperty(hash, name, checkValid);
633        }
634
635      }
636
637      @Override
638      public Base setProperty(int hash, String name, Base value) throws FHIRException {
639        switch (hash) {
640        case 555127957: // instance
641          this.instance = castToType(value); // Type
642          return value;
643        case -1446450521: // causality
644          this.causality = (AdverseEventSuspectEntityCausalityComponent) value; // AdverseEventSuspectEntityCausalityComponent
645          return value;
646        default: return super.setProperty(hash, name, value);
647        }
648
649      }
650
651      @Override
652      public Base setProperty(String name, Base value) throws FHIRException {
653        if (name.equals("instance[x]")) {
654          this.instance = castToType(value); // Type
655        } else if (name.equals("causality")) {
656          this.causality = (AdverseEventSuspectEntityCausalityComponent) value; // AdverseEventSuspectEntityCausalityComponent
657        } else
658          return super.setProperty(name, value);
659        return value;
660      }
661
662      @Override
663      public Base makeProperty(int hash, String name) throws FHIRException {
664        switch (hash) {
665        case -2101998645:  return getInstance();
666        case 555127957:  return getInstance();
667        case -1446450521:  return getCausality();
668        default: return super.makeProperty(hash, name);
669        }
670
671      }
672
673      @Override
674      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
675        switch (hash) {
676        case 555127957: /*instance*/ return new String[] {"CodeableConcept", "Reference"};
677        case -1446450521: /*causality*/ return new String[] {};
678        default: return super.getTypesForProperty(hash, name);
679        }
680
681      }
682
683      @Override
684      public Base addChild(String name) throws FHIRException {
685        if (name.equals("instanceCodeableConcept")) {
686          this.instance = new CodeableConcept();
687          return this.instance;
688        }
689        else if (name.equals("instanceReference")) {
690          this.instance = new Reference();
691          return this.instance;
692        }
693        else if (name.equals("causality")) {
694          this.causality = new AdverseEventSuspectEntityCausalityComponent();
695          return this.causality;
696        }
697        else
698          return super.addChild(name);
699      }
700
701      public AdverseEventSuspectEntityComponent copy() {
702        AdverseEventSuspectEntityComponent dst = new AdverseEventSuspectEntityComponent();
703        copyValues(dst);
704        return dst;
705      }
706
707      public void copyValues(AdverseEventSuspectEntityComponent dst) {
708        super.copyValues(dst);
709        dst.instance = instance == null ? null : instance.copy();
710        dst.causality = causality == null ? null : causality.copy();
711      }
712
713      @Override
714      public boolean equalsDeep(Base other_) {
715        if (!super.equalsDeep(other_))
716          return false;
717        if (!(other_ instanceof AdverseEventSuspectEntityComponent))
718          return false;
719        AdverseEventSuspectEntityComponent o = (AdverseEventSuspectEntityComponent) other_;
720        return compareDeep(instance, o.instance, true) && compareDeep(causality, o.causality, true);
721      }
722
723      @Override
724      public boolean equalsShallow(Base other_) {
725        if (!super.equalsShallow(other_))
726          return false;
727        if (!(other_ instanceof AdverseEventSuspectEntityComponent))
728          return false;
729        AdverseEventSuspectEntityComponent o = (AdverseEventSuspectEntityComponent) other_;
730        return true;
731      }
732
733      public boolean isEmpty() {
734        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(instance, causality);
735      }
736
737  public String fhirType() {
738    return "AdverseEvent.suspectEntity";
739
740  }
741
742  }
743
744    @Block()
745    public static class AdverseEventSuspectEntityCausalityComponent extends BackboneElement implements IBaseBackboneElement {
746        /**
747         * The method of evaluating the relatedness of the suspected entity to the event.
748         */
749        @Child(name = "assessmentMethod", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
750        @Description(shortDefinition="Method of evaluating the relatedness of the suspected entity to the event", formalDefinition="The method of evaluating the relatedness of the suspected entity to the event." )
751        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-method")
752        protected CodeableConcept assessmentMethod;
753
754        /**
755         * The result of the assessment regarding the relatedness of the suspected entity to the event.
756         */
757        @Child(name = "entityRelatedness", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
758        @Description(shortDefinition="Result of the assessment regarding the relatedness of the suspected entity to the event", formalDefinition="The result of the assessment regarding the relatedness of the suspected entity to the event." )
759        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-assess")
760        protected CodeableConcept entityRelatedness;
761
762        /**
763         * The author of the information on the possible cause of the event.
764         */
765        @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=true)
766        @Description(shortDefinition="Author of the information on the possible cause of the event", formalDefinition="The author of the information on the possible cause of the event." )
767        protected Reference author;
768
769        private static final long serialVersionUID = 486112728L;
770
771    /**
772     * Constructor
773     */
774      public AdverseEventSuspectEntityCausalityComponent() {
775        super();
776      }
777
778        /**
779         * @return {@link #assessmentMethod} (The method of evaluating the relatedness of the suspected entity to the event.)
780         */
781        public CodeableConcept getAssessmentMethod() { 
782          if (this.assessmentMethod == null)
783            if (Configuration.errorOnAutoCreate())
784              throw new Error("Attempt to auto-create AdverseEventSuspectEntityCausalityComponent.assessmentMethod");
785            else if (Configuration.doAutoCreate())
786              this.assessmentMethod = new CodeableConcept(); // cc
787          return this.assessmentMethod;
788        }
789
790        public boolean hasAssessmentMethod() { 
791          return this.assessmentMethod != null && !this.assessmentMethod.isEmpty();
792        }
793
794        /**
795         * @param value {@link #assessmentMethod} (The method of evaluating the relatedness of the suspected entity to the event.)
796         */
797        public AdverseEventSuspectEntityCausalityComponent setAssessmentMethod(CodeableConcept value) { 
798          this.assessmentMethod = value;
799          return this;
800        }
801
802        /**
803         * @return {@link #entityRelatedness} (The result of the assessment regarding the relatedness of the suspected entity to the event.)
804         */
805        public CodeableConcept getEntityRelatedness() { 
806          if (this.entityRelatedness == null)
807            if (Configuration.errorOnAutoCreate())
808              throw new Error("Attempt to auto-create AdverseEventSuspectEntityCausalityComponent.entityRelatedness");
809            else if (Configuration.doAutoCreate())
810              this.entityRelatedness = new CodeableConcept(); // cc
811          return this.entityRelatedness;
812        }
813
814        public boolean hasEntityRelatedness() { 
815          return this.entityRelatedness != null && !this.entityRelatedness.isEmpty();
816        }
817
818        /**
819         * @param value {@link #entityRelatedness} (The result of the assessment regarding the relatedness of the suspected entity to the event.)
820         */
821        public AdverseEventSuspectEntityCausalityComponent setEntityRelatedness(CodeableConcept value) { 
822          this.entityRelatedness = value;
823          return this;
824        }
825
826        /**
827         * @return {@link #author} (The author of the information on the possible cause of the event.)
828         */
829        public Reference getAuthor() { 
830          if (this.author == null)
831            if (Configuration.errorOnAutoCreate())
832              throw new Error("Attempt to auto-create AdverseEventSuspectEntityCausalityComponent.author");
833            else if (Configuration.doAutoCreate())
834              this.author = new Reference(); // cc
835          return this.author;
836        }
837
838        public boolean hasAuthor() { 
839          return this.author != null && !this.author.isEmpty();
840        }
841
842        /**
843         * @param value {@link #author} (The author of the information on the possible cause of the event.)
844         */
845        public AdverseEventSuspectEntityCausalityComponent setAuthor(Reference value) { 
846          this.author = value;
847          return this;
848        }
849
850        protected void listChildren(List<Property> children) {
851          super.listChildren(children);
852          children.add(new Property("assessmentMethod", "CodeableConcept", "The method of evaluating the relatedness of the suspected entity to the event.", 0, 1, assessmentMethod));
853          children.add(new Property("entityRelatedness", "CodeableConcept", "The result of the assessment regarding the relatedness of the suspected entity to the event.", 0, 1, entityRelatedness));
854          children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "The author of the information on the possible cause of the event.", 0, 1, author));
855        }
856
857        @Override
858        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
859          switch (_hash) {
860          case 1681283651: /*assessmentMethod*/  return new Property("assessmentMethod", "CodeableConcept", "The method of evaluating the relatedness of the suspected entity to the event.", 0, 1, assessmentMethod);
861          case 2000199967: /*entityRelatedness*/  return new Property("entityRelatedness", "CodeableConcept", "The result of the assessment regarding the relatedness of the suspected entity to the event.", 0, 1, entityRelatedness);
862          case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "The author of the information on the possible cause of the event.", 0, 1, author);
863          default: return super.getNamedProperty(_hash, _name, _checkValid);
864          }
865
866        }
867
868      @Override
869      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
870        switch (hash) {
871        case 1681283651: /*assessmentMethod*/ return this.assessmentMethod == null ? new Base[0] : new Base[] {this.assessmentMethod}; // CodeableConcept
872        case 2000199967: /*entityRelatedness*/ return this.entityRelatedness == null ? new Base[0] : new Base[] {this.entityRelatedness}; // CodeableConcept
873        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
874        default: return super.getProperty(hash, name, checkValid);
875        }
876
877      }
878
879      @Override
880      public Base setProperty(int hash, String name, Base value) throws FHIRException {
881        switch (hash) {
882        case 1681283651: // assessmentMethod
883          this.assessmentMethod = castToCodeableConcept(value); // CodeableConcept
884          return value;
885        case 2000199967: // entityRelatedness
886          this.entityRelatedness = castToCodeableConcept(value); // CodeableConcept
887          return value;
888        case -1406328437: // author
889          this.author = castToReference(value); // Reference
890          return value;
891        default: return super.setProperty(hash, name, value);
892        }
893
894      }
895
896      @Override
897      public Base setProperty(String name, Base value) throws FHIRException {
898        if (name.equals("assessmentMethod")) {
899          this.assessmentMethod = castToCodeableConcept(value); // CodeableConcept
900        } else if (name.equals("entityRelatedness")) {
901          this.entityRelatedness = castToCodeableConcept(value); // CodeableConcept
902        } else if (name.equals("author")) {
903          this.author = castToReference(value); // Reference
904        } else
905          return super.setProperty(name, value);
906        return value;
907      }
908
909      @Override
910      public Base makeProperty(int hash, String name) throws FHIRException {
911        switch (hash) {
912        case 1681283651:  return getAssessmentMethod();
913        case 2000199967:  return getEntityRelatedness();
914        case -1406328437:  return getAuthor();
915        default: return super.makeProperty(hash, name);
916        }
917
918      }
919
920      @Override
921      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
922        switch (hash) {
923        case 1681283651: /*assessmentMethod*/ return new String[] {"CodeableConcept"};
924        case 2000199967: /*entityRelatedness*/ return new String[] {"CodeableConcept"};
925        case -1406328437: /*author*/ return new String[] {"Reference"};
926        default: return super.getTypesForProperty(hash, name);
927        }
928
929      }
930
931      @Override
932      public Base addChild(String name) throws FHIRException {
933        if (name.equals("assessmentMethod")) {
934          this.assessmentMethod = new CodeableConcept();
935          return this.assessmentMethod;
936        }
937        else if (name.equals("entityRelatedness")) {
938          this.entityRelatedness = new CodeableConcept();
939          return this.entityRelatedness;
940        }
941        else if (name.equals("author")) {
942          this.author = new Reference();
943          return this.author;
944        }
945        else
946          return super.addChild(name);
947      }
948
949      public AdverseEventSuspectEntityCausalityComponent copy() {
950        AdverseEventSuspectEntityCausalityComponent dst = new AdverseEventSuspectEntityCausalityComponent();
951        copyValues(dst);
952        return dst;
953      }
954
955      public void copyValues(AdverseEventSuspectEntityCausalityComponent dst) {
956        super.copyValues(dst);
957        dst.assessmentMethod = assessmentMethod == null ? null : assessmentMethod.copy();
958        dst.entityRelatedness = entityRelatedness == null ? null : entityRelatedness.copy();
959        dst.author = author == null ? null : author.copy();
960      }
961
962      @Override
963      public boolean equalsDeep(Base other_) {
964        if (!super.equalsDeep(other_))
965          return false;
966        if (!(other_ instanceof AdverseEventSuspectEntityCausalityComponent))
967          return false;
968        AdverseEventSuspectEntityCausalityComponent o = (AdverseEventSuspectEntityCausalityComponent) other_;
969        return compareDeep(assessmentMethod, o.assessmentMethod, true) && compareDeep(entityRelatedness, o.entityRelatedness, true)
970           && compareDeep(author, o.author, true);
971      }
972
973      @Override
974      public boolean equalsShallow(Base other_) {
975        if (!super.equalsShallow(other_))
976          return false;
977        if (!(other_ instanceof AdverseEventSuspectEntityCausalityComponent))
978          return false;
979        AdverseEventSuspectEntityCausalityComponent o = (AdverseEventSuspectEntityCausalityComponent) other_;
980        return true;
981      }
982
983      public boolean isEmpty() {
984        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(assessmentMethod, entityRelatedness
985          , author);
986      }
987
988  public String fhirType() {
989    return "AdverseEvent.suspectEntity.causality";
990
991  }
992
993  }
994
995    @Block()
996    public static class AdverseEventSupportingInfoComponent extends BackboneElement implements IBaseBackboneElement {
997        /**
998         * Relevant past history for the subject.  In a clinical care context, an example being a patient had an adverse event following a penciliin administration and the patient had a previously documented penicillin allergy.  In a clinical trials context, an example is a bunion or rash that was present prior to the study.
999Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history.  For example, a clinical note, staff list, or material safety data sheet (MSDS).
1000         */
1001        @Child(name = "item", type = {Condition.class, Observation.class, AllergyIntolerance.class, FamilyMemberHistory.class, Immunization.class, Procedure.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=true)
1002        @Description(shortDefinition="Subject medical history or document relevant to this adverse event", formalDefinition="Relevant past history for the subject.  In a clinical care context, an example being a patient had an adverse event following a penciliin administration and the patient had a previously documented penicillin allergy.  In a clinical trials context, an example is a bunion or rash that was present prior to the study.\nAdditionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history.  For example, a clinical note, staff list, or material safety data sheet (MSDS)." )
1003        protected Reference item;
1004
1005        /**
1006         * If true, the item has been assessed to be a contributing factor of the adverse event.
1007         */
1008        @Child(name = "contributingFactor", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1009        @Description(shortDefinition="If true, the item has been assessed to be a contributing factor of the adverse event", formalDefinition="If true, the item has been assessed to be a contributing factor of the adverse event." )
1010        protected BooleanType contributingFactor;
1011
1012        private static final long serialVersionUID = 686642289L;
1013
1014    /**
1015     * Constructor
1016     */
1017      public AdverseEventSupportingInfoComponent() {
1018        super();
1019      }
1020
1021    /**
1022     * Constructor
1023     */
1024      public AdverseEventSupportingInfoComponent(Reference item) {
1025        super();
1026        this.item = item;
1027      }
1028
1029        /**
1030         * @return {@link #item} (Relevant past history for the subject.  In a clinical care context, an example being a patient had an adverse event following a penciliin administration and the patient had a previously documented penicillin allergy.  In a clinical trials context, an example is a bunion or rash that was present prior to the study.
1031Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history.  For example, a clinical note, staff list, or material safety data sheet (MSDS).)
1032         */
1033        public Reference getItem() { 
1034          if (this.item == null)
1035            if (Configuration.errorOnAutoCreate())
1036              throw new Error("Attempt to auto-create AdverseEventSupportingInfoComponent.item");
1037            else if (Configuration.doAutoCreate())
1038              this.item = new Reference(); // cc
1039          return this.item;
1040        }
1041
1042        public boolean hasItem() { 
1043          return this.item != null && !this.item.isEmpty();
1044        }
1045
1046        /**
1047         * @param value {@link #item} (Relevant past history for the subject.  In a clinical care context, an example being a patient had an adverse event following a penciliin administration and the patient had a previously documented penicillin allergy.  In a clinical trials context, an example is a bunion or rash that was present prior to the study.
1048Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history.  For example, a clinical note, staff list, or material safety data sheet (MSDS).)
1049         */
1050        public AdverseEventSupportingInfoComponent setItem(Reference value) { 
1051          this.item = value;
1052          return this;
1053        }
1054
1055        /**
1056         * @return {@link #contributingFactor} (If true, the item has been assessed to be a contributing factor of the adverse event.). This is the underlying object with id, value and extensions. The accessor "getContributingFactor" gives direct access to the value
1057         */
1058        public BooleanType getContributingFactorElement() { 
1059          if (this.contributingFactor == null)
1060            if (Configuration.errorOnAutoCreate())
1061              throw new Error("Attempt to auto-create AdverseEventSupportingInfoComponent.contributingFactor");
1062            else if (Configuration.doAutoCreate())
1063              this.contributingFactor = new BooleanType(); // bb
1064          return this.contributingFactor;
1065        }
1066
1067        public boolean hasContributingFactorElement() { 
1068          return this.contributingFactor != null && !this.contributingFactor.isEmpty();
1069        }
1070
1071        public boolean hasContributingFactor() { 
1072          return this.contributingFactor != null && !this.contributingFactor.isEmpty();
1073        }
1074
1075        /**
1076         * @param value {@link #contributingFactor} (If true, the item has been assessed to be a contributing factor of the adverse event.). This is the underlying object with id, value and extensions. The accessor "getContributingFactor" gives direct access to the value
1077         */
1078        public AdverseEventSupportingInfoComponent setContributingFactorElement(BooleanType value) { 
1079          this.contributingFactor = value;
1080          return this;
1081        }
1082
1083        /**
1084         * @return If true, the item has been assessed to be a contributing factor of the adverse event.
1085         */
1086        public boolean getContributingFactor() { 
1087          return this.contributingFactor == null || this.contributingFactor.isEmpty() ? false : this.contributingFactor.getValue();
1088        }
1089
1090        /**
1091         * @param value If true, the item has been assessed to be a contributing factor of the adverse event.
1092         */
1093        public AdverseEventSupportingInfoComponent setContributingFactor(boolean value) { 
1094            if (this.contributingFactor == null)
1095              this.contributingFactor = new BooleanType();
1096            this.contributingFactor.setValue(value);
1097          return this;
1098        }
1099
1100        protected void listChildren(List<Property> children) {
1101          super.listChildren(children);
1102          children.add(new Property("item", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)", "Relevant past history for the subject.  In a clinical care context, an example being a patient had an adverse event following a penciliin administration and the patient had a previously documented penicillin allergy.  In a clinical trials context, an example is a bunion or rash that was present prior to the study.\nAdditionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history.  For example, a clinical note, staff list, or material safety data sheet (MSDS).", 0, 1, item));
1103          children.add(new Property("contributingFactor", "boolean", "If true, the item has been assessed to be a contributing factor of the adverse event.", 0, 1, contributingFactor));
1104        }
1105
1106        @Override
1107        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1108          switch (_hash) {
1109          case 3242771: /*item*/  return new Property("item", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)", "Relevant past history for the subject.  In a clinical care context, an example being a patient had an adverse event following a penciliin administration and the patient had a previously documented penicillin allergy.  In a clinical trials context, an example is a bunion or rash that was present prior to the study.\nAdditionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history.  For example, a clinical note, staff list, or material safety data sheet (MSDS).", 0, 1, item);
1110          case -219647527: /*contributingFactor*/  return new Property("contributingFactor", "boolean", "If true, the item has been assessed to be a contributing factor of the adverse event.", 0, 1, contributingFactor);
1111          default: return super.getNamedProperty(_hash, _name, _checkValid);
1112          }
1113
1114        }
1115
1116      @Override
1117      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1118        switch (hash) {
1119        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Reference
1120        case -219647527: /*contributingFactor*/ return this.contributingFactor == null ? new Base[0] : new Base[] {this.contributingFactor}; // BooleanType
1121        default: return super.getProperty(hash, name, checkValid);
1122        }
1123
1124      }
1125
1126      @Override
1127      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1128        switch (hash) {
1129        case 3242771: // item
1130          this.item = castToReference(value); // Reference
1131          return value;
1132        case -219647527: // contributingFactor
1133          this.contributingFactor = castToBoolean(value); // BooleanType
1134          return value;
1135        default: return super.setProperty(hash, name, value);
1136        }
1137
1138      }
1139
1140      @Override
1141      public Base setProperty(String name, Base value) throws FHIRException {
1142        if (name.equals("item")) {
1143          this.item = castToReference(value); // Reference
1144        } else if (name.equals("contributingFactor")) {
1145          this.contributingFactor = castToBoolean(value); // BooleanType
1146        } else
1147          return super.setProperty(name, value);
1148        return value;
1149      }
1150
1151      @Override
1152      public Base makeProperty(int hash, String name) throws FHIRException {
1153        switch (hash) {
1154        case 3242771:  return getItem();
1155        case -219647527:  return getContributingFactorElement();
1156        default: return super.makeProperty(hash, name);
1157        }
1158
1159      }
1160
1161      @Override
1162      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1163        switch (hash) {
1164        case 3242771: /*item*/ return new String[] {"Reference"};
1165        case -219647527: /*contributingFactor*/ return new String[] {"boolean"};
1166        default: return super.getTypesForProperty(hash, name);
1167        }
1168
1169      }
1170
1171      @Override
1172      public Base addChild(String name) throws FHIRException {
1173        if (name.equals("item")) {
1174          this.item = new Reference();
1175          return this.item;
1176        }
1177        else if (name.equals("contributingFactor")) {
1178          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.contributingFactor");
1179        }
1180        else
1181          return super.addChild(name);
1182      }
1183
1184      public AdverseEventSupportingInfoComponent copy() {
1185        AdverseEventSupportingInfoComponent dst = new AdverseEventSupportingInfoComponent();
1186        copyValues(dst);
1187        return dst;
1188      }
1189
1190      public void copyValues(AdverseEventSupportingInfoComponent dst) {
1191        super.copyValues(dst);
1192        dst.item = item == null ? null : item.copy();
1193        dst.contributingFactor = contributingFactor == null ? null : contributingFactor.copy();
1194      }
1195
1196      @Override
1197      public boolean equalsDeep(Base other_) {
1198        if (!super.equalsDeep(other_))
1199          return false;
1200        if (!(other_ instanceof AdverseEventSupportingInfoComponent))
1201          return false;
1202        AdverseEventSupportingInfoComponent o = (AdverseEventSupportingInfoComponent) other_;
1203        return compareDeep(item, o.item, true) && compareDeep(contributingFactor, o.contributingFactor, true)
1204          ;
1205      }
1206
1207      @Override
1208      public boolean equalsShallow(Base other_) {
1209        if (!super.equalsShallow(other_))
1210          return false;
1211        if (!(other_ instanceof AdverseEventSupportingInfoComponent))
1212          return false;
1213        AdverseEventSupportingInfoComponent o = (AdverseEventSupportingInfoComponent) other_;
1214        return compareValues(contributingFactor, o.contributingFactor, true);
1215      }
1216
1217      public boolean isEmpty() {
1218        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, contributingFactor);
1219      }
1220
1221  public String fhirType() {
1222    return "AdverseEvent.supportingInfo";
1223
1224  }
1225
1226  }
1227
1228    /**
1229     * Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.
1230     */
1231    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1232    @Description(shortDefinition="Business identifier for the event", formalDefinition="Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server." )
1233    protected List<Identifier> identifier;
1234
1235    /**
1236     * The current state of the data entry of the adverse event or potential adverse event.
1237     */
1238    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1239    @Description(shortDefinition="in-progress | completed | entered-in-error | unknown", formalDefinition="The current state of the data entry of the adverse event or potential adverse event." )
1240    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-status")
1241    protected Enumeration<AdverseEventStatus> status;
1242
1243    /**
1244     * Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.
1245     */
1246    @Child(name = "actuality", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1247    @Description(shortDefinition="actual | potential", formalDefinition="Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely." )
1248    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-actuality")
1249    protected Enumeration<AdverseEventActuality> actuality;
1250
1251    /**
1252     * The overall type of event, intended for search and filtering purposes.
1253     */
1254    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1255    @Description(shortDefinition="product-problem | product-quality | product-use-error | wrong-dose | incorrect-prescribing-information | wrong-technique | wrong-route-of-administration | wrong-rate | wrong-duration | wrong-time | expired-drug | medical-device-use-error | problem-different-manufacturer | unsafe-physical-environment", formalDefinition="The overall type of event, intended for search and filtering purposes." )
1256    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-category")
1257    protected List<CodeableConcept> category;
1258
1259    /**
1260     * Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.
1261     */
1262    @Child(name = "code", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1263    @Description(shortDefinition="Event or incident that occurred or was averted", formalDefinition="Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused." )
1264    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-type")
1265    protected CodeableConcept code;
1266
1267    /**
1268     * This subject or group impacted by the event.
1269     */
1270    @Child(name = "subject", type = {Patient.class, Group.class, Practitioner.class, RelatedPerson.class}, order=5, min=1, max=1, modifier=false, summary=true)
1271    @Description(shortDefinition="Subject impacted by event", formalDefinition="This subject or group impacted by the event." )
1272    protected Reference subject;
1273
1274    /**
1275     * The Encounter during which AdverseEvent was created or to which the creation of this record is tightly associated.
1276     */
1277    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true)
1278    @Description(shortDefinition="The Encounter during which this AdverseEvent was created", formalDefinition="The Encounter during which AdverseEvent was created or to which the creation of this record is tightly associated." )
1279    protected Reference encounter;
1280
1281    /**
1282     * The date (and perhaps time) when the adverse event occurred.
1283     */
1284    @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=7, min=0, max=1, modifier=false, summary=true)
1285    @Description(shortDefinition="When the event occurred", formalDefinition="The date (and perhaps time) when the adverse event occurred." )
1286    protected Type occurrence;
1287
1288    /**
1289     * Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
1290     */
1291    @Child(name = "detected", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1292    @Description(shortDefinition="When the event was detected", formalDefinition="Estimated or actual date the AdverseEvent began, in the opinion of the reporter." )
1293    protected DateTimeType detected;
1294
1295    /**
1296     * The date on which the existence of the AdverseEvent was first recorded.
1297     */
1298    @Child(name = "recordedDate", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1299    @Description(shortDefinition="When the event was recorded", formalDefinition="The date on which the existence of the AdverseEvent was first recorded." )
1300    protected DateTimeType recordedDate;
1301
1302    /**
1303     * Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).
1304     */
1305    @Child(name = "resultingCondition", type = {Condition.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1306    @Description(shortDefinition="Effect on the subject due to this event", formalDefinition="Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical)." )
1307    protected List<Reference> resultingCondition;
1308
1309    /**
1310     * The information about where the adverse event occurred.
1311     */
1312    @Child(name = "location", type = {Location.class}, order=11, min=0, max=1, modifier=false, summary=true)
1313    @Description(shortDefinition="Location where adverse event occurred", formalDefinition="The information about where the adverse event occurred." )
1314    protected Reference location;
1315
1316    /**
1317     * Assessment whether this event, or averted event, was of clinical importance.
1318     */
1319    @Child(name = "seriousness", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=true)
1320    @Description(shortDefinition="Seriousness or gravity of the event", formalDefinition="Assessment whether this event, or averted event, was of clinical importance." )
1321    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-seriousness")
1322    protected CodeableConcept seriousness;
1323
1324    /**
1325     * Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.
1326     */
1327    @Child(name = "outcome", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=true)
1328    @Description(shortDefinition="Type of outcome from the adverse event", formalDefinition="Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal." )
1329    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-outcome")
1330    protected CodeableConcept outcome;
1331
1332    /**
1333     * Information on who recorded the adverse event.  May be the patient or a practitioner.
1334     */
1335    @Child(name = "recorder", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=14, min=0, max=1, modifier=false, summary=true)
1336    @Description(shortDefinition="Who recorded the adverse event", formalDefinition="Information on who recorded the adverse event.  May be the patient or a practitioner." )
1337    protected Reference recorder;
1338
1339    /**
1340     * Indicates who or what participated in the adverse event and how they were involved.
1341     */
1342    @Child(name = "participant", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1343    @Description(shortDefinition="Who was involved in the adverse event or the potential adverse event and what they did", formalDefinition="Indicates who or what participated in the adverse event and how they were involved." )
1344    protected List<AdverseEventParticipantComponent> participant;
1345
1346    /**
1347     * Describes the entity that is suspected to have caused the adverse event.
1348     */
1349    @Child(name = "suspectEntity", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1350    @Description(shortDefinition="The suspected agent causing the adverse event", formalDefinition="Describes the entity that is suspected to have caused the adverse event." )
1351    protected List<AdverseEventSuspectEntityComponent> suspectEntity;
1352
1353    /**
1354     * Supporting information relevant to the event.
1355     */
1356    @Child(name = "supportingInfo", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1357    @Description(shortDefinition="Supporting information relevant to the event", formalDefinition="Supporting information relevant to the event." )
1358    protected List<AdverseEventSupportingInfoComponent> supportingInfo;
1359
1360    /**
1361     * The research study that the subject is enrolled in.
1362     */
1363    @Child(name = "study", type = {ResearchStudy.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1364    @Description(shortDefinition="Research study that the subject is enrolled in", formalDefinition="The research study that the subject is enrolled in." )
1365    protected List<Reference> study;
1366
1367    private static final long serialVersionUID = -1729938081L;
1368
1369  /**
1370   * Constructor
1371   */
1372    public AdverseEvent() {
1373      super();
1374    }
1375
1376  /**
1377   * Constructor
1378   */
1379    public AdverseEvent(Enumeration<AdverseEventStatus> status, Enumeration<AdverseEventActuality> actuality, Reference subject) {
1380      super();
1381      this.status = status;
1382      this.actuality = actuality;
1383      this.subject = subject;
1384    }
1385
1386    /**
1387     * @return {@link #identifier} (Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.)
1388     */
1389    public List<Identifier> getIdentifier() { 
1390      if (this.identifier == null)
1391        this.identifier = new ArrayList<Identifier>();
1392      return this.identifier;
1393    }
1394
1395    /**
1396     * @return Returns a reference to <code>this</code> for easy method chaining
1397     */
1398    public AdverseEvent setIdentifier(List<Identifier> theIdentifier) { 
1399      this.identifier = theIdentifier;
1400      return this;
1401    }
1402
1403    public boolean hasIdentifier() { 
1404      if (this.identifier == null)
1405        return false;
1406      for (Identifier item : this.identifier)
1407        if (!item.isEmpty())
1408          return true;
1409      return false;
1410    }
1411
1412    public Identifier addIdentifier() { //3
1413      Identifier t = new Identifier();
1414      if (this.identifier == null)
1415        this.identifier = new ArrayList<Identifier>();
1416      this.identifier.add(t);
1417      return t;
1418    }
1419
1420    public AdverseEvent addIdentifier(Identifier t) { //3
1421      if (t == null)
1422        return this;
1423      if (this.identifier == null)
1424        this.identifier = new ArrayList<Identifier>();
1425      this.identifier.add(t);
1426      return this;
1427    }
1428
1429    /**
1430     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1431     */
1432    public Identifier getIdentifierFirstRep() { 
1433      if (getIdentifier().isEmpty()) {
1434        addIdentifier();
1435      }
1436      return getIdentifier().get(0);
1437    }
1438
1439    /**
1440     * @return {@link #status} (The current state of the data entry of the adverse event or potential adverse event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1441     */
1442    public Enumeration<AdverseEventStatus> getStatusElement() { 
1443      if (this.status == null)
1444        if (Configuration.errorOnAutoCreate())
1445          throw new Error("Attempt to auto-create AdverseEvent.status");
1446        else if (Configuration.doAutoCreate())
1447          this.status = new Enumeration<AdverseEventStatus>(new AdverseEventStatusEnumFactory()); // bb
1448      return this.status;
1449    }
1450
1451    public boolean hasStatusElement() { 
1452      return this.status != null && !this.status.isEmpty();
1453    }
1454
1455    public boolean hasStatus() { 
1456      return this.status != null && !this.status.isEmpty();
1457    }
1458
1459    /**
1460     * @param value {@link #status} (The current state of the data entry of the adverse event or potential adverse event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1461     */
1462    public AdverseEvent setStatusElement(Enumeration<AdverseEventStatus> value) { 
1463      this.status = value;
1464      return this;
1465    }
1466
1467    /**
1468     * @return The current state of the data entry of the adverse event or potential adverse event.
1469     */
1470    public AdverseEventStatus getStatus() { 
1471      return this.status == null ? null : this.status.getValue();
1472    }
1473
1474    /**
1475     * @param value The current state of the data entry of the adverse event or potential adverse event.
1476     */
1477    public AdverseEvent setStatus(AdverseEventStatus value) { 
1478        if (this.status == null)
1479          this.status = new Enumeration<AdverseEventStatus>(new AdverseEventStatusEnumFactory());
1480        this.status.setValue(value);
1481      return this;
1482    }
1483
1484    /**
1485     * @return {@link #actuality} (Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.). This is the underlying object with id, value and extensions. The accessor "getActuality" gives direct access to the value
1486     */
1487    public Enumeration<AdverseEventActuality> getActualityElement() { 
1488      if (this.actuality == null)
1489        if (Configuration.errorOnAutoCreate())
1490          throw new Error("Attempt to auto-create AdverseEvent.actuality");
1491        else if (Configuration.doAutoCreate())
1492          this.actuality = new Enumeration<AdverseEventActuality>(new AdverseEventActualityEnumFactory()); // bb
1493      return this.actuality;
1494    }
1495
1496    public boolean hasActualityElement() { 
1497      return this.actuality != null && !this.actuality.isEmpty();
1498    }
1499
1500    public boolean hasActuality() { 
1501      return this.actuality != null && !this.actuality.isEmpty();
1502    }
1503
1504    /**
1505     * @param value {@link #actuality} (Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.). This is the underlying object with id, value and extensions. The accessor "getActuality" gives direct access to the value
1506     */
1507    public AdverseEvent setActualityElement(Enumeration<AdverseEventActuality> value) { 
1508      this.actuality = value;
1509      return this;
1510    }
1511
1512    /**
1513     * @return Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.
1514     */
1515    public AdverseEventActuality getActuality() { 
1516      return this.actuality == null ? null : this.actuality.getValue();
1517    }
1518
1519    /**
1520     * @param value Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.
1521     */
1522    public AdverseEvent setActuality(AdverseEventActuality value) { 
1523        if (this.actuality == null)
1524          this.actuality = new Enumeration<AdverseEventActuality>(new AdverseEventActualityEnumFactory());
1525        this.actuality.setValue(value);
1526      return this;
1527    }
1528
1529    /**
1530     * @return {@link #category} (The overall type of event, intended for search and filtering purposes.)
1531     */
1532    public List<CodeableConcept> getCategory() { 
1533      if (this.category == null)
1534        this.category = new ArrayList<CodeableConcept>();
1535      return this.category;
1536    }
1537
1538    /**
1539     * @return Returns a reference to <code>this</code> for easy method chaining
1540     */
1541    public AdverseEvent setCategory(List<CodeableConcept> theCategory) { 
1542      this.category = theCategory;
1543      return this;
1544    }
1545
1546    public boolean hasCategory() { 
1547      if (this.category == null)
1548        return false;
1549      for (CodeableConcept item : this.category)
1550        if (!item.isEmpty())
1551          return true;
1552      return false;
1553    }
1554
1555    public CodeableConcept addCategory() { //3
1556      CodeableConcept t = new CodeableConcept();
1557      if (this.category == null)
1558        this.category = new ArrayList<CodeableConcept>();
1559      this.category.add(t);
1560      return t;
1561    }
1562
1563    public AdverseEvent addCategory(CodeableConcept t) { //3
1564      if (t == null)
1565        return this;
1566      if (this.category == null)
1567        this.category = new ArrayList<CodeableConcept>();
1568      this.category.add(t);
1569      return this;
1570    }
1571
1572    /**
1573     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
1574     */
1575    public CodeableConcept getCategoryFirstRep() { 
1576      if (getCategory().isEmpty()) {
1577        addCategory();
1578      }
1579      return getCategory().get(0);
1580    }
1581
1582    /**
1583     * @return {@link #code} (Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.)
1584     */
1585    public CodeableConcept getCode() { 
1586      if (this.code == null)
1587        if (Configuration.errorOnAutoCreate())
1588          throw new Error("Attempt to auto-create AdverseEvent.code");
1589        else if (Configuration.doAutoCreate())
1590          this.code = new CodeableConcept(); // cc
1591      return this.code;
1592    }
1593
1594    public boolean hasCode() { 
1595      return this.code != null && !this.code.isEmpty();
1596    }
1597
1598    /**
1599     * @param value {@link #code} (Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.)
1600     */
1601    public AdverseEvent setCode(CodeableConcept value) { 
1602      this.code = value;
1603      return this;
1604    }
1605
1606    /**
1607     * @return {@link #subject} (This subject or group impacted by the event.)
1608     */
1609    public Reference getSubject() { 
1610      if (this.subject == null)
1611        if (Configuration.errorOnAutoCreate())
1612          throw new Error("Attempt to auto-create AdverseEvent.subject");
1613        else if (Configuration.doAutoCreate())
1614          this.subject = new Reference(); // cc
1615      return this.subject;
1616    }
1617
1618    public boolean hasSubject() { 
1619      return this.subject != null && !this.subject.isEmpty();
1620    }
1621
1622    /**
1623     * @param value {@link #subject} (This subject or group impacted by the event.)
1624     */
1625    public AdverseEvent setSubject(Reference value) { 
1626      this.subject = value;
1627      return this;
1628    }
1629
1630    /**
1631     * @return {@link #encounter} (The Encounter during which AdverseEvent was created or to which the creation of this record is tightly associated.)
1632     */
1633    public Reference getEncounter() { 
1634      if (this.encounter == null)
1635        if (Configuration.errorOnAutoCreate())
1636          throw new Error("Attempt to auto-create AdverseEvent.encounter");
1637        else if (Configuration.doAutoCreate())
1638          this.encounter = new Reference(); // cc
1639      return this.encounter;
1640    }
1641
1642    public boolean hasEncounter() { 
1643      return this.encounter != null && !this.encounter.isEmpty();
1644    }
1645
1646    /**
1647     * @param value {@link #encounter} (The Encounter during which AdverseEvent was created or to which the creation of this record is tightly associated.)
1648     */
1649    public AdverseEvent setEncounter(Reference value) { 
1650      this.encounter = value;
1651      return this;
1652    }
1653
1654    /**
1655     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
1656     */
1657    public Type getOccurrence() { 
1658      return this.occurrence;
1659    }
1660
1661    /**
1662     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
1663     */
1664    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1665      if (this.occurrence == null)
1666        this.occurrence = new DateTimeType();
1667      if (!(this.occurrence instanceof DateTimeType))
1668        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1669      return (DateTimeType) this.occurrence;
1670    }
1671
1672    public boolean hasOccurrenceDateTimeType() { 
1673      return this != null && this.occurrence instanceof DateTimeType;
1674    }
1675
1676    /**
1677     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
1678     */
1679    public Period getOccurrencePeriod() throws FHIRException { 
1680      if (this.occurrence == null)
1681        this.occurrence = new Period();
1682      if (!(this.occurrence instanceof Period))
1683        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1684      return (Period) this.occurrence;
1685    }
1686
1687    public boolean hasOccurrencePeriod() { 
1688      return this != null && this.occurrence instanceof Period;
1689    }
1690
1691    /**
1692     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
1693     */
1694    public Timing getOccurrenceTiming() throws FHIRException { 
1695      if (this.occurrence == null)
1696        this.occurrence = new Timing();
1697      if (!(this.occurrence instanceof Timing))
1698        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1699      return (Timing) this.occurrence;
1700    }
1701
1702    public boolean hasOccurrenceTiming() { 
1703      return this != null && this.occurrence instanceof Timing;
1704    }
1705
1706    public boolean hasOccurrence() { 
1707      return this.occurrence != null && !this.occurrence.isEmpty();
1708    }
1709
1710    /**
1711     * @param value {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
1712     */
1713    public AdverseEvent setOccurrence(Type value) { 
1714      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
1715        throw new Error("Not the right type for AdverseEvent.occurrence[x]: "+value.fhirType());
1716      this.occurrence = value;
1717      return this;
1718    }
1719
1720    /**
1721     * @return {@link #detected} (Estimated or actual date the AdverseEvent began, in the opinion of the reporter.). This is the underlying object with id, value and extensions. The accessor "getDetected" gives direct access to the value
1722     */
1723    public DateTimeType getDetectedElement() { 
1724      if (this.detected == null)
1725        if (Configuration.errorOnAutoCreate())
1726          throw new Error("Attempt to auto-create AdverseEvent.detected");
1727        else if (Configuration.doAutoCreate())
1728          this.detected = new DateTimeType(); // bb
1729      return this.detected;
1730    }
1731
1732    public boolean hasDetectedElement() { 
1733      return this.detected != null && !this.detected.isEmpty();
1734    }
1735
1736    public boolean hasDetected() { 
1737      return this.detected != null && !this.detected.isEmpty();
1738    }
1739
1740    /**
1741     * @param value {@link #detected} (Estimated or actual date the AdverseEvent began, in the opinion of the reporter.). This is the underlying object with id, value and extensions. The accessor "getDetected" gives direct access to the value
1742     */
1743    public AdverseEvent setDetectedElement(DateTimeType value) { 
1744      this.detected = value;
1745      return this;
1746    }
1747
1748    /**
1749     * @return Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
1750     */
1751    public Date getDetected() { 
1752      return this.detected == null ? null : this.detected.getValue();
1753    }
1754
1755    /**
1756     * @param value Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
1757     */
1758    public AdverseEvent setDetected(Date value) { 
1759      if (value == null)
1760        this.detected = null;
1761      else {
1762        if (this.detected == null)
1763          this.detected = new DateTimeType();
1764        this.detected.setValue(value);
1765      }
1766      return this;
1767    }
1768
1769    /**
1770     * @return {@link #recordedDate} (The date on which the existence of the AdverseEvent was first recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
1771     */
1772    public DateTimeType getRecordedDateElement() { 
1773      if (this.recordedDate == null)
1774        if (Configuration.errorOnAutoCreate())
1775          throw new Error("Attempt to auto-create AdverseEvent.recordedDate");
1776        else if (Configuration.doAutoCreate())
1777          this.recordedDate = new DateTimeType(); // bb
1778      return this.recordedDate;
1779    }
1780
1781    public boolean hasRecordedDateElement() { 
1782      return this.recordedDate != null && !this.recordedDate.isEmpty();
1783    }
1784
1785    public boolean hasRecordedDate() { 
1786      return this.recordedDate != null && !this.recordedDate.isEmpty();
1787    }
1788
1789    /**
1790     * @param value {@link #recordedDate} (The date on which the existence of the AdverseEvent was first recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
1791     */
1792    public AdverseEvent setRecordedDateElement(DateTimeType value) { 
1793      this.recordedDate = value;
1794      return this;
1795    }
1796
1797    /**
1798     * @return The date on which the existence of the AdverseEvent was first recorded.
1799     */
1800    public Date getRecordedDate() { 
1801      return this.recordedDate == null ? null : this.recordedDate.getValue();
1802    }
1803
1804    /**
1805     * @param value The date on which the existence of the AdverseEvent was first recorded.
1806     */
1807    public AdverseEvent setRecordedDate(Date value) { 
1808      if (value == null)
1809        this.recordedDate = null;
1810      else {
1811        if (this.recordedDate == null)
1812          this.recordedDate = new DateTimeType();
1813        this.recordedDate.setValue(value);
1814      }
1815      return this;
1816    }
1817
1818    /**
1819     * @return {@link #resultingCondition} (Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).)
1820     */
1821    public List<Reference> getResultingCondition() { 
1822      if (this.resultingCondition == null)
1823        this.resultingCondition = new ArrayList<Reference>();
1824      return this.resultingCondition;
1825    }
1826
1827    /**
1828     * @return Returns a reference to <code>this</code> for easy method chaining
1829     */
1830    public AdverseEvent setResultingCondition(List<Reference> theResultingCondition) { 
1831      this.resultingCondition = theResultingCondition;
1832      return this;
1833    }
1834
1835    public boolean hasResultingCondition() { 
1836      if (this.resultingCondition == null)
1837        return false;
1838      for (Reference item : this.resultingCondition)
1839        if (!item.isEmpty())
1840          return true;
1841      return false;
1842    }
1843
1844    public Reference addResultingCondition() { //3
1845      Reference t = new Reference();
1846      if (this.resultingCondition == null)
1847        this.resultingCondition = new ArrayList<Reference>();
1848      this.resultingCondition.add(t);
1849      return t;
1850    }
1851
1852    public AdverseEvent addResultingCondition(Reference t) { //3
1853      if (t == null)
1854        return this;
1855      if (this.resultingCondition == null)
1856        this.resultingCondition = new ArrayList<Reference>();
1857      this.resultingCondition.add(t);
1858      return this;
1859    }
1860
1861    /**
1862     * @return The first repetition of repeating field {@link #resultingCondition}, creating it if it does not already exist
1863     */
1864    public Reference getResultingConditionFirstRep() { 
1865      if (getResultingCondition().isEmpty()) {
1866        addResultingCondition();
1867      }
1868      return getResultingCondition().get(0);
1869    }
1870
1871    /**
1872     * @return {@link #location} (The information about where the adverse event occurred.)
1873     */
1874    public Reference getLocation() { 
1875      if (this.location == null)
1876        if (Configuration.errorOnAutoCreate())
1877          throw new Error("Attempt to auto-create AdverseEvent.location");
1878        else if (Configuration.doAutoCreate())
1879          this.location = new Reference(); // cc
1880      return this.location;
1881    }
1882
1883    public boolean hasLocation() { 
1884      return this.location != null && !this.location.isEmpty();
1885    }
1886
1887    /**
1888     * @param value {@link #location} (The information about where the adverse event occurred.)
1889     */
1890    public AdverseEvent setLocation(Reference value) { 
1891      this.location = value;
1892      return this;
1893    }
1894
1895    /**
1896     * @return {@link #seriousness} (Assessment whether this event, or averted event, was of clinical importance.)
1897     */
1898    public CodeableConcept getSeriousness() { 
1899      if (this.seriousness == null)
1900        if (Configuration.errorOnAutoCreate())
1901          throw new Error("Attempt to auto-create AdverseEvent.seriousness");
1902        else if (Configuration.doAutoCreate())
1903          this.seriousness = new CodeableConcept(); // cc
1904      return this.seriousness;
1905    }
1906
1907    public boolean hasSeriousness() { 
1908      return this.seriousness != null && !this.seriousness.isEmpty();
1909    }
1910
1911    /**
1912     * @param value {@link #seriousness} (Assessment whether this event, or averted event, was of clinical importance.)
1913     */
1914    public AdverseEvent setSeriousness(CodeableConcept value) { 
1915      this.seriousness = value;
1916      return this;
1917    }
1918
1919    /**
1920     * @return {@link #outcome} (Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.)
1921     */
1922    public CodeableConcept getOutcome() { 
1923      if (this.outcome == null)
1924        if (Configuration.errorOnAutoCreate())
1925          throw new Error("Attempt to auto-create AdverseEvent.outcome");
1926        else if (Configuration.doAutoCreate())
1927          this.outcome = new CodeableConcept(); // cc
1928      return this.outcome;
1929    }
1930
1931    public boolean hasOutcome() { 
1932      return this.outcome != null && !this.outcome.isEmpty();
1933    }
1934
1935    /**
1936     * @param value {@link #outcome} (Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.)
1937     */
1938    public AdverseEvent setOutcome(CodeableConcept value) { 
1939      this.outcome = value;
1940      return this;
1941    }
1942
1943    /**
1944     * @return {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
1945     */
1946    public Reference getRecorder() { 
1947      if (this.recorder == null)
1948        if (Configuration.errorOnAutoCreate())
1949          throw new Error("Attempt to auto-create AdverseEvent.recorder");
1950        else if (Configuration.doAutoCreate())
1951          this.recorder = new Reference(); // cc
1952      return this.recorder;
1953    }
1954
1955    public boolean hasRecorder() { 
1956      return this.recorder != null && !this.recorder.isEmpty();
1957    }
1958
1959    /**
1960     * @param value {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
1961     */
1962    public AdverseEvent setRecorder(Reference value) { 
1963      this.recorder = value;
1964      return this;
1965    }
1966
1967    /**
1968     * @return {@link #participant} (Indicates who or what participated in the adverse event and how they were involved.)
1969     */
1970    public List<AdverseEventParticipantComponent> getParticipant() { 
1971      if (this.participant == null)
1972        this.participant = new ArrayList<AdverseEventParticipantComponent>();
1973      return this.participant;
1974    }
1975
1976    /**
1977     * @return Returns a reference to <code>this</code> for easy method chaining
1978     */
1979    public AdverseEvent setParticipant(List<AdverseEventParticipantComponent> theParticipant) { 
1980      this.participant = theParticipant;
1981      return this;
1982    }
1983
1984    public boolean hasParticipant() { 
1985      if (this.participant == null)
1986        return false;
1987      for (AdverseEventParticipantComponent item : this.participant)
1988        if (!item.isEmpty())
1989          return true;
1990      return false;
1991    }
1992
1993    public AdverseEventParticipantComponent addParticipant() { //3
1994      AdverseEventParticipantComponent t = new AdverseEventParticipantComponent();
1995      if (this.participant == null)
1996        this.participant = new ArrayList<AdverseEventParticipantComponent>();
1997      this.participant.add(t);
1998      return t;
1999    }
2000
2001    public AdverseEvent addParticipant(AdverseEventParticipantComponent t) { //3
2002      if (t == null)
2003        return this;
2004      if (this.participant == null)
2005        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2006      this.participant.add(t);
2007      return this;
2008    }
2009
2010    /**
2011     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist
2012     */
2013    public AdverseEventParticipantComponent getParticipantFirstRep() { 
2014      if (getParticipant().isEmpty()) {
2015        addParticipant();
2016      }
2017      return getParticipant().get(0);
2018    }
2019
2020    /**
2021     * @return {@link #suspectEntity} (Describes the entity that is suspected to have caused the adverse event.)
2022     */
2023    public List<AdverseEventSuspectEntityComponent> getSuspectEntity() { 
2024      if (this.suspectEntity == null)
2025        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2026      return this.suspectEntity;
2027    }
2028
2029    /**
2030     * @return Returns a reference to <code>this</code> for easy method chaining
2031     */
2032    public AdverseEvent setSuspectEntity(List<AdverseEventSuspectEntityComponent> theSuspectEntity) { 
2033      this.suspectEntity = theSuspectEntity;
2034      return this;
2035    }
2036
2037    public boolean hasSuspectEntity() { 
2038      if (this.suspectEntity == null)
2039        return false;
2040      for (AdverseEventSuspectEntityComponent item : this.suspectEntity)
2041        if (!item.isEmpty())
2042          return true;
2043      return false;
2044    }
2045
2046    public AdverseEventSuspectEntityComponent addSuspectEntity() { //3
2047      AdverseEventSuspectEntityComponent t = new AdverseEventSuspectEntityComponent();
2048      if (this.suspectEntity == null)
2049        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2050      this.suspectEntity.add(t);
2051      return t;
2052    }
2053
2054    public AdverseEvent addSuspectEntity(AdverseEventSuspectEntityComponent t) { //3
2055      if (t == null)
2056        return this;
2057      if (this.suspectEntity == null)
2058        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2059      this.suspectEntity.add(t);
2060      return this;
2061    }
2062
2063    /**
2064     * @return The first repetition of repeating field {@link #suspectEntity}, creating it if it does not already exist
2065     */
2066    public AdverseEventSuspectEntityComponent getSuspectEntityFirstRep() { 
2067      if (getSuspectEntity().isEmpty()) {
2068        addSuspectEntity();
2069      }
2070      return getSuspectEntity().get(0);
2071    }
2072
2073    /**
2074     * @return {@link #supportingInfo} (Supporting information relevant to the event.)
2075     */
2076    public List<AdverseEventSupportingInfoComponent> getSupportingInfo() { 
2077      if (this.supportingInfo == null)
2078        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2079      return this.supportingInfo;
2080    }
2081
2082    /**
2083     * @return Returns a reference to <code>this</code> for easy method chaining
2084     */
2085    public AdverseEvent setSupportingInfo(List<AdverseEventSupportingInfoComponent> theSupportingInfo) { 
2086      this.supportingInfo = theSupportingInfo;
2087      return this;
2088    }
2089
2090    public boolean hasSupportingInfo() { 
2091      if (this.supportingInfo == null)
2092        return false;
2093      for (AdverseEventSupportingInfoComponent item : this.supportingInfo)
2094        if (!item.isEmpty())
2095          return true;
2096      return false;
2097    }
2098
2099    public AdverseEventSupportingInfoComponent addSupportingInfo() { //3
2100      AdverseEventSupportingInfoComponent t = new AdverseEventSupportingInfoComponent();
2101      if (this.supportingInfo == null)
2102        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2103      this.supportingInfo.add(t);
2104      return t;
2105    }
2106
2107    public AdverseEvent addSupportingInfo(AdverseEventSupportingInfoComponent t) { //3
2108      if (t == null)
2109        return this;
2110      if (this.supportingInfo == null)
2111        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2112      this.supportingInfo.add(t);
2113      return this;
2114    }
2115
2116    /**
2117     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
2118     */
2119    public AdverseEventSupportingInfoComponent getSupportingInfoFirstRep() { 
2120      if (getSupportingInfo().isEmpty()) {
2121        addSupportingInfo();
2122      }
2123      return getSupportingInfo().get(0);
2124    }
2125
2126    /**
2127     * @return {@link #study} (The research study that the subject is enrolled in.)
2128     */
2129    public List<Reference> getStudy() { 
2130      if (this.study == null)
2131        this.study = new ArrayList<Reference>();
2132      return this.study;
2133    }
2134
2135    /**
2136     * @return Returns a reference to <code>this</code> for easy method chaining
2137     */
2138    public AdverseEvent setStudy(List<Reference> theStudy) { 
2139      this.study = theStudy;
2140      return this;
2141    }
2142
2143    public boolean hasStudy() { 
2144      if (this.study == null)
2145        return false;
2146      for (Reference item : this.study)
2147        if (!item.isEmpty())
2148          return true;
2149      return false;
2150    }
2151
2152    public Reference addStudy() { //3
2153      Reference t = new Reference();
2154      if (this.study == null)
2155        this.study = new ArrayList<Reference>();
2156      this.study.add(t);
2157      return t;
2158    }
2159
2160    public AdverseEvent addStudy(Reference t) { //3
2161      if (t == null)
2162        return this;
2163      if (this.study == null)
2164        this.study = new ArrayList<Reference>();
2165      this.study.add(t);
2166      return this;
2167    }
2168
2169    /**
2170     * @return The first repetition of repeating field {@link #study}, creating it if it does not already exist
2171     */
2172    public Reference getStudyFirstRep() { 
2173      if (getStudy().isEmpty()) {
2174        addStudy();
2175      }
2176      return getStudy().get(0);
2177    }
2178
2179      protected void listChildren(List<Property> children) {
2180        super.listChildren(children);
2181        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
2182        children.add(new Property("status", "code", "The current state of the data entry of the adverse event or potential adverse event.", 0, 1, status));
2183        children.add(new Property("actuality", "code", "Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.", 0, 1, actuality));
2184        children.add(new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category));
2185        children.add(new Property("code", "CodeableConcept", "Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.", 0, 1, code));
2186        children.add(new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event.", 0, 1, subject));
2187        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which AdverseEvent was created or to which the creation of this record is tightly associated.", 0, 1, encounter));
2188        children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence));
2189        children.add(new Property("detected", "dateTime", "Estimated or actual date the AdverseEvent began, in the opinion of the reporter.", 0, 1, detected));
2190        children.add(new Property("recordedDate", "dateTime", "The date on which the existence of the AdverseEvent was first recorded.", 0, 1, recordedDate));
2191        children.add(new Property("resultingCondition", "Reference(Condition)", "Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).", 0, java.lang.Integer.MAX_VALUE, resultingCondition));
2192        children.add(new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location));
2193        children.add(new Property("seriousness", "CodeableConcept", "Assessment whether this event, or averted event, was of clinical importance.", 0, 1, seriousness));
2194        children.add(new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.", 0, 1, outcome));
2195        children.add(new Property("recorder", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder));
2196        children.add(new Property("participant", "", "Indicates who or what participated in the adverse event and how they were involved.", 0, java.lang.Integer.MAX_VALUE, participant));
2197        children.add(new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity));
2198        children.add(new Property("supportingInfo", "", "Supporting information relevant to the event.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
2199        children.add(new Property("study", "Reference(ResearchStudy)", "The research study that the subject is enrolled in.", 0, java.lang.Integer.MAX_VALUE, study));
2200      }
2201
2202      @Override
2203      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2204        switch (_hash) {
2205        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
2206        case -892481550: /*status*/  return new Property("status", "code", "The current state of the data entry of the adverse event or potential adverse event.", 0, 1, status);
2207        case 528866400: /*actuality*/  return new Property("actuality", "code", "Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.", 0, 1, actuality);
2208        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category);
2209        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.", 0, 1, code);
2210        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event.", 0, 1, subject);
2211        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter during which AdverseEvent was created or to which the creation of this record is tightly associated.", 0, 1, encounter);
2212        case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2213        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2214        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2215        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2216        case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2217        case 1048254082: /*detected*/  return new Property("detected", "dateTime", "Estimated or actual date the AdverseEvent began, in the opinion of the reporter.", 0, 1, detected);
2218        case -1952893826: /*recordedDate*/  return new Property("recordedDate", "dateTime", "The date on which the existence of the AdverseEvent was first recorded.", 0, 1, recordedDate);
2219        case -830261258: /*resultingCondition*/  return new Property("resultingCondition", "Reference(Condition)", "Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).", 0, java.lang.Integer.MAX_VALUE, resultingCondition);
2220        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location);
2221        case -1551003909: /*seriousness*/  return new Property("seriousness", "CodeableConcept", "Assessment whether this event, or averted event, was of clinical importance.", 0, 1, seriousness);
2222        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.", 0, 1, outcome);
2223        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder);
2224        case 767422259: /*participant*/  return new Property("participant", "", "Indicates who or what participated in the adverse event and how they were involved.", 0, java.lang.Integer.MAX_VALUE, participant);
2225        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);
2226        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "", "Supporting information relevant to the event.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
2227        case 109776329: /*study*/  return new Property("study", "Reference(ResearchStudy)", "The research study that the subject is enrolled in.", 0, java.lang.Integer.MAX_VALUE, study);
2228        default: return super.getNamedProperty(_hash, _name, _checkValid);
2229        }
2230
2231      }
2232
2233      @Override
2234      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2235        switch (hash) {
2236        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2237        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AdverseEventStatus>
2238        case 528866400: /*actuality*/ return this.actuality == null ? new Base[0] : new Base[] {this.actuality}; // Enumeration<AdverseEventActuality>
2239        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2240        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2241        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2242        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2243        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
2244        case 1048254082: /*detected*/ return this.detected == null ? new Base[0] : new Base[] {this.detected}; // DateTimeType
2245        case -1952893826: /*recordedDate*/ return this.recordedDate == null ? new Base[0] : new Base[] {this.recordedDate}; // DateTimeType
2246        case -830261258: /*resultingCondition*/ return this.resultingCondition == null ? new Base[0] : this.resultingCondition.toArray(new Base[this.resultingCondition.size()]); // Reference
2247        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2248        case -1551003909: /*seriousness*/ return this.seriousness == null ? new Base[0] : new Base[] {this.seriousness}; // CodeableConcept
2249        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
2250        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
2251        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AdverseEventParticipantComponent
2252        case -1957422662: /*suspectEntity*/ return this.suspectEntity == null ? new Base[0] : this.suspectEntity.toArray(new Base[this.suspectEntity.size()]); // AdverseEventSuspectEntityComponent
2253        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // AdverseEventSupportingInfoComponent
2254        case 109776329: /*study*/ return this.study == null ? new Base[0] : this.study.toArray(new Base[this.study.size()]); // Reference
2255        default: return super.getProperty(hash, name, checkValid);
2256        }
2257
2258      }
2259
2260      @Override
2261      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2262        switch (hash) {
2263        case -1618432855: // identifier
2264          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2265          return value;
2266        case -892481550: // status
2267          value = new AdverseEventStatusEnumFactory().fromType(castToCode(value));
2268          this.status = (Enumeration) value; // Enumeration<AdverseEventStatus>
2269          return value;
2270        case 528866400: // actuality
2271          value = new AdverseEventActualityEnumFactory().fromType(castToCode(value));
2272          this.actuality = (Enumeration) value; // Enumeration<AdverseEventActuality>
2273          return value;
2274        case 50511102: // category
2275          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2276          return value;
2277        case 3059181: // code
2278          this.code = castToCodeableConcept(value); // CodeableConcept
2279          return value;
2280        case -1867885268: // subject
2281          this.subject = castToReference(value); // Reference
2282          return value;
2283        case 1524132147: // encounter
2284          this.encounter = castToReference(value); // Reference
2285          return value;
2286        case 1687874001: // occurrence
2287          this.occurrence = castToType(value); // Type
2288          return value;
2289        case 1048254082: // detected
2290          this.detected = castToDateTime(value); // DateTimeType
2291          return value;
2292        case -1952893826: // recordedDate
2293          this.recordedDate = castToDateTime(value); // DateTimeType
2294          return value;
2295        case -830261258: // resultingCondition
2296          this.getResultingCondition().add(castToReference(value)); // Reference
2297          return value;
2298        case 1901043637: // location
2299          this.location = castToReference(value); // Reference
2300          return value;
2301        case -1551003909: // seriousness
2302          this.seriousness = castToCodeableConcept(value); // CodeableConcept
2303          return value;
2304        case -1106507950: // outcome
2305          this.outcome = castToCodeableConcept(value); // CodeableConcept
2306          return value;
2307        case -799233858: // recorder
2308          this.recorder = castToReference(value); // Reference
2309          return value;
2310        case 767422259: // participant
2311          this.getParticipant().add((AdverseEventParticipantComponent) value); // AdverseEventParticipantComponent
2312          return value;
2313        case -1957422662: // suspectEntity
2314          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value); // AdverseEventSuspectEntityComponent
2315          return value;
2316        case 1922406657: // supportingInfo
2317          this.getSupportingInfo().add((AdverseEventSupportingInfoComponent) value); // AdverseEventSupportingInfoComponent
2318          return value;
2319        case 109776329: // study
2320          this.getStudy().add(castToReference(value)); // Reference
2321          return value;
2322        default: return super.setProperty(hash, name, value);
2323        }
2324
2325      }
2326
2327      @Override
2328      public Base setProperty(String name, Base value) throws FHIRException {
2329        if (name.equals("identifier")) {
2330          this.getIdentifier().add(castToIdentifier(value));
2331        } else if (name.equals("status")) {
2332          value = new AdverseEventStatusEnumFactory().fromType(castToCode(value));
2333          this.status = (Enumeration) value; // Enumeration<AdverseEventStatus>
2334        } else if (name.equals("actuality")) {
2335          value = new AdverseEventActualityEnumFactory().fromType(castToCode(value));
2336          this.actuality = (Enumeration) value; // Enumeration<AdverseEventActuality>
2337        } else if (name.equals("category")) {
2338          this.getCategory().add(castToCodeableConcept(value));
2339        } else if (name.equals("code")) {
2340          this.code = castToCodeableConcept(value); // CodeableConcept
2341        } else if (name.equals("subject")) {
2342          this.subject = castToReference(value); // Reference
2343        } else if (name.equals("encounter")) {
2344          this.encounter = castToReference(value); // Reference
2345        } else if (name.equals("occurrence[x]")) {
2346          this.occurrence = castToType(value); // Type
2347        } else if (name.equals("detected")) {
2348          this.detected = castToDateTime(value); // DateTimeType
2349        } else if (name.equals("recordedDate")) {
2350          this.recordedDate = castToDateTime(value); // DateTimeType
2351        } else if (name.equals("resultingCondition")) {
2352          this.getResultingCondition().add(castToReference(value));
2353        } else if (name.equals("location")) {
2354          this.location = castToReference(value); // Reference
2355        } else if (name.equals("seriousness")) {
2356          this.seriousness = castToCodeableConcept(value); // CodeableConcept
2357        } else if (name.equals("outcome")) {
2358          this.outcome = castToCodeableConcept(value); // CodeableConcept
2359        } else if (name.equals("recorder")) {
2360          this.recorder = castToReference(value); // Reference
2361        } else if (name.equals("participant")) {
2362          this.getParticipant().add((AdverseEventParticipantComponent) value);
2363        } else if (name.equals("suspectEntity")) {
2364          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value);
2365        } else if (name.equals("supportingInfo")) {
2366          this.getSupportingInfo().add((AdverseEventSupportingInfoComponent) value);
2367        } else if (name.equals("study")) {
2368          this.getStudy().add(castToReference(value));
2369        } else
2370          return super.setProperty(name, value);
2371        return value;
2372      }
2373
2374      @Override
2375      public Base makeProperty(int hash, String name) throws FHIRException {
2376        switch (hash) {
2377        case -1618432855:  return addIdentifier(); 
2378        case -892481550:  return getStatusElement();
2379        case 528866400:  return getActualityElement();
2380        case 50511102:  return addCategory(); 
2381        case 3059181:  return getCode();
2382        case -1867885268:  return getSubject();
2383        case 1524132147:  return getEncounter();
2384        case -2022646513:  return getOccurrence();
2385        case 1687874001:  return getOccurrence();
2386        case 1048254082:  return getDetectedElement();
2387        case -1952893826:  return getRecordedDateElement();
2388        case -830261258:  return addResultingCondition(); 
2389        case 1901043637:  return getLocation();
2390        case -1551003909:  return getSeriousness();
2391        case -1106507950:  return getOutcome();
2392        case -799233858:  return getRecorder();
2393        case 767422259:  return addParticipant(); 
2394        case -1957422662:  return addSuspectEntity(); 
2395        case 1922406657:  return addSupportingInfo(); 
2396        case 109776329:  return addStudy(); 
2397        default: return super.makeProperty(hash, name);
2398        }
2399
2400      }
2401
2402      @Override
2403      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2404        switch (hash) {
2405        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2406        case -892481550: /*status*/ return new String[] {"code"};
2407        case 528866400: /*actuality*/ return new String[] {"code"};
2408        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2409        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2410        case -1867885268: /*subject*/ return new String[] {"Reference"};
2411        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2412        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
2413        case 1048254082: /*detected*/ return new String[] {"dateTime"};
2414        case -1952893826: /*recordedDate*/ return new String[] {"dateTime"};
2415        case -830261258: /*resultingCondition*/ return new String[] {"Reference"};
2416        case 1901043637: /*location*/ return new String[] {"Reference"};
2417        case -1551003909: /*seriousness*/ return new String[] {"CodeableConcept"};
2418        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
2419        case -799233858: /*recorder*/ return new String[] {"Reference"};
2420        case 767422259: /*participant*/ return new String[] {};
2421        case -1957422662: /*suspectEntity*/ return new String[] {};
2422        case 1922406657: /*supportingInfo*/ return new String[] {};
2423        case 109776329: /*study*/ return new String[] {"Reference"};
2424        default: return super.getTypesForProperty(hash, name);
2425        }
2426
2427      }
2428
2429      @Override
2430      public Base addChild(String name) throws FHIRException {
2431        if (name.equals("identifier")) {
2432          return addIdentifier();
2433        }
2434        else if (name.equals("status")) {
2435          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.status");
2436        }
2437        else if (name.equals("actuality")) {
2438          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.actuality");
2439        }
2440        else if (name.equals("category")) {
2441          return addCategory();
2442        }
2443        else if (name.equals("code")) {
2444          this.code = new CodeableConcept();
2445          return this.code;
2446        }
2447        else if (name.equals("subject")) {
2448          this.subject = new Reference();
2449          return this.subject;
2450        }
2451        else if (name.equals("encounter")) {
2452          this.encounter = new Reference();
2453          return this.encounter;
2454        }
2455        else if (name.equals("occurrenceDateTime")) {
2456          this.occurrence = new DateTimeType();
2457          return this.occurrence;
2458        }
2459        else if (name.equals("occurrencePeriod")) {
2460          this.occurrence = new Period();
2461          return this.occurrence;
2462        }
2463        else if (name.equals("occurrenceTiming")) {
2464          this.occurrence = new Timing();
2465          return this.occurrence;
2466        }
2467        else if (name.equals("detected")) {
2468          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.detected");
2469        }
2470        else if (name.equals("recordedDate")) {
2471          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.recordedDate");
2472        }
2473        else if (name.equals("resultingCondition")) {
2474          return addResultingCondition();
2475        }
2476        else if (name.equals("location")) {
2477          this.location = new Reference();
2478          return this.location;
2479        }
2480        else if (name.equals("seriousness")) {
2481          this.seriousness = new CodeableConcept();
2482          return this.seriousness;
2483        }
2484        else if (name.equals("outcome")) {
2485          this.outcome = new CodeableConcept();
2486          return this.outcome;
2487        }
2488        else if (name.equals("recorder")) {
2489          this.recorder = new Reference();
2490          return this.recorder;
2491        }
2492        else if (name.equals("participant")) {
2493          return addParticipant();
2494        }
2495        else if (name.equals("suspectEntity")) {
2496          return addSuspectEntity();
2497        }
2498        else if (name.equals("supportingInfo")) {
2499          return addSupportingInfo();
2500        }
2501        else if (name.equals("study")) {
2502          return addStudy();
2503        }
2504        else
2505          return super.addChild(name);
2506      }
2507
2508  public String fhirType() {
2509    return "AdverseEvent";
2510
2511  }
2512
2513      public AdverseEvent copy() {
2514        AdverseEvent dst = new AdverseEvent();
2515        copyValues(dst);
2516        return dst;
2517      }
2518
2519      public void copyValues(AdverseEvent dst) {
2520        super.copyValues(dst);
2521        if (identifier != null) {
2522          dst.identifier = new ArrayList<Identifier>();
2523          for (Identifier i : identifier)
2524            dst.identifier.add(i.copy());
2525        };
2526        dst.status = status == null ? null : status.copy();
2527        dst.actuality = actuality == null ? null : actuality.copy();
2528        if (category != null) {
2529          dst.category = new ArrayList<CodeableConcept>();
2530          for (CodeableConcept i : category)
2531            dst.category.add(i.copy());
2532        };
2533        dst.code = code == null ? null : code.copy();
2534        dst.subject = subject == null ? null : subject.copy();
2535        dst.encounter = encounter == null ? null : encounter.copy();
2536        dst.occurrence = occurrence == null ? null : occurrence.copy();
2537        dst.detected = detected == null ? null : detected.copy();
2538        dst.recordedDate = recordedDate == null ? null : recordedDate.copy();
2539        if (resultingCondition != null) {
2540          dst.resultingCondition = new ArrayList<Reference>();
2541          for (Reference i : resultingCondition)
2542            dst.resultingCondition.add(i.copy());
2543        };
2544        dst.location = location == null ? null : location.copy();
2545        dst.seriousness = seriousness == null ? null : seriousness.copy();
2546        dst.outcome = outcome == null ? null : outcome.copy();
2547        dst.recorder = recorder == null ? null : recorder.copy();
2548        if (participant != null) {
2549          dst.participant = new ArrayList<AdverseEventParticipantComponent>();
2550          for (AdverseEventParticipantComponent i : participant)
2551            dst.participant.add(i.copy());
2552        };
2553        if (suspectEntity != null) {
2554          dst.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2555          for (AdverseEventSuspectEntityComponent i : suspectEntity)
2556            dst.suspectEntity.add(i.copy());
2557        };
2558        if (supportingInfo != null) {
2559          dst.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2560          for (AdverseEventSupportingInfoComponent i : supportingInfo)
2561            dst.supportingInfo.add(i.copy());
2562        };
2563        if (study != null) {
2564          dst.study = new ArrayList<Reference>();
2565          for (Reference i : study)
2566            dst.study.add(i.copy());
2567        };
2568      }
2569
2570      protected AdverseEvent typedCopy() {
2571        return copy();
2572      }
2573
2574      @Override
2575      public boolean equalsDeep(Base other_) {
2576        if (!super.equalsDeep(other_))
2577          return false;
2578        if (!(other_ instanceof AdverseEvent))
2579          return false;
2580        AdverseEvent o = (AdverseEvent) other_;
2581        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(actuality, o.actuality, true)
2582           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
2583           && compareDeep(encounter, o.encounter, true) && compareDeep(occurrence, o.occurrence, true) && compareDeep(detected, o.detected, true)
2584           && compareDeep(recordedDate, o.recordedDate, true) && compareDeep(resultingCondition, o.resultingCondition, true)
2585           && compareDeep(location, o.location, true) && compareDeep(seriousness, o.seriousness, true) && compareDeep(outcome, o.outcome, true)
2586           && compareDeep(recorder, o.recorder, true) && compareDeep(participant, o.participant, true) && compareDeep(suspectEntity, o.suspectEntity, true)
2587           && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(study, o.study, true);
2588      }
2589
2590      @Override
2591      public boolean equalsShallow(Base other_) {
2592        if (!super.equalsShallow(other_))
2593          return false;
2594        if (!(other_ instanceof AdverseEvent))
2595          return false;
2596        AdverseEvent o = (AdverseEvent) other_;
2597        return compareValues(status, o.status, true) && compareValues(actuality, o.actuality, true) && compareValues(detected, o.detected, true)
2598           && compareValues(recordedDate, o.recordedDate, true);
2599      }
2600
2601      public boolean isEmpty() {
2602        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, actuality
2603          , category, code, subject, encounter, occurrence, detected, recordedDate, resultingCondition
2604          , location, seriousness, outcome, recorder, participant, suspectEntity, supportingInfo
2605          , study);
2606      }
2607
2608  @Override
2609  public ResourceType getResourceType() {
2610    return ResourceType.AdverseEvent;
2611   }
2612
2613 /**
2614   * Search parameter: <b>date</b>
2615   * <p>
2616   * Description: <b>When the event occurred</b><br>
2617   * Type: <b>date</b><br>
2618   * Path: <b>AdverseEvent.occurrence[x]</b><br>
2619   * </p>
2620   */
2621  @SearchParamDefinition(name="date", path="AdverseEvent.occurrence", description="When the event occurred", type="date" )
2622  public static final String SP_DATE = "date";
2623 /**
2624   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2625   * <p>
2626   * Description: <b>When the event occurred</b><br>
2627   * Type: <b>date</b><br>
2628   * Path: <b>AdverseEvent.occurrence[x]</b><br>
2629   * </p>
2630   */
2631  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2632
2633 /**
2634   * Search parameter: <b>identifier</b>
2635   * <p>
2636   * Description: <b>Business identifier for the event</b><br>
2637   * Type: <b>token</b><br>
2638   * Path: <b>AdverseEvent.identifier</b><br>
2639   * </p>
2640   */
2641  @SearchParamDefinition(name="identifier", path="AdverseEvent.identifier", description="Business identifier for the event", type="token" )
2642  public static final String SP_IDENTIFIER = "identifier";
2643 /**
2644   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2645   * <p>
2646   * Description: <b>Business identifier for the event</b><br>
2647   * Type: <b>token</b><br>
2648   * Path: <b>AdverseEvent.identifier</b><br>
2649   * </p>
2650   */
2651  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2652
2653 /**
2654   * Search parameter: <b>recorder</b>
2655   * <p>
2656   * Description: <b>Who recorded the adverse event</b><br>
2657   * Type: <b>reference</b><br>
2658   * Path: <b>AdverseEvent.recorder</b><br>
2659   * </p>
2660   */
2661  @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, PractitionerRole.class, RelatedPerson.class } )
2662  public static final String SP_RECORDER = "recorder";
2663 /**
2664   * <b>Fluent Client</b> search parameter constant for <b>recorder</b>
2665   * <p>
2666   * Description: <b>Who recorded the adverse event</b><br>
2667   * Type: <b>reference</b><br>
2668   * Path: <b>AdverseEvent.recorder</b><br>
2669   * </p>
2670   */
2671  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECORDER);
2672
2673/**
2674   * Constant for fluent queries to be used to add include statements. Specifies
2675   * the path value of "<b>AdverseEvent:recorder</b>".
2676   */
2677  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECORDER = new ca.uhn.fhir.model.api.Include("AdverseEvent:recorder").toLocked();
2678
2679 /**
2680   * Search parameter: <b>study</b>
2681   * <p>
2682   * Description: <b>Research study that the subject is enrolled in</b><br>
2683   * Type: <b>reference</b><br>
2684   * Path: <b>AdverseEvent.study</b><br>
2685   * </p>
2686   */
2687  @SearchParamDefinition(name="study", path="AdverseEvent.study", description="Research study that the subject is enrolled in", type="reference", target={ResearchStudy.class } )
2688  public static final String SP_STUDY = "study";
2689 /**
2690   * <b>Fluent Client</b> search parameter constant for <b>study</b>
2691   * <p>
2692   * Description: <b>Research study that the subject is enrolled in</b><br>
2693   * Type: <b>reference</b><br>
2694   * Path: <b>AdverseEvent.study</b><br>
2695   * </p>
2696   */
2697  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam STUDY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_STUDY);
2698
2699/**
2700   * Constant for fluent queries to be used to add include statements. Specifies
2701   * the path value of "<b>AdverseEvent:study</b>".
2702   */
2703  public static final ca.uhn.fhir.model.api.Include INCLUDE_STUDY = new ca.uhn.fhir.model.api.Include("AdverseEvent:study").toLocked();
2704
2705 /**
2706   * Search parameter: <b>code</b>
2707   * <p>
2708   * Description: <b>Event or incident that occurred or was averted</b><br>
2709   * Type: <b>token</b><br>
2710   * Path: <b>AdverseEvent.code</b><br>
2711   * </p>
2712   */
2713  @SearchParamDefinition(name="code", path="AdverseEvent.code", description="Event or incident that occurred or was averted", type="token" )
2714  public static final String SP_CODE = "code";
2715 /**
2716   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2717   * <p>
2718   * Description: <b>Event or incident that occurred or was averted</b><br>
2719   * Type: <b>token</b><br>
2720   * Path: <b>AdverseEvent.code</b><br>
2721   * </p>
2722   */
2723  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2724
2725 /**
2726   * Search parameter: <b>actuality</b>
2727   * <p>
2728   * Description: <b>actual | potential</b><br>
2729   * Type: <b>token</b><br>
2730   * Path: <b>AdverseEvent.actuality</b><br>
2731   * </p>
2732   */
2733  @SearchParamDefinition(name="actuality", path="AdverseEvent.actuality", description="actual | potential", type="token" )
2734  public static final String SP_ACTUALITY = "actuality";
2735 /**
2736   * <b>Fluent Client</b> search parameter constant for <b>actuality</b>
2737   * <p>
2738   * Description: <b>actual | potential</b><br>
2739   * Type: <b>token</b><br>
2740   * Path: <b>AdverseEvent.actuality</b><br>
2741   * </p>
2742   */
2743  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTUALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTUALITY);
2744
2745 /**
2746   * Search parameter: <b>subject</b>
2747   * <p>
2748   * Description: <b>Subject impacted by event</b><br>
2749   * Type: <b>reference</b><br>
2750   * Path: <b>AdverseEvent.subject</b><br>
2751   * </p>
2752   */
2753  @SearchParamDefinition(name="subject", path="AdverseEvent.subject", description="Subject impacted by event", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2754  public static final String SP_SUBJECT = "subject";
2755 /**
2756   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2757   * <p>
2758   * Description: <b>Subject impacted by event</b><br>
2759   * Type: <b>reference</b><br>
2760   * Path: <b>AdverseEvent.subject</b><br>
2761   * </p>
2762   */
2763  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2764
2765/**
2766   * Constant for fluent queries to be used to add include statements. Specifies
2767   * the path value of "<b>AdverseEvent:subject</b>".
2768   */
2769  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("AdverseEvent:subject").toLocked();
2770
2771 /**
2772   * Search parameter: <b>resultingcondition</b>
2773   * <p>
2774   * Description: <b>Effect on the subject due to this event</b><br>
2775   * Type: <b>reference</b><br>
2776   * Path: <b>AdverseEvent.resultingCondition</b><br>
2777   * </p>
2778   */
2779  @SearchParamDefinition(name="resultingcondition", path="AdverseEvent.resultingCondition", description="Effect on the subject due to this event", type="reference", target={Condition.class } )
2780  public static final String SP_RESULTINGCONDITION = "resultingcondition";
2781 /**
2782   * <b>Fluent Client</b> search parameter constant for <b>resultingcondition</b>
2783   * <p>
2784   * Description: <b>Effect on the subject due to this event</b><br>
2785   * Type: <b>reference</b><br>
2786   * Path: <b>AdverseEvent.resultingCondition</b><br>
2787   * </p>
2788   */
2789  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULTINGCONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESULTINGCONDITION);
2790
2791/**
2792   * Constant for fluent queries to be used to add include statements. Specifies
2793   * the path value of "<b>AdverseEvent:resultingcondition</b>".
2794   */
2795  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULTINGCONDITION = new ca.uhn.fhir.model.api.Include("AdverseEvent:resultingcondition").toLocked();
2796
2797 /**
2798   * Search parameter: <b>substance</b>
2799   * <p>
2800   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
2801   * Type: <b>reference</b><br>
2802   * Path: <b>AdverseEvent.suspectEntity.instanceReference</b><br>
2803   * </p>
2804   */
2805  @SearchParamDefinition(name="substance", path="(AdverseEvent.suspectEntity.instance as Reference)", description="Refers to the specific entity that caused the adverse event", type="reference", target={Device.class, Immunization.class, Medication.class, MedicationAdministration.class, MedicationUsage.class, Procedure.class, Substance.class } )
2806  public static final String SP_SUBSTANCE = "substance";
2807 /**
2808   * <b>Fluent Client</b> search parameter constant for <b>substance</b>
2809   * <p>
2810   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
2811   * Type: <b>reference</b><br>
2812   * Path: <b>AdverseEvent.suspectEntity.instanceReference</b><br>
2813   * </p>
2814   */
2815  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE);
2816
2817/**
2818   * Constant for fluent queries to be used to add include statements. Specifies
2819   * the path value of "<b>AdverseEvent:substance</b>".
2820   */
2821  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE = new ca.uhn.fhir.model.api.Include("AdverseEvent:substance").toLocked();
2822
2823 /**
2824   * Search parameter: <b>seriousness</b>
2825   * <p>
2826   * Description: <b>Seriousness or gravity of the event</b><br>
2827   * Type: <b>token</b><br>
2828   * Path: <b>AdverseEvent.seriousness</b><br>
2829   * </p>
2830   */
2831  @SearchParamDefinition(name="seriousness", path="AdverseEvent.seriousness", description="Seriousness or gravity of the event", type="token" )
2832  public static final String SP_SERIOUSNESS = "seriousness";
2833 /**
2834   * <b>Fluent Client</b> search parameter constant for <b>seriousness</b>
2835   * <p>
2836   * Description: <b>Seriousness or gravity of the event</b><br>
2837   * Type: <b>token</b><br>
2838   * Path: <b>AdverseEvent.seriousness</b><br>
2839   * </p>
2840   */
2841  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIOUSNESS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERIOUSNESS);
2842
2843 /**
2844   * Search parameter: <b>patient</b>
2845   * <p>
2846   * Description: <b>Subject impacted by event</b><br>
2847   * Type: <b>reference</b><br>
2848   * Path: <b>AdverseEvent.subject</b><br>
2849   * </p>
2850   */
2851  @SearchParamDefinition(name="patient", path="AdverseEvent.subject", description="Subject impacted by event", type="reference", target={Group.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2852  public static final String SP_PATIENT = "patient";
2853 /**
2854   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2855   * <p>
2856   * Description: <b>Subject impacted by event</b><br>
2857   * Type: <b>reference</b><br>
2858   * Path: <b>AdverseEvent.subject</b><br>
2859   * </p>
2860   */
2861  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2862
2863/**
2864   * Constant for fluent queries to be used to add include statements. Specifies
2865   * the path value of "<b>AdverseEvent:patient</b>".
2866   */
2867  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AdverseEvent:patient").toLocked();
2868
2869 /**
2870   * Search parameter: <b>location</b>
2871   * <p>
2872   * Description: <b>Location where adverse event occurred</b><br>
2873   * Type: <b>reference</b><br>
2874   * Path: <b>AdverseEvent.location</b><br>
2875   * </p>
2876   */
2877  @SearchParamDefinition(name="location", path="AdverseEvent.location", description="Location where adverse event occurred", type="reference", target={Location.class } )
2878  public static final String SP_LOCATION = "location";
2879 /**
2880   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2881   * <p>
2882   * Description: <b>Location where adverse event occurred</b><br>
2883   * Type: <b>reference</b><br>
2884   * Path: <b>AdverseEvent.location</b><br>
2885   * </p>
2886   */
2887  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2888
2889/**
2890   * Constant for fluent queries to be used to add include statements. Specifies
2891   * the path value of "<b>AdverseEvent:location</b>".
2892   */
2893  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("AdverseEvent:location").toLocked();
2894
2895 /**
2896   * Search parameter: <b>category</b>
2897   * <p>
2898   * Description: <b>product-problem | product-quality | product-use-error | wrong-dose | incorrect-prescribing-information | wrong-technique | wrong-route-of-administration | wrong-rate | wrong-duration | wrong-time | expired-drug | medical-device-use-error | problem-different-manufacturer | unsafe-physical-environment</b><br>
2899   * Type: <b>token</b><br>
2900   * Path: <b>AdverseEvent.category</b><br>
2901   * </p>
2902   */
2903  @SearchParamDefinition(name="category", path="AdverseEvent.category", description="product-problem | product-quality | product-use-error | wrong-dose | incorrect-prescribing-information | wrong-technique | wrong-route-of-administration | wrong-rate | wrong-duration | wrong-time | expired-drug | medical-device-use-error | problem-different-manufacturer | unsafe-physical-environment", type="token" )
2904  public static final String SP_CATEGORY = "category";
2905 /**
2906   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2907   * <p>
2908   * Description: <b>product-problem | product-quality | product-use-error | wrong-dose | incorrect-prescribing-information | wrong-technique | wrong-route-of-administration | wrong-rate | wrong-duration | wrong-time | expired-drug | medical-device-use-error | problem-different-manufacturer | unsafe-physical-environment</b><br>
2909   * Type: <b>token</b><br>
2910   * Path: <b>AdverseEvent.category</b><br>
2911   * </p>
2912   */
2913  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2914
2915 /**
2916   * Search parameter: <b>status</b>
2917   * <p>
2918   * Description: <b>in-progress | completed | entered-in-error | unknown</b><br>
2919   * Type: <b>token</b><br>
2920   * Path: <b>AdverseEvent.status</b><br>
2921   * </p>
2922   */
2923  @SearchParamDefinition(name="status", path="AdverseEvent.status", description="in-progress | completed | entered-in-error | unknown", type="token" )
2924  public static final String SP_STATUS = "status";
2925 /**
2926   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2927   * <p>
2928   * Description: <b>in-progress | completed | entered-in-error | unknown</b><br>
2929   * Type: <b>token</b><br>
2930   * Path: <b>AdverseEvent.status</b><br>
2931   * </p>
2932   */
2933  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2934
2935
2936}
2937