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