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