001package org.hl7.fhir.dstu2.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
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/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057
058import org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender;
059import org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory;
060import ca.uhn.fhir.model.api.annotation.Child;
061import ca.uhn.fhir.model.api.annotation.Description;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.exceptions.FHIRException;
065/**
066 * 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.
067 */
068@ResourceDef(name="RelatedPerson", profile="http://hl7.org/fhir/Profile/RelatedPerson")
069public class RelatedPerson extends DomainResource {
070
071    /**
072     * Identifier for a person within a particular scope.
073     */
074    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
075    @Description(shortDefinition="A human identifier for this person", formalDefinition="Identifier for a person within a particular scope." )
076    protected List<Identifier> identifier;
077
078    /**
079     * The patient this person is related to.
080     */
081    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
082    @Description(shortDefinition="The patient this person is related to", formalDefinition="The patient this person is related to." )
083    protected Reference patient;
084
085    /**
086     * The actual object that is the target of the reference (The patient this person is related to.)
087     */
088    protected Patient patientTarget;
089
090    /**
091     * The nature of the relationship between a patient and the related person.
092     */
093    @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
094    @Description(shortDefinition="The nature of the relationship", formalDefinition="The nature of the relationship between a patient and the related person." )
095    protected CodeableConcept relationship;
096
097    /**
098     * A name associated with the person.
099     */
100    @Child(name = "name", type = {HumanName.class}, order=3, min=0, max=1, modifier=false, summary=true)
101    @Description(shortDefinition="A name associated with the person", formalDefinition="A name associated with the person." )
102    protected HumanName name;
103
104    /**
105     * A contact detail for the person, e.g. a telephone number or an email address.
106     */
107    @Child(name = "telecom", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
108    @Description(shortDefinition="A contact detail for the person", formalDefinition="A contact detail for the person, e.g. a telephone number or an email address." )
109    protected List<ContactPoint> telecom;
110
111    /**
112     * Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
113     */
114    @Child(name = "gender", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
115    @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes." )
116    protected Enumeration<AdministrativeGender> gender;
117
118    /**
119     * The date on which the related person was born.
120     */
121    @Child(name = "birthDate", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=true)
122    @Description(shortDefinition="The date on which the related person was born", formalDefinition="The date on which the related person was born." )
123    protected DateType birthDate;
124
125    /**
126     * Address where the related person can be contacted or visited.
127     */
128    @Child(name = "address", type = {Address.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
129    @Description(shortDefinition="Address where the related person can be contacted or visited", formalDefinition="Address where the related person can be contacted or visited." )
130    protected List<Address> address;
131
132    /**
133     * Image of the person.
134     */
135    @Child(name = "photo", type = {Attachment.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
136    @Description(shortDefinition="Image of the person", formalDefinition="Image of the person." )
137    protected List<Attachment> photo;
138
139    /**
140     * The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.
141     */
142    @Child(name = "period", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=false)
143    @Description(shortDefinition="Period of time that this relationship is considered valid", formalDefinition="The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown." )
144    protected Period period;
145
146    private static final long serialVersionUID = 7777543L;
147
148  /*
149   * Constructor
150   */
151    public RelatedPerson() {
152      super();
153    }
154
155  /*
156   * Constructor
157   */
158    public RelatedPerson(Reference patient) {
159      super();
160      this.patient = patient;
161    }
162
163    /**
164     * @return {@link #identifier} (Identifier for a person within a particular scope.)
165     */
166    public List<Identifier> getIdentifier() { 
167      if (this.identifier == null)
168        this.identifier = new ArrayList<Identifier>();
169      return this.identifier;
170    }
171
172    public boolean hasIdentifier() { 
173      if (this.identifier == null)
174        return false;
175      for (Identifier item : this.identifier)
176        if (!item.isEmpty())
177          return true;
178      return false;
179    }
180
181    /**
182     * @return {@link #identifier} (Identifier for a person within a particular scope.)
183     */
184    // syntactic sugar
185    public Identifier addIdentifier() { //3
186      Identifier t = new Identifier();
187      if (this.identifier == null)
188        this.identifier = new ArrayList<Identifier>();
189      this.identifier.add(t);
190      return t;
191    }
192
193    // syntactic sugar
194    public RelatedPerson addIdentifier(Identifier t) { //3
195      if (t == null)
196        return this;
197      if (this.identifier == null)
198        this.identifier = new ArrayList<Identifier>();
199      this.identifier.add(t);
200      return this;
201    }
202
203    /**
204     * @return {@link #patient} (The patient this person is related to.)
205     */
206    public Reference getPatient() { 
207      if (this.patient == null)
208        if (Configuration.errorOnAutoCreate())
209          throw new Error("Attempt to auto-create RelatedPerson.patient");
210        else if (Configuration.doAutoCreate())
211          this.patient = new Reference(); // cc
212      return this.patient;
213    }
214
215    public boolean hasPatient() { 
216      return this.patient != null && !this.patient.isEmpty();
217    }
218
219    /**
220     * @param value {@link #patient} (The patient this person is related to.)
221     */
222    public RelatedPerson setPatient(Reference value) { 
223      this.patient = value;
224      return this;
225    }
226
227    /**
228     * @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.)
229     */
230    public Patient getPatientTarget() { 
231      if (this.patientTarget == null)
232        if (Configuration.errorOnAutoCreate())
233          throw new Error("Attempt to auto-create RelatedPerson.patient");
234        else if (Configuration.doAutoCreate())
235          this.patientTarget = new Patient(); // aa
236      return this.patientTarget;
237    }
238
239    /**
240     * @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.)
241     */
242    public RelatedPerson setPatientTarget(Patient value) { 
243      this.patientTarget = value;
244      return this;
245    }
246
247    /**
248     * @return {@link #relationship} (The nature of the relationship between a patient and the related person.)
249     */
250    public CodeableConcept getRelationship() { 
251      if (this.relationship == null)
252        if (Configuration.errorOnAutoCreate())
253          throw new Error("Attempt to auto-create RelatedPerson.relationship");
254        else if (Configuration.doAutoCreate())
255          this.relationship = new CodeableConcept(); // cc
256      return this.relationship;
257    }
258
259    public boolean hasRelationship() { 
260      return this.relationship != null && !this.relationship.isEmpty();
261    }
262
263    /**
264     * @param value {@link #relationship} (The nature of the relationship between a patient and the related person.)
265     */
266    public RelatedPerson setRelationship(CodeableConcept value) { 
267      this.relationship = value;
268      return this;
269    }
270
271    /**
272     * @return {@link #name} (A name associated with the person.)
273     */
274    public HumanName getName() { 
275      if (this.name == null)
276        if (Configuration.errorOnAutoCreate())
277          throw new Error("Attempt to auto-create RelatedPerson.name");
278        else if (Configuration.doAutoCreate())
279          this.name = new HumanName(); // cc
280      return this.name;
281    }
282
283    public boolean hasName() { 
284      return this.name != null && !this.name.isEmpty();
285    }
286
287    /**
288     * @param value {@link #name} (A name associated with the person.)
289     */
290    public RelatedPerson setName(HumanName value) { 
291      this.name = value;
292      return this;
293    }
294
295    /**
296     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.)
297     */
298    public List<ContactPoint> getTelecom() { 
299      if (this.telecom == null)
300        this.telecom = new ArrayList<ContactPoint>();
301      return this.telecom;
302    }
303
304    public boolean hasTelecom() { 
305      if (this.telecom == null)
306        return false;
307      for (ContactPoint item : this.telecom)
308        if (!item.isEmpty())
309          return true;
310      return false;
311    }
312
313    /**
314     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.)
315     */
316    // syntactic sugar
317    public ContactPoint addTelecom() { //3
318      ContactPoint t = new ContactPoint();
319      if (this.telecom == null)
320        this.telecom = new ArrayList<ContactPoint>();
321      this.telecom.add(t);
322      return t;
323    }
324
325    // syntactic sugar
326    public RelatedPerson addTelecom(ContactPoint t) { //3
327      if (t == null)
328        return this;
329      if (this.telecom == null)
330        this.telecom = new ArrayList<ContactPoint>();
331      this.telecom.add(t);
332      return this;
333    }
334
335    /**
336     * @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
337     */
338    public Enumeration<AdministrativeGender> getGenderElement() { 
339      if (this.gender == null)
340        if (Configuration.errorOnAutoCreate())
341          throw new Error("Attempt to auto-create RelatedPerson.gender");
342        else if (Configuration.doAutoCreate())
343          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
344      return this.gender;
345    }
346
347    public boolean hasGenderElement() { 
348      return this.gender != null && !this.gender.isEmpty();
349    }
350
351    public boolean hasGender() { 
352      return this.gender != null && !this.gender.isEmpty();
353    }
354
355    /**
356     * @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
357     */
358    public RelatedPerson setGenderElement(Enumeration<AdministrativeGender> value) { 
359      this.gender = value;
360      return this;
361    }
362
363    /**
364     * @return Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
365     */
366    public AdministrativeGender getGender() { 
367      return this.gender == null ? null : this.gender.getValue();
368    }
369
370    /**
371     * @param value Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
372     */
373    public RelatedPerson setGender(AdministrativeGender value) { 
374      if (value == null)
375        this.gender = null;
376      else {
377        if (this.gender == null)
378          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
379        this.gender.setValue(value);
380      }
381      return this;
382    }
383
384    /**
385     * @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
386     */
387    public DateType getBirthDateElement() { 
388      if (this.birthDate == null)
389        if (Configuration.errorOnAutoCreate())
390          throw new Error("Attempt to auto-create RelatedPerson.birthDate");
391        else if (Configuration.doAutoCreate())
392          this.birthDate = new DateType(); // bb
393      return this.birthDate;
394    }
395
396    public boolean hasBirthDateElement() { 
397      return this.birthDate != null && !this.birthDate.isEmpty();
398    }
399
400    public boolean hasBirthDate() { 
401      return this.birthDate != null && !this.birthDate.isEmpty();
402    }
403
404    /**
405     * @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
406     */
407    public RelatedPerson setBirthDateElement(DateType value) { 
408      this.birthDate = value;
409      return this;
410    }
411
412    /**
413     * @return The date on which the related person was born.
414     */
415    public Date getBirthDate() { 
416      return this.birthDate == null ? null : this.birthDate.getValue();
417    }
418
419    /**
420     * @param value The date on which the related person was born.
421     */
422    public RelatedPerson setBirthDate(Date value) { 
423      if (value == null)
424        this.birthDate = null;
425      else {
426        if (this.birthDate == null)
427          this.birthDate = new DateType();
428        this.birthDate.setValue(value);
429      }
430      return this;
431    }
432
433    /**
434     * @return {@link #address} (Address where the related person can be contacted or visited.)
435     */
436    public List<Address> getAddress() { 
437      if (this.address == null)
438        this.address = new ArrayList<Address>();
439      return this.address;
440    }
441
442    public boolean hasAddress() { 
443      if (this.address == null)
444        return false;
445      for (Address item : this.address)
446        if (!item.isEmpty())
447          return true;
448      return false;
449    }
450
451    /**
452     * @return {@link #address} (Address where the related person can be contacted or visited.)
453     */
454    // syntactic sugar
455    public Address addAddress() { //3
456      Address t = new Address();
457      if (this.address == null)
458        this.address = new ArrayList<Address>();
459      this.address.add(t);
460      return t;
461    }
462
463    // syntactic sugar
464    public RelatedPerson addAddress(Address t) { //3
465      if (t == null)
466        return this;
467      if (this.address == null)
468        this.address = new ArrayList<Address>();
469      this.address.add(t);
470      return this;
471    }
472
473    /**
474     * @return {@link #photo} (Image of the person.)
475     */
476    public List<Attachment> getPhoto() { 
477      if (this.photo == null)
478        this.photo = new ArrayList<Attachment>();
479      return this.photo;
480    }
481
482    public boolean hasPhoto() { 
483      if (this.photo == null)
484        return false;
485      for (Attachment item : this.photo)
486        if (!item.isEmpty())
487          return true;
488      return false;
489    }
490
491    /**
492     * @return {@link #photo} (Image of the person.)
493     */
494    // syntactic sugar
495    public Attachment addPhoto() { //3
496      Attachment t = new Attachment();
497      if (this.photo == null)
498        this.photo = new ArrayList<Attachment>();
499      this.photo.add(t);
500      return t;
501    }
502
503    // syntactic sugar
504    public RelatedPerson addPhoto(Attachment t) { //3
505      if (t == null)
506        return this;
507      if (this.photo == null)
508        this.photo = new ArrayList<Attachment>();
509      this.photo.add(t);
510      return this;
511    }
512
513    /**
514     * @return {@link #period} (The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.)
515     */
516    public Period getPeriod() { 
517      if (this.period == null)
518        if (Configuration.errorOnAutoCreate())
519          throw new Error("Attempt to auto-create RelatedPerson.period");
520        else if (Configuration.doAutoCreate())
521          this.period = new Period(); // cc
522      return this.period;
523    }
524
525    public boolean hasPeriod() { 
526      return this.period != null && !this.period.isEmpty();
527    }
528
529    /**
530     * @param value {@link #period} (The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.)
531     */
532    public RelatedPerson setPeriod(Period value) { 
533      this.period = value;
534      return this;
535    }
536
537      protected void listChildren(List<Property> childrenList) {
538        super.listChildren(childrenList);
539        childrenList.add(new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier));
540        childrenList.add(new Property("patient", "Reference(Patient)", "The patient this person is related to.", 0, java.lang.Integer.MAX_VALUE, patient));
541        childrenList.add(new Property("relationship", "CodeableConcept", "The nature of the relationship between a patient and the related person.", 0, java.lang.Integer.MAX_VALUE, relationship));
542        childrenList.add(new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name));
543        childrenList.add(new Property("telecom", "ContactPoint", "A contact detail for the person, e.g. a telephone number or an email address.", 0, java.lang.Integer.MAX_VALUE, telecom));
544        childrenList.add(new Property("gender", "code", "Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.", 0, java.lang.Integer.MAX_VALUE, gender));
545        childrenList.add(new Property("birthDate", "date", "The date on which the related person was born.", 0, java.lang.Integer.MAX_VALUE, birthDate));
546        childrenList.add(new Property("address", "Address", "Address where the related person can be contacted or visited.", 0, java.lang.Integer.MAX_VALUE, address));
547        childrenList.add(new Property("photo", "Attachment", "Image of the person.", 0, java.lang.Integer.MAX_VALUE, photo));
548        childrenList.add(new Property("period", "Period", "The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.", 0, java.lang.Integer.MAX_VALUE, period));
549      }
550
551      @Override
552      public void setProperty(String name, Base value) throws FHIRException {
553        if (name.equals("identifier"))
554          this.getIdentifier().add(castToIdentifier(value));
555        else if (name.equals("patient"))
556          this.patient = castToReference(value); // Reference
557        else if (name.equals("relationship"))
558          this.relationship = castToCodeableConcept(value); // CodeableConcept
559        else if (name.equals("name"))
560          this.name = castToHumanName(value); // HumanName
561        else if (name.equals("telecom"))
562          this.getTelecom().add(castToContactPoint(value));
563        else if (name.equals("gender"))
564          this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender>
565        else if (name.equals("birthDate"))
566          this.birthDate = castToDate(value); // DateType
567        else if (name.equals("address"))
568          this.getAddress().add(castToAddress(value));
569        else if (name.equals("photo"))
570          this.getPhoto().add(castToAttachment(value));
571        else if (name.equals("period"))
572          this.period = castToPeriod(value); // Period
573        else
574          super.setProperty(name, value);
575      }
576
577      @Override
578      public Base addChild(String name) throws FHIRException {
579        if (name.equals("identifier")) {
580          return addIdentifier();
581        }
582        else if (name.equals("patient")) {
583          this.patient = new Reference();
584          return this.patient;
585        }
586        else if (name.equals("relationship")) {
587          this.relationship = new CodeableConcept();
588          return this.relationship;
589        }
590        else if (name.equals("name")) {
591          this.name = new HumanName();
592          return this.name;
593        }
594        else if (name.equals("telecom")) {
595          return addTelecom();
596        }
597        else if (name.equals("gender")) {
598          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.gender");
599        }
600        else if (name.equals("birthDate")) {
601          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.birthDate");
602        }
603        else if (name.equals("address")) {
604          return addAddress();
605        }
606        else if (name.equals("photo")) {
607          return addPhoto();
608        }
609        else if (name.equals("period")) {
610          this.period = new Period();
611          return this.period;
612        }
613        else
614          return super.addChild(name);
615      }
616
617  public String fhirType() {
618    return "RelatedPerson";
619
620  }
621
622      public RelatedPerson copy() {
623        RelatedPerson dst = new RelatedPerson();
624        copyValues(dst);
625        if (identifier != null) {
626          dst.identifier = new ArrayList<Identifier>();
627          for (Identifier i : identifier)
628            dst.identifier.add(i.copy());
629        };
630        dst.patient = patient == null ? null : patient.copy();
631        dst.relationship = relationship == null ? null : relationship.copy();
632        dst.name = name == null ? null : name.copy();
633        if (telecom != null) {
634          dst.telecom = new ArrayList<ContactPoint>();
635          for (ContactPoint i : telecom)
636            dst.telecom.add(i.copy());
637        };
638        dst.gender = gender == null ? null : gender.copy();
639        dst.birthDate = birthDate == null ? null : birthDate.copy();
640        if (address != null) {
641          dst.address = new ArrayList<Address>();
642          for (Address i : address)
643            dst.address.add(i.copy());
644        };
645        if (photo != null) {
646          dst.photo = new ArrayList<Attachment>();
647          for (Attachment i : photo)
648            dst.photo.add(i.copy());
649        };
650        dst.period = period == null ? null : period.copy();
651        return dst;
652      }
653
654      protected RelatedPerson typedCopy() {
655        return copy();
656      }
657
658      @Override
659      public boolean equalsDeep(Base other) {
660        if (!super.equalsDeep(other))
661          return false;
662        if (!(other instanceof RelatedPerson))
663          return false;
664        RelatedPerson o = (RelatedPerson) other;
665        return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(relationship, o.relationship, true)
666           && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true) && compareDeep(gender, o.gender, true)
667           && compareDeep(birthDate, o.birthDate, true) && compareDeep(address, o.address, true) && compareDeep(photo, o.photo, true)
668           && compareDeep(period, o.period, true);
669      }
670
671      @Override
672      public boolean equalsShallow(Base other) {
673        if (!super.equalsShallow(other))
674          return false;
675        if (!(other instanceof RelatedPerson))
676          return false;
677        RelatedPerson o = (RelatedPerson) other;
678        return compareValues(gender, o.gender, true) && compareValues(birthDate, o.birthDate, true);
679      }
680
681      public boolean isEmpty() {
682        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty())
683           && (relationship == null || relationship.isEmpty()) && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
684           && (gender == null || gender.isEmpty()) && (birthDate == null || birthDate.isEmpty()) && (address == null || address.isEmpty())
685           && (photo == null || photo.isEmpty()) && (period == null || period.isEmpty());
686      }
687
688  @Override
689  public ResourceType getResourceType() {
690    return ResourceType.RelatedPerson;
691   }
692
693  @SearchParamDefinition(name="identifier", path="RelatedPerson.identifier", description="A patient Identifier", type="token" )
694  public static final String SP_IDENTIFIER = "identifier";
695  @SearchParamDefinition(name="address", path="RelatedPerson.address", description="An address in any kind of address/part", type="string" )
696  public static final String SP_ADDRESS = "address";
697  @SearchParamDefinition(name="birthdate", path="RelatedPerson.birthDate", description="The Related Person's date of birth", type="date" )
698  public static final String SP_BIRTHDATE = "birthdate";
699  @SearchParamDefinition(name="address-state", path="RelatedPerson.address.state", description="A state specified in an address", type="string" )
700  public static final String SP_ADDRESSSTATE = "address-state";
701  @SearchParamDefinition(name="gender", path="RelatedPerson.gender", description="Gender of the person", type="token" )
702  public static final String SP_GENDER = "gender";
703  @SearchParamDefinition(name="address-postalcode", path="RelatedPerson.address.postalCode", description="A postal code specified in an address", type="string" )
704  public static final String SP_ADDRESSPOSTALCODE = "address-postalcode";
705  @SearchParamDefinition(name="address-country", path="RelatedPerson.address.country", description="A country specified in an address", type="string" )
706  public static final String SP_ADDRESSCOUNTRY = "address-country";
707  @SearchParamDefinition(name="phonetic", path="RelatedPerson.name", description="A portion of name using some kind of phonetic matching algorithm", type="string" )
708  public static final String SP_PHONETIC = "phonetic";
709  @SearchParamDefinition(name="phone", path="RelatedPerson.telecom.where(system='phone')", description="A value in a phone contact", type="token" )
710  public static final String SP_PHONE = "phone";
711  @SearchParamDefinition(name="patient", path="RelatedPerson.patient", description="The patient this person is related to", type="reference" )
712  public static final String SP_PATIENT = "patient";
713  @SearchParamDefinition(name="name", path="RelatedPerson.name", description="A portion of name in any name part", type="string" )
714  public static final String SP_NAME = "name";
715  @SearchParamDefinition(name="address-use", path="RelatedPerson.address.use", description="A use code specified in an address", type="token" )
716  public static final String SP_ADDRESSUSE = "address-use";
717  @SearchParamDefinition(name="telecom", path="RelatedPerson.telecom", description="The value in any kind of contact", type="token" )
718  public static final String SP_TELECOM = "telecom";
719  @SearchParamDefinition(name="address-city", path="RelatedPerson.address.city", description="A city specified in an address", type="string" )
720  public static final String SP_ADDRESSCITY = "address-city";
721  @SearchParamDefinition(name="email", path="RelatedPerson.telecom.where(system='email')", description="A value in an email contact", type="token" )
722  public static final String SP_EMAIL = "email";
723
724}
725