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.*; 034 035import org.hl7.fhir.exceptions.FHIRException; 036 037import ca.uhn.fhir.model.api.annotation.*; 038/** 039 * This resource provides the insurance eligibility details from the insurer regarding a specified coverage and optionally some class of service. 040 */ 041@ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest") 042public class EligibilityRequest extends DomainResource { 043 044 /** 045 * The Response business identifier. 046 */ 047 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 048 @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." ) 049 protected List<Identifier> identifier; 050 051 /** 052 * The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources. 053 */ 054 @Child(name = "ruleset", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true) 055 @Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." ) 056 protected Coding ruleset; 057 058 /** 059 * The style (standard) and version of the original material which was converted into this resource. 060 */ 061 @Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true) 062 @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." ) 063 protected Coding originalRuleset; 064 065 /** 066 * The date when this resource was created. 067 */ 068 @Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true) 069 @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." ) 070 protected DateTimeType created; 071 072 /** 073 * The Insurer who is target of the request. 074 */ 075 @Child(name = "target", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true) 076 @Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." ) 077 protected Reference target; 078 079 /** 080 * The actual object that is the target of the reference (The Insurer who is target of the request.) 081 */ 082 protected Organization targetTarget; 083 084 /** 085 * The practitioner who is responsible for the services rendered to the patient. 086 */ 087 @Child(name = "provider", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true) 088 @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." ) 089 protected Reference provider; 090 091 /** 092 * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.) 093 */ 094 protected Practitioner providerTarget; 095 096 /** 097 * The organization which is responsible for the services rendered to the patient. 098 */ 099 @Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true) 100 @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." ) 101 protected Reference organization; 102 103 /** 104 * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.) 105 */ 106 protected Organization organizationTarget; 107 108 private static final long serialVersionUID = 1836339504L; 109 110 /* 111 * Constructor 112 */ 113 public EligibilityRequest() { 114 super(); 115 } 116 117 /** 118 * @return {@link #identifier} (The Response business identifier.) 119 */ 120 public List<Identifier> getIdentifier() { 121 if (this.identifier == null) 122 this.identifier = new ArrayList<Identifier>(); 123 return this.identifier; 124 } 125 126 public boolean hasIdentifier() { 127 if (this.identifier == null) 128 return false; 129 for (Identifier item : this.identifier) 130 if (!item.isEmpty()) 131 return true; 132 return false; 133 } 134 135 /** 136 * @return {@link #identifier} (The Response business identifier.) 137 */ 138 // syntactic sugar 139 public Identifier addIdentifier() { //3 140 Identifier t = new Identifier(); 141 if (this.identifier == null) 142 this.identifier = new ArrayList<Identifier>(); 143 this.identifier.add(t); 144 return t; 145 } 146 147 // syntactic sugar 148 public EligibilityRequest addIdentifier(Identifier t) { //3 149 if (t == null) 150 return this; 151 if (this.identifier == null) 152 this.identifier = new ArrayList<Identifier>(); 153 this.identifier.add(t); 154 return this; 155 } 156 157 /** 158 * @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.) 159 */ 160 public Coding getRuleset() { 161 if (this.ruleset == null) 162 if (Configuration.errorOnAutoCreate()) 163 throw new Error("Attempt to auto-create EligibilityRequest.ruleset"); 164 else if (Configuration.doAutoCreate()) 165 this.ruleset = new Coding(); // cc 166 return this.ruleset; 167 } 168 169 public boolean hasRuleset() { 170 return this.ruleset != null && !this.ruleset.isEmpty(); 171 } 172 173 /** 174 * @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.) 175 */ 176 public EligibilityRequest setRuleset(Coding value) { 177 this.ruleset = value; 178 return this; 179 } 180 181 /** 182 * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.) 183 */ 184 public Coding getOriginalRuleset() { 185 if (this.originalRuleset == null) 186 if (Configuration.errorOnAutoCreate()) 187 throw new Error("Attempt to auto-create EligibilityRequest.originalRuleset"); 188 else if (Configuration.doAutoCreate()) 189 this.originalRuleset = new Coding(); // cc 190 return this.originalRuleset; 191 } 192 193 public boolean hasOriginalRuleset() { 194 return this.originalRuleset != null && !this.originalRuleset.isEmpty(); 195 } 196 197 /** 198 * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.) 199 */ 200 public EligibilityRequest setOriginalRuleset(Coding value) { 201 this.originalRuleset = value; 202 return this; 203 } 204 205 /** 206 * @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value 207 */ 208 public DateTimeType getCreatedElement() { 209 if (this.created == null) 210 if (Configuration.errorOnAutoCreate()) 211 throw new Error("Attempt to auto-create EligibilityRequest.created"); 212 else if (Configuration.doAutoCreate()) 213 this.created = new DateTimeType(); // bb 214 return this.created; 215 } 216 217 public boolean hasCreatedElement() { 218 return this.created != null && !this.created.isEmpty(); 219 } 220 221 public boolean hasCreated() { 222 return this.created != null && !this.created.isEmpty(); 223 } 224 225 /** 226 * @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value 227 */ 228 public EligibilityRequest setCreatedElement(DateTimeType value) { 229 this.created = value; 230 return this; 231 } 232 233 /** 234 * @return The date when this resource was created. 235 */ 236 public Date getCreated() { 237 return this.created == null ? null : this.created.getValue(); 238 } 239 240 /** 241 * @param value The date when this resource was created. 242 */ 243 public EligibilityRequest setCreated(Date value) { 244 if (value == null) 245 this.created = null; 246 else { 247 if (this.created == null) 248 this.created = new DateTimeType(); 249 this.created.setValue(value); 250 } 251 return this; 252 } 253 254 /** 255 * @return {@link #target} (The Insurer who is target of the request.) 256 */ 257 public Reference getTarget() { 258 if (this.target == null) 259 if (Configuration.errorOnAutoCreate()) 260 throw new Error("Attempt to auto-create EligibilityRequest.target"); 261 else if (Configuration.doAutoCreate()) 262 this.target = new Reference(); // cc 263 return this.target; 264 } 265 266 public boolean hasTarget() { 267 return this.target != null && !this.target.isEmpty(); 268 } 269 270 /** 271 * @param value {@link #target} (The Insurer who is target of the request.) 272 */ 273 public EligibilityRequest setTarget(Reference value) { 274 this.target = value; 275 return this; 276 } 277 278 /** 279 * @return {@link #target} 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 Insurer who is target of the request.) 280 */ 281 public Organization getTargetTarget() { 282 if (this.targetTarget == null) 283 if (Configuration.errorOnAutoCreate()) 284 throw new Error("Attempt to auto-create EligibilityRequest.target"); 285 else if (Configuration.doAutoCreate()) 286 this.targetTarget = new Organization(); // aa 287 return this.targetTarget; 288 } 289 290 /** 291 * @param value {@link #target} 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 Insurer who is target of the request.) 292 */ 293 public EligibilityRequest setTargetTarget(Organization value) { 294 this.targetTarget = value; 295 return this; 296 } 297 298 /** 299 * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.) 300 */ 301 public Reference getProvider() { 302 if (this.provider == null) 303 if (Configuration.errorOnAutoCreate()) 304 throw new Error("Attempt to auto-create EligibilityRequest.provider"); 305 else if (Configuration.doAutoCreate()) 306 this.provider = new Reference(); // cc 307 return this.provider; 308 } 309 310 public boolean hasProvider() { 311 return this.provider != null && !this.provider.isEmpty(); 312 } 313 314 /** 315 * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.) 316 */ 317 public EligibilityRequest setProvider(Reference value) { 318 this.provider = value; 319 return this; 320 } 321 322 /** 323 * @return {@link #provider} 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 practitioner who is responsible for the services rendered to the patient.) 324 */ 325 public Practitioner getProviderTarget() { 326 if (this.providerTarget == null) 327 if (Configuration.errorOnAutoCreate()) 328 throw new Error("Attempt to auto-create EligibilityRequest.provider"); 329 else if (Configuration.doAutoCreate()) 330 this.providerTarget = new Practitioner(); // aa 331 return this.providerTarget; 332 } 333 334 /** 335 * @param value {@link #provider} 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 practitioner who is responsible for the services rendered to the patient.) 336 */ 337 public EligibilityRequest setProviderTarget(Practitioner value) { 338 this.providerTarget = value; 339 return this; 340 } 341 342 /** 343 * @return {@link #organization} (The organization which is responsible for the services rendered to the patient.) 344 */ 345 public Reference getOrganization() { 346 if (this.organization == null) 347 if (Configuration.errorOnAutoCreate()) 348 throw new Error("Attempt to auto-create EligibilityRequest.organization"); 349 else if (Configuration.doAutoCreate()) 350 this.organization = new Reference(); // cc 351 return this.organization; 352 } 353 354 public boolean hasOrganization() { 355 return this.organization != null && !this.organization.isEmpty(); 356 } 357 358 /** 359 * @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.) 360 */ 361 public EligibilityRequest setOrganization(Reference value) { 362 this.organization = value; 363 return this; 364 } 365 366 /** 367 * @return {@link #organization} 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 organization which is responsible for the services rendered to the patient.) 368 */ 369 public Organization getOrganizationTarget() { 370 if (this.organizationTarget == null) 371 if (Configuration.errorOnAutoCreate()) 372 throw new Error("Attempt to auto-create EligibilityRequest.organization"); 373 else if (Configuration.doAutoCreate()) 374 this.organizationTarget = new Organization(); // aa 375 return this.organizationTarget; 376 } 377 378 /** 379 * @param value {@link #organization} 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 organization which is responsible for the services rendered to the patient.) 380 */ 381 public EligibilityRequest setOrganizationTarget(Organization value) { 382 this.organizationTarget = value; 383 return this; 384 } 385 386 protected void listChildren(List<Property> childrenList) { 387 super.listChildren(childrenList); 388 childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier)); 389 childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset)); 390 childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset)); 391 childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created)); 392 childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target of the request.", 0, java.lang.Integer.MAX_VALUE, target)); 393 childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider)); 394 childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization)); 395 } 396 397 @Override 398 public void setProperty(String name, Base value) throws FHIRException { 399 if (name.equals("identifier")) 400 this.getIdentifier().add(castToIdentifier(value)); 401 else if (name.equals("ruleset")) 402 this.ruleset = castToCoding(value); // Coding 403 else if (name.equals("originalRuleset")) 404 this.originalRuleset = castToCoding(value); // Coding 405 else if (name.equals("created")) 406 this.created = castToDateTime(value); // DateTimeType 407 else if (name.equals("target")) 408 this.target = castToReference(value); // Reference 409 else if (name.equals("provider")) 410 this.provider = castToReference(value); // Reference 411 else if (name.equals("organization")) 412 this.organization = castToReference(value); // Reference 413 else 414 super.setProperty(name, value); 415 } 416 417 @Override 418 public Base addChild(String name) throws FHIRException { 419 if (name.equals("identifier")) { 420 return addIdentifier(); 421 } 422 else if (name.equals("ruleset")) { 423 this.ruleset = new Coding(); 424 return this.ruleset; 425 } 426 else if (name.equals("originalRuleset")) { 427 this.originalRuleset = new Coding(); 428 return this.originalRuleset; 429 } 430 else if (name.equals("created")) { 431 throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.created"); 432 } 433 else if (name.equals("target")) { 434 this.target = new Reference(); 435 return this.target; 436 } 437 else if (name.equals("provider")) { 438 this.provider = new Reference(); 439 return this.provider; 440 } 441 else if (name.equals("organization")) { 442 this.organization = new Reference(); 443 return this.organization; 444 } 445 else 446 return super.addChild(name); 447 } 448 449 public String fhirType() { 450 return "EligibilityRequest"; 451 452 } 453 454 public EligibilityRequest copy() { 455 EligibilityRequest dst = new EligibilityRequest(); 456 copyValues(dst); 457 if (identifier != null) { 458 dst.identifier = new ArrayList<Identifier>(); 459 for (Identifier i : identifier) 460 dst.identifier.add(i.copy()); 461 }; 462 dst.ruleset = ruleset == null ? null : ruleset.copy(); 463 dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy(); 464 dst.created = created == null ? null : created.copy(); 465 dst.target = target == null ? null : target.copy(); 466 dst.provider = provider == null ? null : provider.copy(); 467 dst.organization = organization == null ? null : organization.copy(); 468 return dst; 469 } 470 471 protected EligibilityRequest typedCopy() { 472 return copy(); 473 } 474 475 @Override 476 public boolean equalsDeep(Base other) { 477 if (!super.equalsDeep(other)) 478 return false; 479 if (!(other instanceof EligibilityRequest)) 480 return false; 481 EligibilityRequest o = (EligibilityRequest) other; 482 return compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true) 483 && compareDeep(created, o.created, true) && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true) 484 && compareDeep(organization, o.organization, true); 485 } 486 487 @Override 488 public boolean equalsShallow(Base other) { 489 if (!super.equalsShallow(other)) 490 return false; 491 if (!(other instanceof EligibilityRequest)) 492 return false; 493 EligibilityRequest o = (EligibilityRequest) other; 494 return compareValues(created, o.created, true); 495 } 496 497 public boolean isEmpty() { 498 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (ruleset == null || ruleset.isEmpty()) 499 && (originalRuleset == null || originalRuleset.isEmpty()) && (created == null || created.isEmpty()) 500 && (target == null || target.isEmpty()) && (provider == null || provider.isEmpty()) && (organization == null || organization.isEmpty()) 501 ; 502 } 503 504 @Override 505 public ResourceType getResourceType() { 506 return ResourceType.EligibilityRequest; 507 } 508 509 @SearchParamDefinition(name="identifier", path="EligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" ) 510 public static final String SP_IDENTIFIER = "identifier"; 511 512} 513