001package org.hl7.fhir.r5.model; 002 003 004/* 005 * #%L 006 * org.hl7.fhir.r5 007 * %% 008 * Copyright (C) 2014 - 2019 Health Level 7 009 * %% 010 * Licensed under the Apache License, Version 2.0 (the \"License\"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an \"AS IS\" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * #L% 022 */ 023 024/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, \ 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this \ 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, \ 034 this list of conditions and the following disclaimer in the documentation \ 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 049 POSSIBILITY OF SUCH DAMAGE. 050 */ 051 052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent 053 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 057import org.hl7.fhir.utilities.Utilities; 058import org.hl7.fhir.r5.model.Enumerations.*; 059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 060import org.hl7.fhir.exceptions.FHIRException; 061import org.hl7.fhir.instance.model.api.ICompositeType; 062import ca.uhn.fhir.model.api.annotation.Child; 063import ca.uhn.fhir.model.api.annotation.ChildOrder; 064import ca.uhn.fhir.model.api.annotation.DatatypeDef; 065import ca.uhn.fhir.model.api.annotation.Description; 066import ca.uhn.fhir.model.api.annotation.Block; 067 068/** 069 * Base StructureDefinition for Dosage Type: Indicates how the medication is/was taken or should be taken by the patient. 070 */ 071@DatatypeDef(name="Dosage") 072public class Dosage extends BackboneType implements ICompositeType { 073 074 @Block() 075 public static class DosageDoseAndRateComponent extends Element implements IBaseDatatypeElement { 076 /** 077 * The kind of dose or rate specified, for example, ordered or calculated. 078 */ 079 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 080 @Description(shortDefinition="The kind of dose or rate specified", formalDefinition="The kind of dose or rate specified, for example, ordered or calculated." ) 081 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/dose-rate-type") 082 protected CodeableConcept type; 083 084 /** 085 * Amount of medication per dose. 086 */ 087 @Child(name = "dose", type = {Range.class, Quantity.class}, order=2, min=0, max=1, modifier=false, summary=true) 088 @Description(shortDefinition="Amount of medication per dose", formalDefinition="Amount of medication per dose." ) 089 protected DataType dose; 090 091 /** 092 * Amount of medication per unit of time. 093 */ 094 @Child(name = "rate", type = {Ratio.class, Range.class, Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true) 095 @Description(shortDefinition="Amount of medication per unit of time", formalDefinition="Amount of medication per unit of time." ) 096 protected DataType rate; 097 098 private static final long serialVersionUID = 230646604L; 099 100 /** 101 * Constructor 102 */ 103 public DosageDoseAndRateComponent() { 104 super(); 105 } 106 107 /** 108 * @return {@link #type} (The kind of dose or rate specified, for example, ordered or calculated.) 109 */ 110 public CodeableConcept getType() { 111 if (this.type == null) 112 if (Configuration.errorOnAutoCreate()) 113 throw new Error("Attempt to auto-create DosageDoseAndRateComponent.type"); 114 else if (Configuration.doAutoCreate()) 115 this.type = new CodeableConcept(); // cc 116 return this.type; 117 } 118 119 public boolean hasType() { 120 return this.type != null && !this.type.isEmpty(); 121 } 122 123 /** 124 * @param value {@link #type} (The kind of dose or rate specified, for example, ordered or calculated.) 125 */ 126 public DosageDoseAndRateComponent setType(CodeableConcept value) { 127 this.type = value; 128 return this; 129 } 130 131 /** 132 * @return {@link #dose} (Amount of medication per dose.) 133 */ 134 public DataType getDose() { 135 return this.dose; 136 } 137 138 /** 139 * @return {@link #dose} (Amount of medication per dose.) 140 */ 141 public Range getDoseRange() throws FHIRException { 142 if (this.dose == null) 143 this.dose = new Range(); 144 if (!(this.dose instanceof Range)) 145 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.dose.getClass().getName()+" was encountered"); 146 return (Range) this.dose; 147 } 148 149 public boolean hasDoseRange() { 150 return this != null && this.dose instanceof Range; 151 } 152 153 /** 154 * @return {@link #dose} (Amount of medication per dose.) 155 */ 156 public Quantity getDoseQuantity() throws FHIRException { 157 if (this.dose == null) 158 this.dose = new Quantity(); 159 if (!(this.dose instanceof Quantity)) 160 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.dose.getClass().getName()+" was encountered"); 161 return (Quantity) this.dose; 162 } 163 164 public boolean hasDoseQuantity() { 165 return this != null && this.dose instanceof Quantity; 166 } 167 168 public boolean hasDose() { 169 return this.dose != null && !this.dose.isEmpty(); 170 } 171 172 /** 173 * @param value {@link #dose} (Amount of medication per dose.) 174 */ 175 public DosageDoseAndRateComponent setDose(DataType value) { 176 if (value != null && !(value instanceof Range || value instanceof Quantity)) 177 throw new Error("Not the right type for Dosage.doseAndRate.dose[x]: "+value.fhirType()); 178 this.dose = value; 179 return this; 180 } 181 182 /** 183 * @return {@link #rate} (Amount of medication per unit of time.) 184 */ 185 public DataType getRate() { 186 return this.rate; 187 } 188 189 /** 190 * @return {@link #rate} (Amount of medication per unit of time.) 191 */ 192 public Ratio getRateRatio() throws FHIRException { 193 if (this.rate == null) 194 this.rate = new Ratio(); 195 if (!(this.rate instanceof Ratio)) 196 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered"); 197 return (Ratio) this.rate; 198 } 199 200 public boolean hasRateRatio() { 201 return this != null && this.rate instanceof Ratio; 202 } 203 204 /** 205 * @return {@link #rate} (Amount of medication per unit of time.) 206 */ 207 public Range getRateRange() throws FHIRException { 208 if (this.rate == null) 209 this.rate = new Range(); 210 if (!(this.rate instanceof Range)) 211 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.rate.getClass().getName()+" was encountered"); 212 return (Range) this.rate; 213 } 214 215 public boolean hasRateRange() { 216 return this != null && this.rate instanceof Range; 217 } 218 219 /** 220 * @return {@link #rate} (Amount of medication per unit of time.) 221 */ 222 public Quantity getRateQuantity() throws FHIRException { 223 if (this.rate == null) 224 this.rate = new Quantity(); 225 if (!(this.rate instanceof Quantity)) 226 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.rate.getClass().getName()+" was encountered"); 227 return (Quantity) this.rate; 228 } 229 230 public boolean hasRateQuantity() { 231 return this != null && this.rate instanceof Quantity; 232 } 233 234 public boolean hasRate() { 235 return this.rate != null && !this.rate.isEmpty(); 236 } 237 238 /** 239 * @param value {@link #rate} (Amount of medication per unit of time.) 240 */ 241 public DosageDoseAndRateComponent setRate(DataType value) { 242 if (value != null && !(value instanceof Ratio || value instanceof Range || value instanceof Quantity)) 243 throw new Error("Not the right type for Dosage.doseAndRate.rate[x]: "+value.fhirType()); 244 this.rate = value; 245 return this; 246 } 247 248 protected void listChildren(List<Property> children) { 249 super.listChildren(children); 250 children.add(new Property("type", "CodeableConcept", "The kind of dose or rate specified, for example, ordered or calculated.", 0, 1, type)); 251 children.add(new Property("dose[x]", "Range|Quantity", "Amount of medication per dose.", 0, 1, dose)); 252 children.add(new Property("rate[x]", "Ratio|Range|Quantity", "Amount of medication per unit of time.", 0, 1, rate)); 253 } 254 255 @Override 256 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 257 switch (_hash) { 258 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "The kind of dose or rate specified, for example, ordered or calculated.", 0, 1, type); 259 case 1843195715: /*dose[x]*/ return new Property("dose[x]", "Range|Quantity", "Amount of medication per dose.", 0, 1, dose); 260 case 3089437: /*dose*/ return new Property("dose[x]", "Range|Quantity", "Amount of medication per dose.", 0, 1, dose); 261 case 1775578912: /*doseRange*/ return new Property("dose[x]", "Range", "Amount of medication per dose.", 0, 1, dose); 262 case -2083618872: /*doseQuantity*/ return new Property("dose[x]", "Quantity", "Amount of medication per dose.", 0, 1, dose); 263 case 983460768: /*rate[x]*/ return new Property("rate[x]", "Ratio|Range|Quantity", "Amount of medication per unit of time.", 0, 1, rate); 264 case 3493088: /*rate*/ return new Property("rate[x]", "Ratio|Range|Quantity", "Amount of medication per unit of time.", 0, 1, rate); 265 case 204021515: /*rateRatio*/ return new Property("rate[x]", "Ratio", "Amount of medication per unit of time.", 0, 1, rate); 266 case 204015677: /*rateRange*/ return new Property("rate[x]", "Range", "Amount of medication per unit of time.", 0, 1, rate); 267 case -1085459061: /*rateQuantity*/ return new Property("rate[x]", "Quantity", "Amount of medication per unit of time.", 0, 1, rate); 268 default: return super.getNamedProperty(_hash, _name, _checkValid); 269 } 270 271 } 272 273 @Override 274 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 275 switch (hash) { 276 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 277 case 3089437: /*dose*/ return this.dose == null ? new Base[0] : new Base[] {this.dose}; // DataType 278 case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // DataType 279 default: return super.getProperty(hash, name, checkValid); 280 } 281 282 } 283 284 @Override 285 public Base setProperty(int hash, String name, Base value) throws FHIRException { 286 switch (hash) { 287 case 3575610: // type 288 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 289 return value; 290 case 3089437: // dose 291 this.dose = TypeConvertor.castToType(value); // DataType 292 return value; 293 case 3493088: // rate 294 this.rate = TypeConvertor.castToType(value); // DataType 295 return value; 296 default: return super.setProperty(hash, name, value); 297 } 298 299 } 300 301 @Override 302 public Base setProperty(String name, Base value) throws FHIRException { 303 if (name.equals("type")) { 304 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 305 } else if (name.equals("dose[x]")) { 306 this.dose = TypeConvertor.castToType(value); // DataType 307 } else if (name.equals("rate[x]")) { 308 this.rate = TypeConvertor.castToType(value); // DataType 309 } else 310 return super.setProperty(name, value); 311 return value; 312 } 313 314 @Override 315 public Base makeProperty(int hash, String name) throws FHIRException { 316 switch (hash) { 317 case 3575610: return getType(); 318 case 1843195715: return getDose(); 319 case 3089437: return getDose(); 320 case 983460768: return getRate(); 321 case 3493088: return getRate(); 322 default: return super.makeProperty(hash, name); 323 } 324 325 } 326 327 @Override 328 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 329 switch (hash) { 330 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 331 case 3089437: /*dose*/ return new String[] {"Range", "Quantity"}; 332 case 3493088: /*rate*/ return new String[] {"Ratio", "Range", "Quantity"}; 333 default: return super.getTypesForProperty(hash, name); 334 } 335 336 } 337 338 @Override 339 public Base addChild(String name) throws FHIRException { 340 if (name.equals("type")) { 341 this.type = new CodeableConcept(); 342 return this.type; 343 } 344 else if (name.equals("doseRange")) { 345 this.dose = new Range(); 346 return this.dose; 347 } 348 else if (name.equals("doseQuantity")) { 349 this.dose = new Quantity(); 350 return this.dose; 351 } 352 else if (name.equals("rateRatio")) { 353 this.rate = new Ratio(); 354 return this.rate; 355 } 356 else if (name.equals("rateRange")) { 357 this.rate = new Range(); 358 return this.rate; 359 } 360 else if (name.equals("rateQuantity")) { 361 this.rate = new Quantity(); 362 return this.rate; 363 } 364 else 365 return super.addChild(name); 366 } 367 368 public DosageDoseAndRateComponent copy() { 369 DosageDoseAndRateComponent dst = new DosageDoseAndRateComponent(); 370 copyValues(dst); 371 return dst; 372 } 373 374 public void copyValues(DosageDoseAndRateComponent dst) { 375 super.copyValues(dst); 376 dst.type = type == null ? null : type.copy(); 377 dst.dose = dose == null ? null : dose.copy(); 378 dst.rate = rate == null ? null : rate.copy(); 379 } 380 381 @Override 382 public boolean equalsDeep(Base other_) { 383 if (!super.equalsDeep(other_)) 384 return false; 385 if (!(other_ instanceof DosageDoseAndRateComponent)) 386 return false; 387 DosageDoseAndRateComponent o = (DosageDoseAndRateComponent) other_; 388 return compareDeep(type, o.type, true) && compareDeep(dose, o.dose, true) && compareDeep(rate, o.rate, true) 389 ; 390 } 391 392 @Override 393 public boolean equalsShallow(Base other_) { 394 if (!super.equalsShallow(other_)) 395 return false; 396 if (!(other_ instanceof DosageDoseAndRateComponent)) 397 return false; 398 DosageDoseAndRateComponent o = (DosageDoseAndRateComponent) other_; 399 return true; 400 } 401 402 public boolean isEmpty() { 403 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, dose, rate); 404 } 405 406 public String fhirType() { 407 return "Dosage.doseAndRate"; 408 409 } 410 411 } 412 413 /** 414 * Indicates the order in which the dosage instructions should be applied or interpreted. 415 */ 416 @Child(name = "sequence", type = {IntegerType.class}, order=0, min=0, max=1, modifier=false, summary=true) 417 @Description(shortDefinition="The order of the dosage instructions", formalDefinition="Indicates the order in which the dosage instructions should be applied or interpreted." ) 418 protected IntegerType sequence; 419 420 /** 421 * Free text dosage instructions e.g. SIG. 422 */ 423 @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 424 @Description(shortDefinition="Free text dosage instructions e.g. SIG", formalDefinition="Free text dosage instructions e.g. SIG." ) 425 protected StringType text; 426 427 /** 428 * Supplemental instructions to the patient on how to take the medication (e.g. "with meals" or"take half to one hour before food") or warnings for the patient about the medication (e.g. "may cause drowsiness" or "avoid exposure of skin to direct sunlight or sunlamps"). 429 */ 430 @Child(name = "additionalInstruction", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 431 @Description(shortDefinition="Supplemental instruction or warnings to the patient - e.g. \"with meals\", \"may cause drowsiness\"", formalDefinition="Supplemental instructions to the patient on how to take the medication (e.g. \"with meals\" or\"take half to one hour before food\") or warnings for the patient about the medication (e.g. \"may cause drowsiness\" or \"avoid exposure of skin to direct sunlight or sunlamps\")." ) 432 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/additional-instruction-codes") 433 protected List<CodeableConcept> additionalInstruction; 434 435 /** 436 * Instructions in terms that are understood by the patient or consumer. 437 */ 438 @Child(name = "patientInstruction", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 439 @Description(shortDefinition="Patient or consumer oriented instructions", formalDefinition="Instructions in terms that are understood by the patient or consumer." ) 440 protected StringType patientInstruction; 441 442 /** 443 * When medication should be administered. 444 */ 445 @Child(name = "timing", type = {Timing.class}, order=4, min=0, max=1, modifier=false, summary=true) 446 @Description(shortDefinition="When medication should be administered", formalDefinition="When medication should be administered." ) 447 protected Timing timing; 448 449 /** 450 * Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 451 */ 452 @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true) 453 @Description(shortDefinition="Take \"as needed\" (for x)", formalDefinition="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept)." ) 454 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-as-needed-reason") 455 protected DataType asNeeded; 456 457 /** 458 * Body site to administer to. 459 */ 460 @Child(name = "site", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 461 @Description(shortDefinition="Body site to administer to", formalDefinition="Body site to administer to." ) 462 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/approach-site-codes") 463 protected CodeableConcept site; 464 465 /** 466 * How drug should enter body. 467 */ 468 @Child(name = "route", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true) 469 @Description(shortDefinition="How drug should enter body", formalDefinition="How drug should enter body." ) 470 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/route-codes") 471 protected CodeableConcept route; 472 473 /** 474 * Technique for administering medication. 475 */ 476 @Child(name = "method", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true) 477 @Description(shortDefinition="Technique for administering medication", formalDefinition="Technique for administering medication." ) 478 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/administration-method-codes") 479 protected CodeableConcept method; 480 481 /** 482 * The amount of medication administered. 483 */ 484 @Child(name = "doseAndRate", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 485 @Description(shortDefinition="Amount of medication administered", formalDefinition="The amount of medication administered." ) 486 protected List<DosageDoseAndRateComponent> doseAndRate; 487 488 /** 489 * Upper limit on medication per unit of time. 490 */ 491 @Child(name = "maxDosePerPeriod", type = {Ratio.class}, order=10, min=0, max=1, modifier=false, summary=true) 492 @Description(shortDefinition="Upper limit on medication per unit of time", formalDefinition="Upper limit on medication per unit of time." ) 493 protected Ratio maxDosePerPeriod; 494 495 /** 496 * Upper limit on medication per administration. 497 */ 498 @Child(name = "maxDosePerAdministration", type = {Quantity.class}, order=11, min=0, max=1, modifier=false, summary=true) 499 @Description(shortDefinition="Upper limit on medication per administration", formalDefinition="Upper limit on medication per administration." ) 500 protected Quantity maxDosePerAdministration; 501 502 /** 503 * Upper limit on medication per lifetime of the patient. 504 */ 505 @Child(name = "maxDosePerLifetime", type = {Quantity.class}, order=12, min=0, max=1, modifier=false, summary=true) 506 @Description(shortDefinition="Upper limit on medication per lifetime of the patient", formalDefinition="Upper limit on medication per lifetime of the patient." ) 507 protected Quantity maxDosePerLifetime; 508 509 private static final long serialVersionUID = 1743553833L; 510 511 /** 512 * Constructor 513 */ 514 public Dosage() { 515 super(); 516 } 517 518 /** 519 * @return {@link #sequence} (Indicates the order in which the dosage instructions should be applied or interpreted.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value 520 */ 521 public IntegerType getSequenceElement() { 522 if (this.sequence == null) 523 if (Configuration.errorOnAutoCreate()) 524 throw new Error("Attempt to auto-create Dosage.sequence"); 525 else if (Configuration.doAutoCreate()) 526 this.sequence = new IntegerType(); // bb 527 return this.sequence; 528 } 529 530 public boolean hasSequenceElement() { 531 return this.sequence != null && !this.sequence.isEmpty(); 532 } 533 534 public boolean hasSequence() { 535 return this.sequence != null && !this.sequence.isEmpty(); 536 } 537 538 /** 539 * @param value {@link #sequence} (Indicates the order in which the dosage instructions should be applied or interpreted.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value 540 */ 541 public Dosage setSequenceElement(IntegerType value) { 542 this.sequence = value; 543 return this; 544 } 545 546 /** 547 * @return Indicates the order in which the dosage instructions should be applied or interpreted. 548 */ 549 public int getSequence() { 550 return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue(); 551 } 552 553 /** 554 * @param value Indicates the order in which the dosage instructions should be applied or interpreted. 555 */ 556 public Dosage setSequence(int value) { 557 if (this.sequence == null) 558 this.sequence = new IntegerType(); 559 this.sequence.setValue(value); 560 return this; 561 } 562 563 /** 564 * @return {@link #text} (Free text dosage instructions e.g. SIG.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 565 */ 566 public StringType getTextElement() { 567 if (this.text == null) 568 if (Configuration.errorOnAutoCreate()) 569 throw new Error("Attempt to auto-create Dosage.text"); 570 else if (Configuration.doAutoCreate()) 571 this.text = new StringType(); // bb 572 return this.text; 573 } 574 575 public boolean hasTextElement() { 576 return this.text != null && !this.text.isEmpty(); 577 } 578 579 public boolean hasText() { 580 return this.text != null && !this.text.isEmpty(); 581 } 582 583 /** 584 * @param value {@link #text} (Free text dosage instructions e.g. SIG.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 585 */ 586 public Dosage setTextElement(StringType value) { 587 this.text = value; 588 return this; 589 } 590 591 /** 592 * @return Free text dosage instructions e.g. SIG. 593 */ 594 public String getText() { 595 return this.text == null ? null : this.text.getValue(); 596 } 597 598 /** 599 * @param value Free text dosage instructions e.g. SIG. 600 */ 601 public Dosage setText(String value) { 602 if (Utilities.noString(value)) 603 this.text = null; 604 else { 605 if (this.text == null) 606 this.text = new StringType(); 607 this.text.setValue(value); 608 } 609 return this; 610 } 611 612 /** 613 * @return {@link #additionalInstruction} (Supplemental instructions to the patient on how to take the medication (e.g. "with meals" or"take half to one hour before food") or warnings for the patient about the medication (e.g. "may cause drowsiness" or "avoid exposure of skin to direct sunlight or sunlamps").) 614 */ 615 public List<CodeableConcept> getAdditionalInstruction() { 616 if (this.additionalInstruction == null) 617 this.additionalInstruction = new ArrayList<CodeableConcept>(); 618 return this.additionalInstruction; 619 } 620 621 /** 622 * @return Returns a reference to <code>this</code> for easy method chaining 623 */ 624 public Dosage setAdditionalInstruction(List<CodeableConcept> theAdditionalInstruction) { 625 this.additionalInstruction = theAdditionalInstruction; 626 return this; 627 } 628 629 public boolean hasAdditionalInstruction() { 630 if (this.additionalInstruction == null) 631 return false; 632 for (CodeableConcept item : this.additionalInstruction) 633 if (!item.isEmpty()) 634 return true; 635 return false; 636 } 637 638 public CodeableConcept addAdditionalInstruction() { //3 639 CodeableConcept t = new CodeableConcept(); 640 if (this.additionalInstruction == null) 641 this.additionalInstruction = new ArrayList<CodeableConcept>(); 642 this.additionalInstruction.add(t); 643 return t; 644 } 645 646 public Dosage addAdditionalInstruction(CodeableConcept t) { //3 647 if (t == null) 648 return this; 649 if (this.additionalInstruction == null) 650 this.additionalInstruction = new ArrayList<CodeableConcept>(); 651 this.additionalInstruction.add(t); 652 return this; 653 } 654 655 /** 656 * @return The first repetition of repeating field {@link #additionalInstruction}, creating it if it does not already exist {3} 657 */ 658 public CodeableConcept getAdditionalInstructionFirstRep() { 659 if (getAdditionalInstruction().isEmpty()) { 660 addAdditionalInstruction(); 661 } 662 return getAdditionalInstruction().get(0); 663 } 664 665 /** 666 * @return {@link #patientInstruction} (Instructions in terms that are understood by the patient or consumer.). This is the underlying object with id, value and extensions. The accessor "getPatientInstruction" gives direct access to the value 667 */ 668 public StringType getPatientInstructionElement() { 669 if (this.patientInstruction == null) 670 if (Configuration.errorOnAutoCreate()) 671 throw new Error("Attempt to auto-create Dosage.patientInstruction"); 672 else if (Configuration.doAutoCreate()) 673 this.patientInstruction = new StringType(); // bb 674 return this.patientInstruction; 675 } 676 677 public boolean hasPatientInstructionElement() { 678 return this.patientInstruction != null && !this.patientInstruction.isEmpty(); 679 } 680 681 public boolean hasPatientInstruction() { 682 return this.patientInstruction != null && !this.patientInstruction.isEmpty(); 683 } 684 685 /** 686 * @param value {@link #patientInstruction} (Instructions in terms that are understood by the patient or consumer.). This is the underlying object with id, value and extensions. The accessor "getPatientInstruction" gives direct access to the value 687 */ 688 public Dosage setPatientInstructionElement(StringType value) { 689 this.patientInstruction = value; 690 return this; 691 } 692 693 /** 694 * @return Instructions in terms that are understood by the patient or consumer. 695 */ 696 public String getPatientInstruction() { 697 return this.patientInstruction == null ? null : this.patientInstruction.getValue(); 698 } 699 700 /** 701 * @param value Instructions in terms that are understood by the patient or consumer. 702 */ 703 public Dosage setPatientInstruction(String value) { 704 if (Utilities.noString(value)) 705 this.patientInstruction = null; 706 else { 707 if (this.patientInstruction == null) 708 this.patientInstruction = new StringType(); 709 this.patientInstruction.setValue(value); 710 } 711 return this; 712 } 713 714 /** 715 * @return {@link #timing} (When medication should be administered.) 716 */ 717 public Timing getTiming() { 718 if (this.timing == null) 719 if (Configuration.errorOnAutoCreate()) 720 throw new Error("Attempt to auto-create Dosage.timing"); 721 else if (Configuration.doAutoCreate()) 722 this.timing = new Timing(); // cc 723 return this.timing; 724 } 725 726 public boolean hasTiming() { 727 return this.timing != null && !this.timing.isEmpty(); 728 } 729 730 /** 731 * @param value {@link #timing} (When medication should be administered.) 732 */ 733 public Dosage setTiming(Timing value) { 734 this.timing = value; 735 return this; 736 } 737 738 /** 739 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).) 740 */ 741 public DataType getAsNeeded() { 742 return this.asNeeded; 743 } 744 745 /** 746 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).) 747 */ 748 public BooleanType getAsNeededBooleanType() throws FHIRException { 749 if (this.asNeeded == null) 750 this.asNeeded = new BooleanType(); 751 if (!(this.asNeeded instanceof BooleanType)) 752 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 753 return (BooleanType) this.asNeeded; 754 } 755 756 public boolean hasAsNeededBooleanType() { 757 return this != null && this.asNeeded instanceof BooleanType; 758 } 759 760 /** 761 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).) 762 */ 763 public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 764 if (this.asNeeded == null) 765 this.asNeeded = new CodeableConcept(); 766 if (!(this.asNeeded instanceof CodeableConcept)) 767 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 768 return (CodeableConcept) this.asNeeded; 769 } 770 771 public boolean hasAsNeededCodeableConcept() { 772 return this != null && this.asNeeded instanceof CodeableConcept; 773 } 774 775 public boolean hasAsNeeded() { 776 return this.asNeeded != null && !this.asNeeded.isEmpty(); 777 } 778 779 /** 780 * @param value {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).) 781 */ 782 public Dosage setAsNeeded(DataType value) { 783 if (value != null && !(value instanceof BooleanType || value instanceof CodeableConcept)) 784 throw new Error("Not the right type for Dosage.asNeeded[x]: "+value.fhirType()); 785 this.asNeeded = value; 786 return this; 787 } 788 789 /** 790 * @return {@link #site} (Body site to administer to.) 791 */ 792 public CodeableConcept getSite() { 793 if (this.site == null) 794 if (Configuration.errorOnAutoCreate()) 795 throw new Error("Attempt to auto-create Dosage.site"); 796 else if (Configuration.doAutoCreate()) 797 this.site = new CodeableConcept(); // cc 798 return this.site; 799 } 800 801 public boolean hasSite() { 802 return this.site != null && !this.site.isEmpty(); 803 } 804 805 /** 806 * @param value {@link #site} (Body site to administer to.) 807 */ 808 public Dosage setSite(CodeableConcept value) { 809 this.site = value; 810 return this; 811 } 812 813 /** 814 * @return {@link #route} (How drug should enter body.) 815 */ 816 public CodeableConcept getRoute() { 817 if (this.route == null) 818 if (Configuration.errorOnAutoCreate()) 819 throw new Error("Attempt to auto-create Dosage.route"); 820 else if (Configuration.doAutoCreate()) 821 this.route = new CodeableConcept(); // cc 822 return this.route; 823 } 824 825 public boolean hasRoute() { 826 return this.route != null && !this.route.isEmpty(); 827 } 828 829 /** 830 * @param value {@link #route} (How drug should enter body.) 831 */ 832 public Dosage setRoute(CodeableConcept value) { 833 this.route = value; 834 return this; 835 } 836 837 /** 838 * @return {@link #method} (Technique for administering medication.) 839 */ 840 public CodeableConcept getMethod() { 841 if (this.method == null) 842 if (Configuration.errorOnAutoCreate()) 843 throw new Error("Attempt to auto-create Dosage.method"); 844 else if (Configuration.doAutoCreate()) 845 this.method = new CodeableConcept(); // cc 846 return this.method; 847 } 848 849 public boolean hasMethod() { 850 return this.method != null && !this.method.isEmpty(); 851 } 852 853 /** 854 * @param value {@link #method} (Technique for administering medication.) 855 */ 856 public Dosage setMethod(CodeableConcept value) { 857 this.method = value; 858 return this; 859 } 860 861 /** 862 * @return {@link #doseAndRate} (The amount of medication administered.) 863 */ 864 public List<DosageDoseAndRateComponent> getDoseAndRate() { 865 if (this.doseAndRate == null) 866 this.doseAndRate = new ArrayList<DosageDoseAndRateComponent>(); 867 return this.doseAndRate; 868 } 869 870 /** 871 * @return Returns a reference to <code>this</code> for easy method chaining 872 */ 873 public Dosage setDoseAndRate(List<DosageDoseAndRateComponent> theDoseAndRate) { 874 this.doseAndRate = theDoseAndRate; 875 return this; 876 } 877 878 public boolean hasDoseAndRate() { 879 if (this.doseAndRate == null) 880 return false; 881 for (DosageDoseAndRateComponent item : this.doseAndRate) 882 if (!item.isEmpty()) 883 return true; 884 return false; 885 } 886 887 public DosageDoseAndRateComponent addDoseAndRate() { //3 888 DosageDoseAndRateComponent t = new DosageDoseAndRateComponent(); 889 if (this.doseAndRate == null) 890 this.doseAndRate = new ArrayList<DosageDoseAndRateComponent>(); 891 this.doseAndRate.add(t); 892 return t; 893 } 894 895 public Dosage addDoseAndRate(DosageDoseAndRateComponent t) { //3 896 if (t == null) 897 return this; 898 if (this.doseAndRate == null) 899 this.doseAndRate = new ArrayList<DosageDoseAndRateComponent>(); 900 this.doseAndRate.add(t); 901 return this; 902 } 903 904 /** 905 * @return The first repetition of repeating field {@link #doseAndRate}, creating it if it does not already exist {3} 906 */ 907 public DosageDoseAndRateComponent getDoseAndRateFirstRep() { 908 if (getDoseAndRate().isEmpty()) { 909 addDoseAndRate(); 910 } 911 return getDoseAndRate().get(0); 912 } 913 914 /** 915 * @return {@link #maxDosePerPeriod} (Upper limit on medication per unit of time.) 916 */ 917 public Ratio getMaxDosePerPeriod() { 918 if (this.maxDosePerPeriod == null) 919 if (Configuration.errorOnAutoCreate()) 920 throw new Error("Attempt to auto-create Dosage.maxDosePerPeriod"); 921 else if (Configuration.doAutoCreate()) 922 this.maxDosePerPeriod = new Ratio(); // cc 923 return this.maxDosePerPeriod; 924 } 925 926 public boolean hasMaxDosePerPeriod() { 927 return this.maxDosePerPeriod != null && !this.maxDosePerPeriod.isEmpty(); 928 } 929 930 /** 931 * @param value {@link #maxDosePerPeriod} (Upper limit on medication per unit of time.) 932 */ 933 public Dosage setMaxDosePerPeriod(Ratio value) { 934 this.maxDosePerPeriod = value; 935 return this; 936 } 937 938 /** 939 * @return {@link #maxDosePerAdministration} (Upper limit on medication per administration.) 940 */ 941 public Quantity getMaxDosePerAdministration() { 942 if (this.maxDosePerAdministration == null) 943 if (Configuration.errorOnAutoCreate()) 944 throw new Error("Attempt to auto-create Dosage.maxDosePerAdministration"); 945 else if (Configuration.doAutoCreate()) 946 this.maxDosePerAdministration = new Quantity(); // cc 947 return this.maxDosePerAdministration; 948 } 949 950 public boolean hasMaxDosePerAdministration() { 951 return this.maxDosePerAdministration != null && !this.maxDosePerAdministration.isEmpty(); 952 } 953 954 /** 955 * @param value {@link #maxDosePerAdministration} (Upper limit on medication per administration.) 956 */ 957 public Dosage setMaxDosePerAdministration(Quantity value) { 958 this.maxDosePerAdministration = value; 959 return this; 960 } 961 962 /** 963 * @return {@link #maxDosePerLifetime} (Upper limit on medication per lifetime of the patient.) 964 */ 965 public Quantity getMaxDosePerLifetime() { 966 if (this.maxDosePerLifetime == null) 967 if (Configuration.errorOnAutoCreate()) 968 throw new Error("Attempt to auto-create Dosage.maxDosePerLifetime"); 969 else if (Configuration.doAutoCreate()) 970 this.maxDosePerLifetime = new Quantity(); // cc 971 return this.maxDosePerLifetime; 972 } 973 974 public boolean hasMaxDosePerLifetime() { 975 return this.maxDosePerLifetime != null && !this.maxDosePerLifetime.isEmpty(); 976 } 977 978 /** 979 * @param value {@link #maxDosePerLifetime} (Upper limit on medication per lifetime of the patient.) 980 */ 981 public Dosage setMaxDosePerLifetime(Quantity value) { 982 this.maxDosePerLifetime = value; 983 return this; 984 } 985 986 protected void listChildren(List<Property> children) { 987 super.listChildren(children); 988 children.add(new Property("sequence", "integer", "Indicates the order in which the dosage instructions should be applied or interpreted.", 0, 1, sequence)); 989 children.add(new Property("text", "string", "Free text dosage instructions e.g. SIG.", 0, 1, text)); 990 children.add(new Property("additionalInstruction", "CodeableConcept", "Supplemental instructions to the patient on how to take the medication (e.g. \"with meals\" or\"take half to one hour before food\") or warnings for the patient about the medication (e.g. \"may cause drowsiness\" or \"avoid exposure of skin to direct sunlight or sunlamps\").", 0, java.lang.Integer.MAX_VALUE, additionalInstruction)); 991 children.add(new Property("patientInstruction", "string", "Instructions in terms that are understood by the patient or consumer.", 0, 1, patientInstruction)); 992 children.add(new Property("timing", "Timing", "When medication should be administered.", 0, 1, timing)); 993 children.add(new Property("asNeeded[x]", "boolean|CodeableConcept", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", 0, 1, asNeeded)); 994 children.add(new Property("site", "CodeableConcept", "Body site to administer to.", 0, 1, site)); 995 children.add(new Property("route", "CodeableConcept", "How drug should enter body.", 0, 1, route)); 996 children.add(new Property("method", "CodeableConcept", "Technique for administering medication.", 0, 1, method)); 997 children.add(new Property("doseAndRate", "", "The amount of medication administered.", 0, java.lang.Integer.MAX_VALUE, doseAndRate)); 998 children.add(new Property("maxDosePerPeriod", "Ratio", "Upper limit on medication per unit of time.", 0, 1, maxDosePerPeriod)); 999 children.add(new Property("maxDosePerAdministration", "Quantity", "Upper limit on medication per administration.", 0, 1, maxDosePerAdministration)); 1000 children.add(new Property("maxDosePerLifetime", "Quantity", "Upper limit on medication per lifetime of the patient.", 0, 1, maxDosePerLifetime)); 1001 } 1002 1003 @Override 1004 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1005 switch (_hash) { 1006 case 1349547969: /*sequence*/ return new Property("sequence", "integer", "Indicates the order in which the dosage instructions should be applied or interpreted.", 0, 1, sequence); 1007 case 3556653: /*text*/ return new Property("text", "string", "Free text dosage instructions e.g. SIG.", 0, 1, text); 1008 case 1623641575: /*additionalInstruction*/ return new Property("additionalInstruction", "CodeableConcept", "Supplemental instructions to the patient on how to take the medication (e.g. \"with meals\" or\"take half to one hour before food\") or warnings for the patient about the medication (e.g. \"may cause drowsiness\" or \"avoid exposure of skin to direct sunlight or sunlamps\").", 0, java.lang.Integer.MAX_VALUE, additionalInstruction); 1009 case 737543241: /*patientInstruction*/ return new Property("patientInstruction", "string", "Instructions in terms that are understood by the patient or consumer.", 0, 1, patientInstruction); 1010 case -873664438: /*timing*/ return new Property("timing", "Timing", "When medication should be administered.", 0, 1, timing); 1011 case -544329575: /*asNeeded[x]*/ return new Property("asNeeded[x]", "boolean|CodeableConcept", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", 0, 1, asNeeded); 1012 case -1432923513: /*asNeeded*/ return new Property("asNeeded[x]", "boolean|CodeableConcept", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", 0, 1, asNeeded); 1013 case -591717471: /*asNeededBoolean*/ return new Property("asNeeded[x]", "boolean", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", 0, 1, asNeeded); 1014 case 1556420122: /*asNeededCodeableConcept*/ return new Property("asNeeded[x]", "CodeableConcept", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", 0, 1, asNeeded); 1015 case 3530567: /*site*/ return new Property("site", "CodeableConcept", "Body site to administer to.", 0, 1, site); 1016 case 108704329: /*route*/ return new Property("route", "CodeableConcept", "How drug should enter body.", 0, 1, route); 1017 case -1077554975: /*method*/ return new Property("method", "CodeableConcept", "Technique for administering medication.", 0, 1, method); 1018 case -611024774: /*doseAndRate*/ return new Property("doseAndRate", "", "The amount of medication administered.", 0, java.lang.Integer.MAX_VALUE, doseAndRate); 1019 case 1506263709: /*maxDosePerPeriod*/ return new Property("maxDosePerPeriod", "Ratio", "Upper limit on medication per unit of time.", 0, 1, maxDosePerPeriod); 1020 case 2004889914: /*maxDosePerAdministration*/ return new Property("maxDosePerAdministration", "Quantity", "Upper limit on medication per administration.", 0, 1, maxDosePerAdministration); 1021 case 642099621: /*maxDosePerLifetime*/ return new Property("maxDosePerLifetime", "Quantity", "Upper limit on medication per lifetime of the patient.", 0, 1, maxDosePerLifetime); 1022 default: return super.getNamedProperty(_hash, _name, _checkValid); 1023 } 1024 1025 } 1026 1027 @Override 1028 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1029 switch (hash) { 1030 case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // IntegerType 1031 case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType 1032 case 1623641575: /*additionalInstruction*/ return this.additionalInstruction == null ? new Base[0] : this.additionalInstruction.toArray(new Base[this.additionalInstruction.size()]); // CodeableConcept 1033 case 737543241: /*patientInstruction*/ return this.patientInstruction == null ? new Base[0] : new Base[] {this.patientInstruction}; // StringType 1034 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Timing 1035 case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // DataType 1036 case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // CodeableConcept 1037 case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept 1038 case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept 1039 case -611024774: /*doseAndRate*/ return this.doseAndRate == null ? new Base[0] : this.doseAndRate.toArray(new Base[this.doseAndRate.size()]); // DosageDoseAndRateComponent 1040 case 1506263709: /*maxDosePerPeriod*/ return this.maxDosePerPeriod == null ? new Base[0] : new Base[] {this.maxDosePerPeriod}; // Ratio 1041 case 2004889914: /*maxDosePerAdministration*/ return this.maxDosePerAdministration == null ? new Base[0] : new Base[] {this.maxDosePerAdministration}; // Quantity 1042 case 642099621: /*maxDosePerLifetime*/ return this.maxDosePerLifetime == null ? new Base[0] : new Base[] {this.maxDosePerLifetime}; // Quantity 1043 default: return super.getProperty(hash, name, checkValid); 1044 } 1045 1046 } 1047 1048 @Override 1049 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1050 switch (hash) { 1051 case 1349547969: // sequence 1052 this.sequence = TypeConvertor.castToInteger(value); // IntegerType 1053 return value; 1054 case 3556653: // text 1055 this.text = TypeConvertor.castToString(value); // StringType 1056 return value; 1057 case 1623641575: // additionalInstruction 1058 this.getAdditionalInstruction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept 1059 return value; 1060 case 737543241: // patientInstruction 1061 this.patientInstruction = TypeConvertor.castToString(value); // StringType 1062 return value; 1063 case -873664438: // timing 1064 this.timing = TypeConvertor.castToTiming(value); // Timing 1065 return value; 1066 case -1432923513: // asNeeded 1067 this.asNeeded = TypeConvertor.castToType(value); // DataType 1068 return value; 1069 case 3530567: // site 1070 this.site = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1071 return value; 1072 case 108704329: // route 1073 this.route = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1074 return value; 1075 case -1077554975: // method 1076 this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1077 return value; 1078 case -611024774: // doseAndRate 1079 this.getDoseAndRate().add((DosageDoseAndRateComponent) value); // DosageDoseAndRateComponent 1080 return value; 1081 case 1506263709: // maxDosePerPeriod 1082 this.maxDosePerPeriod = TypeConvertor.castToRatio(value); // Ratio 1083 return value; 1084 case 2004889914: // maxDosePerAdministration 1085 this.maxDosePerAdministration = TypeConvertor.castToQuantity(value); // Quantity 1086 return value; 1087 case 642099621: // maxDosePerLifetime 1088 this.maxDosePerLifetime = TypeConvertor.castToQuantity(value); // Quantity 1089 return value; 1090 default: return super.setProperty(hash, name, value); 1091 } 1092 1093 } 1094 1095 @Override 1096 public Base setProperty(String name, Base value) throws FHIRException { 1097 if (name.equals("sequence")) { 1098 this.sequence = TypeConvertor.castToInteger(value); // IntegerType 1099 } else if (name.equals("text")) { 1100 this.text = TypeConvertor.castToString(value); // StringType 1101 } else if (name.equals("additionalInstruction")) { 1102 this.getAdditionalInstruction().add(TypeConvertor.castToCodeableConcept(value)); 1103 } else if (name.equals("patientInstruction")) { 1104 this.patientInstruction = TypeConvertor.castToString(value); // StringType 1105 } else if (name.equals("timing")) { 1106 this.timing = TypeConvertor.castToTiming(value); // Timing 1107 } else if (name.equals("asNeeded[x]")) { 1108 this.asNeeded = TypeConvertor.castToType(value); // DataType 1109 } else if (name.equals("site")) { 1110 this.site = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1111 } else if (name.equals("route")) { 1112 this.route = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1113 } else if (name.equals("method")) { 1114 this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1115 } else if (name.equals("doseAndRate")) { 1116 this.getDoseAndRate().add((DosageDoseAndRateComponent) value); 1117 } else if (name.equals("maxDosePerPeriod")) { 1118 this.maxDosePerPeriod = TypeConvertor.castToRatio(value); // Ratio 1119 } else if (name.equals("maxDosePerAdministration")) { 1120 this.maxDosePerAdministration = TypeConvertor.castToQuantity(value); // Quantity 1121 } else if (name.equals("maxDosePerLifetime")) { 1122 this.maxDosePerLifetime = TypeConvertor.castToQuantity(value); // Quantity 1123 } else 1124 return super.setProperty(name, value); 1125 return value; 1126 } 1127 1128 @Override 1129 public Base makeProperty(int hash, String name) throws FHIRException { 1130 switch (hash) { 1131 case 1349547969: return getSequenceElement(); 1132 case 3556653: return getTextElement(); 1133 case 1623641575: return addAdditionalInstruction(); 1134 case 737543241: return getPatientInstructionElement(); 1135 case -873664438: return getTiming(); 1136 case -544329575: return getAsNeeded(); 1137 case -1432923513: return getAsNeeded(); 1138 case 3530567: return getSite(); 1139 case 108704329: return getRoute(); 1140 case -1077554975: return getMethod(); 1141 case -611024774: return addDoseAndRate(); 1142 case 1506263709: return getMaxDosePerPeriod(); 1143 case 2004889914: return getMaxDosePerAdministration(); 1144 case 642099621: return getMaxDosePerLifetime(); 1145 default: return super.makeProperty(hash, name); 1146 } 1147 1148 } 1149 1150 @Override 1151 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1152 switch (hash) { 1153 case 1349547969: /*sequence*/ return new String[] {"integer"}; 1154 case 3556653: /*text*/ return new String[] {"string"}; 1155 case 1623641575: /*additionalInstruction*/ return new String[] {"CodeableConcept"}; 1156 case 737543241: /*patientInstruction*/ return new String[] {"string"}; 1157 case -873664438: /*timing*/ return new String[] {"Timing"}; 1158 case -1432923513: /*asNeeded*/ return new String[] {"boolean", "CodeableConcept"}; 1159 case 3530567: /*site*/ return new String[] {"CodeableConcept"}; 1160 case 108704329: /*route*/ return new String[] {"CodeableConcept"}; 1161 case -1077554975: /*method*/ return new String[] {"CodeableConcept"}; 1162 case -611024774: /*doseAndRate*/ return new String[] {}; 1163 case 1506263709: /*maxDosePerPeriod*/ return new String[] {"Ratio"}; 1164 case 2004889914: /*maxDosePerAdministration*/ return new String[] {"Quantity"}; 1165 case 642099621: /*maxDosePerLifetime*/ return new String[] {"Quantity"}; 1166 default: return super.getTypesForProperty(hash, name); 1167 } 1168 1169 } 1170 1171 @Override 1172 public Base addChild(String name) throws FHIRException { 1173 if (name.equals("sequence")) { 1174 throw new FHIRException("Cannot call addChild on a primitive type Dosage.sequence"); 1175 } 1176 else if (name.equals("text")) { 1177 throw new FHIRException("Cannot call addChild on a primitive type Dosage.text"); 1178 } 1179 else if (name.equals("additionalInstruction")) { 1180 return addAdditionalInstruction(); 1181 } 1182 else if (name.equals("patientInstruction")) { 1183 throw new FHIRException("Cannot call addChild on a primitive type Dosage.patientInstruction"); 1184 } 1185 else if (name.equals("timing")) { 1186 this.timing = new Timing(); 1187 return this.timing; 1188 } 1189 else if (name.equals("asNeededBoolean")) { 1190 this.asNeeded = new BooleanType(); 1191 return this.asNeeded; 1192 } 1193 else if (name.equals("asNeededCodeableConcept")) { 1194 this.asNeeded = new CodeableConcept(); 1195 return this.asNeeded; 1196 } 1197 else if (name.equals("site")) { 1198 this.site = new CodeableConcept(); 1199 return this.site; 1200 } 1201 else if (name.equals("route")) { 1202 this.route = new CodeableConcept(); 1203 return this.route; 1204 } 1205 else if (name.equals("method")) { 1206 this.method = new CodeableConcept(); 1207 return this.method; 1208 } 1209 else if (name.equals("doseAndRate")) { 1210 return addDoseAndRate(); 1211 } 1212 else if (name.equals("maxDosePerPeriod")) { 1213 this.maxDosePerPeriod = new Ratio(); 1214 return this.maxDosePerPeriod; 1215 } 1216 else if (name.equals("maxDosePerAdministration")) { 1217 this.maxDosePerAdministration = new Quantity(); 1218 return this.maxDosePerAdministration; 1219 } 1220 else if (name.equals("maxDosePerLifetime")) { 1221 this.maxDosePerLifetime = new Quantity(); 1222 return this.maxDosePerLifetime; 1223 } 1224 else 1225 return super.addChild(name); 1226 } 1227 1228 public String fhirType() { 1229 return "Dosage"; 1230 1231 } 1232 1233 public Dosage copy() { 1234 Dosage dst = new Dosage(); 1235 copyValues(dst); 1236 return dst; 1237 } 1238 1239 public void copyValues(Dosage dst) { 1240 super.copyValues(dst); 1241 dst.sequence = sequence == null ? null : sequence.copy(); 1242 dst.text = text == null ? null : text.copy(); 1243 if (additionalInstruction != null) { 1244 dst.additionalInstruction = new ArrayList<CodeableConcept>(); 1245 for (CodeableConcept i : additionalInstruction) 1246 dst.additionalInstruction.add(i.copy()); 1247 }; 1248 dst.patientInstruction = patientInstruction == null ? null : patientInstruction.copy(); 1249 dst.timing = timing == null ? null : timing.copy(); 1250 dst.asNeeded = asNeeded == null ? null : asNeeded.copy(); 1251 dst.site = site == null ? null : site.copy(); 1252 dst.route = route == null ? null : route.copy(); 1253 dst.method = method == null ? null : method.copy(); 1254 if (doseAndRate != null) { 1255 dst.doseAndRate = new ArrayList<DosageDoseAndRateComponent>(); 1256 for (DosageDoseAndRateComponent i : doseAndRate) 1257 dst.doseAndRate.add(i.copy()); 1258 }; 1259 dst.maxDosePerPeriod = maxDosePerPeriod == null ? null : maxDosePerPeriod.copy(); 1260 dst.maxDosePerAdministration = maxDosePerAdministration == null ? null : maxDosePerAdministration.copy(); 1261 dst.maxDosePerLifetime = maxDosePerLifetime == null ? null : maxDosePerLifetime.copy(); 1262 } 1263 1264 protected Dosage typedCopy() { 1265 return copy(); 1266 } 1267 1268 @Override 1269 public boolean equalsDeep(Base other_) { 1270 if (!super.equalsDeep(other_)) 1271 return false; 1272 if (!(other_ instanceof Dosage)) 1273 return false; 1274 Dosage o = (Dosage) other_; 1275 return compareDeep(sequence, o.sequence, true) && compareDeep(text, o.text, true) && compareDeep(additionalInstruction, o.additionalInstruction, true) 1276 && compareDeep(patientInstruction, o.patientInstruction, true) && compareDeep(timing, o.timing, true) 1277 && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(site, o.site, true) && compareDeep(route, o.route, true) 1278 && compareDeep(method, o.method, true) && compareDeep(doseAndRate, o.doseAndRate, true) && compareDeep(maxDosePerPeriod, o.maxDosePerPeriod, true) 1279 && compareDeep(maxDosePerAdministration, o.maxDosePerAdministration, true) && compareDeep(maxDosePerLifetime, o.maxDosePerLifetime, true) 1280 ; 1281 } 1282 1283 @Override 1284 public boolean equalsShallow(Base other_) { 1285 if (!super.equalsShallow(other_)) 1286 return false; 1287 if (!(other_ instanceof Dosage)) 1288 return false; 1289 Dosage o = (Dosage) other_; 1290 return compareValues(sequence, o.sequence, true) && compareValues(text, o.text, true) && compareValues(patientInstruction, o.patientInstruction, true) 1291 ; 1292 } 1293 1294 public boolean isEmpty() { 1295 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, text, additionalInstruction 1296 , patientInstruction, timing, asNeeded, site, route, method, doseAndRate, maxDosePerPeriod 1297 , maxDosePerAdministration, maxDosePerLifetime); 1298 } 1299 1300 1301} 1302