001package org.hl7.fhir.dstu2.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023 024/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, 034 this list of conditions and the following disclaimer in the documentation 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 049 POSSIBILITY OF SUCH DAMAGE. 050 051*/ 052 053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 057 058import ca.uhn.fhir.model.api.annotation.Block; 059import ca.uhn.fhir.model.api.annotation.Child; 060import ca.uhn.fhir.model.api.annotation.Description; 061import ca.uhn.fhir.model.api.annotation.ResourceDef; 062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 063import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 064import org.hl7.fhir.exceptions.FHIRException; 065/** 066 * A request to perform an action. 067 */ 068@ResourceDef(name="Order", profile="http://hl7.org/fhir/Profile/Order") 069public class Order extends DomainResource { 070 071 @Block() 072 public static class OrderWhenComponent extends BackboneElement implements IBaseBackboneElement { 073 /** 074 * Code specifies when request should be done. The code may simply be a priority code. 075 */ 076 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 077 @Description(shortDefinition="Code specifies when request should be done. The code may simply be a priority code", formalDefinition="Code specifies when request should be done. The code may simply be a priority code." ) 078 protected CodeableConcept code; 079 080 /** 081 * A formal schedule. 082 */ 083 @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=1, modifier=false, summary=true) 084 @Description(shortDefinition="A formal schedule", formalDefinition="A formal schedule." ) 085 protected Timing schedule; 086 087 private static final long serialVersionUID = 307115287L; 088 089 /* 090 * Constructor 091 */ 092 public OrderWhenComponent() { 093 super(); 094 } 095 096 /** 097 * @return {@link #code} (Code specifies when request should be done. The code may simply be a priority code.) 098 */ 099 public CodeableConcept getCode() { 100 if (this.code == null) 101 if (Configuration.errorOnAutoCreate()) 102 throw new Error("Attempt to auto-create OrderWhenComponent.code"); 103 else if (Configuration.doAutoCreate()) 104 this.code = new CodeableConcept(); // cc 105 return this.code; 106 } 107 108 public boolean hasCode() { 109 return this.code != null && !this.code.isEmpty(); 110 } 111 112 /** 113 * @param value {@link #code} (Code specifies when request should be done. The code may simply be a priority code.) 114 */ 115 public OrderWhenComponent setCode(CodeableConcept value) { 116 this.code = value; 117 return this; 118 } 119 120 /** 121 * @return {@link #schedule} (A formal schedule.) 122 */ 123 public Timing getSchedule() { 124 if (this.schedule == null) 125 if (Configuration.errorOnAutoCreate()) 126 throw new Error("Attempt to auto-create OrderWhenComponent.schedule"); 127 else if (Configuration.doAutoCreate()) 128 this.schedule = new Timing(); // cc 129 return this.schedule; 130 } 131 132 public boolean hasSchedule() { 133 return this.schedule != null && !this.schedule.isEmpty(); 134 } 135 136 /** 137 * @param value {@link #schedule} (A formal schedule.) 138 */ 139 public OrderWhenComponent setSchedule(Timing value) { 140 this.schedule = value; 141 return this; 142 } 143 144 protected void listChildren(List<Property> childrenList) { 145 super.listChildren(childrenList); 146 childrenList.add(new Property("code", "CodeableConcept", "Code specifies when request should be done. The code may simply be a priority code.", 0, java.lang.Integer.MAX_VALUE, code)); 147 childrenList.add(new Property("schedule", "Timing", "A formal schedule.", 0, java.lang.Integer.MAX_VALUE, schedule)); 148 } 149 150 @Override 151 public void setProperty(String name, Base value) throws FHIRException { 152 if (name.equals("code")) 153 this.code = castToCodeableConcept(value); // CodeableConcept 154 else if (name.equals("schedule")) 155 this.schedule = castToTiming(value); // Timing 156 else 157 super.setProperty(name, value); 158 } 159 160 @Override 161 public Base addChild(String name) throws FHIRException { 162 if (name.equals("code")) { 163 this.code = new CodeableConcept(); 164 return this.code; 165 } 166 else if (name.equals("schedule")) { 167 this.schedule = new Timing(); 168 return this.schedule; 169 } 170 else 171 return super.addChild(name); 172 } 173 174 public OrderWhenComponent copy() { 175 OrderWhenComponent dst = new OrderWhenComponent(); 176 copyValues(dst); 177 dst.code = code == null ? null : code.copy(); 178 dst.schedule = schedule == null ? null : schedule.copy(); 179 return dst; 180 } 181 182 @Override 183 public boolean equalsDeep(Base other) { 184 if (!super.equalsDeep(other)) 185 return false; 186 if (!(other instanceof OrderWhenComponent)) 187 return false; 188 OrderWhenComponent o = (OrderWhenComponent) other; 189 return compareDeep(code, o.code, true) && compareDeep(schedule, o.schedule, true); 190 } 191 192 @Override 193 public boolean equalsShallow(Base other) { 194 if (!super.equalsShallow(other)) 195 return false; 196 if (!(other instanceof OrderWhenComponent)) 197 return false; 198 OrderWhenComponent o = (OrderWhenComponent) other; 199 return true; 200 } 201 202 public boolean isEmpty() { 203 return super.isEmpty() && (code == null || code.isEmpty()) && (schedule == null || schedule.isEmpty()) 204 ; 205 } 206 207 public String fhirType() { 208 return "Order.when"; 209 210 } 211 212 } 213 214 /** 215 * Identifiers assigned to this order by the orderer or by the receiver. 216 */ 217 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 218 @Description(shortDefinition="Identifiers assigned to this order by the orderer or by the receiver", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." ) 219 protected List<Identifier> identifier; 220 221 /** 222 * When the order was made. 223 */ 224 @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 225 @Description(shortDefinition="When the order was made", formalDefinition="When the order was made." ) 226 protected DateTimeType date; 227 228 /** 229 * Patient this order is about. 230 */ 231 @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class}, order=2, min=0, max=1, modifier=false, summary=true) 232 @Description(shortDefinition="Patient this order is about", formalDefinition="Patient this order is about." ) 233 protected Reference subject; 234 235 /** 236 * The actual object that is the target of the reference (Patient this order is about.) 237 */ 238 protected Resource subjectTarget; 239 240 /** 241 * Who initiated the order. 242 */ 243 @Child(name = "source", type = {Practitioner.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true) 244 @Description(shortDefinition="Who initiated the order", formalDefinition="Who initiated the order." ) 245 protected Reference source; 246 247 /** 248 * The actual object that is the target of the reference (Who initiated the order.) 249 */ 250 protected Resource sourceTarget; 251 252 /** 253 * Who is intended to fulfill the order. 254 */ 255 @Child(name = "target", type = {Organization.class, Device.class, Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true) 256 @Description(shortDefinition="Who is intended to fulfill the order", formalDefinition="Who is intended to fulfill the order." ) 257 protected Reference target; 258 259 /** 260 * The actual object that is the target of the reference (Who is intended to fulfill the order.) 261 */ 262 protected Resource targetTarget; 263 264 /** 265 * Text - why the order was made. 266 */ 267 @Child(name = "reason", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true) 268 @Description(shortDefinition="Text - why the order was made", formalDefinition="Text - why the order was made." ) 269 protected Type reason; 270 271 /** 272 * When order should be fulfilled. 273 */ 274 @Child(name = "when", type = {}, order=6, min=0, max=1, modifier=false, summary=true) 275 @Description(shortDefinition="When order should be fulfilled", formalDefinition="When order should be fulfilled." ) 276 protected OrderWhenComponent when; 277 278 /** 279 * What action is being ordered. 280 */ 281 @Child(name = "detail", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 282 @Description(shortDefinition="What action is being ordered", formalDefinition="What action is being ordered." ) 283 protected List<Reference> detail; 284 /** 285 * The actual objects that are the target of the reference (What action is being ordered.) 286 */ 287 protected List<Resource> detailTarget; 288 289 290 private static final long serialVersionUID = -1392311096L; 291 292 /* 293 * Constructor 294 */ 295 public Order() { 296 super(); 297 } 298 299 /** 300 * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.) 301 */ 302 public List<Identifier> getIdentifier() { 303 if (this.identifier == null) 304 this.identifier = new ArrayList<Identifier>(); 305 return this.identifier; 306 } 307 308 public boolean hasIdentifier() { 309 if (this.identifier == null) 310 return false; 311 for (Identifier item : this.identifier) 312 if (!item.isEmpty()) 313 return true; 314 return false; 315 } 316 317 /** 318 * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.) 319 */ 320 // syntactic sugar 321 public Identifier addIdentifier() { //3 322 Identifier t = new Identifier(); 323 if (this.identifier == null) 324 this.identifier = new ArrayList<Identifier>(); 325 this.identifier.add(t); 326 return t; 327 } 328 329 // syntactic sugar 330 public Order addIdentifier(Identifier t) { //3 331 if (t == null) 332 return this; 333 if (this.identifier == null) 334 this.identifier = new ArrayList<Identifier>(); 335 this.identifier.add(t); 336 return this; 337 } 338 339 /** 340 * @return {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 341 */ 342 public DateTimeType getDateElement() { 343 if (this.date == null) 344 if (Configuration.errorOnAutoCreate()) 345 throw new Error("Attempt to auto-create Order.date"); 346 else if (Configuration.doAutoCreate()) 347 this.date = new DateTimeType(); // bb 348 return this.date; 349 } 350 351 public boolean hasDateElement() { 352 return this.date != null && !this.date.isEmpty(); 353 } 354 355 public boolean hasDate() { 356 return this.date != null && !this.date.isEmpty(); 357 } 358 359 /** 360 * @param value {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 361 */ 362 public Order setDateElement(DateTimeType value) { 363 this.date = value; 364 return this; 365 } 366 367 /** 368 * @return When the order was made. 369 */ 370 public Date getDate() { 371 return this.date == null ? null : this.date.getValue(); 372 } 373 374 /** 375 * @param value When the order was made. 376 */ 377 public Order setDate(Date value) { 378 if (value == null) 379 this.date = null; 380 else { 381 if (this.date == null) 382 this.date = new DateTimeType(); 383 this.date.setValue(value); 384 } 385 return this; 386 } 387 388 /** 389 * @return {@link #subject} (Patient this order is about.) 390 */ 391 public Reference getSubject() { 392 if (this.subject == null) 393 if (Configuration.errorOnAutoCreate()) 394 throw new Error("Attempt to auto-create Order.subject"); 395 else if (Configuration.doAutoCreate()) 396 this.subject = new Reference(); // cc 397 return this.subject; 398 } 399 400 public boolean hasSubject() { 401 return this.subject != null && !this.subject.isEmpty(); 402 } 403 404 /** 405 * @param value {@link #subject} (Patient this order is about.) 406 */ 407 public Order setSubject(Reference value) { 408 this.subject = value; 409 return this; 410 } 411 412 /** 413 * @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. (Patient this order is about.) 414 */ 415 public Resource getSubjectTarget() { 416 return this.subjectTarget; 417 } 418 419 /** 420 * @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. (Patient this order is about.) 421 */ 422 public Order setSubjectTarget(Resource value) { 423 this.subjectTarget = value; 424 return this; 425 } 426 427 /** 428 * @return {@link #source} (Who initiated the order.) 429 */ 430 public Reference getSource() { 431 if (this.source == null) 432 if (Configuration.errorOnAutoCreate()) 433 throw new Error("Attempt to auto-create Order.source"); 434 else if (Configuration.doAutoCreate()) 435 this.source = new Reference(); // cc 436 return this.source; 437 } 438 439 public boolean hasSource() { 440 return this.source != null && !this.source.isEmpty(); 441 } 442 443 /** 444 * @param value {@link #source} (Who initiated the order.) 445 */ 446 public Order setSource(Reference value) { 447 this.source = value; 448 return this; 449 } 450 451 /** 452 * @return {@link #source} 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. (Who initiated the order.) 453 */ 454 public Resource getSourceTarget() { 455 return this.sourceTarget; 456 } 457 458 /** 459 * @param value {@link #source} 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. (Who initiated the order.) 460 */ 461 public Order setSourceTarget(Resource value) { 462 this.sourceTarget = value; 463 return this; 464 } 465 466 /** 467 * @return {@link #target} (Who is intended to fulfill the order.) 468 */ 469 public Reference getTarget() { 470 if (this.target == null) 471 if (Configuration.errorOnAutoCreate()) 472 throw new Error("Attempt to auto-create Order.target"); 473 else if (Configuration.doAutoCreate()) 474 this.target = new Reference(); // cc 475 return this.target; 476 } 477 478 public boolean hasTarget() { 479 return this.target != null && !this.target.isEmpty(); 480 } 481 482 /** 483 * @param value {@link #target} (Who is intended to fulfill the order.) 484 */ 485 public Order setTarget(Reference value) { 486 this.target = value; 487 return this; 488 } 489 490 /** 491 * @return {@link #target} 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. (Who is intended to fulfill the order.) 492 */ 493 public Resource getTargetTarget() { 494 return this.targetTarget; 495 } 496 497 /** 498 * @param value {@link #target} 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. (Who is intended to fulfill the order.) 499 */ 500 public Order setTargetTarget(Resource value) { 501 this.targetTarget = value; 502 return this; 503 } 504 505 /** 506 * @return {@link #reason} (Text - why the order was made.) 507 */ 508 public Type getReason() { 509 return this.reason; 510 } 511 512 /** 513 * @return {@link #reason} (Text - why the order was made.) 514 */ 515 public CodeableConcept getReasonCodeableConcept() throws FHIRException { 516 if (!(this.reason instanceof CodeableConcept)) 517 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered"); 518 return (CodeableConcept) this.reason; 519 } 520 521 public boolean hasReasonCodeableConcept() { 522 return this.reason instanceof CodeableConcept; 523 } 524 525 /** 526 * @return {@link #reason} (Text - why the order was made.) 527 */ 528 public Reference getReasonReference() throws FHIRException { 529 if (!(this.reason instanceof Reference)) 530 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered"); 531 return (Reference) this.reason; 532 } 533 534 public boolean hasReasonReference() { 535 return this.reason instanceof Reference; 536 } 537 538 public boolean hasReason() { 539 return this.reason != null && !this.reason.isEmpty(); 540 } 541 542 /** 543 * @param value {@link #reason} (Text - why the order was made.) 544 */ 545 public Order setReason(Type value) { 546 this.reason = value; 547 return this; 548 } 549 550 /** 551 * @return {@link #when} (When order should be fulfilled.) 552 */ 553 public OrderWhenComponent getWhen() { 554 if (this.when == null) 555 if (Configuration.errorOnAutoCreate()) 556 throw new Error("Attempt to auto-create Order.when"); 557 else if (Configuration.doAutoCreate()) 558 this.when = new OrderWhenComponent(); // cc 559 return this.when; 560 } 561 562 public boolean hasWhen() { 563 return this.when != null && !this.when.isEmpty(); 564 } 565 566 /** 567 * @param value {@link #when} (When order should be fulfilled.) 568 */ 569 public Order setWhen(OrderWhenComponent value) { 570 this.when = value; 571 return this; 572 } 573 574 /** 575 * @return {@link #detail} (What action is being ordered.) 576 */ 577 public List<Reference> getDetail() { 578 if (this.detail == null) 579 this.detail = new ArrayList<Reference>(); 580 return this.detail; 581 } 582 583 public boolean hasDetail() { 584 if (this.detail == null) 585 return false; 586 for (Reference item : this.detail) 587 if (!item.isEmpty()) 588 return true; 589 return false; 590 } 591 592 /** 593 * @return {@link #detail} (What action is being ordered.) 594 */ 595 // syntactic sugar 596 public Reference addDetail() { //3 597 Reference t = new Reference(); 598 if (this.detail == null) 599 this.detail = new ArrayList<Reference>(); 600 this.detail.add(t); 601 return t; 602 } 603 604 // syntactic sugar 605 public Order addDetail(Reference t) { //3 606 if (t == null) 607 return this; 608 if (this.detail == null) 609 this.detail = new ArrayList<Reference>(); 610 this.detail.add(t); 611 return this; 612 } 613 614 /** 615 * @return {@link #detail} (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. What action is being ordered.) 616 */ 617 public List<Resource> getDetailTarget() { 618 if (this.detailTarget == null) 619 this.detailTarget = new ArrayList<Resource>(); 620 return this.detailTarget; 621 } 622 623 protected void listChildren(List<Property> childrenList) { 624 super.listChildren(childrenList); 625 childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier)); 626 childrenList.add(new Property("date", "dateTime", "When the order was made.", 0, java.lang.Integer.MAX_VALUE, date)); 627 childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Substance)", "Patient this order is about.", 0, java.lang.Integer.MAX_VALUE, subject)); 628 childrenList.add(new Property("source", "Reference(Practitioner|Organization)", "Who initiated the order.", 0, java.lang.Integer.MAX_VALUE, source)); 629 childrenList.add(new Property("target", "Reference(Organization|Device|Practitioner)", "Who is intended to fulfill the order.", 0, java.lang.Integer.MAX_VALUE, target)); 630 childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Any)", "Text - why the order was made.", 0, java.lang.Integer.MAX_VALUE, reason)); 631 childrenList.add(new Property("when", "", "When order should be fulfilled.", 0, java.lang.Integer.MAX_VALUE, when)); 632 childrenList.add(new Property("detail", "Reference(Any)", "What action is being ordered.", 0, java.lang.Integer.MAX_VALUE, detail)); 633 } 634 635 @Override 636 public void setProperty(String name, Base value) throws FHIRException { 637 if (name.equals("identifier")) 638 this.getIdentifier().add(castToIdentifier(value)); 639 else if (name.equals("date")) 640 this.date = castToDateTime(value); // DateTimeType 641 else if (name.equals("subject")) 642 this.subject = castToReference(value); // Reference 643 else if (name.equals("source")) 644 this.source = castToReference(value); // Reference 645 else if (name.equals("target")) 646 this.target = castToReference(value); // Reference 647 else if (name.equals("reason[x]")) 648 this.reason = (Type) value; // Type 649 else if (name.equals("when")) 650 this.when = (OrderWhenComponent) value; // OrderWhenComponent 651 else if (name.equals("detail")) 652 this.getDetail().add(castToReference(value)); 653 else 654 super.setProperty(name, value); 655 } 656 657 @Override 658 public Base addChild(String name) throws FHIRException { 659 if (name.equals("identifier")) { 660 return addIdentifier(); 661 } 662 else if (name.equals("date")) { 663 throw new FHIRException("Cannot call addChild on a primitive type Order.date"); 664 } 665 else if (name.equals("subject")) { 666 this.subject = new Reference(); 667 return this.subject; 668 } 669 else if (name.equals("source")) { 670 this.source = new Reference(); 671 return this.source; 672 } 673 else if (name.equals("target")) { 674 this.target = new Reference(); 675 return this.target; 676 } 677 else if (name.equals("reasonCodeableConcept")) { 678 this.reason = new CodeableConcept(); 679 return this.reason; 680 } 681 else if (name.equals("reasonReference")) { 682 this.reason = new Reference(); 683 return this.reason; 684 } 685 else if (name.equals("when")) { 686 this.when = new OrderWhenComponent(); 687 return this.when; 688 } 689 else if (name.equals("detail")) { 690 return addDetail(); 691 } 692 else 693 return super.addChild(name); 694 } 695 696 public String fhirType() { 697 return "Order"; 698 699 } 700 701 public Order copy() { 702 Order dst = new Order(); 703 copyValues(dst); 704 if (identifier != null) { 705 dst.identifier = new ArrayList<Identifier>(); 706 for (Identifier i : identifier) 707 dst.identifier.add(i.copy()); 708 }; 709 dst.date = date == null ? null : date.copy(); 710 dst.subject = subject == null ? null : subject.copy(); 711 dst.source = source == null ? null : source.copy(); 712 dst.target = target == null ? null : target.copy(); 713 dst.reason = reason == null ? null : reason.copy(); 714 dst.when = when == null ? null : when.copy(); 715 if (detail != null) { 716 dst.detail = new ArrayList<Reference>(); 717 for (Reference i : detail) 718 dst.detail.add(i.copy()); 719 }; 720 return dst; 721 } 722 723 protected Order typedCopy() { 724 return copy(); 725 } 726 727 @Override 728 public boolean equalsDeep(Base other) { 729 if (!super.equalsDeep(other)) 730 return false; 731 if (!(other instanceof Order)) 732 return false; 733 Order o = (Order) other; 734 return compareDeep(identifier, o.identifier, true) && compareDeep(date, o.date, true) && compareDeep(subject, o.subject, true) 735 && compareDeep(source, o.source, true) && compareDeep(target, o.target, true) && compareDeep(reason, o.reason, true) 736 && compareDeep(when, o.when, true) && compareDeep(detail, o.detail, true); 737 } 738 739 @Override 740 public boolean equalsShallow(Base other) { 741 if (!super.equalsShallow(other)) 742 return false; 743 if (!(other instanceof Order)) 744 return false; 745 Order o = (Order) other; 746 return compareValues(date, o.date, true); 747 } 748 749 public boolean isEmpty() { 750 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (date == null || date.isEmpty()) 751 && (subject == null || subject.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty()) 752 && (reason == null || reason.isEmpty()) && (when == null || when.isEmpty()) && (detail == null || detail.isEmpty()) 753 ; 754 } 755 756 @Override 757 public ResourceType getResourceType() { 758 return ResourceType.Order; 759 } 760 761 @SearchParamDefinition(name="date", path="Order.date", description="When the order was made", type="date" ) 762 public static final String SP_DATE = "date"; 763 @SearchParamDefinition(name="identifier", path="Order.identifier", description="Instance id from source, target, and/or others", type="token" ) 764 public static final String SP_IDENTIFIER = "identifier"; 765 @SearchParamDefinition(name="subject", path="Order.subject", description="Patient this order is about", type="reference" ) 766 public static final String SP_SUBJECT = "subject"; 767 @SearchParamDefinition(name="patient", path="Order.subject", description="Patient this order is about", type="reference" ) 768 public static final String SP_PATIENT = "patient"; 769 @SearchParamDefinition(name="source", path="Order.source", description="Who initiated the order", type="reference" ) 770 public static final String SP_SOURCE = "source"; 771 @SearchParamDefinition(name="detail", path="Order.detail", description="What action is being ordered", type="reference" ) 772 public static final String SP_DETAIL = "detail"; 773 @SearchParamDefinition(name="when", path="Order.when.schedule", description="A formal schedule", type="date" ) 774 public static final String SP_WHEN = "when"; 775 @SearchParamDefinition(name="target", path="Order.target", description="Who is intended to fulfill the order", type="reference" ) 776 public static final String SP_TARGET = "target"; 777 @SearchParamDefinition(name="when_code", path="Order.when.code", description="Code specifies when request should be done. The code may simply be a priority code", type="token" ) 778 public static final String SP_WHENCODE = "when_code"; 779 780} 781