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