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