001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * Describes the intended objective(s) for a patient, group or organization
049 * care, for example, weight loss, restoring an activity of daily living,
050 * obtaining herd immunity via immunization, meeting a process improvement
051 * objective, etc.
052 */
053@ResourceDef(name = "Goal", profile = "http://hl7.org/fhir/StructureDefinition/Goal")
054public class Goal extends DomainResource {
055
056  public enum GoalLifecycleStatus {
057    /**
058     * A goal is proposed for this patient.
059     */
060    PROPOSED,
061    /**
062     * A goal is planned for this patient.
063     */
064    PLANNED,
065    /**
066     * A proposed goal was accepted or acknowledged.
067     */
068    ACCEPTED,
069    /**
070     * The goal is being sought actively.
071     */
072    ACTIVE,
073    /**
074     * The goal remains a long term objective but is no longer being actively
075     * pursued for a temporary period of time.
076     */
077    ONHOLD,
078    /**
079     * The goal is no longer being sought.
080     */
081    COMPLETED,
082    /**
083     * The goal has been abandoned.
084     */
085    CANCELLED,
086    /**
087     * The goal was entered in error and voided.
088     */
089    ENTEREDINERROR,
090    /**
091     * A proposed goal was rejected.
092     */
093    REJECTED,
094    /**
095     * added to help the parsers with the generic types
096     */
097    NULL;
098
099    public static GoalLifecycleStatus fromCode(String codeString) throws FHIRException {
100      if (codeString == null || "".equals(codeString))
101        return null;
102      if ("proposed".equals(codeString))
103        return PROPOSED;
104      if ("planned".equals(codeString))
105        return PLANNED;
106      if ("accepted".equals(codeString))
107        return ACCEPTED;
108      if ("active".equals(codeString))
109        return ACTIVE;
110      if ("on-hold".equals(codeString))
111        return ONHOLD;
112      if ("completed".equals(codeString))
113        return COMPLETED;
114      if ("cancelled".equals(codeString))
115        return CANCELLED;
116      if ("entered-in-error".equals(codeString))
117        return ENTEREDINERROR;
118      if ("rejected".equals(codeString))
119        return REJECTED;
120      if (Configuration.isAcceptInvalidEnums())
121        return null;
122      else
123        throw new FHIRException("Unknown GoalLifecycleStatus code '" + codeString + "'");
124    }
125
126    public String toCode() {
127      switch (this) {
128      case PROPOSED:
129        return "proposed";
130      case PLANNED:
131        return "planned";
132      case ACCEPTED:
133        return "accepted";
134      case ACTIVE:
135        return "active";
136      case ONHOLD:
137        return "on-hold";
138      case COMPLETED:
139        return "completed";
140      case CANCELLED:
141        return "cancelled";
142      case ENTEREDINERROR:
143        return "entered-in-error";
144      case REJECTED:
145        return "rejected";
146      case NULL:
147        return null;
148      default:
149        return "?";
150      }
151    }
152
153    public String getSystem() {
154      switch (this) {
155      case PROPOSED:
156        return "http://hl7.org/fhir/goal-status";
157      case PLANNED:
158        return "http://hl7.org/fhir/goal-status";
159      case ACCEPTED:
160        return "http://hl7.org/fhir/goal-status";
161      case ACTIVE:
162        return "http://hl7.org/fhir/goal-status";
163      case ONHOLD:
164        return "http://hl7.org/fhir/goal-status";
165      case COMPLETED:
166        return "http://hl7.org/fhir/goal-status";
167      case CANCELLED:
168        return "http://hl7.org/fhir/goal-status";
169      case ENTEREDINERROR:
170        return "http://hl7.org/fhir/goal-status";
171      case REJECTED:
172        return "http://hl7.org/fhir/goal-status";
173      case NULL:
174        return null;
175      default:
176        return "?";
177      }
178    }
179
180    public String getDefinition() {
181      switch (this) {
182      case PROPOSED:
183        return "A goal is proposed for this patient.";
184      case PLANNED:
185        return "A goal is planned for this patient.";
186      case ACCEPTED:
187        return "A proposed goal was accepted or acknowledged.";
188      case ACTIVE:
189        return "The goal is being sought actively.";
190      case ONHOLD:
191        return "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.";
192      case COMPLETED:
193        return "The goal is no longer being sought.";
194      case CANCELLED:
195        return "The goal has been abandoned.";
196      case ENTEREDINERROR:
197        return "The goal was entered in error and voided.";
198      case REJECTED:
199        return "A proposed goal was rejected.";
200      case NULL:
201        return null;
202      default:
203        return "?";
204      }
205    }
206
207    public String getDisplay() {
208      switch (this) {
209      case PROPOSED:
210        return "Proposed";
211      case PLANNED:
212        return "Planned";
213      case ACCEPTED:
214        return "Accepted";
215      case ACTIVE:
216        return "Active";
217      case ONHOLD:
218        return "On Hold";
219      case COMPLETED:
220        return "Completed";
221      case CANCELLED:
222        return "Cancelled";
223      case ENTEREDINERROR:
224        return "Entered in Error";
225      case REJECTED:
226        return "Rejected";
227      case NULL:
228        return null;
229      default:
230        return "?";
231      }
232    }
233  }
234
235  public static class GoalLifecycleStatusEnumFactory implements EnumFactory<GoalLifecycleStatus> {
236    public GoalLifecycleStatus fromCode(String codeString) throws IllegalArgumentException {
237      if (codeString == null || "".equals(codeString))
238        if (codeString == null || "".equals(codeString))
239          return null;
240      if ("proposed".equals(codeString))
241        return GoalLifecycleStatus.PROPOSED;
242      if ("planned".equals(codeString))
243        return GoalLifecycleStatus.PLANNED;
244      if ("accepted".equals(codeString))
245        return GoalLifecycleStatus.ACCEPTED;
246      if ("active".equals(codeString))
247        return GoalLifecycleStatus.ACTIVE;
248      if ("on-hold".equals(codeString))
249        return GoalLifecycleStatus.ONHOLD;
250      if ("completed".equals(codeString))
251        return GoalLifecycleStatus.COMPLETED;
252      if ("cancelled".equals(codeString))
253        return GoalLifecycleStatus.CANCELLED;
254      if ("entered-in-error".equals(codeString))
255        return GoalLifecycleStatus.ENTEREDINERROR;
256      if ("rejected".equals(codeString))
257        return GoalLifecycleStatus.REJECTED;
258      throw new IllegalArgumentException("Unknown GoalLifecycleStatus code '" + codeString + "'");
259    }
260
261    public Enumeration<GoalLifecycleStatus> fromType(PrimitiveType<?> code) throws FHIRException {
262      if (code == null)
263        return null;
264      if (code.isEmpty())
265        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.NULL, code);
266      String codeString = code.asStringValue();
267      if (codeString == null || "".equals(codeString))
268        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.NULL, code);
269      if ("proposed".equals(codeString))
270        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.PROPOSED, code);
271      if ("planned".equals(codeString))
272        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.PLANNED, code);
273      if ("accepted".equals(codeString))
274        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ACCEPTED, code);
275      if ("active".equals(codeString))
276        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ACTIVE, code);
277      if ("on-hold".equals(codeString))
278        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ONHOLD, code);
279      if ("completed".equals(codeString))
280        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.COMPLETED, code);
281      if ("cancelled".equals(codeString))
282        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.CANCELLED, code);
283      if ("entered-in-error".equals(codeString))
284        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ENTEREDINERROR, code);
285      if ("rejected".equals(codeString))
286        return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.REJECTED, code);
287      throw new FHIRException("Unknown GoalLifecycleStatus code '" + codeString + "'");
288    }
289
290    public String toCode(GoalLifecycleStatus code) {
291      if (code == GoalLifecycleStatus.PROPOSED)
292        return "proposed";
293      if (code == GoalLifecycleStatus.PLANNED)
294        return "planned";
295      if (code == GoalLifecycleStatus.ACCEPTED)
296        return "accepted";
297      if (code == GoalLifecycleStatus.ACTIVE)
298        return "active";
299      if (code == GoalLifecycleStatus.ONHOLD)
300        return "on-hold";
301      if (code == GoalLifecycleStatus.COMPLETED)
302        return "completed";
303      if (code == GoalLifecycleStatus.CANCELLED)
304        return "cancelled";
305      if (code == GoalLifecycleStatus.ENTEREDINERROR)
306        return "entered-in-error";
307      if (code == GoalLifecycleStatus.REJECTED)
308        return "rejected";
309      return "?";
310    }
311
312    public String toSystem(GoalLifecycleStatus code) {
313      return code.getSystem();
314    }
315  }
316
317  @Block()
318  public static class GoalTargetComponent extends BackboneElement implements IBaseBackboneElement {
319    /**
320     * The parameter whose value is being tracked, e.g. body weight, blood pressure,
321     * or hemoglobin A1c level.
322     */
323    @Child(name = "measure", type = {
324        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
325    @Description(shortDefinition = "The parameter whose value is being tracked", formalDefinition = "The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.")
326    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-codes")
327    protected CodeableConcept measure;
328
329    /**
330     * The target value of the focus to be achieved to signify the fulfillment of
331     * the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the
332     * range can be specified. When a low value is missing, it indicates that the
333     * goal is achieved at any focus value at or below the high value. Similarly, if
334     * the high value is missing, it indicates that the goal is achieved at any
335     * focus value at or above the low value.
336     */
337    @Child(name = "detail", type = { Quantity.class, Range.class, CodeableConcept.class, StringType.class,
338        BooleanType.class, IntegerType.class,
339        Ratio.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
340    @Description(shortDefinition = "The target value to be achieved", formalDefinition = "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.")
341    protected Type detail;
342
343    /**
344     * Indicates either the date or the duration after start by which the goal
345     * should be met.
346     */
347    @Child(name = "due", type = { DateType.class,
348        Duration.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
349    @Description(shortDefinition = "Reach goal on or before", formalDefinition = "Indicates either the date or the duration after start by which the goal should be met.")
350    protected Type due;
351
352    private static final long serialVersionUID = -585108934L;
353
354    /**
355     * Constructor
356     */
357    public GoalTargetComponent() {
358      super();
359    }
360
361    /**
362     * @return {@link #measure} (The parameter whose value is being tracked, e.g.
363     *         body weight, blood pressure, or hemoglobin A1c level.)
364     */
365    public CodeableConcept getMeasure() {
366      if (this.measure == null)
367        if (Configuration.errorOnAutoCreate())
368          throw new Error("Attempt to auto-create GoalTargetComponent.measure");
369        else if (Configuration.doAutoCreate())
370          this.measure = new CodeableConcept(); // cc
371      return this.measure;
372    }
373
374    public boolean hasMeasure() {
375      return this.measure != null && !this.measure.isEmpty();
376    }
377
378    /**
379     * @param value {@link #measure} (The parameter whose value is being tracked,
380     *              e.g. body weight, blood pressure, or hemoglobin A1c level.)
381     */
382    public GoalTargetComponent setMeasure(CodeableConcept value) {
383      this.measure = value;
384      return this;
385    }
386
387    /**
388     * @return {@link #detail} (The target value of the focus to be achieved to
389     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
390     *         the high or low or both values of the range can be specified. When a
391     *         low value is missing, it indicates that the goal is achieved at any
392     *         focus value at or below the high value. Similarly, if the high value
393     *         is missing, it indicates that the goal is achieved at any focus value
394     *         at or above the low value.)
395     */
396    public Type getDetail() {
397      return this.detail;
398    }
399
400    /**
401     * @return {@link #detail} (The target value of the focus to be achieved to
402     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
403     *         the high or low or both values of the range can be specified. When a
404     *         low value is missing, it indicates that the goal is achieved at any
405     *         focus value at or below the high value. Similarly, if the high value
406     *         is missing, it indicates that the goal is achieved at any focus value
407     *         at or above the low value.)
408     */
409    public Quantity getDetailQuantity() throws FHIRException {
410      if (this.detail == null)
411        this.detail = new Quantity();
412      if (!(this.detail instanceof Quantity))
413        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.detail.getClass().getName()
414            + " was encountered");
415      return (Quantity) this.detail;
416    }
417
418    public boolean hasDetailQuantity() {
419      return this != null && this.detail instanceof Quantity;
420    }
421
422    /**
423     * @return {@link #detail} (The target value of the focus to be achieved to
424     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
425     *         the high or low or both values of the range can be specified. When a
426     *         low value is missing, it indicates that the goal is achieved at any
427     *         focus value at or below the high value. Similarly, if the high value
428     *         is missing, it indicates that the goal is achieved at any focus value
429     *         at or above the low value.)
430     */
431    public Range getDetailRange() throws FHIRException {
432      if (this.detail == null)
433        this.detail = new Range();
434      if (!(this.detail instanceof Range))
435        throw new FHIRException(
436            "Type mismatch: the type Range was expected, but " + this.detail.getClass().getName() + " was encountered");
437      return (Range) this.detail;
438    }
439
440    public boolean hasDetailRange() {
441      return this != null && this.detail instanceof Range;
442    }
443
444    /**
445     * @return {@link #detail} (The target value of the focus to be achieved to
446     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
447     *         the high or low or both values of the range can be specified. When a
448     *         low value is missing, it indicates that the goal is achieved at any
449     *         focus value at or below the high value. Similarly, if the high value
450     *         is missing, it indicates that the goal is achieved at any focus value
451     *         at or above the low value.)
452     */
453    public CodeableConcept getDetailCodeableConcept() throws FHIRException {
454      if (this.detail == null)
455        this.detail = new CodeableConcept();
456      if (!(this.detail instanceof CodeableConcept))
457        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
458            + this.detail.getClass().getName() + " was encountered");
459      return (CodeableConcept) this.detail;
460    }
461
462    public boolean hasDetailCodeableConcept() {
463      return this != null && this.detail instanceof CodeableConcept;
464    }
465
466    /**
467     * @return {@link #detail} (The target value of the focus to be achieved to
468     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
469     *         the high or low or both values of the range can be specified. When a
470     *         low value is missing, it indicates that the goal is achieved at any
471     *         focus value at or below the high value. Similarly, if the high value
472     *         is missing, it indicates that the goal is achieved at any focus value
473     *         at or above the low value.)
474     */
475    public StringType getDetailStringType() throws FHIRException {
476      if (this.detail == null)
477        this.detail = new StringType();
478      if (!(this.detail instanceof StringType))
479        throw new FHIRException("Type mismatch: the type StringType was expected, but "
480            + this.detail.getClass().getName() + " was encountered");
481      return (StringType) this.detail;
482    }
483
484    public boolean hasDetailStringType() {
485      return this != null && this.detail instanceof StringType;
486    }
487
488    /**
489     * @return {@link #detail} (The target value of the focus to be achieved to
490     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
491     *         the high or low or both values of the range can be specified. When a
492     *         low value is missing, it indicates that the goal is achieved at any
493     *         focus value at or below the high value. Similarly, if the high value
494     *         is missing, it indicates that the goal is achieved at any focus value
495     *         at or above the low value.)
496     */
497    public BooleanType getDetailBooleanType() throws FHIRException {
498      if (this.detail == null)
499        this.detail = new BooleanType();
500      if (!(this.detail instanceof BooleanType))
501        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
502            + this.detail.getClass().getName() + " was encountered");
503      return (BooleanType) this.detail;
504    }
505
506    public boolean hasDetailBooleanType() {
507      return this != null && this.detail instanceof BooleanType;
508    }
509
510    /**
511     * @return {@link #detail} (The target value of the focus to be achieved to
512     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
513     *         the high or low or both values of the range can be specified. When a
514     *         low value is missing, it indicates that the goal is achieved at any
515     *         focus value at or below the high value. Similarly, if the high value
516     *         is missing, it indicates that the goal is achieved at any focus value
517     *         at or above the low value.)
518     */
519    public IntegerType getDetailIntegerType() throws FHIRException {
520      if (this.detail == null)
521        this.detail = new IntegerType();
522      if (!(this.detail instanceof IntegerType))
523        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
524            + this.detail.getClass().getName() + " was encountered");
525      return (IntegerType) this.detail;
526    }
527
528    public boolean hasDetailIntegerType() {
529      return this != null && this.detail instanceof IntegerType;
530    }
531
532    /**
533     * @return {@link #detail} (The target value of the focus to be achieved to
534     *         signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either
535     *         the high or low or both values of the range can be specified. When a
536     *         low value is missing, it indicates that the goal is achieved at any
537     *         focus value at or below the high value. Similarly, if the high value
538     *         is missing, it indicates that the goal is achieved at any focus value
539     *         at or above the low value.)
540     */
541    public Ratio getDetailRatio() throws FHIRException {
542      if (this.detail == null)
543        this.detail = new Ratio();
544      if (!(this.detail instanceof Ratio))
545        throw new FHIRException(
546            "Type mismatch: the type Ratio was expected, but " + this.detail.getClass().getName() + " was encountered");
547      return (Ratio) this.detail;
548    }
549
550    public boolean hasDetailRatio() {
551      return this != null && this.detail instanceof Ratio;
552    }
553
554    public boolean hasDetail() {
555      return this.detail != null && !this.detail.isEmpty();
556    }
557
558    /**
559     * @param value {@link #detail} (The target value of the focus to be achieved to
560     *              signify the fulfillment of the goal, e.g. 150 pounds, 7.0%.
561     *              Either the high or low or both values of the range can be
562     *              specified. When a low value is missing, it indicates that the
563     *              goal is achieved at any focus value at or below the high value.
564     *              Similarly, if the high value is missing, it indicates that the
565     *              goal is achieved at any focus value at or above the low value.)
566     */
567    public GoalTargetComponent setDetail(Type value) {
568      if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof CodeableConcept
569          || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType
570          || value instanceof Ratio))
571        throw new Error("Not the right type for Goal.target.detail[x]: " + value.fhirType());
572      this.detail = value;
573      return this;
574    }
575
576    /**
577     * @return {@link #due} (Indicates either the date or the duration after start
578     *         by which the goal should be met.)
579     */
580    public Type getDue() {
581      return this.due;
582    }
583
584    /**
585     * @return {@link #due} (Indicates either the date or the duration after start
586     *         by which the goal should be met.)
587     */
588    public DateType getDueDateType() throws FHIRException {
589      if (this.due == null)
590        this.due = new DateType();
591      if (!(this.due instanceof DateType))
592        throw new FHIRException(
593            "Type mismatch: the type DateType was expected, but " + this.due.getClass().getName() + " was encountered");
594      return (DateType) this.due;
595    }
596
597    public boolean hasDueDateType() {
598      return this != null && this.due instanceof DateType;
599    }
600
601    /**
602     * @return {@link #due} (Indicates either the date or the duration after start
603     *         by which the goal should be met.)
604     */
605    public Duration getDueDuration() throws FHIRException {
606      if (this.due == null)
607        this.due = new Duration();
608      if (!(this.due instanceof Duration))
609        throw new FHIRException(
610            "Type mismatch: the type Duration was expected, but " + this.due.getClass().getName() + " was encountered");
611      return (Duration) this.due;
612    }
613
614    public boolean hasDueDuration() {
615      return this != null && this.due instanceof Duration;
616    }
617
618    public boolean hasDue() {
619      return this.due != null && !this.due.isEmpty();
620    }
621
622    /**
623     * @param value {@link #due} (Indicates either the date or the duration after
624     *              start by which the goal should be met.)
625     */
626    public GoalTargetComponent setDue(Type value) {
627      if (value != null && !(value instanceof DateType || value instanceof Duration))
628        throw new Error("Not the right type for Goal.target.due[x]: " + value.fhirType());
629      this.due = value;
630      return this;
631    }
632
633    protected void listChildren(List<Property> children) {
634      super.listChildren(children);
635      children.add(new Property("measure", "CodeableConcept",
636          "The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0,
637          1, measure));
638      children.add(new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
639          "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
640          0, 1, detail));
641      children.add(new Property("due[x]", "date|Duration",
642          "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due));
643    }
644
645    @Override
646    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
647      switch (_hash) {
648      case 938321246:
649        /* measure */ return new Property("measure", "CodeableConcept",
650            "The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0,
651            1, measure);
652      case -1973084529:
653        /* detail[x] */ return new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
654            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
655            0, 1, detail);
656      case -1335224239:
657        /* detail */ return new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
658            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
659            0, 1, detail);
660      case -1313079300:
661        /* detailQuantity */ return new Property("detail[x]",
662            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
663            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
664            0, 1, detail);
665      case -2062632084:
666        /* detailRange */ return new Property("detail[x]",
667            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
668            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
669            0, 1, detail);
670      case -175586544:
671        /* detailCodeableConcept */ return new Property("detail[x]",
672            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
673            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
674            0, 1, detail);
675      case 529212354:
676        /* detailString */ return new Property("detail[x]",
677            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
678            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
679            0, 1, detail);
680      case 1172184727:
681        /* detailBoolean */ return new Property("detail[x]",
682            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
683            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
684            0, 1, detail);
685      case -1229442131:
686        /* detailInteger */ return new Property("detail[x]",
687            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
688            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
689            0, 1, detail);
690      case -2062626246:
691        /* detailRatio */ return new Property("detail[x]",
692            "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio",
693            "The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.",
694            0, 1, detail);
695      case -1320900084:
696        /* due[x] */ return new Property("due[x]", "date|Duration",
697            "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
698      case 99828:
699        /* due */ return new Property("due[x]", "date|Duration",
700            "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
701      case 2001063874:
702        /* dueDate */ return new Property("due[x]", "date|Duration",
703            "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
704      case -620428376:
705        /* dueDuration */ return new Property("due[x]", "date|Duration",
706            "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
707      default:
708        return super.getNamedProperty(_hash, _name, _checkValid);
709      }
710
711    }
712
713    @Override
714    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
715      switch (hash) {
716      case 938321246:
717        /* measure */ return this.measure == null ? new Base[0] : new Base[] { this.measure }; // CodeableConcept
718      case -1335224239:
719        /* detail */ return this.detail == null ? new Base[0] : new Base[] { this.detail }; // Type
720      case 99828:
721        /* due */ return this.due == null ? new Base[0] : new Base[] { this.due }; // Type
722      default:
723        return super.getProperty(hash, name, checkValid);
724      }
725
726    }
727
728    @Override
729    public Base setProperty(int hash, String name, Base value) throws FHIRException {
730      switch (hash) {
731      case 938321246: // measure
732        this.measure = castToCodeableConcept(value); // CodeableConcept
733        return value;
734      case -1335224239: // detail
735        this.detail = castToType(value); // Type
736        return value;
737      case 99828: // due
738        this.due = castToType(value); // Type
739        return value;
740      default:
741        return super.setProperty(hash, name, value);
742      }
743
744    }
745
746    @Override
747    public Base setProperty(String name, Base value) throws FHIRException {
748      if (name.equals("measure")) {
749        this.measure = castToCodeableConcept(value); // CodeableConcept
750      } else if (name.equals("detail[x]")) {
751        this.detail = castToType(value); // Type
752      } else if (name.equals("due[x]")) {
753        this.due = castToType(value); // Type
754      } else
755        return super.setProperty(name, value);
756      return value;
757    }
758
759  @Override
760  public void removeChild(String name, Base value) throws FHIRException {
761      if (name.equals("measure")) {
762        this.measure = null;
763      } else if (name.equals("detail[x]")) {
764        this.detail = null;
765      } else if (name.equals("due[x]")) {
766        this.due = null;
767      } else
768        super.removeChild(name, value);
769      
770    }
771
772    @Override
773    public Base makeProperty(int hash, String name) throws FHIRException {
774      switch (hash) {
775      case 938321246:
776        return getMeasure();
777      case -1973084529:
778        return getDetail();
779      case -1335224239:
780        return getDetail();
781      case -1320900084:
782        return getDue();
783      case 99828:
784        return getDue();
785      default:
786        return super.makeProperty(hash, name);
787      }
788
789    }
790
791    @Override
792    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
793      switch (hash) {
794      case 938321246:
795        /* measure */ return new String[] { "CodeableConcept" };
796      case -1335224239:
797        /* detail */ return new String[] { "Quantity", "Range", "CodeableConcept", "string", "boolean", "integer",
798            "Ratio" };
799      case 99828:
800        /* due */ return new String[] { "date", "Duration" };
801      default:
802        return super.getTypesForProperty(hash, name);
803      }
804
805    }
806
807    @Override
808    public Base addChild(String name) throws FHIRException {
809      if (name.equals("measure")) {
810        this.measure = new CodeableConcept();
811        return this.measure;
812      } else if (name.equals("detailQuantity")) {
813        this.detail = new Quantity();
814        return this.detail;
815      } else if (name.equals("detailRange")) {
816        this.detail = new Range();
817        return this.detail;
818      } else if (name.equals("detailCodeableConcept")) {
819        this.detail = new CodeableConcept();
820        return this.detail;
821      } else if (name.equals("detailString")) {
822        this.detail = new StringType();
823        return this.detail;
824      } else if (name.equals("detailBoolean")) {
825        this.detail = new BooleanType();
826        return this.detail;
827      } else if (name.equals("detailInteger")) {
828        this.detail = new IntegerType();
829        return this.detail;
830      } else if (name.equals("detailRatio")) {
831        this.detail = new Ratio();
832        return this.detail;
833      } else if (name.equals("dueDate")) {
834        this.due = new DateType();
835        return this.due;
836      } else if (name.equals("dueDuration")) {
837        this.due = new Duration();
838        return this.due;
839      } else
840        return super.addChild(name);
841    }
842
843    public GoalTargetComponent copy() {
844      GoalTargetComponent dst = new GoalTargetComponent();
845      copyValues(dst);
846      return dst;
847    }
848
849    public void copyValues(GoalTargetComponent dst) {
850      super.copyValues(dst);
851      dst.measure = measure == null ? null : measure.copy();
852      dst.detail = detail == null ? null : detail.copy();
853      dst.due = due == null ? null : due.copy();
854    }
855
856    @Override
857    public boolean equalsDeep(Base other_) {
858      if (!super.equalsDeep(other_))
859        return false;
860      if (!(other_ instanceof GoalTargetComponent))
861        return false;
862      GoalTargetComponent o = (GoalTargetComponent) other_;
863      return compareDeep(measure, o.measure, true) && compareDeep(detail, o.detail, true)
864          && compareDeep(due, o.due, true);
865    }
866
867    @Override
868    public boolean equalsShallow(Base other_) {
869      if (!super.equalsShallow(other_))
870        return false;
871      if (!(other_ instanceof GoalTargetComponent))
872        return false;
873      GoalTargetComponent o = (GoalTargetComponent) other_;
874      return true;
875    }
876
877    public boolean isEmpty() {
878      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(measure, detail, due);
879    }
880
881    public String fhirType() {
882      return "Goal.target";
883
884    }
885
886  }
887
888  /**
889   * Business identifiers assigned to this goal by the performer or other systems
890   * which remain constant as the resource is updated and propagates from server
891   * to server.
892   */
893  @Child(name = "identifier", type = {
894      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
895  @Description(shortDefinition = "External Ids for this goal", formalDefinition = "Business identifiers assigned to this goal by the performer or other systems which remain constant as the resource is updated and propagates from server to server.")
896  protected List<Identifier> identifier;
897
898  /**
899   * The state of the goal throughout its lifecycle.
900   */
901  @Child(name = "lifecycleStatus", type = {
902      CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
903  @Description(shortDefinition = "proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected", formalDefinition = "The state of the goal throughout its lifecycle.")
904  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/goal-status")
905  protected Enumeration<GoalLifecycleStatus> lifecycleStatus;
906
907  /**
908   * Describes the progression, or lack thereof, towards the goal against the
909   * target.
910   */
911  @Child(name = "achievementStatus", type = {
912      CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
913  @Description(shortDefinition = "in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable", formalDefinition = "Describes the progression, or lack thereof, towards the goal against the target.")
914  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/goal-achievement")
915  protected CodeableConcept achievementStatus;
916
917  /**
918   * Indicates a category the goal falls within.
919   */
920  @Child(name = "category", type = {
921      CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
922  @Description(shortDefinition = "E.g. Treatment, dietary, behavioral, etc.", formalDefinition = "Indicates a category the goal falls within.")
923  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/goal-category")
924  protected List<CodeableConcept> category;
925
926  /**
927   * Identifies the mutually agreed level of importance associated with
928   * reaching/sustaining the goal.
929   */
930  @Child(name = "priority", type = {
931      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
932  @Description(shortDefinition = "high-priority | medium-priority | low-priority", formalDefinition = "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.")
933  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/goal-priority")
934  protected CodeableConcept priority;
935
936  /**
937   * Human-readable and/or coded description of a specific desired objective of
938   * care, such as "control blood pressure" or "negotiate an obstacle course" or
939   * "dance with child at wedding".
940   */
941  @Child(name = "description", type = {
942      CodeableConcept.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
943  @Description(shortDefinition = "Code or text describing goal", formalDefinition = "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".")
944  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/clinical-findings")
945  protected CodeableConcept description;
946
947  /**
948   * Identifies the patient, group or organization for whom the goal is being
949   * established.
950   */
951  @Child(name = "subject", type = { Patient.class, Group.class,
952      Organization.class }, order = 6, min = 1, max = 1, modifier = false, summary = true)
953  @Description(shortDefinition = "Who this goal is intended for", formalDefinition = "Identifies the patient, group or organization for whom the goal is being established.")
954  protected Reference subject;
955
956  /**
957   * The actual object that is the target of the reference (Identifies the
958   * patient, group or organization for whom the goal is being established.)
959   */
960  protected Resource subjectTarget;
961
962  /**
963   * The date or event after which the goal should begin being pursued.
964   */
965  @Child(name = "start", type = { DateType.class,
966      CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
967  @Description(shortDefinition = "When goal pursuit begins", formalDefinition = "The date or event after which the goal should begin being pursued.")
968  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/goal-start-event")
969  protected Type start;
970
971  /**
972   * Indicates what should be done by when.
973   */
974  @Child(name = "target", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
975  @Description(shortDefinition = "Target outcome for the goal", formalDefinition = "Indicates what should be done by when.")
976  protected List<GoalTargetComponent> target;
977
978  /**
979   * Identifies when the current status. I.e. When initially created, when
980   * achieved, when cancelled, etc.
981   */
982  @Child(name = "statusDate", type = { DateType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
983  @Description(shortDefinition = "When goal status took effect", formalDefinition = "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.")
984  protected DateType statusDate;
985
986  /**
987   * Captures the reason for the current status.
988   */
989  @Child(name = "statusReason", type = {
990      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
991  @Description(shortDefinition = "Reason for current status", formalDefinition = "Captures the reason for the current status.")
992  protected StringType statusReason;
993
994  /**
995   * Indicates whose goal this is - patient goal, practitioner goal, etc.
996   */
997  @Child(name = "expressedBy", type = { Patient.class, Practitioner.class, PractitionerRole.class,
998      RelatedPerson.class }, order = 11, min = 0, max = 1, modifier = false, summary = true)
999  @Description(shortDefinition = "Who's responsible for creating Goal?", formalDefinition = "Indicates whose goal this is - patient goal, practitioner goal, etc.")
1000  protected Reference expressedBy;
1001
1002  /**
1003   * The actual object that is the target of the reference (Indicates whose goal
1004   * this is - patient goal, practitioner goal, etc.)
1005   */
1006  protected Resource expressedByTarget;
1007
1008  /**
1009   * The identified conditions and other health record elements that are intended
1010   * to be addressed by the goal.
1011   */
1012  @Child(name = "addresses", type = { Condition.class, Observation.class, MedicationStatement.class,
1013      NutritionOrder.class, ServiceRequest.class,
1014      RiskAssessment.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1015  @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.")
1016  protected List<Reference> addresses;
1017  /**
1018   * The actual objects that are the target of the reference (The identified
1019   * conditions and other health record elements that are intended to be addressed
1020   * by the goal.)
1021   */
1022  protected List<Resource> addressesTarget;
1023
1024  /**
1025   * Any comments related to the goal.
1026   */
1027  @Child(name = "note", type = {
1028      Annotation.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1029  @Description(shortDefinition = "Comments about the goal", formalDefinition = "Any comments related to the goal.")
1030  protected List<Annotation> note;
1031
1032  /**
1033   * Identifies the change (or lack of change) at the point when the status of the
1034   * goal is assessed.
1035   */
1036  @Child(name = "outcomeCode", type = {
1037      CodeableConcept.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1038  @Description(shortDefinition = "What result was achieved regarding the goal?", formalDefinition = "Identifies the change (or lack of change) at the point when the status of the goal is assessed.")
1039  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/clinical-findings")
1040  protected List<CodeableConcept> outcomeCode;
1041
1042  /**
1043   * Details of what's changed (or not changed).
1044   */
1045  @Child(name = "outcomeReference", type = {
1046      Observation.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1047  @Description(shortDefinition = "Observation that resulted from goal", formalDefinition = "Details of what's changed (or not changed).")
1048  protected List<Reference> outcomeReference;
1049  /**
1050   * The actual objects that are the target of the reference (Details of what's
1051   * changed (or not changed).)
1052   */
1053  protected List<Observation> outcomeReferenceTarget;
1054
1055  private static final long serialVersionUID = -1366854797L;
1056
1057  /**
1058   * Constructor
1059   */
1060  public Goal() {
1061    super();
1062  }
1063
1064  /**
1065   * Constructor
1066   */
1067  public Goal(Enumeration<GoalLifecycleStatus> lifecycleStatus, CodeableConcept description, Reference subject) {
1068    super();
1069    this.lifecycleStatus = lifecycleStatus;
1070    this.description = description;
1071    this.subject = subject;
1072  }
1073
1074  /**
1075   * @return {@link #identifier} (Business identifiers assigned to this goal by
1076   *         the performer or other systems which remain constant as the resource
1077   *         is updated and propagates from server to server.)
1078   */
1079  public List<Identifier> getIdentifier() {
1080    if (this.identifier == null)
1081      this.identifier = new ArrayList<Identifier>();
1082    return this.identifier;
1083  }
1084
1085  /**
1086   * @return Returns a reference to <code>this</code> for easy method chaining
1087   */
1088  public Goal setIdentifier(List<Identifier> theIdentifier) {
1089    this.identifier = theIdentifier;
1090    return this;
1091  }
1092
1093  public boolean hasIdentifier() {
1094    if (this.identifier == null)
1095      return false;
1096    for (Identifier item : this.identifier)
1097      if (!item.isEmpty())
1098        return true;
1099    return false;
1100  }
1101
1102  public Identifier addIdentifier() { // 3
1103    Identifier t = new Identifier();
1104    if (this.identifier == null)
1105      this.identifier = new ArrayList<Identifier>();
1106    this.identifier.add(t);
1107    return t;
1108  }
1109
1110  public Goal addIdentifier(Identifier t) { // 3
1111    if (t == null)
1112      return this;
1113    if (this.identifier == null)
1114      this.identifier = new ArrayList<Identifier>();
1115    this.identifier.add(t);
1116    return this;
1117  }
1118
1119  /**
1120   * @return The first repetition of repeating field {@link #identifier}, creating
1121   *         it if it does not already exist
1122   */
1123  public Identifier getIdentifierFirstRep() {
1124    if (getIdentifier().isEmpty()) {
1125      addIdentifier();
1126    }
1127    return getIdentifier().get(0);
1128  }
1129
1130  /**
1131   * @return {@link #lifecycleStatus} (The state of the goal throughout its
1132   *         lifecycle.). This is the underlying object with id, value and
1133   *         extensions. The accessor "getLifecycleStatus" gives direct access to
1134   *         the value
1135   */
1136  public Enumeration<GoalLifecycleStatus> getLifecycleStatusElement() {
1137    if (this.lifecycleStatus == null)
1138      if (Configuration.errorOnAutoCreate())
1139        throw new Error("Attempt to auto-create Goal.lifecycleStatus");
1140      else if (Configuration.doAutoCreate())
1141        this.lifecycleStatus = new Enumeration<GoalLifecycleStatus>(new GoalLifecycleStatusEnumFactory()); // bb
1142    return this.lifecycleStatus;
1143  }
1144
1145  public boolean hasLifecycleStatusElement() {
1146    return this.lifecycleStatus != null && !this.lifecycleStatus.isEmpty();
1147  }
1148
1149  public boolean hasLifecycleStatus() {
1150    return this.lifecycleStatus != null && !this.lifecycleStatus.isEmpty();
1151  }
1152
1153  /**
1154   * @param value {@link #lifecycleStatus} (The state of the goal throughout its
1155   *              lifecycle.). This is the underlying object with id, value and
1156   *              extensions. The accessor "getLifecycleStatus" gives direct
1157   *              access to the value
1158   */
1159  public Goal setLifecycleStatusElement(Enumeration<GoalLifecycleStatus> value) {
1160    this.lifecycleStatus = value;
1161    return this;
1162  }
1163
1164  /**
1165   * @return The state of the goal throughout its lifecycle.
1166   */
1167  public GoalLifecycleStatus getLifecycleStatus() {
1168    return this.lifecycleStatus == null ? null : this.lifecycleStatus.getValue();
1169  }
1170
1171  /**
1172   * @param value The state of the goal throughout its lifecycle.
1173   */
1174  public Goal setLifecycleStatus(GoalLifecycleStatus value) {
1175    if (this.lifecycleStatus == null)
1176      this.lifecycleStatus = new Enumeration<GoalLifecycleStatus>(new GoalLifecycleStatusEnumFactory());
1177    this.lifecycleStatus.setValue(value);
1178    return this;
1179  }
1180
1181  /**
1182   * @return {@link #achievementStatus} (Describes the progression, or lack
1183   *         thereof, towards the goal against the target.)
1184   */
1185  public CodeableConcept getAchievementStatus() {
1186    if (this.achievementStatus == null)
1187      if (Configuration.errorOnAutoCreate())
1188        throw new Error("Attempt to auto-create Goal.achievementStatus");
1189      else if (Configuration.doAutoCreate())
1190        this.achievementStatus = new CodeableConcept(); // cc
1191    return this.achievementStatus;
1192  }
1193
1194  public boolean hasAchievementStatus() {
1195    return this.achievementStatus != null && !this.achievementStatus.isEmpty();
1196  }
1197
1198  /**
1199   * @param value {@link #achievementStatus} (Describes the progression, or lack
1200   *              thereof, towards the goal against the target.)
1201   */
1202  public Goal setAchievementStatus(CodeableConcept value) {
1203    this.achievementStatus = value;
1204    return this;
1205  }
1206
1207  /**
1208   * @return {@link #category} (Indicates a category the goal falls within.)
1209   */
1210  public List<CodeableConcept> getCategory() {
1211    if (this.category == null)
1212      this.category = new ArrayList<CodeableConcept>();
1213    return this.category;
1214  }
1215
1216  /**
1217   * @return Returns a reference to <code>this</code> for easy method chaining
1218   */
1219  public Goal setCategory(List<CodeableConcept> theCategory) {
1220    this.category = theCategory;
1221    return this;
1222  }
1223
1224  public boolean hasCategory() {
1225    if (this.category == null)
1226      return false;
1227    for (CodeableConcept item : this.category)
1228      if (!item.isEmpty())
1229        return true;
1230    return false;
1231  }
1232
1233  public CodeableConcept addCategory() { // 3
1234    CodeableConcept t = new CodeableConcept();
1235    if (this.category == null)
1236      this.category = new ArrayList<CodeableConcept>();
1237    this.category.add(t);
1238    return t;
1239  }
1240
1241  public Goal addCategory(CodeableConcept t) { // 3
1242    if (t == null)
1243      return this;
1244    if (this.category == null)
1245      this.category = new ArrayList<CodeableConcept>();
1246    this.category.add(t);
1247    return this;
1248  }
1249
1250  /**
1251   * @return The first repetition of repeating field {@link #category}, creating
1252   *         it if it does not already exist
1253   */
1254  public CodeableConcept getCategoryFirstRep() {
1255    if (getCategory().isEmpty()) {
1256      addCategory();
1257    }
1258    return getCategory().get(0);
1259  }
1260
1261  /**
1262   * @return {@link #priority} (Identifies the mutually agreed level of importance
1263   *         associated with reaching/sustaining the goal.)
1264   */
1265  public CodeableConcept getPriority() {
1266    if (this.priority == null)
1267      if (Configuration.errorOnAutoCreate())
1268        throw new Error("Attempt to auto-create Goal.priority");
1269      else if (Configuration.doAutoCreate())
1270        this.priority = new CodeableConcept(); // cc
1271    return this.priority;
1272  }
1273
1274  public boolean hasPriority() {
1275    return this.priority != null && !this.priority.isEmpty();
1276  }
1277
1278  /**
1279   * @param value {@link #priority} (Identifies the mutually agreed level of
1280   *              importance associated with reaching/sustaining the goal.)
1281   */
1282  public Goal setPriority(CodeableConcept value) {
1283    this.priority = value;
1284    return this;
1285  }
1286
1287  /**
1288   * @return {@link #description} (Human-readable and/or coded description of a
1289   *         specific desired objective of care, such as "control blood pressure"
1290   *         or "negotiate an obstacle course" or "dance with child at wedding".)
1291   */
1292  public CodeableConcept getDescription() {
1293    if (this.description == null)
1294      if (Configuration.errorOnAutoCreate())
1295        throw new Error("Attempt to auto-create Goal.description");
1296      else if (Configuration.doAutoCreate())
1297        this.description = new CodeableConcept(); // cc
1298    return this.description;
1299  }
1300
1301  public boolean hasDescription() {
1302    return this.description != null && !this.description.isEmpty();
1303  }
1304
1305  /**
1306   * @param value {@link #description} (Human-readable and/or coded description of
1307   *              a specific desired objective of care, such as "control blood
1308   *              pressure" or "negotiate an obstacle course" or "dance with child
1309   *              at wedding".)
1310   */
1311  public Goal setDescription(CodeableConcept value) {
1312    this.description = value;
1313    return this;
1314  }
1315
1316  /**
1317   * @return {@link #subject} (Identifies the patient, group or organization for
1318   *         whom the goal is being established.)
1319   */
1320  public Reference getSubject() {
1321    if (this.subject == null)
1322      if (Configuration.errorOnAutoCreate())
1323        throw new Error("Attempt to auto-create Goal.subject");
1324      else if (Configuration.doAutoCreate())
1325        this.subject = new Reference(); // cc
1326    return this.subject;
1327  }
1328
1329  public boolean hasSubject() {
1330    return this.subject != null && !this.subject.isEmpty();
1331  }
1332
1333  /**
1334   * @param value {@link #subject} (Identifies the patient, group or organization
1335   *              for whom the goal is being established.)
1336   */
1337  public Goal setSubject(Reference value) {
1338    this.subject = value;
1339    return this;
1340  }
1341
1342  /**
1343   * @return {@link #subject} The actual object that is the target of the
1344   *         reference. The reference library doesn't populate this, but you can
1345   *         use it to hold the resource if you resolve it. (Identifies the
1346   *         patient, group or organization for whom the goal is being
1347   *         established.)
1348   */
1349  public Resource getSubjectTarget() {
1350    return this.subjectTarget;
1351  }
1352
1353  /**
1354   * @param value {@link #subject} The actual object that is the target of the
1355   *              reference. The reference library doesn't use these, but you can
1356   *              use it to hold the resource if you resolve it. (Identifies the
1357   *              patient, group or organization for whom the goal is being
1358   *              established.)
1359   */
1360  public Goal setSubjectTarget(Resource value) {
1361    this.subjectTarget = value;
1362    return this;
1363  }
1364
1365  /**
1366   * @return {@link #start} (The date or event after which the goal should begin
1367   *         being pursued.)
1368   */
1369  public Type getStart() {
1370    return this.start;
1371  }
1372
1373  /**
1374   * @return {@link #start} (The date or event after which the goal should begin
1375   *         being pursued.)
1376   */
1377  public DateType getStartDateType() throws FHIRException {
1378    if (this.start == null)
1379      this.start = new DateType();
1380    if (!(this.start instanceof DateType))
1381      throw new FHIRException(
1382          "Type mismatch: the type DateType was expected, but " + this.start.getClass().getName() + " was encountered");
1383    return (DateType) this.start;
1384  }
1385
1386  public boolean hasStartDateType() {
1387    return this != null && this.start instanceof DateType;
1388  }
1389
1390  /**
1391   * @return {@link #start} (The date or event after which the goal should begin
1392   *         being pursued.)
1393   */
1394  public CodeableConcept getStartCodeableConcept() throws FHIRException {
1395    if (this.start == null)
1396      this.start = new CodeableConcept();
1397    if (!(this.start instanceof CodeableConcept))
1398      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1399          + this.start.getClass().getName() + " was encountered");
1400    return (CodeableConcept) this.start;
1401  }
1402
1403  public boolean hasStartCodeableConcept() {
1404    return this != null && this.start instanceof CodeableConcept;
1405  }
1406
1407  public boolean hasStart() {
1408    return this.start != null && !this.start.isEmpty();
1409  }
1410
1411  /**
1412   * @param value {@link #start} (The date or event after which the goal should
1413   *              begin being pursued.)
1414   */
1415  public Goal setStart(Type value) {
1416    if (value != null && !(value instanceof DateType || value instanceof CodeableConcept))
1417      throw new Error("Not the right type for Goal.start[x]: " + value.fhirType());
1418    this.start = value;
1419    return this;
1420  }
1421
1422  /**
1423   * @return {@link #target} (Indicates what should be done by when.)
1424   */
1425  public List<GoalTargetComponent> getTarget() {
1426    if (this.target == null)
1427      this.target = new ArrayList<GoalTargetComponent>();
1428    return this.target;
1429  }
1430
1431  /**
1432   * @return Returns a reference to <code>this</code> for easy method chaining
1433   */
1434  public Goal setTarget(List<GoalTargetComponent> theTarget) {
1435    this.target = theTarget;
1436    return this;
1437  }
1438
1439  public boolean hasTarget() {
1440    if (this.target == null)
1441      return false;
1442    for (GoalTargetComponent item : this.target)
1443      if (!item.isEmpty())
1444        return true;
1445    return false;
1446  }
1447
1448  public GoalTargetComponent addTarget() { // 3
1449    GoalTargetComponent t = new GoalTargetComponent();
1450    if (this.target == null)
1451      this.target = new ArrayList<GoalTargetComponent>();
1452    this.target.add(t);
1453    return t;
1454  }
1455
1456  public Goal addTarget(GoalTargetComponent t) { // 3
1457    if (t == null)
1458      return this;
1459    if (this.target == null)
1460      this.target = new ArrayList<GoalTargetComponent>();
1461    this.target.add(t);
1462    return this;
1463  }
1464
1465  /**
1466   * @return The first repetition of repeating field {@link #target}, creating it
1467   *         if it does not already exist
1468   */
1469  public GoalTargetComponent getTargetFirstRep() {
1470    if (getTarget().isEmpty()) {
1471      addTarget();
1472    }
1473    return getTarget().get(0);
1474  }
1475
1476  /**
1477   * @return {@link #statusDate} (Identifies when the current status. I.e. When
1478   *         initially created, when achieved, when cancelled, etc.). This is the
1479   *         underlying object with id, value and extensions. The accessor
1480   *         "getStatusDate" gives direct access to the value
1481   */
1482  public DateType getStatusDateElement() {
1483    if (this.statusDate == null)
1484      if (Configuration.errorOnAutoCreate())
1485        throw new Error("Attempt to auto-create Goal.statusDate");
1486      else if (Configuration.doAutoCreate())
1487        this.statusDate = new DateType(); // bb
1488    return this.statusDate;
1489  }
1490
1491  public boolean hasStatusDateElement() {
1492    return this.statusDate != null && !this.statusDate.isEmpty();
1493  }
1494
1495  public boolean hasStatusDate() {
1496    return this.statusDate != null && !this.statusDate.isEmpty();
1497  }
1498
1499  /**
1500   * @param value {@link #statusDate} (Identifies when the current status. I.e.
1501   *              When initially created, when achieved, when cancelled, etc.).
1502   *              This is the underlying object with id, value and extensions. The
1503   *              accessor "getStatusDate" gives direct access to the value
1504   */
1505  public Goal setStatusDateElement(DateType value) {
1506    this.statusDate = value;
1507    return this;
1508  }
1509
1510  /**
1511   * @return Identifies when the current status. I.e. When initially created, when
1512   *         achieved, when cancelled, etc.
1513   */
1514  public Date getStatusDate() {
1515    return this.statusDate == null ? null : this.statusDate.getValue();
1516  }
1517
1518  /**
1519   * @param value Identifies when the current status. I.e. When initially created,
1520   *              when achieved, when cancelled, etc.
1521   */
1522  public Goal setStatusDate(Date value) {
1523    if (value == null)
1524      this.statusDate = null;
1525    else {
1526      if (this.statusDate == null)
1527        this.statusDate = new DateType();
1528      this.statusDate.setValue(value);
1529    }
1530    return this;
1531  }
1532
1533  /**
1534   * @return {@link #statusReason} (Captures the reason for the current status.).
1535   *         This is the underlying object with id, value and extensions. The
1536   *         accessor "getStatusReason" gives direct access to the value
1537   */
1538  public StringType getStatusReasonElement() {
1539    if (this.statusReason == null)
1540      if (Configuration.errorOnAutoCreate())
1541        throw new Error("Attempt to auto-create Goal.statusReason");
1542      else if (Configuration.doAutoCreate())
1543        this.statusReason = new StringType(); // bb
1544    return this.statusReason;
1545  }
1546
1547  public boolean hasStatusReasonElement() {
1548    return this.statusReason != null && !this.statusReason.isEmpty();
1549  }
1550
1551  public boolean hasStatusReason() {
1552    return this.statusReason != null && !this.statusReason.isEmpty();
1553  }
1554
1555  /**
1556   * @param value {@link #statusReason} (Captures the reason for the current
1557   *              status.). This is the underlying object with id, value and
1558   *              extensions. The accessor "getStatusReason" gives direct access
1559   *              to the value
1560   */
1561  public Goal setStatusReasonElement(StringType value) {
1562    this.statusReason = value;
1563    return this;
1564  }
1565
1566  /**
1567   * @return Captures the reason for the current status.
1568   */
1569  public String getStatusReason() {
1570    return this.statusReason == null ? null : this.statusReason.getValue();
1571  }
1572
1573  /**
1574   * @param value Captures the reason for the current status.
1575   */
1576  public Goal setStatusReason(String value) {
1577    if (Utilities.noString(value))
1578      this.statusReason = null;
1579    else {
1580      if (this.statusReason == null)
1581        this.statusReason = new StringType();
1582      this.statusReason.setValue(value);
1583    }
1584    return this;
1585  }
1586
1587  /**
1588   * @return {@link #expressedBy} (Indicates whose goal this is - patient goal,
1589   *         practitioner goal, etc.)
1590   */
1591  public Reference getExpressedBy() {
1592    if (this.expressedBy == null)
1593      if (Configuration.errorOnAutoCreate())
1594        throw new Error("Attempt to auto-create Goal.expressedBy");
1595      else if (Configuration.doAutoCreate())
1596        this.expressedBy = new Reference(); // cc
1597    return this.expressedBy;
1598  }
1599
1600  public boolean hasExpressedBy() {
1601    return this.expressedBy != null && !this.expressedBy.isEmpty();
1602  }
1603
1604  /**
1605   * @param value {@link #expressedBy} (Indicates whose goal this is - patient
1606   *              goal, practitioner goal, etc.)
1607   */
1608  public Goal setExpressedBy(Reference value) {
1609    this.expressedBy = value;
1610    return this;
1611  }
1612
1613  /**
1614   * @return {@link #expressedBy} The actual object that is the target of the
1615   *         reference. The reference library doesn't populate this, but you can
1616   *         use it to hold the resource if you resolve it. (Indicates whose goal
1617   *         this is - patient goal, practitioner goal, etc.)
1618   */
1619  public Resource getExpressedByTarget() {
1620    return this.expressedByTarget;
1621  }
1622
1623  /**
1624   * @param value {@link #expressedBy} The actual object that is the target of the
1625   *              reference. The reference library doesn't use these, but you can
1626   *              use it to hold the resource if you resolve it. (Indicates whose
1627   *              goal this is - patient goal, practitioner goal, etc.)
1628   */
1629  public Goal setExpressedByTarget(Resource value) {
1630    this.expressedByTarget = value;
1631    return this;
1632  }
1633
1634  /**
1635   * @return {@link #addresses} (The identified conditions and other health record
1636   *         elements that are intended to be addressed by the goal.)
1637   */
1638  public List<Reference> getAddresses() {
1639    if (this.addresses == null)
1640      this.addresses = new ArrayList<Reference>();
1641    return this.addresses;
1642  }
1643
1644  /**
1645   * @return Returns a reference to <code>this</code> for easy method chaining
1646   */
1647  public Goal setAddresses(List<Reference> theAddresses) {
1648    this.addresses = theAddresses;
1649    return this;
1650  }
1651
1652  public boolean hasAddresses() {
1653    if (this.addresses == null)
1654      return false;
1655    for (Reference item : this.addresses)
1656      if (!item.isEmpty())
1657        return true;
1658    return false;
1659  }
1660
1661  public Reference addAddresses() { // 3
1662    Reference t = new Reference();
1663    if (this.addresses == null)
1664      this.addresses = new ArrayList<Reference>();
1665    this.addresses.add(t);
1666    return t;
1667  }
1668
1669  public Goal addAddresses(Reference t) { // 3
1670    if (t == null)
1671      return this;
1672    if (this.addresses == null)
1673      this.addresses = new ArrayList<Reference>();
1674    this.addresses.add(t);
1675    return this;
1676  }
1677
1678  /**
1679   * @return The first repetition of repeating field {@link #addresses}, creating
1680   *         it if it does not already exist
1681   */
1682  public Reference getAddressesFirstRep() {
1683    if (getAddresses().isEmpty()) {
1684      addAddresses();
1685    }
1686    return getAddresses().get(0);
1687  }
1688
1689  /**
1690   * @deprecated Use Reference#setResource(IBaseResource) instead
1691   */
1692  @Deprecated
1693  public List<Resource> getAddressesTarget() {
1694    if (this.addressesTarget == null)
1695      this.addressesTarget = new ArrayList<Resource>();
1696    return this.addressesTarget;
1697  }
1698
1699  /**
1700   * @return {@link #note} (Any comments related to the goal.)
1701   */
1702  public List<Annotation> getNote() {
1703    if (this.note == null)
1704      this.note = new ArrayList<Annotation>();
1705    return this.note;
1706  }
1707
1708  /**
1709   * @return Returns a reference to <code>this</code> for easy method chaining
1710   */
1711  public Goal setNote(List<Annotation> theNote) {
1712    this.note = theNote;
1713    return this;
1714  }
1715
1716  public boolean hasNote() {
1717    if (this.note == null)
1718      return false;
1719    for (Annotation item : this.note)
1720      if (!item.isEmpty())
1721        return true;
1722    return false;
1723  }
1724
1725  public Annotation addNote() { // 3
1726    Annotation t = new Annotation();
1727    if (this.note == null)
1728      this.note = new ArrayList<Annotation>();
1729    this.note.add(t);
1730    return t;
1731  }
1732
1733  public Goal addNote(Annotation t) { // 3
1734    if (t == null)
1735      return this;
1736    if (this.note == null)
1737      this.note = new ArrayList<Annotation>();
1738    this.note.add(t);
1739    return this;
1740  }
1741
1742  /**
1743   * @return The first repetition of repeating field {@link #note}, creating it if
1744   *         it does not already exist
1745   */
1746  public Annotation getNoteFirstRep() {
1747    if (getNote().isEmpty()) {
1748      addNote();
1749    }
1750    return getNote().get(0);
1751  }
1752
1753  /**
1754   * @return {@link #outcomeCode} (Identifies the change (or lack of change) at
1755   *         the point when the status of the goal is assessed.)
1756   */
1757  public List<CodeableConcept> getOutcomeCode() {
1758    if (this.outcomeCode == null)
1759      this.outcomeCode = new ArrayList<CodeableConcept>();
1760    return this.outcomeCode;
1761  }
1762
1763  /**
1764   * @return Returns a reference to <code>this</code> for easy method chaining
1765   */
1766  public Goal setOutcomeCode(List<CodeableConcept> theOutcomeCode) {
1767    this.outcomeCode = theOutcomeCode;
1768    return this;
1769  }
1770
1771  public boolean hasOutcomeCode() {
1772    if (this.outcomeCode == null)
1773      return false;
1774    for (CodeableConcept item : this.outcomeCode)
1775      if (!item.isEmpty())
1776        return true;
1777    return false;
1778  }
1779
1780  public CodeableConcept addOutcomeCode() { // 3
1781    CodeableConcept t = new CodeableConcept();
1782    if (this.outcomeCode == null)
1783      this.outcomeCode = new ArrayList<CodeableConcept>();
1784    this.outcomeCode.add(t);
1785    return t;
1786  }
1787
1788  public Goal addOutcomeCode(CodeableConcept t) { // 3
1789    if (t == null)
1790      return this;
1791    if (this.outcomeCode == null)
1792      this.outcomeCode = new ArrayList<CodeableConcept>();
1793    this.outcomeCode.add(t);
1794    return this;
1795  }
1796
1797  /**
1798   * @return The first repetition of repeating field {@link #outcomeCode},
1799   *         creating it if it does not already exist
1800   */
1801  public CodeableConcept getOutcomeCodeFirstRep() {
1802    if (getOutcomeCode().isEmpty()) {
1803      addOutcomeCode();
1804    }
1805    return getOutcomeCode().get(0);
1806  }
1807
1808  /**
1809   * @return {@link #outcomeReference} (Details of what's changed (or not
1810   *         changed).)
1811   */
1812  public List<Reference> getOutcomeReference() {
1813    if (this.outcomeReference == null)
1814      this.outcomeReference = new ArrayList<Reference>();
1815    return this.outcomeReference;
1816  }
1817
1818  /**
1819   * @return Returns a reference to <code>this</code> for easy method chaining
1820   */
1821  public Goal setOutcomeReference(List<Reference> theOutcomeReference) {
1822    this.outcomeReference = theOutcomeReference;
1823    return this;
1824  }
1825
1826  public boolean hasOutcomeReference() {
1827    if (this.outcomeReference == null)
1828      return false;
1829    for (Reference item : this.outcomeReference)
1830      if (!item.isEmpty())
1831        return true;
1832    return false;
1833  }
1834
1835  public Reference addOutcomeReference() { // 3
1836    Reference t = new Reference();
1837    if (this.outcomeReference == null)
1838      this.outcomeReference = new ArrayList<Reference>();
1839    this.outcomeReference.add(t);
1840    return t;
1841  }
1842
1843  public Goal addOutcomeReference(Reference t) { // 3
1844    if (t == null)
1845      return this;
1846    if (this.outcomeReference == null)
1847      this.outcomeReference = new ArrayList<Reference>();
1848    this.outcomeReference.add(t);
1849    return this;
1850  }
1851
1852  /**
1853   * @return The first repetition of repeating field {@link #outcomeReference},
1854   *         creating it if it does not already exist
1855   */
1856  public Reference getOutcomeReferenceFirstRep() {
1857    if (getOutcomeReference().isEmpty()) {
1858      addOutcomeReference();
1859    }
1860    return getOutcomeReference().get(0);
1861  }
1862
1863  /**
1864   * @deprecated Use Reference#setResource(IBaseResource) instead
1865   */
1866  @Deprecated
1867  public List<Observation> getOutcomeReferenceTarget() {
1868    if (this.outcomeReferenceTarget == null)
1869      this.outcomeReferenceTarget = new ArrayList<Observation>();
1870    return this.outcomeReferenceTarget;
1871  }
1872
1873  /**
1874   * @deprecated Use Reference#setResource(IBaseResource) instead
1875   */
1876  @Deprecated
1877  public Observation addOutcomeReferenceTarget() {
1878    Observation r = new Observation();
1879    if (this.outcomeReferenceTarget == null)
1880      this.outcomeReferenceTarget = new ArrayList<Observation>();
1881    this.outcomeReferenceTarget.add(r);
1882    return r;
1883  }
1884
1885  protected void listChildren(List<Property> children) {
1886    super.listChildren(children);
1887    children.add(new Property("identifier", "Identifier",
1888        "Business identifiers assigned to this goal by the performer or other systems which remain constant as the resource is updated and propagates from server to server.",
1889        0, java.lang.Integer.MAX_VALUE, identifier));
1890    children.add(new Property("lifecycleStatus", "code", "The state of the goal throughout its lifecycle.", 0, 1,
1891        lifecycleStatus));
1892    children.add(new Property("achievementStatus", "CodeableConcept",
1893        "Describes the progression, or lack thereof, towards the goal against the target.", 0, 1, achievementStatus));
1894    children.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0,
1895        java.lang.Integer.MAX_VALUE, category));
1896    children.add(new Property("priority", "CodeableConcept",
1897        "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, 1,
1898        priority));
1899    children.add(new Property("description", "CodeableConcept",
1900        "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".",
1901        0, 1, description));
1902    children.add(new Property("subject", "Reference(Patient|Group|Organization)",
1903        "Identifies the patient, group or organization for whom the goal is being established.", 0, 1, subject));
1904    children.add(new Property("start[x]", "date|CodeableConcept",
1905        "The date or event after which the goal should begin being pursued.", 0, 1, start));
1906    children.add(
1907        new Property("target", "", "Indicates what should be done by when.", 0, java.lang.Integer.MAX_VALUE, target));
1908    children.add(new Property("statusDate", "date",
1909        "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, 1,
1910        statusDate));
1911    children
1912        .add(new Property("statusReason", "string", "Captures the reason for the current status.", 0, 1, statusReason));
1913    children.add(new Property("expressedBy", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)",
1914        "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, 1, expressedBy));
1915    children.add(new Property("addresses",
1916        "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ServiceRequest|RiskAssessment)",
1917        "The identified conditions and other health record elements that are intended to be addressed by the goal.", 0,
1918        java.lang.Integer.MAX_VALUE, addresses));
1919    children.add(
1920        new Property("note", "Annotation", "Any comments related to the goal.", 0, java.lang.Integer.MAX_VALUE, note));
1921    children.add(new Property("outcomeCode", "CodeableConcept",
1922        "Identifies the change (or lack of change) at the point when the status of the goal is assessed.", 0,
1923        java.lang.Integer.MAX_VALUE, outcomeCode));
1924    children.add(new Property("outcomeReference", "Reference(Observation)",
1925        "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, outcomeReference));
1926  }
1927
1928  @Override
1929  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1930    switch (_hash) {
1931    case -1618432855:
1932      /* identifier */ return new Property("identifier", "Identifier",
1933          "Business identifiers assigned to this goal by the performer or other systems which remain constant as the resource is updated and propagates from server to server.",
1934          0, java.lang.Integer.MAX_VALUE, identifier);
1935    case 1165552636:
1936      /* lifecycleStatus */ return new Property("lifecycleStatus", "code",
1937          "The state of the goal throughout its lifecycle.", 0, 1, lifecycleStatus);
1938    case 104524801:
1939      /* achievementStatus */ return new Property("achievementStatus", "CodeableConcept",
1940          "Describes the progression, or lack thereof, towards the goal against the target.", 0, 1, achievementStatus);
1941    case 50511102:
1942      /* category */ return new Property("category", "CodeableConcept", "Indicates a category the goal falls within.",
1943          0, java.lang.Integer.MAX_VALUE, category);
1944    case -1165461084:
1945      /* priority */ return new Property("priority", "CodeableConcept",
1946          "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, 1,
1947          priority);
1948    case -1724546052:
1949      /* description */ return new Property("description", "CodeableConcept",
1950          "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".",
1951          0, 1, description);
1952    case -1867885268:
1953      /* subject */ return new Property("subject", "Reference(Patient|Group|Organization)",
1954          "Identifies the patient, group or organization for whom the goal is being established.", 0, 1, subject);
1955    case 1316793566:
1956      /* start[x] */ return new Property("start[x]", "date|CodeableConcept",
1957          "The date or event after which the goal should begin being pursued.", 0, 1, start);
1958    case 109757538:
1959      /* start */ return new Property("start[x]", "date|CodeableConcept",
1960          "The date or event after which the goal should begin being pursued.", 0, 1, start);
1961    case -2129778896:
1962      /* startDate */ return new Property("start[x]", "date|CodeableConcept",
1963          "The date or event after which the goal should begin being pursued.", 0, 1, start);
1964    case -1758833953:
1965      /* startCodeableConcept */ return new Property("start[x]", "date|CodeableConcept",
1966          "The date or event after which the goal should begin being pursued.", 0, 1, start);
1967    case -880905839:
1968      /* target */ return new Property("target", "", "Indicates what should be done by when.", 0,
1969          java.lang.Integer.MAX_VALUE, target);
1970    case 247524032:
1971      /* statusDate */ return new Property("statusDate", "date",
1972          "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, 1,
1973          statusDate);
1974    case 2051346646:
1975      /* statusReason */ return new Property("statusReason", "string", "Captures the reason for the current status.", 0,
1976          1, statusReason);
1977    case 175423686:
1978      /* expressedBy */ return new Property("expressedBy",
1979          "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)",
1980          "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, 1, expressedBy);
1981    case 874544034:
1982      /* addresses */ return new Property("addresses",
1983          "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ServiceRequest|RiskAssessment)",
1984          "The identified conditions and other health record elements that are intended to be addressed by the goal.",
1985          0, java.lang.Integer.MAX_VALUE, addresses);
1986    case 3387378:
1987      /* note */ return new Property("note", "Annotation", "Any comments related to the goal.", 0,
1988          java.lang.Integer.MAX_VALUE, note);
1989    case 1062482015:
1990      /* outcomeCode */ return new Property("outcomeCode", "CodeableConcept",
1991          "Identifies the change (or lack of change) at the point when the status of the goal is assessed.", 0,
1992          java.lang.Integer.MAX_VALUE, outcomeCode);
1993    case -782273511:
1994      /* outcomeReference */ return new Property("outcomeReference", "Reference(Observation)",
1995          "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, outcomeReference);
1996    default:
1997      return super.getNamedProperty(_hash, _name, _checkValid);
1998    }
1999
2000  }
2001
2002  @Override
2003  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2004    switch (hash) {
2005    case -1618432855:
2006      /* identifier */ return this.identifier == null ? new Base[0]
2007          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2008    case 1165552636:
2009      /* lifecycleStatus */ return this.lifecycleStatus == null ? new Base[0] : new Base[] { this.lifecycleStatus }; // Enumeration<GoalLifecycleStatus>
2010    case 104524801:
2011      /* achievementStatus */ return this.achievementStatus == null ? new Base[0]
2012          : new Base[] { this.achievementStatus }; // CodeableConcept
2013    case 50511102:
2014      /* category */ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2015    case -1165461084:
2016      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // CodeableConcept
2017    case -1724546052:
2018      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // CodeableConcept
2019    case -1867885268:
2020      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2021    case 109757538:
2022      /* start */ return this.start == null ? new Base[0] : new Base[] { this.start }; // Type
2023    case -880905839:
2024      /* target */ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // GoalTargetComponent
2025    case 247524032:
2026      /* statusDate */ return this.statusDate == null ? new Base[0] : new Base[] { this.statusDate }; // DateType
2027    case 2051346646:
2028      /* statusReason */ return this.statusReason == null ? new Base[0] : new Base[] { this.statusReason }; // StringType
2029    case 175423686:
2030      /* expressedBy */ return this.expressedBy == null ? new Base[0] : new Base[] { this.expressedBy }; // Reference
2031    case 874544034:
2032      /* addresses */ return this.addresses == null ? new Base[0]
2033          : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
2034    case 3387378:
2035      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2036    case 1062482015:
2037      /* outcomeCode */ return this.outcomeCode == null ? new Base[0]
2038          : this.outcomeCode.toArray(new Base[this.outcomeCode.size()]); // CodeableConcept
2039    case -782273511:
2040      /* outcomeReference */ return this.outcomeReference == null ? new Base[0]
2041          : this.outcomeReference.toArray(new Base[this.outcomeReference.size()]); // Reference
2042    default:
2043      return super.getProperty(hash, name, checkValid);
2044    }
2045
2046  }
2047
2048  @Override
2049  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2050    switch (hash) {
2051    case -1618432855: // identifier
2052      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2053      return value;
2054    case 1165552636: // lifecycleStatus
2055      value = new GoalLifecycleStatusEnumFactory().fromType(castToCode(value));
2056      this.lifecycleStatus = (Enumeration) value; // Enumeration<GoalLifecycleStatus>
2057      return value;
2058    case 104524801: // achievementStatus
2059      this.achievementStatus = castToCodeableConcept(value); // CodeableConcept
2060      return value;
2061    case 50511102: // category
2062      this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2063      return value;
2064    case -1165461084: // priority
2065      this.priority = castToCodeableConcept(value); // CodeableConcept
2066      return value;
2067    case -1724546052: // description
2068      this.description = castToCodeableConcept(value); // CodeableConcept
2069      return value;
2070    case -1867885268: // subject
2071      this.subject = castToReference(value); // Reference
2072      return value;
2073    case 109757538: // start
2074      this.start = castToType(value); // Type
2075      return value;
2076    case -880905839: // target
2077      this.getTarget().add((GoalTargetComponent) value); // GoalTargetComponent
2078      return value;
2079    case 247524032: // statusDate
2080      this.statusDate = castToDate(value); // DateType
2081      return value;
2082    case 2051346646: // statusReason
2083      this.statusReason = castToString(value); // StringType
2084      return value;
2085    case 175423686: // expressedBy
2086      this.expressedBy = castToReference(value); // Reference
2087      return value;
2088    case 874544034: // addresses
2089      this.getAddresses().add(castToReference(value)); // Reference
2090      return value;
2091    case 3387378: // note
2092      this.getNote().add(castToAnnotation(value)); // Annotation
2093      return value;
2094    case 1062482015: // outcomeCode
2095      this.getOutcomeCode().add(castToCodeableConcept(value)); // CodeableConcept
2096      return value;
2097    case -782273511: // outcomeReference
2098      this.getOutcomeReference().add(castToReference(value)); // Reference
2099      return value;
2100    default:
2101      return super.setProperty(hash, name, value);
2102    }
2103
2104  }
2105
2106  @Override
2107  public Base setProperty(String name, Base value) throws FHIRException {
2108    if (name.equals("identifier")) {
2109      this.getIdentifier().add(castToIdentifier(value));
2110    } else if (name.equals("lifecycleStatus")) {
2111      value = new GoalLifecycleStatusEnumFactory().fromType(castToCode(value));
2112      this.lifecycleStatus = (Enumeration) value; // Enumeration<GoalLifecycleStatus>
2113    } else if (name.equals("achievementStatus")) {
2114      this.achievementStatus = castToCodeableConcept(value); // CodeableConcept
2115    } else if (name.equals("category")) {
2116      this.getCategory().add(castToCodeableConcept(value));
2117    } else if (name.equals("priority")) {
2118      this.priority = castToCodeableConcept(value); // CodeableConcept
2119    } else if (name.equals("description")) {
2120      this.description = castToCodeableConcept(value); // CodeableConcept
2121    } else if (name.equals("subject")) {
2122      this.subject = castToReference(value); // Reference
2123    } else if (name.equals("start[x]")) {
2124      this.start = castToType(value); // Type
2125    } else if (name.equals("target")) {
2126      this.getTarget().add((GoalTargetComponent) value);
2127    } else if (name.equals("statusDate")) {
2128      this.statusDate = castToDate(value); // DateType
2129    } else if (name.equals("statusReason")) {
2130      this.statusReason = castToString(value); // StringType
2131    } else if (name.equals("expressedBy")) {
2132      this.expressedBy = castToReference(value); // Reference
2133    } else if (name.equals("addresses")) {
2134      this.getAddresses().add(castToReference(value));
2135    } else if (name.equals("note")) {
2136      this.getNote().add(castToAnnotation(value));
2137    } else if (name.equals("outcomeCode")) {
2138      this.getOutcomeCode().add(castToCodeableConcept(value));
2139    } else if (name.equals("outcomeReference")) {
2140      this.getOutcomeReference().add(castToReference(value));
2141    } else
2142      return super.setProperty(name, value);
2143    return value;
2144  }
2145
2146  @Override
2147  public void removeChild(String name, Base value) throws FHIRException {
2148    if (name.equals("identifier")) {
2149      this.getIdentifier().remove(castToIdentifier(value));
2150    } else if (name.equals("lifecycleStatus")) {
2151      this.lifecycleStatus = null;
2152    } else if (name.equals("achievementStatus")) {
2153      this.achievementStatus = null;
2154    } else if (name.equals("category")) {
2155      this.getCategory().remove(castToCodeableConcept(value));
2156    } else if (name.equals("priority")) {
2157      this.priority = null;
2158    } else if (name.equals("description")) {
2159      this.description = null;
2160    } else if (name.equals("subject")) {
2161      this.subject = null;
2162    } else if (name.equals("start[x]")) {
2163      this.start = null;
2164    } else if (name.equals("target")) {
2165      this.getTarget().remove((GoalTargetComponent) value);
2166    } else if (name.equals("statusDate")) {
2167      this.statusDate = null;
2168    } else if (name.equals("statusReason")) {
2169      this.statusReason = null;
2170    } else if (name.equals("expressedBy")) {
2171      this.expressedBy = null;
2172    } else if (name.equals("addresses")) {
2173      this.getAddresses().remove(castToReference(value));
2174    } else if (name.equals("note")) {
2175      this.getNote().remove(castToAnnotation(value));
2176    } else if (name.equals("outcomeCode")) {
2177      this.getOutcomeCode().remove(castToCodeableConcept(value));
2178    } else if (name.equals("outcomeReference")) {
2179      this.getOutcomeReference().remove(castToReference(value));
2180    } else
2181      super.removeChild(name, value);
2182    
2183  }
2184
2185  @Override
2186  public Base makeProperty(int hash, String name) throws FHIRException {
2187    switch (hash) {
2188    case -1618432855:
2189      return addIdentifier();
2190    case 1165552636:
2191      return getLifecycleStatusElement();
2192    case 104524801:
2193      return getAchievementStatus();
2194    case 50511102:
2195      return addCategory();
2196    case -1165461084:
2197      return getPriority();
2198    case -1724546052:
2199      return getDescription();
2200    case -1867885268:
2201      return getSubject();
2202    case 1316793566:
2203      return getStart();
2204    case 109757538:
2205      return getStart();
2206    case -880905839:
2207      return addTarget();
2208    case 247524032:
2209      return getStatusDateElement();
2210    case 2051346646:
2211      return getStatusReasonElement();
2212    case 175423686:
2213      return getExpressedBy();
2214    case 874544034:
2215      return addAddresses();
2216    case 3387378:
2217      return addNote();
2218    case 1062482015:
2219      return addOutcomeCode();
2220    case -782273511:
2221      return addOutcomeReference();
2222    default:
2223      return super.makeProperty(hash, name);
2224    }
2225
2226  }
2227
2228  @Override
2229  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2230    switch (hash) {
2231    case -1618432855:
2232      /* identifier */ return new String[] { "Identifier" };
2233    case 1165552636:
2234      /* lifecycleStatus */ return new String[] { "code" };
2235    case 104524801:
2236      /* achievementStatus */ return new String[] { "CodeableConcept" };
2237    case 50511102:
2238      /* category */ return new String[] { "CodeableConcept" };
2239    case -1165461084:
2240      /* priority */ return new String[] { "CodeableConcept" };
2241    case -1724546052:
2242      /* description */ return new String[] { "CodeableConcept" };
2243    case -1867885268:
2244      /* subject */ return new String[] { "Reference" };
2245    case 109757538:
2246      /* start */ return new String[] { "date", "CodeableConcept" };
2247    case -880905839:
2248      /* target */ return new String[] {};
2249    case 247524032:
2250      /* statusDate */ return new String[] { "date" };
2251    case 2051346646:
2252      /* statusReason */ return new String[] { "string" };
2253    case 175423686:
2254      /* expressedBy */ return new String[] { "Reference" };
2255    case 874544034:
2256      /* addresses */ return new String[] { "Reference" };
2257    case 3387378:
2258      /* note */ return new String[] { "Annotation" };
2259    case 1062482015:
2260      /* outcomeCode */ return new String[] { "CodeableConcept" };
2261    case -782273511:
2262      /* outcomeReference */ return new String[] { "Reference" };
2263    default:
2264      return super.getTypesForProperty(hash, name);
2265    }
2266
2267  }
2268
2269  @Override
2270  public Base addChild(String name) throws FHIRException {
2271    if (name.equals("identifier")) {
2272      return addIdentifier();
2273    } else if (name.equals("lifecycleStatus")) {
2274      throw new FHIRException("Cannot call addChild on a singleton property Goal.lifecycleStatus");
2275    } else if (name.equals("achievementStatus")) {
2276      this.achievementStatus = new CodeableConcept();
2277      return this.achievementStatus;
2278    } else if (name.equals("category")) {
2279      return addCategory();
2280    } else if (name.equals("priority")) {
2281      this.priority = new CodeableConcept();
2282      return this.priority;
2283    } else if (name.equals("description")) {
2284      this.description = new CodeableConcept();
2285      return this.description;
2286    } else if (name.equals("subject")) {
2287      this.subject = new Reference();
2288      return this.subject;
2289    } else if (name.equals("startDate")) {
2290      this.start = new DateType();
2291      return this.start;
2292    } else if (name.equals("startCodeableConcept")) {
2293      this.start = new CodeableConcept();
2294      return this.start;
2295    } else if (name.equals("target")) {
2296      return addTarget();
2297    } else if (name.equals("statusDate")) {
2298      throw new FHIRException("Cannot call addChild on a singleton property Goal.statusDate");
2299    } else if (name.equals("statusReason")) {
2300      throw new FHIRException("Cannot call addChild on a singleton property Goal.statusReason");
2301    } else if (name.equals("expressedBy")) {
2302      this.expressedBy = new Reference();
2303      return this.expressedBy;
2304    } else if (name.equals("addresses")) {
2305      return addAddresses();
2306    } else if (name.equals("note")) {
2307      return addNote();
2308    } else if (name.equals("outcomeCode")) {
2309      return addOutcomeCode();
2310    } else if (name.equals("outcomeReference")) {
2311      return addOutcomeReference();
2312    } else
2313      return super.addChild(name);
2314  }
2315
2316  public String fhirType() {
2317    return "Goal";
2318
2319  }
2320
2321  public Goal copy() {
2322    Goal dst = new Goal();
2323    copyValues(dst);
2324    return dst;
2325  }
2326
2327  public void copyValues(Goal dst) {
2328    super.copyValues(dst);
2329    if (identifier != null) {
2330      dst.identifier = new ArrayList<Identifier>();
2331      for (Identifier i : identifier)
2332        dst.identifier.add(i.copy());
2333    }
2334    ;
2335    dst.lifecycleStatus = lifecycleStatus == null ? null : lifecycleStatus.copy();
2336    dst.achievementStatus = achievementStatus == null ? null : achievementStatus.copy();
2337    if (category != null) {
2338      dst.category = new ArrayList<CodeableConcept>();
2339      for (CodeableConcept i : category)
2340        dst.category.add(i.copy());
2341    }
2342    ;
2343    dst.priority = priority == null ? null : priority.copy();
2344    dst.description = description == null ? null : description.copy();
2345    dst.subject = subject == null ? null : subject.copy();
2346    dst.start = start == null ? null : start.copy();
2347    if (target != null) {
2348      dst.target = new ArrayList<GoalTargetComponent>();
2349      for (GoalTargetComponent i : target)
2350        dst.target.add(i.copy());
2351    }
2352    ;
2353    dst.statusDate = statusDate == null ? null : statusDate.copy();
2354    dst.statusReason = statusReason == null ? null : statusReason.copy();
2355    dst.expressedBy = expressedBy == null ? null : expressedBy.copy();
2356    if (addresses != null) {
2357      dst.addresses = new ArrayList<Reference>();
2358      for (Reference i : addresses)
2359        dst.addresses.add(i.copy());
2360    }
2361    ;
2362    if (note != null) {
2363      dst.note = new ArrayList<Annotation>();
2364      for (Annotation i : note)
2365        dst.note.add(i.copy());
2366    }
2367    ;
2368    if (outcomeCode != null) {
2369      dst.outcomeCode = new ArrayList<CodeableConcept>();
2370      for (CodeableConcept i : outcomeCode)
2371        dst.outcomeCode.add(i.copy());
2372    }
2373    ;
2374    if (outcomeReference != null) {
2375      dst.outcomeReference = new ArrayList<Reference>();
2376      for (Reference i : outcomeReference)
2377        dst.outcomeReference.add(i.copy());
2378    }
2379    ;
2380  }
2381
2382  protected Goal typedCopy() {
2383    return copy();
2384  }
2385
2386  @Override
2387  public boolean equalsDeep(Base other_) {
2388    if (!super.equalsDeep(other_))
2389      return false;
2390    if (!(other_ instanceof Goal))
2391      return false;
2392    Goal o = (Goal) other_;
2393    return compareDeep(identifier, o.identifier, true) && compareDeep(lifecycleStatus, o.lifecycleStatus, true)
2394        && compareDeep(achievementStatus, o.achievementStatus, true) && compareDeep(category, o.category, true)
2395        && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true)
2396        && compareDeep(subject, o.subject, true) && compareDeep(start, o.start, true)
2397        && compareDeep(target, o.target, true) && compareDeep(statusDate, o.statusDate, true)
2398        && compareDeep(statusReason, o.statusReason, true) && compareDeep(expressedBy, o.expressedBy, true)
2399        && compareDeep(addresses, o.addresses, true) && compareDeep(note, o.note, true)
2400        && compareDeep(outcomeCode, o.outcomeCode, true) && compareDeep(outcomeReference, o.outcomeReference, true);
2401  }
2402
2403  @Override
2404  public boolean equalsShallow(Base other_) {
2405    if (!super.equalsShallow(other_))
2406      return false;
2407    if (!(other_ instanceof Goal))
2408      return false;
2409    Goal o = (Goal) other_;
2410    return compareValues(lifecycleStatus, o.lifecycleStatus, true) && compareValues(statusDate, o.statusDate, true)
2411        && compareValues(statusReason, o.statusReason, true);
2412  }
2413
2414  public boolean isEmpty() {
2415    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, lifecycleStatus, achievementStatus,
2416        category, priority, description, subject, start, target, statusDate, statusReason, expressedBy, addresses, note,
2417        outcomeCode, outcomeReference);
2418  }
2419
2420  @Override
2421  public ResourceType getResourceType() {
2422    return ResourceType.Goal;
2423  }
2424
2425  /**
2426   * Search parameter: <b>identifier</b>
2427   * <p>
2428   * Description: <b>External Ids for this goal</b><br>
2429   * Type: <b>token</b><br>
2430   * Path: <b>Goal.identifier</b><br>
2431   * </p>
2432   */
2433  @SearchParamDefinition(name = "identifier", path = "Goal.identifier", description = "External Ids for this goal", type = "token")
2434  public static final String SP_IDENTIFIER = "identifier";
2435  /**
2436   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2437   * <p>
2438   * Description: <b>External Ids for this goal</b><br>
2439   * Type: <b>token</b><br>
2440   * Path: <b>Goal.identifier</b><br>
2441   * </p>
2442   */
2443  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2444      SP_IDENTIFIER);
2445
2446  /**
2447   * Search parameter: <b>lifecycle-status</b>
2448   * <p>
2449   * Description: <b>proposed | planned | accepted | active | on-hold | completed
2450   * | cancelled | entered-in-error | rejected</b><br>
2451   * Type: <b>token</b><br>
2452   * Path: <b>Goal.lifecycleStatus</b><br>
2453   * </p>
2454   */
2455  @SearchParamDefinition(name = "lifecycle-status", path = "Goal.lifecycleStatus", description = "proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected", type = "token")
2456  public static final String SP_LIFECYCLE_STATUS = "lifecycle-status";
2457  /**
2458   * <b>Fluent Client</b> search parameter constant for <b>lifecycle-status</b>
2459   * <p>
2460   * Description: <b>proposed | planned | accepted | active | on-hold | completed
2461   * | cancelled | entered-in-error | rejected</b><br>
2462   * Type: <b>token</b><br>
2463   * Path: <b>Goal.lifecycleStatus</b><br>
2464   * </p>
2465   */
2466  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LIFECYCLE_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2467      SP_LIFECYCLE_STATUS);
2468
2469  /**
2470   * Search parameter: <b>achievement-status</b>
2471   * <p>
2472   * Description: <b>in-progress | improving | worsening | no-change | achieved |
2473   * sustaining | not-achieved | no-progress | not-attainable</b><br>
2474   * Type: <b>token</b><br>
2475   * Path: <b>Goal.achievementStatus</b><br>
2476   * </p>
2477   */
2478  @SearchParamDefinition(name = "achievement-status", path = "Goal.achievementStatus", description = "in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable", type = "token")
2479  public static final String SP_ACHIEVEMENT_STATUS = "achievement-status";
2480  /**
2481   * <b>Fluent Client</b> search parameter constant for <b>achievement-status</b>
2482   * <p>
2483   * Description: <b>in-progress | improving | worsening | no-change | achieved |
2484   * sustaining | not-achieved | no-progress | not-attainable</b><br>
2485   * Type: <b>token</b><br>
2486   * Path: <b>Goal.achievementStatus</b><br>
2487   * </p>
2488   */
2489  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACHIEVEMENT_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2490      SP_ACHIEVEMENT_STATUS);
2491
2492  /**
2493   * Search parameter: <b>patient</b>
2494   * <p>
2495   * Description: <b>Who this goal is intended for</b><br>
2496   * Type: <b>reference</b><br>
2497   * Path: <b>Goal.subject</b><br>
2498   * </p>
2499   */
2500  @SearchParamDefinition(name = "patient", path = "Goal.subject.where(resolve() is Patient)", description = "Who this goal is intended for", type = "reference", providesMembershipIn = {
2501      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
2502  public static final String SP_PATIENT = "patient";
2503  /**
2504   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2505   * <p>
2506   * Description: <b>Who this goal is intended for</b><br>
2507   * Type: <b>reference</b><br>
2508   * Path: <b>Goal.subject</b><br>
2509   * </p>
2510   */
2511  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2512      SP_PATIENT);
2513
2514  /**
2515   * Constant for fluent queries to be used to add include statements. Specifies
2516   * the path value of "<b>Goal:patient</b>".
2517   */
2518  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Goal:patient")
2519      .toLocked();
2520
2521  /**
2522   * Search parameter: <b>subject</b>
2523   * <p>
2524   * Description: <b>Who this goal is intended for</b><br>
2525   * Type: <b>reference</b><br>
2526   * Path: <b>Goal.subject</b><br>
2527   * </p>
2528   */
2529  @SearchParamDefinition(name = "subject", path = "Goal.subject", description = "Who this goal is intended for", type = "reference", target = {
2530      Group.class, Organization.class, Patient.class })
2531  public static final String SP_SUBJECT = "subject";
2532  /**
2533   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2534   * <p>
2535   * Description: <b>Who this goal is intended for</b><br>
2536   * Type: <b>reference</b><br>
2537   * Path: <b>Goal.subject</b><br>
2538   * </p>
2539   */
2540  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2541      SP_SUBJECT);
2542
2543  /**
2544   * Constant for fluent queries to be used to add include statements. Specifies
2545   * the path value of "<b>Goal:subject</b>".
2546   */
2547  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Goal:subject")
2548      .toLocked();
2549
2550  /**
2551   * Search parameter: <b>start-date</b>
2552   * <p>
2553   * Description: <b>When goal pursuit begins</b><br>
2554   * Type: <b>date</b><br>
2555   * Path: <b>Goal.startDate</b><br>
2556   * </p>
2557   */
2558  @SearchParamDefinition(name = "start-date", path = "(Goal.start as date)", description = "When goal pursuit begins", type = "date")
2559  public static final String SP_START_DATE = "start-date";
2560  /**
2561   * <b>Fluent Client</b> search parameter constant for <b>start-date</b>
2562   * <p>
2563   * Description: <b>When goal pursuit begins</b><br>
2564   * Type: <b>date</b><br>
2565   * Path: <b>Goal.startDate</b><br>
2566   * </p>
2567   */
2568  public static final ca.uhn.fhir.rest.gclient.DateClientParam START_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2569      SP_START_DATE);
2570
2571  /**
2572   * Search parameter: <b>category</b>
2573   * <p>
2574   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
2575   * Type: <b>token</b><br>
2576   * Path: <b>Goal.category</b><br>
2577   * </p>
2578   */
2579  @SearchParamDefinition(name = "category", path = "Goal.category", description = "E.g. Treatment, dietary, behavioral, etc.", type = "token")
2580  public static final String SP_CATEGORY = "category";
2581  /**
2582   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2583   * <p>
2584   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
2585   * Type: <b>token</b><br>
2586   * Path: <b>Goal.category</b><br>
2587   * </p>
2588   */
2589  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2590      SP_CATEGORY);
2591
2592  /**
2593   * Search parameter: <b>target-date</b>
2594   * <p>
2595   * Description: <b>Reach goal on or before</b><br>
2596   * Type: <b>date</b><br>
2597   * Path: <b>Goal.target.dueDate</b><br>
2598   * </p>
2599   */
2600  @SearchParamDefinition(name = "target-date", path = "(Goal.target.due as date)", description = "Reach goal on or before", type = "date")
2601  public static final String SP_TARGET_DATE = "target-date";
2602  /**
2603   * <b>Fluent Client</b> search parameter constant for <b>target-date</b>
2604   * <p>
2605   * Description: <b>Reach goal on or before</b><br>
2606   * Type: <b>date</b><br>
2607   * Path: <b>Goal.target.dueDate</b><br>
2608   * </p>
2609   */
2610  public static final ca.uhn.fhir.rest.gclient.DateClientParam TARGET_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2611      SP_TARGET_DATE);
2612
2613}