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