001package org.hl7.fhir.dstu2.model; 002 003 004 005 006import java.math.BigDecimal; 007 008/* 009 Copyright (c) 2011+, HL7, Inc. 010 All rights reserved. 011 012 Redistribution and use in source and binary forms, with or without modification, 013 are permitted provided that the following conditions are met: 014 015 * Redistributions of source code must retain the above copyright notice, this 016 list of conditions and the following disclaimer. 017 * Redistributions in binary form must reproduce the above copyright notice, 018 this list of conditions and the following disclaimer in the documentation 019 and/or other materials provided with the distribution. 020 * Neither the name of HL7 nor the names of its contributors may be used to 021 endorse or promote products derived from this software without specific 022 prior written permission. 023 024 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 025 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 026 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 027 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 028 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 029 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 030 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 031 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 032 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 033 POSSIBILITY OF SUCH DAMAGE. 034 035*/ 036 037// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 038import java.util.ArrayList; 039import java.util.Date; 040import java.util.List; 041 042import ca.uhn.fhir.model.api.annotation.Block; 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.ResourceDef; 046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 047import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 048import org.hl7.fhir.exceptions.FHIRException; 049import org.hl7.fhir.utilities.Utilities; 050/** 051 * An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome. 052 */ 053@ResourceDef(name="RiskAssessment", profile="http://hl7.org/fhir/Profile/RiskAssessment") 054public class RiskAssessment extends DomainResource { 055 056 @Block() 057 public static class RiskAssessmentPredictionComponent extends BackboneElement implements IBaseBackboneElement { 058 /** 059 * One of the potential outcomes for the patient (e.g. remission, death, a particular condition). 060 */ 061 @Child(name = "outcome", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false) 062 @Description(shortDefinition="Possible outcome for the subject", formalDefinition="One of the potential outcomes for the patient (e.g. remission, death, a particular condition)." ) 063 protected CodeableConcept outcome; 064 065 /** 066 * How likely is the outcome (in the specified timeframe). 067 */ 068 @Child(name = "probability", type = {DecimalType.class, Range.class, CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) 069 @Description(shortDefinition="Likelihood of specified outcome", formalDefinition="How likely is the outcome (in the specified timeframe)." ) 070 protected Type probability; 071 072 /** 073 * 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.). 074 */ 075 @Child(name = "relativeRisk", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false) 076 @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.)." ) 077 protected DecimalType relativeRisk; 078 079 /** 080 * Indicates the period of time or age range of the subject to which the specified probability applies. 081 */ 082 @Child(name = "when", type = {Period.class, Range.class}, order=4, min=0, max=1, modifier=false, summary=false) 083 @Description(shortDefinition="Timeframe or age range", formalDefinition="Indicates the period of time or age range of the subject to which the specified probability applies." ) 084 protected Type when; 085 086 /** 087 * Additional information explaining the basis for the prediction. 088 */ 089 @Child(name = "rationale", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false) 090 @Description(shortDefinition="Explanation of prediction", formalDefinition="Additional information explaining the basis for the prediction." ) 091 protected StringType rationale; 092 093 private static final long serialVersionUID = 647967428L; 094 095 /* 096 * Constructor 097 */ 098 public RiskAssessmentPredictionComponent() { 099 super(); 100 } 101 102 /* 103 * Constructor 104 */ 105 public RiskAssessmentPredictionComponent(CodeableConcept outcome) { 106 super(); 107 this.outcome = outcome; 108 } 109 110 /** 111 * @return {@link #outcome} (One of the potential outcomes for the patient (e.g. remission, death, a particular condition).) 112 */ 113 public CodeableConcept getOutcome() { 114 if (this.outcome == null) 115 if (Configuration.errorOnAutoCreate()) 116 throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.outcome"); 117 else if (Configuration.doAutoCreate()) 118 this.outcome = new CodeableConcept(); // cc 119 return this.outcome; 120 } 121 122 public boolean hasOutcome() { 123 return this.outcome != null && !this.outcome.isEmpty(); 124 } 125 126 /** 127 * @param value {@link #outcome} (One of the potential outcomes for the patient (e.g. remission, death, a particular condition).) 128 */ 129 public RiskAssessmentPredictionComponent setOutcome(CodeableConcept value) { 130 this.outcome = value; 131 return this; 132 } 133 134 /** 135 * @return {@link #probability} (How likely is the outcome (in the specified timeframe).) 136 */ 137 public Type getProbability() { 138 return this.probability; 139 } 140 141 /** 142 * @return {@link #probability} (How likely is the outcome (in the specified timeframe).) 143 */ 144 public DecimalType getProbabilityDecimalType() throws FHIRException { 145 if (!(this.probability instanceof DecimalType)) 146 throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.probability.getClass().getName()+" was encountered"); 147 return (DecimalType) this.probability; 148 } 149 150 public boolean hasProbabilityDecimalType() { 151 return this.probability instanceof DecimalType; 152 } 153 154 /** 155 * @return {@link #probability} (How likely is the outcome (in the specified timeframe).) 156 */ 157 public Range getProbabilityRange() throws FHIRException { 158 if (!(this.probability instanceof Range)) 159 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.probability.getClass().getName()+" was encountered"); 160 return (Range) this.probability; 161 } 162 163 public boolean hasProbabilityRange() { 164 return this.probability instanceof Range; 165 } 166 167 /** 168 * @return {@link #probability} (How likely is the outcome (in the specified timeframe).) 169 */ 170 public CodeableConcept getProbabilityCodeableConcept() throws FHIRException { 171 if (!(this.probability instanceof CodeableConcept)) 172 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.probability.getClass().getName()+" was encountered"); 173 return (CodeableConcept) this.probability; 174 } 175 176 public boolean hasProbabilityCodeableConcept() { 177 return this.probability instanceof CodeableConcept; 178 } 179 180 public boolean hasProbability() { 181 return this.probability != null && !this.probability.isEmpty(); 182 } 183 184 /** 185 * @param value {@link #probability} (How likely is the outcome (in the specified timeframe).) 186 */ 187 public RiskAssessmentPredictionComponent setProbability(Type value) { 188 this.probability = value; 189 return this; 190 } 191 192 /** 193 * @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 194 */ 195 public DecimalType getRelativeRiskElement() { 196 if (this.relativeRisk == null) 197 if (Configuration.errorOnAutoCreate()) 198 throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.relativeRisk"); 199 else if (Configuration.doAutoCreate()) 200 this.relativeRisk = new DecimalType(); // bb 201 return this.relativeRisk; 202 } 203 204 public boolean hasRelativeRiskElement() { 205 return this.relativeRisk != null && !this.relativeRisk.isEmpty(); 206 } 207 208 public boolean hasRelativeRisk() { 209 return this.relativeRisk != null && !this.relativeRisk.isEmpty(); 210 } 211 212 /** 213 * @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 214 */ 215 public RiskAssessmentPredictionComponent setRelativeRiskElement(DecimalType value) { 216 this.relativeRisk = value; 217 return this; 218 } 219 220 /** 221 * @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.). 222 */ 223 public BigDecimal getRelativeRisk() { 224 return this.relativeRisk == null ? null : this.relativeRisk.getValue(); 225 } 226 227 /** 228 * @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.). 229 */ 230 public RiskAssessmentPredictionComponent setRelativeRisk(BigDecimal value) { 231 if (value == null) 232 this.relativeRisk = null; 233 else { 234 if (this.relativeRisk == null) 235 this.relativeRisk = new DecimalType(); 236 this.relativeRisk.setValue(value); 237 } 238 return this; 239 } 240 241 /** 242 * @return {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.) 243 */ 244 public Type getWhen() { 245 return this.when; 246 } 247 248 /** 249 * @return {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.) 250 */ 251 public Period getWhenPeriod() throws FHIRException { 252 if (!(this.when instanceof Period)) 253 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.when.getClass().getName()+" was encountered"); 254 return (Period) this.when; 255 } 256 257 public boolean hasWhenPeriod() { 258 return this.when instanceof Period; 259 } 260 261 /** 262 * @return {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.) 263 */ 264 public Range getWhenRange() throws FHIRException { 265 if (!(this.when instanceof Range)) 266 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.when.getClass().getName()+" was encountered"); 267 return (Range) this.when; 268 } 269 270 public boolean hasWhenRange() { 271 return this.when instanceof Range; 272 } 273 274 public boolean hasWhen() { 275 return this.when != null && !this.when.isEmpty(); 276 } 277 278 /** 279 * @param value {@link #when} (Indicates the period of time or age range of the subject to which the specified probability applies.) 280 */ 281 public RiskAssessmentPredictionComponent setWhen(Type value) { 282 this.when = value; 283 return this; 284 } 285 286 /** 287 * @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 288 */ 289 public StringType getRationaleElement() { 290 if (this.rationale == null) 291 if (Configuration.errorOnAutoCreate()) 292 throw new Error("Attempt to auto-create RiskAssessmentPredictionComponent.rationale"); 293 else if (Configuration.doAutoCreate()) 294 this.rationale = new StringType(); // bb 295 return this.rationale; 296 } 297 298 public boolean hasRationaleElement() { 299 return this.rationale != null && !this.rationale.isEmpty(); 300 } 301 302 public boolean hasRationale() { 303 return this.rationale != null && !this.rationale.isEmpty(); 304 } 305 306 /** 307 * @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 308 */ 309 public RiskAssessmentPredictionComponent setRationaleElement(StringType value) { 310 this.rationale = value; 311 return this; 312 } 313 314 /** 315 * @return Additional information explaining the basis for the prediction. 316 */ 317 public String getRationale() { 318 return this.rationale == null ? null : this.rationale.getValue(); 319 } 320 321 /** 322 * @param value Additional information explaining the basis for the prediction. 323 */ 324 public RiskAssessmentPredictionComponent setRationale(String value) { 325 if (Utilities.noString(value)) 326 this.rationale = null; 327 else { 328 if (this.rationale == null) 329 this.rationale = new StringType(); 330 this.rationale.setValue(value); 331 } 332 return this; 333 } 334 335 protected void listChildren(List<Property> childrenList) { 336 super.listChildren(childrenList); 337 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)); 338 childrenList.add(new Property("probability[x]", "decimal|Range|CodeableConcept", "How likely is the outcome (in the specified timeframe).", 0, java.lang.Integer.MAX_VALUE, probability)); 339 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)); 340 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)); 341 childrenList.add(new Property("rationale", "string", "Additional information explaining the basis for the prediction.", 0, java.lang.Integer.MAX_VALUE, rationale)); 342 } 343 344 @Override 345 public void setProperty(String name, Base value) throws FHIRException { 346 if (name.equals("outcome")) 347 this.outcome = castToCodeableConcept(value); // CodeableConcept 348 else if (name.equals("probability[x]")) 349 this.probability = (Type) value; // Type 350 else if (name.equals("relativeRisk")) 351 this.relativeRisk = castToDecimal(value); // DecimalType 352 else if (name.equals("when[x]")) 353 this.when = (Type) value; // Type 354 else if (name.equals("rationale")) 355 this.rationale = castToString(value); // StringType 356 else 357 super.setProperty(name, value); 358 } 359 360 @Override 361 public Base addChild(String name) throws FHIRException { 362 if (name.equals("outcome")) { 363 this.outcome = new CodeableConcept(); 364 return this.outcome; 365 } 366 else if (name.equals("probabilityDecimal")) { 367 this.probability = new DecimalType(); 368 return this.probability; 369 } 370 else if (name.equals("probabilityRange")) { 371 this.probability = new Range(); 372 return this.probability; 373 } 374 else if (name.equals("probabilityCodeableConcept")) { 375 this.probability = new CodeableConcept(); 376 return this.probability; 377 } 378 else if (name.equals("relativeRisk")) { 379 throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.relativeRisk"); 380 } 381 else if (name.equals("whenPeriod")) { 382 this.when = new Period(); 383 return this.when; 384 } 385 else if (name.equals("whenRange")) { 386 this.when = new Range(); 387 return this.when; 388 } 389 else if (name.equals("rationale")) { 390 throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.rationale"); 391 } 392 else 393 return super.addChild(name); 394 } 395 396 public RiskAssessmentPredictionComponent copy() { 397 RiskAssessmentPredictionComponent dst = new RiskAssessmentPredictionComponent(); 398 copyValues(dst); 399 dst.outcome = outcome == null ? null : outcome.copy(); 400 dst.probability = probability == null ? null : probability.copy(); 401 dst.relativeRisk = relativeRisk == null ? null : relativeRisk.copy(); 402 dst.when = when == null ? null : when.copy(); 403 dst.rationale = rationale == null ? null : rationale.copy(); 404 return dst; 405 } 406 407 @Override 408 public boolean equalsDeep(Base other) { 409 if (!super.equalsDeep(other)) 410 return false; 411 if (!(other instanceof RiskAssessmentPredictionComponent)) 412 return false; 413 RiskAssessmentPredictionComponent o = (RiskAssessmentPredictionComponent) other; 414 return compareDeep(outcome, o.outcome, true) && compareDeep(probability, o.probability, true) && compareDeep(relativeRisk, o.relativeRisk, true) 415 && compareDeep(when, o.when, true) && compareDeep(rationale, o.rationale, true); 416 } 417 418 @Override 419 public boolean equalsShallow(Base other) { 420 if (!super.equalsShallow(other)) 421 return false; 422 if (!(other instanceof RiskAssessmentPredictionComponent)) 423 return false; 424 RiskAssessmentPredictionComponent o = (RiskAssessmentPredictionComponent) other; 425 return compareValues(relativeRisk, o.relativeRisk, true) && compareValues(rationale, o.rationale, true) 426 ; 427 } 428 429 public boolean isEmpty() { 430 return super.isEmpty() && (outcome == null || outcome.isEmpty()) && (probability == null || probability.isEmpty()) 431 && (relativeRisk == null || relativeRisk.isEmpty()) && (when == null || when.isEmpty()) && (rationale == null || rationale.isEmpty()) 432 ; 433 } 434 435 public String fhirType() { 436 return "RiskAssessment.prediction"; 437 438 } 439 440 } 441 442 /** 443 * The patient or group the risk assessment applies to. 444 */ 445 @Child(name = "subject", type = {Patient.class, Group.class}, order=0, min=0, max=1, modifier=false, summary=true) 446 @Description(shortDefinition="Who/what does assessment apply to?", formalDefinition="The patient or group the risk assessment applies to." ) 447 protected Reference subject; 448 449 /** 450 * The actual object that is the target of the reference (The patient or group the risk assessment applies to.) 451 */ 452 protected Resource subjectTarget; 453 454 /** 455 * The date (and possibly time) the risk assessment was performed. 456 */ 457 @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 458 @Description(shortDefinition="When was assessment made?", formalDefinition="The date (and possibly time) the risk assessment was performed." ) 459 protected DateTimeType date; 460 461 /** 462 * For assessments or prognosis specific to a particular condition, indicates the condition being assessed. 463 */ 464 @Child(name = "condition", type = {Condition.class}, order=2, min=0, max=1, modifier=false, summary=true) 465 @Description(shortDefinition="Condition assessed", formalDefinition="For assessments or prognosis specific to a particular condition, indicates the condition being assessed." ) 466 protected Reference condition; 467 468 /** 469 * The actual object that is the target of the reference (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.) 470 */ 471 protected Condition conditionTarget; 472 473 /** 474 * The encounter where the assessment was performed. 475 */ 476 @Child(name = "encounter", type = {Encounter.class}, order=3, min=0, max=1, modifier=false, summary=true) 477 @Description(shortDefinition="Where was assessment performed?", formalDefinition="The encounter where the assessment was performed." ) 478 protected Reference encounter; 479 480 /** 481 * The actual object that is the target of the reference (The encounter where the assessment was performed.) 482 */ 483 protected Encounter encounterTarget; 484 485 /** 486 * The provider or software application that performed the assessment. 487 */ 488 @Child(name = "performer", type = {Practitioner.class, Device.class}, order=4, min=0, max=1, modifier=false, summary=true) 489 @Description(shortDefinition="Who did assessment?", formalDefinition="The provider or software application that performed the assessment." ) 490 protected Reference performer; 491 492 /** 493 * The actual object that is the target of the reference (The provider or software application that performed the assessment.) 494 */ 495 protected Resource performerTarget; 496 497 /** 498 * Business identifier assigned to the risk assessment. 499 */ 500 @Child(name = "identifier", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true) 501 @Description(shortDefinition="Unique identifier for the assessment", formalDefinition="Business identifier assigned to the risk assessment." ) 502 protected Identifier identifier; 503 504 /** 505 * The algorithm, process or mechanism used to evaluate the risk. 506 */ 507 @Child(name = "method", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 508 @Description(shortDefinition="Evaluation mechanism", formalDefinition="The algorithm, process or mechanism used to evaluate the risk." ) 509 protected CodeableConcept method; 510 511 /** 512 * Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.). 513 */ 514 @Child(name = "basis", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 515 @Description(shortDefinition="Information used in assessment", formalDefinition="Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.)." ) 516 protected List<Reference> basis; 517 /** 518 * 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.).) 519 */ 520 protected List<Resource> basisTarget; 521 522 523 /** 524 * Describes the expected outcome for the subject. 525 */ 526 @Child(name = "prediction", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 527 @Description(shortDefinition="Outcome predicted", formalDefinition="Describes the expected outcome for the subject." ) 528 protected List<RiskAssessmentPredictionComponent> prediction; 529 530 /** 531 * A description of the steps that might be taken to reduce the identified risk(s). 532 */ 533 @Child(name = "mitigation", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false) 534 @Description(shortDefinition="How to reduce risk", formalDefinition="A description of the steps that might be taken to reduce the identified risk(s)." ) 535 protected StringType mitigation; 536 537 private static final long serialVersionUID = 724306293L; 538 539 /* 540 * Constructor 541 */ 542 public RiskAssessment() { 543 super(); 544 } 545 546 /** 547 * @return {@link #subject} (The patient or group the risk assessment applies to.) 548 */ 549 public Reference getSubject() { 550 if (this.subject == null) 551 if (Configuration.errorOnAutoCreate()) 552 throw new Error("Attempt to auto-create RiskAssessment.subject"); 553 else if (Configuration.doAutoCreate()) 554 this.subject = new Reference(); // cc 555 return this.subject; 556 } 557 558 public boolean hasSubject() { 559 return this.subject != null && !this.subject.isEmpty(); 560 } 561 562 /** 563 * @param value {@link #subject} (The patient or group the risk assessment applies to.) 564 */ 565 public RiskAssessment setSubject(Reference value) { 566 this.subject = value; 567 return this; 568 } 569 570 /** 571 * @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.) 572 */ 573 public Resource getSubjectTarget() { 574 return this.subjectTarget; 575 } 576 577 /** 578 * @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.) 579 */ 580 public RiskAssessment setSubjectTarget(Resource value) { 581 this.subjectTarget = value; 582 return this; 583 } 584 585 /** 586 * @return {@link #date} (The date (and possibly time) the risk assessment was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 587 */ 588 public DateTimeType getDateElement() { 589 if (this.date == null) 590 if (Configuration.errorOnAutoCreate()) 591 throw new Error("Attempt to auto-create RiskAssessment.date"); 592 else if (Configuration.doAutoCreate()) 593 this.date = new DateTimeType(); // bb 594 return this.date; 595 } 596 597 public boolean hasDateElement() { 598 return this.date != null && !this.date.isEmpty(); 599 } 600 601 public boolean hasDate() { 602 return this.date != null && !this.date.isEmpty(); 603 } 604 605 /** 606 * @param value {@link #date} (The date (and possibly time) the risk assessment was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 607 */ 608 public RiskAssessment setDateElement(DateTimeType value) { 609 this.date = value; 610 return this; 611 } 612 613 /** 614 * @return The date (and possibly time) the risk assessment was performed. 615 */ 616 public Date getDate() { 617 return this.date == null ? null : this.date.getValue(); 618 } 619 620 /** 621 * @param value The date (and possibly time) the risk assessment was performed. 622 */ 623 public RiskAssessment setDate(Date value) { 624 if (value == null) 625 this.date = null; 626 else { 627 if (this.date == null) 628 this.date = new DateTimeType(); 629 this.date.setValue(value); 630 } 631 return this; 632 } 633 634 /** 635 * @return {@link #condition} (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.) 636 */ 637 public Reference getCondition() { 638 if (this.condition == null) 639 if (Configuration.errorOnAutoCreate()) 640 throw new Error("Attempt to auto-create RiskAssessment.condition"); 641 else if (Configuration.doAutoCreate()) 642 this.condition = new Reference(); // cc 643 return this.condition; 644 } 645 646 public boolean hasCondition() { 647 return this.condition != null && !this.condition.isEmpty(); 648 } 649 650 /** 651 * @param value {@link #condition} (For assessments or prognosis specific to a particular condition, indicates the condition being assessed.) 652 */ 653 public RiskAssessment setCondition(Reference value) { 654 this.condition = value; 655 return this; 656 } 657 658 /** 659 * @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.) 660 */ 661 public Condition getConditionTarget() { 662 if (this.conditionTarget == null) 663 if (Configuration.errorOnAutoCreate()) 664 throw new Error("Attempt to auto-create RiskAssessment.condition"); 665 else if (Configuration.doAutoCreate()) 666 this.conditionTarget = new Condition(); // aa 667 return this.conditionTarget; 668 } 669 670 /** 671 * @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.) 672 */ 673 public RiskAssessment setConditionTarget(Condition value) { 674 this.conditionTarget = value; 675 return this; 676 } 677 678 /** 679 * @return {@link #encounter} (The encounter where the assessment was performed.) 680 */ 681 public Reference getEncounter() { 682 if (this.encounter == null) 683 if (Configuration.errorOnAutoCreate()) 684 throw new Error("Attempt to auto-create RiskAssessment.encounter"); 685 else if (Configuration.doAutoCreate()) 686 this.encounter = new Reference(); // cc 687 return this.encounter; 688 } 689 690 public boolean hasEncounter() { 691 return this.encounter != null && !this.encounter.isEmpty(); 692 } 693 694 /** 695 * @param value {@link #encounter} (The encounter where the assessment was performed.) 696 */ 697 public RiskAssessment setEncounter(Reference value) { 698 this.encounter = value; 699 return this; 700 } 701 702 /** 703 * @return {@link #encounter} 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.) 704 */ 705 public Encounter getEncounterTarget() { 706 if (this.encounterTarget == null) 707 if (Configuration.errorOnAutoCreate()) 708 throw new Error("Attempt to auto-create RiskAssessment.encounter"); 709 else if (Configuration.doAutoCreate()) 710 this.encounterTarget = new Encounter(); // aa 711 return this.encounterTarget; 712 } 713 714 /** 715 * @param value {@link #encounter} 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.) 716 */ 717 public RiskAssessment setEncounterTarget(Encounter value) { 718 this.encounterTarget = value; 719 return this; 720 } 721 722 /** 723 * @return {@link #performer} (The provider or software application that performed the assessment.) 724 */ 725 public Reference getPerformer() { 726 if (this.performer == null) 727 if (Configuration.errorOnAutoCreate()) 728 throw new Error("Attempt to auto-create RiskAssessment.performer"); 729 else if (Configuration.doAutoCreate()) 730 this.performer = new Reference(); // cc 731 return this.performer; 732 } 733 734 public boolean hasPerformer() { 735 return this.performer != null && !this.performer.isEmpty(); 736 } 737 738 /** 739 * @param value {@link #performer} (The provider or software application that performed the assessment.) 740 */ 741 public RiskAssessment setPerformer(Reference value) { 742 this.performer = value; 743 return this; 744 } 745 746 /** 747 * @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.) 748 */ 749 public Resource getPerformerTarget() { 750 return this.performerTarget; 751 } 752 753 /** 754 * @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.) 755 */ 756 public RiskAssessment setPerformerTarget(Resource value) { 757 this.performerTarget = value; 758 return this; 759 } 760 761 /** 762 * @return {@link #identifier} (Business identifier assigned to the risk assessment.) 763 */ 764 public Identifier getIdentifier() { 765 if (this.identifier == null) 766 if (Configuration.errorOnAutoCreate()) 767 throw new Error("Attempt to auto-create RiskAssessment.identifier"); 768 else if (Configuration.doAutoCreate()) 769 this.identifier = new Identifier(); // cc 770 return this.identifier; 771 } 772 773 public boolean hasIdentifier() { 774 return this.identifier != null && !this.identifier.isEmpty(); 775 } 776 777 /** 778 * @param value {@link #identifier} (Business identifier assigned to the risk assessment.) 779 */ 780 public RiskAssessment setIdentifier(Identifier value) { 781 this.identifier = value; 782 return this; 783 } 784 785 /** 786 * @return {@link #method} (The algorithm, process or mechanism used to evaluate the risk.) 787 */ 788 public CodeableConcept getMethod() { 789 if (this.method == null) 790 if (Configuration.errorOnAutoCreate()) 791 throw new Error("Attempt to auto-create RiskAssessment.method"); 792 else if (Configuration.doAutoCreate()) 793 this.method = new CodeableConcept(); // cc 794 return this.method; 795 } 796 797 public boolean hasMethod() { 798 return this.method != null && !this.method.isEmpty(); 799 } 800 801 /** 802 * @param value {@link #method} (The algorithm, process or mechanism used to evaluate the risk.) 803 */ 804 public RiskAssessment setMethod(CodeableConcept value) { 805 this.method = value; 806 return this; 807 } 808 809 /** 810 * @return {@link #basis} (Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).) 811 */ 812 public List<Reference> getBasis() { 813 if (this.basis == null) 814 this.basis = new ArrayList<Reference>(); 815 return this.basis; 816 } 817 818 public boolean hasBasis() { 819 if (this.basis == null) 820 return false; 821 for (Reference item : this.basis) 822 if (!item.isEmpty()) 823 return true; 824 return false; 825 } 826 827 /** 828 * @return {@link #basis} (Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).) 829 */ 830 // syntactic sugar 831 public Reference addBasis() { //3 832 Reference t = new Reference(); 833 if (this.basis == null) 834 this.basis = new ArrayList<Reference>(); 835 this.basis.add(t); 836 return t; 837 } 838 839 // syntactic sugar 840 public RiskAssessment addBasis(Reference t) { //3 841 if (t == null) 842 return this; 843 if (this.basis == null) 844 this.basis = new ArrayList<Reference>(); 845 this.basis.add(t); 846 return this; 847 } 848 849 /** 850 * @return {@link #basis} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).) 851 */ 852 public List<Resource> getBasisTarget() { 853 if (this.basisTarget == null) 854 this.basisTarget = new ArrayList<Resource>(); 855 return this.basisTarget; 856 } 857 858 /** 859 * @return {@link #prediction} (Describes the expected outcome for the subject.) 860 */ 861 public List<RiskAssessmentPredictionComponent> getPrediction() { 862 if (this.prediction == null) 863 this.prediction = new ArrayList<RiskAssessmentPredictionComponent>(); 864 return this.prediction; 865 } 866 867 public boolean hasPrediction() { 868 if (this.prediction == null) 869 return false; 870 for (RiskAssessmentPredictionComponent item : this.prediction) 871 if (!item.isEmpty()) 872 return true; 873 return false; 874 } 875 876 /** 877 * @return {@link #prediction} (Describes the expected outcome for the subject.) 878 */ 879 // syntactic sugar 880 public RiskAssessmentPredictionComponent addPrediction() { //3 881 RiskAssessmentPredictionComponent t = new RiskAssessmentPredictionComponent(); 882 if (this.prediction == null) 883 this.prediction = new ArrayList<RiskAssessmentPredictionComponent>(); 884 this.prediction.add(t); 885 return t; 886 } 887 888 // syntactic sugar 889 public RiskAssessment addPrediction(RiskAssessmentPredictionComponent t) { //3 890 if (t == null) 891 return this; 892 if (this.prediction == null) 893 this.prediction = new ArrayList<RiskAssessmentPredictionComponent>(); 894 this.prediction.add(t); 895 return this; 896 } 897 898 /** 899 * @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 900 */ 901 public StringType getMitigationElement() { 902 if (this.mitigation == null) 903 if (Configuration.errorOnAutoCreate()) 904 throw new Error("Attempt to auto-create RiskAssessment.mitigation"); 905 else if (Configuration.doAutoCreate()) 906 this.mitigation = new StringType(); // bb 907 return this.mitigation; 908 } 909 910 public boolean hasMitigationElement() { 911 return this.mitigation != null && !this.mitigation.isEmpty(); 912 } 913 914 public boolean hasMitigation() { 915 return this.mitigation != null && !this.mitigation.isEmpty(); 916 } 917 918 /** 919 * @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 920 */ 921 public RiskAssessment setMitigationElement(StringType value) { 922 this.mitigation = value; 923 return this; 924 } 925 926 /** 927 * @return A description of the steps that might be taken to reduce the identified risk(s). 928 */ 929 public String getMitigation() { 930 return this.mitigation == null ? null : this.mitigation.getValue(); 931 } 932 933 /** 934 * @param value A description of the steps that might be taken to reduce the identified risk(s). 935 */ 936 public RiskAssessment setMitigation(String value) { 937 if (Utilities.noString(value)) 938 this.mitigation = null; 939 else { 940 if (this.mitigation == null) 941 this.mitigation = new StringType(); 942 this.mitigation.setValue(value); 943 } 944 return this; 945 } 946 947 protected void listChildren(List<Property> childrenList) { 948 super.listChildren(childrenList); 949 childrenList.add(new Property("subject", "Reference(Patient|Group)", "The patient or group the risk assessment applies to.", 0, java.lang.Integer.MAX_VALUE, subject)); 950 childrenList.add(new Property("date", "dateTime", "The date (and possibly time) the risk assessment was performed.", 0, java.lang.Integer.MAX_VALUE, date)); 951 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)); 952 childrenList.add(new Property("encounter", "Reference(Encounter)", "The encounter where the assessment was performed.", 0, java.lang.Integer.MAX_VALUE, encounter)); 953 childrenList.add(new Property("performer", "Reference(Practitioner|Device)", "The provider or software application that performed the assessment.", 0, java.lang.Integer.MAX_VALUE, performer)); 954 childrenList.add(new Property("identifier", "Identifier", "Business identifier assigned to the risk assessment.", 0, java.lang.Integer.MAX_VALUE, identifier)); 955 childrenList.add(new Property("method", "CodeableConcept", "The algorithm, process or mechanism used to evaluate the risk.", 0, java.lang.Integer.MAX_VALUE, method)); 956 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)); 957 childrenList.add(new Property("prediction", "", "Describes the expected outcome for the subject.", 0, java.lang.Integer.MAX_VALUE, prediction)); 958 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)); 959 } 960 961 @Override 962 public void setProperty(String name, Base value) throws FHIRException { 963 if (name.equals("subject")) 964 this.subject = castToReference(value); // Reference 965 else if (name.equals("date")) 966 this.date = castToDateTime(value); // DateTimeType 967 else if (name.equals("condition")) 968 this.condition = castToReference(value); // Reference 969 else if (name.equals("encounter")) 970 this.encounter = castToReference(value); // Reference 971 else if (name.equals("performer")) 972 this.performer = castToReference(value); // Reference 973 else if (name.equals("identifier")) 974 this.identifier = castToIdentifier(value); // Identifier 975 else if (name.equals("method")) 976 this.method = castToCodeableConcept(value); // CodeableConcept 977 else if (name.equals("basis")) 978 this.getBasis().add(castToReference(value)); 979 else if (name.equals("prediction")) 980 this.getPrediction().add((RiskAssessmentPredictionComponent) value); 981 else if (name.equals("mitigation")) 982 this.mitigation = castToString(value); // StringType 983 else 984 super.setProperty(name, value); 985 } 986 987 @Override 988 public Base addChild(String name) throws FHIRException { 989 if (name.equals("subject")) { 990 this.subject = new Reference(); 991 return this.subject; 992 } 993 else if (name.equals("date")) { 994 throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.date"); 995 } 996 else if (name.equals("condition")) { 997 this.condition = new Reference(); 998 return this.condition; 999 } 1000 else if (name.equals("encounter")) { 1001 this.encounter = new Reference(); 1002 return this.encounter; 1003 } 1004 else if (name.equals("performer")) { 1005 this.performer = new Reference(); 1006 return this.performer; 1007 } 1008 else if (name.equals("identifier")) { 1009 this.identifier = new Identifier(); 1010 return this.identifier; 1011 } 1012 else if (name.equals("method")) { 1013 this.method = new CodeableConcept(); 1014 return this.method; 1015 } 1016 else if (name.equals("basis")) { 1017 return addBasis(); 1018 } 1019 else if (name.equals("prediction")) { 1020 return addPrediction(); 1021 } 1022 else if (name.equals("mitigation")) { 1023 throw new FHIRException("Cannot call addChild on a primitive type RiskAssessment.mitigation"); 1024 } 1025 else 1026 return super.addChild(name); 1027 } 1028 1029 public String fhirType() { 1030 return "RiskAssessment"; 1031 1032 } 1033 1034 public RiskAssessment copy() { 1035 RiskAssessment dst = new RiskAssessment(); 1036 copyValues(dst); 1037 dst.subject = subject == null ? null : subject.copy(); 1038 dst.date = date == null ? null : date.copy(); 1039 dst.condition = condition == null ? null : condition.copy(); 1040 dst.encounter = encounter == null ? null : encounter.copy(); 1041 dst.performer = performer == null ? null : performer.copy(); 1042 dst.identifier = identifier == null ? null : identifier.copy(); 1043 dst.method = method == null ? null : method.copy(); 1044 if (basis != null) { 1045 dst.basis = new ArrayList<Reference>(); 1046 for (Reference i : basis) 1047 dst.basis.add(i.copy()); 1048 }; 1049 if (prediction != null) { 1050 dst.prediction = new ArrayList<RiskAssessmentPredictionComponent>(); 1051 for (RiskAssessmentPredictionComponent i : prediction) 1052 dst.prediction.add(i.copy()); 1053 }; 1054 dst.mitigation = mitigation == null ? null : mitigation.copy(); 1055 return dst; 1056 } 1057 1058 protected RiskAssessment typedCopy() { 1059 return copy(); 1060 } 1061 1062 @Override 1063 public boolean equalsDeep(Base other) { 1064 if (!super.equalsDeep(other)) 1065 return false; 1066 if (!(other instanceof RiskAssessment)) 1067 return false; 1068 RiskAssessment o = (RiskAssessment) other; 1069 return compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true) && compareDeep(condition, o.condition, true) 1070 && compareDeep(encounter, o.encounter, true) && compareDeep(performer, o.performer, true) && compareDeep(identifier, o.identifier, true) 1071 && compareDeep(method, o.method, true) && compareDeep(basis, o.basis, true) && compareDeep(prediction, o.prediction, true) 1072 && compareDeep(mitigation, o.mitigation, true); 1073 } 1074 1075 @Override 1076 public boolean equalsShallow(Base other) { 1077 if (!super.equalsShallow(other)) 1078 return false; 1079 if (!(other instanceof RiskAssessment)) 1080 return false; 1081 RiskAssessment o = (RiskAssessment) other; 1082 return compareValues(date, o.date, true) && compareValues(mitigation, o.mitigation, true); 1083 } 1084 1085 public boolean isEmpty() { 1086 return super.isEmpty() && (subject == null || subject.isEmpty()) && (date == null || date.isEmpty()) 1087 && (condition == null || condition.isEmpty()) && (encounter == null || encounter.isEmpty()) 1088 && (performer == null || performer.isEmpty()) && (identifier == null || identifier.isEmpty()) 1089 && (method == null || method.isEmpty()) && (basis == null || basis.isEmpty()) && (prediction == null || prediction.isEmpty()) 1090 && (mitigation == null || mitigation.isEmpty()); 1091 } 1092 1093 @Override 1094 public ResourceType getResourceType() { 1095 return ResourceType.RiskAssessment; 1096 } 1097 1098 @SearchParamDefinition(name="date", path="RiskAssessment.date", description="When was assessment made?", type="date" ) 1099 public static final String SP_DATE = "date"; 1100 @SearchParamDefinition(name="identifier", path="RiskAssessment.identifier", description="Unique identifier for the assessment", type="token" ) 1101 public static final String SP_IDENTIFIER = "identifier"; 1102 @SearchParamDefinition(name="condition", path="RiskAssessment.condition", description="Condition assessed", type="reference" ) 1103 public static final String SP_CONDITION = "condition"; 1104 @SearchParamDefinition(name="performer", path="RiskAssessment.performer", description="Who did assessment?", type="reference" ) 1105 public static final String SP_PERFORMER = "performer"; 1106 @SearchParamDefinition(name="method", path="RiskAssessment.method", description="Evaluation mechanism", type="token" ) 1107 public static final String SP_METHOD = "method"; 1108 @SearchParamDefinition(name="subject", path="RiskAssessment.subject", description="Who/what does assessment apply to?", type="reference" ) 1109 public static final String SP_SUBJECT = "subject"; 1110 @SearchParamDefinition(name="patient", path="RiskAssessment.subject", description="Who/what does assessment apply to?", type="reference" ) 1111 public static final String SP_PATIENT = "patient"; 1112 @SearchParamDefinition(name="encounter", path="RiskAssessment.encounter", description="Where was assessment performed?", type="reference" ) 1113 public static final String SP_ENCOUNTER = "encounter"; 1114 1115}