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