001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import org.hl7.fhir.r5.model.Enumerations.*;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069/**
070 * Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.
071 */
072@ResourceDef(name="RelatedPerson", profile="http://hl7.org/fhir/StructureDefinition/RelatedPerson")
073public class RelatedPerson extends DomainResource {
074
075    @Block()
076    public static class RelatedPersonCommunicationComponent extends BackboneElement implements IBaseBackboneElement {
077        /**
078         * 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.
079         */
080        @Child(name = "language", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
081        @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." )
082        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
083        protected CodeableConcept language;
084
085        /**
086         * Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
087         */
088        @Child(name = "preferred", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
089        @Description(shortDefinition="Language preference indicator", formalDefinition="Indicates whether or not the patient prefers this language (over other languages he masters up a certain level)." )
090        protected BooleanType preferred;
091
092        private static final long serialVersionUID = 633792918L;
093
094    /**
095     * Constructor
096     */
097      public RelatedPersonCommunicationComponent() {
098        super();
099      }
100
101    /**
102     * Constructor
103     */
104      public RelatedPersonCommunicationComponent(CodeableConcept language) {
105        super();
106        this.language = language;
107      }
108
109        /**
110         * @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.)
111         */
112        public CodeableConcept getLanguage() { 
113          if (this.language == null)
114            if (Configuration.errorOnAutoCreate())
115              throw new Error("Attempt to auto-create RelatedPersonCommunicationComponent.language");
116            else if (Configuration.doAutoCreate())
117              this.language = new CodeableConcept(); // cc
118          return this.language;
119        }
120
121        public boolean hasLanguage() { 
122          return this.language != null && !this.language.isEmpty();
123        }
124
125        /**
126         * @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.)
127         */
128        public RelatedPersonCommunicationComponent setLanguage(CodeableConcept value) { 
129          this.language = value;
130          return this;
131        }
132
133        /**
134         * @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
135         */
136        public BooleanType getPreferredElement() { 
137          if (this.preferred == null)
138            if (Configuration.errorOnAutoCreate())
139              throw new Error("Attempt to auto-create RelatedPersonCommunicationComponent.preferred");
140            else if (Configuration.doAutoCreate())
141              this.preferred = new BooleanType(); // bb
142          return this.preferred;
143        }
144
145        public boolean hasPreferredElement() { 
146          return this.preferred != null && !this.preferred.isEmpty();
147        }
148
149        public boolean hasPreferred() { 
150          return this.preferred != null && !this.preferred.isEmpty();
151        }
152
153        /**
154         * @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
155         */
156        public RelatedPersonCommunicationComponent setPreferredElement(BooleanType value) { 
157          this.preferred = value;
158          return this;
159        }
160
161        /**
162         * @return Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
163         */
164        public boolean getPreferred() { 
165          return this.preferred == null || this.preferred.isEmpty() ? false : this.preferred.getValue();
166        }
167
168        /**
169         * @param value Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
170         */
171        public RelatedPersonCommunicationComponent setPreferred(boolean value) { 
172            if (this.preferred == null)
173              this.preferred = new BooleanType();
174            this.preferred.setValue(value);
175          return this;
176        }
177
178        protected void listChildren(List<Property> children) {
179          super.listChildren(children);
180          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));
181          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));
182        }
183
184        @Override
185        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
186          switch (_hash) {
187          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);
188          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);
189          default: return super.getNamedProperty(_hash, _name, _checkValid);
190          }
191
192        }
193
194      @Override
195      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
196        switch (hash) {
197        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
198        case -1294005119: /*preferred*/ return this.preferred == null ? new Base[0] : new Base[] {this.preferred}; // BooleanType
199        default: return super.getProperty(hash, name, checkValid);
200        }
201
202      }
203
204      @Override
205      public Base setProperty(int hash, String name, Base value) throws FHIRException {
206        switch (hash) {
207        case -1613589672: // language
208          this.language = castToCodeableConcept(value); // CodeableConcept
209          return value;
210        case -1294005119: // preferred
211          this.preferred = castToBoolean(value); // BooleanType
212          return value;
213        default: return super.setProperty(hash, name, value);
214        }
215
216      }
217
218      @Override
219      public Base setProperty(String name, Base value) throws FHIRException {
220        if (name.equals("language")) {
221          this.language = castToCodeableConcept(value); // CodeableConcept
222        } else if (name.equals("preferred")) {
223          this.preferred = castToBoolean(value); // BooleanType
224        } else
225          return super.setProperty(name, value);
226        return value;
227      }
228
229      @Override
230      public Base makeProperty(int hash, String name) throws FHIRException {
231        switch (hash) {
232        case -1613589672:  return getLanguage();
233        case -1294005119:  return getPreferredElement();
234        default: return super.makeProperty(hash, name);
235        }
236
237      }
238
239      @Override
240      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
241        switch (hash) {
242        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
243        case -1294005119: /*preferred*/ return new String[] {"boolean"};
244        default: return super.getTypesForProperty(hash, name);
245        }
246
247      }
248
249      @Override
250      public Base addChild(String name) throws FHIRException {
251        if (name.equals("language")) {
252          this.language = new CodeableConcept();
253          return this.language;
254        }
255        else if (name.equals("preferred")) {
256          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.preferred");
257        }
258        else
259          return super.addChild(name);
260      }
261
262      public RelatedPersonCommunicationComponent copy() {
263        RelatedPersonCommunicationComponent dst = new RelatedPersonCommunicationComponent();
264        copyValues(dst);
265        return dst;
266      }
267
268      public void copyValues(RelatedPersonCommunicationComponent dst) {
269        super.copyValues(dst);
270        dst.language = language == null ? null : language.copy();
271        dst.preferred = preferred == null ? null : preferred.copy();
272      }
273
274      @Override
275      public boolean equalsDeep(Base other_) {
276        if (!super.equalsDeep(other_))
277          return false;
278        if (!(other_ instanceof RelatedPersonCommunicationComponent))
279          return false;
280        RelatedPersonCommunicationComponent o = (RelatedPersonCommunicationComponent) other_;
281        return compareDeep(language, o.language, true) && compareDeep(preferred, o.preferred, true);
282      }
283
284      @Override
285      public boolean equalsShallow(Base other_) {
286        if (!super.equalsShallow(other_))
287          return false;
288        if (!(other_ instanceof RelatedPersonCommunicationComponent))
289          return false;
290        RelatedPersonCommunicationComponent o = (RelatedPersonCommunicationComponent) other_;
291        return compareValues(preferred, o.preferred, true);
292      }
293
294      public boolean isEmpty() {
295        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(language, preferred);
296      }
297
298  public String fhirType() {
299    return "RelatedPerson.communication";
300
301  }
302
303  }
304
305    /**
306     * Identifier for a person within a particular scope.
307     */
308    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
309    @Description(shortDefinition="A human identifier for this person", formalDefinition="Identifier for a person within a particular scope." )
310    protected List<Identifier> identifier;
311
312    /**
313     * Whether this related person record is in active use.
314     */
315    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
316    @Description(shortDefinition="Whether this related person's record is in active use", formalDefinition="Whether this related person record is in active use." )
317    protected BooleanType active;
318
319    /**
320     * The patient this person is related to.
321     */
322    @Child(name = "patient", type = {Patient.class}, order=2, min=1, max=1, modifier=false, summary=true)
323    @Description(shortDefinition="The patient this person is related to", formalDefinition="The patient this person is related to." )
324    protected Reference patient;
325
326    /**
327     * The nature of the relationship between a patient and the related person.
328     */
329    @Child(name = "relationship", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
330    @Description(shortDefinition="The nature of the relationship", formalDefinition="The nature of the relationship between a patient and the related person." )
331    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype")
332    protected List<CodeableConcept> relationship;
333
334    /**
335     * A name associated with the person.
336     */
337    @Child(name = "name", type = {HumanName.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
338    @Description(shortDefinition="A name associated with the person", formalDefinition="A name associated with the person." )
339    protected List<HumanName> name;
340
341    /**
342     * A contact detail for the person, e.g. a telephone number or an email address.
343     */
344    @Child(name = "telecom", type = {ContactPoint.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
345    @Description(shortDefinition="A contact detail for the person", formalDefinition="A contact detail for the person, e.g. a telephone number or an email address." )
346    protected List<ContactPoint> telecom;
347
348    /**
349     * Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
350     */
351    @Child(name = "gender", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
352    @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes." )
353    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/administrative-gender")
354    protected Enumeration<AdministrativeGender> gender;
355
356    /**
357     * The date on which the related person was born.
358     */
359    @Child(name = "birthDate", type = {DateType.class}, order=7, min=0, max=1, modifier=false, summary=true)
360    @Description(shortDefinition="The date on which the related person was born", formalDefinition="The date on which the related person was born." )
361    protected DateType birthDate;
362
363    /**
364     * Address where the related person can be contacted or visited.
365     */
366    @Child(name = "address", type = {Address.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
367    @Description(shortDefinition="Address where the related person can be contacted or visited", formalDefinition="Address where the related person can be contacted or visited." )
368    protected List<Address> address;
369
370    /**
371     * Image of the person.
372     */
373    @Child(name = "photo", type = {Attachment.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
374    @Description(shortDefinition="Image of the person", formalDefinition="Image of the person." )
375    protected List<Attachment> photo;
376
377    /**
378     * The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.
379     */
380    @Child(name = "period", type = {Period.class}, order=10, min=0, max=1, modifier=false, summary=false)
381    @Description(shortDefinition="Period of time that this relationship is considered valid", formalDefinition="The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown." )
382    protected Period period;
383
384    /**
385     * A language which may be used to communicate with about the patient's health.
386     */
387    @Child(name = "communication", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
388    @Description(shortDefinition="A language which may be used to communicate with about the patient's health", formalDefinition="A language which may be used to communicate with about the patient's health." )
389    protected List<RelatedPersonCommunicationComponent> communication;
390
391    private static final long serialVersionUID = -857475397L;
392
393  /**
394   * Constructor
395   */
396    public RelatedPerson() {
397      super();
398    }
399
400  /**
401   * Constructor
402   */
403    public RelatedPerson(Reference patient) {
404      super();
405      this.patient = patient;
406    }
407
408    /**
409     * @return {@link #identifier} (Identifier for a person within a particular scope.)
410     */
411    public List<Identifier> getIdentifier() { 
412      if (this.identifier == null)
413        this.identifier = new ArrayList<Identifier>();
414      return this.identifier;
415    }
416
417    /**
418     * @return Returns a reference to <code>this</code> for easy method chaining
419     */
420    public RelatedPerson setIdentifier(List<Identifier> theIdentifier) { 
421      this.identifier = theIdentifier;
422      return this;
423    }
424
425    public boolean hasIdentifier() { 
426      if (this.identifier == null)
427        return false;
428      for (Identifier item : this.identifier)
429        if (!item.isEmpty())
430          return true;
431      return false;
432    }
433
434    public Identifier addIdentifier() { //3
435      Identifier t = new Identifier();
436      if (this.identifier == null)
437        this.identifier = new ArrayList<Identifier>();
438      this.identifier.add(t);
439      return t;
440    }
441
442    public RelatedPerson addIdentifier(Identifier t) { //3
443      if (t == null)
444        return this;
445      if (this.identifier == null)
446        this.identifier = new ArrayList<Identifier>();
447      this.identifier.add(t);
448      return this;
449    }
450
451    /**
452     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
453     */
454    public Identifier getIdentifierFirstRep() { 
455      if (getIdentifier().isEmpty()) {
456        addIdentifier();
457      }
458      return getIdentifier().get(0);
459    }
460
461    /**
462     * @return {@link #active} (Whether this related person record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
463     */
464    public BooleanType getActiveElement() { 
465      if (this.active == null)
466        if (Configuration.errorOnAutoCreate())
467          throw new Error("Attempt to auto-create RelatedPerson.active");
468        else if (Configuration.doAutoCreate())
469          this.active = new BooleanType(); // bb
470      return this.active;
471    }
472
473    public boolean hasActiveElement() { 
474      return this.active != null && !this.active.isEmpty();
475    }
476
477    public boolean hasActive() { 
478      return this.active != null && !this.active.isEmpty();
479    }
480
481    /**
482     * @param value {@link #active} (Whether this related person record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
483     */
484    public RelatedPerson setActiveElement(BooleanType value) { 
485      this.active = value;
486      return this;
487    }
488
489    /**
490     * @return Whether this related person record is in active use.
491     */
492    public boolean getActive() { 
493      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
494    }
495
496    /**
497     * @param value Whether this related person record is in active use.
498     */
499    public RelatedPerson setActive(boolean value) { 
500        if (this.active == null)
501          this.active = new BooleanType();
502        this.active.setValue(value);
503      return this;
504    }
505
506    /**
507     * @return {@link #patient} (The patient this person is related to.)
508     */
509    public Reference getPatient() { 
510      if (this.patient == null)
511        if (Configuration.errorOnAutoCreate())
512          throw new Error("Attempt to auto-create RelatedPerson.patient");
513        else if (Configuration.doAutoCreate())
514          this.patient = new Reference(); // cc
515      return this.patient;
516    }
517
518    public boolean hasPatient() { 
519      return this.patient != null && !this.patient.isEmpty();
520    }
521
522    /**
523     * @param value {@link #patient} (The patient this person is related to.)
524     */
525    public RelatedPerson setPatient(Reference value) { 
526      this.patient = value;
527      return this;
528    }
529
530    /**
531     * @return {@link #relationship} (The nature of the relationship between a patient and the related person.)
532     */
533    public List<CodeableConcept> getRelationship() { 
534      if (this.relationship == null)
535        this.relationship = new ArrayList<CodeableConcept>();
536      return this.relationship;
537    }
538
539    /**
540     * @return Returns a reference to <code>this</code> for easy method chaining
541     */
542    public RelatedPerson setRelationship(List<CodeableConcept> theRelationship) { 
543      this.relationship = theRelationship;
544      return this;
545    }
546
547    public boolean hasRelationship() { 
548      if (this.relationship == null)
549        return false;
550      for (CodeableConcept item : this.relationship)
551        if (!item.isEmpty())
552          return true;
553      return false;
554    }
555
556    public CodeableConcept addRelationship() { //3
557      CodeableConcept t = new CodeableConcept();
558      if (this.relationship == null)
559        this.relationship = new ArrayList<CodeableConcept>();
560      this.relationship.add(t);
561      return t;
562    }
563
564    public RelatedPerson addRelationship(CodeableConcept t) { //3
565      if (t == null)
566        return this;
567      if (this.relationship == null)
568        this.relationship = new ArrayList<CodeableConcept>();
569      this.relationship.add(t);
570      return this;
571    }
572
573    /**
574     * @return The first repetition of repeating field {@link #relationship}, creating it if it does not already exist
575     */
576    public CodeableConcept getRelationshipFirstRep() { 
577      if (getRelationship().isEmpty()) {
578        addRelationship();
579      }
580      return getRelationship().get(0);
581    }
582
583    /**
584     * @return {@link #name} (A name associated with the person.)
585     */
586    public List<HumanName> getName() { 
587      if (this.name == null)
588        this.name = new ArrayList<HumanName>();
589      return this.name;
590    }
591
592    /**
593     * @return Returns a reference to <code>this</code> for easy method chaining
594     */
595    public RelatedPerson setName(List<HumanName> theName) { 
596      this.name = theName;
597      return this;
598    }
599
600    public boolean hasName() { 
601      if (this.name == null)
602        return false;
603      for (HumanName item : this.name)
604        if (!item.isEmpty())
605          return true;
606      return false;
607    }
608
609    public HumanName addName() { //3
610      HumanName t = new HumanName();
611      if (this.name == null)
612        this.name = new ArrayList<HumanName>();
613      this.name.add(t);
614      return t;
615    }
616
617    public RelatedPerson addName(HumanName t) { //3
618      if (t == null)
619        return this;
620      if (this.name == null)
621        this.name = new ArrayList<HumanName>();
622      this.name.add(t);
623      return this;
624    }
625
626    /**
627     * @return The first repetition of repeating field {@link #name}, creating it if it does not already exist
628     */
629    public HumanName getNameFirstRep() { 
630      if (getName().isEmpty()) {
631        addName();
632      }
633      return getName().get(0);
634    }
635
636    /**
637     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.)
638     */
639    public List<ContactPoint> getTelecom() { 
640      if (this.telecom == null)
641        this.telecom = new ArrayList<ContactPoint>();
642      return this.telecom;
643    }
644
645    /**
646     * @return Returns a reference to <code>this</code> for easy method chaining
647     */
648    public RelatedPerson setTelecom(List<ContactPoint> theTelecom) { 
649      this.telecom = theTelecom;
650      return this;
651    }
652
653    public boolean hasTelecom() { 
654      if (this.telecom == null)
655        return false;
656      for (ContactPoint item : this.telecom)
657        if (!item.isEmpty())
658          return true;
659      return false;
660    }
661
662    public ContactPoint addTelecom() { //3
663      ContactPoint t = new ContactPoint();
664      if (this.telecom == null)
665        this.telecom = new ArrayList<ContactPoint>();
666      this.telecom.add(t);
667      return t;
668    }
669
670    public RelatedPerson addTelecom(ContactPoint t) { //3
671      if (t == null)
672        return this;
673      if (this.telecom == null)
674        this.telecom = new ArrayList<ContactPoint>();
675      this.telecom.add(t);
676      return this;
677    }
678
679    /**
680     * @return The first repetition of repeating field {@link #telecom}, creating it if it does not already exist
681     */
682    public ContactPoint getTelecomFirstRep() { 
683      if (getTelecom().isEmpty()) {
684        addTelecom();
685      }
686      return getTelecom().get(0);
687    }
688
689    /**
690     * @return {@link #gender} (Administrative Gender - the gender that the 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
691     */
692    public Enumeration<AdministrativeGender> getGenderElement() { 
693      if (this.gender == null)
694        if (Configuration.errorOnAutoCreate())
695          throw new Error("Attempt to auto-create RelatedPerson.gender");
696        else if (Configuration.doAutoCreate())
697          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
698      return this.gender;
699    }
700
701    public boolean hasGenderElement() { 
702      return this.gender != null && !this.gender.isEmpty();
703    }
704
705    public boolean hasGender() { 
706      return this.gender != null && !this.gender.isEmpty();
707    }
708
709    /**
710     * @param value {@link #gender} (Administrative Gender - the gender that the 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
711     */
712    public RelatedPerson setGenderElement(Enumeration<AdministrativeGender> value) { 
713      this.gender = value;
714      return this;
715    }
716
717    /**
718     * @return Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
719     */
720    public AdministrativeGender getGender() { 
721      return this.gender == null ? null : this.gender.getValue();
722    }
723
724    /**
725     * @param value Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
726     */
727    public RelatedPerson setGender(AdministrativeGender value) { 
728      if (value == null)
729        this.gender = null;
730      else {
731        if (this.gender == null)
732          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
733        this.gender.setValue(value);
734      }
735      return this;
736    }
737
738    /**
739     * @return {@link #birthDate} (The date on which the related person was born.). This is the underlying object with id, value and extensions. The accessor "getBirthDate" gives direct access to the value
740     */
741    public DateType getBirthDateElement() { 
742      if (this.birthDate == null)
743        if (Configuration.errorOnAutoCreate())
744          throw new Error("Attempt to auto-create RelatedPerson.birthDate");
745        else if (Configuration.doAutoCreate())
746          this.birthDate = new DateType(); // bb
747      return this.birthDate;
748    }
749
750    public boolean hasBirthDateElement() { 
751      return this.birthDate != null && !this.birthDate.isEmpty();
752    }
753
754    public boolean hasBirthDate() { 
755      return this.birthDate != null && !this.birthDate.isEmpty();
756    }
757
758    /**
759     * @param value {@link #birthDate} (The date on which the related person was born.). This is the underlying object with id, value and extensions. The accessor "getBirthDate" gives direct access to the value
760     */
761    public RelatedPerson setBirthDateElement(DateType value) { 
762      this.birthDate = value;
763      return this;
764    }
765
766    /**
767     * @return The date on which the related person was born.
768     */
769    public Date getBirthDate() { 
770      return this.birthDate == null ? null : this.birthDate.getValue();
771    }
772
773    /**
774     * @param value The date on which the related person was born.
775     */
776    public RelatedPerson setBirthDate(Date value) { 
777      if (value == null)
778        this.birthDate = null;
779      else {
780        if (this.birthDate == null)
781          this.birthDate = new DateType();
782        this.birthDate.setValue(value);
783      }
784      return this;
785    }
786
787    /**
788     * @return {@link #address} (Address where the related person can be contacted or visited.)
789     */
790    public List<Address> getAddress() { 
791      if (this.address == null)
792        this.address = new ArrayList<Address>();
793      return this.address;
794    }
795
796    /**
797     * @return Returns a reference to <code>this</code> for easy method chaining
798     */
799    public RelatedPerson setAddress(List<Address> theAddress) { 
800      this.address = theAddress;
801      return this;
802    }
803
804    public boolean hasAddress() { 
805      if (this.address == null)
806        return false;
807      for (Address item : this.address)
808        if (!item.isEmpty())
809          return true;
810      return false;
811    }
812
813    public Address addAddress() { //3
814      Address t = new Address();
815      if (this.address == null)
816        this.address = new ArrayList<Address>();
817      this.address.add(t);
818      return t;
819    }
820
821    public RelatedPerson addAddress(Address t) { //3
822      if (t == null)
823        return this;
824      if (this.address == null)
825        this.address = new ArrayList<Address>();
826      this.address.add(t);
827      return this;
828    }
829
830    /**
831     * @return The first repetition of repeating field {@link #address}, creating it if it does not already exist
832     */
833    public Address getAddressFirstRep() { 
834      if (getAddress().isEmpty()) {
835        addAddress();
836      }
837      return getAddress().get(0);
838    }
839
840    /**
841     * @return {@link #photo} (Image of the person.)
842     */
843    public List<Attachment> getPhoto() { 
844      if (this.photo == null)
845        this.photo = new ArrayList<Attachment>();
846      return this.photo;
847    }
848
849    /**
850     * @return Returns a reference to <code>this</code> for easy method chaining
851     */
852    public RelatedPerson setPhoto(List<Attachment> thePhoto) { 
853      this.photo = thePhoto;
854      return this;
855    }
856
857    public boolean hasPhoto() { 
858      if (this.photo == null)
859        return false;
860      for (Attachment item : this.photo)
861        if (!item.isEmpty())
862          return true;
863      return false;
864    }
865
866    public Attachment addPhoto() { //3
867      Attachment t = new Attachment();
868      if (this.photo == null)
869        this.photo = new ArrayList<Attachment>();
870      this.photo.add(t);
871      return t;
872    }
873
874    public RelatedPerson addPhoto(Attachment t) { //3
875      if (t == null)
876        return this;
877      if (this.photo == null)
878        this.photo = new ArrayList<Attachment>();
879      this.photo.add(t);
880      return this;
881    }
882
883    /**
884     * @return The first repetition of repeating field {@link #photo}, creating it if it does not already exist
885     */
886    public Attachment getPhotoFirstRep() { 
887      if (getPhoto().isEmpty()) {
888        addPhoto();
889      }
890      return getPhoto().get(0);
891    }
892
893    /**
894     * @return {@link #period} (The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.)
895     */
896    public Period getPeriod() { 
897      if (this.period == null)
898        if (Configuration.errorOnAutoCreate())
899          throw new Error("Attempt to auto-create RelatedPerson.period");
900        else if (Configuration.doAutoCreate())
901          this.period = new Period(); // cc
902      return this.period;
903    }
904
905    public boolean hasPeriod() { 
906      return this.period != null && !this.period.isEmpty();
907    }
908
909    /**
910     * @param value {@link #period} (The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.)
911     */
912    public RelatedPerson setPeriod(Period value) { 
913      this.period = value;
914      return this;
915    }
916
917    /**
918     * @return {@link #communication} (A language which may be used to communicate with about the patient's health.)
919     */
920    public List<RelatedPersonCommunicationComponent> getCommunication() { 
921      if (this.communication == null)
922        this.communication = new ArrayList<RelatedPersonCommunicationComponent>();
923      return this.communication;
924    }
925
926    /**
927     * @return Returns a reference to <code>this</code> for easy method chaining
928     */
929    public RelatedPerson setCommunication(List<RelatedPersonCommunicationComponent> theCommunication) { 
930      this.communication = theCommunication;
931      return this;
932    }
933
934    public boolean hasCommunication() { 
935      if (this.communication == null)
936        return false;
937      for (RelatedPersonCommunicationComponent item : this.communication)
938        if (!item.isEmpty())
939          return true;
940      return false;
941    }
942
943    public RelatedPersonCommunicationComponent addCommunication() { //3
944      RelatedPersonCommunicationComponent t = new RelatedPersonCommunicationComponent();
945      if (this.communication == null)
946        this.communication = new ArrayList<RelatedPersonCommunicationComponent>();
947      this.communication.add(t);
948      return t;
949    }
950
951    public RelatedPerson addCommunication(RelatedPersonCommunicationComponent t) { //3
952      if (t == null)
953        return this;
954      if (this.communication == null)
955        this.communication = new ArrayList<RelatedPersonCommunicationComponent>();
956      this.communication.add(t);
957      return this;
958    }
959
960    /**
961     * @return The first repetition of repeating field {@link #communication}, creating it if it does not already exist
962     */
963    public RelatedPersonCommunicationComponent getCommunicationFirstRep() { 
964      if (getCommunication().isEmpty()) {
965        addCommunication();
966      }
967      return getCommunication().get(0);
968    }
969
970      protected void listChildren(List<Property> children) {
971        super.listChildren(children);
972        children.add(new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier));
973        children.add(new Property("active", "boolean", "Whether this related person record is in active use.", 0, 1, active));
974        children.add(new Property("patient", "Reference(Patient)", "The patient this person is related to.", 0, 1, patient));
975        children.add(new Property("relationship", "CodeableConcept", "The nature of the relationship between a patient and the related person.", 0, java.lang.Integer.MAX_VALUE, relationship));
976        children.add(new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name));
977        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));
978        children.add(new Property("gender", "code", "Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.", 0, 1, gender));
979        children.add(new Property("birthDate", "date", "The date on which the related person was born.", 0, 1, birthDate));
980        children.add(new Property("address", "Address", "Address where the related person can be contacted or visited.", 0, java.lang.Integer.MAX_VALUE, address));
981        children.add(new Property("photo", "Attachment", "Image of the person.", 0, java.lang.Integer.MAX_VALUE, photo));
982        children.add(new Property("period", "Period", "The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.", 0, 1, period));
983        children.add(new Property("communication", "", "A language which may be used to communicate with about the patient's health.", 0, java.lang.Integer.MAX_VALUE, communication));
984      }
985
986      @Override
987      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
988        switch (_hash) {
989        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier);
990        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this related person record is in active use.", 0, 1, active);
991        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient this person is related to.", 0, 1, patient);
992        case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "The nature of the relationship between a patient and the related person.", 0, java.lang.Integer.MAX_VALUE, relationship);
993        case 3373707: /*name*/  return new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name);
994        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);
995        case -1249512767: /*gender*/  return new Property("gender", "code", "Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.", 0, 1, gender);
996        case -1210031859: /*birthDate*/  return new Property("birthDate", "date", "The date on which the related person was born.", 0, 1, birthDate);
997        case -1147692044: /*address*/  return new Property("address", "Address", "Address where the related person can be contacted or visited.", 0, java.lang.Integer.MAX_VALUE, address);
998        case 106642994: /*photo*/  return new Property("photo", "Attachment", "Image of the person.", 0, java.lang.Integer.MAX_VALUE, photo);
999        case -991726143: /*period*/  return new Property("period", "Period", "The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.", 0, 1, period);
1000        case -1035284522: /*communication*/  return new Property("communication", "", "A language which may be used to communicate with about the patient's health.", 0, java.lang.Integer.MAX_VALUE, communication);
1001        default: return super.getNamedProperty(_hash, _name, _checkValid);
1002        }
1003
1004      }
1005
1006      @Override
1007      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1008        switch (hash) {
1009        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1010        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
1011        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1012        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : this.relationship.toArray(new Base[this.relationship.size()]); // CodeableConcept
1013        case 3373707: /*name*/ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // HumanName
1014        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
1015        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // Enumeration<AdministrativeGender>
1016        case -1210031859: /*birthDate*/ return this.birthDate == null ? new Base[0] : new Base[] {this.birthDate}; // DateType
1017        case -1147692044: /*address*/ return this.address == null ? new Base[0] : this.address.toArray(new Base[this.address.size()]); // Address
1018        case 106642994: /*photo*/ return this.photo == null ? new Base[0] : this.photo.toArray(new Base[this.photo.size()]); // Attachment
1019        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1020        case -1035284522: /*communication*/ return this.communication == null ? new Base[0] : this.communication.toArray(new Base[this.communication.size()]); // RelatedPersonCommunicationComponent
1021        default: return super.getProperty(hash, name, checkValid);
1022        }
1023
1024      }
1025
1026      @Override
1027      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1028        switch (hash) {
1029        case -1618432855: // identifier
1030          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1031          return value;
1032        case -1422950650: // active
1033          this.active = castToBoolean(value); // BooleanType
1034          return value;
1035        case -791418107: // patient
1036          this.patient = castToReference(value); // Reference
1037          return value;
1038        case -261851592: // relationship
1039          this.getRelationship().add(castToCodeableConcept(value)); // CodeableConcept
1040          return value;
1041        case 3373707: // name
1042          this.getName().add(castToHumanName(value)); // HumanName
1043          return value;
1044        case -1429363305: // telecom
1045          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
1046          return value;
1047        case -1249512767: // gender
1048          value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
1049          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1050          return value;
1051        case -1210031859: // birthDate
1052          this.birthDate = castToDate(value); // DateType
1053          return value;
1054        case -1147692044: // address
1055          this.getAddress().add(castToAddress(value)); // Address
1056          return value;
1057        case 106642994: // photo
1058          this.getPhoto().add(castToAttachment(value)); // Attachment
1059          return value;
1060        case -991726143: // period
1061          this.period = castToPeriod(value); // Period
1062          return value;
1063        case -1035284522: // communication
1064          this.getCommunication().add((RelatedPersonCommunicationComponent) value); // RelatedPersonCommunicationComponent
1065          return value;
1066        default: return super.setProperty(hash, name, value);
1067        }
1068
1069      }
1070
1071      @Override
1072      public Base setProperty(String name, Base value) throws FHIRException {
1073        if (name.equals("identifier")) {
1074          this.getIdentifier().add(castToIdentifier(value));
1075        } else if (name.equals("active")) {
1076          this.active = castToBoolean(value); // BooleanType
1077        } else if (name.equals("patient")) {
1078          this.patient = castToReference(value); // Reference
1079        } else if (name.equals("relationship")) {
1080          this.getRelationship().add(castToCodeableConcept(value));
1081        } else if (name.equals("name")) {
1082          this.getName().add(castToHumanName(value));
1083        } else if (name.equals("telecom")) {
1084          this.getTelecom().add(castToContactPoint(value));
1085        } else if (name.equals("gender")) {
1086          value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
1087          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1088        } else if (name.equals("birthDate")) {
1089          this.birthDate = castToDate(value); // DateType
1090        } else if (name.equals("address")) {
1091          this.getAddress().add(castToAddress(value));
1092        } else if (name.equals("photo")) {
1093          this.getPhoto().add(castToAttachment(value));
1094        } else if (name.equals("period")) {
1095          this.period = castToPeriod(value); // Period
1096        } else if (name.equals("communication")) {
1097          this.getCommunication().add((RelatedPersonCommunicationComponent) value);
1098        } else
1099          return super.setProperty(name, value);
1100        return value;
1101      }
1102
1103      @Override
1104      public Base makeProperty(int hash, String name) throws FHIRException {
1105        switch (hash) {
1106        case -1618432855:  return addIdentifier(); 
1107        case -1422950650:  return getActiveElement();
1108        case -791418107:  return getPatient();
1109        case -261851592:  return addRelationship(); 
1110        case 3373707:  return addName(); 
1111        case -1429363305:  return addTelecom(); 
1112        case -1249512767:  return getGenderElement();
1113        case -1210031859:  return getBirthDateElement();
1114        case -1147692044:  return addAddress(); 
1115        case 106642994:  return addPhoto(); 
1116        case -991726143:  return getPeriod();
1117        case -1035284522:  return addCommunication(); 
1118        default: return super.makeProperty(hash, name);
1119        }
1120
1121      }
1122
1123      @Override
1124      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1125        switch (hash) {
1126        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1127        case -1422950650: /*active*/ return new String[] {"boolean"};
1128        case -791418107: /*patient*/ return new String[] {"Reference"};
1129        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
1130        case 3373707: /*name*/ return new String[] {"HumanName"};
1131        case -1429363305: /*telecom*/ return new String[] {"ContactPoint"};
1132        case -1249512767: /*gender*/ return new String[] {"code"};
1133        case -1210031859: /*birthDate*/ return new String[] {"date"};
1134        case -1147692044: /*address*/ return new String[] {"Address"};
1135        case 106642994: /*photo*/ return new String[] {"Attachment"};
1136        case -991726143: /*period*/ return new String[] {"Period"};
1137        case -1035284522: /*communication*/ return new String[] {};
1138        default: return super.getTypesForProperty(hash, name);
1139        }
1140
1141      }
1142
1143      @Override
1144      public Base addChild(String name) throws FHIRException {
1145        if (name.equals("identifier")) {
1146          return addIdentifier();
1147        }
1148        else if (name.equals("active")) {
1149          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.active");
1150        }
1151        else if (name.equals("patient")) {
1152          this.patient = new Reference();
1153          return this.patient;
1154        }
1155        else if (name.equals("relationship")) {
1156          return addRelationship();
1157        }
1158        else if (name.equals("name")) {
1159          return addName();
1160        }
1161        else if (name.equals("telecom")) {
1162          return addTelecom();
1163        }
1164        else if (name.equals("gender")) {
1165          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.gender");
1166        }
1167        else if (name.equals("birthDate")) {
1168          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.birthDate");
1169        }
1170        else if (name.equals("address")) {
1171          return addAddress();
1172        }
1173        else if (name.equals("photo")) {
1174          return addPhoto();
1175        }
1176        else if (name.equals("period")) {
1177          this.period = new Period();
1178          return this.period;
1179        }
1180        else if (name.equals("communication")) {
1181          return addCommunication();
1182        }
1183        else
1184          return super.addChild(name);
1185      }
1186
1187  public String fhirType() {
1188    return "RelatedPerson";
1189
1190  }
1191
1192      public RelatedPerson copy() {
1193        RelatedPerson dst = new RelatedPerson();
1194        copyValues(dst);
1195        return dst;
1196      }
1197
1198      public void copyValues(RelatedPerson dst) {
1199        super.copyValues(dst);
1200        if (identifier != null) {
1201          dst.identifier = new ArrayList<Identifier>();
1202          for (Identifier i : identifier)
1203            dst.identifier.add(i.copy());
1204        };
1205        dst.active = active == null ? null : active.copy();
1206        dst.patient = patient == null ? null : patient.copy();
1207        if (relationship != null) {
1208          dst.relationship = new ArrayList<CodeableConcept>();
1209          for (CodeableConcept i : relationship)
1210            dst.relationship.add(i.copy());
1211        };
1212        if (name != null) {
1213          dst.name = new ArrayList<HumanName>();
1214          for (HumanName i : name)
1215            dst.name.add(i.copy());
1216        };
1217        if (telecom != null) {
1218          dst.telecom = new ArrayList<ContactPoint>();
1219          for (ContactPoint i : telecom)
1220            dst.telecom.add(i.copy());
1221        };
1222        dst.gender = gender == null ? null : gender.copy();
1223        dst.birthDate = birthDate == null ? null : birthDate.copy();
1224        if (address != null) {
1225          dst.address = new ArrayList<Address>();
1226          for (Address i : address)
1227            dst.address.add(i.copy());
1228        };
1229        if (photo != null) {
1230          dst.photo = new ArrayList<Attachment>();
1231          for (Attachment i : photo)
1232            dst.photo.add(i.copy());
1233        };
1234        dst.period = period == null ? null : period.copy();
1235        if (communication != null) {
1236          dst.communication = new ArrayList<RelatedPersonCommunicationComponent>();
1237          for (RelatedPersonCommunicationComponent i : communication)
1238            dst.communication.add(i.copy());
1239        };
1240      }
1241
1242      protected RelatedPerson typedCopy() {
1243        return copy();
1244      }
1245
1246      @Override
1247      public boolean equalsDeep(Base other_) {
1248        if (!super.equalsDeep(other_))
1249          return false;
1250        if (!(other_ instanceof RelatedPerson))
1251          return false;
1252        RelatedPerson o = (RelatedPerson) other_;
1253        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(patient, o.patient, true)
1254           && compareDeep(relationship, o.relationship, true) && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true)
1255           && compareDeep(gender, o.gender, true) && compareDeep(birthDate, o.birthDate, true) && compareDeep(address, o.address, true)
1256           && compareDeep(photo, o.photo, true) && compareDeep(period, o.period, true) && compareDeep(communication, o.communication, true)
1257          ;
1258      }
1259
1260      @Override
1261      public boolean equalsShallow(Base other_) {
1262        if (!super.equalsShallow(other_))
1263          return false;
1264        if (!(other_ instanceof RelatedPerson))
1265          return false;
1266        RelatedPerson o = (RelatedPerson) other_;
1267        return compareValues(active, o.active, true) && compareValues(gender, o.gender, true) && compareValues(birthDate, o.birthDate, true)
1268          ;
1269      }
1270
1271      public boolean isEmpty() {
1272        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, patient
1273          , relationship, name, telecom, gender, birthDate, address, photo, period, communication
1274          );
1275      }
1276
1277  @Override
1278  public ResourceType getResourceType() {
1279    return ResourceType.RelatedPerson;
1280   }
1281
1282 /**
1283   * Search parameter: <b>identifier</b>
1284   * <p>
1285   * Description: <b>An Identifier of the RelatedPerson</b><br>
1286   * Type: <b>token</b><br>
1287   * Path: <b>RelatedPerson.identifier</b><br>
1288   * </p>
1289   */
1290  @SearchParamDefinition(name="identifier", path="RelatedPerson.identifier", description="An Identifier of the RelatedPerson", type="token" )
1291  public static final String SP_IDENTIFIER = "identifier";
1292 /**
1293   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1294   * <p>
1295   * Description: <b>An Identifier of the RelatedPerson</b><br>
1296   * Type: <b>token</b><br>
1297   * Path: <b>RelatedPerson.identifier</b><br>
1298   * </p>
1299   */
1300  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1301
1302 /**
1303   * Search parameter: <b>address</b>
1304   * <p>
1305   * Description: <b>A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text</b><br>
1306   * Type: <b>string</b><br>
1307   * Path: <b>RelatedPerson.address</b><br>
1308   * </p>
1309   */
1310  @SearchParamDefinition(name="address", path="RelatedPerson.address", description="A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text", type="string" )
1311  public static final String SP_ADDRESS = "address";
1312 /**
1313   * <b>Fluent Client</b> search parameter constant for <b>address</b>
1314   * <p>
1315   * Description: <b>A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text</b><br>
1316   * Type: <b>string</b><br>
1317   * Path: <b>RelatedPerson.address</b><br>
1318   * </p>
1319   */
1320  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
1321
1322 /**
1323   * Search parameter: <b>birthdate</b>
1324   * <p>
1325   * Description: <b>The Related Person's date of birth</b><br>
1326   * Type: <b>date</b><br>
1327   * Path: <b>RelatedPerson.birthDate</b><br>
1328   * </p>
1329   */
1330  @SearchParamDefinition(name="birthdate", path="RelatedPerson.birthDate", description="The Related Person's date of birth", type="date" )
1331  public static final String SP_BIRTHDATE = "birthdate";
1332 /**
1333   * <b>Fluent Client</b> search parameter constant for <b>birthdate</b>
1334   * <p>
1335   * Description: <b>The Related Person's date of birth</b><br>
1336   * Type: <b>date</b><br>
1337   * Path: <b>RelatedPerson.birthDate</b><br>
1338   * </p>
1339   */
1340  public static final ca.uhn.fhir.rest.gclient.DateClientParam BIRTHDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_BIRTHDATE);
1341
1342 /**
1343   * Search parameter: <b>address-state</b>
1344   * <p>
1345   * Description: <b>A state specified in an address</b><br>
1346   * Type: <b>string</b><br>
1347   * Path: <b>RelatedPerson.address.state</b><br>
1348   * </p>
1349   */
1350  @SearchParamDefinition(name="address-state", path="RelatedPerson.address.state", description="A state specified in an address", type="string" )
1351  public static final String SP_ADDRESS_STATE = "address-state";
1352 /**
1353   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
1354   * <p>
1355   * Description: <b>A state specified in an address</b><br>
1356   * Type: <b>string</b><br>
1357   * Path: <b>RelatedPerson.address.state</b><br>
1358   * </p>
1359   */
1360  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
1361
1362 /**
1363   * Search parameter: <b>gender</b>
1364   * <p>
1365   * Description: <b>Gender of the related person</b><br>
1366   * Type: <b>token</b><br>
1367   * Path: <b>RelatedPerson.gender</b><br>
1368   * </p>
1369   */
1370  @SearchParamDefinition(name="gender", path="RelatedPerson.gender", description="Gender of the related person", type="token" )
1371  public static final String SP_GENDER = "gender";
1372 /**
1373   * <b>Fluent Client</b> search parameter constant for <b>gender</b>
1374   * <p>
1375   * Description: <b>Gender of the related person</b><br>
1376   * Type: <b>token</b><br>
1377   * Path: <b>RelatedPerson.gender</b><br>
1378   * </p>
1379   */
1380  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GENDER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GENDER);
1381
1382 /**
1383   * Search parameter: <b>active</b>
1384   * <p>
1385   * Description: <b>Indicates if the related person record is active</b><br>
1386   * Type: <b>token</b><br>
1387   * Path: <b>RelatedPerson.active</b><br>
1388   * </p>
1389   */
1390  @SearchParamDefinition(name="active", path="RelatedPerson.active", description="Indicates if the related person record is active", type="token" )
1391  public static final String SP_ACTIVE = "active";
1392 /**
1393   * <b>Fluent Client</b> search parameter constant for <b>active</b>
1394   * <p>
1395   * Description: <b>Indicates if the related person record is active</b><br>
1396   * Type: <b>token</b><br>
1397   * Path: <b>RelatedPerson.active</b><br>
1398   * </p>
1399   */
1400  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
1401
1402 /**
1403   * Search parameter: <b>address-postalcode</b>
1404   * <p>
1405   * Description: <b>A postal code specified in an address</b><br>
1406   * Type: <b>string</b><br>
1407   * Path: <b>RelatedPerson.address.postalCode</b><br>
1408   * </p>
1409   */
1410  @SearchParamDefinition(name="address-postalcode", path="RelatedPerson.address.postalCode", description="A postal code specified in an address", type="string" )
1411  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
1412 /**
1413   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
1414   * <p>
1415   * Description: <b>A postal code specified in an address</b><br>
1416   * Type: <b>string</b><br>
1417   * Path: <b>RelatedPerson.address.postalCode</b><br>
1418   * </p>
1419   */
1420  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
1421
1422 /**
1423   * Search parameter: <b>address-country</b>
1424   * <p>
1425   * Description: <b>A country specified in an address</b><br>
1426   * Type: <b>string</b><br>
1427   * Path: <b>RelatedPerson.address.country</b><br>
1428   * </p>
1429   */
1430  @SearchParamDefinition(name="address-country", path="RelatedPerson.address.country", description="A country specified in an address", type="string" )
1431  public static final String SP_ADDRESS_COUNTRY = "address-country";
1432 /**
1433   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
1434   * <p>
1435   * Description: <b>A country specified in an address</b><br>
1436   * Type: <b>string</b><br>
1437   * Path: <b>RelatedPerson.address.country</b><br>
1438   * </p>
1439   */
1440  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
1441
1442 /**
1443   * Search parameter: <b>phonetic</b>
1444   * <p>
1445   * Description: <b>A portion of name using some kind of phonetic matching algorithm</b><br>
1446   * Type: <b>string</b><br>
1447   * Path: <b>RelatedPerson.name</b><br>
1448   * </p>
1449   */
1450  @SearchParamDefinition(name="phonetic", path="RelatedPerson.name", description="A portion of name using some kind of phonetic matching algorithm", type="string" )
1451  public static final String SP_PHONETIC = "phonetic";
1452 /**
1453   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
1454   * <p>
1455   * Description: <b>A portion of name using some kind of phonetic matching algorithm</b><br>
1456   * Type: <b>string</b><br>
1457   * Path: <b>RelatedPerson.name</b><br>
1458   * </p>
1459   */
1460  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PHONETIC);
1461
1462 /**
1463   * Search parameter: <b>phone</b>
1464   * <p>
1465   * Description: <b>A value in a phone contact</b><br>
1466   * Type: <b>token</b><br>
1467   * Path: <b>RelatedPerson.telecom(system=phone)</b><br>
1468   * </p>
1469   */
1470  @SearchParamDefinition(name="phone", path="RelatedPerson.telecom.where(system='phone')", description="A value in a phone contact", type="token" )
1471  public static final String SP_PHONE = "phone";
1472 /**
1473   * <b>Fluent Client</b> search parameter constant for <b>phone</b>
1474   * <p>
1475   * Description: <b>A value in a phone contact</b><br>
1476   * Type: <b>token</b><br>
1477   * Path: <b>RelatedPerson.telecom(system=phone)</b><br>
1478   * </p>
1479   */
1480  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PHONE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PHONE);
1481
1482 /**
1483   * Search parameter: <b>patient</b>
1484   * <p>
1485   * Description: <b>The patient this related person is related to</b><br>
1486   * Type: <b>reference</b><br>
1487   * Path: <b>RelatedPerson.patient</b><br>
1488   * </p>
1489   */
1490  @SearchParamDefinition(name="patient", path="RelatedPerson.patient", description="The patient this related person is related to", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1491  public static final String SP_PATIENT = "patient";
1492 /**
1493   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1494   * <p>
1495   * Description: <b>The patient this related person is related to</b><br>
1496   * Type: <b>reference</b><br>
1497   * Path: <b>RelatedPerson.patient</b><br>
1498   * </p>
1499   */
1500  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1501
1502/**
1503   * Constant for fluent queries to be used to add include statements. Specifies
1504   * the path value of "<b>RelatedPerson:patient</b>".
1505   */
1506  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("RelatedPerson:patient").toLocked();
1507
1508 /**
1509   * Search parameter: <b>name</b>
1510   * <p>
1511   * Description: <b>A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text</b><br>
1512   * Type: <b>string</b><br>
1513   * Path: <b>RelatedPerson.name</b><br>
1514   * </p>
1515   */
1516  @SearchParamDefinition(name="name", path="RelatedPerson.name", description="A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text", type="string" )
1517  public static final String SP_NAME = "name";
1518 /**
1519   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1520   * <p>
1521   * Description: <b>A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text</b><br>
1522   * Type: <b>string</b><br>
1523   * Path: <b>RelatedPerson.name</b><br>
1524   * </p>
1525   */
1526  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
1527
1528 /**
1529   * Search parameter: <b>address-use</b>
1530   * <p>
1531   * Description: <b>A use code specified in an address</b><br>
1532   * Type: <b>token</b><br>
1533   * Path: <b>RelatedPerson.address.use</b><br>
1534   * </p>
1535   */
1536  @SearchParamDefinition(name="address-use", path="RelatedPerson.address.use", description="A use code specified in an address", type="token" )
1537  public static final String SP_ADDRESS_USE = "address-use";
1538 /**
1539   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
1540   * <p>
1541   * Description: <b>A use code specified in an address</b><br>
1542   * Type: <b>token</b><br>
1543   * Path: <b>RelatedPerson.address.use</b><br>
1544   * </p>
1545   */
1546  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
1547
1548 /**
1549   * Search parameter: <b>telecom</b>
1550   * <p>
1551   * Description: <b>The value in any kind of contact</b><br>
1552   * Type: <b>token</b><br>
1553   * Path: <b>RelatedPerson.telecom</b><br>
1554   * </p>
1555   */
1556  @SearchParamDefinition(name="telecom", path="RelatedPerson.telecom", description="The value in any kind of contact", type="token" )
1557  public static final String SP_TELECOM = "telecom";
1558 /**
1559   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
1560   * <p>
1561   * Description: <b>The value in any kind of contact</b><br>
1562   * Type: <b>token</b><br>
1563   * Path: <b>RelatedPerson.telecom</b><br>
1564   * </p>
1565   */
1566  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TELECOM);
1567
1568 /**
1569   * Search parameter: <b>address-city</b>
1570   * <p>
1571   * Description: <b>A city specified in an address</b><br>
1572   * Type: <b>string</b><br>
1573   * Path: <b>RelatedPerson.address.city</b><br>
1574   * </p>
1575   */
1576  @SearchParamDefinition(name="address-city", path="RelatedPerson.address.city", description="A city specified in an address", type="string" )
1577  public static final String SP_ADDRESS_CITY = "address-city";
1578 /**
1579   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
1580   * <p>
1581   * Description: <b>A city specified in an address</b><br>
1582   * Type: <b>string</b><br>
1583   * Path: <b>RelatedPerson.address.city</b><br>
1584   * </p>
1585   */
1586  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
1587
1588 /**
1589   * Search parameter: <b>relationship</b>
1590   * <p>
1591   * Description: <b>The relationship between the patient and the relatedperson</b><br>
1592   * Type: <b>token</b><br>
1593   * Path: <b>RelatedPerson.relationship</b><br>
1594   * </p>
1595   */
1596  @SearchParamDefinition(name="relationship", path="RelatedPerson.relationship", description="The relationship between the patient and the relatedperson", type="token" )
1597  public static final String SP_RELATIONSHIP = "relationship";
1598 /**
1599   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
1600   * <p>
1601   * Description: <b>The relationship between the patient and the relatedperson</b><br>
1602   * Type: <b>token</b><br>
1603   * Path: <b>RelatedPerson.relationship</b><br>
1604   * </p>
1605   */
1606  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATIONSHIP = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATIONSHIP);
1607
1608 /**
1609   * Search parameter: <b>email</b>
1610   * <p>
1611   * Description: <b>A value in an email contact</b><br>
1612   * Type: <b>token</b><br>
1613   * Path: <b>RelatedPerson.telecom(system=email)</b><br>
1614   * </p>
1615   */
1616  @SearchParamDefinition(name="email", path="RelatedPerson.telecom.where(system='email')", description="A value in an email contact", type="token" )
1617  public static final String SP_EMAIL = "email";
1618 /**
1619   * <b>Fluent Client</b> search parameter constant for <b>email</b>
1620   * <p>
1621   * Description: <b>A value in an email contact</b><br>
1622   * Type: <b>token</b><br>
1623   * Path: <b>RelatedPerson.telecom(system=email)</b><br>
1624   * </p>
1625   */
1626  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMAIL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EMAIL);
1627
1628
1629}
1630