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 * Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc. 068 */ 069@ResourceDef(name="DetectedIssue", profile="http://hl7.org/fhir/Profile/DetectedIssue") 070public class DetectedIssue extends DomainResource { 071 072 public enum DetectedIssueSeverity { 073 /** 074 * Indicates the issue may be life-threatening or has the potential to cause permanent injury. 075 */ 076 HIGH, 077 /** 078 * Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury. 079 */ 080 MODERATE, 081 /** 082 * Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject. 083 */ 084 LOW, 085 /** 086 * added to help the parsers 087 */ 088 NULL; 089 public static DetectedIssueSeverity fromCode(String codeString) throws FHIRException { 090 if (codeString == null || "".equals(codeString)) 091 return null; 092 if ("high".equals(codeString)) 093 return HIGH; 094 if ("moderate".equals(codeString)) 095 return MODERATE; 096 if ("low".equals(codeString)) 097 return LOW; 098 throw new FHIRException("Unknown DetectedIssueSeverity code '"+codeString+"'"); 099 } 100 public String toCode() { 101 switch (this) { 102 case HIGH: return "high"; 103 case MODERATE: return "moderate"; 104 case LOW: return "low"; 105 default: return "?"; 106 } 107 } 108 public String getSystem() { 109 switch (this) { 110 case HIGH: return "http://hl7.org/fhir/detectedissue-severity"; 111 case MODERATE: return "http://hl7.org/fhir/detectedissue-severity"; 112 case LOW: return "http://hl7.org/fhir/detectedissue-severity"; 113 default: return "?"; 114 } 115 } 116 public String getDefinition() { 117 switch (this) { 118 case HIGH: return "Indicates the issue may be life-threatening or has the potential to cause permanent injury."; 119 case MODERATE: return "Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury."; 120 case LOW: return "Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject."; 121 default: return "?"; 122 } 123 } 124 public String getDisplay() { 125 switch (this) { 126 case HIGH: return "High"; 127 case MODERATE: return "Moderate"; 128 case LOW: return "Low"; 129 default: return "?"; 130 } 131 } 132 } 133 134 public static class DetectedIssueSeverityEnumFactory implements EnumFactory<DetectedIssueSeverity> { 135 public DetectedIssueSeverity fromCode(String codeString) throws IllegalArgumentException { 136 if (codeString == null || "".equals(codeString)) 137 if (codeString == null || "".equals(codeString)) 138 return null; 139 if ("high".equals(codeString)) 140 return DetectedIssueSeverity.HIGH; 141 if ("moderate".equals(codeString)) 142 return DetectedIssueSeverity.MODERATE; 143 if ("low".equals(codeString)) 144 return DetectedIssueSeverity.LOW; 145 throw new IllegalArgumentException("Unknown DetectedIssueSeverity code '"+codeString+"'"); 146 } 147 public Enumeration<DetectedIssueSeverity> fromType(Base code) throws FHIRException { 148 if (code == null || code.isEmpty()) 149 return null; 150 String codeString = ((PrimitiveType) code).asStringValue(); 151 if (codeString == null || "".equals(codeString)) 152 return null; 153 if ("high".equals(codeString)) 154 return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.HIGH); 155 if ("moderate".equals(codeString)) 156 return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.MODERATE); 157 if ("low".equals(codeString)) 158 return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.LOW); 159 throw new FHIRException("Unknown DetectedIssueSeverity code '"+codeString+"'"); 160 } 161 public String toCode(DetectedIssueSeverity code) { 162 if (code == DetectedIssueSeverity.HIGH) 163 return "high"; 164 if (code == DetectedIssueSeverity.MODERATE) 165 return "moderate"; 166 if (code == DetectedIssueSeverity.LOW) 167 return "low"; 168 return "?"; 169 } 170 } 171 172 @Block() 173 public static class DetectedIssueMitigationComponent extends BackboneElement implements IBaseBackboneElement { 174 /** 175 * Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue. 176 */ 177 @Child(name = "action", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false) 178 @Description(shortDefinition="What mitigation?", formalDefinition="Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue." ) 179 protected CodeableConcept action; 180 181 /** 182 * Indicates when the mitigating action was documented. 183 */ 184 @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false) 185 @Description(shortDefinition="Date committed", formalDefinition="Indicates when the mitigating action was documented." ) 186 protected DateTimeType date; 187 188 /** 189 * Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring. 190 */ 191 @Child(name = "author", type = {Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=false) 192 @Description(shortDefinition="Who is committing?", formalDefinition="Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring." ) 193 protected Reference author; 194 195 /** 196 * The actual object that is the target of the reference (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.) 197 */ 198 protected Practitioner authorTarget; 199 200 private static final long serialVersionUID = -1994768436L; 201 202 /* 203 * Constructor 204 */ 205 public DetectedIssueMitigationComponent() { 206 super(); 207 } 208 209 /* 210 * Constructor 211 */ 212 public DetectedIssueMitigationComponent(CodeableConcept action) { 213 super(); 214 this.action = action; 215 } 216 217 /** 218 * @return {@link #action} (Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.) 219 */ 220 public CodeableConcept getAction() { 221 if (this.action == null) 222 if (Configuration.errorOnAutoCreate()) 223 throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.action"); 224 else if (Configuration.doAutoCreate()) 225 this.action = new CodeableConcept(); // cc 226 return this.action; 227 } 228 229 public boolean hasAction() { 230 return this.action != null && !this.action.isEmpty(); 231 } 232 233 /** 234 * @param value {@link #action} (Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.) 235 */ 236 public DetectedIssueMitigationComponent setAction(CodeableConcept value) { 237 this.action = value; 238 return this; 239 } 240 241 /** 242 * @return {@link #date} (Indicates when the mitigating action was documented.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 243 */ 244 public DateTimeType getDateElement() { 245 if (this.date == null) 246 if (Configuration.errorOnAutoCreate()) 247 throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.date"); 248 else if (Configuration.doAutoCreate()) 249 this.date = new DateTimeType(); // bb 250 return this.date; 251 } 252 253 public boolean hasDateElement() { 254 return this.date != null && !this.date.isEmpty(); 255 } 256 257 public boolean hasDate() { 258 return this.date != null && !this.date.isEmpty(); 259 } 260 261 /** 262 * @param value {@link #date} (Indicates when the mitigating action was documented.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 263 */ 264 public DetectedIssueMitigationComponent setDateElement(DateTimeType value) { 265 this.date = value; 266 return this; 267 } 268 269 /** 270 * @return Indicates when the mitigating action was documented. 271 */ 272 public Date getDate() { 273 return this.date == null ? null : this.date.getValue(); 274 } 275 276 /** 277 * @param value Indicates when the mitigating action was documented. 278 */ 279 public DetectedIssueMitigationComponent setDate(Date value) { 280 if (value == null) 281 this.date = null; 282 else { 283 if (this.date == null) 284 this.date = new DateTimeType(); 285 this.date.setValue(value); 286 } 287 return this; 288 } 289 290 /** 291 * @return {@link #author} (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.) 292 */ 293 public Reference getAuthor() { 294 if (this.author == null) 295 if (Configuration.errorOnAutoCreate()) 296 throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.author"); 297 else if (Configuration.doAutoCreate()) 298 this.author = new Reference(); // cc 299 return this.author; 300 } 301 302 public boolean hasAuthor() { 303 return this.author != null && !this.author.isEmpty(); 304 } 305 306 /** 307 * @param value {@link #author} (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.) 308 */ 309 public DetectedIssueMitigationComponent setAuthor(Reference value) { 310 this.author = value; 311 return this; 312 } 313 314 /** 315 * @return {@link #author} 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. (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.) 316 */ 317 public Practitioner getAuthorTarget() { 318 if (this.authorTarget == null) 319 if (Configuration.errorOnAutoCreate()) 320 throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.author"); 321 else if (Configuration.doAutoCreate()) 322 this.authorTarget = new Practitioner(); // aa 323 return this.authorTarget; 324 } 325 326 /** 327 * @param value {@link #author} 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. (Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.) 328 */ 329 public DetectedIssueMitigationComponent setAuthorTarget(Practitioner value) { 330 this.authorTarget = value; 331 return this; 332 } 333 334 protected void listChildren(List<Property> childrenList) { 335 super.listChildren(childrenList); 336 childrenList.add(new Property("action", "CodeableConcept", "Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.", 0, java.lang.Integer.MAX_VALUE, action)); 337 childrenList.add(new Property("date", "dateTime", "Indicates when the mitigating action was documented.", 0, java.lang.Integer.MAX_VALUE, date)); 338 childrenList.add(new Property("author", "Reference(Practitioner)", "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.", 0, java.lang.Integer.MAX_VALUE, author)); 339 } 340 341 @Override 342 public void setProperty(String name, Base value) throws FHIRException { 343 if (name.equals("action")) 344 this.action = castToCodeableConcept(value); // CodeableConcept 345 else if (name.equals("date")) 346 this.date = castToDateTime(value); // DateTimeType 347 else if (name.equals("author")) 348 this.author = castToReference(value); // Reference 349 else 350 super.setProperty(name, value); 351 } 352 353 @Override 354 public Base addChild(String name) throws FHIRException { 355 if (name.equals("action")) { 356 this.action = new CodeableConcept(); 357 return this.action; 358 } 359 else if (name.equals("date")) { 360 throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.date"); 361 } 362 else if (name.equals("author")) { 363 this.author = new Reference(); 364 return this.author; 365 } 366 else 367 return super.addChild(name); 368 } 369 370 public DetectedIssueMitigationComponent copy() { 371 DetectedIssueMitigationComponent dst = new DetectedIssueMitigationComponent(); 372 copyValues(dst); 373 dst.action = action == null ? null : action.copy(); 374 dst.date = date == null ? null : date.copy(); 375 dst.author = author == null ? null : author.copy(); 376 return dst; 377 } 378 379 @Override 380 public boolean equalsDeep(Base other) { 381 if (!super.equalsDeep(other)) 382 return false; 383 if (!(other instanceof DetectedIssueMitigationComponent)) 384 return false; 385 DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other; 386 return compareDeep(action, o.action, true) && compareDeep(date, o.date, true) && compareDeep(author, o.author, true) 387 ; 388 } 389 390 @Override 391 public boolean equalsShallow(Base other) { 392 if (!super.equalsShallow(other)) 393 return false; 394 if (!(other instanceof DetectedIssueMitigationComponent)) 395 return false; 396 DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other; 397 return compareValues(date, o.date, true); 398 } 399 400 public boolean isEmpty() { 401 return super.isEmpty() && (action == null || action.isEmpty()) && (date == null || date.isEmpty()) 402 && (author == null || author.isEmpty()); 403 } 404 405 public String fhirType() { 406 return "DetectedIssue.mitigation"; 407 408 } 409 410 } 411 412 /** 413 * Indicates the patient whose record the detected issue is associated with. 414 */ 415 @Child(name = "patient", type = {Patient.class}, order=0, min=0, max=1, modifier=false, summary=true) 416 @Description(shortDefinition="Associated patient", formalDefinition="Indicates the patient whose record the detected issue is associated with." ) 417 protected Reference patient; 418 419 /** 420 * The actual object that is the target of the reference (Indicates the patient whose record the detected issue is associated with.) 421 */ 422 protected Patient patientTarget; 423 424 /** 425 * Identifies the general type of issue identified. 426 */ 427 @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 428 @Description(shortDefinition="Issue Category, e.g. drug-drug, duplicate therapy, etc.", formalDefinition="Identifies the general type of issue identified." ) 429 protected CodeableConcept category; 430 431 /** 432 * Indicates the degree of importance associated with the identified issue based on the potential impact on the patient. 433 */ 434 @Child(name = "severity", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true) 435 @Description(shortDefinition="high | moderate | low", formalDefinition="Indicates the degree of importance associated with the identified issue based on the potential impact on the patient." ) 436 protected Enumeration<DetectedIssueSeverity> severity; 437 438 /** 439 * Indicates the resource representing the current activity or proposed activity that is potentially problematic. 440 */ 441 @Child(name = "implicated", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 442 @Description(shortDefinition="Problem resource", formalDefinition="Indicates the resource representing the current activity or proposed activity that is potentially problematic." ) 443 protected List<Reference> implicated; 444 /** 445 * The actual objects that are the target of the reference (Indicates the resource representing the current activity or proposed activity that is potentially problematic.) 446 */ 447 protected List<Resource> implicatedTarget; 448 449 450 /** 451 * A textual explanation of the detected issue. 452 */ 453 @Child(name = "detail", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false) 454 @Description(shortDefinition="Description and context", formalDefinition="A textual explanation of the detected issue." ) 455 protected StringType detail; 456 457 /** 458 * The date or date-time when the detected issue was initially identified. 459 */ 460 @Child(name = "date", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true) 461 @Description(shortDefinition="When identified", formalDefinition="The date or date-time when the detected issue was initially identified." ) 462 protected DateTimeType date; 463 464 /** 465 * Individual or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review. 466 */ 467 @Child(name = "author", type = {Practitioner.class, Device.class}, order=6, min=0, max=1, modifier=false, summary=true) 468 @Description(shortDefinition="The provider or device that identified the issue", formalDefinition="Individual or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review." ) 469 protected Reference author; 470 471 /** 472 * The actual object that is the target of the reference (Individual or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review.) 473 */ 474 protected Resource authorTarget; 475 476 /** 477 * Business identifier associated with the detected issue record. 478 */ 479 @Child(name = "identifier", type = {Identifier.class}, order=7, min=0, max=1, modifier=false, summary=true) 480 @Description(shortDefinition="Unique id for the detected issue", formalDefinition="Business identifier associated with the detected issue record." ) 481 protected Identifier identifier; 482 483 /** 484 * The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified. 485 */ 486 @Child(name = "reference", type = {UriType.class}, order=8, min=0, max=1, modifier=false, summary=false) 487 @Description(shortDefinition="Authority for issue", formalDefinition="The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified." ) 488 protected UriType reference; 489 490 /** 491 * Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action. 492 */ 493 @Child(name = "mitigation", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 494 @Description(shortDefinition="Step taken to address", formalDefinition="Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action." ) 495 protected List<DetectedIssueMitigationComponent> mitigation; 496 497 private static final long serialVersionUID = -403732234L; 498 499 /* 500 * Constructor 501 */ 502 public DetectedIssue() { 503 super(); 504 } 505 506 /** 507 * @return {@link #patient} (Indicates the patient whose record the detected issue is associated with.) 508 */ 509 public Reference getPatient() { 510 if (this.patient == null) 511 if (Configuration.errorOnAutoCreate()) 512 throw new Error("Attempt to auto-create DetectedIssue.patient"); 513 else if (Configuration.doAutoCreate()) 514 this.patient = new Reference(); // cc 515 return this.patient; 516 } 517 518 public boolean hasPatient() { 519 return this.patient != null && !this.patient.isEmpty(); 520 } 521 522 /** 523 * @param value {@link #patient} (Indicates the patient whose record the detected issue is associated with.) 524 */ 525 public DetectedIssue setPatient(Reference value) { 526 this.patient = value; 527 return this; 528 } 529 530 /** 531 * @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 whose record the detected issue is associated with.) 532 */ 533 public Patient getPatientTarget() { 534 if (this.patientTarget == null) 535 if (Configuration.errorOnAutoCreate()) 536 throw new Error("Attempt to auto-create DetectedIssue.patient"); 537 else if (Configuration.doAutoCreate()) 538 this.patientTarget = new Patient(); // aa 539 return this.patientTarget; 540 } 541 542 /** 543 * @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 whose record the detected issue is associated with.) 544 */ 545 public DetectedIssue setPatientTarget(Patient value) { 546 this.patientTarget = value; 547 return this; 548 } 549 550 /** 551 * @return {@link #category} (Identifies the general type of issue identified.) 552 */ 553 public CodeableConcept getCategory() { 554 if (this.category == null) 555 if (Configuration.errorOnAutoCreate()) 556 throw new Error("Attempt to auto-create DetectedIssue.category"); 557 else if (Configuration.doAutoCreate()) 558 this.category = new CodeableConcept(); // cc 559 return this.category; 560 } 561 562 public boolean hasCategory() { 563 return this.category != null && !this.category.isEmpty(); 564 } 565 566 /** 567 * @param value {@link #category} (Identifies the general type of issue identified.) 568 */ 569 public DetectedIssue setCategory(CodeableConcept value) { 570 this.category = value; 571 return this; 572 } 573 574 /** 575 * @return {@link #severity} (Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value 576 */ 577 public Enumeration<DetectedIssueSeverity> getSeverityElement() { 578 if (this.severity == null) 579 if (Configuration.errorOnAutoCreate()) 580 throw new Error("Attempt to auto-create DetectedIssue.severity"); 581 else if (Configuration.doAutoCreate()) 582 this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory()); // bb 583 return this.severity; 584 } 585 586 public boolean hasSeverityElement() { 587 return this.severity != null && !this.severity.isEmpty(); 588 } 589 590 public boolean hasSeverity() { 591 return this.severity != null && !this.severity.isEmpty(); 592 } 593 594 /** 595 * @param value {@link #severity} (Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value 596 */ 597 public DetectedIssue setSeverityElement(Enumeration<DetectedIssueSeverity> value) { 598 this.severity = value; 599 return this; 600 } 601 602 /** 603 * @return Indicates the degree of importance associated with the identified issue based on the potential impact on the patient. 604 */ 605 public DetectedIssueSeverity getSeverity() { 606 return this.severity == null ? null : this.severity.getValue(); 607 } 608 609 /** 610 * @param value Indicates the degree of importance associated with the identified issue based on the potential impact on the patient. 611 */ 612 public DetectedIssue setSeverity(DetectedIssueSeverity value) { 613 if (value == null) 614 this.severity = null; 615 else { 616 if (this.severity == null) 617 this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory()); 618 this.severity.setValue(value); 619 } 620 return this; 621 } 622 623 /** 624 * @return {@link #implicated} (Indicates the resource representing the current activity or proposed activity that is potentially problematic.) 625 */ 626 public List<Reference> getImplicated() { 627 if (this.implicated == null) 628 this.implicated = new ArrayList<Reference>(); 629 return this.implicated; 630 } 631 632 public boolean hasImplicated() { 633 if (this.implicated == null) 634 return false; 635 for (Reference item : this.implicated) 636 if (!item.isEmpty()) 637 return true; 638 return false; 639 } 640 641 /** 642 * @return {@link #implicated} (Indicates the resource representing the current activity or proposed activity that is potentially problematic.) 643 */ 644 // syntactic sugar 645 public Reference addImplicated() { //3 646 Reference t = new Reference(); 647 if (this.implicated == null) 648 this.implicated = new ArrayList<Reference>(); 649 this.implicated.add(t); 650 return t; 651 } 652 653 // syntactic sugar 654 public DetectedIssue addImplicated(Reference t) { //3 655 if (t == null) 656 return this; 657 if (this.implicated == null) 658 this.implicated = new ArrayList<Reference>(); 659 this.implicated.add(t); 660 return this; 661 } 662 663 /** 664 * @return {@link #implicated} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Indicates the resource representing the current activity or proposed activity that is potentially problematic.) 665 */ 666 public List<Resource> getImplicatedTarget() { 667 if (this.implicatedTarget == null) 668 this.implicatedTarget = new ArrayList<Resource>(); 669 return this.implicatedTarget; 670 } 671 672 /** 673 * @return {@link #detail} (A textual explanation of the detected issue.). This is the underlying object with id, value and extensions. The accessor "getDetail" gives direct access to the value 674 */ 675 public StringType getDetailElement() { 676 if (this.detail == null) 677 if (Configuration.errorOnAutoCreate()) 678 throw new Error("Attempt to auto-create DetectedIssue.detail"); 679 else if (Configuration.doAutoCreate()) 680 this.detail = new StringType(); // bb 681 return this.detail; 682 } 683 684 public boolean hasDetailElement() { 685 return this.detail != null && !this.detail.isEmpty(); 686 } 687 688 public boolean hasDetail() { 689 return this.detail != null && !this.detail.isEmpty(); 690 } 691 692 /** 693 * @param value {@link #detail} (A textual explanation of the detected issue.). This is the underlying object with id, value and extensions. The accessor "getDetail" gives direct access to the value 694 */ 695 public DetectedIssue setDetailElement(StringType value) { 696 this.detail = value; 697 return this; 698 } 699 700 /** 701 * @return A textual explanation of the detected issue. 702 */ 703 public String getDetail() { 704 return this.detail == null ? null : this.detail.getValue(); 705 } 706 707 /** 708 * @param value A textual explanation of the detected issue. 709 */ 710 public DetectedIssue setDetail(String value) { 711 if (Utilities.noString(value)) 712 this.detail = null; 713 else { 714 if (this.detail == null) 715 this.detail = new StringType(); 716 this.detail.setValue(value); 717 } 718 return this; 719 } 720 721 /** 722 * @return {@link #date} (The date or date-time when the detected issue was initially identified.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 723 */ 724 public DateTimeType getDateElement() { 725 if (this.date == null) 726 if (Configuration.errorOnAutoCreate()) 727 throw new Error("Attempt to auto-create DetectedIssue.date"); 728 else if (Configuration.doAutoCreate()) 729 this.date = new DateTimeType(); // bb 730 return this.date; 731 } 732 733 public boolean hasDateElement() { 734 return this.date != null && !this.date.isEmpty(); 735 } 736 737 public boolean hasDate() { 738 return this.date != null && !this.date.isEmpty(); 739 } 740 741 /** 742 * @param value {@link #date} (The date or date-time when the detected issue was initially identified.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 743 */ 744 public DetectedIssue setDateElement(DateTimeType value) { 745 this.date = value; 746 return this; 747 } 748 749 /** 750 * @return The date or date-time when the detected issue was initially identified. 751 */ 752 public Date getDate() { 753 return this.date == null ? null : this.date.getValue(); 754 } 755 756 /** 757 * @param value The date or date-time when the detected issue was initially identified. 758 */ 759 public DetectedIssue setDate(Date value) { 760 if (value == null) 761 this.date = null; 762 else { 763 if (this.date == null) 764 this.date = new DateTimeType(); 765 this.date.setValue(value); 766 } 767 return this; 768 } 769 770 /** 771 * @return {@link #author} (Individual or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review.) 772 */ 773 public Reference getAuthor() { 774 if (this.author == null) 775 if (Configuration.errorOnAutoCreate()) 776 throw new Error("Attempt to auto-create DetectedIssue.author"); 777 else if (Configuration.doAutoCreate()) 778 this.author = new Reference(); // cc 779 return this.author; 780 } 781 782 public boolean hasAuthor() { 783 return this.author != null && !this.author.isEmpty(); 784 } 785 786 /** 787 * @param value {@link #author} (Individual or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review.) 788 */ 789 public DetectedIssue setAuthor(Reference value) { 790 this.author = value; 791 return this; 792 } 793 794 /** 795 * @return {@link #author} 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 or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review.) 796 */ 797 public Resource getAuthorTarget() { 798 return this.authorTarget; 799 } 800 801 /** 802 * @param value {@link #author} 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 or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review.) 803 */ 804 public DetectedIssue setAuthorTarget(Resource value) { 805 this.authorTarget = value; 806 return this; 807 } 808 809 /** 810 * @return {@link #identifier} (Business identifier associated with the detected issue record.) 811 */ 812 public Identifier getIdentifier() { 813 if (this.identifier == null) 814 if (Configuration.errorOnAutoCreate()) 815 throw new Error("Attempt to auto-create DetectedIssue.identifier"); 816 else if (Configuration.doAutoCreate()) 817 this.identifier = new Identifier(); // cc 818 return this.identifier; 819 } 820 821 public boolean hasIdentifier() { 822 return this.identifier != null && !this.identifier.isEmpty(); 823 } 824 825 /** 826 * @param value {@link #identifier} (Business identifier associated with the detected issue record.) 827 */ 828 public DetectedIssue setIdentifier(Identifier value) { 829 this.identifier = value; 830 return this; 831 } 832 833 /** 834 * @return {@link #reference} (The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value 835 */ 836 public UriType getReferenceElement() { 837 if (this.reference == null) 838 if (Configuration.errorOnAutoCreate()) 839 throw new Error("Attempt to auto-create DetectedIssue.reference"); 840 else if (Configuration.doAutoCreate()) 841 this.reference = new UriType(); // bb 842 return this.reference; 843 } 844 845 public boolean hasReferenceElement() { 846 return this.reference != null && !this.reference.isEmpty(); 847 } 848 849 public boolean hasReference() { 850 return this.reference != null && !this.reference.isEmpty(); 851 } 852 853 /** 854 * @param value {@link #reference} (The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value 855 */ 856 public DetectedIssue setReferenceElement(UriType value) { 857 this.reference = value; 858 return this; 859 } 860 861 /** 862 * @return The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified. 863 */ 864 public String getReference() { 865 return this.reference == null ? null : this.reference.getValue(); 866 } 867 868 /** 869 * @param value The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified. 870 */ 871 public DetectedIssue setReference(String value) { 872 if (Utilities.noString(value)) 873 this.reference = null; 874 else { 875 if (this.reference == null) 876 this.reference = new UriType(); 877 this.reference.setValue(value); 878 } 879 return this; 880 } 881 882 /** 883 * @return {@link #mitigation} (Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.) 884 */ 885 public List<DetectedIssueMitigationComponent> getMitigation() { 886 if (this.mitigation == null) 887 this.mitigation = new ArrayList<DetectedIssueMitigationComponent>(); 888 return this.mitigation; 889 } 890 891 public boolean hasMitigation() { 892 if (this.mitigation == null) 893 return false; 894 for (DetectedIssueMitigationComponent item : this.mitigation) 895 if (!item.isEmpty()) 896 return true; 897 return false; 898 } 899 900 /** 901 * @return {@link #mitigation} (Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.) 902 */ 903 // syntactic sugar 904 public DetectedIssueMitigationComponent addMitigation() { //3 905 DetectedIssueMitigationComponent t = new DetectedIssueMitigationComponent(); 906 if (this.mitigation == null) 907 this.mitigation = new ArrayList<DetectedIssueMitigationComponent>(); 908 this.mitigation.add(t); 909 return t; 910 } 911 912 // syntactic sugar 913 public DetectedIssue addMitigation(DetectedIssueMitigationComponent t) { //3 914 if (t == null) 915 return this; 916 if (this.mitigation == null) 917 this.mitigation = new ArrayList<DetectedIssueMitigationComponent>(); 918 this.mitigation.add(t); 919 return this; 920 } 921 922 protected void listChildren(List<Property> childrenList) { 923 super.listChildren(childrenList); 924 childrenList.add(new Property("patient", "Reference(Patient)", "Indicates the patient whose record the detected issue is associated with.", 0, java.lang.Integer.MAX_VALUE, patient)); 925 childrenList.add(new Property("category", "CodeableConcept", "Identifies the general type of issue identified.", 0, java.lang.Integer.MAX_VALUE, category)); 926 childrenList.add(new Property("severity", "code", "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.", 0, java.lang.Integer.MAX_VALUE, severity)); 927 childrenList.add(new Property("implicated", "Reference(Any)", "Indicates the resource representing the current activity or proposed activity that is potentially problematic.", 0, java.lang.Integer.MAX_VALUE, implicated)); 928 childrenList.add(new Property("detail", "string", "A textual explanation of the detected issue.", 0, java.lang.Integer.MAX_VALUE, detail)); 929 childrenList.add(new Property("date", "dateTime", "The date or date-time when the detected issue was initially identified.", 0, java.lang.Integer.MAX_VALUE, date)); 930 childrenList.add(new Property("author", "Reference(Practitioner|Device)", "Individual or device responsible for the issue being raised. For example, a decision support application or a pharmacist conducting a medication review.", 0, java.lang.Integer.MAX_VALUE, author)); 931 childrenList.add(new Property("identifier", "Identifier", "Business identifier associated with the detected issue record.", 0, java.lang.Integer.MAX_VALUE, identifier)); 932 childrenList.add(new Property("reference", "uri", "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.", 0, java.lang.Integer.MAX_VALUE, reference)); 933 childrenList.add(new Property("mitigation", "", "Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.", 0, java.lang.Integer.MAX_VALUE, mitigation)); 934 } 935 936 @Override 937 public void setProperty(String name, Base value) throws FHIRException { 938 if (name.equals("patient")) 939 this.patient = castToReference(value); // Reference 940 else if (name.equals("category")) 941 this.category = castToCodeableConcept(value); // CodeableConcept 942 else if (name.equals("severity")) 943 this.severity = new DetectedIssueSeverityEnumFactory().fromType(value); // Enumeration<DetectedIssueSeverity> 944 else if (name.equals("implicated")) 945 this.getImplicated().add(castToReference(value)); 946 else if (name.equals("detail")) 947 this.detail = castToString(value); // StringType 948 else if (name.equals("date")) 949 this.date = castToDateTime(value); // DateTimeType 950 else if (name.equals("author")) 951 this.author = castToReference(value); // Reference 952 else if (name.equals("identifier")) 953 this.identifier = castToIdentifier(value); // Identifier 954 else if (name.equals("reference")) 955 this.reference = castToUri(value); // UriType 956 else if (name.equals("mitigation")) 957 this.getMitigation().add((DetectedIssueMitigationComponent) value); 958 else 959 super.setProperty(name, value); 960 } 961 962 @Override 963 public Base addChild(String name) throws FHIRException { 964 if (name.equals("patient")) { 965 this.patient = new Reference(); 966 return this.patient; 967 } 968 else if (name.equals("category")) { 969 this.category = new CodeableConcept(); 970 return this.category; 971 } 972 else if (name.equals("severity")) { 973 throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.severity"); 974 } 975 else if (name.equals("implicated")) { 976 return addImplicated(); 977 } 978 else if (name.equals("detail")) { 979 throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.detail"); 980 } 981 else if (name.equals("date")) { 982 throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.date"); 983 } 984 else if (name.equals("author")) { 985 this.author = new Reference(); 986 return this.author; 987 } 988 else if (name.equals("identifier")) { 989 this.identifier = new Identifier(); 990 return this.identifier; 991 } 992 else if (name.equals("reference")) { 993 throw new FHIRException("Cannot call addChild on a primitive type DetectedIssue.reference"); 994 } 995 else if (name.equals("mitigation")) { 996 return addMitigation(); 997 } 998 else 999 return super.addChild(name); 1000 } 1001 1002 public String fhirType() { 1003 return "DetectedIssue"; 1004 1005 } 1006 1007 public DetectedIssue copy() { 1008 DetectedIssue dst = new DetectedIssue(); 1009 copyValues(dst); 1010 dst.patient = patient == null ? null : patient.copy(); 1011 dst.category = category == null ? null : category.copy(); 1012 dst.severity = severity == null ? null : severity.copy(); 1013 if (implicated != null) { 1014 dst.implicated = new ArrayList<Reference>(); 1015 for (Reference i : implicated) 1016 dst.implicated.add(i.copy()); 1017 }; 1018 dst.detail = detail == null ? null : detail.copy(); 1019 dst.date = date == null ? null : date.copy(); 1020 dst.author = author == null ? null : author.copy(); 1021 dst.identifier = identifier == null ? null : identifier.copy(); 1022 dst.reference = reference == null ? null : reference.copy(); 1023 if (mitigation != null) { 1024 dst.mitigation = new ArrayList<DetectedIssueMitigationComponent>(); 1025 for (DetectedIssueMitigationComponent i : mitigation) 1026 dst.mitigation.add(i.copy()); 1027 }; 1028 return dst; 1029 } 1030 1031 protected DetectedIssue typedCopy() { 1032 return copy(); 1033 } 1034 1035 @Override 1036 public boolean equalsDeep(Base other) { 1037 if (!super.equalsDeep(other)) 1038 return false; 1039 if (!(other instanceof DetectedIssue)) 1040 return false; 1041 DetectedIssue o = (DetectedIssue) other; 1042 return compareDeep(patient, o.patient, true) && compareDeep(category, o.category, true) && compareDeep(severity, o.severity, true) 1043 && compareDeep(implicated, o.implicated, true) && compareDeep(detail, o.detail, true) && compareDeep(date, o.date, true) 1044 && compareDeep(author, o.author, true) && compareDeep(identifier, o.identifier, true) && compareDeep(reference, o.reference, true) 1045 && compareDeep(mitigation, o.mitigation, true); 1046 } 1047 1048 @Override 1049 public boolean equalsShallow(Base other) { 1050 if (!super.equalsShallow(other)) 1051 return false; 1052 if (!(other instanceof DetectedIssue)) 1053 return false; 1054 DetectedIssue o = (DetectedIssue) other; 1055 return compareValues(severity, o.severity, true) && compareValues(detail, o.detail, true) && compareValues(date, o.date, true) 1056 && compareValues(reference, o.reference, true); 1057 } 1058 1059 public boolean isEmpty() { 1060 return super.isEmpty() && (patient == null || patient.isEmpty()) && (category == null || category.isEmpty()) 1061 && (severity == null || severity.isEmpty()) && (implicated == null || implicated.isEmpty()) 1062 && (detail == null || detail.isEmpty()) && (date == null || date.isEmpty()) && (author == null || author.isEmpty()) 1063 && (identifier == null || identifier.isEmpty()) && (reference == null || reference.isEmpty()) 1064 && (mitigation == null || mitigation.isEmpty()); 1065 } 1066 1067 @Override 1068 public ResourceType getResourceType() { 1069 return ResourceType.DetectedIssue; 1070 } 1071 1072 @SearchParamDefinition(name="date", path="DetectedIssue.date", description="When identified", type="date" ) 1073 public static final String SP_DATE = "date"; 1074 @SearchParamDefinition(name="identifier", path="DetectedIssue.identifier", description="Unique id for the detected issue", type="token" ) 1075 public static final String SP_IDENTIFIER = "identifier"; 1076 @SearchParamDefinition(name="patient", path="DetectedIssue.patient", description="Associated patient", type="reference" ) 1077 public static final String SP_PATIENT = "patient"; 1078 @SearchParamDefinition(name="author", path="DetectedIssue.author", description="The provider or device that identified the issue", type="reference" ) 1079 public static final String SP_AUTHOR = "author"; 1080 @SearchParamDefinition(name="implicated", path="DetectedIssue.implicated", description="Problem resource", type="reference" ) 1081 public static final String SP_IMPLICATED = "implicated"; 1082 @SearchParamDefinition(name="category", path="DetectedIssue.category", description="Issue Category, e.g. drug-drug, duplicate therapy, etc.", type="token" ) 1083 public static final String SP_CATEGORY = "category"; 1084 1085} 1086