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