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