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