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