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