001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.
050 */
051@ResourceDef(name="Goal", profile="http://hl7.org/fhir/Profile/Goal")
052public class Goal extends DomainResource {
053
054    public enum GoalStatus {
055        /**
056         * A goal is proposed for this patient
057         */
058        PROPOSED, 
059        /**
060         * A goal is planned for this patient
061         */
062        PLANNED, 
063        /**
064         * A proposed goal was accepted
065         */
066        ACCEPTED, 
067        /**
068         * A proposed goal was rejected
069         */
070        REJECTED, 
071        /**
072         * The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)
073         */
074        INPROGRESS, 
075        /**
076         * The goal has been met and no further action is needed
077         */
078        ACHIEVED, 
079        /**
080         * The goal has been met, but ongoing activity is needed to sustain the goal objective
081         */
082        SUSTAINING, 
083        /**
084         * The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.
085         */
086        ONHOLD, 
087        /**
088         * The goal is no longer being sought
089         */
090        CANCELLED, 
091        /**
092         * added to help the parsers
093         */
094        NULL;
095        public static GoalStatus fromCode(String codeString) throws FHIRException {
096            if (codeString == null || "".equals(codeString))
097                return null;
098        if ("proposed".equals(codeString))
099          return PROPOSED;
100        if ("planned".equals(codeString))
101          return PLANNED;
102        if ("accepted".equals(codeString))
103          return ACCEPTED;
104        if ("rejected".equals(codeString))
105          return REJECTED;
106        if ("in-progress".equals(codeString))
107          return INPROGRESS;
108        if ("achieved".equals(codeString))
109          return ACHIEVED;
110        if ("sustaining".equals(codeString))
111          return SUSTAINING;
112        if ("on-hold".equals(codeString))
113          return ONHOLD;
114        if ("cancelled".equals(codeString))
115          return CANCELLED;
116        throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
117        }
118        public String toCode() {
119          switch (this) {
120            case PROPOSED: return "proposed";
121            case PLANNED: return "planned";
122            case ACCEPTED: return "accepted";
123            case REJECTED: return "rejected";
124            case INPROGRESS: return "in-progress";
125            case ACHIEVED: return "achieved";
126            case SUSTAINING: return "sustaining";
127            case ONHOLD: return "on-hold";
128            case CANCELLED: return "cancelled";
129            case NULL: return null;
130            default: return "?";
131          }
132        }
133        public String getSystem() {
134          switch (this) {
135            case PROPOSED: return "http://hl7.org/fhir/goal-status";
136            case PLANNED: return "http://hl7.org/fhir/goal-status";
137            case ACCEPTED: return "http://hl7.org/fhir/goal-status";
138            case REJECTED: return "http://hl7.org/fhir/goal-status";
139            case INPROGRESS: return "http://hl7.org/fhir/goal-status";
140            case ACHIEVED: return "http://hl7.org/fhir/goal-status";
141            case SUSTAINING: return "http://hl7.org/fhir/goal-status";
142            case ONHOLD: return "http://hl7.org/fhir/goal-status";
143            case CANCELLED: return "http://hl7.org/fhir/goal-status";
144            case NULL: return null;
145            default: return "?";
146          }
147        }
148        public String getDefinition() {
149          switch (this) {
150            case PROPOSED: return "A goal is proposed for this patient";
151            case PLANNED: return "A goal is planned for this patient";
152            case ACCEPTED: return "A proposed goal was accepted";
153            case REJECTED: return "A proposed goal was rejected";
154            case INPROGRESS: return "The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)";
155            case ACHIEVED: return "The goal has been met and no further action is needed";
156            case SUSTAINING: return "The goal has been met, but ongoing activity is needed to sustain the goal objective";
157            case ONHOLD: return "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.";
158            case CANCELLED: return "The goal is no longer being sought";
159            case NULL: return null;
160            default: return "?";
161          }
162        }
163        public String getDisplay() {
164          switch (this) {
165            case PROPOSED: return "Proposed";
166            case PLANNED: return "Planned";
167            case ACCEPTED: return "Accepted";
168            case REJECTED: return "Rejected";
169            case INPROGRESS: return "In Progress";
170            case ACHIEVED: return "Achieved";
171            case SUSTAINING: return "Sustaining";
172            case ONHOLD: return "On Hold";
173            case CANCELLED: return "Cancelled";
174            case NULL: return null;
175            default: return "?";
176          }
177        }
178    }
179
180  public static class GoalStatusEnumFactory implements EnumFactory<GoalStatus> {
181    public GoalStatus fromCode(String codeString) throws IllegalArgumentException {
182      if (codeString == null || "".equals(codeString))
183            if (codeString == null || "".equals(codeString))
184                return null;
185        if ("proposed".equals(codeString))
186          return GoalStatus.PROPOSED;
187        if ("planned".equals(codeString))
188          return GoalStatus.PLANNED;
189        if ("accepted".equals(codeString))
190          return GoalStatus.ACCEPTED;
191        if ("rejected".equals(codeString))
192          return GoalStatus.REJECTED;
193        if ("in-progress".equals(codeString))
194          return GoalStatus.INPROGRESS;
195        if ("achieved".equals(codeString))
196          return GoalStatus.ACHIEVED;
197        if ("sustaining".equals(codeString))
198          return GoalStatus.SUSTAINING;
199        if ("on-hold".equals(codeString))
200          return GoalStatus.ONHOLD;
201        if ("cancelled".equals(codeString))
202          return GoalStatus.CANCELLED;
203        throw new IllegalArgumentException("Unknown GoalStatus code '"+codeString+"'");
204        }
205        public Enumeration<GoalStatus> fromType(Base code) throws FHIRException {
206          if (code == null || code.isEmpty())
207            return null;
208          String codeString = ((PrimitiveType) code).asStringValue();
209          if (codeString == null || "".equals(codeString))
210            return null;
211        if ("proposed".equals(codeString))
212          return new Enumeration<GoalStatus>(this, GoalStatus.PROPOSED);
213        if ("planned".equals(codeString))
214          return new Enumeration<GoalStatus>(this, GoalStatus.PLANNED);
215        if ("accepted".equals(codeString))
216          return new Enumeration<GoalStatus>(this, GoalStatus.ACCEPTED);
217        if ("rejected".equals(codeString))
218          return new Enumeration<GoalStatus>(this, GoalStatus.REJECTED);
219        if ("in-progress".equals(codeString))
220          return new Enumeration<GoalStatus>(this, GoalStatus.INPROGRESS);
221        if ("achieved".equals(codeString))
222          return new Enumeration<GoalStatus>(this, GoalStatus.ACHIEVED);
223        if ("sustaining".equals(codeString))
224          return new Enumeration<GoalStatus>(this, GoalStatus.SUSTAINING);
225        if ("on-hold".equals(codeString))
226          return new Enumeration<GoalStatus>(this, GoalStatus.ONHOLD);
227        if ("cancelled".equals(codeString))
228          return new Enumeration<GoalStatus>(this, GoalStatus.CANCELLED);
229        throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
230        }
231    public String toCode(GoalStatus code) {
232      if (code == GoalStatus.PROPOSED)
233        return "proposed";
234      if (code == GoalStatus.PLANNED)
235        return "planned";
236      if (code == GoalStatus.ACCEPTED)
237        return "accepted";
238      if (code == GoalStatus.REJECTED)
239        return "rejected";
240      if (code == GoalStatus.INPROGRESS)
241        return "in-progress";
242      if (code == GoalStatus.ACHIEVED)
243        return "achieved";
244      if (code == GoalStatus.SUSTAINING)
245        return "sustaining";
246      if (code == GoalStatus.ONHOLD)
247        return "on-hold";
248      if (code == GoalStatus.CANCELLED)
249        return "cancelled";
250      return "?";
251      }
252    public String toSystem(GoalStatus code) {
253      return code.getSystem();
254      }
255    }
256
257    @Block()
258    public static class GoalOutcomeComponent extends BackboneElement implements IBaseBackboneElement {
259        /**
260         * Details of what's changed (or not changed).
261         */
262        @Child(name = "result", type = {CodeableConcept.class, Observation.class}, order=1, min=0, max=1, modifier=false, summary=false)
263        @Description(shortDefinition="Code or observation that resulted from goal", formalDefinition="Details of what's changed (or not changed)." )
264        protected Type result;
265
266        private static final long serialVersionUID = 1994317639L;
267
268    /**
269     * Constructor
270     */
271      public GoalOutcomeComponent() {
272        super();
273      }
274
275        /**
276         * @return {@link #result} (Details of what's changed (or not changed).)
277         */
278        public Type getResult() { 
279          return this.result;
280        }
281
282        /**
283         * @return {@link #result} (Details of what's changed (or not changed).)
284         */
285        public CodeableConcept getResultCodeableConcept() throws FHIRException { 
286          if (!(this.result instanceof CodeableConcept))
287            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.result.getClass().getName()+" was encountered");
288          return (CodeableConcept) this.result;
289        }
290
291        public boolean hasResultCodeableConcept() { 
292          return this.result instanceof CodeableConcept;
293        }
294
295        /**
296         * @return {@link #result} (Details of what's changed (or not changed).)
297         */
298        public Reference getResultReference() throws FHIRException { 
299          if (!(this.result instanceof Reference))
300            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.result.getClass().getName()+" was encountered");
301          return (Reference) this.result;
302        }
303
304        public boolean hasResultReference() { 
305          return this.result instanceof Reference;
306        }
307
308        public boolean hasResult() { 
309          return this.result != null && !this.result.isEmpty();
310        }
311
312        /**
313         * @param value {@link #result} (Details of what's changed (or not changed).)
314         */
315        public GoalOutcomeComponent setResult(Type value) { 
316          this.result = value;
317          return this;
318        }
319
320        protected void listChildren(List<Property> childrenList) {
321          super.listChildren(childrenList);
322          childrenList.add(new Property("result[x]", "CodeableConcept|Reference(Observation)", "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, result));
323        }
324
325      @Override
326      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
327        switch (hash) {
328        case -934426595: /*result*/ return this.result == null ? new Base[0] : new Base[] {this.result}; // Type
329        default: return super.getProperty(hash, name, checkValid);
330        }
331
332      }
333
334      @Override
335      public void setProperty(int hash, String name, Base value) throws FHIRException {
336        switch (hash) {
337        case -934426595: // result
338          this.result = (Type) value; // Type
339          break;
340        default: super.setProperty(hash, name, value);
341        }
342
343      }
344
345      @Override
346      public void setProperty(String name, Base value) throws FHIRException {
347        if (name.equals("result[x]"))
348          this.result = (Type) value; // Type
349        else
350          super.setProperty(name, value);
351      }
352
353      @Override
354      public Base makeProperty(int hash, String name) throws FHIRException {
355        switch (hash) {
356        case -1819555005:  return getResult(); // Type
357        default: return super.makeProperty(hash, name);
358        }
359
360      }
361
362      @Override
363      public Base addChild(String name) throws FHIRException {
364        if (name.equals("resultCodeableConcept")) {
365          this.result = new CodeableConcept();
366          return this.result;
367        }
368        else if (name.equals("resultReference")) {
369          this.result = new Reference();
370          return this.result;
371        }
372        else
373          return super.addChild(name);
374      }
375
376      public GoalOutcomeComponent copy() {
377        GoalOutcomeComponent dst = new GoalOutcomeComponent();
378        copyValues(dst);
379        dst.result = result == null ? null : result.copy();
380        return dst;
381      }
382
383      @Override
384      public boolean equalsDeep(Base other) {
385        if (!super.equalsDeep(other))
386          return false;
387        if (!(other instanceof GoalOutcomeComponent))
388          return false;
389        GoalOutcomeComponent o = (GoalOutcomeComponent) other;
390        return compareDeep(result, o.result, true);
391      }
392
393      @Override
394      public boolean equalsShallow(Base other) {
395        if (!super.equalsShallow(other))
396          return false;
397        if (!(other instanceof GoalOutcomeComponent))
398          return false;
399        GoalOutcomeComponent o = (GoalOutcomeComponent) other;
400        return true;
401      }
402
403      public boolean isEmpty() {
404        return super.isEmpty() && (result == null || result.isEmpty());
405      }
406
407  public String fhirType() {
408    return "Goal.outcome";
409
410  }
411
412  }
413
414    /**
415     * This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
416     */
417    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
418    @Description(shortDefinition="External Ids for this goal", formalDefinition="This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
419    protected List<Identifier> identifier;
420
421    /**
422     * Identifies the patient, group or organization for whom the goal is being established.
423     */
424    @Child(name = "subject", type = {Patient.class, Group.class, Organization.class}, order=1, min=0, max=1, modifier=false, summary=true)
425    @Description(shortDefinition="Who this goal is intended for", formalDefinition="Identifies the patient, group or organization for whom the goal is being established." )
426    protected Reference subject;
427
428    /**
429     * The actual object that is the target of the reference (Identifies the patient, group or organization for whom the goal is being established.)
430     */
431    protected Resource subjectTarget;
432
433    /**
434     * The date or event after which the goal should begin being pursued.
435     */
436    @Child(name = "start", type = {DateType.class, CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
437    @Description(shortDefinition="When goal pursuit begins", formalDefinition="The date or event after which the goal should begin being pursued." )
438    protected Type start;
439
440    /**
441     * Indicates either the date or the duration after start by which the goal should be met.
442     */
443    @Child(name = "target", type = {DateType.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
444    @Description(shortDefinition="Reach goal on or before", formalDefinition="Indicates either the date or the duration after start by which the goal should be met." )
445    protected Type target;
446
447    /**
448     * Indicates a category the goal falls within.
449     */
450    @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
451    @Description(shortDefinition="E.g. Treatment, dietary, behavioral, etc.", formalDefinition="Indicates a category the goal falls within." )
452    protected List<CodeableConcept> category;
453
454    /**
455     * Human-readable description of a specific desired objective of care.
456     */
457    @Child(name = "description", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
458    @Description(shortDefinition="What's the desired outcome?", formalDefinition="Human-readable description of a specific desired objective of care." )
459    protected StringType description;
460
461    /**
462     * Indicates whether the goal has been reached and is still considered relevant.
463     */
464    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
465    @Description(shortDefinition="proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled", formalDefinition="Indicates whether the goal has been reached and is still considered relevant." )
466    protected Enumeration<GoalStatus> status;
467
468    /**
469     * Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
470     */
471    @Child(name = "statusDate", type = {DateType.class}, order=7, min=0, max=1, modifier=false, summary=true)
472    @Description(shortDefinition="When goal status took effect", formalDefinition="Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc." )
473    protected DateType statusDate;
474
475    /**
476     * Captures the reason for the current status.
477     */
478    @Child(name = "statusReason", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
479    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current status." )
480    protected CodeableConcept statusReason;
481
482    /**
483     * Indicates whose goal this is - patient goal, practitioner goal, etc.
484     */
485    @Child(name = "author", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=9, min=0, max=1, modifier=false, summary=true)
486    @Description(shortDefinition="Who's responsible for creating Goal?", formalDefinition="Indicates whose goal this is - patient goal, practitioner goal, etc." )
487    protected Reference author;
488
489    /**
490     * The actual object that is the target of the reference (Indicates whose goal this is - patient goal, practitioner goal, etc.)
491     */
492    protected Resource authorTarget;
493
494    /**
495     * Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.
496     */
497    @Child(name = "priority", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
498    @Description(shortDefinition="high | medium |low", formalDefinition="Identifies the mutually agreed level of importance associated with reaching/sustaining the goal." )
499    protected CodeableConcept priority;
500
501    /**
502     * The identified conditions and other health record elements that are intended to be addressed by the goal.
503     */
504    @Child(name = "addresses", type = {Condition.class, Observation.class, MedicationStatement.class, NutritionOrder.class, ProcedureRequest.class, RiskAssessment.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
505    @Description(shortDefinition="Issues addressed by this goal", formalDefinition="The identified conditions and other health record elements that are intended to be addressed by the goal." )
506    protected List<Reference> addresses;
507    /**
508     * The actual objects that are the target of the reference (The identified conditions and other health record elements that are intended to be addressed by the goal.)
509     */
510    protected List<Resource> addressesTarget;
511
512
513    /**
514     * Any comments related to the goal.
515     */
516    @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
517    @Description(shortDefinition="Comments about the goal", formalDefinition="Any comments related to the goal." )
518    protected List<Annotation> note;
519
520    /**
521     * Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.
522     */
523    @Child(name = "outcome", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
524    @Description(shortDefinition="What was end result of goal?", formalDefinition="Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved." )
525    protected List<GoalOutcomeComponent> outcome;
526
527    private static final long serialVersionUID = 2029459056L;
528
529  /**
530   * Constructor
531   */
532    public Goal() {
533      super();
534    }
535
536  /**
537   * Constructor
538   */
539    public Goal(StringType description, Enumeration<GoalStatus> status) {
540      super();
541      this.description = description;
542      this.status = status;
543    }
544
545    /**
546     * @return {@link #identifier} (This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
547     */
548    public List<Identifier> getIdentifier() { 
549      if (this.identifier == null)
550        this.identifier = new ArrayList<Identifier>();
551      return this.identifier;
552    }
553
554    public boolean hasIdentifier() { 
555      if (this.identifier == null)
556        return false;
557      for (Identifier item : this.identifier)
558        if (!item.isEmpty())
559          return true;
560      return false;
561    }
562
563    /**
564     * @return {@link #identifier} (This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
565     */
566    // syntactic sugar
567    public Identifier addIdentifier() { //3
568      Identifier t = new Identifier();
569      if (this.identifier == null)
570        this.identifier = new ArrayList<Identifier>();
571      this.identifier.add(t);
572      return t;
573    }
574
575    // syntactic sugar
576    public Goal addIdentifier(Identifier t) { //3
577      if (t == null)
578        return this;
579      if (this.identifier == null)
580        this.identifier = new ArrayList<Identifier>();
581      this.identifier.add(t);
582      return this;
583    }
584
585    /**
586     * @return {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
587     */
588    public Reference getSubject() { 
589      if (this.subject == null)
590        if (Configuration.errorOnAutoCreate())
591          throw new Error("Attempt to auto-create Goal.subject");
592        else if (Configuration.doAutoCreate())
593          this.subject = new Reference(); // cc
594      return this.subject;
595    }
596
597    public boolean hasSubject() { 
598      return this.subject != null && !this.subject.isEmpty();
599    }
600
601    /**
602     * @param value {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
603     */
604    public Goal setSubject(Reference value) { 
605      this.subject = value;
606      return this;
607    }
608
609    /**
610     * @return {@link #subject} 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. (Identifies the patient, group or organization for whom the goal is being established.)
611     */
612    public Resource getSubjectTarget() { 
613      return this.subjectTarget;
614    }
615
616    /**
617     * @param value {@link #subject} 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. (Identifies the patient, group or organization for whom the goal is being established.)
618     */
619    public Goal setSubjectTarget(Resource value) { 
620      this.subjectTarget = value;
621      return this;
622    }
623
624    /**
625     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
626     */
627    public Type getStart() { 
628      return this.start;
629    }
630
631    /**
632     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
633     */
634    public DateType getStartDateType() throws FHIRException { 
635      if (!(this.start instanceof DateType))
636        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.start.getClass().getName()+" was encountered");
637      return (DateType) this.start;
638    }
639
640    public boolean hasStartDateType() { 
641      return this.start instanceof DateType;
642    }
643
644    /**
645     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
646     */
647    public CodeableConcept getStartCodeableConcept() throws FHIRException { 
648      if (!(this.start instanceof CodeableConcept))
649        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.start.getClass().getName()+" was encountered");
650      return (CodeableConcept) this.start;
651    }
652
653    public boolean hasStartCodeableConcept() { 
654      return this.start instanceof CodeableConcept;
655    }
656
657    public boolean hasStart() { 
658      return this.start != null && !this.start.isEmpty();
659    }
660
661    /**
662     * @param value {@link #start} (The date or event after which the goal should begin being pursued.)
663     */
664    public Goal setStart(Type value) { 
665      this.start = value;
666      return this;
667    }
668
669    /**
670     * @return {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
671     */
672    public Type getTarget() { 
673      return this.target;
674    }
675
676    /**
677     * @return {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
678     */
679    public DateType getTargetDateType() throws FHIRException { 
680      if (!(this.target instanceof DateType))
681        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.target.getClass().getName()+" was encountered");
682      return (DateType) this.target;
683    }
684
685    public boolean hasTargetDateType() { 
686      return this.target instanceof DateType;
687    }
688
689    /**
690     * @return {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
691     */
692    public Duration getTargetDuration() throws FHIRException { 
693      if (!(this.target instanceof Duration))
694        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.target.getClass().getName()+" was encountered");
695      return (Duration) this.target;
696    }
697
698    public boolean hasTargetDuration() { 
699      return this.target instanceof Duration;
700    }
701
702    public boolean hasTarget() { 
703      return this.target != null && !this.target.isEmpty();
704    }
705
706    /**
707     * @param value {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
708     */
709    public Goal setTarget(Type value) { 
710      this.target = value;
711      return this;
712    }
713
714    /**
715     * @return {@link #category} (Indicates a category the goal falls within.)
716     */
717    public List<CodeableConcept> getCategory() { 
718      if (this.category == null)
719        this.category = new ArrayList<CodeableConcept>();
720      return this.category;
721    }
722
723    public boolean hasCategory() { 
724      if (this.category == null)
725        return false;
726      for (CodeableConcept item : this.category)
727        if (!item.isEmpty())
728          return true;
729      return false;
730    }
731
732    /**
733     * @return {@link #category} (Indicates a category the goal falls within.)
734     */
735    // syntactic sugar
736    public CodeableConcept addCategory() { //3
737      CodeableConcept t = new CodeableConcept();
738      if (this.category == null)
739        this.category = new ArrayList<CodeableConcept>();
740      this.category.add(t);
741      return t;
742    }
743
744    // syntactic sugar
745    public Goal addCategory(CodeableConcept t) { //3
746      if (t == null)
747        return this;
748      if (this.category == null)
749        this.category = new ArrayList<CodeableConcept>();
750      this.category.add(t);
751      return this;
752    }
753
754    /**
755     * @return {@link #description} (Human-readable description of a specific desired objective of care.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
756     */
757    public StringType getDescriptionElement() { 
758      if (this.description == null)
759        if (Configuration.errorOnAutoCreate())
760          throw new Error("Attempt to auto-create Goal.description");
761        else if (Configuration.doAutoCreate())
762          this.description = new StringType(); // bb
763      return this.description;
764    }
765
766    public boolean hasDescriptionElement() { 
767      return this.description != null && !this.description.isEmpty();
768    }
769
770    public boolean hasDescription() { 
771      return this.description != null && !this.description.isEmpty();
772    }
773
774    /**
775     * @param value {@link #description} (Human-readable description of a specific desired objective of care.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
776     */
777    public Goal setDescriptionElement(StringType value) { 
778      this.description = value;
779      return this;
780    }
781
782    /**
783     * @return Human-readable description of a specific desired objective of care.
784     */
785    public String getDescription() { 
786      return this.description == null ? null : this.description.getValue();
787    }
788
789    /**
790     * @param value Human-readable description of a specific desired objective of care.
791     */
792    public Goal setDescription(String value) { 
793        if (this.description == null)
794          this.description = new StringType();
795        this.description.setValue(value);
796      return this;
797    }
798
799    /**
800     * @return {@link #status} (Indicates whether the goal has been reached and is still considered relevant.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
801     */
802    public Enumeration<GoalStatus> getStatusElement() { 
803      if (this.status == null)
804        if (Configuration.errorOnAutoCreate())
805          throw new Error("Attempt to auto-create Goal.status");
806        else if (Configuration.doAutoCreate())
807          this.status = new Enumeration<GoalStatus>(new GoalStatusEnumFactory()); // bb
808      return this.status;
809    }
810
811    public boolean hasStatusElement() { 
812      return this.status != null && !this.status.isEmpty();
813    }
814
815    public boolean hasStatus() { 
816      return this.status != null && !this.status.isEmpty();
817    }
818
819    /**
820     * @param value {@link #status} (Indicates whether the goal has been reached and is still considered relevant.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
821     */
822    public Goal setStatusElement(Enumeration<GoalStatus> value) { 
823      this.status = value;
824      return this;
825    }
826
827    /**
828     * @return Indicates whether the goal has been reached and is still considered relevant.
829     */
830    public GoalStatus getStatus() { 
831      return this.status == null ? null : this.status.getValue();
832    }
833
834    /**
835     * @param value Indicates whether the goal has been reached and is still considered relevant.
836     */
837    public Goal setStatus(GoalStatus value) { 
838        if (this.status == null)
839          this.status = new Enumeration<GoalStatus>(new GoalStatusEnumFactory());
840        this.status.setValue(value);
841      return this;
842    }
843
844    /**
845     * @return {@link #statusDate} (Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
846     */
847    public DateType getStatusDateElement() { 
848      if (this.statusDate == null)
849        if (Configuration.errorOnAutoCreate())
850          throw new Error("Attempt to auto-create Goal.statusDate");
851        else if (Configuration.doAutoCreate())
852          this.statusDate = new DateType(); // bb
853      return this.statusDate;
854    }
855
856    public boolean hasStatusDateElement() { 
857      return this.statusDate != null && !this.statusDate.isEmpty();
858    }
859
860    public boolean hasStatusDate() { 
861      return this.statusDate != null && !this.statusDate.isEmpty();
862    }
863
864    /**
865     * @param value {@link #statusDate} (Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
866     */
867    public Goal setStatusDateElement(DateType value) { 
868      this.statusDate = value;
869      return this;
870    }
871
872    /**
873     * @return Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
874     */
875    public Date getStatusDate() { 
876      return this.statusDate == null ? null : this.statusDate.getValue();
877    }
878
879    /**
880     * @param value Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
881     */
882    public Goal setStatusDate(Date value) { 
883      if (value == null)
884        this.statusDate = null;
885      else {
886        if (this.statusDate == null)
887          this.statusDate = new DateType();
888        this.statusDate.setValue(value);
889      }
890      return this;
891    }
892
893    /**
894     * @return {@link #statusReason} (Captures the reason for the current status.)
895     */
896    public CodeableConcept getStatusReason() { 
897      if (this.statusReason == null)
898        if (Configuration.errorOnAutoCreate())
899          throw new Error("Attempt to auto-create Goal.statusReason");
900        else if (Configuration.doAutoCreate())
901          this.statusReason = new CodeableConcept(); // cc
902      return this.statusReason;
903    }
904
905    public boolean hasStatusReason() { 
906      return this.statusReason != null && !this.statusReason.isEmpty();
907    }
908
909    /**
910     * @param value {@link #statusReason} (Captures the reason for the current status.)
911     */
912    public Goal setStatusReason(CodeableConcept value) { 
913      this.statusReason = value;
914      return this;
915    }
916
917    /**
918     * @return {@link #author} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
919     */
920    public Reference getAuthor() { 
921      if (this.author == null)
922        if (Configuration.errorOnAutoCreate())
923          throw new Error("Attempt to auto-create Goal.author");
924        else if (Configuration.doAutoCreate())
925          this.author = new Reference(); // cc
926      return this.author;
927    }
928
929    public boolean hasAuthor() { 
930      return this.author != null && !this.author.isEmpty();
931    }
932
933    /**
934     * @param value {@link #author} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
935     */
936    public Goal setAuthor(Reference value) { 
937      this.author = value;
938      return this;
939    }
940
941    /**
942     * @return {@link #author} 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. (Indicates whose goal this is - patient goal, practitioner goal, etc.)
943     */
944    public Resource getAuthorTarget() { 
945      return this.authorTarget;
946    }
947
948    /**
949     * @param value {@link #author} 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. (Indicates whose goal this is - patient goal, practitioner goal, etc.)
950     */
951    public Goal setAuthorTarget(Resource value) { 
952      this.authorTarget = value;
953      return this;
954    }
955
956    /**
957     * @return {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
958     */
959    public CodeableConcept getPriority() { 
960      if (this.priority == null)
961        if (Configuration.errorOnAutoCreate())
962          throw new Error("Attempt to auto-create Goal.priority");
963        else if (Configuration.doAutoCreate())
964          this.priority = new CodeableConcept(); // cc
965      return this.priority;
966    }
967
968    public boolean hasPriority() { 
969      return this.priority != null && !this.priority.isEmpty();
970    }
971
972    /**
973     * @param value {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
974     */
975    public Goal setPriority(CodeableConcept value) { 
976      this.priority = value;
977      return this;
978    }
979
980    /**
981     * @return {@link #addresses} (The identified conditions and other health record elements that are intended to be addressed by the goal.)
982     */
983    public List<Reference> getAddresses() { 
984      if (this.addresses == null)
985        this.addresses = new ArrayList<Reference>();
986      return this.addresses;
987    }
988
989    public boolean hasAddresses() { 
990      if (this.addresses == null)
991        return false;
992      for (Reference item : this.addresses)
993        if (!item.isEmpty())
994          return true;
995      return false;
996    }
997
998    /**
999     * @return {@link #addresses} (The identified conditions and other health record elements that are intended to be addressed by the goal.)
1000     */
1001    // syntactic sugar
1002    public Reference addAddresses() { //3
1003      Reference t = new Reference();
1004      if (this.addresses == null)
1005        this.addresses = new ArrayList<Reference>();
1006      this.addresses.add(t);
1007      return t;
1008    }
1009
1010    // syntactic sugar
1011    public Goal addAddresses(Reference t) { //3
1012      if (t == null)
1013        return this;
1014      if (this.addresses == null)
1015        this.addresses = new ArrayList<Reference>();
1016      this.addresses.add(t);
1017      return this;
1018    }
1019
1020    /**
1021     * @return {@link #addresses} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The identified conditions and other health record elements that are intended to be addressed by the goal.)
1022     */
1023    public List<Resource> getAddressesTarget() { 
1024      if (this.addressesTarget == null)
1025        this.addressesTarget = new ArrayList<Resource>();
1026      return this.addressesTarget;
1027    }
1028
1029    /**
1030     * @return {@link #note} (Any comments related to the goal.)
1031     */
1032    public List<Annotation> getNote() { 
1033      if (this.note == null)
1034        this.note = new ArrayList<Annotation>();
1035      return this.note;
1036    }
1037
1038    public boolean hasNote() { 
1039      if (this.note == null)
1040        return false;
1041      for (Annotation item : this.note)
1042        if (!item.isEmpty())
1043          return true;
1044      return false;
1045    }
1046
1047    /**
1048     * @return {@link #note} (Any comments related to the goal.)
1049     */
1050    // syntactic sugar
1051    public Annotation addNote() { //3
1052      Annotation t = new Annotation();
1053      if (this.note == null)
1054        this.note = new ArrayList<Annotation>();
1055      this.note.add(t);
1056      return t;
1057    }
1058
1059    // syntactic sugar
1060    public Goal addNote(Annotation t) { //3
1061      if (t == null)
1062        return this;
1063      if (this.note == null)
1064        this.note = new ArrayList<Annotation>();
1065      this.note.add(t);
1066      return this;
1067    }
1068
1069    /**
1070     * @return {@link #outcome} (Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.)
1071     */
1072    public List<GoalOutcomeComponent> getOutcome() { 
1073      if (this.outcome == null)
1074        this.outcome = new ArrayList<GoalOutcomeComponent>();
1075      return this.outcome;
1076    }
1077
1078    public boolean hasOutcome() { 
1079      if (this.outcome == null)
1080        return false;
1081      for (GoalOutcomeComponent item : this.outcome)
1082        if (!item.isEmpty())
1083          return true;
1084      return false;
1085    }
1086
1087    /**
1088     * @return {@link #outcome} (Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.)
1089     */
1090    // syntactic sugar
1091    public GoalOutcomeComponent addOutcome() { //3
1092      GoalOutcomeComponent t = new GoalOutcomeComponent();
1093      if (this.outcome == null)
1094        this.outcome = new ArrayList<GoalOutcomeComponent>();
1095      this.outcome.add(t);
1096      return t;
1097    }
1098
1099    // syntactic sugar
1100    public Goal addOutcome(GoalOutcomeComponent t) { //3
1101      if (t == null)
1102        return this;
1103      if (this.outcome == null)
1104        this.outcome = new ArrayList<GoalOutcomeComponent>();
1105      this.outcome.add(t);
1106      return this;
1107    }
1108
1109      protected void listChildren(List<Property> childrenList) {
1110        super.listChildren(childrenList);
1111        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
1112        childrenList.add(new Property("subject", "Reference(Patient|Group|Organization)", "Identifies the patient, group or organization for whom the goal is being established.", 0, java.lang.Integer.MAX_VALUE, subject));
1113        childrenList.add(new Property("start[x]", "date|CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, java.lang.Integer.MAX_VALUE, start));
1114        childrenList.add(new Property("target[x]", "date|Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, java.lang.Integer.MAX_VALUE, target));
1115        childrenList.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, java.lang.Integer.MAX_VALUE, category));
1116        childrenList.add(new Property("description", "string", "Human-readable description of a specific desired objective of care.", 0, java.lang.Integer.MAX_VALUE, description));
1117        childrenList.add(new Property("status", "code", "Indicates whether the goal has been reached and is still considered relevant.", 0, java.lang.Integer.MAX_VALUE, status));
1118        childrenList.add(new Property("statusDate", "date", "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, java.lang.Integer.MAX_VALUE, statusDate));
1119        childrenList.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current status.", 0, java.lang.Integer.MAX_VALUE, statusReason));
1120        childrenList.add(new Property("author", "Reference(Patient|Practitioner|RelatedPerson)", "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, java.lang.Integer.MAX_VALUE, author));
1121        childrenList.add(new Property("priority", "CodeableConcept", "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, java.lang.Integer.MAX_VALUE, priority));
1122        childrenList.add(new Property("addresses", "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ProcedureRequest|RiskAssessment)", "The identified conditions and other health record elements that are intended to be addressed by the goal.", 0, java.lang.Integer.MAX_VALUE, addresses));
1123        childrenList.add(new Property("note", "Annotation", "Any comments related to the goal.", 0, java.lang.Integer.MAX_VALUE, note));
1124        childrenList.add(new Property("outcome", "", "Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.", 0, java.lang.Integer.MAX_VALUE, outcome));
1125      }
1126
1127      @Override
1128      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1129        switch (hash) {
1130        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1131        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1132        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // Type
1133        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Type
1134        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1135        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1136        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<GoalStatus>
1137        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateType
1138        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
1139        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
1140        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1141        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
1142        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1143        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : this.outcome.toArray(new Base[this.outcome.size()]); // GoalOutcomeComponent
1144        default: return super.getProperty(hash, name, checkValid);
1145        }
1146
1147      }
1148
1149      @Override
1150      public void setProperty(int hash, String name, Base value) throws FHIRException {
1151        switch (hash) {
1152        case -1618432855: // identifier
1153          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1154          break;
1155        case -1867885268: // subject
1156          this.subject = castToReference(value); // Reference
1157          break;
1158        case 109757538: // start
1159          this.start = (Type) value; // Type
1160          break;
1161        case -880905839: // target
1162          this.target = (Type) value; // Type
1163          break;
1164        case 50511102: // category
1165          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
1166          break;
1167        case -1724546052: // description
1168          this.description = castToString(value); // StringType
1169          break;
1170        case -892481550: // status
1171          this.status = new GoalStatusEnumFactory().fromType(value); // Enumeration<GoalStatus>
1172          break;
1173        case 247524032: // statusDate
1174          this.statusDate = castToDate(value); // DateType
1175          break;
1176        case 2051346646: // statusReason
1177          this.statusReason = castToCodeableConcept(value); // CodeableConcept
1178          break;
1179        case -1406328437: // author
1180          this.author = castToReference(value); // Reference
1181          break;
1182        case -1165461084: // priority
1183          this.priority = castToCodeableConcept(value); // CodeableConcept
1184          break;
1185        case 874544034: // addresses
1186          this.getAddresses().add(castToReference(value)); // Reference
1187          break;
1188        case 3387378: // note
1189          this.getNote().add(castToAnnotation(value)); // Annotation
1190          break;
1191        case -1106507950: // outcome
1192          this.getOutcome().add((GoalOutcomeComponent) value); // GoalOutcomeComponent
1193          break;
1194        default: super.setProperty(hash, name, value);
1195        }
1196
1197      }
1198
1199      @Override
1200      public void setProperty(String name, Base value) throws FHIRException {
1201        if (name.equals("identifier"))
1202          this.getIdentifier().add(castToIdentifier(value));
1203        else if (name.equals("subject"))
1204          this.subject = castToReference(value); // Reference
1205        else if (name.equals("start[x]"))
1206          this.start = (Type) value; // Type
1207        else if (name.equals("target[x]"))
1208          this.target = (Type) value; // Type
1209        else if (name.equals("category"))
1210          this.getCategory().add(castToCodeableConcept(value));
1211        else if (name.equals("description"))
1212          this.description = castToString(value); // StringType
1213        else if (name.equals("status"))
1214          this.status = new GoalStatusEnumFactory().fromType(value); // Enumeration<GoalStatus>
1215        else if (name.equals("statusDate"))
1216          this.statusDate = castToDate(value); // DateType
1217        else if (name.equals("statusReason"))
1218          this.statusReason = castToCodeableConcept(value); // CodeableConcept
1219        else if (name.equals("author"))
1220          this.author = castToReference(value); // Reference
1221        else if (name.equals("priority"))
1222          this.priority = castToCodeableConcept(value); // CodeableConcept
1223        else if (name.equals("addresses"))
1224          this.getAddresses().add(castToReference(value));
1225        else if (name.equals("note"))
1226          this.getNote().add(castToAnnotation(value));
1227        else if (name.equals("outcome"))
1228          this.getOutcome().add((GoalOutcomeComponent) value);
1229        else
1230          super.setProperty(name, value);
1231      }
1232
1233      @Override
1234      public Base makeProperty(int hash, String name) throws FHIRException {
1235        switch (hash) {
1236        case -1618432855:  return addIdentifier(); // Identifier
1237        case -1867885268:  return getSubject(); // Reference
1238        case 1316793566:  return getStart(); // Type
1239        case -815579825:  return getTarget(); // Type
1240        case 50511102:  return addCategory(); // CodeableConcept
1241        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
1242        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<GoalStatus>
1243        case 247524032: throw new FHIRException("Cannot make property statusDate as it is not a complex type"); // DateType
1244        case 2051346646:  return getStatusReason(); // CodeableConcept
1245        case -1406328437:  return getAuthor(); // Reference
1246        case -1165461084:  return getPriority(); // CodeableConcept
1247        case 874544034:  return addAddresses(); // Reference
1248        case 3387378:  return addNote(); // Annotation
1249        case -1106507950:  return addOutcome(); // GoalOutcomeComponent
1250        default: return super.makeProperty(hash, name);
1251        }
1252
1253      }
1254
1255      @Override
1256      public Base addChild(String name) throws FHIRException {
1257        if (name.equals("identifier")) {
1258          return addIdentifier();
1259        }
1260        else if (name.equals("subject")) {
1261          this.subject = new Reference();
1262          return this.subject;
1263        }
1264        else if (name.equals("startDate")) {
1265          this.start = new DateType();
1266          return this.start;
1267        }
1268        else if (name.equals("startCodeableConcept")) {
1269          this.start = new CodeableConcept();
1270          return this.start;
1271        }
1272        else if (name.equals("targetDate")) {
1273          this.target = new DateType();
1274          return this.target;
1275        }
1276        else if (name.equals("targetDuration")) {
1277          this.target = new Duration();
1278          return this.target;
1279        }
1280        else if (name.equals("category")) {
1281          return addCategory();
1282        }
1283        else if (name.equals("description")) {
1284          throw new FHIRException("Cannot call addChild on a primitive type Goal.description");
1285        }
1286        else if (name.equals("status")) {
1287          throw new FHIRException("Cannot call addChild on a primitive type Goal.status");
1288        }
1289        else if (name.equals("statusDate")) {
1290          throw new FHIRException("Cannot call addChild on a primitive type Goal.statusDate");
1291        }
1292        else if (name.equals("statusReason")) {
1293          this.statusReason = new CodeableConcept();
1294          return this.statusReason;
1295        }
1296        else if (name.equals("author")) {
1297          this.author = new Reference();
1298          return this.author;
1299        }
1300        else if (name.equals("priority")) {
1301          this.priority = new CodeableConcept();
1302          return this.priority;
1303        }
1304        else if (name.equals("addresses")) {
1305          return addAddresses();
1306        }
1307        else if (name.equals("note")) {
1308          return addNote();
1309        }
1310        else if (name.equals("outcome")) {
1311          return addOutcome();
1312        }
1313        else
1314          return super.addChild(name);
1315      }
1316
1317  public String fhirType() {
1318    return "Goal";
1319
1320  }
1321
1322      public Goal copy() {
1323        Goal dst = new Goal();
1324        copyValues(dst);
1325        if (identifier != null) {
1326          dst.identifier = new ArrayList<Identifier>();
1327          for (Identifier i : identifier)
1328            dst.identifier.add(i.copy());
1329        };
1330        dst.subject = subject == null ? null : subject.copy();
1331        dst.start = start == null ? null : start.copy();
1332        dst.target = target == null ? null : target.copy();
1333        if (category != null) {
1334          dst.category = new ArrayList<CodeableConcept>();
1335          for (CodeableConcept i : category)
1336            dst.category.add(i.copy());
1337        };
1338        dst.description = description == null ? null : description.copy();
1339        dst.status = status == null ? null : status.copy();
1340        dst.statusDate = statusDate == null ? null : statusDate.copy();
1341        dst.statusReason = statusReason == null ? null : statusReason.copy();
1342        dst.author = author == null ? null : author.copy();
1343        dst.priority = priority == null ? null : priority.copy();
1344        if (addresses != null) {
1345          dst.addresses = new ArrayList<Reference>();
1346          for (Reference i : addresses)
1347            dst.addresses.add(i.copy());
1348        };
1349        if (note != null) {
1350          dst.note = new ArrayList<Annotation>();
1351          for (Annotation i : note)
1352            dst.note.add(i.copy());
1353        };
1354        if (outcome != null) {
1355          dst.outcome = new ArrayList<GoalOutcomeComponent>();
1356          for (GoalOutcomeComponent i : outcome)
1357            dst.outcome.add(i.copy());
1358        };
1359        return dst;
1360      }
1361
1362      protected Goal typedCopy() {
1363        return copy();
1364      }
1365
1366      @Override
1367      public boolean equalsDeep(Base other) {
1368        if (!super.equalsDeep(other))
1369          return false;
1370        if (!(other instanceof Goal))
1371          return false;
1372        Goal o = (Goal) other;
1373        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(start, o.start, true)
1374           && compareDeep(target, o.target, true) && compareDeep(category, o.category, true) && compareDeep(description, o.description, true)
1375           && compareDeep(status, o.status, true) && compareDeep(statusDate, o.statusDate, true) && compareDeep(statusReason, o.statusReason, true)
1376           && compareDeep(author, o.author, true) && compareDeep(priority, o.priority, true) && compareDeep(addresses, o.addresses, true)
1377           && compareDeep(note, o.note, true) && compareDeep(outcome, o.outcome, true);
1378      }
1379
1380      @Override
1381      public boolean equalsShallow(Base other) {
1382        if (!super.equalsShallow(other))
1383          return false;
1384        if (!(other instanceof Goal))
1385          return false;
1386        Goal o = (Goal) other;
1387        return compareValues(description, o.description, true) && compareValues(status, o.status, true) && compareValues(statusDate, o.statusDate, true)
1388          ;
1389      }
1390
1391      public boolean isEmpty() {
1392        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (subject == null || subject.isEmpty())
1393           && (start == null || start.isEmpty()) && (target == null || target.isEmpty()) && (category == null || category.isEmpty())
1394           && (description == null || description.isEmpty()) && (status == null || status.isEmpty())
1395           && (statusDate == null || statusDate.isEmpty()) && (statusReason == null || statusReason.isEmpty())
1396           && (author == null || author.isEmpty()) && (priority == null || priority.isEmpty()) && (addresses == null || addresses.isEmpty())
1397           && (note == null || note.isEmpty()) && (outcome == null || outcome.isEmpty());
1398      }
1399
1400  @Override
1401  public ResourceType getResourceType() {
1402    return ResourceType.Goal;
1403   }
1404
1405 /**
1406   * Search parameter: <b>targetdate</b>
1407   * <p>
1408   * Description: <b>Reach goal on or before</b><br>
1409   * Type: <b>date</b><br>
1410   * Path: <b>Goal.targetDate</b><br>
1411   * </p>
1412   */
1413  @SearchParamDefinition(name="targetdate", path="Goal.target.as(Date)", description="Reach goal on or before", type="date" )
1414  public static final String SP_TARGETDATE = "targetdate";
1415 /**
1416   * <b>Fluent Client</b> search parameter constant for <b>targetdate</b>
1417   * <p>
1418   * Description: <b>Reach goal on or before</b><br>
1419   * Type: <b>date</b><br>
1420   * Path: <b>Goal.targetDate</b><br>
1421   * </p>
1422   */
1423  public static final ca.uhn.fhir.rest.gclient.DateClientParam TARGETDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_TARGETDATE);
1424
1425 /**
1426   * Search parameter: <b>category</b>
1427   * <p>
1428   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1429   * Type: <b>token</b><br>
1430   * Path: <b>Goal.category</b><br>
1431   * </p>
1432   */
1433  @SearchParamDefinition(name="category", path="Goal.category", description="E.g. Treatment, dietary, behavioral, etc.", type="token" )
1434  public static final String SP_CATEGORY = "category";
1435 /**
1436   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1437   * <p>
1438   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1439   * Type: <b>token</b><br>
1440   * Path: <b>Goal.category</b><br>
1441   * </p>
1442   */
1443  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1444
1445 /**
1446   * Search parameter: <b>patient</b>
1447   * <p>
1448   * Description: <b>Who this goal is intended for</b><br>
1449   * Type: <b>reference</b><br>
1450   * Path: <b>Goal.subject</b><br>
1451   * </p>
1452   */
1453  @SearchParamDefinition(name="patient", path="Goal.subject", description="Who this goal is intended for", type="reference" )
1454  public static final String SP_PATIENT = "patient";
1455 /**
1456   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1457   * <p>
1458   * Description: <b>Who this goal is intended for</b><br>
1459   * Type: <b>reference</b><br>
1460   * Path: <b>Goal.subject</b><br>
1461   * </p>
1462   */
1463  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1464
1465/**
1466   * Constant for fluent queries to be used to add include statements. Specifies
1467   * the path value of "<b>Goal:patient</b>".
1468   */
1469  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Goal:patient").toLocked();
1470
1471 /**
1472   * Search parameter: <b>status</b>
1473   * <p>
1474   * Description: <b>proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled</b><br>
1475   * Type: <b>token</b><br>
1476   * Path: <b>Goal.status</b><br>
1477   * </p>
1478   */
1479  @SearchParamDefinition(name="status", path="Goal.status", description="proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled", type="token" )
1480  public static final String SP_STATUS = "status";
1481 /**
1482   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1483   * <p>
1484   * Description: <b>proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled</b><br>
1485   * Type: <b>token</b><br>
1486   * Path: <b>Goal.status</b><br>
1487   * </p>
1488   */
1489  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1490
1491 /**
1492   * Search parameter: <b>subject</b>
1493   * <p>
1494   * Description: <b>Who this goal is intended for</b><br>
1495   * Type: <b>reference</b><br>
1496   * Path: <b>Goal.subject</b><br>
1497   * </p>
1498   */
1499  @SearchParamDefinition(name="subject", path="Goal.subject", description="Who this goal is intended for", type="reference" )
1500  public static final String SP_SUBJECT = "subject";
1501 /**
1502   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1503   * <p>
1504   * Description: <b>Who this goal is intended for</b><br>
1505   * Type: <b>reference</b><br>
1506   * Path: <b>Goal.subject</b><br>
1507   * </p>
1508   */
1509  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1510
1511/**
1512   * Constant for fluent queries to be used to add include statements. Specifies
1513   * the path value of "<b>Goal:subject</b>".
1514   */
1515  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Goal:subject").toLocked();
1516
1517 /**
1518   * Search parameter: <b>identifier</b>
1519   * <p>
1520   * Description: <b>External Ids for this goal</b><br>
1521   * Type: <b>token</b><br>
1522   * Path: <b>Goal.identifier</b><br>
1523   * </p>
1524   */
1525  @SearchParamDefinition(name="identifier", path="Goal.identifier", description="External Ids for this goal", type="token" )
1526  public static final String SP_IDENTIFIER = "identifier";
1527 /**
1528   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1529   * <p>
1530   * Description: <b>External Ids for this goal</b><br>
1531   * Type: <b>token</b><br>
1532   * Path: <b>Goal.identifier</b><br>
1533   * </p>
1534   */
1535  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1536
1537
1538}