001package org.hl7.fhir.dstu2.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.ArrayList; 034import java.util.Date; 035import java.util.List; 036 037import ca.uhn.fhir.model.api.annotation.Child; 038import ca.uhn.fhir.model.api.annotation.Description; 039import ca.uhn.fhir.model.api.annotation.ResourceDef; 040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 041import org.hl7.fhir.exceptions.FHIRException; 042import org.hl7.fhir.utilities.Utilities; 043 044/** 045 * A response to an order. 046 */ 047@ResourceDef(name = "OrderResponse", profile = "http://hl7.org/fhir/Profile/OrderResponse") 048public class OrderResponse extends DomainResource { 049 050 public enum OrderStatus { 051 /** 052 * The order is known, but no processing has occurred at this time 053 */ 054 PENDING, 055 /** 056 * The order is undergoing initial processing to determine whether it will be 057 * accepted (usually this involves human review) 058 */ 059 REVIEW, 060 /** 061 * The order was rejected because of a workflow/business logic reason 062 */ 063 REJECTED, 064 /** 065 * The order was unable to be processed because of a technical error (i.e. 066 * unexpected error) 067 */ 068 ERROR, 069 /** 070 * The order has been accepted, and work is in progress. 071 */ 072 ACCEPTED, 073 /** 074 * Processing the order was halted at the initiators request. 075 */ 076 CANCELLED, 077 /** 078 * The order has been cancelled and replaced by another. 079 */ 080 REPLACED, 081 /** 082 * Processing the order was stopped because of some workflow/business logic 083 * reason. 084 */ 085 ABORTED, 086 /** 087 * The order has been completed. 088 */ 089 COMPLETED, 090 /** 091 * added to help the parsers 092 */ 093 NULL; 094 095 public static OrderStatus fromCode(String codeString) throws FHIRException { 096 if (codeString == null || "".equals(codeString)) 097 return null; 098 if ("pending".equals(codeString)) 099 return PENDING; 100 if ("review".equals(codeString)) 101 return REVIEW; 102 if ("rejected".equals(codeString)) 103 return REJECTED; 104 if ("error".equals(codeString)) 105 return ERROR; 106 if ("accepted".equals(codeString)) 107 return ACCEPTED; 108 if ("cancelled".equals(codeString)) 109 return CANCELLED; 110 if ("replaced".equals(codeString)) 111 return REPLACED; 112 if ("aborted".equals(codeString)) 113 return ABORTED; 114 if ("completed".equals(codeString)) 115 return COMPLETED; 116 throw new FHIRException("Unknown OrderStatus code '" + codeString + "'"); 117 } 118 119 public String toCode() { 120 switch (this) { 121 case PENDING: 122 return "pending"; 123 case REVIEW: 124 return "review"; 125 case REJECTED: 126 return "rejected"; 127 case ERROR: 128 return "error"; 129 case ACCEPTED: 130 return "accepted"; 131 case CANCELLED: 132 return "cancelled"; 133 case REPLACED: 134 return "replaced"; 135 case ABORTED: 136 return "aborted"; 137 case COMPLETED: 138 return "completed"; 139 case NULL: 140 return null; 141 default: 142 return "?"; 143 } 144 } 145 146 public String getSystem() { 147 switch (this) { 148 case PENDING: 149 return "http://hl7.org/fhir/order-status"; 150 case REVIEW: 151 return "http://hl7.org/fhir/order-status"; 152 case REJECTED: 153 return "http://hl7.org/fhir/order-status"; 154 case ERROR: 155 return "http://hl7.org/fhir/order-status"; 156 case ACCEPTED: 157 return "http://hl7.org/fhir/order-status"; 158 case CANCELLED: 159 return "http://hl7.org/fhir/order-status"; 160 case REPLACED: 161 return "http://hl7.org/fhir/order-status"; 162 case ABORTED: 163 return "http://hl7.org/fhir/order-status"; 164 case COMPLETED: 165 return "http://hl7.org/fhir/order-status"; 166 case NULL: 167 return null; 168 default: 169 return "?"; 170 } 171 } 172 173 public String getDefinition() { 174 switch (this) { 175 case PENDING: 176 return "The order is known, but no processing has occurred at this time"; 177 case REVIEW: 178 return "The order is undergoing initial processing to determine whether it will be accepted (usually this involves human review)"; 179 case REJECTED: 180 return "The order was rejected because of a workflow/business logic reason"; 181 case ERROR: 182 return "The order was unable to be processed because of a technical error (i.e. unexpected error)"; 183 case ACCEPTED: 184 return "The order has been accepted, and work is in progress."; 185 case CANCELLED: 186 return "Processing the order was halted at the initiators request."; 187 case REPLACED: 188 return "The order has been cancelled and replaced by another."; 189 case ABORTED: 190 return "Processing the order was stopped because of some workflow/business logic reason."; 191 case COMPLETED: 192 return "The order has been completed."; 193 case NULL: 194 return null; 195 default: 196 return "?"; 197 } 198 } 199 200 public String getDisplay() { 201 switch (this) { 202 case PENDING: 203 return "Pending"; 204 case REVIEW: 205 return "Review"; 206 case REJECTED: 207 return "Rejected"; 208 case ERROR: 209 return "Error"; 210 case ACCEPTED: 211 return "Accepted"; 212 case CANCELLED: 213 return "Cancelled"; 214 case REPLACED: 215 return "Replaced"; 216 case ABORTED: 217 return "Aborted"; 218 case COMPLETED: 219 return "Completed"; 220 case NULL: 221 return null; 222 default: 223 return "?"; 224 } 225 } 226 } 227 228 public static class OrderStatusEnumFactory implements EnumFactory<OrderStatus> { 229 public OrderStatus fromCode(String codeString) throws IllegalArgumentException { 230 if (codeString == null || "".equals(codeString)) 231 if (codeString == null || "".equals(codeString)) 232 return null; 233 if ("pending".equals(codeString)) 234 return OrderStatus.PENDING; 235 if ("review".equals(codeString)) 236 return OrderStatus.REVIEW; 237 if ("rejected".equals(codeString)) 238 return OrderStatus.REJECTED; 239 if ("error".equals(codeString)) 240 return OrderStatus.ERROR; 241 if ("accepted".equals(codeString)) 242 return OrderStatus.ACCEPTED; 243 if ("cancelled".equals(codeString)) 244 return OrderStatus.CANCELLED; 245 if ("replaced".equals(codeString)) 246 return OrderStatus.REPLACED; 247 if ("aborted".equals(codeString)) 248 return OrderStatus.ABORTED; 249 if ("completed".equals(codeString)) 250 return OrderStatus.COMPLETED; 251 throw new IllegalArgumentException("Unknown OrderStatus code '" + codeString + "'"); 252 } 253 254 public Enumeration<OrderStatus> fromType(Base code) throws FHIRException { 255 if (code == null || code.isEmpty()) 256 return null; 257 String codeString = ((PrimitiveType) code).asStringValue(); 258 if (codeString == null || "".equals(codeString)) 259 return null; 260 if ("pending".equals(codeString)) 261 return new Enumeration<OrderStatus>(this, OrderStatus.PENDING); 262 if ("review".equals(codeString)) 263 return new Enumeration<OrderStatus>(this, OrderStatus.REVIEW); 264 if ("rejected".equals(codeString)) 265 return new Enumeration<OrderStatus>(this, OrderStatus.REJECTED); 266 if ("error".equals(codeString)) 267 return new Enumeration<OrderStatus>(this, OrderStatus.ERROR); 268 if ("accepted".equals(codeString)) 269 return new Enumeration<OrderStatus>(this, OrderStatus.ACCEPTED); 270 if ("cancelled".equals(codeString)) 271 return new Enumeration<OrderStatus>(this, OrderStatus.CANCELLED); 272 if ("replaced".equals(codeString)) 273 return new Enumeration<OrderStatus>(this, OrderStatus.REPLACED); 274 if ("aborted".equals(codeString)) 275 return new Enumeration<OrderStatus>(this, OrderStatus.ABORTED); 276 if ("completed".equals(codeString)) 277 return new Enumeration<OrderStatus>(this, OrderStatus.COMPLETED); 278 throw new FHIRException("Unknown OrderStatus code '" + codeString + "'"); 279 } 280 281 public String toCode(OrderStatus code) { 282 if (code == OrderStatus.PENDING) 283 return "pending"; 284 if (code == OrderStatus.REVIEW) 285 return "review"; 286 if (code == OrderStatus.REJECTED) 287 return "rejected"; 288 if (code == OrderStatus.ERROR) 289 return "error"; 290 if (code == OrderStatus.ACCEPTED) 291 return "accepted"; 292 if (code == OrderStatus.CANCELLED) 293 return "cancelled"; 294 if (code == OrderStatus.REPLACED) 295 return "replaced"; 296 if (code == OrderStatus.ABORTED) 297 return "aborted"; 298 if (code == OrderStatus.COMPLETED) 299 return "completed"; 300 return "?"; 301 } 302 } 303 304 /** 305 * Identifiers assigned to this order. The identifiers are usually assigned by 306 * the system responding to the order, but they may be provided or added to by 307 * other systems. 308 */ 309 @Child(name = "identifier", type = { 310 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 311 @Description(shortDefinition = "Identifiers assigned to this order by the orderer or by the receiver", formalDefinition = "Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.") 312 protected List<Identifier> identifier; 313 314 /** 315 * A reference to the order that this is in response to. 316 */ 317 @Child(name = "request", type = { Order.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 318 @Description(shortDefinition = "The order that this is a response to", formalDefinition = "A reference to the order that this is in response to.") 319 protected Reference request; 320 321 /** 322 * The actual object that is the target of the reference (A reference to the 323 * order that this is in response to.) 324 */ 325 protected Order requestTarget; 326 327 /** 328 * The date and time at which this order response was made (created/posted). 329 */ 330 @Child(name = "date", type = { DateTimeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 331 @Description(shortDefinition = "When the response was made", formalDefinition = "The date and time at which this order response was made (created/posted).") 332 protected DateTimeType date; 333 334 /** 335 * The person, organization, or device credited with making the response. 336 */ 337 @Child(name = "who", type = { Practitioner.class, Organization.class, 338 Device.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 339 @Description(shortDefinition = "Who made the response", formalDefinition = "The person, organization, or device credited with making the response.") 340 protected Reference who; 341 342 /** 343 * The actual object that is the target of the reference (The person, 344 * organization, or device credited with making the response.) 345 */ 346 protected Resource whoTarget; 347 348 /** 349 * What this response says about the status of the original order. 350 */ 351 @Child(name = "orderStatus", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = true, summary = true) 352 @Description(shortDefinition = "pending | review | rejected | error | accepted | cancelled | replaced | aborted | completed", formalDefinition = "What this response says about the status of the original order.") 353 protected Enumeration<OrderStatus> orderStatus; 354 355 /** 356 * Additional description about the response - e.g. a text description provided 357 * by a human user when making decisions about the order. 358 */ 359 @Child(name = "description", type = { 360 StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 361 @Description(shortDefinition = "Additional description of the response", formalDefinition = "Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.") 362 protected StringType description; 363 364 /** 365 * Links to resources that provide details of the outcome of performing the 366 * order; e.g. Diagnostic Reports in a response that is made to an order that 367 * referenced a diagnostic order. 368 */ 369 @Child(name = "fulfillment", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 370 @Description(shortDefinition = "Details of the outcome of performing the order", formalDefinition = "Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.") 371 protected List<Reference> fulfillment; 372 /** 373 * The actual objects that are the target of the reference (Links to resources 374 * that provide details of the outcome of performing the order; e.g. Diagnostic 375 * Reports in a response that is made to an order that referenced a diagnostic 376 * order.) 377 */ 378 protected List<Resource> fulfillmentTarget; 379 380 private static final long serialVersionUID = -856633109L; 381 382 /* 383 * Constructor 384 */ 385 public OrderResponse() { 386 super(); 387 } 388 389 /* 390 * Constructor 391 */ 392 public OrderResponse(Reference request, Enumeration<OrderStatus> orderStatus) { 393 super(); 394 this.request = request; 395 this.orderStatus = orderStatus; 396 } 397 398 /** 399 * @return {@link #identifier} (Identifiers assigned to this order. The 400 * identifiers are usually assigned by the system responding to the 401 * order, but they may be provided or added to by other systems.) 402 */ 403 public List<Identifier> getIdentifier() { 404 if (this.identifier == null) 405 this.identifier = new ArrayList<Identifier>(); 406 return this.identifier; 407 } 408 409 public boolean hasIdentifier() { 410 if (this.identifier == null) 411 return false; 412 for (Identifier item : this.identifier) 413 if (!item.isEmpty()) 414 return true; 415 return false; 416 } 417 418 /** 419 * @return {@link #identifier} (Identifiers assigned to this order. The 420 * identifiers are usually assigned by the system responding to the 421 * order, but they may be provided or added to by other systems.) 422 */ 423 // syntactic sugar 424 public Identifier addIdentifier() { // 3 425 Identifier t = new Identifier(); 426 if (this.identifier == null) 427 this.identifier = new ArrayList<Identifier>(); 428 this.identifier.add(t); 429 return t; 430 } 431 432 // syntactic sugar 433 public OrderResponse addIdentifier(Identifier t) { // 3 434 if (t == null) 435 return this; 436 if (this.identifier == null) 437 this.identifier = new ArrayList<Identifier>(); 438 this.identifier.add(t); 439 return this; 440 } 441 442 /** 443 * @return {@link #request} (A reference to the order that this is in response 444 * to.) 445 */ 446 public Reference getRequest() { 447 if (this.request == null) 448 if (Configuration.errorOnAutoCreate()) 449 throw new Error("Attempt to auto-create OrderResponse.request"); 450 else if (Configuration.doAutoCreate()) 451 this.request = new Reference(); // cc 452 return this.request; 453 } 454 455 public boolean hasRequest() { 456 return this.request != null && !this.request.isEmpty(); 457 } 458 459 /** 460 * @param value {@link #request} (A reference to the order that this is in 461 * response to.) 462 */ 463 public OrderResponse setRequest(Reference value) { 464 this.request = value; 465 return this; 466 } 467 468 /** 469 * @return {@link #request} The actual object that is the target of the 470 * reference. The reference library doesn't populate this, but you can 471 * use it to hold the resource if you resolve it. (A reference to the 472 * order that this is in response to.) 473 */ 474 public Order getRequestTarget() { 475 if (this.requestTarget == null) 476 if (Configuration.errorOnAutoCreate()) 477 throw new Error("Attempt to auto-create OrderResponse.request"); 478 else if (Configuration.doAutoCreate()) 479 this.requestTarget = new Order(); // aa 480 return this.requestTarget; 481 } 482 483 /** 484 * @param value {@link #request} The actual object that is the target of the 485 * reference. The reference library doesn't use these, but you can 486 * use it to hold the resource if you resolve it. (A reference to 487 * the order that this is in response to.) 488 */ 489 public OrderResponse setRequestTarget(Order value) { 490 this.requestTarget = value; 491 return this; 492 } 493 494 /** 495 * @return {@link #date} (The date and time at which this order response was 496 * made (created/posted).). This is the underlying object with id, value 497 * and extensions. The accessor "getDate" gives direct access to the 498 * value 499 */ 500 public DateTimeType getDateElement() { 501 if (this.date == null) 502 if (Configuration.errorOnAutoCreate()) 503 throw new Error("Attempt to auto-create OrderResponse.date"); 504 else if (Configuration.doAutoCreate()) 505 this.date = new DateTimeType(); // bb 506 return this.date; 507 } 508 509 public boolean hasDateElement() { 510 return this.date != null && !this.date.isEmpty(); 511 } 512 513 public boolean hasDate() { 514 return this.date != null && !this.date.isEmpty(); 515 } 516 517 /** 518 * @param value {@link #date} (The date and time at which this order response 519 * was made (created/posted).). This is the underlying object with 520 * id, value and extensions. The accessor "getDate" gives direct 521 * access to the value 522 */ 523 public OrderResponse setDateElement(DateTimeType value) { 524 this.date = value; 525 return this; 526 } 527 528 /** 529 * @return The date and time at which this order response was made 530 * (created/posted). 531 */ 532 public Date getDate() { 533 return this.date == null ? null : this.date.getValue(); 534 } 535 536 /** 537 * @param value The date and time at which this order response was made 538 * (created/posted). 539 */ 540 public OrderResponse setDate(Date value) { 541 if (value == null) 542 this.date = null; 543 else { 544 if (this.date == null) 545 this.date = new DateTimeType(); 546 this.date.setValue(value); 547 } 548 return this; 549 } 550 551 /** 552 * @return {@link #who} (The person, organization, or device credited with 553 * making the response.) 554 */ 555 public Reference getWho() { 556 if (this.who == null) 557 if (Configuration.errorOnAutoCreate()) 558 throw new Error("Attempt to auto-create OrderResponse.who"); 559 else if (Configuration.doAutoCreate()) 560 this.who = new Reference(); // cc 561 return this.who; 562 } 563 564 public boolean hasWho() { 565 return this.who != null && !this.who.isEmpty(); 566 } 567 568 /** 569 * @param value {@link #who} (The person, organization, or device credited with 570 * making the response.) 571 */ 572 public OrderResponse setWho(Reference value) { 573 this.who = value; 574 return this; 575 } 576 577 /** 578 * @return {@link #who} The actual object that is the target of the reference. 579 * The reference library doesn't populate this, but you can use it to 580 * hold the resource if you resolve it. (The person, organization, or 581 * device credited with making the response.) 582 */ 583 public Resource getWhoTarget() { 584 return this.whoTarget; 585 } 586 587 /** 588 * @param value {@link #who} The actual object that is the target of the 589 * reference. The reference library doesn't use these, but you can 590 * use it to hold the resource if you resolve it. (The person, 591 * organization, or device credited with making the response.) 592 */ 593 public OrderResponse setWhoTarget(Resource value) { 594 this.whoTarget = value; 595 return this; 596 } 597 598 /** 599 * @return {@link #orderStatus} (What this response says about the status of the 600 * original order.). This is the underlying object with id, value and 601 * extensions. The accessor "getOrderStatus" gives direct access to the 602 * value 603 */ 604 public Enumeration<OrderStatus> getOrderStatusElement() { 605 if (this.orderStatus == null) 606 if (Configuration.errorOnAutoCreate()) 607 throw new Error("Attempt to auto-create OrderResponse.orderStatus"); 608 else if (Configuration.doAutoCreate()) 609 this.orderStatus = new Enumeration<OrderStatus>(new OrderStatusEnumFactory()); // bb 610 return this.orderStatus; 611 } 612 613 public boolean hasOrderStatusElement() { 614 return this.orderStatus != null && !this.orderStatus.isEmpty(); 615 } 616 617 public boolean hasOrderStatus() { 618 return this.orderStatus != null && !this.orderStatus.isEmpty(); 619 } 620 621 /** 622 * @param value {@link #orderStatus} (What this response says about the status 623 * of the original order.). This is the underlying object with id, 624 * value and extensions. The accessor "getOrderStatus" gives direct 625 * access to the value 626 */ 627 public OrderResponse setOrderStatusElement(Enumeration<OrderStatus> value) { 628 this.orderStatus = value; 629 return this; 630 } 631 632 /** 633 * @return What this response says about the status of the original order. 634 */ 635 public OrderStatus getOrderStatus() { 636 return this.orderStatus == null ? null : this.orderStatus.getValue(); 637 } 638 639 /** 640 * @param value What this response says about the status of the original order. 641 */ 642 public OrderResponse setOrderStatus(OrderStatus value) { 643 if (this.orderStatus == null) 644 this.orderStatus = new Enumeration<OrderStatus>(new OrderStatusEnumFactory()); 645 this.orderStatus.setValue(value); 646 return this; 647 } 648 649 /** 650 * @return {@link #description} (Additional description about the response - 651 * e.g. a text description provided by a human user when making 652 * decisions about the order.). This is the underlying object with id, 653 * value and extensions. The accessor "getDescription" gives direct 654 * access to the value 655 */ 656 public StringType getDescriptionElement() { 657 if (this.description == null) 658 if (Configuration.errorOnAutoCreate()) 659 throw new Error("Attempt to auto-create OrderResponse.description"); 660 else if (Configuration.doAutoCreate()) 661 this.description = new StringType(); // bb 662 return this.description; 663 } 664 665 public boolean hasDescriptionElement() { 666 return this.description != null && !this.description.isEmpty(); 667 } 668 669 public boolean hasDescription() { 670 return this.description != null && !this.description.isEmpty(); 671 } 672 673 /** 674 * @param value {@link #description} (Additional description about the response 675 * - e.g. a text description provided by a human user when making 676 * decisions about the order.). This is the underlying object with 677 * id, value and extensions. The accessor "getDescription" gives 678 * direct access to the value 679 */ 680 public OrderResponse setDescriptionElement(StringType value) { 681 this.description = value; 682 return this; 683 } 684 685 /** 686 * @return Additional description about the response - e.g. a text description 687 * provided by a human user when making decisions about the order. 688 */ 689 public String getDescription() { 690 return this.description == null ? null : this.description.getValue(); 691 } 692 693 /** 694 * @param value Additional description about the response - e.g. a text 695 * description provided by a human user when making decisions about 696 * the order. 697 */ 698 public OrderResponse setDescription(String value) { 699 if (Utilities.noString(value)) 700 this.description = null; 701 else { 702 if (this.description == null) 703 this.description = new StringType(); 704 this.description.setValue(value); 705 } 706 return this; 707 } 708 709 /** 710 * @return {@link #fulfillment} (Links to resources that provide details of the 711 * outcome of performing the order; e.g. Diagnostic Reports in a 712 * response that is made to an order that referenced a diagnostic 713 * order.) 714 */ 715 public List<Reference> getFulfillment() { 716 if (this.fulfillment == null) 717 this.fulfillment = new ArrayList<Reference>(); 718 return this.fulfillment; 719 } 720 721 public boolean hasFulfillment() { 722 if (this.fulfillment == null) 723 return false; 724 for (Reference item : this.fulfillment) 725 if (!item.isEmpty()) 726 return true; 727 return false; 728 } 729 730 /** 731 * @return {@link #fulfillment} (Links to resources that provide details of the 732 * outcome of performing the order; e.g. Diagnostic Reports in a 733 * response that is made to an order that referenced a diagnostic 734 * order.) 735 */ 736 // syntactic sugar 737 public Reference addFulfillment() { // 3 738 Reference t = new Reference(); 739 if (this.fulfillment == null) 740 this.fulfillment = new ArrayList<Reference>(); 741 this.fulfillment.add(t); 742 return t; 743 } 744 745 // syntactic sugar 746 public OrderResponse addFulfillment(Reference t) { // 3 747 if (t == null) 748 return this; 749 if (this.fulfillment == null) 750 this.fulfillment = new ArrayList<Reference>(); 751 this.fulfillment.add(t); 752 return this; 753 } 754 755 /** 756 * @return {@link #fulfillment} (The actual objects that are the target of the 757 * reference. The reference library doesn't populate this, but you can 758 * use this to hold the resources if you resolvethemt. Links to 759 * resources that provide details of the outcome of performing the 760 * order; e.g. Diagnostic Reports in a response that is made to an order 761 * that referenced a diagnostic order.) 762 */ 763 public List<Resource> getFulfillmentTarget() { 764 if (this.fulfillmentTarget == null) 765 this.fulfillmentTarget = new ArrayList<Resource>(); 766 return this.fulfillmentTarget; 767 } 768 769 protected void listChildren(List<Property> childrenList) { 770 super.listChildren(childrenList); 771 childrenList.add(new Property("identifier", "Identifier", 772 "Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.", 773 0, java.lang.Integer.MAX_VALUE, identifier)); 774 childrenList.add(new Property("request", "Reference(Order)", 775 "A reference to the order that this is in response to.", 0, java.lang.Integer.MAX_VALUE, request)); 776 childrenList.add( 777 new Property("date", "dateTime", "The date and time at which this order response was made (created/posted).", 0, 778 java.lang.Integer.MAX_VALUE, date)); 779 childrenList.add(new Property("who", "Reference(Practitioner|Organization|Device)", 780 "The person, organization, or device credited with making the response.", 0, java.lang.Integer.MAX_VALUE, who)); 781 childrenList 782 .add(new Property("orderStatus", "code", "What this response says about the status of the original order.", 0, 783 java.lang.Integer.MAX_VALUE, orderStatus)); 784 childrenList.add(new Property("description", "string", 785 "Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.", 786 0, java.lang.Integer.MAX_VALUE, description)); 787 childrenList.add(new Property("fulfillment", "Reference(Any)", 788 "Links to resources that provide details of the outcome of performing the order; e.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.", 789 0, java.lang.Integer.MAX_VALUE, fulfillment)); 790 } 791 792 @Override 793 public void setProperty(String name, Base value) throws FHIRException { 794 if (name.equals("identifier")) 795 this.getIdentifier().add(castToIdentifier(value)); 796 else if (name.equals("request")) 797 this.request = castToReference(value); // Reference 798 else if (name.equals("date")) 799 this.date = castToDateTime(value); // DateTimeType 800 else if (name.equals("who")) 801 this.who = castToReference(value); // Reference 802 else if (name.equals("orderStatus")) 803 this.orderStatus = new OrderStatusEnumFactory().fromType(value); // Enumeration<OrderStatus> 804 else if (name.equals("description")) 805 this.description = castToString(value); // StringType 806 else if (name.equals("fulfillment")) 807 this.getFulfillment().add(castToReference(value)); 808 else 809 super.setProperty(name, value); 810 } 811 812 @Override 813 public Base addChild(String name) throws FHIRException { 814 if (name.equals("identifier")) { 815 return addIdentifier(); 816 } else if (name.equals("request")) { 817 this.request = new Reference(); 818 return this.request; 819 } else if (name.equals("date")) { 820 throw new FHIRException("Cannot call addChild on a singleton property OrderResponse.date"); 821 } else if (name.equals("who")) { 822 this.who = new Reference(); 823 return this.who; 824 } else if (name.equals("orderStatus")) { 825 throw new FHIRException("Cannot call addChild on a singleton property OrderResponse.orderStatus"); 826 } else if (name.equals("description")) { 827 throw new FHIRException("Cannot call addChild on a singleton property OrderResponse.description"); 828 } else if (name.equals("fulfillment")) { 829 return addFulfillment(); 830 } else 831 return super.addChild(name); 832 } 833 834 public String fhirType() { 835 return "OrderResponse"; 836 837 } 838 839 public OrderResponse copy() { 840 OrderResponse dst = new OrderResponse(); 841 copyValues(dst); 842 if (identifier != null) { 843 dst.identifier = new ArrayList<Identifier>(); 844 for (Identifier i : identifier) 845 dst.identifier.add(i.copy()); 846 } 847 ; 848 dst.request = request == null ? null : request.copy(); 849 dst.date = date == null ? null : date.copy(); 850 dst.who = who == null ? null : who.copy(); 851 dst.orderStatus = orderStatus == null ? null : orderStatus.copy(); 852 dst.description = description == null ? null : description.copy(); 853 if (fulfillment != null) { 854 dst.fulfillment = new ArrayList<Reference>(); 855 for (Reference i : fulfillment) 856 dst.fulfillment.add(i.copy()); 857 } 858 ; 859 return dst; 860 } 861 862 protected OrderResponse typedCopy() { 863 return copy(); 864 } 865 866 @Override 867 public boolean equalsDeep(Base other) { 868 if (!super.equalsDeep(other)) 869 return false; 870 if (!(other instanceof OrderResponse)) 871 return false; 872 OrderResponse o = (OrderResponse) other; 873 return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) 874 && compareDeep(date, o.date, true) && compareDeep(who, o.who, true) 875 && compareDeep(orderStatus, o.orderStatus, true) && compareDeep(description, o.description, true) 876 && compareDeep(fulfillment, o.fulfillment, true); 877 } 878 879 @Override 880 public boolean equalsShallow(Base other) { 881 if (!super.equalsShallow(other)) 882 return false; 883 if (!(other instanceof OrderResponse)) 884 return false; 885 OrderResponse o = (OrderResponse) other; 886 return compareValues(date, o.date, true) && compareValues(orderStatus, o.orderStatus, true) 887 && compareValues(description, o.description, true); 888 } 889 890 public boolean isEmpty() { 891 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty()) 892 && (date == null || date.isEmpty()) && (who == null || who.isEmpty()) 893 && (orderStatus == null || orderStatus.isEmpty()) && (description == null || description.isEmpty()) 894 && (fulfillment == null || fulfillment.isEmpty()); 895 } 896 897 @Override 898 public ResourceType getResourceType() { 899 return ResourceType.OrderResponse; 900 } 901 902 @SearchParamDefinition(name = "date", path = "OrderResponse.date", description = "When the response was made", type = "date") 903 public static final String SP_DATE = "date"; 904 @SearchParamDefinition(name = "request", path = "OrderResponse.request", description = "The order that this is a response to", type = "reference") 905 public static final String SP_REQUEST = "request"; 906 @SearchParamDefinition(name = "identifier", path = "OrderResponse.identifier", description = "Identifiers assigned to this order by the orderer or by the receiver", type = "token") 907 public static final String SP_IDENTIFIER = "identifier"; 908 @SearchParamDefinition(name = "code", path = "OrderResponse.orderStatus", description = "pending | review | rejected | error | accepted | cancelled | replaced | aborted | completed", type = "token") 909 public static final String SP_CODE = "code"; 910 @SearchParamDefinition(name = "fulfillment", path = "OrderResponse.fulfillment", description = "Details of the outcome of performing the order", type = "reference") 911 public static final String SP_FULFILLMENT = "fulfillment"; 912 @SearchParamDefinition(name = "who", path = "OrderResponse.who", description = "Who made the response", type = "reference") 913 public static final String SP_WHO = "who"; 914 915}