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 * The findings and interpretation of diagnostic tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports. 068 */ 069@ResourceDef(name="DiagnosticReport", profile="http://hl7.org/fhir/Profile/DiagnosticReport") 070public class DiagnosticReport extends DomainResource { 071 072 public enum DiagnosticReportStatus { 073 /** 074 * The existence of the report is registered, but there is nothing yet available. 075 */ 076 REGISTERED, 077 /** 078 * This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified. 079 */ 080 PARTIAL, 081 /** 082 * The report is complete and verified by an authorized person. 083 */ 084 FINAL, 085 /** 086 * The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed 087 */ 088 CORRECTED, 089 /** 090 * The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed. 091 */ 092 APPENDED, 093 /** 094 * The report is unavailable because the measurement was not started or not completed (also sometimes called "aborted"). 095 */ 096 CANCELLED, 097 /** 098 * The report has been withdrawn following a previous final release. 099 */ 100 ENTEREDINERROR, 101 /** 102 * added to help the parsers 103 */ 104 NULL; 105 public static DiagnosticReportStatus fromCode(String codeString) throws FHIRException { 106 if (codeString == null || "".equals(codeString)) 107 return null; 108 if ("registered".equals(codeString)) 109 return REGISTERED; 110 if ("partial".equals(codeString)) 111 return PARTIAL; 112 if ("final".equals(codeString)) 113 return FINAL; 114 if ("corrected".equals(codeString)) 115 return CORRECTED; 116 if ("appended".equals(codeString)) 117 return APPENDED; 118 if ("cancelled".equals(codeString)) 119 return CANCELLED; 120 if ("entered-in-error".equals(codeString)) 121 return ENTEREDINERROR; 122 throw new FHIRException("Unknown DiagnosticReportStatus code '"+codeString+"'"); 123 } 124 public String toCode() { 125 switch (this) { 126 case REGISTERED: return "registered"; 127 case PARTIAL: return "partial"; 128 case FINAL: return "final"; 129 case CORRECTED: return "corrected"; 130 case APPENDED: return "appended"; 131 case CANCELLED: return "cancelled"; 132 case ENTEREDINERROR: return "entered-in-error"; 133 default: return "?"; 134 } 135 } 136 public String getSystem() { 137 switch (this) { 138 case REGISTERED: return "http://hl7.org/fhir/diagnostic-report-status"; 139 case PARTIAL: return "http://hl7.org/fhir/diagnostic-report-status"; 140 case FINAL: return "http://hl7.org/fhir/diagnostic-report-status"; 141 case CORRECTED: return "http://hl7.org/fhir/diagnostic-report-status"; 142 case APPENDED: return "http://hl7.org/fhir/diagnostic-report-status"; 143 case CANCELLED: return "http://hl7.org/fhir/diagnostic-report-status"; 144 case ENTEREDINERROR: return "http://hl7.org/fhir/diagnostic-report-status"; 145 default: return "?"; 146 } 147 } 148 public String getDefinition() { 149 switch (this) { 150 case REGISTERED: return "The existence of the report is registered, but there is nothing yet available."; 151 case PARTIAL: return "This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified."; 152 case FINAL: return "The report is complete and verified by an authorized person."; 153 case CORRECTED: return "The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed"; 154 case APPENDED: return "The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed."; 155 case CANCELLED: return "The report is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\")."; 156 case ENTEREDINERROR: return "The report has been withdrawn following a previous final release."; 157 default: return "?"; 158 } 159 } 160 public String getDisplay() { 161 switch (this) { 162 case REGISTERED: return "Registered"; 163 case PARTIAL: return "Partial"; 164 case FINAL: return "Final"; 165 case CORRECTED: return "Corrected"; 166 case APPENDED: return "Appended"; 167 case CANCELLED: return "Cancelled"; 168 case ENTEREDINERROR: return "Entered in Error"; 169 default: return "?"; 170 } 171 } 172 } 173 174 public static class DiagnosticReportStatusEnumFactory implements EnumFactory<DiagnosticReportStatus> { 175 public DiagnosticReportStatus fromCode(String codeString) throws IllegalArgumentException { 176 if (codeString == null || "".equals(codeString)) 177 if (codeString == null || "".equals(codeString)) 178 return null; 179 if ("registered".equals(codeString)) 180 return DiagnosticReportStatus.REGISTERED; 181 if ("partial".equals(codeString)) 182 return DiagnosticReportStatus.PARTIAL; 183 if ("final".equals(codeString)) 184 return DiagnosticReportStatus.FINAL; 185 if ("corrected".equals(codeString)) 186 return DiagnosticReportStatus.CORRECTED; 187 if ("appended".equals(codeString)) 188 return DiagnosticReportStatus.APPENDED; 189 if ("cancelled".equals(codeString)) 190 return DiagnosticReportStatus.CANCELLED; 191 if ("entered-in-error".equals(codeString)) 192 return DiagnosticReportStatus.ENTEREDINERROR; 193 throw new IllegalArgumentException("Unknown DiagnosticReportStatus code '"+codeString+"'"); 194 } 195 public Enumeration<DiagnosticReportStatus> fromType(Base code) throws FHIRException { 196 if (code == null || code.isEmpty()) 197 return null; 198 String codeString = ((PrimitiveType) code).asStringValue(); 199 if (codeString == null || "".equals(codeString)) 200 return null; 201 if ("registered".equals(codeString)) 202 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.REGISTERED); 203 if ("partial".equals(codeString)) 204 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.PARTIAL); 205 if ("final".equals(codeString)) 206 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.FINAL); 207 if ("corrected".equals(codeString)) 208 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.CORRECTED); 209 if ("appended".equals(codeString)) 210 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.APPENDED); 211 if ("cancelled".equals(codeString)) 212 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.CANCELLED); 213 if ("entered-in-error".equals(codeString)) 214 return new Enumeration<DiagnosticReportStatus>(this, DiagnosticReportStatus.ENTEREDINERROR); 215 throw new FHIRException("Unknown DiagnosticReportStatus code '"+codeString+"'"); 216 } 217 public String toCode(DiagnosticReportStatus code) { 218 if (code == DiagnosticReportStatus.REGISTERED) 219 return "registered"; 220 if (code == DiagnosticReportStatus.PARTIAL) 221 return "partial"; 222 if (code == DiagnosticReportStatus.FINAL) 223 return "final"; 224 if (code == DiagnosticReportStatus.CORRECTED) 225 return "corrected"; 226 if (code == DiagnosticReportStatus.APPENDED) 227 return "appended"; 228 if (code == DiagnosticReportStatus.CANCELLED) 229 return "cancelled"; 230 if (code == DiagnosticReportStatus.ENTEREDINERROR) 231 return "entered-in-error"; 232 return "?"; 233 } 234 } 235 236 @Block() 237 public static class DiagnosticReportImageComponent extends BackboneElement implements IBaseBackboneElement { 238 /** 239 * A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features. 240 */ 241 @Child(name = "comment", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false) 242 @Description(shortDefinition="Comment about the image (e.g. explanation)", formalDefinition="A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features." ) 243 protected StringType comment; 244 245 /** 246 * Reference to the image source. 247 */ 248 @Child(name = "link", type = {Media.class}, order=2, min=1, max=1, modifier=false, summary=true) 249 @Description(shortDefinition="Reference to the image source", formalDefinition="Reference to the image source." ) 250 protected Reference link; 251 252 /** 253 * The actual object that is the target of the reference (Reference to the image source.) 254 */ 255 protected Media linkTarget; 256 257 private static final long serialVersionUID = 935791940L; 258 259 /* 260 * Constructor 261 */ 262 public DiagnosticReportImageComponent() { 263 super(); 264 } 265 266 /* 267 * Constructor 268 */ 269 public DiagnosticReportImageComponent(Reference link) { 270 super(); 271 this.link = link; 272 } 273 274 /** 275 * @return {@link #comment} (A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value 276 */ 277 public StringType getCommentElement() { 278 if (this.comment == null) 279 if (Configuration.errorOnAutoCreate()) 280 throw new Error("Attempt to auto-create DiagnosticReportImageComponent.comment"); 281 else if (Configuration.doAutoCreate()) 282 this.comment = new StringType(); // bb 283 return this.comment; 284 } 285 286 public boolean hasCommentElement() { 287 return this.comment != null && !this.comment.isEmpty(); 288 } 289 290 public boolean hasComment() { 291 return this.comment != null && !this.comment.isEmpty(); 292 } 293 294 /** 295 * @param value {@link #comment} (A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value 296 */ 297 public DiagnosticReportImageComponent setCommentElement(StringType value) { 298 this.comment = value; 299 return this; 300 } 301 302 /** 303 * @return A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features. 304 */ 305 public String getComment() { 306 return this.comment == null ? null : this.comment.getValue(); 307 } 308 309 /** 310 * @param value A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features. 311 */ 312 public DiagnosticReportImageComponent setComment(String value) { 313 if (Utilities.noString(value)) 314 this.comment = null; 315 else { 316 if (this.comment == null) 317 this.comment = new StringType(); 318 this.comment.setValue(value); 319 } 320 return this; 321 } 322 323 /** 324 * @return {@link #link} (Reference to the image source.) 325 */ 326 public Reference getLink() { 327 if (this.link == null) 328 if (Configuration.errorOnAutoCreate()) 329 throw new Error("Attempt to auto-create DiagnosticReportImageComponent.link"); 330 else if (Configuration.doAutoCreate()) 331 this.link = new Reference(); // cc 332 return this.link; 333 } 334 335 public boolean hasLink() { 336 return this.link != null && !this.link.isEmpty(); 337 } 338 339 /** 340 * @param value {@link #link} (Reference to the image source.) 341 */ 342 public DiagnosticReportImageComponent setLink(Reference value) { 343 this.link = value; 344 return this; 345 } 346 347 /** 348 * @return {@link #link} 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. (Reference to the image source.) 349 */ 350 public Media getLinkTarget() { 351 if (this.linkTarget == null) 352 if (Configuration.errorOnAutoCreate()) 353 throw new Error("Attempt to auto-create DiagnosticReportImageComponent.link"); 354 else if (Configuration.doAutoCreate()) 355 this.linkTarget = new Media(); // aa 356 return this.linkTarget; 357 } 358 359 /** 360 * @param value {@link #link} 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. (Reference to the image source.) 361 */ 362 public DiagnosticReportImageComponent setLinkTarget(Media value) { 363 this.linkTarget = value; 364 return this; 365 } 366 367 protected void listChildren(List<Property> childrenList) { 368 super.listChildren(childrenList); 369 childrenList.add(new Property("comment", "string", "A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.", 0, java.lang.Integer.MAX_VALUE, comment)); 370 childrenList.add(new Property("link", "Reference(Media)", "Reference to the image source.", 0, java.lang.Integer.MAX_VALUE, link)); 371 } 372 373 @Override 374 public void setProperty(String name, Base value) throws FHIRException { 375 if (name.equals("comment")) 376 this.comment = castToString(value); // StringType 377 else if (name.equals("link")) 378 this.link = castToReference(value); // Reference 379 else 380 super.setProperty(name, value); 381 } 382 383 @Override 384 public Base addChild(String name) throws FHIRException { 385 if (name.equals("comment")) { 386 throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.comment"); 387 } 388 else if (name.equals("link")) { 389 this.link = new Reference(); 390 return this.link; 391 } 392 else 393 return super.addChild(name); 394 } 395 396 public DiagnosticReportImageComponent copy() { 397 DiagnosticReportImageComponent dst = new DiagnosticReportImageComponent(); 398 copyValues(dst); 399 dst.comment = comment == null ? null : comment.copy(); 400 dst.link = link == null ? null : link.copy(); 401 return dst; 402 } 403 404 @Override 405 public boolean equalsDeep(Base other) { 406 if (!super.equalsDeep(other)) 407 return false; 408 if (!(other instanceof DiagnosticReportImageComponent)) 409 return false; 410 DiagnosticReportImageComponent o = (DiagnosticReportImageComponent) other; 411 return compareDeep(comment, o.comment, true) && compareDeep(link, o.link, true); 412 } 413 414 @Override 415 public boolean equalsShallow(Base other) { 416 if (!super.equalsShallow(other)) 417 return false; 418 if (!(other instanceof DiagnosticReportImageComponent)) 419 return false; 420 DiagnosticReportImageComponent o = (DiagnosticReportImageComponent) other; 421 return compareValues(comment, o.comment, true); 422 } 423 424 public boolean isEmpty() { 425 return super.isEmpty() && (comment == null || comment.isEmpty()) && (link == null || link.isEmpty()) 426 ; 427 } 428 429 public String fhirType() { 430 return "DiagnosticReport.image"; 431 432 } 433 434 } 435 436 /** 437 * The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider. 438 */ 439 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 440 @Description(shortDefinition="Id for external references to this report", formalDefinition="The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider." ) 441 protected List<Identifier> identifier; 442 443 /** 444 * The status of the diagnostic report as a whole. 445 */ 446 @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 447 @Description(shortDefinition="registered | partial | final | corrected | appended | cancelled | entered-in-error", formalDefinition="The status of the diagnostic report as a whole." ) 448 protected Enumeration<DiagnosticReportStatus> status; 449 450 /** 451 * A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes. 452 */ 453 @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 454 @Description(shortDefinition="Service category", formalDefinition="A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes." ) 455 protected CodeableConcept category; 456 457 /** 458 * A code or name that describes this diagnostic report. 459 */ 460 @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true) 461 @Description(shortDefinition="Name/Code for this diagnostic report", formalDefinition="A code or name that describes this diagnostic report." ) 462 protected CodeableConcept code; 463 464 /** 465 * The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources. 466 */ 467 @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Location.class}, order=4, min=1, max=1, modifier=false, summary=true) 468 @Description(shortDefinition="The subject of the report, usually, but not always, the patient", formalDefinition="The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources." ) 469 protected Reference subject; 470 471 /** 472 * The actual object that is the target of the reference (The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.) 473 */ 474 protected Resource subjectTarget; 475 476 /** 477 * The link to the health care event (encounter) when the order was made. 478 */ 479 @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true) 480 @Description(shortDefinition="Health care event when test ordered", formalDefinition="The link to the health care event (encounter) when the order was made." ) 481 protected Reference encounter; 482 483 /** 484 * The actual object that is the target of the reference (The link to the health care event (encounter) when the order was made.) 485 */ 486 protected Encounter encounterTarget; 487 488 /** 489 * The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself. 490 */ 491 @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=6, min=1, max=1, modifier=false, summary=true) 492 @Description(shortDefinition="Clinically Relevant time/time-period for report", formalDefinition="The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself." ) 493 protected Type effective; 494 495 /** 496 * The date and time that this version of the report was released from the source diagnostic service. 497 */ 498 @Child(name = "issued", type = {InstantType.class}, order=7, min=1, max=1, modifier=false, summary=true) 499 @Description(shortDefinition="DateTime this version was released", formalDefinition="The date and time that this version of the report was released from the source diagnostic service." ) 500 protected InstantType issued; 501 502 /** 503 * The diagnostic service that is responsible for issuing the report. 504 */ 505 @Child(name = "performer", type = {Practitioner.class, Organization.class}, order=8, min=1, max=1, modifier=false, summary=true) 506 @Description(shortDefinition="Responsible Diagnostic Service", formalDefinition="The diagnostic service that is responsible for issuing the report." ) 507 protected Reference performer; 508 509 /** 510 * The actual object that is the target of the reference (The diagnostic service that is responsible for issuing the report.) 511 */ 512 protected Resource performerTarget; 513 514 /** 515 * Details concerning a test or procedure requested. 516 */ 517 @Child(name = "request", type = {DiagnosticOrder.class, ProcedureRequest.class, ReferralRequest.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 518 @Description(shortDefinition="What was requested", formalDefinition="Details concerning a test or procedure requested." ) 519 protected List<Reference> request; 520 /** 521 * The actual objects that are the target of the reference (Details concerning a test or procedure requested.) 522 */ 523 protected List<Resource> requestTarget; 524 525 526 /** 527 * Details about the specimens on which this diagnostic report is based. 528 */ 529 @Child(name = "specimen", type = {Specimen.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 530 @Description(shortDefinition="Specimens this report is based on", formalDefinition="Details about the specimens on which this diagnostic report is based." ) 531 protected List<Reference> specimen; 532 /** 533 * The actual objects that are the target of the reference (Details about the specimens on which this diagnostic report is based.) 534 */ 535 protected List<Specimen> specimenTarget; 536 537 538 /** 539 * Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels"). 540 */ 541 @Child(name = "result", type = {Observation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 542 @Description(shortDefinition="Observations - simple, or complex nested groups", formalDefinition="Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. \"atomic\" results), or they can be grouping observations that include references to other members of the group (e.g. \"panels\")." ) 543 protected List<Reference> result; 544 /** 545 * The actual objects that are the target of the reference (Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").) 546 */ 547 protected List<Observation> resultTarget; 548 549 550 /** 551 * One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images. 552 */ 553 @Child(name = "imagingStudy", type = {ImagingStudy.class, ImagingObjectSelection.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 554 @Description(shortDefinition="Reference to full details of imaging associated with the diagnostic report", formalDefinition="One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images." ) 555 protected List<Reference> imagingStudy; 556 /** 557 * The actual objects that are the target of the reference (One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.) 558 */ 559 protected List<Resource> imagingStudyTarget; 560 561 562 /** 563 * A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest). 564 */ 565 @Child(name = "image", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 566 @Description(shortDefinition="Key images associated with this report", formalDefinition="A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest)." ) 567 protected List<DiagnosticReportImageComponent> image; 568 569 /** 570 * Concise and clinically contextualized narrative interpretation of the diagnostic report. 571 */ 572 @Child(name = "conclusion", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false) 573 @Description(shortDefinition="Clinical Interpretation of test results", formalDefinition="Concise and clinically contextualized narrative interpretation of the diagnostic report." ) 574 protected StringType conclusion; 575 576 /** 577 * Codes for the conclusion. 578 */ 579 @Child(name = "codedDiagnosis", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 580 @Description(shortDefinition="Codes for the conclusion", formalDefinition="Codes for the conclusion." ) 581 protected List<CodeableConcept> codedDiagnosis; 582 583 /** 584 * Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent. 585 */ 586 @Child(name = "presentedForm", type = {Attachment.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 587 @Description(shortDefinition="Entire report as issued", formalDefinition="Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent." ) 588 protected List<Attachment> presentedForm; 589 590 private static final long serialVersionUID = 920334551L; 591 592 /* 593 * Constructor 594 */ 595 public DiagnosticReport() { 596 super(); 597 } 598 599 /* 600 * Constructor 601 */ 602 public DiagnosticReport(Enumeration<DiagnosticReportStatus> status, CodeableConcept code, Reference subject, Type effective, InstantType issued, Reference performer) { 603 super(); 604 this.status = status; 605 this.code = code; 606 this.subject = subject; 607 this.effective = effective; 608 this.issued = issued; 609 this.performer = performer; 610 } 611 612 /** 613 * @return {@link #identifier} (The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.) 614 */ 615 public List<Identifier> getIdentifier() { 616 if (this.identifier == null) 617 this.identifier = new ArrayList<Identifier>(); 618 return this.identifier; 619 } 620 621 public boolean hasIdentifier() { 622 if (this.identifier == null) 623 return false; 624 for (Identifier item : this.identifier) 625 if (!item.isEmpty()) 626 return true; 627 return false; 628 } 629 630 /** 631 * @return {@link #identifier} (The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.) 632 */ 633 // syntactic sugar 634 public Identifier addIdentifier() { //3 635 Identifier t = new Identifier(); 636 if (this.identifier == null) 637 this.identifier = new ArrayList<Identifier>(); 638 this.identifier.add(t); 639 return t; 640 } 641 642 // syntactic sugar 643 public DiagnosticReport addIdentifier(Identifier t) { //3 644 if (t == null) 645 return this; 646 if (this.identifier == null) 647 this.identifier = new ArrayList<Identifier>(); 648 this.identifier.add(t); 649 return this; 650 } 651 652 /** 653 * @return {@link #status} (The status of the diagnostic report as a whole.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 654 */ 655 public Enumeration<DiagnosticReportStatus> getStatusElement() { 656 if (this.status == null) 657 if (Configuration.errorOnAutoCreate()) 658 throw new Error("Attempt to auto-create DiagnosticReport.status"); 659 else if (Configuration.doAutoCreate()) 660 this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory()); // bb 661 return this.status; 662 } 663 664 public boolean hasStatusElement() { 665 return this.status != null && !this.status.isEmpty(); 666 } 667 668 public boolean hasStatus() { 669 return this.status != null && !this.status.isEmpty(); 670 } 671 672 /** 673 * @param value {@link #status} (The status of the diagnostic report as a whole.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 674 */ 675 public DiagnosticReport setStatusElement(Enumeration<DiagnosticReportStatus> value) { 676 this.status = value; 677 return this; 678 } 679 680 /** 681 * @return The status of the diagnostic report as a whole. 682 */ 683 public DiagnosticReportStatus getStatus() { 684 return this.status == null ? null : this.status.getValue(); 685 } 686 687 /** 688 * @param value The status of the diagnostic report as a whole. 689 */ 690 public DiagnosticReport setStatus(DiagnosticReportStatus value) { 691 if (this.status == null) 692 this.status = new Enumeration<DiagnosticReportStatus>(new DiagnosticReportStatusEnumFactory()); 693 this.status.setValue(value); 694 return this; 695 } 696 697 /** 698 * @return {@link #category} (A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.) 699 */ 700 public CodeableConcept getCategory() { 701 if (this.category == null) 702 if (Configuration.errorOnAutoCreate()) 703 throw new Error("Attempt to auto-create DiagnosticReport.category"); 704 else if (Configuration.doAutoCreate()) 705 this.category = new CodeableConcept(); // cc 706 return this.category; 707 } 708 709 public boolean hasCategory() { 710 return this.category != null && !this.category.isEmpty(); 711 } 712 713 /** 714 * @param value {@link #category} (A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.) 715 */ 716 public DiagnosticReport setCategory(CodeableConcept value) { 717 this.category = value; 718 return this; 719 } 720 721 /** 722 * @return {@link #code} (A code or name that describes this diagnostic report.) 723 */ 724 public CodeableConcept getCode() { 725 if (this.code == null) 726 if (Configuration.errorOnAutoCreate()) 727 throw new Error("Attempt to auto-create DiagnosticReport.code"); 728 else if (Configuration.doAutoCreate()) 729 this.code = new CodeableConcept(); // cc 730 return this.code; 731 } 732 733 public boolean hasCode() { 734 return this.code != null && !this.code.isEmpty(); 735 } 736 737 /** 738 * @param value {@link #code} (A code or name that describes this diagnostic report.) 739 */ 740 public DiagnosticReport setCode(CodeableConcept value) { 741 this.code = value; 742 return this; 743 } 744 745 /** 746 * @return {@link #subject} (The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.) 747 */ 748 public Reference getSubject() { 749 if (this.subject == null) 750 if (Configuration.errorOnAutoCreate()) 751 throw new Error("Attempt to auto-create DiagnosticReport.subject"); 752 else if (Configuration.doAutoCreate()) 753 this.subject = new Reference(); // cc 754 return this.subject; 755 } 756 757 public boolean hasSubject() { 758 return this.subject != null && !this.subject.isEmpty(); 759 } 760 761 /** 762 * @param value {@link #subject} (The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.) 763 */ 764 public DiagnosticReport setSubject(Reference value) { 765 this.subject = value; 766 return this; 767 } 768 769 /** 770 * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.) 771 */ 772 public Resource getSubjectTarget() { 773 return this.subjectTarget; 774 } 775 776 /** 777 * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.) 778 */ 779 public DiagnosticReport setSubjectTarget(Resource value) { 780 this.subjectTarget = value; 781 return this; 782 } 783 784 /** 785 * @return {@link #encounter} (The link to the health care event (encounter) when the order was made.) 786 */ 787 public Reference getEncounter() { 788 if (this.encounter == null) 789 if (Configuration.errorOnAutoCreate()) 790 throw new Error("Attempt to auto-create DiagnosticReport.encounter"); 791 else if (Configuration.doAutoCreate()) 792 this.encounter = new Reference(); // cc 793 return this.encounter; 794 } 795 796 public boolean hasEncounter() { 797 return this.encounter != null && !this.encounter.isEmpty(); 798 } 799 800 /** 801 * @param value {@link #encounter} (The link to the health care event (encounter) when the order was made.) 802 */ 803 public DiagnosticReport setEncounter(Reference value) { 804 this.encounter = value; 805 return this; 806 } 807 808 /** 809 * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The link to the health care event (encounter) when the order was made.) 810 */ 811 public Encounter getEncounterTarget() { 812 if (this.encounterTarget == null) 813 if (Configuration.errorOnAutoCreate()) 814 throw new Error("Attempt to auto-create DiagnosticReport.encounter"); 815 else if (Configuration.doAutoCreate()) 816 this.encounterTarget = new Encounter(); // aa 817 return this.encounterTarget; 818 } 819 820 /** 821 * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The link to the health care event (encounter) when the order was made.) 822 */ 823 public DiagnosticReport setEncounterTarget(Encounter value) { 824 this.encounterTarget = value; 825 return this; 826 } 827 828 /** 829 * @return {@link #effective} (The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.) 830 */ 831 public Type getEffective() { 832 return this.effective; 833 } 834 835 /** 836 * @return {@link #effective} (The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.) 837 */ 838 public DateTimeType getEffectiveDateTimeType() throws FHIRException { 839 if (!(this.effective instanceof DateTimeType)) 840 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered"); 841 return (DateTimeType) this.effective; 842 } 843 844 public boolean hasEffectiveDateTimeType() { 845 return this.effective instanceof DateTimeType; 846 } 847 848 /** 849 * @return {@link #effective} (The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.) 850 */ 851 public Period getEffectivePeriod() throws FHIRException { 852 if (!(this.effective instanceof Period)) 853 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered"); 854 return (Period) this.effective; 855 } 856 857 public boolean hasEffectivePeriod() { 858 return this.effective instanceof Period; 859 } 860 861 public boolean hasEffective() { 862 return this.effective != null && !this.effective.isEmpty(); 863 } 864 865 /** 866 * @param value {@link #effective} (The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.) 867 */ 868 public DiagnosticReport setEffective(Type value) { 869 this.effective = value; 870 return this; 871 } 872 873 /** 874 * @return {@link #issued} (The date and time that this version of the report was released from the source diagnostic service.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value 875 */ 876 public InstantType getIssuedElement() { 877 if (this.issued == null) 878 if (Configuration.errorOnAutoCreate()) 879 throw new Error("Attempt to auto-create DiagnosticReport.issued"); 880 else if (Configuration.doAutoCreate()) 881 this.issued = new InstantType(); // bb 882 return this.issued; 883 } 884 885 public boolean hasIssuedElement() { 886 return this.issued != null && !this.issued.isEmpty(); 887 } 888 889 public boolean hasIssued() { 890 return this.issued != null && !this.issued.isEmpty(); 891 } 892 893 /** 894 * @param value {@link #issued} (The date and time that this version of the report was released from the source diagnostic service.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value 895 */ 896 public DiagnosticReport setIssuedElement(InstantType value) { 897 this.issued = value; 898 return this; 899 } 900 901 /** 902 * @return The date and time that this version of the report was released from the source diagnostic service. 903 */ 904 public Date getIssued() { 905 return this.issued == null ? null : this.issued.getValue(); 906 } 907 908 /** 909 * @param value The date and time that this version of the report was released from the source diagnostic service. 910 */ 911 public DiagnosticReport setIssued(Date value) { 912 if (this.issued == null) 913 this.issued = new InstantType(); 914 this.issued.setValue(value); 915 return this; 916 } 917 918 /** 919 * @return {@link #performer} (The diagnostic service that is responsible for issuing the report.) 920 */ 921 public Reference getPerformer() { 922 if (this.performer == null) 923 if (Configuration.errorOnAutoCreate()) 924 throw new Error("Attempt to auto-create DiagnosticReport.performer"); 925 else if (Configuration.doAutoCreate()) 926 this.performer = new Reference(); // cc 927 return this.performer; 928 } 929 930 public boolean hasPerformer() { 931 return this.performer != null && !this.performer.isEmpty(); 932 } 933 934 /** 935 * @param value {@link #performer} (The diagnostic service that is responsible for issuing the report.) 936 */ 937 public DiagnosticReport setPerformer(Reference value) { 938 this.performer = value; 939 return this; 940 } 941 942 /** 943 * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The diagnostic service that is responsible for issuing the report.) 944 */ 945 public Resource getPerformerTarget() { 946 return this.performerTarget; 947 } 948 949 /** 950 * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The diagnostic service that is responsible for issuing the report.) 951 */ 952 public DiagnosticReport setPerformerTarget(Resource value) { 953 this.performerTarget = value; 954 return this; 955 } 956 957 /** 958 * @return {@link #request} (Details concerning a test or procedure requested.) 959 */ 960 public List<Reference> getRequest() { 961 if (this.request == null) 962 this.request = new ArrayList<Reference>(); 963 return this.request; 964 } 965 966 public boolean hasRequest() { 967 if (this.request == null) 968 return false; 969 for (Reference item : this.request) 970 if (!item.isEmpty()) 971 return true; 972 return false; 973 } 974 975 /** 976 * @return {@link #request} (Details concerning a test or procedure requested.) 977 */ 978 // syntactic sugar 979 public Reference addRequest() { //3 980 Reference t = new Reference(); 981 if (this.request == null) 982 this.request = new ArrayList<Reference>(); 983 this.request.add(t); 984 return t; 985 } 986 987 // syntactic sugar 988 public DiagnosticReport addRequest(Reference t) { //3 989 if (t == null) 990 return this; 991 if (this.request == null) 992 this.request = new ArrayList<Reference>(); 993 this.request.add(t); 994 return this; 995 } 996 997 /** 998 * @return {@link #request} (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. Details concerning a test or procedure requested.) 999 */ 1000 public List<Resource> getRequestTarget() { 1001 if (this.requestTarget == null) 1002 this.requestTarget = new ArrayList<Resource>(); 1003 return this.requestTarget; 1004 } 1005 1006 /** 1007 * @return {@link #specimen} (Details about the specimens on which this diagnostic report is based.) 1008 */ 1009 public List<Reference> getSpecimen() { 1010 if (this.specimen == null) 1011 this.specimen = new ArrayList<Reference>(); 1012 return this.specimen; 1013 } 1014 1015 public boolean hasSpecimen() { 1016 if (this.specimen == null) 1017 return false; 1018 for (Reference item : this.specimen) 1019 if (!item.isEmpty()) 1020 return true; 1021 return false; 1022 } 1023 1024 /** 1025 * @return {@link #specimen} (Details about the specimens on which this diagnostic report is based.) 1026 */ 1027 // syntactic sugar 1028 public Reference addSpecimen() { //3 1029 Reference t = new Reference(); 1030 if (this.specimen == null) 1031 this.specimen = new ArrayList<Reference>(); 1032 this.specimen.add(t); 1033 return t; 1034 } 1035 1036 // syntactic sugar 1037 public DiagnosticReport addSpecimen(Reference t) { //3 1038 if (t == null) 1039 return this; 1040 if (this.specimen == null) 1041 this.specimen = new ArrayList<Reference>(); 1042 this.specimen.add(t); 1043 return this; 1044 } 1045 1046 /** 1047 * @return {@link #specimen} (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. Details about the specimens on which this diagnostic report is based.) 1048 */ 1049 public List<Specimen> getSpecimenTarget() { 1050 if (this.specimenTarget == null) 1051 this.specimenTarget = new ArrayList<Specimen>(); 1052 return this.specimenTarget; 1053 } 1054 1055 // syntactic sugar 1056 /** 1057 * @return {@link #specimen} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Details about the specimens on which this diagnostic report is based.) 1058 */ 1059 public Specimen addSpecimenTarget() { 1060 Specimen r = new Specimen(); 1061 if (this.specimenTarget == null) 1062 this.specimenTarget = new ArrayList<Specimen>(); 1063 this.specimenTarget.add(r); 1064 return r; 1065 } 1066 1067 /** 1068 * @return {@link #result} (Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").) 1069 */ 1070 public List<Reference> getResult() { 1071 if (this.result == null) 1072 this.result = new ArrayList<Reference>(); 1073 return this.result; 1074 } 1075 1076 public boolean hasResult() { 1077 if (this.result == null) 1078 return false; 1079 for (Reference item : this.result) 1080 if (!item.isEmpty()) 1081 return true; 1082 return false; 1083 } 1084 1085 /** 1086 * @return {@link #result} (Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").) 1087 */ 1088 // syntactic sugar 1089 public Reference addResult() { //3 1090 Reference t = new Reference(); 1091 if (this.result == null) 1092 this.result = new ArrayList<Reference>(); 1093 this.result.add(t); 1094 return t; 1095 } 1096 1097 // syntactic sugar 1098 public DiagnosticReport addResult(Reference t) { //3 1099 if (t == null) 1100 return this; 1101 if (this.result == null) 1102 this.result = new ArrayList<Reference>(); 1103 this.result.add(t); 1104 return this; 1105 } 1106 1107 /** 1108 * @return {@link #result} (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. Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").) 1109 */ 1110 public List<Observation> getResultTarget() { 1111 if (this.resultTarget == null) 1112 this.resultTarget = new ArrayList<Observation>(); 1113 return this.resultTarget; 1114 } 1115 1116 // syntactic sugar 1117 /** 1118 * @return {@link #result} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").) 1119 */ 1120 public Observation addResultTarget() { 1121 Observation r = new Observation(); 1122 if (this.resultTarget == null) 1123 this.resultTarget = new ArrayList<Observation>(); 1124 this.resultTarget.add(r); 1125 return r; 1126 } 1127 1128 /** 1129 * @return {@link #imagingStudy} (One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.) 1130 */ 1131 public List<Reference> getImagingStudy() { 1132 if (this.imagingStudy == null) 1133 this.imagingStudy = new ArrayList<Reference>(); 1134 return this.imagingStudy; 1135 } 1136 1137 public boolean hasImagingStudy() { 1138 if (this.imagingStudy == null) 1139 return false; 1140 for (Reference item : this.imagingStudy) 1141 if (!item.isEmpty()) 1142 return true; 1143 return false; 1144 } 1145 1146 /** 1147 * @return {@link #imagingStudy} (One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.) 1148 */ 1149 // syntactic sugar 1150 public Reference addImagingStudy() { //3 1151 Reference t = new Reference(); 1152 if (this.imagingStudy == null) 1153 this.imagingStudy = new ArrayList<Reference>(); 1154 this.imagingStudy.add(t); 1155 return t; 1156 } 1157 1158 // syntactic sugar 1159 public DiagnosticReport addImagingStudy(Reference t) { //3 1160 if (t == null) 1161 return this; 1162 if (this.imagingStudy == null) 1163 this.imagingStudy = new ArrayList<Reference>(); 1164 this.imagingStudy.add(t); 1165 return this; 1166 } 1167 1168 /** 1169 * @return {@link #imagingStudy} (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. One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.) 1170 */ 1171 public List<Resource> getImagingStudyTarget() { 1172 if (this.imagingStudyTarget == null) 1173 this.imagingStudyTarget = new ArrayList<Resource>(); 1174 return this.imagingStudyTarget; 1175 } 1176 1177 /** 1178 * @return {@link #image} (A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).) 1179 */ 1180 public List<DiagnosticReportImageComponent> getImage() { 1181 if (this.image == null) 1182 this.image = new ArrayList<DiagnosticReportImageComponent>(); 1183 return this.image; 1184 } 1185 1186 public boolean hasImage() { 1187 if (this.image == null) 1188 return false; 1189 for (DiagnosticReportImageComponent item : this.image) 1190 if (!item.isEmpty()) 1191 return true; 1192 return false; 1193 } 1194 1195 /** 1196 * @return {@link #image} (A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).) 1197 */ 1198 // syntactic sugar 1199 public DiagnosticReportImageComponent addImage() { //3 1200 DiagnosticReportImageComponent t = new DiagnosticReportImageComponent(); 1201 if (this.image == null) 1202 this.image = new ArrayList<DiagnosticReportImageComponent>(); 1203 this.image.add(t); 1204 return t; 1205 } 1206 1207 // syntactic sugar 1208 public DiagnosticReport addImage(DiagnosticReportImageComponent t) { //3 1209 if (t == null) 1210 return this; 1211 if (this.image == null) 1212 this.image = new ArrayList<DiagnosticReportImageComponent>(); 1213 this.image.add(t); 1214 return this; 1215 } 1216 1217 /** 1218 * @return {@link #conclusion} (Concise and clinically contextualized narrative interpretation of the diagnostic report.). This is the underlying object with id, value and extensions. The accessor "getConclusion" gives direct access to the value 1219 */ 1220 public StringType getConclusionElement() { 1221 if (this.conclusion == null) 1222 if (Configuration.errorOnAutoCreate()) 1223 throw new Error("Attempt to auto-create DiagnosticReport.conclusion"); 1224 else if (Configuration.doAutoCreate()) 1225 this.conclusion = new StringType(); // bb 1226 return this.conclusion; 1227 } 1228 1229 public boolean hasConclusionElement() { 1230 return this.conclusion != null && !this.conclusion.isEmpty(); 1231 } 1232 1233 public boolean hasConclusion() { 1234 return this.conclusion != null && !this.conclusion.isEmpty(); 1235 } 1236 1237 /** 1238 * @param value {@link #conclusion} (Concise and clinically contextualized narrative interpretation of the diagnostic report.). This is the underlying object with id, value and extensions. The accessor "getConclusion" gives direct access to the value 1239 */ 1240 public DiagnosticReport setConclusionElement(StringType value) { 1241 this.conclusion = value; 1242 return this; 1243 } 1244 1245 /** 1246 * @return Concise and clinically contextualized narrative interpretation of the diagnostic report. 1247 */ 1248 public String getConclusion() { 1249 return this.conclusion == null ? null : this.conclusion.getValue(); 1250 } 1251 1252 /** 1253 * @param value Concise and clinically contextualized narrative interpretation of the diagnostic report. 1254 */ 1255 public DiagnosticReport setConclusion(String value) { 1256 if (Utilities.noString(value)) 1257 this.conclusion = null; 1258 else { 1259 if (this.conclusion == null) 1260 this.conclusion = new StringType(); 1261 this.conclusion.setValue(value); 1262 } 1263 return this; 1264 } 1265 1266 /** 1267 * @return {@link #codedDiagnosis} (Codes for the conclusion.) 1268 */ 1269 public List<CodeableConcept> getCodedDiagnosis() { 1270 if (this.codedDiagnosis == null) 1271 this.codedDiagnosis = new ArrayList<CodeableConcept>(); 1272 return this.codedDiagnosis; 1273 } 1274 1275 public boolean hasCodedDiagnosis() { 1276 if (this.codedDiagnosis == null) 1277 return false; 1278 for (CodeableConcept item : this.codedDiagnosis) 1279 if (!item.isEmpty()) 1280 return true; 1281 return false; 1282 } 1283 1284 /** 1285 * @return {@link #codedDiagnosis} (Codes for the conclusion.) 1286 */ 1287 // syntactic sugar 1288 public CodeableConcept addCodedDiagnosis() { //3 1289 CodeableConcept t = new CodeableConcept(); 1290 if (this.codedDiagnosis == null) 1291 this.codedDiagnosis = new ArrayList<CodeableConcept>(); 1292 this.codedDiagnosis.add(t); 1293 return t; 1294 } 1295 1296 // syntactic sugar 1297 public DiagnosticReport addCodedDiagnosis(CodeableConcept t) { //3 1298 if (t == null) 1299 return this; 1300 if (this.codedDiagnosis == null) 1301 this.codedDiagnosis = new ArrayList<CodeableConcept>(); 1302 this.codedDiagnosis.add(t); 1303 return this; 1304 } 1305 1306 /** 1307 * @return {@link #presentedForm} (Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.) 1308 */ 1309 public List<Attachment> getPresentedForm() { 1310 if (this.presentedForm == null) 1311 this.presentedForm = new ArrayList<Attachment>(); 1312 return this.presentedForm; 1313 } 1314 1315 public boolean hasPresentedForm() { 1316 if (this.presentedForm == null) 1317 return false; 1318 for (Attachment item : this.presentedForm) 1319 if (!item.isEmpty()) 1320 return true; 1321 return false; 1322 } 1323 1324 /** 1325 * @return {@link #presentedForm} (Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.) 1326 */ 1327 // syntactic sugar 1328 public Attachment addPresentedForm() { //3 1329 Attachment t = new Attachment(); 1330 if (this.presentedForm == null) 1331 this.presentedForm = new ArrayList<Attachment>(); 1332 this.presentedForm.add(t); 1333 return t; 1334 } 1335 1336 // syntactic sugar 1337 public DiagnosticReport addPresentedForm(Attachment t) { //3 1338 if (t == null) 1339 return this; 1340 if (this.presentedForm == null) 1341 this.presentedForm = new ArrayList<Attachment>(); 1342 this.presentedForm.add(t); 1343 return this; 1344 } 1345 1346 protected void listChildren(List<Property> childrenList) { 1347 super.listChildren(childrenList); 1348 childrenList.add(new Property("identifier", "Identifier", "The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1349 childrenList.add(new Property("status", "code", "The status of the diagnostic report as a whole.", 0, java.lang.Integer.MAX_VALUE, status)); 1350 childrenList.add(new Property("category", "CodeableConcept", "A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.", 0, java.lang.Integer.MAX_VALUE, category)); 1351 childrenList.add(new Property("code", "CodeableConcept", "A code or name that describes this diagnostic report.", 0, java.lang.Integer.MAX_VALUE, code)); 1352 childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Location)", "The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.", 0, java.lang.Integer.MAX_VALUE, subject)); 1353 childrenList.add(new Property("encounter", "Reference(Encounter)", "The link to the health care event (encounter) when the order was made.", 0, java.lang.Integer.MAX_VALUE, encounter)); 1354 childrenList.add(new Property("effective[x]", "dateTime|Period", "The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.", 0, java.lang.Integer.MAX_VALUE, effective)); 1355 childrenList.add(new Property("issued", "instant", "The date and time that this version of the report was released from the source diagnostic service.", 0, java.lang.Integer.MAX_VALUE, issued)); 1356 childrenList.add(new Property("performer", "Reference(Practitioner|Organization)", "The diagnostic service that is responsible for issuing the report.", 0, java.lang.Integer.MAX_VALUE, performer)); 1357 childrenList.add(new Property("request", "Reference(DiagnosticOrder|ProcedureRequest|ReferralRequest)", "Details concerning a test or procedure requested.", 0, java.lang.Integer.MAX_VALUE, request)); 1358 childrenList.add(new Property("specimen", "Reference(Specimen)", "Details about the specimens on which this diagnostic report is based.", 0, java.lang.Integer.MAX_VALUE, specimen)); 1359 childrenList.add(new Property("result", "Reference(Observation)", "Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. \"atomic\" results), or they can be grouping observations that include references to other members of the group (e.g. \"panels\").", 0, java.lang.Integer.MAX_VALUE, result)); 1360 childrenList.add(new Property("imagingStudy", "Reference(ImagingStudy|ImagingObjectSelection)", "One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.", 0, java.lang.Integer.MAX_VALUE, imagingStudy)); 1361 childrenList.add(new Property("image", "", "A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).", 0, java.lang.Integer.MAX_VALUE, image)); 1362 childrenList.add(new Property("conclusion", "string", "Concise and clinically contextualized narrative interpretation of the diagnostic report.", 0, java.lang.Integer.MAX_VALUE, conclusion)); 1363 childrenList.add(new Property("codedDiagnosis", "CodeableConcept", "Codes for the conclusion.", 0, java.lang.Integer.MAX_VALUE, codedDiagnosis)); 1364 childrenList.add(new Property("presentedForm", "Attachment", "Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.", 0, java.lang.Integer.MAX_VALUE, presentedForm)); 1365 } 1366 1367 @Override 1368 public void setProperty(String name, Base value) throws FHIRException { 1369 if (name.equals("identifier")) 1370 this.getIdentifier().add(castToIdentifier(value)); 1371 else if (name.equals("status")) 1372 this.status = new DiagnosticReportStatusEnumFactory().fromType(value); // Enumeration<DiagnosticReportStatus> 1373 else if (name.equals("category")) 1374 this.category = castToCodeableConcept(value); // CodeableConcept 1375 else if (name.equals("code")) 1376 this.code = castToCodeableConcept(value); // CodeableConcept 1377 else if (name.equals("subject")) 1378 this.subject = castToReference(value); // Reference 1379 else if (name.equals("encounter")) 1380 this.encounter = castToReference(value); // Reference 1381 else if (name.equals("effective[x]")) 1382 this.effective = (Type) value; // Type 1383 else if (name.equals("issued")) 1384 this.issued = castToInstant(value); // InstantType 1385 else if (name.equals("performer")) 1386 this.performer = castToReference(value); // Reference 1387 else if (name.equals("request")) 1388 this.getRequest().add(castToReference(value)); 1389 else if (name.equals("specimen")) 1390 this.getSpecimen().add(castToReference(value)); 1391 else if (name.equals("result")) 1392 this.getResult().add(castToReference(value)); 1393 else if (name.equals("imagingStudy")) 1394 this.getImagingStudy().add(castToReference(value)); 1395 else if (name.equals("image")) 1396 this.getImage().add((DiagnosticReportImageComponent) value); 1397 else if (name.equals("conclusion")) 1398 this.conclusion = castToString(value); // StringType 1399 else if (name.equals("codedDiagnosis")) 1400 this.getCodedDiagnosis().add(castToCodeableConcept(value)); 1401 else if (name.equals("presentedForm")) 1402 this.getPresentedForm().add(castToAttachment(value)); 1403 else 1404 super.setProperty(name, value); 1405 } 1406 1407 @Override 1408 public Base addChild(String name) throws FHIRException { 1409 if (name.equals("identifier")) { 1410 return addIdentifier(); 1411 } 1412 else if (name.equals("status")) { 1413 throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.status"); 1414 } 1415 else if (name.equals("category")) { 1416 this.category = new CodeableConcept(); 1417 return this.category; 1418 } 1419 else if (name.equals("code")) { 1420 this.code = new CodeableConcept(); 1421 return this.code; 1422 } 1423 else if (name.equals("subject")) { 1424 this.subject = new Reference(); 1425 return this.subject; 1426 } 1427 else if (name.equals("encounter")) { 1428 this.encounter = new Reference(); 1429 return this.encounter; 1430 } 1431 else if (name.equals("effectiveDateTime")) { 1432 this.effective = new DateTimeType(); 1433 return this.effective; 1434 } 1435 else if (name.equals("effectivePeriod")) { 1436 this.effective = new Period(); 1437 return this.effective; 1438 } 1439 else if (name.equals("issued")) { 1440 throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.issued"); 1441 } 1442 else if (name.equals("performer")) { 1443 this.performer = new Reference(); 1444 return this.performer; 1445 } 1446 else if (name.equals("request")) { 1447 return addRequest(); 1448 } 1449 else if (name.equals("specimen")) { 1450 return addSpecimen(); 1451 } 1452 else if (name.equals("result")) { 1453 return addResult(); 1454 } 1455 else if (name.equals("imagingStudy")) { 1456 return addImagingStudy(); 1457 } 1458 else if (name.equals("image")) { 1459 return addImage(); 1460 } 1461 else if (name.equals("conclusion")) { 1462 throw new FHIRException("Cannot call addChild on a primitive type DiagnosticReport.conclusion"); 1463 } 1464 else if (name.equals("codedDiagnosis")) { 1465 return addCodedDiagnosis(); 1466 } 1467 else if (name.equals("presentedForm")) { 1468 return addPresentedForm(); 1469 } 1470 else 1471 return super.addChild(name); 1472 } 1473 1474 public String fhirType() { 1475 return "DiagnosticReport"; 1476 1477 } 1478 1479 public DiagnosticReport copy() { 1480 DiagnosticReport dst = new DiagnosticReport(); 1481 copyValues(dst); 1482 if (identifier != null) { 1483 dst.identifier = new ArrayList<Identifier>(); 1484 for (Identifier i : identifier) 1485 dst.identifier.add(i.copy()); 1486 }; 1487 dst.status = status == null ? null : status.copy(); 1488 dst.category = category == null ? null : category.copy(); 1489 dst.code = code == null ? null : code.copy(); 1490 dst.subject = subject == null ? null : subject.copy(); 1491 dst.encounter = encounter == null ? null : encounter.copy(); 1492 dst.effective = effective == null ? null : effective.copy(); 1493 dst.issued = issued == null ? null : issued.copy(); 1494 dst.performer = performer == null ? null : performer.copy(); 1495 if (request != null) { 1496 dst.request = new ArrayList<Reference>(); 1497 for (Reference i : request) 1498 dst.request.add(i.copy()); 1499 }; 1500 if (specimen != null) { 1501 dst.specimen = new ArrayList<Reference>(); 1502 for (Reference i : specimen) 1503 dst.specimen.add(i.copy()); 1504 }; 1505 if (result != null) { 1506 dst.result = new ArrayList<Reference>(); 1507 for (Reference i : result) 1508 dst.result.add(i.copy()); 1509 }; 1510 if (imagingStudy != null) { 1511 dst.imagingStudy = new ArrayList<Reference>(); 1512 for (Reference i : imagingStudy) 1513 dst.imagingStudy.add(i.copy()); 1514 }; 1515 if (image != null) { 1516 dst.image = new ArrayList<DiagnosticReportImageComponent>(); 1517 for (DiagnosticReportImageComponent i : image) 1518 dst.image.add(i.copy()); 1519 }; 1520 dst.conclusion = conclusion == null ? null : conclusion.copy(); 1521 if (codedDiagnosis != null) { 1522 dst.codedDiagnosis = new ArrayList<CodeableConcept>(); 1523 for (CodeableConcept i : codedDiagnosis) 1524 dst.codedDiagnosis.add(i.copy()); 1525 }; 1526 if (presentedForm != null) { 1527 dst.presentedForm = new ArrayList<Attachment>(); 1528 for (Attachment i : presentedForm) 1529 dst.presentedForm.add(i.copy()); 1530 }; 1531 return dst; 1532 } 1533 1534 protected DiagnosticReport typedCopy() { 1535 return copy(); 1536 } 1537 1538 @Override 1539 public boolean equalsDeep(Base other) { 1540 if (!super.equalsDeep(other)) 1541 return false; 1542 if (!(other instanceof DiagnosticReport)) 1543 return false; 1544 DiagnosticReport o = (DiagnosticReport) other; 1545 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true) 1546 && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true) 1547 && compareDeep(effective, o.effective, true) && compareDeep(issued, o.issued, true) && compareDeep(performer, o.performer, true) 1548 && compareDeep(request, o.request, true) && compareDeep(specimen, o.specimen, true) && compareDeep(result, o.result, true) 1549 && compareDeep(imagingStudy, o.imagingStudy, true) && compareDeep(image, o.image, true) && compareDeep(conclusion, o.conclusion, true) 1550 && compareDeep(codedDiagnosis, o.codedDiagnosis, true) && compareDeep(presentedForm, o.presentedForm, true) 1551 ; 1552 } 1553 1554 @Override 1555 public boolean equalsShallow(Base other) { 1556 if (!super.equalsShallow(other)) 1557 return false; 1558 if (!(other instanceof DiagnosticReport)) 1559 return false; 1560 DiagnosticReport o = (DiagnosticReport) other; 1561 return compareValues(status, o.status, true) && compareValues(issued, o.issued, true) && compareValues(conclusion, o.conclusion, true) 1562 ; 1563 } 1564 1565 public boolean isEmpty() { 1566 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 1567 && (category == null || category.isEmpty()) && (code == null || code.isEmpty()) && (subject == null || subject.isEmpty()) 1568 && (encounter == null || encounter.isEmpty()) && (effective == null || effective.isEmpty()) 1569 && (issued == null || issued.isEmpty()) && (performer == null || performer.isEmpty()) && (request == null || request.isEmpty()) 1570 && (specimen == null || specimen.isEmpty()) && (result == null || result.isEmpty()) && (imagingStudy == null || imagingStudy.isEmpty()) 1571 && (image == null || image.isEmpty()) && (conclusion == null || conclusion.isEmpty()) && (codedDiagnosis == null || codedDiagnosis.isEmpty()) 1572 && (presentedForm == null || presentedForm.isEmpty()); 1573 } 1574 1575 @Override 1576 public ResourceType getResourceType() { 1577 return ResourceType.DiagnosticReport; 1578 } 1579 1580 @SearchParamDefinition(name="date", path="DiagnosticReport.effective[x]", description="The clinically relevant time of the report", type="date" ) 1581 public static final String SP_DATE = "date"; 1582 @SearchParamDefinition(name="identifier", path="DiagnosticReport.identifier", description="An identifier for the report", type="token" ) 1583 public static final String SP_IDENTIFIER = "identifier"; 1584 @SearchParamDefinition(name="image", path="DiagnosticReport.image.link", description="A reference to the image source.", type="reference" ) 1585 public static final String SP_IMAGE = "image"; 1586 @SearchParamDefinition(name="request", path="DiagnosticReport.request", description="Reference to the test or procedure request.", type="reference" ) 1587 public static final String SP_REQUEST = "request"; 1588 @SearchParamDefinition(name="performer", path="DiagnosticReport.performer", description="Who was the source of the report (organization)", type="reference" ) 1589 public static final String SP_PERFORMER = "performer"; 1590 @SearchParamDefinition(name="code", path="DiagnosticReport.code", description="The code for the report as a whole, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result", type="token" ) 1591 public static final String SP_CODE = "code"; 1592 @SearchParamDefinition(name="subject", path="DiagnosticReport.subject", description="The subject of the report", type="reference" ) 1593 public static final String SP_SUBJECT = "subject"; 1594 @SearchParamDefinition(name="diagnosis", path="DiagnosticReport.codedDiagnosis", description="A coded diagnosis on the report", type="token" ) 1595 public static final String SP_DIAGNOSIS = "diagnosis"; 1596 @SearchParamDefinition(name="encounter", path="DiagnosticReport.encounter", description="The Encounter when the order was made", type="reference" ) 1597 public static final String SP_ENCOUNTER = "encounter"; 1598 @SearchParamDefinition(name="result", path="DiagnosticReport.result", description="Link to an atomic result (observation resource)", type="reference" ) 1599 public static final String SP_RESULT = "result"; 1600 @SearchParamDefinition(name="patient", path="DiagnosticReport.subject", description="The subject of the report if a patient", type="reference" ) 1601 public static final String SP_PATIENT = "patient"; 1602 @SearchParamDefinition(name="specimen", path="DiagnosticReport.specimen", description="The specimen details", type="reference" ) 1603 public static final String SP_SPECIMEN = "specimen"; 1604 @SearchParamDefinition(name="issued", path="DiagnosticReport.issued", description="When the report was issued", type="date" ) 1605 public static final String SP_ISSUED = "issued"; 1606 @SearchParamDefinition(name="category", path="DiagnosticReport.category", description="Which diagnostic discipline/department created the report", type="token" ) 1607 public static final String SP_CATEGORY = "category"; 1608 @SearchParamDefinition(name="status", path="DiagnosticReport.status", description="The status of the report", type="token" ) 1609 public static final String SP_STATUS = "status"; 1610 1611} 1612