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