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