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