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