001package org.hl7.fhir.instance.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.*; 034 035import org.hl7.fhir.exceptions.FHIRException; 036import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 037import org.hl7.fhir.utilities.Utilities; 038 039import ca.uhn.fhir.model.api.annotation.*; 040/** 041 * Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a diagnosis during an encounter; populating a problem list or a summary statement, such as a discharge summary. 042 */ 043@ResourceDef(name="Condition", profile="http://hl7.org/fhir/Profile/Condition") 044public class Condition extends DomainResource { 045 046 public enum ConditionVerificationStatus { 047 /** 048 * This is a tentative diagnosis - still a candidate that is under consideration. 049 */ 050 PROVISIONAL, 051 /** 052 * One of a set of potential (and typically mutually exclusive) diagnosis asserted to further guide the diagnostic process and preliminary treatment. 053 */ 054 DIFFERENTIAL, 055 /** 056 * There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition. 057 */ 058 CONFIRMED, 059 /** 060 * This condition has been ruled out by diagnostic and clinical evidence. 061 */ 062 REFUTED, 063 /** 064 * The statement was entered in error and is not valid. 065 */ 066 ENTEREDINERROR, 067 /** 068 * The condition status is unknown. Note that "unknown" is a value of last resort and every attempt should be made to provide a meaningful value other than "unknown". 069 */ 070 UNKNOWN, 071 /** 072 * added to help the parsers 073 */ 074 NULL; 075 public static ConditionVerificationStatus fromCode(String codeString) throws FHIRException { 076 if (codeString == null || "".equals(codeString)) 077 return null; 078 if ("provisional".equals(codeString)) 079 return PROVISIONAL; 080 if ("differential".equals(codeString)) 081 return DIFFERENTIAL; 082 if ("confirmed".equals(codeString)) 083 return CONFIRMED; 084 if ("refuted".equals(codeString)) 085 return REFUTED; 086 if ("entered-in-error".equals(codeString)) 087 return ENTEREDINERROR; 088 if ("unknown".equals(codeString)) 089 return UNKNOWN; 090 throw new FHIRException("Unknown ConditionVerificationStatus code '"+codeString+"'"); 091 } 092 public String toCode() { 093 switch (this) { 094 case PROVISIONAL: return "provisional"; 095 case DIFFERENTIAL: return "differential"; 096 case CONFIRMED: return "confirmed"; 097 case REFUTED: return "refuted"; 098 case ENTEREDINERROR: return "entered-in-error"; 099 case UNKNOWN: return "unknown"; 100 default: return "?"; 101 } 102 } 103 public String getSystem() { 104 switch (this) { 105 case PROVISIONAL: return "http://hl7.org/fhir/condition-ver-status"; 106 case DIFFERENTIAL: return "http://hl7.org/fhir/condition-ver-status"; 107 case CONFIRMED: return "http://hl7.org/fhir/condition-ver-status"; 108 case REFUTED: return "http://hl7.org/fhir/condition-ver-status"; 109 case ENTEREDINERROR: return "http://hl7.org/fhir/condition-ver-status"; 110 case UNKNOWN: return "http://hl7.org/fhir/condition-ver-status"; 111 default: return "?"; 112 } 113 } 114 public String getDefinition() { 115 switch (this) { 116 case PROVISIONAL: return "This is a tentative diagnosis - still a candidate that is under consideration."; 117 case DIFFERENTIAL: return "One of a set of potential (and typically mutually exclusive) diagnosis asserted to further guide the diagnostic process and preliminary treatment."; 118 case CONFIRMED: return "There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition."; 119 case REFUTED: return "This condition has been ruled out by diagnostic and clinical evidence."; 120 case ENTEREDINERROR: return "The statement was entered in error and is not valid."; 121 case UNKNOWN: return "The condition status is unknown. Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\"."; 122 default: return "?"; 123 } 124 } 125 public String getDisplay() { 126 switch (this) { 127 case PROVISIONAL: return "Provisional"; 128 case DIFFERENTIAL: return "Differential"; 129 case CONFIRMED: return "Confirmed"; 130 case REFUTED: return "Refuted"; 131 case ENTEREDINERROR: return "Entered In Error"; 132 case UNKNOWN: return "Unknown"; 133 default: return "?"; 134 } 135 } 136 } 137 138 public static class ConditionVerificationStatusEnumFactory implements EnumFactory<ConditionVerificationStatus> { 139 public ConditionVerificationStatus fromCode(String codeString) throws IllegalArgumentException { 140 if (codeString == null || "".equals(codeString)) 141 if (codeString == null || "".equals(codeString)) 142 return null; 143 if ("provisional".equals(codeString)) 144 return ConditionVerificationStatus.PROVISIONAL; 145 if ("differential".equals(codeString)) 146 return ConditionVerificationStatus.DIFFERENTIAL; 147 if ("confirmed".equals(codeString)) 148 return ConditionVerificationStatus.CONFIRMED; 149 if ("refuted".equals(codeString)) 150 return ConditionVerificationStatus.REFUTED; 151 if ("entered-in-error".equals(codeString)) 152 return ConditionVerificationStatus.ENTEREDINERROR; 153 if ("unknown".equals(codeString)) 154 return ConditionVerificationStatus.UNKNOWN; 155 throw new IllegalArgumentException("Unknown ConditionVerificationStatus code '"+codeString+"'"); 156 } 157 public Enumeration<ConditionVerificationStatus> fromType(Base code) throws FHIRException { 158 if (code == null || code.isEmpty()) 159 return null; 160 String codeString = ((PrimitiveType) code).asStringValue(); 161 if (codeString == null || "".equals(codeString)) 162 return null; 163 if ("provisional".equals(codeString)) 164 return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.PROVISIONAL); 165 if ("differential".equals(codeString)) 166 return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.DIFFERENTIAL); 167 if ("confirmed".equals(codeString)) 168 return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.CONFIRMED); 169 if ("refuted".equals(codeString)) 170 return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.REFUTED); 171 if ("entered-in-error".equals(codeString)) 172 return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.ENTEREDINERROR); 173 if ("unknown".equals(codeString)) 174 return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.UNKNOWN); 175 throw new FHIRException("Unknown ConditionVerificationStatus code '"+codeString+"'"); 176 } 177 public String toCode(ConditionVerificationStatus code) { 178 if (code == ConditionVerificationStatus.PROVISIONAL) 179 return "provisional"; 180 if (code == ConditionVerificationStatus.DIFFERENTIAL) 181 return "differential"; 182 if (code == ConditionVerificationStatus.CONFIRMED) 183 return "confirmed"; 184 if (code == ConditionVerificationStatus.REFUTED) 185 return "refuted"; 186 if (code == ConditionVerificationStatus.ENTEREDINERROR) 187 return "entered-in-error"; 188 if (code == ConditionVerificationStatus.UNKNOWN) 189 return "unknown"; 190 return "?"; 191 } 192 } 193 194 @Block() 195 public static class ConditionStageComponent extends BackboneElement implements IBaseBackboneElement { 196 /** 197 * A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific. 198 */ 199 @Child(name = "summary", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 200 @Description(shortDefinition="Simple summary (disease specific)", formalDefinition="A simple summary of the stage such as \"Stage 3\". The determination of the stage is disease-specific." ) 201 protected CodeableConcept summary; 202 203 /** 204 * Reference to a formal record of the evidence on which the staging assessment is based. 205 */ 206 @Child(name = "assessment", type = {ClinicalImpression.class, DiagnosticReport.class, Observation.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 207 @Description(shortDefinition="Formal record of assessment", formalDefinition="Reference to a formal record of the evidence on which the staging assessment is based." ) 208 protected List<Reference> assessment; 209 /** 210 * The actual objects that are the target of the reference (Reference to a formal record of the evidence on which the staging assessment is based.) 211 */ 212 protected List<Resource> assessmentTarget; 213 214 215 private static final long serialVersionUID = -1961530405L; 216 217 /* 218 * Constructor 219 */ 220 public ConditionStageComponent() { 221 super(); 222 } 223 224 /** 225 * @return {@link #summary} (A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific.) 226 */ 227 public CodeableConcept getSummary() { 228 if (this.summary == null) 229 if (Configuration.errorOnAutoCreate()) 230 throw new Error("Attempt to auto-create ConditionStageComponent.summary"); 231 else if (Configuration.doAutoCreate()) 232 this.summary = new CodeableConcept(); // cc 233 return this.summary; 234 } 235 236 public boolean hasSummary() { 237 return this.summary != null && !this.summary.isEmpty(); 238 } 239 240 /** 241 * @param value {@link #summary} (A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific.) 242 */ 243 public ConditionStageComponent setSummary(CodeableConcept value) { 244 this.summary = value; 245 return this; 246 } 247 248 /** 249 * @return {@link #assessment} (Reference to a formal record of the evidence on which the staging assessment is based.) 250 */ 251 public List<Reference> getAssessment() { 252 if (this.assessment == null) 253 this.assessment = new ArrayList<Reference>(); 254 return this.assessment; 255 } 256 257 public boolean hasAssessment() { 258 if (this.assessment == null) 259 return false; 260 for (Reference item : this.assessment) 261 if (!item.isEmpty()) 262 return true; 263 return false; 264 } 265 266 /** 267 * @return {@link #assessment} (Reference to a formal record of the evidence on which the staging assessment is based.) 268 */ 269 // syntactic sugar 270 public Reference addAssessment() { //3 271 Reference t = new Reference(); 272 if (this.assessment == null) 273 this.assessment = new ArrayList<Reference>(); 274 this.assessment.add(t); 275 return t; 276 } 277 278 // syntactic sugar 279 public ConditionStageComponent addAssessment(Reference t) { //3 280 if (t == null) 281 return this; 282 if (this.assessment == null) 283 this.assessment = new ArrayList<Reference>(); 284 this.assessment.add(t); 285 return this; 286 } 287 288 /** 289 * @return {@link #assessment} (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. Reference to a formal record of the evidence on which the staging assessment is based.) 290 */ 291 public List<Resource> getAssessmentTarget() { 292 if (this.assessmentTarget == null) 293 this.assessmentTarget = new ArrayList<Resource>(); 294 return this.assessmentTarget; 295 } 296 297 protected void listChildren(List<Property> childrenList) { 298 super.listChildren(childrenList); 299 childrenList.add(new Property("summary", "CodeableConcept", "A simple summary of the stage such as \"Stage 3\". The determination of the stage is disease-specific.", 0, java.lang.Integer.MAX_VALUE, summary)); 300 childrenList.add(new Property("assessment", "Reference(ClinicalImpression|DiagnosticReport|Observation)", "Reference to a formal record of the evidence on which the staging assessment is based.", 0, java.lang.Integer.MAX_VALUE, assessment)); 301 } 302 303 @Override 304 public void setProperty(String name, Base value) throws FHIRException { 305 if (name.equals("summary")) 306 this.summary = castToCodeableConcept(value); // CodeableConcept 307 else if (name.equals("assessment")) 308 this.getAssessment().add(castToReference(value)); 309 else 310 super.setProperty(name, value); 311 } 312 313 @Override 314 public Base addChild(String name) throws FHIRException { 315 if (name.equals("summary")) { 316 this.summary = new CodeableConcept(); 317 return this.summary; 318 } 319 else if (name.equals("assessment")) { 320 return addAssessment(); 321 } 322 else 323 return super.addChild(name); 324 } 325 326 public ConditionStageComponent copy() { 327 ConditionStageComponent dst = new ConditionStageComponent(); 328 copyValues(dst); 329 dst.summary = summary == null ? null : summary.copy(); 330 if (assessment != null) { 331 dst.assessment = new ArrayList<Reference>(); 332 for (Reference i : assessment) 333 dst.assessment.add(i.copy()); 334 }; 335 return dst; 336 } 337 338 @Override 339 public boolean equalsDeep(Base other) { 340 if (!super.equalsDeep(other)) 341 return false; 342 if (!(other instanceof ConditionStageComponent)) 343 return false; 344 ConditionStageComponent o = (ConditionStageComponent) other; 345 return compareDeep(summary, o.summary, true) && compareDeep(assessment, o.assessment, true); 346 } 347 348 @Override 349 public boolean equalsShallow(Base other) { 350 if (!super.equalsShallow(other)) 351 return false; 352 if (!(other instanceof ConditionStageComponent)) 353 return false; 354 ConditionStageComponent o = (ConditionStageComponent) other; 355 return true; 356 } 357 358 public boolean isEmpty() { 359 return super.isEmpty() && (summary == null || summary.isEmpty()) && (assessment == null || assessment.isEmpty()) 360 ; 361 } 362 363 public String fhirType() { 364 return "Condition.stage"; 365 366 } 367 368 } 369 370 @Block() 371 public static class ConditionEvidenceComponent extends BackboneElement implements IBaseBackboneElement { 372 /** 373 * A manifestation or symptom that led to the recording of this condition. 374 */ 375 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 376 @Description(shortDefinition="Manifestation/symptom", formalDefinition="A manifestation or symptom that led to the recording of this condition." ) 377 protected CodeableConcept code; 378 379 /** 380 * Links to other relevant information, including pathology reports. 381 */ 382 @Child(name = "detail", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 383 @Description(shortDefinition="Supporting information found elsewhere", formalDefinition="Links to other relevant information, including pathology reports." ) 384 protected List<Reference> detail; 385 /** 386 * The actual objects that are the target of the reference (Links to other relevant information, including pathology reports.) 387 */ 388 protected List<Resource> detailTarget; 389 390 391 private static final long serialVersionUID = 945689926L; 392 393 /* 394 * Constructor 395 */ 396 public ConditionEvidenceComponent() { 397 super(); 398 } 399 400 /** 401 * @return {@link #code} (A manifestation or symptom that led to the recording of this condition.) 402 */ 403 public CodeableConcept getCode() { 404 if (this.code == null) 405 if (Configuration.errorOnAutoCreate()) 406 throw new Error("Attempt to auto-create ConditionEvidenceComponent.code"); 407 else if (Configuration.doAutoCreate()) 408 this.code = new CodeableConcept(); // cc 409 return this.code; 410 } 411 412 public boolean hasCode() { 413 return this.code != null && !this.code.isEmpty(); 414 } 415 416 /** 417 * @param value {@link #code} (A manifestation or symptom that led to the recording of this condition.) 418 */ 419 public ConditionEvidenceComponent setCode(CodeableConcept value) { 420 this.code = value; 421 return this; 422 } 423 424 /** 425 * @return {@link #detail} (Links to other relevant information, including pathology reports.) 426 */ 427 public List<Reference> getDetail() { 428 if (this.detail == null) 429 this.detail = new ArrayList<Reference>(); 430 return this.detail; 431 } 432 433 public boolean hasDetail() { 434 if (this.detail == null) 435 return false; 436 for (Reference item : this.detail) 437 if (!item.isEmpty()) 438 return true; 439 return false; 440 } 441 442 /** 443 * @return {@link #detail} (Links to other relevant information, including pathology reports.) 444 */ 445 // syntactic sugar 446 public Reference addDetail() { //3 447 Reference t = new Reference(); 448 if (this.detail == null) 449 this.detail = new ArrayList<Reference>(); 450 this.detail.add(t); 451 return t; 452 } 453 454 // syntactic sugar 455 public ConditionEvidenceComponent addDetail(Reference t) { //3 456 if (t == null) 457 return this; 458 if (this.detail == null) 459 this.detail = new ArrayList<Reference>(); 460 this.detail.add(t); 461 return this; 462 } 463 464 /** 465 * @return {@link #detail} (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. Links to other relevant information, including pathology reports.) 466 */ 467 public List<Resource> getDetailTarget() { 468 if (this.detailTarget == null) 469 this.detailTarget = new ArrayList<Resource>(); 470 return this.detailTarget; 471 } 472 473 protected void listChildren(List<Property> childrenList) { 474 super.listChildren(childrenList); 475 childrenList.add(new Property("code", "CodeableConcept", "A manifestation or symptom that led to the recording of this condition.", 0, java.lang.Integer.MAX_VALUE, code)); 476 childrenList.add(new Property("detail", "Reference(Any)", "Links to other relevant information, including pathology reports.", 0, java.lang.Integer.MAX_VALUE, detail)); 477 } 478 479 @Override 480 public void setProperty(String name, Base value) throws FHIRException { 481 if (name.equals("code")) 482 this.code = castToCodeableConcept(value); // CodeableConcept 483 else if (name.equals("detail")) 484 this.getDetail().add(castToReference(value)); 485 else 486 super.setProperty(name, value); 487 } 488 489 @Override 490 public Base addChild(String name) throws FHIRException { 491 if (name.equals("code")) { 492 this.code = new CodeableConcept(); 493 return this.code; 494 } 495 else if (name.equals("detail")) { 496 return addDetail(); 497 } 498 else 499 return super.addChild(name); 500 } 501 502 public ConditionEvidenceComponent copy() { 503 ConditionEvidenceComponent dst = new ConditionEvidenceComponent(); 504 copyValues(dst); 505 dst.code = code == null ? null : code.copy(); 506 if (detail != null) { 507 dst.detail = new ArrayList<Reference>(); 508 for (Reference i : detail) 509 dst.detail.add(i.copy()); 510 }; 511 return dst; 512 } 513 514 @Override 515 public boolean equalsDeep(Base other) { 516 if (!super.equalsDeep(other)) 517 return false; 518 if (!(other instanceof ConditionEvidenceComponent)) 519 return false; 520 ConditionEvidenceComponent o = (ConditionEvidenceComponent) other; 521 return compareDeep(code, o.code, true) && compareDeep(detail, o.detail, true); 522 } 523 524 @Override 525 public boolean equalsShallow(Base other) { 526 if (!super.equalsShallow(other)) 527 return false; 528 if (!(other instanceof ConditionEvidenceComponent)) 529 return false; 530 ConditionEvidenceComponent o = (ConditionEvidenceComponent) other; 531 return true; 532 } 533 534 public boolean isEmpty() { 535 return super.isEmpty() && (code == null || code.isEmpty()) && (detail == null || detail.isEmpty()) 536 ; 537 } 538 539 public String fhirType() { 540 return "Condition.evidence"; 541 542 } 543 544 } 545 546 /** 547 * This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation). 548 */ 549 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 550 @Description(shortDefinition="External Ids for this condition", formalDefinition="This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." ) 551 protected List<Identifier> identifier; 552 553 /** 554 * Indicates the patient who the condition record is associated with. 555 */ 556 @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true) 557 @Description(shortDefinition="Who has the condition?", formalDefinition="Indicates the patient who the condition record is associated with." ) 558 protected Reference patient; 559 560 /** 561 * The actual object that is the target of the reference (Indicates the patient who the condition record is associated with.) 562 */ 563 protected Patient patientTarget; 564 565 /** 566 * Encounter during which the condition was first asserted. 567 */ 568 @Child(name = "encounter", type = {Encounter.class}, order=2, min=0, max=1, modifier=false, summary=true) 569 @Description(shortDefinition="Encounter when condition first asserted", formalDefinition="Encounter during which the condition was first asserted." ) 570 protected Reference encounter; 571 572 /** 573 * The actual object that is the target of the reference (Encounter during which the condition was first asserted.) 574 */ 575 protected Encounter encounterTarget; 576 577 /** 578 * Individual who is making the condition statement. 579 */ 580 @Child(name = "asserter", type = {Practitioner.class, Patient.class}, order=3, min=0, max=1, modifier=false, summary=true) 581 @Description(shortDefinition="Person who asserts this condition", formalDefinition="Individual who is making the condition statement." ) 582 protected Reference asserter; 583 584 /** 585 * The actual object that is the target of the reference (Individual who is making the condition statement.) 586 */ 587 protected Resource asserterTarget; 588 589 /** 590 * A date, when the Condition statement was documented. 591 */ 592 @Child(name = "dateRecorded", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=true) 593 @Description(shortDefinition="When first entered", formalDefinition="A date, when the Condition statement was documented." ) 594 protected DateType dateRecorded; 595 596 /** 597 * Identification of the condition, problem or diagnosis. 598 */ 599 @Child(name = "code", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=true) 600 @Description(shortDefinition="Identification of the condition, problem or diagnosis", formalDefinition="Identification of the condition, problem or diagnosis." ) 601 protected CodeableConcept code; 602 603 /** 604 * A category assigned to the condition. 605 */ 606 @Child(name = "category", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 607 @Description(shortDefinition="complaint | symptom | finding | diagnosis", formalDefinition="A category assigned to the condition." ) 608 protected CodeableConcept category; 609 610 /** 611 * The clinical status of the condition. 612 */ 613 @Child(name = "clinicalStatus", type = {CodeType.class}, order=7, min=0, max=1, modifier=true, summary=true) 614 @Description(shortDefinition="active | relapse | remission | resolved", formalDefinition="The clinical status of the condition." ) 615 protected CodeType clinicalStatus; 616 617 /** 618 * The verification status to support the clinical status of the condition. 619 */ 620 @Child(name = "verificationStatus", type = {CodeType.class}, order=8, min=1, max=1, modifier=true, summary=true) 621 @Description(shortDefinition="provisional | differential | confirmed | refuted | entered-in-error | unknown", formalDefinition="The verification status to support the clinical status of the condition." ) 622 protected Enumeration<ConditionVerificationStatus> verificationStatus; 623 624 /** 625 * A subjective assessment of the severity of the condition as evaluated by the clinician. 626 */ 627 @Child(name = "severity", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true) 628 @Description(shortDefinition="Subjective severity of condition", formalDefinition="A subjective assessment of the severity of the condition as evaluated by the clinician." ) 629 protected CodeableConcept severity; 630 631 /** 632 * Estimated or actual date or date-time the condition began, in the opinion of the clinician. 633 */ 634 @Child(name = "onset", type = {DateTimeType.class, Age.class, Period.class, Range.class, StringType.class}, order=10, min=0, max=1, modifier=false, summary=true) 635 @Description(shortDefinition="Estimated or actual date, date-time, or age", formalDefinition="Estimated or actual date or date-time the condition began, in the opinion of the clinician." ) 636 protected Type onset; 637 638 /** 639 * The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate. 640 */ 641 @Child(name = "abatement", type = {DateTimeType.class, Age.class, BooleanType.class, Period.class, Range.class, StringType.class}, order=11, min=0, max=1, modifier=false, summary=true) 642 @Description(shortDefinition="If/when in resolution/remission", formalDefinition="The date or estimated date that the condition resolved or went into remission. This is called \"abatement\" because of the many overloaded connotations associated with \"remission\" or \"resolution\" - Conditions are never really resolved, but they can abate." ) 643 protected Type abatement; 644 645 /** 646 * Clinical stage or grade of a condition. May include formal severity assessments. 647 */ 648 @Child(name = "stage", type = {}, order=12, min=0, max=1, modifier=false, summary=true) 649 @Description(shortDefinition="Stage/grade, usually assessed formally", formalDefinition="Clinical stage or grade of a condition. May include formal severity assessments." ) 650 protected ConditionStageComponent stage; 651 652 /** 653 * Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed. 654 */ 655 @Child(name = "evidence", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 656 @Description(shortDefinition="Supporting evidence", formalDefinition="Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed." ) 657 protected List<ConditionEvidenceComponent> evidence; 658 659 /** 660 * The anatomical location where this condition manifests itself. 661 */ 662 @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 663 @Description(shortDefinition="Anatomical location, if relevant", formalDefinition="The anatomical location where this condition manifests itself." ) 664 protected List<CodeableConcept> bodySite; 665 666 /** 667 * Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis. 668 */ 669 @Child(name = "notes", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true) 670 @Description(shortDefinition="Additional information about the Condition", formalDefinition="Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis." ) 671 protected StringType notes; 672 673 private static final long serialVersionUID = -341227215L; 674 675 /* 676 * Constructor 677 */ 678 public Condition() { 679 super(); 680 } 681 682 /* 683 * Constructor 684 */ 685 public Condition(Reference patient, CodeableConcept code, Enumeration<ConditionVerificationStatus> verificationStatus) { 686 super(); 687 this.patient = patient; 688 this.code = code; 689 this.verificationStatus = verificationStatus; 690 } 691 692 /** 693 * @return {@link #identifier} (This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).) 694 */ 695 public List<Identifier> getIdentifier() { 696 if (this.identifier == null) 697 this.identifier = new ArrayList<Identifier>(); 698 return this.identifier; 699 } 700 701 public boolean hasIdentifier() { 702 if (this.identifier == null) 703 return false; 704 for (Identifier item : this.identifier) 705 if (!item.isEmpty()) 706 return true; 707 return false; 708 } 709 710 /** 711 * @return {@link #identifier} (This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).) 712 */ 713 // syntactic sugar 714 public Identifier addIdentifier() { //3 715 Identifier t = new Identifier(); 716 if (this.identifier == null) 717 this.identifier = new ArrayList<Identifier>(); 718 this.identifier.add(t); 719 return t; 720 } 721 722 // syntactic sugar 723 public Condition addIdentifier(Identifier t) { //3 724 if (t == null) 725 return this; 726 if (this.identifier == null) 727 this.identifier = new ArrayList<Identifier>(); 728 this.identifier.add(t); 729 return this; 730 } 731 732 /** 733 * @return {@link #patient} (Indicates the patient who the condition record is associated with.) 734 */ 735 public Reference getPatient() { 736 if (this.patient == null) 737 if (Configuration.errorOnAutoCreate()) 738 throw new Error("Attempt to auto-create Condition.patient"); 739 else if (Configuration.doAutoCreate()) 740 this.patient = new Reference(); // cc 741 return this.patient; 742 } 743 744 public boolean hasPatient() { 745 return this.patient != null && !this.patient.isEmpty(); 746 } 747 748 /** 749 * @param value {@link #patient} (Indicates the patient who the condition record is associated with.) 750 */ 751 public Condition setPatient(Reference value) { 752 this.patient = value; 753 return this; 754 } 755 756 /** 757 * @return {@link #patient} 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. (Indicates the patient who the condition record is associated with.) 758 */ 759 public Patient getPatientTarget() { 760 if (this.patientTarget == null) 761 if (Configuration.errorOnAutoCreate()) 762 throw new Error("Attempt to auto-create Condition.patient"); 763 else if (Configuration.doAutoCreate()) 764 this.patientTarget = new Patient(); // aa 765 return this.patientTarget; 766 } 767 768 /** 769 * @param value {@link #patient} 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. (Indicates the patient who the condition record is associated with.) 770 */ 771 public Condition setPatientTarget(Patient value) { 772 this.patientTarget = value; 773 return this; 774 } 775 776 /** 777 * @return {@link #encounter} (Encounter during which the condition was first asserted.) 778 */ 779 public Reference getEncounter() { 780 if (this.encounter == null) 781 if (Configuration.errorOnAutoCreate()) 782 throw new Error("Attempt to auto-create Condition.encounter"); 783 else if (Configuration.doAutoCreate()) 784 this.encounter = new Reference(); // cc 785 return this.encounter; 786 } 787 788 public boolean hasEncounter() { 789 return this.encounter != null && !this.encounter.isEmpty(); 790 } 791 792 /** 793 * @param value {@link #encounter} (Encounter during which the condition was first asserted.) 794 */ 795 public Condition setEncounter(Reference value) { 796 this.encounter = value; 797 return this; 798 } 799 800 /** 801 * @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. (Encounter during which the condition was first asserted.) 802 */ 803 public Encounter getEncounterTarget() { 804 if (this.encounterTarget == null) 805 if (Configuration.errorOnAutoCreate()) 806 throw new Error("Attempt to auto-create Condition.encounter"); 807 else if (Configuration.doAutoCreate()) 808 this.encounterTarget = new Encounter(); // aa 809 return this.encounterTarget; 810 } 811 812 /** 813 * @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. (Encounter during which the condition was first asserted.) 814 */ 815 public Condition setEncounterTarget(Encounter value) { 816 this.encounterTarget = value; 817 return this; 818 } 819 820 /** 821 * @return {@link #asserter} (Individual who is making the condition statement.) 822 */ 823 public Reference getAsserter() { 824 if (this.asserter == null) 825 if (Configuration.errorOnAutoCreate()) 826 throw new Error("Attempt to auto-create Condition.asserter"); 827 else if (Configuration.doAutoCreate()) 828 this.asserter = new Reference(); // cc 829 return this.asserter; 830 } 831 832 public boolean hasAsserter() { 833 return this.asserter != null && !this.asserter.isEmpty(); 834 } 835 836 /** 837 * @param value {@link #asserter} (Individual who is making the condition statement.) 838 */ 839 public Condition setAsserter(Reference value) { 840 this.asserter = value; 841 return this; 842 } 843 844 /** 845 * @return {@link #asserter} 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. (Individual who is making the condition statement.) 846 */ 847 public Resource getAsserterTarget() { 848 return this.asserterTarget; 849 } 850 851 /** 852 * @param value {@link #asserter} 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. (Individual who is making the condition statement.) 853 */ 854 public Condition setAsserterTarget(Resource value) { 855 this.asserterTarget = value; 856 return this; 857 } 858 859 /** 860 * @return {@link #dateRecorded} (A date, when the Condition statement was documented.). This is the underlying object with id, value and extensions. The accessor "getDateRecorded" gives direct access to the value 861 */ 862 public DateType getDateRecordedElement() { 863 if (this.dateRecorded == null) 864 if (Configuration.errorOnAutoCreate()) 865 throw new Error("Attempt to auto-create Condition.dateRecorded"); 866 else if (Configuration.doAutoCreate()) 867 this.dateRecorded = new DateType(); // bb 868 return this.dateRecorded; 869 } 870 871 public boolean hasDateRecordedElement() { 872 return this.dateRecorded != null && !this.dateRecorded.isEmpty(); 873 } 874 875 public boolean hasDateRecorded() { 876 return this.dateRecorded != null && !this.dateRecorded.isEmpty(); 877 } 878 879 /** 880 * @param value {@link #dateRecorded} (A date, when the Condition statement was documented.). This is the underlying object with id, value and extensions. The accessor "getDateRecorded" gives direct access to the value 881 */ 882 public Condition setDateRecordedElement(DateType value) { 883 this.dateRecorded = value; 884 return this; 885 } 886 887 /** 888 * @return A date, when the Condition statement was documented. 889 */ 890 public Date getDateRecorded() { 891 return this.dateRecorded == null ? null : this.dateRecorded.getValue(); 892 } 893 894 /** 895 * @param value A date, when the Condition statement was documented. 896 */ 897 public Condition setDateRecorded(Date value) { 898 if (value == null) 899 this.dateRecorded = null; 900 else { 901 if (this.dateRecorded == null) 902 this.dateRecorded = new DateType(); 903 this.dateRecorded.setValue(value); 904 } 905 return this; 906 } 907 908 /** 909 * @return {@link #code} (Identification of the condition, problem or diagnosis.) 910 */ 911 public CodeableConcept getCode() { 912 if (this.code == null) 913 if (Configuration.errorOnAutoCreate()) 914 throw new Error("Attempt to auto-create Condition.code"); 915 else if (Configuration.doAutoCreate()) 916 this.code = new CodeableConcept(); // cc 917 return this.code; 918 } 919 920 public boolean hasCode() { 921 return this.code != null && !this.code.isEmpty(); 922 } 923 924 /** 925 * @param value {@link #code} (Identification of the condition, problem or diagnosis.) 926 */ 927 public Condition setCode(CodeableConcept value) { 928 this.code = value; 929 return this; 930 } 931 932 /** 933 * @return {@link #category} (A category assigned to the condition.) 934 */ 935 public CodeableConcept getCategory() { 936 if (this.category == null) 937 if (Configuration.errorOnAutoCreate()) 938 throw new Error("Attempt to auto-create Condition.category"); 939 else if (Configuration.doAutoCreate()) 940 this.category = new CodeableConcept(); // cc 941 return this.category; 942 } 943 944 public boolean hasCategory() { 945 return this.category != null && !this.category.isEmpty(); 946 } 947 948 /** 949 * @param value {@link #category} (A category assigned to the condition.) 950 */ 951 public Condition setCategory(CodeableConcept value) { 952 this.category = value; 953 return this; 954 } 955 956 /** 957 * @return {@link #clinicalStatus} (The clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getClinicalStatus" gives direct access to the value 958 */ 959 public CodeType getClinicalStatusElement() { 960 if (this.clinicalStatus == null) 961 if (Configuration.errorOnAutoCreate()) 962 throw new Error("Attempt to auto-create Condition.clinicalStatus"); 963 else if (Configuration.doAutoCreate()) 964 this.clinicalStatus = new CodeType(); // bb 965 return this.clinicalStatus; 966 } 967 968 public boolean hasClinicalStatusElement() { 969 return this.clinicalStatus != null && !this.clinicalStatus.isEmpty(); 970 } 971 972 public boolean hasClinicalStatus() { 973 return this.clinicalStatus != null && !this.clinicalStatus.isEmpty(); 974 } 975 976 /** 977 * @param value {@link #clinicalStatus} (The clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getClinicalStatus" gives direct access to the value 978 */ 979 public Condition setClinicalStatusElement(CodeType value) { 980 this.clinicalStatus = value; 981 return this; 982 } 983 984 /** 985 * @return The clinical status of the condition. 986 */ 987 public String getClinicalStatus() { 988 return this.clinicalStatus == null ? null : this.clinicalStatus.getValue(); 989 } 990 991 /** 992 * @param value The clinical status of the condition. 993 */ 994 public Condition setClinicalStatus(String value) { 995 if (Utilities.noString(value)) 996 this.clinicalStatus = null; 997 else { 998 if (this.clinicalStatus == null) 999 this.clinicalStatus = new CodeType(); 1000 this.clinicalStatus.setValue(value); 1001 } 1002 return this; 1003 } 1004 1005 /** 1006 * @return {@link #verificationStatus} (The verification status to support the clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getVerificationStatus" gives direct access to the value 1007 */ 1008 public Enumeration<ConditionVerificationStatus> getVerificationStatusElement() { 1009 if (this.verificationStatus == null) 1010 if (Configuration.errorOnAutoCreate()) 1011 throw new Error("Attempt to auto-create Condition.verificationStatus"); 1012 else if (Configuration.doAutoCreate()) 1013 this.verificationStatus = new Enumeration<ConditionVerificationStatus>(new ConditionVerificationStatusEnumFactory()); // bb 1014 return this.verificationStatus; 1015 } 1016 1017 public boolean hasVerificationStatusElement() { 1018 return this.verificationStatus != null && !this.verificationStatus.isEmpty(); 1019 } 1020 1021 public boolean hasVerificationStatus() { 1022 return this.verificationStatus != null && !this.verificationStatus.isEmpty(); 1023 } 1024 1025 /** 1026 * @param value {@link #verificationStatus} (The verification status to support the clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getVerificationStatus" gives direct access to the value 1027 */ 1028 public Condition setVerificationStatusElement(Enumeration<ConditionVerificationStatus> value) { 1029 this.verificationStatus = value; 1030 return this; 1031 } 1032 1033 /** 1034 * @return The verification status to support the clinical status of the condition. 1035 */ 1036 public ConditionVerificationStatus getVerificationStatus() { 1037 return this.verificationStatus == null ? null : this.verificationStatus.getValue(); 1038 } 1039 1040 /** 1041 * @param value The verification status to support the clinical status of the condition. 1042 */ 1043 public Condition setVerificationStatus(ConditionVerificationStatus value) { 1044 if (this.verificationStatus == null) 1045 this.verificationStatus = new Enumeration<ConditionVerificationStatus>(new ConditionVerificationStatusEnumFactory()); 1046 this.verificationStatus.setValue(value); 1047 return this; 1048 } 1049 1050 /** 1051 * @return {@link #severity} (A subjective assessment of the severity of the condition as evaluated by the clinician.) 1052 */ 1053 public CodeableConcept getSeverity() { 1054 if (this.severity == null) 1055 if (Configuration.errorOnAutoCreate()) 1056 throw new Error("Attempt to auto-create Condition.severity"); 1057 else if (Configuration.doAutoCreate()) 1058 this.severity = new CodeableConcept(); // cc 1059 return this.severity; 1060 } 1061 1062 public boolean hasSeverity() { 1063 return this.severity != null && !this.severity.isEmpty(); 1064 } 1065 1066 /** 1067 * @param value {@link #severity} (A subjective assessment of the severity of the condition as evaluated by the clinician.) 1068 */ 1069 public Condition setSeverity(CodeableConcept value) { 1070 this.severity = value; 1071 return this; 1072 } 1073 1074 /** 1075 * @return {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1076 */ 1077 public Type getOnset() { 1078 return this.onset; 1079 } 1080 1081 /** 1082 * @return {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1083 */ 1084 public DateTimeType getOnsetDateTimeType() throws FHIRException { 1085 if (!(this.onset instanceof DateTimeType)) 1086 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.onset.getClass().getName()+" was encountered"); 1087 return (DateTimeType) this.onset; 1088 } 1089 1090 public boolean hasOnsetDateTimeType() { 1091 return this.onset instanceof DateTimeType; 1092 } 1093 1094 /** 1095 * @return {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1096 */ 1097 public Age getOnsetAge() throws FHIRException { 1098 if (!(this.onset instanceof Age)) 1099 throw new FHIRException("Type mismatch: the type Age was expected, but "+this.onset.getClass().getName()+" was encountered"); 1100 return (Age) this.onset; 1101 } 1102 1103 public boolean hasOnsetAge() { 1104 return this.onset instanceof Age; 1105 } 1106 1107 /** 1108 * @return {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1109 */ 1110 public Period getOnsetPeriod() throws FHIRException { 1111 if (!(this.onset instanceof Period)) 1112 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.onset.getClass().getName()+" was encountered"); 1113 return (Period) this.onset; 1114 } 1115 1116 public boolean hasOnsetPeriod() { 1117 return this.onset instanceof Period; 1118 } 1119 1120 /** 1121 * @return {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1122 */ 1123 public Range getOnsetRange() throws FHIRException { 1124 if (!(this.onset instanceof Range)) 1125 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.onset.getClass().getName()+" was encountered"); 1126 return (Range) this.onset; 1127 } 1128 1129 public boolean hasOnsetRange() { 1130 return this.onset instanceof Range; 1131 } 1132 1133 /** 1134 * @return {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1135 */ 1136 public StringType getOnsetStringType() throws FHIRException { 1137 if (!(this.onset instanceof StringType)) 1138 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.onset.getClass().getName()+" was encountered"); 1139 return (StringType) this.onset; 1140 } 1141 1142 public boolean hasOnsetStringType() { 1143 return this.onset instanceof StringType; 1144 } 1145 1146 public boolean hasOnset() { 1147 return this.onset != null && !this.onset.isEmpty(); 1148 } 1149 1150 /** 1151 * @param value {@link #onset} (Estimated or actual date or date-time the condition began, in the opinion of the clinician.) 1152 */ 1153 public Condition setOnset(Type value) { 1154 this.onset = value; 1155 return this; 1156 } 1157 1158 /** 1159 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1160 */ 1161 public Type getAbatement() { 1162 return this.abatement; 1163 } 1164 1165 /** 1166 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1167 */ 1168 public DateTimeType getAbatementDateTimeType() throws FHIRException { 1169 if (!(this.abatement instanceof DateTimeType)) 1170 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.abatement.getClass().getName()+" was encountered"); 1171 return (DateTimeType) this.abatement; 1172 } 1173 1174 public boolean hasAbatementDateTimeType() { 1175 return this.abatement instanceof DateTimeType; 1176 } 1177 1178 /** 1179 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1180 */ 1181 public Age getAbatementAge() throws FHIRException { 1182 if (!(this.abatement instanceof Age)) 1183 throw new FHIRException("Type mismatch: the type Age was expected, but "+this.abatement.getClass().getName()+" was encountered"); 1184 return (Age) this.abatement; 1185 } 1186 1187 public boolean hasAbatementAge() { 1188 return this.abatement instanceof Age; 1189 } 1190 1191 /** 1192 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1193 */ 1194 public BooleanType getAbatementBooleanType() throws FHIRException { 1195 if (!(this.abatement instanceof BooleanType)) 1196 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.abatement.getClass().getName()+" was encountered"); 1197 return (BooleanType) this.abatement; 1198 } 1199 1200 public boolean hasAbatementBooleanType() { 1201 return this.abatement instanceof BooleanType; 1202 } 1203 1204 /** 1205 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1206 */ 1207 public Period getAbatementPeriod() throws FHIRException { 1208 if (!(this.abatement instanceof Period)) 1209 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.abatement.getClass().getName()+" was encountered"); 1210 return (Period) this.abatement; 1211 } 1212 1213 public boolean hasAbatementPeriod() { 1214 return this.abatement instanceof Period; 1215 } 1216 1217 /** 1218 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1219 */ 1220 public Range getAbatementRange() throws FHIRException { 1221 if (!(this.abatement instanceof Range)) 1222 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.abatement.getClass().getName()+" was encountered"); 1223 return (Range) this.abatement; 1224 } 1225 1226 public boolean hasAbatementRange() { 1227 return this.abatement instanceof Range; 1228 } 1229 1230 /** 1231 * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1232 */ 1233 public StringType getAbatementStringType() throws FHIRException { 1234 if (!(this.abatement instanceof StringType)) 1235 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.abatement.getClass().getName()+" was encountered"); 1236 return (StringType) this.abatement; 1237 } 1238 1239 public boolean hasAbatementStringType() { 1240 return this.abatement instanceof StringType; 1241 } 1242 1243 public boolean hasAbatement() { 1244 return this.abatement != null && !this.abatement.isEmpty(); 1245 } 1246 1247 /** 1248 * @param value {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.) 1249 */ 1250 public Condition setAbatement(Type value) { 1251 this.abatement = value; 1252 return this; 1253 } 1254 1255 /** 1256 * @return {@link #stage} (Clinical stage or grade of a condition. May include formal severity assessments.) 1257 */ 1258 public ConditionStageComponent getStage() { 1259 if (this.stage == null) 1260 if (Configuration.errorOnAutoCreate()) 1261 throw new Error("Attempt to auto-create Condition.stage"); 1262 else if (Configuration.doAutoCreate()) 1263 this.stage = new ConditionStageComponent(); // cc 1264 return this.stage; 1265 } 1266 1267 public boolean hasStage() { 1268 return this.stage != null && !this.stage.isEmpty(); 1269 } 1270 1271 /** 1272 * @param value {@link #stage} (Clinical stage or grade of a condition. May include formal severity assessments.) 1273 */ 1274 public Condition setStage(ConditionStageComponent value) { 1275 this.stage = value; 1276 return this; 1277 } 1278 1279 /** 1280 * @return {@link #evidence} (Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.) 1281 */ 1282 public List<ConditionEvidenceComponent> getEvidence() { 1283 if (this.evidence == null) 1284 this.evidence = new ArrayList<ConditionEvidenceComponent>(); 1285 return this.evidence; 1286 } 1287 1288 public boolean hasEvidence() { 1289 if (this.evidence == null) 1290 return false; 1291 for (ConditionEvidenceComponent item : this.evidence) 1292 if (!item.isEmpty()) 1293 return true; 1294 return false; 1295 } 1296 1297 /** 1298 * @return {@link #evidence} (Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.) 1299 */ 1300 // syntactic sugar 1301 public ConditionEvidenceComponent addEvidence() { //3 1302 ConditionEvidenceComponent t = new ConditionEvidenceComponent(); 1303 if (this.evidence == null) 1304 this.evidence = new ArrayList<ConditionEvidenceComponent>(); 1305 this.evidence.add(t); 1306 return t; 1307 } 1308 1309 // syntactic sugar 1310 public Condition addEvidence(ConditionEvidenceComponent t) { //3 1311 if (t == null) 1312 return this; 1313 if (this.evidence == null) 1314 this.evidence = new ArrayList<ConditionEvidenceComponent>(); 1315 this.evidence.add(t); 1316 return this; 1317 } 1318 1319 /** 1320 * @return {@link #bodySite} (The anatomical location where this condition manifests itself.) 1321 */ 1322 public List<CodeableConcept> getBodySite() { 1323 if (this.bodySite == null) 1324 this.bodySite = new ArrayList<CodeableConcept>(); 1325 return this.bodySite; 1326 } 1327 1328 public boolean hasBodySite() { 1329 if (this.bodySite == null) 1330 return false; 1331 for (CodeableConcept item : this.bodySite) 1332 if (!item.isEmpty()) 1333 return true; 1334 return false; 1335 } 1336 1337 /** 1338 * @return {@link #bodySite} (The anatomical location where this condition manifests itself.) 1339 */ 1340 // syntactic sugar 1341 public CodeableConcept addBodySite() { //3 1342 CodeableConcept t = new CodeableConcept(); 1343 if (this.bodySite == null) 1344 this.bodySite = new ArrayList<CodeableConcept>(); 1345 this.bodySite.add(t); 1346 return t; 1347 } 1348 1349 // syntactic sugar 1350 public Condition addBodySite(CodeableConcept t) { //3 1351 if (t == null) 1352 return this; 1353 if (this.bodySite == null) 1354 this.bodySite = new ArrayList<CodeableConcept>(); 1355 this.bodySite.add(t); 1356 return this; 1357 } 1358 1359 /** 1360 * @return {@link #notes} (Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.). This is the underlying object with id, value and extensions. The accessor "getNotes" gives direct access to the value 1361 */ 1362 public StringType getNotesElement() { 1363 if (this.notes == null) 1364 if (Configuration.errorOnAutoCreate()) 1365 throw new Error("Attempt to auto-create Condition.notes"); 1366 else if (Configuration.doAutoCreate()) 1367 this.notes = new StringType(); // bb 1368 return this.notes; 1369 } 1370 1371 public boolean hasNotesElement() { 1372 return this.notes != null && !this.notes.isEmpty(); 1373 } 1374 1375 public boolean hasNotes() { 1376 return this.notes != null && !this.notes.isEmpty(); 1377 } 1378 1379 /** 1380 * @param value {@link #notes} (Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.). This is the underlying object with id, value and extensions. The accessor "getNotes" gives direct access to the value 1381 */ 1382 public Condition setNotesElement(StringType value) { 1383 this.notes = value; 1384 return this; 1385 } 1386 1387 /** 1388 * @return Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis. 1389 */ 1390 public String getNotes() { 1391 return this.notes == null ? null : this.notes.getValue(); 1392 } 1393 1394 /** 1395 * @param value Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis. 1396 */ 1397 public Condition setNotes(String value) { 1398 if (Utilities.noString(value)) 1399 this.notes = null; 1400 else { 1401 if (this.notes == null) 1402 this.notes = new StringType(); 1403 this.notes.setValue(value); 1404 } 1405 return this; 1406 } 1407 1408 protected void listChildren(List<Property> childrenList) { 1409 super.listChildren(childrenList); 1410 childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier)); 1411 childrenList.add(new Property("patient", "Reference(Patient)", "Indicates the patient who the condition record is associated with.", 0, java.lang.Integer.MAX_VALUE, patient)); 1412 childrenList.add(new Property("encounter", "Reference(Encounter)", "Encounter during which the condition was first asserted.", 0, java.lang.Integer.MAX_VALUE, encounter)); 1413 childrenList.add(new Property("asserter", "Reference(Practitioner|Patient)", "Individual who is making the condition statement.", 0, java.lang.Integer.MAX_VALUE, asserter)); 1414 childrenList.add(new Property("dateRecorded", "date", "A date, when the Condition statement was documented.", 0, java.lang.Integer.MAX_VALUE, dateRecorded)); 1415 childrenList.add(new Property("code", "CodeableConcept", "Identification of the condition, problem or diagnosis.", 0, java.lang.Integer.MAX_VALUE, code)); 1416 childrenList.add(new Property("category", "CodeableConcept", "A category assigned to the condition.", 0, java.lang.Integer.MAX_VALUE, category)); 1417 childrenList.add(new Property("clinicalStatus", "code", "The clinical status of the condition.", 0, java.lang.Integer.MAX_VALUE, clinicalStatus)); 1418 childrenList.add(new Property("verificationStatus", "code", "The verification status to support the clinical status of the condition.", 0, java.lang.Integer.MAX_VALUE, verificationStatus)); 1419 childrenList.add(new Property("severity", "CodeableConcept", "A subjective assessment of the severity of the condition as evaluated by the clinician.", 0, java.lang.Integer.MAX_VALUE, severity)); 1420 childrenList.add(new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date or date-time the condition began, in the opinion of the clinician.", 0, java.lang.Integer.MAX_VALUE, onset)); 1421 childrenList.add(new Property("abatement[x]", "dateTime|Age|boolean|Period|Range|string", "The date or estimated date that the condition resolved or went into remission. This is called \"abatement\" because of the many overloaded connotations associated with \"remission\" or \"resolution\" - Conditions are never really resolved, but they can abate.", 0, java.lang.Integer.MAX_VALUE, abatement)); 1422 childrenList.add(new Property("stage", "", "Clinical stage or grade of a condition. May include formal severity assessments.", 0, java.lang.Integer.MAX_VALUE, stage)); 1423 childrenList.add(new Property("evidence", "", "Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.", 0, java.lang.Integer.MAX_VALUE, evidence)); 1424 childrenList.add(new Property("bodySite", "CodeableConcept", "The anatomical location where this condition manifests itself.", 0, java.lang.Integer.MAX_VALUE, bodySite)); 1425 childrenList.add(new Property("notes", "string", "Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.", 0, java.lang.Integer.MAX_VALUE, notes)); 1426 } 1427 1428 @Override 1429 public void setProperty(String name, Base value) throws FHIRException { 1430 if (name.equals("identifier")) 1431 this.getIdentifier().add(castToIdentifier(value)); 1432 else if (name.equals("patient")) 1433 this.patient = castToReference(value); // Reference 1434 else if (name.equals("encounter")) 1435 this.encounter = castToReference(value); // Reference 1436 else if (name.equals("asserter")) 1437 this.asserter = castToReference(value); // Reference 1438 else if (name.equals("dateRecorded")) 1439 this.dateRecorded = castToDate(value); // DateType 1440 else if (name.equals("code")) 1441 this.code = castToCodeableConcept(value); // CodeableConcept 1442 else if (name.equals("category")) 1443 this.category = castToCodeableConcept(value); // CodeableConcept 1444 else if (name.equals("clinicalStatus")) 1445 this.clinicalStatus = castToCode(value); // CodeType 1446 else if (name.equals("verificationStatus")) 1447 this.verificationStatus = new ConditionVerificationStatusEnumFactory().fromType(value); // Enumeration<ConditionVerificationStatus> 1448 else if (name.equals("severity")) 1449 this.severity = castToCodeableConcept(value); // CodeableConcept 1450 else if (name.equals("onset[x]")) 1451 this.onset = (Type) value; // Type 1452 else if (name.equals("abatement[x]")) 1453 this.abatement = (Type) value; // Type 1454 else if (name.equals("stage")) 1455 this.stage = (ConditionStageComponent) value; // ConditionStageComponent 1456 else if (name.equals("evidence")) 1457 this.getEvidence().add((ConditionEvidenceComponent) value); 1458 else if (name.equals("bodySite")) 1459 this.getBodySite().add(castToCodeableConcept(value)); 1460 else if (name.equals("notes")) 1461 this.notes = castToString(value); // StringType 1462 else 1463 super.setProperty(name, value); 1464 } 1465 1466 @Override 1467 public Base addChild(String name) throws FHIRException { 1468 if (name.equals("identifier")) { 1469 return addIdentifier(); 1470 } 1471 else if (name.equals("patient")) { 1472 this.patient = new Reference(); 1473 return this.patient; 1474 } 1475 else if (name.equals("encounter")) { 1476 this.encounter = new Reference(); 1477 return this.encounter; 1478 } 1479 else if (name.equals("asserter")) { 1480 this.asserter = new Reference(); 1481 return this.asserter; 1482 } 1483 else if (name.equals("dateRecorded")) { 1484 throw new FHIRException("Cannot call addChild on a primitive type Condition.dateRecorded"); 1485 } 1486 else if (name.equals("code")) { 1487 this.code = new CodeableConcept(); 1488 return this.code; 1489 } 1490 else if (name.equals("category")) { 1491 this.category = new CodeableConcept(); 1492 return this.category; 1493 } 1494 else if (name.equals("clinicalStatus")) { 1495 throw new FHIRException("Cannot call addChild on a primitive type Condition.clinicalStatus"); 1496 } 1497 else if (name.equals("verificationStatus")) { 1498 throw new FHIRException("Cannot call addChild on a primitive type Condition.verificationStatus"); 1499 } 1500 else if (name.equals("severity")) { 1501 this.severity = new CodeableConcept(); 1502 return this.severity; 1503 } 1504 else if (name.equals("onsetDateTime")) { 1505 this.onset = new DateTimeType(); 1506 return this.onset; 1507 } 1508 else if (name.equals("onsetAge")) { 1509 this.onset = new Age(); 1510 return this.onset; 1511 } 1512 else if (name.equals("onsetPeriod")) { 1513 this.onset = new Period(); 1514 return this.onset; 1515 } 1516 else if (name.equals("onsetRange")) { 1517 this.onset = new Range(); 1518 return this.onset; 1519 } 1520 else if (name.equals("onsetString")) { 1521 this.onset = new StringType(); 1522 return this.onset; 1523 } 1524 else if (name.equals("abatementDateTime")) { 1525 this.abatement = new DateTimeType(); 1526 return this.abatement; 1527 } 1528 else if (name.equals("abatementAge")) { 1529 this.abatement = new Age(); 1530 return this.abatement; 1531 } 1532 else if (name.equals("abatementBoolean")) { 1533 this.abatement = new BooleanType(); 1534 return this.abatement; 1535 } 1536 else if (name.equals("abatementPeriod")) { 1537 this.abatement = new Period(); 1538 return this.abatement; 1539 } 1540 else if (name.equals("abatementRange")) { 1541 this.abatement = new Range(); 1542 return this.abatement; 1543 } 1544 else if (name.equals("abatementString")) { 1545 this.abatement = new StringType(); 1546 return this.abatement; 1547 } 1548 else if (name.equals("stage")) { 1549 this.stage = new ConditionStageComponent(); 1550 return this.stage; 1551 } 1552 else if (name.equals("evidence")) { 1553 return addEvidence(); 1554 } 1555 else if (name.equals("bodySite")) { 1556 return addBodySite(); 1557 } 1558 else if (name.equals("notes")) { 1559 throw new FHIRException("Cannot call addChild on a primitive type Condition.notes"); 1560 } 1561 else 1562 return super.addChild(name); 1563 } 1564 1565 public String fhirType() { 1566 return "Condition"; 1567 1568 } 1569 1570 public Condition copy() { 1571 Condition dst = new Condition(); 1572 copyValues(dst); 1573 if (identifier != null) { 1574 dst.identifier = new ArrayList<Identifier>(); 1575 for (Identifier i : identifier) 1576 dst.identifier.add(i.copy()); 1577 }; 1578 dst.patient = patient == null ? null : patient.copy(); 1579 dst.encounter = encounter == null ? null : encounter.copy(); 1580 dst.asserter = asserter == null ? null : asserter.copy(); 1581 dst.dateRecorded = dateRecorded == null ? null : dateRecorded.copy(); 1582 dst.code = code == null ? null : code.copy(); 1583 dst.category = category == null ? null : category.copy(); 1584 dst.clinicalStatus = clinicalStatus == null ? null : clinicalStatus.copy(); 1585 dst.verificationStatus = verificationStatus == null ? null : verificationStatus.copy(); 1586 dst.severity = severity == null ? null : severity.copy(); 1587 dst.onset = onset == null ? null : onset.copy(); 1588 dst.abatement = abatement == null ? null : abatement.copy(); 1589 dst.stage = stage == null ? null : stage.copy(); 1590 if (evidence != null) { 1591 dst.evidence = new ArrayList<ConditionEvidenceComponent>(); 1592 for (ConditionEvidenceComponent i : evidence) 1593 dst.evidence.add(i.copy()); 1594 }; 1595 if (bodySite != null) { 1596 dst.bodySite = new ArrayList<CodeableConcept>(); 1597 for (CodeableConcept i : bodySite) 1598 dst.bodySite.add(i.copy()); 1599 }; 1600 dst.notes = notes == null ? null : notes.copy(); 1601 return dst; 1602 } 1603 1604 protected Condition typedCopy() { 1605 return copy(); 1606 } 1607 1608 @Override 1609 public boolean equalsDeep(Base other) { 1610 if (!super.equalsDeep(other)) 1611 return false; 1612 if (!(other instanceof Condition)) 1613 return false; 1614 Condition o = (Condition) other; 1615 return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true) 1616 && compareDeep(asserter, o.asserter, true) && compareDeep(dateRecorded, o.dateRecorded, true) && compareDeep(code, o.code, true) 1617 && compareDeep(category, o.category, true) && compareDeep(clinicalStatus, o.clinicalStatus, true) 1618 && compareDeep(verificationStatus, o.verificationStatus, true) && compareDeep(severity, o.severity, true) 1619 && compareDeep(onset, o.onset, true) && compareDeep(abatement, o.abatement, true) && compareDeep(stage, o.stage, true) 1620 && compareDeep(evidence, o.evidence, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(notes, o.notes, true) 1621 ; 1622 } 1623 1624 @Override 1625 public boolean equalsShallow(Base other) { 1626 if (!super.equalsShallow(other)) 1627 return false; 1628 if (!(other instanceof Condition)) 1629 return false; 1630 Condition o = (Condition) other; 1631 return compareValues(dateRecorded, o.dateRecorded, true) && compareValues(clinicalStatus, o.clinicalStatus, true) 1632 && compareValues(verificationStatus, o.verificationStatus, true) && compareValues(notes, o.notes, true) 1633 ; 1634 } 1635 1636 public boolean isEmpty() { 1637 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty()) 1638 && (encounter == null || encounter.isEmpty()) && (asserter == null || asserter.isEmpty()) 1639 && (dateRecorded == null || dateRecorded.isEmpty()) && (code == null || code.isEmpty()) && (category == null || category.isEmpty()) 1640 && (clinicalStatus == null || clinicalStatus.isEmpty()) && (verificationStatus == null || verificationStatus.isEmpty()) 1641 && (severity == null || severity.isEmpty()) && (onset == null || onset.isEmpty()) && (abatement == null || abatement.isEmpty()) 1642 && (stage == null || stage.isEmpty()) && (evidence == null || evidence.isEmpty()) && (bodySite == null || bodySite.isEmpty()) 1643 && (notes == null || notes.isEmpty()); 1644 } 1645 1646 @Override 1647 public ResourceType getResourceType() { 1648 return ResourceType.Condition; 1649 } 1650 1651 @SearchParamDefinition(name="severity", path="Condition.severity", description="The severity of the condition", type="token" ) 1652 public static final String SP_SEVERITY = "severity"; 1653 @SearchParamDefinition(name="identifier", path="Condition.identifier", description="A unique identifier of the condition record", type="token" ) 1654 public static final String SP_IDENTIFIER = "identifier"; 1655 @SearchParamDefinition(name="clinicalstatus", path="Condition.clinicalStatus", description="The clinical status of the condition", type="token" ) 1656 public static final String SP_CLINICALSTATUS = "clinicalstatus"; 1657 @SearchParamDefinition(name="onset-info", path="Condition.onset[x]", description="Other onsets (boolean, age, range, string)", type="string" ) 1658 public static final String SP_ONSETINFO = "onset-info"; 1659 @SearchParamDefinition(name="code", path="Condition.code", description="Code for the condition", type="token" ) 1660 public static final String SP_CODE = "code"; 1661 @SearchParamDefinition(name="evidence", path="Condition.evidence.code", description="Manifestation/symptom", type="token" ) 1662 public static final String SP_EVIDENCE = "evidence"; 1663 @SearchParamDefinition(name="encounter", path="Condition.encounter", description="Encounter when condition first asserted", type="reference" ) 1664 public static final String SP_ENCOUNTER = "encounter"; 1665 @SearchParamDefinition(name="onset", path="Condition.onset[x]", description="Date related onsets (dateTime and Period)", type="date" ) 1666 public static final String SP_ONSET = "onset"; 1667 @SearchParamDefinition(name="asserter", path="Condition.asserter", description="Person who asserts this condition", type="reference" ) 1668 public static final String SP_ASSERTER = "asserter"; 1669 @SearchParamDefinition(name="date-recorded", path="Condition.dateRecorded", description="A date, when the Condition statement was documented", type="date" ) 1670 public static final String SP_DATERECORDED = "date-recorded"; 1671 @SearchParamDefinition(name="stage", path="Condition.stage.summary", description="Simple summary (disease specific)", type="token" ) 1672 public static final String SP_STAGE = "stage"; 1673 @SearchParamDefinition(name="patient", path="Condition.patient", description="Who has the condition?", type="reference" ) 1674 public static final String SP_PATIENT = "patient"; 1675 @SearchParamDefinition(name="category", path="Condition.category", description="The category of the condition", type="token" ) 1676 public static final String SP_CATEGORY = "category"; 1677 @SearchParamDefinition(name="body-site", path="Condition.bodySite", description="Anatomical location, if relevant", type="token" ) 1678 public static final String SP_BODYSITE = "body-site"; 1679 1680} 1681