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