001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0 033 034import java.util.*; 035 036import ca.uhn.fhir.model.api.annotation.ResourceDef; 037import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 038import ca.uhn.fhir.model.api.annotation.Child; 039import ca.uhn.fhir.model.api.annotation.ChildOrder; 040import ca.uhn.fhir.model.api.annotation.Description; 041import ca.uhn.fhir.model.api.annotation.Block; 042import org.hl7.fhir.instance.model.api.*; 043import org.hl7.fhir.exceptions.FHIRException; 044/** 045 * Indication for the Medicinal Product. 046 */ 047@ResourceDef(name="MedicinalProductIndication", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication") 048public class MedicinalProductIndication extends DomainResource { 049 050 @Block() 051 public static class MedicinalProductIndicationOtherTherapyComponent extends BackboneElement implements IBaseBackboneElement { 052 /** 053 * The type of relationship between the medicinal product indication or contraindication and another therapy. 054 */ 055 @Child(name = "therapyRelationshipType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 056 @Description(shortDefinition="The type of relationship between the medicinal product indication or contraindication and another therapy", formalDefinition="The type of relationship between the medicinal product indication or contraindication and another therapy." ) 057 protected CodeableConcept therapyRelationshipType; 058 059 /** 060 * Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication. 061 */ 062 @Child(name = "medication", type = {CodeableConcept.class, MedicinalProduct.class, Medication.class, Substance.class, SubstanceSpecification.class}, order=2, min=1, max=1, modifier=false, summary=true) 063 @Description(shortDefinition="Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication", formalDefinition="Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication." ) 064 protected Type medication; 065 066 private static final long serialVersionUID = 1438478115L; 067 068 /** 069 * Constructor 070 */ 071 public MedicinalProductIndicationOtherTherapyComponent() { 072 super(); 073 } 074 075 /** 076 * Constructor 077 */ 078 public MedicinalProductIndicationOtherTherapyComponent(CodeableConcept therapyRelationshipType, Type medication) { 079 super(); 080 this.therapyRelationshipType = therapyRelationshipType; 081 this.medication = medication; 082 } 083 084 /** 085 * @return {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.) 086 */ 087 public CodeableConcept getTherapyRelationshipType() { 088 if (this.therapyRelationshipType == null) 089 if (Configuration.errorOnAutoCreate()) 090 throw new Error("Attempt to auto-create MedicinalProductIndicationOtherTherapyComponent.therapyRelationshipType"); 091 else if (Configuration.doAutoCreate()) 092 this.therapyRelationshipType = new CodeableConcept(); // cc 093 return this.therapyRelationshipType; 094 } 095 096 public boolean hasTherapyRelationshipType() { 097 return this.therapyRelationshipType != null && !this.therapyRelationshipType.isEmpty(); 098 } 099 100 /** 101 * @param value {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.) 102 */ 103 public MedicinalProductIndicationOtherTherapyComponent setTherapyRelationshipType(CodeableConcept value) { 104 this.therapyRelationshipType = value; 105 return this; 106 } 107 108 /** 109 * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.) 110 */ 111 public Type getMedication() { 112 return this.medication; 113 } 114 115 /** 116 * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.) 117 */ 118 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 119 if (this.medication == null) 120 this.medication = new CodeableConcept(); 121 if (!(this.medication instanceof CodeableConcept)) 122 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 123 return (CodeableConcept) this.medication; 124 } 125 126 public boolean hasMedicationCodeableConcept() { 127 return this != null && this.medication instanceof CodeableConcept; 128 } 129 130 /** 131 * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.) 132 */ 133 public Reference getMedicationReference() throws FHIRException { 134 if (this.medication == null) 135 this.medication = new Reference(); 136 if (!(this.medication instanceof Reference)) 137 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 138 return (Reference) this.medication; 139 } 140 141 public boolean hasMedicationReference() { 142 return this != null && this.medication instanceof Reference; 143 } 144 145 public boolean hasMedication() { 146 return this.medication != null && !this.medication.isEmpty(); 147 } 148 149 /** 150 * @param value {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.) 151 */ 152 public MedicinalProductIndicationOtherTherapyComponent setMedication(Type value) { 153 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 154 throw new Error("Not the right type for MedicinalProductIndication.otherTherapy.medication[x]: "+value.fhirType()); 155 this.medication = value; 156 return this; 157 } 158 159 protected void listChildren(List<Property> children) { 160 super.listChildren(children); 161 children.add(new Property("therapyRelationshipType", "CodeableConcept", "The type of relationship between the medicinal product indication or contraindication and another therapy.", 0, 1, therapyRelationshipType)); 162 children.add(new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication)); 163 } 164 165 @Override 166 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 167 switch (_hash) { 168 case -551658469: /*therapyRelationshipType*/ return new Property("therapyRelationshipType", "CodeableConcept", "The type of relationship between the medicinal product indication or contraindication and another therapy.", 0, 1, therapyRelationshipType); 169 case 1458402129: /*medication[x]*/ return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication); 170 case 1998965455: /*medication*/ return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication); 171 case -209845038: /*medicationCodeableConcept*/ return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication); 172 case 2104315196: /*medicationReference*/ return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication); 173 default: return super.getNamedProperty(_hash, _name, _checkValid); 174 } 175 176 } 177 178 @Override 179 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 180 switch (hash) { 181 case -551658469: /*therapyRelationshipType*/ return this.therapyRelationshipType == null ? new Base[0] : new Base[] {this.therapyRelationshipType}; // CodeableConcept 182 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 183 default: return super.getProperty(hash, name, checkValid); 184 } 185 186 } 187 188 @Override 189 public Base setProperty(int hash, String name, Base value) throws FHIRException { 190 switch (hash) { 191 case -551658469: // therapyRelationshipType 192 this.therapyRelationshipType = castToCodeableConcept(value); // CodeableConcept 193 return value; 194 case 1998965455: // medication 195 this.medication = castToType(value); // Type 196 return value; 197 default: return super.setProperty(hash, name, value); 198 } 199 200 } 201 202 @Override 203 public Base setProperty(String name, Base value) throws FHIRException { 204 if (name.equals("therapyRelationshipType")) { 205 this.therapyRelationshipType = castToCodeableConcept(value); // CodeableConcept 206 } else if (name.equals("medication[x]")) { 207 this.medication = castToType(value); // Type 208 } else 209 return super.setProperty(name, value); 210 return value; 211 } 212 213 @Override 214 public Base makeProperty(int hash, String name) throws FHIRException { 215 switch (hash) { 216 case -551658469: return getTherapyRelationshipType(); 217 case 1458402129: return getMedication(); 218 case 1998965455: return getMedication(); 219 default: return super.makeProperty(hash, name); 220 } 221 222 } 223 224 @Override 225 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 226 switch (hash) { 227 case -551658469: /*therapyRelationshipType*/ return new String[] {"CodeableConcept"}; 228 case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"}; 229 default: return super.getTypesForProperty(hash, name); 230 } 231 232 } 233 234 @Override 235 public Base addChild(String name) throws FHIRException { 236 if (name.equals("therapyRelationshipType")) { 237 this.therapyRelationshipType = new CodeableConcept(); 238 return this.therapyRelationshipType; 239 } 240 else if (name.equals("medicationCodeableConcept")) { 241 this.medication = new CodeableConcept(); 242 return this.medication; 243 } 244 else if (name.equals("medicationReference")) { 245 this.medication = new Reference(); 246 return this.medication; 247 } 248 else 249 return super.addChild(name); 250 } 251 252 public MedicinalProductIndicationOtherTherapyComponent copy() { 253 MedicinalProductIndicationOtherTherapyComponent dst = new MedicinalProductIndicationOtherTherapyComponent(); 254 copyValues(dst); 255 dst.therapyRelationshipType = therapyRelationshipType == null ? null : therapyRelationshipType.copy(); 256 dst.medication = medication == null ? null : medication.copy(); 257 return dst; 258 } 259 260 @Override 261 public boolean equalsDeep(Base other_) { 262 if (!super.equalsDeep(other_)) 263 return false; 264 if (!(other_ instanceof MedicinalProductIndicationOtherTherapyComponent)) 265 return false; 266 MedicinalProductIndicationOtherTherapyComponent o = (MedicinalProductIndicationOtherTherapyComponent) other_; 267 return compareDeep(therapyRelationshipType, o.therapyRelationshipType, true) && compareDeep(medication, o.medication, true) 268 ; 269 } 270 271 @Override 272 public boolean equalsShallow(Base other_) { 273 if (!super.equalsShallow(other_)) 274 return false; 275 if (!(other_ instanceof MedicinalProductIndicationOtherTherapyComponent)) 276 return false; 277 MedicinalProductIndicationOtherTherapyComponent o = (MedicinalProductIndicationOtherTherapyComponent) other_; 278 return true; 279 } 280 281 public boolean isEmpty() { 282 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(therapyRelationshipType, medication 283 ); 284 } 285 286 public String fhirType() { 287 return "MedicinalProductIndication.otherTherapy"; 288 289 } 290 291 } 292 293 /** 294 * The medication for which this is an indication. 295 */ 296 @Child(name = "subject", type = {MedicinalProduct.class, Medication.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 297 @Description(shortDefinition="The medication for which this is an indication", formalDefinition="The medication for which this is an indication." ) 298 protected List<Reference> subject; 299 /** 300 * The actual objects that are the target of the reference (The medication for which this is an indication.) 301 */ 302 protected List<Resource> subjectTarget; 303 304 305 /** 306 * The disease, symptom or procedure that is the indication for treatment. 307 */ 308 @Child(name = "diseaseSymptomProcedure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 309 @Description(shortDefinition="The disease, symptom or procedure that is the indication for treatment", formalDefinition="The disease, symptom or procedure that is the indication for treatment." ) 310 protected CodeableConcept diseaseSymptomProcedure; 311 312 /** 313 * The status of the disease or symptom for which the indication applies. 314 */ 315 @Child(name = "diseaseStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 316 @Description(shortDefinition="The status of the disease or symptom for which the indication applies", formalDefinition="The status of the disease or symptom for which the indication applies." ) 317 protected CodeableConcept diseaseStatus; 318 319 /** 320 * Comorbidity (concurrent condition) or co-infection as part of the indication. 321 */ 322 @Child(name = "comorbidity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 323 @Description(shortDefinition="Comorbidity (concurrent condition) or co-infection as part of the indication", formalDefinition="Comorbidity (concurrent condition) or co-infection as part of the indication." ) 324 protected List<CodeableConcept> comorbidity; 325 326 /** 327 * The intended effect, aim or strategy to be achieved by the indication. 328 */ 329 @Child(name = "intendedEffect", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 330 @Description(shortDefinition="The intended effect, aim or strategy to be achieved by the indication", formalDefinition="The intended effect, aim or strategy to be achieved by the indication." ) 331 protected CodeableConcept intendedEffect; 332 333 /** 334 * Timing or duration information as part of the indication. 335 */ 336 @Child(name = "duration", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=true) 337 @Description(shortDefinition="Timing or duration information as part of the indication", formalDefinition="Timing or duration information as part of the indication." ) 338 protected Quantity duration; 339 340 /** 341 * Information about the use of the medicinal product in relation to other therapies described as part of the indication. 342 */ 343 @Child(name = "otherTherapy", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 344 @Description(shortDefinition="Information about the use of the medicinal product in relation to other therapies described as part of the indication", formalDefinition="Information about the use of the medicinal product in relation to other therapies described as part of the indication." ) 345 protected List<MedicinalProductIndicationOtherTherapyComponent> otherTherapy; 346 347 /** 348 * Describe the undesirable effects of the medicinal product. 349 */ 350 @Child(name = "undesirableEffect", type = {MedicinalProductUndesirableEffect.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 351 @Description(shortDefinition="Describe the undesirable effects of the medicinal product", formalDefinition="Describe the undesirable effects of the medicinal product." ) 352 protected List<Reference> undesirableEffect; 353 /** 354 * The actual objects that are the target of the reference (Describe the undesirable effects of the medicinal product.) 355 */ 356 protected List<MedicinalProductUndesirableEffect> undesirableEffectTarget; 357 358 359 /** 360 * The population group to which this applies. 361 */ 362 @Child(name = "population", type = {Population.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 363 @Description(shortDefinition="The population group to which this applies", formalDefinition="The population group to which this applies." ) 364 protected List<Population> population; 365 366 private static final long serialVersionUID = 1205519664L; 367 368 /** 369 * Constructor 370 */ 371 public MedicinalProductIndication() { 372 super(); 373 } 374 375 /** 376 * @return {@link #subject} (The medication for which this is an indication.) 377 */ 378 public List<Reference> getSubject() { 379 if (this.subject == null) 380 this.subject = new ArrayList<Reference>(); 381 return this.subject; 382 } 383 384 /** 385 * @return Returns a reference to <code>this</code> for easy method chaining 386 */ 387 public MedicinalProductIndication setSubject(List<Reference> theSubject) { 388 this.subject = theSubject; 389 return this; 390 } 391 392 public boolean hasSubject() { 393 if (this.subject == null) 394 return false; 395 for (Reference item : this.subject) 396 if (!item.isEmpty()) 397 return true; 398 return false; 399 } 400 401 public Reference addSubject() { //3 402 Reference t = new Reference(); 403 if (this.subject == null) 404 this.subject = new ArrayList<Reference>(); 405 this.subject.add(t); 406 return t; 407 } 408 409 public MedicinalProductIndication addSubject(Reference t) { //3 410 if (t == null) 411 return this; 412 if (this.subject == null) 413 this.subject = new ArrayList<Reference>(); 414 this.subject.add(t); 415 return this; 416 } 417 418 /** 419 * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist 420 */ 421 public Reference getSubjectFirstRep() { 422 if (getSubject().isEmpty()) { 423 addSubject(); 424 } 425 return getSubject().get(0); 426 } 427 428 /** 429 * @deprecated Use Reference#setResource(IBaseResource) instead 430 */ 431 @Deprecated 432 public List<Resource> getSubjectTarget() { 433 if (this.subjectTarget == null) 434 this.subjectTarget = new ArrayList<Resource>(); 435 return this.subjectTarget; 436 } 437 438 /** 439 * @return {@link #diseaseSymptomProcedure} (The disease, symptom or procedure that is the indication for treatment.) 440 */ 441 public CodeableConcept getDiseaseSymptomProcedure() { 442 if (this.diseaseSymptomProcedure == null) 443 if (Configuration.errorOnAutoCreate()) 444 throw new Error("Attempt to auto-create MedicinalProductIndication.diseaseSymptomProcedure"); 445 else if (Configuration.doAutoCreate()) 446 this.diseaseSymptomProcedure = new CodeableConcept(); // cc 447 return this.diseaseSymptomProcedure; 448 } 449 450 public boolean hasDiseaseSymptomProcedure() { 451 return this.diseaseSymptomProcedure != null && !this.diseaseSymptomProcedure.isEmpty(); 452 } 453 454 /** 455 * @param value {@link #diseaseSymptomProcedure} (The disease, symptom or procedure that is the indication for treatment.) 456 */ 457 public MedicinalProductIndication setDiseaseSymptomProcedure(CodeableConcept value) { 458 this.diseaseSymptomProcedure = value; 459 return this; 460 } 461 462 /** 463 * @return {@link #diseaseStatus} (The status of the disease or symptom for which the indication applies.) 464 */ 465 public CodeableConcept getDiseaseStatus() { 466 if (this.diseaseStatus == null) 467 if (Configuration.errorOnAutoCreate()) 468 throw new Error("Attempt to auto-create MedicinalProductIndication.diseaseStatus"); 469 else if (Configuration.doAutoCreate()) 470 this.diseaseStatus = new CodeableConcept(); // cc 471 return this.diseaseStatus; 472 } 473 474 public boolean hasDiseaseStatus() { 475 return this.diseaseStatus != null && !this.diseaseStatus.isEmpty(); 476 } 477 478 /** 479 * @param value {@link #diseaseStatus} (The status of the disease or symptom for which the indication applies.) 480 */ 481 public MedicinalProductIndication setDiseaseStatus(CodeableConcept value) { 482 this.diseaseStatus = value; 483 return this; 484 } 485 486 /** 487 * @return {@link #comorbidity} (Comorbidity (concurrent condition) or co-infection as part of the indication.) 488 */ 489 public List<CodeableConcept> getComorbidity() { 490 if (this.comorbidity == null) 491 this.comorbidity = new ArrayList<CodeableConcept>(); 492 return this.comorbidity; 493 } 494 495 /** 496 * @return Returns a reference to <code>this</code> for easy method chaining 497 */ 498 public MedicinalProductIndication setComorbidity(List<CodeableConcept> theComorbidity) { 499 this.comorbidity = theComorbidity; 500 return this; 501 } 502 503 public boolean hasComorbidity() { 504 if (this.comorbidity == null) 505 return false; 506 for (CodeableConcept item : this.comorbidity) 507 if (!item.isEmpty()) 508 return true; 509 return false; 510 } 511 512 public CodeableConcept addComorbidity() { //3 513 CodeableConcept t = new CodeableConcept(); 514 if (this.comorbidity == null) 515 this.comorbidity = new ArrayList<CodeableConcept>(); 516 this.comorbidity.add(t); 517 return t; 518 } 519 520 public MedicinalProductIndication addComorbidity(CodeableConcept t) { //3 521 if (t == null) 522 return this; 523 if (this.comorbidity == null) 524 this.comorbidity = new ArrayList<CodeableConcept>(); 525 this.comorbidity.add(t); 526 return this; 527 } 528 529 /** 530 * @return The first repetition of repeating field {@link #comorbidity}, creating it if it does not already exist 531 */ 532 public CodeableConcept getComorbidityFirstRep() { 533 if (getComorbidity().isEmpty()) { 534 addComorbidity(); 535 } 536 return getComorbidity().get(0); 537 } 538 539 /** 540 * @return {@link #intendedEffect} (The intended effect, aim or strategy to be achieved by the indication.) 541 */ 542 public CodeableConcept getIntendedEffect() { 543 if (this.intendedEffect == null) 544 if (Configuration.errorOnAutoCreate()) 545 throw new Error("Attempt to auto-create MedicinalProductIndication.intendedEffect"); 546 else if (Configuration.doAutoCreate()) 547 this.intendedEffect = new CodeableConcept(); // cc 548 return this.intendedEffect; 549 } 550 551 public boolean hasIntendedEffect() { 552 return this.intendedEffect != null && !this.intendedEffect.isEmpty(); 553 } 554 555 /** 556 * @param value {@link #intendedEffect} (The intended effect, aim or strategy to be achieved by the indication.) 557 */ 558 public MedicinalProductIndication setIntendedEffect(CodeableConcept value) { 559 this.intendedEffect = value; 560 return this; 561 } 562 563 /** 564 * @return {@link #duration} (Timing or duration information as part of the indication.) 565 */ 566 public Quantity getDuration() { 567 if (this.duration == null) 568 if (Configuration.errorOnAutoCreate()) 569 throw new Error("Attempt to auto-create MedicinalProductIndication.duration"); 570 else if (Configuration.doAutoCreate()) 571 this.duration = new Quantity(); // cc 572 return this.duration; 573 } 574 575 public boolean hasDuration() { 576 return this.duration != null && !this.duration.isEmpty(); 577 } 578 579 /** 580 * @param value {@link #duration} (Timing or duration information as part of the indication.) 581 */ 582 public MedicinalProductIndication setDuration(Quantity value) { 583 this.duration = value; 584 return this; 585 } 586 587 /** 588 * @return {@link #otherTherapy} (Information about the use of the medicinal product in relation to other therapies described as part of the indication.) 589 */ 590 public List<MedicinalProductIndicationOtherTherapyComponent> getOtherTherapy() { 591 if (this.otherTherapy == null) 592 this.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>(); 593 return this.otherTherapy; 594 } 595 596 /** 597 * @return Returns a reference to <code>this</code> for easy method chaining 598 */ 599 public MedicinalProductIndication setOtherTherapy(List<MedicinalProductIndicationOtherTherapyComponent> theOtherTherapy) { 600 this.otherTherapy = theOtherTherapy; 601 return this; 602 } 603 604 public boolean hasOtherTherapy() { 605 if (this.otherTherapy == null) 606 return false; 607 for (MedicinalProductIndicationOtherTherapyComponent item : this.otherTherapy) 608 if (!item.isEmpty()) 609 return true; 610 return false; 611 } 612 613 public MedicinalProductIndicationOtherTherapyComponent addOtherTherapy() { //3 614 MedicinalProductIndicationOtherTherapyComponent t = new MedicinalProductIndicationOtherTherapyComponent(); 615 if (this.otherTherapy == null) 616 this.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>(); 617 this.otherTherapy.add(t); 618 return t; 619 } 620 621 public MedicinalProductIndication addOtherTherapy(MedicinalProductIndicationOtherTherapyComponent t) { //3 622 if (t == null) 623 return this; 624 if (this.otherTherapy == null) 625 this.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>(); 626 this.otherTherapy.add(t); 627 return this; 628 } 629 630 /** 631 * @return The first repetition of repeating field {@link #otherTherapy}, creating it if it does not already exist 632 */ 633 public MedicinalProductIndicationOtherTherapyComponent getOtherTherapyFirstRep() { 634 if (getOtherTherapy().isEmpty()) { 635 addOtherTherapy(); 636 } 637 return getOtherTherapy().get(0); 638 } 639 640 /** 641 * @return {@link #undesirableEffect} (Describe the undesirable effects of the medicinal product.) 642 */ 643 public List<Reference> getUndesirableEffect() { 644 if (this.undesirableEffect == null) 645 this.undesirableEffect = new ArrayList<Reference>(); 646 return this.undesirableEffect; 647 } 648 649 /** 650 * @return Returns a reference to <code>this</code> for easy method chaining 651 */ 652 public MedicinalProductIndication setUndesirableEffect(List<Reference> theUndesirableEffect) { 653 this.undesirableEffect = theUndesirableEffect; 654 return this; 655 } 656 657 public boolean hasUndesirableEffect() { 658 if (this.undesirableEffect == null) 659 return false; 660 for (Reference item : this.undesirableEffect) 661 if (!item.isEmpty()) 662 return true; 663 return false; 664 } 665 666 public Reference addUndesirableEffect() { //3 667 Reference t = new Reference(); 668 if (this.undesirableEffect == null) 669 this.undesirableEffect = new ArrayList<Reference>(); 670 this.undesirableEffect.add(t); 671 return t; 672 } 673 674 public MedicinalProductIndication addUndesirableEffect(Reference t) { //3 675 if (t == null) 676 return this; 677 if (this.undesirableEffect == null) 678 this.undesirableEffect = new ArrayList<Reference>(); 679 this.undesirableEffect.add(t); 680 return this; 681 } 682 683 /** 684 * @return The first repetition of repeating field {@link #undesirableEffect}, creating it if it does not already exist 685 */ 686 public Reference getUndesirableEffectFirstRep() { 687 if (getUndesirableEffect().isEmpty()) { 688 addUndesirableEffect(); 689 } 690 return getUndesirableEffect().get(0); 691 } 692 693 /** 694 * @deprecated Use Reference#setResource(IBaseResource) instead 695 */ 696 @Deprecated 697 public List<MedicinalProductUndesirableEffect> getUndesirableEffectTarget() { 698 if (this.undesirableEffectTarget == null) 699 this.undesirableEffectTarget = new ArrayList<MedicinalProductUndesirableEffect>(); 700 return this.undesirableEffectTarget; 701 } 702 703 /** 704 * @deprecated Use Reference#setResource(IBaseResource) instead 705 */ 706 @Deprecated 707 public MedicinalProductUndesirableEffect addUndesirableEffectTarget() { 708 MedicinalProductUndesirableEffect r = new MedicinalProductUndesirableEffect(); 709 if (this.undesirableEffectTarget == null) 710 this.undesirableEffectTarget = new ArrayList<MedicinalProductUndesirableEffect>(); 711 this.undesirableEffectTarget.add(r); 712 return r; 713 } 714 715 /** 716 * @return {@link #population} (The population group to which this applies.) 717 */ 718 public List<Population> getPopulation() { 719 if (this.population == null) 720 this.population = new ArrayList<Population>(); 721 return this.population; 722 } 723 724 /** 725 * @return Returns a reference to <code>this</code> for easy method chaining 726 */ 727 public MedicinalProductIndication setPopulation(List<Population> thePopulation) { 728 this.population = thePopulation; 729 return this; 730 } 731 732 public boolean hasPopulation() { 733 if (this.population == null) 734 return false; 735 for (Population item : this.population) 736 if (!item.isEmpty()) 737 return true; 738 return false; 739 } 740 741 public Population addPopulation() { //3 742 Population t = new Population(); 743 if (this.population == null) 744 this.population = new ArrayList<Population>(); 745 this.population.add(t); 746 return t; 747 } 748 749 public MedicinalProductIndication addPopulation(Population t) { //3 750 if (t == null) 751 return this; 752 if (this.population == null) 753 this.population = new ArrayList<Population>(); 754 this.population.add(t); 755 return this; 756 } 757 758 /** 759 * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist 760 */ 761 public Population getPopulationFirstRep() { 762 if (getPopulation().isEmpty()) { 763 addPopulation(); 764 } 765 return getPopulation().get(0); 766 } 767 768 protected void listChildren(List<Property> children) { 769 super.listChildren(children); 770 children.add(new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject)); 771 children.add(new Property("diseaseSymptomProcedure", "CodeableConcept", "The disease, symptom or procedure that is the indication for treatment.", 0, 1, diseaseSymptomProcedure)); 772 children.add(new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for which the indication applies.", 0, 1, diseaseStatus)); 773 children.add(new Property("comorbidity", "CodeableConcept", "Comorbidity (concurrent condition) or co-infection as part of the indication.", 0, java.lang.Integer.MAX_VALUE, comorbidity)); 774 children.add(new Property("intendedEffect", "CodeableConcept", "The intended effect, aim or strategy to be achieved by the indication.", 0, 1, intendedEffect)); 775 children.add(new Property("duration", "Quantity", "Timing or duration information as part of the indication.", 0, 1, duration)); 776 children.add(new Property("otherTherapy", "", "Information about the use of the medicinal product in relation to other therapies described as part of the indication.", 0, java.lang.Integer.MAX_VALUE, otherTherapy)); 777 children.add(new Property("undesirableEffect", "Reference(MedicinalProductUndesirableEffect)", "Describe the undesirable effects of the medicinal product.", 0, java.lang.Integer.MAX_VALUE, undesirableEffect)); 778 children.add(new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population)); 779 } 780 781 @Override 782 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 783 switch (_hash) { 784 case -1867885268: /*subject*/ return new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject); 785 case -1497395130: /*diseaseSymptomProcedure*/ return new Property("diseaseSymptomProcedure", "CodeableConcept", "The disease, symptom or procedure that is the indication for treatment.", 0, 1, diseaseSymptomProcedure); 786 case -505503602: /*diseaseStatus*/ return new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for which the indication applies.", 0, 1, diseaseStatus); 787 case -406395211: /*comorbidity*/ return new Property("comorbidity", "CodeableConcept", "Comorbidity (concurrent condition) or co-infection as part of the indication.", 0, java.lang.Integer.MAX_VALUE, comorbidity); 788 case 1587112348: /*intendedEffect*/ return new Property("intendedEffect", "CodeableConcept", "The intended effect, aim or strategy to be achieved by the indication.", 0, 1, intendedEffect); 789 case -1992012396: /*duration*/ return new Property("duration", "Quantity", "Timing or duration information as part of the indication.", 0, 1, duration); 790 case -544509127: /*otherTherapy*/ return new Property("otherTherapy", "", "Information about the use of the medicinal product in relation to other therapies described as part of the indication.", 0, java.lang.Integer.MAX_VALUE, otherTherapy); 791 case 444367565: /*undesirableEffect*/ return new Property("undesirableEffect", "Reference(MedicinalProductUndesirableEffect)", "Describe the undesirable effects of the medicinal product.", 0, java.lang.Integer.MAX_VALUE, undesirableEffect); 792 case -2023558323: /*population*/ return new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population); 793 default: return super.getNamedProperty(_hash, _name, _checkValid); 794 } 795 796 } 797 798 @Override 799 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 800 switch (hash) { 801 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference 802 case -1497395130: /*diseaseSymptomProcedure*/ return this.diseaseSymptomProcedure == null ? new Base[0] : new Base[] {this.diseaseSymptomProcedure}; // CodeableConcept 803 case -505503602: /*diseaseStatus*/ return this.diseaseStatus == null ? new Base[0] : new Base[] {this.diseaseStatus}; // CodeableConcept 804 case -406395211: /*comorbidity*/ return this.comorbidity == null ? new Base[0] : this.comorbidity.toArray(new Base[this.comorbidity.size()]); // CodeableConcept 805 case 1587112348: /*intendedEffect*/ return this.intendedEffect == null ? new Base[0] : new Base[] {this.intendedEffect}; // CodeableConcept 806 case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Quantity 807 case -544509127: /*otherTherapy*/ return this.otherTherapy == null ? new Base[0] : this.otherTherapy.toArray(new Base[this.otherTherapy.size()]); // MedicinalProductIndicationOtherTherapyComponent 808 case 444367565: /*undesirableEffect*/ return this.undesirableEffect == null ? new Base[0] : this.undesirableEffect.toArray(new Base[this.undesirableEffect.size()]); // Reference 809 case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // Population 810 default: return super.getProperty(hash, name, checkValid); 811 } 812 813 } 814 815 @Override 816 public Base setProperty(int hash, String name, Base value) throws FHIRException { 817 switch (hash) { 818 case -1867885268: // subject 819 this.getSubject().add(castToReference(value)); // Reference 820 return value; 821 case -1497395130: // diseaseSymptomProcedure 822 this.diseaseSymptomProcedure = castToCodeableConcept(value); // CodeableConcept 823 return value; 824 case -505503602: // diseaseStatus 825 this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept 826 return value; 827 case -406395211: // comorbidity 828 this.getComorbidity().add(castToCodeableConcept(value)); // CodeableConcept 829 return value; 830 case 1587112348: // intendedEffect 831 this.intendedEffect = castToCodeableConcept(value); // CodeableConcept 832 return value; 833 case -1992012396: // duration 834 this.duration = castToQuantity(value); // Quantity 835 return value; 836 case -544509127: // otherTherapy 837 this.getOtherTherapy().add((MedicinalProductIndicationOtherTherapyComponent) value); // MedicinalProductIndicationOtherTherapyComponent 838 return value; 839 case 444367565: // undesirableEffect 840 this.getUndesirableEffect().add(castToReference(value)); // Reference 841 return value; 842 case -2023558323: // population 843 this.getPopulation().add(castToPopulation(value)); // Population 844 return value; 845 default: return super.setProperty(hash, name, value); 846 } 847 848 } 849 850 @Override 851 public Base setProperty(String name, Base value) throws FHIRException { 852 if (name.equals("subject")) { 853 this.getSubject().add(castToReference(value)); 854 } else if (name.equals("diseaseSymptomProcedure")) { 855 this.diseaseSymptomProcedure = castToCodeableConcept(value); // CodeableConcept 856 } else if (name.equals("diseaseStatus")) { 857 this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept 858 } else if (name.equals("comorbidity")) { 859 this.getComorbidity().add(castToCodeableConcept(value)); 860 } else if (name.equals("intendedEffect")) { 861 this.intendedEffect = castToCodeableConcept(value); // CodeableConcept 862 } else if (name.equals("duration")) { 863 this.duration = castToQuantity(value); // Quantity 864 } else if (name.equals("otherTherapy")) { 865 this.getOtherTherapy().add((MedicinalProductIndicationOtherTherapyComponent) value); 866 } else if (name.equals("undesirableEffect")) { 867 this.getUndesirableEffect().add(castToReference(value)); 868 } else if (name.equals("population")) { 869 this.getPopulation().add(castToPopulation(value)); 870 } else 871 return super.setProperty(name, value); 872 return value; 873 } 874 875 @Override 876 public Base makeProperty(int hash, String name) throws FHIRException { 877 switch (hash) { 878 case -1867885268: return addSubject(); 879 case -1497395130: return getDiseaseSymptomProcedure(); 880 case -505503602: return getDiseaseStatus(); 881 case -406395211: return addComorbidity(); 882 case 1587112348: return getIntendedEffect(); 883 case -1992012396: return getDuration(); 884 case -544509127: return addOtherTherapy(); 885 case 444367565: return addUndesirableEffect(); 886 case -2023558323: return addPopulation(); 887 default: return super.makeProperty(hash, name); 888 } 889 890 } 891 892 @Override 893 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 894 switch (hash) { 895 case -1867885268: /*subject*/ return new String[] {"Reference"}; 896 case -1497395130: /*diseaseSymptomProcedure*/ return new String[] {"CodeableConcept"}; 897 case -505503602: /*diseaseStatus*/ return new String[] {"CodeableConcept"}; 898 case -406395211: /*comorbidity*/ return new String[] {"CodeableConcept"}; 899 case 1587112348: /*intendedEffect*/ return new String[] {"CodeableConcept"}; 900 case -1992012396: /*duration*/ return new String[] {"Quantity"}; 901 case -544509127: /*otherTherapy*/ return new String[] {}; 902 case 444367565: /*undesirableEffect*/ return new String[] {"Reference"}; 903 case -2023558323: /*population*/ return new String[] {"Population"}; 904 default: return super.getTypesForProperty(hash, name); 905 } 906 907 } 908 909 @Override 910 public Base addChild(String name) throws FHIRException { 911 if (name.equals("subject")) { 912 return addSubject(); 913 } 914 else if (name.equals("diseaseSymptomProcedure")) { 915 this.diseaseSymptomProcedure = new CodeableConcept(); 916 return this.diseaseSymptomProcedure; 917 } 918 else if (name.equals("diseaseStatus")) { 919 this.diseaseStatus = new CodeableConcept(); 920 return this.diseaseStatus; 921 } 922 else if (name.equals("comorbidity")) { 923 return addComorbidity(); 924 } 925 else if (name.equals("intendedEffect")) { 926 this.intendedEffect = new CodeableConcept(); 927 return this.intendedEffect; 928 } 929 else if (name.equals("duration")) { 930 this.duration = new Quantity(); 931 return this.duration; 932 } 933 else if (name.equals("otherTherapy")) { 934 return addOtherTherapy(); 935 } 936 else if (name.equals("undesirableEffect")) { 937 return addUndesirableEffect(); 938 } 939 else if (name.equals("population")) { 940 return addPopulation(); 941 } 942 else 943 return super.addChild(name); 944 } 945 946 public String fhirType() { 947 return "MedicinalProductIndication"; 948 949 } 950 951 public MedicinalProductIndication copy() { 952 MedicinalProductIndication dst = new MedicinalProductIndication(); 953 copyValues(dst); 954 if (subject != null) { 955 dst.subject = new ArrayList<Reference>(); 956 for (Reference i : subject) 957 dst.subject.add(i.copy()); 958 }; 959 dst.diseaseSymptomProcedure = diseaseSymptomProcedure == null ? null : diseaseSymptomProcedure.copy(); 960 dst.diseaseStatus = diseaseStatus == null ? null : diseaseStatus.copy(); 961 if (comorbidity != null) { 962 dst.comorbidity = new ArrayList<CodeableConcept>(); 963 for (CodeableConcept i : comorbidity) 964 dst.comorbidity.add(i.copy()); 965 }; 966 dst.intendedEffect = intendedEffect == null ? null : intendedEffect.copy(); 967 dst.duration = duration == null ? null : duration.copy(); 968 if (otherTherapy != null) { 969 dst.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>(); 970 for (MedicinalProductIndicationOtherTherapyComponent i : otherTherapy) 971 dst.otherTherapy.add(i.copy()); 972 }; 973 if (undesirableEffect != null) { 974 dst.undesirableEffect = new ArrayList<Reference>(); 975 for (Reference i : undesirableEffect) 976 dst.undesirableEffect.add(i.copy()); 977 }; 978 if (population != null) { 979 dst.population = new ArrayList<Population>(); 980 for (Population i : population) 981 dst.population.add(i.copy()); 982 }; 983 return dst; 984 } 985 986 protected MedicinalProductIndication typedCopy() { 987 return copy(); 988 } 989 990 @Override 991 public boolean equalsDeep(Base other_) { 992 if (!super.equalsDeep(other_)) 993 return false; 994 if (!(other_ instanceof MedicinalProductIndication)) 995 return false; 996 MedicinalProductIndication o = (MedicinalProductIndication) other_; 997 return compareDeep(subject, o.subject, true) && compareDeep(diseaseSymptomProcedure, o.diseaseSymptomProcedure, true) 998 && compareDeep(diseaseStatus, o.diseaseStatus, true) && compareDeep(comorbidity, o.comorbidity, true) 999 && compareDeep(intendedEffect, o.intendedEffect, true) && compareDeep(duration, o.duration, true) 1000 && compareDeep(otherTherapy, o.otherTherapy, true) && compareDeep(undesirableEffect, o.undesirableEffect, true) 1001 && compareDeep(population, o.population, true); 1002 } 1003 1004 @Override 1005 public boolean equalsShallow(Base other_) { 1006 if (!super.equalsShallow(other_)) 1007 return false; 1008 if (!(other_ instanceof MedicinalProductIndication)) 1009 return false; 1010 MedicinalProductIndication o = (MedicinalProductIndication) other_; 1011 return true; 1012 } 1013 1014 public boolean isEmpty() { 1015 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, diseaseSymptomProcedure 1016 , diseaseStatus, comorbidity, intendedEffect, duration, otherTherapy, undesirableEffect 1017 , population); 1018 } 1019 1020 @Override 1021 public ResourceType getResourceType() { 1022 return ResourceType.MedicinalProductIndication; 1023 } 1024 1025 /** 1026 * Search parameter: <b>subject</b> 1027 * <p> 1028 * Description: <b>The medication for which this is an indication</b><br> 1029 * Type: <b>reference</b><br> 1030 * Path: <b>MedicinalProductIndication.subject</b><br> 1031 * </p> 1032 */ 1033 @SearchParamDefinition(name="subject", path="MedicinalProductIndication.subject", description="The medication for which this is an indication", type="reference", target={Medication.class, MedicinalProduct.class } ) 1034 public static final String SP_SUBJECT = "subject"; 1035 /** 1036 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 1037 * <p> 1038 * Description: <b>The medication for which this is an indication</b><br> 1039 * Type: <b>reference</b><br> 1040 * Path: <b>MedicinalProductIndication.subject</b><br> 1041 * </p> 1042 */ 1043 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 1044 1045/** 1046 * Constant for fluent queries to be used to add include statements. Specifies 1047 * the path value of "<b>MedicinalProductIndication:subject</b>". 1048 */ 1049 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductIndication:subject").toLocked(); 1050 1051 1052} 1053