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