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