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 * A request for a procedure to be performed. May be a proposal or an order. 040 */ 041@ResourceDef(name="ProcedureRequest", profile="http://hl7.org/fhir/Profile/ProcedureRequest") 042public class ProcedureRequest extends DomainResource { 043 044 public enum ProcedureRequestStatus { 045 /** 046 * The request has been proposed. 047 */ 048 PROPOSED, 049 /** 050 * The request is in preliminary form, prior to being requested. 051 */ 052 DRAFT, 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 request is happening. 067 */ 068 INPROGRESS, 069 /** 070 * The work has been completed, 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 ProcedureRequestStatus fromCode(String codeString) throws FHIRException { 090 if (codeString == null || "".equals(codeString)) 091 return null; 092 if ("proposed".equals(codeString)) 093 return PROPOSED; 094 if ("draft".equals(codeString)) 095 return DRAFT; 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 ProcedureRequestStatus code '"+codeString+"'"); 113 } 114 public String toCode() { 115 switch (this) { 116 case PROPOSED: return "proposed"; 117 case DRAFT: return "draft"; 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/procedure-request-status"; 132 case DRAFT: return "http://hl7.org/fhir/procedure-request-status"; 133 case REQUESTED: return "http://hl7.org/fhir/procedure-request-status"; 134 case RECEIVED: return "http://hl7.org/fhir/procedure-request-status"; 135 case ACCEPTED: return "http://hl7.org/fhir/procedure-request-status"; 136 case INPROGRESS: return "http://hl7.org/fhir/procedure-request-status"; 137 case COMPLETED: return "http://hl7.org/fhir/procedure-request-status"; 138 case SUSPENDED: return "http://hl7.org/fhir/procedure-request-status"; 139 case REJECTED: return "http://hl7.org/fhir/procedure-request-status"; 140 case ABORTED: return "http://hl7.org/fhir/procedure-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 DRAFT: return "The request is in preliminary form, prior to being requested."; 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 request is happening."; 152 case COMPLETED: return "The work has been completed, 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 DRAFT: return "Draft"; 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 ProcedureRequestStatusEnumFactory implements EnumFactory<ProcedureRequestStatus> { 177 public ProcedureRequestStatus 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 ProcedureRequestStatus.PROPOSED; 183 if ("draft".equals(codeString)) 184 return ProcedureRequestStatus.DRAFT; 185 if ("requested".equals(codeString)) 186 return ProcedureRequestStatus.REQUESTED; 187 if ("received".equals(codeString)) 188 return ProcedureRequestStatus.RECEIVED; 189 if ("accepted".equals(codeString)) 190 return ProcedureRequestStatus.ACCEPTED; 191 if ("in-progress".equals(codeString)) 192 return ProcedureRequestStatus.INPROGRESS; 193 if ("completed".equals(codeString)) 194 return ProcedureRequestStatus.COMPLETED; 195 if ("suspended".equals(codeString)) 196 return ProcedureRequestStatus.SUSPENDED; 197 if ("rejected".equals(codeString)) 198 return ProcedureRequestStatus.REJECTED; 199 if ("aborted".equals(codeString)) 200 return ProcedureRequestStatus.ABORTED; 201 throw new IllegalArgumentException("Unknown ProcedureRequestStatus code '"+codeString+"'"); 202 } 203 public Enumeration<ProcedureRequestStatus> 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<ProcedureRequestStatus>(this, ProcedureRequestStatus.PROPOSED); 211 if ("draft".equals(codeString)) 212 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.DRAFT); 213 if ("requested".equals(codeString)) 214 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.REQUESTED); 215 if ("received".equals(codeString)) 216 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.RECEIVED); 217 if ("accepted".equals(codeString)) 218 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.ACCEPTED); 219 if ("in-progress".equals(codeString)) 220 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.INPROGRESS); 221 if ("completed".equals(codeString)) 222 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.COMPLETED); 223 if ("suspended".equals(codeString)) 224 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.SUSPENDED); 225 if ("rejected".equals(codeString)) 226 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.REJECTED); 227 if ("aborted".equals(codeString)) 228 return new Enumeration<ProcedureRequestStatus>(this, ProcedureRequestStatus.ABORTED); 229 throw new FHIRException("Unknown ProcedureRequestStatus code '"+codeString+"'"); 230 } 231 public String toCode(ProcedureRequestStatus code) { 232 if (code == ProcedureRequestStatus.PROPOSED) 233 return "proposed"; 234 if (code == ProcedureRequestStatus.DRAFT) 235 return "draft"; 236 if (code == ProcedureRequestStatus.REQUESTED) 237 return "requested"; 238 if (code == ProcedureRequestStatus.RECEIVED) 239 return "received"; 240 if (code == ProcedureRequestStatus.ACCEPTED) 241 return "accepted"; 242 if (code == ProcedureRequestStatus.INPROGRESS) 243 return "in-progress"; 244 if (code == ProcedureRequestStatus.COMPLETED) 245 return "completed"; 246 if (code == ProcedureRequestStatus.SUSPENDED) 247 return "suspended"; 248 if (code == ProcedureRequestStatus.REJECTED) 249 return "rejected"; 250 if (code == ProcedureRequestStatus.ABORTED) 251 return "aborted"; 252 return "?"; 253 } 254 } 255 256 public enum ProcedureRequestPriority { 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 ProcedureRequestPriority 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 ProcedureRequestPriority 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/procedure-request-priority"; 302 case URGENT: return "http://hl7.org/fhir/procedure-request-priority"; 303 case STAT: return "http://hl7.org/fhir/procedure-request-priority"; 304 case ASAP: return "http://hl7.org/fhir/procedure-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 ProcedureRequestPriorityEnumFactory implements EnumFactory<ProcedureRequestPriority> { 329 public ProcedureRequestPriority 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 ProcedureRequestPriority.ROUTINE; 335 if ("urgent".equals(codeString)) 336 return ProcedureRequestPriority.URGENT; 337 if ("stat".equals(codeString)) 338 return ProcedureRequestPriority.STAT; 339 if ("asap".equals(codeString)) 340 return ProcedureRequestPriority.ASAP; 341 throw new IllegalArgumentException("Unknown ProcedureRequestPriority code '"+codeString+"'"); 342 } 343 public Enumeration<ProcedureRequestPriority> 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<ProcedureRequestPriority>(this, ProcedureRequestPriority.ROUTINE); 351 if ("urgent".equals(codeString)) 352 return new Enumeration<ProcedureRequestPriority>(this, ProcedureRequestPriority.URGENT); 353 if ("stat".equals(codeString)) 354 return new Enumeration<ProcedureRequestPriority>(this, ProcedureRequestPriority.STAT); 355 if ("asap".equals(codeString)) 356 return new Enumeration<ProcedureRequestPriority>(this, ProcedureRequestPriority.ASAP); 357 throw new FHIRException("Unknown ProcedureRequestPriority code '"+codeString+"'"); 358 } 359 public String toCode(ProcedureRequestPriority code) { 360 if (code == ProcedureRequestPriority.ROUTINE) 361 return "routine"; 362 if (code == ProcedureRequestPriority.URGENT) 363 return "urgent"; 364 if (code == ProcedureRequestPriority.STAT) 365 return "stat"; 366 if (code == ProcedureRequestPriority.ASAP) 367 return "asap"; 368 return "?"; 369 } 370 } 371 372 /** 373 * Identifiers assigned to this order by the order or by the receiver. 374 */ 375 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 376 @Description(shortDefinition="Unique identifier for the request", formalDefinition="Identifiers assigned to this order by the order or by the receiver." ) 377 protected List<Identifier> identifier; 378 379 /** 380 * The person, animal or group that should receive the procedure. 381 */ 382 @Child(name = "subject", type = {Patient.class, Group.class}, order=1, min=1, max=1, modifier=false, summary=true) 383 @Description(shortDefinition="Who the procedure should be done to", formalDefinition="The person, animal or group that should receive the procedure." ) 384 protected Reference subject; 385 386 /** 387 * The actual object that is the target of the reference (The person, animal or group that should receive the procedure.) 388 */ 389 protected Resource subjectTarget; 390 391 /** 392 * The specific procedure that is ordered. Use text if the exact nature of the procedure cannot be coded. 393 */ 394 @Child(name = "code", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true) 395 @Description(shortDefinition="What procedure to perform", formalDefinition="The specific procedure that is ordered. Use text if the exact nature of the procedure cannot be coded." ) 396 protected CodeableConcept code; 397 398 /** 399 * Indicates the sites on the subject's body where the procedure should be performed (I.e. the target sites). 400 */ 401 @Child(name = "bodySite", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 402 @Description(shortDefinition="What part of body to perform on", formalDefinition="Indicates the sites on the subject's body where the procedure should be performed (I.e. the target sites)." ) 403 protected List<CodeableConcept> bodySite; 404 405 /** 406 * The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance. 407 */ 408 @Child(name = "reason", type = {CodeableConcept.class, Condition.class}, order=4, min=0, max=1, modifier=false, summary=true) 409 @Description(shortDefinition="Why procedure should occur", formalDefinition="The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance." ) 410 protected Type reason; 411 412 /** 413 * The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. "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". 414 */ 415 @Child(name = "scheduled", type = {DateTimeType.class, Period.class, Timing.class}, order=5, min=0, max=1, modifier=false, summary=true) 416 @Description(shortDefinition="When procedure should occur", formalDefinition="The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. \"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\"." ) 417 protected Type scheduled; 418 419 /** 420 * The encounter within which the procedure proposal or request was created. 421 */ 422 @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true) 423 @Description(shortDefinition="Encounter request created during", formalDefinition="The encounter within which the procedure proposal or request was created." ) 424 protected Reference encounter; 425 426 /** 427 * The actual object that is the target of the reference (The encounter within which the procedure proposal or request was created.) 428 */ 429 protected Encounter encounterTarget; 430 431 /** 432 * For example, the surgeon, anaethetist, endoscopist, etc. 433 */ 434 @Child(name = "performer", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=7, min=0, max=1, modifier=false, summary=true) 435 @Description(shortDefinition="Who should perform the procedure", formalDefinition="For example, the surgeon, anaethetist, endoscopist, etc." ) 436 protected Reference performer; 437 438 /** 439 * The actual object that is the target of the reference (For example, the surgeon, anaethetist, endoscopist, etc.) 440 */ 441 protected Resource performerTarget; 442 443 /** 444 * The status of the order. 445 */ 446 @Child(name = "status", type = {CodeType.class}, order=8, min=0, max=1, modifier=true, summary=true) 447 @Description(shortDefinition="proposed | draft | requested | received | accepted | in-progress | completed | suspended | rejected | aborted", formalDefinition="The status of the order." ) 448 protected Enumeration<ProcedureRequestStatus> status; 449 450 /** 451 * Any other notes associated with this proposal or order - e.g. provider instructions. 452 */ 453 @Child(name = "notes", type = {Annotation.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 454 @Description(shortDefinition="Additional information about desired procedure", formalDefinition="Any other notes associated with this proposal or order - e.g. provider instructions." ) 455 protected List<Annotation> notes; 456 457 /** 458 * If a CodeableConcept is present, it indicates the pre-condition for performing the procedure. 459 */ 460 @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true) 461 @Description(shortDefinition="Preconditions for procedure", formalDefinition="If a CodeableConcept is present, it indicates the pre-condition for performing the procedure." ) 462 protected Type asNeeded; 463 464 /** 465 * The time when the request was made. 466 */ 467 @Child(name = "orderedOn", type = {DateTimeType.class}, order=11, min=0, max=1, modifier=false, summary=true) 468 @Description(shortDefinition="When request was created", formalDefinition="The time when the request was made." ) 469 protected DateTimeType orderedOn; 470 471 /** 472 * The healthcare professional responsible for proposing or ordering the procedure. 473 */ 474 @Child(name = "orderer", type = {Practitioner.class, Patient.class, RelatedPerson.class, Device.class}, order=12, min=0, max=1, modifier=false, summary=true) 475 @Description(shortDefinition="Who made request", formalDefinition="The healthcare professional responsible for proposing or ordering the procedure." ) 476 protected Reference orderer; 477 478 /** 479 * The actual object that is the target of the reference (The healthcare professional responsible for proposing or ordering the procedure.) 480 */ 481 protected Resource ordererTarget; 482 483 /** 484 * The clinical priority associated with this order. 485 */ 486 @Child(name = "priority", type = {CodeType.class}, order=13, min=0, max=1, modifier=false, summary=true) 487 @Description(shortDefinition="routine | urgent | stat | asap", formalDefinition="The clinical priority associated with this order." ) 488 protected Enumeration<ProcedureRequestPriority> priority; 489 490 private static final long serialVersionUID = -916650578L; 491 492 /* 493 * Constructor 494 */ 495 public ProcedureRequest() { 496 super(); 497 } 498 499 /* 500 * Constructor 501 */ 502 public ProcedureRequest(Reference subject, CodeableConcept code) { 503 super(); 504 this.subject = subject; 505 this.code = code; 506 } 507 508 /** 509 * @return {@link #identifier} (Identifiers assigned to this order by the order or by the receiver.) 510 */ 511 public List<Identifier> getIdentifier() { 512 if (this.identifier == null) 513 this.identifier = new ArrayList<Identifier>(); 514 return this.identifier; 515 } 516 517 public boolean hasIdentifier() { 518 if (this.identifier == null) 519 return false; 520 for (Identifier item : this.identifier) 521 if (!item.isEmpty()) 522 return true; 523 return false; 524 } 525 526 /** 527 * @return {@link #identifier} (Identifiers assigned to this order by the order or by the receiver.) 528 */ 529 // syntactic sugar 530 public Identifier addIdentifier() { //3 531 Identifier t = new Identifier(); 532 if (this.identifier == null) 533 this.identifier = new ArrayList<Identifier>(); 534 this.identifier.add(t); 535 return t; 536 } 537 538 // syntactic sugar 539 public ProcedureRequest addIdentifier(Identifier t) { //3 540 if (t == null) 541 return this; 542 if (this.identifier == null) 543 this.identifier = new ArrayList<Identifier>(); 544 this.identifier.add(t); 545 return this; 546 } 547 548 /** 549 * @return {@link #subject} (The person, animal or group that should receive the procedure.) 550 */ 551 public Reference getSubject() { 552 if (this.subject == null) 553 if (Configuration.errorOnAutoCreate()) 554 throw new Error("Attempt to auto-create ProcedureRequest.subject"); 555 else if (Configuration.doAutoCreate()) 556 this.subject = new Reference(); // cc 557 return this.subject; 558 } 559 560 public boolean hasSubject() { 561 return this.subject != null && !this.subject.isEmpty(); 562 } 563 564 /** 565 * @param value {@link #subject} (The person, animal or group that should receive the procedure.) 566 */ 567 public ProcedureRequest setSubject(Reference value) { 568 this.subject = value; 569 return this; 570 } 571 572 /** 573 * @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 person, animal or group that should receive the procedure.) 574 */ 575 public Resource getSubjectTarget() { 576 return this.subjectTarget; 577 } 578 579 /** 580 * @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 person, animal or group that should receive the procedure.) 581 */ 582 public ProcedureRequest setSubjectTarget(Resource value) { 583 this.subjectTarget = value; 584 return this; 585 } 586 587 /** 588 * @return {@link #code} (The specific procedure that is ordered. Use text if the exact nature of the procedure cannot be coded.) 589 */ 590 public CodeableConcept getCode() { 591 if (this.code == null) 592 if (Configuration.errorOnAutoCreate()) 593 throw new Error("Attempt to auto-create ProcedureRequest.code"); 594 else if (Configuration.doAutoCreate()) 595 this.code = new CodeableConcept(); // cc 596 return this.code; 597 } 598 599 public boolean hasCode() { 600 return this.code != null && !this.code.isEmpty(); 601 } 602 603 /** 604 * @param value {@link #code} (The specific procedure that is ordered. Use text if the exact nature of the procedure cannot be coded.) 605 */ 606 public ProcedureRequest setCode(CodeableConcept value) { 607 this.code = value; 608 return this; 609 } 610 611 /** 612 * @return {@link #bodySite} (Indicates the sites on the subject's body where the procedure should be performed (I.e. the target sites).) 613 */ 614 public List<CodeableConcept> getBodySite() { 615 if (this.bodySite == null) 616 this.bodySite = new ArrayList<CodeableConcept>(); 617 return this.bodySite; 618 } 619 620 public boolean hasBodySite() { 621 if (this.bodySite == null) 622 return false; 623 for (CodeableConcept item : this.bodySite) 624 if (!item.isEmpty()) 625 return true; 626 return false; 627 } 628 629 /** 630 * @return {@link #bodySite} (Indicates the sites on the subject's body where the procedure should be performed (I.e. the target sites).) 631 */ 632 // syntactic sugar 633 public CodeableConcept addBodySite() { //3 634 CodeableConcept t = new CodeableConcept(); 635 if (this.bodySite == null) 636 this.bodySite = new ArrayList<CodeableConcept>(); 637 this.bodySite.add(t); 638 return t; 639 } 640 641 // syntactic sugar 642 public ProcedureRequest addBodySite(CodeableConcept t) { //3 643 if (t == null) 644 return this; 645 if (this.bodySite == null) 646 this.bodySite = new ArrayList<CodeableConcept>(); 647 this.bodySite.add(t); 648 return this; 649 } 650 651 /** 652 * @return {@link #reason} (The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance.) 653 */ 654 public Type getReason() { 655 return this.reason; 656 } 657 658 /** 659 * @return {@link #reason} (The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance.) 660 */ 661 public CodeableConcept getReasonCodeableConcept() throws FHIRException { 662 if (!(this.reason instanceof CodeableConcept)) 663 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered"); 664 return (CodeableConcept) this.reason; 665 } 666 667 public boolean hasReasonCodeableConcept() { 668 return this.reason instanceof CodeableConcept; 669 } 670 671 /** 672 * @return {@link #reason} (The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance.) 673 */ 674 public Reference getReasonReference() throws FHIRException { 675 if (!(this.reason instanceof Reference)) 676 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered"); 677 return (Reference) this.reason; 678 } 679 680 public boolean hasReasonReference() { 681 return this.reason instanceof Reference; 682 } 683 684 public boolean hasReason() { 685 return this.reason != null && !this.reason.isEmpty(); 686 } 687 688 /** 689 * @param value {@link #reason} (The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance.) 690 */ 691 public ProcedureRequest setReason(Type value) { 692 this.reason = value; 693 return this; 694 } 695 696 /** 697 * @return {@link #scheduled} (The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. "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".) 698 */ 699 public Type getScheduled() { 700 return this.scheduled; 701 } 702 703 /** 704 * @return {@link #scheduled} (The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. "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".) 705 */ 706 public DateTimeType getScheduledDateTimeType() throws FHIRException { 707 if (!(this.scheduled instanceof DateTimeType)) 708 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.scheduled.getClass().getName()+" was encountered"); 709 return (DateTimeType) this.scheduled; 710 } 711 712 public boolean hasScheduledDateTimeType() { 713 return this.scheduled instanceof DateTimeType; 714 } 715 716 /** 717 * @return {@link #scheduled} (The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. "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".) 718 */ 719 public Period getScheduledPeriod() throws FHIRException { 720 if (!(this.scheduled instanceof Period)) 721 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.scheduled.getClass().getName()+" was encountered"); 722 return (Period) this.scheduled; 723 } 724 725 public boolean hasScheduledPeriod() { 726 return this.scheduled instanceof Period; 727 } 728 729 /** 730 * @return {@link #scheduled} (The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. "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".) 731 */ 732 public Timing getScheduledTiming() throws FHIRException { 733 if (!(this.scheduled instanceof Timing)) 734 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.scheduled.getClass().getName()+" was encountered"); 735 return (Timing) this.scheduled; 736 } 737 738 public boolean hasScheduledTiming() { 739 return this.scheduled instanceof Timing; 740 } 741 742 public boolean hasScheduled() { 743 return this.scheduled != null && !this.scheduled.isEmpty(); 744 } 745 746 /** 747 * @param value {@link #scheduled} (The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. "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".) 748 */ 749 public ProcedureRequest setScheduled(Type value) { 750 this.scheduled = value; 751 return this; 752 } 753 754 /** 755 * @return {@link #encounter} (The encounter within which the procedure proposal or request was created.) 756 */ 757 public Reference getEncounter() { 758 if (this.encounter == null) 759 if (Configuration.errorOnAutoCreate()) 760 throw new Error("Attempt to auto-create ProcedureRequest.encounter"); 761 else if (Configuration.doAutoCreate()) 762 this.encounter = new Reference(); // cc 763 return this.encounter; 764 } 765 766 public boolean hasEncounter() { 767 return this.encounter != null && !this.encounter.isEmpty(); 768 } 769 770 /** 771 * @param value {@link #encounter} (The encounter within which the procedure proposal or request was created.) 772 */ 773 public ProcedureRequest setEncounter(Reference value) { 774 this.encounter = value; 775 return this; 776 } 777 778 /** 779 * @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. (The encounter within which the procedure proposal or request was created.) 780 */ 781 public Encounter getEncounterTarget() { 782 if (this.encounterTarget == null) 783 if (Configuration.errorOnAutoCreate()) 784 throw new Error("Attempt to auto-create ProcedureRequest.encounter"); 785 else if (Configuration.doAutoCreate()) 786 this.encounterTarget = new Encounter(); // aa 787 return this.encounterTarget; 788 } 789 790 /** 791 * @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. (The encounter within which the procedure proposal or request was created.) 792 */ 793 public ProcedureRequest setEncounterTarget(Encounter value) { 794 this.encounterTarget = value; 795 return this; 796 } 797 798 /** 799 * @return {@link #performer} (For example, the surgeon, anaethetist, endoscopist, etc.) 800 */ 801 public Reference getPerformer() { 802 if (this.performer == null) 803 if (Configuration.errorOnAutoCreate()) 804 throw new Error("Attempt to auto-create ProcedureRequest.performer"); 805 else if (Configuration.doAutoCreate()) 806 this.performer = new Reference(); // cc 807 return this.performer; 808 } 809 810 public boolean hasPerformer() { 811 return this.performer != null && !this.performer.isEmpty(); 812 } 813 814 /** 815 * @param value {@link #performer} (For example, the surgeon, anaethetist, endoscopist, etc.) 816 */ 817 public ProcedureRequest setPerformer(Reference value) { 818 this.performer = value; 819 return this; 820 } 821 822 /** 823 * @return {@link #performer} 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. (For example, the surgeon, anaethetist, endoscopist, etc.) 824 */ 825 public Resource getPerformerTarget() { 826 return this.performerTarget; 827 } 828 829 /** 830 * @param value {@link #performer} 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. (For example, the surgeon, anaethetist, endoscopist, etc.) 831 */ 832 public ProcedureRequest setPerformerTarget(Resource value) { 833 this.performerTarget = value; 834 return this; 835 } 836 837 /** 838 * @return {@link #status} (The status of the order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 839 */ 840 public Enumeration<ProcedureRequestStatus> getStatusElement() { 841 if (this.status == null) 842 if (Configuration.errorOnAutoCreate()) 843 throw new Error("Attempt to auto-create ProcedureRequest.status"); 844 else if (Configuration.doAutoCreate()) 845 this.status = new Enumeration<ProcedureRequestStatus>(new ProcedureRequestStatusEnumFactory()); // bb 846 return this.status; 847 } 848 849 public boolean hasStatusElement() { 850 return this.status != null && !this.status.isEmpty(); 851 } 852 853 public boolean hasStatus() { 854 return this.status != null && !this.status.isEmpty(); 855 } 856 857 /** 858 * @param value {@link #status} (The status of the order.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 859 */ 860 public ProcedureRequest setStatusElement(Enumeration<ProcedureRequestStatus> value) { 861 this.status = value; 862 return this; 863 } 864 865 /** 866 * @return The status of the order. 867 */ 868 public ProcedureRequestStatus getStatus() { 869 return this.status == null ? null : this.status.getValue(); 870 } 871 872 /** 873 * @param value The status of the order. 874 */ 875 public ProcedureRequest setStatus(ProcedureRequestStatus value) { 876 if (value == null) 877 this.status = null; 878 else { 879 if (this.status == null) 880 this.status = new Enumeration<ProcedureRequestStatus>(new ProcedureRequestStatusEnumFactory()); 881 this.status.setValue(value); 882 } 883 return this; 884 } 885 886 /** 887 * @return {@link #notes} (Any other notes associated with this proposal or order - e.g. provider instructions.) 888 */ 889 public List<Annotation> getNotes() { 890 if (this.notes == null) 891 this.notes = new ArrayList<Annotation>(); 892 return this.notes; 893 } 894 895 public boolean hasNotes() { 896 if (this.notes == null) 897 return false; 898 for (Annotation item : this.notes) 899 if (!item.isEmpty()) 900 return true; 901 return false; 902 } 903 904 /** 905 * @return {@link #notes} (Any other notes associated with this proposal or order - e.g. provider instructions.) 906 */ 907 // syntactic sugar 908 public Annotation addNotes() { //3 909 Annotation t = new Annotation(); 910 if (this.notes == null) 911 this.notes = new ArrayList<Annotation>(); 912 this.notes.add(t); 913 return t; 914 } 915 916 // syntactic sugar 917 public ProcedureRequest addNotes(Annotation t) { //3 918 if (t == null) 919 return this; 920 if (this.notes == null) 921 this.notes = new ArrayList<Annotation>(); 922 this.notes.add(t); 923 return this; 924 } 925 926 /** 927 * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.) 928 */ 929 public Type getAsNeeded() { 930 return this.asNeeded; 931 } 932 933 /** 934 * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.) 935 */ 936 public BooleanType getAsNeededBooleanType() throws FHIRException { 937 if (!(this.asNeeded instanceof BooleanType)) 938 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 939 return (BooleanType) this.asNeeded; 940 } 941 942 public boolean hasAsNeededBooleanType() { 943 return this.asNeeded instanceof BooleanType; 944 } 945 946 /** 947 * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.) 948 */ 949 public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 950 if (!(this.asNeeded instanceof CodeableConcept)) 951 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 952 return (CodeableConcept) this.asNeeded; 953 } 954 955 public boolean hasAsNeededCodeableConcept() { 956 return this.asNeeded instanceof CodeableConcept; 957 } 958 959 public boolean hasAsNeeded() { 960 return this.asNeeded != null && !this.asNeeded.isEmpty(); 961 } 962 963 /** 964 * @param value {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.) 965 */ 966 public ProcedureRequest setAsNeeded(Type value) { 967 this.asNeeded = value; 968 return this; 969 } 970 971 /** 972 * @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 973 */ 974 public DateTimeType getOrderedOnElement() { 975 if (this.orderedOn == null) 976 if (Configuration.errorOnAutoCreate()) 977 throw new Error("Attempt to auto-create ProcedureRequest.orderedOn"); 978 else if (Configuration.doAutoCreate()) 979 this.orderedOn = new DateTimeType(); // bb 980 return this.orderedOn; 981 } 982 983 public boolean hasOrderedOnElement() { 984 return this.orderedOn != null && !this.orderedOn.isEmpty(); 985 } 986 987 public boolean hasOrderedOn() { 988 return this.orderedOn != null && !this.orderedOn.isEmpty(); 989 } 990 991 /** 992 * @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 993 */ 994 public ProcedureRequest setOrderedOnElement(DateTimeType value) { 995 this.orderedOn = value; 996 return this; 997 } 998 999 /** 1000 * @return The time when the request was made. 1001 */ 1002 public Date getOrderedOn() { 1003 return this.orderedOn == null ? null : this.orderedOn.getValue(); 1004 } 1005 1006 /** 1007 * @param value The time when the request was made. 1008 */ 1009 public ProcedureRequest setOrderedOn(Date value) { 1010 if (value == null) 1011 this.orderedOn = null; 1012 else { 1013 if (this.orderedOn == null) 1014 this.orderedOn = new DateTimeType(); 1015 this.orderedOn.setValue(value); 1016 } 1017 return this; 1018 } 1019 1020 /** 1021 * @return {@link #orderer} (The healthcare professional responsible for proposing or ordering the procedure.) 1022 */ 1023 public Reference getOrderer() { 1024 if (this.orderer == null) 1025 if (Configuration.errorOnAutoCreate()) 1026 throw new Error("Attempt to auto-create ProcedureRequest.orderer"); 1027 else if (Configuration.doAutoCreate()) 1028 this.orderer = new Reference(); // cc 1029 return this.orderer; 1030 } 1031 1032 public boolean hasOrderer() { 1033 return this.orderer != null && !this.orderer.isEmpty(); 1034 } 1035 1036 /** 1037 * @param value {@link #orderer} (The healthcare professional responsible for proposing or ordering the procedure.) 1038 */ 1039 public ProcedureRequest setOrderer(Reference value) { 1040 this.orderer = value; 1041 return this; 1042 } 1043 1044 /** 1045 * @return {@link #orderer} 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 healthcare professional responsible for proposing or ordering the procedure.) 1046 */ 1047 public Resource getOrdererTarget() { 1048 return this.ordererTarget; 1049 } 1050 1051 /** 1052 * @param value {@link #orderer} 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 healthcare professional responsible for proposing or ordering the procedure.) 1053 */ 1054 public ProcedureRequest setOrdererTarget(Resource value) { 1055 this.ordererTarget = value; 1056 return this; 1057 } 1058 1059 /** 1060 * @return {@link #priority} (The clinical priority associated with this order.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1061 */ 1062 public Enumeration<ProcedureRequestPriority> getPriorityElement() { 1063 if (this.priority == null) 1064 if (Configuration.errorOnAutoCreate()) 1065 throw new Error("Attempt to auto-create ProcedureRequest.priority"); 1066 else if (Configuration.doAutoCreate()) 1067 this.priority = new Enumeration<ProcedureRequestPriority>(new ProcedureRequestPriorityEnumFactory()); // bb 1068 return this.priority; 1069 } 1070 1071 public boolean hasPriorityElement() { 1072 return this.priority != null && !this.priority.isEmpty(); 1073 } 1074 1075 public boolean hasPriority() { 1076 return this.priority != null && !this.priority.isEmpty(); 1077 } 1078 1079 /** 1080 * @param value {@link #priority} (The clinical priority associated with this order.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1081 */ 1082 public ProcedureRequest setPriorityElement(Enumeration<ProcedureRequestPriority> value) { 1083 this.priority = value; 1084 return this; 1085 } 1086 1087 /** 1088 * @return The clinical priority associated with this order. 1089 */ 1090 public ProcedureRequestPriority getPriority() { 1091 return this.priority == null ? null : this.priority.getValue(); 1092 } 1093 1094 /** 1095 * @param value The clinical priority associated with this order. 1096 */ 1097 public ProcedureRequest setPriority(ProcedureRequestPriority value) { 1098 if (value == null) 1099 this.priority = null; 1100 else { 1101 if (this.priority == null) 1102 this.priority = new Enumeration<ProcedureRequestPriority>(new ProcedureRequestPriorityEnumFactory()); 1103 this.priority.setValue(value); 1104 } 1105 return this; 1106 } 1107 1108 protected void listChildren(List<Property> childrenList) { 1109 super.listChildren(childrenList); 1110 childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the order or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1111 childrenList.add(new Property("subject", "Reference(Patient|Group)", "The person, animal or group that should receive the procedure.", 0, java.lang.Integer.MAX_VALUE, subject)); 1112 childrenList.add(new Property("code", "CodeableConcept", "The specific procedure that is ordered. Use text if the exact nature of the procedure cannot be coded.", 0, java.lang.Integer.MAX_VALUE, code)); 1113 childrenList.add(new Property("bodySite", "CodeableConcept", "Indicates the sites on the subject's body where the procedure should be performed (I.e. the target sites).", 0, java.lang.Integer.MAX_VALUE, bodySite)); 1114 childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Condition)", "The reason why the procedure is being proposed or ordered. This procedure request may be motivated by a Condition for instance.", 0, java.lang.Integer.MAX_VALUE, reason)); 1115 childrenList.add(new Property("scheduled[x]", "dateTime|Period|Timing", "The timing schedule for the proposed or ordered procedure. The Schedule data type allows many different expressions. E.g. \"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, scheduled)); 1116 childrenList.add(new Property("encounter", "Reference(Encounter)", "The encounter within which the procedure proposal or request was created.", 0, java.lang.Integer.MAX_VALUE, encounter)); 1117 childrenList.add(new Property("performer", "Reference(Practitioner|Organization|Patient|RelatedPerson)", "For example, the surgeon, anaethetist, endoscopist, etc.", 0, java.lang.Integer.MAX_VALUE, performer)); 1118 childrenList.add(new Property("status", "code", "The status of the order.", 0, java.lang.Integer.MAX_VALUE, status)); 1119 childrenList.add(new Property("notes", "Annotation", "Any other notes associated with this proposal or order - e.g. provider instructions.", 0, java.lang.Integer.MAX_VALUE, notes)); 1120 childrenList.add(new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.", 0, java.lang.Integer.MAX_VALUE, asNeeded)); 1121 childrenList.add(new Property("orderedOn", "dateTime", "The time when the request was made.", 0, java.lang.Integer.MAX_VALUE, orderedOn)); 1122 childrenList.add(new Property("orderer", "Reference(Practitioner|Patient|RelatedPerson|Device)", "The healthcare professional responsible for proposing or ordering the procedure.", 0, java.lang.Integer.MAX_VALUE, orderer)); 1123 childrenList.add(new Property("priority", "code", "The clinical priority associated with this order.", 0, java.lang.Integer.MAX_VALUE, priority)); 1124 } 1125 1126 @Override 1127 public void setProperty(String name, Base value) throws FHIRException { 1128 if (name.equals("identifier")) 1129 this.getIdentifier().add(castToIdentifier(value)); 1130 else if (name.equals("subject")) 1131 this.subject = castToReference(value); // Reference 1132 else if (name.equals("code")) 1133 this.code = castToCodeableConcept(value); // CodeableConcept 1134 else if (name.equals("bodySite")) 1135 this.getBodySite().add(castToCodeableConcept(value)); 1136 else if (name.equals("reason[x]")) 1137 this.reason = (Type) value; // Type 1138 else if (name.equals("scheduled[x]")) 1139 this.scheduled = (Type) value; // Type 1140 else if (name.equals("encounter")) 1141 this.encounter = castToReference(value); // Reference 1142 else if (name.equals("performer")) 1143 this.performer = castToReference(value); // Reference 1144 else if (name.equals("status")) 1145 this.status = new ProcedureRequestStatusEnumFactory().fromType(value); // Enumeration<ProcedureRequestStatus> 1146 else if (name.equals("notes")) 1147 this.getNotes().add(castToAnnotation(value)); 1148 else if (name.equals("asNeeded[x]")) 1149 this.asNeeded = (Type) value; // Type 1150 else if (name.equals("orderedOn")) 1151 this.orderedOn = castToDateTime(value); // DateTimeType 1152 else if (name.equals("orderer")) 1153 this.orderer = castToReference(value); // Reference 1154 else if (name.equals("priority")) 1155 this.priority = new ProcedureRequestPriorityEnumFactory().fromType(value); // Enumeration<ProcedureRequestPriority> 1156 else 1157 super.setProperty(name, value); 1158 } 1159 1160 @Override 1161 public Base addChild(String name) throws FHIRException { 1162 if (name.equals("identifier")) { 1163 return addIdentifier(); 1164 } 1165 else if (name.equals("subject")) { 1166 this.subject = new Reference(); 1167 return this.subject; 1168 } 1169 else if (name.equals("code")) { 1170 this.code = new CodeableConcept(); 1171 return this.code; 1172 } 1173 else if (name.equals("bodySite")) { 1174 return addBodySite(); 1175 } 1176 else if (name.equals("reasonCodeableConcept")) { 1177 this.reason = new CodeableConcept(); 1178 return this.reason; 1179 } 1180 else if (name.equals("reasonReference")) { 1181 this.reason = new Reference(); 1182 return this.reason; 1183 } 1184 else if (name.equals("scheduledDateTime")) { 1185 this.scheduled = new DateTimeType(); 1186 return this.scheduled; 1187 } 1188 else if (name.equals("scheduledPeriod")) { 1189 this.scheduled = new Period(); 1190 return this.scheduled; 1191 } 1192 else if (name.equals("scheduledTiming")) { 1193 this.scheduled = new Timing(); 1194 return this.scheduled; 1195 } 1196 else if (name.equals("encounter")) { 1197 this.encounter = new Reference(); 1198 return this.encounter; 1199 } 1200 else if (name.equals("performer")) { 1201 this.performer = new Reference(); 1202 return this.performer; 1203 } 1204 else if (name.equals("status")) { 1205 throw new FHIRException("Cannot call addChild on a primitive type ProcedureRequest.status"); 1206 } 1207 else if (name.equals("notes")) { 1208 return addNotes(); 1209 } 1210 else if (name.equals("asNeededBoolean")) { 1211 this.asNeeded = new BooleanType(); 1212 return this.asNeeded; 1213 } 1214 else if (name.equals("asNeededCodeableConcept")) { 1215 this.asNeeded = new CodeableConcept(); 1216 return this.asNeeded; 1217 } 1218 else if (name.equals("orderedOn")) { 1219 throw new FHIRException("Cannot call addChild on a primitive type ProcedureRequest.orderedOn"); 1220 } 1221 else if (name.equals("orderer")) { 1222 this.orderer = new Reference(); 1223 return this.orderer; 1224 } 1225 else if (name.equals("priority")) { 1226 throw new FHIRException("Cannot call addChild on a primitive type ProcedureRequest.priority"); 1227 } 1228 else 1229 return super.addChild(name); 1230 } 1231 1232 public String fhirType() { 1233 return "ProcedureRequest"; 1234 1235 } 1236 1237 public ProcedureRequest copy() { 1238 ProcedureRequest dst = new ProcedureRequest(); 1239 copyValues(dst); 1240 if (identifier != null) { 1241 dst.identifier = new ArrayList<Identifier>(); 1242 for (Identifier i : identifier) 1243 dst.identifier.add(i.copy()); 1244 }; 1245 dst.subject = subject == null ? null : subject.copy(); 1246 dst.code = code == null ? null : code.copy(); 1247 if (bodySite != null) { 1248 dst.bodySite = new ArrayList<CodeableConcept>(); 1249 for (CodeableConcept i : bodySite) 1250 dst.bodySite.add(i.copy()); 1251 }; 1252 dst.reason = reason == null ? null : reason.copy(); 1253 dst.scheduled = scheduled == null ? null : scheduled.copy(); 1254 dst.encounter = encounter == null ? null : encounter.copy(); 1255 dst.performer = performer == null ? null : performer.copy(); 1256 dst.status = status == null ? null : status.copy(); 1257 if (notes != null) { 1258 dst.notes = new ArrayList<Annotation>(); 1259 for (Annotation i : notes) 1260 dst.notes.add(i.copy()); 1261 }; 1262 dst.asNeeded = asNeeded == null ? null : asNeeded.copy(); 1263 dst.orderedOn = orderedOn == null ? null : orderedOn.copy(); 1264 dst.orderer = orderer == null ? null : orderer.copy(); 1265 dst.priority = priority == null ? null : priority.copy(); 1266 return dst; 1267 } 1268 1269 protected ProcedureRequest typedCopy() { 1270 return copy(); 1271 } 1272 1273 @Override 1274 public boolean equalsDeep(Base other) { 1275 if (!super.equalsDeep(other)) 1276 return false; 1277 if (!(other instanceof ProcedureRequest)) 1278 return false; 1279 ProcedureRequest o = (ProcedureRequest) other; 1280 return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(code, o.code, true) 1281 && compareDeep(bodySite, o.bodySite, true) && compareDeep(reason, o.reason, true) && compareDeep(scheduled, o.scheduled, true) 1282 && compareDeep(encounter, o.encounter, true) && compareDeep(performer, o.performer, true) && compareDeep(status, o.status, true) 1283 && compareDeep(notes, o.notes, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(orderedOn, o.orderedOn, true) 1284 && compareDeep(orderer, o.orderer, true) && compareDeep(priority, o.priority, true); 1285 } 1286 1287 @Override 1288 public boolean equalsShallow(Base other) { 1289 if (!super.equalsShallow(other)) 1290 return false; 1291 if (!(other instanceof ProcedureRequest)) 1292 return false; 1293 ProcedureRequest o = (ProcedureRequest) other; 1294 return compareValues(status, o.status, true) && compareValues(orderedOn, o.orderedOn, true) && compareValues(priority, o.priority, true) 1295 ; 1296 } 1297 1298 public boolean isEmpty() { 1299 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (subject == null || subject.isEmpty()) 1300 && (code == null || code.isEmpty()) && (bodySite == null || bodySite.isEmpty()) && (reason == null || reason.isEmpty()) 1301 && (scheduled == null || scheduled.isEmpty()) && (encounter == null || encounter.isEmpty()) 1302 && (performer == null || performer.isEmpty()) && (status == null || status.isEmpty()) && (notes == null || notes.isEmpty()) 1303 && (asNeeded == null || asNeeded.isEmpty()) && (orderedOn == null || orderedOn.isEmpty()) 1304 && (orderer == null || orderer.isEmpty()) && (priority == null || priority.isEmpty()); 1305 } 1306 1307 @Override 1308 public ResourceType getResourceType() { 1309 return ResourceType.ProcedureRequest; 1310 } 1311 1312 @SearchParamDefinition(name="identifier", path="ProcedureRequest.identifier", description="A unique identifier of the Procedure Request", type="token" ) 1313 public static final String SP_IDENTIFIER = "identifier"; 1314 @SearchParamDefinition(name="performer", path="ProcedureRequest.performer", description="Who should perform the procedure", type="reference" ) 1315 public static final String SP_PERFORMER = "performer"; 1316 @SearchParamDefinition(name="subject", path="ProcedureRequest.subject", description="Search by subject", type="reference" ) 1317 public static final String SP_SUBJECT = "subject"; 1318 @SearchParamDefinition(name="patient", path="ProcedureRequest.subject", description="Search by subject - a patient", type="reference" ) 1319 public static final String SP_PATIENT = "patient"; 1320 @SearchParamDefinition(name="orderer", path="ProcedureRequest.orderer", description="Who made request", type="reference" ) 1321 public static final String SP_ORDERER = "orderer"; 1322 @SearchParamDefinition(name="encounter", path="ProcedureRequest.encounter", description="Encounter request created during", type="reference" ) 1323 public static final String SP_ENCOUNTER = "encounter"; 1324 1325} 1326