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