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