001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
040import org.hl7.fhir.r4.model.Enumerations.AdministrativeGenderEnumFactory;
041
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047
048/**
049 * Demographics and other administrative information about an individual or
050 * animal receiving care or other health-related services.
051 */
052@ResourceDef(name = "Patient", profile = "http://hl7.org/fhir/StructureDefinition/Patient")
053public class Patient extends DomainResource {
054
055  public enum LinkType {
056    /**
057     * The patient resource containing this link must no longer be used. The link
058     * points forward to another patient resource that must be used in lieu of the
059     * patient resource that contains this link.
060     */
061    REPLACEDBY,
062    /**
063     * The patient resource containing this link is the current active patient
064     * record. The link points back to an inactive patient resource that has been
065     * merged into this resource, and should be consulted to retrieve additional
066     * referenced information.
067     */
068    REPLACES,
069    /**
070     * The patient resource containing this link is in use and valid but not
071     * considered the main source of information about a patient. The link points
072     * forward to another patient resource that should be consulted to retrieve
073     * additional patient information.
074     */
075    REFER,
076    /**
077     * The patient resource containing this link is in use and valid, but points to
078     * another patient resource that is known to contain data about the same person.
079     * Data in this resource might overlap or contradict information found in the
080     * other patient resource. This link does not indicate any relative importance
081     * of the resources concerned, and both should be regarded as equally valid.
082     */
083    SEEALSO,
084    /**
085     * added to help the parsers with the generic types
086     */
087    NULL;
088
089    public static LinkType fromCode(String codeString) throws FHIRException {
090      if (codeString == null || "".equals(codeString))
091        return null;
092      if ("replaced-by".equals(codeString))
093        return REPLACEDBY;
094      if ("replaces".equals(codeString))
095        return REPLACES;
096      if ("refer".equals(codeString))
097        return REFER;
098      if ("seealso".equals(codeString))
099        return SEEALSO;
100      if (Configuration.isAcceptInvalidEnums())
101        return null;
102      else
103        throw new FHIRException("Unknown LinkType code '" + codeString + "'");
104    }
105
106    public String toCode() {
107      switch (this) {
108      case REPLACEDBY:
109        return "replaced-by";
110      case REPLACES:
111        return "replaces";
112      case REFER:
113        return "refer";
114      case SEEALSO:
115        return "seealso";
116      case NULL:
117        return null;
118      default:
119        return "?";
120      }
121    }
122
123    public String getSystem() {
124      switch (this) {
125      case REPLACEDBY:
126        return "http://hl7.org/fhir/link-type";
127      case REPLACES:
128        return "http://hl7.org/fhir/link-type";
129      case REFER:
130        return "http://hl7.org/fhir/link-type";
131      case SEEALSO:
132        return "http://hl7.org/fhir/link-type";
133      case NULL:
134        return null;
135      default:
136        return "?";
137      }
138    }
139
140    public String getDefinition() {
141      switch (this) {
142      case REPLACEDBY:
143        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.";
144      case REPLACES:
145        return "The patient resource containing this link is the current active patient record. The link points back to an inactive patient resource that has been merged into this resource, and should be consulted to retrieve additional referenced information.";
146      case REFER:
147        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.";
148      case SEEALSO:
149        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.";
150      case NULL:
151        return null;
152      default:
153        return "?";
154      }
155    }
156
157    public String getDisplay() {
158      switch (this) {
159      case REPLACEDBY:
160        return "Replaced-by";
161      case REPLACES:
162        return "Replaces";
163      case REFER:
164        return "Refer";
165      case SEEALSO:
166        return "See also";
167      case NULL:
168        return null;
169      default:
170        return "?";
171      }
172    }
173  }
174
175  public static class LinkTypeEnumFactory implements EnumFactory<LinkType> {
176    public LinkType fromCode(String codeString) throws IllegalArgumentException {
177      if (codeString == null || "".equals(codeString))
178        if (codeString == null || "".equals(codeString))
179          return null;
180      if ("replaced-by".equals(codeString))
181        return LinkType.REPLACEDBY;
182      if ("replaces".equals(codeString))
183        return LinkType.REPLACES;
184      if ("refer".equals(codeString))
185        return LinkType.REFER;
186      if ("seealso".equals(codeString))
187        return LinkType.SEEALSO;
188      throw new IllegalArgumentException("Unknown LinkType code '" + codeString + "'");
189    }
190
191    public Enumeration<LinkType> fromType(PrimitiveType<?> code) throws FHIRException {
192      if (code == null)
193        return null;
194      if (code.isEmpty())
195        return new Enumeration<LinkType>(this, LinkType.NULL, code);
196      String codeString = code.asStringValue();
197      if (codeString == null || "".equals(codeString))
198        return new Enumeration<LinkType>(this, LinkType.NULL, code);
199      if ("replaced-by".equals(codeString))
200        return new Enumeration<LinkType>(this, LinkType.REPLACEDBY, code);
201      if ("replaces".equals(codeString))
202        return new Enumeration<LinkType>(this, LinkType.REPLACES, code);
203      if ("refer".equals(codeString))
204        return new Enumeration<LinkType>(this, LinkType.REFER, code);
205      if ("seealso".equals(codeString))
206        return new Enumeration<LinkType>(this, LinkType.SEEALSO, code);
207      throw new FHIRException("Unknown LinkType code '" + codeString + "'");
208    }
209
210    public String toCode(LinkType code) {
211      if (code == LinkType.REPLACEDBY)
212        return "replaced-by";
213      if (code == LinkType.REPLACES)
214        return "replaces";
215      if (code == LinkType.REFER)
216        return "refer";
217      if (code == LinkType.SEEALSO)
218        return "seealso";
219      return "?";
220    }
221
222    public String toSystem(LinkType code) {
223      return code.getSystem();
224    }
225  }
226
227  @Block()
228  public static class ContactComponent extends BackboneElement implements IBaseBackboneElement {
229    /**
230     * The nature of the relationship between the patient and the contact person.
231     */
232    @Child(name = "relationship", type = {
233        CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
234    @Description(shortDefinition = "The kind of relationship", formalDefinition = "The nature of the relationship between the patient and the contact person.")
235    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/patient-contactrelationship")
236    protected List<CodeableConcept> relationship;
237
238    /**
239     * A name associated with the contact person.
240     */
241    @Child(name = "name", type = { HumanName.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
242    @Description(shortDefinition = "A name associated with the contact person", formalDefinition = "A name associated with the contact person.")
243    protected HumanName name;
244
245    /**
246     * A contact detail for the person, e.g. a telephone number or an email address.
247     */
248    @Child(name = "telecom", type = {
249        ContactPoint.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
250    @Description(shortDefinition = "A contact detail for the person", formalDefinition = "A contact detail for the person, e.g. a telephone number or an email address.")
251    protected List<ContactPoint> telecom;
252
253    /**
254     * Address for the contact person.
255     */
256    @Child(name = "address", type = { Address.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
257    @Description(shortDefinition = "Address for the contact person", formalDefinition = "Address for the contact person.")
258    protected Address address;
259
260    /**
261     * Administrative Gender - the gender that the contact person is considered to
262     * have for administration and record keeping purposes.
263     */
264    @Child(name = "gender", type = { CodeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
265    @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.")
266    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/administrative-gender")
267    protected Enumeration<AdministrativeGender> gender;
268
269    /**
270     * Organization on behalf of which the contact is acting or for which the
271     * contact is working.
272     */
273    @Child(name = "organization", type = {
274        Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
275    @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.")
276    protected Reference organization;
277
278    /**
279     * The actual object that is the target of the reference (Organization on behalf
280     * of which the contact is acting or for which the contact is working.)
281     */
282    protected Organization organizationTarget;
283
284    /**
285     * The period during which this contact person or organization is valid to be
286     * contacted relating to this patient.
287     */
288    @Child(name = "period", type = { Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
289    @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.")
290    protected Period period;
291
292    private static final long serialVersionUID = 364269017L;
293
294    /**
295     * Constructor
296     */
297    public ContactComponent() {
298      super();
299    }
300
301    /**
302     * @return {@link #relationship} (The nature of the relationship between the
303     *         patient and the contact person.)
304     */
305    public List<CodeableConcept> getRelationship() {
306      if (this.relationship == null)
307        this.relationship = new ArrayList<CodeableConcept>();
308      return this.relationship;
309    }
310
311    /**
312     * @return Returns a reference to <code>this</code> for easy method chaining
313     */
314    public ContactComponent setRelationship(List<CodeableConcept> theRelationship) {
315      this.relationship = theRelationship;
316      return this;
317    }
318
319    public boolean hasRelationship() {
320      if (this.relationship == null)
321        return false;
322      for (CodeableConcept item : this.relationship)
323        if (!item.isEmpty())
324          return true;
325      return false;
326    }
327
328    public CodeableConcept addRelationship() { // 3
329      CodeableConcept t = new CodeableConcept();
330      if (this.relationship == null)
331        this.relationship = new ArrayList<CodeableConcept>();
332      this.relationship.add(t);
333      return t;
334    }
335
336    public ContactComponent addRelationship(CodeableConcept t) { // 3
337      if (t == null)
338        return this;
339      if (this.relationship == null)
340        this.relationship = new ArrayList<CodeableConcept>();
341      this.relationship.add(t);
342      return this;
343    }
344
345    /**
346     * @return The first repetition of repeating field {@link #relationship},
347     *         creating it if it does not already exist
348     */
349    public CodeableConcept getRelationshipFirstRep() {
350      if (getRelationship().isEmpty()) {
351        addRelationship();
352      }
353      return getRelationship().get(0);
354    }
355
356    /**
357     * @return {@link #name} (A name associated with the contact person.)
358     */
359    public HumanName getName() {
360      if (this.name == null)
361        if (Configuration.errorOnAutoCreate())
362          throw new Error("Attempt to auto-create ContactComponent.name");
363        else if (Configuration.doAutoCreate())
364          this.name = new HumanName(); // cc
365      return this.name;
366    }
367
368    public boolean hasName() {
369      return this.name != null && !this.name.isEmpty();
370    }
371
372    /**
373     * @param value {@link #name} (A name associated with the contact person.)
374     */
375    public ContactComponent setName(HumanName value) {
376      this.name = value;
377      return this;
378    }
379
380    /**
381     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone
382     *         number or an email address.)
383     */
384    public List<ContactPoint> getTelecom() {
385      if (this.telecom == null)
386        this.telecom = new ArrayList<ContactPoint>();
387      return this.telecom;
388    }
389
390    /**
391     * @return Returns a reference to <code>this</code> for easy method chaining
392     */
393    public ContactComponent setTelecom(List<ContactPoint> theTelecom) {
394      this.telecom = theTelecom;
395      return this;
396    }
397
398    public boolean hasTelecom() {
399      if (this.telecom == null)
400        return false;
401      for (ContactPoint item : this.telecom)
402        if (!item.isEmpty())
403          return true;
404      return false;
405    }
406
407    public ContactPoint addTelecom() { // 3
408      ContactPoint t = new ContactPoint();
409      if (this.telecom == null)
410        this.telecom = new ArrayList<ContactPoint>();
411      this.telecom.add(t);
412      return t;
413    }
414
415    public ContactComponent addTelecom(ContactPoint t) { // 3
416      if (t == null)
417        return this;
418      if (this.telecom == null)
419        this.telecom = new ArrayList<ContactPoint>();
420      this.telecom.add(t);
421      return this;
422    }
423
424    /**
425     * @return The first repetition of repeating field {@link #telecom}, creating it
426     *         if it does not already exist
427     */
428    public ContactPoint getTelecomFirstRep() {
429      if (getTelecom().isEmpty()) {
430        addTelecom();
431      }
432      return getTelecom().get(0);
433    }
434
435    /**
436     * @return {@link #address} (Address for the contact person.)
437     */
438    public Address getAddress() {
439      if (this.address == null)
440        if (Configuration.errorOnAutoCreate())
441          throw new Error("Attempt to auto-create ContactComponent.address");
442        else if (Configuration.doAutoCreate())
443          this.address = new Address(); // cc
444      return this.address;
445    }
446
447    public boolean hasAddress() {
448      return this.address != null && !this.address.isEmpty();
449    }
450
451    /**
452     * @param value {@link #address} (Address for the contact person.)
453     */
454    public ContactComponent setAddress(Address value) {
455      this.address = value;
456      return this;
457    }
458
459    /**
460     * @return {@link #gender} (Administrative Gender - the gender that the contact
461     *         person is considered to have for administration and record keeping
462     *         purposes.). This is the underlying object with id, value and
463     *         extensions. The accessor "getGender" gives direct access to the value
464     */
465    public Enumeration<AdministrativeGender> getGenderElement() {
466      if (this.gender == null)
467        if (Configuration.errorOnAutoCreate())
468          throw new Error("Attempt to auto-create ContactComponent.gender");
469        else if (Configuration.doAutoCreate())
470          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
471      return this.gender;
472    }
473
474    public boolean hasGenderElement() {
475      return this.gender != null && !this.gender.isEmpty();
476    }
477
478    public boolean hasGender() {
479      return this.gender != null && !this.gender.isEmpty();
480    }
481
482    /**
483     * @param value {@link #gender} (Administrative Gender - the gender that the
484     *              contact person is considered to have for administration and
485     *              record keeping purposes.). This is the underlying object with
486     *              id, value and extensions. The accessor "getGender" gives direct
487     *              access to the value
488     */
489    public ContactComponent setGenderElement(Enumeration<AdministrativeGender> value) {
490      this.gender = value;
491      return this;
492    }
493
494    /**
495     * @return Administrative Gender - the gender that the contact person is
496     *         considered to have for administration and record keeping purposes.
497     */
498    public AdministrativeGender getGender() {
499      return this.gender == null ? null : this.gender.getValue();
500    }
501
502    /**
503     * @param value Administrative Gender - the gender that the contact person is
504     *              considered to have for administration and record keeping
505     *              purposes.
506     */
507    public ContactComponent setGender(AdministrativeGender value) {
508      if (value == null)
509        this.gender = null;
510      else {
511        if (this.gender == null)
512          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
513        this.gender.setValue(value);
514      }
515      return this;
516    }
517
518    /**
519     * @return {@link #organization} (Organization on behalf of which the contact is
520     *         acting or for which the contact is working.)
521     */
522    public Reference getOrganization() {
523      if (this.organization == null)
524        if (Configuration.errorOnAutoCreate())
525          throw new Error("Attempt to auto-create ContactComponent.organization");
526        else if (Configuration.doAutoCreate())
527          this.organization = new Reference(); // cc
528      return this.organization;
529    }
530
531    public boolean hasOrganization() {
532      return this.organization != null && !this.organization.isEmpty();
533    }
534
535    /**
536     * @param value {@link #organization} (Organization on behalf of which the
537     *              contact is acting or for which the contact is working.)
538     */
539    public ContactComponent setOrganization(Reference value) {
540      this.organization = value;
541      return this;
542    }
543
544    /**
545     * @return {@link #organization} The actual object that is the target of the
546     *         reference. The reference library doesn't populate this, but you can
547     *         use it to hold the resource if you resolve it. (Organization on
548     *         behalf of which the contact is acting or for which the contact is
549     *         working.)
550     */
551    public Organization getOrganizationTarget() {
552      if (this.organizationTarget == null)
553        if (Configuration.errorOnAutoCreate())
554          throw new Error("Attempt to auto-create ContactComponent.organization");
555        else if (Configuration.doAutoCreate())
556          this.organizationTarget = new Organization(); // aa
557      return this.organizationTarget;
558    }
559
560    /**
561     * @param value {@link #organization} The actual object that is the target of
562     *              the reference. The reference library doesn't use these, but you
563     *              can use it to hold the resource if you resolve it. (Organization
564     *              on behalf of which the contact is acting or for which the
565     *              contact is working.)
566     */
567    public ContactComponent setOrganizationTarget(Organization value) {
568      this.organizationTarget = value;
569      return this;
570    }
571
572    /**
573     * @return {@link #period} (The period during which this contact person or
574     *         organization is valid to be contacted relating to this patient.)
575     */
576    public Period getPeriod() {
577      if (this.period == null)
578        if (Configuration.errorOnAutoCreate())
579          throw new Error("Attempt to auto-create ContactComponent.period");
580        else if (Configuration.doAutoCreate())
581          this.period = new Period(); // cc
582      return this.period;
583    }
584
585    public boolean hasPeriod() {
586      return this.period != null && !this.period.isEmpty();
587    }
588
589    /**
590     * @param value {@link #period} (The period during which this contact person or
591     *              organization is valid to be contacted relating to this patient.)
592     */
593    public ContactComponent setPeriod(Period value) {
594      this.period = value;
595      return this;
596    }
597
598    protected void listChildren(List<Property> children) {
599      super.listChildren(children);
600      children.add(new Property("relationship", "CodeableConcept",
601          "The nature of the relationship between the patient and the contact person.", 0, java.lang.Integer.MAX_VALUE,
602          relationship));
603      children.add(new Property("name", "HumanName", "A name associated with the contact person.", 0, 1, name));
604      children.add(new Property("telecom", "ContactPoint",
605          "A contact detail for the person, e.g. a telephone number or an email address.", 0,
606          java.lang.Integer.MAX_VALUE, telecom));
607      children.add(new Property("address", "Address", "Address for the contact person.", 0, 1, address));
608      children.add(new Property("gender", "code",
609          "Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.",
610          0, 1, gender));
611      children.add(new Property("organization", "Reference(Organization)",
612          "Organization on behalf of which the contact is acting or for which the contact is working.", 0, 1,
613          organization));
614      children.add(new Property("period", "Period",
615          "The period during which this contact person or organization is valid to be contacted relating to this patient.",
616          0, 1, period));
617    }
618
619    @Override
620    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
621      switch (_hash) {
622      case -261851592:
623        /* relationship */ return new Property("relationship", "CodeableConcept",
624            "The nature of the relationship between the patient and the contact person.", 0,
625            java.lang.Integer.MAX_VALUE, relationship);
626      case 3373707:
627        /* name */ return new Property("name", "HumanName", "A name associated with the contact person.", 0, 1, name);
628      case -1429363305:
629        /* telecom */ return new Property("telecom", "ContactPoint",
630            "A contact detail for the person, e.g. a telephone number or an email address.", 0,
631            java.lang.Integer.MAX_VALUE, telecom);
632      case -1147692044:
633        /* address */ return new Property("address", "Address", "Address for the contact person.", 0, 1, address);
634      case -1249512767:
635        /* gender */ return new Property("gender", "code",
636            "Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.",
637            0, 1, gender);
638      case 1178922291:
639        /* organization */ return new Property("organization", "Reference(Organization)",
640            "Organization on behalf of which the contact is acting or for which the contact is working.", 0, 1,
641            organization);
642      case -991726143:
643        /* period */ return new Property("period", "Period",
644            "The period during which this contact person or organization is valid to be contacted relating to this patient.",
645            0, 1, period);
646      default:
647        return super.getNamedProperty(_hash, _name, _checkValid);
648      }
649
650    }
651
652    @Override
653    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
654      switch (hash) {
655      case -261851592:
656        /* relationship */ return this.relationship == null ? new Base[0]
657            : this.relationship.toArray(new Base[this.relationship.size()]); // CodeableConcept
658      case 3373707:
659        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // HumanName
660      case -1429363305:
661        /* telecom */ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
662      case -1147692044:
663        /* address */ return this.address == null ? new Base[0] : new Base[] { this.address }; // Address
664      case -1249512767:
665        /* gender */ return this.gender == null ? new Base[0] : new Base[] { this.gender }; // Enumeration<AdministrativeGender>
666      case 1178922291:
667        /* organization */ return this.organization == null ? new Base[0] : new Base[] { this.organization }; // Reference
668      case -991726143:
669        /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
670      default:
671        return super.getProperty(hash, name, checkValid);
672      }
673
674    }
675
676    @Override
677    public Base setProperty(int hash, String name, Base value) throws FHIRException {
678      switch (hash) {
679      case -261851592: // relationship
680        this.getRelationship().add(castToCodeableConcept(value)); // CodeableConcept
681        return value;
682      case 3373707: // name
683        this.name = castToHumanName(value); // HumanName
684        return value;
685      case -1429363305: // telecom
686        this.getTelecom().add(castToContactPoint(value)); // ContactPoint
687        return value;
688      case -1147692044: // address
689        this.address = castToAddress(value); // Address
690        return value;
691      case -1249512767: // gender
692        value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
693        this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
694        return value;
695      case 1178922291: // organization
696        this.organization = castToReference(value); // Reference
697        return value;
698      case -991726143: // period
699        this.period = castToPeriod(value); // Period
700        return value;
701      default:
702        return super.setProperty(hash, name, value);
703      }
704
705    }
706
707    @Override
708    public Base setProperty(String name, Base value) throws FHIRException {
709      if (name.equals("relationship")) {
710        this.getRelationship().add(castToCodeableConcept(value));
711      } else if (name.equals("name")) {
712        this.name = castToHumanName(value); // HumanName
713      } else if (name.equals("telecom")) {
714        this.getTelecom().add(castToContactPoint(value));
715      } else if (name.equals("address")) {
716        this.address = castToAddress(value); // Address
717      } else if (name.equals("gender")) {
718        value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
719        this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
720      } else if (name.equals("organization")) {
721        this.organization = castToReference(value); // Reference
722      } else if (name.equals("period")) {
723        this.period = castToPeriod(value); // Period
724      } else
725        return super.setProperty(name, value);
726      return value;
727    }
728
729    @Override
730    public Base makeProperty(int hash, String name) throws FHIRException {
731      switch (hash) {
732      case -261851592:
733        return addRelationship();
734      case 3373707:
735        return getName();
736      case -1429363305:
737        return addTelecom();
738      case -1147692044:
739        return getAddress();
740      case -1249512767:
741        return getGenderElement();
742      case 1178922291:
743        return getOrganization();
744      case -991726143:
745        return getPeriod();
746      default:
747        return super.makeProperty(hash, name);
748      }
749
750    }
751
752    @Override
753    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
754      switch (hash) {
755      case -261851592:
756        /* relationship */ return new String[] { "CodeableConcept" };
757      case 3373707:
758        /* name */ return new String[] { "HumanName" };
759      case -1429363305:
760        /* telecom */ return new String[] { "ContactPoint" };
761      case -1147692044:
762        /* address */ return new String[] { "Address" };
763      case -1249512767:
764        /* gender */ return new String[] { "code" };
765      case 1178922291:
766        /* organization */ return new String[] { "Reference" };
767      case -991726143:
768        /* period */ return new String[] { "Period" };
769      default:
770        return super.getTypesForProperty(hash, name);
771      }
772
773    }
774
775    @Override
776    public Base addChild(String name) throws FHIRException {
777      if (name.equals("relationship")) {
778        return addRelationship();
779      } else if (name.equals("name")) {
780        this.name = new HumanName();
781        return this.name;
782      } else if (name.equals("telecom")) {
783        return addTelecom();
784      } else if (name.equals("address")) {
785        this.address = new Address();
786        return this.address;
787      } else if (name.equals("gender")) {
788        throw new FHIRException("Cannot call addChild on a singleton property Patient.gender");
789      } else if (name.equals("organization")) {
790        this.organization = new Reference();
791        return this.organization;
792      } else if (name.equals("period")) {
793        this.period = new Period();
794        return this.period;
795      } else
796        return super.addChild(name);
797    }
798
799    public ContactComponent copy() {
800      ContactComponent dst = new ContactComponent();
801      copyValues(dst);
802      return dst;
803    }
804
805    public void copyValues(ContactComponent dst) {
806      super.copyValues(dst);
807      if (relationship != null) {
808        dst.relationship = new ArrayList<CodeableConcept>();
809        for (CodeableConcept i : relationship)
810          dst.relationship.add(i.copy());
811      }
812      ;
813      dst.name = name == null ? null : name.copy();
814      if (telecom != null) {
815        dst.telecom = new ArrayList<ContactPoint>();
816        for (ContactPoint i : telecom)
817          dst.telecom.add(i.copy());
818      }
819      ;
820      dst.address = address == null ? null : address.copy();
821      dst.gender = gender == null ? null : gender.copy();
822      dst.organization = organization == null ? null : organization.copy();
823      dst.period = period == null ? null : period.copy();
824    }
825
826    @Override
827    public boolean equalsDeep(Base other_) {
828      if (!super.equalsDeep(other_))
829        return false;
830      if (!(other_ instanceof ContactComponent))
831        return false;
832      ContactComponent o = (ContactComponent) other_;
833      return compareDeep(relationship, o.relationship, true) && compareDeep(name, o.name, true)
834          && compareDeep(telecom, o.telecom, true) && compareDeep(address, o.address, true)
835          && compareDeep(gender, o.gender, true) && compareDeep(organization, o.organization, true)
836          && compareDeep(period, o.period, true);
837    }
838
839    @Override
840    public boolean equalsShallow(Base other_) {
841      if (!super.equalsShallow(other_))
842        return false;
843      if (!(other_ instanceof ContactComponent))
844        return false;
845      ContactComponent o = (ContactComponent) other_;
846      return compareValues(gender, o.gender, true);
847    }
848
849    public boolean isEmpty() {
850      return super.isEmpty()
851          && ca.uhn.fhir.util.ElementUtil.isEmpty(relationship, name, telecom, address, gender, organization, period);
852    }
853
854    public String fhirType() {
855      return "Patient.contact";
856
857    }
858
859  }
860
861  @Block()
862  public static class PatientCommunicationComponent extends BackboneElement implements IBaseBackboneElement {
863    /**
864     * The ISO-639-1 alpha 2 code in lower case for the language, optionally
865     * followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper
866     * case; e.g. "en" for English, or "en-US" for American English versus "en-EN"
867     * for England English.
868     */
869    @Child(name = "language", type = {
870        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
871    @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.")
872    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/languages")
873    protected CodeableConcept language;
874
875    /**
876     * Indicates whether or not the patient prefers this language (over other
877     * languages he masters up a certain level).
878     */
879    @Child(name = "preferred", type = {
880        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
881    @Description(shortDefinition = "Language preference indicator", formalDefinition = "Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).")
882    protected BooleanType preferred;
883
884    private static final long serialVersionUID = 633792918L;
885
886    /**
887     * Constructor
888     */
889    public PatientCommunicationComponent() {
890      super();
891    }
892
893    /**
894     * Constructor
895     */
896    public PatientCommunicationComponent(CodeableConcept language) {
897      super();
898      this.language = language;
899    }
900
901    /**
902     * @return {@link #language} (The ISO-639-1 alpha 2 code in lower case for the
903     *         language, optionally followed by a hyphen and the ISO-3166-1 alpha 2
904     *         code for the region in upper case; e.g. "en" for English, or "en-US"
905     *         for American English versus "en-EN" for England English.)
906     */
907    public CodeableConcept getLanguage() {
908      if (this.language == null)
909        if (Configuration.errorOnAutoCreate())
910          throw new Error("Attempt to auto-create PatientCommunicationComponent.language");
911        else if (Configuration.doAutoCreate())
912          this.language = new CodeableConcept(); // cc
913      return this.language;
914    }
915
916    public boolean hasLanguage() {
917      return this.language != null && !this.language.isEmpty();
918    }
919
920    /**
921     * @param value {@link #language} (The ISO-639-1 alpha 2 code in lower case for
922     *              the language, optionally followed by a hyphen and the ISO-3166-1
923     *              alpha 2 code for the region in upper case; e.g. "en" for
924     *              English, or "en-US" for American English versus "en-EN" for
925     *              England English.)
926     */
927    public PatientCommunicationComponent setLanguage(CodeableConcept value) {
928      this.language = value;
929      return this;
930    }
931
932    /**
933     * @return {@link #preferred} (Indicates whether or not the patient prefers this
934     *         language (over other languages he masters up a certain level).). This
935     *         is the underlying object with id, value and extensions. The accessor
936     *         "getPreferred" gives direct access to the value
937     */
938    public BooleanType getPreferredElement() {
939      if (this.preferred == null)
940        if (Configuration.errorOnAutoCreate())
941          throw new Error("Attempt to auto-create PatientCommunicationComponent.preferred");
942        else if (Configuration.doAutoCreate())
943          this.preferred = new BooleanType(); // bb
944      return this.preferred;
945    }
946
947    public boolean hasPreferredElement() {
948      return this.preferred != null && !this.preferred.isEmpty();
949    }
950
951    public boolean hasPreferred() {
952      return this.preferred != null && !this.preferred.isEmpty();
953    }
954
955    /**
956     * @param value {@link #preferred} (Indicates whether or not the patient prefers
957     *              this language (over other languages he masters up a certain
958     *              level).). This is the underlying object with id, value and
959     *              extensions. The accessor "getPreferred" gives direct access to
960     *              the value
961     */
962    public PatientCommunicationComponent setPreferredElement(BooleanType value) {
963      this.preferred = value;
964      return this;
965    }
966
967    /**
968     * @return Indicates whether or not the patient prefers this language (over
969     *         other languages he masters up a certain level).
970     */
971    public boolean getPreferred() {
972      return this.preferred == null || this.preferred.isEmpty() ? false : this.preferred.getValue();
973    }
974
975    /**
976     * @param value Indicates whether or not the patient prefers this language (over
977     *              other languages he masters up a certain level).
978     */
979    public PatientCommunicationComponent setPreferred(boolean value) {
980      if (this.preferred == null)
981        this.preferred = new BooleanType();
982      this.preferred.setValue(value);
983      return this;
984    }
985
986    protected void listChildren(List<Property> children) {
987      super.listChildren(children);
988      children.add(new Property("language", "CodeableConcept",
989          "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.",
990          0, 1, language));
991      children.add(new Property("preferred", "boolean",
992          "Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).",
993          0, 1, preferred));
994    }
995
996    @Override
997    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
998      switch (_hash) {
999      case -1613589672:
1000        /* language */ return new Property("language", "CodeableConcept",
1001            "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.",
1002            0, 1, language);
1003      case -1294005119:
1004        /* preferred */ return new Property("preferred", "boolean",
1005            "Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).",
1006            0, 1, preferred);
1007      default:
1008        return super.getNamedProperty(_hash, _name, _checkValid);
1009      }
1010
1011    }
1012
1013    @Override
1014    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1015      switch (hash) {
1016      case -1613589672:
1017        /* language */ return this.language == null ? new Base[0] : new Base[] { this.language }; // CodeableConcept
1018      case -1294005119:
1019        /* preferred */ return this.preferred == null ? new Base[0] : new Base[] { this.preferred }; // BooleanType
1020      default:
1021        return super.getProperty(hash, name, checkValid);
1022      }
1023
1024    }
1025
1026    @Override
1027    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1028      switch (hash) {
1029      case -1613589672: // language
1030        this.language = castToCodeableConcept(value); // CodeableConcept
1031        return value;
1032      case -1294005119: // preferred
1033        this.preferred = castToBoolean(value); // BooleanType
1034        return value;
1035      default:
1036        return super.setProperty(hash, name, value);
1037      }
1038
1039    }
1040
1041    @Override
1042    public Base setProperty(String name, Base value) throws FHIRException {
1043      if (name.equals("language")) {
1044        this.language = castToCodeableConcept(value); // CodeableConcept
1045      } else if (name.equals("preferred")) {
1046        this.preferred = castToBoolean(value); // BooleanType
1047      } else
1048        return super.setProperty(name, value);
1049      return value;
1050    }
1051
1052    @Override
1053    public Base makeProperty(int hash, String name) throws FHIRException {
1054      switch (hash) {
1055      case -1613589672:
1056        return getLanguage();
1057      case -1294005119:
1058        return getPreferredElement();
1059      default:
1060        return super.makeProperty(hash, name);
1061      }
1062
1063    }
1064
1065    @Override
1066    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1067      switch (hash) {
1068      case -1613589672:
1069        /* language */ return new String[] { "CodeableConcept" };
1070      case -1294005119:
1071        /* preferred */ return new String[] { "boolean" };
1072      default:
1073        return super.getTypesForProperty(hash, name);
1074      }
1075
1076    }
1077
1078    @Override
1079    public Base addChild(String name) throws FHIRException {
1080      if (name.equals("language")) {
1081        this.language = new CodeableConcept();
1082        return this.language;
1083      } else if (name.equals("preferred")) {
1084        throw new FHIRException("Cannot call addChild on a singleton property Patient.preferred");
1085      } else
1086        return super.addChild(name);
1087    }
1088
1089    public PatientCommunicationComponent copy() {
1090      PatientCommunicationComponent dst = new PatientCommunicationComponent();
1091      copyValues(dst);
1092      return dst;
1093    }
1094
1095    public void copyValues(PatientCommunicationComponent dst) {
1096      super.copyValues(dst);
1097      dst.language = language == null ? null : language.copy();
1098      dst.preferred = preferred == null ? null : preferred.copy();
1099    }
1100
1101    @Override
1102    public boolean equalsDeep(Base other_) {
1103      if (!super.equalsDeep(other_))
1104        return false;
1105      if (!(other_ instanceof PatientCommunicationComponent))
1106        return false;
1107      PatientCommunicationComponent o = (PatientCommunicationComponent) other_;
1108      return compareDeep(language, o.language, true) && compareDeep(preferred, o.preferred, true);
1109    }
1110
1111    @Override
1112    public boolean equalsShallow(Base other_) {
1113      if (!super.equalsShallow(other_))
1114        return false;
1115      if (!(other_ instanceof PatientCommunicationComponent))
1116        return false;
1117      PatientCommunicationComponent o = (PatientCommunicationComponent) other_;
1118      return compareValues(preferred, o.preferred, true);
1119    }
1120
1121    public boolean isEmpty() {
1122      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(language, preferred);
1123    }
1124
1125    public String fhirType() {
1126      return "Patient.communication";
1127
1128    }
1129
1130  }
1131
1132  @Block()
1133  public static class PatientLinkComponent extends BackboneElement implements IBaseBackboneElement {
1134    /**
1135     * The other patient resource that the link refers to.
1136     */
1137    @Child(name = "other", type = { Patient.class,
1138        RelatedPerson.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1139    @Description(shortDefinition = "The other patient or related person resource that the link refers to", formalDefinition = "The other patient resource that the link refers to.")
1140    protected Reference other;
1141
1142    /**
1143     * The actual object that is the target of the reference (The other patient
1144     * resource that the link refers to.)
1145     */
1146    protected Resource otherTarget;
1147
1148    /**
1149     * The type of link between this patient resource and another patient resource.
1150     */
1151    @Child(name = "type", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
1152    @Description(shortDefinition = "replaced-by | replaces | refer | seealso", formalDefinition = "The type of link between this patient resource and another patient resource.")
1153    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/link-type")
1154    protected Enumeration<LinkType> type;
1155
1156    private static final long serialVersionUID = 1083576633L;
1157
1158    /**
1159     * Constructor
1160     */
1161    public PatientLinkComponent() {
1162      super();
1163    }
1164
1165    /**
1166     * Constructor
1167     */
1168    public PatientLinkComponent(Reference other, Enumeration<LinkType> type) {
1169      super();
1170      this.other = other;
1171      this.type = type;
1172    }
1173
1174    /**
1175     * @return {@link #other} (The other patient resource that the link refers to.)
1176     */
1177    public Reference getOther() {
1178      if (this.other == null)
1179        if (Configuration.errorOnAutoCreate())
1180          throw new Error("Attempt to auto-create PatientLinkComponent.other");
1181        else if (Configuration.doAutoCreate())
1182          this.other = new Reference(); // cc
1183      return this.other;
1184    }
1185
1186    public boolean hasOther() {
1187      return this.other != null && !this.other.isEmpty();
1188    }
1189
1190    /**
1191     * @param value {@link #other} (The other patient resource that the link refers
1192     *              to.)
1193     */
1194    public PatientLinkComponent setOther(Reference value) {
1195      this.other = value;
1196      return this;
1197    }
1198
1199    /**
1200     * @return {@link #other} The actual object that is the target of the reference.
1201     *         The reference library doesn't populate this, but you can use it to
1202     *         hold the resource if you resolve it. (The other patient resource that
1203     *         the link refers to.)
1204     */
1205    public Resource getOtherTarget() {
1206      return this.otherTarget;
1207    }
1208
1209    /**
1210     * @param value {@link #other} The actual object that is the target of the
1211     *              reference. The reference library doesn't use these, but you can
1212     *              use it to hold the resource if you resolve it. (The other
1213     *              patient resource that the link refers to.)
1214     */
1215    public PatientLinkComponent setOtherTarget(Resource value) {
1216      this.otherTarget = value;
1217      return this;
1218    }
1219
1220    /**
1221     * @return {@link #type} (The type of link between this patient resource and
1222     *         another patient resource.). This is the underlying object with id,
1223     *         value and extensions. The accessor "getType" gives direct access to
1224     *         the value
1225     */
1226    public Enumeration<LinkType> getTypeElement() {
1227      if (this.type == null)
1228        if (Configuration.errorOnAutoCreate())
1229          throw new Error("Attempt to auto-create PatientLinkComponent.type");
1230        else if (Configuration.doAutoCreate())
1231          this.type = new Enumeration<LinkType>(new LinkTypeEnumFactory()); // bb
1232      return this.type;
1233    }
1234
1235    public boolean hasTypeElement() {
1236      return this.type != null && !this.type.isEmpty();
1237    }
1238
1239    public boolean hasType() {
1240      return this.type != null && !this.type.isEmpty();
1241    }
1242
1243    /**
1244     * @param value {@link #type} (The type of link between this patient resource
1245     *              and another patient resource.). This is the underlying object
1246     *              with id, value and extensions. The accessor "getType" gives
1247     *              direct access to the value
1248     */
1249    public PatientLinkComponent setTypeElement(Enumeration<LinkType> value) {
1250      this.type = value;
1251      return this;
1252    }
1253
1254    /**
1255     * @return The type of link between this patient resource and another patient
1256     *         resource.
1257     */
1258    public LinkType getType() {
1259      return this.type == null ? null : this.type.getValue();
1260    }
1261
1262    /**
1263     * @param value The type of link between this patient resource and another
1264     *              patient resource.
1265     */
1266    public PatientLinkComponent setType(LinkType value) {
1267      if (this.type == null)
1268        this.type = new Enumeration<LinkType>(new LinkTypeEnumFactory());
1269      this.type.setValue(value);
1270      return this;
1271    }
1272
1273    protected void listChildren(List<Property> children) {
1274      super.listChildren(children);
1275      children.add(new Property("other", "Reference(Patient|RelatedPerson)",
1276          "The other patient resource that the link refers to.", 0, 1, other));
1277      children.add(new Property("type", "code",
1278          "The type of link between this patient resource and another patient resource.", 0, 1, type));
1279    }
1280
1281    @Override
1282    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1283      switch (_hash) {
1284      case 106069776:
1285        /* other */ return new Property("other", "Reference(Patient|RelatedPerson)",
1286            "The other patient resource that the link refers to.", 0, 1, other);
1287      case 3575610:
1288        /* type */ return new Property("type", "code",
1289            "The type of link between this patient resource and another patient resource.", 0, 1, type);
1290      default:
1291        return super.getNamedProperty(_hash, _name, _checkValid);
1292      }
1293
1294    }
1295
1296    @Override
1297    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1298      switch (hash) {
1299      case 106069776:
1300        /* other */ return this.other == null ? new Base[0] : new Base[] { this.other }; // Reference
1301      case 3575610:
1302        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<LinkType>
1303      default:
1304        return super.getProperty(hash, name, checkValid);
1305      }
1306
1307    }
1308
1309    @Override
1310    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1311      switch (hash) {
1312      case 106069776: // other
1313        this.other = castToReference(value); // Reference
1314        return value;
1315      case 3575610: // type
1316        value = new LinkTypeEnumFactory().fromType(castToCode(value));
1317        this.type = (Enumeration) value; // Enumeration<LinkType>
1318        return value;
1319      default:
1320        return super.setProperty(hash, name, value);
1321      }
1322
1323    }
1324
1325    @Override
1326    public Base setProperty(String name, Base value) throws FHIRException {
1327      if (name.equals("other")) {
1328        this.other = castToReference(value); // Reference
1329      } else if (name.equals("type")) {
1330        value = new LinkTypeEnumFactory().fromType(castToCode(value));
1331        this.type = (Enumeration) value; // Enumeration<LinkType>
1332      } else
1333        return super.setProperty(name, value);
1334      return value;
1335    }
1336
1337    @Override
1338    public Base makeProperty(int hash, String name) throws FHIRException {
1339      switch (hash) {
1340      case 106069776:
1341        return getOther();
1342      case 3575610:
1343        return getTypeElement();
1344      default:
1345        return super.makeProperty(hash, name);
1346      }
1347
1348    }
1349
1350    @Override
1351    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1352      switch (hash) {
1353      case 106069776:
1354        /* other */ return new String[] { "Reference" };
1355      case 3575610:
1356        /* type */ return new String[] { "code" };
1357      default:
1358        return super.getTypesForProperty(hash, name);
1359      }
1360
1361    }
1362
1363    @Override
1364    public Base addChild(String name) throws FHIRException {
1365      if (name.equals("other")) {
1366        this.other = new Reference();
1367        return this.other;
1368      } else if (name.equals("type")) {
1369        throw new FHIRException("Cannot call addChild on a singleton property Patient.type");
1370      } else
1371        return super.addChild(name);
1372    }
1373
1374    public PatientLinkComponent copy() {
1375      PatientLinkComponent dst = new PatientLinkComponent();
1376      copyValues(dst);
1377      return dst;
1378    }
1379
1380    public void copyValues(PatientLinkComponent dst) {
1381      super.copyValues(dst);
1382      dst.other = other == null ? null : other.copy();
1383      dst.type = type == null ? null : type.copy();
1384    }
1385
1386    @Override
1387    public boolean equalsDeep(Base other_) {
1388      if (!super.equalsDeep(other_))
1389        return false;
1390      if (!(other_ instanceof PatientLinkComponent))
1391        return false;
1392      PatientLinkComponent o = (PatientLinkComponent) other_;
1393      return compareDeep(other, o.other, true) && compareDeep(type, o.type, true);
1394    }
1395
1396    @Override
1397    public boolean equalsShallow(Base other_) {
1398      if (!super.equalsShallow(other_))
1399        return false;
1400      if (!(other_ instanceof PatientLinkComponent))
1401        return false;
1402      PatientLinkComponent o = (PatientLinkComponent) other_;
1403      return compareValues(type, o.type, true);
1404    }
1405
1406    public boolean isEmpty() {
1407      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(other, type);
1408    }
1409
1410    public String fhirType() {
1411      return "Patient.link";
1412
1413    }
1414
1415  }
1416
1417  /**
1418   * An identifier for this patient.
1419   */
1420  @Child(name = "identifier", type = {
1421      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1422  @Description(shortDefinition = "An identifier for this patient", formalDefinition = "An identifier for this patient.")
1423  protected List<Identifier> identifier;
1424
1425  /**
1426   * Whether this patient record is in active use. Many systems use this property
1427   * to mark as non-current patients, such as those that have not been seen for a
1428   * period of time based on an organization's business rules.
1429   * 
1430   * It is often used to filter patient lists to exclude inactive patients
1431   * 
1432   * Deceased patients may also be marked as inactive for the same reasons, but
1433   * may be active for some time after death.
1434   */
1435  @Child(name = "active", type = { BooleanType.class }, order = 1, min = 0, max = 1, modifier = true, summary = true)
1436  @Description(shortDefinition = "Whether this patient's record is in active use", formalDefinition = "Whether this patient record is in active use. \nMany systems use this property to mark as non-current patients, such as those that have not been seen for a period of time based on an organization's business rules.\n\nIt is often used to filter patient lists to exclude inactive patients\n\nDeceased patients may also be marked as inactive for the same reasons, but may be active for some time after death.")
1437  protected BooleanType active;
1438
1439  /**
1440   * A name associated with the individual.
1441   */
1442  @Child(name = "name", type = {
1443      HumanName.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1444  @Description(shortDefinition = "A name associated with the patient", formalDefinition = "A name associated with the individual.")
1445  protected List<HumanName> name;
1446
1447  /**
1448   * A contact detail (e.g. a telephone number or an email address) by which the
1449   * individual may be contacted.
1450   */
1451  @Child(name = "telecom", type = {
1452      ContactPoint.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1453  @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.")
1454  protected List<ContactPoint> telecom;
1455
1456  /**
1457   * Administrative Gender - the gender that the patient is considered to have for
1458   * administration and record keeping purposes.
1459   */
1460  @Child(name = "gender", type = { CodeType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1461  @Description(shortDefinition = "male | female | other | unknown", formalDefinition = "Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.")
1462  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/administrative-gender")
1463  protected Enumeration<AdministrativeGender> gender;
1464
1465  /**
1466   * The date of birth for the individual.
1467   */
1468  @Child(name = "birthDate", type = { DateType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1469  @Description(shortDefinition = "The date of birth for the individual", formalDefinition = "The date of birth for the individual.")
1470  protected DateType birthDate;
1471
1472  /**
1473   * Indicates if the individual is deceased or not.
1474   */
1475  @Child(name = "deceased", type = { BooleanType.class,
1476      DateTimeType.class }, order = 6, min = 0, max = 1, modifier = true, summary = true)
1477  @Description(shortDefinition = "Indicates if the individual is deceased or not", formalDefinition = "Indicates if the individual is deceased or not.")
1478  protected Type deceased;
1479
1480  /**
1481   * An address for the individual.
1482   */
1483  @Child(name = "address", type = {
1484      Address.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1485  @Description(shortDefinition = "An address for the individual", formalDefinition = "An address for the individual.")
1486  protected List<Address> address;
1487
1488  /**
1489   * This field contains a patient's most recent marital (civil) status.
1490   */
1491  @Child(name = "maritalStatus", type = {
1492      CodeableConcept.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
1493  @Description(shortDefinition = "Marital (civil) status of a patient", formalDefinition = "This field contains a patient's most recent marital (civil) status.")
1494  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/marital-status")
1495  protected CodeableConcept maritalStatus;
1496
1497  /**
1498   * Indicates whether the patient is part of a multiple (boolean) or indicates
1499   * the actual birth order (integer).
1500   */
1501  @Child(name = "multipleBirth", type = { BooleanType.class,
1502      IntegerType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
1503  @Description(shortDefinition = "Whether patient is part of a multiple birth", formalDefinition = "Indicates whether the patient is part of a multiple (boolean) or indicates the actual birth order (integer).")
1504  protected Type multipleBirth;
1505
1506  /**
1507   * Image of the patient.
1508   */
1509  @Child(name = "photo", type = {
1510      Attachment.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1511  @Description(shortDefinition = "Image of the patient", formalDefinition = "Image of the patient.")
1512  protected List<Attachment> photo;
1513
1514  /**
1515   * A contact party (e.g. guardian, partner, friend) for the patient.
1516   */
1517  @Child(name = "contact", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1518  @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.")
1519  protected List<ContactComponent> contact;
1520
1521  /**
1522   * A language which may be used to communicate with the patient about his or her
1523   * health.
1524   */
1525  @Child(name = "communication", type = {}, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1526  @Description(shortDefinition = "A language which may be used to communicate with the patient about his or her health", formalDefinition = "A language which may be used to communicate with the patient about his or her health.")
1527  protected List<PatientCommunicationComponent> communication;
1528
1529  /**
1530   * Patient's nominated care provider.
1531   */
1532  @Child(name = "generalPractitioner", type = { Organization.class, Practitioner.class,
1533      PractitionerRole.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1534  @Description(shortDefinition = "Patient's nominated primary care provider", formalDefinition = "Patient's nominated care provider.")
1535  protected List<Reference> generalPractitioner;
1536  /**
1537   * The actual objects that are the target of the reference (Patient's nominated
1538   * care provider.)
1539   */
1540  protected List<Resource> generalPractitionerTarget;
1541
1542  /**
1543   * Organization that is the custodian of the patient record.
1544   */
1545  @Child(name = "managingOrganization", type = {
1546      Organization.class }, order = 14, min = 0, max = 1, modifier = false, summary = true)
1547  @Description(shortDefinition = "Organization that is the custodian of the patient record", formalDefinition = "Organization that is the custodian of the patient record.")
1548  protected Reference managingOrganization;
1549
1550  /**
1551   * The actual object that is the target of the reference (Organization that is
1552   * the custodian of the patient record.)
1553   */
1554  protected Organization managingOrganizationTarget;
1555
1556  /**
1557   * Link to another patient resource that concerns the same actual patient.
1558   */
1559  @Child(name = "link", type = {}, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = true, summary = true)
1560  @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.")
1561  protected List<PatientLinkComponent> link;
1562
1563  private static final long serialVersionUID = 2138656939L;
1564
1565  /**
1566   * Constructor
1567   */
1568  public Patient() {
1569    super();
1570  }
1571
1572  /**
1573   * @return {@link #identifier} (An identifier for this patient.)
1574   */
1575  public List<Identifier> getIdentifier() {
1576    if (this.identifier == null)
1577      this.identifier = new ArrayList<Identifier>();
1578    return this.identifier;
1579  }
1580
1581  /**
1582   * @return Returns a reference to <code>this</code> for easy method chaining
1583   */
1584  public Patient setIdentifier(List<Identifier> theIdentifier) {
1585    this.identifier = theIdentifier;
1586    return this;
1587  }
1588
1589  public boolean hasIdentifier() {
1590    if (this.identifier == null)
1591      return false;
1592    for (Identifier item : this.identifier)
1593      if (!item.isEmpty())
1594        return true;
1595    return false;
1596  }
1597
1598  public Identifier addIdentifier() { // 3
1599    Identifier t = new Identifier();
1600    if (this.identifier == null)
1601      this.identifier = new ArrayList<Identifier>();
1602    this.identifier.add(t);
1603    return t;
1604  }
1605
1606  public Patient addIdentifier(Identifier t) { // 3
1607    if (t == null)
1608      return this;
1609    if (this.identifier == null)
1610      this.identifier = new ArrayList<Identifier>();
1611    this.identifier.add(t);
1612    return this;
1613  }
1614
1615  /**
1616   * @return The first repetition of repeating field {@link #identifier}, creating
1617   *         it if it does not already exist
1618   */
1619  public Identifier getIdentifierFirstRep() {
1620    if (getIdentifier().isEmpty()) {
1621      addIdentifier();
1622    }
1623    return getIdentifier().get(0);
1624  }
1625
1626  /**
1627   * @return {@link #active} (Whether this patient record is in active use. Many
1628   *         systems use this property to mark as non-current patients, such as
1629   *         those that have not been seen for a period of time based on an
1630   *         organization's business rules.
1631   * 
1632   *         It is often used to filter patient lists to exclude inactive patients
1633   * 
1634   *         Deceased patients may also be marked as inactive for the same
1635   *         reasons, but may be active for some time after death.). This is the
1636   *         underlying object with id, value and extensions. The accessor
1637   *         "getActive" gives direct access to the value
1638   */
1639  public BooleanType getActiveElement() {
1640    if (this.active == null)
1641      if (Configuration.errorOnAutoCreate())
1642        throw new Error("Attempt to auto-create Patient.active");
1643      else if (Configuration.doAutoCreate())
1644        this.active = new BooleanType(); // bb
1645    return this.active;
1646  }
1647
1648  public boolean hasActiveElement() {
1649    return this.active != null && !this.active.isEmpty();
1650  }
1651
1652  public boolean hasActive() {
1653    return this.active != null && !this.active.isEmpty();
1654  }
1655
1656  /**
1657   * @param value {@link #active} (Whether this patient record is in active use.
1658   *              Many systems use this property to mark as non-current patients,
1659   *              such as those that have not been seen for a period of time based
1660   *              on an organization's business rules.
1661   * 
1662   *              It is often used to filter patient lists to exclude inactive
1663   *              patients
1664   * 
1665   *              Deceased patients may also be marked as inactive for the same
1666   *              reasons, but may be active for some time after death.). This is
1667   *              the underlying object with id, value and extensions. The
1668   *              accessor "getActive" gives direct access to the value
1669   */
1670  public Patient setActiveElement(BooleanType value) {
1671    this.active = value;
1672    return this;
1673  }
1674
1675  /**
1676   * @return Whether this patient record is in active use. Many systems use this
1677   *         property to mark as non-current patients, such as those that have not
1678   *         been seen for a period of time based on an organization's business
1679   *         rules.
1680   * 
1681   *         It is often used to filter patient lists to exclude inactive patients
1682   * 
1683   *         Deceased patients may also be marked as inactive for the same
1684   *         reasons, but may be active for some time after death.
1685   */
1686  public boolean getActive() {
1687    return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
1688  }
1689
1690  /**
1691   * @param value Whether this patient record is in active use. Many systems use
1692   *              this property to mark as non-current patients, such as those
1693   *              that have not been seen for a period of time based on an
1694   *              organization's business rules.
1695   * 
1696   *              It is often used to filter patient lists to exclude inactive
1697   *              patients
1698   * 
1699   *              Deceased patients may also be marked as inactive for the same
1700   *              reasons, but may be active for some time after death.
1701   */
1702  public Patient setActive(boolean value) {
1703    if (this.active == null)
1704      this.active = new BooleanType();
1705    this.active.setValue(value);
1706    return this;
1707  }
1708
1709  /**
1710   * @return {@link #name} (A name associated with the individual.)
1711   */
1712  public List<HumanName> getName() {
1713    if (this.name == null)
1714      this.name = new ArrayList<HumanName>();
1715    return this.name;
1716  }
1717
1718  /**
1719   * @return Returns a reference to <code>this</code> for easy method chaining
1720   */
1721  public Patient setName(List<HumanName> theName) {
1722    this.name = theName;
1723    return this;
1724  }
1725
1726  public boolean hasName() {
1727    if (this.name == null)
1728      return false;
1729    for (HumanName item : this.name)
1730      if (!item.isEmpty())
1731        return true;
1732    return false;
1733  }
1734
1735  public HumanName addName() { // 3
1736    HumanName t = new HumanName();
1737    if (this.name == null)
1738      this.name = new ArrayList<HumanName>();
1739    this.name.add(t);
1740    return t;
1741  }
1742
1743  public Patient addName(HumanName t) { // 3
1744    if (t == null)
1745      return this;
1746    if (this.name == null)
1747      this.name = new ArrayList<HumanName>();
1748    this.name.add(t);
1749    return this;
1750  }
1751
1752  /**
1753   * @return The first repetition of repeating field {@link #name}, creating it if
1754   *         it does not already exist
1755   */
1756  public HumanName getNameFirstRep() {
1757    if (getName().isEmpty()) {
1758      addName();
1759    }
1760    return getName().get(0);
1761  }
1762
1763  /**
1764   * @return {@link #telecom} (A contact detail (e.g. a telephone number or an
1765   *         email address) by which the individual may be contacted.)
1766   */
1767  public List<ContactPoint> getTelecom() {
1768    if (this.telecom == null)
1769      this.telecom = new ArrayList<ContactPoint>();
1770    return this.telecom;
1771  }
1772
1773  /**
1774   * @return Returns a reference to <code>this</code> for easy method chaining
1775   */
1776  public Patient setTelecom(List<ContactPoint> theTelecom) {
1777    this.telecom = theTelecom;
1778    return this;
1779  }
1780
1781  public boolean hasTelecom() {
1782    if (this.telecom == null)
1783      return false;
1784    for (ContactPoint item : this.telecom)
1785      if (!item.isEmpty())
1786        return true;
1787    return false;
1788  }
1789
1790  public ContactPoint addTelecom() { // 3
1791    ContactPoint t = new ContactPoint();
1792    if (this.telecom == null)
1793      this.telecom = new ArrayList<ContactPoint>();
1794    this.telecom.add(t);
1795    return t;
1796  }
1797
1798  public Patient addTelecom(ContactPoint t) { // 3
1799    if (t == null)
1800      return this;
1801    if (this.telecom == null)
1802      this.telecom = new ArrayList<ContactPoint>();
1803    this.telecom.add(t);
1804    return this;
1805  }
1806
1807  /**
1808   * @return The first repetition of repeating field {@link #telecom}, creating it
1809   *         if it does not already exist
1810   */
1811  public ContactPoint getTelecomFirstRep() {
1812    if (getTelecom().isEmpty()) {
1813      addTelecom();
1814    }
1815    return getTelecom().get(0);
1816  }
1817
1818  /**
1819   * @return {@link #gender} (Administrative Gender - the gender that the patient
1820   *         is considered to have for administration and record keeping
1821   *         purposes.). This is the underlying object with id, value and
1822   *         extensions. The accessor "getGender" gives direct access to the value
1823   */
1824  public Enumeration<AdministrativeGender> getGenderElement() {
1825    if (this.gender == null)
1826      if (Configuration.errorOnAutoCreate())
1827        throw new Error("Attempt to auto-create Patient.gender");
1828      else if (Configuration.doAutoCreate())
1829        this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
1830    return this.gender;
1831  }
1832
1833  public boolean hasGenderElement() {
1834    return this.gender != null && !this.gender.isEmpty();
1835  }
1836
1837  public boolean hasGender() {
1838    return this.gender != null && !this.gender.isEmpty();
1839  }
1840
1841  /**
1842   * @param value {@link #gender} (Administrative Gender - the gender that the
1843   *              patient is considered to have for administration and record
1844   *              keeping purposes.). This is the underlying object with id, value
1845   *              and extensions. The accessor "getGender" gives direct access to
1846   *              the value
1847   */
1848  public Patient setGenderElement(Enumeration<AdministrativeGender> value) {
1849    this.gender = value;
1850    return this;
1851  }
1852
1853  /**
1854   * @return Administrative Gender - the gender that the patient is considered to
1855   *         have for administration and record keeping purposes.
1856   */
1857  public AdministrativeGender getGender() {
1858    return this.gender == null ? null : this.gender.getValue();
1859  }
1860
1861  /**
1862   * @param value Administrative Gender - the gender that the patient is
1863   *              considered to have for administration and record keeping
1864   *              purposes.
1865   */
1866  public Patient setGender(AdministrativeGender value) {
1867    if (value == null)
1868      this.gender = null;
1869    else {
1870      if (this.gender == null)
1871        this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
1872      this.gender.setValue(value);
1873    }
1874    return this;
1875  }
1876
1877  /**
1878   * @return {@link #birthDate} (The date of birth for the individual.). This is
1879   *         the underlying object with id, value and extensions. The accessor
1880   *         "getBirthDate" gives direct access to the value
1881   */
1882  public DateType getBirthDateElement() {
1883    if (this.birthDate == null)
1884      if (Configuration.errorOnAutoCreate())
1885        throw new Error("Attempt to auto-create Patient.birthDate");
1886      else if (Configuration.doAutoCreate())
1887        this.birthDate = new DateType(); // bb
1888    return this.birthDate;
1889  }
1890
1891  public boolean hasBirthDateElement() {
1892    return this.birthDate != null && !this.birthDate.isEmpty();
1893  }
1894
1895  public boolean hasBirthDate() {
1896    return this.birthDate != null && !this.birthDate.isEmpty();
1897  }
1898
1899  /**
1900   * @param value {@link #birthDate} (The date of birth for the individual.). This
1901   *              is the underlying object with id, value and extensions. The
1902   *              accessor "getBirthDate" gives direct access to the value
1903   */
1904  public Patient setBirthDateElement(DateType value) {
1905    this.birthDate = value;
1906    return this;
1907  }
1908
1909  /**
1910   * @return The date of birth for the individual.
1911   */
1912  public Date getBirthDate() {
1913    return this.birthDate == null ? null : this.birthDate.getValue();
1914  }
1915
1916  /**
1917   * @param value The date of birth for the individual.
1918   */
1919  public Patient setBirthDate(Date value) {
1920    if (value == null)
1921      this.birthDate = null;
1922    else {
1923      if (this.birthDate == null)
1924        this.birthDate = new DateType();
1925      this.birthDate.setValue(value);
1926    }
1927    return this;
1928  }
1929
1930  /**
1931   * @return {@link #deceased} (Indicates if the individual is deceased or not.)
1932   */
1933  public Type getDeceased() {
1934    return this.deceased;
1935  }
1936
1937  /**
1938   * @return {@link #deceased} (Indicates if the individual is deceased or not.)
1939   */
1940  public BooleanType getDeceasedBooleanType() throws FHIRException {
1941    if (this.deceased == null)
1942      this.deceased = new BooleanType();
1943    if (!(this.deceased instanceof BooleanType))
1944      throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1945          + this.deceased.getClass().getName() + " was encountered");
1946    return (BooleanType) this.deceased;
1947  }
1948
1949  public boolean hasDeceasedBooleanType() {
1950    return this != null && this.deceased instanceof BooleanType;
1951  }
1952
1953  /**
1954   * @return {@link #deceased} (Indicates if the individual is deceased or not.)
1955   */
1956  public DateTimeType getDeceasedDateTimeType() throws FHIRException {
1957    if (this.deceased == null)
1958      this.deceased = new DateTimeType();
1959    if (!(this.deceased instanceof DateTimeType))
1960      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1961          + this.deceased.getClass().getName() + " was encountered");
1962    return (DateTimeType) this.deceased;
1963  }
1964
1965  public boolean hasDeceasedDateTimeType() {
1966    return this != null && this.deceased instanceof DateTimeType;
1967  }
1968
1969  public boolean hasDeceased() {
1970    return this.deceased != null && !this.deceased.isEmpty();
1971  }
1972
1973  /**
1974   * @param value {@link #deceased} (Indicates if the individual is deceased or
1975   *              not.)
1976   */
1977  public Patient setDeceased(Type value) {
1978    if (value != null && !(value instanceof BooleanType || value instanceof DateTimeType))
1979      throw new Error("Not the right type for Patient.deceased[x]: " + value.fhirType());
1980    this.deceased = value;
1981    return this;
1982  }
1983
1984  /**
1985   * @return {@link #address} (An address for the individual.)
1986   */
1987  public List<Address> getAddress() {
1988    if (this.address == null)
1989      this.address = new ArrayList<Address>();
1990    return this.address;
1991  }
1992
1993  /**
1994   * @return Returns a reference to <code>this</code> for easy method chaining
1995   */
1996  public Patient setAddress(List<Address> theAddress) {
1997    this.address = theAddress;
1998    return this;
1999  }
2000
2001  public boolean hasAddress() {
2002    if (this.address == null)
2003      return false;
2004    for (Address item : this.address)
2005      if (!item.isEmpty())
2006        return true;
2007    return false;
2008  }
2009
2010  public Address addAddress() { // 3
2011    Address t = new Address();
2012    if (this.address == null)
2013      this.address = new ArrayList<Address>();
2014    this.address.add(t);
2015    return t;
2016  }
2017
2018  public Patient addAddress(Address t) { // 3
2019    if (t == null)
2020      return this;
2021    if (this.address == null)
2022      this.address = new ArrayList<Address>();
2023    this.address.add(t);
2024    return this;
2025  }
2026
2027  /**
2028   * @return The first repetition of repeating field {@link #address}, creating it
2029   *         if it does not already exist
2030   */
2031  public Address getAddressFirstRep() {
2032    if (getAddress().isEmpty()) {
2033      addAddress();
2034    }
2035    return getAddress().get(0);
2036  }
2037
2038  /**
2039   * @return {@link #maritalStatus} (This field contains a patient's most recent
2040   *         marital (civil) status.)
2041   */
2042  public CodeableConcept getMaritalStatus() {
2043    if (this.maritalStatus == null)
2044      if (Configuration.errorOnAutoCreate())
2045        throw new Error("Attempt to auto-create Patient.maritalStatus");
2046      else if (Configuration.doAutoCreate())
2047        this.maritalStatus = new CodeableConcept(); // cc
2048    return this.maritalStatus;
2049  }
2050
2051  public boolean hasMaritalStatus() {
2052    return this.maritalStatus != null && !this.maritalStatus.isEmpty();
2053  }
2054
2055  /**
2056   * @param value {@link #maritalStatus} (This field contains a patient's most
2057   *              recent marital (civil) status.)
2058   */
2059  public Patient setMaritalStatus(CodeableConcept value) {
2060    this.maritalStatus = value;
2061    return this;
2062  }
2063
2064  /**
2065   * @return {@link #multipleBirth} (Indicates whether the patient is part of a
2066   *         multiple (boolean) or indicates the actual birth order (integer).)
2067   */
2068  public Type getMultipleBirth() {
2069    return this.multipleBirth;
2070  }
2071
2072  /**
2073   * @return {@link #multipleBirth} (Indicates whether the patient is part of a
2074   *         multiple (boolean) or indicates the actual birth order (integer).)
2075   */
2076  public BooleanType getMultipleBirthBooleanType() throws FHIRException {
2077    if (this.multipleBirth == null)
2078      this.multipleBirth = new BooleanType();
2079    if (!(this.multipleBirth instanceof BooleanType))
2080      throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
2081          + this.multipleBirth.getClass().getName() + " was encountered");
2082    return (BooleanType) this.multipleBirth;
2083  }
2084
2085  public boolean hasMultipleBirthBooleanType() {
2086    return this != null && this.multipleBirth instanceof BooleanType;
2087  }
2088
2089  /**
2090   * @return {@link #multipleBirth} (Indicates whether the patient is part of a
2091   *         multiple (boolean) or indicates the actual birth order (integer).)
2092   */
2093  public IntegerType getMultipleBirthIntegerType() throws FHIRException {
2094    if (this.multipleBirth == null)
2095      this.multipleBirth = new IntegerType();
2096    if (!(this.multipleBirth instanceof IntegerType))
2097      throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
2098          + this.multipleBirth.getClass().getName() + " was encountered");
2099    return (IntegerType) this.multipleBirth;
2100  }
2101
2102  public boolean hasMultipleBirthIntegerType() {
2103    return this != null && this.multipleBirth instanceof IntegerType;
2104  }
2105
2106  public boolean hasMultipleBirth() {
2107    return this.multipleBirth != null && !this.multipleBirth.isEmpty();
2108  }
2109
2110  /**
2111   * @param value {@link #multipleBirth} (Indicates whether the patient is part of
2112   *              a multiple (boolean) or indicates the actual birth order
2113   *              (integer).)
2114   */
2115  public Patient setMultipleBirth(Type value) {
2116    if (value != null && !(value instanceof BooleanType || value instanceof IntegerType))
2117      throw new Error("Not the right type for Patient.multipleBirth[x]: " + value.fhirType());
2118    this.multipleBirth = value;
2119    return this;
2120  }
2121
2122  /**
2123   * @return {@link #photo} (Image of the patient.)
2124   */
2125  public List<Attachment> getPhoto() {
2126    if (this.photo == null)
2127      this.photo = new ArrayList<Attachment>();
2128    return this.photo;
2129  }
2130
2131  /**
2132   * @return Returns a reference to <code>this</code> for easy method chaining
2133   */
2134  public Patient setPhoto(List<Attachment> thePhoto) {
2135    this.photo = thePhoto;
2136    return this;
2137  }
2138
2139  public boolean hasPhoto() {
2140    if (this.photo == null)
2141      return false;
2142    for (Attachment item : this.photo)
2143      if (!item.isEmpty())
2144        return true;
2145    return false;
2146  }
2147
2148  public Attachment addPhoto() { // 3
2149    Attachment t = new Attachment();
2150    if (this.photo == null)
2151      this.photo = new ArrayList<Attachment>();
2152    this.photo.add(t);
2153    return t;
2154  }
2155
2156  public Patient addPhoto(Attachment t) { // 3
2157    if (t == null)
2158      return this;
2159    if (this.photo == null)
2160      this.photo = new ArrayList<Attachment>();
2161    this.photo.add(t);
2162    return this;
2163  }
2164
2165  /**
2166   * @return The first repetition of repeating field {@link #photo}, creating it
2167   *         if it does not already exist
2168   */
2169  public Attachment getPhotoFirstRep() {
2170    if (getPhoto().isEmpty()) {
2171      addPhoto();
2172    }
2173    return getPhoto().get(0);
2174  }
2175
2176  /**
2177   * @return {@link #contact} (A contact party (e.g. guardian, partner, friend)
2178   *         for the patient.)
2179   */
2180  public List<ContactComponent> getContact() {
2181    if (this.contact == null)
2182      this.contact = new ArrayList<ContactComponent>();
2183    return this.contact;
2184  }
2185
2186  /**
2187   * @return Returns a reference to <code>this</code> for easy method chaining
2188   */
2189  public Patient setContact(List<ContactComponent> theContact) {
2190    this.contact = theContact;
2191    return this;
2192  }
2193
2194  public boolean hasContact() {
2195    if (this.contact == null)
2196      return false;
2197    for (ContactComponent item : this.contact)
2198      if (!item.isEmpty())
2199        return true;
2200    return false;
2201  }
2202
2203  public ContactComponent addContact() { // 3
2204    ContactComponent t = new ContactComponent();
2205    if (this.contact == null)
2206      this.contact = new ArrayList<ContactComponent>();
2207    this.contact.add(t);
2208    return t;
2209  }
2210
2211  public Patient addContact(ContactComponent t) { // 3
2212    if (t == null)
2213      return this;
2214    if (this.contact == null)
2215      this.contact = new ArrayList<ContactComponent>();
2216    this.contact.add(t);
2217    return this;
2218  }
2219
2220  /**
2221   * @return The first repetition of repeating field {@link #contact}, creating it
2222   *         if it does not already exist
2223   */
2224  public ContactComponent getContactFirstRep() {
2225    if (getContact().isEmpty()) {
2226      addContact();
2227    }
2228    return getContact().get(0);
2229  }
2230
2231  /**
2232   * @return {@link #communication} (A language which may be used to communicate
2233   *         with the patient about his or her health.)
2234   */
2235  public List<PatientCommunicationComponent> getCommunication() {
2236    if (this.communication == null)
2237      this.communication = new ArrayList<PatientCommunicationComponent>();
2238    return this.communication;
2239  }
2240
2241  /**
2242   * @return Returns a reference to <code>this</code> for easy method chaining
2243   */
2244  public Patient setCommunication(List<PatientCommunicationComponent> theCommunication) {
2245    this.communication = theCommunication;
2246    return this;
2247  }
2248
2249  public boolean hasCommunication() {
2250    if (this.communication == null)
2251      return false;
2252    for (PatientCommunicationComponent item : this.communication)
2253      if (!item.isEmpty())
2254        return true;
2255    return false;
2256  }
2257
2258  public PatientCommunicationComponent addCommunication() { // 3
2259    PatientCommunicationComponent t = new PatientCommunicationComponent();
2260    if (this.communication == null)
2261      this.communication = new ArrayList<PatientCommunicationComponent>();
2262    this.communication.add(t);
2263    return t;
2264  }
2265
2266  public Patient addCommunication(PatientCommunicationComponent t) { // 3
2267    if (t == null)
2268      return this;
2269    if (this.communication == null)
2270      this.communication = new ArrayList<PatientCommunicationComponent>();
2271    this.communication.add(t);
2272    return this;
2273  }
2274
2275  /**
2276   * @return The first repetition of repeating field {@link #communication},
2277   *         creating it if it does not already exist
2278   */
2279  public PatientCommunicationComponent getCommunicationFirstRep() {
2280    if (getCommunication().isEmpty()) {
2281      addCommunication();
2282    }
2283    return getCommunication().get(0);
2284  }
2285
2286  /**
2287   * @return {@link #generalPractitioner} (Patient's nominated care provider.)
2288   */
2289  public List<Reference> getGeneralPractitioner() {
2290    if (this.generalPractitioner == null)
2291      this.generalPractitioner = new ArrayList<Reference>();
2292    return this.generalPractitioner;
2293  }
2294
2295  /**
2296   * @return Returns a reference to <code>this</code> for easy method chaining
2297   */
2298  public Patient setGeneralPractitioner(List<Reference> theGeneralPractitioner) {
2299    this.generalPractitioner = theGeneralPractitioner;
2300    return this;
2301  }
2302
2303  public boolean hasGeneralPractitioner() {
2304    if (this.generalPractitioner == null)
2305      return false;
2306    for (Reference item : this.generalPractitioner)
2307      if (!item.isEmpty())
2308        return true;
2309    return false;
2310  }
2311
2312  public Reference addGeneralPractitioner() { // 3
2313    Reference t = new Reference();
2314    if (this.generalPractitioner == null)
2315      this.generalPractitioner = new ArrayList<Reference>();
2316    this.generalPractitioner.add(t);
2317    return t;
2318  }
2319
2320  public Patient addGeneralPractitioner(Reference t) { // 3
2321    if (t == null)
2322      return this;
2323    if (this.generalPractitioner == null)
2324      this.generalPractitioner = new ArrayList<Reference>();
2325    this.generalPractitioner.add(t);
2326    return this;
2327  }
2328
2329  /**
2330   * @return The first repetition of repeating field {@link #generalPractitioner},
2331   *         creating it if it does not already exist
2332   */
2333  public Reference getGeneralPractitionerFirstRep() {
2334    if (getGeneralPractitioner().isEmpty()) {
2335      addGeneralPractitioner();
2336    }
2337    return getGeneralPractitioner().get(0);
2338  }
2339
2340  /**
2341   * @deprecated Use Reference#setResource(IBaseResource) instead
2342   */
2343  @Deprecated
2344  public List<Resource> getGeneralPractitionerTarget() {
2345    if (this.generalPractitionerTarget == null)
2346      this.generalPractitionerTarget = new ArrayList<Resource>();
2347    return this.generalPractitionerTarget;
2348  }
2349
2350  /**
2351   * @return {@link #managingOrganization} (Organization that is the custodian of
2352   *         the patient record.)
2353   */
2354  public Reference getManagingOrganization() {
2355    if (this.managingOrganization == null)
2356      if (Configuration.errorOnAutoCreate())
2357        throw new Error("Attempt to auto-create Patient.managingOrganization");
2358      else if (Configuration.doAutoCreate())
2359        this.managingOrganization = new Reference(); // cc
2360    return this.managingOrganization;
2361  }
2362
2363  public boolean hasManagingOrganization() {
2364    return this.managingOrganization != null && !this.managingOrganization.isEmpty();
2365  }
2366
2367  /**
2368   * @param value {@link #managingOrganization} (Organization that is the
2369   *              custodian of the patient record.)
2370   */
2371  public Patient setManagingOrganization(Reference value) {
2372    this.managingOrganization = value;
2373    return this;
2374  }
2375
2376  /**
2377   * @return {@link #managingOrganization} The actual object that is the target of
2378   *         the reference. The reference library doesn't populate this, but you
2379   *         can use it to hold the resource if you resolve it. (Organization that
2380   *         is the custodian of the patient record.)
2381   */
2382  public Organization getManagingOrganizationTarget() {
2383    if (this.managingOrganizationTarget == null)
2384      if (Configuration.errorOnAutoCreate())
2385        throw new Error("Attempt to auto-create Patient.managingOrganization");
2386      else if (Configuration.doAutoCreate())
2387        this.managingOrganizationTarget = new Organization(); // aa
2388    return this.managingOrganizationTarget;
2389  }
2390
2391  /**
2392   * @param value {@link #managingOrganization} The actual object that is the
2393   *              target of the reference. The reference library doesn't use
2394   *              these, but you can use it to hold the resource if you resolve
2395   *              it. (Organization that is the custodian of the patient record.)
2396   */
2397  public Patient setManagingOrganizationTarget(Organization value) {
2398    this.managingOrganizationTarget = value;
2399    return this;
2400  }
2401
2402  /**
2403   * @return {@link #link} (Link to another patient resource that concerns the
2404   *         same actual patient.)
2405   */
2406  public List<PatientLinkComponent> getLink() {
2407    if (this.link == null)
2408      this.link = new ArrayList<PatientLinkComponent>();
2409    return this.link;
2410  }
2411
2412  /**
2413   * @return Returns a reference to <code>this</code> for easy method chaining
2414   */
2415  public Patient setLink(List<PatientLinkComponent> theLink) {
2416    this.link = theLink;
2417    return this;
2418  }
2419
2420  public boolean hasLink() {
2421    if (this.link == null)
2422      return false;
2423    for (PatientLinkComponent item : this.link)
2424      if (!item.isEmpty())
2425        return true;
2426    return false;
2427  }
2428
2429  public PatientLinkComponent addLink() { // 3
2430    PatientLinkComponent t = new PatientLinkComponent();
2431    if (this.link == null)
2432      this.link = new ArrayList<PatientLinkComponent>();
2433    this.link.add(t);
2434    return t;
2435  }
2436
2437  public Patient addLink(PatientLinkComponent t) { // 3
2438    if (t == null)
2439      return this;
2440    if (this.link == null)
2441      this.link = new ArrayList<PatientLinkComponent>();
2442    this.link.add(t);
2443    return this;
2444  }
2445
2446  /**
2447   * @return The first repetition of repeating field {@link #link}, creating it if
2448   *         it does not already exist
2449   */
2450  public PatientLinkComponent getLinkFirstRep() {
2451    if (getLink().isEmpty()) {
2452      addLink();
2453    }
2454    return getLink().get(0);
2455  }
2456
2457  protected void listChildren(List<Property> children) {
2458    super.listChildren(children);
2459    children.add(new Property("identifier", "Identifier", "An identifier for this patient.", 0,
2460        java.lang.Integer.MAX_VALUE, identifier));
2461    children.add(new Property("active", "boolean",
2462        "Whether this patient record is in active use. \nMany systems use this property to mark as non-current patients, such as those that have not been seen for a period of time based on an organization's business rules.\n\nIt is often used to filter patient lists to exclude inactive patients\n\nDeceased patients may also be marked as inactive for the same reasons, but may be active for some time after death.",
2463        0, 1, active));
2464    children.add(new Property("name", "HumanName", "A name associated with the individual.", 0,
2465        java.lang.Integer.MAX_VALUE, name));
2466    children.add(new Property("telecom", "ContactPoint",
2467        "A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.", 0,
2468        java.lang.Integer.MAX_VALUE, telecom));
2469    children.add(new Property("gender", "code",
2470        "Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.",
2471        0, 1, gender));
2472    children.add(new Property("birthDate", "date", "The date of birth for the individual.", 0, 1, birthDate));
2473    children.add(new Property("deceased[x]", "boolean|dateTime", "Indicates if the individual is deceased or not.", 0,
2474        1, deceased));
2475    children.add(
2476        new Property("address", "Address", "An address for the individual.", 0, java.lang.Integer.MAX_VALUE, address));
2477    children.add(new Property("maritalStatus", "CodeableConcept",
2478        "This field contains a patient's most recent marital (civil) status.", 0, 1, maritalStatus));
2479    children.add(new Property("multipleBirth[x]", "boolean|integer",
2480        "Indicates whether the patient is part of a multiple (boolean) or indicates the actual birth order (integer).",
2481        0, 1, multipleBirth));
2482    children.add(new Property("photo", "Attachment", "Image of the patient.", 0, java.lang.Integer.MAX_VALUE, photo));
2483    children.add(new Property("contact", "", "A contact party (e.g. guardian, partner, friend) for the patient.", 0,
2484        java.lang.Integer.MAX_VALUE, contact));
2485    children.add(new Property("communication", "",
2486        "A language which may be used to communicate with the patient about his or her health.", 0,
2487        java.lang.Integer.MAX_VALUE, communication));
2488    children.add(new Property("generalPractitioner", "Reference(Organization|Practitioner|PractitionerRole)",
2489        "Patient's nominated care provider.", 0, java.lang.Integer.MAX_VALUE, generalPractitioner));
2490    children.add(new Property("managingOrganization", "Reference(Organization)",
2491        "Organization that is the custodian of the patient record.", 0, 1, managingOrganization));
2492    children.add(new Property("link", "", "Link to another patient resource that concerns the same actual patient.", 0,
2493        java.lang.Integer.MAX_VALUE, link));
2494  }
2495
2496  @Override
2497  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2498    switch (_hash) {
2499    case -1618432855:
2500      /* identifier */ return new Property("identifier", "Identifier", "An identifier for this patient.", 0,
2501          java.lang.Integer.MAX_VALUE, identifier);
2502    case -1422950650:
2503      /* active */ return new Property("active", "boolean",
2504          "Whether this patient record is in active use. \nMany systems use this property to mark as non-current patients, such as those that have not been seen for a period of time based on an organization's business rules.\n\nIt is often used to filter patient lists to exclude inactive patients\n\nDeceased patients may also be marked as inactive for the same reasons, but may be active for some time after death.",
2505          0, 1, active);
2506    case 3373707:
2507      /* name */ return new Property("name", "HumanName", "A name associated with the individual.", 0,
2508          java.lang.Integer.MAX_VALUE, name);
2509    case -1429363305:
2510      /* telecom */ return new Property("telecom", "ContactPoint",
2511          "A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.", 0,
2512          java.lang.Integer.MAX_VALUE, telecom);
2513    case -1249512767:
2514      /* gender */ return new Property("gender", "code",
2515          "Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.",
2516          0, 1, gender);
2517    case -1210031859:
2518      /* birthDate */ return new Property("birthDate", "date", "The date of birth for the individual.", 0, 1,
2519          birthDate);
2520    case -1311442804:
2521      /* deceased[x] */ return new Property("deceased[x]", "boolean|dateTime",
2522          "Indicates if the individual is deceased or not.", 0, 1, deceased);
2523    case 561497972:
2524      /* deceased */ return new Property("deceased[x]", "boolean|dateTime",
2525          "Indicates if the individual is deceased or not.", 0, 1, deceased);
2526    case 497463828:
2527      /* deceasedBoolean */ return new Property("deceased[x]", "boolean|dateTime",
2528          "Indicates if the individual is deceased or not.", 0, 1, deceased);
2529    case -1971804369:
2530      /* deceasedDateTime */ return new Property("deceased[x]", "boolean|dateTime",
2531          "Indicates if the individual is deceased or not.", 0, 1, deceased);
2532    case -1147692044:
2533      /* address */ return new Property("address", "Address", "An address for the individual.", 0,
2534          java.lang.Integer.MAX_VALUE, address);
2535    case 1756919302:
2536      /* maritalStatus */ return new Property("maritalStatus", "CodeableConcept",
2537          "This field contains a patient's most recent marital (civil) status.", 0, 1, maritalStatus);
2538    case -1764672111:
2539      /* multipleBirth[x] */ return new Property("multipleBirth[x]", "boolean|integer",
2540          "Indicates whether the patient is part of a multiple (boolean) or indicates the actual birth order (integer).",
2541          0, 1, multipleBirth);
2542    case -677369713:
2543      /* multipleBirth */ return new Property("multipleBirth[x]", "boolean|integer",
2544          "Indicates whether the patient is part of a multiple (boolean) or indicates the actual birth order (integer).",
2545          0, 1, multipleBirth);
2546    case -247534439:
2547      /* multipleBirthBoolean */ return new Property("multipleBirth[x]", "boolean|integer",
2548          "Indicates whether the patient is part of a multiple (boolean) or indicates the actual birth order (integer).",
2549          0, 1, multipleBirth);
2550    case 1645805999:
2551      /* multipleBirthInteger */ return new Property("multipleBirth[x]", "boolean|integer",
2552          "Indicates whether the patient is part of a multiple (boolean) or indicates the actual birth order (integer).",
2553          0, 1, multipleBirth);
2554    case 106642994:
2555      /* photo */ return new Property("photo", "Attachment", "Image of the patient.", 0, java.lang.Integer.MAX_VALUE,
2556          photo);
2557    case 951526432:
2558      /* contact */ return new Property("contact", "",
2559          "A contact party (e.g. guardian, partner, friend) for the patient.", 0, java.lang.Integer.MAX_VALUE, contact);
2560    case -1035284522:
2561      /* communication */ return new Property("communication", "",
2562          "A language which may be used to communicate with the patient about his or her health.", 0,
2563          java.lang.Integer.MAX_VALUE, communication);
2564    case 1488292898:
2565      /* generalPractitioner */ return new Property("generalPractitioner",
2566          "Reference(Organization|Practitioner|PractitionerRole)", "Patient's nominated care provider.", 0,
2567          java.lang.Integer.MAX_VALUE, generalPractitioner);
2568    case -2058947787:
2569      /* managingOrganization */ return new Property("managingOrganization", "Reference(Organization)",
2570          "Organization that is the custodian of the patient record.", 0, 1, managingOrganization);
2571    case 3321850:
2572      /* link */ return new Property("link", "",
2573          "Link to another patient resource that concerns the same actual patient.", 0, java.lang.Integer.MAX_VALUE,
2574          link);
2575    default:
2576      return super.getNamedProperty(_hash, _name, _checkValid);
2577    }
2578
2579  }
2580
2581  @Override
2582  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2583    switch (hash) {
2584    case -1618432855:
2585      /* identifier */ return this.identifier == null ? new Base[0]
2586          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2587    case -1422950650:
2588      /* active */ return this.active == null ? new Base[0] : new Base[] { this.active }; // BooleanType
2589    case 3373707:
2590      /* name */ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // HumanName
2591    case -1429363305:
2592      /* telecom */ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
2593    case -1249512767:
2594      /* gender */ return this.gender == null ? new Base[0] : new Base[] { this.gender }; // Enumeration<AdministrativeGender>
2595    case -1210031859:
2596      /* birthDate */ return this.birthDate == null ? new Base[0] : new Base[] { this.birthDate }; // DateType
2597    case 561497972:
2598      /* deceased */ return this.deceased == null ? new Base[0] : new Base[] { this.deceased }; // Type
2599    case -1147692044:
2600      /* address */ return this.address == null ? new Base[0] : this.address.toArray(new Base[this.address.size()]); // Address
2601    case 1756919302:
2602      /* maritalStatus */ return this.maritalStatus == null ? new Base[0] : new Base[] { this.maritalStatus }; // CodeableConcept
2603    case -677369713:
2604      /* multipleBirth */ return this.multipleBirth == null ? new Base[0] : new Base[] { this.multipleBirth }; // Type
2605    case 106642994:
2606      /* photo */ return this.photo == null ? new Base[0] : this.photo.toArray(new Base[this.photo.size()]); // Attachment
2607    case 951526432:
2608      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactComponent
2609    case -1035284522:
2610      /* communication */ return this.communication == null ? new Base[0]
2611          : this.communication.toArray(new Base[this.communication.size()]); // PatientCommunicationComponent
2612    case 1488292898:
2613      /* generalPractitioner */ return this.generalPractitioner == null ? new Base[0]
2614          : this.generalPractitioner.toArray(new Base[this.generalPractitioner.size()]); // Reference
2615    case -2058947787:
2616      /* managingOrganization */ return this.managingOrganization == null ? new Base[0]
2617          : new Base[] { this.managingOrganization }; // Reference
2618    case 3321850:
2619      /* link */ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // PatientLinkComponent
2620    default:
2621      return super.getProperty(hash, name, checkValid);
2622    }
2623
2624  }
2625
2626  @Override
2627  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2628    switch (hash) {
2629    case -1618432855: // identifier
2630      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2631      return value;
2632    case -1422950650: // active
2633      this.active = castToBoolean(value); // BooleanType
2634      return value;
2635    case 3373707: // name
2636      this.getName().add(castToHumanName(value)); // HumanName
2637      return value;
2638    case -1429363305: // telecom
2639      this.getTelecom().add(castToContactPoint(value)); // ContactPoint
2640      return value;
2641    case -1249512767: // gender
2642      value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
2643      this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
2644      return value;
2645    case -1210031859: // birthDate
2646      this.birthDate = castToDate(value); // DateType
2647      return value;
2648    case 561497972: // deceased
2649      this.deceased = castToType(value); // Type
2650      return value;
2651    case -1147692044: // address
2652      this.getAddress().add(castToAddress(value)); // Address
2653      return value;
2654    case 1756919302: // maritalStatus
2655      this.maritalStatus = castToCodeableConcept(value); // CodeableConcept
2656      return value;
2657    case -677369713: // multipleBirth
2658      this.multipleBirth = castToType(value); // Type
2659      return value;
2660    case 106642994: // photo
2661      this.getPhoto().add(castToAttachment(value)); // Attachment
2662      return value;
2663    case 951526432: // contact
2664      this.getContact().add((ContactComponent) value); // ContactComponent
2665      return value;
2666    case -1035284522: // communication
2667      this.getCommunication().add((PatientCommunicationComponent) value); // PatientCommunicationComponent
2668      return value;
2669    case 1488292898: // generalPractitioner
2670      this.getGeneralPractitioner().add(castToReference(value)); // Reference
2671      return value;
2672    case -2058947787: // managingOrganization
2673      this.managingOrganization = castToReference(value); // Reference
2674      return value;
2675    case 3321850: // link
2676      this.getLink().add((PatientLinkComponent) value); // PatientLinkComponent
2677      return value;
2678    default:
2679      return super.setProperty(hash, name, value);
2680    }
2681
2682  }
2683
2684  @Override
2685  public Base setProperty(String name, Base value) throws FHIRException {
2686    if (name.equals("identifier")) {
2687      this.getIdentifier().add(castToIdentifier(value));
2688    } else if (name.equals("active")) {
2689      this.active = castToBoolean(value); // BooleanType
2690    } else if (name.equals("name")) {
2691      this.getName().add(castToHumanName(value));
2692    } else if (name.equals("telecom")) {
2693      this.getTelecom().add(castToContactPoint(value));
2694    } else if (name.equals("gender")) {
2695      value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
2696      this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
2697    } else if (name.equals("birthDate")) {
2698      this.birthDate = castToDate(value); // DateType
2699    } else if (name.equals("deceased[x]")) {
2700      this.deceased = castToType(value); // Type
2701    } else if (name.equals("address")) {
2702      this.getAddress().add(castToAddress(value));
2703    } else if (name.equals("maritalStatus")) {
2704      this.maritalStatus = castToCodeableConcept(value); // CodeableConcept
2705    } else if (name.equals("multipleBirth[x]")) {
2706      this.multipleBirth = castToType(value); // Type
2707    } else if (name.equals("photo")) {
2708      this.getPhoto().add(castToAttachment(value));
2709    } else if (name.equals("contact")) {
2710      this.getContact().add((ContactComponent) value);
2711    } else if (name.equals("communication")) {
2712      this.getCommunication().add((PatientCommunicationComponent) value);
2713    } else if (name.equals("generalPractitioner")) {
2714      this.getGeneralPractitioner().add(castToReference(value));
2715    } else if (name.equals("managingOrganization")) {
2716      this.managingOrganization = castToReference(value); // Reference
2717    } else if (name.equals("link")) {
2718      this.getLink().add((PatientLinkComponent) value);
2719    } else
2720      return super.setProperty(name, value);
2721    return value;
2722  }
2723
2724  @Override
2725  public Base makeProperty(int hash, String name) throws FHIRException {
2726    switch (hash) {
2727    case -1618432855:
2728      return addIdentifier();
2729    case -1422950650:
2730      return getActiveElement();
2731    case 3373707:
2732      return addName();
2733    case -1429363305:
2734      return addTelecom();
2735    case -1249512767:
2736      return getGenderElement();
2737    case -1210031859:
2738      return getBirthDateElement();
2739    case -1311442804:
2740      return getDeceased();
2741    case 561497972:
2742      return getDeceased();
2743    case -1147692044:
2744      return addAddress();
2745    case 1756919302:
2746      return getMaritalStatus();
2747    case -1764672111:
2748      return getMultipleBirth();
2749    case -677369713:
2750      return getMultipleBirth();
2751    case 106642994:
2752      return addPhoto();
2753    case 951526432:
2754      return addContact();
2755    case -1035284522:
2756      return addCommunication();
2757    case 1488292898:
2758      return addGeneralPractitioner();
2759    case -2058947787:
2760      return getManagingOrganization();
2761    case 3321850:
2762      return addLink();
2763    default:
2764      return super.makeProperty(hash, name);
2765    }
2766
2767  }
2768
2769  @Override
2770  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2771    switch (hash) {
2772    case -1618432855:
2773      /* identifier */ return new String[] { "Identifier" };
2774    case -1422950650:
2775      /* active */ return new String[] { "boolean" };
2776    case 3373707:
2777      /* name */ return new String[] { "HumanName" };
2778    case -1429363305:
2779      /* telecom */ return new String[] { "ContactPoint" };
2780    case -1249512767:
2781      /* gender */ return new String[] { "code" };
2782    case -1210031859:
2783      /* birthDate */ return new String[] { "date" };
2784    case 561497972:
2785      /* deceased */ return new String[] { "boolean", "dateTime" };
2786    case -1147692044:
2787      /* address */ return new String[] { "Address" };
2788    case 1756919302:
2789      /* maritalStatus */ return new String[] { "CodeableConcept" };
2790    case -677369713:
2791      /* multipleBirth */ return new String[] { "boolean", "integer" };
2792    case 106642994:
2793      /* photo */ return new String[] { "Attachment" };
2794    case 951526432:
2795      /* contact */ return new String[] {};
2796    case -1035284522:
2797      /* communication */ return new String[] {};
2798    case 1488292898:
2799      /* generalPractitioner */ return new String[] { "Reference" };
2800    case -2058947787:
2801      /* managingOrganization */ return new String[] { "Reference" };
2802    case 3321850:
2803      /* link */ return new String[] {};
2804    default:
2805      return super.getTypesForProperty(hash, name);
2806    }
2807
2808  }
2809
2810  @Override
2811  public Base addChild(String name) throws FHIRException {
2812    if (name.equals("identifier")) {
2813      return addIdentifier();
2814    } else if (name.equals("active")) {
2815      throw new FHIRException("Cannot call addChild on a singleton property Patient.active");
2816    } else if (name.equals("name")) {
2817      return addName();
2818    } else if (name.equals("telecom")) {
2819      return addTelecom();
2820    } else if (name.equals("gender")) {
2821      throw new FHIRException("Cannot call addChild on a singleton property Patient.gender");
2822    } else if (name.equals("birthDate")) {
2823      throw new FHIRException("Cannot call addChild on a singleton property Patient.birthDate");
2824    } else if (name.equals("deceasedBoolean")) {
2825      this.deceased = new BooleanType();
2826      return this.deceased;
2827    } else if (name.equals("deceasedDateTime")) {
2828      this.deceased = new DateTimeType();
2829      return this.deceased;
2830    } else if (name.equals("address")) {
2831      return addAddress();
2832    } else if (name.equals("maritalStatus")) {
2833      this.maritalStatus = new CodeableConcept();
2834      return this.maritalStatus;
2835    } else if (name.equals("multipleBirthBoolean")) {
2836      this.multipleBirth = new BooleanType();
2837      return this.multipleBirth;
2838    } else if (name.equals("multipleBirthInteger")) {
2839      this.multipleBirth = new IntegerType();
2840      return this.multipleBirth;
2841    } else if (name.equals("photo")) {
2842      return addPhoto();
2843    } else if (name.equals("contact")) {
2844      return addContact();
2845    } else if (name.equals("communication")) {
2846      return addCommunication();
2847    } else if (name.equals("generalPractitioner")) {
2848      return addGeneralPractitioner();
2849    } else if (name.equals("managingOrganization")) {
2850      this.managingOrganization = new Reference();
2851      return this.managingOrganization;
2852    } else if (name.equals("link")) {
2853      return addLink();
2854    } else
2855      return super.addChild(name);
2856  }
2857
2858  public String fhirType() {
2859    return "Patient";
2860
2861  }
2862
2863  public Patient copy() {
2864    Patient dst = new Patient();
2865    copyValues(dst);
2866    return dst;
2867  }
2868
2869  public void copyValues(Patient dst) {
2870    super.copyValues(dst);
2871    if (identifier != null) {
2872      dst.identifier = new ArrayList<Identifier>();
2873      for (Identifier i : identifier)
2874        dst.identifier.add(i.copy());
2875    }
2876    ;
2877    dst.active = active == null ? null : active.copy();
2878    if (name != null) {
2879      dst.name = new ArrayList<HumanName>();
2880      for (HumanName i : name)
2881        dst.name.add(i.copy());
2882    }
2883    ;
2884    if (telecom != null) {
2885      dst.telecom = new ArrayList<ContactPoint>();
2886      for (ContactPoint i : telecom)
2887        dst.telecom.add(i.copy());
2888    }
2889    ;
2890    dst.gender = gender == null ? null : gender.copy();
2891    dst.birthDate = birthDate == null ? null : birthDate.copy();
2892    dst.deceased = deceased == null ? null : deceased.copy();
2893    if (address != null) {
2894      dst.address = new ArrayList<Address>();
2895      for (Address i : address)
2896        dst.address.add(i.copy());
2897    }
2898    ;
2899    dst.maritalStatus = maritalStatus == null ? null : maritalStatus.copy();
2900    dst.multipleBirth = multipleBirth == null ? null : multipleBirth.copy();
2901    if (photo != null) {
2902      dst.photo = new ArrayList<Attachment>();
2903      for (Attachment i : photo)
2904        dst.photo.add(i.copy());
2905    }
2906    ;
2907    if (contact != null) {
2908      dst.contact = new ArrayList<ContactComponent>();
2909      for (ContactComponent i : contact)
2910        dst.contact.add(i.copy());
2911    }
2912    ;
2913    if (communication != null) {
2914      dst.communication = new ArrayList<PatientCommunicationComponent>();
2915      for (PatientCommunicationComponent i : communication)
2916        dst.communication.add(i.copy());
2917    }
2918    ;
2919    if (generalPractitioner != null) {
2920      dst.generalPractitioner = new ArrayList<Reference>();
2921      for (Reference i : generalPractitioner)
2922        dst.generalPractitioner.add(i.copy());
2923    }
2924    ;
2925    dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
2926    if (link != null) {
2927      dst.link = new ArrayList<PatientLinkComponent>();
2928      for (PatientLinkComponent i : link)
2929        dst.link.add(i.copy());
2930    }
2931    ;
2932  }
2933
2934  protected Patient typedCopy() {
2935    return copy();
2936  }
2937
2938  @Override
2939  public boolean equalsDeep(Base other_) {
2940    if (!super.equalsDeep(other_))
2941      return false;
2942    if (!(other_ instanceof Patient))
2943      return false;
2944    Patient o = (Patient) other_;
2945    return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true)
2946        && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true)
2947        && compareDeep(gender, o.gender, true) && compareDeep(birthDate, o.birthDate, true)
2948        && compareDeep(deceased, o.deceased, true) && compareDeep(address, o.address, true)
2949        && compareDeep(maritalStatus, o.maritalStatus, true) && compareDeep(multipleBirth, o.multipleBirth, true)
2950        && compareDeep(photo, o.photo, true) && compareDeep(contact, o.contact, true)
2951        && compareDeep(communication, o.communication, true)
2952        && compareDeep(generalPractitioner, o.generalPractitioner, true)
2953        && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(link, o.link, true);
2954  }
2955
2956  @Override
2957  public boolean equalsShallow(Base other_) {
2958    if (!super.equalsShallow(other_))
2959      return false;
2960    if (!(other_ instanceof Patient))
2961      return false;
2962    Patient o = (Patient) other_;
2963    return compareValues(active, o.active, true) && compareValues(gender, o.gender, true)
2964        && compareValues(birthDate, o.birthDate, true);
2965  }
2966
2967  public boolean isEmpty() {
2968    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, name, telecom, gender, birthDate,
2969        deceased, address, maritalStatus, multipleBirth, photo, contact, communication, generalPractitioner,
2970        managingOrganization, link);
2971  }
2972
2973  @Override
2974  public ResourceType getResourceType() {
2975    return ResourceType.Patient;
2976  }
2977
2978  /**
2979   * Search parameter: <b>identifier</b>
2980   * <p>
2981   * Description: <b>A patient identifier</b><br>
2982   * Type: <b>token</b><br>
2983   * Path: <b>Patient.identifier</b><br>
2984   * </p>
2985   */
2986  @SearchParamDefinition(name = "identifier", path = "Patient.identifier", description = "A patient identifier", type = "token")
2987  public static final String SP_IDENTIFIER = "identifier";
2988  /**
2989   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2990   * <p>
2991   * Description: <b>A patient identifier</b><br>
2992   * Type: <b>token</b><br>
2993   * Path: <b>Patient.identifier</b><br>
2994   * </p>
2995   */
2996  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2997      SP_IDENTIFIER);
2998
2999  /**
3000   * Search parameter: <b>given</b>
3001   * <p>
3002   * Description: <b>A portion of the given name of the patient</b><br>
3003   * Type: <b>string</b><br>
3004   * Path: <b>Patient.name.given</b><br>
3005   * </p>
3006   */
3007  @SearchParamDefinition(name = "given", path = "Patient.name.given", description = "A portion of the given name of the patient", type = "string")
3008  public static final String SP_GIVEN = "given";
3009  /**
3010   * <b>Fluent Client</b> search parameter constant for <b>given</b>
3011   * <p>
3012   * Description: <b>A portion of the given name of the patient</b><br>
3013   * Type: <b>string</b><br>
3014   * Path: <b>Patient.name.given</b><br>
3015   * </p>
3016   */
3017  public static final ca.uhn.fhir.rest.gclient.StringClientParam GIVEN = new ca.uhn.fhir.rest.gclient.StringClientParam(
3018      SP_GIVEN);
3019
3020  /**
3021   * Search parameter: <b>address</b>
3022   * <p>
3023   * Description: <b>A server defined search that may match any of the string
3024   * fields in the Address, including line, city, district, state, country,
3025   * postalCode, and/or text</b><br>
3026   * Type: <b>string</b><br>
3027   * Path: <b>Patient.address</b><br>
3028   * </p>
3029   */
3030  @SearchParamDefinition(name = "address", path = "Patient.address", description = "A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text", type = "string")
3031  public static final String SP_ADDRESS = "address";
3032  /**
3033   * <b>Fluent Client</b> search parameter constant for <b>address</b>
3034   * <p>
3035   * Description: <b>A server defined search that may match any of the string
3036   * fields in the Address, including line, city, district, state, country,
3037   * postalCode, and/or text</b><br>
3038   * Type: <b>string</b><br>
3039   * Path: <b>Patient.address</b><br>
3040   * </p>
3041   */
3042  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(
3043      SP_ADDRESS);
3044
3045  /**
3046   * Search parameter: <b>birthdate</b>
3047   * <p>
3048   * Description: <b>The patient's date of birth</b><br>
3049   * Type: <b>date</b><br>
3050   * Path: <b>Patient.birthDate</b><br>
3051   * </p>
3052   */
3053  @SearchParamDefinition(name = "birthdate", path = "Patient.birthDate", description = "The patient's date of birth", type = "date")
3054  public static final String SP_BIRTHDATE = "birthdate";
3055  /**
3056   * <b>Fluent Client</b> search parameter constant for <b>birthdate</b>
3057   * <p>
3058   * Description: <b>The patient's date of birth</b><br>
3059   * Type: <b>date</b><br>
3060   * Path: <b>Patient.birthDate</b><br>
3061   * </p>
3062   */
3063  public static final ca.uhn.fhir.rest.gclient.DateClientParam BIRTHDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3064      SP_BIRTHDATE);
3065
3066  /**
3067   * Search parameter: <b>deceased</b>
3068   * <p>
3069   * Description: <b>This patient has been marked as deceased, or as a death date
3070   * entered</b><br>
3071   * Type: <b>token</b><br>
3072   * Path: <b>Patient.deceased[x]</b><br>
3073   * </p>
3074   */
3075  @SearchParamDefinition(name = "deceased", path = "Patient.deceased.exists() and Patient.deceased != false", description = "This patient has been marked as deceased, or as a death date entered", type = "token")
3076  public static final String SP_DECEASED = "deceased";
3077  /**
3078   * <b>Fluent Client</b> search parameter constant for <b>deceased</b>
3079   * <p>
3080   * Description: <b>This patient has been marked as deceased, or as a death date
3081   * entered</b><br>
3082   * Type: <b>token</b><br>
3083   * Path: <b>Patient.deceased[x]</b><br>
3084   * </p>
3085   */
3086  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DECEASED = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3087      SP_DECEASED);
3088
3089  /**
3090   * Search parameter: <b>address-state</b>
3091   * <p>
3092   * Description: <b>A state specified in an address</b><br>
3093   * Type: <b>string</b><br>
3094   * Path: <b>Patient.address.state</b><br>
3095   * </p>
3096   */
3097  @SearchParamDefinition(name = "address-state", path = "Patient.address.state", description = "A state specified in an address", type = "string")
3098  public static final String SP_ADDRESS_STATE = "address-state";
3099  /**
3100   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
3101   * <p>
3102   * Description: <b>A state specified in an address</b><br>
3103   * Type: <b>string</b><br>
3104   * Path: <b>Patient.address.state</b><br>
3105   * </p>
3106   */
3107  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(
3108      SP_ADDRESS_STATE);
3109
3110  /**
3111   * Search parameter: <b>gender</b>
3112   * <p>
3113   * Description: <b>Gender of the patient</b><br>
3114   * Type: <b>token</b><br>
3115   * Path: <b>Patient.gender</b><br>
3116   * </p>
3117   */
3118  @SearchParamDefinition(name = "gender", path = "Patient.gender", description = "Gender of the patient", type = "token")
3119  public static final String SP_GENDER = "gender";
3120  /**
3121   * <b>Fluent Client</b> search parameter constant for <b>gender</b>
3122   * <p>
3123   * Description: <b>Gender of the patient</b><br>
3124   * Type: <b>token</b><br>
3125   * Path: <b>Patient.gender</b><br>
3126   * </p>
3127   */
3128  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GENDER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3129      SP_GENDER);
3130
3131  /**
3132   * Search parameter: <b>general-practitioner</b>
3133   * <p>
3134   * Description: <b>Patient's nominated general practitioner, not the
3135   * organization that manages the record</b><br>
3136   * Type: <b>reference</b><br>
3137   * Path: <b>Patient.generalPractitioner</b><br>
3138   * </p>
3139   */
3140  @SearchParamDefinition(name = "general-practitioner", path = "Patient.generalPractitioner", description = "Patient's nominated general practitioner, not the organization that manages the record", type = "reference", providesMembershipIn = {
3141      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
3142          Practitioner.class, PractitionerRole.class })
3143  public static final String SP_GENERAL_PRACTITIONER = "general-practitioner";
3144  /**
3145   * <b>Fluent Client</b> search parameter constant for
3146   * <b>general-practitioner</b>
3147   * <p>
3148   * Description: <b>Patient's nominated general practitioner, not the
3149   * organization that manages the record</b><br>
3150   * Type: <b>reference</b><br>
3151   * Path: <b>Patient.generalPractitioner</b><br>
3152   * </p>
3153   */
3154  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam GENERAL_PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3155      SP_GENERAL_PRACTITIONER);
3156
3157  /**
3158   * Constant for fluent queries to be used to add include statements. Specifies
3159   * the path value of "<b>Patient:general-practitioner</b>".
3160   */
3161  public static final ca.uhn.fhir.model.api.Include INCLUDE_GENERAL_PRACTITIONER = new ca.uhn.fhir.model.api.Include(
3162      "Patient:general-practitioner").toLocked();
3163
3164  /**
3165   * Search parameter: <b>link</b>
3166   * <p>
3167   * Description: <b>All patients linked to the given patient</b><br>
3168   * Type: <b>reference</b><br>
3169   * Path: <b>Patient.link.other</b><br>
3170   * </p>
3171   */
3172  @SearchParamDefinition(name = "link", path = "Patient.link.other", description = "All patients linked to the given patient", type = "reference", providesMembershipIn = {
3173      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
3174      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Patient.class,
3175          RelatedPerson.class })
3176  public static final String SP_LINK = "link";
3177  /**
3178   * <b>Fluent Client</b> search parameter constant for <b>link</b>
3179   * <p>
3180   * Description: <b>All patients linked to the given patient</b><br>
3181   * Type: <b>reference</b><br>
3182   * Path: <b>Patient.link.other</b><br>
3183   * </p>
3184   */
3185  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LINK = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3186      SP_LINK);
3187
3188  /**
3189   * Constant for fluent queries to be used to add include statements. Specifies
3190   * the path value of "<b>Patient:link</b>".
3191   */
3192  public static final ca.uhn.fhir.model.api.Include INCLUDE_LINK = new ca.uhn.fhir.model.api.Include("Patient:link")
3193      .toLocked();
3194
3195  /**
3196   * Search parameter: <b>active</b>
3197   * <p>
3198   * Description: <b>Whether the patient record is active</b><br>
3199   * Type: <b>token</b><br>
3200   * Path: <b>Patient.active</b><br>
3201   * </p>
3202   */
3203  @SearchParamDefinition(name = "active", path = "Patient.active", description = "Whether the patient record is active", type = "token")
3204  public static final String SP_ACTIVE = "active";
3205  /**
3206   * <b>Fluent Client</b> search parameter constant for <b>active</b>
3207   * <p>
3208   * Description: <b>Whether the patient record is active</b><br>
3209   * Type: <b>token</b><br>
3210   * Path: <b>Patient.active</b><br>
3211   * </p>
3212   */
3213  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3214      SP_ACTIVE);
3215
3216  /**
3217   * Search parameter: <b>language</b>
3218   * <p>
3219   * Description: <b>Language code (irrespective of use value)</b><br>
3220   * Type: <b>token</b><br>
3221   * Path: <b>Patient.communication.language</b><br>
3222   * </p>
3223   */
3224  @SearchParamDefinition(name = "language", path = "Patient.communication.language", description = "Language code (irrespective of use value)", type = "token")
3225  public static final String SP_LANGUAGE = "language";
3226  /**
3227   * <b>Fluent Client</b> search parameter constant for <b>language</b>
3228   * <p>
3229   * Description: <b>Language code (irrespective of use value)</b><br>
3230   * Type: <b>token</b><br>
3231   * Path: <b>Patient.communication.language</b><br>
3232   * </p>
3233   */
3234  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LANGUAGE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3235      SP_LANGUAGE);
3236
3237  /**
3238   * Search parameter: <b>address-postalcode</b>
3239   * <p>
3240   * Description: <b>A postalCode specified in an address</b><br>
3241   * Type: <b>string</b><br>
3242   * Path: <b>Patient.address.postalCode</b><br>
3243   * </p>
3244   */
3245  @SearchParamDefinition(name = "address-postalcode", path = "Patient.address.postalCode", description = "A postalCode specified in an address", type = "string")
3246  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
3247  /**
3248   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
3249   * <p>
3250   * Description: <b>A postalCode specified in an address</b><br>
3251   * Type: <b>string</b><br>
3252   * Path: <b>Patient.address.postalCode</b><br>
3253   * </p>
3254   */
3255  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(
3256      SP_ADDRESS_POSTALCODE);
3257
3258  /**
3259   * Search parameter: <b>address-country</b>
3260   * <p>
3261   * Description: <b>A country specified in an address</b><br>
3262   * Type: <b>string</b><br>
3263   * Path: <b>Patient.address.country</b><br>
3264   * </p>
3265   */
3266  @SearchParamDefinition(name = "address-country", path = "Patient.address.country", description = "A country specified in an address", type = "string")
3267  public static final String SP_ADDRESS_COUNTRY = "address-country";
3268  /**
3269   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
3270   * <p>
3271   * Description: <b>A country specified in an address</b><br>
3272   * Type: <b>string</b><br>
3273   * Path: <b>Patient.address.country</b><br>
3274   * </p>
3275   */
3276  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(
3277      SP_ADDRESS_COUNTRY);
3278
3279  /**
3280   * Search parameter: <b>death-date</b>
3281   * <p>
3282   * Description: <b>The date of death has been provided and satisfies this search
3283   * value</b><br>
3284   * Type: <b>date</b><br>
3285   * Path: <b>Patient.deceasedDateTime</b><br>
3286   * </p>
3287   */
3288  @SearchParamDefinition(name = "death-date", path = "(Patient.deceased as dateTime)", description = "The date of death has been provided and satisfies this search value", type = "date")
3289  public static final String SP_DEATH_DATE = "death-date";
3290  /**
3291   * <b>Fluent Client</b> search parameter constant for <b>death-date</b>
3292   * <p>
3293   * Description: <b>The date of death has been provided and satisfies this search
3294   * value</b><br>
3295   * Type: <b>date</b><br>
3296   * Path: <b>Patient.deceasedDateTime</b><br>
3297   * </p>
3298   */
3299  public static final ca.uhn.fhir.rest.gclient.DateClientParam DEATH_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3300      SP_DEATH_DATE);
3301
3302  /**
3303   * Search parameter: <b>phonetic</b>
3304   * <p>
3305   * Description: <b>A portion of either family or given name using some kind of
3306   * phonetic matching algorithm</b><br>
3307   * Type: <b>string</b><br>
3308   * Path: <b>Patient.name</b><br>
3309   * </p>
3310   */
3311  @SearchParamDefinition(name = "phonetic", path = "Patient.name", description = "A portion of either family or given name using some kind of phonetic matching algorithm", type = "string")
3312  public static final String SP_PHONETIC = "phonetic";
3313  /**
3314   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
3315   * <p>
3316   * Description: <b>A portion of either family or given name using some kind of
3317   * phonetic matching algorithm</b><br>
3318   * Type: <b>string</b><br>
3319   * Path: <b>Patient.name</b><br>
3320   * </p>
3321   */
3322  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(
3323      SP_PHONETIC);
3324
3325  /**
3326   * Search parameter: <b>phone</b>
3327   * <p>
3328   * Description: <b>A value in a phone contact</b><br>
3329   * Type: <b>token</b><br>
3330   * Path: <b>Patient.telecom(system=phone)</b><br>
3331   * </p>
3332   */
3333  @SearchParamDefinition(name = "phone", path = "Patient.telecom.where(system='phone')", description = "A value in a phone contact", type = "token")
3334  public static final String SP_PHONE = "phone";
3335  /**
3336   * <b>Fluent Client</b> search parameter constant for <b>phone</b>
3337   * <p>
3338   * Description: <b>A value in a phone contact</b><br>
3339   * Type: <b>token</b><br>
3340   * Path: <b>Patient.telecom(system=phone)</b><br>
3341   * </p>
3342   */
3343  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PHONE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3344      SP_PHONE);
3345
3346  /**
3347   * Search parameter: <b>organization</b>
3348   * <p>
3349   * Description: <b>The organization that is the custodian of the patient
3350   * record</b><br>
3351   * Type: <b>reference</b><br>
3352   * Path: <b>Patient.managingOrganization</b><br>
3353   * </p>
3354   */
3355  @SearchParamDefinition(name = "organization", path = "Patient.managingOrganization", description = "The organization that is the custodian of the patient record", type = "reference", target = {
3356      Organization.class })
3357  public static final String SP_ORGANIZATION = "organization";
3358  /**
3359   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
3360   * <p>
3361   * Description: <b>The organization that is the custodian of the patient
3362   * record</b><br>
3363   * Type: <b>reference</b><br>
3364   * Path: <b>Patient.managingOrganization</b><br>
3365   * </p>
3366   */
3367  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3368      SP_ORGANIZATION);
3369
3370  /**
3371   * Constant for fluent queries to be used to add include statements. Specifies
3372   * the path value of "<b>Patient:organization</b>".
3373   */
3374  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include(
3375      "Patient:organization").toLocked();
3376
3377  /**
3378   * Search parameter: <b>name</b>
3379   * <p>
3380   * Description: <b>A server defined search that may match any of the string
3381   * fields in the HumanName, including family, give, prefix, suffix, suffix,
3382   * and/or text</b><br>
3383   * Type: <b>string</b><br>
3384   * Path: <b>Patient.name</b><br>
3385   * </p>
3386   */
3387  @SearchParamDefinition(name = "name", path = "Patient.name", description = "A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text", type = "string")
3388  public static final String SP_NAME = "name";
3389  /**
3390   * <b>Fluent Client</b> search parameter constant for <b>name</b>
3391   * <p>
3392   * Description: <b>A server defined search that may match any of the string
3393   * fields in the HumanName, including family, give, prefix, suffix, suffix,
3394   * and/or text</b><br>
3395   * Type: <b>string</b><br>
3396   * Path: <b>Patient.name</b><br>
3397   * </p>
3398   */
3399  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
3400      SP_NAME);
3401
3402  /**
3403   * Search parameter: <b>address-use</b>
3404   * <p>
3405   * Description: <b>A use code specified in an address</b><br>
3406   * Type: <b>token</b><br>
3407   * Path: <b>Patient.address.use</b><br>
3408   * </p>
3409   */
3410  @SearchParamDefinition(name = "address-use", path = "Patient.address.use", description = "A use code specified in an address", type = "token")
3411  public static final String SP_ADDRESS_USE = "address-use";
3412  /**
3413   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
3414   * <p>
3415   * Description: <b>A use code specified in an address</b><br>
3416   * Type: <b>token</b><br>
3417   * Path: <b>Patient.address.use</b><br>
3418   * </p>
3419   */
3420  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3421      SP_ADDRESS_USE);
3422
3423  /**
3424   * Search parameter: <b>telecom</b>
3425   * <p>
3426   * Description: <b>The value in any kind of telecom details of the
3427   * patient</b><br>
3428   * Type: <b>token</b><br>
3429   * Path: <b>Patient.telecom</b><br>
3430   * </p>
3431   */
3432  @SearchParamDefinition(name = "telecom", path = "Patient.telecom", description = "The value in any kind of telecom details of the patient", type = "token")
3433  public static final String SP_TELECOM = "telecom";
3434  /**
3435   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
3436   * <p>
3437   * Description: <b>The value in any kind of telecom details of the
3438   * patient</b><br>
3439   * Type: <b>token</b><br>
3440   * Path: <b>Patient.telecom</b><br>
3441   * </p>
3442   */
3443  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3444      SP_TELECOM);
3445
3446  /**
3447   * Search parameter: <b>family</b>
3448   * <p>
3449   * Description: <b>A portion of the family name of the patient</b><br>
3450   * Type: <b>string</b><br>
3451   * Path: <b>Patient.name.family</b><br>
3452   * </p>
3453   */
3454  @SearchParamDefinition(name = "family", path = "Patient.name.family", description = "A portion of the family name of the patient", type = "string")
3455  public static final String SP_FAMILY = "family";
3456  /**
3457   * <b>Fluent Client</b> search parameter constant for <b>family</b>
3458   * <p>
3459   * Description: <b>A portion of the family name of the patient</b><br>
3460   * Type: <b>string</b><br>
3461   * Path: <b>Patient.name.family</b><br>
3462   * </p>
3463   */
3464  public static final ca.uhn.fhir.rest.gclient.StringClientParam FAMILY = new ca.uhn.fhir.rest.gclient.StringClientParam(
3465      SP_FAMILY);
3466
3467  /**
3468   * Search parameter: <b>address-city</b>
3469   * <p>
3470   * Description: <b>A city specified in an address</b><br>
3471   * Type: <b>string</b><br>
3472   * Path: <b>Patient.address.city</b><br>
3473   * </p>
3474   */
3475  @SearchParamDefinition(name = "address-city", path = "Patient.address.city", description = "A city specified in an address", type = "string")
3476  public static final String SP_ADDRESS_CITY = "address-city";
3477  /**
3478   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
3479   * <p>
3480   * Description: <b>A city specified in an address</b><br>
3481   * Type: <b>string</b><br>
3482   * Path: <b>Patient.address.city</b><br>
3483   * </p>
3484   */
3485  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(
3486      SP_ADDRESS_CITY);
3487
3488  /**
3489   * Search parameter: <b>email</b>
3490   * <p>
3491   * Description: <b>A value in an email contact</b><br>
3492   * Type: <b>token</b><br>
3493   * Path: <b>Patient.telecom(system=email)</b><br>
3494   * </p>
3495   */
3496  @SearchParamDefinition(name = "email", path = "Patient.telecom.where(system='email')", description = "A value in an email contact", type = "token")
3497  public static final String SP_EMAIL = "email";
3498  /**
3499   * <b>Fluent Client</b> search parameter constant for <b>email</b>
3500   * <p>
3501   * Description: <b>A value in an email contact</b><br>
3502   * Type: <b>token</b><br>
3503   * Path: <b>Patient.telecom(system=email)</b><br>
3504   * </p>
3505   */
3506  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMAIL = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3507      SP_EMAIL);
3508
3509}