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