001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.utilities.Utilities; 038 039import ca.uhn.fhir.model.api.annotation.*; 040/** 041 * Financial instrument which may be used to pay for or reimburse health care products and services. 042 */ 043@ResourceDef(name="Coverage", profile="http://hl7.org/fhir/Profile/Coverage") 044public class Coverage extends DomainResource { 045 046 /** 047 * The program or plan underwriter or payor. 048 */ 049 @Child(name = "issuer", type = {Organization.class}, order=0, min=0, max=1, modifier=false, summary=true) 050 @Description(shortDefinition="An identifier for the plan issuer", formalDefinition="The program or plan underwriter or payor." ) 051 protected Reference issuer; 052 053 /** 054 * The actual object that is the target of the reference (The program or plan underwriter or payor.) 055 */ 056 protected Organization issuerTarget; 057 058 /** 059 * Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business. 060 */ 061 @Child(name = "bin", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false) 062 @Description(shortDefinition="BIN Number", formalDefinition="Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business." ) 063 protected Identifier bin; 064 065 /** 066 * Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force. 067 */ 068 @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true) 069 @Description(shortDefinition="Coverage start and end dates", formalDefinition="Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force." ) 070 protected Period period; 071 072 /** 073 * The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health. 074 */ 075 @Child(name = "type", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true) 076 @Description(shortDefinition="Type of coverage", formalDefinition="The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health." ) 077 protected Coding type; 078 079 /** 080 * The id issued to the subscriber. 081 */ 082 @Child(name = "subscriberId", type = {Identifier.class}, order=4, min=0, max=1, modifier=false, summary=true) 083 @Description(shortDefinition="Subscriber ID", formalDefinition="The id issued to the subscriber." ) 084 protected Identifier subscriberId; 085 086 /** 087 * The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID. 088 */ 089 @Child(name = "identifier", type = {Identifier.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 090 @Description(shortDefinition="The primary coverage ID", formalDefinition="The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID." ) 091 protected List<Identifier> identifier; 092 093 /** 094 * Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID. 095 */ 096 @Child(name = "group", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true) 097 @Description(shortDefinition="An identifier for the group", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID." ) 098 protected StringType group; 099 100 /** 101 * Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID. 102 */ 103 @Child(name = "plan", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true) 104 @Description(shortDefinition="An identifier for the plan", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID." ) 105 protected StringType plan; 106 107 /** 108 * Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID. 109 */ 110 @Child(name = "subPlan", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true) 111 @Description(shortDefinition="An identifier for the subsection of the plan", formalDefinition="Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID." ) 112 protected StringType subPlan; 113 114 /** 115 * A unique identifier for a dependent under the coverage. 116 */ 117 @Child(name = "dependent", type = {PositiveIntType.class}, order=9, min=0, max=1, modifier=false, summary=true) 118 @Description(shortDefinition="The dependent number", formalDefinition="A unique identifier for a dependent under the coverage." ) 119 protected PositiveIntType dependent; 120 121 /** 122 * An optional counter for a particular instance of the identified coverage which increments upon each renewal. 123 */ 124 @Child(name = "sequence", type = {PositiveIntType.class}, order=10, min=0, max=1, modifier=false, summary=true) 125 @Description(shortDefinition="The plan instance or sequence counter", formalDefinition="An optional counter for a particular instance of the identified coverage which increments upon each renewal." ) 126 protected PositiveIntType sequence; 127 128 /** 129 * The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due. 130 */ 131 @Child(name = "subscriber", type = {Patient.class}, order=11, min=0, max=1, modifier=true, summary=false) 132 @Description(shortDefinition="Plan holder information", formalDefinition="The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due." ) 133 protected Reference subscriber; 134 135 /** 136 * The actual object that is the target of the reference (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.) 137 */ 138 protected Patient subscriberTarget; 139 140 /** 141 * The identifier for a community of providers. 142 */ 143 @Child(name = "network", type = {Identifier.class}, order=12, min=0, max=1, modifier=false, summary=true) 144 @Description(shortDefinition="Insurer network", formalDefinition="The identifier for a community of providers." ) 145 protected Identifier network; 146 147 /** 148 * The policy(s) which constitute this insurance coverage. 149 */ 150 @Child(name = "contract", type = {Contract.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 151 @Description(shortDefinition="Contract details", formalDefinition="The policy(s) which constitute this insurance coverage." ) 152 protected List<Reference> contract; 153 /** 154 * The actual objects that are the target of the reference (The policy(s) which constitute this insurance coverage.) 155 */ 156 protected List<Contract> contractTarget; 157 158 159 private static final long serialVersionUID = -1312031251L; 160 161 /* 162 * Constructor 163 */ 164 public Coverage() { 165 super(); 166 } 167 168 /** 169 * @return {@link #issuer} (The program or plan underwriter or payor.) 170 */ 171 public Reference getIssuer() { 172 if (this.issuer == null) 173 if (Configuration.errorOnAutoCreate()) 174 throw new Error("Attempt to auto-create Coverage.issuer"); 175 else if (Configuration.doAutoCreate()) 176 this.issuer = new Reference(); // cc 177 return this.issuer; 178 } 179 180 public boolean hasIssuer() { 181 return this.issuer != null && !this.issuer.isEmpty(); 182 } 183 184 /** 185 * @param value {@link #issuer} (The program or plan underwriter or payor.) 186 */ 187 public Coverage setIssuer(Reference value) { 188 this.issuer = value; 189 return this; 190 } 191 192 /** 193 * @return {@link #issuer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The program or plan underwriter or payor.) 194 */ 195 public Organization getIssuerTarget() { 196 if (this.issuerTarget == null) 197 if (Configuration.errorOnAutoCreate()) 198 throw new Error("Attempt to auto-create Coverage.issuer"); 199 else if (Configuration.doAutoCreate()) 200 this.issuerTarget = new Organization(); // aa 201 return this.issuerTarget; 202 } 203 204 /** 205 * @param value {@link #issuer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The program or plan underwriter or payor.) 206 */ 207 public Coverage setIssuerTarget(Organization value) { 208 this.issuerTarget = value; 209 return this; 210 } 211 212 /** 213 * @return {@link #bin} (Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.) 214 */ 215 public Identifier getBin() { 216 if (this.bin == null) 217 if (Configuration.errorOnAutoCreate()) 218 throw new Error("Attempt to auto-create Coverage.bin"); 219 else if (Configuration.doAutoCreate()) 220 this.bin = new Identifier(); // cc 221 return this.bin; 222 } 223 224 public boolean hasBin() { 225 return this.bin != null && !this.bin.isEmpty(); 226 } 227 228 /** 229 * @param value {@link #bin} (Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.) 230 */ 231 public Coverage setBin(Identifier value) { 232 this.bin = value; 233 return this; 234 } 235 236 /** 237 * @return {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.) 238 */ 239 public Period getPeriod() { 240 if (this.period == null) 241 if (Configuration.errorOnAutoCreate()) 242 throw new Error("Attempt to auto-create Coverage.period"); 243 else if (Configuration.doAutoCreate()) 244 this.period = new Period(); // cc 245 return this.period; 246 } 247 248 public boolean hasPeriod() { 249 return this.period != null && !this.period.isEmpty(); 250 } 251 252 /** 253 * @param value {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.) 254 */ 255 public Coverage setPeriod(Period value) { 256 this.period = value; 257 return this; 258 } 259 260 /** 261 * @return {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.) 262 */ 263 public Coding getType() { 264 if (this.type == null) 265 if (Configuration.errorOnAutoCreate()) 266 throw new Error("Attempt to auto-create Coverage.type"); 267 else if (Configuration.doAutoCreate()) 268 this.type = new Coding(); // cc 269 return this.type; 270 } 271 272 public boolean hasType() { 273 return this.type != null && !this.type.isEmpty(); 274 } 275 276 /** 277 * @param value {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.) 278 */ 279 public Coverage setType(Coding value) { 280 this.type = value; 281 return this; 282 } 283 284 /** 285 * @return {@link #subscriberId} (The id issued to the subscriber.) 286 */ 287 public Identifier getSubscriberId() { 288 if (this.subscriberId == null) 289 if (Configuration.errorOnAutoCreate()) 290 throw new Error("Attempt to auto-create Coverage.subscriberId"); 291 else if (Configuration.doAutoCreate()) 292 this.subscriberId = new Identifier(); // cc 293 return this.subscriberId; 294 } 295 296 public boolean hasSubscriberId() { 297 return this.subscriberId != null && !this.subscriberId.isEmpty(); 298 } 299 300 /** 301 * @param value {@link #subscriberId} (The id issued to the subscriber.) 302 */ 303 public Coverage setSubscriberId(Identifier value) { 304 this.subscriberId = value; 305 return this; 306 } 307 308 /** 309 * @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.) 310 */ 311 public List<Identifier> getIdentifier() { 312 if (this.identifier == null) 313 this.identifier = new ArrayList<Identifier>(); 314 return this.identifier; 315 } 316 317 public boolean hasIdentifier() { 318 if (this.identifier == null) 319 return false; 320 for (Identifier item : this.identifier) 321 if (!item.isEmpty()) 322 return true; 323 return false; 324 } 325 326 /** 327 * @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.) 328 */ 329 // syntactic sugar 330 public Identifier addIdentifier() { //3 331 Identifier t = new Identifier(); 332 if (this.identifier == null) 333 this.identifier = new ArrayList<Identifier>(); 334 this.identifier.add(t); 335 return t; 336 } 337 338 // syntactic sugar 339 public Coverage addIdentifier(Identifier t) { //3 340 if (t == null) 341 return this; 342 if (this.identifier == null) 343 this.identifier = new ArrayList<Identifier>(); 344 this.identifier.add(t); 345 return this; 346 } 347 348 /** 349 * @return {@link #group} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value 350 */ 351 public StringType getGroupElement() { 352 if (this.group == null) 353 if (Configuration.errorOnAutoCreate()) 354 throw new Error("Attempt to auto-create Coverage.group"); 355 else if (Configuration.doAutoCreate()) 356 this.group = new StringType(); // bb 357 return this.group; 358 } 359 360 public boolean hasGroupElement() { 361 return this.group != null && !this.group.isEmpty(); 362 } 363 364 public boolean hasGroup() { 365 return this.group != null && !this.group.isEmpty(); 366 } 367 368 /** 369 * @param value {@link #group} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value 370 */ 371 public Coverage setGroupElement(StringType value) { 372 this.group = value; 373 return this; 374 } 375 376 /** 377 * @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID. 378 */ 379 public String getGroup() { 380 return this.group == null ? null : this.group.getValue(); 381 } 382 383 /** 384 * @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID. 385 */ 386 public Coverage setGroup(String value) { 387 if (Utilities.noString(value)) 388 this.group = null; 389 else { 390 if (this.group == null) 391 this.group = new StringType(); 392 this.group.setValue(value); 393 } 394 return this; 395 } 396 397 /** 398 * @return {@link #plan} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value 399 */ 400 public StringType getPlanElement() { 401 if (this.plan == null) 402 if (Configuration.errorOnAutoCreate()) 403 throw new Error("Attempt to auto-create Coverage.plan"); 404 else if (Configuration.doAutoCreate()) 405 this.plan = new StringType(); // bb 406 return this.plan; 407 } 408 409 public boolean hasPlanElement() { 410 return this.plan != null && !this.plan.isEmpty(); 411 } 412 413 public boolean hasPlan() { 414 return this.plan != null && !this.plan.isEmpty(); 415 } 416 417 /** 418 * @param value {@link #plan} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value 419 */ 420 public Coverage setPlanElement(StringType value) { 421 this.plan = value; 422 return this; 423 } 424 425 /** 426 * @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID. 427 */ 428 public String getPlan() { 429 return this.plan == null ? null : this.plan.getValue(); 430 } 431 432 /** 433 * @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID. 434 */ 435 public Coverage setPlan(String value) { 436 if (Utilities.noString(value)) 437 this.plan = null; 438 else { 439 if (this.plan == null) 440 this.plan = new StringType(); 441 this.plan.setValue(value); 442 } 443 return this; 444 } 445 446 /** 447 * @return {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value 448 */ 449 public StringType getSubPlanElement() { 450 if (this.subPlan == null) 451 if (Configuration.errorOnAutoCreate()) 452 throw new Error("Attempt to auto-create Coverage.subPlan"); 453 else if (Configuration.doAutoCreate()) 454 this.subPlan = new StringType(); // bb 455 return this.subPlan; 456 } 457 458 public boolean hasSubPlanElement() { 459 return this.subPlan != null && !this.subPlan.isEmpty(); 460 } 461 462 public boolean hasSubPlan() { 463 return this.subPlan != null && !this.subPlan.isEmpty(); 464 } 465 466 /** 467 * @param value {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value 468 */ 469 public Coverage setSubPlanElement(StringType value) { 470 this.subPlan = value; 471 return this; 472 } 473 474 /** 475 * @return Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID. 476 */ 477 public String getSubPlan() { 478 return this.subPlan == null ? null : this.subPlan.getValue(); 479 } 480 481 /** 482 * @param value Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID. 483 */ 484 public Coverage setSubPlan(String value) { 485 if (Utilities.noString(value)) 486 this.subPlan = null; 487 else { 488 if (this.subPlan == null) 489 this.subPlan = new StringType(); 490 this.subPlan.setValue(value); 491 } 492 return this; 493 } 494 495 /** 496 * @return {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value 497 */ 498 public PositiveIntType getDependentElement() { 499 if (this.dependent == null) 500 if (Configuration.errorOnAutoCreate()) 501 throw new Error("Attempt to auto-create Coverage.dependent"); 502 else if (Configuration.doAutoCreate()) 503 this.dependent = new PositiveIntType(); // bb 504 return this.dependent; 505 } 506 507 public boolean hasDependentElement() { 508 return this.dependent != null && !this.dependent.isEmpty(); 509 } 510 511 public boolean hasDependent() { 512 return this.dependent != null && !this.dependent.isEmpty(); 513 } 514 515 /** 516 * @param value {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value 517 */ 518 public Coverage setDependentElement(PositiveIntType value) { 519 this.dependent = value; 520 return this; 521 } 522 523 /** 524 * @return A unique identifier for a dependent under the coverage. 525 */ 526 public int getDependent() { 527 return this.dependent == null || this.dependent.isEmpty() ? 0 : this.dependent.getValue(); 528 } 529 530 /** 531 * @param value A unique identifier for a dependent under the coverage. 532 */ 533 public Coverage setDependent(int value) { 534 if (this.dependent == null) 535 this.dependent = new PositiveIntType(); 536 this.dependent.setValue(value); 537 return this; 538 } 539 540 /** 541 * @return {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value 542 */ 543 public PositiveIntType getSequenceElement() { 544 if (this.sequence == null) 545 if (Configuration.errorOnAutoCreate()) 546 throw new Error("Attempt to auto-create Coverage.sequence"); 547 else if (Configuration.doAutoCreate()) 548 this.sequence = new PositiveIntType(); // bb 549 return this.sequence; 550 } 551 552 public boolean hasSequenceElement() { 553 return this.sequence != null && !this.sequence.isEmpty(); 554 } 555 556 public boolean hasSequence() { 557 return this.sequence != null && !this.sequence.isEmpty(); 558 } 559 560 /** 561 * @param value {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value 562 */ 563 public Coverage setSequenceElement(PositiveIntType value) { 564 this.sequence = value; 565 return this; 566 } 567 568 /** 569 * @return An optional counter for a particular instance of the identified coverage which increments upon each renewal. 570 */ 571 public int getSequence() { 572 return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue(); 573 } 574 575 /** 576 * @param value An optional counter for a particular instance of the identified coverage which increments upon each renewal. 577 */ 578 public Coverage setSequence(int value) { 579 if (this.sequence == null) 580 this.sequence = new PositiveIntType(); 581 this.sequence.setValue(value); 582 return this; 583 } 584 585 /** 586 * @return {@link #subscriber} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.) 587 */ 588 public Reference getSubscriber() { 589 if (this.subscriber == null) 590 if (Configuration.errorOnAutoCreate()) 591 throw new Error("Attempt to auto-create Coverage.subscriber"); 592 else if (Configuration.doAutoCreate()) 593 this.subscriber = new Reference(); // cc 594 return this.subscriber; 595 } 596 597 public boolean hasSubscriber() { 598 return this.subscriber != null && !this.subscriber.isEmpty(); 599 } 600 601 /** 602 * @param value {@link #subscriber} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.) 603 */ 604 public Coverage setSubscriber(Reference value) { 605 this.subscriber = value; 606 return this; 607 } 608 609 /** 610 * @return {@link #subscriber} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.) 611 */ 612 public Patient getSubscriberTarget() { 613 if (this.subscriberTarget == null) 614 if (Configuration.errorOnAutoCreate()) 615 throw new Error("Attempt to auto-create Coverage.subscriber"); 616 else if (Configuration.doAutoCreate()) 617 this.subscriberTarget = new Patient(); // aa 618 return this.subscriberTarget; 619 } 620 621 /** 622 * @param value {@link #subscriber} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.) 623 */ 624 public Coverage setSubscriberTarget(Patient value) { 625 this.subscriberTarget = value; 626 return this; 627 } 628 629 /** 630 * @return {@link #network} (The identifier for a community of providers.) 631 */ 632 public Identifier getNetwork() { 633 if (this.network == null) 634 if (Configuration.errorOnAutoCreate()) 635 throw new Error("Attempt to auto-create Coverage.network"); 636 else if (Configuration.doAutoCreate()) 637 this.network = new Identifier(); // cc 638 return this.network; 639 } 640 641 public boolean hasNetwork() { 642 return this.network != null && !this.network.isEmpty(); 643 } 644 645 /** 646 * @param value {@link #network} (The identifier for a community of providers.) 647 */ 648 public Coverage setNetwork(Identifier value) { 649 this.network = value; 650 return this; 651 } 652 653 /** 654 * @return {@link #contract} (The policy(s) which constitute this insurance coverage.) 655 */ 656 public List<Reference> getContract() { 657 if (this.contract == null) 658 this.contract = new ArrayList<Reference>(); 659 return this.contract; 660 } 661 662 public boolean hasContract() { 663 if (this.contract == null) 664 return false; 665 for (Reference item : this.contract) 666 if (!item.isEmpty()) 667 return true; 668 return false; 669 } 670 671 /** 672 * @return {@link #contract} (The policy(s) which constitute this insurance coverage.) 673 */ 674 // syntactic sugar 675 public Reference addContract() { //3 676 Reference t = new Reference(); 677 if (this.contract == null) 678 this.contract = new ArrayList<Reference>(); 679 this.contract.add(t); 680 return t; 681 } 682 683 // syntactic sugar 684 public Coverage addContract(Reference t) { //3 685 if (t == null) 686 return this; 687 if (this.contract == null) 688 this.contract = new ArrayList<Reference>(); 689 this.contract.add(t); 690 return this; 691 } 692 693 /** 694 * @return {@link #contract} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The policy(s) which constitute this insurance coverage.) 695 */ 696 public List<Contract> getContractTarget() { 697 if (this.contractTarget == null) 698 this.contractTarget = new ArrayList<Contract>(); 699 return this.contractTarget; 700 } 701 702 // syntactic sugar 703 /** 704 * @return {@link #contract} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The policy(s) which constitute this insurance coverage.) 705 */ 706 public Contract addContractTarget() { 707 Contract r = new Contract(); 708 if (this.contractTarget == null) 709 this.contractTarget = new ArrayList<Contract>(); 710 this.contractTarget.add(r); 711 return r; 712 } 713 714 protected void listChildren(List<Property> childrenList) { 715 super.listChildren(childrenList); 716 childrenList.add(new Property("issuer", "Reference(Organization)", "The program or plan underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, issuer)); 717 childrenList.add(new Property("bin", "Identifier", "Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.", 0, java.lang.Integer.MAX_VALUE, bin)); 718 childrenList.add(new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, java.lang.Integer.MAX_VALUE, period)); 719 childrenList.add(new Property("type", "Coding", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.", 0, java.lang.Integer.MAX_VALUE, type)); 720 childrenList.add(new Property("subscriberId", "Identifier", "The id issued to the subscriber.", 0, java.lang.Integer.MAX_VALUE, subscriberId)); 721 childrenList.add(new Property("identifier", "Identifier", "The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.", 0, java.lang.Integer.MAX_VALUE, identifier)); 722 childrenList.add(new Property("group", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.", 0, java.lang.Integer.MAX_VALUE, group)); 723 childrenList.add(new Property("plan", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.", 0, java.lang.Integer.MAX_VALUE, plan)); 724 childrenList.add(new Property("subPlan", "string", "Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.", 0, java.lang.Integer.MAX_VALUE, subPlan)); 725 childrenList.add(new Property("dependent", "positiveInt", "A unique identifier for a dependent under the coverage.", 0, java.lang.Integer.MAX_VALUE, dependent)); 726 childrenList.add(new Property("sequence", "positiveInt", "An optional counter for a particular instance of the identified coverage which increments upon each renewal.", 0, java.lang.Integer.MAX_VALUE, sequence)); 727 childrenList.add(new Property("subscriber", "Reference(Patient)", "The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.", 0, java.lang.Integer.MAX_VALUE, subscriber)); 728 childrenList.add(new Property("network", "Identifier", "The identifier for a community of providers.", 0, java.lang.Integer.MAX_VALUE, network)); 729 childrenList.add(new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract)); 730 } 731 732 @Override 733 public void setProperty(String name, Base value) throws FHIRException { 734 if (name.equals("issuer")) 735 this.issuer = castToReference(value); // Reference 736 else if (name.equals("bin")) 737 this.bin = castToIdentifier(value); // Identifier 738 else if (name.equals("period")) 739 this.period = castToPeriod(value); // Period 740 else if (name.equals("type")) 741 this.type = castToCoding(value); // Coding 742 else if (name.equals("subscriberId")) 743 this.subscriberId = castToIdentifier(value); // Identifier 744 else if (name.equals("identifier")) 745 this.getIdentifier().add(castToIdentifier(value)); 746 else if (name.equals("group")) 747 this.group = castToString(value); // StringType 748 else if (name.equals("plan")) 749 this.plan = castToString(value); // StringType 750 else if (name.equals("subPlan")) 751 this.subPlan = castToString(value); // StringType 752 else if (name.equals("dependent")) 753 this.dependent = castToPositiveInt(value); // PositiveIntType 754 else if (name.equals("sequence")) 755 this.sequence = castToPositiveInt(value); // PositiveIntType 756 else if (name.equals("subscriber")) 757 this.subscriber = castToReference(value); // Reference 758 else if (name.equals("network")) 759 this.network = castToIdentifier(value); // Identifier 760 else if (name.equals("contract")) 761 this.getContract().add(castToReference(value)); 762 else 763 super.setProperty(name, value); 764 } 765 766 @Override 767 public Base addChild(String name) throws FHIRException { 768 if (name.equals("issuer")) { 769 this.issuer = new Reference(); 770 return this.issuer; 771 } 772 else if (name.equals("bin")) { 773 this.bin = new Identifier(); 774 return this.bin; 775 } 776 else if (name.equals("period")) { 777 this.period = new Period(); 778 return this.period; 779 } 780 else if (name.equals("type")) { 781 this.type = new Coding(); 782 return this.type; 783 } 784 else if (name.equals("subscriberId")) { 785 this.subscriberId = new Identifier(); 786 return this.subscriberId; 787 } 788 else if (name.equals("identifier")) { 789 return addIdentifier(); 790 } 791 else if (name.equals("group")) { 792 throw new FHIRException("Cannot call addChild on a primitive type Coverage.group"); 793 } 794 else if (name.equals("plan")) { 795 throw new FHIRException("Cannot call addChild on a primitive type Coverage.plan"); 796 } 797 else if (name.equals("subPlan")) { 798 throw new FHIRException("Cannot call addChild on a primitive type Coverage.subPlan"); 799 } 800 else if (name.equals("dependent")) { 801 throw new FHIRException("Cannot call addChild on a primitive type Coverage.dependent"); 802 } 803 else if (name.equals("sequence")) { 804 throw new FHIRException("Cannot call addChild on a primitive type Coverage.sequence"); 805 } 806 else if (name.equals("subscriber")) { 807 this.subscriber = new Reference(); 808 return this.subscriber; 809 } 810 else if (name.equals("network")) { 811 this.network = new Identifier(); 812 return this.network; 813 } 814 else if (name.equals("contract")) { 815 return addContract(); 816 } 817 else 818 return super.addChild(name); 819 } 820 821 public String fhirType() { 822 return "Coverage"; 823 824 } 825 826 public Coverage copy() { 827 Coverage dst = new Coverage(); 828 copyValues(dst); 829 dst.issuer = issuer == null ? null : issuer.copy(); 830 dst.bin = bin == null ? null : bin.copy(); 831 dst.period = period == null ? null : period.copy(); 832 dst.type = type == null ? null : type.copy(); 833 dst.subscriberId = subscriberId == null ? null : subscriberId.copy(); 834 if (identifier != null) { 835 dst.identifier = new ArrayList<Identifier>(); 836 for (Identifier i : identifier) 837 dst.identifier.add(i.copy()); 838 }; 839 dst.group = group == null ? null : group.copy(); 840 dst.plan = plan == null ? null : plan.copy(); 841 dst.subPlan = subPlan == null ? null : subPlan.copy(); 842 dst.dependent = dependent == null ? null : dependent.copy(); 843 dst.sequence = sequence == null ? null : sequence.copy(); 844 dst.subscriber = subscriber == null ? null : subscriber.copy(); 845 dst.network = network == null ? null : network.copy(); 846 if (contract != null) { 847 dst.contract = new ArrayList<Reference>(); 848 for (Reference i : contract) 849 dst.contract.add(i.copy()); 850 }; 851 return dst; 852 } 853 854 protected Coverage typedCopy() { 855 return copy(); 856 } 857 858 @Override 859 public boolean equalsDeep(Base other) { 860 if (!super.equalsDeep(other)) 861 return false; 862 if (!(other instanceof Coverage)) 863 return false; 864 Coverage o = (Coverage) other; 865 return compareDeep(issuer, o.issuer, true) && compareDeep(bin, o.bin, true) && compareDeep(period, o.period, true) 866 && compareDeep(type, o.type, true) && compareDeep(subscriberId, o.subscriberId, true) && compareDeep(identifier, o.identifier, true) 867 && compareDeep(group, o.group, true) && compareDeep(plan, o.plan, true) && compareDeep(subPlan, o.subPlan, true) 868 && compareDeep(dependent, o.dependent, true) && compareDeep(sequence, o.sequence, true) && compareDeep(subscriber, o.subscriber, true) 869 && compareDeep(network, o.network, true) && compareDeep(contract, o.contract, true); 870 } 871 872 @Override 873 public boolean equalsShallow(Base other) { 874 if (!super.equalsShallow(other)) 875 return false; 876 if (!(other instanceof Coverage)) 877 return false; 878 Coverage o = (Coverage) other; 879 return compareValues(group, o.group, true) && compareValues(plan, o.plan, true) && compareValues(subPlan, o.subPlan, true) 880 && compareValues(dependent, o.dependent, true) && compareValues(sequence, o.sequence, true); 881 } 882 883 public boolean isEmpty() { 884 return super.isEmpty() && (issuer == null || issuer.isEmpty()) && (bin == null || bin.isEmpty()) 885 && (period == null || period.isEmpty()) && (type == null || type.isEmpty()) && (subscriberId == null || subscriberId.isEmpty()) 886 && (identifier == null || identifier.isEmpty()) && (group == null || group.isEmpty()) && (plan == null || plan.isEmpty()) 887 && (subPlan == null || subPlan.isEmpty()) && (dependent == null || dependent.isEmpty()) && (sequence == null || sequence.isEmpty()) 888 && (subscriber == null || subscriber.isEmpty()) && (network == null || network.isEmpty()) 889 && (contract == null || contract.isEmpty()); 890 } 891 892 @Override 893 public ResourceType getResourceType() { 894 return ResourceType.Coverage; 895 } 896 897 @SearchParamDefinition(name="identifier", path="Coverage.identifier", description="The primary identifier of the insured", type="token" ) 898 public static final String SP_IDENTIFIER = "identifier"; 899 @SearchParamDefinition(name="sequence", path="Coverage.sequence", description="Sequence number", type="token" ) 900 public static final String SP_SEQUENCE = "sequence"; 901 @SearchParamDefinition(name="subplan", path="Coverage.subPlan", description="Sub-plan identifier", type="token" ) 902 public static final String SP_SUBPLAN = "subplan"; 903 @SearchParamDefinition(name="type", path="Coverage.type", description="The kind of coverage", type="token" ) 904 public static final String SP_TYPE = "type"; 905 @SearchParamDefinition(name="plan", path="Coverage.plan", description="A plan or policy identifier", type="token" ) 906 public static final String SP_PLAN = "plan"; 907 @SearchParamDefinition(name="dependent", path="Coverage.dependent", description="Dependent number", type="token" ) 908 public static final String SP_DEPENDENT = "dependent"; 909 @SearchParamDefinition(name="issuer", path="Coverage.issuer", description="The identity of the insurer", type="reference" ) 910 public static final String SP_ISSUER = "issuer"; 911 @SearchParamDefinition(name="group", path="Coverage.group", description="Group identifier", type="token" ) 912 public static final String SP_GROUP = "group"; 913 914} 915