001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.
048 */
049@ResourceDef(name="RiskAssessment", profile="http://hl7.org/fhir/Profile/RiskAssessment")
050public class RiskAssessment extends DomainResource {
051
052    public enum RiskAssessmentStatus {
053        /**
054         * The existence of the observation is registered, but there is no result yet available.
055         */
056        REGISTERED, 
057        /**
058         * This is an initial or interim observation: data may be incomplete or unverified.
059         */
060        PRELIMINARY, 
061        /**
062         * The observation is complete.
063         */
064        FINAL, 
065        /**
066         * Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.
067         */
068        AMENDED, 
069        /**
070         * Subsequent to being Final, the observation has been modified to correct an error in the test result.
071         */
072        CORRECTED, 
073        /**
074         * The observation is unavailable because the measurement was not started or not completed (also sometimes called "aborted").
075         */
076        CANCELLED, 
077        /**
078         * 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".)
079         */
080        ENTEREDINERROR, 
081        /**
082         * The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, but the authoring system does not know which.
083         */
084        UNKNOWN, 
085        /**
086         * added to help the parsers with the generic types
087         */
088        NULL;
089        public static RiskAssessmentStatus fromCode(String codeString) throws FHIRException {
090            if (codeString == null || "".equals(codeString))
091                return null;
092        if ("registered".equals(codeString))
093          return REGISTERED;
094        if ("preliminary".equals(codeString))
095          return PRELIMINARY;
096        if ("final".equals(codeString))
097          return FINAL;
098        if ("amended".equals(codeString))
099          return AMENDED;
100        if ("corrected".equals(codeString))
101          return CORRECTED;
102        if ("cancelled".equals(codeString))
103          return CANCELLED;
104        if ("entered-in-error".equals(codeString))
105          return ENTEREDINERROR;
106        if ("unknown".equals(codeString))
107          return UNKNOWN;
108        if (Configuration.isAcceptInvalidEnums())
109          return null;
110        else
111          throw new FHIRException("Unknown RiskAssessmentStatus code '"+codeString+"'");
112        }
113        public String toCode() {
114          switch (this) {
115            case REGISTERED: return "registered";
116            case PRELIMINARY: return "preliminary";
117            case FINAL: return "final";
118            case AMENDED: return "amended";
119            case CORRECTED: return "corrected";
120            case CANCELLED: return "cancelled";
121            case ENTEREDINERROR: return "entered-in-error";
122            case UNKNOWN: return "unknown";
123            default: return "?";
124          }
125        }
126        public String getSystem() {
127          switch (this) {
128            case REGISTERED: return "http://hl7.org/fhir/observation-status";
129            case PRELIMINARY: return "http://hl7.org/fhir/observation-status";
130            case FINAL: return "http://hl7.org/fhir/observation-status";
131            case AMENDED: return "http://hl7.org/fhir/observation-status";
132            case CORRECTED: return "http://hl7.org/fhir/observation-status";
133            case CANCELLED: return "http://hl7.org/fhir/observation-status";
134            case ENTEREDINERROR: return "http://hl7.org/fhir/observation-status";
135            case UNKNOWN: return "http://hl7.org/fhir/observation-status";
136            default: return "?";
137          }
138        }
139        public String getDefinition() {
140          switch (this) {
141            case REGISTERED: return "The existence of the observation is registered, but there is no result yet available.";
142            case PRELIMINARY: return "This is an initial or interim observation: data may be incomplete or unverified.";
143            case FINAL: return "The observation is complete.";
144            case AMENDED: return "Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.";
145            case CORRECTED: return "Subsequent to being Final, the observation has been modified to correct an error in the test result.";
146            case CANCELLED: return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
147            case ENTEREDINERROR: 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\".)";
148            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring system does not know which.";
149            default: return "?";
150          }
151        }
152        public String getDisplay() {
153          switch (this) {
154            case REGISTERED: return "Registered";
155            case PRELIMINARY: return "Preliminary";
156            case FINAL: return "Final";
157            case AMENDED: return "Amended";
158            case CORRECTED: return "Corrected";
159            case CANCELLED: return "Cancelled";
160            case ENTEREDINERROR: return "Entered in Error";
161            case UNKNOWN: return "Unknown";
162            default: return "?";
163          }
164        }
165    }
166
167  public static class RiskAssessmentStatusEnumFactory implements EnumFactory<RiskAssessmentStatus> {
168    public RiskAssessmentStatus fromCode(String codeString) throws IllegalArgumentException {
169      if (codeString == null || "".equals(codeString))
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("registered".equals(codeString))
173          return RiskAssessmentStatus.REGISTERED;
174        if ("preliminary".equals(codeString))
175          return RiskAssessmentStatus.PRELIMINARY;
176        if ("final".equals(codeString))
177          return RiskAssessmentStatus.FINAL;
178        if ("amended".equals(codeString))
179          return RiskAssessmentStatus.AMENDED;
180        if ("corrected".equals(codeString))
181          return RiskAssessmentStatus.CORRECTED;
182        if ("cancelled".equals(codeString))
183          return RiskAssessmentStatus.CANCELLED;
184        if ("entered-in-error".equals(codeString))
185          return RiskAssessmentStatus.ENTEREDINERROR;
186        if ("unknown".equals(codeString))
187          return RiskAssessmentStatus.UNKNOWN;
188        throw new IllegalArgumentException("Unknown RiskAssessmentStatus code '"+codeString+"'");
189        }
190        public Enumeration<RiskAssessmentStatus> fromType(Base code) throws FHIRException {
191          if (code == null)
192            return null;
193          if (code.isEmpty())
194            return new Enumeration<RiskAssessmentStatus>(this);
195          String codeString = ((PrimitiveType) code).asStringValue();
196          if (codeString == null || "".equals(codeString))
197            return null;
198        if ("registered".equals(codeString))
199          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.REGISTERED);
200        if ("preliminary".equals(codeString))
201          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.PRELIMINARY);
202        if ("final".equals(codeString))
203          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.FINAL);
204        if ("amended".equals(codeString))
205          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.AMENDED);
206        if ("corrected".equals(codeString))
207          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.CORRECTED);
208        if ("cancelled".equals(codeString))
209          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.CANCELLED);
210        if ("entered-in-error".equals(codeString))
211          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.ENTEREDINERROR);
212        if ("unknown".equals(codeString))
213          return new Enumeration<RiskAssessmentStatus>(this, RiskAssessmentStatus.UNKNOWN);
214        throw new FHIRException("Unknown RiskAssessmentStatus code '"+codeString+"'");
215        }
216    public String toCode(RiskAssessmentStatus code) {
217      if (code == RiskAssessmentStatus.REGISTERED)
218        return "registered";
219      if (code == RiskAssessmentStatus.PRELIMINARY)
220        return "preliminary";
221      if (code == RiskAssessmentStatus.FINAL)
222        return "final";
223      if (code == RiskAssessmentStatus.AMENDED)
224        return "amended";
225      if (code == RiskAssessmentStatus.CORRECTED)
226        return "corrected";
227      if (code == RiskAssessmentStatus.CANCELLED)
228        return "cancelled";
229      if (code == RiskAssessmentStatus.ENTEREDINERROR)
230        return "entered-in-error";
231      if (code == RiskAssessmentStatus.UNKNOWN)
232        return "unknown";
233      return "?";
234      }
235    public String toSystem(RiskAssessmentStatus code) {
236      return code.getSystem();
237      }
238    }
239
240    @Block()
241    public static class RiskAssessmentPredictionComponent extends BackboneElement implements IBaseBackboneElement {
242        /**
243         * One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).
244         */
245        @Child(name = "outcome", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
246        @Description(shortDefinition="Possible outcome for the subject", formalDefinition="One of the potential outcomes for the patient (e.g. remission, death,  a particular condition)." )
247        protected CodeableConcept outcome;
248
249        /**
250         * How likely is the outcome (in the specified timeframe).
251         */
252        @Child(name = "probability", type = {DecimalType.class, Range.class}, order=2, min=0, max=1, modifier=false, summary=false)
253        @Description(shortDefinition="Likelihood of specified outcome", formalDefinition="How likely is the outcome (in the specified timeframe)." )
254        protected Type probability;
255
256        /**
257         * How likely is the outcome (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, high).
258         */
259        @Child(name = "qualitativeRisk", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
260        @Description(shortDefinition="Likelihood of specified outcome as a qualitative value", formalDefinition="How likely is the outcome (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, high)." )
261        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/risk-probability")
262        protected CodeableConcept qualitativeRisk;
263
264        /**
265         * 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.).
266         */
267        @Child(name = "relativeRisk", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
268        @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.)." )
269        protected DecimalType relativeRisk;
270
271        /**
272         * Indicates the period of time or age range of the subject to which the specified probability applies.
273         */
274        @Child(name = "when", type = {Period.class, Range.class}, order=5, min=0, max=1, modifier=false, summary=false)
275        @Description(shortDefinition="Timeframe or age range", formalDefinition="Indicates the period of time or age range of the subject to which the specified probability applies." )
276        protected Type when;
277
278        /**
279         * Additional information explaining the basis for the prediction.
280         */
281        @Child(name = "rationale", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
282        @Description(shortDefinition="Explanation of prediction", formalDefinition="Additional information explaining the basis for the prediction." )
283        protected StringType rationale;
284
285        private static final long serialVersionUID = 1283401747L;
286
287    /**
288     * Constructor
289     */
290      public RiskAssessmentPredictionComponent() {
291        super();
292      }
293
294    /**
295     * Constructor
296     */
297      public RiskAssessmentPredictionComponent(CodeableConcept outcome) {
298        super();
299        this.outcome = outcome;
300      }
301
302        /**
303         * @return {@link #outcome} (One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).)
304         */
305        public CodeableConcept getOutcome() { 
306          if (this.outcome == null)
307            if (Configuration.errorOnAutoCreate())
308              throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.outcome");
309            else if (Configuration.doAutoCreate())
310              this.outcome = new CodeableConcept(); // cc
311          return this.outcome;
312        }
313
314        public boolean hasOutcome() { 
315          return this.outcome != null && !this.outcome.isEmpty();
316        }
317
318        /**
319         * @param value {@link #outcome} (One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).)
320         */
321        public RiskAssessmentPredictionComponent setOutcome(CodeableConcept value) { 
322          this.outcome = value;
323          return this;
324        }
325
326        /**
327         * @return {@link #probability} (How likely is the outcome (in the specified timeframe).)
328         */
329        public Type getProbability() { 
330          return this.probability;
331        }
332
333        /**
334         * @return {@link #probability} (How likely is the outcome (in the specified timeframe).)
335         */
336        public DecimalType getProbabilityDecimalType() throws FHIRException { 
337          if (!(this.probability instanceof DecimalType))
338            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.probability.getClass().getName()+" was encountered");
339          return (DecimalType) this.probability;
340        }
341
342        public boolean hasProbabilityDecimalType() { 
343          return this.probability instanceof DecimalType;
344        }
345
346        /**
347         * @return {@link #probability} (How likely is the outcome (in the specified timeframe).)
348         */
349        public Range getProbabilityRange() throws FHIRException { 
350          if (!(this.probability instanceof Range))
351            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.probability.getClass().getName()+" was encountered");
352          return (Range) this.probability;
353        }
354
355        public boolean hasProbabilityRange() { 
356          return this.probability instanceof Range;
357        }
358
359        public boolean hasProbability() { 
360          return this.probability != null && !this.probability.isEmpty();
361        }
362
363        /**
364         * @param value {@link #probability} (How likely is the outcome (in the specified timeframe).)
365         */
366        public RiskAssessmentPredictionComponent setProbability(Type value) { 
367          this.probability = value;
368          return this;
369        }
370
371        /**
372         * @return {@link #qualitativeRisk} (How likely is the outcome (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, high).)
373         */
374        public CodeableConcept getQualitativeRisk() { 
375          if (this.qualitativeRisk == null)
376            if (Configuration.errorOnAutoCreate())
377              throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.qualitativeRisk");
378            else if (Configuration.doAutoCreate())
379              this.qualitativeRisk = new CodeableConcept(); // cc
380          return this.qualitativeRisk;
381        }
382
383        public boolean hasQualitativeRisk() { 
384          return this.qualitativeRisk != null && !this.qualitativeRisk.isEmpty();
385        }
386
387        /**
388         * @param value {@link #qualitativeRisk} (How likely is the outcome (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, high).)
389         */
390        public RiskAssessmentPredictionComponent setQualitativeRisk(CodeableConcept value) { 
391          this.qualitativeRisk = value;
392          return this;
393        }
394
395        /**
396         * @return {@link #relativeRisk} (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.).). This is the underlying object with id, value and extensions. The accessor "getRelativeRisk" gives direct access to the value
397         */
398        public DecimalType getRelativeRiskElement() { 
399          if (this.relativeRisk == null)
400            if (Configuration.errorOnAutoCreate())
401              throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.relativeRisk");
402            else if (Configuration.doAutoCreate())
403              this.relativeRisk = new DecimalType(); // bb
404          return this.relativeRisk;
405        }
406
407        public boolean hasRelativeRiskElement() { 
408          return this.relativeRisk != null && !this.relativeRisk.isEmpty();
409        }
410
411        public boolean hasRelativeRisk() { 
412          return this.relativeRisk != null && !this.relativeRisk.isEmpty();
413        }
414
415        /**
416         * @param value {@link #relativeRisk} (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.).). This is the underlying object with id, value and extensions. The accessor "getRelativeRisk" gives direct access to the value
417         */
418        public RiskAssessmentPredictionComponent setRelativeRiskElement(DecimalType value) { 
419          this.relativeRisk = value;
420          return this;
421        }
422
423        /**
424         * @return 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.).
425         */
426        public BigDecimal getRelativeRisk() { 
427          return this.relativeRisk == null ? null : this.relativeRisk.getValue();
428        }
429
430        /**
431         * @param value 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.).
432         */
433        public RiskAssessmentPredictionComponent setRelativeRisk(BigDecimal value) { 
434          if (value == null)
435            this.relativeRisk = null;
436          else {
437            if (this.relativeRisk == null)
438              this.relativeRisk = new DecimalType();
439            this.relativeRisk.setValue(value);
440          }
441          return this;
442        }
443
444        /**
445         * @param value 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.).
446         */
447        public RiskAssessmentPredictionComponent setRelativeRisk(long value) { 
448              this.relativeRisk = new DecimalType();
449            this.relativeRisk.setValue(value);
450          return this;
451        }
452
453        /**
454         * @param value 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.).
455         */
456        public RiskAssessmentPredictionComponent setRelativeRisk(double value) { 
457              this.relativeRisk = new DecimalType();
458            this.relativeRisk.setValue(value);
459          return this;
460        }
461
462        /**
463         * @return {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.)
464         */
465        public Type getWhen() { 
466          return this.when;
467        }
468
469        /**
470         * @return {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.)
471         */
472        public Period getWhenPeriod() throws FHIRException { 
473          if (!(this.when instanceof Period))
474            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.when.getClass().getName()+" was encountered");
475          return (Period) this.when;
476        }
477
478        public boolean hasWhenPeriod() { 
479          return this.when instanceof Period;
480        }
481
482        /**
483         * @return {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.)
484         */
485        public Range getWhenRange() throws FHIRException { 
486          if (!(this.when instanceof Range))
487            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.when.getClass().getName()+" was encountered");
488          return (Range) this.when;
489        }
490
491        public boolean hasWhenRange() { 
492          return this.when instanceof Range;
493        }
494
495        public boolean hasWhen() { 
496          return this.when != null && !this.when.isEmpty();
497        }
498
499        /**
500         * @param value {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.)
501         */
502        public RiskAssessmentPredictionComponent setWhen(Type value) { 
503          this.when = value;
504          return this;
505        }
506
507        /**
508         * @return {@link #rationale} (Additional information explaining the basis for the prediction.). This is the underlying object with id, value and extensions. The accessor "getRationale" gives direct access to the value
509         */
510        public StringType getRationaleElement() { 
511          if (this.rationale == null)
512            if (Configuration.errorOnAutoCreate())
513              throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.rationale");
514            else if (Configuration.doAutoCreate())
515              this.rationale = new StringType(); // bb
516          return this.rationale;
517        }
518
519        public boolean hasRationaleElement() { 
520          return this.rationale != null && !this.rationale.isEmpty();
521        }
522
523        public boolean hasRationale() { 
524          return this.rationale != null && !this.rationale.isEmpty();
525        }
526
527        /**
528         * @param value {@link #rationale} (Additional information explaining the basis for the prediction.). This is the underlying object with id, value and extensions. The accessor "getRationale" gives direct access to the value
529         */
530        public RiskAssessmentPredictionComponent setRationaleElement(StringType value) { 
531          this.rationale = value;
532          return this;
533        }
534
535        /**
536         * @return Additional information explaining the basis for the prediction.
537         */
538        public String getRationale() { 
539          return this.rationale == null ? null : this.rationale.getValue();
540        }
541
542        /**
543         * @param value Additional information explaining the basis for the prediction.
544         */
545        public RiskAssessmentPredictionComponent setRationale(String value) { 
546          if (Utilities.noString(value))
547            this.rationale = null;
548          else {
549            if (this.rationale == null)
550              this.rationale = new StringType();
551            this.rationale.setValue(value);
552          }
553          return this;
554        }
555
556        protected void listChildren(List<Property> childrenList) {
557          super.listChildren(childrenList);
558          childrenList.add(new Property("outcome", "CodeableConcept", "One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).", 0, java.lang.Integer.MAX_VALUE, outcome));
559          childrenList.add(new Property("probability[x]", "decimal|Range", "How likely is the outcome (in the specified timeframe).", 0, java.lang.Integer.MAX_VALUE, probability));
560          childrenList.add(new Property("qualitativeRisk", "CodeableConcept", "How likely is the outcome (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, high).", 0, java.lang.Integer.MAX_VALUE, qualitativeRisk));
561          childrenList.add(new Property("relativeRisk", "decimal", "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.).", 0, java.lang.Integer.MAX_VALUE, relativeRisk));
562          childrenList.add(new Property("when[x]", "Period|Range", "Indicates the period of time or age range of the subject to which the specified probability applies.", 0, java.lang.Integer.MAX_VALUE, when));
563          childrenList.add(new Property("rationale", "string", "Additional information explaining the basis for the prediction.", 0, java.lang.Integer.MAX_VALUE, rationale));
564        }
565
566      @Override
567      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
568        switch (hash) {
569        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
570        case -1290561483: /*probability*/ return this.probability == null ? new Base[0] : new Base[] {this.probability}; // Type
571        case 123308730: /*qualitativeRisk*/ return this.qualitativeRisk == null ? new Base[0] : new Base[] {this.qualitativeRisk}; // CodeableConcept
572        case -70741061: /*relativeRisk*/ return this.relativeRisk == null ? new Base[0] : new Base[] {this.relativeRisk}; // DecimalType
573        case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // Type
574        case 345689335: /*rationale*/ return this.rationale == null ? new Base[0] : new Base[] {this.rationale}; // StringType
575        default: return super.getProperty(hash, name, checkValid);
576        }
577
578      }
579
580      @Override
581      public Base setProperty(int hash, String name, Base value) throws FHIRException {
582        switch (hash) {
583        case -1106507950: // outcome
584          this.outcome = castToCodeableConcept(value); // CodeableConcept
585          return value;
586        case -1290561483: // probability
587          this.probability = castToType(value); // Type
588          return value;
589        case 123308730: // qualitativeRisk
590          this.qualitativeRisk = castToCodeableConcept(value); // CodeableConcept
591          return value;
592        case -70741061: // relativeRisk
593          this.relativeRisk = castToDecimal(value); // DecimalType
594          return value;
595        case 3648314: // when
596          this.when = castToType(value); // Type
597          return value;
598        case 345689335: // rationale
599          this.rationale = castToString(value); // StringType
600          return value;
601        default: return super.setProperty(hash, name, value);
602        }
603
604      }
605
606      @Override
607      public Base setProperty(String name, Base value) throws FHIRException {
608        if (name.equals("outcome")) {
609          this.outcome = castToCodeableConcept(value); // CodeableConcept
610        } else if (name.equals("probability[x]")) {
611          this.probability = castToType(value); // Type
612        } else if (name.equals("qualitativeRisk")) {
613          this.qualitativeRisk = castToCodeableConcept(value); // CodeableConcept
614        } else if (name.equals("relativeRisk")) {
615          this.relativeRisk = castToDecimal(value); // DecimalType
616        } else if (name.equals("when[x]")) {
617          this.when = castToType(value); // Type
618        } else if (name.equals("rationale")) {
619          this.rationale = castToString(value); // StringType
620        } else
621          return super.setProperty(name, value);
622        return value;
623      }
624
625      @Override
626      public Base makeProperty(int hash, String name) throws FHIRException {
627        switch (hash) {
628        case -1106507950:  return getOutcome(); 
629        case 1430185003:  return getProbability(); 
630        case -1290561483:  return getProbability(); 
631        case 123308730:  return getQualitativeRisk(); 
632        case -70741061:  return getRelativeRiskElement();
633        case 1312831238:  return getWhen(); 
634        case 3648314:  return getWhen(); 
635        case 345689335:  return getRationaleElement();
636        default: return super.makeProperty(hash, name);
637        }
638
639      }
640
641      @Override
642      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
643        switch (hash) {
644        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
645        case -1290561483: /*probability*/ return new String[] {"decimal", "Range"};
646        case 123308730: /*qualitativeRisk*/ return new String[] {"CodeableConcept"};
647        case -70741061: /*relativeRisk*/ return new String[] {"decimal"};
648        case 3648314: /*when*/ return new String[] {"Period", "Range"};
649        case 345689335: /*rationale*/ return new String[] {"string"};
650        default: return super.getTypesForProperty(hash, name);
651        }
652
653      }
654
655      @Override
656      public Base addChild(String name) throws FHIRException {
657        if (name.equals("outcome")) {
658          this.outcome = new CodeableConcept();
659          return this.outcome;
660        }
661        else if (name.equals("probabilityDecimal")) {
662          this.probability = new DecimalType();
663          return this.probability;
664        }
665        else if (name.equals("probabilityRange")) {
666          this.probability = new Range();
667          return this.probability;
668        }
669        else if (name.equals("qualitativeRisk")) {
670          this.qualitativeRisk = new CodeableConcept();
671          return this.qualitativeRisk;
672        }
673        else if (name.equals("relativeRisk")) {
674          throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.relativeRisk");
675        }
676        else if (name.equals("whenPeriod")) {
677          this.when = new Period();
678          return this.when;
679        }
680        else if (name.equals("whenRange")) {
681          this.when = new Range();
682          return this.when;
683        }
684        else if (name.equals("rationale")) {
685          throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.rationale");
686        }
687        else
688          return super.addChild(name);
689      }
690
691      public RiskAssessmentPredictionComponent copy() {
692        RiskAssessmentPredictionComponent dst = new RiskAssessmentPredictionComponent();
693        copyValues(dst);
694        dst.outcome = outcome == null ? null : outcome.copy();
695        dst.probability = probability == null ? null : probability.copy();
696        dst.qualitativeRisk = qualitativeRisk == null ? null : qualitativeRisk.copy();
697        dst.relativeRisk = relativeRisk == null ? null : relativeRisk.copy();
698        dst.when = when == null ? null : when.copy();
699        dst.rationale = rationale == null ? null : rationale.copy();
700        return dst;
701      }
702
703      @Override
704      public boolean equalsDeep(Base other) {
705        if (!super.equalsDeep(other))
706          return false;
707        if (!(other instanceof RiskAssessmentPredictionComponent))
708          return false;
709        RiskAssessmentPredictionComponent o = (RiskAssessmentPredictionComponent) other;
710        return compareDeep(outcome, o.outcome, true) && compareDeep(probability, o.probability, true) && compareDeep(qualitativeRisk, o.qualitativeRisk, true)
711           && compareDeep(relativeRisk, o.relativeRisk, true) && compareDeep(when, o.when, true) && compareDeep(rationale, o.rationale, true)
712          ;
713      }
714
715      @Override
716      public boolean equalsShallow(Base other) {
717        if (!super.equalsShallow(other))
718          return false;
719        if (!(other instanceof RiskAssessmentPredictionComponent))
720          return false;
721        RiskAssessmentPredictionComponent o = (RiskAssessmentPredictionComponent) other;
722        return compareValues(relativeRisk, o.relativeRisk, true) && compareValues(rationale, o.rationale, true)
723          ;
724      }
725
726      public boolean isEmpty() {
727        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(outcome, probability, qualitativeRisk
728          , relativeRisk, when, rationale);
729      }
730
731  public String fhirType() {
732    return "RiskAssessment.prediction";
733
734  }
735
736  }
737
738    /**
739     * Business identifier assigned to the risk assessment.
740     */
741    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
742    @Description(shortDefinition="Unique identifier for the assessment", formalDefinition="Business identifier assigned to the risk assessment." )
743    protected Identifier identifier;
744
745    /**
746     * A reference to the request that is fulfilled by this risk assessment.
747     */
748    @Child(name = "basedOn", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
749    @Description(shortDefinition="Request fulfilled by this assessment", formalDefinition="A reference to the request that is fulfilled by this risk assessment." )
750    protected Reference basedOn;
751
752    /**
753     * The actual object that is the target of the reference (A reference to the request that is fulfilled by this risk assessment.)
754     */
755    protected Resource basedOnTarget;
756
757    /**
758     * A reference to a resource that this risk assessment is part of, such as a Procedure.
759     */
760    @Child(name = "parent", type = {Reference.class}, order=2, min=0, max=1, modifier=false, summary=false)
761    @Description(shortDefinition="Part of this occurrence", formalDefinition="A reference to a resource that this risk assessment is part of, such as a Procedure." )
762    protected Reference parent;
763
764    /**
765     * The actual object that is the target of the reference (A reference to a resource that this risk assessment is part of, such as a Procedure.)
766     */
767    protected Resource parentTarget;
768
769    /**
770     * The status of the RiskAssessment, using the same statuses as an Observation.
771     */
772    @Child(name = "status", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=false)
773    @Description(shortDefinition="registered | preliminary | final | amended +", formalDefinition="The status of the RiskAssessment, using the same statuses as an Observation." )
774    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-status")
775    protected Enumeration<RiskAssessmentStatus> status;
776
777    /**
778     * The algorithm, process or mechanism used to evaluate the risk.
779     */
780    @Child(name = "method", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
781    @Description(shortDefinition="Evaluation mechanism", formalDefinition="The algorithm, process or mechanism used to evaluate the risk." )
782    protected CodeableConcept method;
783
784    /**
785     * The type of the risk assessment performed.
786     */
787    @Child(name = "code", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
788    @Description(shortDefinition="Type of assessment", formalDefinition="The type of the risk assessment performed." )
789    protected CodeableConcept code;
790
791    /**
792     * The patient or group the risk assessment applies to.
793     */
794    @Child(name = "subject", type = {Patient.class, Group.class}, order=6, min=0, max=1, modifier=false, summary=true)
795    @Description(shortDefinition="Who/what does assessment apply to?", formalDefinition="The patient or group the risk assessment applies to." )
796    protected Reference subject;
797
798    /**
799     * The actual object that is the target of the reference (The patient or group the risk assessment applies to.)
800     */
801    protected Resource subjectTarget;
802
803    /**
804     * The encounter where the assessment was performed.
805     */
806    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=7, min=0, max=1, modifier=false, summary=true)
807    @Description(shortDefinition="Where was assessment performed?", formalDefinition="The encounter where the assessment was performed." )
808    protected Reference context;
809
810    /**
811     * The actual object that is the target of the reference (The encounter where the assessment was performed.)
812     */
813    protected Resource contextTarget;
814
815    /**
816     * The date (and possibly time) the risk assessment was performed.
817     */
818    @Child(name = "occurrence", type = {DateTimeType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=true)
819    @Description(shortDefinition="When was assessment made?", formalDefinition="The date (and possibly time) the risk assessment was performed." )
820    protected Type occurrence;
821
822    /**
823     * For assessments or prognosis specific to a particular condition, indicates the condition being assessed.
824     */
825    @Child(name = "condition", type = {Condition.class}, order=9, min=0, max=1, modifier=false, summary=true)
826    @Description(shortDefinition="Condition assessed", formalDefinition="For assessments or prognosis specific to a particular condition, indicates the condition being assessed." )
827    protected Reference condition;
828
829    /**
830     * The actual object that is the target of the reference (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.)
831     */
832    protected Condition conditionTarget;
833
834    /**
835     * The provider or software application that performed the assessment.
836     */
837    @Child(name = "performer", type = {Practitioner.class, Device.class}, order=10, min=0, max=1, modifier=false, summary=true)
838    @Description(shortDefinition="Who did assessment?", formalDefinition="The provider or software application that performed the assessment." )
839    protected Reference performer;
840
841    /**
842     * The actual object that is the target of the reference (The provider or software application that performed the assessment.)
843     */
844    protected Resource performerTarget;
845
846    /**
847     * The reason the risk assessment was performed.
848     */
849    @Child(name = "reason", type = {CodeableConcept.class, Reference.class}, order=11, min=0, max=1, modifier=false, summary=false)
850    @Description(shortDefinition="Why the assessment was necessary?", formalDefinition="The reason the risk assessment was performed." )
851    protected Type reason;
852
853    /**
854     * Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).
855     */
856    @Child(name = "basis", type = {Reference.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
857    @Description(shortDefinition="Information used in assessment", formalDefinition="Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.)." )
858    protected List<Reference> basis;
859    /**
860     * The actual objects that are the target of the reference (Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).)
861     */
862    protected List<Resource> basisTarget;
863
864
865    /**
866     * Describes the expected outcome for the subject.
867     */
868    @Child(name = "prediction", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
869    @Description(shortDefinition="Outcome predicted", formalDefinition="Describes the expected outcome for the subject." )
870    protected List<RiskAssessmentPredictionComponent> prediction;
871
872    /**
873     * A description of the steps that might be taken to reduce the identified risk(s).
874     */
875    @Child(name = "mitigation", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
876    @Description(shortDefinition="How to reduce risk", formalDefinition="A description of the steps that might be taken to reduce the identified risk(s)." )
877    protected StringType mitigation;
878
879    /**
880     * Additional comments about the risk assessment.
881     */
882    @Child(name = "comment", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=false)
883    @Description(shortDefinition="Comments on the risk assessment", formalDefinition="Additional comments about the risk assessment." )
884    protected StringType comment;
885
886    private static final long serialVersionUID = -715866284L;
887
888  /**
889   * Constructor
890   */
891    public RiskAssessment() {
892      super();
893    }
894
895  /**
896   * Constructor
897   */
898    public RiskAssessment(Enumeration<RiskAssessmentStatus> status) {
899      super();
900      this.status = status;
901    }
902
903    /**
904     * @return {@link #identifier} (Business identifier assigned to the risk assessment.)
905     */
906    public Identifier getIdentifier() { 
907      if (this.identifier == null)
908        if (Configuration.errorOnAutoCreate())
909          throw new Error("Attempt to auto-create RiskAssessment.identifier");
910        else if (Configuration.doAutoCreate())
911          this.identifier = new Identifier(); // cc
912      return this.identifier;
913    }
914
915    public boolean hasIdentifier() { 
916      return this.identifier != null && !this.identifier.isEmpty();
917    }
918
919    /**
920     * @param value {@link #identifier} (Business identifier assigned to the risk assessment.)
921     */
922    public RiskAssessment setIdentifier(Identifier value) { 
923      this.identifier = value;
924      return this;
925    }
926
927    /**
928     * @return {@link #basedOn} (A reference to the request that is fulfilled by this risk assessment.)
929     */
930    public Reference getBasedOn() { 
931      if (this.basedOn == null)
932        if (Configuration.errorOnAutoCreate())
933          throw new Error("Attempt to auto-create RiskAssessment.basedOn");
934        else if (Configuration.doAutoCreate())
935          this.basedOn = new Reference(); // cc
936      return this.basedOn;
937    }
938
939    public boolean hasBasedOn() { 
940      return this.basedOn != null && !this.basedOn.isEmpty();
941    }
942
943    /**
944     * @param value {@link #basedOn} (A reference to the request that is fulfilled by this risk assessment.)
945     */
946    public RiskAssessment setBasedOn(Reference value) { 
947      this.basedOn = value;
948      return this;
949    }
950
951    /**
952     * @return {@link #basedOn} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to the request that is fulfilled by this risk assessment.)
953     */
954    public Resource getBasedOnTarget() { 
955      return this.basedOnTarget;
956    }
957
958    /**
959     * @param value {@link #basedOn} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to the request that is fulfilled by this risk assessment.)
960     */
961    public RiskAssessment setBasedOnTarget(Resource value) { 
962      this.basedOnTarget = value;
963      return this;
964    }
965
966    /**
967     * @return {@link #parent} (A reference to a resource that this risk assessment is part of, such as a Procedure.)
968     */
969    public Reference getParent() { 
970      if (this.parent == null)
971        if (Configuration.errorOnAutoCreate())
972          throw new Error("Attempt to auto-create RiskAssessment.parent");
973        else if (Configuration.doAutoCreate())
974          this.parent = new Reference(); // cc
975      return this.parent;
976    }
977
978    public boolean hasParent() { 
979      return this.parent != null && !this.parent.isEmpty();
980    }
981
982    /**
983     * @param value {@link #parent} (A reference to a resource that this risk assessment is part of, such as a Procedure.)
984     */
985    public RiskAssessment setParent(Reference value) { 
986      this.parent = value;
987      return this;
988    }
989
990    /**
991     * @return {@link #parent} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to a resource that this risk assessment is part of, such as a Procedure.)
992     */
993    public Resource getParentTarget() { 
994      return this.parentTarget;
995    }
996
997    /**
998     * @param value {@link #parent} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to a resource that this risk assessment is part of, such as a Procedure.)
999     */
1000    public RiskAssessment setParentTarget(Resource value) { 
1001      this.parentTarget = value;
1002      return this;
1003    }
1004
1005    /**
1006     * @return {@link #status} (The status of the RiskAssessment, using the same statuses as an Observation.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1007     */
1008    public Enumeration<RiskAssessmentStatus> getStatusElement() { 
1009      if (this.status == null)
1010        if (Configuration.errorOnAutoCreate())
1011          throw new Error("Attempt to auto-create RiskAssessment.status");
1012        else if (Configuration.doAutoCreate())
1013          this.status = new Enumeration<RiskAssessmentStatus>(new RiskAssessmentStatusEnumFactory()); // bb
1014      return this.status;
1015    }
1016
1017    public boolean hasStatusElement() { 
1018      return this.status != null && !this.status.isEmpty();
1019    }
1020
1021    public boolean hasStatus() { 
1022      return this.status != null && !this.status.isEmpty();
1023    }
1024
1025    /**
1026     * @param value {@link #status} (The status of the RiskAssessment, using the same statuses as an Observation.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1027     */
1028    public RiskAssessment setStatusElement(Enumeration<RiskAssessmentStatus> value) { 
1029      this.status = value;
1030      return this;
1031    }
1032
1033    /**
1034     * @return The status of the RiskAssessment, using the same statuses as an Observation.
1035     */
1036    public RiskAssessmentStatus getStatus() { 
1037      return this.status == null ? null : this.status.getValue();
1038    }
1039
1040    /**
1041     * @param value The status of the RiskAssessment, using the same statuses as an Observation.
1042     */
1043    public RiskAssessment setStatus(RiskAssessmentStatus value) { 
1044        if (this.status == null)
1045          this.status = new Enumeration<RiskAssessmentStatus>(new RiskAssessmentStatusEnumFactory());
1046        this.status.setValue(value);
1047      return this;
1048    }
1049
1050    /**
1051     * @return {@link #method} (The algorithm, process or mechanism used to evaluate the risk.)
1052     */
1053    public CodeableConcept getMethod() { 
1054      if (this.method == null)
1055        if (Configuration.errorOnAutoCreate())
1056          throw new Error("Attempt to auto-create RiskAssessment.method");
1057        else if (Configuration.doAutoCreate())
1058          this.method = new CodeableConcept(); // cc
1059      return this.method;
1060    }
1061
1062    public boolean hasMethod() { 
1063      return this.method != null && !this.method.isEmpty();
1064    }
1065
1066    /**
1067     * @param value {@link #method} (The algorithm, process or mechanism used to evaluate the risk.)
1068     */
1069    public RiskAssessment setMethod(CodeableConcept value) { 
1070      this.method = value;
1071      return this;
1072    }
1073
1074    /**
1075     * @return {@link #code} (The type of the risk assessment performed.)
1076     */
1077    public CodeableConcept getCode() { 
1078      if (this.code == null)
1079        if (Configuration.errorOnAutoCreate())
1080          throw new Error("Attempt to auto-create RiskAssessment.code");
1081        else if (Configuration.doAutoCreate())
1082          this.code = new CodeableConcept(); // cc
1083      return this.code;
1084    }
1085
1086    public boolean hasCode() { 
1087      return this.code != null && !this.code.isEmpty();
1088    }
1089
1090    /**
1091     * @param value {@link #code} (The type of the risk assessment performed.)
1092     */
1093    public RiskAssessment setCode(CodeableConcept value) { 
1094      this.code = value;
1095      return this;
1096    }
1097
1098    /**
1099     * @return {@link #subject} (The patient or group the risk assessment applies to.)
1100     */
1101    public Reference getSubject() { 
1102      if (this.subject == null)
1103        if (Configuration.errorOnAutoCreate())
1104          throw new Error("Attempt to auto-create RiskAssessment.subject");
1105        else if (Configuration.doAutoCreate())
1106          this.subject = new Reference(); // cc
1107      return this.subject;
1108    }
1109
1110    public boolean hasSubject() { 
1111      return this.subject != null && !this.subject.isEmpty();
1112    }
1113
1114    /**
1115     * @param value {@link #subject} (The patient or group the risk assessment applies to.)
1116     */
1117    public RiskAssessment setSubject(Reference value) { 
1118      this.subject = value;
1119      return this;
1120    }
1121
1122    /**
1123     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient or group the risk assessment applies to.)
1124     */
1125    public Resource getSubjectTarget() { 
1126      return this.subjectTarget;
1127    }
1128
1129    /**
1130     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient or group the risk assessment applies to.)
1131     */
1132    public RiskAssessment setSubjectTarget(Resource value) { 
1133      this.subjectTarget = value;
1134      return this;
1135    }
1136
1137    /**
1138     * @return {@link #context} (The encounter where the assessment was performed.)
1139     */
1140    public Reference getContext() { 
1141      if (this.context == null)
1142        if (Configuration.errorOnAutoCreate())
1143          throw new Error("Attempt to auto-create RiskAssessment.context");
1144        else if (Configuration.doAutoCreate())
1145          this.context = new Reference(); // cc
1146      return this.context;
1147    }
1148
1149    public boolean hasContext() { 
1150      return this.context != null && !this.context.isEmpty();
1151    }
1152
1153    /**
1154     * @param value {@link #context} (The encounter where the assessment was performed.)
1155     */
1156    public RiskAssessment setContext(Reference value) { 
1157      this.context = value;
1158      return this;
1159    }
1160
1161    /**
1162     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The encounter where the assessment was performed.)
1163     */
1164    public Resource getContextTarget() { 
1165      return this.contextTarget;
1166    }
1167
1168    /**
1169     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The encounter where the assessment was performed.)
1170     */
1171    public RiskAssessment setContextTarget(Resource value) { 
1172      this.contextTarget = value;
1173      return this;
1174    }
1175
1176    /**
1177     * @return {@link #occurrence} (The date (and possibly time) the risk assessment was performed.)
1178     */
1179    public Type getOccurrence() { 
1180      return this.occurrence;
1181    }
1182
1183    /**
1184     * @return {@link #occurrence} (The date (and possibly time) the risk assessment was performed.)
1185     */
1186    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1187      if (!(this.occurrence instanceof DateTimeType))
1188        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1189      return (DateTimeType) this.occurrence;
1190    }
1191
1192    public boolean hasOccurrenceDateTimeType() { 
1193      return this.occurrence instanceof DateTimeType;
1194    }
1195
1196    /**
1197     * @return {@link #occurrence} (The date (and possibly time) the risk assessment was performed.)
1198     */
1199    public Period getOccurrencePeriod() throws FHIRException { 
1200      if (!(this.occurrence instanceof Period))
1201        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1202      return (Period) this.occurrence;
1203    }
1204
1205    public boolean hasOccurrencePeriod() { 
1206      return this.occurrence instanceof Period;
1207    }
1208
1209    public boolean hasOccurrence() { 
1210      return this.occurrence != null && !this.occurrence.isEmpty();
1211    }
1212
1213    /**
1214     * @param value {@link #occurrence} (The date (and possibly time) the risk assessment was performed.)
1215     */
1216    public RiskAssessment setOccurrence(Type value) { 
1217      this.occurrence = value;
1218      return this;
1219    }
1220
1221    /**
1222     * @return {@link #condition} (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.)
1223     */
1224    public Reference getCondition() { 
1225      if (this.condition == null)
1226        if (Configuration.errorOnAutoCreate())
1227          throw new Error("Attempt to auto-create RiskAssessment.condition");
1228        else if (Configuration.doAutoCreate())
1229          this.condition = new Reference(); // cc
1230      return this.condition;
1231    }
1232
1233    public boolean hasCondition() { 
1234      return this.condition != null && !this.condition.isEmpty();
1235    }
1236
1237    /**
1238     * @param value {@link #condition} (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.)
1239     */
1240    public RiskAssessment setCondition(Reference value) { 
1241      this.condition = value;
1242      return this;
1243    }
1244
1245    /**
1246     * @return {@link #condition} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.)
1247     */
1248    public Condition getConditionTarget() { 
1249      if (this.conditionTarget == null)
1250        if (Configuration.errorOnAutoCreate())
1251          throw new Error("Attempt to auto-create RiskAssessment.condition");
1252        else if (Configuration.doAutoCreate())
1253          this.conditionTarget = new Condition(); // aa
1254      return this.conditionTarget;
1255    }
1256
1257    /**
1258     * @param value {@link #condition} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.)
1259     */
1260    public RiskAssessment setConditionTarget(Condition value) { 
1261      this.conditionTarget = value;
1262      return this;
1263    }
1264
1265    /**
1266     * @return {@link #performer} (The provider or software application that performed the assessment.)
1267     */
1268    public Reference getPerformer() { 
1269      if (this.performer == null)
1270        if (Configuration.errorOnAutoCreate())
1271          throw new Error("Attempt to auto-create RiskAssessment.performer");
1272        else if (Configuration.doAutoCreate())
1273          this.performer = new Reference(); // cc
1274      return this.performer;
1275    }
1276
1277    public boolean hasPerformer() { 
1278      return this.performer != null && !this.performer.isEmpty();
1279    }
1280
1281    /**
1282     * @param value {@link #performer} (The provider or software application that performed the assessment.)
1283     */
1284    public RiskAssessment setPerformer(Reference value) { 
1285      this.performer = value;
1286      return this;
1287    }
1288
1289    /**
1290     * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The provider or software application that performed the assessment.)
1291     */
1292    public Resource getPerformerTarget() { 
1293      return this.performerTarget;
1294    }
1295
1296    /**
1297     * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The provider or software application that performed the assessment.)
1298     */
1299    public RiskAssessment setPerformerTarget(Resource value) { 
1300      this.performerTarget = value;
1301      return this;
1302    }
1303
1304    /**
1305     * @return {@link #reason} (The reason the risk assessment was performed.)
1306     */
1307    public Type getReason() { 
1308      return this.reason;
1309    }
1310
1311    /**
1312     * @return {@link #reason} (The reason the risk assessment was performed.)
1313     */
1314    public CodeableConcept getReasonCodeableConcept() throws FHIRException { 
1315      if (!(this.reason instanceof CodeableConcept))
1316        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered");
1317      return (CodeableConcept) this.reason;
1318    }
1319
1320    public boolean hasReasonCodeableConcept() { 
1321      return this.reason instanceof CodeableConcept;
1322    }
1323
1324    /**
1325     * @return {@link #reason} (The reason the risk assessment was performed.)
1326     */
1327    public Reference getReasonReference() throws FHIRException { 
1328      if (!(this.reason instanceof Reference))
1329        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered");
1330      return (Reference) this.reason;
1331    }
1332
1333    public boolean hasReasonReference() { 
1334      return this.reason instanceof Reference;
1335    }
1336
1337    public boolean hasReason() { 
1338      return this.reason != null && !this.reason.isEmpty();
1339    }
1340
1341    /**
1342     * @param value {@link #reason} (The reason the risk assessment was performed.)
1343     */
1344    public RiskAssessment setReason(Type value) { 
1345      this.reason = value;
1346      return this;
1347    }
1348
1349    /**
1350     * @return {@link #basis} (Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).)
1351     */
1352    public List<Reference> getBasis() { 
1353      if (this.basis == null)
1354        this.basis = new ArrayList<Reference>();
1355      return this.basis;
1356    }
1357
1358    /**
1359     * @return Returns a reference to <code>this</code> for easy method chaining
1360     */
1361    public RiskAssessment setBasis(List<Reference> theBasis) { 
1362      this.basis = theBasis;
1363      return this;
1364    }
1365
1366    public boolean hasBasis() { 
1367      if (this.basis == null)
1368        return false;
1369      for (Reference item : this.basis)
1370        if (!item.isEmpty())
1371          return true;
1372      return false;
1373    }
1374
1375    public Reference addBasis() { //3
1376      Reference t = new Reference();
1377      if (this.basis == null)
1378        this.basis = new ArrayList<Reference>();
1379      this.basis.add(t);
1380      return t;
1381    }
1382
1383    public RiskAssessment addBasis(Reference t) { //3
1384      if (t == null)
1385        return this;
1386      if (this.basis == null)
1387        this.basis = new ArrayList<Reference>();
1388      this.basis.add(t);
1389      return this;
1390    }
1391
1392    /**
1393     * @return The first repetition of repeating field {@link #basis}, creating it if it does not already exist
1394     */
1395    public Reference getBasisFirstRep() { 
1396      if (getBasis().isEmpty()) {
1397        addBasis();
1398      }
1399      return getBasis().get(0);
1400    }
1401
1402    /**
1403     * @deprecated Use Reference#setResource(IBaseResource) instead
1404     */
1405    @Deprecated
1406    public List<Resource> getBasisTarget() { 
1407      if (this.basisTarget == null)
1408        this.basisTarget = new ArrayList<Resource>();
1409      return this.basisTarget;
1410    }
1411
1412    /**
1413     * @return {@link #prediction} (Describes the expected outcome for the subject.)
1414     */
1415    public List<RiskAssessmentPredictionComponent> getPrediction() { 
1416      if (this.prediction == null)
1417        this.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1418      return this.prediction;
1419    }
1420
1421    /**
1422     * @return Returns a reference to <code>this</code> for easy method chaining
1423     */
1424    public RiskAssessment setPrediction(List<RiskAssessmentPredictionComponent> thePrediction) { 
1425      this.prediction = thePrediction;
1426      return this;
1427    }
1428
1429    public boolean hasPrediction() { 
1430      if (this.prediction == null)
1431        return false;
1432      for (RiskAssessmentPredictionComponent item : this.prediction)
1433        if (!item.isEmpty())
1434          return true;
1435      return false;
1436    }
1437
1438    public RiskAssessmentPredictionComponent addPrediction() { //3
1439      RiskAssessmentPredictionComponent t = new RiskAssessmentPredictionComponent();
1440      if (this.prediction == null)
1441        this.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1442      this.prediction.add(t);
1443      return t;
1444    }
1445
1446    public RiskAssessment addPrediction(RiskAssessmentPredictionComponent t) { //3
1447      if (t == null)
1448        return this;
1449      if (this.prediction == null)
1450        this.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1451      this.prediction.add(t);
1452      return this;
1453    }
1454
1455    /**
1456     * @return The first repetition of repeating field {@link #prediction}, creating it if it does not already exist
1457     */
1458    public RiskAssessmentPredictionComponent getPredictionFirstRep() { 
1459      if (getPrediction().isEmpty()) {
1460        addPrediction();
1461      }
1462      return getPrediction().get(0);
1463    }
1464
1465    /**
1466     * @return {@link #mitigation} (A description of the steps that might be taken to reduce the identified risk(s).). This is the underlying object with id, value and extensions. The accessor "getMitigation" gives direct access to the value
1467     */
1468    public StringType getMitigationElement() { 
1469      if (this.mitigation == null)
1470        if (Configuration.errorOnAutoCreate())
1471          throw new Error("Attempt to auto-create RiskAssessment.mitigation");
1472        else if (Configuration.doAutoCreate())
1473          this.mitigation = new StringType(); // bb
1474      return this.mitigation;
1475    }
1476
1477    public boolean hasMitigationElement() { 
1478      return this.mitigation != null && !this.mitigation.isEmpty();
1479    }
1480
1481    public boolean hasMitigation() { 
1482      return this.mitigation != null && !this.mitigation.isEmpty();
1483    }
1484
1485    /**
1486     * @param value {@link #mitigation} (A description of the steps that might be taken to reduce the identified risk(s).). This is the underlying object with id, value and extensions. The accessor "getMitigation" gives direct access to the value
1487     */
1488    public RiskAssessment setMitigationElement(StringType value) { 
1489      this.mitigation = value;
1490      return this;
1491    }
1492
1493    /**
1494     * @return A description of the steps that might be taken to reduce the identified risk(s).
1495     */
1496    public String getMitigation() { 
1497      return this.mitigation == null ? null : this.mitigation.getValue();
1498    }
1499
1500    /**
1501     * @param value A description of the steps that might be taken to reduce the identified risk(s).
1502     */
1503    public RiskAssessment setMitigation(String value) { 
1504      if (Utilities.noString(value))
1505        this.mitigation = null;
1506      else {
1507        if (this.mitigation == null)
1508          this.mitigation = new StringType();
1509        this.mitigation.setValue(value);
1510      }
1511      return this;
1512    }
1513
1514    /**
1515     * @return {@link #comment} (Additional comments about the risk assessment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1516     */
1517    public StringType getCommentElement() { 
1518      if (this.comment == null)
1519        if (Configuration.errorOnAutoCreate())
1520          throw new Error("Attempt to auto-create RiskAssessment.comment");
1521        else if (Configuration.doAutoCreate())
1522          this.comment = new StringType(); // bb
1523      return this.comment;
1524    }
1525
1526    public boolean hasCommentElement() { 
1527      return this.comment != null && !this.comment.isEmpty();
1528    }
1529
1530    public boolean hasComment() { 
1531      return this.comment != null && !this.comment.isEmpty();
1532    }
1533
1534    /**
1535     * @param value {@link #comment} (Additional comments about the risk assessment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1536     */
1537    public RiskAssessment setCommentElement(StringType value) { 
1538      this.comment = value;
1539      return this;
1540    }
1541
1542    /**
1543     * @return Additional comments about the risk assessment.
1544     */
1545    public String getComment() { 
1546      return this.comment == null ? null : this.comment.getValue();
1547    }
1548
1549    /**
1550     * @param value Additional comments about the risk assessment.
1551     */
1552    public RiskAssessment setComment(String value) { 
1553      if (Utilities.noString(value))
1554        this.comment = null;
1555      else {
1556        if (this.comment == null)
1557          this.comment = new StringType();
1558        this.comment.setValue(value);
1559      }
1560      return this;
1561    }
1562
1563      protected void listChildren(List<Property> childrenList) {
1564        super.listChildren(childrenList);
1565        childrenList.add(new Property("identifier", "Identifier", "Business identifier assigned to the risk assessment.", 0, java.lang.Integer.MAX_VALUE, identifier));
1566        childrenList.add(new Property("basedOn", "Reference(Any)", "A reference to the request that is fulfilled by this risk assessment.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1567        childrenList.add(new Property("parent", "Reference(Any)", "A reference to a resource that this risk assessment is part of, such as a Procedure.", 0, java.lang.Integer.MAX_VALUE, parent));
1568        childrenList.add(new Property("status", "code", "The status of the RiskAssessment, using the same statuses as an Observation.", 0, java.lang.Integer.MAX_VALUE, status));
1569        childrenList.add(new Property("method", "CodeableConcept", "The algorithm, process or mechanism used to evaluate the risk.", 0, java.lang.Integer.MAX_VALUE, method));
1570        childrenList.add(new Property("code", "CodeableConcept", "The type of the risk assessment performed.", 0, java.lang.Integer.MAX_VALUE, code));
1571        childrenList.add(new Property("subject", "Reference(Patient|Group)", "The patient or group the risk assessment applies to.", 0, java.lang.Integer.MAX_VALUE, subject));
1572        childrenList.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter where the assessment was performed.", 0, java.lang.Integer.MAX_VALUE, context));
1573        childrenList.add(new Property("occurrence[x]", "dateTime|Period", "The date (and possibly time) the risk assessment was performed.", 0, java.lang.Integer.MAX_VALUE, occurrence));
1574        childrenList.add(new Property("condition", "Reference(Condition)", "For assessments or prognosis specific to a particular condition, indicates the condition being assessed.", 0, java.lang.Integer.MAX_VALUE, condition));
1575        childrenList.add(new Property("performer", "Reference(Practitioner|Device)", "The provider or software application that performed the assessment.", 0, java.lang.Integer.MAX_VALUE, performer));
1576        childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Any)", "The reason the risk assessment was performed.", 0, java.lang.Integer.MAX_VALUE, reason));
1577        childrenList.add(new Property("basis", "Reference(Any)", "Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).", 0, java.lang.Integer.MAX_VALUE, basis));
1578        childrenList.add(new Property("prediction", "", "Describes the expected outcome for the subject.", 0, java.lang.Integer.MAX_VALUE, prediction));
1579        childrenList.add(new Property("mitigation", "string", "A description of the steps that might be taken to reduce the identified risk(s).", 0, java.lang.Integer.MAX_VALUE, mitigation));
1580        childrenList.add(new Property("comment", "string", "Additional comments about the risk assessment.", 0, java.lang.Integer.MAX_VALUE, comment));
1581      }
1582
1583      @Override
1584      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1585        switch (hash) {
1586        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1587        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : new Base[] {this.basedOn}; // Reference
1588        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : new Base[] {this.parent}; // Reference
1589        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<RiskAssessmentStatus>
1590        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
1591        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1592        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1593        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
1594        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
1595        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // Reference
1596        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
1597        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Type
1598        case 93508670: /*basis*/ return this.basis == null ? new Base[0] : this.basis.toArray(new Base[this.basis.size()]); // Reference
1599        case 1161234575: /*prediction*/ return this.prediction == null ? new Base[0] : this.prediction.toArray(new Base[this.prediction.size()]); // RiskAssessmentPredictionComponent
1600        case 1293793087: /*mitigation*/ return this.mitigation == null ? new Base[0] : new Base[] {this.mitigation}; // StringType
1601        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
1602        default: return super.getProperty(hash, name, checkValid);
1603        }
1604
1605      }
1606
1607      @Override
1608      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1609        switch (hash) {
1610        case -1618432855: // identifier
1611          this.identifier = castToIdentifier(value); // Identifier
1612          return value;
1613        case -332612366: // basedOn
1614          this.basedOn = castToReference(value); // Reference
1615          return value;
1616        case -995424086: // parent
1617          this.parent = castToReference(value); // Reference
1618          return value;
1619        case -892481550: // status
1620          value = new RiskAssessmentStatusEnumFactory().fromType(castToCode(value));
1621          this.status = (Enumeration) value; // Enumeration<RiskAssessmentStatus>
1622          return value;
1623        case -1077554975: // method
1624          this.method = castToCodeableConcept(value); // CodeableConcept
1625          return value;
1626        case 3059181: // code
1627          this.code = castToCodeableConcept(value); // CodeableConcept
1628          return value;
1629        case -1867885268: // subject
1630          this.subject = castToReference(value); // Reference
1631          return value;
1632        case 951530927: // context
1633          this.context = castToReference(value); // Reference
1634          return value;
1635        case 1687874001: // occurrence
1636          this.occurrence = castToType(value); // Type
1637          return value;
1638        case -861311717: // condition
1639          this.condition = castToReference(value); // Reference
1640          return value;
1641        case 481140686: // performer
1642          this.performer = castToReference(value); // Reference
1643          return value;
1644        case -934964668: // reason
1645          this.reason = castToType(value); // Type
1646          return value;
1647        case 93508670: // basis
1648          this.getBasis().add(castToReference(value)); // Reference
1649          return value;
1650        case 1161234575: // prediction
1651          this.getPrediction().add((RiskAssessmentPredictionComponent) value); // RiskAssessmentPredictionComponent
1652          return value;
1653        case 1293793087: // mitigation
1654          this.mitigation = castToString(value); // StringType
1655          return value;
1656        case 950398559: // comment
1657          this.comment = castToString(value); // StringType
1658          return value;
1659        default: return super.setProperty(hash, name, value);
1660        }
1661
1662      }
1663
1664      @Override
1665      public Base setProperty(String name, Base value) throws FHIRException {
1666        if (name.equals("identifier")) {
1667          this.identifier = castToIdentifier(value); // Identifier
1668        } else if (name.equals("basedOn")) {
1669          this.basedOn = castToReference(value); // Reference
1670        } else if (name.equals("parent")) {
1671          this.parent = castToReference(value); // Reference
1672        } else if (name.equals("status")) {
1673          value = new RiskAssessmentStatusEnumFactory().fromType(castToCode(value));
1674          this.status = (Enumeration) value; // Enumeration<RiskAssessmentStatus>
1675        } else if (name.equals("method")) {
1676          this.method = castToCodeableConcept(value); // CodeableConcept
1677        } else if (name.equals("code")) {
1678          this.code = castToCodeableConcept(value); // CodeableConcept
1679        } else if (name.equals("subject")) {
1680          this.subject = castToReference(value); // Reference
1681        } else if (name.equals("context")) {
1682          this.context = castToReference(value); // Reference
1683        } else if (name.equals("occurrence[x]")) {
1684          this.occurrence = castToType(value); // Type
1685        } else if (name.equals("condition")) {
1686          this.condition = castToReference(value); // Reference
1687        } else if (name.equals("performer")) {
1688          this.performer = castToReference(value); // Reference
1689        } else if (name.equals("reason[x]")) {
1690          this.reason = castToType(value); // Type
1691        } else if (name.equals("basis")) {
1692          this.getBasis().add(castToReference(value));
1693        } else if (name.equals("prediction")) {
1694          this.getPrediction().add((RiskAssessmentPredictionComponent) value);
1695        } else if (name.equals("mitigation")) {
1696          this.mitigation = castToString(value); // StringType
1697        } else if (name.equals("comment")) {
1698          this.comment = castToString(value); // StringType
1699        } else
1700          return super.setProperty(name, value);
1701        return value;
1702      }
1703
1704      @Override
1705      public Base makeProperty(int hash, String name) throws FHIRException {
1706        switch (hash) {
1707        case -1618432855:  return getIdentifier(); 
1708        case -332612366:  return getBasedOn(); 
1709        case -995424086:  return getParent(); 
1710        case -892481550:  return getStatusElement();
1711        case -1077554975:  return getMethod(); 
1712        case 3059181:  return getCode(); 
1713        case -1867885268:  return getSubject(); 
1714        case 951530927:  return getContext(); 
1715        case -2022646513:  return getOccurrence(); 
1716        case 1687874001:  return getOccurrence(); 
1717        case -861311717:  return getCondition(); 
1718        case 481140686:  return getPerformer(); 
1719        case -669418564:  return getReason(); 
1720        case -934964668:  return getReason(); 
1721        case 93508670:  return addBasis(); 
1722        case 1161234575:  return addPrediction(); 
1723        case 1293793087:  return getMitigationElement();
1724        case 950398559:  return getCommentElement();
1725        default: return super.makeProperty(hash, name);
1726        }
1727
1728      }
1729
1730      @Override
1731      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1732        switch (hash) {
1733        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1734        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1735        case -995424086: /*parent*/ return new String[] {"Reference"};
1736        case -892481550: /*status*/ return new String[] {"code"};
1737        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
1738        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1739        case -1867885268: /*subject*/ return new String[] {"Reference"};
1740        case 951530927: /*context*/ return new String[] {"Reference"};
1741        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period"};
1742        case -861311717: /*condition*/ return new String[] {"Reference"};
1743        case 481140686: /*performer*/ return new String[] {"Reference"};
1744        case -934964668: /*reason*/ return new String[] {"CodeableConcept", "Reference"};
1745        case 93508670: /*basis*/ return new String[] {"Reference"};
1746        case 1161234575: /*prediction*/ return new String[] {};
1747        case 1293793087: /*mitigation*/ return new String[] {"string"};
1748        case 950398559: /*comment*/ return new String[] {"string"};
1749        default: return super.getTypesForProperty(hash, name);
1750        }
1751
1752      }
1753
1754      @Override
1755      public Base addChild(String name) throws FHIRException {
1756        if (name.equals("identifier")) {
1757          this.identifier = new Identifier();
1758          return this.identifier;
1759        }
1760        else if (name.equals("basedOn")) {
1761          this.basedOn = new Reference();
1762          return this.basedOn;
1763        }
1764        else if (name.equals("parent")) {
1765          this.parent = new Reference();
1766          return this.parent;
1767        }
1768        else if (name.equals("status")) {
1769          throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.status");
1770        }
1771        else if (name.equals("method")) {
1772          this.method = new CodeableConcept();
1773          return this.method;
1774        }
1775        else if (name.equals("code")) {
1776          this.code = new CodeableConcept();
1777          return this.code;
1778        }
1779        else if (name.equals("subject")) {
1780          this.subject = new Reference();
1781          return this.subject;
1782        }
1783        else if (name.equals("context")) {
1784          this.context = new Reference();
1785          return this.context;
1786        }
1787        else if (name.equals("occurrenceDateTime")) {
1788          this.occurrence = new DateTimeType();
1789          return this.occurrence;
1790        }
1791        else if (name.equals("occurrencePeriod")) {
1792          this.occurrence = new Period();
1793          return this.occurrence;
1794        }
1795        else if (name.equals("condition")) {
1796          this.condition = new Reference();
1797          return this.condition;
1798        }
1799        else if (name.equals("performer")) {
1800          this.performer = new Reference();
1801          return this.performer;
1802        }
1803        else if (name.equals("reasonCodeableConcept")) {
1804          this.reason = new CodeableConcept();
1805          return this.reason;
1806        }
1807        else if (name.equals("reasonReference")) {
1808          this.reason = new Reference();
1809          return this.reason;
1810        }
1811        else if (name.equals("basis")) {
1812          return addBasis();
1813        }
1814        else if (name.equals("prediction")) {
1815          return addPrediction();
1816        }
1817        else if (name.equals("mitigation")) {
1818          throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.mitigation");
1819        }
1820        else if (name.equals("comment")) {
1821          throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.comment");
1822        }
1823        else
1824          return super.addChild(name);
1825      }
1826
1827  public String fhirType() {
1828    return "RiskAssessment";
1829
1830  }
1831
1832      public RiskAssessment copy() {
1833        RiskAssessment dst = new RiskAssessment();
1834        copyValues(dst);
1835        dst.identifier = identifier == null ? null : identifier.copy();
1836        dst.basedOn = basedOn == null ? null : basedOn.copy();
1837        dst.parent = parent == null ? null : parent.copy();
1838        dst.status = status == null ? null : status.copy();
1839        dst.method = method == null ? null : method.copy();
1840        dst.code = code == null ? null : code.copy();
1841        dst.subject = subject == null ? null : subject.copy();
1842        dst.context = context == null ? null : context.copy();
1843        dst.occurrence = occurrence == null ? null : occurrence.copy();
1844        dst.condition = condition == null ? null : condition.copy();
1845        dst.performer = performer == null ? null : performer.copy();
1846        dst.reason = reason == null ? null : reason.copy();
1847        if (basis != null) {
1848          dst.basis = new ArrayList<Reference>();
1849          for (Reference i : basis)
1850            dst.basis.add(i.copy());
1851        };
1852        if (prediction != null) {
1853          dst.prediction = new ArrayList<RiskAssessmentPredictionComponent>();
1854          for (RiskAssessmentPredictionComponent i : prediction)
1855            dst.prediction.add(i.copy());
1856        };
1857        dst.mitigation = mitigation == null ? null : mitigation.copy();
1858        dst.comment = comment == null ? null : comment.copy();
1859        return dst;
1860      }
1861
1862      protected RiskAssessment typedCopy() {
1863        return copy();
1864      }
1865
1866      @Override
1867      public boolean equalsDeep(Base other) {
1868        if (!super.equalsDeep(other))
1869          return false;
1870        if (!(other instanceof RiskAssessment))
1871          return false;
1872        RiskAssessment o = (RiskAssessment) other;
1873        return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(parent, o.parent, true)
1874           && compareDeep(status, o.status, true) && compareDeep(method, o.method, true) && compareDeep(code, o.code, true)
1875           && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true) && compareDeep(occurrence, o.occurrence, true)
1876           && compareDeep(condition, o.condition, true) && compareDeep(performer, o.performer, true) && compareDeep(reason, o.reason, true)
1877           && compareDeep(basis, o.basis, true) && compareDeep(prediction, o.prediction, true) && compareDeep(mitigation, o.mitigation, true)
1878           && compareDeep(comment, o.comment, true);
1879      }
1880
1881      @Override
1882      public boolean equalsShallow(Base other) {
1883        if (!super.equalsShallow(other))
1884          return false;
1885        if (!(other instanceof RiskAssessment))
1886          return false;
1887        RiskAssessment o = (RiskAssessment) other;
1888        return compareValues(status, o.status, true) && compareValues(mitigation, o.mitigation, true) && compareValues(comment, o.comment, true)
1889          ;
1890      }
1891
1892      public boolean isEmpty() {
1893        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, parent
1894          , status, method, code, subject, context, occurrence, condition, performer, reason
1895          , basis, prediction, mitigation, comment);
1896      }
1897
1898  @Override
1899  public ResourceType getResourceType() {
1900    return ResourceType.RiskAssessment;
1901   }
1902
1903 /**
1904   * Search parameter: <b>date</b>
1905   * <p>
1906   * Description: <b>When was assessment made?</b><br>
1907   * Type: <b>date</b><br>
1908   * Path: <b>RiskAssessment.occurrenceDateTime</b><br>
1909   * </p>
1910   */
1911  @SearchParamDefinition(name="date", path="RiskAssessment.occurrence.as(DateTime)", description="When was assessment made?", type="date" )
1912  public static final String SP_DATE = "date";
1913 /**
1914   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1915   * <p>
1916   * Description: <b>When was assessment made?</b><br>
1917   * Type: <b>date</b><br>
1918   * Path: <b>RiskAssessment.occurrenceDateTime</b><br>
1919   * </p>
1920   */
1921  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1922
1923 /**
1924   * Search parameter: <b>identifier</b>
1925   * <p>
1926   * Description: <b>Unique identifier for the assessment</b><br>
1927   * Type: <b>token</b><br>
1928   * Path: <b>RiskAssessment.identifier</b><br>
1929   * </p>
1930   */
1931  @SearchParamDefinition(name="identifier", path="RiskAssessment.identifier", description="Unique identifier for the assessment", type="token" )
1932  public static final String SP_IDENTIFIER = "identifier";
1933 /**
1934   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1935   * <p>
1936   * Description: <b>Unique identifier for the assessment</b><br>
1937   * Type: <b>token</b><br>
1938   * Path: <b>RiskAssessment.identifier</b><br>
1939   * </p>
1940   */
1941  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1942
1943 /**
1944   * Search parameter: <b>condition</b>
1945   * <p>
1946   * Description: <b>Condition assessed</b><br>
1947   * Type: <b>reference</b><br>
1948   * Path: <b>RiskAssessment.condition</b><br>
1949   * </p>
1950   */
1951  @SearchParamDefinition(name="condition", path="RiskAssessment.condition", description="Condition assessed", type="reference", target={Condition.class } )
1952  public static final String SP_CONDITION = "condition";
1953 /**
1954   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
1955   * <p>
1956   * Description: <b>Condition assessed</b><br>
1957   * Type: <b>reference</b><br>
1958   * Path: <b>RiskAssessment.condition</b><br>
1959   * </p>
1960   */
1961  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONDITION);
1962
1963/**
1964   * Constant for fluent queries to be used to add include statements. Specifies
1965   * the path value of "<b>RiskAssessment:condition</b>".
1966   */
1967  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include("RiskAssessment:condition").toLocked();
1968
1969 /**
1970   * Search parameter: <b>performer</b>
1971   * <p>
1972   * Description: <b>Who did assessment?</b><br>
1973   * Type: <b>reference</b><br>
1974   * Path: <b>RiskAssessment.performer</b><br>
1975   * </p>
1976   */
1977  @SearchParamDefinition(name="performer", path="RiskAssessment.performer", description="Who did assessment?", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Practitioner.class } )
1978  public static final String SP_PERFORMER = "performer";
1979 /**
1980   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
1981   * <p>
1982   * Description: <b>Who did assessment?</b><br>
1983   * Type: <b>reference</b><br>
1984   * Path: <b>RiskAssessment.performer</b><br>
1985   * </p>
1986   */
1987  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
1988
1989/**
1990   * Constant for fluent queries to be used to add include statements. Specifies
1991   * the path value of "<b>RiskAssessment:performer</b>".
1992   */
1993  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("RiskAssessment:performer").toLocked();
1994
1995 /**
1996   * Search parameter: <b>method</b>
1997   * <p>
1998   * Description: <b>Evaluation mechanism</b><br>
1999   * Type: <b>token</b><br>
2000   * Path: <b>RiskAssessment.method</b><br>
2001   * </p>
2002   */
2003  @SearchParamDefinition(name="method", path="RiskAssessment.method", description="Evaluation mechanism", type="token" )
2004  public static final String SP_METHOD = "method";
2005 /**
2006   * <b>Fluent Client</b> search parameter constant for <b>method</b>
2007   * <p>
2008   * Description: <b>Evaluation mechanism</b><br>
2009   * Type: <b>token</b><br>
2010   * Path: <b>RiskAssessment.method</b><br>
2011   * </p>
2012   */
2013  public static final ca.uhn.fhir.rest.gclient.TokenClientParam METHOD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_METHOD);
2014
2015 /**
2016   * Search parameter: <b>subject</b>
2017   * <p>
2018   * Description: <b>Who/what does assessment apply to?</b><br>
2019   * Type: <b>reference</b><br>
2020   * Path: <b>RiskAssessment.subject</b><br>
2021   * </p>
2022   */
2023  @SearchParamDefinition(name="subject", path="RiskAssessment.subject", description="Who/what does assessment apply to?", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } )
2024  public static final String SP_SUBJECT = "subject";
2025 /**
2026   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2027   * <p>
2028   * Description: <b>Who/what does assessment apply to?</b><br>
2029   * Type: <b>reference</b><br>
2030   * Path: <b>RiskAssessment.subject</b><br>
2031   * </p>
2032   */
2033  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2034
2035/**
2036   * Constant for fluent queries to be used to add include statements. Specifies
2037   * the path value of "<b>RiskAssessment:subject</b>".
2038   */
2039  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("RiskAssessment:subject").toLocked();
2040
2041 /**
2042   * Search parameter: <b>patient</b>
2043   * <p>
2044   * Description: <b>Who/what does assessment apply to?</b><br>
2045   * Type: <b>reference</b><br>
2046   * Path: <b>RiskAssessment.subject</b><br>
2047   * </p>
2048   */
2049  @SearchParamDefinition(name="patient", path="RiskAssessment.subject", description="Who/what does assessment apply to?", type="reference", target={Patient.class } )
2050  public static final String SP_PATIENT = "patient";
2051 /**
2052   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2053   * <p>
2054   * Description: <b>Who/what does assessment apply to?</b><br>
2055   * Type: <b>reference</b><br>
2056   * Path: <b>RiskAssessment.subject</b><br>
2057   * </p>
2058   */
2059  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2060
2061/**
2062   * Constant for fluent queries to be used to add include statements. Specifies
2063   * the path value of "<b>RiskAssessment:patient</b>".
2064   */
2065  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("RiskAssessment:patient").toLocked();
2066
2067 /**
2068   * Search parameter: <b>probability</b>
2069   * <p>
2070   * Description: <b>Likelihood of specified outcome</b><br>
2071   * Type: <b>number</b><br>
2072   * Path: <b>RiskAssessment.prediction.probability[x]</b><br>
2073   * </p>
2074   */
2075  @SearchParamDefinition(name="probability", path="RiskAssessment.prediction.probability", description="Likelihood of specified outcome", type="number" )
2076  public static final String SP_PROBABILITY = "probability";
2077 /**
2078   * <b>Fluent Client</b> search parameter constant for <b>probability</b>
2079   * <p>
2080   * Description: <b>Likelihood of specified outcome</b><br>
2081   * Type: <b>number</b><br>
2082   * Path: <b>RiskAssessment.prediction.probability[x]</b><br>
2083   * </p>
2084   */
2085  public static final ca.uhn.fhir.rest.gclient.NumberClientParam PROBABILITY = new ca.uhn.fhir.rest.gclient.NumberClientParam(SP_PROBABILITY);
2086
2087 /**
2088   * Search parameter: <b>risk</b>
2089   * <p>
2090   * Description: <b>Likelihood of specified outcome as a qualitative value</b><br>
2091   * Type: <b>token</b><br>
2092   * Path: <b>RiskAssessment.prediction.qualitativeRisk</b><br>
2093   * </p>
2094   */
2095  @SearchParamDefinition(name="risk", path="RiskAssessment.prediction.qualitativeRisk", description="Likelihood of specified outcome as a qualitative value", type="token" )
2096  public static final String SP_RISK = "risk";
2097 /**
2098   * <b>Fluent Client</b> search parameter constant for <b>risk</b>
2099   * <p>
2100   * Description: <b>Likelihood of specified outcome as a qualitative value</b><br>
2101   * Type: <b>token</b><br>
2102   * Path: <b>RiskAssessment.prediction.qualitativeRisk</b><br>
2103   * </p>
2104   */
2105  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RISK = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RISK);
2106
2107 /**
2108   * Search parameter: <b>encounter</b>
2109   * <p>
2110   * Description: <b>Where was assessment performed?</b><br>
2111   * Type: <b>reference</b><br>
2112   * Path: <b>RiskAssessment.context</b><br>
2113   * </p>
2114   */
2115  @SearchParamDefinition(name="encounter", path="RiskAssessment.context", description="Where was assessment performed?", type="reference", target={Encounter.class } )
2116  public static final String SP_ENCOUNTER = "encounter";
2117 /**
2118   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2119   * <p>
2120   * Description: <b>Where was assessment performed?</b><br>
2121   * Type: <b>reference</b><br>
2122   * Path: <b>RiskAssessment.context</b><br>
2123   * </p>
2124   */
2125  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2126
2127/**
2128   * Constant for fluent queries to be used to add include statements. Specifies
2129   * the path value of "<b>RiskAssessment:encounter</b>".
2130   */
2131  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("RiskAssessment:encounter").toLocked();
2132
2133
2134}
2135