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