001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.List;
037
038import org.hl7.fhir.exceptions.FHIRException;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.utilities.Utilities;
041
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047
048/**
049 * An assessment of the likely outcome(s) for a patient or other subject as well
050 * as the likelihood of each outcome.
051 */
052@ResourceDef(name = "RiskAssessment", profile = "http://hl7.org/fhir/StructureDefinition/RiskAssessment")
053public class RiskAssessment extends DomainResource {
054
055  public enum RiskAssessmentStatus {
056    /**
057     * The existence of the observation is registered, but there is no result yet
058     * available.
059     */
060    REGISTERED,
061    /**
062     * This is an initial or interim observation: data may be incomplete or
063     * unverified.
064     */
065    PRELIMINARY,
066    /**
067     * The observation is complete and there are no further actions needed.
068     * Additional information such "released", "signed", etc would be represented
069     * using [Provenance](provenance.html) which provides not only the act but also
070     * the actors and dates and other related data. These act states would be
071     * associated with an observation status of `preliminary` until they are all
072     * completed and then a status of `final` would be applied.
073     */
074    FINAL,
075    /**
076     * Subsequent to being Final, the observation has been modified subsequent. This
077     * includes updates/new information and corrections.
078     */
079    AMENDED,
080    /**
081     * Subsequent to being Final, the observation has been modified to correct an
082     * error in the test result.
083     */
084    CORRECTED,
085    /**
086     * The observation is unavailable because the measurement was not started or not
087     * completed (also sometimes called "aborted").
088     */
089    CANCELLED,
090    /**
091     * The observation has been withdrawn following previous final release. This
092     * electronic record should never have existed, though it is possible that
093     * real-world decisions were based on it. (If real-world activity has occurred,
094     * the status should be "cancelled" rather than "entered-in-error".).
095     */
096    ENTEREDINERROR,
097    /**
098     * The authoring/source system does not know which of the status values
099     * currently applies for this observation. Note: This concept is not to be used
100     * for "other" - one of the listed statuses is presumed to apply, but the
101     * authoring/source system does not know which.
102     */
103    UNKNOWN,
104    /**
105     * added to help the parsers with the generic types
106     */
107    NULL;
108
109    public static RiskAssessmentStatus fromCode(String codeString) throws FHIRException {
110      if (codeString == null || "".equals(codeString))
111        return null;
112      if ("registered".equals(codeString))
113        return REGISTERED;
114      if ("preliminary".equals(codeString))
115        return PRELIMINARY;
116      if ("final".equals(codeString))
117        return FINAL;
118      if ("amended".equals(codeString))
119        return AMENDED;
120      if ("corrected".equals(codeString))
121        return CORRECTED;
122      if ("cancelled".equals(codeString))
123        return CANCELLED;
124      if ("entered-in-error".equals(codeString))
125        return ENTEREDINERROR;
126      if ("unknown".equals(codeString))
127        return UNKNOWN;
128      if (Configuration.isAcceptInvalidEnums())
129        return null;
130      else
131        throw new FHIRException("Unknown RiskAssessmentStatus code '" + codeString + "'");
132    }
133
134    public String toCode() {
135      switch (this) {
136      case REGISTERED:
137        return "registered";
138      case PRELIMINARY:
139        return "preliminary";
140      case FINAL:
141        return "final";
142      case AMENDED:
143        return "amended";
144      case CORRECTED:
145        return "corrected";
146      case CANCELLED:
147        return "cancelled";
148      case ENTEREDINERROR:
149        return "entered-in-error";
150      case UNKNOWN:
151        return "unknown";
152      case NULL:
153        return null;
154      default:
155        return "?";
156      }
157    }
158
159    public String getSystem() {
160      switch (this) {
161      case REGISTERED:
162        return "http://hl7.org/fhir/observation-status";
163      case PRELIMINARY:
164        return "http://hl7.org/fhir/observation-status";
165      case FINAL:
166        return "http://hl7.org/fhir/observation-status";
167      case AMENDED:
168        return "http://hl7.org/fhir/observation-status";
169      case CORRECTED:
170        return "http://hl7.org/fhir/observation-status";
171      case CANCELLED:
172        return "http://hl7.org/fhir/observation-status";
173      case ENTEREDINERROR:
174        return "http://hl7.org/fhir/observation-status";
175      case UNKNOWN:
176        return "http://hl7.org/fhir/observation-status";
177      case NULL:
178        return null;
179      default:
180        return "?";
181      }
182    }
183
184    public String getDefinition() {
185      switch (this) {
186      case REGISTERED:
187        return "The existence of the observation is registered, but there is no result yet available.";
188      case PRELIMINARY:
189        return "This is an initial or interim observation: data may be incomplete or unverified.";
190      case FINAL:
191        return "The observation is complete and there are no further actions needed. Additional information such \"released\", \"signed\", etc would be represented using [Provenance](provenance.html) which provides not only the act but also the actors and dates and other related data. These act states would be associated with an observation status of `preliminary` until they are all completed and then a status of `final` would be applied.";
192      case AMENDED:
193        return "Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.";
194      case CORRECTED:
195        return "Subsequent to being Final, the observation has been modified to correct an error in the test result.";
196      case CANCELLED:
197        return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
198      case ENTEREDINERROR:
199        return "The observation has been withdrawn following previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
200      case UNKNOWN:
201        return "The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.";
202      case NULL:
203        return null;
204      default:
205        return "?";
206      }
207    }
208
209    public String getDisplay() {
210      switch (this) {
211      case REGISTERED:
212        return "Registered";
213      case PRELIMINARY:
214        return "Preliminary";
215      case FINAL:
216        return "Final";
217      case AMENDED:
218        return "Amended";
219      case CORRECTED:
220        return "Corrected";
221      case CANCELLED:
222        return "Cancelled";
223      case ENTEREDINERROR:
224        return "Entered in Error";
225      case UNKNOWN:
226        return "Unknown";
227      case NULL:
228        return null;
229      default:
230        return "?";
231      }
232    }
233  }
234
235  public static class RiskAssessmentStatusEnumFactory implements EnumFactory<RiskAssessmentStatus> {
236    public RiskAssessmentStatus fromCode(String codeString) throws IllegalArgumentException {
237      if (codeString == null || "".equals(codeString))
238        if (codeString == null || "".equals(codeString))
239          return null;
240      if ("registered".equals(codeString))
241        return RiskAssessmentStatus.REGISTERED;
242      if ("preliminary".equals(codeString))
243        return RiskAssessmentStatus.PRELIMINARY;
244      if ("final".equals(codeString))
245        return RiskAssessmentStatus.FINAL;
246      if ("amended".equals(codeString))
247        return RiskAssessmentStatus.AMENDED;
248      if ("corrected".equals(codeString))
249        return RiskAssessmentStatus.CORRECTED;
250      if ("cancelled".equals(codeString))
251        return RiskAssessmentStatus.CANCELLED;
252      if ("entered-in-error".equals(codeString))
253        return RiskAssessmentStatus.ENTEREDINERROR;
254      if ("unknown".equals(codeString))
255        return RiskAssessmentStatus.UNKNOWN;
256      throw new IllegalArgumentException("Unknown RiskAssessmentStatus code '" + codeString + "'");
257    }
258
259    public Enumeration<RiskAssessmentStatus> fromType(PrimitiveType<?> code) throws FHIRException {
260      if (code == null)
261        return null;
262      if (code.isEmpty())
263        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.NULL, code);
264      String codeString = code.asStringValue();
265      if (codeString == null || "".equals(codeString))
266        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.NULL, code);
267      if ("registered".equals(codeString))
268        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.REGISTERED, code);
269      if ("preliminary".equals(codeString))
270        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.PRELIMINARY, code);
271      if ("final".equals(codeString))
272        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.FINAL, code);
273      if ("amended".equals(codeString))
274        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.AMENDED, code);
275      if ("corrected".equals(codeString))
276        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.CORRECTED, code);
277      if ("cancelled".equals(codeString))
278        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.CANCELLED, code);
279      if ("entered-in-error".equals(codeString))
280        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.ENTEREDINERROR, code);
281      if ("unknown".equals(codeString))
282        return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.UNKNOWN, code);
283      throw new FHIRException("Unknown RiskAssessmentStatus code '" + codeString + "'");
284    }
285
286    public String toCode(RiskAssessmentStatus code) {
287       if (code == RiskAssessmentStatus.NULL)
288           return null;
289       if (code == RiskAssessmentStatus.REGISTERED)
290        return "registered";
291      if (code == RiskAssessmentStatus.PRELIMINARY)
292        return "preliminary";
293      if (code == RiskAssessmentStatus.FINAL)
294        return "final";
295      if (code == RiskAssessmentStatus.AMENDED)
296        return "amended";
297      if (code == RiskAssessmentStatus.CORRECTED)
298        return "corrected";
299      if (code == RiskAssessmentStatus.CANCELLED)
300        return "cancelled";
301      if (code == RiskAssessmentStatus.ENTEREDINERROR)
302        return "entered-in-error";
303      if (code == RiskAssessmentStatus.UNKNOWN)
304        return "unknown";
305      return "?";
306   }
307
308    public String toSystem(RiskAssessmentStatus code) {
309      return code.getSystem();
310    }
311  }
312
313  @Block()
314  public static class RiskAssessmentPredictionComponent extends BackboneElement implements IBaseBackboneElement {
315    /**
316     * One of the potential outcomes for the patient (e.g. remission, death, a
317     * particular condition).
318     */
319    @Child(name = "outcome", type = {
320        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
321    @Description(shortDefinition = "Possible outcome for the subject", formalDefinition = "One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).")
322    protected CodeableConcept outcome;
323
324    /**
325     * Indicates how likely the outcome is (in the specified timeframe).
326     */
327    @Child(name = "probability", type = { DecimalType.class,
328        Range.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
329    @Description(shortDefinition = "Likelihood of specified outcome", formalDefinition = "Indicates how likely the outcome is (in the specified timeframe).")
330    protected Type probability;
331
332    /**
333     * Indicates how likely the outcome is (in the specified timeframe), expressed
334     * as a qualitative value (e.g. low, medium, or high).
335     */
336    @Child(name = "qualitativeRisk", type = {
337        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
338    @Description(shortDefinition = "Likelihood of specified outcome as a qualitative value", formalDefinition = "Indicates how likely the outcome is (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, or high).")
339    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/risk-probability")
340    protected CodeableConcept qualitativeRisk;
341
342    /**
343     * Indicates the risk for this particular subject (with their specific
344     * characteristics) divided by the risk of the population in general. (Numbers
345     * greater than 1 = higher risk than the population, numbers less than 1 = lower
346     * risk.).
347     */
348    @Child(name = "relativeRisk", type = {
349        DecimalType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
350    @Description(shortDefinition = "Relative likelihood", formalDefinition = "Indicates the risk for this particular subject (with their specific characteristics) divided by the risk of the population in general.  (Numbers greater than 1 = higher risk than the population, numbers less than 1 = lower risk.).")
351    protected DecimalType relativeRisk;
352
353    /**
354     * Indicates the period of time or age range of the subject to which the
355     * specified probability applies.
356     */
357    @Child(name = "when", type = { Period.class,
358        Range.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
359    @Description(shortDefinition = "Timeframe or age range", formalDefinition = "Indicates the period of time or age range of the subject to which the specified probability applies.")
360    protected Type when;
361
362    /**
363     * Additional information explaining the basis for the prediction.
364     */
365    @Child(name = "rationale", type = {
366        StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
367    @Description(shortDefinition = "Explanation of prediction", formalDefinition = "Additional information explaining the basis for the prediction.")
368    protected StringType rationale;
369
370    private static final long serialVersionUID = 1283401747L;
371
372    /**
373     * Constructor
374     */
375    public RiskAssessmentPredictionComponent() {
376      super();
377    }
378
379    /**
380     * @return {@link #outcome} (One of the potential outcomes for the patient (e.g.
381     *         remission, death, a particular condition).)
382     */
383    public CodeableConcept getOutcome() {
384      if (this.outcome == null)
385        if (Configuration.errorOnAutoCreate())
386          throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.outcome");
387        else if (Configuration.doAutoCreate())
388          this.outcome = new CodeableConcept(); // cc
389      return this.outcome;
390    }
391
392    public boolean hasOutcome() {
393      return this.outcome != null && !this.outcome.isEmpty();
394    }
395
396    /**
397     * @param value {@link #outcome} (One of the potential outcomes for the patient
398     *              (e.g. remission, death, a particular condition).)
399     */
400    public RiskAssessmentPredictionComponent setOutcome(CodeableConcept value) {
401      this.outcome = value;
402      return this;
403    }
404
405    /**
406     * @return {@link #probability} (Indicates how likely the outcome is (in the
407     *         specified timeframe).)
408     */
409    public Type getProbability() {
410      return this.probability;
411    }
412
413    /**
414     * @return {@link #probability} (Indicates how likely the outcome is (in the
415     *         specified timeframe).)
416     */
417    public DecimalType getProbabilityDecimalType() throws FHIRException {
418      if (this.probability == null)
419        this.probability = new DecimalType();
420      if (!(this.probability instanceof DecimalType))
421        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
422            + this.probability.getClass().getName() + " was encountered");
423      return (DecimalType) this.probability;
424    }
425
426    public boolean hasProbabilityDecimalType() {
427        return this.probability instanceof DecimalType;
428    }
429
430    /**
431     * @return {@link #probability} (Indicates how likely the outcome is (in the
432     *         specified timeframe).)
433     */
434    public Range getProbabilityRange() throws FHIRException {
435      if (this.probability == null)
436        this.probability = new Range();
437      if (!(this.probability instanceof Range))
438        throw new FHIRException("Type mismatch: the type Range was expected, but "
439            + this.probability.getClass().getName() + " was encountered");
440      return (Range) this.probability;
441    }
442
443    public boolean hasProbabilityRange() {
444        return this.probability instanceof Range;
445    }
446
447    public boolean hasProbability() {
448      return this.probability != null && !this.probability.isEmpty();
449    }
450
451    /**
452     * @param value {@link #probability} (Indicates how likely the outcome is (in
453     *              the specified timeframe).)
454     */
455    public RiskAssessmentPredictionComponent setProbability(Type value) {
456      if (value != null && !(value instanceof DecimalType || value instanceof Range))
457        throw new Error("Not the right type for RiskAssessment.prediction.probability[x]: " + value.fhirType());
458      this.probability = value;
459      return this;
460    }
461
462    /**
463     * @return {@link #qualitativeRisk} (Indicates how likely the outcome is (in the
464     *         specified timeframe), expressed as a qualitative value (e.g. low,
465     *         medium, or high).)
466     */
467    public CodeableConcept getQualitativeRisk() {
468      if (this.qualitativeRisk == null)
469        if (Configuration.errorOnAutoCreate())
470          throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.qualitativeRisk");
471        else if (Configuration.doAutoCreate())
472          this.qualitativeRisk = new CodeableConcept(); // cc
473      return this.qualitativeRisk;
474    }
475
476    public boolean hasQualitativeRisk() {
477      return this.qualitativeRisk != null && !this.qualitativeRisk.isEmpty();
478    }
479
480    /**
481     * @param value {@link #qualitativeRisk} (Indicates how likely the outcome is
482     *              (in the specified timeframe), expressed as a qualitative value
483     *              (e.g. low, medium, or high).)
484     */
485    public RiskAssessmentPredictionComponent setQualitativeRisk(CodeableConcept value) {
486      this.qualitativeRisk = value;
487      return this;
488    }
489
490    /**
491     * @return {@link #relativeRisk} (Indicates the risk for this particular subject
492     *         (with their specific characteristics) divided by the risk of the
493     *         population in general. (Numbers greater than 1 = higher risk than the
494     *         population, numbers less than 1 = lower risk.).). This is the
495     *         underlying object with id, value and extensions. The accessor
496     *         "getRelativeRisk" gives direct access to the value
497     */
498    public DecimalType getRelativeRiskElement() {
499      if (this.relativeRisk == null)
500        if (Configuration.errorOnAutoCreate())
501          throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.relativeRisk");
502        else if (Configuration.doAutoCreate())
503          this.relativeRisk = new DecimalType(); // bb
504      return this.relativeRisk;
505    }
506
507    public boolean hasRelativeRiskElement() {
508      return this.relativeRisk != null && !this.relativeRisk.isEmpty();
509    }
510
511    public boolean hasRelativeRisk() {
512      return this.relativeRisk != null && !this.relativeRisk.isEmpty();
513    }
514
515    /**
516     * @param value {@link #relativeRisk} (Indicates the risk for this particular
517     *              subject (with their specific characteristics) divided by the
518     *              risk of the population in general. (Numbers greater than 1 =
519     *              higher risk than the population, numbers less than 1 = lower
520     *              risk.).). This is the underlying object with id, value and
521     *              extensions. The accessor "getRelativeRisk" gives direct access
522     *              to the value
523     */
524    public RiskAssessmentPredictionComponent setRelativeRiskElement(DecimalType value) {
525      this.relativeRisk = value;
526      return this;
527    }
528
529    /**
530     * @return Indicates the risk for this particular subject (with their specific
531     *         characteristics) divided by the risk of the population in general.
532     *         (Numbers greater than 1 = higher risk than the population, numbers
533     *         less than 1 = lower risk.).
534     */
535    public BigDecimal getRelativeRisk() {
536      return this.relativeRisk == null ? null : this.relativeRisk.getValue();
537    }
538
539    /**
540     * @param value Indicates the risk for this particular subject (with their
541     *              specific characteristics) divided by the risk of the population
542     *              in general. (Numbers greater than 1 = higher risk than the
543     *              population, numbers less than 1 = lower risk.).
544     */
545    public RiskAssessmentPredictionComponent setRelativeRisk(BigDecimal value) {
546      if (value == null)
547        this.relativeRisk = null;
548      else {
549        if (this.relativeRisk == null)
550          this.relativeRisk = new DecimalType();
551        this.relativeRisk.setValue(value);
552      }
553      return this;
554    }
555
556    /**
557     * @param value Indicates the risk for this particular subject (with their
558     *              specific characteristics) divided by the risk of the population
559     *              in general. (Numbers greater than 1 = higher risk than the
560     *              population, numbers less than 1 = lower risk.).
561     */
562    public RiskAssessmentPredictionComponent setRelativeRisk(long value) {
563      this.relativeRisk = new DecimalType();
564      this.relativeRisk.setValue(value);
565      return this;
566    }
567
568    /**
569     * @param value Indicates the risk for this particular subject (with their
570     *              specific characteristics) divided by the risk of the population
571     *              in general. (Numbers greater than 1 = higher risk than the
572     *              population, numbers less than 1 = lower risk.).
573     */
574    public RiskAssessmentPredictionComponent setRelativeRisk(double value) {
575      this.relativeRisk = new DecimalType();
576      this.relativeRisk.setValue(value);
577      return this;
578    }
579
580    /**
581     * @return {@link #when} (Indicates the period of time or age range of the
582     *         subject to which the specified probability applies.)
583     */
584    public Type getWhen() {
585      return this.when;
586    }
587
588    /**
589     * @return {@link #when} (Indicates the period of time or age range of the
590     *         subject to which the specified probability applies.)
591     */
592    public Period getWhenPeriod() throws FHIRException {
593      if (this.when == null)
594        this.when = new Period();
595      if (!(this.when instanceof Period))
596        throw new FHIRException(
597            "Type mismatch: the type Period was expected, but " + this.when.getClass().getName() + " was encountered");
598      return (Period) this.when;
599    }
600
601    public boolean hasWhenPeriod() {
602        return this.when instanceof Period;
603    }
604
605    /**
606     * @return {@link #when} (Indicates the period of time or age range of the
607     *         subject to which the specified probability applies.)
608     */
609    public Range getWhenRange() throws FHIRException {
610      if (this.when == null)
611        this.when = new Range();
612      if (!(this.when instanceof Range))
613        throw new FHIRException(
614            "Type mismatch: the type Range was expected, but " + this.when.getClass().getName() + " was encountered");
615      return (Range) this.when;
616    }
617
618    public boolean hasWhenRange() {
619        return this.when instanceof Range;
620    }
621
622    public boolean hasWhen() {
623      return this.when != null && !this.when.isEmpty();
624    }
625
626    /**
627     * @param value {@link #when} (Indicates the period of time or age range of the
628     *              subject to which the specified probability applies.)
629     */
630    public RiskAssessmentPredictionComponent setWhen(Type value) {
631      if (value != null && !(value instanceof Period || value instanceof Range))
632        throw new Error("Not the right type for RiskAssessment.prediction.when[x]: " + value.fhirType());
633      this.when = value;
634      return this;
635    }
636
637    /**
638     * @return {@link #rationale} (Additional information explaining the basis for
639     *         the prediction.). This is the underlying object with id, value and
640     *         extensions. The accessor "getRationale" gives direct access to the
641     *         value
642     */
643    public StringType getRationaleElement() {
644      if (this.rationale == null)
645        if (Configuration.errorOnAutoCreate())
646          throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.rationale");
647        else if (Configuration.doAutoCreate())
648          this.rationale = new StringType(); // bb
649      return this.rationale;
650    }
651
652    public boolean hasRationaleElement() {
653      return this.rationale != null && !this.rationale.isEmpty();
654    }
655
656    public boolean hasRationale() {
657      return this.rationale != null && !this.rationale.isEmpty();
658    }
659
660    /**
661     * @param value {@link #rationale} (Additional information explaining the basis
662     *              for the prediction.). This is the underlying object with id,
663     *              value and extensions. The accessor "getRationale" gives direct
664     *              access to the value
665     */
666    public RiskAssessmentPredictionComponent setRationaleElement(StringType value) {
667      this.rationale = value;
668      return this;
669    }
670
671    /**
672     * @return Additional information explaining the basis for the prediction.
673     */
674    public String getRationale() {
675      return this.rationale == null ? null : this.rationale.getValue();
676    }
677
678    /**
679     * @param value Additional information explaining the basis for the prediction.
680     */
681    public RiskAssessmentPredictionComponent setRationale(String value) {
682      if (Utilities.noString(value))
683        this.rationale = null;
684      else {
685        if (this.rationale == null)
686          this.rationale = new StringType();
687        this.rationale.setValue(value);
688      }
689      return this;
690    }
691
692    protected void listChildren(List<Property> children) {
693      super.listChildren(children);
694      children.add(new Property("outcome", "CodeableConcept",
695          "One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).", 0, 1,
696          outcome));
697      children.add(new Property("probability[x]", "decimal|Range",
698          "Indicates how likely the outcome is (in the specified timeframe).", 0, 1, probability));
699      children.add(new Property("qualitativeRisk", "CodeableConcept",
700          "Indicates how likely the outcome is (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, or high).",
701          0, 1, qualitativeRisk));
702      children.add(new Property("relativeRisk", "decimal",
703          "Indicates the risk for this particular subject (with their specific characteristics) divided by the risk of the population in general.  (Numbers greater than 1 = higher risk than the population, numbers less than 1 = lower risk.).",
704          0, 1, relativeRisk));
705      children.add(new Property("when[x]", "Period|Range",
706          "Indicates the period of time or age range of the subject to which the specified probability applies.", 0, 1,
707          when));
708      children.add(new Property("rationale", "string",
709          "Additional information explaining the basis for the prediction.", 0, 1, rationale));
710    }
711
712    @Override
713    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
714      switch (_hash) {
715      case -1106507950:
716        /* outcome */ return new Property("outcome", "CodeableConcept",
717            "One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).", 0, 1,
718            outcome);
719      case 1430185003:
720        /* probability[x] */ return new Property("probability[x]", "decimal|Range",
721            "Indicates how likely the outcome is (in the specified timeframe).", 0, 1, probability);
722      case -1290561483:
723        /* probability */ return new Property("probability[x]", "decimal|Range",
724            "Indicates how likely the outcome is (in the specified timeframe).", 0, 1, probability);
725      case 888495452:
726        /* probabilityDecimal */ return new Property("probability[x]", "decimal|Range",
727            "Indicates how likely the outcome is (in the specified timeframe).", 0, 1, probability);
728      case 9275912:
729        /* probabilityRange */ return new Property("probability[x]", "decimal|Range",
730            "Indicates how likely the outcome is (in the specified timeframe).", 0, 1, probability);
731      case 123308730:
732        /* qualitativeRisk */ return new Property("qualitativeRisk", "CodeableConcept",
733            "Indicates how likely the outcome is (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, or high).",
734            0, 1, qualitativeRisk);
735      case -70741061:
736        /* relativeRisk */ return new Property("relativeRisk", "decimal",
737            "Indicates the risk for this particular subject (with their specific characteristics) divided by the risk of the population in general.  (Numbers greater than 1 = higher risk than the population, numbers less than 1 = lower risk.).",
738            0, 1, relativeRisk);
739      case 1312831238:
740        /* when[x] */ return new Property("when[x]", "Period|Range",
741            "Indicates the period of time or age range of the subject to which the specified probability applies.", 0,
742            1, when);
743      case 3648314:
744        /* when */ return new Property("when[x]", "Period|Range",
745            "Indicates the period of time or age range of the subject to which the specified probability applies.", 0,
746            1, when);
747      case 251476379:
748        /* whenPeriod */ return new Property("when[x]", "Period|Range",
749            "Indicates the period of time or age range of the subject to which the specified probability applies.", 0,
750            1, when);
751      case -1098542557:
752        /* whenRange */ return new Property("when[x]", "Period|Range",
753            "Indicates the period of time or age range of the subject to which the specified probability applies.", 0,
754            1, when);
755      case 345689335:
756        /* rationale */ return new Property("rationale", "string",
757            "Additional information explaining the basis for the prediction.", 0, 1, rationale);
758      default:
759        return super.getNamedProperty(_hash, _name, _checkValid);
760      }
761
762    }
763
764    @Override
765    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
766      switch (hash) {
767      case -1106507950:
768        /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // CodeableConcept
769      case -1290561483:
770        /* probability */ return this.probability == null ? new Base[0] : new Base[] { this.probability }; // Type
771      case 123308730:
772        /* qualitativeRisk */ return this.qualitativeRisk == null ? new Base[0] : new Base[] { this.qualitativeRisk }; // CodeableConcept
773      case -70741061:
774        /* relativeRisk */ return this.relativeRisk == null ? new Base[0] : new Base[] { this.relativeRisk }; // DecimalType
775      case 3648314:
776        /* when */ return this.when == null ? new Base[0] : new Base[] { this.when }; // Type
777      case 345689335:
778        /* rationale */ return this.rationale == null ? new Base[0] : new Base[] { this.rationale }; // StringType
779      default:
780        return super.getProperty(hash, name, checkValid);
781      }
782
783    }
784
785    @Override
786    public Base setProperty(int hash, String name, Base value) throws FHIRException {
787      switch (hash) {
788      case -1106507950: // outcome
789        this.outcome = castToCodeableConcept(value); // CodeableConcept
790        return value;
791      case -1290561483: // probability
792        this.probability = castToType(value); // Type
793        return value;
794      case 123308730: // qualitativeRisk
795        this.qualitativeRisk = castToCodeableConcept(value); // CodeableConcept
796        return value;
797      case -70741061: // relativeRisk
798        this.relativeRisk = castToDecimal(value); // DecimalType
799        return value;
800      case 3648314: // when
801        this.when = castToType(value); // Type
802        return value;
803      case 345689335: // rationale
804        this.rationale = castToString(value); // StringType
805        return value;
806      default:
807        return super.setProperty(hash, name, value);
808      }
809
810    }
811
812    @Override
813    public Base setProperty(String name, Base value) throws FHIRException {
814      if (name.equals("outcome")) {
815        this.outcome = castToCodeableConcept(value); // CodeableConcept
816      } else if (name.equals("probability[x]")) {
817        this.probability = castToType(value); // Type
818      } else if (name.equals("qualitativeRisk")) {
819        this.qualitativeRisk = castToCodeableConcept(value); // CodeableConcept
820      } else if (name.equals("relativeRisk")) {
821        this.relativeRisk = castToDecimal(value); // DecimalType
822      } else if (name.equals("when[x]")) {
823        this.when = castToType(value); // Type
824      } else if (name.equals("rationale")) {
825        this.rationale = castToString(value); // StringType
826      } else
827        return super.setProperty(name, value);
828      return value;
829    }
830
831  @Override
832  public void removeChild(String name, Base value) throws FHIRException {
833      if (name.equals("outcome")) {
834        this.outcome = null;
835      } else if (name.equals("probability[x]")) {
836        this.probability = null;
837      } else if (name.equals("qualitativeRisk")) {
838        this.qualitativeRisk = null;
839      } else if (name.equals("relativeRisk")) {
840        this.relativeRisk = null;
841      } else if (name.equals("when[x]")) {
842        this.when = null;
843      } else if (name.equals("rationale")) {
844        this.rationale = null;
845      } else
846        super.removeChild(name, value);
847      
848    }
849
850    @Override
851    public Base makeProperty(int hash, String name) throws FHIRException {
852      switch (hash) {
853      case -1106507950:
854        return getOutcome();
855      case 1430185003:
856        return getProbability();
857      case -1290561483:
858        return getProbability();
859      case 123308730:
860        return getQualitativeRisk();
861      case -70741061:
862        return getRelativeRiskElement();
863      case 1312831238:
864        return getWhen();
865      case 3648314:
866        return getWhen();
867      case 345689335:
868        return getRationaleElement();
869      default:
870        return super.makeProperty(hash, name);
871      }
872
873    }
874
875    @Override
876    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
877      switch (hash) {
878      case -1106507950:
879        /* outcome */ return new String[] { "CodeableConcept" };
880      case -1290561483:
881        /* probability */ return new String[] { "decimal", "Range" };
882      case 123308730:
883        /* qualitativeRisk */ return new String[] { "CodeableConcept" };
884      case -70741061:
885        /* relativeRisk */ return new String[] { "decimal" };
886      case 3648314:
887        /* when */ return new String[] { "Period", "Range" };
888      case 345689335:
889        /* rationale */ return new String[] { "string" };
890      default:
891        return super.getTypesForProperty(hash, name);
892      }
893
894    }
895
896    @Override
897    public Base addChild(String name) throws FHIRException {
898      if (name.equals("outcome")) {
899        this.outcome = new CodeableConcept();
900        return this.outcome;
901      } else if (name.equals("probabilityDecimal")) {
902        this.probability = new DecimalType();
903        return this.probability;
904      } else if (name.equals("probabilityRange")) {
905        this.probability = new Range();
906        return this.probability;
907      } else if (name.equals("qualitativeRisk")) {
908        this.qualitativeRisk = new CodeableConcept();
909        return this.qualitativeRisk;
910      } else if (name.equals("relativeRisk")) {
911        throw new FHIRException("Cannot call addChild on a singleton property RiskAssessment.relativeRisk");
912      } else if (name.equals("whenPeriod")) {
913        this.when = new Period();
914        return this.when;
915      } else if (name.equals("whenRange")) {
916        this.when = new Range();
917        return this.when;
918      } else if (name.equals("rationale")) {
919        throw new FHIRException("Cannot call addChild on a singleton property RiskAssessment.rationale");
920      } else
921        return super.addChild(name);
922    }
923
924    public RiskAssessmentPredictionComponent copy() {
925      RiskAssessmentPredictionComponent dst = new RiskAssessmentPredictionComponent();
926      copyValues(dst);
927      return dst;
928    }
929
930    public void copyValues(RiskAssessmentPredictionComponent dst) {
931      super.copyValues(dst);
932      dst.outcome = outcome == null ? null : outcome.copy();
933      dst.probability = probability == null ? null : probability.copy();
934      dst.qualitativeRisk = qualitativeRisk == null ? null : qualitativeRisk.copy();
935      dst.relativeRisk = relativeRisk == null ? null : relativeRisk.copy();
936      dst.when = when == null ? null : when.copy();
937      dst.rationale = rationale == null ? null : rationale.copy();
938    }
939
940    @Override
941    public boolean equalsDeep(Base other_) {
942      if (!super.equalsDeep(other_))
943        return false;
944      if (!(other_ instanceof RiskAssessmentPredictionComponent))
945        return false;
946      RiskAssessmentPredictionComponent o = (RiskAssessmentPredictionComponent) other_;
947      return compareDeep(outcome, o.outcome, true) && compareDeep(probability, o.probability, true)
948          && compareDeep(qualitativeRisk, o.qualitativeRisk, true) && compareDeep(relativeRisk, o.relativeRisk, true)
949          && compareDeep(when, o.when, true) && compareDeep(rationale, o.rationale, true);
950    }
951
952    @Override
953    public boolean equalsShallow(Base other_) {
954      if (!super.equalsShallow(other_))
955        return false;
956      if (!(other_ instanceof RiskAssessmentPredictionComponent))
957        return false;
958      RiskAssessmentPredictionComponent o = (RiskAssessmentPredictionComponent) other_;
959      return compareValues(relativeRisk, o.relativeRisk, true) && compareValues(rationale, o.rationale, true);
960    }
961
962    public boolean isEmpty() {
963      return super.isEmpty()
964          && ca.uhn.fhir.util.ElementUtil.isEmpty(outcome, probability, qualitativeRisk, relativeRisk, when, rationale);
965    }
966
967    public String fhirType() {
968      return "RiskAssessment.prediction";
969
970    }
971
972  }
973
974  /**
975   * Business identifier assigned to the risk assessment.
976   */
977  @Child(name = "identifier", type = {
978      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
979  @Description(shortDefinition = "Unique identifier for the assessment", formalDefinition = "Business identifier assigned to the risk assessment.")
980  protected List<Identifier> identifier;
981
982  /**
983   * A reference to the request that is fulfilled by this risk assessment.
984   */
985  @Child(name = "basedOn", type = { Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
986  @Description(shortDefinition = "Request fulfilled by this assessment", formalDefinition = "A reference to the request that is fulfilled by this risk assessment.")
987  protected Reference basedOn;
988
989  /**
990   * The actual object that is the target of the reference (A reference to the
991   * request that is fulfilled by this risk assessment.)
992   */
993  protected Resource basedOnTarget;
994
995  /**
996   * A reference to a resource that this risk assessment is part of, such as a
997   * Procedure.
998   */
999  @Child(name = "parent", type = { Reference.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1000  @Description(shortDefinition = "Part of this occurrence", formalDefinition = "A reference to a resource that this risk assessment is part of, such as a Procedure.")
1001  protected Reference parent;
1002
1003  /**
1004   * The actual object that is the target of the reference (A reference to a
1005   * resource that this risk assessment is part of, such as a Procedure.)
1006   */
1007  protected Resource parentTarget;
1008
1009  /**
1010   * The status of the RiskAssessment, using the same statuses as an Observation.
1011   */
1012  @Child(name = "status", type = { CodeType.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
1013  @Description(shortDefinition = "registered | preliminary | final | amended +", formalDefinition = "The status of the RiskAssessment, using the same statuses as an Observation.")
1014  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-status")
1015  protected Enumeration<RiskAssessmentStatus> status;
1016
1017  /**
1018   * The algorithm, process or mechanism used to evaluate the risk.
1019   */
1020  @Child(name = "method", type = {
1021      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1022  @Description(shortDefinition = "Evaluation mechanism", formalDefinition = "The algorithm, process or mechanism used to evaluate the risk.")
1023  protected CodeableConcept method;
1024
1025  /**
1026   * The type of the risk assessment performed.
1027   */
1028  @Child(name = "code", type = { CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1029  @Description(shortDefinition = "Type of assessment", formalDefinition = "The type of the risk assessment performed.")
1030  protected CodeableConcept code;
1031
1032  /**
1033   * The patient or group the risk assessment applies to.
1034   */
1035  @Child(name = "subject", type = { Patient.class,
1036      Group.class }, order = 6, min = 1, max = 1, modifier = false, summary = true)
1037  @Description(shortDefinition = "Who/what does assessment apply to?", formalDefinition = "The patient or group the risk assessment applies to.")
1038  protected Reference subject;
1039
1040  /**
1041   * The actual object that is the target of the reference (The patient or group
1042   * the risk assessment applies to.)
1043   */
1044  protected Resource subjectTarget;
1045
1046  /**
1047   * The encounter where the assessment was performed.
1048   */
1049  @Child(name = "encounter", type = { Encounter.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1050  @Description(shortDefinition = "Where was assessment performed?", formalDefinition = "The encounter where the assessment was performed.")
1051  protected Reference encounter;
1052
1053  /**
1054   * The actual object that is the target of the reference (The encounter where
1055   * the assessment was performed.)
1056   */
1057  protected Encounter encounterTarget;
1058
1059  /**
1060   * The date (and possibly time) the risk assessment was performed.
1061   */
1062  @Child(name = "occurrence", type = { DateTimeType.class,
1063      Period.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
1064  @Description(shortDefinition = "When was assessment made?", formalDefinition = "The date (and possibly time) the risk assessment was performed.")
1065  protected Type occurrence;
1066
1067  /**
1068   * For assessments or prognosis specific to a particular condition, indicates
1069   * the condition being assessed.
1070   */
1071  @Child(name = "condition", type = { Condition.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
1072  @Description(shortDefinition = "Condition assessed", formalDefinition = "For assessments or prognosis specific to a particular condition, indicates the condition being assessed.")
1073  protected Reference condition;
1074
1075  /**
1076   * The actual object that is the target of the reference (For assessments or
1077   * prognosis specific to a particular condition, indicates the condition being
1078   * assessed.)
1079   */
1080  protected Condition conditionTarget;
1081
1082  /**
1083   * The provider or software application that performed the assessment.
1084   */
1085  @Child(name = "performer", type = { Practitioner.class, PractitionerRole.class,
1086      Device.class }, order = 10, min = 0, max = 1, modifier = false, summary = true)
1087  @Description(shortDefinition = "Who did assessment?", formalDefinition = "The provider or software application that performed the assessment.")
1088  protected Reference performer;
1089
1090  /**
1091   * The actual object that is the target of the reference (The provider or
1092   * software application that performed the assessment.)
1093   */
1094  protected Resource performerTarget;
1095
1096  /**
1097   * The reason the risk assessment was performed.
1098   */
1099  @Child(name = "reasonCode", type = {
1100      CodeableConcept.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1101  @Description(shortDefinition = "Why the assessment was necessary?", formalDefinition = "The reason the risk assessment was performed.")
1102  protected List<CodeableConcept> reasonCode;
1103
1104  /**
1105   * Resources supporting the reason the risk assessment was performed.
1106   */
1107  @Child(name = "reasonReference", type = { Condition.class, Observation.class, DiagnosticReport.class,
1108      DocumentReference.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1109  @Description(shortDefinition = "Why the assessment was necessary?", formalDefinition = "Resources supporting the reason the risk assessment was performed.")
1110  protected List<Reference> reasonReference;
1111  /**
1112   * The actual objects that are the target of the reference (Resources supporting
1113   * the reason the risk assessment was performed.)
1114   */
1115  protected List<Resource> reasonReferenceTarget;
1116
1117  /**
1118   * Indicates the source data considered as part of the assessment (for example,
1119   * FamilyHistory, Observations, Procedures, Conditions, etc.).
1120   */
1121  @Child(name = "basis", type = {
1122      Reference.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1123  @Description(shortDefinition = "Information used in assessment", formalDefinition = "Indicates the source data considered as part of the assessment (for example, FamilyHistory, Observations, Procedures, Conditions, etc.).")
1124  protected List<Reference> basis;
1125  /**
1126   * The actual objects that are the target of the reference (Indicates the source
1127   * data considered as part of the assessment (for example, FamilyHistory,
1128   * Observations, Procedures, Conditions, etc.).)
1129   */
1130  protected List<Resource> basisTarget;
1131
1132  /**
1133   * Describes the expected outcome for the subject.
1134   */
1135  @Child(name = "prediction", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1136  @Description(shortDefinition = "Outcome predicted", formalDefinition = "Describes the expected outcome for the subject.")
1137  protected List<RiskAssessmentPredictionComponent> prediction;
1138
1139  /**
1140   * A description of the steps that might be taken to reduce the identified
1141   * risk(s).
1142   */
1143  @Child(name = "mitigation", type = {
1144      StringType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
1145  @Description(shortDefinition = "How to reduce risk", formalDefinition = "A description of the steps that might be taken to reduce the identified risk(s).")
1146  protected StringType mitigation;
1147
1148  /**
1149   * Additional comments about the risk assessment.
1150   */
1151  @Child(name = "note", type = {
1152      Annotation.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1153  @Description(shortDefinition = "Comments on the risk assessment", formalDefinition = "Additional comments about the risk assessment.")
1154  protected List<Annotation> note;
1155
1156  private static final long serialVersionUID = -2137260218L;
1157
1158  /**
1159   * Constructor
1160   */
1161  public RiskAssessment() {
1162    super();
1163  }
1164
1165  /**
1166   * Constructor
1167   */
1168  public RiskAssessment(Enumeration<RiskAssessmentStatus> status, Reference subject) {
1169    super();
1170    this.status = status;
1171    this.subject = subject;
1172  }
1173
1174  /**
1175   * @return {@link #identifier} (Business identifier assigned to the risk
1176   *         assessment.)
1177   */
1178  public List<Identifier> getIdentifier() {
1179    if (this.identifier == null)
1180      this.identifier = new ArrayList<Identifier>();
1181    return this.identifier;
1182  }
1183
1184  /**
1185   * @return Returns a reference to <code>this</code> for easy method chaining
1186   */
1187  public RiskAssessment setIdentifier(List<Identifier> theIdentifier) {
1188    this.identifier = theIdentifier;
1189    return this;
1190  }
1191
1192  public boolean hasIdentifier() {
1193    if (this.identifier == null)
1194      return false;
1195    for (Identifier item : this.identifier)
1196      if (!item.isEmpty())
1197        return true;
1198    return false;
1199  }
1200
1201  public Identifier addIdentifier() { // 3
1202    Identifier t = new Identifier();
1203    if (this.identifier == null)
1204      this.identifier = new ArrayList<Identifier>();
1205    this.identifier.add(t);
1206    return t;
1207  }
1208
1209  public RiskAssessment addIdentifier(Identifier t) { // 3
1210    if (t == null)
1211      return this;
1212    if (this.identifier == null)
1213      this.identifier = new ArrayList<Identifier>();
1214    this.identifier.add(t);
1215    return this;
1216  }
1217
1218  /**
1219   * @return The first repetition of repeating field {@link #identifier}, creating
1220   *         it if it does not already exist
1221   */
1222  public Identifier getIdentifierFirstRep() {
1223    if (getIdentifier().isEmpty()) {
1224      addIdentifier();
1225    }
1226    return getIdentifier().get(0);
1227  }
1228
1229  /**
1230   * @return {@link #basedOn} (A reference to the request that is fulfilled by
1231   *         this risk assessment.)
1232   */
1233  public Reference getBasedOn() {
1234    if (this.basedOn == null)
1235      if (Configuration.errorOnAutoCreate())
1236        throw new Error("Attempt to auto-create RiskAssessment.basedOn");
1237      else if (Configuration.doAutoCreate())
1238        this.basedOn = new Reference(); // cc
1239    return this.basedOn;
1240  }
1241
1242  public boolean hasBasedOn() {
1243    return this.basedOn != null && !this.basedOn.isEmpty();
1244  }
1245
1246  /**
1247   * @param value {@link #basedOn} (A reference to the request that is fulfilled
1248   *              by this risk assessment.)
1249   */
1250  public RiskAssessment setBasedOn(Reference value) {
1251    this.basedOn = value;
1252    return this;
1253  }
1254
1255  /**
1256   * @return {@link #basedOn} The actual object that is the target of the
1257   *         reference. The reference library doesn't populate this, but you can
1258   *         use it to hold the resource if you resolve it. (A reference to the
1259   *         request that is fulfilled by this risk assessment.)
1260   */
1261  public Resource getBasedOnTarget() {
1262    return this.basedOnTarget;
1263  }
1264
1265  /**
1266   * @param value {@link #basedOn} The actual object that is the target of the
1267   *              reference. The reference library doesn't use these, but you can
1268   *              use it to hold the resource if you resolve it. (A reference to
1269   *              the request that is fulfilled by this risk assessment.)
1270   */
1271  public RiskAssessment setBasedOnTarget(Resource value) {
1272    this.basedOnTarget = value;
1273    return this;
1274  }
1275
1276  /**
1277   * @return {@link #parent} (A reference to a resource that this risk assessment
1278   *         is part of, such as a Procedure.)
1279   */
1280  public Reference getParent() {
1281    if (this.parent == null)
1282      if (Configuration.errorOnAutoCreate())
1283        throw new Error("Attempt to auto-create RiskAssessment.parent");
1284      else if (Configuration.doAutoCreate())
1285        this.parent = new Reference(); // cc
1286    return this.parent;
1287  }
1288
1289  public boolean hasParent() {
1290    return this.parent != null && !this.parent.isEmpty();
1291  }
1292
1293  /**
1294   * @param value {@link #parent} (A reference to a resource that this risk
1295   *              assessment is part of, such as a Procedure.)
1296   */
1297  public RiskAssessment setParent(Reference value) {
1298    this.parent = value;
1299    return this;
1300  }
1301
1302  /**
1303   * @return {@link #parent} The actual object that is the target of the
1304   *         reference. The reference library doesn't populate this, but you can
1305   *         use it to hold the resource if you resolve it. (A reference to a
1306   *         resource that this risk assessment is part of, such as a Procedure.)
1307   */
1308  public Resource getParentTarget() {
1309    return this.parentTarget;
1310  }
1311
1312  /**
1313   * @param value {@link #parent} The actual object that is the target of the
1314   *              reference. The reference library doesn't use these, but you can
1315   *              use it to hold the resource if you resolve it. (A reference to a
1316   *              resource that this risk assessment is part of, such as a
1317   *              Procedure.)
1318   */
1319  public RiskAssessment setParentTarget(Resource value) {
1320    this.parentTarget = value;
1321    return this;
1322  }
1323
1324  /**
1325   * @return {@link #status} (The status of the RiskAssessment, using the same
1326   *         statuses as an Observation.). This is the underlying object with id,
1327   *         value and extensions. The accessor "getStatus" gives direct access to
1328   *         the value
1329   */
1330  public Enumeration<RiskAssessmentStatus> getStatusElement() {
1331    if (this.status == null)
1332      if (Configuration.errorOnAutoCreate())
1333        throw new Error("Attempt to auto-create RiskAssessment.status");
1334      else if (Configuration.doAutoCreate())
1335        this.status = new Enumeration<RiskAssessmentStatus>(new RiskAssessmentStatusEnumFactory()); // bb
1336    return this.status;
1337  }
1338
1339  public boolean hasStatusElement() {
1340    return this.status != null && !this.status.isEmpty();
1341  }
1342
1343  public boolean hasStatus() {
1344    return this.status != null && !this.status.isEmpty();
1345  }
1346
1347  /**
1348   * @param value {@link #status} (The status of the RiskAssessment, using the
1349   *              same statuses as an Observation.). This is the underlying object
1350   *              with id, value and extensions. The accessor "getStatus" gives
1351   *              direct access to the value
1352   */
1353  public RiskAssessment setStatusElement(Enumeration<RiskAssessmentStatus> value) {
1354    this.status = value;
1355    return this;
1356  }
1357
1358  /**
1359   * @return The status of the RiskAssessment, using the same statuses as an
1360   *         Observation.
1361   */
1362  public RiskAssessmentStatus getStatus() {
1363    return this.status == null ? null : this.status.getValue();
1364  }
1365
1366  /**
1367   * @param value The status of the RiskAssessment, using the same statuses as an
1368   *              Observation.
1369   */
1370  public RiskAssessment setStatus(RiskAssessmentStatus value) {
1371    if (this.status == null)
1372      this.status = new Enumeration<RiskAssessmentStatus>(new RiskAssessmentStatusEnumFactory());
1373    this.status.setValue(value);
1374    return this;
1375  }
1376
1377  /**
1378   * @return {@link #method} (The algorithm, process or mechanism used to evaluate
1379   *         the risk.)
1380   */
1381  public CodeableConcept getMethod() {
1382    if (this.method == null)
1383      if (Configuration.errorOnAutoCreate())
1384        throw new Error("Attempt to auto-create RiskAssessment.method");
1385      else if (Configuration.doAutoCreate())
1386        this.method = new CodeableConcept(); // cc
1387    return this.method;
1388  }
1389
1390  public boolean hasMethod() {
1391    return this.method != null && !this.method.isEmpty();
1392  }
1393
1394  /**
1395   * @param value {@link #method} (The algorithm, process or mechanism used to
1396   *              evaluate the risk.)
1397   */
1398  public RiskAssessment setMethod(CodeableConcept value) {
1399    this.method = value;
1400    return this;
1401  }
1402
1403  /**
1404   * @return {@link #code} (The type of the risk assessment performed.)
1405   */
1406  public CodeableConcept getCode() {
1407    if (this.code == null)
1408      if (Configuration.errorOnAutoCreate())
1409        throw new Error("Attempt to auto-create RiskAssessment.code");
1410      else if (Configuration.doAutoCreate())
1411        this.code = new CodeableConcept(); // cc
1412    return this.code;
1413  }
1414
1415  public boolean hasCode() {
1416    return this.code != null && !this.code.isEmpty();
1417  }
1418
1419  /**
1420   * @param value {@link #code} (The type of the risk assessment performed.)
1421   */
1422  public RiskAssessment setCode(CodeableConcept value) {
1423    this.code = value;
1424    return this;
1425  }
1426
1427  /**
1428   * @return {@link #subject} (The patient or group the risk assessment applies
1429   *         to.)
1430   */
1431  public Reference getSubject() {
1432    if (this.subject == null)
1433      if (Configuration.errorOnAutoCreate())
1434        throw new Error("Attempt to auto-create RiskAssessment.subject");
1435      else if (Configuration.doAutoCreate())
1436        this.subject = new Reference(); // cc
1437    return this.subject;
1438  }
1439
1440  public boolean hasSubject() {
1441    return this.subject != null && !this.subject.isEmpty();
1442  }
1443
1444  /**
1445   * @param value {@link #subject} (The patient or group the risk assessment
1446   *              applies to.)
1447   */
1448  public RiskAssessment setSubject(Reference value) {
1449    this.subject = value;
1450    return this;
1451  }
1452
1453  /**
1454   * @return {@link #subject} The actual object that is the target of the
1455   *         reference. The reference library doesn't populate this, but you can
1456   *         use it to hold the resource if you resolve it. (The patient or group
1457   *         the risk assessment applies to.)
1458   */
1459  public Resource getSubjectTarget() {
1460    return this.subjectTarget;
1461  }
1462
1463  /**
1464   * @param value {@link #subject} The actual object that is the target of the
1465   *              reference. The reference library doesn't use these, but you can
1466   *              use it to hold the resource if you resolve it. (The patient or
1467   *              group the risk assessment applies to.)
1468   */
1469  public RiskAssessment setSubjectTarget(Resource value) {
1470    this.subjectTarget = value;
1471    return this;
1472  }
1473
1474  /**
1475   * @return {@link #encounter} (The encounter where the assessment was
1476   *         performed.)
1477   */
1478  public Reference getEncounter() {
1479    if (this.encounter == null)
1480      if (Configuration.errorOnAutoCreate())
1481        throw new Error("Attempt to auto-create RiskAssessment.encounter");
1482      else if (Configuration.doAutoCreate())
1483        this.encounter = new Reference(); // cc
1484    return this.encounter;
1485  }
1486
1487  public boolean hasEncounter() {
1488    return this.encounter != null && !this.encounter.isEmpty();
1489  }
1490
1491  /**
1492   * @param value {@link #encounter} (The encounter where the assessment was
1493   *              performed.)
1494   */
1495  public RiskAssessment setEncounter(Reference value) {
1496    this.encounter = value;
1497    return this;
1498  }
1499
1500  /**
1501   * @return {@link #encounter} The actual object that is the target of the
1502   *         reference. The reference library doesn't populate this, but you can
1503   *         use it to hold the resource if you resolve it. (The encounter where
1504   *         the assessment was performed.)
1505   */
1506  public Encounter getEncounterTarget() {
1507    if (this.encounterTarget == null)
1508      if (Configuration.errorOnAutoCreate())
1509        throw new Error("Attempt to auto-create RiskAssessment.encounter");
1510      else if (Configuration.doAutoCreate())
1511        this.encounterTarget = new Encounter(); // aa
1512    return this.encounterTarget;
1513  }
1514
1515  /**
1516   * @param value {@link #encounter} The actual object that is the target of the
1517   *              reference. The reference library doesn't use these, but you can
1518   *              use it to hold the resource if you resolve it. (The encounter
1519   *              where the assessment was performed.)
1520   */
1521  public RiskAssessment setEncounterTarget(Encounter value) {
1522    this.encounterTarget = value;
1523    return this;
1524  }
1525
1526  /**
1527   * @return {@link #occurrence} (The date (and possibly time) the risk assessment
1528   *         was performed.)
1529   */
1530  public Type getOccurrence() {
1531    return this.occurrence;
1532  }
1533
1534  /**
1535   * @return {@link #occurrence} (The date (and possibly time) the risk assessment
1536   *         was performed.)
1537   */
1538  public DateTimeType getOccurrenceDateTimeType() throws FHIRException {
1539    if (this.occurrence == null)
1540      this.occurrence = new DateTimeType();
1541    if (!(this.occurrence instanceof DateTimeType))
1542      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1543          + this.occurrence.getClass().getName() + " was encountered");
1544    return (DateTimeType) this.occurrence;
1545  }
1546
1547  public boolean hasOccurrenceDateTimeType() {
1548      return this.occurrence instanceof DateTimeType;
1549  }
1550
1551  /**
1552   * @return {@link #occurrence} (The date (and possibly time) the risk assessment
1553   *         was performed.)
1554   */
1555  public Period getOccurrencePeriod() throws FHIRException {
1556    if (this.occurrence == null)
1557      this.occurrence = new Period();
1558    if (!(this.occurrence instanceof Period))
1559      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.occurrence.getClass().getName()
1560          + " was encountered");
1561    return (Period) this.occurrence;
1562  }
1563
1564  public boolean hasOccurrencePeriod() {
1565      return this.occurrence instanceof Period;
1566  }
1567
1568  public boolean hasOccurrence() {
1569    return this.occurrence != null && !this.occurrence.isEmpty();
1570  }
1571
1572  /**
1573   * @param value {@link #occurrence} (The date (and possibly time) the risk
1574   *              assessment was performed.)
1575   */
1576  public RiskAssessment setOccurrence(Type value) {
1577    if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1578      throw new Error("Not the right type for RiskAssessment.occurrence[x]: " + value.fhirType());
1579    this.occurrence = value;
1580    return this;
1581  }
1582
1583  /**
1584   * @return {@link #condition} (For assessments or prognosis specific to a
1585   *         particular condition, indicates the condition being assessed.)
1586   */
1587  public Reference getCondition() {
1588    if (this.condition == null)
1589      if (Configuration.errorOnAutoCreate())
1590        throw new Error("Attempt to auto-create RiskAssessment.condition");
1591      else if (Configuration.doAutoCreate())
1592        this.condition = new Reference(); // cc
1593    return this.condition;
1594  }
1595
1596  public boolean hasCondition() {
1597    return this.condition != null && !this.condition.isEmpty();
1598  }
1599
1600  /**
1601   * @param value {@link #condition} (For assessments or prognosis specific to a
1602   *              particular condition, indicates the condition being assessed.)
1603   */
1604  public RiskAssessment setCondition(Reference value) {
1605    this.condition = value;
1606    return this;
1607  }
1608
1609  /**
1610   * @return {@link #condition} The actual object that is the target of the
1611   *         reference. The reference library doesn't populate this, but you can
1612   *         use it to hold the resource if you resolve it. (For assessments or
1613   *         prognosis specific to a particular condition, indicates the condition
1614   *         being assessed.)
1615   */
1616  public Condition getConditionTarget() {
1617    if (this.conditionTarget == null)
1618      if (Configuration.errorOnAutoCreate())
1619        throw new Error("Attempt to auto-create RiskAssessment.condition");
1620      else if (Configuration.doAutoCreate())
1621        this.conditionTarget = new Condition(); // aa
1622    return this.conditionTarget;
1623  }
1624
1625  /**
1626   * @param value {@link #condition} The actual object that is the target of the
1627   *              reference. The reference library doesn't use these, but you can
1628   *              use it to hold the resource if you resolve it. (For assessments
1629   *              or prognosis specific to a particular condition, indicates the
1630   *              condition being assessed.)
1631   */
1632  public RiskAssessment setConditionTarget(Condition value) {
1633    this.conditionTarget = value;
1634    return this;
1635  }
1636
1637  /**
1638   * @return {@link #performer} (The provider or software application that
1639   *         performed the assessment.)
1640   */
1641  public Reference getPerformer() {
1642    if (this.performer == null)
1643      if (Configuration.errorOnAutoCreate())
1644        throw new Error("Attempt to auto-create RiskAssessment.performer");
1645      else if (Configuration.doAutoCreate())
1646        this.performer = new Reference(); // cc
1647    return this.performer;
1648  }
1649
1650  public boolean hasPerformer() {
1651    return this.performer != null && !this.performer.isEmpty();
1652  }
1653
1654  /**
1655   * @param value {@link #performer} (The provider or software application that
1656   *              performed the assessment.)
1657   */
1658  public RiskAssessment setPerformer(Reference value) {
1659    this.performer = value;
1660    return this;
1661  }
1662
1663  /**
1664   * @return {@link #performer} The actual object that is the target of the
1665   *         reference. The reference library doesn't populate this, but you can
1666   *         use it to hold the resource if you resolve it. (The provider or
1667   *         software application that performed the assessment.)
1668   */
1669  public Resource getPerformerTarget() {
1670    return this.performerTarget;
1671  }
1672
1673  /**
1674   * @param value {@link #performer} The actual object that is the target of the
1675   *              reference. The reference library doesn't use these, but you can
1676   *              use it to hold the resource if you resolve it. (The provider or
1677   *              software application that performed the assessment.)
1678   */
1679  public RiskAssessment setPerformerTarget(Resource value) {
1680    this.performerTarget = value;
1681    return this;
1682  }
1683
1684  /**
1685   * @return {@link #reasonCode} (The reason the risk assessment was performed.)
1686   */
1687  public List<CodeableConcept> getReasonCode() {
1688    if (this.reasonCode == null)
1689      this.reasonCode = new ArrayList<CodeableConcept>();
1690    return this.reasonCode;
1691  }
1692
1693  /**
1694   * @return Returns a reference to <code>this</code> for easy method chaining
1695   */
1696  public RiskAssessment setReasonCode(List<CodeableConcept> theReasonCode) {
1697    this.reasonCode = theReasonCode;
1698    return this;
1699  }
1700
1701  public boolean hasReasonCode() {
1702    if (this.reasonCode == null)
1703      return false;
1704    for (CodeableConcept item : this.reasonCode)
1705      if (!item.isEmpty())
1706        return true;
1707    return false;
1708  }
1709
1710  public CodeableConcept addReasonCode() { // 3
1711    CodeableConcept t = new CodeableConcept();
1712    if (this.reasonCode == null)
1713      this.reasonCode = new ArrayList<CodeableConcept>();
1714    this.reasonCode.add(t);
1715    return t;
1716  }
1717
1718  public RiskAssessment addReasonCode(CodeableConcept t) { // 3
1719    if (t == null)
1720      return this;
1721    if (this.reasonCode == null)
1722      this.reasonCode = new ArrayList<CodeableConcept>();
1723    this.reasonCode.add(t);
1724    return this;
1725  }
1726
1727  /**
1728   * @return The first repetition of repeating field {@link #reasonCode}, creating
1729   *         it if it does not already exist
1730   */
1731  public CodeableConcept getReasonCodeFirstRep() {
1732    if (getReasonCode().isEmpty()) {
1733      addReasonCode();
1734    }
1735    return getReasonCode().get(0);
1736  }
1737
1738  /**
1739   * @return {@link #reasonReference} (Resources supporting the reason the risk
1740   *         assessment was performed.)
1741   */
1742  public List<Reference> getReasonReference() {
1743    if (this.reasonReference == null)
1744      this.reasonReference = new ArrayList<Reference>();
1745    return this.reasonReference;
1746  }
1747
1748  /**
1749   * @return Returns a reference to <code>this</code> for easy method chaining
1750   */
1751  public RiskAssessment setReasonReference(List<Reference> theReasonReference) {
1752    this.reasonReference = theReasonReference;
1753    return this;
1754  }
1755
1756  public boolean hasReasonReference() {
1757    if (this.reasonReference == null)
1758      return false;
1759    for (Reference item : this.reasonReference)
1760      if (!item.isEmpty())
1761        return true;
1762    return false;
1763  }
1764
1765  public Reference addReasonReference() { // 3
1766    Reference t = new Reference();
1767    if (this.reasonReference == null)
1768      this.reasonReference = new ArrayList<Reference>();
1769    this.reasonReference.add(t);
1770    return t;
1771  }
1772
1773  public RiskAssessment addReasonReference(Reference t) { // 3
1774    if (t == null)
1775      return this;
1776    if (this.reasonReference == null)
1777      this.reasonReference = new ArrayList<Reference>();
1778    this.reasonReference.add(t);
1779    return this;
1780  }
1781
1782  /**
1783   * @return The first repetition of repeating field {@link #reasonReference},
1784   *         creating it if it does not already exist
1785   */
1786  public Reference getReasonReferenceFirstRep() {
1787    if (getReasonReference().isEmpty()) {
1788      addReasonReference();
1789    }
1790    return getReasonReference().get(0);
1791  }
1792
1793  /**
1794   * @return {@link #basis} (Indicates the source data considered as part of the
1795   *         assessment (for example, FamilyHistory, Observations, Procedures,
1796   *         Conditions, etc.).)
1797   */
1798  public List<Reference> getBasis() {
1799    if (this.basis == null)
1800      this.basis = new ArrayList<Reference>();
1801    return this.basis;
1802  }
1803
1804  /**
1805   * @return Returns a reference to <code>this</code> for easy method chaining
1806   */
1807  public RiskAssessment setBasis(List<Reference> theBasis) {
1808    this.basis = theBasis;
1809    return this;
1810  }
1811
1812  public boolean hasBasis() {
1813    if (this.basis == null)
1814      return false;
1815    for (Reference item : this.basis)
1816      if (!item.isEmpty())
1817        return true;
1818    return false;
1819  }
1820
1821  public Reference addBasis() { // 3
1822    Reference t = new Reference();
1823    if (this.basis == null)
1824      this.basis = new ArrayList<Reference>();
1825    this.basis.add(t);
1826    return t;
1827  }
1828
1829  public RiskAssessment addBasis(Reference t) { // 3
1830    if (t == null)
1831      return this;
1832    if (this.basis == null)
1833      this.basis = new ArrayList<Reference>();
1834    this.basis.add(t);
1835    return this;
1836  }
1837
1838  /**
1839   * @return The first repetition of repeating field {@link #basis}, creating it
1840   *         if it does not already exist
1841   */
1842  public Reference getBasisFirstRep() {
1843    if (getBasis().isEmpty()) {
1844      addBasis();
1845    }
1846    return getBasis().get(0);
1847  }
1848
1849  /**
1850   * @return {@link #prediction} (Describes the expected outcome for the subject.)
1851   */
1852  public List<RiskAssessmentPredictionComponent> getPrediction() {
1853    if (this.prediction == null)
1854      this.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1855    return this.prediction;
1856  }
1857
1858  /**
1859   * @return Returns a reference to <code>this</code> for easy method chaining
1860   */
1861  public RiskAssessment setPrediction(List<RiskAssessmentPredictionComponent> thePrediction) {
1862    this.prediction = thePrediction;
1863    return this;
1864  }
1865
1866  public boolean hasPrediction() {
1867    if (this.prediction == null)
1868      return false;
1869    for (RiskAssessmentPredictionComponent item : this.prediction)
1870      if (!item.isEmpty())
1871        return true;
1872    return false;
1873  }
1874
1875  public RiskAssessmentPredictionComponent addPrediction() { // 3
1876    RiskAssessmentPredictionComponent t = new RiskAssessmentPredictionComponent();
1877    if (this.prediction == null)
1878      this.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1879    this.prediction.add(t);
1880    return t;
1881  }
1882
1883  public RiskAssessment addPrediction(RiskAssessmentPredictionComponent t) { // 3
1884    if (t == null)
1885      return this;
1886    if (this.prediction == null)
1887      this.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1888    this.prediction.add(t);
1889    return this;
1890  }
1891
1892  /**
1893   * @return The first repetition of repeating field {@link #prediction}, creating
1894   *         it if it does not already exist
1895   */
1896  public RiskAssessmentPredictionComponent getPredictionFirstRep() {
1897    if (getPrediction().isEmpty()) {
1898      addPrediction();
1899    }
1900    return getPrediction().get(0);
1901  }
1902
1903  /**
1904   * @return {@link #mitigation} (A description of the steps that might be taken
1905   *         to reduce the identified risk(s).). This is the underlying object
1906   *         with id, value and extensions. The accessor "getMitigation" gives
1907   *         direct access to the value
1908   */
1909  public StringType getMitigationElement() {
1910    if (this.mitigation == null)
1911      if (Configuration.errorOnAutoCreate())
1912        throw new Error("Attempt to auto-create RiskAssessment.mitigation");
1913      else if (Configuration.doAutoCreate())
1914        this.mitigation = new StringType(); // bb
1915    return this.mitigation;
1916  }
1917
1918  public boolean hasMitigationElement() {
1919    return this.mitigation != null && !this.mitigation.isEmpty();
1920  }
1921
1922  public boolean hasMitigation() {
1923    return this.mitigation != null && !this.mitigation.isEmpty();
1924  }
1925
1926  /**
1927   * @param value {@link #mitigation} (A description of the steps that might be
1928   *              taken to reduce the identified risk(s).). This is the underlying
1929   *              object with id, value and extensions. The accessor
1930   *              "getMitigation" gives direct access to the value
1931   */
1932  public RiskAssessment setMitigationElement(StringType value) {
1933    this.mitigation = value;
1934    return this;
1935  }
1936
1937  /**
1938   * @return A description of the steps that might be taken to reduce the
1939   *         identified risk(s).
1940   */
1941  public String getMitigation() {
1942    return this.mitigation == null ? null : this.mitigation.getValue();
1943  }
1944
1945  /**
1946   * @param value A description of the steps that might be taken to reduce the
1947   *              identified risk(s).
1948   */
1949  public RiskAssessment setMitigation(String value) {
1950    if (Utilities.noString(value))
1951      this.mitigation = null;
1952    else {
1953      if (this.mitigation == null)
1954        this.mitigation = new StringType();
1955      this.mitigation.setValue(value);
1956    }
1957    return this;
1958  }
1959
1960  /**
1961   * @return {@link #note} (Additional comments about the risk assessment.)
1962   */
1963  public List<Annotation> getNote() {
1964    if (this.note == null)
1965      this.note = new ArrayList<Annotation>();
1966    return this.note;
1967  }
1968
1969  /**
1970   * @return Returns a reference to <code>this</code> for easy method chaining
1971   */
1972  public RiskAssessment setNote(List<Annotation> theNote) {
1973    this.note = theNote;
1974    return this;
1975  }
1976
1977  public boolean hasNote() {
1978    if (this.note == null)
1979      return false;
1980    for (Annotation item : this.note)
1981      if (!item.isEmpty())
1982        return true;
1983    return false;
1984  }
1985
1986  public Annotation addNote() { // 3
1987    Annotation t = new Annotation();
1988    if (this.note == null)
1989      this.note = new ArrayList<Annotation>();
1990    this.note.add(t);
1991    return t;
1992  }
1993
1994  public RiskAssessment addNote(Annotation t) { // 3
1995    if (t == null)
1996      return this;
1997    if (this.note == null)
1998      this.note = new ArrayList<Annotation>();
1999    this.note.add(t);
2000    return this;
2001  }
2002
2003  /**
2004   * @return The first repetition of repeating field {@link #note}, creating it if
2005   *         it does not already exist
2006   */
2007  public Annotation getNoteFirstRep() {
2008    if (getNote().isEmpty()) {
2009      addNote();
2010    }
2011    return getNote().get(0);
2012  }
2013
2014  protected void listChildren(List<Property> children) {
2015    super.listChildren(children);
2016    children.add(new Property("identifier", "Identifier", "Business identifier assigned to the risk assessment.", 0,
2017        java.lang.Integer.MAX_VALUE, identifier));
2018    children.add(new Property("basedOn", "Reference(Any)",
2019        "A reference to the request that is fulfilled by this risk assessment.", 0, 1, basedOn));
2020    children.add(new Property("parent", "Reference(Any)",
2021        "A reference to a resource that this risk assessment is part of, such as a Procedure.", 0, 1, parent));
2022    children.add(new Property("status", "code",
2023        "The status of the RiskAssessment, using the same statuses as an Observation.", 0, 1, status));
2024    children.add(new Property("method", "CodeableConcept",
2025        "The algorithm, process or mechanism used to evaluate the risk.", 0, 1, method));
2026    children.add(new Property("code", "CodeableConcept", "The type of the risk assessment performed.", 0, 1, code));
2027    children.add(new Property("subject", "Reference(Patient|Group)",
2028        "The patient or group the risk assessment applies to.", 0, 1, subject));
2029    children.add(new Property("encounter", "Reference(Encounter)", "The encounter where the assessment was performed.",
2030        0, 1, encounter));
2031    children.add(new Property("occurrence[x]", "dateTime|Period",
2032        "The date (and possibly time) the risk assessment was performed.", 0, 1, occurrence));
2033    children.add(new Property("condition", "Reference(Condition)",
2034        "For assessments or prognosis specific to a particular condition, indicates the condition being assessed.", 0,
2035        1, condition));
2036    children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Device)",
2037        "The provider or software application that performed the assessment.", 0, 1, performer));
2038    children.add(new Property("reasonCode", "CodeableConcept", "The reason the risk assessment was performed.", 0,
2039        java.lang.Integer.MAX_VALUE, reasonCode));
2040    children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)",
2041        "Resources supporting the reason the risk assessment was performed.", 0, java.lang.Integer.MAX_VALUE,
2042        reasonReference));
2043    children.add(new Property("basis", "Reference(Any)",
2044        "Indicates the source data considered as part of the assessment (for example, FamilyHistory, Observations, Procedures, Conditions, etc.).",
2045        0, java.lang.Integer.MAX_VALUE, basis));
2046    children.add(new Property("prediction", "", "Describes the expected outcome for the subject.", 0,
2047        java.lang.Integer.MAX_VALUE, prediction));
2048    children.add(new Property("mitigation", "string",
2049        "A description of the steps that might be taken to reduce the identified risk(s).", 0, 1, mitigation));
2050    children.add(new Property("note", "Annotation", "Additional comments about the risk assessment.", 0,
2051        java.lang.Integer.MAX_VALUE, note));
2052  }
2053
2054  @Override
2055  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2056    switch (_hash) {
2057    case -1618432855:
2058      /* identifier */ return new Property("identifier", "Identifier",
2059          "Business identifier assigned to the risk assessment.", 0, java.lang.Integer.MAX_VALUE, identifier);
2060    case -332612366:
2061      /* basedOn */ return new Property("basedOn", "Reference(Any)",
2062          "A reference to the request that is fulfilled by this risk assessment.", 0, 1, basedOn);
2063    case -995424086:
2064      /* parent */ return new Property("parent", "Reference(Any)",
2065          "A reference to a resource that this risk assessment is part of, such as a Procedure.", 0, 1, parent);
2066    case -892481550:
2067      /* status */ return new Property("status", "code",
2068          "The status of the RiskAssessment, using the same statuses as an Observation.", 0, 1, status);
2069    case -1077554975:
2070      /* method */ return new Property("method", "CodeableConcept",
2071          "The algorithm, process or mechanism used to evaluate the risk.", 0, 1, method);
2072    case 3059181:
2073      /* code */ return new Property("code", "CodeableConcept", "The type of the risk assessment performed.", 0, 1,
2074          code);
2075    case -1867885268:
2076      /* subject */ return new Property("subject", "Reference(Patient|Group)",
2077          "The patient or group the risk assessment applies to.", 0, 1, subject);
2078    case 1524132147:
2079      /* encounter */ return new Property("encounter", "Reference(Encounter)",
2080          "The encounter where the assessment was performed.", 0, 1, encounter);
2081    case -2022646513:
2082      /* occurrence[x] */ return new Property("occurrence[x]", "dateTime|Period",
2083          "The date (and possibly time) the risk assessment was performed.", 0, 1, occurrence);
2084    case 1687874001:
2085      /* occurrence */ return new Property("occurrence[x]", "dateTime|Period",
2086          "The date (and possibly time) the risk assessment was performed.", 0, 1, occurrence);
2087    case -298443636:
2088      /* occurrenceDateTime */ return new Property("occurrence[x]", "dateTime|Period",
2089          "The date (and possibly time) the risk assessment was performed.", 0, 1, occurrence);
2090    case 1397156594:
2091      /* occurrencePeriod */ return new Property("occurrence[x]", "dateTime|Period",
2092          "The date (and possibly time) the risk assessment was performed.", 0, 1, occurrence);
2093    case -861311717:
2094      /* condition */ return new Property("condition", "Reference(Condition)",
2095          "For assessments or prognosis specific to a particular condition, indicates the condition being assessed.", 0,
2096          1, condition);
2097    case 481140686:
2098      /* performer */ return new Property("performer", "Reference(Practitioner|PractitionerRole|Device)",
2099          "The provider or software application that performed the assessment.", 0, 1, performer);
2100    case 722137681:
2101      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
2102          "The reason the risk assessment was performed.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2103    case -1146218137:
2104      /* reasonReference */ return new Property("reasonReference",
2105          "Reference(Condition|Observation|DiagnosticReport|DocumentReference)",
2106          "Resources supporting the reason the risk assessment was performed.", 0, java.lang.Integer.MAX_VALUE,
2107          reasonReference);
2108    case 93508670:
2109      /* basis */ return new Property("basis", "Reference(Any)",
2110          "Indicates the source data considered as part of the assessment (for example, FamilyHistory, Observations, Procedures, Conditions, etc.).",
2111          0, java.lang.Integer.MAX_VALUE, basis);
2112    case 1161234575:
2113      /* prediction */ return new Property("prediction", "", "Describes the expected outcome for the subject.", 0,
2114          java.lang.Integer.MAX_VALUE, prediction);
2115    case 1293793087:
2116      /* mitigation */ return new Property("mitigation", "string",
2117          "A description of the steps that might be taken to reduce the identified risk(s).", 0, 1, mitigation);
2118    case 3387378:
2119      /* note */ return new Property("note", "Annotation", "Additional comments about the risk assessment.", 0,
2120          java.lang.Integer.MAX_VALUE, note);
2121    default:
2122      return super.getNamedProperty(_hash, _name, _checkValid);
2123    }
2124
2125  }
2126
2127  @Override
2128  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2129    switch (hash) {
2130    case -1618432855:
2131      /* identifier */ return this.identifier == null ? new Base[0]
2132          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2133    case -332612366:
2134      /* basedOn */ return this.basedOn == null ? new Base[0] : new Base[] { this.basedOn }; // Reference
2135    case -995424086:
2136      /* parent */ return this.parent == null ? new Base[0] : new Base[] { this.parent }; // Reference
2137    case -892481550:
2138      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<RiskAssessmentStatus>
2139    case -1077554975:
2140      /* method */ return this.method == null ? new Base[0] : new Base[] { this.method }; // CodeableConcept
2141    case 3059181:
2142      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2143    case -1867885268:
2144      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2145    case 1524132147:
2146      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
2147    case 1687874001:
2148      /* occurrence */ return this.occurrence == null ? new Base[0] : new Base[] { this.occurrence }; // Type
2149    case -861311717:
2150      /* condition */ return this.condition == null ? new Base[0] : new Base[] { this.condition }; // Reference
2151    case 481140686:
2152      /* performer */ return this.performer == null ? new Base[0] : new Base[] { this.performer }; // Reference
2153    case 722137681:
2154      /* reasonCode */ return this.reasonCode == null ? new Base[0]
2155          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2156    case -1146218137:
2157      /* reasonReference */ return this.reasonReference == null ? new Base[0]
2158          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2159    case 93508670:
2160      /* basis */ return this.basis == null ? new Base[0] : this.basis.toArray(new Base[this.basis.size()]); // Reference
2161    case 1161234575:
2162      /* prediction */ return this.prediction == null ? new Base[0]
2163          : this.prediction.toArray(new Base[this.prediction.size()]); // RiskAssessmentPredictionComponent
2164    case 1293793087:
2165      /* mitigation */ return this.mitigation == null ? new Base[0] : new Base[] { this.mitigation }; // StringType
2166    case 3387378:
2167      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2168    default:
2169      return super.getProperty(hash, name, checkValid);
2170    }
2171
2172  }
2173
2174  @Override
2175  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2176    switch (hash) {
2177    case -1618432855: // identifier
2178      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2179      return value;
2180    case -332612366: // basedOn
2181      this.basedOn = castToReference(value); // Reference
2182      return value;
2183    case -995424086: // parent
2184      this.parent = castToReference(value); // Reference
2185      return value;
2186    case -892481550: // status
2187      value = new RiskAssessmentStatusEnumFactory().fromType(castToCode(value));
2188      this.status = (Enumeration) value; // Enumeration<RiskAssessmentStatus>
2189      return value;
2190    case -1077554975: // method
2191      this.method = castToCodeableConcept(value); // CodeableConcept
2192      return value;
2193    case 3059181: // code
2194      this.code = castToCodeableConcept(value); // CodeableConcept
2195      return value;
2196    case -1867885268: // subject
2197      this.subject = castToReference(value); // Reference
2198      return value;
2199    case 1524132147: // encounter
2200      this.encounter = castToReference(value); // Reference
2201      return value;
2202    case 1687874001: // occurrence
2203      this.occurrence = castToType(value); // Type
2204      return value;
2205    case -861311717: // condition
2206      this.condition = castToReference(value); // Reference
2207      return value;
2208    case 481140686: // performer
2209      this.performer = castToReference(value); // Reference
2210      return value;
2211    case 722137681: // reasonCode
2212      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2213      return value;
2214    case -1146218137: // reasonReference
2215      this.getReasonReference().add(castToReference(value)); // Reference
2216      return value;
2217    case 93508670: // basis
2218      this.getBasis().add(castToReference(value)); // Reference
2219      return value;
2220    case 1161234575: // prediction
2221      this.getPrediction().add((RiskAssessmentPredictionComponent) value); // RiskAssessmentPredictionComponent
2222      return value;
2223    case 1293793087: // mitigation
2224      this.mitigation = castToString(value); // StringType
2225      return value;
2226    case 3387378: // note
2227      this.getNote().add(castToAnnotation(value)); // Annotation
2228      return value;
2229    default:
2230      return super.setProperty(hash, name, value);
2231    }
2232
2233  }
2234
2235  @Override
2236  public Base setProperty(String name, Base value) throws FHIRException {
2237    if (name.equals("identifier")) {
2238      this.getIdentifier().add(castToIdentifier(value));
2239    } else if (name.equals("basedOn")) {
2240      this.basedOn = castToReference(value); // Reference
2241    } else if (name.equals("parent")) {
2242      this.parent = castToReference(value); // Reference
2243    } else if (name.equals("status")) {
2244      value = new RiskAssessmentStatusEnumFactory().fromType(castToCode(value));
2245      this.status = (Enumeration) value; // Enumeration<RiskAssessmentStatus>
2246    } else if (name.equals("method")) {
2247      this.method = castToCodeableConcept(value); // CodeableConcept
2248    } else if (name.equals("code")) {
2249      this.code = castToCodeableConcept(value); // CodeableConcept
2250    } else if (name.equals("subject")) {
2251      this.subject = castToReference(value); // Reference
2252    } else if (name.equals("encounter")) {
2253      this.encounter = castToReference(value); // Reference
2254    } else if (name.equals("occurrence[x]")) {
2255      this.occurrence = castToType(value); // Type
2256    } else if (name.equals("condition")) {
2257      this.condition = castToReference(value); // Reference
2258    } else if (name.equals("performer")) {
2259      this.performer = castToReference(value); // Reference
2260    } else if (name.equals("reasonCode")) {
2261      this.getReasonCode().add(castToCodeableConcept(value));
2262    } else if (name.equals("reasonReference")) {
2263      this.getReasonReference().add(castToReference(value));
2264    } else if (name.equals("basis")) {
2265      this.getBasis().add(castToReference(value));
2266    } else if (name.equals("prediction")) {
2267      this.getPrediction().add((RiskAssessmentPredictionComponent) value);
2268    } else if (name.equals("mitigation")) {
2269      this.mitigation = castToString(value); // StringType
2270    } else if (name.equals("note")) {
2271      this.getNote().add(castToAnnotation(value));
2272    } else
2273      return super.setProperty(name, value);
2274    return value;
2275  }
2276
2277  @Override
2278  public void removeChild(String name, Base value) throws FHIRException {
2279    if (name.equals("identifier")) {
2280      this.getIdentifier().remove(castToIdentifier(value));
2281    } else if (name.equals("basedOn")) {
2282      this.basedOn = null;
2283    } else if (name.equals("parent")) {
2284      this.parent = null;
2285    } else if (name.equals("status")) {
2286      this.status = null;
2287    } else if (name.equals("method")) {
2288      this.method = null;
2289    } else if (name.equals("code")) {
2290      this.code = null;
2291    } else if (name.equals("subject")) {
2292      this.subject = null;
2293    } else if (name.equals("encounter")) {
2294      this.encounter = null;
2295    } else if (name.equals("occurrence[x]")) {
2296      this.occurrence = null;
2297    } else if (name.equals("condition")) {
2298      this.condition = null;
2299    } else if (name.equals("performer")) {
2300      this.performer = null;
2301    } else if (name.equals("reasonCode")) {
2302      this.getReasonCode().remove(castToCodeableConcept(value));
2303    } else if (name.equals("reasonReference")) {
2304      this.getReasonReference().remove(castToReference(value));
2305    } else if (name.equals("basis")) {
2306      this.getBasis().remove(castToReference(value));
2307    } else if (name.equals("prediction")) {
2308      this.getPrediction().remove((RiskAssessmentPredictionComponent) value);
2309    } else if (name.equals("mitigation")) {
2310      this.mitigation = null;
2311    } else if (name.equals("note")) {
2312      this.getNote().remove(castToAnnotation(value));
2313    } else
2314      super.removeChild(name, value);
2315    
2316  }
2317
2318  @Override
2319  public Base makeProperty(int hash, String name) throws FHIRException {
2320    switch (hash) {
2321    case -1618432855:
2322      return addIdentifier();
2323    case -332612366:
2324      return getBasedOn();
2325    case -995424086:
2326      return getParent();
2327    case -892481550:
2328      return getStatusElement();
2329    case -1077554975:
2330      return getMethod();
2331    case 3059181:
2332      return getCode();
2333    case -1867885268:
2334      return getSubject();
2335    case 1524132147:
2336      return getEncounter();
2337    case -2022646513:
2338      return getOccurrence();
2339    case 1687874001:
2340      return getOccurrence();
2341    case -861311717:
2342      return getCondition();
2343    case 481140686:
2344      return getPerformer();
2345    case 722137681:
2346      return addReasonCode();
2347    case -1146218137:
2348      return addReasonReference();
2349    case 93508670:
2350      return addBasis();
2351    case 1161234575:
2352      return addPrediction();
2353    case 1293793087:
2354      return getMitigationElement();
2355    case 3387378:
2356      return addNote();
2357    default:
2358      return super.makeProperty(hash, name);
2359    }
2360
2361  }
2362
2363  @Override
2364  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2365    switch (hash) {
2366    case -1618432855:
2367      /* identifier */ return new String[] { "Identifier" };
2368    case -332612366:
2369      /* basedOn */ return new String[] { "Reference" };
2370    case -995424086:
2371      /* parent */ return new String[] { "Reference" };
2372    case -892481550:
2373      /* status */ return new String[] { "code" };
2374    case -1077554975:
2375      /* method */ return new String[] { "CodeableConcept" };
2376    case 3059181:
2377      /* code */ return new String[] { "CodeableConcept" };
2378    case -1867885268:
2379      /* subject */ return new String[] { "Reference" };
2380    case 1524132147:
2381      /* encounter */ return new String[] { "Reference" };
2382    case 1687874001:
2383      /* occurrence */ return new String[] { "dateTime", "Period" };
2384    case -861311717:
2385      /* condition */ return new String[] { "Reference" };
2386    case 481140686:
2387      /* performer */ return new String[] { "Reference" };
2388    case 722137681:
2389      /* reasonCode */ return new String[] { "CodeableConcept" };
2390    case -1146218137:
2391      /* reasonReference */ return new String[] { "Reference" };
2392    case 93508670:
2393      /* basis */ return new String[] { "Reference" };
2394    case 1161234575:
2395      /* prediction */ return new String[] {};
2396    case 1293793087:
2397      /* mitigation */ return new String[] { "string" };
2398    case 3387378:
2399      /* note */ return new String[] { "Annotation" };
2400    default:
2401      return super.getTypesForProperty(hash, name);
2402    }
2403
2404  }
2405
2406  @Override
2407  public Base addChild(String name) throws FHIRException {
2408    if (name.equals("identifier")) {
2409      return addIdentifier();
2410    } else if (name.equals("basedOn")) {
2411      this.basedOn = new Reference();
2412      return this.basedOn;
2413    } else if (name.equals("parent")) {
2414      this.parent = new Reference();
2415      return this.parent;
2416    } else if (name.equals("status")) {
2417      throw new FHIRException("Cannot call addChild on a singleton property RiskAssessment.status");
2418    } else if (name.equals("method")) {
2419      this.method = new CodeableConcept();
2420      return this.method;
2421    } else if (name.equals("code")) {
2422      this.code = new CodeableConcept();
2423      return this.code;
2424    } else if (name.equals("subject")) {
2425      this.subject = new Reference();
2426      return this.subject;
2427    } else if (name.equals("encounter")) {
2428      this.encounter = new Reference();
2429      return this.encounter;
2430    } else if (name.equals("occurrenceDateTime")) {
2431      this.occurrence = new DateTimeType();
2432      return this.occurrence;
2433    } else if (name.equals("occurrencePeriod")) {
2434      this.occurrence = new Period();
2435      return this.occurrence;
2436    } else if (name.equals("condition")) {
2437      this.condition = new Reference();
2438      return this.condition;
2439    } else if (name.equals("performer")) {
2440      this.performer = new Reference();
2441      return this.performer;
2442    } else if (name.equals("reasonCode")) {
2443      return addReasonCode();
2444    } else if (name.equals("reasonReference")) {
2445      return addReasonReference();
2446    } else if (name.equals("basis")) {
2447      return addBasis();
2448    } else if (name.equals("prediction")) {
2449      return addPrediction();
2450    } else if (name.equals("mitigation")) {
2451      throw new FHIRException("Cannot call addChild on a singleton property RiskAssessment.mitigation");
2452    } else if (name.equals("note")) {
2453      return addNote();
2454    } else
2455      return super.addChild(name);
2456  }
2457
2458  public String fhirType() {
2459    return "RiskAssessment";
2460
2461  }
2462
2463  public RiskAssessment copy() {
2464    RiskAssessment dst = new RiskAssessment();
2465    copyValues(dst);
2466    return dst;
2467  }
2468
2469  public void copyValues(RiskAssessment dst) {
2470    super.copyValues(dst);
2471    if (identifier != null) {
2472      dst.identifier = new ArrayList<Identifier>();
2473      for (Identifier i : identifier)
2474        dst.identifier.add(i.copy());
2475    }
2476    ;
2477    dst.basedOn = basedOn == null ? null : basedOn.copy();
2478    dst.parent = parent == null ? null : parent.copy();
2479    dst.status = status == null ? null : status.copy();
2480    dst.method = method == null ? null : method.copy();
2481    dst.code = code == null ? null : code.copy();
2482    dst.subject = subject == null ? null : subject.copy();
2483    dst.encounter = encounter == null ? null : encounter.copy();
2484    dst.occurrence = occurrence == null ? null : occurrence.copy();
2485    dst.condition = condition == null ? null : condition.copy();
2486    dst.performer = performer == null ? null : performer.copy();
2487    if (reasonCode != null) {
2488      dst.reasonCode = new ArrayList<CodeableConcept>();
2489      for (CodeableConcept i : reasonCode)
2490        dst.reasonCode.add(i.copy());
2491    }
2492    ;
2493    if (reasonReference != null) {
2494      dst.reasonReference = new ArrayList<Reference>();
2495      for (Reference i : reasonReference)
2496        dst.reasonReference.add(i.copy());
2497    }
2498    ;
2499    if (basis != null) {
2500      dst.basis = new ArrayList<Reference>();
2501      for (Reference i : basis)
2502        dst.basis.add(i.copy());
2503    }
2504    ;
2505    if (prediction != null) {
2506      dst.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
2507      for (RiskAssessmentPredictionComponent i : prediction)
2508        dst.prediction.add(i.copy());
2509    }
2510    ;
2511    dst.mitigation = mitigation == null ? null : mitigation.copy();
2512    if (note != null) {
2513      dst.note = new ArrayList<Annotation>();
2514      for (Annotation i : note)
2515        dst.note.add(i.copy());
2516    }
2517    ;
2518  }
2519
2520  protected RiskAssessment typedCopy() {
2521    return copy();
2522  }
2523
2524  @Override
2525  public boolean equalsDeep(Base other_) {
2526    if (!super.equalsDeep(other_))
2527      return false;
2528    if (!(other_ instanceof RiskAssessment))
2529      return false;
2530    RiskAssessment o = (RiskAssessment) other_;
2531    return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true)
2532        && compareDeep(parent, o.parent, true) && compareDeep(status, o.status, true)
2533        && compareDeep(method, o.method, true) && compareDeep(code, o.code, true)
2534        && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
2535        && compareDeep(occurrence, o.occurrence, true) && compareDeep(condition, o.condition, true)
2536        && compareDeep(performer, o.performer, true) && compareDeep(reasonCode, o.reasonCode, true)
2537        && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(basis, o.basis, true)
2538        && compareDeep(prediction, o.prediction, true) && compareDeep(mitigation, o.mitigation, true)
2539        && compareDeep(note, o.note, true);
2540  }
2541
2542  @Override
2543  public boolean equalsShallow(Base other_) {
2544    if (!super.equalsShallow(other_))
2545      return false;
2546    if (!(other_ instanceof RiskAssessment))
2547      return false;
2548    RiskAssessment o = (RiskAssessment) other_;
2549    return compareValues(status, o.status, true) && compareValues(mitigation, o.mitigation, true);
2550  }
2551
2552  public boolean isEmpty() {
2553    return super.isEmpty()
2554        && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, parent, status, method, code, subject, encounter,
2555            occurrence, condition, performer, reasonCode, reasonReference, basis, prediction, mitigation, note);
2556  }
2557
2558  @Override
2559  public ResourceType getResourceType() {
2560    return ResourceType.RiskAssessment;
2561  }
2562
2563  /**
2564   * Search parameter: <b>date</b>
2565   * <p>
2566   * Description: <b>When was assessment made?</b><br>
2567   * Type: <b>date</b><br>
2568   * Path: <b>RiskAssessment.occurrenceDateTime</b><br>
2569   * </p>
2570   */
2571  @SearchParamDefinition(name = "date", path = "(RiskAssessment.occurrence as dateTime)", description = "When was assessment made?", type = "date")
2572  public static final String SP_DATE = "date";
2573  /**
2574   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2575   * <p>
2576   * Description: <b>When was assessment made?</b><br>
2577   * Type: <b>date</b><br>
2578   * Path: <b>RiskAssessment.occurrenceDateTime</b><br>
2579   * </p>
2580   */
2581  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2582      SP_DATE);
2583
2584  /**
2585   * Search parameter: <b>identifier</b>
2586   * <p>
2587   * Description: <b>Unique identifier for the assessment</b><br>
2588   * Type: <b>token</b><br>
2589   * Path: <b>RiskAssessment.identifier</b><br>
2590   * </p>
2591   */
2592  @SearchParamDefinition(name = "identifier", path = "RiskAssessment.identifier", description = "Unique identifier for the assessment", type = "token")
2593  public static final String SP_IDENTIFIER = "identifier";
2594  /**
2595   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2596   * <p>
2597   * Description: <b>Unique identifier for the assessment</b><br>
2598   * Type: <b>token</b><br>
2599   * Path: <b>RiskAssessment.identifier</b><br>
2600   * </p>
2601   */
2602  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2603      SP_IDENTIFIER);
2604
2605  /**
2606   * Search parameter: <b>condition</b>
2607   * <p>
2608   * Description: <b>Condition assessed</b><br>
2609   * Type: <b>reference</b><br>
2610   * Path: <b>RiskAssessment.condition</b><br>
2611   * </p>
2612   */
2613  @SearchParamDefinition(name = "condition", path = "RiskAssessment.condition", description = "Condition assessed", type = "reference", target = {
2614      Condition.class })
2615  public static final String SP_CONDITION = "condition";
2616  /**
2617   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
2618   * <p>
2619   * Description: <b>Condition assessed</b><br>
2620   * Type: <b>reference</b><br>
2621   * Path: <b>RiskAssessment.condition</b><br>
2622   * </p>
2623   */
2624  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2625      SP_CONDITION);
2626
2627  /**
2628   * Constant for fluent queries to be used to add include statements. Specifies
2629   * the path value of "<b>RiskAssessment:condition</b>".
2630   */
2631  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include(
2632      "RiskAssessment:condition").toLocked();
2633
2634  /**
2635   * Search parameter: <b>performer</b>
2636   * <p>
2637   * Description: <b>Who did assessment?</b><br>
2638   * Type: <b>reference</b><br>
2639   * Path: <b>RiskAssessment.performer</b><br>
2640   * </p>
2641   */
2642  @SearchParamDefinition(name = "performer", path = "RiskAssessment.performer", description = "Who did assessment?", type = "reference", providesMembershipIn = {
2643      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
2644      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class,
2645          Practitioner.class, PractitionerRole.class })
2646  public static final String SP_PERFORMER = "performer";
2647  /**
2648   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2649   * <p>
2650   * Description: <b>Who did assessment?</b><br>
2651   * Type: <b>reference</b><br>
2652   * Path: <b>RiskAssessment.performer</b><br>
2653   * </p>
2654   */
2655  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2656      SP_PERFORMER);
2657
2658  /**
2659   * Constant for fluent queries to be used to add include statements. Specifies
2660   * the path value of "<b>RiskAssessment:performer</b>".
2661   */
2662  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include(
2663      "RiskAssessment:performer").toLocked();
2664
2665  /**
2666   * Search parameter: <b>method</b>
2667   * <p>
2668   * Description: <b>Evaluation mechanism</b><br>
2669   * Type: <b>token</b><br>
2670   * Path: <b>RiskAssessment.method</b><br>
2671   * </p>
2672   */
2673  @SearchParamDefinition(name = "method", path = "RiskAssessment.method", description = "Evaluation mechanism", type = "token")
2674  public static final String SP_METHOD = "method";
2675  /**
2676   * <b>Fluent Client</b> search parameter constant for <b>method</b>
2677   * <p>
2678   * Description: <b>Evaluation mechanism</b><br>
2679   * Type: <b>token</b><br>
2680   * Path: <b>RiskAssessment.method</b><br>
2681   * </p>
2682   */
2683  public static final ca.uhn.fhir.rest.gclient.TokenClientParam METHOD = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2684      SP_METHOD);
2685
2686  /**
2687   * Search parameter: <b>subject</b>
2688   * <p>
2689   * Description: <b>Who/what does assessment apply to?</b><br>
2690   * Type: <b>reference</b><br>
2691   * Path: <b>RiskAssessment.subject</b><br>
2692   * </p>
2693   */
2694  @SearchParamDefinition(name = "subject", path = "RiskAssessment.subject", description = "Who/what does assessment apply to?", type = "reference", providesMembershipIn = {
2695      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Group.class, Patient.class })
2696  public static final String SP_SUBJECT = "subject";
2697  /**
2698   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2699   * <p>
2700   * Description: <b>Who/what does assessment apply to?</b><br>
2701   * Type: <b>reference</b><br>
2702   * Path: <b>RiskAssessment.subject</b><br>
2703   * </p>
2704   */
2705  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2706      SP_SUBJECT);
2707
2708  /**
2709   * Constant for fluent queries to be used to add include statements. Specifies
2710   * the path value of "<b>RiskAssessment:subject</b>".
2711   */
2712  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
2713      "RiskAssessment:subject").toLocked();
2714
2715  /**
2716   * Search parameter: <b>patient</b>
2717   * <p>
2718   * Description: <b>Who/what does assessment apply to?</b><br>
2719   * Type: <b>reference</b><br>
2720   * Path: <b>RiskAssessment.subject</b><br>
2721   * </p>
2722   */
2723  @SearchParamDefinition(name = "patient", path = "RiskAssessment.subject.where(resolve() is Patient)", description = "Who/what does assessment apply to?", type = "reference", target = {
2724      Patient.class })
2725  public static final String SP_PATIENT = "patient";
2726  /**
2727   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2728   * <p>
2729   * Description: <b>Who/what does assessment apply to?</b><br>
2730   * Type: <b>reference</b><br>
2731   * Path: <b>RiskAssessment.subject</b><br>
2732   * </p>
2733   */
2734  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2735      SP_PATIENT);
2736
2737  /**
2738   * Constant for fluent queries to be used to add include statements. Specifies
2739   * the path value of "<b>RiskAssessment:patient</b>".
2740   */
2741  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2742      "RiskAssessment:patient").toLocked();
2743
2744  /**
2745   * Search parameter: <b>probability</b>
2746   * <p>
2747   * Description: <b>Likelihood of specified outcome</b><br>
2748   * Type: <b>number</b><br>
2749   * Path: <b>RiskAssessment.prediction.probability[x]</b><br>
2750   * </p>
2751   */
2752  @SearchParamDefinition(name = "probability", path = "RiskAssessment.prediction.probability", description = "Likelihood of specified outcome", type = "number")
2753  public static final String SP_PROBABILITY = "probability";
2754  /**
2755   * <b>Fluent Client</b> search parameter constant for <b>probability</b>
2756   * <p>
2757   * Description: <b>Likelihood of specified outcome</b><br>
2758   * Type: <b>number</b><br>
2759   * Path: <b>RiskAssessment.prediction.probability[x]</b><br>
2760   * </p>
2761   */
2762  public static final ca.uhn.fhir.rest.gclient.NumberClientParam PROBABILITY = new ca.uhn.fhir.rest.gclient.NumberClientParam(
2763      SP_PROBABILITY);
2764
2765  /**
2766   * Search parameter: <b>risk</b>
2767   * <p>
2768   * Description: <b>Likelihood of specified outcome as a qualitative
2769   * value</b><br>
2770   * Type: <b>token</b><br>
2771   * Path: <b>RiskAssessment.prediction.qualitativeRisk</b><br>
2772   * </p>
2773   */
2774  @SearchParamDefinition(name = "risk", path = "RiskAssessment.prediction.qualitativeRisk", description = "Likelihood of specified outcome as a qualitative value", type = "token")
2775  public static final String SP_RISK = "risk";
2776  /**
2777   * <b>Fluent Client</b> search parameter constant for <b>risk</b>
2778   * <p>
2779   * Description: <b>Likelihood of specified outcome as a qualitative
2780   * value</b><br>
2781   * Type: <b>token</b><br>
2782   * Path: <b>RiskAssessment.prediction.qualitativeRisk</b><br>
2783   * </p>
2784   */
2785  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RISK = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2786      SP_RISK);
2787
2788  /**
2789   * Search parameter: <b>encounter</b>
2790   * <p>
2791   * Description: <b>Where was assessment performed?</b><br>
2792   * Type: <b>reference</b><br>
2793   * Path: <b>RiskAssessment.encounter</b><br>
2794   * </p>
2795   */
2796  @SearchParamDefinition(name = "encounter", path = "RiskAssessment.encounter", description = "Where was assessment performed?", type = "reference", target = {
2797      Encounter.class })
2798  public static final String SP_ENCOUNTER = "encounter";
2799  /**
2800   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2801   * <p>
2802   * Description: <b>Where was assessment performed?</b><br>
2803   * Type: <b>reference</b><br>
2804   * Path: <b>RiskAssessment.encounter</b><br>
2805   * </p>
2806   */
2807  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2808      SP_ENCOUNTER);
2809
2810  /**
2811   * Constant for fluent queries to be used to add include statements. Specifies
2812   * the path value of "<b>RiskAssessment:encounter</b>".
2813   */
2814  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
2815      "RiskAssessment:encounter").toLocked();
2816
2817}