001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGender;
041import org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGenderEnumFactory;
042import org.hl7.fhir.exceptions.FHIRException;
043
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * 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.
050 */
051@ResourceDef(name="RelatedPerson", profile="http://hl7.org/fhir/Profile/RelatedPerson")
052public class RelatedPerson extends DomainResource {
053
054    /**
055     * Identifier for a person within a particular scope.
056     */
057    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
058    @Description(shortDefinition="A human identifier for this person", formalDefinition="Identifier for a person within a particular scope." )
059    protected List<Identifier> identifier;
060
061    /**
062     * The patient this person is related to.
063     */
064    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
065    @Description(shortDefinition="The patient this person is related to", formalDefinition="The patient this person is related to." )
066    protected Reference patient;
067
068    /**
069     * The actual object that is the target of the reference (The patient this person is related to.)
070     */
071    protected Patient patientTarget;
072
073    /**
074     * The nature of the relationship between a patient and the related person.
075     */
076    @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
077    @Description(shortDefinition="The nature of the relationship", formalDefinition="The nature of the relationship between a patient and the related person." )
078    protected CodeableConcept relationship;
079
080    /**
081     * A name associated with the person.
082     */
083    @Child(name = "name", type = {HumanName.class}, order=3, min=0, max=1, modifier=false, summary=true)
084    @Description(shortDefinition="A name associated with the person", formalDefinition="A name associated with the person." )
085    protected HumanName name;
086
087    /**
088     * A contact detail for the person, e.g. a telephone number or an email address.
089     */
090    @Child(name = "telecom", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
091    @Description(shortDefinition="A contact detail for the person", formalDefinition="A contact detail for the person, e.g. a telephone number or an email address." )
092    protected List<ContactPoint> telecom;
093
094    /**
095     * Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
096     */
097    @Child(name = "gender", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
098    @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes." )
099    protected Enumeration<AdministrativeGender> gender;
100
101    /**
102     * The date on which the related person was born.
103     */
104    @Child(name = "birthDate", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=true)
105    @Description(shortDefinition="The date on which the related person was born", formalDefinition="The date on which the related person was born." )
106    protected DateType birthDate;
107
108    /**
109     * Address where the related person can be contacted or visited.
110     */
111    @Child(name = "address", type = {Address.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
112    @Description(shortDefinition="Address where the related person can be contacted or visited", formalDefinition="Address where the related person can be contacted or visited." )
113    protected List<Address> address;
114
115    /**
116     * Image of the person.
117     */
118    @Child(name = "photo", type = {Attachment.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
119    @Description(shortDefinition="Image of the person", formalDefinition="Image of the person." )
120    protected List<Attachment> photo;
121
122    /**
123     * The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.
124     */
125    @Child(name = "period", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=false)
126    @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." )
127    protected Period period;
128
129    private static final long serialVersionUID = 7777543L;
130
131  /**
132   * Constructor
133   */
134    public RelatedPerson() {
135      super();
136    }
137
138  /**
139   * Constructor
140   */
141    public RelatedPerson(Reference patient) {
142      super();
143      this.patient = patient;
144    }
145
146    /**
147     * @return {@link #identifier} (Identifier for a person within a particular scope.)
148     */
149    public List<Identifier> getIdentifier() { 
150      if (this.identifier == null)
151        this.identifier = new ArrayList<Identifier>();
152      return this.identifier;
153    }
154
155    public boolean hasIdentifier() { 
156      if (this.identifier == null)
157        return false;
158      for (Identifier item : this.identifier)
159        if (!item.isEmpty())
160          return true;
161      return false;
162    }
163
164    /**
165     * @return {@link #identifier} (Identifier for a person within a particular scope.)
166     */
167    // syntactic sugar
168    public Identifier addIdentifier() { //3
169      Identifier t = new Identifier();
170      if (this.identifier == null)
171        this.identifier = new ArrayList<Identifier>();
172      this.identifier.add(t);
173      return t;
174    }
175
176    // syntactic sugar
177    public RelatedPerson addIdentifier(Identifier t) { //3
178      if (t == null)
179        return this;
180      if (this.identifier == null)
181        this.identifier = new ArrayList<Identifier>();
182      this.identifier.add(t);
183      return this;
184    }
185
186    /**
187     * @return {@link #patient} (The patient this person is related to.)
188     */
189    public Reference getPatient() { 
190      if (this.patient == null)
191        if (Configuration.errorOnAutoCreate())
192          throw new Error("Attempt to auto-create RelatedPerson.patient");
193        else if (Configuration.doAutoCreate())
194          this.patient = new Reference(); // cc
195      return this.patient;
196    }
197
198    public boolean hasPatient() { 
199      return this.patient != null && !this.patient.isEmpty();
200    }
201
202    /**
203     * @param value {@link #patient} (The patient this person is related to.)
204     */
205    public RelatedPerson setPatient(Reference value) { 
206      this.patient = value;
207      return this;
208    }
209
210    /**
211     * @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.)
212     */
213    public Patient getPatientTarget() { 
214      if (this.patientTarget == null)
215        if (Configuration.errorOnAutoCreate())
216          throw new Error("Attempt to auto-create RelatedPerson.patient");
217        else if (Configuration.doAutoCreate())
218          this.patientTarget = new Patient(); // aa
219      return this.patientTarget;
220    }
221
222    /**
223     * @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.)
224     */
225    public RelatedPerson setPatientTarget(Patient value) { 
226      this.patientTarget = value;
227      return this;
228    }
229
230    /**
231     * @return {@link #relationship} (The nature of the relationship between a patient and the related person.)
232     */
233    public CodeableConcept getRelationship() { 
234      if (this.relationship == null)
235        if (Configuration.errorOnAutoCreate())
236          throw new Error("Attempt to auto-create RelatedPerson.relationship");
237        else if (Configuration.doAutoCreate())
238          this.relationship = new CodeableConcept(); // cc
239      return this.relationship;
240    }
241
242    public boolean hasRelationship() { 
243      return this.relationship != null && !this.relationship.isEmpty();
244    }
245
246    /**
247     * @param value {@link #relationship} (The nature of the relationship between a patient and the related person.)
248     */
249    public RelatedPerson setRelationship(CodeableConcept value) { 
250      this.relationship = value;
251      return this;
252    }
253
254    /**
255     * @return {@link #name} (A name associated with the person.)
256     */
257    public HumanName getName() { 
258      if (this.name == null)
259        if (Configuration.errorOnAutoCreate())
260          throw new Error("Attempt to auto-create RelatedPerson.name");
261        else if (Configuration.doAutoCreate())
262          this.name = new HumanName(); // cc
263      return this.name;
264    }
265
266    public boolean hasName() { 
267      return this.name != null && !this.name.isEmpty();
268    }
269
270    /**
271     * @param value {@link #name} (A name associated with the person.)
272     */
273    public RelatedPerson setName(HumanName value) { 
274      this.name = value;
275      return this;
276    }
277
278    /**
279     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.)
280     */
281    public List<ContactPoint> getTelecom() { 
282      if (this.telecom == null)
283        this.telecom = new ArrayList<ContactPoint>();
284      return this.telecom;
285    }
286
287    public boolean hasTelecom() { 
288      if (this.telecom == null)
289        return false;
290      for (ContactPoint item : this.telecom)
291        if (!item.isEmpty())
292          return true;
293      return false;
294    }
295
296    /**
297     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.)
298     */
299    // syntactic sugar
300    public ContactPoint addTelecom() { //3
301      ContactPoint t = new ContactPoint();
302      if (this.telecom == null)
303        this.telecom = new ArrayList<ContactPoint>();
304      this.telecom.add(t);
305      return t;
306    }
307
308    // syntactic sugar
309    public RelatedPerson addTelecom(ContactPoint t) { //3
310      if (t == null)
311        return this;
312      if (this.telecom == null)
313        this.telecom = new ArrayList<ContactPoint>();
314      this.telecom.add(t);
315      return this;
316    }
317
318    /**
319     * @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
320     */
321    public Enumeration<AdministrativeGender> getGenderElement() { 
322      if (this.gender == null)
323        if (Configuration.errorOnAutoCreate())
324          throw new Error("Attempt to auto-create RelatedPerson.gender");
325        else if (Configuration.doAutoCreate())
326          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
327      return this.gender;
328    }
329
330    public boolean hasGenderElement() { 
331      return this.gender != null && !this.gender.isEmpty();
332    }
333
334    public boolean hasGender() { 
335      return this.gender != null && !this.gender.isEmpty();
336    }
337
338    /**
339     * @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
340     */
341    public RelatedPerson setGenderElement(Enumeration<AdministrativeGender> value) { 
342      this.gender = value;
343      return this;
344    }
345
346    /**
347     * @return Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
348     */
349    public AdministrativeGender getGender() { 
350      return this.gender == null ? null : this.gender.getValue();
351    }
352
353    /**
354     * @param value Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
355     */
356    public RelatedPerson setGender(AdministrativeGender value) { 
357      if (value == null)
358        this.gender = null;
359      else {
360        if (this.gender == null)
361          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
362        this.gender.setValue(value);
363      }
364      return this;
365    }
366
367    /**
368     * @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
369     */
370    public DateType getBirthDateElement() { 
371      if (this.birthDate == null)
372        if (Configuration.errorOnAutoCreate())
373          throw new Error("Attempt to auto-create RelatedPerson.birthDate");
374        else if (Configuration.doAutoCreate())
375          this.birthDate = new DateType(); // bb
376      return this.birthDate;
377    }
378
379    public boolean hasBirthDateElement() { 
380      return this.birthDate != null && !this.birthDate.isEmpty();
381    }
382
383    public boolean hasBirthDate() { 
384      return this.birthDate != null && !this.birthDate.isEmpty();
385    }
386
387    /**
388     * @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
389     */
390    public RelatedPerson setBirthDateElement(DateType value) { 
391      this.birthDate = value;
392      return this;
393    }
394
395    /**
396     * @return The date on which the related person was born.
397     */
398    public Date getBirthDate() { 
399      return this.birthDate == null ? null : this.birthDate.getValue();
400    }
401
402    /**
403     * @param value The date on which the related person was born.
404     */
405    public RelatedPerson setBirthDate(Date value) { 
406      if (value == null)
407        this.birthDate = null;
408      else {
409        if (this.birthDate == null)
410          this.birthDate = new DateType();
411        this.birthDate.setValue(value);
412      }
413      return this;
414    }
415
416    /**
417     * @return {@link #address} (Address where the related person can be contacted or visited.)
418     */
419    public List<Address> getAddress() { 
420      if (this.address == null)
421        this.address = new ArrayList<Address>();
422      return this.address;
423    }
424
425    public boolean hasAddress() { 
426      if (this.address == null)
427        return false;
428      for (Address item : this.address)
429        if (!item.isEmpty())
430          return true;
431      return false;
432    }
433
434    /**
435     * @return {@link #address} (Address where the related person can be contacted or visited.)
436     */
437    // syntactic sugar
438    public Address addAddress() { //3
439      Address t = new Address();
440      if (this.address == null)
441        this.address = new ArrayList<Address>();
442      this.address.add(t);
443      return t;
444    }
445
446    // syntactic sugar
447    public RelatedPerson addAddress(Address t) { //3
448      if (t == null)
449        return this;
450      if (this.address == null)
451        this.address = new ArrayList<Address>();
452      this.address.add(t);
453      return this;
454    }
455
456    /**
457     * @return {@link #photo} (Image of the person.)
458     */
459    public List<Attachment> getPhoto() { 
460      if (this.photo == null)
461        this.photo = new ArrayList<Attachment>();
462      return this.photo;
463    }
464
465    public boolean hasPhoto() { 
466      if (this.photo == null)
467        return false;
468      for (Attachment item : this.photo)
469        if (!item.isEmpty())
470          return true;
471      return false;
472    }
473
474    /**
475     * @return {@link #photo} (Image of the person.)
476     */
477    // syntactic sugar
478    public Attachment addPhoto() { //3
479      Attachment t = new Attachment();
480      if (this.photo == null)
481        this.photo = new ArrayList<Attachment>();
482      this.photo.add(t);
483      return t;
484    }
485
486    // syntactic sugar
487    public RelatedPerson addPhoto(Attachment t) { //3
488      if (t == null)
489        return this;
490      if (this.photo == null)
491        this.photo = new ArrayList<Attachment>();
492      this.photo.add(t);
493      return this;
494    }
495
496    /**
497     * @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.)
498     */
499    public Period getPeriod() { 
500      if (this.period == null)
501        if (Configuration.errorOnAutoCreate())
502          throw new Error("Attempt to auto-create RelatedPerson.period");
503        else if (Configuration.doAutoCreate())
504          this.period = new Period(); // cc
505      return this.period;
506    }
507
508    public boolean hasPeriod() { 
509      return this.period != null && !this.period.isEmpty();
510    }
511
512    /**
513     * @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.)
514     */
515    public RelatedPerson setPeriod(Period value) { 
516      this.period = value;
517      return this;
518    }
519
520      protected void listChildren(List<Property> childrenList) {
521        super.listChildren(childrenList);
522        childrenList.add(new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier));
523        childrenList.add(new Property("patient", "Reference(Patient)", "The patient this person is related to.", 0, java.lang.Integer.MAX_VALUE, patient));
524        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));
525        childrenList.add(new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name));
526        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));
527        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));
528        childrenList.add(new Property("birthDate", "date", "The date on which the related person was born.", 0, java.lang.Integer.MAX_VALUE, birthDate));
529        childrenList.add(new Property("address", "Address", "Address where the related person can be contacted or visited.", 0, java.lang.Integer.MAX_VALUE, address));
530        childrenList.add(new Property("photo", "Attachment", "Image of the person.", 0, java.lang.Integer.MAX_VALUE, photo));
531        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));
532      }
533
534      @Override
535      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
536        switch (hash) {
537        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
538        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
539        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
540        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // HumanName
541        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
542        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // Enumeration<AdministrativeGender>
543        case -1210031859: /*birthDate*/ return this.birthDate == null ? new Base[0] : new Base[] {this.birthDate}; // DateType
544        case -1147692044: /*address*/ return this.address == null ? new Base[0] : this.address.toArray(new Base[this.address.size()]); // Address
545        case 106642994: /*photo*/ return this.photo == null ? new Base[0] : this.photo.toArray(new Base[this.photo.size()]); // Attachment
546        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
547        default: return super.getProperty(hash, name, checkValid);
548        }
549
550      }
551
552      @Override
553      public void setProperty(int hash, String name, Base value) throws FHIRException {
554        switch (hash) {
555        case -1618432855: // identifier
556          this.getIdentifier().add(castToIdentifier(value)); // Identifier
557          break;
558        case -791418107: // patient
559          this.patient = castToReference(value); // Reference
560          break;
561        case -261851592: // relationship
562          this.relationship = castToCodeableConcept(value); // CodeableConcept
563          break;
564        case 3373707: // name
565          this.name = castToHumanName(value); // HumanName
566          break;
567        case -1429363305: // telecom
568          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
569          break;
570        case -1249512767: // gender
571          this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender>
572          break;
573        case -1210031859: // birthDate
574          this.birthDate = castToDate(value); // DateType
575          break;
576        case -1147692044: // address
577          this.getAddress().add(castToAddress(value)); // Address
578          break;
579        case 106642994: // photo
580          this.getPhoto().add(castToAttachment(value)); // Attachment
581          break;
582        case -991726143: // period
583          this.period = castToPeriod(value); // Period
584          break;
585        default: super.setProperty(hash, name, value);
586        }
587
588      }
589
590      @Override
591      public void setProperty(String name, Base value) throws FHIRException {
592        if (name.equals("identifier"))
593          this.getIdentifier().add(castToIdentifier(value));
594        else if (name.equals("patient"))
595          this.patient = castToReference(value); // Reference
596        else if (name.equals("relationship"))
597          this.relationship = castToCodeableConcept(value); // CodeableConcept
598        else if (name.equals("name"))
599          this.name = castToHumanName(value); // HumanName
600        else if (name.equals("telecom"))
601          this.getTelecom().add(castToContactPoint(value));
602        else if (name.equals("gender"))
603          this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender>
604        else if (name.equals("birthDate"))
605          this.birthDate = castToDate(value); // DateType
606        else if (name.equals("address"))
607          this.getAddress().add(castToAddress(value));
608        else if (name.equals("photo"))
609          this.getPhoto().add(castToAttachment(value));
610        else if (name.equals("period"))
611          this.period = castToPeriod(value); // Period
612        else
613          super.setProperty(name, value);
614      }
615
616      @Override
617      public Base makeProperty(int hash, String name) throws FHIRException {
618        switch (hash) {
619        case -1618432855:  return addIdentifier(); // Identifier
620        case -791418107:  return getPatient(); // Reference
621        case -261851592:  return getRelationship(); // CodeableConcept
622        case 3373707:  return getName(); // HumanName
623        case -1429363305:  return addTelecom(); // ContactPoint
624        case -1249512767: throw new FHIRException("Cannot make property gender as it is not a complex type"); // Enumeration<AdministrativeGender>
625        case -1210031859: throw new FHIRException("Cannot make property birthDate as it is not a complex type"); // DateType
626        case -1147692044:  return addAddress(); // Address
627        case 106642994:  return addPhoto(); // Attachment
628        case -991726143:  return getPeriod(); // Period
629        default: return super.makeProperty(hash, name);
630        }
631
632      }
633
634      @Override
635      public Base addChild(String name) throws FHIRException {
636        if (name.equals("identifier")) {
637          return addIdentifier();
638        }
639        else if (name.equals("patient")) {
640          this.patient = new Reference();
641          return this.patient;
642        }
643        else if (name.equals("relationship")) {
644          this.relationship = new CodeableConcept();
645          return this.relationship;
646        }
647        else if (name.equals("name")) {
648          this.name = new HumanName();
649          return this.name;
650        }
651        else if (name.equals("telecom")) {
652          return addTelecom();
653        }
654        else if (name.equals("gender")) {
655          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.gender");
656        }
657        else if (name.equals("birthDate")) {
658          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.birthDate");
659        }
660        else if (name.equals("address")) {
661          return addAddress();
662        }
663        else if (name.equals("photo")) {
664          return addPhoto();
665        }
666        else if (name.equals("period")) {
667          this.period = new Period();
668          return this.period;
669        }
670        else
671          return super.addChild(name);
672      }
673
674  public String fhirType() {
675    return "RelatedPerson";
676
677  }
678
679      public RelatedPerson copy() {
680        RelatedPerson dst = new RelatedPerson();
681        copyValues(dst);
682        if (identifier != null) {
683          dst.identifier = new ArrayList<Identifier>();
684          for (Identifier i : identifier)
685            dst.identifier.add(i.copy());
686        };
687        dst.patient = patient == null ? null : patient.copy();
688        dst.relationship = relationship == null ? null : relationship.copy();
689        dst.name = name == null ? null : name.copy();
690        if (telecom != null) {
691          dst.telecom = new ArrayList<ContactPoint>();
692          for (ContactPoint i : telecom)
693            dst.telecom.add(i.copy());
694        };
695        dst.gender = gender == null ? null : gender.copy();
696        dst.birthDate = birthDate == null ? null : birthDate.copy();
697        if (address != null) {
698          dst.address = new ArrayList<Address>();
699          for (Address i : address)
700            dst.address.add(i.copy());
701        };
702        if (photo != null) {
703          dst.photo = new ArrayList<Attachment>();
704          for (Attachment i : photo)
705            dst.photo.add(i.copy());
706        };
707        dst.period = period == null ? null : period.copy();
708        return dst;
709      }
710
711      protected RelatedPerson typedCopy() {
712        return copy();
713      }
714
715      @Override
716      public boolean equalsDeep(Base other) {
717        if (!super.equalsDeep(other))
718          return false;
719        if (!(other instanceof RelatedPerson))
720          return false;
721        RelatedPerson o = (RelatedPerson) other;
722        return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(relationship, o.relationship, true)
723           && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true) && compareDeep(gender, o.gender, true)
724           && compareDeep(birthDate, o.birthDate, true) && compareDeep(address, o.address, true) && compareDeep(photo, o.photo, true)
725           && compareDeep(period, o.period, true);
726      }
727
728      @Override
729      public boolean equalsShallow(Base other) {
730        if (!super.equalsShallow(other))
731          return false;
732        if (!(other instanceof RelatedPerson))
733          return false;
734        RelatedPerson o = (RelatedPerson) other;
735        return compareValues(gender, o.gender, true) && compareValues(birthDate, o.birthDate, true);
736      }
737
738      public boolean isEmpty() {
739        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty())
740           && (relationship == null || relationship.isEmpty()) && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
741           && (gender == null || gender.isEmpty()) && (birthDate == null || birthDate.isEmpty()) && (address == null || address.isEmpty())
742           && (photo == null || photo.isEmpty()) && (period == null || period.isEmpty());
743      }
744
745  @Override
746  public ResourceType getResourceType() {
747    return ResourceType.RelatedPerson;
748   }
749
750 /**
751   * Search parameter: <b>phone</b>
752   * <p>
753   * Description: <b>A value in a phone contact</b><br>
754   * Type: <b>token</b><br>
755   * Path: <b>RelatedPerson.telecom(system=phone)</b><br>
756   * </p>
757   */
758  @SearchParamDefinition(name="phone", path="RelatedPerson.telecom.where(system='phone')", description="A value in a phone contact", type="token" )
759  public static final String SP_PHONE = "phone";
760 /**
761   * <b>Fluent Client</b> search parameter constant for <b>phone</b>
762   * <p>
763   * Description: <b>A value in a phone contact</b><br>
764   * Type: <b>token</b><br>
765   * Path: <b>RelatedPerson.telecom(system=phone)</b><br>
766   * </p>
767   */
768  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PHONE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PHONE);
769
770 /**
771   * Search parameter: <b>phonetic</b>
772   * <p>
773   * Description: <b>A portion of name using some kind of phonetic matching algorithm</b><br>
774   * Type: <b>string</b><br>
775   * Path: <b>RelatedPerson.name</b><br>
776   * </p>
777   */
778  @SearchParamDefinition(name="phonetic", path="RelatedPerson.name", description="A portion of name using some kind of phonetic matching algorithm", type="string" )
779  public static final String SP_PHONETIC = "phonetic";
780 /**
781   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
782   * <p>
783   * Description: <b>A portion of name using some kind of phonetic matching algorithm</b><br>
784   * Type: <b>string</b><br>
785   * Path: <b>RelatedPerson.name</b><br>
786   * </p>
787   */
788  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PHONETIC);
789
790 /**
791   * Search parameter: <b>address-country</b>
792   * <p>
793   * Description: <b>A country specified in an address</b><br>
794   * Type: <b>string</b><br>
795   * Path: <b>RelatedPerson.address.country</b><br>
796   * </p>
797   */
798  @SearchParamDefinition(name="address-country", path="RelatedPerson.address.country", description="A country specified in an address", type="string" )
799  public static final String SP_ADDRESS_COUNTRY = "address-country";
800 /**
801   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
802   * <p>
803   * Description: <b>A country specified in an address</b><br>
804   * Type: <b>string</b><br>
805   * Path: <b>RelatedPerson.address.country</b><br>
806   * </p>
807   */
808  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
809
810 /**
811   * Search parameter: <b>patient</b>
812   * <p>
813   * Description: <b>The patient this person is related to</b><br>
814   * Type: <b>reference</b><br>
815   * Path: <b>RelatedPerson.patient</b><br>
816   * </p>
817   */
818  @SearchParamDefinition(name="patient", path="RelatedPerson.patient", description="The patient this person is related to", type="reference" )
819  public static final String SP_PATIENT = "patient";
820 /**
821   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
822   * <p>
823   * Description: <b>The patient this person is related to</b><br>
824   * Type: <b>reference</b><br>
825   * Path: <b>RelatedPerson.patient</b><br>
826   * </p>
827   */
828  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
829
830/**
831   * Constant for fluent queries to be used to add include statements. Specifies
832   * the path value of "<b>RelatedPerson:patient</b>".
833   */
834  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("RelatedPerson:patient").toLocked();
835
836 /**
837   * Search parameter: <b>address-city</b>
838   * <p>
839   * Description: <b>A city specified in an address</b><br>
840   * Type: <b>string</b><br>
841   * Path: <b>RelatedPerson.address.city</b><br>
842   * </p>
843   */
844  @SearchParamDefinition(name="address-city", path="RelatedPerson.address.city", description="A city specified in an address", type="string" )
845  public static final String SP_ADDRESS_CITY = "address-city";
846 /**
847   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
848   * <p>
849   * Description: <b>A city specified in an address</b><br>
850   * Type: <b>string</b><br>
851   * Path: <b>RelatedPerson.address.city</b><br>
852   * </p>
853   */
854  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
855
856 /**
857   * Search parameter: <b>address-state</b>
858   * <p>
859   * Description: <b>A state specified in an address</b><br>
860   * Type: <b>string</b><br>
861   * Path: <b>RelatedPerson.address.state</b><br>
862   * </p>
863   */
864  @SearchParamDefinition(name="address-state", path="RelatedPerson.address.state", description="A state specified in an address", type="string" )
865  public static final String SP_ADDRESS_STATE = "address-state";
866 /**
867   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
868   * <p>
869   * Description: <b>A state specified in an address</b><br>
870   * Type: <b>string</b><br>
871   * Path: <b>RelatedPerson.address.state</b><br>
872   * </p>
873   */
874  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
875
876 /**
877   * Search parameter: <b>email</b>
878   * <p>
879   * Description: <b>A value in an email contact</b><br>
880   * Type: <b>token</b><br>
881   * Path: <b>RelatedPerson.telecom(system=email)</b><br>
882   * </p>
883   */
884  @SearchParamDefinition(name="email", path="RelatedPerson.telecom.where(system='email')", description="A value in an email contact", type="token" )
885  public static final String SP_EMAIL = "email";
886 /**
887   * <b>Fluent Client</b> search parameter constant for <b>email</b>
888   * <p>
889   * Description: <b>A value in an email contact</b><br>
890   * Type: <b>token</b><br>
891   * Path: <b>RelatedPerson.telecom(system=email)</b><br>
892   * </p>
893   */
894  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMAIL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EMAIL);
895
896 /**
897   * Search parameter: <b>address</b>
898   * <p>
899   * Description: <b>An address in any kind of address/part</b><br>
900   * Type: <b>string</b><br>
901   * Path: <b>RelatedPerson.address</b><br>
902   * </p>
903   */
904  @SearchParamDefinition(name="address", path="RelatedPerson.address", description="An address in any kind of address/part", type="string" )
905  public static final String SP_ADDRESS = "address";
906 /**
907   * <b>Fluent Client</b> search parameter constant for <b>address</b>
908   * <p>
909   * Description: <b>An address in any kind of address/part</b><br>
910   * Type: <b>string</b><br>
911   * Path: <b>RelatedPerson.address</b><br>
912   * </p>
913   */
914  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
915
916 /**
917   * Search parameter: <b>address-use</b>
918   * <p>
919   * Description: <b>A use code specified in an address</b><br>
920   * Type: <b>token</b><br>
921   * Path: <b>RelatedPerson.address.use</b><br>
922   * </p>
923   */
924  @SearchParamDefinition(name="address-use", path="RelatedPerson.address.use", description="A use code specified in an address", type="token" )
925  public static final String SP_ADDRESS_USE = "address-use";
926 /**
927   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
928   * <p>
929   * Description: <b>A use code specified in an address</b><br>
930   * Type: <b>token</b><br>
931   * Path: <b>RelatedPerson.address.use</b><br>
932   * </p>
933   */
934  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
935
936 /**
937   * Search parameter: <b>name</b>
938   * <p>
939   * Description: <b>A portion of name in any name part</b><br>
940   * Type: <b>string</b><br>
941   * Path: <b>RelatedPerson.name</b><br>
942   * </p>
943   */
944  @SearchParamDefinition(name="name", path="RelatedPerson.name", description="A portion of name in any name part", type="string" )
945  public static final String SP_NAME = "name";
946 /**
947   * <b>Fluent Client</b> search parameter constant for <b>name</b>
948   * <p>
949   * Description: <b>A portion of name in any name part</b><br>
950   * Type: <b>string</b><br>
951   * Path: <b>RelatedPerson.name</b><br>
952   * </p>
953   */
954  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
955
956 /**
957   * Search parameter: <b>birthdate</b>
958   * <p>
959   * Description: <b>The Related Person's date of birth</b><br>
960   * Type: <b>date</b><br>
961   * Path: <b>RelatedPerson.birthDate</b><br>
962   * </p>
963   */
964  @SearchParamDefinition(name="birthdate", path="RelatedPerson.birthDate", description="The Related Person's date of birth", type="date" )
965  public static final String SP_BIRTHDATE = "birthdate";
966 /**
967   * <b>Fluent Client</b> search parameter constant for <b>birthdate</b>
968   * <p>
969   * Description: <b>The Related Person's date of birth</b><br>
970   * Type: <b>date</b><br>
971   * Path: <b>RelatedPerson.birthDate</b><br>
972   * </p>
973   */
974  public static final ca.uhn.fhir.rest.gclient.DateClientParam BIRTHDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_BIRTHDATE);
975
976 /**
977   * Search parameter: <b>telecom</b>
978   * <p>
979   * Description: <b>The value in any kind of contact</b><br>
980   * Type: <b>token</b><br>
981   * Path: <b>RelatedPerson.telecom</b><br>
982   * </p>
983   */
984  @SearchParamDefinition(name="telecom", path="RelatedPerson.telecom", description="The value in any kind of contact", type="token" )
985  public static final String SP_TELECOM = "telecom";
986 /**
987   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
988   * <p>
989   * Description: <b>The value in any kind of contact</b><br>
990   * Type: <b>token</b><br>
991   * Path: <b>RelatedPerson.telecom</b><br>
992   * </p>
993   */
994  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TELECOM);
995
996 /**
997   * Search parameter: <b>gender</b>
998   * <p>
999   * Description: <b>Gender of the person</b><br>
1000   * Type: <b>token</b><br>
1001   * Path: <b>RelatedPerson.gender</b><br>
1002   * </p>
1003   */
1004  @SearchParamDefinition(name="gender", path="RelatedPerson.gender", description="Gender of the person", type="token" )
1005  public static final String SP_GENDER = "gender";
1006 /**
1007   * <b>Fluent Client</b> search parameter constant for <b>gender</b>
1008   * <p>
1009   * Description: <b>Gender of the person</b><br>
1010   * Type: <b>token</b><br>
1011   * Path: <b>RelatedPerson.gender</b><br>
1012   * </p>
1013   */
1014  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GENDER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GENDER);
1015
1016 /**
1017   * Search parameter: <b>identifier</b>
1018   * <p>
1019   * Description: <b>A patient Identifier</b><br>
1020   * Type: <b>token</b><br>
1021   * Path: <b>RelatedPerson.identifier</b><br>
1022   * </p>
1023   */
1024  @SearchParamDefinition(name="identifier", path="RelatedPerson.identifier", description="A patient Identifier", type="token" )
1025  public static final String SP_IDENTIFIER = "identifier";
1026 /**
1027   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1028   * <p>
1029   * Description: <b>A patient Identifier</b><br>
1030   * Type: <b>token</b><br>
1031   * Path: <b>RelatedPerson.identifier</b><br>
1032   * </p>
1033   */
1034  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1035
1036 /**
1037   * Search parameter: <b>address-postalcode</b>
1038   * <p>
1039   * Description: <b>A postal code specified in an address</b><br>
1040   * Type: <b>string</b><br>
1041   * Path: <b>RelatedPerson.address.postalCode</b><br>
1042   * </p>
1043   */
1044  @SearchParamDefinition(name="address-postalcode", path="RelatedPerson.address.postalCode", description="A postal code specified in an address", type="string" )
1045  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
1046 /**
1047   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
1048   * <p>
1049   * Description: <b>A postal code specified in an address</b><br>
1050   * Type: <b>string</b><br>
1051   * Path: <b>RelatedPerson.address.postalCode</b><br>
1052   * </p>
1053   */
1054  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
1055
1056
1057}