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