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