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