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