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