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