001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * Significant health conditions for a person related to the patient relevant in
049 * the context of care for the patient.
050 */
051@ResourceDef(name = "FamilyMemberHistory", profile = "http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory")
052public class FamilyMemberHistory extends DomainResource {
053
054  public enum FamilyHistoryStatus {
055    /**
056     * Some health information is known and captured, but not complete - see notes
057     * for details.
058     */
059    PARTIAL,
060    /**
061     * All available related health information is captured as of the date (and
062     * possibly time) when the family member history was taken.
063     */
064    COMPLETED,
065    /**
066     * This instance should not have been part of this patient's medical record.
067     */
068    ENTEREDINERROR,
069    /**
070     * Health information for this family member is unavailable/unknown.
071     */
072    HEALTHUNKNOWN,
073    /**
074     * added to help the parsers with the generic types
075     */
076    NULL;
077
078    public static FamilyHistoryStatus fromCode(String codeString) throws FHIRException {
079      if (codeString == null || "".equals(codeString))
080        return null;
081      if ("partial".equals(codeString))
082        return PARTIAL;
083      if ("completed".equals(codeString))
084        return COMPLETED;
085      if ("entered-in-error".equals(codeString))
086        return ENTEREDINERROR;
087      if ("health-unknown".equals(codeString))
088        return HEALTHUNKNOWN;
089      if (Configuration.isAcceptInvalidEnums())
090        return null;
091      else
092        throw new FHIRException("Unknown FamilyHistoryStatus code '" + codeString + "'");
093    }
094
095    public String toCode() {
096      switch (this) {
097      case PARTIAL:
098        return "partial";
099      case COMPLETED:
100        return "completed";
101      case ENTEREDINERROR:
102        return "entered-in-error";
103      case HEALTHUNKNOWN:
104        return "health-unknown";
105      case NULL:
106        return null;
107      default:
108        return "?";
109      }
110    }
111
112    public String getSystem() {
113      switch (this) {
114      case PARTIAL:
115        return "http://hl7.org/fhir/history-status";
116      case COMPLETED:
117        return "http://hl7.org/fhir/history-status";
118      case ENTEREDINERROR:
119        return "http://hl7.org/fhir/history-status";
120      case HEALTHUNKNOWN:
121        return "http://hl7.org/fhir/history-status";
122      case NULL:
123        return null;
124      default:
125        return "?";
126      }
127    }
128
129    public String getDefinition() {
130      switch (this) {
131      case PARTIAL:
132        return "Some health information is known and captured, but not complete - see notes for details.";
133      case COMPLETED:
134        return "All available related health information is captured as of the date (and possibly time) when the family member history was taken.";
135      case ENTEREDINERROR:
136        return "This instance should not have been part of this patient's medical record.";
137      case HEALTHUNKNOWN:
138        return "Health information for this family member is unavailable/unknown.";
139      case NULL:
140        return null;
141      default:
142        return "?";
143      }
144    }
145
146    public String getDisplay() {
147      switch (this) {
148      case PARTIAL:
149        return "Partial";
150      case COMPLETED:
151        return "Completed";
152      case ENTEREDINERROR:
153        return "Entered in Error";
154      case HEALTHUNKNOWN:
155        return "Health Unknown";
156      case NULL:
157        return null;
158      default:
159        return "?";
160      }
161    }
162  }
163
164  public static class FamilyHistoryStatusEnumFactory implements EnumFactory<FamilyHistoryStatus> {
165    public FamilyHistoryStatus fromCode(String codeString) throws IllegalArgumentException {
166      if (codeString == null || "".equals(codeString))
167        if (codeString == null || "".equals(codeString))
168          return null;
169      if ("partial".equals(codeString))
170        return FamilyHistoryStatus.PARTIAL;
171      if ("completed".equals(codeString))
172        return FamilyHistoryStatus.COMPLETED;
173      if ("entered-in-error".equals(codeString))
174        return FamilyHistoryStatus.ENTEREDINERROR;
175      if ("health-unknown".equals(codeString))
176        return FamilyHistoryStatus.HEALTHUNKNOWN;
177      throw new IllegalArgumentException("Unknown FamilyHistoryStatus code '" + codeString + "'");
178    }
179
180    public Enumeration<FamilyHistoryStatus> fromType(PrimitiveType<?> code) throws FHIRException {
181      if (code == null)
182        return null;
183      if (code.isEmpty())
184        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.NULL, code);
185      String codeString = code.asStringValue();
186      if (codeString == null || "".equals(codeString))
187        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.NULL, code);
188      if ("partial".equals(codeString))
189        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.PARTIAL, code);
190      if ("completed".equals(codeString))
191        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.COMPLETED, code);
192      if ("entered-in-error".equals(codeString))
193        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.ENTEREDINERROR, code);
194      if ("health-unknown".equals(codeString))
195        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.HEALTHUNKNOWN, code);
196      throw new FHIRException("Unknown FamilyHistoryStatus code '" + codeString + "'");
197    }
198
199    public String toCode(FamilyHistoryStatus code) {
200      if (code == FamilyHistoryStatus.PARTIAL)
201        return "partial";
202      if (code == FamilyHistoryStatus.COMPLETED)
203        return "completed";
204      if (code == FamilyHistoryStatus.ENTEREDINERROR)
205        return "entered-in-error";
206      if (code == FamilyHistoryStatus.HEALTHUNKNOWN)
207        return "health-unknown";
208      return "?";
209    }
210
211    public String toSystem(FamilyHistoryStatus code) {
212      return code.getSystem();
213    }
214  }
215
216  @Block()
217  public static class FamilyMemberHistoryConditionComponent extends BackboneElement implements IBaseBackboneElement {
218    /**
219     * The actual condition specified. Could be a coded condition (like MI or
220     * Diabetes) or a less specific string like 'cancer' depending on how much is
221     * known about the condition and the capabilities of the creating system.
222     */
223    @Child(name = "code", type = {
224        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
225    @Description(shortDefinition = "Condition suffered by relation", formalDefinition = "The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.")
226    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code")
227    protected CodeableConcept code;
228
229    /**
230     * Indicates what happened following the condition. If the condition resulted in
231     * death, deceased date is captured on the relation.
232     */
233    @Child(name = "outcome", type = {
234        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
235    @Description(shortDefinition = "deceased | permanent disability | etc.", formalDefinition = "Indicates what happened following the condition.  If the condition resulted in death, deceased date is captured on the relation.")
236    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-outcome")
237    protected CodeableConcept outcome;
238
239    /**
240     * This condition contributed to the cause of death of the related person. If
241     * contributedToDeath is not populated, then it is unknown.
242     */
243    @Child(name = "contributedToDeath", type = {
244        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
245    @Description(shortDefinition = "Whether the condition contributed to the cause of death", formalDefinition = "This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.")
246    protected BooleanType contributedToDeath;
247
248    /**
249     * Either the age of onset, range of approximate age or descriptive string can
250     * be recorded. For conditions with multiple occurrences, this describes the
251     * first known occurrence.
252     */
253    @Child(name = "onset", type = { Age.class, Range.class, Period.class,
254        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
255    @Description(shortDefinition = "When condition first manifested", formalDefinition = "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.")
256    protected Type onset;
257
258    /**
259     * An area where general notes can be placed about this specific condition.
260     */
261    @Child(name = "note", type = {
262        Annotation.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
263    @Description(shortDefinition = "Extra information about condition", formalDefinition = "An area where general notes can be placed about this specific condition.")
264    protected List<Annotation> note;
265
266    private static final long serialVersionUID = 1230182301L;
267
268    /**
269     * Constructor
270     */
271    public FamilyMemberHistoryConditionComponent() {
272      super();
273    }
274
275    /**
276     * Constructor
277     */
278    public FamilyMemberHistoryConditionComponent(CodeableConcept code) {
279      super();
280      this.code = code;
281    }
282
283    /**
284     * @return {@link #code} (The actual condition specified. Could be a coded
285     *         condition (like MI or Diabetes) or a less specific string like
286     *         'cancer' depending on how much is known about the condition and the
287     *         capabilities of the creating system.)
288     */
289    public CodeableConcept getCode() {
290      if (this.code == null)
291        if (Configuration.errorOnAutoCreate())
292          throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.code");
293        else if (Configuration.doAutoCreate())
294          this.code = new CodeableConcept(); // cc
295      return this.code;
296    }
297
298    public boolean hasCode() {
299      return this.code != null && !this.code.isEmpty();
300    }
301
302    /**
303     * @param value {@link #code} (The actual condition specified. Could be a coded
304     *              condition (like MI or Diabetes) or a less specific string like
305     *              'cancer' depending on how much is known about the condition and
306     *              the capabilities of the creating system.)
307     */
308    public FamilyMemberHistoryConditionComponent setCode(CodeableConcept value) {
309      this.code = value;
310      return this;
311    }
312
313    /**
314     * @return {@link #outcome} (Indicates what happened following the condition. If
315     *         the condition resulted in death, deceased date is captured on the
316     *         relation.)
317     */
318    public CodeableConcept getOutcome() {
319      if (this.outcome == null)
320        if (Configuration.errorOnAutoCreate())
321          throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.outcome");
322        else if (Configuration.doAutoCreate())
323          this.outcome = new CodeableConcept(); // cc
324      return this.outcome;
325    }
326
327    public boolean hasOutcome() {
328      return this.outcome != null && !this.outcome.isEmpty();
329    }
330
331    /**
332     * @param value {@link #outcome} (Indicates what happened following the
333     *              condition. If the condition resulted in death, deceased date is
334     *              captured on the relation.)
335     */
336    public FamilyMemberHistoryConditionComponent setOutcome(CodeableConcept value) {
337      this.outcome = value;
338      return this;
339    }
340
341    /**
342     * @return {@link #contributedToDeath} (This condition contributed to the cause
343     *         of death of the related person. If contributedToDeath is not
344     *         populated, then it is unknown.). This is the underlying object with
345     *         id, value and extensions. The accessor "getContributedToDeath" gives
346     *         direct access to the value
347     */
348    public BooleanType getContributedToDeathElement() {
349      if (this.contributedToDeath == null)
350        if (Configuration.errorOnAutoCreate())
351          throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.contributedToDeath");
352        else if (Configuration.doAutoCreate())
353          this.contributedToDeath = new BooleanType(); // bb
354      return this.contributedToDeath;
355    }
356
357    public boolean hasContributedToDeathElement() {
358      return this.contributedToDeath != null && !this.contributedToDeath.isEmpty();
359    }
360
361    public boolean hasContributedToDeath() {
362      return this.contributedToDeath != null && !this.contributedToDeath.isEmpty();
363    }
364
365    /**
366     * @param value {@link #contributedToDeath} (This condition contributed to the
367     *              cause of death of the related person. If contributedToDeath is
368     *              not populated, then it is unknown.). This is the underlying
369     *              object with id, value and extensions. The accessor
370     *              "getContributedToDeath" gives direct access to the value
371     */
372    public FamilyMemberHistoryConditionComponent setContributedToDeathElement(BooleanType value) {
373      this.contributedToDeath = value;
374      return this;
375    }
376
377    /**
378     * @return This condition contributed to the cause of death of the related
379     *         person. If contributedToDeath is not populated, then it is unknown.
380     */
381    public boolean getContributedToDeath() {
382      return this.contributedToDeath == null || this.contributedToDeath.isEmpty() ? false
383          : this.contributedToDeath.getValue();
384    }
385
386    /**
387     * @param value This condition contributed to the cause of death of the related
388     *              person. If contributedToDeath is not populated, then it is
389     *              unknown.
390     */
391    public FamilyMemberHistoryConditionComponent setContributedToDeath(boolean value) {
392      if (this.contributedToDeath == null)
393        this.contributedToDeath = new BooleanType();
394      this.contributedToDeath.setValue(value);
395      return this;
396    }
397
398    /**
399     * @return {@link #onset} (Either the age of onset, range of approximate age or
400     *         descriptive string can be recorded. For conditions with multiple
401     *         occurrences, this describes the first known occurrence.)
402     */
403    public Type getOnset() {
404      return this.onset;
405    }
406
407    /**
408     * @return {@link #onset} (Either the age of onset, range of approximate age or
409     *         descriptive string can be recorded. For conditions with multiple
410     *         occurrences, this describes the first known occurrence.)
411     */
412    public Age getOnsetAge() throws FHIRException {
413      if (this.onset == null)
414        this.onset = new Age();
415      if (!(this.onset instanceof Age))
416        throw new FHIRException(
417            "Type mismatch: the type Age was expected, but " + this.onset.getClass().getName() + " was encountered");
418      return (Age) this.onset;
419    }
420
421    public boolean hasOnsetAge() {
422      return this != null && this.onset instanceof Age;
423    }
424
425    /**
426     * @return {@link #onset} (Either the age of onset, range of approximate age or
427     *         descriptive string can be recorded. For conditions with multiple
428     *         occurrences, this describes the first known occurrence.)
429     */
430    public Range getOnsetRange() throws FHIRException {
431      if (this.onset == null)
432        this.onset = new Range();
433      if (!(this.onset instanceof Range))
434        throw new FHIRException(
435            "Type mismatch: the type Range was expected, but " + this.onset.getClass().getName() + " was encountered");
436      return (Range) this.onset;
437    }
438
439    public boolean hasOnsetRange() {
440      return this != null && this.onset instanceof Range;
441    }
442
443    /**
444     * @return {@link #onset} (Either the age of onset, range of approximate age or
445     *         descriptive string can be recorded. For conditions with multiple
446     *         occurrences, this describes the first known occurrence.)
447     */
448    public Period getOnsetPeriod() throws FHIRException {
449      if (this.onset == null)
450        this.onset = new Period();
451      if (!(this.onset instanceof Period))
452        throw new FHIRException(
453            "Type mismatch: the type Period was expected, but " + this.onset.getClass().getName() + " was encountered");
454      return (Period) this.onset;
455    }
456
457    public boolean hasOnsetPeriod() {
458      return this != null && this.onset instanceof Period;
459    }
460
461    /**
462     * @return {@link #onset} (Either the age of onset, range of approximate age or
463     *         descriptive string can be recorded. For conditions with multiple
464     *         occurrences, this describes the first known occurrence.)
465     */
466    public StringType getOnsetStringType() throws FHIRException {
467      if (this.onset == null)
468        this.onset = new StringType();
469      if (!(this.onset instanceof StringType))
470        throw new FHIRException("Type mismatch: the type StringType was expected, but "
471            + this.onset.getClass().getName() + " was encountered");
472      return (StringType) this.onset;
473    }
474
475    public boolean hasOnsetStringType() {
476      return this != null && this.onset instanceof StringType;
477    }
478
479    public boolean hasOnset() {
480      return this.onset != null && !this.onset.isEmpty();
481    }
482
483    /**
484     * @param value {@link #onset} (Either the age of onset, range of approximate
485     *              age or descriptive string can be recorded. For conditions with
486     *              multiple occurrences, this describes the first known
487     *              occurrence.)
488     */
489    public FamilyMemberHistoryConditionComponent setOnset(Type value) {
490      if (value != null && !(value instanceof Age || value instanceof Range || value instanceof Period
491          || value instanceof StringType))
492        throw new Error("Not the right type for FamilyMemberHistory.condition.onset[x]: " + value.fhirType());
493      this.onset = value;
494      return this;
495    }
496
497    /**
498     * @return {@link #note} (An area where general notes can be placed about this
499     *         specific condition.)
500     */
501    public List<Annotation> getNote() {
502      if (this.note == null)
503        this.note = new ArrayList<Annotation>();
504      return this.note;
505    }
506
507    /**
508     * @return Returns a reference to <code>this</code> for easy method chaining
509     */
510    public FamilyMemberHistoryConditionComponent setNote(List<Annotation> theNote) {
511      this.note = theNote;
512      return this;
513    }
514
515    public boolean hasNote() {
516      if (this.note == null)
517        return false;
518      for (Annotation item : this.note)
519        if (!item.isEmpty())
520          return true;
521      return false;
522    }
523
524    public Annotation addNote() { // 3
525      Annotation t = new Annotation();
526      if (this.note == null)
527        this.note = new ArrayList<Annotation>();
528      this.note.add(t);
529      return t;
530    }
531
532    public FamilyMemberHistoryConditionComponent addNote(Annotation t) { // 3
533      if (t == null)
534        return this;
535      if (this.note == null)
536        this.note = new ArrayList<Annotation>();
537      this.note.add(t);
538      return this;
539    }
540
541    /**
542     * @return The first repetition of repeating field {@link #note}, creating it if
543     *         it does not already exist
544     */
545    public Annotation getNoteFirstRep() {
546      if (getNote().isEmpty()) {
547        addNote();
548      }
549      return getNote().get(0);
550    }
551
552    protected void listChildren(List<Property> children) {
553      super.listChildren(children);
554      children.add(new Property("code", "CodeableConcept",
555          "The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.",
556          0, 1, code));
557      children.add(new Property("outcome", "CodeableConcept",
558          "Indicates what happened following the condition.  If the condition resulted in death, deceased date is captured on the relation.",
559          0, 1, outcome));
560      children.add(new Property("contributedToDeath", "boolean",
561          "This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.",
562          0, 1, contributedToDeath));
563      children.add(new Property("onset[x]", "Age|Range|Period|string",
564          "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
565          0, 1, onset));
566      children.add(
567          new Property("note", "Annotation", "An area where general notes can be placed about this specific condition.",
568              0, java.lang.Integer.MAX_VALUE, note));
569    }
570
571    @Override
572    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
573      switch (_hash) {
574      case 3059181:
575        /* code */ return new Property("code", "CodeableConcept",
576            "The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.",
577            0, 1, code);
578      case -1106507950:
579        /* outcome */ return new Property("outcome", "CodeableConcept",
580            "Indicates what happened following the condition.  If the condition resulted in death, deceased date is captured on the relation.",
581            0, 1, outcome);
582      case -363644638:
583        /* contributedToDeath */ return new Property("contributedToDeath", "boolean",
584            "This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.",
585            0, 1, contributedToDeath);
586      case -1886216323:
587        /* onset[x] */ return new Property("onset[x]", "Age|Range|Period|string",
588            "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
589            0, 1, onset);
590      case 105901603:
591        /* onset */ return new Property("onset[x]", "Age|Range|Period|string",
592            "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
593            0, 1, onset);
594      case -1886241828:
595        /* onsetAge */ return new Property("onset[x]", "Age|Range|Period|string",
596            "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
597            0, 1, onset);
598      case -186664742:
599        /* onsetRange */ return new Property("onset[x]", "Age|Range|Period|string",
600            "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
601            0, 1, onset);
602      case -1545082428:
603        /* onsetPeriod */ return new Property("onset[x]", "Age|Range|Period|string",
604            "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
605            0, 1, onset);
606      case -1445342188:
607        /* onsetString */ return new Property("onset[x]", "Age|Range|Period|string",
608            "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.",
609            0, 1, onset);
610      case 3387378:
611        /* note */ return new Property("note", "Annotation",
612            "An area where general notes can be placed about this specific condition.", 0, java.lang.Integer.MAX_VALUE,
613            note);
614      default:
615        return super.getNamedProperty(_hash, _name, _checkValid);
616      }
617
618    }
619
620    @Override
621    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
622      switch (hash) {
623      case 3059181:
624        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
625      case -1106507950:
626        /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // CodeableConcept
627      case -363644638:
628        /* contributedToDeath */ return this.contributedToDeath == null ? new Base[0]
629            : new Base[] { this.contributedToDeath }; // BooleanType
630      case 105901603:
631        /* onset */ return this.onset == null ? new Base[0] : new Base[] { this.onset }; // Type
632      case 3387378:
633        /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
634      default:
635        return super.getProperty(hash, name, checkValid);
636      }
637
638    }
639
640    @Override
641    public Base setProperty(int hash, String name, Base value) throws FHIRException {
642      switch (hash) {
643      case 3059181: // code
644        this.code = castToCodeableConcept(value); // CodeableConcept
645        return value;
646      case -1106507950: // outcome
647        this.outcome = castToCodeableConcept(value); // CodeableConcept
648        return value;
649      case -363644638: // contributedToDeath
650        this.contributedToDeath = castToBoolean(value); // BooleanType
651        return value;
652      case 105901603: // onset
653        this.onset = castToType(value); // Type
654        return value;
655      case 3387378: // note
656        this.getNote().add(castToAnnotation(value)); // Annotation
657        return value;
658      default:
659        return super.setProperty(hash, name, value);
660      }
661
662    }
663
664    @Override
665    public Base setProperty(String name, Base value) throws FHIRException {
666      if (name.equals("code")) {
667        this.code = castToCodeableConcept(value); // CodeableConcept
668      } else if (name.equals("outcome")) {
669        this.outcome = castToCodeableConcept(value); // CodeableConcept
670      } else if (name.equals("contributedToDeath")) {
671        this.contributedToDeath = castToBoolean(value); // BooleanType
672      } else if (name.equals("onset[x]")) {
673        this.onset = castToType(value); // Type
674      } else if (name.equals("note")) {
675        this.getNote().add(castToAnnotation(value));
676      } else
677        return super.setProperty(name, value);
678      return value;
679    }
680
681    @Override
682    public Base makeProperty(int hash, String name) throws FHIRException {
683      switch (hash) {
684      case 3059181:
685        return getCode();
686      case -1106507950:
687        return getOutcome();
688      case -363644638:
689        return getContributedToDeathElement();
690      case -1886216323:
691        return getOnset();
692      case 105901603:
693        return getOnset();
694      case 3387378:
695        return addNote();
696      default:
697        return super.makeProperty(hash, name);
698      }
699
700    }
701
702    @Override
703    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
704      switch (hash) {
705      case 3059181:
706        /* code */ return new String[] { "CodeableConcept" };
707      case -1106507950:
708        /* outcome */ return new String[] { "CodeableConcept" };
709      case -363644638:
710        /* contributedToDeath */ return new String[] { "boolean" };
711      case 105901603:
712        /* onset */ return new String[] { "Age", "Range", "Period", "string" };
713      case 3387378:
714        /* note */ return new String[] { "Annotation" };
715      default:
716        return super.getTypesForProperty(hash, name);
717      }
718
719    }
720
721    @Override
722    public Base addChild(String name) throws FHIRException {
723      if (name.equals("code")) {
724        this.code = new CodeableConcept();
725        return this.code;
726      } else if (name.equals("outcome")) {
727        this.outcome = new CodeableConcept();
728        return this.outcome;
729      } else if (name.equals("contributedToDeath")) {
730        throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.contributedToDeath");
731      } else if (name.equals("onsetAge")) {
732        this.onset = new Age();
733        return this.onset;
734      } else if (name.equals("onsetRange")) {
735        this.onset = new Range();
736        return this.onset;
737      } else if (name.equals("onsetPeriod")) {
738        this.onset = new Period();
739        return this.onset;
740      } else if (name.equals("onsetString")) {
741        this.onset = new StringType();
742        return this.onset;
743      } else if (name.equals("note")) {
744        return addNote();
745      } else
746        return super.addChild(name);
747    }
748
749    public FamilyMemberHistoryConditionComponent copy() {
750      FamilyMemberHistoryConditionComponent dst = new FamilyMemberHistoryConditionComponent();
751      copyValues(dst);
752      return dst;
753    }
754
755    public void copyValues(FamilyMemberHistoryConditionComponent dst) {
756      super.copyValues(dst);
757      dst.code = code == null ? null : code.copy();
758      dst.outcome = outcome == null ? null : outcome.copy();
759      dst.contributedToDeath = contributedToDeath == null ? null : contributedToDeath.copy();
760      dst.onset = onset == null ? null : onset.copy();
761      if (note != null) {
762        dst.note = new ArrayList<Annotation>();
763        for (Annotation i : note)
764          dst.note.add(i.copy());
765      }
766      ;
767    }
768
769    @Override
770    public boolean equalsDeep(Base other_) {
771      if (!super.equalsDeep(other_))
772        return false;
773      if (!(other_ instanceof FamilyMemberHistoryConditionComponent))
774        return false;
775      FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other_;
776      return compareDeep(code, o.code, true) && compareDeep(outcome, o.outcome, true)
777          && compareDeep(contributedToDeath, o.contributedToDeath, true) && compareDeep(onset, o.onset, true)
778          && compareDeep(note, o.note, true);
779    }
780
781    @Override
782    public boolean equalsShallow(Base other_) {
783      if (!super.equalsShallow(other_))
784        return false;
785      if (!(other_ instanceof FamilyMemberHistoryConditionComponent))
786        return false;
787      FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other_;
788      return compareValues(contributedToDeath, o.contributedToDeath, true);
789    }
790
791    public boolean isEmpty() {
792      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, outcome, contributedToDeath, onset, note);
793    }
794
795    public String fhirType() {
796      return "FamilyMemberHistory.condition";
797
798    }
799
800  }
801
802  /**
803   * Business identifiers assigned to this family member history by the performer
804   * or other systems which remain constant as the resource is updated and
805   * propagates from server to server.
806   */
807  @Child(name = "identifier", type = {
808      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
809  @Description(shortDefinition = "External Id(s) for this record", formalDefinition = "Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.")
810  protected List<Identifier> identifier;
811
812  /**
813   * The URL pointing to a FHIR-defined protocol, guideline, orderset or other
814   * definition that is adhered to in whole or in part by this
815   * FamilyMemberHistory.
816   */
817  @Child(name = "instantiatesCanonical", type = {
818      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
819  @Description(shortDefinition = "Instantiates FHIR protocol or definition", formalDefinition = "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.")
820  protected List<CanonicalType> instantiatesCanonical;
821
822  /**
823   * The URL pointing to an externally maintained protocol, guideline, orderset or
824   * other definition that is adhered to in whole or in part by this
825   * FamilyMemberHistory.
826   */
827  @Child(name = "instantiatesUri", type = {
828      UriType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
829  @Description(shortDefinition = "Instantiates external protocol or definition", formalDefinition = "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.")
830  protected List<UriType> instantiatesUri;
831
832  /**
833   * A code specifying the status of the record of the family history of a
834   * specific family member.
835   */
836  @Child(name = "status", type = { CodeType.class }, order = 3, min = 1, max = 1, modifier = true, summary = true)
837  @Description(shortDefinition = "partial | completed | entered-in-error | health-unknown", formalDefinition = "A code specifying the status of the record of the family history of a specific family member.")
838  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/history-status")
839  protected Enumeration<FamilyHistoryStatus> status;
840
841  /**
842   * Describes why the family member's history is not available.
843   */
844  @Child(name = "dataAbsentReason", type = {
845      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
846  @Description(shortDefinition = "subject-unknown | withheld | unable-to-obtain | deferred", formalDefinition = "Describes why the family member's history is not available.")
847  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/history-absent-reason")
848  protected CodeableConcept dataAbsentReason;
849
850  /**
851   * The person who this history concerns.
852   */
853  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
854  @Description(shortDefinition = "Patient history is about", formalDefinition = "The person who this history concerns.")
855  protected Reference patient;
856
857  /**
858   * The actual object that is the target of the reference (The person who this
859   * history concerns.)
860   */
861  protected Patient patientTarget;
862
863  /**
864   * The date (and possibly time) when the family member history was recorded or
865   * last updated.
866   */
867  @Child(name = "date", type = { DateTimeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
868  @Description(shortDefinition = "When history was recorded or last updated", formalDefinition = "The date (and possibly time) when the family member history was recorded or last updated.")
869  protected DateTimeType date;
870
871  /**
872   * This will either be a name or a description; e.g. "Aunt Susan", "my cousin
873   * with the red hair".
874   */
875  @Child(name = "name", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
876  @Description(shortDefinition = "The family member described", formalDefinition = "This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\".")
877  protected StringType name;
878
879  /**
880   * The type of relationship this person has to the patient (father, mother,
881   * brother etc.).
882   */
883  @Child(name = "relationship", type = {
884      CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = true)
885  @Description(shortDefinition = "Relationship to the subject", formalDefinition = "The type of relationship this person has to the patient (father, mother, brother etc.).")
886  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-FamilyMember")
887  protected CodeableConcept relationship;
888
889  /**
890   * The birth sex of the family member.
891   */
892  @Child(name = "sex", type = { CodeableConcept.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
893  @Description(shortDefinition = "male | female | other | unknown", formalDefinition = "The birth sex of the family member.")
894  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/administrative-gender")
895  protected CodeableConcept sex;
896
897  /**
898   * The actual or approximate date of birth of the relative.
899   */
900  @Child(name = "born", type = { Period.class, DateType.class,
901      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
902  @Description(shortDefinition = "(approximate) date of birth", formalDefinition = "The actual or approximate date of birth of the relative.")
903  protected Type born;
904
905  /**
906   * The age of the relative at the time the family member history is recorded.
907   */
908  @Child(name = "age", type = { Age.class, Range.class,
909      StringType.class }, order = 11, min = 0, max = 1, modifier = false, summary = true)
910  @Description(shortDefinition = "(approximate) age", formalDefinition = "The age of the relative at the time the family member history is recorded.")
911  protected Type age;
912
913  /**
914   * If true, indicates that the age value specified is an estimated value.
915   */
916  @Child(name = "estimatedAge", type = {
917      BooleanType.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
918  @Description(shortDefinition = "Age is estimated?", formalDefinition = "If true, indicates that the age value specified is an estimated value.")
919  protected BooleanType estimatedAge;
920
921  /**
922   * Deceased flag or the actual or approximate age of the relative at the time of
923   * death for the family member history record.
924   */
925  @Child(name = "deceased", type = { BooleanType.class, Age.class, Range.class, DateType.class,
926      StringType.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
927  @Description(shortDefinition = "Dead? How old/when?", formalDefinition = "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.")
928  protected Type deceased;
929
930  /**
931   * Describes why the family member history occurred in coded or textual form.
932   */
933  @Child(name = "reasonCode", type = {
934      CodeableConcept.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
935  @Description(shortDefinition = "Why was family member history performed?", formalDefinition = "Describes why the family member history occurred in coded or textual form.")
936  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/clinical-findings")
937  protected List<CodeableConcept> reasonCode;
938
939  /**
940   * Indicates a Condition, Observation, AllergyIntolerance, or
941   * QuestionnaireResponse that justifies this family member history event.
942   */
943  @Child(name = "reasonReference", type = { Condition.class, Observation.class, AllergyIntolerance.class,
944      QuestionnaireResponse.class, DiagnosticReport.class,
945      DocumentReference.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
946  @Description(shortDefinition = "Why was family member history performed?", formalDefinition = "Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.")
947  protected List<Reference> reasonReference;
948  /**
949   * The actual objects that are the target of the reference (Indicates a
950   * Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that
951   * justifies this family member history event.)
952   */
953  protected List<Resource> reasonReferenceTarget;
954
955  /**
956   * This property allows a non condition-specific note to the made about the
957   * related person. Ideally, the note would be in the condition property, but
958   * this is not always possible.
959   */
960  @Child(name = "note", type = {
961      Annotation.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
962  @Description(shortDefinition = "General note about related person", formalDefinition = "This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.")
963  protected List<Annotation> note;
964
965  /**
966   * The significant Conditions (or condition) that the family member had. This is
967   * a repeating section to allow a system to represent more than one condition
968   * per resource, though there is nothing stopping multiple resources - one per
969   * condition.
970   */
971  @Child(name = "condition", type = {}, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
972  @Description(shortDefinition = "Condition that the related person had", formalDefinition = "The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.")
973  protected List<FamilyMemberHistoryConditionComponent> condition;
974
975  private static final long serialVersionUID = -455261406L;
976
977  /**
978   * Constructor
979   */
980  public FamilyMemberHistory() {
981    super();
982  }
983
984  /**
985   * Constructor
986   */
987  public FamilyMemberHistory(Enumeration<FamilyHistoryStatus> status, Reference patient, CodeableConcept relationship) {
988    super();
989    this.status = status;
990    this.patient = patient;
991    this.relationship = relationship;
992  }
993
994  /**
995   * @return {@link #identifier} (Business identifiers assigned to this family
996   *         member history by the performer or other systems which remain
997   *         constant as the resource is updated and propagates from server to
998   *         server.)
999   */
1000  public List<Identifier> getIdentifier() {
1001    if (this.identifier == null)
1002      this.identifier = new ArrayList<Identifier>();
1003    return this.identifier;
1004  }
1005
1006  /**
1007   * @return Returns a reference to <code>this</code> for easy method chaining
1008   */
1009  public FamilyMemberHistory setIdentifier(List<Identifier> theIdentifier) {
1010    this.identifier = theIdentifier;
1011    return this;
1012  }
1013
1014  public boolean hasIdentifier() {
1015    if (this.identifier == null)
1016      return false;
1017    for (Identifier item : this.identifier)
1018      if (!item.isEmpty())
1019        return true;
1020    return false;
1021  }
1022
1023  public Identifier addIdentifier() { // 3
1024    Identifier t = new Identifier();
1025    if (this.identifier == null)
1026      this.identifier = new ArrayList<Identifier>();
1027    this.identifier.add(t);
1028    return t;
1029  }
1030
1031  public FamilyMemberHistory addIdentifier(Identifier t) { // 3
1032    if (t == null)
1033      return this;
1034    if (this.identifier == null)
1035      this.identifier = new ArrayList<Identifier>();
1036    this.identifier.add(t);
1037    return this;
1038  }
1039
1040  /**
1041   * @return The first repetition of repeating field {@link #identifier}, creating
1042   *         it if it does not already exist
1043   */
1044  public Identifier getIdentifierFirstRep() {
1045    if (getIdentifier().isEmpty()) {
1046      addIdentifier();
1047    }
1048    return getIdentifier().get(0);
1049  }
1050
1051  /**
1052   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
1053   *         protocol, guideline, orderset or other definition that is adhered to
1054   *         in whole or in part by this FamilyMemberHistory.)
1055   */
1056  public List<CanonicalType> getInstantiatesCanonical() {
1057    if (this.instantiatesCanonical == null)
1058      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1059    return this.instantiatesCanonical;
1060  }
1061
1062  /**
1063   * @return Returns a reference to <code>this</code> for easy method chaining
1064   */
1065  public FamilyMemberHistory setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) {
1066    this.instantiatesCanonical = theInstantiatesCanonical;
1067    return this;
1068  }
1069
1070  public boolean hasInstantiatesCanonical() {
1071    if (this.instantiatesCanonical == null)
1072      return false;
1073    for (CanonicalType item : this.instantiatesCanonical)
1074      if (!item.isEmpty())
1075        return true;
1076    return false;
1077  }
1078
1079  /**
1080   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
1081   *         protocol, guideline, orderset or other definition that is adhered to
1082   *         in whole or in part by this FamilyMemberHistory.)
1083   */
1084  public CanonicalType addInstantiatesCanonicalElement() {// 2
1085    CanonicalType t = new CanonicalType();
1086    if (this.instantiatesCanonical == null)
1087      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1088    this.instantiatesCanonical.add(t);
1089    return t;
1090  }
1091
1092  /**
1093   * @param value {@link #instantiatesCanonical} (The URL pointing to a
1094   *              FHIR-defined protocol, guideline, orderset or other definition
1095   *              that is adhered to in whole or in part by this
1096   *              FamilyMemberHistory.)
1097   */
1098  public FamilyMemberHistory addInstantiatesCanonical(String value) { // 1
1099    CanonicalType t = new CanonicalType();
1100    t.setValue(value);
1101    if (this.instantiatesCanonical == null)
1102      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1103    this.instantiatesCanonical.add(t);
1104    return this;
1105  }
1106
1107  /**
1108   * @param value {@link #instantiatesCanonical} (The URL pointing to a
1109   *              FHIR-defined protocol, guideline, orderset or other definition
1110   *              that is adhered to in whole or in part by this
1111   *              FamilyMemberHistory.)
1112   */
1113  public boolean hasInstantiatesCanonical(String value) {
1114    if (this.instantiatesCanonical == null)
1115      return false;
1116    for (CanonicalType v : this.instantiatesCanonical)
1117      if (v.getValue().equals(value)) // canonical(PlanDefinition|Questionnaire|ActivityDefinition|Measure|OperationDefinition)
1118        return true;
1119    return false;
1120  }
1121
1122  /**
1123   * @return {@link #instantiatesUri} (The URL pointing to an externally
1124   *         maintained protocol, guideline, orderset or other definition that is
1125   *         adhered to in whole or in part by this FamilyMemberHistory.)
1126   */
1127  public List<UriType> getInstantiatesUri() {
1128    if (this.instantiatesUri == null)
1129      this.instantiatesUri = new ArrayList<UriType>();
1130    return this.instantiatesUri;
1131  }
1132
1133  /**
1134   * @return Returns a reference to <code>this</code> for easy method chaining
1135   */
1136  public FamilyMemberHistory setInstantiatesUri(List<UriType> theInstantiatesUri) {
1137    this.instantiatesUri = theInstantiatesUri;
1138    return this;
1139  }
1140
1141  public boolean hasInstantiatesUri() {
1142    if (this.instantiatesUri == null)
1143      return false;
1144    for (UriType item : this.instantiatesUri)
1145      if (!item.isEmpty())
1146        return true;
1147    return false;
1148  }
1149
1150  /**
1151   * @return {@link #instantiatesUri} (The URL pointing to an externally
1152   *         maintained protocol, guideline, orderset or other definition that is
1153   *         adhered to in whole or in part by this FamilyMemberHistory.)
1154   */
1155  public UriType addInstantiatesUriElement() {// 2
1156    UriType t = new UriType();
1157    if (this.instantiatesUri == null)
1158      this.instantiatesUri = new ArrayList<UriType>();
1159    this.instantiatesUri.add(t);
1160    return t;
1161  }
1162
1163  /**
1164   * @param value {@link #instantiatesUri} (The URL pointing to an externally
1165   *              maintained protocol, guideline, orderset or other definition
1166   *              that is adhered to in whole or in part by this
1167   *              FamilyMemberHistory.)
1168   */
1169  public FamilyMemberHistory addInstantiatesUri(String value) { // 1
1170    UriType t = new UriType();
1171    t.setValue(value);
1172    if (this.instantiatesUri == null)
1173      this.instantiatesUri = new ArrayList<UriType>();
1174    this.instantiatesUri.add(t);
1175    return this;
1176  }
1177
1178  /**
1179   * @param value {@link #instantiatesUri} (The URL pointing to an externally
1180   *              maintained protocol, guideline, orderset or other definition
1181   *              that is adhered to in whole or in part by this
1182   *              FamilyMemberHistory.)
1183   */
1184  public boolean hasInstantiatesUri(String value) {
1185    if (this.instantiatesUri == null)
1186      return false;
1187    for (UriType v : this.instantiatesUri)
1188      if (v.getValue().equals(value)) // uri
1189        return true;
1190    return false;
1191  }
1192
1193  /**
1194   * @return {@link #status} (A code specifying the status of the record of the
1195   *         family history of a specific family member.). This is the underlying
1196   *         object with id, value and extensions. The accessor "getStatus" gives
1197   *         direct access to the value
1198   */
1199  public Enumeration<FamilyHistoryStatus> getStatusElement() {
1200    if (this.status == null)
1201      if (Configuration.errorOnAutoCreate())
1202        throw new Error("Attempt to auto-create FamilyMemberHistory.status");
1203      else if (Configuration.doAutoCreate())
1204        this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory()); // bb
1205    return this.status;
1206  }
1207
1208  public boolean hasStatusElement() {
1209    return this.status != null && !this.status.isEmpty();
1210  }
1211
1212  public boolean hasStatus() {
1213    return this.status != null && !this.status.isEmpty();
1214  }
1215
1216  /**
1217   * @param value {@link #status} (A code specifying the status of the record of
1218   *              the family history of a specific family member.). This is the
1219   *              underlying object with id, value and extensions. The accessor
1220   *              "getStatus" gives direct access to the value
1221   */
1222  public FamilyMemberHistory setStatusElement(Enumeration<FamilyHistoryStatus> value) {
1223    this.status = value;
1224    return this;
1225  }
1226
1227  /**
1228   * @return A code specifying the status of the record of the family history of a
1229   *         specific family member.
1230   */
1231  public FamilyHistoryStatus getStatus() {
1232    return this.status == null ? null : this.status.getValue();
1233  }
1234
1235  /**
1236   * @param value A code specifying the status of the record of the family history
1237   *              of a specific family member.
1238   */
1239  public FamilyMemberHistory setStatus(FamilyHistoryStatus value) {
1240    if (this.status == null)
1241      this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory());
1242    this.status.setValue(value);
1243    return this;
1244  }
1245
1246  /**
1247   * @return {@link #dataAbsentReason} (Describes why the family member's history
1248   *         is not available.)
1249   */
1250  public CodeableConcept getDataAbsentReason() {
1251    if (this.dataAbsentReason == null)
1252      if (Configuration.errorOnAutoCreate())
1253        throw new Error("Attempt to auto-create FamilyMemberHistory.dataAbsentReason");
1254      else if (Configuration.doAutoCreate())
1255        this.dataAbsentReason = new CodeableConcept(); // cc
1256    return this.dataAbsentReason;
1257  }
1258
1259  public boolean hasDataAbsentReason() {
1260    return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty();
1261  }
1262
1263  /**
1264   * @param value {@link #dataAbsentReason} (Describes why the family member's
1265   *              history is not available.)
1266   */
1267  public FamilyMemberHistory setDataAbsentReason(CodeableConcept value) {
1268    this.dataAbsentReason = value;
1269    return this;
1270  }
1271
1272  /**
1273   * @return {@link #patient} (The person who this history concerns.)
1274   */
1275  public Reference getPatient() {
1276    if (this.patient == null)
1277      if (Configuration.errorOnAutoCreate())
1278        throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
1279      else if (Configuration.doAutoCreate())
1280        this.patient = new Reference(); // cc
1281    return this.patient;
1282  }
1283
1284  public boolean hasPatient() {
1285    return this.patient != null && !this.patient.isEmpty();
1286  }
1287
1288  /**
1289   * @param value {@link #patient} (The person who this history concerns.)
1290   */
1291  public FamilyMemberHistory setPatient(Reference value) {
1292    this.patient = value;
1293    return this;
1294  }
1295
1296  /**
1297   * @return {@link #patient} The actual object that is the target of the
1298   *         reference. The reference library doesn't populate this, but you can
1299   *         use it to hold the resource if you resolve it. (The person who this
1300   *         history concerns.)
1301   */
1302  public Patient getPatientTarget() {
1303    if (this.patientTarget == null)
1304      if (Configuration.errorOnAutoCreate())
1305        throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
1306      else if (Configuration.doAutoCreate())
1307        this.patientTarget = new Patient(); // aa
1308    return this.patientTarget;
1309  }
1310
1311  /**
1312   * @param value {@link #patient} The actual object that is the target of the
1313   *              reference. The reference library doesn't use these, but you can
1314   *              use it to hold the resource if you resolve it. (The person who
1315   *              this history concerns.)
1316   */
1317  public FamilyMemberHistory setPatientTarget(Patient value) {
1318    this.patientTarget = value;
1319    return this;
1320  }
1321
1322  /**
1323   * @return {@link #date} (The date (and possibly time) when the family member
1324   *         history was recorded or last updated.). This is the underlying object
1325   *         with id, value and extensions. The accessor "getDate" gives direct
1326   *         access to the value
1327   */
1328  public DateTimeType getDateElement() {
1329    if (this.date == null)
1330      if (Configuration.errorOnAutoCreate())
1331        throw new Error("Attempt to auto-create FamilyMemberHistory.date");
1332      else if (Configuration.doAutoCreate())
1333        this.date = new DateTimeType(); // bb
1334    return this.date;
1335  }
1336
1337  public boolean hasDateElement() {
1338    return this.date != null && !this.date.isEmpty();
1339  }
1340
1341  public boolean hasDate() {
1342    return this.date != null && !this.date.isEmpty();
1343  }
1344
1345  /**
1346   * @param value {@link #date} (The date (and possibly time) when the family
1347   *              member history was recorded or last updated.). This is the
1348   *              underlying object with id, value and extensions. The accessor
1349   *              "getDate" gives direct access to the value
1350   */
1351  public FamilyMemberHistory setDateElement(DateTimeType value) {
1352    this.date = value;
1353    return this;
1354  }
1355
1356  /**
1357   * @return The date (and possibly time) when the family member history was
1358   *         recorded or last updated.
1359   */
1360  public Date getDate() {
1361    return this.date == null ? null : this.date.getValue();
1362  }
1363
1364  /**
1365   * @param value The date (and possibly time) when the family member history was
1366   *              recorded or last updated.
1367   */
1368  public FamilyMemberHistory setDate(Date value) {
1369    if (value == null)
1370      this.date = null;
1371    else {
1372      if (this.date == null)
1373        this.date = new DateTimeType();
1374      this.date.setValue(value);
1375    }
1376    return this;
1377  }
1378
1379  /**
1380   * @return {@link #name} (This will either be a name or a description; e.g.
1381   *         "Aunt Susan", "my cousin with the red hair".). This is the underlying
1382   *         object with id, value and extensions. The accessor "getName" gives
1383   *         direct access to the value
1384   */
1385  public StringType getNameElement() {
1386    if (this.name == null)
1387      if (Configuration.errorOnAutoCreate())
1388        throw new Error("Attempt to auto-create FamilyMemberHistory.name");
1389      else if (Configuration.doAutoCreate())
1390        this.name = new StringType(); // bb
1391    return this.name;
1392  }
1393
1394  public boolean hasNameElement() {
1395    return this.name != null && !this.name.isEmpty();
1396  }
1397
1398  public boolean hasName() {
1399    return this.name != null && !this.name.isEmpty();
1400  }
1401
1402  /**
1403   * @param value {@link #name} (This will either be a name or a description; e.g.
1404   *              "Aunt Susan", "my cousin with the red hair".). This is the
1405   *              underlying object with id, value and extensions. The accessor
1406   *              "getName" gives direct access to the value
1407   */
1408  public FamilyMemberHistory setNameElement(StringType value) {
1409    this.name = value;
1410    return this;
1411  }
1412
1413  /**
1414   * @return This will either be a name or a description; e.g. "Aunt Susan", "my
1415   *         cousin with the red hair".
1416   */
1417  public String getName() {
1418    return this.name == null ? null : this.name.getValue();
1419  }
1420
1421  /**
1422   * @param value This will either be a name or a description; e.g. "Aunt Susan",
1423   *              "my cousin with the red hair".
1424   */
1425  public FamilyMemberHistory setName(String value) {
1426    if (Utilities.noString(value))
1427      this.name = null;
1428    else {
1429      if (this.name == null)
1430        this.name = new StringType();
1431      this.name.setValue(value);
1432    }
1433    return this;
1434  }
1435
1436  /**
1437   * @return {@link #relationship} (The type of relationship this person has to
1438   *         the patient (father, mother, brother etc.).)
1439   */
1440  public CodeableConcept getRelationship() {
1441    if (this.relationship == null)
1442      if (Configuration.errorOnAutoCreate())
1443        throw new Error("Attempt to auto-create FamilyMemberHistory.relationship");
1444      else if (Configuration.doAutoCreate())
1445        this.relationship = new CodeableConcept(); // cc
1446    return this.relationship;
1447  }
1448
1449  public boolean hasRelationship() {
1450    return this.relationship != null && !this.relationship.isEmpty();
1451  }
1452
1453  /**
1454   * @param value {@link #relationship} (The type of relationship this person has
1455   *              to the patient (father, mother, brother etc.).)
1456   */
1457  public FamilyMemberHistory setRelationship(CodeableConcept value) {
1458    this.relationship = value;
1459    return this;
1460  }
1461
1462  /**
1463   * @return {@link #sex} (The birth sex of the family member.)
1464   */
1465  public CodeableConcept getSex() {
1466    if (this.sex == null)
1467      if (Configuration.errorOnAutoCreate())
1468        throw new Error("Attempt to auto-create FamilyMemberHistory.sex");
1469      else if (Configuration.doAutoCreate())
1470        this.sex = new CodeableConcept(); // cc
1471    return this.sex;
1472  }
1473
1474  public boolean hasSex() {
1475    return this.sex != null && !this.sex.isEmpty();
1476  }
1477
1478  /**
1479   * @param value {@link #sex} (The birth sex of the family member.)
1480   */
1481  public FamilyMemberHistory setSex(CodeableConcept value) {
1482    this.sex = value;
1483    return this;
1484  }
1485
1486  /**
1487   * @return {@link #born} (The actual or approximate date of birth of the
1488   *         relative.)
1489   */
1490  public Type getBorn() {
1491    return this.born;
1492  }
1493
1494  /**
1495   * @return {@link #born} (The actual or approximate date of birth of the
1496   *         relative.)
1497   */
1498  public Period getBornPeriod() throws FHIRException {
1499    if (this.born == null)
1500      this.born = new Period();
1501    if (!(this.born instanceof Period))
1502      throw new FHIRException(
1503          "Type mismatch: the type Period was expected, but " + this.born.getClass().getName() + " was encountered");
1504    return (Period) this.born;
1505  }
1506
1507  public boolean hasBornPeriod() {
1508    return this != null && this.born instanceof Period;
1509  }
1510
1511  /**
1512   * @return {@link #born} (The actual or approximate date of birth of the
1513   *         relative.)
1514   */
1515  public DateType getBornDateType() throws FHIRException {
1516    if (this.born == null)
1517      this.born = new DateType();
1518    if (!(this.born instanceof DateType))
1519      throw new FHIRException(
1520          "Type mismatch: the type DateType was expected, but " + this.born.getClass().getName() + " was encountered");
1521    return (DateType) this.born;
1522  }
1523
1524  public boolean hasBornDateType() {
1525    return this != null && this.born instanceof DateType;
1526  }
1527
1528  /**
1529   * @return {@link #born} (The actual or approximate date of birth of the
1530   *         relative.)
1531   */
1532  public StringType getBornStringType() throws FHIRException {
1533    if (this.born == null)
1534      this.born = new StringType();
1535    if (!(this.born instanceof StringType))
1536      throw new FHIRException("Type mismatch: the type StringType was expected, but " + this.born.getClass().getName()
1537          + " was encountered");
1538    return (StringType) this.born;
1539  }
1540
1541  public boolean hasBornStringType() {
1542    return this != null && this.born instanceof StringType;
1543  }
1544
1545  public boolean hasBorn() {
1546    return this.born != null && !this.born.isEmpty();
1547  }
1548
1549  /**
1550   * @param value {@link #born} (The actual or approximate date of birth of the
1551   *              relative.)
1552   */
1553  public FamilyMemberHistory setBorn(Type value) {
1554    if (value != null && !(value instanceof Period || value instanceof DateType || value instanceof StringType))
1555      throw new Error("Not the right type for FamilyMemberHistory.born[x]: " + value.fhirType());
1556    this.born = value;
1557    return this;
1558  }
1559
1560  /**
1561   * @return {@link #age} (The age of the relative at the time the family member
1562   *         history is recorded.)
1563   */
1564  public Type getAge() {
1565    return this.age;
1566  }
1567
1568  /**
1569   * @return {@link #age} (The age of the relative at the time the family member
1570   *         history is recorded.)
1571   */
1572  public Age getAgeAge() throws FHIRException {
1573    if (this.age == null)
1574      this.age = new Age();
1575    if (!(this.age instanceof Age))
1576      throw new FHIRException(
1577          "Type mismatch: the type Age was expected, but " + this.age.getClass().getName() + " was encountered");
1578    return (Age) this.age;
1579  }
1580
1581  public boolean hasAgeAge() {
1582    return this != null && this.age instanceof Age;
1583  }
1584
1585  /**
1586   * @return {@link #age} (The age of the relative at the time the family member
1587   *         history is recorded.)
1588   */
1589  public Range getAgeRange() throws FHIRException {
1590    if (this.age == null)
1591      this.age = new Range();
1592    if (!(this.age instanceof Range))
1593      throw new FHIRException(
1594          "Type mismatch: the type Range was expected, but " + this.age.getClass().getName() + " was encountered");
1595    return (Range) this.age;
1596  }
1597
1598  public boolean hasAgeRange() {
1599    return this != null && this.age instanceof Range;
1600  }
1601
1602  /**
1603   * @return {@link #age} (The age of the relative at the time the family member
1604   *         history is recorded.)
1605   */
1606  public StringType getAgeStringType() throws FHIRException {
1607    if (this.age == null)
1608      this.age = new StringType();
1609    if (!(this.age instanceof StringType))
1610      throw new FHIRException(
1611          "Type mismatch: the type StringType was expected, but " + this.age.getClass().getName() + " was encountered");
1612    return (StringType) this.age;
1613  }
1614
1615  public boolean hasAgeStringType() {
1616    return this != null && this.age instanceof StringType;
1617  }
1618
1619  public boolean hasAge() {
1620    return this.age != null && !this.age.isEmpty();
1621  }
1622
1623  /**
1624   * @param value {@link #age} (The age of the relative at the time the family
1625   *              member history is recorded.)
1626   */
1627  public FamilyMemberHistory setAge(Type value) {
1628    if (value != null && !(value instanceof Age || value instanceof Range || value instanceof StringType))
1629      throw new Error("Not the right type for FamilyMemberHistory.age[x]: " + value.fhirType());
1630    this.age = value;
1631    return this;
1632  }
1633
1634  /**
1635   * @return {@link #estimatedAge} (If true, indicates that the age value
1636   *         specified is an estimated value.). This is the underlying object with
1637   *         id, value and extensions. The accessor "getEstimatedAge" gives direct
1638   *         access to the value
1639   */
1640  public BooleanType getEstimatedAgeElement() {
1641    if (this.estimatedAge == null)
1642      if (Configuration.errorOnAutoCreate())
1643        throw new Error("Attempt to auto-create FamilyMemberHistory.estimatedAge");
1644      else if (Configuration.doAutoCreate())
1645        this.estimatedAge = new BooleanType(); // bb
1646    return this.estimatedAge;
1647  }
1648
1649  public boolean hasEstimatedAgeElement() {
1650    return this.estimatedAge != null && !this.estimatedAge.isEmpty();
1651  }
1652
1653  public boolean hasEstimatedAge() {
1654    return this.estimatedAge != null && !this.estimatedAge.isEmpty();
1655  }
1656
1657  /**
1658   * @param value {@link #estimatedAge} (If true, indicates that the age value
1659   *              specified is an estimated value.). This is the underlying object
1660   *              with id, value and extensions. The accessor "getEstimatedAge"
1661   *              gives direct access to the value
1662   */
1663  public FamilyMemberHistory setEstimatedAgeElement(BooleanType value) {
1664    this.estimatedAge = value;
1665    return this;
1666  }
1667
1668  /**
1669   * @return If true, indicates that the age value specified is an estimated
1670   *         value.
1671   */
1672  public boolean getEstimatedAge() {
1673    return this.estimatedAge == null || this.estimatedAge.isEmpty() ? false : this.estimatedAge.getValue();
1674  }
1675
1676  /**
1677   * @param value If true, indicates that the age value specified is an estimated
1678   *              value.
1679   */
1680  public FamilyMemberHistory setEstimatedAge(boolean value) {
1681    if (this.estimatedAge == null)
1682      this.estimatedAge = new BooleanType();
1683    this.estimatedAge.setValue(value);
1684    return this;
1685  }
1686
1687  /**
1688   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1689   *         the relative at the time of death for the family member history
1690   *         record.)
1691   */
1692  public Type getDeceased() {
1693    return this.deceased;
1694  }
1695
1696  /**
1697   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1698   *         the relative at the time of death for the family member history
1699   *         record.)
1700   */
1701  public BooleanType getDeceasedBooleanType() throws FHIRException {
1702    if (this.deceased == null)
1703      this.deceased = new BooleanType();
1704    if (!(this.deceased instanceof BooleanType))
1705      throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1706          + this.deceased.getClass().getName() + " was encountered");
1707    return (BooleanType) this.deceased;
1708  }
1709
1710  public boolean hasDeceasedBooleanType() {
1711    return this != null && this.deceased instanceof BooleanType;
1712  }
1713
1714  /**
1715   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1716   *         the relative at the time of death for the family member history
1717   *         record.)
1718   */
1719  public Age getDeceasedAge() throws FHIRException {
1720    if (this.deceased == null)
1721      this.deceased = new Age();
1722    if (!(this.deceased instanceof Age))
1723      throw new FHIRException(
1724          "Type mismatch: the type Age was expected, but " + this.deceased.getClass().getName() + " was encountered");
1725    return (Age) this.deceased;
1726  }
1727
1728  public boolean hasDeceasedAge() {
1729    return this != null && this.deceased instanceof Age;
1730  }
1731
1732  /**
1733   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1734   *         the relative at the time of death for the family member history
1735   *         record.)
1736   */
1737  public Range getDeceasedRange() throws FHIRException {
1738    if (this.deceased == null)
1739      this.deceased = new Range();
1740    if (!(this.deceased instanceof Range))
1741      throw new FHIRException(
1742          "Type mismatch: the type Range was expected, but " + this.deceased.getClass().getName() + " was encountered");
1743    return (Range) this.deceased;
1744  }
1745
1746  public boolean hasDeceasedRange() {
1747    return this != null && this.deceased instanceof Range;
1748  }
1749
1750  /**
1751   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1752   *         the relative at the time of death for the family member history
1753   *         record.)
1754   */
1755  public DateType getDeceasedDateType() throws FHIRException {
1756    if (this.deceased == null)
1757      this.deceased = new DateType();
1758    if (!(this.deceased instanceof DateType))
1759      throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.deceased.getClass().getName()
1760          + " was encountered");
1761    return (DateType) this.deceased;
1762  }
1763
1764  public boolean hasDeceasedDateType() {
1765    return this != null && this.deceased instanceof DateType;
1766  }
1767
1768  /**
1769   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1770   *         the relative at the time of death for the family member history
1771   *         record.)
1772   */
1773  public StringType getDeceasedStringType() throws FHIRException {
1774    if (this.deceased == null)
1775      this.deceased = new StringType();
1776    if (!(this.deceased instanceof StringType))
1777      throw new FHIRException("Type mismatch: the type StringType was expected, but "
1778          + this.deceased.getClass().getName() + " was encountered");
1779    return (StringType) this.deceased;
1780  }
1781
1782  public boolean hasDeceasedStringType() {
1783    return this != null && this.deceased instanceof StringType;
1784  }
1785
1786  public boolean hasDeceased() {
1787    return this.deceased != null && !this.deceased.isEmpty();
1788  }
1789
1790  /**
1791   * @param value {@link #deceased} (Deceased flag or the actual or approximate
1792   *              age of the relative at the time of death for the family member
1793   *              history record.)
1794   */
1795  public FamilyMemberHistory setDeceased(Type value) {
1796    if (value != null && !(value instanceof BooleanType || value instanceof Age || value instanceof Range
1797        || value instanceof DateType || value instanceof StringType))
1798      throw new Error("Not the right type for FamilyMemberHistory.deceased[x]: " + value.fhirType());
1799    this.deceased = value;
1800    return this;
1801  }
1802
1803  /**
1804   * @return {@link #reasonCode} (Describes why the family member history occurred
1805   *         in coded or textual form.)
1806   */
1807  public List<CodeableConcept> getReasonCode() {
1808    if (this.reasonCode == null)
1809      this.reasonCode = new ArrayList<CodeableConcept>();
1810    return this.reasonCode;
1811  }
1812
1813  /**
1814   * @return Returns a reference to <code>this</code> for easy method chaining
1815   */
1816  public FamilyMemberHistory setReasonCode(List<CodeableConcept> theReasonCode) {
1817    this.reasonCode = theReasonCode;
1818    return this;
1819  }
1820
1821  public boolean hasReasonCode() {
1822    if (this.reasonCode == null)
1823      return false;
1824    for (CodeableConcept item : this.reasonCode)
1825      if (!item.isEmpty())
1826        return true;
1827    return false;
1828  }
1829
1830  public CodeableConcept addReasonCode() { // 3
1831    CodeableConcept t = new CodeableConcept();
1832    if (this.reasonCode == null)
1833      this.reasonCode = new ArrayList<CodeableConcept>();
1834    this.reasonCode.add(t);
1835    return t;
1836  }
1837
1838  public FamilyMemberHistory addReasonCode(CodeableConcept t) { // 3
1839    if (t == null)
1840      return this;
1841    if (this.reasonCode == null)
1842      this.reasonCode = new ArrayList<CodeableConcept>();
1843    this.reasonCode.add(t);
1844    return this;
1845  }
1846
1847  /**
1848   * @return The first repetition of repeating field {@link #reasonCode}, creating
1849   *         it if it does not already exist
1850   */
1851  public CodeableConcept getReasonCodeFirstRep() {
1852    if (getReasonCode().isEmpty()) {
1853      addReasonCode();
1854    }
1855    return getReasonCode().get(0);
1856  }
1857
1858  /**
1859   * @return {@link #reasonReference} (Indicates a Condition, Observation,
1860   *         AllergyIntolerance, or QuestionnaireResponse that justifies this
1861   *         family member history event.)
1862   */
1863  public List<Reference> getReasonReference() {
1864    if (this.reasonReference == null)
1865      this.reasonReference = new ArrayList<Reference>();
1866    return this.reasonReference;
1867  }
1868
1869  /**
1870   * @return Returns a reference to <code>this</code> for easy method chaining
1871   */
1872  public FamilyMemberHistory setReasonReference(List<Reference> theReasonReference) {
1873    this.reasonReference = theReasonReference;
1874    return this;
1875  }
1876
1877  public boolean hasReasonReference() {
1878    if (this.reasonReference == null)
1879      return false;
1880    for (Reference item : this.reasonReference)
1881      if (!item.isEmpty())
1882        return true;
1883    return false;
1884  }
1885
1886  public Reference addReasonReference() { // 3
1887    Reference t = new Reference();
1888    if (this.reasonReference == null)
1889      this.reasonReference = new ArrayList<Reference>();
1890    this.reasonReference.add(t);
1891    return t;
1892  }
1893
1894  public FamilyMemberHistory addReasonReference(Reference t) { // 3
1895    if (t == null)
1896      return this;
1897    if (this.reasonReference == null)
1898      this.reasonReference = new ArrayList<Reference>();
1899    this.reasonReference.add(t);
1900    return this;
1901  }
1902
1903  /**
1904   * @return The first repetition of repeating field {@link #reasonReference},
1905   *         creating it if it does not already exist
1906   */
1907  public Reference getReasonReferenceFirstRep() {
1908    if (getReasonReference().isEmpty()) {
1909      addReasonReference();
1910    }
1911    return getReasonReference().get(0);
1912  }
1913
1914  /**
1915   * @deprecated Use Reference#setResource(IBaseResource) instead
1916   */
1917  @Deprecated
1918  public List<Resource> getReasonReferenceTarget() {
1919    if (this.reasonReferenceTarget == null)
1920      this.reasonReferenceTarget = new ArrayList<Resource>();
1921    return this.reasonReferenceTarget;
1922  }
1923
1924  /**
1925   * @return {@link #note} (This property allows a non condition-specific note to
1926   *         the made about the related person. Ideally, the note would be in the
1927   *         condition property, but this is not always possible.)
1928   */
1929  public List<Annotation> getNote() {
1930    if (this.note == null)
1931      this.note = new ArrayList<Annotation>();
1932    return this.note;
1933  }
1934
1935  /**
1936   * @return Returns a reference to <code>this</code> for easy method chaining
1937   */
1938  public FamilyMemberHistory setNote(List<Annotation> theNote) {
1939    this.note = theNote;
1940    return this;
1941  }
1942
1943  public boolean hasNote() {
1944    if (this.note == null)
1945      return false;
1946    for (Annotation item : this.note)
1947      if (!item.isEmpty())
1948        return true;
1949    return false;
1950  }
1951
1952  public Annotation addNote() { // 3
1953    Annotation t = new Annotation();
1954    if (this.note == null)
1955      this.note = new ArrayList<Annotation>();
1956    this.note.add(t);
1957    return t;
1958  }
1959
1960  public FamilyMemberHistory addNote(Annotation t) { // 3
1961    if (t == null)
1962      return this;
1963    if (this.note == null)
1964      this.note = new ArrayList<Annotation>();
1965    this.note.add(t);
1966    return this;
1967  }
1968
1969  /**
1970   * @return The first repetition of repeating field {@link #note}, creating it if
1971   *         it does not already exist
1972   */
1973  public Annotation getNoteFirstRep() {
1974    if (getNote().isEmpty()) {
1975      addNote();
1976    }
1977    return getNote().get(0);
1978  }
1979
1980  /**
1981   * @return {@link #condition} (The significant Conditions (or condition) that
1982   *         the family member had. This is a repeating section to allow a system
1983   *         to represent more than one condition per resource, though there is
1984   *         nothing stopping multiple resources - one per condition.)
1985   */
1986  public List<FamilyMemberHistoryConditionComponent> getCondition() {
1987    if (this.condition == null)
1988      this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1989    return this.condition;
1990  }
1991
1992  /**
1993   * @return Returns a reference to <code>this</code> for easy method chaining
1994   */
1995  public FamilyMemberHistory setCondition(List<FamilyMemberHistoryConditionComponent> theCondition) {
1996    this.condition = theCondition;
1997    return this;
1998  }
1999
2000  public boolean hasCondition() {
2001    if (this.condition == null)
2002      return false;
2003    for (FamilyMemberHistoryConditionComponent item : this.condition)
2004      if (!item.isEmpty())
2005        return true;
2006    return false;
2007  }
2008
2009  public FamilyMemberHistoryConditionComponent addCondition() { // 3
2010    FamilyMemberHistoryConditionComponent t = new FamilyMemberHistoryConditionComponent();
2011    if (this.condition == null)
2012      this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2013    this.condition.add(t);
2014    return t;
2015  }
2016
2017  public FamilyMemberHistory addCondition(FamilyMemberHistoryConditionComponent t) { // 3
2018    if (t == null)
2019      return this;
2020    if (this.condition == null)
2021      this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2022    this.condition.add(t);
2023    return this;
2024  }
2025
2026  /**
2027   * @return The first repetition of repeating field {@link #condition}, creating
2028   *         it if it does not already exist
2029   */
2030  public FamilyMemberHistoryConditionComponent getConditionFirstRep() {
2031    if (getCondition().isEmpty()) {
2032      addCondition();
2033    }
2034    return getCondition().get(0);
2035  }
2036
2037  protected void listChildren(List<Property> children) {
2038    super.listChildren(children);
2039    children.add(new Property("identifier", "Identifier",
2040        "Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.",
2041        0, java.lang.Integer.MAX_VALUE, identifier));
2042    children.add(new Property("instantiatesCanonical",
2043        "canonical(PlanDefinition|Questionnaire|ActivityDefinition|Measure|OperationDefinition)",
2044        "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2045        0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2046    children.add(new Property("instantiatesUri", "uri",
2047        "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2048        0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2049    children.add(new Property("status", "code",
2050        "A code specifying the status of the record of the family history of a specific family member.", 0, 1, status));
2051    children.add(new Property("dataAbsentReason", "CodeableConcept",
2052        "Describes why the family member's history is not available.", 0, 1, dataAbsentReason));
2053    children.add(new Property("patient", "Reference(Patient)", "The person who this history concerns.", 0, 1, patient));
2054    children.add(new Property("date", "dateTime",
2055        "The date (and possibly time) when the family member history was recorded or last updated.", 0, 1, date));
2056    children.add(new Property("name", "string",
2057        "This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\".", 0, 1,
2058        name));
2059    children.add(new Property("relationship", "CodeableConcept",
2060        "The type of relationship this person has to the patient (father, mother, brother etc.).", 0, 1, relationship));
2061    children.add(new Property("sex", "CodeableConcept", "The birth sex of the family member.", 0, 1, sex));
2062    children.add(new Property("born[x]", "Period|date|string",
2063        "The actual or approximate date of birth of the relative.", 0, 1, born));
2064    children.add(new Property("age[x]", "Age|Range|string",
2065        "The age of the relative at the time the family member history is recorded.", 0, 1, age));
2066    children.add(new Property("estimatedAge", "boolean",
2067        "If true, indicates that the age value specified is an estimated value.", 0, 1, estimatedAge));
2068    children.add(new Property("deceased[x]", "boolean|Age|Range|date|string",
2069        "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2070        0, 1, deceased));
2071    children.add(new Property("reasonCode", "CodeableConcept",
2072        "Describes why the family member history occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE,
2073        reasonCode));
2074    children.add(new Property("reasonReference",
2075        "Reference(Condition|Observation|AllergyIntolerance|QuestionnaireResponse|DiagnosticReport|DocumentReference)",
2076        "Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.",
2077        0, java.lang.Integer.MAX_VALUE, reasonReference));
2078    children.add(new Property("note", "Annotation",
2079        "This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.",
2080        0, java.lang.Integer.MAX_VALUE, note));
2081    children.add(new Property("condition", "",
2082        "The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.",
2083        0, java.lang.Integer.MAX_VALUE, condition));
2084  }
2085
2086  @Override
2087  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2088    switch (_hash) {
2089    case -1618432855:
2090      /* identifier */ return new Property("identifier", "Identifier",
2091          "Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.",
2092          0, java.lang.Integer.MAX_VALUE, identifier);
2093    case 8911915:
2094      /* instantiatesCanonical */ return new Property("instantiatesCanonical",
2095          "canonical(PlanDefinition|Questionnaire|ActivityDefinition|Measure|OperationDefinition)",
2096          "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2097          0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2098    case -1926393373:
2099      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
2100          "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2101          0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2102    case -892481550:
2103      /* status */ return new Property("status", "code",
2104          "A code specifying the status of the record of the family history of a specific family member.", 0, 1,
2105          status);
2106    case 1034315687:
2107      /* dataAbsentReason */ return new Property("dataAbsentReason", "CodeableConcept",
2108          "Describes why the family member's history is not available.", 0, 1, dataAbsentReason);
2109    case -791418107:
2110      /* patient */ return new Property("patient", "Reference(Patient)", "The person who this history concerns.", 0, 1,
2111          patient);
2112    case 3076014:
2113      /* date */ return new Property("date", "dateTime",
2114          "The date (and possibly time) when the family member history was recorded or last updated.", 0, 1, date);
2115    case 3373707:
2116      /* name */ return new Property("name", "string",
2117          "This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\".", 0, 1,
2118          name);
2119    case -261851592:
2120      /* relationship */ return new Property("relationship", "CodeableConcept",
2121          "The type of relationship this person has to the patient (father, mother, brother etc.).", 0, 1,
2122          relationship);
2123    case 113766:
2124      /* sex */ return new Property("sex", "CodeableConcept", "The birth sex of the family member.", 0, 1, sex);
2125    case 67532951:
2126      /* born[x] */ return new Property("born[x]", "Period|date|string",
2127          "The actual or approximate date of birth of the relative.", 0, 1, born);
2128    case 3029833:
2129      /* born */ return new Property("born[x]", "Period|date|string",
2130          "The actual or approximate date of birth of the relative.", 0, 1, born);
2131    case 1497711210:
2132      /* bornPeriod */ return new Property("born[x]", "Period|date|string",
2133          "The actual or approximate date of birth of the relative.", 0, 1, born);
2134    case 2092814999:
2135      /* bornDate */ return new Property("born[x]", "Period|date|string",
2136          "The actual or approximate date of birth of the relative.", 0, 1, born);
2137    case 1597451450:
2138      /* bornString */ return new Property("born[x]", "Period|date|string",
2139          "The actual or approximate date of birth of the relative.", 0, 1, born);
2140    case -1419716831:
2141      /* age[x] */ return new Property("age[x]", "Age|Range|string",
2142          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2143    case 96511:
2144      /* age */ return new Property("age[x]", "Age|Range|string",
2145          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2146    case -1419742336:
2147      /* ageAge */ return new Property("age[x]", "Age|Range|string",
2148          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2149    case 1442748286:
2150      /* ageRange */ return new Property("age[x]", "Age|Range|string",
2151          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2152    case 1821821424:
2153      /* ageString */ return new Property("age[x]", "Age|Range|string",
2154          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2155    case 2130167587:
2156      /* estimatedAge */ return new Property("estimatedAge", "boolean",
2157          "If true, indicates that the age value specified is an estimated value.", 0, 1, estimatedAge);
2158    case -1311442804:
2159      /* deceased[x] */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2160          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2161          0, 1, deceased);
2162    case 561497972:
2163      /* deceased */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2164          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2165          0, 1, deceased);
2166    case 497463828:
2167      /* deceasedBoolean */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2168          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2169          0, 1, deceased);
2170    case -1311468309:
2171      /* deceasedAge */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2172          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2173          0, 1, deceased);
2174    case -1880094167:
2175      /* deceasedRange */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2176          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2177          0, 1, deceased);
2178    case -2000727742:
2179      /* deceasedDate */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2180          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2181          0, 1, deceased);
2182    case 1892920485:
2183      /* deceasedString */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2184          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2185          0, 1, deceased);
2186    case 722137681:
2187      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
2188          "Describes why the family member history occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE,
2189          reasonCode);
2190    case -1146218137:
2191      /* reasonReference */ return new Property("reasonReference",
2192          "Reference(Condition|Observation|AllergyIntolerance|QuestionnaireResponse|DiagnosticReport|DocumentReference)",
2193          "Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.",
2194          0, java.lang.Integer.MAX_VALUE, reasonReference);
2195    case 3387378:
2196      /* note */ return new Property("note", "Annotation",
2197          "This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.",
2198          0, java.lang.Integer.MAX_VALUE, note);
2199    case -861311717:
2200      /* condition */ return new Property("condition", "",
2201          "The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.",
2202          0, java.lang.Integer.MAX_VALUE, condition);
2203    default:
2204      return super.getNamedProperty(_hash, _name, _checkValid);
2205    }
2206
2207  }
2208
2209  @Override
2210  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2211    switch (hash) {
2212    case -1618432855:
2213      /* identifier */ return this.identifier == null ? new Base[0]
2214          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2215    case 8911915:
2216      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
2217          : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2218    case -1926393373:
2219      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0]
2220          : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2221    case -892481550:
2222      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<FamilyHistoryStatus>
2223    case 1034315687:
2224      /* dataAbsentReason */ return this.dataAbsentReason == null ? new Base[0] : new Base[] { this.dataAbsentReason }; // CodeableConcept
2225    case -791418107:
2226      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
2227    case 3076014:
2228      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
2229    case 3373707:
2230      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
2231    case -261851592:
2232      /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // CodeableConcept
2233    case 113766:
2234      /* sex */ return this.sex == null ? new Base[0] : new Base[] { this.sex }; // CodeableConcept
2235    case 3029833:
2236      /* born */ return this.born == null ? new Base[0] : new Base[] { this.born }; // Type
2237    case 96511:
2238      /* age */ return this.age == null ? new Base[0] : new Base[] { this.age }; // Type
2239    case 2130167587:
2240      /* estimatedAge */ return this.estimatedAge == null ? new Base[0] : new Base[] { this.estimatedAge }; // BooleanType
2241    case 561497972:
2242      /* deceased */ return this.deceased == null ? new Base[0] : new Base[] { this.deceased }; // Type
2243    case 722137681:
2244      /* reasonCode */ return this.reasonCode == null ? new Base[0]
2245          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2246    case -1146218137:
2247      /* reasonReference */ return this.reasonReference == null ? new Base[0]
2248          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2249    case 3387378:
2250      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2251    case -861311717:
2252      /* condition */ return this.condition == null ? new Base[0]
2253          : this.condition.toArray(new Base[this.condition.size()]); // FamilyMemberHistoryConditionComponent
2254    default:
2255      return super.getProperty(hash, name, checkValid);
2256    }
2257
2258  }
2259
2260  @Override
2261  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2262    switch (hash) {
2263    case -1618432855: // identifier
2264      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2265      return value;
2266    case 8911915: // instantiatesCanonical
2267      this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2268      return value;
2269    case -1926393373: // instantiatesUri
2270      this.getInstantiatesUri().add(castToUri(value)); // UriType
2271      return value;
2272    case -892481550: // status
2273      value = new FamilyHistoryStatusEnumFactory().fromType(castToCode(value));
2274      this.status = (Enumeration) value; // Enumeration<FamilyHistoryStatus>
2275      return value;
2276    case 1034315687: // dataAbsentReason
2277      this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2278      return value;
2279    case -791418107: // patient
2280      this.patient = castToReference(value); // Reference
2281      return value;
2282    case 3076014: // date
2283      this.date = castToDateTime(value); // DateTimeType
2284      return value;
2285    case 3373707: // name
2286      this.name = castToString(value); // StringType
2287      return value;
2288    case -261851592: // relationship
2289      this.relationship = castToCodeableConcept(value); // CodeableConcept
2290      return value;
2291    case 113766: // sex
2292      this.sex = castToCodeableConcept(value); // CodeableConcept
2293      return value;
2294    case 3029833: // born
2295      this.born = castToType(value); // Type
2296      return value;
2297    case 96511: // age
2298      this.age = castToType(value); // Type
2299      return value;
2300    case 2130167587: // estimatedAge
2301      this.estimatedAge = castToBoolean(value); // BooleanType
2302      return value;
2303    case 561497972: // deceased
2304      this.deceased = castToType(value); // Type
2305      return value;
2306    case 722137681: // reasonCode
2307      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2308      return value;
2309    case -1146218137: // reasonReference
2310      this.getReasonReference().add(castToReference(value)); // Reference
2311      return value;
2312    case 3387378: // note
2313      this.getNote().add(castToAnnotation(value)); // Annotation
2314      return value;
2315    case -861311717: // condition
2316      this.getCondition().add((FamilyMemberHistoryConditionComponent) value); // FamilyMemberHistoryConditionComponent
2317      return value;
2318    default:
2319      return super.setProperty(hash, name, value);
2320    }
2321
2322  }
2323
2324  @Override
2325  public Base setProperty(String name, Base value) throws FHIRException {
2326    if (name.equals("identifier")) {
2327      this.getIdentifier().add(castToIdentifier(value));
2328    } else if (name.equals("instantiatesCanonical")) {
2329      this.getInstantiatesCanonical().add(castToCanonical(value));
2330    } else if (name.equals("instantiatesUri")) {
2331      this.getInstantiatesUri().add(castToUri(value));
2332    } else if (name.equals("status")) {
2333      value = new FamilyHistoryStatusEnumFactory().fromType(castToCode(value));
2334      this.status = (Enumeration) value; // Enumeration<FamilyHistoryStatus>
2335    } else if (name.equals("dataAbsentReason")) {
2336      this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2337    } else if (name.equals("patient")) {
2338      this.patient = castToReference(value); // Reference
2339    } else if (name.equals("date")) {
2340      this.date = castToDateTime(value); // DateTimeType
2341    } else if (name.equals("name")) {
2342      this.name = castToString(value); // StringType
2343    } else if (name.equals("relationship")) {
2344      this.relationship = castToCodeableConcept(value); // CodeableConcept
2345    } else if (name.equals("sex")) {
2346      this.sex = castToCodeableConcept(value); // CodeableConcept
2347    } else if (name.equals("born[x]")) {
2348      this.born = castToType(value); // Type
2349    } else if (name.equals("age[x]")) {
2350      this.age = castToType(value); // Type
2351    } else if (name.equals("estimatedAge")) {
2352      this.estimatedAge = castToBoolean(value); // BooleanType
2353    } else if (name.equals("deceased[x]")) {
2354      this.deceased = castToType(value); // Type
2355    } else if (name.equals("reasonCode")) {
2356      this.getReasonCode().add(castToCodeableConcept(value));
2357    } else if (name.equals("reasonReference")) {
2358      this.getReasonReference().add(castToReference(value));
2359    } else if (name.equals("note")) {
2360      this.getNote().add(castToAnnotation(value));
2361    } else if (name.equals("condition")) {
2362      this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
2363    } else
2364      return super.setProperty(name, value);
2365    return value;
2366  }
2367
2368  @Override
2369  public Base makeProperty(int hash, String name) throws FHIRException {
2370    switch (hash) {
2371    case -1618432855:
2372      return addIdentifier();
2373    case 8911915:
2374      return addInstantiatesCanonicalElement();
2375    case -1926393373:
2376      return addInstantiatesUriElement();
2377    case -892481550:
2378      return getStatusElement();
2379    case 1034315687:
2380      return getDataAbsentReason();
2381    case -791418107:
2382      return getPatient();
2383    case 3076014:
2384      return getDateElement();
2385    case 3373707:
2386      return getNameElement();
2387    case -261851592:
2388      return getRelationship();
2389    case 113766:
2390      return getSex();
2391    case 67532951:
2392      return getBorn();
2393    case 3029833:
2394      return getBorn();
2395    case -1419716831:
2396      return getAge();
2397    case 96511:
2398      return getAge();
2399    case 2130167587:
2400      return getEstimatedAgeElement();
2401    case -1311442804:
2402      return getDeceased();
2403    case 561497972:
2404      return getDeceased();
2405    case 722137681:
2406      return addReasonCode();
2407    case -1146218137:
2408      return addReasonReference();
2409    case 3387378:
2410      return addNote();
2411    case -861311717:
2412      return addCondition();
2413    default:
2414      return super.makeProperty(hash, name);
2415    }
2416
2417  }
2418
2419  @Override
2420  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2421    switch (hash) {
2422    case -1618432855:
2423      /* identifier */ return new String[] { "Identifier" };
2424    case 8911915:
2425      /* instantiatesCanonical */ return new String[] { "canonical" };
2426    case -1926393373:
2427      /* instantiatesUri */ return new String[] { "uri" };
2428    case -892481550:
2429      /* status */ return new String[] { "code" };
2430    case 1034315687:
2431      /* dataAbsentReason */ return new String[] { "CodeableConcept" };
2432    case -791418107:
2433      /* patient */ return new String[] { "Reference" };
2434    case 3076014:
2435      /* date */ return new String[] { "dateTime" };
2436    case 3373707:
2437      /* name */ return new String[] { "string" };
2438    case -261851592:
2439      /* relationship */ return new String[] { "CodeableConcept" };
2440    case 113766:
2441      /* sex */ return new String[] { "CodeableConcept" };
2442    case 3029833:
2443      /* born */ return new String[] { "Period", "date", "string" };
2444    case 96511:
2445      /* age */ return new String[] { "Age", "Range", "string" };
2446    case 2130167587:
2447      /* estimatedAge */ return new String[] { "boolean" };
2448    case 561497972:
2449      /* deceased */ return new String[] { "boolean", "Age", "Range", "date", "string" };
2450    case 722137681:
2451      /* reasonCode */ return new String[] { "CodeableConcept" };
2452    case -1146218137:
2453      /* reasonReference */ return new String[] { "Reference" };
2454    case 3387378:
2455      /* note */ return new String[] { "Annotation" };
2456    case -861311717:
2457      /* condition */ return new String[] {};
2458    default:
2459      return super.getTypesForProperty(hash, name);
2460    }
2461
2462  }
2463
2464  @Override
2465  public Base addChild(String name) throws FHIRException {
2466    if (name.equals("identifier")) {
2467      return addIdentifier();
2468    } else if (name.equals("instantiatesCanonical")) {
2469      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.instantiatesCanonical");
2470    } else if (name.equals("instantiatesUri")) {
2471      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.instantiatesUri");
2472    } else if (name.equals("status")) {
2473      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.status");
2474    } else if (name.equals("dataAbsentReason")) {
2475      this.dataAbsentReason = new CodeableConcept();
2476      return this.dataAbsentReason;
2477    } else if (name.equals("patient")) {
2478      this.patient = new Reference();
2479      return this.patient;
2480    } else if (name.equals("date")) {
2481      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.date");
2482    } else if (name.equals("name")) {
2483      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.name");
2484    } else if (name.equals("relationship")) {
2485      this.relationship = new CodeableConcept();
2486      return this.relationship;
2487    } else if (name.equals("sex")) {
2488      this.sex = new CodeableConcept();
2489      return this.sex;
2490    } else if (name.equals("bornPeriod")) {
2491      this.born = new Period();
2492      return this.born;
2493    } else if (name.equals("bornDate")) {
2494      this.born = new DateType();
2495      return this.born;
2496    } else if (name.equals("bornString")) {
2497      this.born = new StringType();
2498      return this.born;
2499    } else if (name.equals("ageAge")) {
2500      this.age = new Age();
2501      return this.age;
2502    } else if (name.equals("ageRange")) {
2503      this.age = new Range();
2504      return this.age;
2505    } else if (name.equals("ageString")) {
2506      this.age = new StringType();
2507      return this.age;
2508    } else if (name.equals("estimatedAge")) {
2509      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.estimatedAge");
2510    } else if (name.equals("deceasedBoolean")) {
2511      this.deceased = new BooleanType();
2512      return this.deceased;
2513    } else if (name.equals("deceasedAge")) {
2514      this.deceased = new Age();
2515      return this.deceased;
2516    } else if (name.equals("deceasedRange")) {
2517      this.deceased = new Range();
2518      return this.deceased;
2519    } else if (name.equals("deceasedDate")) {
2520      this.deceased = new DateType();
2521      return this.deceased;
2522    } else if (name.equals("deceasedString")) {
2523      this.deceased = new StringType();
2524      return this.deceased;
2525    } else if (name.equals("reasonCode")) {
2526      return addReasonCode();
2527    } else if (name.equals("reasonReference")) {
2528      return addReasonReference();
2529    } else if (name.equals("note")) {
2530      return addNote();
2531    } else if (name.equals("condition")) {
2532      return addCondition();
2533    } else
2534      return super.addChild(name);
2535  }
2536
2537  public String fhirType() {
2538    return "FamilyMemberHistory";
2539
2540  }
2541
2542  public FamilyMemberHistory copy() {
2543    FamilyMemberHistory dst = new FamilyMemberHistory();
2544    copyValues(dst);
2545    return dst;
2546  }
2547
2548  public void copyValues(FamilyMemberHistory dst) {
2549    super.copyValues(dst);
2550    if (identifier != null) {
2551      dst.identifier = new ArrayList<Identifier>();
2552      for (Identifier i : identifier)
2553        dst.identifier.add(i.copy());
2554    }
2555    ;
2556    if (instantiatesCanonical != null) {
2557      dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2558      for (CanonicalType i : instantiatesCanonical)
2559        dst.instantiatesCanonical.add(i.copy());
2560    }
2561    ;
2562    if (instantiatesUri != null) {
2563      dst.instantiatesUri = new ArrayList<UriType>();
2564      for (UriType i : instantiatesUri)
2565        dst.instantiatesUri.add(i.copy());
2566    }
2567    ;
2568    dst.status = status == null ? null : status.copy();
2569    dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy();
2570    dst.patient = patient == null ? null : patient.copy();
2571    dst.date = date == null ? null : date.copy();
2572    dst.name = name == null ? null : name.copy();
2573    dst.relationship = relationship == null ? null : relationship.copy();
2574    dst.sex = sex == null ? null : sex.copy();
2575    dst.born = born == null ? null : born.copy();
2576    dst.age = age == null ? null : age.copy();
2577    dst.estimatedAge = estimatedAge == null ? null : estimatedAge.copy();
2578    dst.deceased = deceased == null ? null : deceased.copy();
2579    if (reasonCode != null) {
2580      dst.reasonCode = new ArrayList<CodeableConcept>();
2581      for (CodeableConcept i : reasonCode)
2582        dst.reasonCode.add(i.copy());
2583    }
2584    ;
2585    if (reasonReference != null) {
2586      dst.reasonReference = new ArrayList<Reference>();
2587      for (Reference i : reasonReference)
2588        dst.reasonReference.add(i.copy());
2589    }
2590    ;
2591    if (note != null) {
2592      dst.note = new ArrayList<Annotation>();
2593      for (Annotation i : note)
2594        dst.note.add(i.copy());
2595    }
2596    ;
2597    if (condition != null) {
2598      dst.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2599      for (FamilyMemberHistoryConditionComponent i : condition)
2600        dst.condition.add(i.copy());
2601    }
2602    ;
2603  }
2604
2605  protected FamilyMemberHistory typedCopy() {
2606    return copy();
2607  }
2608
2609  @Override
2610  public boolean equalsDeep(Base other_) {
2611    if (!super.equalsDeep(other_))
2612      return false;
2613    if (!(other_ instanceof FamilyMemberHistory))
2614      return false;
2615    FamilyMemberHistory o = (FamilyMemberHistory) other_;
2616    return compareDeep(identifier, o.identifier, true)
2617        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
2618        && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(status, o.status, true)
2619        && compareDeep(dataAbsentReason, o.dataAbsentReason, true) && compareDeep(patient, o.patient, true)
2620        && compareDeep(date, o.date, true) && compareDeep(name, o.name, true)
2621        && compareDeep(relationship, o.relationship, true) && compareDeep(sex, o.sex, true)
2622        && compareDeep(born, o.born, true) && compareDeep(age, o.age, true)
2623        && compareDeep(estimatedAge, o.estimatedAge, true) && compareDeep(deceased, o.deceased, true)
2624        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2625        && compareDeep(note, o.note, true) && compareDeep(condition, o.condition, true);
2626  }
2627
2628  @Override
2629  public boolean equalsShallow(Base other_) {
2630    if (!super.equalsShallow(other_))
2631      return false;
2632    if (!(other_ instanceof FamilyMemberHistory))
2633      return false;
2634    FamilyMemberHistory o = (FamilyMemberHistory) other_;
2635    return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
2636        && compareValues(date, o.date, true) && compareValues(name, o.name, true)
2637        && compareValues(estimatedAge, o.estimatedAge, true);
2638  }
2639
2640  public boolean isEmpty() {
2641    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical, instantiatesUri,
2642        status, dataAbsentReason, patient, date, name, relationship, sex, born, age, estimatedAge, deceased, reasonCode,
2643        reasonReference, note, condition);
2644  }
2645
2646  @Override
2647  public ResourceType getResourceType() {
2648    return ResourceType.FamilyMemberHistory;
2649  }
2650
2651  /**
2652   * Search parameter: <b>date</b>
2653   * <p>
2654   * Description: <b>When history was recorded or last updated</b><br>
2655   * Type: <b>date</b><br>
2656   * Path: <b>FamilyMemberHistory.date</b><br>
2657   * </p>
2658   */
2659  @SearchParamDefinition(name = "date", path = "FamilyMemberHistory.date", description = "When history was recorded or last updated", type = "date")
2660  public static final String SP_DATE = "date";
2661  /**
2662   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2663   * <p>
2664   * Description: <b>When history was recorded or last updated</b><br>
2665   * Type: <b>date</b><br>
2666   * Path: <b>FamilyMemberHistory.date</b><br>
2667   * </p>
2668   */
2669  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2670      SP_DATE);
2671
2672  /**
2673   * Search parameter: <b>identifier</b>
2674   * <p>
2675   * Description: <b>A search by a record identifier</b><br>
2676   * Type: <b>token</b><br>
2677   * Path: <b>FamilyMemberHistory.identifier</b><br>
2678   * </p>
2679   */
2680  @SearchParamDefinition(name = "identifier", path = "FamilyMemberHistory.identifier", description = "A search by a record identifier", type = "token")
2681  public static final String SP_IDENTIFIER = "identifier";
2682  /**
2683   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2684   * <p>
2685   * Description: <b>A search by a record identifier</b><br>
2686   * Type: <b>token</b><br>
2687   * Path: <b>FamilyMemberHistory.identifier</b><br>
2688   * </p>
2689   */
2690  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2691      SP_IDENTIFIER);
2692
2693  /**
2694   * Search parameter: <b>code</b>
2695   * <p>
2696   * Description: <b>A search by a condition code</b><br>
2697   * Type: <b>token</b><br>
2698   * Path: <b>FamilyMemberHistory.condition.code</b><br>
2699   * </p>
2700   */
2701  @SearchParamDefinition(name = "code", path = "FamilyMemberHistory.condition.code", description = "A search by a condition code", type = "token")
2702  public static final String SP_CODE = "code";
2703  /**
2704   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2705   * <p>
2706   * Description: <b>A search by a condition code</b><br>
2707   * Type: <b>token</b><br>
2708   * Path: <b>FamilyMemberHistory.condition.code</b><br>
2709   * </p>
2710   */
2711  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2712      SP_CODE);
2713
2714  /**
2715   * Search parameter: <b>patient</b>
2716   * <p>
2717   * Description: <b>The identity of a subject to list family member history items
2718   * for</b><br>
2719   * Type: <b>reference</b><br>
2720   * Path: <b>FamilyMemberHistory.patient</b><br>
2721   * </p>
2722   */
2723  @SearchParamDefinition(name = "patient", path = "FamilyMemberHistory.patient", description = "The identity of a subject to list family member history items for", type = "reference", providesMembershipIn = {
2724      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
2725  public static final String SP_PATIENT = "patient";
2726  /**
2727   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2728   * <p>
2729   * Description: <b>The identity of a subject to list family member history items
2730   * for</b><br>
2731   * Type: <b>reference</b><br>
2732   * Path: <b>FamilyMemberHistory.patient</b><br>
2733   * </p>
2734   */
2735  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2736      SP_PATIENT);
2737
2738  /**
2739   * Constant for fluent queries to be used to add include statements. Specifies
2740   * the path value of "<b>FamilyMemberHistory:patient</b>".
2741   */
2742  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2743      "FamilyMemberHistory:patient").toLocked();
2744
2745  /**
2746   * Search parameter: <b>sex</b>
2747   * <p>
2748   * Description: <b>A search by a sex code of a family member</b><br>
2749   * Type: <b>token</b><br>
2750   * Path: <b>FamilyMemberHistory.sex</b><br>
2751   * </p>
2752   */
2753  @SearchParamDefinition(name = "sex", path = "FamilyMemberHistory.sex", description = "A search by a sex code of a family member", type = "token")
2754  public static final String SP_SEX = "sex";
2755  /**
2756   * <b>Fluent Client</b> search parameter constant for <b>sex</b>
2757   * <p>
2758   * Description: <b>A search by a sex code of a family member</b><br>
2759   * Type: <b>token</b><br>
2760   * Path: <b>FamilyMemberHistory.sex</b><br>
2761   * </p>
2762   */
2763  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SEX = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2764      SP_SEX);
2765
2766  /**
2767   * Search parameter: <b>instantiates-canonical</b>
2768   * <p>
2769   * Description: <b>Instantiates FHIR protocol or definition</b><br>
2770   * Type: <b>reference</b><br>
2771   * Path: <b>FamilyMemberHistory.instantiatesCanonical</b><br>
2772   * </p>
2773   */
2774  @SearchParamDefinition(name = "instantiates-canonical", path = "FamilyMemberHistory.instantiatesCanonical", description = "Instantiates FHIR protocol or definition", type = "reference", target = {
2775      ActivityDefinition.class, Measure.class, OperationDefinition.class, PlanDefinition.class, Questionnaire.class })
2776  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
2777  /**
2778   * <b>Fluent Client</b> search parameter constant for
2779   * <b>instantiates-canonical</b>
2780   * <p>
2781   * Description: <b>Instantiates FHIR protocol or definition</b><br>
2782   * Type: <b>reference</b><br>
2783   * Path: <b>FamilyMemberHistory.instantiatesCanonical</b><br>
2784   * </p>
2785   */
2786  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2787      SP_INSTANTIATES_CANONICAL);
2788
2789  /**
2790   * Constant for fluent queries to be used to add include statements. Specifies
2791   * the path value of "<b>FamilyMemberHistory:instantiates-canonical</b>".
2792   */
2793  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include(
2794      "FamilyMemberHistory:instantiates-canonical").toLocked();
2795
2796  /**
2797   * Search parameter: <b>instantiates-uri</b>
2798   * <p>
2799   * Description: <b>Instantiates external protocol or definition</b><br>
2800   * Type: <b>uri</b><br>
2801   * Path: <b>FamilyMemberHistory.instantiatesUri</b><br>
2802   * </p>
2803   */
2804  @SearchParamDefinition(name = "instantiates-uri", path = "FamilyMemberHistory.instantiatesUri", description = "Instantiates external protocol or definition", type = "uri")
2805  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
2806  /**
2807   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
2808   * <p>
2809   * Description: <b>Instantiates external protocol or definition</b><br>
2810   * Type: <b>uri</b><br>
2811   * Path: <b>FamilyMemberHistory.instantiatesUri</b><br>
2812   * </p>
2813   */
2814  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(
2815      SP_INSTANTIATES_URI);
2816
2817  /**
2818   * Search parameter: <b>relationship</b>
2819   * <p>
2820   * Description: <b>A search by a relationship type</b><br>
2821   * Type: <b>token</b><br>
2822   * Path: <b>FamilyMemberHistory.relationship</b><br>
2823   * </p>
2824   */
2825  @SearchParamDefinition(name = "relationship", path = "FamilyMemberHistory.relationship", description = "A search by a relationship type", type = "token")
2826  public static final String SP_RELATIONSHIP = "relationship";
2827  /**
2828   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
2829   * <p>
2830   * Description: <b>A search by a relationship type</b><br>
2831   * Type: <b>token</b><br>
2832   * Path: <b>FamilyMemberHistory.relationship</b><br>
2833   * </p>
2834   */
2835  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATIONSHIP = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2836      SP_RELATIONSHIP);
2837
2838  /**
2839   * Search parameter: <b>status</b>
2840   * <p>
2841   * Description: <b>partial | completed | entered-in-error |
2842   * health-unknown</b><br>
2843   * Type: <b>token</b><br>
2844   * Path: <b>FamilyMemberHistory.status</b><br>
2845   * </p>
2846   */
2847  @SearchParamDefinition(name = "status", path = "FamilyMemberHistory.status", description = "partial | completed | entered-in-error | health-unknown", type = "token")
2848  public static final String SP_STATUS = "status";
2849  /**
2850   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2851   * <p>
2852   * Description: <b>partial | completed | entered-in-error |
2853   * health-unknown</b><br>
2854   * Type: <b>token</b><br>
2855   * Path: <b>FamilyMemberHistory.status</b><br>
2856   * </p>
2857   */
2858  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2859      SP_STATUS);
2860
2861}