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