
001package org.hl7.fhir.r5.model; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r5.model.Enumerations.*; 039import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 045import ca.uhn.fhir.model.api.annotation.Child; 046import ca.uhn.fhir.model.api.annotation.ChildOrder; 047import ca.uhn.fhir.model.api.annotation.Description; 048import ca.uhn.fhir.model.api.annotation.Block; 049 050/** 051 * Indicates that a device is to be or has been dispensed for a named person/patient. This includes a description of the product (supply) provided and the instructions for using the device. 052 */ 053@ResourceDef(name="DeviceDispense", profile="http://hl7.org/fhir/StructureDefinition/DeviceDispense") 054public class DeviceDispense extends DomainResource { 055 056 public enum DeviceDispenseStatusCodes { 057 /** 058 * The core event has not started yet, but some staging activities have begun (e.g. initial preparing of the device. Preparation stages may be tracked e.g. for planning, supply or billing purposes. 059 */ 060 PREPARATION, 061 /** 062 * The dispensed product is ready for pickup. 063 */ 064 INPROGRESS, 065 /** 066 * The dispensed product was not and will never be picked up by the patient. 067 */ 068 CANCELLED, 069 /** 070 * The dispense process is paused while waiting for an external event to reactivate the dispense. For example, new stock has arrived or the prescriber has called. 071 */ 072 ONHOLD, 073 /** 074 * The dispensed product has been picked up. 075 */ 076 COMPLETED, 077 /** 078 * The dispense was entered in error and therefore nullified. 079 */ 080 ENTEREDINERROR, 081 /** 082 * Actions implied by the dispense have been permanently halted, before all of them occurred. 083 */ 084 STOPPED, 085 /** 086 * The dispense was declined and not performed. 087 */ 088 DECLINED, 089 /** 090 * The authoring system does not know which of the status values applies for this dispense. Note: this concept is not to be used for other - one of the listed statuses is presumed to apply, it's just now known which one. 091 */ 092 UNKNOWN, 093 /** 094 * added to help the parsers with the generic types 095 */ 096 NULL; 097 public static DeviceDispenseStatusCodes fromCode(String codeString) throws FHIRException { 098 if (codeString == null || "".equals(codeString)) 099 return null; 100 if ("preparation".equals(codeString)) 101 return PREPARATION; 102 if ("in-progress".equals(codeString)) 103 return INPROGRESS; 104 if ("cancelled".equals(codeString)) 105 return CANCELLED; 106 if ("on-hold".equals(codeString)) 107 return ONHOLD; 108 if ("completed".equals(codeString)) 109 return COMPLETED; 110 if ("entered-in-error".equals(codeString)) 111 return ENTEREDINERROR; 112 if ("stopped".equals(codeString)) 113 return STOPPED; 114 if ("declined".equals(codeString)) 115 return DECLINED; 116 if ("unknown".equals(codeString)) 117 return UNKNOWN; 118 if (Configuration.isAcceptInvalidEnums()) 119 return null; 120 else 121 throw new FHIRException("Unknown DeviceDispenseStatusCodes code '"+codeString+"'"); 122 } 123 public String toCode() { 124 switch (this) { 125 case PREPARATION: return "preparation"; 126 case INPROGRESS: return "in-progress"; 127 case CANCELLED: return "cancelled"; 128 case ONHOLD: return "on-hold"; 129 case COMPLETED: return "completed"; 130 case ENTEREDINERROR: return "entered-in-error"; 131 case STOPPED: return "stopped"; 132 case DECLINED: return "declined"; 133 case UNKNOWN: return "unknown"; 134 case NULL: return null; 135 default: return "?"; 136 } 137 } 138 public String getSystem() { 139 switch (this) { 140 case PREPARATION: return "http://hl7.org/fhir/devicedispense-status"; 141 case INPROGRESS: return "http://hl7.org/fhir/devicedispense-status"; 142 case CANCELLED: return "http://hl7.org/fhir/devicedispense-status"; 143 case ONHOLD: return "http://hl7.org/fhir/devicedispense-status"; 144 case COMPLETED: return "http://hl7.org/fhir/devicedispense-status"; 145 case ENTEREDINERROR: return "http://hl7.org/fhir/devicedispense-status"; 146 case STOPPED: return "http://hl7.org/fhir/devicedispense-status"; 147 case DECLINED: return "http://hl7.org/fhir/devicedispense-status"; 148 case UNKNOWN: return "http://hl7.org/fhir/devicedispense-status"; 149 case NULL: return null; 150 default: return "?"; 151 } 152 } 153 public String getDefinition() { 154 switch (this) { 155 case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. initial preparing of the device. Preparation stages may be tracked e.g. for planning, supply or billing purposes."; 156 case INPROGRESS: return "The dispensed product is ready for pickup."; 157 case CANCELLED: return "The dispensed product was not and will never be picked up by the patient."; 158 case ONHOLD: return "The dispense process is paused while waiting for an external event to reactivate the dispense. For example, new stock has arrived or the prescriber has called."; 159 case COMPLETED: return "The dispensed product has been picked up."; 160 case ENTEREDINERROR: return "The dispense was entered in error and therefore nullified."; 161 case STOPPED: return "Actions implied by the dispense have been permanently halted, before all of them occurred."; 162 case DECLINED: return "The dispense was declined and not performed."; 163 case UNKNOWN: return "The authoring system does not know which of the status values applies for this dispense. Note: this concept is not to be used for other - one of the listed statuses is presumed to apply, it's just now known which one."; 164 case NULL: return null; 165 default: return "?"; 166 } 167 } 168 public String getDisplay() { 169 switch (this) { 170 case PREPARATION: return "Preparation"; 171 case INPROGRESS: return "In Progress"; 172 case CANCELLED: return "Cancelled"; 173 case ONHOLD: return "On Hold"; 174 case COMPLETED: return "Completed"; 175 case ENTEREDINERROR: return "Entered in Error"; 176 case STOPPED: return "Stopped"; 177 case DECLINED: return "Declined"; 178 case UNKNOWN: return "Unknown"; 179 case NULL: return null; 180 default: return "?"; 181 } 182 } 183 } 184 185 public static class DeviceDispenseStatusCodesEnumFactory implements EnumFactory<DeviceDispenseStatusCodes> { 186 public DeviceDispenseStatusCodes fromCode(String codeString) throws IllegalArgumentException { 187 if (codeString == null || "".equals(codeString)) 188 if (codeString == null || "".equals(codeString)) 189 return null; 190 if ("preparation".equals(codeString)) 191 return DeviceDispenseStatusCodes.PREPARATION; 192 if ("in-progress".equals(codeString)) 193 return DeviceDispenseStatusCodes.INPROGRESS; 194 if ("cancelled".equals(codeString)) 195 return DeviceDispenseStatusCodes.CANCELLED; 196 if ("on-hold".equals(codeString)) 197 return DeviceDispenseStatusCodes.ONHOLD; 198 if ("completed".equals(codeString)) 199 return DeviceDispenseStatusCodes.COMPLETED; 200 if ("entered-in-error".equals(codeString)) 201 return DeviceDispenseStatusCodes.ENTEREDINERROR; 202 if ("stopped".equals(codeString)) 203 return DeviceDispenseStatusCodes.STOPPED; 204 if ("declined".equals(codeString)) 205 return DeviceDispenseStatusCodes.DECLINED; 206 if ("unknown".equals(codeString)) 207 return DeviceDispenseStatusCodes.UNKNOWN; 208 throw new IllegalArgumentException("Unknown DeviceDispenseStatusCodes code '"+codeString+"'"); 209 } 210 public Enumeration<DeviceDispenseStatusCodes> fromType(PrimitiveType<?> code) throws FHIRException { 211 if (code == null) 212 return null; 213 if (code.isEmpty()) 214 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.NULL, code); 215 String codeString = ((PrimitiveType) code).asStringValue(); 216 if (codeString == null || "".equals(codeString)) 217 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.NULL, code); 218 if ("preparation".equals(codeString)) 219 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.PREPARATION, code); 220 if ("in-progress".equals(codeString)) 221 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.INPROGRESS, code); 222 if ("cancelled".equals(codeString)) 223 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.CANCELLED, code); 224 if ("on-hold".equals(codeString)) 225 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.ONHOLD, code); 226 if ("completed".equals(codeString)) 227 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.COMPLETED, code); 228 if ("entered-in-error".equals(codeString)) 229 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.ENTEREDINERROR, code); 230 if ("stopped".equals(codeString)) 231 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.STOPPED, code); 232 if ("declined".equals(codeString)) 233 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.DECLINED, code); 234 if ("unknown".equals(codeString)) 235 return new Enumeration<DeviceDispenseStatusCodes>(this, DeviceDispenseStatusCodes.UNKNOWN, code); 236 throw new FHIRException("Unknown DeviceDispenseStatusCodes code '"+codeString+"'"); 237 } 238 public String toCode(DeviceDispenseStatusCodes code) { 239 if (code == DeviceDispenseStatusCodes.PREPARATION) 240 return "preparation"; 241 if (code == DeviceDispenseStatusCodes.INPROGRESS) 242 return "in-progress"; 243 if (code == DeviceDispenseStatusCodes.CANCELLED) 244 return "cancelled"; 245 if (code == DeviceDispenseStatusCodes.ONHOLD) 246 return "on-hold"; 247 if (code == DeviceDispenseStatusCodes.COMPLETED) 248 return "completed"; 249 if (code == DeviceDispenseStatusCodes.ENTEREDINERROR) 250 return "entered-in-error"; 251 if (code == DeviceDispenseStatusCodes.STOPPED) 252 return "stopped"; 253 if (code == DeviceDispenseStatusCodes.DECLINED) 254 return "declined"; 255 if (code == DeviceDispenseStatusCodes.UNKNOWN) 256 return "unknown"; 257 return "?"; 258 } 259 public String toSystem(DeviceDispenseStatusCodes code) { 260 return code.getSystem(); 261 } 262 } 263 264 @Block() 265 public static class DeviceDispensePerformerComponent extends BackboneElement implements IBaseBackboneElement { 266 /** 267 * Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker. 268 */ 269 @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false) 270 @Description(shortDefinition="Who performed the dispense and what they did", formalDefinition="Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker." ) 271 protected CodeableConcept function; 272 273 /** 274 * The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the device. 275 */ 276 @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, Device.class, RelatedPerson.class, CareTeam.class}, order=2, min=1, max=1, modifier=false, summary=false) 277 @Description(shortDefinition="Individual who was performing", formalDefinition="The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the device." ) 278 protected Reference actor; 279 280 private static final long serialVersionUID = -576943815L; 281 282 /** 283 * Constructor 284 */ 285 public DeviceDispensePerformerComponent() { 286 super(); 287 } 288 289 /** 290 * Constructor 291 */ 292 public DeviceDispensePerformerComponent(Reference actor) { 293 super(); 294 this.setActor(actor); 295 } 296 297 /** 298 * @return {@link #function} (Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.) 299 */ 300 public CodeableConcept getFunction() { 301 if (this.function == null) 302 if (Configuration.errorOnAutoCreate()) 303 throw new Error("Attempt to auto-create DeviceDispensePerformerComponent.function"); 304 else if (Configuration.doAutoCreate()) 305 this.function = new CodeableConcept(); // cc 306 return this.function; 307 } 308 309 public boolean hasFunction() { 310 return this.function != null && !this.function.isEmpty(); 311 } 312 313 /** 314 * @param value {@link #function} (Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.) 315 */ 316 public DeviceDispensePerformerComponent setFunction(CodeableConcept value) { 317 this.function = value; 318 return this; 319 } 320 321 /** 322 * @return {@link #actor} (The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the device.) 323 */ 324 public Reference getActor() { 325 if (this.actor == null) 326 if (Configuration.errorOnAutoCreate()) 327 throw new Error("Attempt to auto-create DeviceDispensePerformerComponent.actor"); 328 else if (Configuration.doAutoCreate()) 329 this.actor = new Reference(); // cc 330 return this.actor; 331 } 332 333 public boolean hasActor() { 334 return this.actor != null && !this.actor.isEmpty(); 335 } 336 337 /** 338 * @param value {@link #actor} (The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the device.) 339 */ 340 public DeviceDispensePerformerComponent setActor(Reference value) { 341 this.actor = value; 342 return this; 343 } 344 345 protected void listChildren(List<Property> children) { 346 super.listChildren(children); 347 children.add(new Property("function", "CodeableConcept", "Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.", 0, 1, function)); 348 children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the device.", 0, 1, actor)); 349 } 350 351 @Override 352 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 353 switch (_hash) { 354 case 1380938712: /*function*/ return new Property("function", "CodeableConcept", "Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.", 0, 1, function); 355 case 92645877: /*actor*/ return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the device.", 0, 1, actor); 356 default: return super.getNamedProperty(_hash, _name, _checkValid); 357 } 358 359 } 360 361 @Override 362 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 363 switch (hash) { 364 case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept 365 case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference 366 default: return super.getProperty(hash, name, checkValid); 367 } 368 369 } 370 371 @Override 372 public Base setProperty(int hash, String name, Base value) throws FHIRException { 373 switch (hash) { 374 case 1380938712: // function 375 this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 376 return value; 377 case 92645877: // actor 378 this.actor = TypeConvertor.castToReference(value); // Reference 379 return value; 380 default: return super.setProperty(hash, name, value); 381 } 382 383 } 384 385 @Override 386 public Base setProperty(String name, Base value) throws FHIRException { 387 if (name.equals("function")) { 388 this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 389 } else if (name.equals("actor")) { 390 this.actor = TypeConvertor.castToReference(value); // Reference 391 } else 392 return super.setProperty(name, value); 393 return value; 394 } 395 396 @Override 397 public Base makeProperty(int hash, String name) throws FHIRException { 398 switch (hash) { 399 case 1380938712: return getFunction(); 400 case 92645877: return getActor(); 401 default: return super.makeProperty(hash, name); 402 } 403 404 } 405 406 @Override 407 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 408 switch (hash) { 409 case 1380938712: /*function*/ return new String[] {"CodeableConcept"}; 410 case 92645877: /*actor*/ return new String[] {"Reference"}; 411 default: return super.getTypesForProperty(hash, name); 412 } 413 414 } 415 416 @Override 417 public Base addChild(String name) throws FHIRException { 418 if (name.equals("function")) { 419 this.function = new CodeableConcept(); 420 return this.function; 421 } 422 else if (name.equals("actor")) { 423 this.actor = new Reference(); 424 return this.actor; 425 } 426 else 427 return super.addChild(name); 428 } 429 430 public DeviceDispensePerformerComponent copy() { 431 DeviceDispensePerformerComponent dst = new DeviceDispensePerformerComponent(); 432 copyValues(dst); 433 return dst; 434 } 435 436 public void copyValues(DeviceDispensePerformerComponent dst) { 437 super.copyValues(dst); 438 dst.function = function == null ? null : function.copy(); 439 dst.actor = actor == null ? null : actor.copy(); 440 } 441 442 @Override 443 public boolean equalsDeep(Base other_) { 444 if (!super.equalsDeep(other_)) 445 return false; 446 if (!(other_ instanceof DeviceDispensePerformerComponent)) 447 return false; 448 DeviceDispensePerformerComponent o = (DeviceDispensePerformerComponent) other_; 449 return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true); 450 } 451 452 @Override 453 public boolean equalsShallow(Base other_) { 454 if (!super.equalsShallow(other_)) 455 return false; 456 if (!(other_ instanceof DeviceDispensePerformerComponent)) 457 return false; 458 DeviceDispensePerformerComponent o = (DeviceDispensePerformerComponent) other_; 459 return true; 460 } 461 462 public boolean isEmpty() { 463 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor); 464 } 465 466 public String fhirType() { 467 return "DeviceDispense.performer"; 468 469 } 470 471 } 472 473 /** 474 * Business identifier for this dispensation. 475 */ 476 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 477 @Description(shortDefinition="Business identifier for this dispensation", formalDefinition="Business identifier for this dispensation." ) 478 protected List<Identifier> identifier; 479 480 /** 481 * The order or request that this dispense is fulfilling. 482 */ 483 @Child(name = "basedOn", type = {CarePlan.class, DeviceRequest.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 484 @Description(shortDefinition="The order or request that this dispense is fulfilling", formalDefinition="The order or request that this dispense is fulfilling." ) 485 protected List<Reference> basedOn; 486 487 /** 488 * The bigger event that this dispense is a part of. 489 */ 490 @Child(name = "partOf", type = {Procedure.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 491 @Description(shortDefinition="The bigger event that this dispense is a part of", formalDefinition="The bigger event that this dispense is a part of." ) 492 protected List<Reference> partOf; 493 494 /** 495 * A code specifying the state of the set of dispense events. 496 */ 497 @Child(name = "status", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true) 498 @Description(shortDefinition="preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown", formalDefinition="A code specifying the state of the set of dispense events." ) 499 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicedispense-status") 500 protected Enumeration<DeviceDispenseStatusCodes> status; 501 502 /** 503 * Indicates the reason why a dispense was or was not performed. 504 */ 505 @Child(name = "statusReason", type = {CodeableReference.class}, order=4, min=0, max=1, modifier=false, summary=false) 506 @Description(shortDefinition="Why a dispense was or was not performed", formalDefinition="Indicates the reason why a dispense was or was not performed." ) 507 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicedispense-status-reason") 508 protected CodeableReference statusReason; 509 510 /** 511 * Indicates the type of device dispense. 512 */ 513 @Child(name = "category", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 514 @Description(shortDefinition="Type of device dispense", formalDefinition="Indicates the type of device dispense." ) 515 protected List<CodeableConcept> category; 516 517 /** 518 * Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices. 519 */ 520 @Child(name = "device", type = {CodeableReference.class}, order=6, min=1, max=1, modifier=false, summary=true) 521 @Description(shortDefinition="What device was supplied", formalDefinition="Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices." ) 522 protected CodeableReference device; 523 524 /** 525 * A link to a resource representing the person to whom the device is intended. 526 */ 527 @Child(name = "subject", type = {Patient.class, Practitioner.class}, order=7, min=1, max=1, modifier=false, summary=true) 528 @Description(shortDefinition="Who the dispense is for", formalDefinition="A link to a resource representing the person to whom the device is intended." ) 529 protected Reference subject; 530 531 /** 532 * Identifies the person who picked up the device or the person or location where the device was delivered. This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location. 533 */ 534 @Child(name = "receiver", type = {Patient.class, Practitioner.class, RelatedPerson.class, Location.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false) 535 @Description(shortDefinition="Who collected the device or where the medication was delivered", formalDefinition="Identifies the person who picked up the device or the person or location where the device was delivered. This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location." ) 536 protected Reference receiver; 537 538 /** 539 * The encounter that establishes the context for this event. 540 */ 541 @Child(name = "encounter", type = {Encounter.class}, order=9, min=0, max=1, modifier=false, summary=false) 542 @Description(shortDefinition="Encounter associated with event", formalDefinition="The encounter that establishes the context for this event." ) 543 protected Reference encounter; 544 545 /** 546 * Additional information that supports the device being dispensed. 547 */ 548 @Child(name = "supportingInformation", type = {Reference.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 549 @Description(shortDefinition="Information that supports the dispensing of the device", formalDefinition="Additional information that supports the device being dispensed." ) 550 protected List<Reference> supportingInformation; 551 552 /** 553 * Indicates who or what performed the event. 554 */ 555 @Child(name = "performer", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 556 @Description(shortDefinition="Who performed event", formalDefinition="Indicates who or what performed the event." ) 557 protected List<DeviceDispensePerformerComponent> performer; 558 559 /** 560 * The principal physical location where the dispense was performed. 561 */ 562 @Child(name = "location", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false) 563 @Description(shortDefinition="Where the dispense occurred", formalDefinition="The principal physical location where the dispense was performed." ) 564 protected Reference location; 565 566 /** 567 * Indicates the type of dispensing event that is performed. 568 */ 569 @Child(name = "type", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false) 570 @Description(shortDefinition="Trial fill, partial fill, emergency fill, etc", formalDefinition="Indicates the type of dispensing event that is performed." ) 571 protected CodeableConcept type; 572 573 /** 574 * The number of devices that have been dispensed. 575 */ 576 @Child(name = "quantity", type = {Quantity.class}, order=14, min=0, max=1, modifier=false, summary=false) 577 @Description(shortDefinition="Amount dispensed", formalDefinition="The number of devices that have been dispensed." ) 578 protected Quantity quantity; 579 580 /** 581 * The time when the dispensed product was packaged and reviewed. 582 */ 583 @Child(name = "preparedDate", type = {DateTimeType.class}, order=15, min=0, max=1, modifier=false, summary=true) 584 @Description(shortDefinition="When product was packaged and reviewed", formalDefinition="The time when the dispensed product was packaged and reviewed." ) 585 protected DateTimeType preparedDate; 586 587 /** 588 * The time the dispensed product was made available to the patient or their representative. 589 */ 590 @Child(name = "whenHandedOver", type = {DateTimeType.class}, order=16, min=0, max=1, modifier=false, summary=false) 591 @Description(shortDefinition="When product was given out", formalDefinition="The time the dispensed product was made available to the patient or their representative." ) 592 protected DateTimeType whenHandedOver; 593 594 /** 595 * Identification of the facility/location where the device was /should be shipped to, as part of the dispense process. 596 */ 597 @Child(name = "destination", type = {Location.class}, order=17, min=0, max=1, modifier=false, summary=false) 598 @Description(shortDefinition="Where the device was sent or should be sent", formalDefinition="Identification of the facility/location where the device was /should be shipped to, as part of the dispense process." ) 599 protected Reference destination; 600 601 /** 602 * Extra information about the dispense that could not be conveyed in the other attributes. 603 */ 604 @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 605 @Description(shortDefinition="Information about the dispense", formalDefinition="Extra information about the dispense that could not be conveyed in the other attributes." ) 606 protected List<Annotation> note; 607 608 /** 609 * The full representation of the instructions. 610 */ 611 @Child(name = "usageInstruction", type = {MarkdownType.class}, order=19, min=0, max=1, modifier=false, summary=false) 612 @Description(shortDefinition="Full representation of the usage instructions", formalDefinition="The full representation of the instructions." ) 613 protected MarkdownType usageInstruction; 614 615 /** 616 * A summary of the events of interest that have occurred, such as when the dispense was verified. 617 */ 618 @Child(name = "eventHistory", type = {Provenance.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 619 @Description(shortDefinition="A list of relevant lifecycle events", formalDefinition="A summary of the events of interest that have occurred, such as when the dispense was verified." ) 620 protected List<Reference> eventHistory; 621 622 private static final long serialVersionUID = 1740231007L; 623 624 /** 625 * Constructor 626 */ 627 public DeviceDispense() { 628 super(); 629 } 630 631 /** 632 * Constructor 633 */ 634 public DeviceDispense(DeviceDispenseStatusCodes status, CodeableReference device, Reference subject) { 635 super(); 636 this.setStatus(status); 637 this.setDevice(device); 638 this.setSubject(subject); 639 } 640 641 /** 642 * @return {@link #identifier} (Business identifier for this dispensation.) 643 */ 644 public List<Identifier> getIdentifier() { 645 if (this.identifier == null) 646 this.identifier = new ArrayList<Identifier>(); 647 return this.identifier; 648 } 649 650 /** 651 * @return Returns a reference to <code>this</code> for easy method chaining 652 */ 653 public DeviceDispense setIdentifier(List<Identifier> theIdentifier) { 654 this.identifier = theIdentifier; 655 return this; 656 } 657 658 public boolean hasIdentifier() { 659 if (this.identifier == null) 660 return false; 661 for (Identifier item : this.identifier) 662 if (!item.isEmpty()) 663 return true; 664 return false; 665 } 666 667 public Identifier addIdentifier() { //3 668 Identifier t = new Identifier(); 669 if (this.identifier == null) 670 this.identifier = new ArrayList<Identifier>(); 671 this.identifier.add(t); 672 return t; 673 } 674 675 public DeviceDispense addIdentifier(Identifier t) { //3 676 if (t == null) 677 return this; 678 if (this.identifier == null) 679 this.identifier = new ArrayList<Identifier>(); 680 this.identifier.add(t); 681 return this; 682 } 683 684 /** 685 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3} 686 */ 687 public Identifier getIdentifierFirstRep() { 688 if (getIdentifier().isEmpty()) { 689 addIdentifier(); 690 } 691 return getIdentifier().get(0); 692 } 693 694 /** 695 * @return {@link #basedOn} (The order or request that this dispense is fulfilling.) 696 */ 697 public List<Reference> getBasedOn() { 698 if (this.basedOn == null) 699 this.basedOn = new ArrayList<Reference>(); 700 return this.basedOn; 701 } 702 703 /** 704 * @return Returns a reference to <code>this</code> for easy method chaining 705 */ 706 public DeviceDispense setBasedOn(List<Reference> theBasedOn) { 707 this.basedOn = theBasedOn; 708 return this; 709 } 710 711 public boolean hasBasedOn() { 712 if (this.basedOn == null) 713 return false; 714 for (Reference item : this.basedOn) 715 if (!item.isEmpty()) 716 return true; 717 return false; 718 } 719 720 public Reference addBasedOn() { //3 721 Reference t = new Reference(); 722 if (this.basedOn == null) 723 this.basedOn = new ArrayList<Reference>(); 724 this.basedOn.add(t); 725 return t; 726 } 727 728 public DeviceDispense addBasedOn(Reference t) { //3 729 if (t == null) 730 return this; 731 if (this.basedOn == null) 732 this.basedOn = new ArrayList<Reference>(); 733 this.basedOn.add(t); 734 return this; 735 } 736 737 /** 738 * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3} 739 */ 740 public Reference getBasedOnFirstRep() { 741 if (getBasedOn().isEmpty()) { 742 addBasedOn(); 743 } 744 return getBasedOn().get(0); 745 } 746 747 /** 748 * @return {@link #partOf} (The bigger event that this dispense is a part of.) 749 */ 750 public List<Reference> getPartOf() { 751 if (this.partOf == null) 752 this.partOf = new ArrayList<Reference>(); 753 return this.partOf; 754 } 755 756 /** 757 * @return Returns a reference to <code>this</code> for easy method chaining 758 */ 759 public DeviceDispense setPartOf(List<Reference> thePartOf) { 760 this.partOf = thePartOf; 761 return this; 762 } 763 764 public boolean hasPartOf() { 765 if (this.partOf == null) 766 return false; 767 for (Reference item : this.partOf) 768 if (!item.isEmpty()) 769 return true; 770 return false; 771 } 772 773 public Reference addPartOf() { //3 774 Reference t = new Reference(); 775 if (this.partOf == null) 776 this.partOf = new ArrayList<Reference>(); 777 this.partOf.add(t); 778 return t; 779 } 780 781 public DeviceDispense addPartOf(Reference t) { //3 782 if (t == null) 783 return this; 784 if (this.partOf == null) 785 this.partOf = new ArrayList<Reference>(); 786 this.partOf.add(t); 787 return this; 788 } 789 790 /** 791 * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist {3} 792 */ 793 public Reference getPartOfFirstRep() { 794 if (getPartOf().isEmpty()) { 795 addPartOf(); 796 } 797 return getPartOf().get(0); 798 } 799 800 /** 801 * @return {@link #status} (A code specifying the state of the set of dispense events.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 802 */ 803 public Enumeration<DeviceDispenseStatusCodes> getStatusElement() { 804 if (this.status == null) 805 if (Configuration.errorOnAutoCreate()) 806 throw new Error("Attempt to auto-create DeviceDispense.status"); 807 else if (Configuration.doAutoCreate()) 808 this.status = new Enumeration<DeviceDispenseStatusCodes>(new DeviceDispenseStatusCodesEnumFactory()); // bb 809 return this.status; 810 } 811 812 public boolean hasStatusElement() { 813 return this.status != null && !this.status.isEmpty(); 814 } 815 816 public boolean hasStatus() { 817 return this.status != null && !this.status.isEmpty(); 818 } 819 820 /** 821 * @param value {@link #status} (A code specifying the state of the set of dispense events.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 822 */ 823 public DeviceDispense setStatusElement(Enumeration<DeviceDispenseStatusCodes> value) { 824 this.status = value; 825 return this; 826 } 827 828 /** 829 * @return A code specifying the state of the set of dispense events. 830 */ 831 public DeviceDispenseStatusCodes getStatus() { 832 return this.status == null ? null : this.status.getValue(); 833 } 834 835 /** 836 * @param value A code specifying the state of the set of dispense events. 837 */ 838 public DeviceDispense setStatus(DeviceDispenseStatusCodes value) { 839 if (this.status == null) 840 this.status = new Enumeration<DeviceDispenseStatusCodes>(new DeviceDispenseStatusCodesEnumFactory()); 841 this.status.setValue(value); 842 return this; 843 } 844 845 /** 846 * @return {@link #statusReason} (Indicates the reason why a dispense was or was not performed.) 847 */ 848 public CodeableReference getStatusReason() { 849 if (this.statusReason == null) 850 if (Configuration.errorOnAutoCreate()) 851 throw new Error("Attempt to auto-create DeviceDispense.statusReason"); 852 else if (Configuration.doAutoCreate()) 853 this.statusReason = new CodeableReference(); // cc 854 return this.statusReason; 855 } 856 857 public boolean hasStatusReason() { 858 return this.statusReason != null && !this.statusReason.isEmpty(); 859 } 860 861 /** 862 * @param value {@link #statusReason} (Indicates the reason why a dispense was or was not performed.) 863 */ 864 public DeviceDispense setStatusReason(CodeableReference value) { 865 this.statusReason = value; 866 return this; 867 } 868 869 /** 870 * @return {@link #category} (Indicates the type of device dispense.) 871 */ 872 public List<CodeableConcept> getCategory() { 873 if (this.category == null) 874 this.category = new ArrayList<CodeableConcept>(); 875 return this.category; 876 } 877 878 /** 879 * @return Returns a reference to <code>this</code> for easy method chaining 880 */ 881 public DeviceDispense setCategory(List<CodeableConcept> theCategory) { 882 this.category = theCategory; 883 return this; 884 } 885 886 public boolean hasCategory() { 887 if (this.category == null) 888 return false; 889 for (CodeableConcept item : this.category) 890 if (!item.isEmpty()) 891 return true; 892 return false; 893 } 894 895 public CodeableConcept addCategory() { //3 896 CodeableConcept t = new CodeableConcept(); 897 if (this.category == null) 898 this.category = new ArrayList<CodeableConcept>(); 899 this.category.add(t); 900 return t; 901 } 902 903 public DeviceDispense addCategory(CodeableConcept t) { //3 904 if (t == null) 905 return this; 906 if (this.category == null) 907 this.category = new ArrayList<CodeableConcept>(); 908 this.category.add(t); 909 return this; 910 } 911 912 /** 913 * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3} 914 */ 915 public CodeableConcept getCategoryFirstRep() { 916 if (getCategory().isEmpty()) { 917 addCategory(); 918 } 919 return getCategory().get(0); 920 } 921 922 /** 923 * @return {@link #device} (Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices.) 924 */ 925 public CodeableReference getDevice() { 926 if (this.device == null) 927 if (Configuration.errorOnAutoCreate()) 928 throw new Error("Attempt to auto-create DeviceDispense.device"); 929 else if (Configuration.doAutoCreate()) 930 this.device = new CodeableReference(); // cc 931 return this.device; 932 } 933 934 public boolean hasDevice() { 935 return this.device != null && !this.device.isEmpty(); 936 } 937 938 /** 939 * @param value {@link #device} (Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices.) 940 */ 941 public DeviceDispense setDevice(CodeableReference value) { 942 this.device = value; 943 return this; 944 } 945 946 /** 947 * @return {@link #subject} (A link to a resource representing the person to whom the device is intended.) 948 */ 949 public Reference getSubject() { 950 if (this.subject == null) 951 if (Configuration.errorOnAutoCreate()) 952 throw new Error("Attempt to auto-create DeviceDispense.subject"); 953 else if (Configuration.doAutoCreate()) 954 this.subject = new Reference(); // cc 955 return this.subject; 956 } 957 958 public boolean hasSubject() { 959 return this.subject != null && !this.subject.isEmpty(); 960 } 961 962 /** 963 * @param value {@link #subject} (A link to a resource representing the person to whom the device is intended.) 964 */ 965 public DeviceDispense setSubject(Reference value) { 966 this.subject = value; 967 return this; 968 } 969 970 /** 971 * @return {@link #receiver} (Identifies the person who picked up the device or the person or location where the device was delivered. This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.) 972 */ 973 public Reference getReceiver() { 974 if (this.receiver == null) 975 if (Configuration.errorOnAutoCreate()) 976 throw new Error("Attempt to auto-create DeviceDispense.receiver"); 977 else if (Configuration.doAutoCreate()) 978 this.receiver = new Reference(); // cc 979 return this.receiver; 980 } 981 982 public boolean hasReceiver() { 983 return this.receiver != null && !this.receiver.isEmpty(); 984 } 985 986 /** 987 * @param value {@link #receiver} (Identifies the person who picked up the device or the person or location where the device was delivered. This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.) 988 */ 989 public DeviceDispense setReceiver(Reference value) { 990 this.receiver = value; 991 return this; 992 } 993 994 /** 995 * @return {@link #encounter} (The encounter that establishes the context for this event.) 996 */ 997 public Reference getEncounter() { 998 if (this.encounter == null) 999 if (Configuration.errorOnAutoCreate()) 1000 throw new Error("Attempt to auto-create DeviceDispense.encounter"); 1001 else if (Configuration.doAutoCreate()) 1002 this.encounter = new Reference(); // cc 1003 return this.encounter; 1004 } 1005 1006 public boolean hasEncounter() { 1007 return this.encounter != null && !this.encounter.isEmpty(); 1008 } 1009 1010 /** 1011 * @param value {@link #encounter} (The encounter that establishes the context for this event.) 1012 */ 1013 public DeviceDispense setEncounter(Reference value) { 1014 this.encounter = value; 1015 return this; 1016 } 1017 1018 /** 1019 * @return {@link #supportingInformation} (Additional information that supports the device being dispensed.) 1020 */ 1021 public List<Reference> getSupportingInformation() { 1022 if (this.supportingInformation == null) 1023 this.supportingInformation = new ArrayList<Reference>(); 1024 return this.supportingInformation; 1025 } 1026 1027 /** 1028 * @return Returns a reference to <code>this</code> for easy method chaining 1029 */ 1030 public DeviceDispense setSupportingInformation(List<Reference> theSupportingInformation) { 1031 this.supportingInformation = theSupportingInformation; 1032 return this; 1033 } 1034 1035 public boolean hasSupportingInformation() { 1036 if (this.supportingInformation == null) 1037 return false; 1038 for (Reference item : this.supportingInformation) 1039 if (!item.isEmpty()) 1040 return true; 1041 return false; 1042 } 1043 1044 public Reference addSupportingInformation() { //3 1045 Reference t = new Reference(); 1046 if (this.supportingInformation == null) 1047 this.supportingInformation = new ArrayList<Reference>(); 1048 this.supportingInformation.add(t); 1049 return t; 1050 } 1051 1052 public DeviceDispense addSupportingInformation(Reference t) { //3 1053 if (t == null) 1054 return this; 1055 if (this.supportingInformation == null) 1056 this.supportingInformation = new ArrayList<Reference>(); 1057 this.supportingInformation.add(t); 1058 return this; 1059 } 1060 1061 /** 1062 * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist {3} 1063 */ 1064 public Reference getSupportingInformationFirstRep() { 1065 if (getSupportingInformation().isEmpty()) { 1066 addSupportingInformation(); 1067 } 1068 return getSupportingInformation().get(0); 1069 } 1070 1071 /** 1072 * @return {@link #performer} (Indicates who or what performed the event.) 1073 */ 1074 public List<DeviceDispensePerformerComponent> getPerformer() { 1075 if (this.performer == null) 1076 this.performer = new ArrayList<DeviceDispensePerformerComponent>(); 1077 return this.performer; 1078 } 1079 1080 /** 1081 * @return Returns a reference to <code>this</code> for easy method chaining 1082 */ 1083 public DeviceDispense setPerformer(List<DeviceDispensePerformerComponent> thePerformer) { 1084 this.performer = thePerformer; 1085 return this; 1086 } 1087 1088 public boolean hasPerformer() { 1089 if (this.performer == null) 1090 return false; 1091 for (DeviceDispensePerformerComponent item : this.performer) 1092 if (!item.isEmpty()) 1093 return true; 1094 return false; 1095 } 1096 1097 public DeviceDispensePerformerComponent addPerformer() { //3 1098 DeviceDispensePerformerComponent t = new DeviceDispensePerformerComponent(); 1099 if (this.performer == null) 1100 this.performer = new ArrayList<DeviceDispensePerformerComponent>(); 1101 this.performer.add(t); 1102 return t; 1103 } 1104 1105 public DeviceDispense addPerformer(DeviceDispensePerformerComponent t) { //3 1106 if (t == null) 1107 return this; 1108 if (this.performer == null) 1109 this.performer = new ArrayList<DeviceDispensePerformerComponent>(); 1110 this.performer.add(t); 1111 return this; 1112 } 1113 1114 /** 1115 * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist {3} 1116 */ 1117 public DeviceDispensePerformerComponent getPerformerFirstRep() { 1118 if (getPerformer().isEmpty()) { 1119 addPerformer(); 1120 } 1121 return getPerformer().get(0); 1122 } 1123 1124 /** 1125 * @return {@link #location} (The principal physical location where the dispense was performed.) 1126 */ 1127 public Reference getLocation() { 1128 if (this.location == null) 1129 if (Configuration.errorOnAutoCreate()) 1130 throw new Error("Attempt to auto-create DeviceDispense.location"); 1131 else if (Configuration.doAutoCreate()) 1132 this.location = new Reference(); // cc 1133 return this.location; 1134 } 1135 1136 public boolean hasLocation() { 1137 return this.location != null && !this.location.isEmpty(); 1138 } 1139 1140 /** 1141 * @param value {@link #location} (The principal physical location where the dispense was performed.) 1142 */ 1143 public DeviceDispense setLocation(Reference value) { 1144 this.location = value; 1145 return this; 1146 } 1147 1148 /** 1149 * @return {@link #type} (Indicates the type of dispensing event that is performed.) 1150 */ 1151 public CodeableConcept getType() { 1152 if (this.type == null) 1153 if (Configuration.errorOnAutoCreate()) 1154 throw new Error("Attempt to auto-create DeviceDispense.type"); 1155 else if (Configuration.doAutoCreate()) 1156 this.type = new CodeableConcept(); // cc 1157 return this.type; 1158 } 1159 1160 public boolean hasType() { 1161 return this.type != null && !this.type.isEmpty(); 1162 } 1163 1164 /** 1165 * @param value {@link #type} (Indicates the type of dispensing event that is performed.) 1166 */ 1167 public DeviceDispense setType(CodeableConcept value) { 1168 this.type = value; 1169 return this; 1170 } 1171 1172 /** 1173 * @return {@link #quantity} (The number of devices that have been dispensed.) 1174 */ 1175 public Quantity getQuantity() { 1176 if (this.quantity == null) 1177 if (Configuration.errorOnAutoCreate()) 1178 throw new Error("Attempt to auto-create DeviceDispense.quantity"); 1179 else if (Configuration.doAutoCreate()) 1180 this.quantity = new Quantity(); // cc 1181 return this.quantity; 1182 } 1183 1184 public boolean hasQuantity() { 1185 return this.quantity != null && !this.quantity.isEmpty(); 1186 } 1187 1188 /** 1189 * @param value {@link #quantity} (The number of devices that have been dispensed.) 1190 */ 1191 public DeviceDispense setQuantity(Quantity value) { 1192 this.quantity = value; 1193 return this; 1194 } 1195 1196 /** 1197 * @return {@link #preparedDate} (The time when the dispensed product was packaged and reviewed.). This is the underlying object with id, value and extensions. The accessor "getPreparedDate" gives direct access to the value 1198 */ 1199 public DateTimeType getPreparedDateElement() { 1200 if (this.preparedDate == null) 1201 if (Configuration.errorOnAutoCreate()) 1202 throw new Error("Attempt to auto-create DeviceDispense.preparedDate"); 1203 else if (Configuration.doAutoCreate()) 1204 this.preparedDate = new DateTimeType(); // bb 1205 return this.preparedDate; 1206 } 1207 1208 public boolean hasPreparedDateElement() { 1209 return this.preparedDate != null && !this.preparedDate.isEmpty(); 1210 } 1211 1212 public boolean hasPreparedDate() { 1213 return this.preparedDate != null && !this.preparedDate.isEmpty(); 1214 } 1215 1216 /** 1217 * @param value {@link #preparedDate} (The time when the dispensed product was packaged and reviewed.). This is the underlying object with id, value and extensions. The accessor "getPreparedDate" gives direct access to the value 1218 */ 1219 public DeviceDispense setPreparedDateElement(DateTimeType value) { 1220 this.preparedDate = value; 1221 return this; 1222 } 1223 1224 /** 1225 * @return The time when the dispensed product was packaged and reviewed. 1226 */ 1227 public Date getPreparedDate() { 1228 return this.preparedDate == null ? null : this.preparedDate.getValue(); 1229 } 1230 1231 /** 1232 * @param value The time when the dispensed product was packaged and reviewed. 1233 */ 1234 public DeviceDispense setPreparedDate(Date value) { 1235 if (value == null) 1236 this.preparedDate = null; 1237 else { 1238 if (this.preparedDate == null) 1239 this.preparedDate = new DateTimeType(); 1240 this.preparedDate.setValue(value); 1241 } 1242 return this; 1243 } 1244 1245 /** 1246 * @return {@link #whenHandedOver} (The time the dispensed product was made available to the patient or their representative.). This is the underlying object with id, value and extensions. The accessor "getWhenHandedOver" gives direct access to the value 1247 */ 1248 public DateTimeType getWhenHandedOverElement() { 1249 if (this.whenHandedOver == null) 1250 if (Configuration.errorOnAutoCreate()) 1251 throw new Error("Attempt to auto-create DeviceDispense.whenHandedOver"); 1252 else if (Configuration.doAutoCreate()) 1253 this.whenHandedOver = new DateTimeType(); // bb 1254 return this.whenHandedOver; 1255 } 1256 1257 public boolean hasWhenHandedOverElement() { 1258 return this.whenHandedOver != null && !this.whenHandedOver.isEmpty(); 1259 } 1260 1261 public boolean hasWhenHandedOver() { 1262 return this.whenHandedOver != null && !this.whenHandedOver.isEmpty(); 1263 } 1264 1265 /** 1266 * @param value {@link #whenHandedOver} (The time the dispensed product was made available to the patient or their representative.). This is the underlying object with id, value and extensions. The accessor "getWhenHandedOver" gives direct access to the value 1267 */ 1268 public DeviceDispense setWhenHandedOverElement(DateTimeType value) { 1269 this.whenHandedOver = value; 1270 return this; 1271 } 1272 1273 /** 1274 * @return The time the dispensed product was made available to the patient or their representative. 1275 */ 1276 public Date getWhenHandedOver() { 1277 return this.whenHandedOver == null ? null : this.whenHandedOver.getValue(); 1278 } 1279 1280 /** 1281 * @param value The time the dispensed product was made available to the patient or their representative. 1282 */ 1283 public DeviceDispense setWhenHandedOver(Date value) { 1284 if (value == null) 1285 this.whenHandedOver = null; 1286 else { 1287 if (this.whenHandedOver == null) 1288 this.whenHandedOver = new DateTimeType(); 1289 this.whenHandedOver.setValue(value); 1290 } 1291 return this; 1292 } 1293 1294 /** 1295 * @return {@link #destination} (Identification of the facility/location where the device was /should be shipped to, as part of the dispense process.) 1296 */ 1297 public Reference getDestination() { 1298 if (this.destination == null) 1299 if (Configuration.errorOnAutoCreate()) 1300 throw new Error("Attempt to auto-create DeviceDispense.destination"); 1301 else if (Configuration.doAutoCreate()) 1302 this.destination = new Reference(); // cc 1303 return this.destination; 1304 } 1305 1306 public boolean hasDestination() { 1307 return this.destination != null && !this.destination.isEmpty(); 1308 } 1309 1310 /** 1311 * @param value {@link #destination} (Identification of the facility/location where the device was /should be shipped to, as part of the dispense process.) 1312 */ 1313 public DeviceDispense setDestination(Reference value) { 1314 this.destination = value; 1315 return this; 1316 } 1317 1318 /** 1319 * @return {@link #note} (Extra information about the dispense that could not be conveyed in the other attributes.) 1320 */ 1321 public List<Annotation> getNote() { 1322 if (this.note == null) 1323 this.note = new ArrayList<Annotation>(); 1324 return this.note; 1325 } 1326 1327 /** 1328 * @return Returns a reference to <code>this</code> for easy method chaining 1329 */ 1330 public DeviceDispense setNote(List<Annotation> theNote) { 1331 this.note = theNote; 1332 return this; 1333 } 1334 1335 public boolean hasNote() { 1336 if (this.note == null) 1337 return false; 1338 for (Annotation item : this.note) 1339 if (!item.isEmpty()) 1340 return true; 1341 return false; 1342 } 1343 1344 public Annotation addNote() { //3 1345 Annotation t = new Annotation(); 1346 if (this.note == null) 1347 this.note = new ArrayList<Annotation>(); 1348 this.note.add(t); 1349 return t; 1350 } 1351 1352 public DeviceDispense addNote(Annotation t) { //3 1353 if (t == null) 1354 return this; 1355 if (this.note == null) 1356 this.note = new ArrayList<Annotation>(); 1357 this.note.add(t); 1358 return this; 1359 } 1360 1361 /** 1362 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3} 1363 */ 1364 public Annotation getNoteFirstRep() { 1365 if (getNote().isEmpty()) { 1366 addNote(); 1367 } 1368 return getNote().get(0); 1369 } 1370 1371 /** 1372 * @return {@link #usageInstruction} (The full representation of the instructions.). This is the underlying object with id, value and extensions. The accessor "getUsageInstruction" gives direct access to the value 1373 */ 1374 public MarkdownType getUsageInstructionElement() { 1375 if (this.usageInstruction == null) 1376 if (Configuration.errorOnAutoCreate()) 1377 throw new Error("Attempt to auto-create DeviceDispense.usageInstruction"); 1378 else if (Configuration.doAutoCreate()) 1379 this.usageInstruction = new MarkdownType(); // bb 1380 return this.usageInstruction; 1381 } 1382 1383 public boolean hasUsageInstructionElement() { 1384 return this.usageInstruction != null && !this.usageInstruction.isEmpty(); 1385 } 1386 1387 public boolean hasUsageInstruction() { 1388 return this.usageInstruction != null && !this.usageInstruction.isEmpty(); 1389 } 1390 1391 /** 1392 * @param value {@link #usageInstruction} (The full representation of the instructions.). This is the underlying object with id, value and extensions. The accessor "getUsageInstruction" gives direct access to the value 1393 */ 1394 public DeviceDispense setUsageInstructionElement(MarkdownType value) { 1395 this.usageInstruction = value; 1396 return this; 1397 } 1398 1399 /** 1400 * @return The full representation of the instructions. 1401 */ 1402 public String getUsageInstruction() { 1403 return this.usageInstruction == null ? null : this.usageInstruction.getValue(); 1404 } 1405 1406 /** 1407 * @param value The full representation of the instructions. 1408 */ 1409 public DeviceDispense setUsageInstruction(String value) { 1410 if (Utilities.noString(value)) 1411 this.usageInstruction = null; 1412 else { 1413 if (this.usageInstruction == null) 1414 this.usageInstruction = new MarkdownType(); 1415 this.usageInstruction.setValue(value); 1416 } 1417 return this; 1418 } 1419 1420 /** 1421 * @return {@link #eventHistory} (A summary of the events of interest that have occurred, such as when the dispense was verified.) 1422 */ 1423 public List<Reference> getEventHistory() { 1424 if (this.eventHistory == null) 1425 this.eventHistory = new ArrayList<Reference>(); 1426 return this.eventHistory; 1427 } 1428 1429 /** 1430 * @return Returns a reference to <code>this</code> for easy method chaining 1431 */ 1432 public DeviceDispense setEventHistory(List<Reference> theEventHistory) { 1433 this.eventHistory = theEventHistory; 1434 return this; 1435 } 1436 1437 public boolean hasEventHistory() { 1438 if (this.eventHistory == null) 1439 return false; 1440 for (Reference item : this.eventHistory) 1441 if (!item.isEmpty()) 1442 return true; 1443 return false; 1444 } 1445 1446 public Reference addEventHistory() { //3 1447 Reference t = new Reference(); 1448 if (this.eventHistory == null) 1449 this.eventHistory = new ArrayList<Reference>(); 1450 this.eventHistory.add(t); 1451 return t; 1452 } 1453 1454 public DeviceDispense addEventHistory(Reference t) { //3 1455 if (t == null) 1456 return this; 1457 if (this.eventHistory == null) 1458 this.eventHistory = new ArrayList<Reference>(); 1459 this.eventHistory.add(t); 1460 return this; 1461 } 1462 1463 /** 1464 * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist {3} 1465 */ 1466 public Reference getEventHistoryFirstRep() { 1467 if (getEventHistory().isEmpty()) { 1468 addEventHistory(); 1469 } 1470 return getEventHistory().get(0); 1471 } 1472 1473 protected void listChildren(List<Property> children) { 1474 super.listChildren(children); 1475 children.add(new Property("identifier", "Identifier", "Business identifier for this dispensation.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1476 children.add(new Property("basedOn", "Reference(CarePlan|DeviceRequest)", "The order or request that this dispense is fulfilling.", 0, java.lang.Integer.MAX_VALUE, basedOn)); 1477 children.add(new Property("partOf", "Reference(Procedure)", "The bigger event that this dispense is a part of.", 0, java.lang.Integer.MAX_VALUE, partOf)); 1478 children.add(new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, 1, status)); 1479 children.add(new Property("statusReason", "CodeableReference(DetectedIssue)", "Indicates the reason why a dispense was or was not performed.", 0, 1, statusReason)); 1480 children.add(new Property("category", "CodeableConcept", "Indicates the type of device dispense.", 0, java.lang.Integer.MAX_VALUE, category)); 1481 children.add(new Property("device", "CodeableReference(Device|DeviceDefinition)", "Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices.", 0, 1, device)); 1482 children.add(new Property("subject", "Reference(Patient|Practitioner)", "A link to a resource representing the person to whom the device is intended.", 0, 1, subject)); 1483 children.add(new Property("receiver", "Reference(Patient|Practitioner|RelatedPerson|Location|PractitionerRole)", "Identifies the person who picked up the device or the person or location where the device was delivered. This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.", 0, 1, receiver)); 1484 children.add(new Property("encounter", "Reference(Encounter)", "The encounter that establishes the context for this event.", 0, 1, encounter)); 1485 children.add(new Property("supportingInformation", "Reference(Any)", "Additional information that supports the device being dispensed.", 0, java.lang.Integer.MAX_VALUE, supportingInformation)); 1486 children.add(new Property("performer", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, performer)); 1487 children.add(new Property("location", "Reference(Location)", "The principal physical location where the dispense was performed.", 0, 1, location)); 1488 children.add(new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed.", 0, 1, type)); 1489 children.add(new Property("quantity", "Quantity", "The number of devices that have been dispensed.", 0, 1, quantity)); 1490 children.add(new Property("preparedDate", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, 1, preparedDate)); 1491 children.add(new Property("whenHandedOver", "dateTime", "The time the dispensed product was made available to the patient or their representative.", 0, 1, whenHandedOver)); 1492 children.add(new Property("destination", "Reference(Location)", "Identification of the facility/location where the device was /should be shipped to, as part of the dispense process.", 0, 1, destination)); 1493 children.add(new Property("note", "Annotation", "Extra information about the dispense that could not be conveyed in the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); 1494 children.add(new Property("usageInstruction", "markdown", "The full representation of the instructions.", 0, 1, usageInstruction)); 1495 children.add(new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the dispense was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory)); 1496 } 1497 1498 @Override 1499 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1500 switch (_hash) { 1501 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Business identifier for this dispensation.", 0, java.lang.Integer.MAX_VALUE, identifier); 1502 case -332612366: /*basedOn*/ return new Property("basedOn", "Reference(CarePlan|DeviceRequest)", "The order or request that this dispense is fulfilling.", 0, java.lang.Integer.MAX_VALUE, basedOn); 1503 case -995410646: /*partOf*/ return new Property("partOf", "Reference(Procedure)", "The bigger event that this dispense is a part of.", 0, java.lang.Integer.MAX_VALUE, partOf); 1504 case -892481550: /*status*/ return new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, 1, status); 1505 case 2051346646: /*statusReason*/ return new Property("statusReason", "CodeableReference(DetectedIssue)", "Indicates the reason why a dispense was or was not performed.", 0, 1, statusReason); 1506 case 50511102: /*category*/ return new Property("category", "CodeableConcept", "Indicates the type of device dispense.", 0, java.lang.Integer.MAX_VALUE, category); 1507 case -1335157162: /*device*/ return new Property("device", "CodeableReference(Device|DeviceDefinition)", "Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices.", 0, 1, device); 1508 case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Practitioner)", "A link to a resource representing the person to whom the device is intended.", 0, 1, subject); 1509 case -808719889: /*receiver*/ return new Property("receiver", "Reference(Patient|Practitioner|RelatedPerson|Location|PractitionerRole)", "Identifies the person who picked up the device or the person or location where the device was delivered. This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.", 0, 1, receiver); 1510 case 1524132147: /*encounter*/ return new Property("encounter", "Reference(Encounter)", "The encounter that establishes the context for this event.", 0, 1, encounter); 1511 case -1248768647: /*supportingInformation*/ return new Property("supportingInformation", "Reference(Any)", "Additional information that supports the device being dispensed.", 0, java.lang.Integer.MAX_VALUE, supportingInformation); 1512 case 481140686: /*performer*/ return new Property("performer", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, performer); 1513 case 1901043637: /*location*/ return new Property("location", "Reference(Location)", "The principal physical location where the dispense was performed.", 0, 1, location); 1514 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed.", 0, 1, type); 1515 case -1285004149: /*quantity*/ return new Property("quantity", "Quantity", "The number of devices that have been dispensed.", 0, 1, quantity); 1516 case -2024959605: /*preparedDate*/ return new Property("preparedDate", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, 1, preparedDate); 1517 case -940241380: /*whenHandedOver*/ return new Property("whenHandedOver", "dateTime", "The time the dispensed product was made available to the patient or their representative.", 0, 1, whenHandedOver); 1518 case -1429847026: /*destination*/ return new Property("destination", "Reference(Location)", "Identification of the facility/location where the device was /should be shipped to, as part of the dispense process.", 0, 1, destination); 1519 case 3387378: /*note*/ return new Property("note", "Annotation", "Extra information about the dispense that could not be conveyed in the other attributes.", 0, java.lang.Integer.MAX_VALUE, note); 1520 case 2138372141: /*usageInstruction*/ return new Property("usageInstruction", "markdown", "The full representation of the instructions.", 0, 1, usageInstruction); 1521 case 1835190426: /*eventHistory*/ return new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the dispense was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory); 1522 default: return super.getNamedProperty(_hash, _name, _checkValid); 1523 } 1524 1525 } 1526 1527 @Override 1528 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1529 switch (hash) { 1530 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1531 case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference 1532 case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference 1533 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DeviceDispenseStatusCodes> 1534 case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableReference 1535 case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept 1536 case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // CodeableReference 1537 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 1538 case -808719889: /*receiver*/ return this.receiver == null ? new Base[0] : new Base[] {this.receiver}; // Reference 1539 case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference 1540 case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference 1541 case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // DeviceDispensePerformerComponent 1542 case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference 1543 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1544 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity 1545 case -2024959605: /*preparedDate*/ return this.preparedDate == null ? new Base[0] : new Base[] {this.preparedDate}; // DateTimeType 1546 case -940241380: /*whenHandedOver*/ return this.whenHandedOver == null ? new Base[0] : new Base[] {this.whenHandedOver}; // DateTimeType 1547 case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference 1548 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 1549 case 2138372141: /*usageInstruction*/ return this.usageInstruction == null ? new Base[0] : new Base[] {this.usageInstruction}; // MarkdownType 1550 case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference 1551 default: return super.getProperty(hash, name, checkValid); 1552 } 1553 1554 } 1555 1556 @Override 1557 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1558 switch (hash) { 1559 case -1618432855: // identifier 1560 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier 1561 return value; 1562 case -332612366: // basedOn 1563 this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference 1564 return value; 1565 case -995410646: // partOf 1566 this.getPartOf().add(TypeConvertor.castToReference(value)); // Reference 1567 return value; 1568 case -892481550: // status 1569 value = new DeviceDispenseStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value)); 1570 this.status = (Enumeration) value; // Enumeration<DeviceDispenseStatusCodes> 1571 return value; 1572 case 2051346646: // statusReason 1573 this.statusReason = TypeConvertor.castToCodeableReference(value); // CodeableReference 1574 return value; 1575 case 50511102: // category 1576 this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept 1577 return value; 1578 case -1335157162: // device 1579 this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference 1580 return value; 1581 case -1867885268: // subject 1582 this.subject = TypeConvertor.castToReference(value); // Reference 1583 return value; 1584 case -808719889: // receiver 1585 this.receiver = TypeConvertor.castToReference(value); // Reference 1586 return value; 1587 case 1524132147: // encounter 1588 this.encounter = TypeConvertor.castToReference(value); // Reference 1589 return value; 1590 case -1248768647: // supportingInformation 1591 this.getSupportingInformation().add(TypeConvertor.castToReference(value)); // Reference 1592 return value; 1593 case 481140686: // performer 1594 this.getPerformer().add((DeviceDispensePerformerComponent) value); // DeviceDispensePerformerComponent 1595 return value; 1596 case 1901043637: // location 1597 this.location = TypeConvertor.castToReference(value); // Reference 1598 return value; 1599 case 3575610: // type 1600 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1601 return value; 1602 case -1285004149: // quantity 1603 this.quantity = TypeConvertor.castToQuantity(value); // Quantity 1604 return value; 1605 case -2024959605: // preparedDate 1606 this.preparedDate = TypeConvertor.castToDateTime(value); // DateTimeType 1607 return value; 1608 case -940241380: // whenHandedOver 1609 this.whenHandedOver = TypeConvertor.castToDateTime(value); // DateTimeType 1610 return value; 1611 case -1429847026: // destination 1612 this.destination = TypeConvertor.castToReference(value); // Reference 1613 return value; 1614 case 3387378: // note 1615 this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation 1616 return value; 1617 case 2138372141: // usageInstruction 1618 this.usageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType 1619 return value; 1620 case 1835190426: // eventHistory 1621 this.getEventHistory().add(TypeConvertor.castToReference(value)); // Reference 1622 return value; 1623 default: return super.setProperty(hash, name, value); 1624 } 1625 1626 } 1627 1628 @Override 1629 public Base setProperty(String name, Base value) throws FHIRException { 1630 if (name.equals("identifier")) { 1631 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); 1632 } else if (name.equals("basedOn")) { 1633 this.getBasedOn().add(TypeConvertor.castToReference(value)); 1634 } else if (name.equals("partOf")) { 1635 this.getPartOf().add(TypeConvertor.castToReference(value)); 1636 } else if (name.equals("status")) { 1637 value = new DeviceDispenseStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value)); 1638 this.status = (Enumeration) value; // Enumeration<DeviceDispenseStatusCodes> 1639 } else if (name.equals("statusReason")) { 1640 this.statusReason = TypeConvertor.castToCodeableReference(value); // CodeableReference 1641 } else if (name.equals("category")) { 1642 this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); 1643 } else if (name.equals("device")) { 1644 this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference 1645 } else if (name.equals("subject")) { 1646 this.subject = TypeConvertor.castToReference(value); // Reference 1647 } else if (name.equals("receiver")) { 1648 this.receiver = TypeConvertor.castToReference(value); // Reference 1649 } else if (name.equals("encounter")) { 1650 this.encounter = TypeConvertor.castToReference(value); // Reference 1651 } else if (name.equals("supportingInformation")) { 1652 this.getSupportingInformation().add(TypeConvertor.castToReference(value)); 1653 } else if (name.equals("performer")) { 1654 this.getPerformer().add((DeviceDispensePerformerComponent) value); 1655 } else if (name.equals("location")) { 1656 this.location = TypeConvertor.castToReference(value); // Reference 1657 } else if (name.equals("type")) { 1658 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1659 } else if (name.equals("quantity")) { 1660 this.quantity = TypeConvertor.castToQuantity(value); // Quantity 1661 } else if (name.equals("preparedDate")) { 1662 this.preparedDate = TypeConvertor.castToDateTime(value); // DateTimeType 1663 } else if (name.equals("whenHandedOver")) { 1664 this.whenHandedOver = TypeConvertor.castToDateTime(value); // DateTimeType 1665 } else if (name.equals("destination")) { 1666 this.destination = TypeConvertor.castToReference(value); // Reference 1667 } else if (name.equals("note")) { 1668 this.getNote().add(TypeConvertor.castToAnnotation(value)); 1669 } else if (name.equals("usageInstruction")) { 1670 this.usageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType 1671 } else if (name.equals("eventHistory")) { 1672 this.getEventHistory().add(TypeConvertor.castToReference(value)); 1673 } else 1674 return super.setProperty(name, value); 1675 return value; 1676 } 1677 1678 @Override 1679 public Base makeProperty(int hash, String name) throws FHIRException { 1680 switch (hash) { 1681 case -1618432855: return addIdentifier(); 1682 case -332612366: return addBasedOn(); 1683 case -995410646: return addPartOf(); 1684 case -892481550: return getStatusElement(); 1685 case 2051346646: return getStatusReason(); 1686 case 50511102: return addCategory(); 1687 case -1335157162: return getDevice(); 1688 case -1867885268: return getSubject(); 1689 case -808719889: return getReceiver(); 1690 case 1524132147: return getEncounter(); 1691 case -1248768647: return addSupportingInformation(); 1692 case 481140686: return addPerformer(); 1693 case 1901043637: return getLocation(); 1694 case 3575610: return getType(); 1695 case -1285004149: return getQuantity(); 1696 case -2024959605: return getPreparedDateElement(); 1697 case -940241380: return getWhenHandedOverElement(); 1698 case -1429847026: return getDestination(); 1699 case 3387378: return addNote(); 1700 case 2138372141: return getUsageInstructionElement(); 1701 case 1835190426: return addEventHistory(); 1702 default: return super.makeProperty(hash, name); 1703 } 1704 1705 } 1706 1707 @Override 1708 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1709 switch (hash) { 1710 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1711 case -332612366: /*basedOn*/ return new String[] {"Reference"}; 1712 case -995410646: /*partOf*/ return new String[] {"Reference"}; 1713 case -892481550: /*status*/ return new String[] {"code"}; 1714 case 2051346646: /*statusReason*/ return new String[] {"CodeableReference"}; 1715 case 50511102: /*category*/ return new String[] {"CodeableConcept"}; 1716 case -1335157162: /*device*/ return new String[] {"CodeableReference"}; 1717 case -1867885268: /*subject*/ return new String[] {"Reference"}; 1718 case -808719889: /*receiver*/ return new String[] {"Reference"}; 1719 case 1524132147: /*encounter*/ return new String[] {"Reference"}; 1720 case -1248768647: /*supportingInformation*/ return new String[] {"Reference"}; 1721 case 481140686: /*performer*/ return new String[] {}; 1722 case 1901043637: /*location*/ return new String[] {"Reference"}; 1723 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 1724 case -1285004149: /*quantity*/ return new String[] {"Quantity"}; 1725 case -2024959605: /*preparedDate*/ return new String[] {"dateTime"}; 1726 case -940241380: /*whenHandedOver*/ return new String[] {"dateTime"}; 1727 case -1429847026: /*destination*/ return new String[] {"Reference"}; 1728 case 3387378: /*note*/ return new String[] {"Annotation"}; 1729 case 2138372141: /*usageInstruction*/ return new String[] {"markdown"}; 1730 case 1835190426: /*eventHistory*/ return new String[] {"Reference"}; 1731 default: return super.getTypesForProperty(hash, name); 1732 } 1733 1734 } 1735 1736 @Override 1737 public Base addChild(String name) throws FHIRException { 1738 if (name.equals("identifier")) { 1739 return addIdentifier(); 1740 } 1741 else if (name.equals("basedOn")) { 1742 return addBasedOn(); 1743 } 1744 else if (name.equals("partOf")) { 1745 return addPartOf(); 1746 } 1747 else if (name.equals("status")) { 1748 throw new FHIRException("Cannot call addChild on a primitive type DeviceDispense.status"); 1749 } 1750 else if (name.equals("statusReason")) { 1751 this.statusReason = new CodeableReference(); 1752 return this.statusReason; 1753 } 1754 else if (name.equals("category")) { 1755 return addCategory(); 1756 } 1757 else if (name.equals("device")) { 1758 this.device = new CodeableReference(); 1759 return this.device; 1760 } 1761 else if (name.equals("subject")) { 1762 this.subject = new Reference(); 1763 return this.subject; 1764 } 1765 else if (name.equals("receiver")) { 1766 this.receiver = new Reference(); 1767 return this.receiver; 1768 } 1769 else if (name.equals("encounter")) { 1770 this.encounter = new Reference(); 1771 return this.encounter; 1772 } 1773 else if (name.equals("supportingInformation")) { 1774 return addSupportingInformation(); 1775 } 1776 else if (name.equals("performer")) { 1777 return addPerformer(); 1778 } 1779 else if (name.equals("location")) { 1780 this.location = new Reference(); 1781 return this.location; 1782 } 1783 else if (name.equals("type")) { 1784 this.type = new CodeableConcept(); 1785 return this.type; 1786 } 1787 else if (name.equals("quantity")) { 1788 this.quantity = new Quantity(); 1789 return this.quantity; 1790 } 1791 else if (name.equals("preparedDate")) { 1792 throw new FHIRException("Cannot call addChild on a primitive type DeviceDispense.preparedDate"); 1793 } 1794 else if (name.equals("whenHandedOver")) { 1795 throw new FHIRException("Cannot call addChild on a primitive type DeviceDispense.whenHandedOver"); 1796 } 1797 else if (name.equals("destination")) { 1798 this.destination = new Reference(); 1799 return this.destination; 1800 } 1801 else if (name.equals("note")) { 1802 return addNote(); 1803 } 1804 else if (name.equals("usageInstruction")) { 1805 throw new FHIRException("Cannot call addChild on a primitive type DeviceDispense.usageInstruction"); 1806 } 1807 else if (name.equals("eventHistory")) { 1808 return addEventHistory(); 1809 } 1810 else 1811 return super.addChild(name); 1812 } 1813 1814 public String fhirType() { 1815 return "DeviceDispense"; 1816 1817 } 1818 1819 public DeviceDispense copy() { 1820 DeviceDispense dst = new DeviceDispense(); 1821 copyValues(dst); 1822 return dst; 1823 } 1824 1825 public void copyValues(DeviceDispense dst) { 1826 super.copyValues(dst); 1827 if (identifier != null) { 1828 dst.identifier = new ArrayList<Identifier>(); 1829 for (Identifier i : identifier) 1830 dst.identifier.add(i.copy()); 1831 }; 1832 if (basedOn != null) { 1833 dst.basedOn = new ArrayList<Reference>(); 1834 for (Reference i : basedOn) 1835 dst.basedOn.add(i.copy()); 1836 }; 1837 if (partOf != null) { 1838 dst.partOf = new ArrayList<Reference>(); 1839 for (Reference i : partOf) 1840 dst.partOf.add(i.copy()); 1841 }; 1842 dst.status = status == null ? null : status.copy(); 1843 dst.statusReason = statusReason == null ? null : statusReason.copy(); 1844 if (category != null) { 1845 dst.category = new ArrayList<CodeableConcept>(); 1846 for (CodeableConcept i : category) 1847 dst.category.add(i.copy()); 1848 }; 1849 dst.device = device == null ? null : device.copy(); 1850 dst.subject = subject == null ? null : subject.copy(); 1851 dst.receiver = receiver == null ? null : receiver.copy(); 1852 dst.encounter = encounter == null ? null : encounter.copy(); 1853 if (supportingInformation != null) { 1854 dst.supportingInformation = new ArrayList<Reference>(); 1855 for (Reference i : supportingInformation) 1856 dst.supportingInformation.add(i.copy()); 1857 }; 1858 if (performer != null) { 1859 dst.performer = new ArrayList<DeviceDispensePerformerComponent>(); 1860 for (DeviceDispensePerformerComponent i : performer) 1861 dst.performer.add(i.copy()); 1862 }; 1863 dst.location = location == null ? null : location.copy(); 1864 dst.type = type == null ? null : type.copy(); 1865 dst.quantity = quantity == null ? null : quantity.copy(); 1866 dst.preparedDate = preparedDate == null ? null : preparedDate.copy(); 1867 dst.whenHandedOver = whenHandedOver == null ? null : whenHandedOver.copy(); 1868 dst.destination = destination == null ? null : destination.copy(); 1869 if (note != null) { 1870 dst.note = new ArrayList<Annotation>(); 1871 for (Annotation i : note) 1872 dst.note.add(i.copy()); 1873 }; 1874 dst.usageInstruction = usageInstruction == null ? null : usageInstruction.copy(); 1875 if (eventHistory != null) { 1876 dst.eventHistory = new ArrayList<Reference>(); 1877 for (Reference i : eventHistory) 1878 dst.eventHistory.add(i.copy()); 1879 }; 1880 } 1881 1882 protected DeviceDispense typedCopy() { 1883 return copy(); 1884 } 1885 1886 @Override 1887 public boolean equalsDeep(Base other_) { 1888 if (!super.equalsDeep(other_)) 1889 return false; 1890 if (!(other_ instanceof DeviceDispense)) 1891 return false; 1892 DeviceDispense o = (DeviceDispense) other_; 1893 return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(partOf, o.partOf, true) 1894 && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) && compareDeep(category, o.category, true) 1895 && compareDeep(device, o.device, true) && compareDeep(subject, o.subject, true) && compareDeep(receiver, o.receiver, true) 1896 && compareDeep(encounter, o.encounter, true) && compareDeep(supportingInformation, o.supportingInformation, true) 1897 && compareDeep(performer, o.performer, true) && compareDeep(location, o.location, true) && compareDeep(type, o.type, true) 1898 && compareDeep(quantity, o.quantity, true) && compareDeep(preparedDate, o.preparedDate, true) && compareDeep(whenHandedOver, o.whenHandedOver, true) 1899 && compareDeep(destination, o.destination, true) && compareDeep(note, o.note, true) && compareDeep(usageInstruction, o.usageInstruction, true) 1900 && compareDeep(eventHistory, o.eventHistory, true); 1901 } 1902 1903 @Override 1904 public boolean equalsShallow(Base other_) { 1905 if (!super.equalsShallow(other_)) 1906 return false; 1907 if (!(other_ instanceof DeviceDispense)) 1908 return false; 1909 DeviceDispense o = (DeviceDispense) other_; 1910 return compareValues(status, o.status, true) && compareValues(preparedDate, o.preparedDate, true) && compareValues(whenHandedOver, o.whenHandedOver, true) 1911 && compareValues(usageInstruction, o.usageInstruction, true); 1912 } 1913 1914 public boolean isEmpty() { 1915 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf 1916 , status, statusReason, category, device, subject, receiver, encounter, supportingInformation 1917 , performer, location, type, quantity, preparedDate, whenHandedOver, destination 1918 , note, usageInstruction, eventHistory); 1919 } 1920 1921 @Override 1922 public ResourceType getResourceType() { 1923 return ResourceType.DeviceDispense; 1924 } 1925 1926 /** 1927 * Search parameter: <b>code</b> 1928 * <p> 1929 * Description: <b>Search for devices that match this code</b><br> 1930 * Type: <b>token</b><br> 1931 * Path: <b>DeviceDispense.device.concept</b><br> 1932 * </p> 1933 */ 1934 @SearchParamDefinition(name="code", path="DeviceDispense.device.concept", description="Search for devices that match this code", type="token" ) 1935 public static final String SP_CODE = "code"; 1936 /** 1937 * <b>Fluent Client</b> search parameter constant for <b>code</b> 1938 * <p> 1939 * Description: <b>Search for devices that match this code</b><br> 1940 * Type: <b>token</b><br> 1941 * Path: <b>DeviceDispense.device.concept</b><br> 1942 * </p> 1943 */ 1944 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 1945 1946 /** 1947 * Search parameter: <b>identifier</b> 1948 * <p> 1949 * Description: <b>The identifier of the dispense</b><br> 1950 * Type: <b>token</b><br> 1951 * Path: <b>DeviceDispense.identifier</b><br> 1952 * </p> 1953 */ 1954 @SearchParamDefinition(name="identifier", path="DeviceDispense.identifier", description="The identifier of the dispense", type="token" ) 1955 public static final String SP_IDENTIFIER = "identifier"; 1956 /** 1957 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1958 * <p> 1959 * Description: <b>The identifier of the dispense</b><br> 1960 * Type: <b>token</b><br> 1961 * Path: <b>DeviceDispense.identifier</b><br> 1962 * </p> 1963 */ 1964 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1965 1966 /** 1967 * Search parameter: <b>patient</b> 1968 * <p> 1969 * Description: <b>Returns device dispenses for a specific patient</b><br> 1970 * Type: <b>reference</b><br> 1971 * Path: <b>DeviceDispense.subject.where(resolve() is Patient)</b><br> 1972 * </p> 1973 */ 1974 @SearchParamDefinition(name="patient", path="DeviceDispense.subject.where(resolve() is Patient)", description="Returns device dispenses for a specific patient", type="reference", target={Patient.class } ) 1975 public static final String SP_PATIENT = "patient"; 1976 /** 1977 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1978 * <p> 1979 * Description: <b>Returns device dispenses for a specific patient</b><br> 1980 * Type: <b>reference</b><br> 1981 * Path: <b>DeviceDispense.subject.where(resolve() is Patient)</b><br> 1982 * </p> 1983 */ 1984 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1985 1986/** 1987 * Constant for fluent queries to be used to add include statements. Specifies 1988 * the path value of "<b>DeviceDispense:patient</b>". 1989 */ 1990 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceDispense:patient").toLocked(); 1991 1992 /** 1993 * Search parameter: <b>status</b> 1994 * <p> 1995 * Description: <b>The status of the dispense</b><br> 1996 * Type: <b>token</b><br> 1997 * Path: <b>DeviceDispense.status</b><br> 1998 * </p> 1999 */ 2000 @SearchParamDefinition(name="status", path="DeviceDispense.status", description="The status of the dispense", type="token" ) 2001 public static final String SP_STATUS = "status"; 2002 /** 2003 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2004 * <p> 2005 * Description: <b>The status of the dispense</b><br> 2006 * Type: <b>token</b><br> 2007 * Path: <b>DeviceDispense.status</b><br> 2008 * </p> 2009 */ 2010 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 2011 2012 /** 2013 * Search parameter: <b>subject</b> 2014 * <p> 2015 * Description: <b>The identity of a patient for whom to list dispenses</b><br> 2016 * Type: <b>reference</b><br> 2017 * Path: <b>DeviceDispense.subject</b><br> 2018 * </p> 2019 */ 2020 @SearchParamDefinition(name="subject", path="DeviceDispense.subject", description="The identity of a patient for whom to list dispenses", type="reference", target={Patient.class, Practitioner.class } ) 2021 public static final String SP_SUBJECT = "subject"; 2022 /** 2023 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 2024 * <p> 2025 * Description: <b>The identity of a patient for whom to list dispenses</b><br> 2026 * Type: <b>reference</b><br> 2027 * Path: <b>DeviceDispense.subject</b><br> 2028 * </p> 2029 */ 2030 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 2031 2032/** 2033 * Constant for fluent queries to be used to add include statements. Specifies 2034 * the path value of "<b>DeviceDispense:subject</b>". 2035 */ 2036 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DeviceDispense:subject").toLocked(); 2037 2038 2039} 2040