001package org.hl7.fhir.r4b.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 Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r4b.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 * This resource is primarily used for the identification and definition of a medication for the purposes of prescribing, dispensing, and administering a medication as well as for making statements about medication use. 052 */ 053@ResourceDef(name="Medication", profile="http://hl7.org/fhir/StructureDefinition/Medication") 054public class Medication extends DomainResource { 055 056 public enum MedicationStatusCodes { 057 /** 058 * The medication is available for use. 059 */ 060 ACTIVE, 061 /** 062 * The medication is not available for use. 063 */ 064 INACTIVE, 065 /** 066 * The medication was entered in error. 067 */ 068 ENTEREDINERROR, 069 /** 070 * added to help the parsers with the generic types 071 */ 072 NULL; 073 public static MedicationStatusCodes fromCode(String codeString) throws FHIRException { 074 if (codeString == null || "".equals(codeString)) 075 return null; 076 if ("active".equals(codeString)) 077 return ACTIVE; 078 if ("inactive".equals(codeString)) 079 return INACTIVE; 080 if ("entered-in-error".equals(codeString)) 081 return ENTEREDINERROR; 082 if (Configuration.isAcceptInvalidEnums()) 083 return null; 084 else 085 throw new FHIRException("Unknown MedicationStatusCodes code '"+codeString+"'"); 086 } 087 public String toCode() { 088 switch (this) { 089 case ACTIVE: return "active"; 090 case INACTIVE: return "inactive"; 091 case ENTEREDINERROR: return "entered-in-error"; 092 case NULL: return null; 093 default: return "?"; 094 } 095 } 096 public String getSystem() { 097 switch (this) { 098 case ACTIVE: return "http://hl7.org/fhir/CodeSystem/medication-status"; 099 case INACTIVE: return "http://hl7.org/fhir/CodeSystem/medication-status"; 100 case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medication-status"; 101 case NULL: return null; 102 default: return "?"; 103 } 104 } 105 public String getDefinition() { 106 switch (this) { 107 case ACTIVE: return "The medication is available for use."; 108 case INACTIVE: return "The medication is not available for use."; 109 case ENTEREDINERROR: return "The medication was entered in error."; 110 case NULL: return null; 111 default: return "?"; 112 } 113 } 114 public String getDisplay() { 115 switch (this) { 116 case ACTIVE: return "Active"; 117 case INACTIVE: return "Inactive"; 118 case ENTEREDINERROR: return "Entered in Error"; 119 case NULL: return null; 120 default: return "?"; 121 } 122 } 123 } 124 125 public static class MedicationStatusCodesEnumFactory implements EnumFactory<MedicationStatusCodes> { 126 public MedicationStatusCodes fromCode(String codeString) throws IllegalArgumentException { 127 if (codeString == null || "".equals(codeString)) 128 if (codeString == null || "".equals(codeString)) 129 return null; 130 if ("active".equals(codeString)) 131 return MedicationStatusCodes.ACTIVE; 132 if ("inactive".equals(codeString)) 133 return MedicationStatusCodes.INACTIVE; 134 if ("entered-in-error".equals(codeString)) 135 return MedicationStatusCodes.ENTEREDINERROR; 136 throw new IllegalArgumentException("Unknown MedicationStatusCodes code '"+codeString+"'"); 137 } 138 public Enumeration<MedicationStatusCodes> fromType(Base code) throws FHIRException { 139 if (code == null) 140 return null; 141 if (code.isEmpty()) 142 return new Enumeration<MedicationStatusCodes>(this); 143 String codeString = ((PrimitiveType) code).asStringValue(); 144 if (codeString == null || "".equals(codeString)) 145 return null; 146 if ("active".equals(codeString)) 147 return new Enumeration<MedicationStatusCodes>(this, MedicationStatusCodes.ACTIVE); 148 if ("inactive".equals(codeString)) 149 return new Enumeration<MedicationStatusCodes>(this, MedicationStatusCodes.INACTIVE); 150 if ("entered-in-error".equals(codeString)) 151 return new Enumeration<MedicationStatusCodes>(this, MedicationStatusCodes.ENTEREDINERROR); 152 throw new FHIRException("Unknown MedicationStatusCodes code '"+codeString+"'"); 153 } 154 public String toCode(MedicationStatusCodes code) { 155 if (code == MedicationStatusCodes.ACTIVE) 156 return "active"; 157 if (code == MedicationStatusCodes.INACTIVE) 158 return "inactive"; 159 if (code == MedicationStatusCodes.ENTEREDINERROR) 160 return "entered-in-error"; 161 return "?"; 162 } 163 public String toSystem(MedicationStatusCodes code) { 164 return code.getSystem(); 165 } 166 } 167 168 @Block() 169 public static class MedicationIngredientComponent extends BackboneElement implements IBaseBackboneElement { 170 /** 171 * The actual ingredient - either a substance (simple ingredient) or another medication of a medication. 172 */ 173 @Child(name = "item", type = {CodeableConcept.class, Substance.class, Medication.class}, order=1, min=1, max=1, modifier=false, summary=false) 174 @Description(shortDefinition="The actual ingredient or content", formalDefinition="The actual ingredient - either a substance (simple ingredient) or another medication of a medication." ) 175 protected DataType item; 176 177 /** 178 * Indication of whether this ingredient affects the therapeutic action of the drug. 179 */ 180 @Child(name = "isActive", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false) 181 @Description(shortDefinition="Active ingredient indicator", formalDefinition="Indication of whether this ingredient affects the therapeutic action of the drug." ) 182 protected BooleanType isActive; 183 184 /** 185 * Specifies how many (or how much) of the items there are in this Medication. For example, 250 mg per tablet. This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet. 186 */ 187 @Child(name = "strength", type = {Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false) 188 @Description(shortDefinition="Quantity of ingredient present", formalDefinition="Specifies how many (or how much) of the items there are in this Medication. For example, 250 mg per tablet. This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet." ) 189 protected Ratio strength; 190 191 private static final long serialVersionUID = -744144813L; 192 193 /** 194 * Constructor 195 */ 196 public MedicationIngredientComponent() { 197 super(); 198 } 199 200 /** 201 * Constructor 202 */ 203 public MedicationIngredientComponent(DataType item) { 204 super(); 205 this.setItem(item); 206 } 207 208 /** 209 * @return {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication of a medication.) 210 */ 211 public DataType getItem() { 212 return this.item; 213 } 214 215 /** 216 * @return {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication of a medication.) 217 */ 218 public CodeableConcept getItemCodeableConcept() throws FHIRException { 219 if (this.item == null) 220 this.item = new CodeableConcept(); 221 if (!(this.item instanceof CodeableConcept)) 222 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered"); 223 return (CodeableConcept) this.item; 224 } 225 226 public boolean hasItemCodeableConcept() { 227 return this != null && this.item instanceof CodeableConcept; 228 } 229 230 /** 231 * @return {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication of a medication.) 232 */ 233 public Reference getItemReference() throws FHIRException { 234 if (this.item == null) 235 this.item = new Reference(); 236 if (!(this.item instanceof Reference)) 237 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered"); 238 return (Reference) this.item; 239 } 240 241 public boolean hasItemReference() { 242 return this != null && this.item instanceof Reference; 243 } 244 245 public boolean hasItem() { 246 return this.item != null && !this.item.isEmpty(); 247 } 248 249 /** 250 * @param value {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication of a medication.) 251 */ 252 public MedicationIngredientComponent setItem(DataType value) { 253 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 254 throw new Error("Not the right type for Medication.ingredient.item[x]: "+value.fhirType()); 255 this.item = value; 256 return this; 257 } 258 259 /** 260 * @return {@link #isActive} (Indication of whether this ingredient affects the therapeutic action of the drug.). This is the underlying object with id, value and extensions. The accessor "getIsActive" gives direct access to the value 261 */ 262 public BooleanType getIsActiveElement() { 263 if (this.isActive == null) 264 if (Configuration.errorOnAutoCreate()) 265 throw new Error("Attempt to auto-create MedicationIngredientComponent.isActive"); 266 else if (Configuration.doAutoCreate()) 267 this.isActive = new BooleanType(); // bb 268 return this.isActive; 269 } 270 271 public boolean hasIsActiveElement() { 272 return this.isActive != null && !this.isActive.isEmpty(); 273 } 274 275 public boolean hasIsActive() { 276 return this.isActive != null && !this.isActive.isEmpty(); 277 } 278 279 /** 280 * @param value {@link #isActive} (Indication of whether this ingredient affects the therapeutic action of the drug.). This is the underlying object with id, value and extensions. The accessor "getIsActive" gives direct access to the value 281 */ 282 public MedicationIngredientComponent setIsActiveElement(BooleanType value) { 283 this.isActive = value; 284 return this; 285 } 286 287 /** 288 * @return Indication of whether this ingredient affects the therapeutic action of the drug. 289 */ 290 public boolean getIsActive() { 291 return this.isActive == null || this.isActive.isEmpty() ? false : this.isActive.getValue(); 292 } 293 294 /** 295 * @param value Indication of whether this ingredient affects the therapeutic action of the drug. 296 */ 297 public MedicationIngredientComponent setIsActive(boolean value) { 298 if (this.isActive == null) 299 this.isActive = new BooleanType(); 300 this.isActive.setValue(value); 301 return this; 302 } 303 304 /** 305 * @return {@link #strength} (Specifies how many (or how much) of the items there are in this Medication. For example, 250 mg per tablet. This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.) 306 */ 307 public Ratio getStrength() { 308 if (this.strength == null) 309 if (Configuration.errorOnAutoCreate()) 310 throw new Error("Attempt to auto-create MedicationIngredientComponent.strength"); 311 else if (Configuration.doAutoCreate()) 312 this.strength = new Ratio(); // cc 313 return this.strength; 314 } 315 316 public boolean hasStrength() { 317 return this.strength != null && !this.strength.isEmpty(); 318 } 319 320 /** 321 * @param value {@link #strength} (Specifies how many (or how much) of the items there are in this Medication. For example, 250 mg per tablet. This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.) 322 */ 323 public MedicationIngredientComponent setStrength(Ratio value) { 324 this.strength = value; 325 return this; 326 } 327 328 protected void listChildren(List<Property> children) { 329 super.listChildren(children); 330 children.add(new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The actual ingredient - either a substance (simple ingredient) or another medication of a medication.", 0, 1, item)); 331 children.add(new Property("isActive", "boolean", "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, 1, isActive)); 332 children.add(new Property("strength", "Ratio", "Specifies how many (or how much) of the items there are in this Medication. For example, 250 mg per tablet. This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.", 0, 1, strength)); 333 } 334 335 @Override 336 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 337 switch (_hash) { 338 case 2116201613: /*item[x]*/ return new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The actual ingredient - either a substance (simple ingredient) or another medication of a medication.", 0, 1, item); 339 case 3242771: /*item*/ return new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The actual ingredient - either a substance (simple ingredient) or another medication of a medication.", 0, 1, item); 340 case 106644494: /*itemCodeableConcept*/ return new Property("item[x]", "CodeableConcept", "The actual ingredient - either a substance (simple ingredient) or another medication of a medication.", 0, 1, item); 341 case 1376364920: /*itemReference*/ return new Property("item[x]", "Reference(Substance|Medication)", "The actual ingredient - either a substance (simple ingredient) or another medication of a medication.", 0, 1, item); 342 case -748916528: /*isActive*/ return new Property("isActive", "boolean", "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, 1, isActive); 343 case 1791316033: /*strength*/ return new Property("strength", "Ratio", "Specifies how many (or how much) of the items there are in this Medication. For example, 250 mg per tablet. This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.", 0, 1, strength); 344 default: return super.getNamedProperty(_hash, _name, _checkValid); 345 } 346 347 } 348 349 @Override 350 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 351 switch (hash) { 352 case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType 353 case -748916528: /*isActive*/ return this.isActive == null ? new Base[0] : new Base[] {this.isActive}; // BooleanType 354 case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Ratio 355 default: return super.getProperty(hash, name, checkValid); 356 } 357 358 } 359 360 @Override 361 public Base setProperty(int hash, String name, Base value) throws FHIRException { 362 switch (hash) { 363 case 3242771: // item 364 this.item = TypeConvertor.castToType(value); // DataType 365 return value; 366 case -748916528: // isActive 367 this.isActive = TypeConvertor.castToBoolean(value); // BooleanType 368 return value; 369 case 1791316033: // strength 370 this.strength = TypeConvertor.castToRatio(value); // Ratio 371 return value; 372 default: return super.setProperty(hash, name, value); 373 } 374 375 } 376 377 @Override 378 public Base setProperty(String name, Base value) throws FHIRException { 379 if (name.equals("item[x]")) { 380 this.item = TypeConvertor.castToType(value); // DataType 381 } else if (name.equals("isActive")) { 382 this.isActive = TypeConvertor.castToBoolean(value); // BooleanType 383 } else if (name.equals("strength")) { 384 this.strength = TypeConvertor.castToRatio(value); // Ratio 385 } else 386 return super.setProperty(name, value); 387 return value; 388 } 389 390 @Override 391 public Base makeProperty(int hash, String name) throws FHIRException { 392 switch (hash) { 393 case 2116201613: return getItem(); 394 case 3242771: return getItem(); 395 case -748916528: return getIsActiveElement(); 396 case 1791316033: return getStrength(); 397 default: return super.makeProperty(hash, name); 398 } 399 400 } 401 402 @Override 403 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 404 switch (hash) { 405 case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"}; 406 case -748916528: /*isActive*/ return new String[] {"boolean"}; 407 case 1791316033: /*strength*/ return new String[] {"Ratio"}; 408 default: return super.getTypesForProperty(hash, name); 409 } 410 411 } 412 413 @Override 414 public Base addChild(String name) throws FHIRException { 415 if (name.equals("itemCodeableConcept")) { 416 this.item = new CodeableConcept(); 417 return this.item; 418 } 419 else if (name.equals("itemReference")) { 420 this.item = new Reference(); 421 return this.item; 422 } 423 else if (name.equals("isActive")) { 424 throw new FHIRException("Cannot call addChild on a primitive type Medication.ingredient.isActive"); 425 } 426 else if (name.equals("strength")) { 427 this.strength = new Ratio(); 428 return this.strength; 429 } 430 else 431 return super.addChild(name); 432 } 433 434 public MedicationIngredientComponent copy() { 435 MedicationIngredientComponent dst = new MedicationIngredientComponent(); 436 copyValues(dst); 437 return dst; 438 } 439 440 public void copyValues(MedicationIngredientComponent dst) { 441 super.copyValues(dst); 442 dst.item = item == null ? null : item.copy(); 443 dst.isActive = isActive == null ? null : isActive.copy(); 444 dst.strength = strength == null ? null : strength.copy(); 445 } 446 447 @Override 448 public boolean equalsDeep(Base other_) { 449 if (!super.equalsDeep(other_)) 450 return false; 451 if (!(other_ instanceof MedicationIngredientComponent)) 452 return false; 453 MedicationIngredientComponent o = (MedicationIngredientComponent) other_; 454 return compareDeep(item, o.item, true) && compareDeep(isActive, o.isActive, true) && compareDeep(strength, o.strength, true) 455 ; 456 } 457 458 @Override 459 public boolean equalsShallow(Base other_) { 460 if (!super.equalsShallow(other_)) 461 return false; 462 if (!(other_ instanceof MedicationIngredientComponent)) 463 return false; 464 MedicationIngredientComponent o = (MedicationIngredientComponent) other_; 465 return compareValues(isActive, o.isActive, true); 466 } 467 468 public boolean isEmpty() { 469 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, isActive, strength 470 ); 471 } 472 473 public String fhirType() { 474 return "Medication.ingredient"; 475 476 } 477 478 } 479 480 @Block() 481 public static class MedicationBatchComponent extends BackboneElement implements IBaseBackboneElement { 482 /** 483 * The assigned lot number of a batch of the specified product. 484 */ 485 @Child(name = "lotNumber", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false) 486 @Description(shortDefinition="Identifier assigned to batch", formalDefinition="The assigned lot number of a batch of the specified product." ) 487 protected StringType lotNumber; 488 489 /** 490 * When this specific batch of product will expire. 491 */ 492 @Child(name = "expirationDate", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false) 493 @Description(shortDefinition="When batch will expire", formalDefinition="When this specific batch of product will expire." ) 494 protected DateTimeType expirationDate; 495 496 private static final long serialVersionUID = 1982738755L; 497 498 /** 499 * Constructor 500 */ 501 public MedicationBatchComponent() { 502 super(); 503 } 504 505 /** 506 * @return {@link #lotNumber} (The assigned lot number of a batch of the specified product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value 507 */ 508 public StringType getLotNumberElement() { 509 if (this.lotNumber == null) 510 if (Configuration.errorOnAutoCreate()) 511 throw new Error("Attempt to auto-create MedicationBatchComponent.lotNumber"); 512 else if (Configuration.doAutoCreate()) 513 this.lotNumber = new StringType(); // bb 514 return this.lotNumber; 515 } 516 517 public boolean hasLotNumberElement() { 518 return this.lotNumber != null && !this.lotNumber.isEmpty(); 519 } 520 521 public boolean hasLotNumber() { 522 return this.lotNumber != null && !this.lotNumber.isEmpty(); 523 } 524 525 /** 526 * @param value {@link #lotNumber} (The assigned lot number of a batch of the specified product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value 527 */ 528 public MedicationBatchComponent setLotNumberElement(StringType value) { 529 this.lotNumber = value; 530 return this; 531 } 532 533 /** 534 * @return The assigned lot number of a batch of the specified product. 535 */ 536 public String getLotNumber() { 537 return this.lotNumber == null ? null : this.lotNumber.getValue(); 538 } 539 540 /** 541 * @param value The assigned lot number of a batch of the specified product. 542 */ 543 public MedicationBatchComponent setLotNumber(String value) { 544 if (Utilities.noString(value)) 545 this.lotNumber = null; 546 else { 547 if (this.lotNumber == null) 548 this.lotNumber = new StringType(); 549 this.lotNumber.setValue(value); 550 } 551 return this; 552 } 553 554 /** 555 * @return {@link #expirationDate} (When this specific batch of product will expire.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value 556 */ 557 public DateTimeType getExpirationDateElement() { 558 if (this.expirationDate == null) 559 if (Configuration.errorOnAutoCreate()) 560 throw new Error("Attempt to auto-create MedicationBatchComponent.expirationDate"); 561 else if (Configuration.doAutoCreate()) 562 this.expirationDate = new DateTimeType(); // bb 563 return this.expirationDate; 564 } 565 566 public boolean hasExpirationDateElement() { 567 return this.expirationDate != null && !this.expirationDate.isEmpty(); 568 } 569 570 public boolean hasExpirationDate() { 571 return this.expirationDate != null && !this.expirationDate.isEmpty(); 572 } 573 574 /** 575 * @param value {@link #expirationDate} (When this specific batch of product will expire.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value 576 */ 577 public MedicationBatchComponent setExpirationDateElement(DateTimeType value) { 578 this.expirationDate = value; 579 return this; 580 } 581 582 /** 583 * @return When this specific batch of product will expire. 584 */ 585 public Date getExpirationDate() { 586 return this.expirationDate == null ? null : this.expirationDate.getValue(); 587 } 588 589 /** 590 * @param value When this specific batch of product will expire. 591 */ 592 public MedicationBatchComponent setExpirationDate(Date value) { 593 if (value == null) 594 this.expirationDate = null; 595 else { 596 if (this.expirationDate == null) 597 this.expirationDate = new DateTimeType(); 598 this.expirationDate.setValue(value); 599 } 600 return this; 601 } 602 603 protected void listChildren(List<Property> children) { 604 super.listChildren(children); 605 children.add(new Property("lotNumber", "string", "The assigned lot number of a batch of the specified product.", 0, 1, lotNumber)); 606 children.add(new Property("expirationDate", "dateTime", "When this specific batch of product will expire.", 0, 1, expirationDate)); 607 } 608 609 @Override 610 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 611 switch (_hash) { 612 case 462547450: /*lotNumber*/ return new Property("lotNumber", "string", "The assigned lot number of a batch of the specified product.", 0, 1, lotNumber); 613 case -668811523: /*expirationDate*/ return new Property("expirationDate", "dateTime", "When this specific batch of product will expire.", 0, 1, expirationDate); 614 default: return super.getNamedProperty(_hash, _name, _checkValid); 615 } 616 617 } 618 619 @Override 620 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 621 switch (hash) { 622 case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType 623 case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType 624 default: return super.getProperty(hash, name, checkValid); 625 } 626 627 } 628 629 @Override 630 public Base setProperty(int hash, String name, Base value) throws FHIRException { 631 switch (hash) { 632 case 462547450: // lotNumber 633 this.lotNumber = TypeConvertor.castToString(value); // StringType 634 return value; 635 case -668811523: // expirationDate 636 this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType 637 return value; 638 default: return super.setProperty(hash, name, value); 639 } 640 641 } 642 643 @Override 644 public Base setProperty(String name, Base value) throws FHIRException { 645 if (name.equals("lotNumber")) { 646 this.lotNumber = TypeConvertor.castToString(value); // StringType 647 } else if (name.equals("expirationDate")) { 648 this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType 649 } else 650 return super.setProperty(name, value); 651 return value; 652 } 653 654 @Override 655 public Base makeProperty(int hash, String name) throws FHIRException { 656 switch (hash) { 657 case 462547450: return getLotNumberElement(); 658 case -668811523: return getExpirationDateElement(); 659 default: return super.makeProperty(hash, name); 660 } 661 662 } 663 664 @Override 665 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 666 switch (hash) { 667 case 462547450: /*lotNumber*/ return new String[] {"string"}; 668 case -668811523: /*expirationDate*/ return new String[] {"dateTime"}; 669 default: return super.getTypesForProperty(hash, name); 670 } 671 672 } 673 674 @Override 675 public Base addChild(String name) throws FHIRException { 676 if (name.equals("lotNumber")) { 677 throw new FHIRException("Cannot call addChild on a primitive type Medication.batch.lotNumber"); 678 } 679 else if (name.equals("expirationDate")) { 680 throw new FHIRException("Cannot call addChild on a primitive type Medication.batch.expirationDate"); 681 } 682 else 683 return super.addChild(name); 684 } 685 686 public MedicationBatchComponent copy() { 687 MedicationBatchComponent dst = new MedicationBatchComponent(); 688 copyValues(dst); 689 return dst; 690 } 691 692 public void copyValues(MedicationBatchComponent dst) { 693 super.copyValues(dst); 694 dst.lotNumber = lotNumber == null ? null : lotNumber.copy(); 695 dst.expirationDate = expirationDate == null ? null : expirationDate.copy(); 696 } 697 698 @Override 699 public boolean equalsDeep(Base other_) { 700 if (!super.equalsDeep(other_)) 701 return false; 702 if (!(other_ instanceof MedicationBatchComponent)) 703 return false; 704 MedicationBatchComponent o = (MedicationBatchComponent) other_; 705 return compareDeep(lotNumber, o.lotNumber, true) && compareDeep(expirationDate, o.expirationDate, true) 706 ; 707 } 708 709 @Override 710 public boolean equalsShallow(Base other_) { 711 if (!super.equalsShallow(other_)) 712 return false; 713 if (!(other_ instanceof MedicationBatchComponent)) 714 return false; 715 MedicationBatchComponent o = (MedicationBatchComponent) other_; 716 return compareValues(lotNumber, o.lotNumber, true) && compareValues(expirationDate, o.expirationDate, true) 717 ; 718 } 719 720 public boolean isEmpty() { 721 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(lotNumber, expirationDate 722 ); 723 } 724 725 public String fhirType() { 726 return "Medication.batch"; 727 728 } 729 730 } 731 732 /** 733 * Business identifier for this medication. 734 */ 735 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 736 @Description(shortDefinition="Business identifier for this medication", formalDefinition="Business identifier for this medication." ) 737 protected List<Identifier> identifier; 738 739 /** 740 * A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems. 741 */ 742 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 743 @Description(shortDefinition="Codes that identify this medication", formalDefinition="A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems." ) 744 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes") 745 protected CodeableConcept code; 746 747 /** 748 * A code to indicate if the medication is in active use. 749 */ 750 @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true) 751 @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="A code to indicate if the medication is in active use." ) 752 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-status") 753 protected Enumeration<MedicationStatusCodes> status; 754 755 /** 756 * Describes the details of the manufacturer of the medication product. This is not intended to represent the distributor of a medication product. 757 */ 758 @Child(name = "manufacturer", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=true) 759 @Description(shortDefinition="Manufacturer of the item", formalDefinition="Describes the details of the manufacturer of the medication product. This is not intended to represent the distributor of a medication product." ) 760 protected Reference manufacturer; 761 762 /** 763 * Describes the form of the item. Powder; tablets; capsule. 764 */ 765 @Child(name = "form", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false) 766 @Description(shortDefinition="powder | tablets | capsule +", formalDefinition="Describes the form of the item. Powder; tablets; capsule." ) 767 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-form-codes") 768 protected CodeableConcept form; 769 770 /** 771 * Specific amount of the drug in the packaged product. For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.). 772 */ 773 @Child(name = "amount", type = {Ratio.class}, order=5, min=0, max=1, modifier=false, summary=true) 774 @Description(shortDefinition="Amount of drug in package", formalDefinition="Specific amount of the drug in the packaged product. For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.)." ) 775 protected Ratio amount; 776 777 /** 778 * Identifies a particular constituent of interest in the product. 779 */ 780 @Child(name = "ingredient", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 781 @Description(shortDefinition="Active or inactive ingredient", formalDefinition="Identifies a particular constituent of interest in the product." ) 782 protected List<MedicationIngredientComponent> ingredient; 783 784 /** 785 * Information that only applies to packages (not products). 786 */ 787 @Child(name = "batch", type = {}, order=7, min=0, max=1, modifier=false, summary=false) 788 @Description(shortDefinition="Details about packaged medications", formalDefinition="Information that only applies to packages (not products)." ) 789 protected MedicationBatchComponent batch; 790 791 private static final long serialVersionUID = 1114691572L; 792 793 /** 794 * Constructor 795 */ 796 public Medication() { 797 super(); 798 } 799 800 /** 801 * @return {@link #identifier} (Business identifier for this medication.) 802 */ 803 public List<Identifier> getIdentifier() { 804 if (this.identifier == null) 805 this.identifier = new ArrayList<Identifier>(); 806 return this.identifier; 807 } 808 809 /** 810 * @return Returns a reference to <code>this</code> for easy method chaining 811 */ 812 public Medication setIdentifier(List<Identifier> theIdentifier) { 813 this.identifier = theIdentifier; 814 return this; 815 } 816 817 public boolean hasIdentifier() { 818 if (this.identifier == null) 819 return false; 820 for (Identifier item : this.identifier) 821 if (!item.isEmpty()) 822 return true; 823 return false; 824 } 825 826 public Identifier addIdentifier() { //3 827 Identifier t = new Identifier(); 828 if (this.identifier == null) 829 this.identifier = new ArrayList<Identifier>(); 830 this.identifier.add(t); 831 return t; 832 } 833 834 public Medication addIdentifier(Identifier t) { //3 835 if (t == null) 836 return this; 837 if (this.identifier == null) 838 this.identifier = new ArrayList<Identifier>(); 839 this.identifier.add(t); 840 return this; 841 } 842 843 /** 844 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3} 845 */ 846 public Identifier getIdentifierFirstRep() { 847 if (getIdentifier().isEmpty()) { 848 addIdentifier(); 849 } 850 return getIdentifier().get(0); 851 } 852 853 /** 854 * @return {@link #code} (A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.) 855 */ 856 public CodeableConcept getCode() { 857 if (this.code == null) 858 if (Configuration.errorOnAutoCreate()) 859 throw new Error("Attempt to auto-create Medication.code"); 860 else if (Configuration.doAutoCreate()) 861 this.code = new CodeableConcept(); // cc 862 return this.code; 863 } 864 865 public boolean hasCode() { 866 return this.code != null && !this.code.isEmpty(); 867 } 868 869 /** 870 * @param value {@link #code} (A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.) 871 */ 872 public Medication setCode(CodeableConcept value) { 873 this.code = value; 874 return this; 875 } 876 877 /** 878 * @return {@link #status} (A code to indicate if the medication is in active use.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 879 */ 880 public Enumeration<MedicationStatusCodes> getStatusElement() { 881 if (this.status == null) 882 if (Configuration.errorOnAutoCreate()) 883 throw new Error("Attempt to auto-create Medication.status"); 884 else if (Configuration.doAutoCreate()) 885 this.status = new Enumeration<MedicationStatusCodes>(new MedicationStatusCodesEnumFactory()); // bb 886 return this.status; 887 } 888 889 public boolean hasStatusElement() { 890 return this.status != null && !this.status.isEmpty(); 891 } 892 893 public boolean hasStatus() { 894 return this.status != null && !this.status.isEmpty(); 895 } 896 897 /** 898 * @param value {@link #status} (A code to indicate if the medication is in active use.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 899 */ 900 public Medication setStatusElement(Enumeration<MedicationStatusCodes> value) { 901 this.status = value; 902 return this; 903 } 904 905 /** 906 * @return A code to indicate if the medication is in active use. 907 */ 908 public MedicationStatusCodes getStatus() { 909 return this.status == null ? null : this.status.getValue(); 910 } 911 912 /** 913 * @param value A code to indicate if the medication is in active use. 914 */ 915 public Medication setStatus(MedicationStatusCodes value) { 916 if (value == null) 917 this.status = null; 918 else { 919 if (this.status == null) 920 this.status = new Enumeration<MedicationStatusCodes>(new MedicationStatusCodesEnumFactory()); 921 this.status.setValue(value); 922 } 923 return this; 924 } 925 926 /** 927 * @return {@link #manufacturer} (Describes the details of the manufacturer of the medication product. This is not intended to represent the distributor of a medication product.) 928 */ 929 public Reference getManufacturer() { 930 if (this.manufacturer == null) 931 if (Configuration.errorOnAutoCreate()) 932 throw new Error("Attempt to auto-create Medication.manufacturer"); 933 else if (Configuration.doAutoCreate()) 934 this.manufacturer = new Reference(); // cc 935 return this.manufacturer; 936 } 937 938 public boolean hasManufacturer() { 939 return this.manufacturer != null && !this.manufacturer.isEmpty(); 940 } 941 942 /** 943 * @param value {@link #manufacturer} (Describes the details of the manufacturer of the medication product. This is not intended to represent the distributor of a medication product.) 944 */ 945 public Medication setManufacturer(Reference value) { 946 this.manufacturer = value; 947 return this; 948 } 949 950 /** 951 * @return {@link #form} (Describes the form of the item. Powder; tablets; capsule.) 952 */ 953 public CodeableConcept getForm() { 954 if (this.form == null) 955 if (Configuration.errorOnAutoCreate()) 956 throw new Error("Attempt to auto-create Medication.form"); 957 else if (Configuration.doAutoCreate()) 958 this.form = new CodeableConcept(); // cc 959 return this.form; 960 } 961 962 public boolean hasForm() { 963 return this.form != null && !this.form.isEmpty(); 964 } 965 966 /** 967 * @param value {@link #form} (Describes the form of the item. Powder; tablets; capsule.) 968 */ 969 public Medication setForm(CodeableConcept value) { 970 this.form = value; 971 return this; 972 } 973 974 /** 975 * @return {@link #amount} (Specific amount of the drug in the packaged product. For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).) 976 */ 977 public Ratio getAmount() { 978 if (this.amount == null) 979 if (Configuration.errorOnAutoCreate()) 980 throw new Error("Attempt to auto-create Medication.amount"); 981 else if (Configuration.doAutoCreate()) 982 this.amount = new Ratio(); // cc 983 return this.amount; 984 } 985 986 public boolean hasAmount() { 987 return this.amount != null && !this.amount.isEmpty(); 988 } 989 990 /** 991 * @param value {@link #amount} (Specific amount of the drug in the packaged product. For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).) 992 */ 993 public Medication setAmount(Ratio value) { 994 this.amount = value; 995 return this; 996 } 997 998 /** 999 * @return {@link #ingredient} (Identifies a particular constituent of interest in the product.) 1000 */ 1001 public List<MedicationIngredientComponent> getIngredient() { 1002 if (this.ingredient == null) 1003 this.ingredient = new ArrayList<MedicationIngredientComponent>(); 1004 return this.ingredient; 1005 } 1006 1007 /** 1008 * @return Returns a reference to <code>this</code> for easy method chaining 1009 */ 1010 public Medication setIngredient(List<MedicationIngredientComponent> theIngredient) { 1011 this.ingredient = theIngredient; 1012 return this; 1013 } 1014 1015 public boolean hasIngredient() { 1016 if (this.ingredient == null) 1017 return false; 1018 for (MedicationIngredientComponent item : this.ingredient) 1019 if (!item.isEmpty()) 1020 return true; 1021 return false; 1022 } 1023 1024 public MedicationIngredientComponent addIngredient() { //3 1025 MedicationIngredientComponent t = new MedicationIngredientComponent(); 1026 if (this.ingredient == null) 1027 this.ingredient = new ArrayList<MedicationIngredientComponent>(); 1028 this.ingredient.add(t); 1029 return t; 1030 } 1031 1032 public Medication addIngredient(MedicationIngredientComponent t) { //3 1033 if (t == null) 1034 return this; 1035 if (this.ingredient == null) 1036 this.ingredient = new ArrayList<MedicationIngredientComponent>(); 1037 this.ingredient.add(t); 1038 return this; 1039 } 1040 1041 /** 1042 * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist {3} 1043 */ 1044 public MedicationIngredientComponent getIngredientFirstRep() { 1045 if (getIngredient().isEmpty()) { 1046 addIngredient(); 1047 } 1048 return getIngredient().get(0); 1049 } 1050 1051 /** 1052 * @return {@link #batch} (Information that only applies to packages (not products).) 1053 */ 1054 public MedicationBatchComponent getBatch() { 1055 if (this.batch == null) 1056 if (Configuration.errorOnAutoCreate()) 1057 throw new Error("Attempt to auto-create Medication.batch"); 1058 else if (Configuration.doAutoCreate()) 1059 this.batch = new MedicationBatchComponent(); // cc 1060 return this.batch; 1061 } 1062 1063 public boolean hasBatch() { 1064 return this.batch != null && !this.batch.isEmpty(); 1065 } 1066 1067 /** 1068 * @param value {@link #batch} (Information that only applies to packages (not products).) 1069 */ 1070 public Medication setBatch(MedicationBatchComponent value) { 1071 this.batch = value; 1072 return this; 1073 } 1074 1075 protected void listChildren(List<Property> children) { 1076 super.listChildren(children); 1077 children.add(new Property("identifier", "Identifier", "Business identifier for this medication.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1078 children.add(new Property("code", "CodeableConcept", "A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.", 0, 1, code)); 1079 children.add(new Property("status", "code", "A code to indicate if the medication is in active use.", 0, 1, status)); 1080 children.add(new Property("manufacturer", "Reference(Organization)", "Describes the details of the manufacturer of the medication product. This is not intended to represent the distributor of a medication product.", 0, 1, manufacturer)); 1081 children.add(new Property("form", "CodeableConcept", "Describes the form of the item. Powder; tablets; capsule.", 0, 1, form)); 1082 children.add(new Property("amount", "Ratio", "Specific amount of the drug in the packaged product. For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).", 0, 1, amount)); 1083 children.add(new Property("ingredient", "", "Identifies a particular constituent of interest in the product.", 0, java.lang.Integer.MAX_VALUE, ingredient)); 1084 children.add(new Property("batch", "", "Information that only applies to packages (not products).", 0, 1, batch)); 1085 } 1086 1087 @Override 1088 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1089 switch (_hash) { 1090 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Business identifier for this medication.", 0, java.lang.Integer.MAX_VALUE, identifier); 1091 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.", 0, 1, code); 1092 case -892481550: /*status*/ return new Property("status", "code", "A code to indicate if the medication is in active use.", 0, 1, status); 1093 case -1969347631: /*manufacturer*/ return new Property("manufacturer", "Reference(Organization)", "Describes the details of the manufacturer of the medication product. This is not intended to represent the distributor of a medication product.", 0, 1, manufacturer); 1094 case 3148996: /*form*/ return new Property("form", "CodeableConcept", "Describes the form of the item. Powder; tablets; capsule.", 0, 1, form); 1095 case -1413853096: /*amount*/ return new Property("amount", "Ratio", "Specific amount of the drug in the packaged product. For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).", 0, 1, amount); 1096 case -206409263: /*ingredient*/ return new Property("ingredient", "", "Identifies a particular constituent of interest in the product.", 0, java.lang.Integer.MAX_VALUE, ingredient); 1097 case 93509434: /*batch*/ return new Property("batch", "", "Information that only applies to packages (not products).", 0, 1, batch); 1098 default: return super.getNamedProperty(_hash, _name, _checkValid); 1099 } 1100 1101 } 1102 1103 @Override 1104 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1105 switch (hash) { 1106 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1107 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 1108 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationStatusCodes> 1109 case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference 1110 case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept 1111 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Ratio 1112 case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // MedicationIngredientComponent 1113 case 93509434: /*batch*/ return this.batch == null ? new Base[0] : new Base[] {this.batch}; // MedicationBatchComponent 1114 default: return super.getProperty(hash, name, checkValid); 1115 } 1116 1117 } 1118 1119 @Override 1120 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1121 switch (hash) { 1122 case -1618432855: // identifier 1123 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier 1124 return value; 1125 case 3059181: // code 1126 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1127 return value; 1128 case -892481550: // status 1129 value = new MedicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value)); 1130 this.status = (Enumeration) value; // Enumeration<MedicationStatusCodes> 1131 return value; 1132 case -1969347631: // manufacturer 1133 this.manufacturer = TypeConvertor.castToReference(value); // Reference 1134 return value; 1135 case 3148996: // form 1136 this.form = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1137 return value; 1138 case -1413853096: // amount 1139 this.amount = TypeConvertor.castToRatio(value); // Ratio 1140 return value; 1141 case -206409263: // ingredient 1142 this.getIngredient().add((MedicationIngredientComponent) value); // MedicationIngredientComponent 1143 return value; 1144 case 93509434: // batch 1145 this.batch = (MedicationBatchComponent) value; // MedicationBatchComponent 1146 return value; 1147 default: return super.setProperty(hash, name, value); 1148 } 1149 1150 } 1151 1152 @Override 1153 public Base setProperty(String name, Base value) throws FHIRException { 1154 if (name.equals("identifier")) { 1155 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); 1156 } else if (name.equals("code")) { 1157 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1158 } else if (name.equals("status")) { 1159 value = new MedicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value)); 1160 this.status = (Enumeration) value; // Enumeration<MedicationStatusCodes> 1161 } else if (name.equals("manufacturer")) { 1162 this.manufacturer = TypeConvertor.castToReference(value); // Reference 1163 } else if (name.equals("form")) { 1164 this.form = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1165 } else if (name.equals("amount")) { 1166 this.amount = TypeConvertor.castToRatio(value); // Ratio 1167 } else if (name.equals("ingredient")) { 1168 this.getIngredient().add((MedicationIngredientComponent) value); 1169 } else if (name.equals("batch")) { 1170 this.batch = (MedicationBatchComponent) value; // MedicationBatchComponent 1171 } else 1172 return super.setProperty(name, value); 1173 return value; 1174 } 1175 1176 @Override 1177 public Base makeProperty(int hash, String name) throws FHIRException { 1178 switch (hash) { 1179 case -1618432855: return addIdentifier(); 1180 case 3059181: return getCode(); 1181 case -892481550: return getStatusElement(); 1182 case -1969347631: return getManufacturer(); 1183 case 3148996: return getForm(); 1184 case -1413853096: return getAmount(); 1185 case -206409263: return addIngredient(); 1186 case 93509434: return getBatch(); 1187 default: return super.makeProperty(hash, name); 1188 } 1189 1190 } 1191 1192 @Override 1193 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1194 switch (hash) { 1195 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1196 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 1197 case -892481550: /*status*/ return new String[] {"code"}; 1198 case -1969347631: /*manufacturer*/ return new String[] {"Reference"}; 1199 case 3148996: /*form*/ return new String[] {"CodeableConcept"}; 1200 case -1413853096: /*amount*/ return new String[] {"Ratio"}; 1201 case -206409263: /*ingredient*/ return new String[] {}; 1202 case 93509434: /*batch*/ return new String[] {}; 1203 default: return super.getTypesForProperty(hash, name); 1204 } 1205 1206 } 1207 1208 @Override 1209 public Base addChild(String name) throws FHIRException { 1210 if (name.equals("identifier")) { 1211 return addIdentifier(); 1212 } 1213 else if (name.equals("code")) { 1214 this.code = new CodeableConcept(); 1215 return this.code; 1216 } 1217 else if (name.equals("status")) { 1218 throw new FHIRException("Cannot call addChild on a primitive type Medication.status"); 1219 } 1220 else if (name.equals("manufacturer")) { 1221 this.manufacturer = new Reference(); 1222 return this.manufacturer; 1223 } 1224 else if (name.equals("form")) { 1225 this.form = new CodeableConcept(); 1226 return this.form; 1227 } 1228 else if (name.equals("amount")) { 1229 this.amount = new Ratio(); 1230 return this.amount; 1231 } 1232 else if (name.equals("ingredient")) { 1233 return addIngredient(); 1234 } 1235 else if (name.equals("batch")) { 1236 this.batch = new MedicationBatchComponent(); 1237 return this.batch; 1238 } 1239 else 1240 return super.addChild(name); 1241 } 1242 1243 public String fhirType() { 1244 return "Medication"; 1245 1246 } 1247 1248 public Medication copy() { 1249 Medication dst = new Medication(); 1250 copyValues(dst); 1251 return dst; 1252 } 1253 1254 public void copyValues(Medication dst) { 1255 super.copyValues(dst); 1256 if (identifier != null) { 1257 dst.identifier = new ArrayList<Identifier>(); 1258 for (Identifier i : identifier) 1259 dst.identifier.add(i.copy()); 1260 }; 1261 dst.code = code == null ? null : code.copy(); 1262 dst.status = status == null ? null : status.copy(); 1263 dst.manufacturer = manufacturer == null ? null : manufacturer.copy(); 1264 dst.form = form == null ? null : form.copy(); 1265 dst.amount = amount == null ? null : amount.copy(); 1266 if (ingredient != null) { 1267 dst.ingredient = new ArrayList<MedicationIngredientComponent>(); 1268 for (MedicationIngredientComponent i : ingredient) 1269 dst.ingredient.add(i.copy()); 1270 }; 1271 dst.batch = batch == null ? null : batch.copy(); 1272 } 1273 1274 protected Medication typedCopy() { 1275 return copy(); 1276 } 1277 1278 @Override 1279 public boolean equalsDeep(Base other_) { 1280 if (!super.equalsDeep(other_)) 1281 return false; 1282 if (!(other_ instanceof Medication)) 1283 return false; 1284 Medication o = (Medication) other_; 1285 return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(status, o.status, true) 1286 && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(form, o.form, true) && compareDeep(amount, o.amount, true) 1287 && compareDeep(ingredient, o.ingredient, true) && compareDeep(batch, o.batch, true); 1288 } 1289 1290 @Override 1291 public boolean equalsShallow(Base other_) { 1292 if (!super.equalsShallow(other_)) 1293 return false; 1294 if (!(other_ instanceof Medication)) 1295 return false; 1296 Medication o = (Medication) other_; 1297 return compareValues(status, o.status, true); 1298 } 1299 1300 public boolean isEmpty() { 1301 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, code, status 1302 , manufacturer, form, amount, ingredient, batch); 1303 } 1304 1305 @Override 1306 public ResourceType getResourceType() { 1307 return ResourceType.Medication; 1308 } 1309 1310 /** 1311 * Search parameter: <b>expiration-date</b> 1312 * <p> 1313 * Description: <b>Returns medications in a batch with this expiration date</b><br> 1314 * Type: <b>date</b><br> 1315 * Path: <b>Medication.batch.expirationDate</b><br> 1316 * </p> 1317 */ 1318 @SearchParamDefinition(name="expiration-date", path="Medication.batch.expirationDate", description="Returns medications in a batch with this expiration date", type="date" ) 1319 public static final String SP_EXPIRATION_DATE = "expiration-date"; 1320 /** 1321 * <b>Fluent Client</b> search parameter constant for <b>expiration-date</b> 1322 * <p> 1323 * Description: <b>Returns medications in a batch with this expiration date</b><br> 1324 * Type: <b>date</b><br> 1325 * Path: <b>Medication.batch.expirationDate</b><br> 1326 * </p> 1327 */ 1328 public static final ca.uhn.fhir.rest.gclient.DateClientParam EXPIRATION_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EXPIRATION_DATE); 1329 1330 /** 1331 * Search parameter: <b>form</b> 1332 * <p> 1333 * Description: <b>Returns medications for a specific dose form</b><br> 1334 * Type: <b>token</b><br> 1335 * Path: <b>Medication.form</b><br> 1336 * </p> 1337 */ 1338 @SearchParamDefinition(name="form", path="Medication.form", description="Returns medications for a specific dose form", type="token" ) 1339 public static final String SP_FORM = "form"; 1340 /** 1341 * <b>Fluent Client</b> search parameter constant for <b>form</b> 1342 * <p> 1343 * Description: <b>Returns medications for a specific dose form</b><br> 1344 * Type: <b>token</b><br> 1345 * Path: <b>Medication.form</b><br> 1346 * </p> 1347 */ 1348 public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORM); 1349 1350 /** 1351 * Search parameter: <b>identifier</b> 1352 * <p> 1353 * Description: <b>Returns medications with this external identifier</b><br> 1354 * Type: <b>token</b><br> 1355 * Path: <b>Medication.identifier</b><br> 1356 * </p> 1357 */ 1358 @SearchParamDefinition(name="identifier", path="Medication.identifier", description="Returns medications with this external identifier", type="token" ) 1359 public static final String SP_IDENTIFIER = "identifier"; 1360 /** 1361 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1362 * <p> 1363 * Description: <b>Returns medications with this external identifier</b><br> 1364 * Type: <b>token</b><br> 1365 * Path: <b>Medication.identifier</b><br> 1366 * </p> 1367 */ 1368 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1369 1370 /** 1371 * Search parameter: <b>ingredient-code</b> 1372 * <p> 1373 * Description: <b>Returns medications for this ingredient code</b><br> 1374 * Type: <b>token</b><br> 1375 * Path: <b>(Medication.ingredient.item as CodeableConcept)</b><br> 1376 * </p> 1377 */ 1378 @SearchParamDefinition(name="ingredient-code", path="(Medication.ingredient.item as CodeableConcept)", description="Returns medications for this ingredient code", type="token" ) 1379 public static final String SP_INGREDIENT_CODE = "ingredient-code"; 1380 /** 1381 * <b>Fluent Client</b> search parameter constant for <b>ingredient-code</b> 1382 * <p> 1383 * Description: <b>Returns medications for this ingredient code</b><br> 1384 * Type: <b>token</b><br> 1385 * Path: <b>(Medication.ingredient.item as CodeableConcept)</b><br> 1386 * </p> 1387 */ 1388 public static final ca.uhn.fhir.rest.gclient.TokenClientParam INGREDIENT_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INGREDIENT_CODE); 1389 1390 /** 1391 * Search parameter: <b>ingredient</b> 1392 * <p> 1393 * Description: <b>Returns medications for this ingredient reference</b><br> 1394 * Type: <b>reference</b><br> 1395 * Path: <b>(Medication.ingredient.item as Reference)</b><br> 1396 * </p> 1397 */ 1398 @SearchParamDefinition(name="ingredient", path="(Medication.ingredient.item as Reference)", description="Returns medications for this ingredient reference", type="reference", target={Medication.class, Substance.class } ) 1399 public static final String SP_INGREDIENT = "ingredient"; 1400 /** 1401 * <b>Fluent Client</b> search parameter constant for <b>ingredient</b> 1402 * <p> 1403 * Description: <b>Returns medications for this ingredient reference</b><br> 1404 * Type: <b>reference</b><br> 1405 * Path: <b>(Medication.ingredient.item as Reference)</b><br> 1406 * </p> 1407 */ 1408 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INGREDIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INGREDIENT); 1409 1410/** 1411 * Constant for fluent queries to be used to add include statements. Specifies 1412 * the path value of "<b>Medication:ingredient</b>". 1413 */ 1414 public static final ca.uhn.fhir.model.api.Include INCLUDE_INGREDIENT = new ca.uhn.fhir.model.api.Include("Medication:ingredient").toLocked(); 1415 1416 /** 1417 * Search parameter: <b>lot-number</b> 1418 * <p> 1419 * Description: <b>Returns medications in a batch with this lot number</b><br> 1420 * Type: <b>token</b><br> 1421 * Path: <b>Medication.batch.lotNumber</b><br> 1422 * </p> 1423 */ 1424 @SearchParamDefinition(name="lot-number", path="Medication.batch.lotNumber", description="Returns medications in a batch with this lot number", type="token" ) 1425 public static final String SP_LOT_NUMBER = "lot-number"; 1426 /** 1427 * <b>Fluent Client</b> search parameter constant for <b>lot-number</b> 1428 * <p> 1429 * Description: <b>Returns medications in a batch with this lot number</b><br> 1430 * Type: <b>token</b><br> 1431 * Path: <b>Medication.batch.lotNumber</b><br> 1432 * </p> 1433 */ 1434 public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOT_NUMBER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOT_NUMBER); 1435 1436 /** 1437 * Search parameter: <b>manufacturer</b> 1438 * <p> 1439 * Description: <b>Returns medications made or sold for this manufacturer</b><br> 1440 * Type: <b>reference</b><br> 1441 * Path: <b>Medication.manufacturer</b><br> 1442 * </p> 1443 */ 1444 @SearchParamDefinition(name="manufacturer", path="Medication.manufacturer", description="Returns medications made or sold for this manufacturer", type="reference", target={Organization.class } ) 1445 public static final String SP_MANUFACTURER = "manufacturer"; 1446 /** 1447 * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b> 1448 * <p> 1449 * Description: <b>Returns medications made or sold for this manufacturer</b><br> 1450 * Type: <b>reference</b><br> 1451 * Path: <b>Medication.manufacturer</b><br> 1452 * </p> 1453 */ 1454 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER); 1455 1456/** 1457 * Constant for fluent queries to be used to add include statements. Specifies 1458 * the path value of "<b>Medication:manufacturer</b>". 1459 */ 1460 public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("Medication:manufacturer").toLocked(); 1461 1462 /** 1463 * Search parameter: <b>status</b> 1464 * <p> 1465 * Description: <b>Returns medications for this status</b><br> 1466 * Type: <b>token</b><br> 1467 * Path: <b>Medication.status</b><br> 1468 * </p> 1469 */ 1470 @SearchParamDefinition(name="status", path="Medication.status", description="Returns medications for this status", type="token" ) 1471 public static final String SP_STATUS = "status"; 1472 /** 1473 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1474 * <p> 1475 * Description: <b>Returns medications for this status</b><br> 1476 * Type: <b>token</b><br> 1477 * Path: <b>Medication.status</b><br> 1478 * </p> 1479 */ 1480 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1481 1482 /** 1483 * Search parameter: <b>code</b> 1484 * <p> 1485 * Description: <b>Multiple Resources: 1486 1487* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance 1488* [Condition](condition.html): Code for the condition 1489* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered 1490* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result 1491* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code 1492* [List](list.html): What the purpose of this list is 1493* [Medication](medication.html): Returns medications for a specific code 1494* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code 1495* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code 1496* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code 1497* [MedicationStatement](medicationstatement.html): Return statements of this medication code 1498* [Observation](observation.html): The code of the observation type 1499* [Procedure](procedure.html): A code to identify a procedure 1500* [ServiceRequest](servicerequest.html): What is being requested/ordered 1501</b><br> 1502 * Type: <b>token</b><br> 1503 * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code</b><br> 1504 * </p> 1505 */ 1506 @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationStatement](medicationstatement.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type="token" ) 1507 public static final String SP_CODE = "code"; 1508 /** 1509 * <b>Fluent Client</b> search parameter constant for <b>code</b> 1510 * <p> 1511 * Description: <b>Multiple Resources: 1512 1513* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance 1514* [Condition](condition.html): Code for the condition 1515* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered 1516* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result 1517* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code 1518* [List](list.html): What the purpose of this list is 1519* [Medication](medication.html): Returns medications for a specific code 1520* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code 1521* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code 1522* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code 1523* [MedicationStatement](medicationstatement.html): Return statements of this medication code 1524* [Observation](observation.html): The code of the observation type 1525* [Procedure](procedure.html): A code to identify a procedure 1526* [ServiceRequest](servicerequest.html): What is being requested/ordered 1527</b><br> 1528 * Type: <b>token</b><br> 1529 * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code</b><br> 1530 * </p> 1531 */ 1532 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 1533 1534 1535} 1536