001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * Record of delivery of what is supplied. 047 */ 048@ResourceDef(name="SupplyDelivery", profile="http://hl7.org/fhir/Profile/SupplyDelivery") 049public class SupplyDelivery extends DomainResource { 050 051 public enum SupplyDeliveryStatus { 052 /** 053 * Supply has been requested, but not delivered. 054 */ 055 INPROGRESS, 056 /** 057 * Supply has been delivered ("completed"). 058 */ 059 COMPLETED, 060 /** 061 * Dispensing was not completed. 062 */ 063 ABANDONED, 064 /** 065 * added to help the parsers 066 */ 067 NULL; 068 public static SupplyDeliveryStatus fromCode(String codeString) throws FHIRException { 069 if (codeString == null || "".equals(codeString)) 070 return null; 071 if ("in-progress".equals(codeString)) 072 return INPROGRESS; 073 if ("completed".equals(codeString)) 074 return COMPLETED; 075 if ("abandoned".equals(codeString)) 076 return ABANDONED; 077 throw new FHIRException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 078 } 079 public String toCode() { 080 switch (this) { 081 case INPROGRESS: return "in-progress"; 082 case COMPLETED: return "completed"; 083 case ABANDONED: return "abandoned"; 084 default: return "?"; 085 } 086 } 087 public String getSystem() { 088 switch (this) { 089 case INPROGRESS: return "http://hl7.org/fhir/supplydelivery-status"; 090 case COMPLETED: return "http://hl7.org/fhir/supplydelivery-status"; 091 case ABANDONED: return "http://hl7.org/fhir/supplydelivery-status"; 092 default: return "?"; 093 } 094 } 095 public String getDefinition() { 096 switch (this) { 097 case INPROGRESS: return "Supply has been requested, but not delivered."; 098 case COMPLETED: return "Supply has been delivered (\"completed\")."; 099 case ABANDONED: return "Dispensing was not completed."; 100 default: return "?"; 101 } 102 } 103 public String getDisplay() { 104 switch (this) { 105 case INPROGRESS: return "In Progress"; 106 case COMPLETED: return "Delivered"; 107 case ABANDONED: return "Abandoned"; 108 default: return "?"; 109 } 110 } 111 } 112 113 public static class SupplyDeliveryStatusEnumFactory implements EnumFactory<SupplyDeliveryStatus> { 114 public SupplyDeliveryStatus fromCode(String codeString) throws IllegalArgumentException { 115 if (codeString == null || "".equals(codeString)) 116 if (codeString == null || "".equals(codeString)) 117 return null; 118 if ("in-progress".equals(codeString)) 119 return SupplyDeliveryStatus.INPROGRESS; 120 if ("completed".equals(codeString)) 121 return SupplyDeliveryStatus.COMPLETED; 122 if ("abandoned".equals(codeString)) 123 return SupplyDeliveryStatus.ABANDONED; 124 throw new IllegalArgumentException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 125 } 126 public Enumeration<SupplyDeliveryStatus> fromType(Base code) throws FHIRException { 127 if (code == null || code.isEmpty()) 128 return null; 129 String codeString = ((PrimitiveType) code).asStringValue(); 130 if (codeString == null || "".equals(codeString)) 131 return null; 132 if ("in-progress".equals(codeString)) 133 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.INPROGRESS); 134 if ("completed".equals(codeString)) 135 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.COMPLETED); 136 if ("abandoned".equals(codeString)) 137 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.ABANDONED); 138 throw new FHIRException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 139 } 140 public String toCode(SupplyDeliveryStatus code) { 141 if (code == SupplyDeliveryStatus.INPROGRESS) 142 return "in-progress"; 143 if (code == SupplyDeliveryStatus.COMPLETED) 144 return "completed"; 145 if (code == SupplyDeliveryStatus.ABANDONED) 146 return "abandoned"; 147 return "?"; 148 } 149 } 150 151 /** 152 * Identifier assigned by the dispensing facility when the item(s) is dispensed. 153 */ 154 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 155 @Description(shortDefinition="External identifier", formalDefinition="Identifier assigned by the dispensing facility when the item(s) is dispensed." ) 156 protected Identifier identifier; 157 158 /** 159 * A code specifying the state of the dispense event. 160 */ 161 @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 162 @Description(shortDefinition="in-progress | completed | abandoned", formalDefinition="A code specifying the state of the dispense event." ) 163 protected Enumeration<SupplyDeliveryStatus> status; 164 165 /** 166 * A link to a resource representing the person whom the delivered item is for. 167 */ 168 @Child(name = "patient", type = {Patient.class}, order=2, min=0, max=1, modifier=false, summary=true) 169 @Description(shortDefinition="Patient for whom the item is supplied", formalDefinition="A link to a resource representing the person whom the delivered item is for." ) 170 protected Reference patient; 171 172 /** 173 * The actual object that is the target of the reference (A link to a resource representing the person whom the delivered item is for.) 174 */ 175 protected Patient patientTarget; 176 177 /** 178 * Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc. 179 */ 180 @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 181 @Description(shortDefinition="Category of dispense event", formalDefinition="Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc." ) 182 protected CodeableConcept type; 183 184 /** 185 * The amount of supply that has been dispensed. Includes unit of measure. 186 */ 187 @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=true) 188 @Description(shortDefinition="Amount dispensed", formalDefinition="The amount of supply that has been dispensed. Includes unit of measure." ) 189 protected SimpleQuantity quantity; 190 191 /** 192 * Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list. 193 */ 194 @Child(name = "suppliedItem", type = {Medication.class, Substance.class, Device.class}, order=5, min=0, max=1, modifier=false, summary=true) 195 @Description(shortDefinition="Medication, Substance, or Device supplied", formalDefinition="Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list." ) 196 protected Reference suppliedItem; 197 198 /** 199 * The actual object that is the target of the reference (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list.) 200 */ 201 protected Resource suppliedItemTarget; 202 203 /** 204 * The individual responsible for dispensing the medication, supplier or device. 205 */ 206 @Child(name = "supplier", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true) 207 @Description(shortDefinition="Dispenser", formalDefinition="The individual responsible for dispensing the medication, supplier or device." ) 208 protected Reference supplier; 209 210 /** 211 * The actual object that is the target of the reference (The individual responsible for dispensing the medication, supplier or device.) 212 */ 213 protected Practitioner supplierTarget; 214 215 /** 216 * The time the dispense event occurred. 217 */ 218 @Child(name = "whenPrepared", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true) 219 @Description(shortDefinition="Dispensing time", formalDefinition="The time the dispense event occurred." ) 220 protected Period whenPrepared; 221 222 /** 223 * The time the dispensed item was sent or handed to the patient (or agent). 224 */ 225 @Child(name = "time", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 226 @Description(shortDefinition="Handover time", formalDefinition="The time the dispensed item was sent or handed to the patient (or agent)." ) 227 protected DateTimeType time; 228 229 /** 230 * Identification of the facility/location where the Supply was shipped to, as part of the dispense event. 231 */ 232 @Child(name = "destination", type = {Location.class}, order=9, min=0, max=1, modifier=false, summary=true) 233 @Description(shortDefinition="Where the Supply was sent", formalDefinition="Identification of the facility/location where the Supply was shipped to, as part of the dispense event." ) 234 protected Reference destination; 235 236 /** 237 * The actual object that is the target of the reference (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 238 */ 239 protected Location destinationTarget; 240 241 /** 242 * Identifies the person who picked up the Supply. 243 */ 244 @Child(name = "receiver", type = {Practitioner.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 245 @Description(shortDefinition="Who collected the Supply", formalDefinition="Identifies the person who picked up the Supply." ) 246 protected List<Reference> receiver; 247 /** 248 * The actual objects that are the target of the reference (Identifies the person who picked up the Supply.) 249 */ 250 protected List<Practitioner> receiverTarget; 251 252 253 private static final long serialVersionUID = -1520129707L; 254 255 /* 256 * Constructor 257 */ 258 public SupplyDelivery() { 259 super(); 260 } 261 262 /** 263 * @return {@link #identifier} (Identifier assigned by the dispensing facility when the item(s) is dispensed.) 264 */ 265 public Identifier getIdentifier() { 266 if (this.identifier == null) 267 if (Configuration.errorOnAutoCreate()) 268 throw new Error("Attempt to auto-create SupplyDelivery.identifier"); 269 else if (Configuration.doAutoCreate()) 270 this.identifier = new Identifier(); // cc 271 return this.identifier; 272 } 273 274 public boolean hasIdentifier() { 275 return this.identifier != null && !this.identifier.isEmpty(); 276 } 277 278 /** 279 * @param value {@link #identifier} (Identifier assigned by the dispensing facility when the item(s) is dispensed.) 280 */ 281 public SupplyDelivery setIdentifier(Identifier value) { 282 this.identifier = value; 283 return this; 284 } 285 286 /** 287 * @return {@link #status} (A code specifying the state of the dispense event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 288 */ 289 public Enumeration<SupplyDeliveryStatus> getStatusElement() { 290 if (this.status == null) 291 if (Configuration.errorOnAutoCreate()) 292 throw new Error("Attempt to auto-create SupplyDelivery.status"); 293 else if (Configuration.doAutoCreate()) 294 this.status = new Enumeration<SupplyDeliveryStatus>(new SupplyDeliveryStatusEnumFactory()); // bb 295 return this.status; 296 } 297 298 public boolean hasStatusElement() { 299 return this.status != null && !this.status.isEmpty(); 300 } 301 302 public boolean hasStatus() { 303 return this.status != null && !this.status.isEmpty(); 304 } 305 306 /** 307 * @param value {@link #status} (A code specifying the state of the dispense event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 308 */ 309 public SupplyDelivery setStatusElement(Enumeration<SupplyDeliveryStatus> value) { 310 this.status = value; 311 return this; 312 } 313 314 /** 315 * @return A code specifying the state of the dispense event. 316 */ 317 public SupplyDeliveryStatus getStatus() { 318 return this.status == null ? null : this.status.getValue(); 319 } 320 321 /** 322 * @param value A code specifying the state of the dispense event. 323 */ 324 public SupplyDelivery setStatus(SupplyDeliveryStatus value) { 325 if (value == null) 326 this.status = null; 327 else { 328 if (this.status == null) 329 this.status = new Enumeration<SupplyDeliveryStatus>(new SupplyDeliveryStatusEnumFactory()); 330 this.status.setValue(value); 331 } 332 return this; 333 } 334 335 /** 336 * @return {@link #patient} (A link to a resource representing the person whom the delivered item is for.) 337 */ 338 public Reference getPatient() { 339 if (this.patient == null) 340 if (Configuration.errorOnAutoCreate()) 341 throw new Error("Attempt to auto-create SupplyDelivery.patient"); 342 else if (Configuration.doAutoCreate()) 343 this.patient = new Reference(); // cc 344 return this.patient; 345 } 346 347 public boolean hasPatient() { 348 return this.patient != null && !this.patient.isEmpty(); 349 } 350 351 /** 352 * @param value {@link #patient} (A link to a resource representing the person whom the delivered item is for.) 353 */ 354 public SupplyDelivery setPatient(Reference value) { 355 this.patient = value; 356 return this; 357 } 358 359 /** 360 * @return {@link #patient} 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 link to a resource representing the person whom the delivered item is for.) 361 */ 362 public Patient getPatientTarget() { 363 if (this.patientTarget == null) 364 if (Configuration.errorOnAutoCreate()) 365 throw new Error("Attempt to auto-create SupplyDelivery.patient"); 366 else if (Configuration.doAutoCreate()) 367 this.patientTarget = new Patient(); // aa 368 return this.patientTarget; 369 } 370 371 /** 372 * @param value {@link #patient} 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 link to a resource representing the person whom the delivered item is for.) 373 */ 374 public SupplyDelivery setPatientTarget(Patient value) { 375 this.patientTarget = value; 376 return this; 377 } 378 379 /** 380 * @return {@link #type} (Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.) 381 */ 382 public CodeableConcept getType() { 383 if (this.type == null) 384 if (Configuration.errorOnAutoCreate()) 385 throw new Error("Attempt to auto-create SupplyDelivery.type"); 386 else if (Configuration.doAutoCreate()) 387 this.type = new CodeableConcept(); // cc 388 return this.type; 389 } 390 391 public boolean hasType() { 392 return this.type != null && !this.type.isEmpty(); 393 } 394 395 /** 396 * @param value {@link #type} (Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.) 397 */ 398 public SupplyDelivery setType(CodeableConcept value) { 399 this.type = value; 400 return this; 401 } 402 403 /** 404 * @return {@link #quantity} (The amount of supply that has been dispensed. Includes unit of measure.) 405 */ 406 public SimpleQuantity getQuantity() { 407 if (this.quantity == null) 408 if (Configuration.errorOnAutoCreate()) 409 throw new Error("Attempt to auto-create SupplyDelivery.quantity"); 410 else if (Configuration.doAutoCreate()) 411 this.quantity = new SimpleQuantity(); // cc 412 return this.quantity; 413 } 414 415 public boolean hasQuantity() { 416 return this.quantity != null && !this.quantity.isEmpty(); 417 } 418 419 /** 420 * @param value {@link #quantity} (The amount of supply that has been dispensed. Includes unit of measure.) 421 */ 422 public SupplyDelivery setQuantity(SimpleQuantity value) { 423 this.quantity = value; 424 return this; 425 } 426 427 /** 428 * @return {@link #suppliedItem} (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list.) 429 */ 430 public Reference getSuppliedItem() { 431 if (this.suppliedItem == null) 432 if (Configuration.errorOnAutoCreate()) 433 throw new Error("Attempt to auto-create SupplyDelivery.suppliedItem"); 434 else if (Configuration.doAutoCreate()) 435 this.suppliedItem = new Reference(); // cc 436 return this.suppliedItem; 437 } 438 439 public boolean hasSuppliedItem() { 440 return this.suppliedItem != null && !this.suppliedItem.isEmpty(); 441 } 442 443 /** 444 * @param value {@link #suppliedItem} (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list.) 445 */ 446 public SupplyDelivery setSuppliedItem(Reference value) { 447 this.suppliedItem = value; 448 return this; 449 } 450 451 /** 452 * @return {@link #suppliedItem} 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. (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list.) 453 */ 454 public Resource getSuppliedItemTarget() { 455 return this.suppliedItemTarget; 456 } 457 458 /** 459 * @param value {@link #suppliedItem} 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. (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list.) 460 */ 461 public SupplyDelivery setSuppliedItemTarget(Resource value) { 462 this.suppliedItemTarget = value; 463 return this; 464 } 465 466 /** 467 * @return {@link #supplier} (The individual responsible for dispensing the medication, supplier or device.) 468 */ 469 public Reference getSupplier() { 470 if (this.supplier == null) 471 if (Configuration.errorOnAutoCreate()) 472 throw new Error("Attempt to auto-create SupplyDelivery.supplier"); 473 else if (Configuration.doAutoCreate()) 474 this.supplier = new Reference(); // cc 475 return this.supplier; 476 } 477 478 public boolean hasSupplier() { 479 return this.supplier != null && !this.supplier.isEmpty(); 480 } 481 482 /** 483 * @param value {@link #supplier} (The individual responsible for dispensing the medication, supplier or device.) 484 */ 485 public SupplyDelivery setSupplier(Reference value) { 486 this.supplier = value; 487 return this; 488 } 489 490 /** 491 * @return {@link #supplier} 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 individual responsible for dispensing the medication, supplier or device.) 492 */ 493 public Practitioner getSupplierTarget() { 494 if (this.supplierTarget == null) 495 if (Configuration.errorOnAutoCreate()) 496 throw new Error("Attempt to auto-create SupplyDelivery.supplier"); 497 else if (Configuration.doAutoCreate()) 498 this.supplierTarget = new Practitioner(); // aa 499 return this.supplierTarget; 500 } 501 502 /** 503 * @param value {@link #supplier} 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 individual responsible for dispensing the medication, supplier or device.) 504 */ 505 public SupplyDelivery setSupplierTarget(Practitioner value) { 506 this.supplierTarget = value; 507 return this; 508 } 509 510 /** 511 * @return {@link #whenPrepared} (The time the dispense event occurred.) 512 */ 513 public Period getWhenPrepared() { 514 if (this.whenPrepared == null) 515 if (Configuration.errorOnAutoCreate()) 516 throw new Error("Attempt to auto-create SupplyDelivery.whenPrepared"); 517 else if (Configuration.doAutoCreate()) 518 this.whenPrepared = new Period(); // cc 519 return this.whenPrepared; 520 } 521 522 public boolean hasWhenPrepared() { 523 return this.whenPrepared != null && !this.whenPrepared.isEmpty(); 524 } 525 526 /** 527 * @param value {@link #whenPrepared} (The time the dispense event occurred.) 528 */ 529 public SupplyDelivery setWhenPrepared(Period value) { 530 this.whenPrepared = value; 531 return this; 532 } 533 534 /** 535 * @return {@link #time} (The time the dispensed item was sent or handed to the patient (or agent).). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value 536 */ 537 public DateTimeType getTimeElement() { 538 if (this.time == null) 539 if (Configuration.errorOnAutoCreate()) 540 throw new Error("Attempt to auto-create SupplyDelivery.time"); 541 else if (Configuration.doAutoCreate()) 542 this.time = new DateTimeType(); // bb 543 return this.time; 544 } 545 546 public boolean hasTimeElement() { 547 return this.time != null && !this.time.isEmpty(); 548 } 549 550 public boolean hasTime() { 551 return this.time != null && !this.time.isEmpty(); 552 } 553 554 /** 555 * @param value {@link #time} (The time the dispensed item was sent or handed to the patient (or agent).). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value 556 */ 557 public SupplyDelivery setTimeElement(DateTimeType value) { 558 this.time = value; 559 return this; 560 } 561 562 /** 563 * @return The time the dispensed item was sent or handed to the patient (or agent). 564 */ 565 public Date getTime() { 566 return this.time == null ? null : this.time.getValue(); 567 } 568 569 /** 570 * @param value The time the dispensed item was sent or handed to the patient (or agent). 571 */ 572 public SupplyDelivery setTime(Date value) { 573 if (value == null) 574 this.time = null; 575 else { 576 if (this.time == null) 577 this.time = new DateTimeType(); 578 this.time.setValue(value); 579 } 580 return this; 581 } 582 583 /** 584 * @return {@link #destination} (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 585 */ 586 public Reference getDestination() { 587 if (this.destination == null) 588 if (Configuration.errorOnAutoCreate()) 589 throw new Error("Attempt to auto-create SupplyDelivery.destination"); 590 else if (Configuration.doAutoCreate()) 591 this.destination = new Reference(); // cc 592 return this.destination; 593 } 594 595 public boolean hasDestination() { 596 return this.destination != null && !this.destination.isEmpty(); 597 } 598 599 /** 600 * @param value {@link #destination} (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 601 */ 602 public SupplyDelivery setDestination(Reference value) { 603 this.destination = value; 604 return this; 605 } 606 607 /** 608 * @return {@link #destination} 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. (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 609 */ 610 public Location getDestinationTarget() { 611 if (this.destinationTarget == null) 612 if (Configuration.errorOnAutoCreate()) 613 throw new Error("Attempt to auto-create SupplyDelivery.destination"); 614 else if (Configuration.doAutoCreate()) 615 this.destinationTarget = new Location(); // aa 616 return this.destinationTarget; 617 } 618 619 /** 620 * @param value {@link #destination} 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. (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 621 */ 622 public SupplyDelivery setDestinationTarget(Location value) { 623 this.destinationTarget = value; 624 return this; 625 } 626 627 /** 628 * @return {@link #receiver} (Identifies the person who picked up the Supply.) 629 */ 630 public List<Reference> getReceiver() { 631 if (this.receiver == null) 632 this.receiver = new ArrayList<Reference>(); 633 return this.receiver; 634 } 635 636 public boolean hasReceiver() { 637 if (this.receiver == null) 638 return false; 639 for (Reference item : this.receiver) 640 if (!item.isEmpty()) 641 return true; 642 return false; 643 } 644 645 /** 646 * @return {@link #receiver} (Identifies the person who picked up the Supply.) 647 */ 648 // syntactic sugar 649 public Reference addReceiver() { //3 650 Reference t = new Reference(); 651 if (this.receiver == null) 652 this.receiver = new ArrayList<Reference>(); 653 this.receiver.add(t); 654 return t; 655 } 656 657 // syntactic sugar 658 public SupplyDelivery addReceiver(Reference t) { //3 659 if (t == null) 660 return this; 661 if (this.receiver == null) 662 this.receiver = new ArrayList<Reference>(); 663 this.receiver.add(t); 664 return this; 665 } 666 667 /** 668 * @return {@link #receiver} (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. Identifies the person who picked up the Supply.) 669 */ 670 public List<Practitioner> getReceiverTarget() { 671 if (this.receiverTarget == null) 672 this.receiverTarget = new ArrayList<Practitioner>(); 673 return this.receiverTarget; 674 } 675 676 // syntactic sugar 677 /** 678 * @return {@link #receiver} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Identifies the person who picked up the Supply.) 679 */ 680 public Practitioner addReceiverTarget() { 681 Practitioner r = new Practitioner(); 682 if (this.receiverTarget == null) 683 this.receiverTarget = new ArrayList<Practitioner>(); 684 this.receiverTarget.add(r); 685 return r; 686 } 687 688 protected void listChildren(List<Property> childrenList) { 689 super.listChildren(childrenList); 690 childrenList.add(new Property("identifier", "Identifier", "Identifier assigned by the dispensing facility when the item(s) is dispensed.", 0, java.lang.Integer.MAX_VALUE, identifier)); 691 childrenList.add(new Property("status", "code", "A code specifying the state of the dispense event.", 0, java.lang.Integer.MAX_VALUE, status)); 692 childrenList.add(new Property("patient", "Reference(Patient)", "A link to a resource representing the person whom the delivered item is for.", 0, java.lang.Integer.MAX_VALUE, patient)); 693 childrenList.add(new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, java.lang.Integer.MAX_VALUE, type)); 694 childrenList.add(new Property("quantity", "SimpleQuantity", "The amount of supply that has been dispensed. Includes unit of measure.", 0, java.lang.Integer.MAX_VALUE, quantity)); 695 childrenList.add(new Property("suppliedItem", "Reference(Medication|Substance|Device)", "Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a simple attribute carrying a code that identifies the item from a known list.", 0, java.lang.Integer.MAX_VALUE, suppliedItem)); 696 childrenList.add(new Property("supplier", "Reference(Practitioner)", "The individual responsible for dispensing the medication, supplier or device.", 0, java.lang.Integer.MAX_VALUE, supplier)); 697 childrenList.add(new Property("whenPrepared", "Period", "The time the dispense event occurred.", 0, java.lang.Integer.MAX_VALUE, whenPrepared)); 698 childrenList.add(new Property("time", "dateTime", "The time the dispensed item was sent or handed to the patient (or agent).", 0, java.lang.Integer.MAX_VALUE, time)); 699 childrenList.add(new Property("destination", "Reference(Location)", "Identification of the facility/location where the Supply was shipped to, as part of the dispense event.", 0, java.lang.Integer.MAX_VALUE, destination)); 700 childrenList.add(new Property("receiver", "Reference(Practitioner)", "Identifies the person who picked up the Supply.", 0, java.lang.Integer.MAX_VALUE, receiver)); 701 } 702 703 @Override 704 public void setProperty(String name, Base value) throws FHIRException { 705 if (name.equals("identifier")) 706 this.identifier = castToIdentifier(value); // Identifier 707 else if (name.equals("status")) 708 this.status = new SupplyDeliveryStatusEnumFactory().fromType(value); // Enumeration<SupplyDeliveryStatus> 709 else if (name.equals("patient")) 710 this.patient = castToReference(value); // Reference 711 else if (name.equals("type")) 712 this.type = castToCodeableConcept(value); // CodeableConcept 713 else if (name.equals("quantity")) 714 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 715 else if (name.equals("suppliedItem")) 716 this.suppliedItem = castToReference(value); // Reference 717 else if (name.equals("supplier")) 718 this.supplier = castToReference(value); // Reference 719 else if (name.equals("whenPrepared")) 720 this.whenPrepared = castToPeriod(value); // Period 721 else if (name.equals("time")) 722 this.time = castToDateTime(value); // DateTimeType 723 else if (name.equals("destination")) 724 this.destination = castToReference(value); // Reference 725 else if (name.equals("receiver")) 726 this.getReceiver().add(castToReference(value)); 727 else 728 super.setProperty(name, value); 729 } 730 731 @Override 732 public Base addChild(String name) throws FHIRException { 733 if (name.equals("identifier")) { 734 this.identifier = new Identifier(); 735 return this.identifier; 736 } 737 else if (name.equals("status")) { 738 throw new FHIRException("Cannot call addChild on a primitive type SupplyDelivery.status"); 739 } 740 else if (name.equals("patient")) { 741 this.patient = new Reference(); 742 return this.patient; 743 } 744 else if (name.equals("type")) { 745 this.type = new CodeableConcept(); 746 return this.type; 747 } 748 else if (name.equals("quantity")) { 749 this.quantity = new SimpleQuantity(); 750 return this.quantity; 751 } 752 else if (name.equals("suppliedItem")) { 753 this.suppliedItem = new Reference(); 754 return this.suppliedItem; 755 } 756 else if (name.equals("supplier")) { 757 this.supplier = new Reference(); 758 return this.supplier; 759 } 760 else if (name.equals("whenPrepared")) { 761 this.whenPrepared = new Period(); 762 return this.whenPrepared; 763 } 764 else if (name.equals("time")) { 765 throw new FHIRException("Cannot call addChild on a primitive type SupplyDelivery.time"); 766 } 767 else if (name.equals("destination")) { 768 this.destination = new Reference(); 769 return this.destination; 770 } 771 else if (name.equals("receiver")) { 772 return addReceiver(); 773 } 774 else 775 return super.addChild(name); 776 } 777 778 public String fhirType() { 779 return "SupplyDelivery"; 780 781 } 782 783 public SupplyDelivery copy() { 784 SupplyDelivery dst = new SupplyDelivery(); 785 copyValues(dst); 786 dst.identifier = identifier == null ? null : identifier.copy(); 787 dst.status = status == null ? null : status.copy(); 788 dst.patient = patient == null ? null : patient.copy(); 789 dst.type = type == null ? null : type.copy(); 790 dst.quantity = quantity == null ? null : quantity.copy(); 791 dst.suppliedItem = suppliedItem == null ? null : suppliedItem.copy(); 792 dst.supplier = supplier == null ? null : supplier.copy(); 793 dst.whenPrepared = whenPrepared == null ? null : whenPrepared.copy(); 794 dst.time = time == null ? null : time.copy(); 795 dst.destination = destination == null ? null : destination.copy(); 796 if (receiver != null) { 797 dst.receiver = new ArrayList<Reference>(); 798 for (Reference i : receiver) 799 dst.receiver.add(i.copy()); 800 }; 801 return dst; 802 } 803 804 protected SupplyDelivery typedCopy() { 805 return copy(); 806 } 807 808 @Override 809 public boolean equalsDeep(Base other) { 810 if (!super.equalsDeep(other)) 811 return false; 812 if (!(other instanceof SupplyDelivery)) 813 return false; 814 SupplyDelivery o = (SupplyDelivery) other; 815 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true) 816 && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true) && compareDeep(suppliedItem, o.suppliedItem, true) 817 && compareDeep(supplier, o.supplier, true) && compareDeep(whenPrepared, o.whenPrepared, true) && compareDeep(time, o.time, true) 818 && compareDeep(destination, o.destination, true) && compareDeep(receiver, o.receiver, true); 819 } 820 821 @Override 822 public boolean equalsShallow(Base other) { 823 if (!super.equalsShallow(other)) 824 return false; 825 if (!(other instanceof SupplyDelivery)) 826 return false; 827 SupplyDelivery o = (SupplyDelivery) other; 828 return compareValues(status, o.status, true) && compareValues(time, o.time, true); 829 } 830 831 public boolean isEmpty() { 832 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 833 && (patient == null || patient.isEmpty()) && (type == null || type.isEmpty()) && (quantity == null || quantity.isEmpty()) 834 && (suppliedItem == null || suppliedItem.isEmpty()) && (supplier == null || supplier.isEmpty()) 835 && (whenPrepared == null || whenPrepared.isEmpty()) && (time == null || time.isEmpty()) && (destination == null || destination.isEmpty()) 836 && (receiver == null || receiver.isEmpty()); 837 } 838 839 @Override 840 public ResourceType getResourceType() { 841 return ResourceType.SupplyDelivery; 842 } 843 844 @SearchParamDefinition(name="identifier", path="SupplyDelivery.identifier", description="External identifier", type="token" ) 845 public static final String SP_IDENTIFIER = "identifier"; 846 @SearchParamDefinition(name="receiver", path="SupplyDelivery.receiver", description="Who collected the Supply", type="reference" ) 847 public static final String SP_RECEIVER = "receiver"; 848 @SearchParamDefinition(name="patient", path="SupplyDelivery.patient", description="Patient for whom the item is supplied", type="reference" ) 849 public static final String SP_PATIENT = "patient"; 850 @SearchParamDefinition(name="supplier", path="SupplyDelivery.supplier", description="Dispenser", type="reference" ) 851 public static final String SP_SUPPLIER = "supplier"; 852 @SearchParamDefinition(name="status", path="SupplyDelivery.status", description="in-progress | completed | abandoned", type="token" ) 853 public static final String SP_STATUS = "status"; 854 855}