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