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