001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import org.hl7.fhir.utilities.Utilities; 040import ca.uhn.fhir.model.api.annotation.ResourceDef; 041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046import org.hl7.fhir.instance.model.api.*; 047import org.hl7.fhir.exceptions.FHIRException; 048/** 049 * A record of a device being used by a patient where the record is the result of a report from the patient or another clinician. 050 */ 051@ResourceDef(name="DeviceUseStatement", profile="http://hl7.org/fhir/StructureDefinition/DeviceUseStatement") 052public class DeviceUseStatement extends DomainResource { 053 054 public enum DeviceUseStatementStatus { 055 /** 056 * The device is still being used. 057 */ 058 ACTIVE, 059 /** 060 * The device is no longer being used. 061 */ 062 COMPLETED, 063 /** 064 * The statement was recorded incorrectly. 065 */ 066 ENTEREDINERROR, 067 /** 068 * The device may be used at some time in the future. 069 */ 070 INTENDED, 071 /** 072 * Actions implied by the statement have been permanently halted, before all of them occurred. 073 */ 074 STOPPED, 075 /** 076 * Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called "suspended". 077 */ 078 ONHOLD, 079 /** 080 * added to help the parsers with the generic types 081 */ 082 NULL; 083 public static DeviceUseStatementStatus fromCode(String codeString) throws FHIRException { 084 if (codeString == null || "".equals(codeString)) 085 return null; 086 if ("active".equals(codeString)) 087 return ACTIVE; 088 if ("completed".equals(codeString)) 089 return COMPLETED; 090 if ("entered-in-error".equals(codeString)) 091 return ENTEREDINERROR; 092 if ("intended".equals(codeString)) 093 return INTENDED; 094 if ("stopped".equals(codeString)) 095 return STOPPED; 096 if ("on-hold".equals(codeString)) 097 return ONHOLD; 098 if (Configuration.isAcceptInvalidEnums()) 099 return null; 100 else 101 throw new FHIRException("Unknown DeviceUseStatementStatus code '"+codeString+"'"); 102 } 103 public String toCode() { 104 switch (this) { 105 case ACTIVE: return "active"; 106 case COMPLETED: return "completed"; 107 case ENTEREDINERROR: return "entered-in-error"; 108 case INTENDED: return "intended"; 109 case STOPPED: return "stopped"; 110 case ONHOLD: return "on-hold"; 111 default: return "?"; 112 } 113 } 114 public String getSystem() { 115 switch (this) { 116 case ACTIVE: return "http://hl7.org/fhir/device-statement-status"; 117 case COMPLETED: return "http://hl7.org/fhir/device-statement-status"; 118 case ENTEREDINERROR: return "http://hl7.org/fhir/device-statement-status"; 119 case INTENDED: return "http://hl7.org/fhir/device-statement-status"; 120 case STOPPED: return "http://hl7.org/fhir/device-statement-status"; 121 case ONHOLD: return "http://hl7.org/fhir/device-statement-status"; 122 default: return "?"; 123 } 124 } 125 public String getDefinition() { 126 switch (this) { 127 case ACTIVE: return "The device is still being used."; 128 case COMPLETED: return "The device is no longer being used."; 129 case ENTEREDINERROR: return "The statement was recorded incorrectly."; 130 case INTENDED: return "The device may be used at some time in the future."; 131 case STOPPED: return "Actions implied by the statement have been permanently halted, before all of them occurred."; 132 case ONHOLD: return "Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called \"suspended\"."; 133 default: return "?"; 134 } 135 } 136 public String getDisplay() { 137 switch (this) { 138 case ACTIVE: return "Active"; 139 case COMPLETED: return "Completed"; 140 case ENTEREDINERROR: return "Entered in Error"; 141 case INTENDED: return "Intended"; 142 case STOPPED: return "Stopped"; 143 case ONHOLD: return "On Hold"; 144 default: return "?"; 145 } 146 } 147 } 148 149 public static class DeviceUseStatementStatusEnumFactory implements EnumFactory<DeviceUseStatementStatus> { 150 public DeviceUseStatementStatus fromCode(String codeString) throws IllegalArgumentException { 151 if (codeString == null || "".equals(codeString)) 152 if (codeString == null || "".equals(codeString)) 153 return null; 154 if ("active".equals(codeString)) 155 return DeviceUseStatementStatus.ACTIVE; 156 if ("completed".equals(codeString)) 157 return DeviceUseStatementStatus.COMPLETED; 158 if ("entered-in-error".equals(codeString)) 159 return DeviceUseStatementStatus.ENTEREDINERROR; 160 if ("intended".equals(codeString)) 161 return DeviceUseStatementStatus.INTENDED; 162 if ("stopped".equals(codeString)) 163 return DeviceUseStatementStatus.STOPPED; 164 if ("on-hold".equals(codeString)) 165 return DeviceUseStatementStatus.ONHOLD; 166 throw new IllegalArgumentException("Unknown DeviceUseStatementStatus code '"+codeString+"'"); 167 } 168 public Enumeration<DeviceUseStatementStatus> fromType(Base code) throws FHIRException { 169 if (code == null) 170 return null; 171 if (code.isEmpty()) 172 return new Enumeration<DeviceUseStatementStatus>(this); 173 String codeString = ((PrimitiveType) code).asStringValue(); 174 if (codeString == null || "".equals(codeString)) 175 return null; 176 if ("active".equals(codeString)) 177 return new Enumeration<DeviceUseStatementStatus>(this, DeviceUseStatementStatus.ACTIVE); 178 if ("completed".equals(codeString)) 179 return new Enumeration<DeviceUseStatementStatus>(this, DeviceUseStatementStatus.COMPLETED); 180 if ("entered-in-error".equals(codeString)) 181 return new Enumeration<DeviceUseStatementStatus>(this, DeviceUseStatementStatus.ENTEREDINERROR); 182 if ("intended".equals(codeString)) 183 return new Enumeration<DeviceUseStatementStatus>(this, DeviceUseStatementStatus.INTENDED); 184 if ("stopped".equals(codeString)) 185 return new Enumeration<DeviceUseStatementStatus>(this, DeviceUseStatementStatus.STOPPED); 186 if ("on-hold".equals(codeString)) 187 return new Enumeration<DeviceUseStatementStatus>(this, DeviceUseStatementStatus.ONHOLD); 188 throw new FHIRException("Unknown DeviceUseStatementStatus code '"+codeString+"'"); 189 } 190 public String toCode(DeviceUseStatementStatus code) { 191 if (code == DeviceUseStatementStatus.ACTIVE) 192 return "active"; 193 if (code == DeviceUseStatementStatus.COMPLETED) 194 return "completed"; 195 if (code == DeviceUseStatementStatus.ENTEREDINERROR) 196 return "entered-in-error"; 197 if (code == DeviceUseStatementStatus.INTENDED) 198 return "intended"; 199 if (code == DeviceUseStatementStatus.STOPPED) 200 return "stopped"; 201 if (code == DeviceUseStatementStatus.ONHOLD) 202 return "on-hold"; 203 return "?"; 204 } 205 public String toSystem(DeviceUseStatementStatus code) { 206 return code.getSystem(); 207 } 208 } 209 210 /** 211 * An external identifier for this statement such as an IRI. 212 */ 213 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 214 @Description(shortDefinition="External identifier for this record", formalDefinition="An external identifier for this statement such as an IRI." ) 215 protected List<Identifier> identifier; 216 217 /** 218 * A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement. 219 */ 220 @Child(name = "basedOn", type = {ServiceRequest.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 221 @Description(shortDefinition="Fulfills plan, proposal or order", formalDefinition="A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement." ) 222 protected List<Reference> basedOn; 223 /** 224 * The actual objects that are the target of the reference (A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement.) 225 */ 226 protected List<ServiceRequest> basedOnTarget; 227 228 229 /** 230 * A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed. 231 */ 232 @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true) 233 @Description(shortDefinition="active | completed | entered-in-error +", formalDefinition="A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed." ) 234 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-statement-status") 235 protected Enumeration<DeviceUseStatementStatus> status; 236 237 /** 238 * The patient who used the device. 239 */ 240 @Child(name = "subject", type = {Patient.class, Group.class}, order=3, min=1, max=1, modifier=false, summary=true) 241 @Description(shortDefinition="Patient using device", formalDefinition="The patient who used the device." ) 242 protected Reference subject; 243 244 /** 245 * The actual object that is the target of the reference (The patient who used the device.) 246 */ 247 protected Resource subjectTarget; 248 249 /** 250 * Allows linking the DeviceUseStatement to the underlying Request, or to other information that supports or is used to derive the DeviceUseStatement. 251 */ 252 @Child(name = "derivedFrom", type = {ServiceRequest.class, Procedure.class, Claim.class, Observation.class, QuestionnaireResponse.class, DocumentReference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 253 @Description(shortDefinition="Supporting information", formalDefinition="Allows linking the DeviceUseStatement to the underlying Request, or to other information that supports or is used to derive the DeviceUseStatement." ) 254 protected List<Reference> derivedFrom; 255 /** 256 * The actual objects that are the target of the reference (Allows linking the DeviceUseStatement to the underlying Request, or to other information that supports or is used to derive the DeviceUseStatement.) 257 */ 258 protected List<Resource> derivedFromTarget; 259 260 261 /** 262 * How often the device was used. 263 */ 264 @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true) 265 @Description(shortDefinition="How often the device was used", formalDefinition="How often the device was used." ) 266 protected Type timing; 267 268 /** 269 * The time at which the statement was made/recorded. 270 */ 271 @Child(name = "recordedOn", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true) 272 @Description(shortDefinition="When statement was recorded", formalDefinition="The time at which the statement was made/recorded." ) 273 protected DateTimeType recordedOn; 274 275 /** 276 * Who reported the device was being used by the patient. 277 */ 278 @Child(name = "source", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=7, min=0, max=1, modifier=false, summary=true) 279 @Description(shortDefinition="Who made the statement", formalDefinition="Who reported the device was being used by the patient." ) 280 protected Reference source; 281 282 /** 283 * The actual object that is the target of the reference (Who reported the device was being used by the patient.) 284 */ 285 protected Resource sourceTarget; 286 287 /** 288 * The details of the device used. 289 */ 290 @Child(name = "device", type = {Device.class}, order=8, min=1, max=1, modifier=false, summary=true) 291 @Description(shortDefinition="Reference to device used", formalDefinition="The details of the device used." ) 292 protected Reference device; 293 294 /** 295 * The actual object that is the target of the reference (The details of the device used.) 296 */ 297 protected Device deviceTarget; 298 299 /** 300 * Reason or justification for the use of the device. 301 */ 302 @Child(name = "reasonCode", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 303 @Description(shortDefinition="Why device was used", formalDefinition="Reason or justification for the use of the device." ) 304 protected List<CodeableConcept> reasonCode; 305 306 /** 307 * Indicates another resource whose existence justifies this DeviceUseStatement. 308 */ 309 @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class, Media.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 310 @Description(shortDefinition="Why was DeviceUseStatement performed?", formalDefinition="Indicates another resource whose existence justifies this DeviceUseStatement." ) 311 protected List<Reference> reasonReference; 312 /** 313 * The actual objects that are the target of the reference (Indicates another resource whose existence justifies this DeviceUseStatement.) 314 */ 315 protected List<Resource> reasonReferenceTarget; 316 317 318 /** 319 * Indicates the anotomic location on the subject's body where the device was used ( i.e. the target). 320 */ 321 @Child(name = "bodySite", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=true) 322 @Description(shortDefinition="Target body site", formalDefinition="Indicates the anotomic location on the subject's body where the device was used ( i.e. the target)." ) 323 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site") 324 protected CodeableConcept bodySite; 325 326 /** 327 * Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement. 328 */ 329 @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 330 @Description(shortDefinition="Addition details (comments, instructions)", formalDefinition="Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement." ) 331 protected List<Annotation> note; 332 333 private static final long serialVersionUID = -968330048L; 334 335 /** 336 * Constructor 337 */ 338 public DeviceUseStatement() { 339 super(); 340 } 341 342 /** 343 * Constructor 344 */ 345 public DeviceUseStatement(Enumeration<DeviceUseStatementStatus> status, Reference subject, Reference device) { 346 super(); 347 this.status = status; 348 this.subject = subject; 349 this.device = device; 350 } 351 352 /** 353 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 354 */ 355 public List<Identifier> getIdentifier() { 356 if (this.identifier == null) 357 this.identifier = new ArrayList<Identifier>(); 358 return this.identifier; 359 } 360 361 /** 362 * @return Returns a reference to <code>this</code> for easy method chaining 363 */ 364 public DeviceUseStatement setIdentifier(List<Identifier> theIdentifier) { 365 this.identifier = theIdentifier; 366 return this; 367 } 368 369 public boolean hasIdentifier() { 370 if (this.identifier == null) 371 return false; 372 for (Identifier item : this.identifier) 373 if (!item.isEmpty()) 374 return true; 375 return false; 376 } 377 378 public Identifier addIdentifier() { //3 379 Identifier t = new Identifier(); 380 if (this.identifier == null) 381 this.identifier = new ArrayList<Identifier>(); 382 this.identifier.add(t); 383 return t; 384 } 385 386 public DeviceUseStatement addIdentifier(Identifier t) { //3 387 if (t == null) 388 return this; 389 if (this.identifier == null) 390 this.identifier = new ArrayList<Identifier>(); 391 this.identifier.add(t); 392 return this; 393 } 394 395 /** 396 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 397 */ 398 public Identifier getIdentifierFirstRep() { 399 if (getIdentifier().isEmpty()) { 400 addIdentifier(); 401 } 402 return getIdentifier().get(0); 403 } 404 405 /** 406 * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement.) 407 */ 408 public List<Reference> getBasedOn() { 409 if (this.basedOn == null) 410 this.basedOn = new ArrayList<Reference>(); 411 return this.basedOn; 412 } 413 414 /** 415 * @return Returns a reference to <code>this</code> for easy method chaining 416 */ 417 public DeviceUseStatement setBasedOn(List<Reference> theBasedOn) { 418 this.basedOn = theBasedOn; 419 return this; 420 } 421 422 public boolean hasBasedOn() { 423 if (this.basedOn == null) 424 return false; 425 for (Reference item : this.basedOn) 426 if (!item.isEmpty()) 427 return true; 428 return false; 429 } 430 431 public Reference addBasedOn() { //3 432 Reference t = new Reference(); 433 if (this.basedOn == null) 434 this.basedOn = new ArrayList<Reference>(); 435 this.basedOn.add(t); 436 return t; 437 } 438 439 public DeviceUseStatement addBasedOn(Reference t) { //3 440 if (t == null) 441 return this; 442 if (this.basedOn == null) 443 this.basedOn = new ArrayList<Reference>(); 444 this.basedOn.add(t); 445 return this; 446 } 447 448 /** 449 * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist 450 */ 451 public Reference getBasedOnFirstRep() { 452 if (getBasedOn().isEmpty()) { 453 addBasedOn(); 454 } 455 return getBasedOn().get(0); 456 } 457 458 /** 459 * @deprecated Use Reference#setResource(IBaseResource) instead 460 */ 461 @Deprecated 462 public List<ServiceRequest> getBasedOnTarget() { 463 if (this.basedOnTarget == null) 464 this.basedOnTarget = new ArrayList<ServiceRequest>(); 465 return this.basedOnTarget; 466 } 467 468 /** 469 * @deprecated Use Reference#setResource(IBaseResource) instead 470 */ 471 @Deprecated 472 public ServiceRequest addBasedOnTarget() { 473 ServiceRequest r = new ServiceRequest(); 474 if (this.basedOnTarget == null) 475 this.basedOnTarget = new ArrayList<ServiceRequest>(); 476 this.basedOnTarget.add(r); 477 return r; 478 } 479 480 /** 481 * @return {@link #status} (A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 482 */ 483 public Enumeration<DeviceUseStatementStatus> getStatusElement() { 484 if (this.status == null) 485 if (Configuration.errorOnAutoCreate()) 486 throw new Error("Attempt to auto-create DeviceUseStatement.status"); 487 else if (Configuration.doAutoCreate()) 488 this.status = new Enumeration<DeviceUseStatementStatus>(new DeviceUseStatementStatusEnumFactory()); // bb 489 return this.status; 490 } 491 492 public boolean hasStatusElement() { 493 return this.status != null && !this.status.isEmpty(); 494 } 495 496 public boolean hasStatus() { 497 return this.status != null && !this.status.isEmpty(); 498 } 499 500 /** 501 * @param value {@link #status} (A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 502 */ 503 public DeviceUseStatement setStatusElement(Enumeration<DeviceUseStatementStatus> value) { 504 this.status = value; 505 return this; 506 } 507 508 /** 509 * @return A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed. 510 */ 511 public DeviceUseStatementStatus getStatus() { 512 return this.status == null ? null : this.status.getValue(); 513 } 514 515 /** 516 * @param value A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed. 517 */ 518 public DeviceUseStatement setStatus(DeviceUseStatementStatus value) { 519 if (this.status == null) 520 this.status = new Enumeration<DeviceUseStatementStatus>(new DeviceUseStatementStatusEnumFactory()); 521 this.status.setValue(value); 522 return this; 523 } 524 525 /** 526 * @return {@link #subject} (The patient who used the device.) 527 */ 528 public Reference getSubject() { 529 if (this.subject == null) 530 if (Configuration.errorOnAutoCreate()) 531 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 532 else if (Configuration.doAutoCreate()) 533 this.subject = new Reference(); // cc 534 return this.subject; 535 } 536 537 public boolean hasSubject() { 538 return this.subject != null && !this.subject.isEmpty(); 539 } 540 541 /** 542 * @param value {@link #subject} (The patient who used the device.) 543 */ 544 public DeviceUseStatement setSubject(Reference value) { 545 this.subject = value; 546 return this; 547 } 548 549 /** 550 * @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 patient who used the device.) 551 */ 552 public Resource getSubjectTarget() { 553 return this.subjectTarget; 554 } 555 556 /** 557 * @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 patient who used the device.) 558 */ 559 public DeviceUseStatement setSubjectTarget(Resource value) { 560 this.subjectTarget = value; 561 return this; 562 } 563 564 /** 565 * @return {@link #derivedFrom} (Allows linking the DeviceUseStatement to the underlying Request, or to other information that supports or is used to derive the DeviceUseStatement.) 566 */ 567 public List<Reference> getDerivedFrom() { 568 if (this.derivedFrom == null) 569 this.derivedFrom = new ArrayList<Reference>(); 570 return this.derivedFrom; 571 } 572 573 /** 574 * @return Returns a reference to <code>this</code> for easy method chaining 575 */ 576 public DeviceUseStatement setDerivedFrom(List<Reference> theDerivedFrom) { 577 this.derivedFrom = theDerivedFrom; 578 return this; 579 } 580 581 public boolean hasDerivedFrom() { 582 if (this.derivedFrom == null) 583 return false; 584 for (Reference item : this.derivedFrom) 585 if (!item.isEmpty()) 586 return true; 587 return false; 588 } 589 590 public Reference addDerivedFrom() { //3 591 Reference t = new Reference(); 592 if (this.derivedFrom == null) 593 this.derivedFrom = new ArrayList<Reference>(); 594 this.derivedFrom.add(t); 595 return t; 596 } 597 598 public DeviceUseStatement addDerivedFrom(Reference t) { //3 599 if (t == null) 600 return this; 601 if (this.derivedFrom == null) 602 this.derivedFrom = new ArrayList<Reference>(); 603 this.derivedFrom.add(t); 604 return this; 605 } 606 607 /** 608 * @return The first repetition of repeating field {@link #derivedFrom}, creating it if it does not already exist 609 */ 610 public Reference getDerivedFromFirstRep() { 611 if (getDerivedFrom().isEmpty()) { 612 addDerivedFrom(); 613 } 614 return getDerivedFrom().get(0); 615 } 616 617 /** 618 * @deprecated Use Reference#setResource(IBaseResource) instead 619 */ 620 @Deprecated 621 public List<Resource> getDerivedFromTarget() { 622 if (this.derivedFromTarget == null) 623 this.derivedFromTarget = new ArrayList<Resource>(); 624 return this.derivedFromTarget; 625 } 626 627 /** 628 * @return {@link #timing} (How often the device was used.) 629 */ 630 public Type getTiming() { 631 return this.timing; 632 } 633 634 /** 635 * @return {@link #timing} (How often the device was used.) 636 */ 637 public Timing getTimingTiming() throws FHIRException { 638 if (this.timing == null) 639 this.timing = new Timing(); 640 if (!(this.timing instanceof Timing)) 641 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 642 return (Timing) this.timing; 643 } 644 645 public boolean hasTimingTiming() { 646 return this != null && this.timing instanceof Timing; 647 } 648 649 /** 650 * @return {@link #timing} (How often the device was used.) 651 */ 652 public Period getTimingPeriod() throws FHIRException { 653 if (this.timing == null) 654 this.timing = new Period(); 655 if (!(this.timing instanceof Period)) 656 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered"); 657 return (Period) this.timing; 658 } 659 660 public boolean hasTimingPeriod() { 661 return this != null && this.timing instanceof Period; 662 } 663 664 /** 665 * @return {@link #timing} (How often the device was used.) 666 */ 667 public DateTimeType getTimingDateTimeType() throws FHIRException { 668 if (this.timing == null) 669 this.timing = new DateTimeType(); 670 if (!(this.timing instanceof DateTimeType)) 671 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 672 return (DateTimeType) this.timing; 673 } 674 675 public boolean hasTimingDateTimeType() { 676 return this != null && this.timing instanceof DateTimeType; 677 } 678 679 public boolean hasTiming() { 680 return this.timing != null && !this.timing.isEmpty(); 681 } 682 683 /** 684 * @param value {@link #timing} (How often the device was used.) 685 */ 686 public DeviceUseStatement setTiming(Type value) { 687 if (value != null && !(value instanceof Timing || value instanceof Period || value instanceof DateTimeType)) 688 throw new Error("Not the right type for DeviceUseStatement.timing[x]: "+value.fhirType()); 689 this.timing = value; 690 return this; 691 } 692 693 /** 694 * @return {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 695 */ 696 public DateTimeType getRecordedOnElement() { 697 if (this.recordedOn == null) 698 if (Configuration.errorOnAutoCreate()) 699 throw new Error("Attempt to auto-create DeviceUseStatement.recordedOn"); 700 else if (Configuration.doAutoCreate()) 701 this.recordedOn = new DateTimeType(); // bb 702 return this.recordedOn; 703 } 704 705 public boolean hasRecordedOnElement() { 706 return this.recordedOn != null && !this.recordedOn.isEmpty(); 707 } 708 709 public boolean hasRecordedOn() { 710 return this.recordedOn != null && !this.recordedOn.isEmpty(); 711 } 712 713 /** 714 * @param value {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 715 */ 716 public DeviceUseStatement setRecordedOnElement(DateTimeType value) { 717 this.recordedOn = value; 718 return this; 719 } 720 721 /** 722 * @return The time at which the statement was made/recorded. 723 */ 724 public Date getRecordedOn() { 725 return this.recordedOn == null ? null : this.recordedOn.getValue(); 726 } 727 728 /** 729 * @param value The time at which the statement was made/recorded. 730 */ 731 public DeviceUseStatement setRecordedOn(Date value) { 732 if (value == null) 733 this.recordedOn = null; 734 else { 735 if (this.recordedOn == null) 736 this.recordedOn = new DateTimeType(); 737 this.recordedOn.setValue(value); 738 } 739 return this; 740 } 741 742 /** 743 * @return {@link #source} (Who reported the device was being used by the patient.) 744 */ 745 public Reference getSource() { 746 if (this.source == null) 747 if (Configuration.errorOnAutoCreate()) 748 throw new Error("Attempt to auto-create DeviceUseStatement.source"); 749 else if (Configuration.doAutoCreate()) 750 this.source = new Reference(); // cc 751 return this.source; 752 } 753 754 public boolean hasSource() { 755 return this.source != null && !this.source.isEmpty(); 756 } 757 758 /** 759 * @param value {@link #source} (Who reported the device was being used by the patient.) 760 */ 761 public DeviceUseStatement setSource(Reference value) { 762 this.source = value; 763 return this; 764 } 765 766 /** 767 * @return {@link #source} 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. (Who reported the device was being used by the patient.) 768 */ 769 public Resource getSourceTarget() { 770 return this.sourceTarget; 771 } 772 773 /** 774 * @param value {@link #source} 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. (Who reported the device was being used by the patient.) 775 */ 776 public DeviceUseStatement setSourceTarget(Resource value) { 777 this.sourceTarget = value; 778 return this; 779 } 780 781 /** 782 * @return {@link #device} (The details of the device used.) 783 */ 784 public Reference getDevice() { 785 if (this.device == null) 786 if (Configuration.errorOnAutoCreate()) 787 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 788 else if (Configuration.doAutoCreate()) 789 this.device = new Reference(); // cc 790 return this.device; 791 } 792 793 public boolean hasDevice() { 794 return this.device != null && !this.device.isEmpty(); 795 } 796 797 /** 798 * @param value {@link #device} (The details of the device used.) 799 */ 800 public DeviceUseStatement setDevice(Reference value) { 801 this.device = value; 802 return this; 803 } 804 805 /** 806 * @return {@link #device} 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 details of the device used.) 807 */ 808 public Device getDeviceTarget() { 809 if (this.deviceTarget == null) 810 if (Configuration.errorOnAutoCreate()) 811 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 812 else if (Configuration.doAutoCreate()) 813 this.deviceTarget = new Device(); // aa 814 return this.deviceTarget; 815 } 816 817 /** 818 * @param value {@link #device} 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 details of the device used.) 819 */ 820 public DeviceUseStatement setDeviceTarget(Device value) { 821 this.deviceTarget = value; 822 return this; 823 } 824 825 /** 826 * @return {@link #reasonCode} (Reason or justification for the use of the device.) 827 */ 828 public List<CodeableConcept> getReasonCode() { 829 if (this.reasonCode == null) 830 this.reasonCode = new ArrayList<CodeableConcept>(); 831 return this.reasonCode; 832 } 833 834 /** 835 * @return Returns a reference to <code>this</code> for easy method chaining 836 */ 837 public DeviceUseStatement setReasonCode(List<CodeableConcept> theReasonCode) { 838 this.reasonCode = theReasonCode; 839 return this; 840 } 841 842 public boolean hasReasonCode() { 843 if (this.reasonCode == null) 844 return false; 845 for (CodeableConcept item : this.reasonCode) 846 if (!item.isEmpty()) 847 return true; 848 return false; 849 } 850 851 public CodeableConcept addReasonCode() { //3 852 CodeableConcept t = new CodeableConcept(); 853 if (this.reasonCode == null) 854 this.reasonCode = new ArrayList<CodeableConcept>(); 855 this.reasonCode.add(t); 856 return t; 857 } 858 859 public DeviceUseStatement addReasonCode(CodeableConcept t) { //3 860 if (t == null) 861 return this; 862 if (this.reasonCode == null) 863 this.reasonCode = new ArrayList<CodeableConcept>(); 864 this.reasonCode.add(t); 865 return this; 866 } 867 868 /** 869 * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist 870 */ 871 public CodeableConcept getReasonCodeFirstRep() { 872 if (getReasonCode().isEmpty()) { 873 addReasonCode(); 874 } 875 return getReasonCode().get(0); 876 } 877 878 /** 879 * @return {@link #reasonReference} (Indicates another resource whose existence justifies this DeviceUseStatement.) 880 */ 881 public List<Reference> getReasonReference() { 882 if (this.reasonReference == null) 883 this.reasonReference = new ArrayList<Reference>(); 884 return this.reasonReference; 885 } 886 887 /** 888 * @return Returns a reference to <code>this</code> for easy method chaining 889 */ 890 public DeviceUseStatement setReasonReference(List<Reference> theReasonReference) { 891 this.reasonReference = theReasonReference; 892 return this; 893 } 894 895 public boolean hasReasonReference() { 896 if (this.reasonReference == null) 897 return false; 898 for (Reference item : this.reasonReference) 899 if (!item.isEmpty()) 900 return true; 901 return false; 902 } 903 904 public Reference addReasonReference() { //3 905 Reference t = new Reference(); 906 if (this.reasonReference == null) 907 this.reasonReference = new ArrayList<Reference>(); 908 this.reasonReference.add(t); 909 return t; 910 } 911 912 public DeviceUseStatement addReasonReference(Reference t) { //3 913 if (t == null) 914 return this; 915 if (this.reasonReference == null) 916 this.reasonReference = new ArrayList<Reference>(); 917 this.reasonReference.add(t); 918 return this; 919 } 920 921 /** 922 * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist 923 */ 924 public Reference getReasonReferenceFirstRep() { 925 if (getReasonReference().isEmpty()) { 926 addReasonReference(); 927 } 928 return getReasonReference().get(0); 929 } 930 931 /** 932 * @deprecated Use Reference#setResource(IBaseResource) instead 933 */ 934 @Deprecated 935 public List<Resource> getReasonReferenceTarget() { 936 if (this.reasonReferenceTarget == null) 937 this.reasonReferenceTarget = new ArrayList<Resource>(); 938 return this.reasonReferenceTarget; 939 } 940 941 /** 942 * @return {@link #bodySite} (Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).) 943 */ 944 public CodeableConcept getBodySite() { 945 if (this.bodySite == null) 946 if (Configuration.errorOnAutoCreate()) 947 throw new Error("Attempt to auto-create DeviceUseStatement.bodySite"); 948 else if (Configuration.doAutoCreate()) 949 this.bodySite = new CodeableConcept(); // cc 950 return this.bodySite; 951 } 952 953 public boolean hasBodySite() { 954 return this.bodySite != null && !this.bodySite.isEmpty(); 955 } 956 957 /** 958 * @param value {@link #bodySite} (Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).) 959 */ 960 public DeviceUseStatement setBodySite(CodeableConcept value) { 961 this.bodySite = value; 962 return this; 963 } 964 965 /** 966 * @return {@link #note} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 967 */ 968 public List<Annotation> getNote() { 969 if (this.note == null) 970 this.note = new ArrayList<Annotation>(); 971 return this.note; 972 } 973 974 /** 975 * @return Returns a reference to <code>this</code> for easy method chaining 976 */ 977 public DeviceUseStatement setNote(List<Annotation> theNote) { 978 this.note = theNote; 979 return this; 980 } 981 982 public boolean hasNote() { 983 if (this.note == null) 984 return false; 985 for (Annotation item : this.note) 986 if (!item.isEmpty()) 987 return true; 988 return false; 989 } 990 991 public Annotation addNote() { //3 992 Annotation t = new Annotation(); 993 if (this.note == null) 994 this.note = new ArrayList<Annotation>(); 995 this.note.add(t); 996 return t; 997 } 998 999 public DeviceUseStatement addNote(Annotation t) { //3 1000 if (t == null) 1001 return this; 1002 if (this.note == null) 1003 this.note = new ArrayList<Annotation>(); 1004 this.note.add(t); 1005 return this; 1006 } 1007 1008 /** 1009 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist 1010 */ 1011 public Annotation getNoteFirstRep() { 1012 if (getNote().isEmpty()) { 1013 addNote(); 1014 } 1015 return getNote().get(0); 1016 } 1017 1018 protected void listChildren(List<Property> children) { 1019 super.listChildren(children); 1020 children.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1021 children.add(new Property("basedOn", "Reference(ServiceRequest)", "A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement.", 0, java.lang.Integer.MAX_VALUE, basedOn)); 1022 children.add(new Property("status", "code", "A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed.", 0, 1, status)); 1023 children.add(new Property("subject", "Reference(Patient|Group)", "The patient who used the device.", 0, 1, subject)); 1024 children.add(new Property("derivedFrom", "Reference(ServiceRequest|Procedure|Claim|Observation|QuestionnaireResponse|DocumentReference)", "Allows linking the DeviceUseStatement to the underlying Request, or to other information that supports or is used to derive the DeviceUseStatement.", 0, java.lang.Integer.MAX_VALUE, derivedFrom)); 1025 children.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing)); 1026 children.add(new Property("recordedOn", "dateTime", "The time at which the statement was made/recorded.", 0, 1, recordedOn)); 1027 children.add(new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who reported the device was being used by the patient.", 0, 1, source)); 1028 children.add(new Property("device", "Reference(Device)", "The details of the device used.", 0, 1, device)); 1029 children.add(new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of the device.", 0, java.lang.Integer.MAX_VALUE, reasonCode)); 1030 children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Media)", "Indicates another resource whose existence justifies this DeviceUseStatement.", 0, java.lang.Integer.MAX_VALUE, reasonReference)); 1031 children.add(new Property("bodySite", "CodeableConcept", "Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).", 0, 1, bodySite)); 1032 children.add(new Property("note", "Annotation", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, note)); 1033 } 1034 1035 @Override 1036 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1037 switch (_hash) { 1038 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier); 1039 case -332612366: /*basedOn*/ return new Property("basedOn", "Reference(ServiceRequest)", "A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement.", 0, java.lang.Integer.MAX_VALUE, basedOn); 1040 case -892481550: /*status*/ return new Property("status", "code", "A code representing the patient or other source's judgment about the state of the device used that this statement is about. Generally this will be active or completed.", 0, 1, status); 1041 case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group)", "The patient who used the device.", 0, 1, subject); 1042 case 1077922663: /*derivedFrom*/ return new Property("derivedFrom", "Reference(ServiceRequest|Procedure|Claim|Observation|QuestionnaireResponse|DocumentReference)", "Allows linking the DeviceUseStatement to the underlying Request, or to other information that supports or is used to derive the DeviceUseStatement.", 0, java.lang.Integer.MAX_VALUE, derivedFrom); 1043 case 164632566: /*timing[x]*/ return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing); 1044 case -873664438: /*timing*/ return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing); 1045 case -497554124: /*timingTiming*/ return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing); 1046 case -615615829: /*timingPeriod*/ return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing); 1047 case -1837458939: /*timingDateTime*/ return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing); 1048 case 735397551: /*recordedOn*/ return new Property("recordedOn", "dateTime", "The time at which the statement was made/recorded.", 0, 1, recordedOn); 1049 case -896505829: /*source*/ return new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Who reported the device was being used by the patient.", 0, 1, source); 1050 case -1335157162: /*device*/ return new Property("device", "Reference(Device)", "The details of the device used.", 0, 1, device); 1051 case 722137681: /*reasonCode*/ return new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of the device.", 0, java.lang.Integer.MAX_VALUE, reasonCode); 1052 case -1146218137: /*reasonReference*/ return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference|Media)", "Indicates another resource whose existence justifies this DeviceUseStatement.", 0, java.lang.Integer.MAX_VALUE, reasonReference); 1053 case 1702620169: /*bodySite*/ return new Property("bodySite", "CodeableConcept", "Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).", 0, 1, bodySite); 1054 case 3387378: /*note*/ return new Property("note", "Annotation", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, note); 1055 default: return super.getNamedProperty(_hash, _name, _checkValid); 1056 } 1057 1058 } 1059 1060 @Override 1061 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1062 switch (hash) { 1063 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1064 case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference 1065 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DeviceUseStatementStatus> 1066 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 1067 case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // Reference 1068 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type 1069 case 735397551: /*recordedOn*/ return this.recordedOn == null ? new Base[0] : new Base[] {this.recordedOn}; // DateTimeType 1070 case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference 1071 case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference 1072 case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept 1073 case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference 1074 case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept 1075 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 1076 default: return super.getProperty(hash, name, checkValid); 1077 } 1078 1079 } 1080 1081 @Override 1082 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1083 switch (hash) { 1084 case -1618432855: // identifier 1085 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1086 return value; 1087 case -332612366: // basedOn 1088 this.getBasedOn().add(castToReference(value)); // Reference 1089 return value; 1090 case -892481550: // status 1091 value = new DeviceUseStatementStatusEnumFactory().fromType(castToCode(value)); 1092 this.status = (Enumeration) value; // Enumeration<DeviceUseStatementStatus> 1093 return value; 1094 case -1867885268: // subject 1095 this.subject = castToReference(value); // Reference 1096 return value; 1097 case 1077922663: // derivedFrom 1098 this.getDerivedFrom().add(castToReference(value)); // Reference 1099 return value; 1100 case -873664438: // timing 1101 this.timing = castToType(value); // Type 1102 return value; 1103 case 735397551: // recordedOn 1104 this.recordedOn = castToDateTime(value); // DateTimeType 1105 return value; 1106 case -896505829: // source 1107 this.source = castToReference(value); // Reference 1108 return value; 1109 case -1335157162: // device 1110 this.device = castToReference(value); // Reference 1111 return value; 1112 case 722137681: // reasonCode 1113 this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept 1114 return value; 1115 case -1146218137: // reasonReference 1116 this.getReasonReference().add(castToReference(value)); // Reference 1117 return value; 1118 case 1702620169: // bodySite 1119 this.bodySite = castToCodeableConcept(value); // CodeableConcept 1120 return value; 1121 case 3387378: // note 1122 this.getNote().add(castToAnnotation(value)); // Annotation 1123 return value; 1124 default: return super.setProperty(hash, name, value); 1125 } 1126 1127 } 1128 1129 @Override 1130 public Base setProperty(String name, Base value) throws FHIRException { 1131 if (name.equals("identifier")) { 1132 this.getIdentifier().add(castToIdentifier(value)); 1133 } else if (name.equals("basedOn")) { 1134 this.getBasedOn().add(castToReference(value)); 1135 } else if (name.equals("status")) { 1136 value = new DeviceUseStatementStatusEnumFactory().fromType(castToCode(value)); 1137 this.status = (Enumeration) value; // Enumeration<DeviceUseStatementStatus> 1138 } else if (name.equals("subject")) { 1139 this.subject = castToReference(value); // Reference 1140 } else if (name.equals("derivedFrom")) { 1141 this.getDerivedFrom().add(castToReference(value)); 1142 } else if (name.equals("timing[x]")) { 1143 this.timing = castToType(value); // Type 1144 } else if (name.equals("recordedOn")) { 1145 this.recordedOn = castToDateTime(value); // DateTimeType 1146 } else if (name.equals("source")) { 1147 this.source = castToReference(value); // Reference 1148 } else if (name.equals("device")) { 1149 this.device = castToReference(value); // Reference 1150 } else if (name.equals("reasonCode")) { 1151 this.getReasonCode().add(castToCodeableConcept(value)); 1152 } else if (name.equals("reasonReference")) { 1153 this.getReasonReference().add(castToReference(value)); 1154 } else if (name.equals("bodySite")) { 1155 this.bodySite = castToCodeableConcept(value); // CodeableConcept 1156 } else if (name.equals("note")) { 1157 this.getNote().add(castToAnnotation(value)); 1158 } else 1159 return super.setProperty(name, value); 1160 return value; 1161 } 1162 1163 @Override 1164 public Base makeProperty(int hash, String name) throws FHIRException { 1165 switch (hash) { 1166 case -1618432855: return addIdentifier(); 1167 case -332612366: return addBasedOn(); 1168 case -892481550: return getStatusElement(); 1169 case -1867885268: return getSubject(); 1170 case 1077922663: return addDerivedFrom(); 1171 case 164632566: return getTiming(); 1172 case -873664438: return getTiming(); 1173 case 735397551: return getRecordedOnElement(); 1174 case -896505829: return getSource(); 1175 case -1335157162: return getDevice(); 1176 case 722137681: return addReasonCode(); 1177 case -1146218137: return addReasonReference(); 1178 case 1702620169: return getBodySite(); 1179 case 3387378: return addNote(); 1180 default: return super.makeProperty(hash, name); 1181 } 1182 1183 } 1184 1185 @Override 1186 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1187 switch (hash) { 1188 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1189 case -332612366: /*basedOn*/ return new String[] {"Reference"}; 1190 case -892481550: /*status*/ return new String[] {"code"}; 1191 case -1867885268: /*subject*/ return new String[] {"Reference"}; 1192 case 1077922663: /*derivedFrom*/ return new String[] {"Reference"}; 1193 case -873664438: /*timing*/ return new String[] {"Timing", "Period", "dateTime"}; 1194 case 735397551: /*recordedOn*/ return new String[] {"dateTime"}; 1195 case -896505829: /*source*/ return new String[] {"Reference"}; 1196 case -1335157162: /*device*/ return new String[] {"Reference"}; 1197 case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"}; 1198 case -1146218137: /*reasonReference*/ return new String[] {"Reference"}; 1199 case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"}; 1200 case 3387378: /*note*/ return new String[] {"Annotation"}; 1201 default: return super.getTypesForProperty(hash, name); 1202 } 1203 1204 } 1205 1206 @Override 1207 public Base addChild(String name) throws FHIRException { 1208 if (name.equals("identifier")) { 1209 return addIdentifier(); 1210 } 1211 else if (name.equals("basedOn")) { 1212 return addBasedOn(); 1213 } 1214 else if (name.equals("status")) { 1215 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.status"); 1216 } 1217 else if (name.equals("subject")) { 1218 this.subject = new Reference(); 1219 return this.subject; 1220 } 1221 else if (name.equals("derivedFrom")) { 1222 return addDerivedFrom(); 1223 } 1224 else if (name.equals("timingTiming")) { 1225 this.timing = new Timing(); 1226 return this.timing; 1227 } 1228 else if (name.equals("timingPeriod")) { 1229 this.timing = new Period(); 1230 return this.timing; 1231 } 1232 else if (name.equals("timingDateTime")) { 1233 this.timing = new DateTimeType(); 1234 return this.timing; 1235 } 1236 else if (name.equals("recordedOn")) { 1237 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.recordedOn"); 1238 } 1239 else if (name.equals("source")) { 1240 this.source = new Reference(); 1241 return this.source; 1242 } 1243 else if (name.equals("device")) { 1244 this.device = new Reference(); 1245 return this.device; 1246 } 1247 else if (name.equals("reasonCode")) { 1248 return addReasonCode(); 1249 } 1250 else if (name.equals("reasonReference")) { 1251 return addReasonReference(); 1252 } 1253 else if (name.equals("bodySite")) { 1254 this.bodySite = new CodeableConcept(); 1255 return this.bodySite; 1256 } 1257 else if (name.equals("note")) { 1258 return addNote(); 1259 } 1260 else 1261 return super.addChild(name); 1262 } 1263 1264 public String fhirType() { 1265 return "DeviceUseStatement"; 1266 1267 } 1268 1269 public DeviceUseStatement copy() { 1270 DeviceUseStatement dst = new DeviceUseStatement(); 1271 copyValues(dst); 1272 return dst; 1273 } 1274 1275 public void copyValues(DeviceUseStatement dst) { 1276 super.copyValues(dst); 1277 if (identifier != null) { 1278 dst.identifier = new ArrayList<Identifier>(); 1279 for (Identifier i : identifier) 1280 dst.identifier.add(i.copy()); 1281 }; 1282 if (basedOn != null) { 1283 dst.basedOn = new ArrayList<Reference>(); 1284 for (Reference i : basedOn) 1285 dst.basedOn.add(i.copy()); 1286 }; 1287 dst.status = status == null ? null : status.copy(); 1288 dst.subject = subject == null ? null : subject.copy(); 1289 if (derivedFrom != null) { 1290 dst.derivedFrom = new ArrayList<Reference>(); 1291 for (Reference i : derivedFrom) 1292 dst.derivedFrom.add(i.copy()); 1293 }; 1294 dst.timing = timing == null ? null : timing.copy(); 1295 dst.recordedOn = recordedOn == null ? null : recordedOn.copy(); 1296 dst.source = source == null ? null : source.copy(); 1297 dst.device = device == null ? null : device.copy(); 1298 if (reasonCode != null) { 1299 dst.reasonCode = new ArrayList<CodeableConcept>(); 1300 for (CodeableConcept i : reasonCode) 1301 dst.reasonCode.add(i.copy()); 1302 }; 1303 if (reasonReference != null) { 1304 dst.reasonReference = new ArrayList<Reference>(); 1305 for (Reference i : reasonReference) 1306 dst.reasonReference.add(i.copy()); 1307 }; 1308 dst.bodySite = bodySite == null ? null : bodySite.copy(); 1309 if (note != null) { 1310 dst.note = new ArrayList<Annotation>(); 1311 for (Annotation i : note) 1312 dst.note.add(i.copy()); 1313 }; 1314 } 1315 1316 protected DeviceUseStatement typedCopy() { 1317 return copy(); 1318 } 1319 1320 @Override 1321 public boolean equalsDeep(Base other_) { 1322 if (!super.equalsDeep(other_)) 1323 return false; 1324 if (!(other_ instanceof DeviceUseStatement)) 1325 return false; 1326 DeviceUseStatement o = (DeviceUseStatement) other_; 1327 return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(status, o.status, true) 1328 && compareDeep(subject, o.subject, true) && compareDeep(derivedFrom, o.derivedFrom, true) && compareDeep(timing, o.timing, true) 1329 && compareDeep(recordedOn, o.recordedOn, true) && compareDeep(source, o.source, true) && compareDeep(device, o.device, true) 1330 && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true) 1331 && compareDeep(bodySite, o.bodySite, true) && compareDeep(note, o.note, true); 1332 } 1333 1334 @Override 1335 public boolean equalsShallow(Base other_) { 1336 if (!super.equalsShallow(other_)) 1337 return false; 1338 if (!(other_ instanceof DeviceUseStatement)) 1339 return false; 1340 DeviceUseStatement o = (DeviceUseStatement) other_; 1341 return compareValues(status, o.status, true) && compareValues(recordedOn, o.recordedOn, true); 1342 } 1343 1344 public boolean isEmpty() { 1345 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, status 1346 , subject, derivedFrom, timing, recordedOn, source, device, reasonCode, reasonReference 1347 , bodySite, note); 1348 } 1349 1350 @Override 1351 public ResourceType getResourceType() { 1352 return ResourceType.DeviceUseStatement; 1353 } 1354 1355 /** 1356 * Search parameter: <b>identifier</b> 1357 * <p> 1358 * Description: <b>Search by identifier</b><br> 1359 * Type: <b>token</b><br> 1360 * Path: <b>DeviceUseStatement.identifier</b><br> 1361 * </p> 1362 */ 1363 @SearchParamDefinition(name="identifier", path="DeviceUseStatement.identifier", description="Search by identifier", type="token" ) 1364 public static final String SP_IDENTIFIER = "identifier"; 1365 /** 1366 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1367 * <p> 1368 * Description: <b>Search by identifier</b><br> 1369 * Type: <b>token</b><br> 1370 * Path: <b>DeviceUseStatement.identifier</b><br> 1371 * </p> 1372 */ 1373 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1374 1375 /** 1376 * Search parameter: <b>subject</b> 1377 * <p> 1378 * Description: <b>Search by subject</b><br> 1379 * Type: <b>reference</b><br> 1380 * Path: <b>DeviceUseStatement.subject</b><br> 1381 * </p> 1382 */ 1383 @SearchParamDefinition(name="subject", path="DeviceUseStatement.subject", description="Search by subject", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } ) 1384 public static final String SP_SUBJECT = "subject"; 1385 /** 1386 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 1387 * <p> 1388 * Description: <b>Search by subject</b><br> 1389 * Type: <b>reference</b><br> 1390 * Path: <b>DeviceUseStatement.subject</b><br> 1391 * </p> 1392 */ 1393 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 1394 1395/** 1396 * Constant for fluent queries to be used to add include statements. Specifies 1397 * the path value of "<b>DeviceUseStatement:subject</b>". 1398 */ 1399 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:subject").toLocked(); 1400 1401 /** 1402 * Search parameter: <b>patient</b> 1403 * <p> 1404 * Description: <b>Search by subject - a patient</b><br> 1405 * Type: <b>reference</b><br> 1406 * Path: <b>DeviceUseStatement.subject</b><br> 1407 * </p> 1408 */ 1409 @SearchParamDefinition(name="patient", path="DeviceUseStatement.subject", description="Search by subject - a patient", type="reference", target={Group.class, Patient.class } ) 1410 public static final String SP_PATIENT = "patient"; 1411 /** 1412 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1413 * <p> 1414 * Description: <b>Search by subject - a patient</b><br> 1415 * Type: <b>reference</b><br> 1416 * Path: <b>DeviceUseStatement.subject</b><br> 1417 * </p> 1418 */ 1419 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1420 1421/** 1422 * Constant for fluent queries to be used to add include statements. Specifies 1423 * the path value of "<b>DeviceUseStatement:patient</b>". 1424 */ 1425 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:patient").toLocked(); 1426 1427 /** 1428 * Search parameter: <b>device</b> 1429 * <p> 1430 * Description: <b>Search by device</b><br> 1431 * Type: <b>reference</b><br> 1432 * Path: <b>DeviceUseStatement.device</b><br> 1433 * </p> 1434 */ 1435 @SearchParamDefinition(name="device", path="DeviceUseStatement.device", description="Search by device", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device") }, target={Device.class } ) 1436 public static final String SP_DEVICE = "device"; 1437 /** 1438 * <b>Fluent Client</b> search parameter constant for <b>device</b> 1439 * <p> 1440 * Description: <b>Search by device</b><br> 1441 * Type: <b>reference</b><br> 1442 * Path: <b>DeviceUseStatement.device</b><br> 1443 * </p> 1444 */ 1445 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE); 1446 1447/** 1448 * Constant for fluent queries to be used to add include statements. Specifies 1449 * the path value of "<b>DeviceUseStatement:device</b>". 1450 */ 1451 public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:device").toLocked(); 1452 1453 1454}