001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import org.hl7.fhir.exceptions.FHIRException; 041 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.Description; 044import ca.uhn.fhir.model.api.annotation.ResourceDef; 045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 046/** 047 * Record of delivery of what is supplied. 048 */ 049@ResourceDef(name="SupplyDelivery", profile="http://hl7.org/fhir/Profile/SupplyDelivery") 050public class SupplyDelivery extends DomainResource { 051 052 public enum SupplyDeliveryStatus { 053 /** 054 * Supply has been requested, but not delivered. 055 */ 056 INPROGRESS, 057 /** 058 * Supply has been delivered ("completed"). 059 */ 060 COMPLETED, 061 /** 062 * Dispensing was not completed. 063 */ 064 ABANDONED, 065 /** 066 * added to help the parsers 067 */ 068 NULL; 069 public static SupplyDeliveryStatus fromCode(String codeString) throws FHIRException { 070 if (codeString == null || "".equals(codeString)) 071 return null; 072 if ("in-progress".equals(codeString)) 073 return INPROGRESS; 074 if ("completed".equals(codeString)) 075 return COMPLETED; 076 if ("abandoned".equals(codeString)) 077 return ABANDONED; 078 throw new FHIRException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 079 } 080 public String toCode() { 081 switch (this) { 082 case INPROGRESS: return "in-progress"; 083 case COMPLETED: return "completed"; 084 case ABANDONED: return "abandoned"; 085 case NULL: return null; 086 default: return "?"; 087 } 088 } 089 public String getSystem() { 090 switch (this) { 091 case INPROGRESS: return "http://hl7.org/fhir/supplydelivery-status"; 092 case COMPLETED: return "http://hl7.org/fhir/supplydelivery-status"; 093 case ABANDONED: return "http://hl7.org/fhir/supplydelivery-status"; 094 case NULL: return null; 095 default: return "?"; 096 } 097 } 098 public String getDefinition() { 099 switch (this) { 100 case INPROGRESS: return "Supply has been requested, but not delivered."; 101 case COMPLETED: return "Supply has been delivered (\"completed\")."; 102 case ABANDONED: return "Dispensing was not completed."; 103 case NULL: return null; 104 default: return "?"; 105 } 106 } 107 public String getDisplay() { 108 switch (this) { 109 case INPROGRESS: return "In Progress"; 110 case COMPLETED: return "Delivered"; 111 case ABANDONED: return "Abandoned"; 112 case NULL: return null; 113 default: return "?"; 114 } 115 } 116 } 117 118 public static class SupplyDeliveryStatusEnumFactory implements EnumFactory<SupplyDeliveryStatus> { 119 public SupplyDeliveryStatus fromCode(String codeString) throws IllegalArgumentException { 120 if (codeString == null || "".equals(codeString)) 121 if (codeString == null || "".equals(codeString)) 122 return null; 123 if ("in-progress".equals(codeString)) 124 return SupplyDeliveryStatus.INPROGRESS; 125 if ("completed".equals(codeString)) 126 return SupplyDeliveryStatus.COMPLETED; 127 if ("abandoned".equals(codeString)) 128 return SupplyDeliveryStatus.ABANDONED; 129 throw new IllegalArgumentException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 130 } 131 public Enumeration<SupplyDeliveryStatus> fromType(Base code) throws FHIRException { 132 if (code == null || code.isEmpty()) 133 return null; 134 String codeString = ((PrimitiveType) code).asStringValue(); 135 if (codeString == null || "".equals(codeString)) 136 return null; 137 if ("in-progress".equals(codeString)) 138 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.INPROGRESS); 139 if ("completed".equals(codeString)) 140 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.COMPLETED); 141 if ("abandoned".equals(codeString)) 142 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.ABANDONED); 143 throw new FHIRException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 144 } 145 public String toCode(SupplyDeliveryStatus code) { 146 if (code == SupplyDeliveryStatus.INPROGRESS) 147 return "in-progress"; 148 if (code == SupplyDeliveryStatus.COMPLETED) 149 return "completed"; 150 if (code == SupplyDeliveryStatus.ABANDONED) 151 return "abandoned"; 152 return "?"; 153 } 154 public String toSystem(SupplyDeliveryStatus code) { 155 return code.getSystem(); 156 } 157 } 158 159 /** 160 * Identifier assigned by the dispensing facility when the item(s) is dispensed. 161 */ 162 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 163 @Description(shortDefinition="External identifier", formalDefinition="Identifier assigned by the dispensing facility when the item(s) is dispensed." ) 164 protected Identifier identifier; 165 166 /** 167 * A code specifying the state of the dispense event. 168 */ 169 @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 170 @Description(shortDefinition="in-progress | completed | abandoned", formalDefinition="A code specifying the state of the dispense event." ) 171 protected Enumeration<SupplyDeliveryStatus> status; 172 173 /** 174 * A link to a resource representing the person whom the delivered item is for. 175 */ 176 @Child(name = "patient", type = {Patient.class}, order=2, min=0, max=1, modifier=false, summary=true) 177 @Description(shortDefinition="Patient for whom the item is supplied", formalDefinition="A link to a resource representing the person whom the delivered item is for." ) 178 protected Reference patient; 179 180 /** 181 * The actual object that is the target of the reference (A link to a resource representing the person whom the delivered item is for.) 182 */ 183 protected Patient patientTarget; 184 185 /** 186 * Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc. 187 */ 188 @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 189 @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." ) 190 protected CodeableConcept type; 191 192 /** 193 * The amount of supply that has been dispensed. Includes unit of measure. 194 */ 195 @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=true) 196 @Description(shortDefinition="Amount dispensed", formalDefinition="The amount of supply that has been dispensed. Includes unit of measure." ) 197 protected SimpleQuantity quantity; 198 199 /** 200 * 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. 201 */ 202 @Child(name = "suppliedItem", type = {Medication.class, Substance.class, Device.class}, order=5, min=0, max=1, modifier=false, summary=true) 203 @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." ) 204 protected Reference suppliedItem; 205 206 /** 207 * 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.) 208 */ 209 protected Resource suppliedItemTarget; 210 211 /** 212 * The individual responsible for dispensing the medication, supplier or device. 213 */ 214 @Child(name = "supplier", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true) 215 @Description(shortDefinition="Dispenser", formalDefinition="The individual responsible for dispensing the medication, supplier or device." ) 216 protected Reference supplier; 217 218 /** 219 * The actual object that is the target of the reference (The individual responsible for dispensing the medication, supplier or device.) 220 */ 221 protected Practitioner supplierTarget; 222 223 /** 224 * The time the dispense event occurred. 225 */ 226 @Child(name = "whenPrepared", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true) 227 @Description(shortDefinition="Dispensing time", formalDefinition="The time the dispense event occurred." ) 228 protected Period whenPrepared; 229 230 /** 231 * The time the dispensed item was sent or handed to the patient (or agent). 232 */ 233 @Child(name = "time", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 234 @Description(shortDefinition="Handover time", formalDefinition="The time the dispensed item was sent or handed to the patient (or agent)." ) 235 protected DateTimeType time; 236 237 /** 238 * Identification of the facility/location where the Supply was shipped to, as part of the dispense event. 239 */ 240 @Child(name = "destination", type = {Location.class}, order=9, min=0, max=1, modifier=false, summary=true) 241 @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." ) 242 protected Reference destination; 243 244 /** 245 * 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.) 246 */ 247 protected Location destinationTarget; 248 249 /** 250 * Identifies the person who picked up the Supply. 251 */ 252 @Child(name = "receiver", type = {Practitioner.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 253 @Description(shortDefinition="Who collected the Supply", formalDefinition="Identifies the person who picked up the Supply." ) 254 protected List<Reference> receiver; 255 /** 256 * The actual objects that are the target of the reference (Identifies the person who picked up the Supply.) 257 */ 258 protected List<Practitioner> receiverTarget; 259 260 261 private static final long serialVersionUID = -1520129707L; 262 263 /** 264 * Constructor 265 */ 266 public SupplyDelivery() { 267 super(); 268 } 269 270 /** 271 * @return {@link #identifier} (Identifier assigned by the dispensing facility when the item(s) is dispensed.) 272 */ 273 public Identifier getIdentifier() { 274 if (this.identifier == null) 275 if (Configuration.errorOnAutoCreate()) 276 throw new Error("Attempt to auto-create SupplyDelivery.identifier"); 277 else if (Configuration.doAutoCreate()) 278 this.identifier = new Identifier(); // cc 279 return this.identifier; 280 } 281 282 public boolean hasIdentifier() { 283 return this.identifier != null && !this.identifier.isEmpty(); 284 } 285 286 /** 287 * @param value {@link #identifier} (Identifier assigned by the dispensing facility when the item(s) is dispensed.) 288 */ 289 public SupplyDelivery setIdentifier(Identifier value) { 290 this.identifier = value; 291 return this; 292 } 293 294 /** 295 * @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 296 */ 297 public Enumeration<SupplyDeliveryStatus> getStatusElement() { 298 if (this.status == null) 299 if (Configuration.errorOnAutoCreate()) 300 throw new Error("Attempt to auto-create SupplyDelivery.status"); 301 else if (Configuration.doAutoCreate()) 302 this.status = new Enumeration<SupplyDeliveryStatus>(new SupplyDeliveryStatusEnumFactory()); // bb 303 return this.status; 304 } 305 306 public boolean hasStatusElement() { 307 return this.status != null && !this.status.isEmpty(); 308 } 309 310 public boolean hasStatus() { 311 return this.status != null && !this.status.isEmpty(); 312 } 313 314 /** 315 * @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 316 */ 317 public SupplyDelivery setStatusElement(Enumeration<SupplyDeliveryStatus> value) { 318 this.status = value; 319 return this; 320 } 321 322 /** 323 * @return A code specifying the state of the dispense event. 324 */ 325 public SupplyDeliveryStatus getStatus() { 326 return this.status == null ? null : this.status.getValue(); 327 } 328 329 /** 330 * @param value A code specifying the state of the dispense event. 331 */ 332 public SupplyDelivery setStatus(SupplyDeliveryStatus value) { 333 if (value == null) 334 this.status = null; 335 else { 336 if (this.status == null) 337 this.status = new Enumeration<SupplyDeliveryStatus>(new SupplyDeliveryStatusEnumFactory()); 338 this.status.setValue(value); 339 } 340 return this; 341 } 342 343 /** 344 * @return {@link #patient} (A link to a resource representing the person whom the delivered item is for.) 345 */ 346 public Reference getPatient() { 347 if (this.patient == null) 348 if (Configuration.errorOnAutoCreate()) 349 throw new Error("Attempt to auto-create SupplyDelivery.patient"); 350 else if (Configuration.doAutoCreate()) 351 this.patient = new Reference(); // cc 352 return this.patient; 353 } 354 355 public boolean hasPatient() { 356 return this.patient != null && !this.patient.isEmpty(); 357 } 358 359 /** 360 * @param value {@link #patient} (A link to a resource representing the person whom the delivered item is for.) 361 */ 362 public SupplyDelivery setPatient(Reference value) { 363 this.patient = value; 364 return this; 365 } 366 367 /** 368 * @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.) 369 */ 370 public Patient getPatientTarget() { 371 if (this.patientTarget == null) 372 if (Configuration.errorOnAutoCreate()) 373 throw new Error("Attempt to auto-create SupplyDelivery.patient"); 374 else if (Configuration.doAutoCreate()) 375 this.patientTarget = new Patient(); // aa 376 return this.patientTarget; 377 } 378 379 /** 380 * @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.) 381 */ 382 public SupplyDelivery setPatientTarget(Patient value) { 383 this.patientTarget = value; 384 return this; 385 } 386 387 /** 388 * @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.) 389 */ 390 public CodeableConcept getType() { 391 if (this.type == null) 392 if (Configuration.errorOnAutoCreate()) 393 throw new Error("Attempt to auto-create SupplyDelivery.type"); 394 else if (Configuration.doAutoCreate()) 395 this.type = new CodeableConcept(); // cc 396 return this.type; 397 } 398 399 public boolean hasType() { 400 return this.type != null && !this.type.isEmpty(); 401 } 402 403 /** 404 * @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.) 405 */ 406 public SupplyDelivery setType(CodeableConcept value) { 407 this.type = value; 408 return this; 409 } 410 411 /** 412 * @return {@link #quantity} (The amount of supply that has been dispensed. Includes unit of measure.) 413 */ 414 public SimpleQuantity getQuantity() { 415 if (this.quantity == null) 416 if (Configuration.errorOnAutoCreate()) 417 throw new Error("Attempt to auto-create SupplyDelivery.quantity"); 418 else if (Configuration.doAutoCreate()) 419 this.quantity = new SimpleQuantity(); // cc 420 return this.quantity; 421 } 422 423 public boolean hasQuantity() { 424 return this.quantity != null && !this.quantity.isEmpty(); 425 } 426 427 /** 428 * @param value {@link #quantity} (The amount of supply that has been dispensed. Includes unit of measure.) 429 */ 430 public SupplyDelivery setQuantity(SimpleQuantity value) { 431 this.quantity = value; 432 return this; 433 } 434 435 /** 436 * @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.) 437 */ 438 public Reference getSuppliedItem() { 439 if (this.suppliedItem == null) 440 if (Configuration.errorOnAutoCreate()) 441 throw new Error("Attempt to auto-create SupplyDelivery.suppliedItem"); 442 else if (Configuration.doAutoCreate()) 443 this.suppliedItem = new Reference(); // cc 444 return this.suppliedItem; 445 } 446 447 public boolean hasSuppliedItem() { 448 return this.suppliedItem != null && !this.suppliedItem.isEmpty(); 449 } 450 451 /** 452 * @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.) 453 */ 454 public SupplyDelivery setSuppliedItem(Reference value) { 455 this.suppliedItem = value; 456 return this; 457 } 458 459 /** 460 * @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.) 461 */ 462 public Resource getSuppliedItemTarget() { 463 return this.suppliedItemTarget; 464 } 465 466 /** 467 * @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.) 468 */ 469 public SupplyDelivery setSuppliedItemTarget(Resource value) { 470 this.suppliedItemTarget = value; 471 return this; 472 } 473 474 /** 475 * @return {@link #supplier} (The individual responsible for dispensing the medication, supplier or device.) 476 */ 477 public Reference getSupplier() { 478 if (this.supplier == null) 479 if (Configuration.errorOnAutoCreate()) 480 throw new Error("Attempt to auto-create SupplyDelivery.supplier"); 481 else if (Configuration.doAutoCreate()) 482 this.supplier = new Reference(); // cc 483 return this.supplier; 484 } 485 486 public boolean hasSupplier() { 487 return this.supplier != null && !this.supplier.isEmpty(); 488 } 489 490 /** 491 * @param value {@link #supplier} (The individual responsible for dispensing the medication, supplier or device.) 492 */ 493 public SupplyDelivery setSupplier(Reference value) { 494 this.supplier = value; 495 return this; 496 } 497 498 /** 499 * @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.) 500 */ 501 public Practitioner getSupplierTarget() { 502 if (this.supplierTarget == null) 503 if (Configuration.errorOnAutoCreate()) 504 throw new Error("Attempt to auto-create SupplyDelivery.supplier"); 505 else if (Configuration.doAutoCreate()) 506 this.supplierTarget = new Practitioner(); // aa 507 return this.supplierTarget; 508 } 509 510 /** 511 * @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.) 512 */ 513 public SupplyDelivery setSupplierTarget(Practitioner value) { 514 this.supplierTarget = value; 515 return this; 516 } 517 518 /** 519 * @return {@link #whenPrepared} (The time the dispense event occurred.) 520 */ 521 public Period getWhenPrepared() { 522 if (this.whenPrepared == null) 523 if (Configuration.errorOnAutoCreate()) 524 throw new Error("Attempt to auto-create SupplyDelivery.whenPrepared"); 525 else if (Configuration.doAutoCreate()) 526 this.whenPrepared = new Period(); // cc 527 return this.whenPrepared; 528 } 529 530 public boolean hasWhenPrepared() { 531 return this.whenPrepared != null && !this.whenPrepared.isEmpty(); 532 } 533 534 /** 535 * @param value {@link #whenPrepared} (The time the dispense event occurred.) 536 */ 537 public SupplyDelivery setWhenPrepared(Period value) { 538 this.whenPrepared = value; 539 return this; 540 } 541 542 /** 543 * @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 544 */ 545 public DateTimeType getTimeElement() { 546 if (this.time == null) 547 if (Configuration.errorOnAutoCreate()) 548 throw new Error("Attempt to auto-create SupplyDelivery.time"); 549 else if (Configuration.doAutoCreate()) 550 this.time = new DateTimeType(); // bb 551 return this.time; 552 } 553 554 public boolean hasTimeElement() { 555 return this.time != null && !this.time.isEmpty(); 556 } 557 558 public boolean hasTime() { 559 return this.time != null && !this.time.isEmpty(); 560 } 561 562 /** 563 * @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 564 */ 565 public SupplyDelivery setTimeElement(DateTimeType value) { 566 this.time = value; 567 return this; 568 } 569 570 /** 571 * @return The time the dispensed item was sent or handed to the patient (or agent). 572 */ 573 public Date getTime() { 574 return this.time == null ? null : this.time.getValue(); 575 } 576 577 /** 578 * @param value The time the dispensed item was sent or handed to the patient (or agent). 579 */ 580 public SupplyDelivery setTime(Date value) { 581 if (value == null) 582 this.time = null; 583 else { 584 if (this.time == null) 585 this.time = new DateTimeType(); 586 this.time.setValue(value); 587 } 588 return this; 589 } 590 591 /** 592 * @return {@link #destination} (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 593 */ 594 public Reference getDestination() { 595 if (this.destination == null) 596 if (Configuration.errorOnAutoCreate()) 597 throw new Error("Attempt to auto-create SupplyDelivery.destination"); 598 else if (Configuration.doAutoCreate()) 599 this.destination = new Reference(); // cc 600 return this.destination; 601 } 602 603 public boolean hasDestination() { 604 return this.destination != null && !this.destination.isEmpty(); 605 } 606 607 /** 608 * @param value {@link #destination} (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 609 */ 610 public SupplyDelivery setDestination(Reference value) { 611 this.destination = value; 612 return this; 613 } 614 615 /** 616 * @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.) 617 */ 618 public Location getDestinationTarget() { 619 if (this.destinationTarget == null) 620 if (Configuration.errorOnAutoCreate()) 621 throw new Error("Attempt to auto-create SupplyDelivery.destination"); 622 else if (Configuration.doAutoCreate()) 623 this.destinationTarget = new Location(); // aa 624 return this.destinationTarget; 625 } 626 627 /** 628 * @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.) 629 */ 630 public SupplyDelivery setDestinationTarget(Location value) { 631 this.destinationTarget = value; 632 return this; 633 } 634 635 /** 636 * @return {@link #receiver} (Identifies the person who picked up the Supply.) 637 */ 638 public List<Reference> getReceiver() { 639 if (this.receiver == null) 640 this.receiver = new ArrayList<Reference>(); 641 return this.receiver; 642 } 643 644 public boolean hasReceiver() { 645 if (this.receiver == null) 646 return false; 647 for (Reference item : this.receiver) 648 if (!item.isEmpty()) 649 return true; 650 return false; 651 } 652 653 /** 654 * @return {@link #receiver} (Identifies the person who picked up the Supply.) 655 */ 656 // syntactic sugar 657 public Reference addReceiver() { //3 658 Reference t = new Reference(); 659 if (this.receiver == null) 660 this.receiver = new ArrayList<Reference>(); 661 this.receiver.add(t); 662 return t; 663 } 664 665 // syntactic sugar 666 public SupplyDelivery addReceiver(Reference t) { //3 667 if (t == null) 668 return this; 669 if (this.receiver == null) 670 this.receiver = new ArrayList<Reference>(); 671 this.receiver.add(t); 672 return this; 673 } 674 675 /** 676 * @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.) 677 */ 678 public List<Practitioner> getReceiverTarget() { 679 if (this.receiverTarget == null) 680 this.receiverTarget = new ArrayList<Practitioner>(); 681 return this.receiverTarget; 682 } 683 684 // syntactic sugar 685 /** 686 * @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.) 687 */ 688 public Practitioner addReceiverTarget() { 689 Practitioner r = new Practitioner(); 690 if (this.receiverTarget == null) 691 this.receiverTarget = new ArrayList<Practitioner>(); 692 this.receiverTarget.add(r); 693 return r; 694 } 695 696 protected void listChildren(List<Property> childrenList) { 697 super.listChildren(childrenList); 698 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)); 699 childrenList.add(new Property("status", "code", "A code specifying the state of the dispense event.", 0, java.lang.Integer.MAX_VALUE, status)); 700 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)); 701 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)); 702 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)); 703 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)); 704 childrenList.add(new Property("supplier", "Reference(Practitioner)", "The individual responsible for dispensing the medication, supplier or device.", 0, java.lang.Integer.MAX_VALUE, supplier)); 705 childrenList.add(new Property("whenPrepared", "Period", "The time the dispense event occurred.", 0, java.lang.Integer.MAX_VALUE, whenPrepared)); 706 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)); 707 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)); 708 childrenList.add(new Property("receiver", "Reference(Practitioner)", "Identifies the person who picked up the Supply.", 0, java.lang.Integer.MAX_VALUE, receiver)); 709 } 710 711 @Override 712 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 713 switch (hash) { 714 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 715 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SupplyDeliveryStatus> 716 case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference 717 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 718 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 719 case 1993333233: /*suppliedItem*/ return this.suppliedItem == null ? new Base[0] : new Base[] {this.suppliedItem}; // Reference 720 case -1663305268: /*supplier*/ return this.supplier == null ? new Base[0] : new Base[] {this.supplier}; // Reference 721 case -562837097: /*whenPrepared*/ return this.whenPrepared == null ? new Base[0] : new Base[] {this.whenPrepared}; // Period 722 case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DateTimeType 723 case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference 724 case -808719889: /*receiver*/ return this.receiver == null ? new Base[0] : this.receiver.toArray(new Base[this.receiver.size()]); // Reference 725 default: return super.getProperty(hash, name, checkValid); 726 } 727 728 } 729 730 @Override 731 public void setProperty(int hash, String name, Base value) throws FHIRException { 732 switch (hash) { 733 case -1618432855: // identifier 734 this.identifier = castToIdentifier(value); // Identifier 735 break; 736 case -892481550: // status 737 this.status = new SupplyDeliveryStatusEnumFactory().fromType(value); // Enumeration<SupplyDeliveryStatus> 738 break; 739 case -791418107: // patient 740 this.patient = castToReference(value); // Reference 741 break; 742 case 3575610: // type 743 this.type = castToCodeableConcept(value); // CodeableConcept 744 break; 745 case -1285004149: // quantity 746 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 747 break; 748 case 1993333233: // suppliedItem 749 this.suppliedItem = castToReference(value); // Reference 750 break; 751 case -1663305268: // supplier 752 this.supplier = castToReference(value); // Reference 753 break; 754 case -562837097: // whenPrepared 755 this.whenPrepared = castToPeriod(value); // Period 756 break; 757 case 3560141: // time 758 this.time = castToDateTime(value); // DateTimeType 759 break; 760 case -1429847026: // destination 761 this.destination = castToReference(value); // Reference 762 break; 763 case -808719889: // receiver 764 this.getReceiver().add(castToReference(value)); // Reference 765 break; 766 default: super.setProperty(hash, name, value); 767 } 768 769 } 770 771 @Override 772 public void setProperty(String name, Base value) throws FHIRException { 773 if (name.equals("identifier")) 774 this.identifier = castToIdentifier(value); // Identifier 775 else if (name.equals("status")) 776 this.status = new SupplyDeliveryStatusEnumFactory().fromType(value); // Enumeration<SupplyDeliveryStatus> 777 else if (name.equals("patient")) 778 this.patient = castToReference(value); // Reference 779 else if (name.equals("type")) 780 this.type = castToCodeableConcept(value); // CodeableConcept 781 else if (name.equals("quantity")) 782 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 783 else if (name.equals("suppliedItem")) 784 this.suppliedItem = castToReference(value); // Reference 785 else if (name.equals("supplier")) 786 this.supplier = castToReference(value); // Reference 787 else if (name.equals("whenPrepared")) 788 this.whenPrepared = castToPeriod(value); // Period 789 else if (name.equals("time")) 790 this.time = castToDateTime(value); // DateTimeType 791 else if (name.equals("destination")) 792 this.destination = castToReference(value); // Reference 793 else if (name.equals("receiver")) 794 this.getReceiver().add(castToReference(value)); 795 else 796 super.setProperty(name, value); 797 } 798 799 @Override 800 public Base makeProperty(int hash, String name) throws FHIRException { 801 switch (hash) { 802 case -1618432855: return getIdentifier(); // Identifier 803 case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<SupplyDeliveryStatus> 804 case -791418107: return getPatient(); // Reference 805 case 3575610: return getType(); // CodeableConcept 806 case -1285004149: return getQuantity(); // SimpleQuantity 807 case 1993333233: return getSuppliedItem(); // Reference 808 case -1663305268: return getSupplier(); // Reference 809 case -562837097: return getWhenPrepared(); // Period 810 case 3560141: throw new FHIRException("Cannot make property time as it is not a complex type"); // DateTimeType 811 case -1429847026: return getDestination(); // Reference 812 case -808719889: return addReceiver(); // Reference 813 default: return super.makeProperty(hash, name); 814 } 815 816 } 817 818 @Override 819 public Base addChild(String name) throws FHIRException { 820 if (name.equals("identifier")) { 821 this.identifier = new Identifier(); 822 return this.identifier; 823 } 824 else if (name.equals("status")) { 825 throw new FHIRException("Cannot call addChild on a primitive type SupplyDelivery.status"); 826 } 827 else if (name.equals("patient")) { 828 this.patient = new Reference(); 829 return this.patient; 830 } 831 else if (name.equals("type")) { 832 this.type = new CodeableConcept(); 833 return this.type; 834 } 835 else if (name.equals("quantity")) { 836 this.quantity = new SimpleQuantity(); 837 return this.quantity; 838 } 839 else if (name.equals("suppliedItem")) { 840 this.suppliedItem = new Reference(); 841 return this.suppliedItem; 842 } 843 else if (name.equals("supplier")) { 844 this.supplier = new Reference(); 845 return this.supplier; 846 } 847 else if (name.equals("whenPrepared")) { 848 this.whenPrepared = new Period(); 849 return this.whenPrepared; 850 } 851 else if (name.equals("time")) { 852 throw new FHIRException("Cannot call addChild on a primitive type SupplyDelivery.time"); 853 } 854 else if (name.equals("destination")) { 855 this.destination = new Reference(); 856 return this.destination; 857 } 858 else if (name.equals("receiver")) { 859 return addReceiver(); 860 } 861 else 862 return super.addChild(name); 863 } 864 865 public String fhirType() { 866 return "SupplyDelivery"; 867 868 } 869 870 public SupplyDelivery copy() { 871 SupplyDelivery dst = new SupplyDelivery(); 872 copyValues(dst); 873 dst.identifier = identifier == null ? null : identifier.copy(); 874 dst.status = status == null ? null : status.copy(); 875 dst.patient = patient == null ? null : patient.copy(); 876 dst.type = type == null ? null : type.copy(); 877 dst.quantity = quantity == null ? null : quantity.copy(); 878 dst.suppliedItem = suppliedItem == null ? null : suppliedItem.copy(); 879 dst.supplier = supplier == null ? null : supplier.copy(); 880 dst.whenPrepared = whenPrepared == null ? null : whenPrepared.copy(); 881 dst.time = time == null ? null : time.copy(); 882 dst.destination = destination == null ? null : destination.copy(); 883 if (receiver != null) { 884 dst.receiver = new ArrayList<Reference>(); 885 for (Reference i : receiver) 886 dst.receiver.add(i.copy()); 887 }; 888 return dst; 889 } 890 891 protected SupplyDelivery typedCopy() { 892 return copy(); 893 } 894 895 @Override 896 public boolean equalsDeep(Base other) { 897 if (!super.equalsDeep(other)) 898 return false; 899 if (!(other instanceof SupplyDelivery)) 900 return false; 901 SupplyDelivery o = (SupplyDelivery) other; 902 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true) 903 && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true) && compareDeep(suppliedItem, o.suppliedItem, true) 904 && compareDeep(supplier, o.supplier, true) && compareDeep(whenPrepared, o.whenPrepared, true) && compareDeep(time, o.time, true) 905 && compareDeep(destination, o.destination, true) && compareDeep(receiver, o.receiver, true); 906 } 907 908 @Override 909 public boolean equalsShallow(Base other) { 910 if (!super.equalsShallow(other)) 911 return false; 912 if (!(other instanceof SupplyDelivery)) 913 return false; 914 SupplyDelivery o = (SupplyDelivery) other; 915 return compareValues(status, o.status, true) && compareValues(time, o.time, true); 916 } 917 918 public boolean isEmpty() { 919 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 920 && (patient == null || patient.isEmpty()) && (type == null || type.isEmpty()) && (quantity == null || quantity.isEmpty()) 921 && (suppliedItem == null || suppliedItem.isEmpty()) && (supplier == null || supplier.isEmpty()) 922 && (whenPrepared == null || whenPrepared.isEmpty()) && (time == null || time.isEmpty()) && (destination == null || destination.isEmpty()) 923 && (receiver == null || receiver.isEmpty()); 924 } 925 926 @Override 927 public ResourceType getResourceType() { 928 return ResourceType.SupplyDelivery; 929 } 930 931 /** 932 * Search parameter: <b>patient</b> 933 * <p> 934 * Description: <b>Patient for whom the item is supplied</b><br> 935 * Type: <b>reference</b><br> 936 * Path: <b>SupplyDelivery.patient</b><br> 937 * </p> 938 */ 939 @SearchParamDefinition(name="patient", path="SupplyDelivery.patient", description="Patient for whom the item is supplied", type="reference" ) 940 public static final String SP_PATIENT = "patient"; 941 /** 942 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 943 * <p> 944 * Description: <b>Patient for whom the item is supplied</b><br> 945 * Type: <b>reference</b><br> 946 * Path: <b>SupplyDelivery.patient</b><br> 947 * </p> 948 */ 949 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 950 951/** 952 * Constant for fluent queries to be used to add include statements. Specifies 953 * the path value of "<b>SupplyDelivery:patient</b>". 954 */ 955 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("SupplyDelivery:patient").toLocked(); 956 957 /** 958 * Search parameter: <b>receiver</b> 959 * <p> 960 * Description: <b>Who collected the Supply</b><br> 961 * Type: <b>reference</b><br> 962 * Path: <b>SupplyDelivery.receiver</b><br> 963 * </p> 964 */ 965 @SearchParamDefinition(name="receiver", path="SupplyDelivery.receiver", description="Who collected the Supply", type="reference" ) 966 public static final String SP_RECEIVER = "receiver"; 967 /** 968 * <b>Fluent Client</b> search parameter constant for <b>receiver</b> 969 * <p> 970 * Description: <b>Who collected the Supply</b><br> 971 * Type: <b>reference</b><br> 972 * Path: <b>SupplyDelivery.receiver</b><br> 973 * </p> 974 */ 975 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECEIVER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECEIVER); 976 977/** 978 * Constant for fluent queries to be used to add include statements. Specifies 979 * the path value of "<b>SupplyDelivery:receiver</b>". 980 */ 981 public static final ca.uhn.fhir.model.api.Include INCLUDE_RECEIVER = new ca.uhn.fhir.model.api.Include("SupplyDelivery:receiver").toLocked(); 982 983 /** 984 * Search parameter: <b>status</b> 985 * <p> 986 * Description: <b>in-progress | completed | abandoned</b><br> 987 * Type: <b>token</b><br> 988 * Path: <b>SupplyDelivery.status</b><br> 989 * </p> 990 */ 991 @SearchParamDefinition(name="status", path="SupplyDelivery.status", description="in-progress | completed | abandoned", type="token" ) 992 public static final String SP_STATUS = "status"; 993 /** 994 * <b>Fluent Client</b> search parameter constant for <b>status</b> 995 * <p> 996 * Description: <b>in-progress | completed | abandoned</b><br> 997 * Type: <b>token</b><br> 998 * Path: <b>SupplyDelivery.status</b><br> 999 * </p> 1000 */ 1001 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1002 1003 /** 1004 * Search parameter: <b>identifier</b> 1005 * <p> 1006 * Description: <b>External identifier</b><br> 1007 * Type: <b>token</b><br> 1008 * Path: <b>SupplyDelivery.identifier</b><br> 1009 * </p> 1010 */ 1011 @SearchParamDefinition(name="identifier", path="SupplyDelivery.identifier", description="External identifier", type="token" ) 1012 public static final String SP_IDENTIFIER = "identifier"; 1013 /** 1014 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1015 * <p> 1016 * Description: <b>External identifier</b><br> 1017 * Type: <b>token</b><br> 1018 * Path: <b>SupplyDelivery.identifier</b><br> 1019 * </p> 1020 */ 1021 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1022 1023 /** 1024 * Search parameter: <b>supplier</b> 1025 * <p> 1026 * Description: <b>Dispenser</b><br> 1027 * Type: <b>reference</b><br> 1028 * Path: <b>SupplyDelivery.supplier</b><br> 1029 * </p> 1030 */ 1031 @SearchParamDefinition(name="supplier", path="SupplyDelivery.supplier", description="Dispenser", type="reference" ) 1032 public static final String SP_SUPPLIER = "supplier"; 1033 /** 1034 * <b>Fluent Client</b> search parameter constant for <b>supplier</b> 1035 * <p> 1036 * Description: <b>Dispenser</b><br> 1037 * Type: <b>reference</b><br> 1038 * Path: <b>SupplyDelivery.supplier</b><br> 1039 * </p> 1040 */ 1041 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPLIER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUPPLIER); 1042 1043/** 1044 * Constant for fluent queries to be used to add include statements. Specifies 1045 * the path value of "<b>SupplyDelivery:supplier</b>". 1046 */ 1047 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPLIER = new ca.uhn.fhir.model.api.Include("SupplyDelivery:supplier").toLocked(); 1048 1049 1050}