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