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 * The clinical particulars - indications, contraindications etc. of a medicinal product, including for regulatory purposes. 066 */ 067@ResourceDef(name="MedicinalProductContraindication", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductContraindication") 068public class MedicinalProductContraindication extends DomainResource { 069 070 @Block() 071 public static class MedicinalProductContraindicationOtherTherapyComponent 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 MedicinalProductContraindicationOtherTherapyComponent() { 092 super(); 093 } 094 095 /** 096 * Constructor 097 */ 098 public MedicinalProductContraindicationOtherTherapyComponent(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 MedicinalProductContraindicationOtherTherapyComponent.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 MedicinalProductContraindicationOtherTherapyComponent 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 MedicinalProductContraindicationOtherTherapyComponent setMedication(Type value) { 173 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 174 throw new Error("Not the right type for MedicinalProductContraindication.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 MedicinalProductContraindicationOtherTherapyComponent copy() { 273 MedicinalProductContraindicationOtherTherapyComponent dst = new MedicinalProductContraindicationOtherTherapyComponent(); 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 MedicinalProductContraindicationOtherTherapyComponent)) 285 return false; 286 MedicinalProductContraindicationOtherTherapyComponent o = (MedicinalProductContraindicationOtherTherapyComponent) 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 MedicinalProductContraindicationOtherTherapyComponent)) 296 return false; 297 MedicinalProductContraindicationOtherTherapyComponent o = (MedicinalProductContraindicationOtherTherapyComponent) 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 "MedicinalProductContraindication.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 for the contraindication. 327 */ 328 @Child(name = "disease", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 329 @Description(shortDefinition="The disease, symptom or procedure for the contraindication", formalDefinition="The disease, symptom or procedure for the contraindication." ) 330 protected CodeableConcept disease; 331 332 /** 333 * The status of the disease or symptom for the contraindication. 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 the contraindication", formalDefinition="The status of the disease or symptom for the contraindication." ) 337 protected CodeableConcept diseaseStatus; 338 339 /** 340 * A comorbidity (concurrent condition) or coinfection. 341 */ 342 @Child(name = "comorbidity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 343 @Description(shortDefinition="A comorbidity (concurrent condition) or coinfection", formalDefinition="A comorbidity (concurrent condition) or coinfection." ) 344 protected List<CodeableConcept> comorbidity; 345 346 /** 347 * Information about the use of the medicinal product in relation to other therapies as part of the indication. 348 */ 349 @Child(name = "therapeuticIndication", type = {MedicinalProductIndication.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 350 @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." ) 351 protected List<Reference> therapeuticIndication; 352 /** 353 * The actual objects that are the target of the reference (Information about the use of the medicinal product in relation to other therapies as part of the indication.) 354 */ 355 protected List<MedicinalProductIndication> therapeuticIndicationTarget; 356 357 358 /** 359 * Information about the use of the medicinal product in relation to other therapies described as part of the indication. 360 */ 361 @Child(name = "otherTherapy", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 362 @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." ) 363 protected List<MedicinalProductContraindicationOtherTherapyComponent> otherTherapy; 364 365 /** 366 * The population group to which this applies. 367 */ 368 @Child(name = "population", type = {Population.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 369 @Description(shortDefinition="The population group to which this applies", formalDefinition="The population group to which this applies." ) 370 protected List<Population> population; 371 372 private static final long serialVersionUID = -1746103034L; 373 374 /** 375 * Constructor 376 */ 377 public MedicinalProductContraindication() { 378 super(); 379 } 380 381 /** 382 * @return {@link #subject} (The medication for which this is an indication.) 383 */ 384 public List<Reference> getSubject() { 385 if (this.subject == null) 386 this.subject = new ArrayList<Reference>(); 387 return this.subject; 388 } 389 390 /** 391 * @return Returns a reference to <code>this</code> for easy method chaining 392 */ 393 public MedicinalProductContraindication setSubject(List<Reference> theSubject) { 394 this.subject = theSubject; 395 return this; 396 } 397 398 public boolean hasSubject() { 399 if (this.subject == null) 400 return false; 401 for (Reference item : this.subject) 402 if (!item.isEmpty()) 403 return true; 404 return false; 405 } 406 407 public Reference addSubject() { //3 408 Reference t = new Reference(); 409 if (this.subject == null) 410 this.subject = new ArrayList<Reference>(); 411 this.subject.add(t); 412 return t; 413 } 414 415 public MedicinalProductContraindication addSubject(Reference t) { //3 416 if (t == null) 417 return this; 418 if (this.subject == null) 419 this.subject = new ArrayList<Reference>(); 420 this.subject.add(t); 421 return this; 422 } 423 424 /** 425 * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist 426 */ 427 public Reference getSubjectFirstRep() { 428 if (getSubject().isEmpty()) { 429 addSubject(); 430 } 431 return getSubject().get(0); 432 } 433 434 /** 435 * @deprecated Use Reference#setResource(IBaseResource) instead 436 */ 437 @Deprecated 438 public List<Resource> getSubjectTarget() { 439 if (this.subjectTarget == null) 440 this.subjectTarget = new ArrayList<Resource>(); 441 return this.subjectTarget; 442 } 443 444 /** 445 * @return {@link #disease} (The disease, symptom or procedure for the contraindication.) 446 */ 447 public CodeableConcept getDisease() { 448 if (this.disease == null) 449 if (Configuration.errorOnAutoCreate()) 450 throw new Error("Attempt to auto-create MedicinalProductContraindication.disease"); 451 else if (Configuration.doAutoCreate()) 452 this.disease = new CodeableConcept(); // cc 453 return this.disease; 454 } 455 456 public boolean hasDisease() { 457 return this.disease != null && !this.disease.isEmpty(); 458 } 459 460 /** 461 * @param value {@link #disease} (The disease, symptom or procedure for the contraindication.) 462 */ 463 public MedicinalProductContraindication setDisease(CodeableConcept value) { 464 this.disease = value; 465 return this; 466 } 467 468 /** 469 * @return {@link #diseaseStatus} (The status of the disease or symptom for the contraindication.) 470 */ 471 public CodeableConcept getDiseaseStatus() { 472 if (this.diseaseStatus == null) 473 if (Configuration.errorOnAutoCreate()) 474 throw new Error("Attempt to auto-create MedicinalProductContraindication.diseaseStatus"); 475 else if (Configuration.doAutoCreate()) 476 this.diseaseStatus = new CodeableConcept(); // cc 477 return this.diseaseStatus; 478 } 479 480 public boolean hasDiseaseStatus() { 481 return this.diseaseStatus != null && !this.diseaseStatus.isEmpty(); 482 } 483 484 /** 485 * @param value {@link #diseaseStatus} (The status of the disease or symptom for the contraindication.) 486 */ 487 public MedicinalProductContraindication setDiseaseStatus(CodeableConcept value) { 488 this.diseaseStatus = value; 489 return this; 490 } 491 492 /** 493 * @return {@link #comorbidity} (A comorbidity (concurrent condition) or coinfection.) 494 */ 495 public List<CodeableConcept> getComorbidity() { 496 if (this.comorbidity == null) 497 this.comorbidity = new ArrayList<CodeableConcept>(); 498 return this.comorbidity; 499 } 500 501 /** 502 * @return Returns a reference to <code>this</code> for easy method chaining 503 */ 504 public MedicinalProductContraindication setComorbidity(List<CodeableConcept> theComorbidity) { 505 this.comorbidity = theComorbidity; 506 return this; 507 } 508 509 public boolean hasComorbidity() { 510 if (this.comorbidity == null) 511 return false; 512 for (CodeableConcept item : this.comorbidity) 513 if (!item.isEmpty()) 514 return true; 515 return false; 516 } 517 518 public CodeableConcept addComorbidity() { //3 519 CodeableConcept t = new CodeableConcept(); 520 if (this.comorbidity == null) 521 this.comorbidity = new ArrayList<CodeableConcept>(); 522 this.comorbidity.add(t); 523 return t; 524 } 525 526 public MedicinalProductContraindication addComorbidity(CodeableConcept t) { //3 527 if (t == null) 528 return this; 529 if (this.comorbidity == null) 530 this.comorbidity = new ArrayList<CodeableConcept>(); 531 this.comorbidity.add(t); 532 return this; 533 } 534 535 /** 536 * @return The first repetition of repeating field {@link #comorbidity}, creating it if it does not already exist 537 */ 538 public CodeableConcept getComorbidityFirstRep() { 539 if (getComorbidity().isEmpty()) { 540 addComorbidity(); 541 } 542 return getComorbidity().get(0); 543 } 544 545 /** 546 * @return {@link #therapeuticIndication} (Information about the use of the medicinal product in relation to other therapies as part of the indication.) 547 */ 548 public List<Reference> getTherapeuticIndication() { 549 if (this.therapeuticIndication == null) 550 this.therapeuticIndication = new ArrayList<Reference>(); 551 return this.therapeuticIndication; 552 } 553 554 /** 555 * @return Returns a reference to <code>this</code> for easy method chaining 556 */ 557 public MedicinalProductContraindication setTherapeuticIndication(List<Reference> theTherapeuticIndication) { 558 this.therapeuticIndication = theTherapeuticIndication; 559 return this; 560 } 561 562 public boolean hasTherapeuticIndication() { 563 if (this.therapeuticIndication == null) 564 return false; 565 for (Reference item : this.therapeuticIndication) 566 if (!item.isEmpty()) 567 return true; 568 return false; 569 } 570 571 public Reference addTherapeuticIndication() { //3 572 Reference t = new Reference(); 573 if (this.therapeuticIndication == null) 574 this.therapeuticIndication = new ArrayList<Reference>(); 575 this.therapeuticIndication.add(t); 576 return t; 577 } 578 579 public MedicinalProductContraindication addTherapeuticIndication(Reference t) { //3 580 if (t == null) 581 return this; 582 if (this.therapeuticIndication == null) 583 this.therapeuticIndication = new ArrayList<Reference>(); 584 this.therapeuticIndication.add(t); 585 return this; 586 } 587 588 /** 589 * @return The first repetition of repeating field {@link #therapeuticIndication}, creating it if it does not already exist 590 */ 591 public Reference getTherapeuticIndicationFirstRep() { 592 if (getTherapeuticIndication().isEmpty()) { 593 addTherapeuticIndication(); 594 } 595 return getTherapeuticIndication().get(0); 596 } 597 598 /** 599 * @deprecated Use Reference#setResource(IBaseResource) instead 600 */ 601 @Deprecated 602 public List<MedicinalProductIndication> getTherapeuticIndicationTarget() { 603 if (this.therapeuticIndicationTarget == null) 604 this.therapeuticIndicationTarget = new ArrayList<MedicinalProductIndication>(); 605 return this.therapeuticIndicationTarget; 606 } 607 608 /** 609 * @deprecated Use Reference#setResource(IBaseResource) instead 610 */ 611 @Deprecated 612 public MedicinalProductIndication addTherapeuticIndicationTarget() { 613 MedicinalProductIndication r = new MedicinalProductIndication(); 614 if (this.therapeuticIndicationTarget == null) 615 this.therapeuticIndicationTarget = new ArrayList<MedicinalProductIndication>(); 616 this.therapeuticIndicationTarget.add(r); 617 return r; 618 } 619 620 /** 621 * @return {@link #otherTherapy} (Information about the use of the medicinal product in relation to other therapies described as part of the indication.) 622 */ 623 public List<MedicinalProductContraindicationOtherTherapyComponent> getOtherTherapy() { 624 if (this.otherTherapy == null) 625 this.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>(); 626 return this.otherTherapy; 627 } 628 629 /** 630 * @return Returns a reference to <code>this</code> for easy method chaining 631 */ 632 public MedicinalProductContraindication setOtherTherapy(List<MedicinalProductContraindicationOtherTherapyComponent> theOtherTherapy) { 633 this.otherTherapy = theOtherTherapy; 634 return this; 635 } 636 637 public boolean hasOtherTherapy() { 638 if (this.otherTherapy == null) 639 return false; 640 for (MedicinalProductContraindicationOtherTherapyComponent item : this.otherTherapy) 641 if (!item.isEmpty()) 642 return true; 643 return false; 644 } 645 646 public MedicinalProductContraindicationOtherTherapyComponent addOtherTherapy() { //3 647 MedicinalProductContraindicationOtherTherapyComponent t = new MedicinalProductContraindicationOtherTherapyComponent(); 648 if (this.otherTherapy == null) 649 this.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>(); 650 this.otherTherapy.add(t); 651 return t; 652 } 653 654 public MedicinalProductContraindication addOtherTherapy(MedicinalProductContraindicationOtherTherapyComponent t) { //3 655 if (t == null) 656 return this; 657 if (this.otherTherapy == null) 658 this.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>(); 659 this.otherTherapy.add(t); 660 return this; 661 } 662 663 /** 664 * @return The first repetition of repeating field {@link #otherTherapy}, creating it if it does not already exist 665 */ 666 public MedicinalProductContraindicationOtherTherapyComponent getOtherTherapyFirstRep() { 667 if (getOtherTherapy().isEmpty()) { 668 addOtherTherapy(); 669 } 670 return getOtherTherapy().get(0); 671 } 672 673 /** 674 * @return {@link #population} (The population group to which this applies.) 675 */ 676 public List<Population> getPopulation() { 677 if (this.population == null) 678 this.population = new ArrayList<Population>(); 679 return this.population; 680 } 681 682 /** 683 * @return Returns a reference to <code>this</code> for easy method chaining 684 */ 685 public MedicinalProductContraindication setPopulation(List<Population> thePopulation) { 686 this.population = thePopulation; 687 return this; 688 } 689 690 public boolean hasPopulation() { 691 if (this.population == null) 692 return false; 693 for (Population item : this.population) 694 if (!item.isEmpty()) 695 return true; 696 return false; 697 } 698 699 public Population addPopulation() { //3 700 Population t = new Population(); 701 if (this.population == null) 702 this.population = new ArrayList<Population>(); 703 this.population.add(t); 704 return t; 705 } 706 707 public MedicinalProductContraindication addPopulation(Population t) { //3 708 if (t == null) 709 return this; 710 if (this.population == null) 711 this.population = new ArrayList<Population>(); 712 this.population.add(t); 713 return this; 714 } 715 716 /** 717 * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist 718 */ 719 public Population getPopulationFirstRep() { 720 if (getPopulation().isEmpty()) { 721 addPopulation(); 722 } 723 return getPopulation().get(0); 724 } 725 726 protected void listChildren(List<Property> children) { 727 super.listChildren(children); 728 children.add(new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject)); 729 children.add(new Property("disease", "CodeableConcept", "The disease, symptom or procedure for the contraindication.", 0, 1, disease)); 730 children.add(new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the contraindication.", 0, 1, diseaseStatus)); 731 children.add(new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection.", 0, java.lang.Integer.MAX_VALUE, comorbidity)); 732 children.add(new Property("therapeuticIndication", "Reference(MedicinalProductIndication)", "Information about the use of the medicinal product in relation to other therapies as part of the indication.", 0, java.lang.Integer.MAX_VALUE, therapeuticIndication)); 733 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)); 734 children.add(new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population)); 735 } 736 737 @Override 738 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 739 switch (_hash) { 740 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); 741 case 1671426428: /*disease*/ return new Property("disease", "CodeableConcept", "The disease, symptom or procedure for the contraindication.", 0, 1, disease); 742 case -505503602: /*diseaseStatus*/ return new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the contraindication.", 0, 1, diseaseStatus); 743 case -406395211: /*comorbidity*/ return new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection.", 0, java.lang.Integer.MAX_VALUE, comorbidity); 744 case -1925150262: /*therapeuticIndication*/ return new Property("therapeuticIndication", "Reference(MedicinalProductIndication)", "Information about the use of the medicinal product in relation to other therapies as part of the indication.", 0, java.lang.Integer.MAX_VALUE, therapeuticIndication); 745 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); 746 case -2023558323: /*population*/ return new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population); 747 default: return super.getNamedProperty(_hash, _name, _checkValid); 748 } 749 750 } 751 752 @Override 753 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 754 switch (hash) { 755 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference 756 case 1671426428: /*disease*/ return this.disease == null ? new Base[0] : new Base[] {this.disease}; // CodeableConcept 757 case -505503602: /*diseaseStatus*/ return this.diseaseStatus == null ? new Base[0] : new Base[] {this.diseaseStatus}; // CodeableConcept 758 case -406395211: /*comorbidity*/ return this.comorbidity == null ? new Base[0] : this.comorbidity.toArray(new Base[this.comorbidity.size()]); // CodeableConcept 759 case -1925150262: /*therapeuticIndication*/ return this.therapeuticIndication == null ? new Base[0] : this.therapeuticIndication.toArray(new Base[this.therapeuticIndication.size()]); // Reference 760 case -544509127: /*otherTherapy*/ return this.otherTherapy == null ? new Base[0] : this.otherTherapy.toArray(new Base[this.otherTherapy.size()]); // MedicinalProductContraindicationOtherTherapyComponent 761 case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // Population 762 default: return super.getProperty(hash, name, checkValid); 763 } 764 765 } 766 767 @Override 768 public Base setProperty(int hash, String name, Base value) throws FHIRException { 769 switch (hash) { 770 case -1867885268: // subject 771 this.getSubject().add(castToReference(value)); // Reference 772 return value; 773 case 1671426428: // disease 774 this.disease = castToCodeableConcept(value); // CodeableConcept 775 return value; 776 case -505503602: // diseaseStatus 777 this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept 778 return value; 779 case -406395211: // comorbidity 780 this.getComorbidity().add(castToCodeableConcept(value)); // CodeableConcept 781 return value; 782 case -1925150262: // therapeuticIndication 783 this.getTherapeuticIndication().add(castToReference(value)); // Reference 784 return value; 785 case -544509127: // otherTherapy 786 this.getOtherTherapy().add((MedicinalProductContraindicationOtherTherapyComponent) value); // MedicinalProductContraindicationOtherTherapyComponent 787 return value; 788 case -2023558323: // population 789 this.getPopulation().add(castToPopulation(value)); // Population 790 return value; 791 default: return super.setProperty(hash, name, value); 792 } 793 794 } 795 796 @Override 797 public Base setProperty(String name, Base value) throws FHIRException { 798 if (name.equals("subject")) { 799 this.getSubject().add(castToReference(value)); 800 } else if (name.equals("disease")) { 801 this.disease = castToCodeableConcept(value); // CodeableConcept 802 } else if (name.equals("diseaseStatus")) { 803 this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept 804 } else if (name.equals("comorbidity")) { 805 this.getComorbidity().add(castToCodeableConcept(value)); 806 } else if (name.equals("therapeuticIndication")) { 807 this.getTherapeuticIndication().add(castToReference(value)); 808 } else if (name.equals("otherTherapy")) { 809 this.getOtherTherapy().add((MedicinalProductContraindicationOtherTherapyComponent) value); 810 } else if (name.equals("population")) { 811 this.getPopulation().add(castToPopulation(value)); 812 } else 813 return super.setProperty(name, value); 814 return value; 815 } 816 817 @Override 818 public Base makeProperty(int hash, String name) throws FHIRException { 819 switch (hash) { 820 case -1867885268: return addSubject(); 821 case 1671426428: return getDisease(); 822 case -505503602: return getDiseaseStatus(); 823 case -406395211: return addComorbidity(); 824 case -1925150262: return addTherapeuticIndication(); 825 case -544509127: return addOtherTherapy(); 826 case -2023558323: return addPopulation(); 827 default: return super.makeProperty(hash, name); 828 } 829 830 } 831 832 @Override 833 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 834 switch (hash) { 835 case -1867885268: /*subject*/ return new String[] {"Reference"}; 836 case 1671426428: /*disease*/ return new String[] {"CodeableConcept"}; 837 case -505503602: /*diseaseStatus*/ return new String[] {"CodeableConcept"}; 838 case -406395211: /*comorbidity*/ return new String[] {"CodeableConcept"}; 839 case -1925150262: /*therapeuticIndication*/ return new String[] {"Reference"}; 840 case -544509127: /*otherTherapy*/ return new String[] {}; 841 case -2023558323: /*population*/ return new String[] {"Population"}; 842 default: return super.getTypesForProperty(hash, name); 843 } 844 845 } 846 847 @Override 848 public Base addChild(String name) throws FHIRException { 849 if (name.equals("subject")) { 850 return addSubject(); 851 } 852 else if (name.equals("disease")) { 853 this.disease = new CodeableConcept(); 854 return this.disease; 855 } 856 else if (name.equals("diseaseStatus")) { 857 this.diseaseStatus = new CodeableConcept(); 858 return this.diseaseStatus; 859 } 860 else if (name.equals("comorbidity")) { 861 return addComorbidity(); 862 } 863 else if (name.equals("therapeuticIndication")) { 864 return addTherapeuticIndication(); 865 } 866 else if (name.equals("otherTherapy")) { 867 return addOtherTherapy(); 868 } 869 else if (name.equals("population")) { 870 return addPopulation(); 871 } 872 else 873 return super.addChild(name); 874 } 875 876 public String fhirType() { 877 return "MedicinalProductContraindication"; 878 879 } 880 881 public MedicinalProductContraindication copy() { 882 MedicinalProductContraindication dst = new MedicinalProductContraindication(); 883 copyValues(dst); 884 if (subject != null) { 885 dst.subject = new ArrayList<Reference>(); 886 for (Reference i : subject) 887 dst.subject.add(i.copy()); 888 }; 889 dst.disease = disease == null ? null : disease.copy(); 890 dst.diseaseStatus = diseaseStatus == null ? null : diseaseStatus.copy(); 891 if (comorbidity != null) { 892 dst.comorbidity = new ArrayList<CodeableConcept>(); 893 for (CodeableConcept i : comorbidity) 894 dst.comorbidity.add(i.copy()); 895 }; 896 if (therapeuticIndication != null) { 897 dst.therapeuticIndication = new ArrayList<Reference>(); 898 for (Reference i : therapeuticIndication) 899 dst.therapeuticIndication.add(i.copy()); 900 }; 901 if (otherTherapy != null) { 902 dst.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>(); 903 for (MedicinalProductContraindicationOtherTherapyComponent i : otherTherapy) 904 dst.otherTherapy.add(i.copy()); 905 }; 906 if (population != null) { 907 dst.population = new ArrayList<Population>(); 908 for (Population i : population) 909 dst.population.add(i.copy()); 910 }; 911 return dst; 912 } 913 914 protected MedicinalProductContraindication typedCopy() { 915 return copy(); 916 } 917 918 @Override 919 public boolean equalsDeep(Base other_) { 920 if (!super.equalsDeep(other_)) 921 return false; 922 if (!(other_ instanceof MedicinalProductContraindication)) 923 return false; 924 MedicinalProductContraindication o = (MedicinalProductContraindication) other_; 925 return compareDeep(subject, o.subject, true) && compareDeep(disease, o.disease, true) && compareDeep(diseaseStatus, o.diseaseStatus, true) 926 && compareDeep(comorbidity, o.comorbidity, true) && compareDeep(therapeuticIndication, o.therapeuticIndication, true) 927 && compareDeep(otherTherapy, o.otherTherapy, true) && compareDeep(population, o.population, true) 928 ; 929 } 930 931 @Override 932 public boolean equalsShallow(Base other_) { 933 if (!super.equalsShallow(other_)) 934 return false; 935 if (!(other_ instanceof MedicinalProductContraindication)) 936 return false; 937 MedicinalProductContraindication o = (MedicinalProductContraindication) other_; 938 return true; 939 } 940 941 public boolean isEmpty() { 942 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, disease, diseaseStatus 943 , comorbidity, therapeuticIndication, otherTherapy, population); 944 } 945 946 @Override 947 public ResourceType getResourceType() { 948 return ResourceType.MedicinalProductContraindication; 949 } 950 951 /** 952 * Search parameter: <b>subject</b> 953 * <p> 954 * Description: <b>The medication for which this is an contraindication</b><br> 955 * Type: <b>reference</b><br> 956 * Path: <b>MedicinalProductContraindication.subject</b><br> 957 * </p> 958 */ 959 @SearchParamDefinition(name="subject", path="MedicinalProductContraindication.subject", description="The medication for which this is an contraindication", type="reference", target={Medication.class, MedicinalProduct.class } ) 960 public static final String SP_SUBJECT = "subject"; 961 /** 962 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 963 * <p> 964 * Description: <b>The medication for which this is an contraindication</b><br> 965 * Type: <b>reference</b><br> 966 * Path: <b>MedicinalProductContraindication.subject</b><br> 967 * </p> 968 */ 969 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 970 971/** 972 * Constant for fluent queries to be used to add include statements. Specifies 973 * the path value of "<b>MedicinalProductContraindication:subject</b>". 974 */ 975 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductContraindication:subject").toLocked(); 976 977 978} 979