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