001package org.hl7.fhir.instance.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.*; 034 035import org.hl7.fhir.exceptions.FHIRException; 036 037import ca.uhn.fhir.model.api.annotation.*; 038/** 039 * Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external assistive device, such as a walker. 040 */ 041@ResourceDef(name="DeviceUseRequest", profile="http://hl7.org/fhir/Profile/DeviceUseRequest") 042public class DeviceUseRequest extends DomainResource { 043 044 public enum DeviceUseRequestStatus { 045 /** 046 * The request has been proposed. 047 */ 048 PROPOSED, 049 /** 050 * The request has been planned. 051 */ 052 PLANNED, 053 /** 054 * The request has been placed. 055 */ 056 REQUESTED, 057 /** 058 * The receiving system has received the request but not yet decided whether it will be performed. 059 */ 060 RECEIVED, 061 /** 062 * The receiving system has accepted the request but work has not yet commenced. 063 */ 064 ACCEPTED, 065 /** 066 * The work to fulfill the order is happening. 067 */ 068 INPROGRESS, 069 /** 070 * The work has been complete, the report(s) released, and no further work is planned. 071 */ 072 COMPLETED, 073 /** 074 * The request has been held by originating system/user request. 075 */ 076 SUSPENDED, 077 /** 078 * The receiving system has declined to fulfill the request. 079 */ 080 REJECTED, 081 /** 082 * The request was attempted, but due to some procedural error, it could not be completed. 083 */ 084 ABORTED, 085 /** 086 * added to help the parsers 087 */ 088 NULL; 089 public static DeviceUseRequestStatus fromCode(String codeString) throws FHIRException { 090 if (codeString == null || "".equals(codeString)) 091 return null; 092 if ("proposed".equals(codeString)) 093 return PROPOSED; 094 if ("planned".equals(codeString)) 095 return PLANNED; 096 if ("requested".equals(codeString)) 097 return REQUESTED; 098 if ("received".equals(codeString)) 099 return RECEIVED; 100 if ("accepted".equals(codeString)) 101 return ACCEPTED; 102 if ("in-progress".equals(codeString)) 103 return INPROGRESS; 104 if ("completed".equals(codeString)) 105 return COMPLETED; 106 if ("suspended".equals(codeString)) 107 return SUSPENDED; 108 if ("rejected".equals(codeString)) 109 return REJECTED; 110 if ("aborted".equals(codeString)) 111 return ABORTED; 112 throw new FHIRException("Unknown DeviceUseRequestStatus code '"+codeString+"'"); 113 } 114 public String toCode() { 115 switch (this) { 116 case PROPOSED: return "proposed"; 117 case PLANNED: return "planned"; 118 case REQUESTED: return "requested"; 119 case RECEIVED: return "received"; 120 case ACCEPTED: return "accepted"; 121 case INPROGRESS: return "in-progress"; 122 case COMPLETED: return "completed"; 123 case SUSPENDED: return "suspended"; 124 case REJECTED: return "rejected"; 125 case ABORTED: return "aborted"; 126 default: return "?"; 127 } 128 } 129 public String getSystem() { 130 switch (this) { 131 case PROPOSED: return "http://hl7.org/fhir/device-use-request-status"; 132 case PLANNED: return "http://hl7.org/fhir/device-use-request-status"; 133 case REQUESTED: return "http://hl7.org/fhir/device-use-request-status"; 134 case RECEIVED: return "http://hl7.org/fhir/device-use-request-status"; 135 case ACCEPTED: return "http://hl7.org/fhir/device-use-request-status"; 136 case INPROGRESS: return "http://hl7.org/fhir/device-use-request-status"; 137 case COMPLETED: return "http://hl7.org/fhir/device-use-request-status"; 138 case SUSPENDED: return "http://hl7.org/fhir/device-use-request-status"; 139 case REJECTED: return "http://hl7.org/fhir/device-use-request-status"; 140 case ABORTED: return "http://hl7.org/fhir/device-use-request-status"; 141 default: return "?"; 142 } 143 } 144 public String getDefinition() { 145 switch (this) { 146 case PROPOSED: return "The request has been proposed."; 147 case PLANNED: return "The request has been planned."; 148 case REQUESTED: return "The request has been placed."; 149 case RECEIVED: return "The receiving system has received the request but not yet decided whether it will be performed."; 150 case ACCEPTED: return "The receiving system has accepted the request but work has not yet commenced."; 151 case INPROGRESS: return "The work to fulfill the order is happening."; 152 case COMPLETED: return "The work has been complete, the report(s) released, and no further work is planned."; 153 case SUSPENDED: return "The request has been held by originating system/user request."; 154 case REJECTED: return "The receiving system has declined to fulfill the request."; 155 case ABORTED: return "The request was attempted, but due to some procedural error, it could not be completed."; 156 default: return "?"; 157 } 158 } 159 public String getDisplay() { 160 switch (this) { 161 case PROPOSED: return "Proposed"; 162 case PLANNED: return "Planned"; 163 case REQUESTED: return "Requested"; 164 case RECEIVED: return "Received"; 165 case ACCEPTED: return "Accepted"; 166 case INPROGRESS: return "In Progress"; 167 case COMPLETED: return "Completed"; 168 case SUSPENDED: return "Suspended"; 169 case REJECTED: return "Rejected"; 170 case ABORTED: return "Aborted"; 171 default: return "?"; 172 } 173 } 174 } 175 176 public static class DeviceUseRequestStatusEnumFactory implements EnumFactory<DeviceUseRequestStatus> { 177 public DeviceUseRequestStatus fromCode(String codeString) throws IllegalArgumentException { 178 if (codeString == null || "".equals(codeString)) 179 if (codeString == null || "".equals(codeString)) 180 return null; 181 if ("proposed".equals(codeString)) 182 return DeviceUseRequestStatus.PROPOSED; 183 if ("planned".equals(codeString)) 184 return DeviceUseRequestStatus.PLANNED; 185 if ("requested".equals(codeString)) 186 return DeviceUseRequestStatus.REQUESTED; 187 if ("received".equals(codeString)) 188 return DeviceUseRequestStatus.RECEIVED; 189 if ("accepted".equals(codeString)) 190 return DeviceUseRequestStatus.ACCEPTED; 191 if ("in-progress".equals(codeString)) 192 return DeviceUseRequestStatus.INPROGRESS; 193 if ("completed".equals(codeString)) 194 return DeviceUseRequestStatus.COMPLETED; 195 if ("suspended".equals(codeString)) 196 return DeviceUseRequestStatus.SUSPENDED; 197 if ("rejected".equals(codeString)) 198 return DeviceUseRequestStatus.REJECTED; 199 if ("aborted".equals(codeString)) 200 return DeviceUseRequestStatus.ABORTED; 201 throw new IllegalArgumentException("Unknown DeviceUseRequestStatus code '"+codeString+"'"); 202 } 203 public Enumeration<DeviceUseRequestStatus> fromType(Base code) throws FHIRException { 204 if (code == null || code.isEmpty()) 205 return null; 206 String codeString = ((PrimitiveType) code).asStringValue(); 207 if (codeString == null || "".equals(codeString)) 208 return null; 209 if ("proposed".equals(codeString)) 210 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.PROPOSED); 211 if ("planned".equals(codeString)) 212 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.PLANNED); 213 if ("requested".equals(codeString)) 214 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.REQUESTED); 215 if ("received".equals(codeString)) 216 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.RECEIVED); 217 if ("accepted".equals(codeString)) 218 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.ACCEPTED); 219 if ("in-progress".equals(codeString)) 220 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.INPROGRESS); 221 if ("completed".equals(codeString)) 222 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.COMPLETED); 223 if ("suspended".equals(codeString)) 224 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.SUSPENDED); 225 if ("rejected".equals(codeString)) 226 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.REJECTED); 227 if ("aborted".equals(codeString)) 228 return new Enumeration<DeviceUseRequestStatus>(this, DeviceUseRequestStatus.ABORTED); 229 throw new FHIRException("Unknown DeviceUseRequestStatus code '"+codeString+"'"); 230 } 231 public String toCode(DeviceUseRequestStatus code) { 232 if (code == DeviceUseRequestStatus.PROPOSED) 233 return "proposed"; 234 if (code == DeviceUseRequestStatus.PLANNED) 235 return "planned"; 236 if (code == DeviceUseRequestStatus.REQUESTED) 237 return "requested"; 238 if (code == DeviceUseRequestStatus.RECEIVED) 239 return "received"; 240 if (code == DeviceUseRequestStatus.ACCEPTED) 241 return "accepted"; 242 if (code == DeviceUseRequestStatus.INPROGRESS) 243 return "in-progress"; 244 if (code == DeviceUseRequestStatus.COMPLETED) 245 return "completed"; 246 if (code == DeviceUseRequestStatus.SUSPENDED) 247 return "suspended"; 248 if (code == DeviceUseRequestStatus.REJECTED) 249 return "rejected"; 250 if (code == DeviceUseRequestStatus.ABORTED) 251 return "aborted"; 252 return "?"; 253 } 254 } 255 256 public enum DeviceUseRequestPriority { 257 /** 258 * The request has a normal priority. 259 */ 260 ROUTINE, 261 /** 262 * The request should be done urgently. 263 */ 264 URGENT, 265 /** 266 * The request is time-critical. 267 */ 268 STAT, 269 /** 270 * The request should be acted on as soon as possible. 271 */ 272 ASAP, 273 /** 274 * added to help the parsers 275 */ 276 NULL; 277 public static DeviceUseRequestPriority fromCode(String codeString) throws FHIRException { 278 if (codeString == null || "".equals(codeString)) 279 return null; 280 if ("routine".equals(codeString)) 281 return ROUTINE; 282 if ("urgent".equals(codeString)) 283 return URGENT; 284 if ("stat".equals(codeString)) 285 return STAT; 286 if ("asap".equals(codeString)) 287 return ASAP; 288 throw new FHIRException("Unknown DeviceUseRequestPriority code '"+codeString+"'"); 289 } 290 public String toCode() { 291 switch (this) { 292 case ROUTINE: return "routine"; 293 case URGENT: return "urgent"; 294 case STAT: return "stat"; 295 case ASAP: return "asap"; 296 default: return "?"; 297 } 298 } 299 public String getSystem() { 300 switch (this) { 301 case ROUTINE: return "http://hl7.org/fhir/device-use-request-priority"; 302 case URGENT: return "http://hl7.org/fhir/device-use-request-priority"; 303 case STAT: return "http://hl7.org/fhir/device-use-request-priority"; 304 case ASAP: return "http://hl7.org/fhir/device-use-request-priority"; 305 default: return "?"; 306 } 307 } 308 public String getDefinition() { 309 switch (this) { 310 case ROUTINE: return "The request has a normal priority."; 311 case URGENT: return "The request should be done urgently."; 312 case STAT: return "The request is time-critical."; 313 case ASAP: return "The request should be acted on as soon as possible."; 314 default: return "?"; 315 } 316 } 317 public String getDisplay() { 318 switch (this) { 319 case ROUTINE: return "Routine"; 320 case URGENT: return "Urgent"; 321 case STAT: return "Stat"; 322 case ASAP: return "ASAP"; 323 default: return "?"; 324 } 325 } 326 } 327 328 public static class DeviceUseRequestPriorityEnumFactory implements EnumFactory<DeviceUseRequestPriority> { 329 public DeviceUseRequestPriority fromCode(String codeString) throws IllegalArgumentException { 330 if (codeString == null || "".equals(codeString)) 331 if (codeString == null || "".equals(codeString)) 332 return null; 333 if ("routine".equals(codeString)) 334 return DeviceUseRequestPriority.ROUTINE; 335 if ("urgent".equals(codeString)) 336 return DeviceUseRequestPriority.URGENT; 337 if ("stat".equals(codeString)) 338 return DeviceUseRequestPriority.STAT; 339 if ("asap".equals(codeString)) 340 return DeviceUseRequestPriority.ASAP; 341 throw new IllegalArgumentException("Unknown DeviceUseRequestPriority code '"+codeString+"'"); 342 } 343 public Enumeration<DeviceUseRequestPriority> fromType(Base code) throws FHIRException { 344 if (code == null || code.isEmpty()) 345 return null; 346 String codeString = ((PrimitiveType) code).asStringValue(); 347 if (codeString == null || "".equals(codeString)) 348 return null; 349 if ("routine".equals(codeString)) 350 return new Enumeration<DeviceUseRequestPriority>(this, DeviceUseRequestPriority.ROUTINE); 351 if ("urgent".equals(codeString)) 352 return new Enumeration<DeviceUseRequestPriority>(this, DeviceUseRequestPriority.URGENT); 353 if ("stat".equals(codeString)) 354 return new Enumeration<DeviceUseRequestPriority>(this, DeviceUseRequestPriority.STAT); 355 if ("asap".equals(codeString)) 356 return new Enumeration<DeviceUseRequestPriority>(this, DeviceUseRequestPriority.ASAP); 357 throw new FHIRException("Unknown DeviceUseRequestPriority code '"+codeString+"'"); 358 } 359 public String toCode(DeviceUseRequestPriority code) { 360 if (code == DeviceUseRequestPriority.ROUTINE) 361 return "routine"; 362 if (code == DeviceUseRequestPriority.URGENT) 363 return "urgent"; 364 if (code == DeviceUseRequestPriority.STAT) 365 return "stat"; 366 if (code == DeviceUseRequestPriority.ASAP) 367 return "asap"; 368 return "?"; 369 } 370 } 371 372 /** 373 * Indicates the site on the subject's body where the device should be used ( i.e. the target site). 374 */ 375 @Child(name = "bodySite", type = {CodeableConcept.class, BodySite.class}, order=0, min=0, max=1, modifier=false, summary=true) 376 @Description(shortDefinition="Target body site", formalDefinition="Indicates the site on the subject's body where the device should be used ( i.e. the target site)." ) 377 protected Type bodySite; 378 379 /** 380 * The status of the request. 381 */ 382 @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 383 @Description(shortDefinition="proposed | planned | requested | received | accepted | in-progress | completed | suspended | rejected | aborted", formalDefinition="The status of the request." ) 384 protected Enumeration<DeviceUseRequestStatus> status; 385 386 /** 387 * The details of the device to be used. 388 */ 389 @Child(name = "device", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=true) 390 @Description(shortDefinition="Device requested", formalDefinition="The details of the device to be used." ) 391 protected Reference device; 392 393 /** 394 * The actual object that is the target of the reference (The details of the device to be used.) 395 */ 396 protected Device deviceTarget; 397 398 /** 399 * An encounter that provides additional context in which this request is made. 400 */ 401 @Child(name = "encounter", type = {Encounter.class}, order=3, min=0, max=1, modifier=false, summary=true) 402 @Description(shortDefinition="Encounter motivating request", formalDefinition="An encounter that provides additional context in which this request is made." ) 403 protected Reference encounter; 404 405 /** 406 * The actual object that is the target of the reference (An encounter that provides additional context in which this request is made.) 407 */ 408 protected Encounter encounterTarget; 409 410 /** 411 * Identifiers assigned to this order by the orderer or by the receiver. 412 */ 413 @Child(name = "identifier", type = {Identifier.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 414 @Description(shortDefinition="Request identifier", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." ) 415 protected List<Identifier> identifier; 416 417 /** 418 * Reason or justification for the use of this device. 419 */ 420 @Child(name = "indication", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 421 @Description(shortDefinition="Reason for request", formalDefinition="Reason or justification for the use of this device." ) 422 protected List<CodeableConcept> indication; 423 424 /** 425 * Details about this request 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. 426 */ 427 @Child(name = "notes", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 428 @Description(shortDefinition="Notes or comments", formalDefinition="Details about this request 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." ) 429 protected List<StringType> notes; 430 431 /** 432 * The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%. 433 */ 434 @Child(name = "prnReason", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 435 @Description(shortDefinition="PRN", formalDefinition="The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%." ) 436 protected List<CodeableConcept> prnReason; 437 438 /** 439 * The time when the request was made. 440 */ 441 @Child(name = "orderedOn", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 442 @Description(shortDefinition="When ordered", formalDefinition="The time when the request was made." ) 443 protected DateTimeType orderedOn; 444 445 /** 446 * The time at which the request was made/recorded. 447 */ 448 @Child(name = "recordedOn", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true) 449 @Description(shortDefinition="When recorded", formalDefinition="The time at which the request was made/recorded." ) 450 protected DateTimeType recordedOn; 451 452 /** 453 * The patient who will use the device. 454 */ 455 @Child(name = "subject", type = {Patient.class}, order=10, min=1, max=1, modifier=false, summary=true) 456 @Description(shortDefinition="Focus of request", formalDefinition="The patient who will use the device." ) 457 protected Reference subject; 458 459 /** 460 * The actual object that is the target of the reference (The patient who will use the device.) 461 */ 462 protected Patient subjectTarget; 463 464 /** 465 * The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013". 466 */ 467 @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=11, min=0, max=1, modifier=false, summary=true) 468 @Description(shortDefinition="Schedule for use", formalDefinition="The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\"." ) 469 protected Type timing; 470 471 /** 472 * Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine. 473 */ 474 @Child(name = "priority", type = {CodeType.class}, order=12, min=0, max=1, modifier=false, summary=true) 475 @Description(shortDefinition="routine | urgent | stat | asap", formalDefinition="Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine." ) 476 protected Enumeration<DeviceUseRequestPriority> priority; 477 478 private static final long serialVersionUID = 1208477058L; 479 480 /* 481 * Constructor 482 */ 483 public DeviceUseRequest() { 484 super(); 485 } 486 487 /* 488 * Constructor 489 */ 490 public DeviceUseRequest(Reference device, Reference subject) { 491 super(); 492 this.device = device; 493 this.subject = subject; 494 } 495 496 /** 497 * @return {@link #bodySite} (Indicates the site on the subject's body where the device should be used ( i.e. the target site).) 498 */ 499 public Type getBodySite() { 500 return this.bodySite; 501 } 502 503 /** 504 * @return {@link #bodySite} (Indicates the site on the subject's body where the device should be used ( i.e. the target site).) 505 */ 506 public CodeableConcept getBodySiteCodeableConcept() throws FHIRException { 507 if (!(this.bodySite instanceof CodeableConcept)) 508 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 509 return (CodeableConcept) this.bodySite; 510 } 511 512 public boolean hasBodySiteCodeableConcept() { 513 return this.bodySite instanceof CodeableConcept; 514 } 515 516 /** 517 * @return {@link #bodySite} (Indicates the site on the subject's body where the device should be used ( i.e. the target site).) 518 */ 519 public Reference getBodySiteReference() throws FHIRException { 520 if (!(this.bodySite instanceof Reference)) 521 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 522 return (Reference) this.bodySite; 523 } 524 525 public boolean hasBodySiteReference() { 526 return this.bodySite instanceof Reference; 527 } 528 529 public boolean hasBodySite() { 530 return this.bodySite != null && !this.bodySite.isEmpty(); 531 } 532 533 /** 534 * @param value {@link #bodySite} (Indicates the site on the subject's body where the device should be used ( i.e. the target site).) 535 */ 536 public DeviceUseRequest setBodySite(Type value) { 537 this.bodySite = value; 538 return this; 539 } 540 541 /** 542 * @return {@link #status} (The status of the request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 543 */ 544 public Enumeration<DeviceUseRequestStatus> getStatusElement() { 545 if (this.status == null) 546 if (Configuration.errorOnAutoCreate()) 547 throw new Error("Attempt to auto-create DeviceUseRequest.status"); 548 else if (Configuration.doAutoCreate()) 549 this.status = new Enumeration<DeviceUseRequestStatus>(new DeviceUseRequestStatusEnumFactory()); // bb 550 return this.status; 551 } 552 553 public boolean hasStatusElement() { 554 return this.status != null && !this.status.isEmpty(); 555 } 556 557 public boolean hasStatus() { 558 return this.status != null && !this.status.isEmpty(); 559 } 560 561 /** 562 * @param value {@link #status} (The status of the request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 563 */ 564 public DeviceUseRequest setStatusElement(Enumeration<DeviceUseRequestStatus> value) { 565 this.status = value; 566 return this; 567 } 568 569 /** 570 * @return The status of the request. 571 */ 572 public DeviceUseRequestStatus getStatus() { 573 return this.status == null ? null : this.status.getValue(); 574 } 575 576 /** 577 * @param value The status of the request. 578 */ 579 public DeviceUseRequest setStatus(DeviceUseRequestStatus value) { 580 if (value == null) 581 this.status = null; 582 else { 583 if (this.status == null) 584 this.status = new Enumeration<DeviceUseRequestStatus>(new DeviceUseRequestStatusEnumFactory()); 585 this.status.setValue(value); 586 } 587 return this; 588 } 589 590 /** 591 * @return {@link #device} (The details of the device to be used.) 592 */ 593 public Reference getDevice() { 594 if (this.device == null) 595 if (Configuration.errorOnAutoCreate()) 596 throw new Error("Attempt to auto-create DeviceUseRequest.device"); 597 else if (Configuration.doAutoCreate()) 598 this.device = new Reference(); // cc 599 return this.device; 600 } 601 602 public boolean hasDevice() { 603 return this.device != null && !this.device.isEmpty(); 604 } 605 606 /** 607 * @param value {@link #device} (The details of the device to be used.) 608 */ 609 public DeviceUseRequest setDevice(Reference value) { 610 this.device = value; 611 return this; 612 } 613 614 /** 615 * @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 to be used.) 616 */ 617 public Device getDeviceTarget() { 618 if (this.deviceTarget == null) 619 if (Configuration.errorOnAutoCreate()) 620 throw new Error("Attempt to auto-create DeviceUseRequest.device"); 621 else if (Configuration.doAutoCreate()) 622 this.deviceTarget = new Device(); // aa 623 return this.deviceTarget; 624 } 625 626 /** 627 * @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 to be used.) 628 */ 629 public DeviceUseRequest setDeviceTarget(Device value) { 630 this.deviceTarget = value; 631 return this; 632 } 633 634 /** 635 * @return {@link #encounter} (An encounter that provides additional context in which this request is made.) 636 */ 637 public Reference getEncounter() { 638 if (this.encounter == null) 639 if (Configuration.errorOnAutoCreate()) 640 throw new Error("Attempt to auto-create DeviceUseRequest.encounter"); 641 else if (Configuration.doAutoCreate()) 642 this.encounter = new Reference(); // cc 643 return this.encounter; 644 } 645 646 public boolean hasEncounter() { 647 return this.encounter != null && !this.encounter.isEmpty(); 648 } 649 650 /** 651 * @param value {@link #encounter} (An encounter that provides additional context in which this request is made.) 652 */ 653 public DeviceUseRequest setEncounter(Reference value) { 654 this.encounter = value; 655 return this; 656 } 657 658 /** 659 * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An encounter that provides additional context in which this request is made.) 660 */ 661 public Encounter getEncounterTarget() { 662 if (this.encounterTarget == null) 663 if (Configuration.errorOnAutoCreate()) 664 throw new Error("Attempt to auto-create DeviceUseRequest.encounter"); 665 else if (Configuration.doAutoCreate()) 666 this.encounterTarget = new Encounter(); // aa 667 return this.encounterTarget; 668 } 669 670 /** 671 * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An encounter that provides additional context in which this request is made.) 672 */ 673 public DeviceUseRequest setEncounterTarget(Encounter value) { 674 this.encounterTarget = value; 675 return this; 676 } 677 678 /** 679 * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.) 680 */ 681 public List<Identifier> getIdentifier() { 682 if (this.identifier == null) 683 this.identifier = new ArrayList<Identifier>(); 684 return this.identifier; 685 } 686 687 public boolean hasIdentifier() { 688 if (this.identifier == null) 689 return false; 690 for (Identifier item : this.identifier) 691 if (!item.isEmpty()) 692 return true; 693 return false; 694 } 695 696 /** 697 * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.) 698 */ 699 // syntactic sugar 700 public Identifier addIdentifier() { //3 701 Identifier t = new Identifier(); 702 if (this.identifier == null) 703 this.identifier = new ArrayList<Identifier>(); 704 this.identifier.add(t); 705 return t; 706 } 707 708 // syntactic sugar 709 public DeviceUseRequest addIdentifier(Identifier t) { //3 710 if (t == null) 711 return this; 712 if (this.identifier == null) 713 this.identifier = new ArrayList<Identifier>(); 714 this.identifier.add(t); 715 return this; 716 } 717 718 /** 719 * @return {@link #indication} (Reason or justification for the use of this device.) 720 */ 721 public List<CodeableConcept> getIndication() { 722 if (this.indication == null) 723 this.indication = new ArrayList<CodeableConcept>(); 724 return this.indication; 725 } 726 727 public boolean hasIndication() { 728 if (this.indication == null) 729 return false; 730 for (CodeableConcept item : this.indication) 731 if (!item.isEmpty()) 732 return true; 733 return false; 734 } 735 736 /** 737 * @return {@link #indication} (Reason or justification for the use of this device.) 738 */ 739 // syntactic sugar 740 public CodeableConcept addIndication() { //3 741 CodeableConcept t = new CodeableConcept(); 742 if (this.indication == null) 743 this.indication = new ArrayList<CodeableConcept>(); 744 this.indication.add(t); 745 return t; 746 } 747 748 // syntactic sugar 749 public DeviceUseRequest addIndication(CodeableConcept t) { //3 750 if (t == null) 751 return this; 752 if (this.indication == null) 753 this.indication = new ArrayList<CodeableConcept>(); 754 this.indication.add(t); 755 return this; 756 } 757 758 /** 759 * @return {@link #notes} (Details about this request 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.) 760 */ 761 public List<StringType> getNotes() { 762 if (this.notes == null) 763 this.notes = new ArrayList<StringType>(); 764 return this.notes; 765 } 766 767 public boolean hasNotes() { 768 if (this.notes == null) 769 return false; 770 for (StringType item : this.notes) 771 if (!item.isEmpty()) 772 return true; 773 return false; 774 } 775 776 /** 777 * @return {@link #notes} (Details about this request 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.) 778 */ 779 // syntactic sugar 780 public StringType addNotesElement() {//2 781 StringType t = new StringType(); 782 if (this.notes == null) 783 this.notes = new ArrayList<StringType>(); 784 this.notes.add(t); 785 return t; 786 } 787 788 /** 789 * @param value {@link #notes} (Details about this request 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.) 790 */ 791 public DeviceUseRequest addNotes(String value) { //1 792 StringType t = new StringType(); 793 t.setValue(value); 794 if (this.notes == null) 795 this.notes = new ArrayList<StringType>(); 796 this.notes.add(t); 797 return this; 798 } 799 800 /** 801 * @param value {@link #notes} (Details about this request 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.) 802 */ 803 public boolean hasNotes(String value) { 804 if (this.notes == null) 805 return false; 806 for (StringType v : this.notes) 807 if (v.equals(value)) // string 808 return true; 809 return false; 810 } 811 812 /** 813 * @return {@link #prnReason} (The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.) 814 */ 815 public List<CodeableConcept> getPrnReason() { 816 if (this.prnReason == null) 817 this.prnReason = new ArrayList<CodeableConcept>(); 818 return this.prnReason; 819 } 820 821 public boolean hasPrnReason() { 822 if (this.prnReason == null) 823 return false; 824 for (CodeableConcept item : this.prnReason) 825 if (!item.isEmpty()) 826 return true; 827 return false; 828 } 829 830 /** 831 * @return {@link #prnReason} (The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.) 832 */ 833 // syntactic sugar 834 public CodeableConcept addPrnReason() { //3 835 CodeableConcept t = new CodeableConcept(); 836 if (this.prnReason == null) 837 this.prnReason = new ArrayList<CodeableConcept>(); 838 this.prnReason.add(t); 839 return t; 840 } 841 842 // syntactic sugar 843 public DeviceUseRequest addPrnReason(CodeableConcept t) { //3 844 if (t == null) 845 return this; 846 if (this.prnReason == null) 847 this.prnReason = new ArrayList<CodeableConcept>(); 848 this.prnReason.add(t); 849 return this; 850 } 851 852 /** 853 * @return {@link #orderedOn} (The time when the request was made.). This is the underlying object with id, value and extensions. The accessor "getOrderedOn" gives direct access to the value 854 */ 855 public DateTimeType getOrderedOnElement() { 856 if (this.orderedOn == null) 857 if (Configuration.errorOnAutoCreate()) 858 throw new Error("Attempt to auto-create DeviceUseRequest.orderedOn"); 859 else if (Configuration.doAutoCreate()) 860 this.orderedOn = new DateTimeType(); // bb 861 return this.orderedOn; 862 } 863 864 public boolean hasOrderedOnElement() { 865 return this.orderedOn != null && !this.orderedOn.isEmpty(); 866 } 867 868 public boolean hasOrderedOn() { 869 return this.orderedOn != null && !this.orderedOn.isEmpty(); 870 } 871 872 /** 873 * @param value {@link #orderedOn} (The time when the request was made.). This is the underlying object with id, value and extensions. The accessor "getOrderedOn" gives direct access to the value 874 */ 875 public DeviceUseRequest setOrderedOnElement(DateTimeType value) { 876 this.orderedOn = value; 877 return this; 878 } 879 880 /** 881 * @return The time when the request was made. 882 */ 883 public Date getOrderedOn() { 884 return this.orderedOn == null ? null : this.orderedOn.getValue(); 885 } 886 887 /** 888 * @param value The time when the request was made. 889 */ 890 public DeviceUseRequest setOrderedOn(Date value) { 891 if (value == null) 892 this.orderedOn = null; 893 else { 894 if (this.orderedOn == null) 895 this.orderedOn = new DateTimeType(); 896 this.orderedOn.setValue(value); 897 } 898 return this; 899 } 900 901 /** 902 * @return {@link #recordedOn} (The time at which the request was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 903 */ 904 public DateTimeType getRecordedOnElement() { 905 if (this.recordedOn == null) 906 if (Configuration.errorOnAutoCreate()) 907 throw new Error("Attempt to auto-create DeviceUseRequest.recordedOn"); 908 else if (Configuration.doAutoCreate()) 909 this.recordedOn = new DateTimeType(); // bb 910 return this.recordedOn; 911 } 912 913 public boolean hasRecordedOnElement() { 914 return this.recordedOn != null && !this.recordedOn.isEmpty(); 915 } 916 917 public boolean hasRecordedOn() { 918 return this.recordedOn != null && !this.recordedOn.isEmpty(); 919 } 920 921 /** 922 * @param value {@link #recordedOn} (The time at which the request was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 923 */ 924 public DeviceUseRequest setRecordedOnElement(DateTimeType value) { 925 this.recordedOn = value; 926 return this; 927 } 928 929 /** 930 * @return The time at which the request was made/recorded. 931 */ 932 public Date getRecordedOn() { 933 return this.recordedOn == null ? null : this.recordedOn.getValue(); 934 } 935 936 /** 937 * @param value The time at which the request was made/recorded. 938 */ 939 public DeviceUseRequest setRecordedOn(Date value) { 940 if (value == null) 941 this.recordedOn = null; 942 else { 943 if (this.recordedOn == null) 944 this.recordedOn = new DateTimeType(); 945 this.recordedOn.setValue(value); 946 } 947 return this; 948 } 949 950 /** 951 * @return {@link #subject} (The patient who will use the device.) 952 */ 953 public Reference getSubject() { 954 if (this.subject == null) 955 if (Configuration.errorOnAutoCreate()) 956 throw new Error("Attempt to auto-create DeviceUseRequest.subject"); 957 else if (Configuration.doAutoCreate()) 958 this.subject = new Reference(); // cc 959 return this.subject; 960 } 961 962 public boolean hasSubject() { 963 return this.subject != null && !this.subject.isEmpty(); 964 } 965 966 /** 967 * @param value {@link #subject} (The patient who will use the device.) 968 */ 969 public DeviceUseRequest setSubject(Reference value) { 970 this.subject = value; 971 return this; 972 } 973 974 /** 975 * @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 will use the device.) 976 */ 977 public Patient getSubjectTarget() { 978 if (this.subjectTarget == null) 979 if (Configuration.errorOnAutoCreate()) 980 throw new Error("Attempt to auto-create DeviceUseRequest.subject"); 981 else if (Configuration.doAutoCreate()) 982 this.subjectTarget = new Patient(); // aa 983 return this.subjectTarget; 984 } 985 986 /** 987 * @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 will use the device.) 988 */ 989 public DeviceUseRequest setSubjectTarget(Patient value) { 990 this.subjectTarget = value; 991 return this; 992 } 993 994 /** 995 * @return {@link #timing} (The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 996 */ 997 public Type getTiming() { 998 return this.timing; 999 } 1000 1001 /** 1002 * @return {@link #timing} (The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 1003 */ 1004 public Timing getTimingTiming() throws FHIRException { 1005 if (!(this.timing instanceof Timing)) 1006 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 1007 return (Timing) this.timing; 1008 } 1009 1010 public boolean hasTimingTiming() { 1011 return this.timing instanceof Timing; 1012 } 1013 1014 /** 1015 * @return {@link #timing} (The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 1016 */ 1017 public Period getTimingPeriod() throws FHIRException { 1018 if (!(this.timing instanceof Period)) 1019 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered"); 1020 return (Period) this.timing; 1021 } 1022 1023 public boolean hasTimingPeriod() { 1024 return this.timing instanceof Period; 1025 } 1026 1027 /** 1028 * @return {@link #timing} (The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 1029 */ 1030 public DateTimeType getTimingDateTimeType() throws FHIRException { 1031 if (!(this.timing instanceof DateTimeType)) 1032 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 1033 return (DateTimeType) this.timing; 1034 } 1035 1036 public boolean hasTimingDateTimeType() { 1037 return this.timing instanceof DateTimeType; 1038 } 1039 1040 public boolean hasTiming() { 1041 return this.timing != null && !this.timing.isEmpty(); 1042 } 1043 1044 /** 1045 * @param value {@link #timing} (The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 1046 */ 1047 public DeviceUseRequest setTiming(Type value) { 1048 this.timing = value; 1049 return this; 1050 } 1051 1052 /** 1053 * @return {@link #priority} (Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1054 */ 1055 public Enumeration<DeviceUseRequestPriority> getPriorityElement() { 1056 if (this.priority == null) 1057 if (Configuration.errorOnAutoCreate()) 1058 throw new Error("Attempt to auto-create DeviceUseRequest.priority"); 1059 else if (Configuration.doAutoCreate()) 1060 this.priority = new Enumeration<DeviceUseRequestPriority>(new DeviceUseRequestPriorityEnumFactory()); // bb 1061 return this.priority; 1062 } 1063 1064 public boolean hasPriorityElement() { 1065 return this.priority != null && !this.priority.isEmpty(); 1066 } 1067 1068 public boolean hasPriority() { 1069 return this.priority != null && !this.priority.isEmpty(); 1070 } 1071 1072 /** 1073 * @param value {@link #priority} (Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1074 */ 1075 public DeviceUseRequest setPriorityElement(Enumeration<DeviceUseRequestPriority> value) { 1076 this.priority = value; 1077 return this; 1078 } 1079 1080 /** 1081 * @return Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine. 1082 */ 1083 public DeviceUseRequestPriority getPriority() { 1084 return this.priority == null ? null : this.priority.getValue(); 1085 } 1086 1087 /** 1088 * @param value Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine. 1089 */ 1090 public DeviceUseRequest setPriority(DeviceUseRequestPriority value) { 1091 if (value == null) 1092 this.priority = null; 1093 else { 1094 if (this.priority == null) 1095 this.priority = new Enumeration<DeviceUseRequestPriority>(new DeviceUseRequestPriorityEnumFactory()); 1096 this.priority.setValue(value); 1097 } 1098 return this; 1099 } 1100 1101 protected void listChildren(List<Property> childrenList) { 1102 super.listChildren(childrenList); 1103 childrenList.add(new Property("bodySite[x]", "CodeableConcept|Reference(BodySite)", "Indicates the site on the subject's body where the device should be used ( i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, bodySite)); 1104 childrenList.add(new Property("status", "code", "The status of the request.", 0, java.lang.Integer.MAX_VALUE, status)); 1105 childrenList.add(new Property("device", "Reference(Device)", "The details of the device to be used.", 0, java.lang.Integer.MAX_VALUE, device)); 1106 childrenList.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional context in which this request is made.", 0, java.lang.Integer.MAX_VALUE, encounter)); 1107 childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1108 childrenList.add(new Property("indication", "CodeableConcept", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, indication)); 1109 childrenList.add(new Property("notes", "string", "Details about this request 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, notes)); 1110 childrenList.add(new Property("prnReason", "CodeableConcept", "The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.", 0, java.lang.Integer.MAX_VALUE, prnReason)); 1111 childrenList.add(new Property("orderedOn", "dateTime", "The time when the request was made.", 0, java.lang.Integer.MAX_VALUE, orderedOn)); 1112 childrenList.add(new Property("recordedOn", "dateTime", "The time at which the request was made/recorded.", 0, java.lang.Integer.MAX_VALUE, recordedOn)); 1113 childrenList.add(new Property("subject", "Reference(Patient)", "The patient who will use the device.", 0, java.lang.Integer.MAX_VALUE, subject)); 1114 childrenList.add(new Property("timing[x]", "Timing|Period|dateTime", "The timing schedule for the use of the device The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, java.lang.Integer.MAX_VALUE, timing)); 1115 childrenList.add(new Property("priority", "code", "Characterizes how quickly the use of device must be initiated. Includes concepts such as stat, urgent, routine.", 0, java.lang.Integer.MAX_VALUE, priority)); 1116 } 1117 1118 @Override 1119 public void setProperty(String name, Base value) throws FHIRException { 1120 if (name.equals("bodySite[x]")) 1121 this.bodySite = (Type) value; // Type 1122 else if (name.equals("status")) 1123 this.status = new DeviceUseRequestStatusEnumFactory().fromType(value); // Enumeration<DeviceUseRequestStatus> 1124 else if (name.equals("device")) 1125 this.device = castToReference(value); // Reference 1126 else if (name.equals("encounter")) 1127 this.encounter = castToReference(value); // Reference 1128 else if (name.equals("identifier")) 1129 this.getIdentifier().add(castToIdentifier(value)); 1130 else if (name.equals("indication")) 1131 this.getIndication().add(castToCodeableConcept(value)); 1132 else if (name.equals("notes")) 1133 this.getNotes().add(castToString(value)); 1134 else if (name.equals("prnReason")) 1135 this.getPrnReason().add(castToCodeableConcept(value)); 1136 else if (name.equals("orderedOn")) 1137 this.orderedOn = castToDateTime(value); // DateTimeType 1138 else if (name.equals("recordedOn")) 1139 this.recordedOn = castToDateTime(value); // DateTimeType 1140 else if (name.equals("subject")) 1141 this.subject = castToReference(value); // Reference 1142 else if (name.equals("timing[x]")) 1143 this.timing = (Type) value; // Type 1144 else if (name.equals("priority")) 1145 this.priority = new DeviceUseRequestPriorityEnumFactory().fromType(value); // Enumeration<DeviceUseRequestPriority> 1146 else 1147 super.setProperty(name, value); 1148 } 1149 1150 @Override 1151 public Base addChild(String name) throws FHIRException { 1152 if (name.equals("bodySiteCodeableConcept")) { 1153 this.bodySite = new CodeableConcept(); 1154 return this.bodySite; 1155 } 1156 else if (name.equals("bodySiteReference")) { 1157 this.bodySite = new Reference(); 1158 return this.bodySite; 1159 } 1160 else if (name.equals("status")) { 1161 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseRequest.status"); 1162 } 1163 else if (name.equals("device")) { 1164 this.device = new Reference(); 1165 return this.device; 1166 } 1167 else if (name.equals("encounter")) { 1168 this.encounter = new Reference(); 1169 return this.encounter; 1170 } 1171 else if (name.equals("identifier")) { 1172 return addIdentifier(); 1173 } 1174 else if (name.equals("indication")) { 1175 return addIndication(); 1176 } 1177 else if (name.equals("notes")) { 1178 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseRequest.notes"); 1179 } 1180 else if (name.equals("prnReason")) { 1181 return addPrnReason(); 1182 } 1183 else if (name.equals("orderedOn")) { 1184 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseRequest.orderedOn"); 1185 } 1186 else if (name.equals("recordedOn")) { 1187 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseRequest.recordedOn"); 1188 } 1189 else if (name.equals("subject")) { 1190 this.subject = new Reference(); 1191 return this.subject; 1192 } 1193 else if (name.equals("timingTiming")) { 1194 this.timing = new Timing(); 1195 return this.timing; 1196 } 1197 else if (name.equals("timingPeriod")) { 1198 this.timing = new Period(); 1199 return this.timing; 1200 } 1201 else if (name.equals("timingDateTime")) { 1202 this.timing = new DateTimeType(); 1203 return this.timing; 1204 } 1205 else if (name.equals("priority")) { 1206 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseRequest.priority"); 1207 } 1208 else 1209 return super.addChild(name); 1210 } 1211 1212 public String fhirType() { 1213 return "DeviceUseRequest"; 1214 1215 } 1216 1217 public DeviceUseRequest copy() { 1218 DeviceUseRequest dst = new DeviceUseRequest(); 1219 copyValues(dst); 1220 dst.bodySite = bodySite == null ? null : bodySite.copy(); 1221 dst.status = status == null ? null : status.copy(); 1222 dst.device = device == null ? null : device.copy(); 1223 dst.encounter = encounter == null ? null : encounter.copy(); 1224 if (identifier != null) { 1225 dst.identifier = new ArrayList<Identifier>(); 1226 for (Identifier i : identifier) 1227 dst.identifier.add(i.copy()); 1228 }; 1229 if (indication != null) { 1230 dst.indication = new ArrayList<CodeableConcept>(); 1231 for (CodeableConcept i : indication) 1232 dst.indication.add(i.copy()); 1233 }; 1234 if (notes != null) { 1235 dst.notes = new ArrayList<StringType>(); 1236 for (StringType i : notes) 1237 dst.notes.add(i.copy()); 1238 }; 1239 if (prnReason != null) { 1240 dst.prnReason = new ArrayList<CodeableConcept>(); 1241 for (CodeableConcept i : prnReason) 1242 dst.prnReason.add(i.copy()); 1243 }; 1244 dst.orderedOn = orderedOn == null ? null : orderedOn.copy(); 1245 dst.recordedOn = recordedOn == null ? null : recordedOn.copy(); 1246 dst.subject = subject == null ? null : subject.copy(); 1247 dst.timing = timing == null ? null : timing.copy(); 1248 dst.priority = priority == null ? null : priority.copy(); 1249 return dst; 1250 } 1251 1252 protected DeviceUseRequest typedCopy() { 1253 return copy(); 1254 } 1255 1256 @Override 1257 public boolean equalsDeep(Base other) { 1258 if (!super.equalsDeep(other)) 1259 return false; 1260 if (!(other instanceof DeviceUseRequest)) 1261 return false; 1262 DeviceUseRequest o = (DeviceUseRequest) other; 1263 return compareDeep(bodySite, o.bodySite, true) && compareDeep(status, o.status, true) && compareDeep(device, o.device, true) 1264 && compareDeep(encounter, o.encounter, true) && compareDeep(identifier, o.identifier, true) && compareDeep(indication, o.indication, true) 1265 && compareDeep(notes, o.notes, true) && compareDeep(prnReason, o.prnReason, true) && compareDeep(orderedOn, o.orderedOn, true) 1266 && compareDeep(recordedOn, o.recordedOn, true) && compareDeep(subject, o.subject, true) && compareDeep(timing, o.timing, true) 1267 && compareDeep(priority, o.priority, true); 1268 } 1269 1270 @Override 1271 public boolean equalsShallow(Base other) { 1272 if (!super.equalsShallow(other)) 1273 return false; 1274 if (!(other instanceof DeviceUseRequest)) 1275 return false; 1276 DeviceUseRequest o = (DeviceUseRequest) other; 1277 return compareValues(status, o.status, true) && compareValues(notes, o.notes, true) && compareValues(orderedOn, o.orderedOn, true) 1278 && compareValues(recordedOn, o.recordedOn, true) && compareValues(priority, o.priority, true); 1279 } 1280 1281 public boolean isEmpty() { 1282 return super.isEmpty() && (bodySite == null || bodySite.isEmpty()) && (status == null || status.isEmpty()) 1283 && (device == null || device.isEmpty()) && (encounter == null || encounter.isEmpty()) && (identifier == null || identifier.isEmpty()) 1284 && (indication == null || indication.isEmpty()) && (notes == null || notes.isEmpty()) && (prnReason == null || prnReason.isEmpty()) 1285 && (orderedOn == null || orderedOn.isEmpty()) && (recordedOn == null || recordedOn.isEmpty()) 1286 && (subject == null || subject.isEmpty()) && (timing == null || timing.isEmpty()) && (priority == null || priority.isEmpty()) 1287 ; 1288 } 1289 1290 @Override 1291 public ResourceType getResourceType() { 1292 return ResourceType.DeviceUseRequest; 1293 } 1294 1295 @SearchParamDefinition(name="subject", path="DeviceUseRequest.subject", description="Search by subject", type="reference" ) 1296 public static final String SP_SUBJECT = "subject"; 1297 @SearchParamDefinition(name="patient", path="DeviceUseRequest.subject", description="Search by subject - a patient", type="reference" ) 1298 public static final String SP_PATIENT = "patient"; 1299 @SearchParamDefinition(name="device", path="DeviceUseRequest.device", description="Device requested", type="reference" ) 1300 public static final String SP_DEVICE = "device"; 1301 1302} 1303