001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.List; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.Description; 041import ca.uhn.fhir.model.api.annotation.ResourceDef; 042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 043import org.hl7.fhir.exceptions.FHIRException; 044import org.hl7.fhir.utilities.Utilities; 045/** 046 * A financial tool for tracking value accrued for a particular purpose. In the healthcare field, used to track charges for a patient, cost centres, etc. 047 */ 048@ResourceDef(name="Account", profile="http://hl7.org/fhir/Profile/Account") 049public class Account extends DomainResource { 050 051 public enum AccountStatus { 052 /** 053 * This account is active and may be used. 054 */ 055 ACTIVE, 056 /** 057 * This account is inactive and should not be used to track financial information. 058 */ 059 INACTIVE, 060 /** 061 * added to help the parsers 062 */ 063 NULL; 064 public static AccountStatus fromCode(String codeString) throws FHIRException { 065 if (codeString == null || "".equals(codeString)) 066 return null; 067 if ("active".equals(codeString)) 068 return ACTIVE; 069 if ("inactive".equals(codeString)) 070 return INACTIVE; 071 throw new FHIRException("Unknown AccountStatus code '"+codeString+"'"); 072 } 073 public String toCode() { 074 switch (this) { 075 case ACTIVE: return "active"; 076 case INACTIVE: return "inactive"; 077 case NULL: return null; 078 default: return "?"; 079 } 080 } 081 public String getSystem() { 082 switch (this) { 083 case ACTIVE: return "http://hl7.org/fhir/account-status"; 084 case INACTIVE: return "http://hl7.org/fhir/account-status"; 085 case NULL: return null; 086 default: return "?"; 087 } 088 } 089 public String getDefinition() { 090 switch (this) { 091 case ACTIVE: return "This account is active and may be used."; 092 case INACTIVE: return "This account is inactive and should not be used to track financial information."; 093 case NULL: return null; 094 default: return "?"; 095 } 096 } 097 public String getDisplay() { 098 switch (this) { 099 case ACTIVE: return "Active"; 100 case INACTIVE: return "Inactive"; 101 case NULL: return null; 102 default: return "?"; 103 } 104 } 105 } 106 107 public static class AccountStatusEnumFactory implements EnumFactory<AccountStatus> { 108 public AccountStatus fromCode(String codeString) throws IllegalArgumentException { 109 if (codeString == null || "".equals(codeString)) 110 if (codeString == null || "".equals(codeString)) 111 return null; 112 if ("active".equals(codeString)) 113 return AccountStatus.ACTIVE; 114 if ("inactive".equals(codeString)) 115 return AccountStatus.INACTIVE; 116 throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'"); 117 } 118 public Enumeration<AccountStatus> fromType(Base code) throws FHIRException { 119 if (code == null || code.isEmpty()) 120 return null; 121 String codeString = ((PrimitiveType) code).asStringValue(); 122 if (codeString == null || "".equals(codeString)) 123 return null; 124 if ("active".equals(codeString)) 125 return new Enumeration<AccountStatus>(this, AccountStatus.ACTIVE); 126 if ("inactive".equals(codeString)) 127 return new Enumeration<AccountStatus>(this, AccountStatus.INACTIVE); 128 throw new FHIRException("Unknown AccountStatus code '"+codeString+"'"); 129 } 130 public String toCode(AccountStatus code) { 131 if (code == AccountStatus.ACTIVE) 132 return "active"; 133 if (code == AccountStatus.INACTIVE) 134 return "inactive"; 135 return "?"; 136 } 137 } 138 139 /** 140 * Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number). 141 */ 142 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 143 @Description(shortDefinition="Account number", formalDefinition="Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number)." ) 144 protected List<Identifier> identifier; 145 146 /** 147 * Name used for the account when displaying it to humans in reports, etc. 148 */ 149 @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 150 @Description(shortDefinition="Human-readable label", formalDefinition="Name used for the account when displaying it to humans in reports, etc." ) 151 protected StringType name; 152 153 /** 154 * Categorizes the account for reporting and searching purposes. 155 */ 156 @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 157 @Description(shortDefinition="E.g. patient, expense, depreciation", formalDefinition="Categorizes the account for reporting and searching purposes." ) 158 protected CodeableConcept type; 159 160 /** 161 * Indicates whether the account is presently used/useable or not. 162 */ 163 @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true) 164 @Description(shortDefinition="active | inactive", formalDefinition="Indicates whether the account is presently used/useable or not." ) 165 protected Enumeration<AccountStatus> status; 166 167 /** 168 * Indicates the period of time over which the account is allowed. 169 */ 170 @Child(name = "activePeriod", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true) 171 @Description(shortDefinition="Valid from..to", formalDefinition="Indicates the period of time over which the account is allowed." ) 172 protected Period activePeriod; 173 174 /** 175 * Identifies the currency to which transactions must be converted when crediting or debiting the account. 176 */ 177 @Child(name = "currency", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true) 178 @Description(shortDefinition="Base currency in which balance is tracked", formalDefinition="Identifies the currency to which transactions must be converted when crediting or debiting the account." ) 179 protected Coding currency; 180 181 /** 182 * Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative. 183 */ 184 @Child(name = "balance", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true) 185 @Description(shortDefinition="How much is in account?", formalDefinition="Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative." ) 186 protected Money balance; 187 188 /** 189 * Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc. 190 */ 191 @Child(name = "coveragePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true) 192 @Description(shortDefinition="Transaction window", formalDefinition="Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc." ) 193 protected Period coveragePeriod; 194 195 /** 196 * Identifies the patient, device, practitioner, location or other object the account is associated with. 197 */ 198 @Child(name = "subject", type = {Patient.class, Device.class, Practitioner.class, Location.class, HealthcareService.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true) 199 @Description(shortDefinition="What is account tied to?", formalDefinition="Identifies the patient, device, practitioner, location or other object the account is associated with." ) 200 protected Reference subject; 201 202 /** 203 * The actual object that is the target of the reference (Identifies the patient, device, practitioner, location or other object the account is associated with.) 204 */ 205 protected Resource subjectTarget; 206 207 /** 208 * Indicates the organization, department, etc. with responsibility for the account. 209 */ 210 @Child(name = "owner", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true) 211 @Description(shortDefinition="Who is responsible?", formalDefinition="Indicates the organization, department, etc. with responsibility for the account." ) 212 protected Reference owner; 213 214 /** 215 * The actual object that is the target of the reference (Indicates the organization, department, etc. with responsibility for the account.) 216 */ 217 protected Organization ownerTarget; 218 219 /** 220 * Provides additional information about what the account tracks and how it is used. 221 */ 222 @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true) 223 @Description(shortDefinition="Explanation of purpose/use", formalDefinition="Provides additional information about what the account tracks and how it is used." ) 224 protected StringType description; 225 226 private static final long serialVersionUID = -1926153194L; 227 228 /* 229 * Constructor 230 */ 231 public Account() { 232 super(); 233 } 234 235 /** 236 * @return {@link #identifier} (Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).) 237 */ 238 public List<Identifier> getIdentifier() { 239 if (this.identifier == null) 240 this.identifier = new ArrayList<Identifier>(); 241 return this.identifier; 242 } 243 244 public boolean hasIdentifier() { 245 if (this.identifier == null) 246 return false; 247 for (Identifier item : this.identifier) 248 if (!item.isEmpty()) 249 return true; 250 return false; 251 } 252 253 /** 254 * @return {@link #identifier} (Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).) 255 */ 256 // syntactic sugar 257 public Identifier addIdentifier() { //3 258 Identifier t = new Identifier(); 259 if (this.identifier == null) 260 this.identifier = new ArrayList<Identifier>(); 261 this.identifier.add(t); 262 return t; 263 } 264 265 // syntactic sugar 266 public Account addIdentifier(Identifier t) { //3 267 if (t == null) 268 return this; 269 if (this.identifier == null) 270 this.identifier = new ArrayList<Identifier>(); 271 this.identifier.add(t); 272 return this; 273 } 274 275 /** 276 * @return {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 277 */ 278 public StringType getNameElement() { 279 if (this.name == null) 280 if (Configuration.errorOnAutoCreate()) 281 throw new Error("Attempt to auto-create Account.name"); 282 else if (Configuration.doAutoCreate()) 283 this.name = new StringType(); // bb 284 return this.name; 285 } 286 287 public boolean hasNameElement() { 288 return this.name != null && !this.name.isEmpty(); 289 } 290 291 public boolean hasName() { 292 return this.name != null && !this.name.isEmpty(); 293 } 294 295 /** 296 * @param value {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 297 */ 298 public Account setNameElement(StringType value) { 299 this.name = value; 300 return this; 301 } 302 303 /** 304 * @return Name used for the account when displaying it to humans in reports, etc. 305 */ 306 public String getName() { 307 return this.name == null ? null : this.name.getValue(); 308 } 309 310 /** 311 * @param value Name used for the account when displaying it to humans in reports, etc. 312 */ 313 public Account setName(String value) { 314 if (Utilities.noString(value)) 315 this.name = null; 316 else { 317 if (this.name == null) 318 this.name = new StringType(); 319 this.name.setValue(value); 320 } 321 return this; 322 } 323 324 /** 325 * @return {@link #type} (Categorizes the account for reporting and searching purposes.) 326 */ 327 public CodeableConcept getType() { 328 if (this.type == null) 329 if (Configuration.errorOnAutoCreate()) 330 throw new Error("Attempt to auto-create Account.type"); 331 else if (Configuration.doAutoCreate()) 332 this.type = new CodeableConcept(); // cc 333 return this.type; 334 } 335 336 public boolean hasType() { 337 return this.type != null && !this.type.isEmpty(); 338 } 339 340 /** 341 * @param value {@link #type} (Categorizes the account for reporting and searching purposes.) 342 */ 343 public Account setType(CodeableConcept value) { 344 this.type = value; 345 return this; 346 } 347 348 /** 349 * @return {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 350 */ 351 public Enumeration<AccountStatus> getStatusElement() { 352 if (this.status == null) 353 if (Configuration.errorOnAutoCreate()) 354 throw new Error("Attempt to auto-create Account.status"); 355 else if (Configuration.doAutoCreate()) 356 this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory()); // bb 357 return this.status; 358 } 359 360 public boolean hasStatusElement() { 361 return this.status != null && !this.status.isEmpty(); 362 } 363 364 public boolean hasStatus() { 365 return this.status != null && !this.status.isEmpty(); 366 } 367 368 /** 369 * @param value {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 370 */ 371 public Account setStatusElement(Enumeration<AccountStatus> value) { 372 this.status = value; 373 return this; 374 } 375 376 /** 377 * @return Indicates whether the account is presently used/useable or not. 378 */ 379 public AccountStatus getStatus() { 380 return this.status == null ? null : this.status.getValue(); 381 } 382 383 /** 384 * @param value Indicates whether the account is presently used/useable or not. 385 */ 386 public Account setStatus(AccountStatus value) { 387 if (value == null) 388 this.status = null; 389 else { 390 if (this.status == null) 391 this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory()); 392 this.status.setValue(value); 393 } 394 return this; 395 } 396 397 /** 398 * @return {@link #activePeriod} (Indicates the period of time over which the account is allowed.) 399 */ 400 public Period getActivePeriod() { 401 if (this.activePeriod == null) 402 if (Configuration.errorOnAutoCreate()) 403 throw new Error("Attempt to auto-create Account.activePeriod"); 404 else if (Configuration.doAutoCreate()) 405 this.activePeriod = new Period(); // cc 406 return this.activePeriod; 407 } 408 409 public boolean hasActivePeriod() { 410 return this.activePeriod != null && !this.activePeriod.isEmpty(); 411 } 412 413 /** 414 * @param value {@link #activePeriod} (Indicates the period of time over which the account is allowed.) 415 */ 416 public Account setActivePeriod(Period value) { 417 this.activePeriod = value; 418 return this; 419 } 420 421 /** 422 * @return {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.) 423 */ 424 public Coding getCurrency() { 425 if (this.currency == null) 426 if (Configuration.errorOnAutoCreate()) 427 throw new Error("Attempt to auto-create Account.currency"); 428 else if (Configuration.doAutoCreate()) 429 this.currency = new Coding(); // cc 430 return this.currency; 431 } 432 433 public boolean hasCurrency() { 434 return this.currency != null && !this.currency.isEmpty(); 435 } 436 437 /** 438 * @param value {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.) 439 */ 440 public Account setCurrency(Coding value) { 441 this.currency = value; 442 return this; 443 } 444 445 /** 446 * @return {@link #balance} (Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.) 447 */ 448 public Money getBalance() { 449 if (this.balance == null) 450 if (Configuration.errorOnAutoCreate()) 451 throw new Error("Attempt to auto-create Account.balance"); 452 else if (Configuration.doAutoCreate()) 453 this.balance = new Money(); // cc 454 return this.balance; 455 } 456 457 public boolean hasBalance() { 458 return this.balance != null && !this.balance.isEmpty(); 459 } 460 461 /** 462 * @param value {@link #balance} (Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.) 463 */ 464 public Account setBalance(Money value) { 465 this.balance = value; 466 return this; 467 } 468 469 /** 470 * @return {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.) 471 */ 472 public Period getCoveragePeriod() { 473 if (this.coveragePeriod == null) 474 if (Configuration.errorOnAutoCreate()) 475 throw new Error("Attempt to auto-create Account.coveragePeriod"); 476 else if (Configuration.doAutoCreate()) 477 this.coveragePeriod = new Period(); // cc 478 return this.coveragePeriod; 479 } 480 481 public boolean hasCoveragePeriod() { 482 return this.coveragePeriod != null && !this.coveragePeriod.isEmpty(); 483 } 484 485 /** 486 * @param value {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.) 487 */ 488 public Account setCoveragePeriod(Period value) { 489 this.coveragePeriod = value; 490 return this; 491 } 492 493 /** 494 * @return {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.) 495 */ 496 public Reference getSubject() { 497 if (this.subject == null) 498 if (Configuration.errorOnAutoCreate()) 499 throw new Error("Attempt to auto-create Account.subject"); 500 else if (Configuration.doAutoCreate()) 501 this.subject = new Reference(); // cc 502 return this.subject; 503 } 504 505 public boolean hasSubject() { 506 return this.subject != null && !this.subject.isEmpty(); 507 } 508 509 /** 510 * @param value {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.) 511 */ 512 public Account setSubject(Reference value) { 513 this.subject = value; 514 return this; 515 } 516 517 /** 518 * @return {@link #subject} 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. (Identifies the patient, device, practitioner, location or other object the account is associated with.) 519 */ 520 public Resource getSubjectTarget() { 521 return this.subjectTarget; 522 } 523 524 /** 525 * @param value {@link #subject} 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. (Identifies the patient, device, practitioner, location or other object the account is associated with.) 526 */ 527 public Account setSubjectTarget(Resource value) { 528 this.subjectTarget = value; 529 return this; 530 } 531 532 /** 533 * @return {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.) 534 */ 535 public Reference getOwner() { 536 if (this.owner == null) 537 if (Configuration.errorOnAutoCreate()) 538 throw new Error("Attempt to auto-create Account.owner"); 539 else if (Configuration.doAutoCreate()) 540 this.owner = new Reference(); // cc 541 return this.owner; 542 } 543 544 public boolean hasOwner() { 545 return this.owner != null && !this.owner.isEmpty(); 546 } 547 548 /** 549 * @param value {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.) 550 */ 551 public Account setOwner(Reference value) { 552 this.owner = value; 553 return this; 554 } 555 556 /** 557 * @return {@link #owner} 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. (Indicates the organization, department, etc. with responsibility for the account.) 558 */ 559 public Organization getOwnerTarget() { 560 if (this.ownerTarget == null) 561 if (Configuration.errorOnAutoCreate()) 562 throw new Error("Attempt to auto-create Account.owner"); 563 else if (Configuration.doAutoCreate()) 564 this.ownerTarget = new Organization(); // aa 565 return this.ownerTarget; 566 } 567 568 /** 569 * @param value {@link #owner} 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. (Indicates the organization, department, etc. with responsibility for the account.) 570 */ 571 public Account setOwnerTarget(Organization value) { 572 this.ownerTarget = value; 573 return this; 574 } 575 576 /** 577 * @return {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 578 */ 579 public StringType getDescriptionElement() { 580 if (this.description == null) 581 if (Configuration.errorOnAutoCreate()) 582 throw new Error("Attempt to auto-create Account.description"); 583 else if (Configuration.doAutoCreate()) 584 this.description = new StringType(); // bb 585 return this.description; 586 } 587 588 public boolean hasDescriptionElement() { 589 return this.description != null && !this.description.isEmpty(); 590 } 591 592 public boolean hasDescription() { 593 return this.description != null && !this.description.isEmpty(); 594 } 595 596 /** 597 * @param value {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 598 */ 599 public Account setDescriptionElement(StringType value) { 600 this.description = value; 601 return this; 602 } 603 604 /** 605 * @return Provides additional information about what the account tracks and how it is used. 606 */ 607 public String getDescription() { 608 return this.description == null ? null : this.description.getValue(); 609 } 610 611 /** 612 * @param value Provides additional information about what the account tracks and how it is used. 613 */ 614 public Account setDescription(String value) { 615 if (Utilities.noString(value)) 616 this.description = null; 617 else { 618 if (this.description == null) 619 this.description = new StringType(); 620 this.description.setValue(value); 621 } 622 return this; 623 } 624 625 protected void listChildren(List<Property> childrenList) { 626 super.listChildren(childrenList); 627 childrenList.add(new Property("identifier", "Identifier", "Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).", 0, java.lang.Integer.MAX_VALUE, identifier)); 628 childrenList.add(new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, java.lang.Integer.MAX_VALUE, name)); 629 childrenList.add(new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, java.lang.Integer.MAX_VALUE, type)); 630 childrenList.add(new Property("status", "code", "Indicates whether the account is presently used/useable or not.", 0, java.lang.Integer.MAX_VALUE, status)); 631 childrenList.add(new Property("activePeriod", "Period", "Indicates the period of time over which the account is allowed.", 0, java.lang.Integer.MAX_VALUE, activePeriod)); 632 childrenList.add(new Property("currency", "Coding", "Identifies the currency to which transactions must be converted when crediting or debiting the account.", 0, java.lang.Integer.MAX_VALUE, currency)); 633 childrenList.add(new Property("balance", "Money", "Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.", 0, java.lang.Integer.MAX_VALUE, balance)); 634 childrenList.add(new Property("coveragePeriod", "Period", "Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.", 0, java.lang.Integer.MAX_VALUE, coveragePeriod)); 635 childrenList.add(new Property("subject", "Reference(Patient|Device|Practitioner|Location|HealthcareService|Organization)", "Identifies the patient, device, practitioner, location or other object the account is associated with.", 0, java.lang.Integer.MAX_VALUE, subject)); 636 childrenList.add(new Property("owner", "Reference(Organization)", "Indicates the organization, department, etc. with responsibility for the account.", 0, java.lang.Integer.MAX_VALUE, owner)); 637 childrenList.add(new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, java.lang.Integer.MAX_VALUE, description)); 638 } 639 640 @Override 641 public void setProperty(String name, Base value) throws FHIRException { 642 if (name.equals("identifier")) 643 this.getIdentifier().add(castToIdentifier(value)); 644 else if (name.equals("name")) 645 this.name = castToString(value); // StringType 646 else if (name.equals("type")) 647 this.type = castToCodeableConcept(value); // CodeableConcept 648 else if (name.equals("status")) 649 this.status = new AccountStatusEnumFactory().fromType(value); // Enumeration<AccountStatus> 650 else if (name.equals("activePeriod")) 651 this.activePeriod = castToPeriod(value); // Period 652 else if (name.equals("currency")) 653 this.currency = castToCoding(value); // Coding 654 else if (name.equals("balance")) 655 this.balance = castToMoney(value); // Money 656 else if (name.equals("coveragePeriod")) 657 this.coveragePeriod = castToPeriod(value); // Period 658 else if (name.equals("subject")) 659 this.subject = castToReference(value); // Reference 660 else if (name.equals("owner")) 661 this.owner = castToReference(value); // Reference 662 else if (name.equals("description")) 663 this.description = castToString(value); // StringType 664 else 665 super.setProperty(name, value); 666 } 667 668 @Override 669 public Base addChild(String name) throws FHIRException { 670 if (name.equals("identifier")) { 671 return addIdentifier(); 672 } 673 else if (name.equals("name")) { 674 throw new FHIRException("Cannot call addChild on a primitive type Account.name"); 675 } 676 else if (name.equals("type")) { 677 this.type = new CodeableConcept(); 678 return this.type; 679 } 680 else if (name.equals("status")) { 681 throw new FHIRException("Cannot call addChild on a primitive type Account.status"); 682 } 683 else if (name.equals("activePeriod")) { 684 this.activePeriod = new Period(); 685 return this.activePeriod; 686 } 687 else if (name.equals("currency")) { 688 this.currency = new Coding(); 689 return this.currency; 690 } 691 else if (name.equals("balance")) { 692 this.balance = new Money(); 693 return this.balance; 694 } 695 else if (name.equals("coveragePeriod")) { 696 this.coveragePeriod = new Period(); 697 return this.coveragePeriod; 698 } 699 else if (name.equals("subject")) { 700 this.subject = new Reference(); 701 return this.subject; 702 } 703 else if (name.equals("owner")) { 704 this.owner = new Reference(); 705 return this.owner; 706 } 707 else if (name.equals("description")) { 708 throw new FHIRException("Cannot call addChild on a primitive type Account.description"); 709 } 710 else 711 return super.addChild(name); 712 } 713 714 public String fhirType() { 715 return "Account"; 716 717 } 718 719 public Account copy() { 720 Account dst = new Account(); 721 copyValues(dst); 722 if (identifier != null) { 723 dst.identifier = new ArrayList<Identifier>(); 724 for (Identifier i : identifier) 725 dst.identifier.add(i.copy()); 726 }; 727 dst.name = name == null ? null : name.copy(); 728 dst.type = type == null ? null : type.copy(); 729 dst.status = status == null ? null : status.copy(); 730 dst.activePeriod = activePeriod == null ? null : activePeriod.copy(); 731 dst.currency = currency == null ? null : currency.copy(); 732 dst.balance = balance == null ? null : balance.copy(); 733 dst.coveragePeriod = coveragePeriod == null ? null : coveragePeriod.copy(); 734 dst.subject = subject == null ? null : subject.copy(); 735 dst.owner = owner == null ? null : owner.copy(); 736 dst.description = description == null ? null : description.copy(); 737 return dst; 738 } 739 740 protected Account typedCopy() { 741 return copy(); 742 } 743 744 @Override 745 public boolean equalsDeep(Base other) { 746 if (!super.equalsDeep(other)) 747 return false; 748 if (!(other instanceof Account)) 749 return false; 750 Account o = (Account) other; 751 return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(type, o.type, true) 752 && compareDeep(status, o.status, true) && compareDeep(activePeriod, o.activePeriod, true) && compareDeep(currency, o.currency, true) 753 && compareDeep(balance, o.balance, true) && compareDeep(coveragePeriod, o.coveragePeriod, true) 754 && compareDeep(subject, o.subject, true) && compareDeep(owner, o.owner, true) && compareDeep(description, o.description, true) 755 ; 756 } 757 758 @Override 759 public boolean equalsShallow(Base other) { 760 if (!super.equalsShallow(other)) 761 return false; 762 if (!(other instanceof Account)) 763 return false; 764 Account o = (Account) other; 765 return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(description, o.description, true) 766 ; 767 } 768 769 public boolean isEmpty() { 770 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (name == null || name.isEmpty()) 771 && (type == null || type.isEmpty()) && (status == null || status.isEmpty()) && (activePeriod == null || activePeriod.isEmpty()) 772 && (currency == null || currency.isEmpty()) && (balance == null || balance.isEmpty()) && (coveragePeriod == null || coveragePeriod.isEmpty()) 773 && (subject == null || subject.isEmpty()) && (owner == null || owner.isEmpty()) && (description == null || description.isEmpty()) 774 ; 775 } 776 777 @Override 778 public ResourceType getResourceType() { 779 return ResourceType.Account; 780 } 781 782 @SearchParamDefinition(name="owner", path="Account.owner", description="Who is responsible?", type="reference" ) 783 public static final String SP_OWNER = "owner"; 784 @SearchParamDefinition(name="identifier", path="Account.identifier", description="Account number", type="token" ) 785 public static final String SP_IDENTIFIER = "identifier"; 786 @SearchParamDefinition(name="period", path="Account.coveragePeriod", description="Transaction window", type="date" ) 787 public static final String SP_PERIOD = "period"; 788 @SearchParamDefinition(name="balance", path="Account.balance", description="How much is in account?", type="quantity" ) 789 public static final String SP_BALANCE = "balance"; 790 @SearchParamDefinition(name="subject", path="Account.subject", description="What is account tied to?", type="reference" ) 791 public static final String SP_SUBJECT = "subject"; 792 @SearchParamDefinition(name="patient", path="Account.subject", description="What is account tied to?", type="reference" ) 793 public static final String SP_PATIENT = "patient"; 794 @SearchParamDefinition(name="name", path="Account.name", description="Human-readable label", type="string" ) 795 public static final String SP_NAME = "name"; 796 @SearchParamDefinition(name="type", path="Account.type", description="E.g. patient, expense, depreciation", type="token" ) 797 public static final String SP_TYPE = "type"; 798 @SearchParamDefinition(name="status", path="Account.status", description="active | inactive", type="token" ) 799 public static final String SP_STATUS = "status"; 800 801}