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.Date; 038import java.util.List; 039 040import org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender; 041import org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory; 042import ca.uhn.fhir.model.api.annotation.Block; 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.ResourceDef; 046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 047import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 048import org.hl7.fhir.exceptions.FHIRException; 049/** 050 * Demographics and other administrative information about an individual or animal receiving care or other health-related services. 051 */ 052@ResourceDef(name="Patient", profile="http://hl7.org/fhir/Profile/Patient") 053public class Patient extends DomainResource { 054 055 public enum LinkType { 056 /** 057 * The patient resource containing this link must no longer be used. The link points forward to another patient resource that must be used in lieu of the patient resource that contains this link. 058 */ 059 REPLACE, 060 /** 061 * The patient resource containing this link is in use and valid but not considered the main source of information about a patient. The link points forward to another patient resource that should be consulted to retrieve additional patient information. 062 */ 063 REFER, 064 /** 065 * The patient resource containing this link is in use and valid, but points to another patient resource that is known to contain data about the same person. Data in this resource might overlap or contradict information found in the other patient resource. This link does not indicate any relative importance of the resources concerned, and both should be regarded as equally valid. 066 */ 067 SEEALSO, 068 /** 069 * added to help the parsers 070 */ 071 NULL; 072 public static LinkType fromCode(String codeString) throws FHIRException { 073 if (codeString == null || "".equals(codeString)) 074 return null; 075 if ("replace".equals(codeString)) 076 return REPLACE; 077 if ("refer".equals(codeString)) 078 return REFER; 079 if ("seealso".equals(codeString)) 080 return SEEALSO; 081 throw new FHIRException("Unknown LinkType code '"+codeString+"'"); 082 } 083 public String toCode() { 084 switch (this) { 085 case REPLACE: return "replace"; 086 case REFER: return "refer"; 087 case SEEALSO: return "seealso"; 088 case NULL: return null; 089 default: return "?"; 090 } 091 } 092 public String getSystem() { 093 switch (this) { 094 case REPLACE: return "http://hl7.org/fhir/link-type"; 095 case REFER: return "http://hl7.org/fhir/link-type"; 096 case SEEALSO: return "http://hl7.org/fhir/link-type"; 097 case NULL: return null; 098 default: return "?"; 099 } 100 } 101 public String getDefinition() { 102 switch (this) { 103 case REPLACE: return "The patient resource containing this link must no longer be used. The link points forward to another patient resource that must be used in lieu of the patient resource that contains this link."; 104 case REFER: return "The patient resource containing this link is in use and valid but not considered the main source of information about a patient. The link points forward to another patient resource that should be consulted to retrieve additional patient information."; 105 case SEEALSO: return "The patient resource containing this link is in use and valid, but points to another patient resource that is known to contain data about the same person. Data in this resource might overlap or contradict information found in the other patient resource. This link does not indicate any relative importance of the resources concerned, and both should be regarded as equally valid."; 106 case NULL: return null; 107 default: return "?"; 108 } 109 } 110 public String getDisplay() { 111 switch (this) { 112 case REPLACE: return "Replace"; 113 case REFER: return "Refer"; 114 case SEEALSO: return "See also"; 115 case NULL: return null; 116 default: return "?"; 117 } 118 } 119 } 120 121 public static class LinkTypeEnumFactory implements EnumFactory<LinkType> { 122 public LinkType fromCode(String codeString) throws IllegalArgumentException { 123 if (codeString == null || "".equals(codeString)) 124 if (codeString == null || "".equals(codeString)) 125 return null; 126 if ("replace".equals(codeString)) 127 return LinkType.REPLACE; 128 if ("refer".equals(codeString)) 129 return LinkType.REFER; 130 if ("seealso".equals(codeString)) 131 return LinkType.SEEALSO; 132 throw new IllegalArgumentException("Unknown LinkType code '"+codeString+"'"); 133 } 134 public Enumeration<LinkType> fromType(Base code) throws FHIRException { 135 if (code == null || code.isEmpty()) 136 return null; 137 String codeString = ((PrimitiveType) code).asStringValue(); 138 if (codeString == null || "".equals(codeString)) 139 return null; 140 if ("replace".equals(codeString)) 141 return new Enumeration<LinkType>(this, LinkType.REPLACE); 142 if ("refer".equals(codeString)) 143 return new Enumeration<LinkType>(this, LinkType.REFER); 144 if ("seealso".equals(codeString)) 145 return new Enumeration<LinkType>(this, LinkType.SEEALSO); 146 throw new FHIRException("Unknown LinkType code '"+codeString+"'"); 147 } 148 public String toCode(LinkType code) { 149 if (code == LinkType.REPLACE) 150 return "replace"; 151 if (code == LinkType.REFER) 152 return "refer"; 153 if (code == LinkType.SEEALSO) 154 return "seealso"; 155 return "?"; 156 } 157 } 158 159 @Block() 160 public static class ContactComponent extends BackboneElement implements IBaseBackboneElement { 161 /** 162 * The nature of the relationship between the patient and the contact person. 163 */ 164 @Child(name = "relationship", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 165 @Description(shortDefinition="The kind of relationship", formalDefinition="The nature of the relationship between the patient and the contact person." ) 166 protected List<CodeableConcept> relationship; 167 168 /** 169 * A name associated with the contact person. 170 */ 171 @Child(name = "name", type = {HumanName.class}, order=2, min=0, max=1, modifier=false, summary=false) 172 @Description(shortDefinition="A name associated with the contact person", formalDefinition="A name associated with the contact person." ) 173 protected HumanName name; 174 175 /** 176 * A contact detail for the person, e.g. a telephone number or an email address. 177 */ 178 @Child(name = "telecom", type = {ContactPoint.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 179 @Description(shortDefinition="A contact detail for the person", formalDefinition="A contact detail for the person, e.g. a telephone number or an email address." ) 180 protected List<ContactPoint> telecom; 181 182 /** 183 * Address for the contact person. 184 */ 185 @Child(name = "address", type = {Address.class}, order=4, min=0, max=1, modifier=false, summary=false) 186 @Description(shortDefinition="Address for the contact person", formalDefinition="Address for the contact person." ) 187 protected Address address; 188 189 /** 190 * Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes. 191 */ 192 @Child(name = "gender", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false) 193 @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes." ) 194 protected Enumeration<AdministrativeGender> gender; 195 196 /** 197 * Organization on behalf of which the contact is acting or for which the contact is working. 198 */ 199 @Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=false) 200 @Description(shortDefinition="Organization that is associated with the contact", formalDefinition="Organization on behalf of which the contact is acting or for which the contact is working." ) 201 protected Reference organization; 202 203 /** 204 * The actual object that is the target of the reference (Organization on behalf of which the contact is acting or for which the contact is working.) 205 */ 206 protected Organization organizationTarget; 207 208 /** 209 * The period during which this contact person or organization is valid to be contacted relating to this patient. 210 */ 211 @Child(name = "period", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=false) 212 @Description(shortDefinition="The period during which this contact person or organization is valid to be contacted relating to this patient", formalDefinition="The period during which this contact person or organization is valid to be contacted relating to this patient." ) 213 protected Period period; 214 215 private static final long serialVersionUID = 364269017L; 216 217 /* 218 * Constructor 219 */ 220 public ContactComponent() { 221 super(); 222 } 223 224 /** 225 * @return {@link #relationship} (The nature of the relationship between the patient and the contact person.) 226 */ 227 public List<CodeableConcept> getRelationship() { 228 if (this.relationship == null) 229 this.relationship = new ArrayList<CodeableConcept>(); 230 return this.relationship; 231 } 232 233 public boolean hasRelationship() { 234 if (this.relationship == null) 235 return false; 236 for (CodeableConcept item : this.relationship) 237 if (!item.isEmpty()) 238 return true; 239 return false; 240 } 241 242 /** 243 * @return {@link #relationship} (The nature of the relationship between the patient and the contact person.) 244 */ 245 // syntactic sugar 246 public CodeableConcept addRelationship() { //3 247 CodeableConcept t = new CodeableConcept(); 248 if (this.relationship == null) 249 this.relationship = new ArrayList<CodeableConcept>(); 250 this.relationship.add(t); 251 return t; 252 } 253 254 // syntactic sugar 255 public ContactComponent addRelationship(CodeableConcept t) { //3 256 if (t == null) 257 return this; 258 if (this.relationship == null) 259 this.relationship = new ArrayList<CodeableConcept>(); 260 this.relationship.add(t); 261 return this; 262 } 263 264 /** 265 * @return {@link #name} (A name associated with the contact person.) 266 */ 267 public HumanName getName() { 268 if (this.name == null) 269 if (Configuration.errorOnAutoCreate()) 270 throw new Error("Attempt to auto-create ContactComponent.name"); 271 else if (Configuration.doAutoCreate()) 272 this.name = new HumanName(); // cc 273 return this.name; 274 } 275 276 public boolean hasName() { 277 return this.name != null && !this.name.isEmpty(); 278 } 279 280 /** 281 * @param value {@link #name} (A name associated with the contact person.) 282 */ 283 public ContactComponent setName(HumanName value) { 284 this.name = value; 285 return this; 286 } 287 288 /** 289 * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.) 290 */ 291 public List<ContactPoint> getTelecom() { 292 if (this.telecom == null) 293 this.telecom = new ArrayList<ContactPoint>(); 294 return this.telecom; 295 } 296 297 public boolean hasTelecom() { 298 if (this.telecom == null) 299 return false; 300 for (ContactPoint item : this.telecom) 301 if (!item.isEmpty()) 302 return true; 303 return false; 304 } 305 306 /** 307 * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.) 308 */ 309 // syntactic sugar 310 public ContactPoint addTelecom() { //3 311 ContactPoint t = new ContactPoint(); 312 if (this.telecom == null) 313 this.telecom = new ArrayList<ContactPoint>(); 314 this.telecom.add(t); 315 return t; 316 } 317 318 // syntactic sugar 319 public ContactComponent addTelecom(ContactPoint t) { //3 320 if (t == null) 321 return this; 322 if (this.telecom == null) 323 this.telecom = new ArrayList<ContactPoint>(); 324 this.telecom.add(t); 325 return this; 326 } 327 328 /** 329 * @return {@link #address} (Address for the contact person.) 330 */ 331 public Address getAddress() { 332 if (this.address == null) 333 if (Configuration.errorOnAutoCreate()) 334 throw new Error("Attempt to auto-create ContactComponent.address"); 335 else if (Configuration.doAutoCreate()) 336 this.address = new Address(); // cc 337 return this.address; 338 } 339 340 public boolean hasAddress() { 341 return this.address != null && !this.address.isEmpty(); 342 } 343 344 /** 345 * @param value {@link #address} (Address for the contact person.) 346 */ 347 public ContactComponent setAddress(Address value) { 348 this.address = value; 349 return this; 350 } 351 352 /** 353 * @return {@link #gender} (Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value 354 */ 355 public Enumeration<AdministrativeGender> getGenderElement() { 356 if (this.gender == null) 357 if (Configuration.errorOnAutoCreate()) 358 throw new Error("Attempt to auto-create ContactComponent.gender"); 359 else if (Configuration.doAutoCreate()) 360 this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb 361 return this.gender; 362 } 363 364 public boolean hasGenderElement() { 365 return this.gender != null && !this.gender.isEmpty(); 366 } 367 368 public boolean hasGender() { 369 return this.gender != null && !this.gender.isEmpty(); 370 } 371 372 /** 373 * @param value {@link #gender} (Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value 374 */ 375 public ContactComponent setGenderElement(Enumeration<AdministrativeGender> value) { 376 this.gender = value; 377 return this; 378 } 379 380 /** 381 * @return Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes. 382 */ 383 public AdministrativeGender getGender() { 384 return this.gender == null ? null : this.gender.getValue(); 385 } 386 387 /** 388 * @param value Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes. 389 */ 390 public ContactComponent setGender(AdministrativeGender value) { 391 if (value == null) 392 this.gender = null; 393 else { 394 if (this.gender == null) 395 this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); 396 this.gender.setValue(value); 397 } 398 return this; 399 } 400 401 /** 402 * @return {@link #organization} (Organization on behalf of which the contact is acting or for which the contact is working.) 403 */ 404 public Reference getOrganization() { 405 if (this.organization == null) 406 if (Configuration.errorOnAutoCreate()) 407 throw new Error("Attempt to auto-create ContactComponent.organization"); 408 else if (Configuration.doAutoCreate()) 409 this.organization = new Reference(); // cc 410 return this.organization; 411 } 412 413 public boolean hasOrganization() { 414 return this.organization != null && !this.organization.isEmpty(); 415 } 416 417 /** 418 * @param value {@link #organization} (Organization on behalf of which the contact is acting or for which the contact is working.) 419 */ 420 public ContactComponent setOrganization(Reference value) { 421 this.organization = value; 422 return this; 423 } 424 425 /** 426 * @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Organization on behalf of which the contact is acting or for which the contact is working.) 427 */ 428 public Organization getOrganizationTarget() { 429 if (this.organizationTarget == null) 430 if (Configuration.errorOnAutoCreate()) 431 throw new Error("Attempt to auto-create ContactComponent.organization"); 432 else if (Configuration.doAutoCreate()) 433 this.organizationTarget = new Organization(); // aa 434 return this.organizationTarget; 435 } 436 437 /** 438 * @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Organization on behalf of which the contact is acting or for which the contact is working.) 439 */ 440 public ContactComponent setOrganizationTarget(Organization value) { 441 this.organizationTarget = value; 442 return this; 443 } 444 445 /** 446 * @return {@link #period} (The period during which this contact person or organization is valid to be contacted relating to this patient.) 447 */ 448 public Period getPeriod() { 449 if (this.period == null) 450 if (Configuration.errorOnAutoCreate()) 451 throw new Error("Attempt to auto-create ContactComponent.period"); 452 else if (Configuration.doAutoCreate()) 453 this.period = new Period(); // cc 454 return this.period; 455 } 456 457 public boolean hasPeriod() { 458 return this.period != null && !this.period.isEmpty(); 459 } 460 461 /** 462 * @param value {@link #period} (The period during which this contact person or organization is valid to be contacted relating to this patient.) 463 */ 464 public ContactComponent setPeriod(Period value) { 465 this.period = value; 466 return this; 467 } 468 469 protected void listChildren(List<Property> childrenList) { 470 super.listChildren(childrenList); 471 childrenList.add(new Property("relationship", "CodeableConcept", "The nature of the relationship between the patient and the contact person.", 0, java.lang.Integer.MAX_VALUE, relationship)); 472 childrenList.add(new Property("name", "HumanName", "A name associated with the contact person.", 0, java.lang.Integer.MAX_VALUE, name)); 473 childrenList.add(new Property("telecom", "ContactPoint", "A contact detail for the person, e.g. a telephone number or an email address.", 0, java.lang.Integer.MAX_VALUE, telecom)); 474 childrenList.add(new Property("address", "Address", "Address for the contact person.", 0, java.lang.Integer.MAX_VALUE, address)); 475 childrenList.add(new Property("gender", "code", "Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.", 0, java.lang.Integer.MAX_VALUE, gender)); 476 childrenList.add(new Property("organization", "Reference(Organization)", "Organization on behalf of which the contact is acting or for which the contact is working.", 0, java.lang.Integer.MAX_VALUE, organization)); 477 childrenList.add(new Property("period", "Period", "The period during which this contact person or organization is valid to be contacted relating to this patient.", 0, java.lang.Integer.MAX_VALUE, period)); 478 } 479 480 @Override 481 public void setProperty(String name, Base value) throws FHIRException { 482 if (name.equals("relationship")) 483 this.getRelationship().add(castToCodeableConcept(value)); 484 else if (name.equals("name")) 485 this.name = castToHumanName(value); // HumanName 486 else if (name.equals("telecom")) 487 this.getTelecom().add(castToContactPoint(value)); 488 else if (name.equals("address")) 489 this.address = castToAddress(value); // Address 490 else if (name.equals("gender")) 491 this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender> 492 else if (name.equals("organization")) 493 this.organization = castToReference(value); // Reference 494 else if (name.equals("period")) 495 this.period = castToPeriod(value); // Period 496 else 497 super.setProperty(name, value); 498 } 499 500 @Override 501 public Base addChild(String name) throws FHIRException { 502 if (name.equals("relationship")) { 503 return addRelationship(); 504 } 505 else if (name.equals("name")) { 506 this.name = new HumanName(); 507 return this.name; 508 } 509 else if (name.equals("telecom")) { 510 return addTelecom(); 511 } 512 else if (name.equals("address")) { 513 this.address = new Address(); 514 return this.address; 515 } 516 else if (name.equals("gender")) { 517 throw new FHIRException("Cannot call addChild on a primitive type Patient.gender"); 518 } 519 else if (name.equals("organization")) { 520 this.organization = new Reference(); 521 return this.organization; 522 } 523 else if (name.equals("period")) { 524 this.period = new Period(); 525 return this.period; 526 } 527 else 528 return super.addChild(name); 529 } 530 531 public ContactComponent copy() { 532 ContactComponent dst = new ContactComponent(); 533 copyValues(dst); 534 if (relationship != null) { 535 dst.relationship = new ArrayList<CodeableConcept>(); 536 for (CodeableConcept i : relationship) 537 dst.relationship.add(i.copy()); 538 }; 539 dst.name = name == null ? null : name.copy(); 540 if (telecom != null) { 541 dst.telecom = new ArrayList<ContactPoint>(); 542 for (ContactPoint i : telecom) 543 dst.telecom.add(i.copy()); 544 }; 545 dst.address = address == null ? null : address.copy(); 546 dst.gender = gender == null ? null : gender.copy(); 547 dst.organization = organization == null ? null : organization.copy(); 548 dst.period = period == null ? null : period.copy(); 549 return dst; 550 } 551 552 @Override 553 public boolean equalsDeep(Base other) { 554 if (!super.equalsDeep(other)) 555 return false; 556 if (!(other instanceof ContactComponent)) 557 return false; 558 ContactComponent o = (ContactComponent) other; 559 return compareDeep(relationship, o.relationship, true) && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true) 560 && compareDeep(address, o.address, true) && compareDeep(gender, o.gender, true) && compareDeep(organization, o.organization, true) 561 && compareDeep(period, o.period, true); 562 } 563 564 @Override 565 public boolean equalsShallow(Base other) { 566 if (!super.equalsShallow(other)) 567 return false; 568 if (!(other instanceof ContactComponent)) 569 return false; 570 ContactComponent o = (ContactComponent) other; 571 return compareValues(gender, o.gender, true); 572 } 573 574 public boolean isEmpty() { 575 return super.isEmpty() && (relationship == null || relationship.isEmpty()) && (name == null || name.isEmpty()) 576 && (telecom == null || telecom.isEmpty()) && (address == null || address.isEmpty()) && (gender == null || gender.isEmpty()) 577 && (organization == null || organization.isEmpty()) && (period == null || period.isEmpty()) 578 ; 579 } 580 581 public String fhirType() { 582 return "Patient.contact"; 583 584 } 585 586 } 587 588 @Block() 589 public static class AnimalComponent extends BackboneElement implements IBaseBackboneElement { 590 /** 591 * Identifies the high level taxonomic categorization of the kind of animal. 592 */ 593 @Child(name = "species", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 594 @Description(shortDefinition="E.g. Dog, Cow", formalDefinition="Identifies the high level taxonomic categorization of the kind of animal." ) 595 protected CodeableConcept species; 596 597 /** 598 * Identifies the detailed categorization of the kind of animal. 599 */ 600 @Child(name = "breed", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 601 @Description(shortDefinition="E.g. Poodle, Angus", formalDefinition="Identifies the detailed categorization of the kind of animal." ) 602 protected CodeableConcept breed; 603 604 /** 605 * Indicates the current state of the animal's reproductive organs. 606 */ 607 @Child(name = "genderStatus", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 608 @Description(shortDefinition="E.g. Neutered, Intact", formalDefinition="Indicates the current state of the animal's reproductive organs." ) 609 protected CodeableConcept genderStatus; 610 611 private static final long serialVersionUID = -549738382L; 612 613 /* 614 * Constructor 615 */ 616 public AnimalComponent() { 617 super(); 618 } 619 620 /* 621 * Constructor 622 */ 623 public AnimalComponent(CodeableConcept species) { 624 super(); 625 this.species = species; 626 } 627 628 /** 629 * @return {@link #species} (Identifies the high level taxonomic categorization of the kind of animal.) 630 */ 631 public CodeableConcept getSpecies() { 632 if (this.species == null) 633 if (Configuration.errorOnAutoCreate()) 634 throw new Error("Attempt to auto-create AnimalComponent.species"); 635 else if (Configuration.doAutoCreate()) 636 this.species = new CodeableConcept(); // cc 637 return this.species; 638 } 639 640 public boolean hasSpecies() { 641 return this.species != null && !this.species.isEmpty(); 642 } 643 644 /** 645 * @param value {@link #species} (Identifies the high level taxonomic categorization of the kind of animal.) 646 */ 647 public AnimalComponent setSpecies(CodeableConcept value) { 648 this.species = value; 649 return this; 650 } 651 652 /** 653 * @return {@link #breed} (Identifies the detailed categorization of the kind of animal.) 654 */ 655 public CodeableConcept getBreed() { 656 if (this.breed == null) 657 if (Configuration.errorOnAutoCreate()) 658 throw new Error("Attempt to auto-create AnimalComponent.breed"); 659 else if (Configuration.doAutoCreate()) 660 this.breed = new CodeableConcept(); // cc 661 return this.breed; 662 } 663 664 public boolean hasBreed() { 665 return this.breed != null && !this.breed.isEmpty(); 666 } 667 668 /** 669 * @param value {@link #breed} (Identifies the detailed categorization of the kind of animal.) 670 */ 671 public AnimalComponent setBreed(CodeableConcept value) { 672 this.breed = value; 673 return this; 674 } 675 676 /** 677 * @return {@link #genderStatus} (Indicates the current state of the animal's reproductive organs.) 678 */ 679 public CodeableConcept getGenderStatus() { 680 if (this.genderStatus == null) 681 if (Configuration.errorOnAutoCreate()) 682 throw new Error("Attempt to auto-create AnimalComponent.genderStatus"); 683 else if (Configuration.doAutoCreate()) 684 this.genderStatus = new CodeableConcept(); // cc 685 return this.genderStatus; 686 } 687 688 public boolean hasGenderStatus() { 689 return this.genderStatus != null && !this.genderStatus.isEmpty(); 690 } 691 692 /** 693 * @param value {@link #genderStatus} (Indicates the current state of the animal's reproductive organs.) 694 */ 695 public AnimalComponent setGenderStatus(CodeableConcept value) { 696 this.genderStatus = value; 697 return this; 698 } 699 700 protected void listChildren(List<Property> childrenList) { 701 super.listChildren(childrenList); 702 childrenList.add(new Property("species", "CodeableConcept", "Identifies the high level taxonomic categorization of the kind of animal.", 0, java.lang.Integer.MAX_VALUE, species)); 703 childrenList.add(new Property("breed", "CodeableConcept", "Identifies the detailed categorization of the kind of animal.", 0, java.lang.Integer.MAX_VALUE, breed)); 704 childrenList.add(new Property("genderStatus", "CodeableConcept", "Indicates the current state of the animal's reproductive organs.", 0, java.lang.Integer.MAX_VALUE, genderStatus)); 705 } 706 707 @Override 708 public void setProperty(String name, Base value) throws FHIRException { 709 if (name.equals("species")) 710 this.species = castToCodeableConcept(value); // CodeableConcept 711 else if (name.equals("breed")) 712 this.breed = castToCodeableConcept(value); // CodeableConcept 713 else if (name.equals("genderStatus")) 714 this.genderStatus = castToCodeableConcept(value); // CodeableConcept 715 else 716 super.setProperty(name, value); 717 } 718 719 @Override 720 public Base addChild(String name) throws FHIRException { 721 if (name.equals("species")) { 722 this.species = new CodeableConcept(); 723 return this.species; 724 } 725 else if (name.equals("breed")) { 726 this.breed = new CodeableConcept(); 727 return this.breed; 728 } 729 else if (name.equals("genderStatus")) { 730 this.genderStatus = new CodeableConcept(); 731 return this.genderStatus; 732 } 733 else 734 return super.addChild(name); 735 } 736 737 public AnimalComponent copy() { 738 AnimalComponent dst = new AnimalComponent(); 739 copyValues(dst); 740 dst.species = species == null ? null : species.copy(); 741 dst.breed = breed == null ? null : breed.copy(); 742 dst.genderStatus = genderStatus == null ? null : genderStatus.copy(); 743 return dst; 744 } 745 746 @Override 747 public boolean equalsDeep(Base other) { 748 if (!super.equalsDeep(other)) 749 return false; 750 if (!(other instanceof AnimalComponent)) 751 return false; 752 AnimalComponent o = (AnimalComponent) other; 753 return compareDeep(species, o.species, true) && compareDeep(breed, o.breed, true) && compareDeep(genderStatus, o.genderStatus, true) 754 ; 755 } 756 757 @Override 758 public boolean equalsShallow(Base other) { 759 if (!super.equalsShallow(other)) 760 return false; 761 if (!(other instanceof AnimalComponent)) 762 return false; 763 AnimalComponent o = (AnimalComponent) other; 764 return true; 765 } 766 767 public boolean isEmpty() { 768 return super.isEmpty() && (species == null || species.isEmpty()) && (breed == null || breed.isEmpty()) 769 && (genderStatus == null || genderStatus.isEmpty()); 770 } 771 772 public String fhirType() { 773 return "Patient.animal"; 774 775 } 776 777 } 778 779 @Block() 780 public static class PatientCommunicationComponent extends BackboneElement implements IBaseBackboneElement { 781 /** 782 * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English. 783 */ 784 @Child(name = "language", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false) 785 @Description(shortDefinition="The language which can be used to communicate with the patient about his or her health", formalDefinition="The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English." ) 786 protected CodeableConcept language; 787 788 /** 789 * Indicates whether or not the patient prefers this language (over other languages he masters up a certain level). 790 */ 791 @Child(name = "preferred", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false) 792 @Description(shortDefinition="Language preference indicator", formalDefinition="Indicates whether or not the patient prefers this language (over other languages he masters up a certain level)." ) 793 protected BooleanType preferred; 794 795 private static final long serialVersionUID = 633792918L; 796 797 /* 798 * Constructor 799 */ 800 public PatientCommunicationComponent() { 801 super(); 802 } 803 804 /* 805 * Constructor 806 */ 807 public PatientCommunicationComponent(CodeableConcept language) { 808 super(); 809 this.language = language; 810 } 811 812 /** 813 * @return {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.) 814 */ 815 public CodeableConcept getLanguage() { 816 if (this.language == null) 817 if (Configuration.errorOnAutoCreate()) 818 throw new Error("Attempt to auto-create PatientCommunicationComponent.language"); 819 else if (Configuration.doAutoCreate()) 820 this.language = new CodeableConcept(); // cc 821 return this.language; 822 } 823 824 public boolean hasLanguage() { 825 return this.language != null && !this.language.isEmpty(); 826 } 827 828 /** 829 * @param value {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.) 830 */ 831 public PatientCommunicationComponent setLanguage(CodeableConcept value) { 832 this.language = value; 833 return this; 834 } 835 836 /** 837 * @return {@link #preferred} (Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).). This is the underlying object with id, value and extensions. The accessor "getPreferred" gives direct access to the value 838 */ 839 public BooleanType getPreferredElement() { 840 if (this.preferred == null) 841 if (Configuration.errorOnAutoCreate()) 842 throw new Error("Attempt to auto-create PatientCommunicationComponent.preferred"); 843 else if (Configuration.doAutoCreate()) 844 this.preferred = new BooleanType(); // bb 845 return this.preferred; 846 } 847 848 public boolean hasPreferredElement() { 849 return this.preferred != null && !this.preferred.isEmpty(); 850 } 851 852 public boolean hasPreferred() { 853 return this.preferred != null && !this.preferred.isEmpty(); 854 } 855 856 /** 857 * @param value {@link #preferred} (Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).). This is the underlying object with id, value and extensions. The accessor "getPreferred" gives direct access to the value 858 */ 859 public PatientCommunicationComponent setPreferredElement(BooleanType value) { 860 this.preferred = value; 861 return this; 862 } 863 864 /** 865 * @return Indicates whether or not the patient prefers this language (over other languages he masters up a certain level). 866 */ 867 public boolean getPreferred() { 868 return this.preferred == null || this.preferred.isEmpty() ? false : this.preferred.getValue(); 869 } 870 871 /** 872 * @param value Indicates whether or not the patient prefers this language (over other languages he masters up a certain level). 873 */ 874 public PatientCommunicationComponent setPreferred(boolean value) { 875 if (this.preferred == null) 876 this.preferred = new BooleanType(); 877 this.preferred.setValue(value); 878 return this; 879 } 880 881 protected void listChildren(List<Property> childrenList) { 882 super.listChildren(childrenList); 883 childrenList.add(new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, java.lang.Integer.MAX_VALUE, language)); 884 childrenList.add(new Property("preferred", "boolean", "Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).", 0, java.lang.Integer.MAX_VALUE, preferred)); 885 } 886 887 @Override 888 public void setProperty(String name, Base value) throws FHIRException { 889 if (name.equals("language")) 890 this.language = castToCodeableConcept(value); // CodeableConcept 891 else if (name.equals("preferred")) 892 this.preferred = castToBoolean(value); // BooleanType 893 else 894 super.setProperty(name, value); 895 } 896 897 @Override 898 public Base addChild(String name) throws FHIRException { 899 if (name.equals("language")) { 900 this.language = new CodeableConcept(); 901 return this.language; 902 } 903 else if (name.equals("preferred")) { 904 throw new FHIRException("Cannot call addChild on a primitive type Patient.preferred"); 905 } 906 else 907 return super.addChild(name); 908 } 909 910 public PatientCommunicationComponent copy() { 911 PatientCommunicationComponent dst = new PatientCommunicationComponent(); 912 copyValues(dst); 913 dst.language = language == null ? null : language.copy(); 914 dst.preferred = preferred == null ? null : preferred.copy(); 915 return dst; 916 } 917 918 @Override 919 public boolean equalsDeep(Base other) { 920 if (!super.equalsDeep(other)) 921 return false; 922 if (!(other instanceof PatientCommunicationComponent)) 923 return false; 924 PatientCommunicationComponent o = (PatientCommunicationComponent) other; 925 return compareDeep(language, o.language, true) && compareDeep(preferred, o.preferred, true); 926 } 927 928 @Override 929 public boolean equalsShallow(Base other) { 930 if (!super.equalsShallow(other)) 931 return false; 932 if (!(other instanceof PatientCommunicationComponent)) 933 return false; 934 PatientCommunicationComponent o = (PatientCommunicationComponent) other; 935 return compareValues(preferred, o.preferred, true); 936 } 937 938 public boolean isEmpty() { 939 return super.isEmpty() && (language == null || language.isEmpty()) && (preferred == null || preferred.isEmpty()) 940 ; 941 } 942 943 public String fhirType() { 944 return "Patient.communication"; 945 946 } 947 948 } 949 950 @Block() 951 public static class PatientLinkComponent extends BackboneElement implements IBaseBackboneElement { 952 /** 953 * The other patient resource that the link refers to. 954 */ 955 @Child(name = "other", type = {Patient.class}, order=1, min=1, max=1, modifier=true, summary=false) 956 @Description(shortDefinition="The other patient resource that the link refers to", formalDefinition="The other patient resource that the link refers to." ) 957 protected Reference other; 958 959 /** 960 * The actual object that is the target of the reference (The other patient resource that the link refers to.) 961 */ 962 protected Patient otherTarget; 963 964 /** 965 * The type of link between this patient resource and another patient resource. 966 */ 967 @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=false) 968 @Description(shortDefinition="replace | refer | seealso - type of link", formalDefinition="The type of link between this patient resource and another patient resource." ) 969 protected Enumeration<LinkType> type; 970 971 private static final long serialVersionUID = -1942104050L; 972 973 /* 974 * Constructor 975 */ 976 public PatientLinkComponent() { 977 super(); 978 } 979 980 /* 981 * Constructor 982 */ 983 public PatientLinkComponent(Reference other, Enumeration<LinkType> type) { 984 super(); 985 this.other = other; 986 this.type = type; 987 } 988 989 /** 990 * @return {@link #other} (The other patient resource that the link refers to.) 991 */ 992 public Reference getOther() { 993 if (this.other == null) 994 if (Configuration.errorOnAutoCreate()) 995 throw new Error("Attempt to auto-create PatientLinkComponent.other"); 996 else if (Configuration.doAutoCreate()) 997 this.other = new Reference(); // cc 998 return this.other; 999 } 1000 1001 public boolean hasOther() { 1002 return this.other != null && !this.other.isEmpty(); 1003 } 1004 1005 /** 1006 * @param value {@link #other} (The other patient resource that the link refers to.) 1007 */ 1008 public PatientLinkComponent setOther(Reference value) { 1009 this.other = value; 1010 return this; 1011 } 1012 1013 /** 1014 * @return {@link #other} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The other patient resource that the link refers to.) 1015 */ 1016 public Patient getOtherTarget() { 1017 if (this.otherTarget == null) 1018 if (Configuration.errorOnAutoCreate()) 1019 throw new Error("Attempt to auto-create PatientLinkComponent.other"); 1020 else if (Configuration.doAutoCreate()) 1021 this.otherTarget = new Patient(); // aa 1022 return this.otherTarget; 1023 } 1024 1025 /** 1026 * @param value {@link #other} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The other patient resource that the link refers to.) 1027 */ 1028 public PatientLinkComponent setOtherTarget(Patient value) { 1029 this.otherTarget = value; 1030 return this; 1031 } 1032 1033 /** 1034 * @return {@link #type} (The type of link between this patient resource and another patient resource.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 1035 */ 1036 public Enumeration<LinkType> getTypeElement() { 1037 if (this.type == null) 1038 if (Configuration.errorOnAutoCreate()) 1039 throw new Error("Attempt to auto-create PatientLinkComponent.type"); 1040 else if (Configuration.doAutoCreate()) 1041 this.type = new Enumeration<LinkType>(new LinkTypeEnumFactory()); // bb 1042 return this.type; 1043 } 1044 1045 public boolean hasTypeElement() { 1046 return this.type != null && !this.type.isEmpty(); 1047 } 1048 1049 public boolean hasType() { 1050 return this.type != null && !this.type.isEmpty(); 1051 } 1052 1053 /** 1054 * @param value {@link #type} (The type of link between this patient resource and another patient resource.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 1055 */ 1056 public PatientLinkComponent setTypeElement(Enumeration<LinkType> value) { 1057 this.type = value; 1058 return this; 1059 } 1060 1061 /** 1062 * @return The type of link between this patient resource and another patient resource. 1063 */ 1064 public LinkType getType() { 1065 return this.type == null ? null : this.type.getValue(); 1066 } 1067 1068 /** 1069 * @param value The type of link between this patient resource and another patient resource. 1070 */ 1071 public PatientLinkComponent setType(LinkType value) { 1072 if (this.type == null) 1073 this.type = new Enumeration<LinkType>(new LinkTypeEnumFactory()); 1074 this.type.setValue(value); 1075 return this; 1076 } 1077 1078 protected void listChildren(List<Property> childrenList) { 1079 super.listChildren(childrenList); 1080 childrenList.add(new Property("other", "Reference(Patient)", "The other patient resource that the link refers to.", 0, java.lang.Integer.MAX_VALUE, other)); 1081 childrenList.add(new Property("type", "code", "The type of link between this patient resource and another patient resource.", 0, java.lang.Integer.MAX_VALUE, type)); 1082 } 1083 1084 @Override 1085 public void setProperty(String name, Base value) throws FHIRException { 1086 if (name.equals("other")) 1087 this.other = castToReference(value); // Reference 1088 else if (name.equals("type")) 1089 this.type = new LinkTypeEnumFactory().fromType(value); // Enumeration<LinkType> 1090 else 1091 super.setProperty(name, value); 1092 } 1093 1094 @Override 1095 public Base addChild(String name) throws FHIRException { 1096 if (name.equals("other")) { 1097 this.other = new Reference(); 1098 return this.other; 1099 } 1100 else if (name.equals("type")) { 1101 throw new FHIRException("Cannot call addChild on a primitive type Patient.type"); 1102 } 1103 else 1104 return super.addChild(name); 1105 } 1106 1107 public PatientLinkComponent copy() { 1108 PatientLinkComponent dst = new PatientLinkComponent(); 1109 copyValues(dst); 1110 dst.other = other == null ? null : other.copy(); 1111 dst.type = type == null ? null : type.copy(); 1112 return dst; 1113 } 1114 1115 @Override 1116 public boolean equalsDeep(Base other) { 1117 if (!super.equalsDeep(other)) 1118 return false; 1119 if (!(other instanceof PatientLinkComponent)) 1120 return false; 1121 PatientLinkComponent o = (PatientLinkComponent) other; 1122 return compareDeep(other, o.other, true) && compareDeep(type, o.type, true); 1123 } 1124 1125 @Override 1126 public boolean equalsShallow(Base other) { 1127 if (!super.equalsShallow(other)) 1128 return false; 1129 if (!(other instanceof PatientLinkComponent)) 1130 return false; 1131 PatientLinkComponent o = (PatientLinkComponent) other; 1132 return compareValues(type, o.type, true); 1133 } 1134 1135 public boolean isEmpty() { 1136 return super.isEmpty() && (other == null || other.isEmpty()) && (type == null || type.isEmpty()) 1137 ; 1138 } 1139 1140 public String fhirType() { 1141 return "Patient.link"; 1142 1143 } 1144 1145 } 1146 1147 /** 1148 * An identifier for this patient. 1149 */ 1150 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1151 @Description(shortDefinition="An identifier for this patient", formalDefinition="An identifier for this patient." ) 1152 protected List<Identifier> identifier; 1153 1154 /** 1155 * Whether this patient record is in active use. 1156 */ 1157 @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true) 1158 @Description(shortDefinition="Whether this patient's record is in active use", formalDefinition="Whether this patient record is in active use." ) 1159 protected BooleanType active; 1160 1161 /** 1162 * A name associated with the individual. 1163 */ 1164 @Child(name = "name", type = {HumanName.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1165 @Description(shortDefinition="A name associated with the patient", formalDefinition="A name associated with the individual." ) 1166 protected List<HumanName> name; 1167 1168 /** 1169 * A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted. 1170 */ 1171 @Child(name = "telecom", type = {ContactPoint.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1172 @Description(shortDefinition="A contact detail for the individual", formalDefinition="A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted." ) 1173 protected List<ContactPoint> telecom; 1174 1175 /** 1176 * Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes. 1177 */ 1178 @Child(name = "gender", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1179 @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes." ) 1180 protected Enumeration<AdministrativeGender> gender; 1181 1182 /** 1183 * The date of birth for the individual. 1184 */ 1185 @Child(name = "birthDate", type = {DateType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1186 @Description(shortDefinition="The date of birth for the individual", formalDefinition="The date of birth for the individual." ) 1187 protected DateType birthDate; 1188 1189 /** 1190 * Indicates if the individual is deceased or not. 1191 */ 1192 @Child(name = "deceased", type = {BooleanType.class, DateTimeType.class}, order=6, min=0, max=1, modifier=true, summary=true) 1193 @Description(shortDefinition="Indicates if the individual is deceased or not", formalDefinition="Indicates if the individual is deceased or not." ) 1194 protected Type deceased; 1195 1196 /** 1197 * Addresses for the individual. 1198 */ 1199 @Child(name = "address", type = {Address.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1200 @Description(shortDefinition="Addresses for the individual", formalDefinition="Addresses for the individual." ) 1201 protected List<Address> address; 1202 1203 /** 1204 * This field contains a patient's most recent marital (civil) status. 1205 */ 1206 @Child(name = "maritalStatus", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false) 1207 @Description(shortDefinition="Marital (civil) status of a patient", formalDefinition="This field contains a patient's most recent marital (civil) status." ) 1208 protected CodeableConcept maritalStatus; 1209 1210 /** 1211 * Indicates whether the patient is part of a multiple or indicates the actual birth order. 1212 */ 1213 @Child(name = "multipleBirth", type = {BooleanType.class, IntegerType.class}, order=9, min=0, max=1, modifier=false, summary=false) 1214 @Description(shortDefinition="Whether patient is part of a multiple birth", formalDefinition="Indicates whether the patient is part of a multiple or indicates the actual birth order." ) 1215 protected Type multipleBirth; 1216 1217 /** 1218 * Image of the patient. 1219 */ 1220 @Child(name = "photo", type = {Attachment.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1221 @Description(shortDefinition="Image of the patient", formalDefinition="Image of the patient." ) 1222 protected List<Attachment> photo; 1223 1224 /** 1225 * A contact party (e.g. guardian, partner, friend) for the patient. 1226 */ 1227 @Child(name = "contact", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1228 @Description(shortDefinition="A contact party (e.g. guardian, partner, friend) for the patient", formalDefinition="A contact party (e.g. guardian, partner, friend) for the patient." ) 1229 protected List<ContactComponent> contact; 1230 1231 /** 1232 * This patient is known to be an animal. 1233 */ 1234 @Child(name = "animal", type = {}, order=12, min=0, max=1, modifier=true, summary=true) 1235 @Description(shortDefinition="This patient is known to be an animal (non-human)", formalDefinition="This patient is known to be an animal." ) 1236 protected AnimalComponent animal; 1237 1238 /** 1239 * Languages which may be used to communicate with the patient about his or her health. 1240 */ 1241 @Child(name = "communication", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1242 @Description(shortDefinition="A list of Languages which may be used to communicate with the patient about his or her health", formalDefinition="Languages which may be used to communicate with the patient about his or her health." ) 1243 protected List<PatientCommunicationComponent> communication; 1244 1245 /** 1246 * Patient's nominated care provider. 1247 */ 1248 @Child(name = "careProvider", type = {Organization.class, Practitioner.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1249 @Description(shortDefinition="Patient's nominated primary care provider", formalDefinition="Patient's nominated care provider." ) 1250 protected List<Reference> careProvider; 1251 /** 1252 * The actual objects that are the target of the reference (Patient's nominated care provider.) 1253 */ 1254 protected List<Resource> careProviderTarget; 1255 1256 1257 /** 1258 * Organization that is the custodian of the patient record. 1259 */ 1260 @Child(name = "managingOrganization", type = {Organization.class}, order=15, min=0, max=1, modifier=false, summary=true) 1261 @Description(shortDefinition="Organization that is the custodian of the patient record", formalDefinition="Organization that is the custodian of the patient record." ) 1262 protected Reference managingOrganization; 1263 1264 /** 1265 * The actual object that is the target of the reference (Organization that is the custodian of the patient record.) 1266 */ 1267 protected Organization managingOrganizationTarget; 1268 1269 /** 1270 * Link to another patient resource that concerns the same actual patient. 1271 */ 1272 @Child(name = "link", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false) 1273 @Description(shortDefinition="Link to another patient resource that concerns the same actual person", formalDefinition="Link to another patient resource that concerns the same actual patient." ) 1274 protected List<PatientLinkComponent> link; 1275 1276 private static final long serialVersionUID = 2019992554L; 1277 1278 /* 1279 * Constructor 1280 */ 1281 public Patient() { 1282 super(); 1283 } 1284 1285 /** 1286 * @return {@link #identifier} (An identifier for this patient.) 1287 */ 1288 public List<Identifier> getIdentifier() { 1289 if (this.identifier == null) 1290 this.identifier = new ArrayList<Identifier>(); 1291 return this.identifier; 1292 } 1293 1294 public boolean hasIdentifier() { 1295 if (this.identifier == null) 1296 return false; 1297 for (Identifier item : this.identifier) 1298 if (!item.isEmpty()) 1299 return true; 1300 return false; 1301 } 1302 1303 /** 1304 * @return {@link #identifier} (An identifier for this patient.) 1305 */ 1306 // syntactic sugar 1307 public Identifier addIdentifier() { //3 1308 Identifier t = new Identifier(); 1309 if (this.identifier == null) 1310 this.identifier = new ArrayList<Identifier>(); 1311 this.identifier.add(t); 1312 return t; 1313 } 1314 1315 // syntactic sugar 1316 public Patient addIdentifier(Identifier t) { //3 1317 if (t == null) 1318 return this; 1319 if (this.identifier == null) 1320 this.identifier = new ArrayList<Identifier>(); 1321 this.identifier.add(t); 1322 return this; 1323 } 1324 1325 /** 1326 * @return {@link #active} (Whether this patient record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 1327 */ 1328 public BooleanType getActiveElement() { 1329 if (this.active == null) 1330 if (Configuration.errorOnAutoCreate()) 1331 throw new Error("Attempt to auto-create Patient.active"); 1332 else if (Configuration.doAutoCreate()) 1333 this.active = new BooleanType(); // bb 1334 return this.active; 1335 } 1336 1337 public boolean hasActiveElement() { 1338 return this.active != null && !this.active.isEmpty(); 1339 } 1340 1341 public boolean hasActive() { 1342 return this.active != null && !this.active.isEmpty(); 1343 } 1344 1345 /** 1346 * @param value {@link #active} (Whether this patient record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 1347 */ 1348 public Patient setActiveElement(BooleanType value) { 1349 this.active = value; 1350 return this; 1351 } 1352 1353 /** 1354 * @return Whether this patient record is in active use. 1355 */ 1356 public boolean getActive() { 1357 return this.active == null || this.active.isEmpty() ? false : this.active.getValue(); 1358 } 1359 1360 /** 1361 * @param value Whether this patient record is in active use. 1362 */ 1363 public Patient setActive(boolean value) { 1364 if (this.active == null) 1365 this.active = new BooleanType(); 1366 this.active.setValue(value); 1367 return this; 1368 } 1369 1370 /** 1371 * @return {@link #name} (A name associated with the individual.) 1372 */ 1373 public List<HumanName> getName() { 1374 if (this.name == null) 1375 this.name = new ArrayList<HumanName>(); 1376 return this.name; 1377 } 1378 1379 public boolean hasName() { 1380 if (this.name == null) 1381 return false; 1382 for (HumanName item : this.name) 1383 if (!item.isEmpty()) 1384 return true; 1385 return false; 1386 } 1387 1388 /** 1389 * @return {@link #name} (A name associated with the individual.) 1390 */ 1391 // syntactic sugar 1392 public HumanName addName() { //3 1393 HumanName t = new HumanName(); 1394 if (this.name == null) 1395 this.name = new ArrayList<HumanName>(); 1396 this.name.add(t); 1397 return t; 1398 } 1399 1400 // syntactic sugar 1401 public Patient addName(HumanName t) { //3 1402 if (t == null) 1403 return this; 1404 if (this.name == null) 1405 this.name = new ArrayList<HumanName>(); 1406 this.name.add(t); 1407 return this; 1408 } 1409 1410 /** 1411 * @return {@link #telecom} (A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.) 1412 */ 1413 public List<ContactPoint> getTelecom() { 1414 if (this.telecom == null) 1415 this.telecom = new ArrayList<ContactPoint>(); 1416 return this.telecom; 1417 } 1418 1419 public boolean hasTelecom() { 1420 if (this.telecom == null) 1421 return false; 1422 for (ContactPoint item : this.telecom) 1423 if (!item.isEmpty()) 1424 return true; 1425 return false; 1426 } 1427 1428 /** 1429 * @return {@link #telecom} (A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.) 1430 */ 1431 // syntactic sugar 1432 public ContactPoint addTelecom() { //3 1433 ContactPoint t = new ContactPoint(); 1434 if (this.telecom == null) 1435 this.telecom = new ArrayList<ContactPoint>(); 1436 this.telecom.add(t); 1437 return t; 1438 } 1439 1440 // syntactic sugar 1441 public Patient addTelecom(ContactPoint t) { //3 1442 if (t == null) 1443 return this; 1444 if (this.telecom == null) 1445 this.telecom = new ArrayList<ContactPoint>(); 1446 this.telecom.add(t); 1447 return this; 1448 } 1449 1450 /** 1451 * @return {@link #gender} (Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value 1452 */ 1453 public Enumeration<AdministrativeGender> getGenderElement() { 1454 if (this.gender == null) 1455 if (Configuration.errorOnAutoCreate()) 1456 throw new Error("Attempt to auto-create Patient.gender"); 1457 else if (Configuration.doAutoCreate()) 1458 this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb 1459 return this.gender; 1460 } 1461 1462 public boolean hasGenderElement() { 1463 return this.gender != null && !this.gender.isEmpty(); 1464 } 1465 1466 public boolean hasGender() { 1467 return this.gender != null && !this.gender.isEmpty(); 1468 } 1469 1470 /** 1471 * @param value {@link #gender} (Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value 1472 */ 1473 public Patient setGenderElement(Enumeration<AdministrativeGender> value) { 1474 this.gender = value; 1475 return this; 1476 } 1477 1478 /** 1479 * @return Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes. 1480 */ 1481 public AdministrativeGender getGender() { 1482 return this.gender == null ? null : this.gender.getValue(); 1483 } 1484 1485 /** 1486 * @param value Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes. 1487 */ 1488 public Patient setGender(AdministrativeGender value) { 1489 if (value == null) 1490 this.gender = null; 1491 else { 1492 if (this.gender == null) 1493 this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); 1494 this.gender.setValue(value); 1495 } 1496 return this; 1497 } 1498 1499 /** 1500 * @return {@link #birthDate} (The date of birth for the individual.). This is the underlying object with id, value and extensions. The accessor "getBirthDate" gives direct access to the value 1501 */ 1502 public DateType getBirthDateElement() { 1503 if (this.birthDate == null) 1504 if (Configuration.errorOnAutoCreate()) 1505 throw new Error("Attempt to auto-create Patient.birthDate"); 1506 else if (Configuration.doAutoCreate()) 1507 this.birthDate = new DateType(); // bb 1508 return this.birthDate; 1509 } 1510 1511 public boolean hasBirthDateElement() { 1512 return this.birthDate != null && !this.birthDate.isEmpty(); 1513 } 1514 1515 public boolean hasBirthDate() { 1516 return this.birthDate != null && !this.birthDate.isEmpty(); 1517 } 1518 1519 /** 1520 * @param value {@link #birthDate} (The date of birth for the individual.). This is the underlying object with id, value and extensions. The accessor "getBirthDate" gives direct access to the value 1521 */ 1522 public Patient setBirthDateElement(DateType value) { 1523 this.birthDate = value; 1524 return this; 1525 } 1526 1527 /** 1528 * @return The date of birth for the individual. 1529 */ 1530 public Date getBirthDate() { 1531 return this.birthDate == null ? null : this.birthDate.getValue(); 1532 } 1533 1534 /** 1535 * @param value The date of birth for the individual. 1536 */ 1537 public Patient setBirthDate(Date value) { 1538 if (value == null) 1539 this.birthDate = null; 1540 else { 1541 if (this.birthDate == null) 1542 this.birthDate = new DateType(); 1543 this.birthDate.setValue(value); 1544 } 1545 return this; 1546 } 1547 1548 /** 1549 * @return {@link #deceased} (Indicates if the individual is deceased or not.) 1550 */ 1551 public Type getDeceased() { 1552 return this.deceased; 1553 } 1554 1555 /** 1556 * @return {@link #deceased} (Indicates if the individual is deceased or not.) 1557 */ 1558 public BooleanType getDeceasedBooleanType() throws FHIRException { 1559 if (!(this.deceased instanceof BooleanType)) 1560 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.deceased.getClass().getName()+" was encountered"); 1561 return (BooleanType) this.deceased; 1562 } 1563 1564 public boolean hasDeceasedBooleanType() { 1565 return this.deceased instanceof BooleanType; 1566 } 1567 1568 /** 1569 * @return {@link #deceased} (Indicates if the individual is deceased or not.) 1570 */ 1571 public DateTimeType getDeceasedDateTimeType() throws FHIRException { 1572 if (!(this.deceased instanceof DateTimeType)) 1573 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.deceased.getClass().getName()+" was encountered"); 1574 return (DateTimeType) this.deceased; 1575 } 1576 1577 public boolean hasDeceasedDateTimeType() { 1578 return this.deceased instanceof DateTimeType; 1579 } 1580 1581 public boolean hasDeceased() { 1582 return this.deceased != null && !this.deceased.isEmpty(); 1583 } 1584 1585 /** 1586 * @param value {@link #deceased} (Indicates if the individual is deceased or not.) 1587 */ 1588 public Patient setDeceased(Type value) { 1589 this.deceased = value; 1590 return this; 1591 } 1592 1593 /** 1594 * @return {@link #address} (Addresses for the individual.) 1595 */ 1596 public List<Address> getAddress() { 1597 if (this.address == null) 1598 this.address = new ArrayList<Address>(); 1599 return this.address; 1600 } 1601 1602 public boolean hasAddress() { 1603 if (this.address == null) 1604 return false; 1605 for (Address item : this.address) 1606 if (!item.isEmpty()) 1607 return true; 1608 return false; 1609 } 1610 1611 /** 1612 * @return {@link #address} (Addresses for the individual.) 1613 */ 1614 // syntactic sugar 1615 public Address addAddress() { //3 1616 Address t = new Address(); 1617 if (this.address == null) 1618 this.address = new ArrayList<Address>(); 1619 this.address.add(t); 1620 return t; 1621 } 1622 1623 // syntactic sugar 1624 public Patient addAddress(Address t) { //3 1625 if (t == null) 1626 return this; 1627 if (this.address == null) 1628 this.address = new ArrayList<Address>(); 1629 this.address.add(t); 1630 return this; 1631 } 1632 1633 /** 1634 * @return {@link #maritalStatus} (This field contains a patient's most recent marital (civil) status.) 1635 */ 1636 public CodeableConcept getMaritalStatus() { 1637 if (this.maritalStatus == null) 1638 if (Configuration.errorOnAutoCreate()) 1639 throw new Error("Attempt to auto-create Patient.maritalStatus"); 1640 else if (Configuration.doAutoCreate()) 1641 this.maritalStatus = new CodeableConcept(); // cc 1642 return this.maritalStatus; 1643 } 1644 1645 public boolean hasMaritalStatus() { 1646 return this.maritalStatus != null && !this.maritalStatus.isEmpty(); 1647 } 1648 1649 /** 1650 * @param value {@link #maritalStatus} (This field contains a patient's most recent marital (civil) status.) 1651 */ 1652 public Patient setMaritalStatus(CodeableConcept value) { 1653 this.maritalStatus = value; 1654 return this; 1655 } 1656 1657 /** 1658 * @return {@link #multipleBirth} (Indicates whether the patient is part of a multiple or indicates the actual birth order.) 1659 */ 1660 public Type getMultipleBirth() { 1661 return this.multipleBirth; 1662 } 1663 1664 /** 1665 * @return {@link #multipleBirth} (Indicates whether the patient is part of a multiple or indicates the actual birth order.) 1666 */ 1667 public BooleanType getMultipleBirthBooleanType() throws FHIRException { 1668 if (!(this.multipleBirth instanceof BooleanType)) 1669 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.multipleBirth.getClass().getName()+" was encountered"); 1670 return (BooleanType) this.multipleBirth; 1671 } 1672 1673 public boolean hasMultipleBirthBooleanType() { 1674 return this.multipleBirth instanceof BooleanType; 1675 } 1676 1677 /** 1678 * @return {@link #multipleBirth} (Indicates whether the patient is part of a multiple or indicates the actual birth order.) 1679 */ 1680 public IntegerType getMultipleBirthIntegerType() throws FHIRException { 1681 if (!(this.multipleBirth instanceof IntegerType)) 1682 throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.multipleBirth.getClass().getName()+" was encountered"); 1683 return (IntegerType) this.multipleBirth; 1684 } 1685 1686 public boolean hasMultipleBirthIntegerType() { 1687 return this.multipleBirth instanceof IntegerType; 1688 } 1689 1690 public boolean hasMultipleBirth() { 1691 return this.multipleBirth != null && !this.multipleBirth.isEmpty(); 1692 } 1693 1694 /** 1695 * @param value {@link #multipleBirth} (Indicates whether the patient is part of a multiple or indicates the actual birth order.) 1696 */ 1697 public Patient setMultipleBirth(Type value) { 1698 this.multipleBirth = value; 1699 return this; 1700 } 1701 1702 /** 1703 * @return {@link #photo} (Image of the patient.) 1704 */ 1705 public List<Attachment> getPhoto() { 1706 if (this.photo == null) 1707 this.photo = new ArrayList<Attachment>(); 1708 return this.photo; 1709 } 1710 1711 public boolean hasPhoto() { 1712 if (this.photo == null) 1713 return false; 1714 for (Attachment item : this.photo) 1715 if (!item.isEmpty()) 1716 return true; 1717 return false; 1718 } 1719 1720 /** 1721 * @return {@link #photo} (Image of the patient.) 1722 */ 1723 // syntactic sugar 1724 public Attachment addPhoto() { //3 1725 Attachment t = new Attachment(); 1726 if (this.photo == null) 1727 this.photo = new ArrayList<Attachment>(); 1728 this.photo.add(t); 1729 return t; 1730 } 1731 1732 // syntactic sugar 1733 public Patient addPhoto(Attachment t) { //3 1734 if (t == null) 1735 return this; 1736 if (this.photo == null) 1737 this.photo = new ArrayList<Attachment>(); 1738 this.photo.add(t); 1739 return this; 1740 } 1741 1742 /** 1743 * @return {@link #contact} (A contact party (e.g. guardian, partner, friend) for the patient.) 1744 */ 1745 public List<ContactComponent> getContact() { 1746 if (this.contact == null) 1747 this.contact = new ArrayList<ContactComponent>(); 1748 return this.contact; 1749 } 1750 1751 public boolean hasContact() { 1752 if (this.contact == null) 1753 return false; 1754 for (ContactComponent item : this.contact) 1755 if (!item.isEmpty()) 1756 return true; 1757 return false; 1758 } 1759 1760 /** 1761 * @return {@link #contact} (A contact party (e.g. guardian, partner, friend) for the patient.) 1762 */ 1763 // syntactic sugar 1764 public ContactComponent addContact() { //3 1765 ContactComponent t = new ContactComponent(); 1766 if (this.contact == null) 1767 this.contact = new ArrayList<ContactComponent>(); 1768 this.contact.add(t); 1769 return t; 1770 } 1771 1772 // syntactic sugar 1773 public Patient addContact(ContactComponent t) { //3 1774 if (t == null) 1775 return this; 1776 if (this.contact == null) 1777 this.contact = new ArrayList<ContactComponent>(); 1778 this.contact.add(t); 1779 return this; 1780 } 1781 1782 /** 1783 * @return {@link #animal} (This patient is known to be an animal.) 1784 */ 1785 public AnimalComponent getAnimal() { 1786 if (this.animal == null) 1787 if (Configuration.errorOnAutoCreate()) 1788 throw new Error("Attempt to auto-create Patient.animal"); 1789 else if (Configuration.doAutoCreate()) 1790 this.animal = new AnimalComponent(); // cc 1791 return this.animal; 1792 } 1793 1794 public boolean hasAnimal() { 1795 return this.animal != null && !this.animal.isEmpty(); 1796 } 1797 1798 /** 1799 * @param value {@link #animal} (This patient is known to be an animal.) 1800 */ 1801 public Patient setAnimal(AnimalComponent value) { 1802 this.animal = value; 1803 return this; 1804 } 1805 1806 /** 1807 * @return {@link #communication} (Languages which may be used to communicate with the patient about his or her health.) 1808 */ 1809 public List<PatientCommunicationComponent> getCommunication() { 1810 if (this.communication == null) 1811 this.communication = new ArrayList<PatientCommunicationComponent>(); 1812 return this.communication; 1813 } 1814 1815 public boolean hasCommunication() { 1816 if (this.communication == null) 1817 return false; 1818 for (PatientCommunicationComponent item : this.communication) 1819 if (!item.isEmpty()) 1820 return true; 1821 return false; 1822 } 1823 1824 /** 1825 * @return {@link #communication} (Languages which may be used to communicate with the patient about his or her health.) 1826 */ 1827 // syntactic sugar 1828 public PatientCommunicationComponent addCommunication() { //3 1829 PatientCommunicationComponent t = new PatientCommunicationComponent(); 1830 if (this.communication == null) 1831 this.communication = new ArrayList<PatientCommunicationComponent>(); 1832 this.communication.add(t); 1833 return t; 1834 } 1835 1836 // syntactic sugar 1837 public Patient addCommunication(PatientCommunicationComponent t) { //3 1838 if (t == null) 1839 return this; 1840 if (this.communication == null) 1841 this.communication = new ArrayList<PatientCommunicationComponent>(); 1842 this.communication.add(t); 1843 return this; 1844 } 1845 1846 /** 1847 * @return {@link #careProvider} (Patient's nominated care provider.) 1848 */ 1849 public List<Reference> getCareProvider() { 1850 if (this.careProvider == null) 1851 this.careProvider = new ArrayList<Reference>(); 1852 return this.careProvider; 1853 } 1854 1855 public boolean hasCareProvider() { 1856 if (this.careProvider == null) 1857 return false; 1858 for (Reference item : this.careProvider) 1859 if (!item.isEmpty()) 1860 return true; 1861 return false; 1862 } 1863 1864 /** 1865 * @return {@link #careProvider} (Patient's nominated care provider.) 1866 */ 1867 // syntactic sugar 1868 public Reference addCareProvider() { //3 1869 Reference t = new Reference(); 1870 if (this.careProvider == null) 1871 this.careProvider = new ArrayList<Reference>(); 1872 this.careProvider.add(t); 1873 return t; 1874 } 1875 1876 // syntactic sugar 1877 public Patient addCareProvider(Reference t) { //3 1878 if (t == null) 1879 return this; 1880 if (this.careProvider == null) 1881 this.careProvider = new ArrayList<Reference>(); 1882 this.careProvider.add(t); 1883 return this; 1884 } 1885 1886 /** 1887 * @return {@link #careProvider} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Patient's nominated care provider.) 1888 */ 1889 public List<Resource> getCareProviderTarget() { 1890 if (this.careProviderTarget == null) 1891 this.careProviderTarget = new ArrayList<Resource>(); 1892 return this.careProviderTarget; 1893 } 1894 1895 /** 1896 * @return {@link #managingOrganization} (Organization that is the custodian of the patient record.) 1897 */ 1898 public Reference getManagingOrganization() { 1899 if (this.managingOrganization == null) 1900 if (Configuration.errorOnAutoCreate()) 1901 throw new Error("Attempt to auto-create Patient.managingOrganization"); 1902 else if (Configuration.doAutoCreate()) 1903 this.managingOrganization = new Reference(); // cc 1904 return this.managingOrganization; 1905 } 1906 1907 public boolean hasManagingOrganization() { 1908 return this.managingOrganization != null && !this.managingOrganization.isEmpty(); 1909 } 1910 1911 /** 1912 * @param value {@link #managingOrganization} (Organization that is the custodian of the patient record.) 1913 */ 1914 public Patient setManagingOrganization(Reference value) { 1915 this.managingOrganization = value; 1916 return this; 1917 } 1918 1919 /** 1920 * @return {@link #managingOrganization} 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. (Organization that is the custodian of the patient record.) 1921 */ 1922 public Organization getManagingOrganizationTarget() { 1923 if (this.managingOrganizationTarget == null) 1924 if (Configuration.errorOnAutoCreate()) 1925 throw new Error("Attempt to auto-create Patient.managingOrganization"); 1926 else if (Configuration.doAutoCreate()) 1927 this.managingOrganizationTarget = new Organization(); // aa 1928 return this.managingOrganizationTarget; 1929 } 1930 1931 /** 1932 * @param value {@link #managingOrganization} 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. (Organization that is the custodian of the patient record.) 1933 */ 1934 public Patient setManagingOrganizationTarget(Organization value) { 1935 this.managingOrganizationTarget = value; 1936 return this; 1937 } 1938 1939 /** 1940 * @return {@link #link} (Link to another patient resource that concerns the same actual patient.) 1941 */ 1942 public List<PatientLinkComponent> getLink() { 1943 if (this.link == null) 1944 this.link = new ArrayList<PatientLinkComponent>(); 1945 return this.link; 1946 } 1947 1948 public boolean hasLink() { 1949 if (this.link == null) 1950 return false; 1951 for (PatientLinkComponent item : this.link) 1952 if (!item.isEmpty()) 1953 return true; 1954 return false; 1955 } 1956 1957 /** 1958 * @return {@link #link} (Link to another patient resource that concerns the same actual patient.) 1959 */ 1960 // syntactic sugar 1961 public PatientLinkComponent addLink() { //3 1962 PatientLinkComponent t = new PatientLinkComponent(); 1963 if (this.link == null) 1964 this.link = new ArrayList<PatientLinkComponent>(); 1965 this.link.add(t); 1966 return t; 1967 } 1968 1969 // syntactic sugar 1970 public Patient addLink(PatientLinkComponent t) { //3 1971 if (t == null) 1972 return this; 1973 if (this.link == null) 1974 this.link = new ArrayList<PatientLinkComponent>(); 1975 this.link.add(t); 1976 return this; 1977 } 1978 1979 protected void listChildren(List<Property> childrenList) { 1980 super.listChildren(childrenList); 1981 childrenList.add(new Property("identifier", "Identifier", "An identifier for this patient.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1982 childrenList.add(new Property("active", "boolean", "Whether this patient record is in active use.", 0, java.lang.Integer.MAX_VALUE, active)); 1983 childrenList.add(new Property("name", "HumanName", "A name associated with the individual.", 0, java.lang.Integer.MAX_VALUE, name)); 1984 childrenList.add(new Property("telecom", "ContactPoint", "A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.", 0, java.lang.Integer.MAX_VALUE, telecom)); 1985 childrenList.add(new Property("gender", "code", "Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.", 0, java.lang.Integer.MAX_VALUE, gender)); 1986 childrenList.add(new Property("birthDate", "date", "The date of birth for the individual.", 0, java.lang.Integer.MAX_VALUE, birthDate)); 1987 childrenList.add(new Property("deceased[x]", "boolean|dateTime", "Indicates if the individual is deceased or not.", 0, java.lang.Integer.MAX_VALUE, deceased)); 1988 childrenList.add(new Property("address", "Address", "Addresses for the individual.", 0, java.lang.Integer.MAX_VALUE, address)); 1989 childrenList.add(new Property("maritalStatus", "CodeableConcept", "This field contains a patient's most recent marital (civil) status.", 0, java.lang.Integer.MAX_VALUE, maritalStatus)); 1990 childrenList.add(new Property("multipleBirth[x]", "boolean|integer", "Indicates whether the patient is part of a multiple or indicates the actual birth order.", 0, java.lang.Integer.MAX_VALUE, multipleBirth)); 1991 childrenList.add(new Property("photo", "Attachment", "Image of the patient.", 0, java.lang.Integer.MAX_VALUE, photo)); 1992 childrenList.add(new Property("contact", "", "A contact party (e.g. guardian, partner, friend) for the patient.", 0, java.lang.Integer.MAX_VALUE, contact)); 1993 childrenList.add(new Property("animal", "", "This patient is known to be an animal.", 0, java.lang.Integer.MAX_VALUE, animal)); 1994 childrenList.add(new Property("communication", "", "Languages which may be used to communicate with the patient about his or her health.", 0, java.lang.Integer.MAX_VALUE, communication)); 1995 childrenList.add(new Property("careProvider", "Reference(Organization|Practitioner)", "Patient's nominated care provider.", 0, java.lang.Integer.MAX_VALUE, careProvider)); 1996 childrenList.add(new Property("managingOrganization", "Reference(Organization)", "Organization that is the custodian of the patient record.", 0, java.lang.Integer.MAX_VALUE, managingOrganization)); 1997 childrenList.add(new Property("link", "", "Link to another patient resource that concerns the same actual patient.", 0, java.lang.Integer.MAX_VALUE, link)); 1998 } 1999 2000 @Override 2001 public void setProperty(String name, Base value) throws FHIRException { 2002 if (name.equals("identifier")) 2003 this.getIdentifier().add(castToIdentifier(value)); 2004 else if (name.equals("active")) 2005 this.active = castToBoolean(value); // BooleanType 2006 else if (name.equals("name")) 2007 this.getName().add(castToHumanName(value)); 2008 else if (name.equals("telecom")) 2009 this.getTelecom().add(castToContactPoint(value)); 2010 else if (name.equals("gender")) 2011 this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender> 2012 else if (name.equals("birthDate")) 2013 this.birthDate = castToDate(value); // DateType 2014 else if (name.equals("deceased[x]")) 2015 this.deceased = (Type) value; // Type 2016 else if (name.equals("address")) 2017 this.getAddress().add(castToAddress(value)); 2018 else if (name.equals("maritalStatus")) 2019 this.maritalStatus = castToCodeableConcept(value); // CodeableConcept 2020 else if (name.equals("multipleBirth[x]")) 2021 this.multipleBirth = (Type) value; // Type 2022 else if (name.equals("photo")) 2023 this.getPhoto().add(castToAttachment(value)); 2024 else if (name.equals("contact")) 2025 this.getContact().add((ContactComponent) value); 2026 else if (name.equals("animal")) 2027 this.animal = (AnimalComponent) value; // AnimalComponent 2028 else if (name.equals("communication")) 2029 this.getCommunication().add((PatientCommunicationComponent) value); 2030 else if (name.equals("careProvider")) 2031 this.getCareProvider().add(castToReference(value)); 2032 else if (name.equals("managingOrganization")) 2033 this.managingOrganization = castToReference(value); // Reference 2034 else if (name.equals("link")) 2035 this.getLink().add((PatientLinkComponent) value); 2036 else 2037 super.setProperty(name, value); 2038 } 2039 2040 @Override 2041 public Base addChild(String name) throws FHIRException { 2042 if (name.equals("identifier")) { 2043 return addIdentifier(); 2044 } 2045 else if (name.equals("active")) { 2046 throw new FHIRException("Cannot call addChild on a primitive type Patient.active"); 2047 } 2048 else if (name.equals("name")) { 2049 return addName(); 2050 } 2051 else if (name.equals("telecom")) { 2052 return addTelecom(); 2053 } 2054 else if (name.equals("gender")) { 2055 throw new FHIRException("Cannot call addChild on a primitive type Patient.gender"); 2056 } 2057 else if (name.equals("birthDate")) { 2058 throw new FHIRException("Cannot call addChild on a primitive type Patient.birthDate"); 2059 } 2060 else if (name.equals("deceasedBoolean")) { 2061 this.deceased = new BooleanType(); 2062 return this.deceased; 2063 } 2064 else if (name.equals("deceasedDateTime")) { 2065 this.deceased = new DateTimeType(); 2066 return this.deceased; 2067 } 2068 else if (name.equals("address")) { 2069 return addAddress(); 2070 } 2071 else if (name.equals("maritalStatus")) { 2072 this.maritalStatus = new CodeableConcept(); 2073 return this.maritalStatus; 2074 } 2075 else if (name.equals("multipleBirthBoolean")) { 2076 this.multipleBirth = new BooleanType(); 2077 return this.multipleBirth; 2078 } 2079 else if (name.equals("multipleBirthInteger")) { 2080 this.multipleBirth = new IntegerType(); 2081 return this.multipleBirth; 2082 } 2083 else if (name.equals("photo")) { 2084 return addPhoto(); 2085 } 2086 else if (name.equals("contact")) { 2087 return addContact(); 2088 } 2089 else if (name.equals("animal")) { 2090 this.animal = new AnimalComponent(); 2091 return this.animal; 2092 } 2093 else if (name.equals("communication")) { 2094 return addCommunication(); 2095 } 2096 else if (name.equals("careProvider")) { 2097 return addCareProvider(); 2098 } 2099 else if (name.equals("managingOrganization")) { 2100 this.managingOrganization = new Reference(); 2101 return this.managingOrganization; 2102 } 2103 else if (name.equals("link")) { 2104 return addLink(); 2105 } 2106 else 2107 return super.addChild(name); 2108 } 2109 2110 public String fhirType() { 2111 return "Patient"; 2112 2113 } 2114 2115 public Patient copy() { 2116 Patient dst = new Patient(); 2117 copyValues(dst); 2118 if (identifier != null) { 2119 dst.identifier = new ArrayList<Identifier>(); 2120 for (Identifier i : identifier) 2121 dst.identifier.add(i.copy()); 2122 }; 2123 dst.active = active == null ? null : active.copy(); 2124 if (name != null) { 2125 dst.name = new ArrayList<HumanName>(); 2126 for (HumanName i : name) 2127 dst.name.add(i.copy()); 2128 }; 2129 if (telecom != null) { 2130 dst.telecom = new ArrayList<ContactPoint>(); 2131 for (ContactPoint i : telecom) 2132 dst.telecom.add(i.copy()); 2133 }; 2134 dst.gender = gender == null ? null : gender.copy(); 2135 dst.birthDate = birthDate == null ? null : birthDate.copy(); 2136 dst.deceased = deceased == null ? null : deceased.copy(); 2137 if (address != null) { 2138 dst.address = new ArrayList<Address>(); 2139 for (Address i : address) 2140 dst.address.add(i.copy()); 2141 }; 2142 dst.maritalStatus = maritalStatus == null ? null : maritalStatus.copy(); 2143 dst.multipleBirth = multipleBirth == null ? null : multipleBirth.copy(); 2144 if (photo != null) { 2145 dst.photo = new ArrayList<Attachment>(); 2146 for (Attachment i : photo) 2147 dst.photo.add(i.copy()); 2148 }; 2149 if (contact != null) { 2150 dst.contact = new ArrayList<ContactComponent>(); 2151 for (ContactComponent i : contact) 2152 dst.contact.add(i.copy()); 2153 }; 2154 dst.animal = animal == null ? null : animal.copy(); 2155 if (communication != null) { 2156 dst.communication = new ArrayList<PatientCommunicationComponent>(); 2157 for (PatientCommunicationComponent i : communication) 2158 dst.communication.add(i.copy()); 2159 }; 2160 if (careProvider != null) { 2161 dst.careProvider = new ArrayList<Reference>(); 2162 for (Reference i : careProvider) 2163 dst.careProvider.add(i.copy()); 2164 }; 2165 dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy(); 2166 if (link != null) { 2167 dst.link = new ArrayList<PatientLinkComponent>(); 2168 for (PatientLinkComponent i : link) 2169 dst.link.add(i.copy()); 2170 }; 2171 return dst; 2172 } 2173 2174 protected Patient typedCopy() { 2175 return copy(); 2176 } 2177 2178 @Override 2179 public boolean equalsDeep(Base other) { 2180 if (!super.equalsDeep(other)) 2181 return false; 2182 if (!(other instanceof Patient)) 2183 return false; 2184 Patient o = (Patient) other; 2185 return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(name, o.name, true) 2186 && compareDeep(telecom, o.telecom, true) && compareDeep(gender, o.gender, true) && compareDeep(birthDate, o.birthDate, true) 2187 && compareDeep(deceased, o.deceased, true) && compareDeep(address, o.address, true) && compareDeep(maritalStatus, o.maritalStatus, true) 2188 && compareDeep(multipleBirth, o.multipleBirth, true) && compareDeep(photo, o.photo, true) && compareDeep(contact, o.contact, true) 2189 && compareDeep(animal, o.animal, true) && compareDeep(communication, o.communication, true) && compareDeep(careProvider, o.careProvider, true) 2190 && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(link, o.link, true) 2191 ; 2192 } 2193 2194 @Override 2195 public boolean equalsShallow(Base other) { 2196 if (!super.equalsShallow(other)) 2197 return false; 2198 if (!(other instanceof Patient)) 2199 return false; 2200 Patient o = (Patient) other; 2201 return compareValues(active, o.active, true) && compareValues(gender, o.gender, true) && compareValues(birthDate, o.birthDate, true) 2202 ; 2203 } 2204 2205 public boolean isEmpty() { 2206 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (active == null || active.isEmpty()) 2207 && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty()) && (gender == null || gender.isEmpty()) 2208 && (birthDate == null || birthDate.isEmpty()) && (deceased == null || deceased.isEmpty()) 2209 && (address == null || address.isEmpty()) && (maritalStatus == null || maritalStatus.isEmpty()) 2210 && (multipleBirth == null || multipleBirth.isEmpty()) && (photo == null || photo.isEmpty()) 2211 && (contact == null || contact.isEmpty()) && (animal == null || animal.isEmpty()) && (communication == null || communication.isEmpty()) 2212 && (careProvider == null || careProvider.isEmpty()) && (managingOrganization == null || managingOrganization.isEmpty()) 2213 && (link == null || link.isEmpty()); 2214 } 2215 2216 @Override 2217 public ResourceType getResourceType() { 2218 return ResourceType.Patient; 2219 } 2220 2221 @SearchParamDefinition(name="birthdate", path="Patient.birthDate", description="The patient's date of birth", type="date" ) 2222 public static final String SP_BIRTHDATE = "birthdate"; 2223 @SearchParamDefinition(name="deceased", path="Patient.deceased[x]", description="This patient has been marked as deceased, or as a death date entered", type="token" ) 2224 public static final String SP_DECEASED = "deceased"; 2225 @SearchParamDefinition(name="address-state", path="Patient.address.state", description="A state specified in an address", type="string" ) 2226 public static final String SP_ADDRESSSTATE = "address-state"; 2227 @SearchParamDefinition(name="gender", path="Patient.gender", description="Gender of the patient", type="token" ) 2228 public static final String SP_GENDER = "gender"; 2229 @SearchParamDefinition(name="animal-species", path="Patient.animal.species", description="The species for animal patients", type="token" ) 2230 public static final String SP_ANIMALSPECIES = "animal-species"; 2231 @SearchParamDefinition(name="link", path="Patient.link.other", description="All patients linked to the given patient", type="reference" ) 2232 public static final String SP_LINK = "link"; 2233 @SearchParamDefinition(name="language", path="Patient.communication.language", description="Language code (irrespective of use value)", type="token" ) 2234 public static final String SP_LANGUAGE = "language"; 2235 @SearchParamDefinition(name="deathdate", path="Patient.deceasedDateTime", description="The date of death has been provided and satisfies this search value", type="date" ) 2236 public static final String SP_DEATHDATE = "deathdate"; 2237 @SearchParamDefinition(name="animal-breed", path="Patient.animal.breed", description="The breed for animal patients", type="token" ) 2238 public static final String SP_ANIMALBREED = "animal-breed"; 2239 @SearchParamDefinition(name="address-country", path="Patient.address.country", description="A country specified in an address", type="string" ) 2240 public static final String SP_ADDRESSCOUNTRY = "address-country"; 2241 @SearchParamDefinition(name="phonetic", path="Patient.name", description="A portion of either family or given name using some kind of phonetic matching algorithm", type="string" ) 2242 public static final String SP_PHONETIC = "phonetic"; 2243 @SearchParamDefinition(name="telecom", path="Patient.telecom", description="The value in any kind of telecom details of the patient", type="token" ) 2244 public static final String SP_TELECOM = "telecom"; 2245 @SearchParamDefinition(name="address-city", path="Patient.address.city", description="A city specified in an address", type="string" ) 2246 public static final String SP_ADDRESSCITY = "address-city"; 2247 @SearchParamDefinition(name="email", path="Patient.telecom.where(system='email')", description="A value in an email contact", type="token" ) 2248 public static final String SP_EMAIL = "email"; 2249 @SearchParamDefinition(name="identifier", path="Patient.identifier", description="A patient identifier", type="token" ) 2250 public static final String SP_IDENTIFIER = "identifier"; 2251 @SearchParamDefinition(name="given", path="Patient.name.given", description="A portion of the given name of the patient", type="string" ) 2252 public static final String SP_GIVEN = "given"; 2253 @SearchParamDefinition(name="address", path="Patient.address", description="An address in any kind of address/part of the patient", type="string" ) 2254 public static final String SP_ADDRESS = "address"; 2255 @SearchParamDefinition(name="active", path="Patient.active", description="Whether the patient record is active", type="token" ) 2256 public static final String SP_ACTIVE = "active"; 2257 @SearchParamDefinition(name="address-postalcode", path="Patient.address.postalCode", description="A postalCode specified in an address", type="string" ) 2258 public static final String SP_ADDRESSPOSTALCODE = "address-postalcode"; 2259 @SearchParamDefinition(name="careprovider", path="Patient.careProvider", description="Patient's nominated care provider, could be a care manager, not the organization that manages the record", type="reference" ) 2260 public static final String SP_CAREPROVIDER = "careprovider"; 2261 @SearchParamDefinition(name="phone", path="Patient.telecom.where(system='phone')", description="A value in a phone contact", type="token" ) 2262 public static final String SP_PHONE = "phone"; 2263 @SearchParamDefinition(name="organization", path="Patient.managingOrganization", description="The organization at which this person is a patient", type="reference" ) 2264 public static final String SP_ORGANIZATION = "organization"; 2265 @SearchParamDefinition(name="name", path="Patient.name", description="A portion of either family or given name of the patient", type="string" ) 2266 public static final String SP_NAME = "name"; 2267 @SearchParamDefinition(name="address-use", path="Patient.address.use", description="A use code specified in an address", type="token" ) 2268 public static final String SP_ADDRESSUSE = "address-use"; 2269 @SearchParamDefinition(name="family", path="Patient.name.family", description="A portion of the family name of the patient", type="string" ) 2270 public static final String SP_FAMILY = "family"; 2271 2272}