001package org.hl7.fhir.r4b.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r4b.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.
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 pursued for a temporary period of time.
075         */
076        ONHOLD, 
077        /**
078         * The goal is no longer being sought.
079         */
080        COMPLETED, 
081        /**
082         * The goal has been abandoned.
083         */
084        CANCELLED, 
085        /**
086         * The goal was entered in error and voided.
087         */
088        ENTEREDINERROR, 
089        /**
090         * A proposed goal was rejected.
091         */
092        REJECTED, 
093        /**
094         * added to help the parsers with the generic types
095         */
096        NULL;
097        public static GoalLifecycleStatus fromCode(String codeString) throws FHIRException {
098            if (codeString == null || "".equals(codeString))
099                return null;
100        if ("proposed".equals(codeString))
101          return PROPOSED;
102        if ("planned".equals(codeString))
103          return PLANNED;
104        if ("accepted".equals(codeString))
105          return ACCEPTED;
106        if ("active".equals(codeString))
107          return ACTIVE;
108        if ("on-hold".equals(codeString))
109          return ONHOLD;
110        if ("completed".equals(codeString))
111          return COMPLETED;
112        if ("cancelled".equals(codeString))
113          return CANCELLED;
114        if ("entered-in-error".equals(codeString))
115          return ENTEREDINERROR;
116        if ("rejected".equals(codeString))
117          return REJECTED;
118        if (Configuration.isAcceptInvalidEnums())
119          return null;
120        else
121          throw new FHIRException("Unknown GoalLifecycleStatus code '"+codeString+"'");
122        }
123        public String toCode() {
124          switch (this) {
125            case PROPOSED: return "proposed";
126            case PLANNED: return "planned";
127            case ACCEPTED: return "accepted";
128            case ACTIVE: return "active";
129            case ONHOLD: return "on-hold";
130            case COMPLETED: return "completed";
131            case CANCELLED: return "cancelled";
132            case ENTEREDINERROR: return "entered-in-error";
133            case REJECTED: return "rejected";
134            case NULL: return null;
135            default: return "?";
136          }
137        }
138        public String getSystem() {
139          switch (this) {
140            case PROPOSED: return "http://hl7.org/fhir/goal-status";
141            case PLANNED: return "http://hl7.org/fhir/goal-status";
142            case ACCEPTED: return "http://hl7.org/fhir/goal-status";
143            case ACTIVE: return "http://hl7.org/fhir/goal-status";
144            case ONHOLD: return "http://hl7.org/fhir/goal-status";
145            case COMPLETED: return "http://hl7.org/fhir/goal-status";
146            case CANCELLED: return "http://hl7.org/fhir/goal-status";
147            case ENTEREDINERROR: return "http://hl7.org/fhir/goal-status";
148            case REJECTED: return "http://hl7.org/fhir/goal-status";
149            case NULL: return null;
150            default: return "?";
151          }
152        }
153        public String getDefinition() {
154          switch (this) {
155            case PROPOSED: return "A goal is proposed for this patient.";
156            case PLANNED: return "A goal is planned for this patient.";
157            case ACCEPTED: return "A proposed goal was accepted or acknowledged.";
158            case ACTIVE: return "The goal is being sought actively.";
159            case ONHOLD: return "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.";
160            case COMPLETED: return "The goal is no longer being sought.";
161            case CANCELLED: return "The goal has been abandoned.";
162            case ENTEREDINERROR: return "The goal was entered in error and voided.";
163            case REJECTED: return "A proposed goal was rejected.";
164            case NULL: return null;
165            default: return "?";
166          }
167        }
168        public String getDisplay() {
169          switch (this) {
170            case PROPOSED: return "Proposed";
171            case PLANNED: return "Planned";
172            case ACCEPTED: return "Accepted";
173            case ACTIVE: return "Active";
174            case ONHOLD: return "On Hold";
175            case COMPLETED: return "Completed";
176            case CANCELLED: return "Cancelled";
177            case ENTEREDINERROR: return "Entered in Error";
178            case REJECTED: return "Rejected";
179            case NULL: return null;
180            default: return "?";
181          }
182        }
183    }
184
185  public static class GoalLifecycleStatusEnumFactory implements EnumFactory<GoalLifecycleStatus> {
186    public GoalLifecycleStatus fromCode(String codeString) throws IllegalArgumentException {
187      if (codeString == null || "".equals(codeString))
188            if (codeString == null || "".equals(codeString))
189                return null;
190        if ("proposed".equals(codeString))
191          return GoalLifecycleStatus.PROPOSED;
192        if ("planned".equals(codeString))
193          return GoalLifecycleStatus.PLANNED;
194        if ("accepted".equals(codeString))
195          return GoalLifecycleStatus.ACCEPTED;
196        if ("active".equals(codeString))
197          return GoalLifecycleStatus.ACTIVE;
198        if ("on-hold".equals(codeString))
199          return GoalLifecycleStatus.ONHOLD;
200        if ("completed".equals(codeString))
201          return GoalLifecycleStatus.COMPLETED;
202        if ("cancelled".equals(codeString))
203          return GoalLifecycleStatus.CANCELLED;
204        if ("entered-in-error".equals(codeString))
205          return GoalLifecycleStatus.ENTEREDINERROR;
206        if ("rejected".equals(codeString))
207          return GoalLifecycleStatus.REJECTED;
208        throw new IllegalArgumentException("Unknown GoalLifecycleStatus code '"+codeString+"'");
209        }
210        public Enumeration<GoalLifecycleStatus> fromType(Base code) throws FHIRException {
211          if (code == null)
212            return null;
213          if (code.isEmpty())
214            return new Enumeration<GoalLifecycleStatus>(this);
215          String codeString = ((PrimitiveType) code).asStringValue();
216          if (codeString == null || "".equals(codeString))
217            return null;
218        if ("proposed".equals(codeString))
219          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.PROPOSED);
220        if ("planned".equals(codeString))
221          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.PLANNED);
222        if ("accepted".equals(codeString))
223          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ACCEPTED);
224        if ("active".equals(codeString))
225          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ACTIVE);
226        if ("on-hold".equals(codeString))
227          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ONHOLD);
228        if ("completed".equals(codeString))
229          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.COMPLETED);
230        if ("cancelled".equals(codeString))
231          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.CANCELLED);
232        if ("entered-in-error".equals(codeString))
233          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.ENTEREDINERROR);
234        if ("rejected".equals(codeString))
235          return new Enumeration<GoalLifecycleStatus>(this, GoalLifecycleStatus.REJECTED);
236        throw new FHIRException("Unknown GoalLifecycleStatus code '"+codeString+"'");
237        }
238    public String toCode(GoalLifecycleStatus code) {
239      if (code == GoalLifecycleStatus.PROPOSED)
240        return "proposed";
241      if (code == GoalLifecycleStatus.PLANNED)
242        return "planned";
243      if (code == GoalLifecycleStatus.ACCEPTED)
244        return "accepted";
245      if (code == GoalLifecycleStatus.ACTIVE)
246        return "active";
247      if (code == GoalLifecycleStatus.ONHOLD)
248        return "on-hold";
249      if (code == GoalLifecycleStatus.COMPLETED)
250        return "completed";
251      if (code == GoalLifecycleStatus.CANCELLED)
252        return "cancelled";
253      if (code == GoalLifecycleStatus.ENTEREDINERROR)
254        return "entered-in-error";
255      if (code == GoalLifecycleStatus.REJECTED)
256        return "rejected";
257      return "?";
258      }
259    public String toSystem(GoalLifecycleStatus code) {
260      return code.getSystem();
261      }
262    }
263
264    @Block()
265    public static class GoalTargetComponent extends BackboneElement implements IBaseBackboneElement {
266        /**
267         * The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.
268         */
269        @Child(name = "measure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
270        @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." )
271        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
272        protected CodeableConcept measure;
273
274        /**
275         * 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.
276         */
277        @Child(name = "detail", type = {Quantity.class, Range.class, CodeableConcept.class, StringType.class, BooleanType.class, IntegerType.class, Ratio.class}, order=2, min=0, max=1, modifier=false, summary=true)
278        @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." )
279        protected DataType detail;
280
281        /**
282         * Indicates either the date or the duration after start by which the goal should be met.
283         */
284        @Child(name = "due", type = {DateType.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
285        @Description(shortDefinition="Reach goal on or before", formalDefinition="Indicates either the date or the duration after start by which the goal should be met." )
286        protected DataType due;
287
288        private static final long serialVersionUID = 1975697830L;
289
290    /**
291     * Constructor
292     */
293      public GoalTargetComponent() {
294        super();
295      }
296
297        /**
298         * @return {@link #measure} (The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
299         */
300        public CodeableConcept getMeasure() { 
301          if (this.measure == null)
302            if (Configuration.errorOnAutoCreate())
303              throw new Error("Attempt to auto-create GoalTargetComponent.measure");
304            else if (Configuration.doAutoCreate())
305              this.measure = new CodeableConcept(); // cc
306          return this.measure;
307        }
308
309        public boolean hasMeasure() { 
310          return this.measure != null && !this.measure.isEmpty();
311        }
312
313        /**
314         * @param value {@link #measure} (The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
315         */
316        public GoalTargetComponent setMeasure(CodeableConcept value) { 
317          this.measure = value;
318          return this;
319        }
320
321        /**
322         * @return {@link #detail} (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.)
323         */
324        public DataType getDetail() { 
325          return this.detail;
326        }
327
328        /**
329         * @return {@link #detail} (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.)
330         */
331        public Quantity getDetailQuantity() throws FHIRException { 
332          if (this.detail == null)
333            this.detail = new Quantity();
334          if (!(this.detail instanceof Quantity))
335            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.detail.getClass().getName()+" was encountered");
336          return (Quantity) this.detail;
337        }
338
339        public boolean hasDetailQuantity() { 
340          return this != null && this.detail instanceof Quantity;
341        }
342
343        /**
344         * @return {@link #detail} (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.)
345         */
346        public Range getDetailRange() throws FHIRException { 
347          if (this.detail == null)
348            this.detail = new Range();
349          if (!(this.detail instanceof Range))
350            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.detail.getClass().getName()+" was encountered");
351          return (Range) this.detail;
352        }
353
354        public boolean hasDetailRange() { 
355          return this != null && this.detail instanceof Range;
356        }
357
358        /**
359         * @return {@link #detail} (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.)
360         */
361        public CodeableConcept getDetailCodeableConcept() throws FHIRException { 
362          if (this.detail == null)
363            this.detail = new CodeableConcept();
364          if (!(this.detail instanceof CodeableConcept))
365            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.detail.getClass().getName()+" was encountered");
366          return (CodeableConcept) this.detail;
367        }
368
369        public boolean hasDetailCodeableConcept() { 
370          return this != null && this.detail instanceof CodeableConcept;
371        }
372
373        /**
374         * @return {@link #detail} (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.)
375         */
376        public StringType getDetailStringType() throws FHIRException { 
377          if (this.detail == null)
378            this.detail = new StringType();
379          if (!(this.detail instanceof StringType))
380            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.detail.getClass().getName()+" was encountered");
381          return (StringType) this.detail;
382        }
383
384        public boolean hasDetailStringType() { 
385          return this != null && this.detail instanceof StringType;
386        }
387
388        /**
389         * @return {@link #detail} (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.)
390         */
391        public BooleanType getDetailBooleanType() throws FHIRException { 
392          if (this.detail == null)
393            this.detail = new BooleanType();
394          if (!(this.detail instanceof BooleanType))
395            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.detail.getClass().getName()+" was encountered");
396          return (BooleanType) this.detail;
397        }
398
399        public boolean hasDetailBooleanType() { 
400          return this != null && this.detail instanceof BooleanType;
401        }
402
403        /**
404         * @return {@link #detail} (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.)
405         */
406        public IntegerType getDetailIntegerType() throws FHIRException { 
407          if (this.detail == null)
408            this.detail = new IntegerType();
409          if (!(this.detail instanceof IntegerType))
410            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.detail.getClass().getName()+" was encountered");
411          return (IntegerType) this.detail;
412        }
413
414        public boolean hasDetailIntegerType() { 
415          return this != null && this.detail instanceof IntegerType;
416        }
417
418        /**
419         * @return {@link #detail} (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.)
420         */
421        public Ratio getDetailRatio() throws FHIRException { 
422          if (this.detail == null)
423            this.detail = new Ratio();
424          if (!(this.detail instanceof Ratio))
425            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.detail.getClass().getName()+" was encountered");
426          return (Ratio) this.detail;
427        }
428
429        public boolean hasDetailRatio() { 
430          return this != null && this.detail instanceof Ratio;
431        }
432
433        public boolean hasDetail() { 
434          return this.detail != null && !this.detail.isEmpty();
435        }
436
437        /**
438         * @param value {@link #detail} (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.)
439         */
440        public GoalTargetComponent setDetail(DataType value) { 
441          if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof CodeableConcept || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof Ratio))
442            throw new Error("Not the right type for Goal.target.detail[x]: "+value.fhirType());
443          this.detail = value;
444          return this;
445        }
446
447        /**
448         * @return {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
449         */
450        public DataType getDue() { 
451          return this.due;
452        }
453
454        /**
455         * @return {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
456         */
457        public DateType getDueDateType() throws FHIRException { 
458          if (this.due == null)
459            this.due = new DateType();
460          if (!(this.due instanceof DateType))
461            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.due.getClass().getName()+" was encountered");
462          return (DateType) this.due;
463        }
464
465        public boolean hasDueDateType() { 
466          return this != null && this.due instanceof DateType;
467        }
468
469        /**
470         * @return {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
471         */
472        public Duration getDueDuration() throws FHIRException { 
473          if (this.due == null)
474            this.due = new Duration();
475          if (!(this.due instanceof Duration))
476            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.due.getClass().getName()+" was encountered");
477          return (Duration) this.due;
478        }
479
480        public boolean hasDueDuration() { 
481          return this != null && this.due instanceof Duration;
482        }
483
484        public boolean hasDue() { 
485          return this.due != null && !this.due.isEmpty();
486        }
487
488        /**
489         * @param value {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
490         */
491        public GoalTargetComponent setDue(DataType value) { 
492          if (value != null && !(value instanceof DateType || value instanceof Duration))
493            throw new Error("Not the right type for Goal.target.due[x]: "+value.fhirType());
494          this.due = value;
495          return this;
496        }
497
498        protected void listChildren(List<Property> children) {
499          super.listChildren(children);
500          children.add(new Property("measure", "CodeableConcept", "The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, 1, measure));
501          children.add(new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio", "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.", 0, 1, detail));
502          children.add(new Property("due[x]", "date|Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due));
503        }
504
505        @Override
506        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
507          switch (_hash) {
508          case 938321246: /*measure*/  return new Property("measure", "CodeableConcept", "The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, 1, measure);
509          case -1973084529: /*detail[x]*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio", "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.", 0, 1, detail);
510          case -1335224239: /*detail*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio", "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.", 0, 1, detail);
511          case -1313079300: /*detailQuantity*/  return new Property("detail[x]", "Quantity", "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.", 0, 1, detail);
512          case -2062632084: /*detailRange*/  return new Property("detail[x]", "Range", "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.", 0, 1, detail);
513          case -175586544: /*detailCodeableConcept*/  return new Property("detail[x]", "CodeableConcept", "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.", 0, 1, detail);
514          case 529212354: /*detailString*/  return new Property("detail[x]", "string", "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.", 0, 1, detail);
515          case 1172184727: /*detailBoolean*/  return new Property("detail[x]", "boolean", "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.", 0, 1, detail);
516          case -1229442131: /*detailInteger*/  return new Property("detail[x]", "integer", "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.", 0, 1, detail);
517          case -2062626246: /*detailRatio*/  return new Property("detail[x]", "Ratio", "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.", 0, 1, detail);
518          case -1320900084: /*due[x]*/  return new Property("due[x]", "date|Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
519          case 99828: /*due*/  return new Property("due[x]", "date|Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
520          case 2001063874: /*dueDate*/  return new Property("due[x]", "date", "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
521          case -620428376: /*dueDuration*/  return new Property("due[x]", "Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, 1, due);
522          default: return super.getNamedProperty(_hash, _name, _checkValid);
523          }
524
525        }
526
527      @Override
528      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
529        switch (hash) {
530        case 938321246: /*measure*/ return this.measure == null ? new Base[0] : new Base[] {this.measure}; // CodeableConcept
531        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // DataType
532        case 99828: /*due*/ return this.due == null ? new Base[0] : new Base[] {this.due}; // DataType
533        default: return super.getProperty(hash, name, checkValid);
534        }
535
536      }
537
538      @Override
539      public Base setProperty(int hash, String name, Base value) throws FHIRException {
540        switch (hash) {
541        case 938321246: // measure
542          this.measure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
543          return value;
544        case -1335224239: // detail
545          this.detail = TypeConvertor.castToType(value); // DataType
546          return value;
547        case 99828: // due
548          this.due = TypeConvertor.castToType(value); // DataType
549          return value;
550        default: return super.setProperty(hash, name, value);
551        }
552
553      }
554
555      @Override
556      public Base setProperty(String name, Base value) throws FHIRException {
557        if (name.equals("measure")) {
558          this.measure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
559        } else if (name.equals("detail[x]")) {
560          this.detail = TypeConvertor.castToType(value); // DataType
561        } else if (name.equals("due[x]")) {
562          this.due = TypeConvertor.castToType(value); // DataType
563        } else
564          return super.setProperty(name, value);
565        return value;
566      }
567
568      @Override
569      public Base makeProperty(int hash, String name) throws FHIRException {
570        switch (hash) {
571        case 938321246:  return getMeasure();
572        case -1973084529:  return getDetail();
573        case -1335224239:  return getDetail();
574        case -1320900084:  return getDue();
575        case 99828:  return getDue();
576        default: return super.makeProperty(hash, name);
577        }
578
579      }
580
581      @Override
582      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
583        switch (hash) {
584        case 938321246: /*measure*/ return new String[] {"CodeableConcept"};
585        case -1335224239: /*detail*/ return new String[] {"Quantity", "Range", "CodeableConcept", "string", "boolean", "integer", "Ratio"};
586        case 99828: /*due*/ return new String[] {"date", "Duration"};
587        default: return super.getTypesForProperty(hash, name);
588        }
589
590      }
591
592      @Override
593      public Base addChild(String name) throws FHIRException {
594        if (name.equals("measure")) {
595          this.measure = new CodeableConcept();
596          return this.measure;
597        }
598        else if (name.equals("detailQuantity")) {
599          this.detail = new Quantity();
600          return this.detail;
601        }
602        else if (name.equals("detailRange")) {
603          this.detail = new Range();
604          return this.detail;
605        }
606        else if (name.equals("detailCodeableConcept")) {
607          this.detail = new CodeableConcept();
608          return this.detail;
609        }
610        else if (name.equals("detailString")) {
611          this.detail = new StringType();
612          return this.detail;
613        }
614        else if (name.equals("detailBoolean")) {
615          this.detail = new BooleanType();
616          return this.detail;
617        }
618        else if (name.equals("detailInteger")) {
619          this.detail = new IntegerType();
620          return this.detail;
621        }
622        else if (name.equals("detailRatio")) {
623          this.detail = new Ratio();
624          return this.detail;
625        }
626        else if (name.equals("dueDate")) {
627          this.due = new DateType();
628          return this.due;
629        }
630        else if (name.equals("dueDuration")) {
631          this.due = new Duration();
632          return this.due;
633        }
634        else
635          return super.addChild(name);
636      }
637
638      public GoalTargetComponent copy() {
639        GoalTargetComponent dst = new GoalTargetComponent();
640        copyValues(dst);
641        return dst;
642      }
643
644      public void copyValues(GoalTargetComponent dst) {
645        super.copyValues(dst);
646        dst.measure = measure == null ? null : measure.copy();
647        dst.detail = detail == null ? null : detail.copy();
648        dst.due = due == null ? null : due.copy();
649      }
650
651      @Override
652      public boolean equalsDeep(Base other_) {
653        if (!super.equalsDeep(other_))
654          return false;
655        if (!(other_ instanceof GoalTargetComponent))
656          return false;
657        GoalTargetComponent o = (GoalTargetComponent) other_;
658        return compareDeep(measure, o.measure, true) && compareDeep(detail, o.detail, true) && compareDeep(due, o.due, true)
659          ;
660      }
661
662      @Override
663      public boolean equalsShallow(Base other_) {
664        if (!super.equalsShallow(other_))
665          return false;
666        if (!(other_ instanceof GoalTargetComponent))
667          return false;
668        GoalTargetComponent o = (GoalTargetComponent) other_;
669        return true;
670      }
671
672      public boolean isEmpty() {
673        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(measure, detail, due);
674      }
675
676  public String fhirType() {
677    return "Goal.target";
678
679  }
680
681  }
682
683    /**
684     * 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.
685     */
686    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
687    @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." )
688    protected List<Identifier> identifier;
689
690    /**
691     * The state of the goal throughout its lifecycle.
692     */
693    @Child(name = "lifecycleStatus", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
694    @Description(shortDefinition="proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected", formalDefinition="The state of the goal throughout its lifecycle." )
695    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-status")
696    protected Enumeration<GoalLifecycleStatus> lifecycleStatus;
697
698    /**
699     * Describes the progression, or lack thereof, towards the goal against the target.
700     */
701    @Child(name = "achievementStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
702    @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." )
703    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-achievement")
704    protected CodeableConcept achievementStatus;
705
706    /**
707     * Indicates a category the goal falls within.
708     */
709    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
710    @Description(shortDefinition="E.g. Treatment, dietary, behavioral, etc.", formalDefinition="Indicates a category the goal falls within." )
711    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-category")
712    protected List<CodeableConcept> category;
713
714    /**
715     * Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.
716     */
717    @Child(name = "priority", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
718    @Description(shortDefinition="high-priority | medium-priority | low-priority", formalDefinition="Identifies the mutually agreed level of importance associated with reaching/sustaining the goal." )
719    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-priority")
720    protected CodeableConcept priority;
721
722    /**
723     * 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".
724     */
725    @Child(name = "description", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=true)
726    @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\"." )
727    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
728    protected CodeableConcept description;
729
730    /**
731     * Identifies the patient, group or organization for whom the goal is being established.
732     */
733    @Child(name = "subject", type = {Patient.class, Group.class, Organization.class}, order=6, min=1, max=1, modifier=false, summary=true)
734    @Description(shortDefinition="Who this goal is intended for", formalDefinition="Identifies the patient, group or organization for whom the goal is being established." )
735    protected Reference subject;
736
737    /**
738     * The date or event after which the goal should begin being pursued.
739     */
740    @Child(name = "start", type = {DateType.class, CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
741    @Description(shortDefinition="When goal pursuit begins", formalDefinition="The date or event after which the goal should begin being pursued." )
742    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-start-event")
743    protected DataType start;
744
745    /**
746     * Indicates what should be done by when.
747     */
748    @Child(name = "target", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
749    @Description(shortDefinition="Target outcome for the goal", formalDefinition="Indicates what should be done by when." )
750    protected List<GoalTargetComponent> target;
751
752    /**
753     * Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
754     */
755    @Child(name = "statusDate", type = {DateType.class}, order=9, min=0, max=1, modifier=false, summary=true)
756    @Description(shortDefinition="When goal status took effect", formalDefinition="Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc." )
757    protected DateType statusDate;
758
759    /**
760     * Captures the reason for the current status.
761     */
762    @Child(name = "statusReason", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
763    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current status." )
764    protected StringType statusReason;
765
766    /**
767     * Indicates whose goal this is - patient goal, practitioner goal, etc.
768     */
769    @Child(name = "expressedBy", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=11, min=0, max=1, modifier=false, summary=true)
770    @Description(shortDefinition="Who's responsible for creating Goal?", formalDefinition="Indicates whose goal this is - patient goal, practitioner goal, etc." )
771    protected Reference expressedBy;
772
773    /**
774     * The identified conditions and other health record elements that are intended to be addressed by the goal.
775     */
776    @Child(name = "addresses", type = {Condition.class, Observation.class, MedicationStatement.class, NutritionOrder.class, ServiceRequest.class, RiskAssessment.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
777    @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." )
778    protected List<Reference> addresses;
779
780    /**
781     * Any comments related to the goal.
782     */
783    @Child(name = "note", type = {Annotation.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
784    @Description(shortDefinition="Comments about the goal", formalDefinition="Any comments related to the goal." )
785    protected List<Annotation> note;
786
787    /**
788     * Identifies the change (or lack of change) at the point when the status of the goal is assessed.
789     */
790    @Child(name = "outcomeCode", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
791    @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." )
792    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
793    protected List<CodeableConcept> outcomeCode;
794
795    /**
796     * Details of what's changed (or not changed).
797     */
798    @Child(name = "outcomeReference", type = {Observation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
799    @Description(shortDefinition="Observation that resulted from goal", formalDefinition="Details of what's changed (or not changed)." )
800    protected List<Reference> outcomeReference;
801
802    private static final long serialVersionUID = -1661311876L;
803
804  /**
805   * Constructor
806   */
807    public Goal() {
808      super();
809    }
810
811  /**
812   * Constructor
813   */
814    public Goal(GoalLifecycleStatus lifecycleStatus, CodeableConcept description, Reference subject) {
815      super();
816      this.setLifecycleStatus(lifecycleStatus);
817      this.setDescription(description);
818      this.setSubject(subject);
819    }
820
821    /**
822     * @return {@link #identifier} (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.)
823     */
824    public List<Identifier> getIdentifier() { 
825      if (this.identifier == null)
826        this.identifier = new ArrayList<Identifier>();
827      return this.identifier;
828    }
829
830    /**
831     * @return Returns a reference to <code>this</code> for easy method chaining
832     */
833    public Goal setIdentifier(List<Identifier> theIdentifier) { 
834      this.identifier = theIdentifier;
835      return this;
836    }
837
838    public boolean hasIdentifier() { 
839      if (this.identifier == null)
840        return false;
841      for (Identifier item : this.identifier)
842        if (!item.isEmpty())
843          return true;
844      return false;
845    }
846
847    public Identifier addIdentifier() { //3
848      Identifier t = new Identifier();
849      if (this.identifier == null)
850        this.identifier = new ArrayList<Identifier>();
851      this.identifier.add(t);
852      return t;
853    }
854
855    public Goal addIdentifier(Identifier t) { //3
856      if (t == null)
857        return this;
858      if (this.identifier == null)
859        this.identifier = new ArrayList<Identifier>();
860      this.identifier.add(t);
861      return this;
862    }
863
864    /**
865     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
866     */
867    public Identifier getIdentifierFirstRep() { 
868      if (getIdentifier().isEmpty()) {
869        addIdentifier();
870      }
871      return getIdentifier().get(0);
872    }
873
874    /**
875     * @return {@link #lifecycleStatus} (The state of the goal throughout its lifecycle.). This is the underlying object with id, value and extensions. The accessor "getLifecycleStatus" gives direct access to the value
876     */
877    public Enumeration<GoalLifecycleStatus> getLifecycleStatusElement() { 
878      if (this.lifecycleStatus == null)
879        if (Configuration.errorOnAutoCreate())
880          throw new Error("Attempt to auto-create Goal.lifecycleStatus");
881        else if (Configuration.doAutoCreate())
882          this.lifecycleStatus = new Enumeration<GoalLifecycleStatus>(new GoalLifecycleStatusEnumFactory()); // bb
883      return this.lifecycleStatus;
884    }
885
886    public boolean hasLifecycleStatusElement() { 
887      return this.lifecycleStatus != null && !this.lifecycleStatus.isEmpty();
888    }
889
890    public boolean hasLifecycleStatus() { 
891      return this.lifecycleStatus != null && !this.lifecycleStatus.isEmpty();
892    }
893
894    /**
895     * @param value {@link #lifecycleStatus} (The state of the goal throughout its lifecycle.). This is the underlying object with id, value and extensions. The accessor "getLifecycleStatus" gives direct access to the value
896     */
897    public Goal setLifecycleStatusElement(Enumeration<GoalLifecycleStatus> value) { 
898      this.lifecycleStatus = value;
899      return this;
900    }
901
902    /**
903     * @return The state of the goal throughout its lifecycle.
904     */
905    public GoalLifecycleStatus getLifecycleStatus() { 
906      return this.lifecycleStatus == null ? null : this.lifecycleStatus.getValue();
907    }
908
909    /**
910     * @param value The state of the goal throughout its lifecycle.
911     */
912    public Goal setLifecycleStatus(GoalLifecycleStatus value) { 
913        if (this.lifecycleStatus == null)
914          this.lifecycleStatus = new Enumeration<GoalLifecycleStatus>(new GoalLifecycleStatusEnumFactory());
915        this.lifecycleStatus.setValue(value);
916      return this;
917    }
918
919    /**
920     * @return {@link #achievementStatus} (Describes the progression, or lack thereof, towards the goal against the target.)
921     */
922    public CodeableConcept getAchievementStatus() { 
923      if (this.achievementStatus == null)
924        if (Configuration.errorOnAutoCreate())
925          throw new Error("Attempt to auto-create Goal.achievementStatus");
926        else if (Configuration.doAutoCreate())
927          this.achievementStatus = new CodeableConcept(); // cc
928      return this.achievementStatus;
929    }
930
931    public boolean hasAchievementStatus() { 
932      return this.achievementStatus != null && !this.achievementStatus.isEmpty();
933    }
934
935    /**
936     * @param value {@link #achievementStatus} (Describes the progression, or lack thereof, towards the goal against the target.)
937     */
938    public Goal setAchievementStatus(CodeableConcept value) { 
939      this.achievementStatus = value;
940      return this;
941    }
942
943    /**
944     * @return {@link #category} (Indicates a category the goal falls within.)
945     */
946    public List<CodeableConcept> getCategory() { 
947      if (this.category == null)
948        this.category = new ArrayList<CodeableConcept>();
949      return this.category;
950    }
951
952    /**
953     * @return Returns a reference to <code>this</code> for easy method chaining
954     */
955    public Goal setCategory(List<CodeableConcept> theCategory) { 
956      this.category = theCategory;
957      return this;
958    }
959
960    public boolean hasCategory() { 
961      if (this.category == null)
962        return false;
963      for (CodeableConcept item : this.category)
964        if (!item.isEmpty())
965          return true;
966      return false;
967    }
968
969    public CodeableConcept addCategory() { //3
970      CodeableConcept t = new CodeableConcept();
971      if (this.category == null)
972        this.category = new ArrayList<CodeableConcept>();
973      this.category.add(t);
974      return t;
975    }
976
977    public Goal addCategory(CodeableConcept t) { //3
978      if (t == null)
979        return this;
980      if (this.category == null)
981        this.category = new ArrayList<CodeableConcept>();
982      this.category.add(t);
983      return this;
984    }
985
986    /**
987     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
988     */
989    public CodeableConcept getCategoryFirstRep() { 
990      if (getCategory().isEmpty()) {
991        addCategory();
992      }
993      return getCategory().get(0);
994    }
995
996    /**
997     * @return {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
998     */
999    public CodeableConcept getPriority() { 
1000      if (this.priority == null)
1001        if (Configuration.errorOnAutoCreate())
1002          throw new Error("Attempt to auto-create Goal.priority");
1003        else if (Configuration.doAutoCreate())
1004          this.priority = new CodeableConcept(); // cc
1005      return this.priority;
1006    }
1007
1008    public boolean hasPriority() { 
1009      return this.priority != null && !this.priority.isEmpty();
1010    }
1011
1012    /**
1013     * @param value {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
1014     */
1015    public Goal setPriority(CodeableConcept value) { 
1016      this.priority = value;
1017      return this;
1018    }
1019
1020    /**
1021     * @return {@link #description} (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".)
1022     */
1023    public CodeableConcept getDescription() { 
1024      if (this.description == null)
1025        if (Configuration.errorOnAutoCreate())
1026          throw new Error("Attempt to auto-create Goal.description");
1027        else if (Configuration.doAutoCreate())
1028          this.description = new CodeableConcept(); // cc
1029      return this.description;
1030    }
1031
1032    public boolean hasDescription() { 
1033      return this.description != null && !this.description.isEmpty();
1034    }
1035
1036    /**
1037     * @param value {@link #description} (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".)
1038     */
1039    public Goal setDescription(CodeableConcept value) { 
1040      this.description = value;
1041      return this;
1042    }
1043
1044    /**
1045     * @return {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
1046     */
1047    public Reference getSubject() { 
1048      if (this.subject == null)
1049        if (Configuration.errorOnAutoCreate())
1050          throw new Error("Attempt to auto-create Goal.subject");
1051        else if (Configuration.doAutoCreate())
1052          this.subject = new Reference(); // cc
1053      return this.subject;
1054    }
1055
1056    public boolean hasSubject() { 
1057      return this.subject != null && !this.subject.isEmpty();
1058    }
1059
1060    /**
1061     * @param value {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
1062     */
1063    public Goal setSubject(Reference value) { 
1064      this.subject = value;
1065      return this;
1066    }
1067
1068    /**
1069     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
1070     */
1071    public DataType getStart() { 
1072      return this.start;
1073    }
1074
1075    /**
1076     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
1077     */
1078    public DateType getStartDateType() throws FHIRException { 
1079      if (this.start == null)
1080        this.start = new DateType();
1081      if (!(this.start instanceof DateType))
1082        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.start.getClass().getName()+" was encountered");
1083      return (DateType) this.start;
1084    }
1085
1086    public boolean hasStartDateType() { 
1087      return this != null && this.start instanceof DateType;
1088    }
1089
1090    /**
1091     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
1092     */
1093    public CodeableConcept getStartCodeableConcept() throws FHIRException { 
1094      if (this.start == null)
1095        this.start = new CodeableConcept();
1096      if (!(this.start instanceof CodeableConcept))
1097        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.start.getClass().getName()+" was encountered");
1098      return (CodeableConcept) this.start;
1099    }
1100
1101    public boolean hasStartCodeableConcept() { 
1102      return this != null && this.start instanceof CodeableConcept;
1103    }
1104
1105    public boolean hasStart() { 
1106      return this.start != null && !this.start.isEmpty();
1107    }
1108
1109    /**
1110     * @param value {@link #start} (The date or event after which the goal should begin being pursued.)
1111     */
1112    public Goal setStart(DataType value) { 
1113      if (value != null && !(value instanceof DateType || value instanceof CodeableConcept))
1114        throw new Error("Not the right type for Goal.start[x]: "+value.fhirType());
1115      this.start = value;
1116      return this;
1117    }
1118
1119    /**
1120     * @return {@link #target} (Indicates what should be done by when.)
1121     */
1122    public List<GoalTargetComponent> getTarget() { 
1123      if (this.target == null)
1124        this.target = new ArrayList<GoalTargetComponent>();
1125      return this.target;
1126    }
1127
1128    /**
1129     * @return Returns a reference to <code>this</code> for easy method chaining
1130     */
1131    public Goal setTarget(List<GoalTargetComponent> theTarget) { 
1132      this.target = theTarget;
1133      return this;
1134    }
1135
1136    public boolean hasTarget() { 
1137      if (this.target == null)
1138        return false;
1139      for (GoalTargetComponent item : this.target)
1140        if (!item.isEmpty())
1141          return true;
1142      return false;
1143    }
1144
1145    public GoalTargetComponent addTarget() { //3
1146      GoalTargetComponent t = new GoalTargetComponent();
1147      if (this.target == null)
1148        this.target = new ArrayList<GoalTargetComponent>();
1149      this.target.add(t);
1150      return t;
1151    }
1152
1153    public Goal addTarget(GoalTargetComponent t) { //3
1154      if (t == null)
1155        return this;
1156      if (this.target == null)
1157        this.target = new ArrayList<GoalTargetComponent>();
1158      this.target.add(t);
1159      return this;
1160    }
1161
1162    /**
1163     * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist {3}
1164     */
1165    public GoalTargetComponent getTargetFirstRep() { 
1166      if (getTarget().isEmpty()) {
1167        addTarget();
1168      }
1169      return getTarget().get(0);
1170    }
1171
1172    /**
1173     * @return {@link #statusDate} (Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
1174     */
1175    public DateType getStatusDateElement() { 
1176      if (this.statusDate == null)
1177        if (Configuration.errorOnAutoCreate())
1178          throw new Error("Attempt to auto-create Goal.statusDate");
1179        else if (Configuration.doAutoCreate())
1180          this.statusDate = new DateType(); // bb
1181      return this.statusDate;
1182    }
1183
1184    public boolean hasStatusDateElement() { 
1185      return this.statusDate != null && !this.statusDate.isEmpty();
1186    }
1187
1188    public boolean hasStatusDate() { 
1189      return this.statusDate != null && !this.statusDate.isEmpty();
1190    }
1191
1192    /**
1193     * @param value {@link #statusDate} (Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
1194     */
1195    public Goal setStatusDateElement(DateType value) { 
1196      this.statusDate = value;
1197      return this;
1198    }
1199
1200    /**
1201     * @return Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
1202     */
1203    public Date getStatusDate() { 
1204      return this.statusDate == null ? null : this.statusDate.getValue();
1205    }
1206
1207    /**
1208     * @param value Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
1209     */
1210    public Goal setStatusDate(Date value) { 
1211      if (value == null)
1212        this.statusDate = null;
1213      else {
1214        if (this.statusDate == null)
1215          this.statusDate = new DateType();
1216        this.statusDate.setValue(value);
1217      }
1218      return this;
1219    }
1220
1221    /**
1222     * @return {@link #statusReason} (Captures the reason for the current status.). This is the underlying object with id, value and extensions. The accessor "getStatusReason" gives direct access to the value
1223     */
1224    public StringType getStatusReasonElement() { 
1225      if (this.statusReason == null)
1226        if (Configuration.errorOnAutoCreate())
1227          throw new Error("Attempt to auto-create Goal.statusReason");
1228        else if (Configuration.doAutoCreate())
1229          this.statusReason = new StringType(); // bb
1230      return this.statusReason;
1231    }
1232
1233    public boolean hasStatusReasonElement() { 
1234      return this.statusReason != null && !this.statusReason.isEmpty();
1235    }
1236
1237    public boolean hasStatusReason() { 
1238      return this.statusReason != null && !this.statusReason.isEmpty();
1239    }
1240
1241    /**
1242     * @param value {@link #statusReason} (Captures the reason for the current status.). This is the underlying object with id, value and extensions. The accessor "getStatusReason" gives direct access to the value
1243     */
1244    public Goal setStatusReasonElement(StringType value) { 
1245      this.statusReason = value;
1246      return this;
1247    }
1248
1249    /**
1250     * @return Captures the reason for the current status.
1251     */
1252    public String getStatusReason() { 
1253      return this.statusReason == null ? null : this.statusReason.getValue();
1254    }
1255
1256    /**
1257     * @param value Captures the reason for the current status.
1258     */
1259    public Goal setStatusReason(String value) { 
1260      if (Utilities.noString(value))
1261        this.statusReason = null;
1262      else {
1263        if (this.statusReason == null)
1264          this.statusReason = new StringType();
1265        this.statusReason.setValue(value);
1266      }
1267      return this;
1268    }
1269
1270    /**
1271     * @return {@link #expressedBy} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
1272     */
1273    public Reference getExpressedBy() { 
1274      if (this.expressedBy == null)
1275        if (Configuration.errorOnAutoCreate())
1276          throw new Error("Attempt to auto-create Goal.expressedBy");
1277        else if (Configuration.doAutoCreate())
1278          this.expressedBy = new Reference(); // cc
1279      return this.expressedBy;
1280    }
1281
1282    public boolean hasExpressedBy() { 
1283      return this.expressedBy != null && !this.expressedBy.isEmpty();
1284    }
1285
1286    /**
1287     * @param value {@link #expressedBy} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
1288     */
1289    public Goal setExpressedBy(Reference value) { 
1290      this.expressedBy = value;
1291      return this;
1292    }
1293
1294    /**
1295     * @return {@link #addresses} (The identified conditions and other health record elements that are intended to be addressed by the goal.)
1296     */
1297    public List<Reference> getAddresses() { 
1298      if (this.addresses == null)
1299        this.addresses = new ArrayList<Reference>();
1300      return this.addresses;
1301    }
1302
1303    /**
1304     * @return Returns a reference to <code>this</code> for easy method chaining
1305     */
1306    public Goal setAddresses(List<Reference> theAddresses) { 
1307      this.addresses = theAddresses;
1308      return this;
1309    }
1310
1311    public boolean hasAddresses() { 
1312      if (this.addresses == null)
1313        return false;
1314      for (Reference item : this.addresses)
1315        if (!item.isEmpty())
1316          return true;
1317      return false;
1318    }
1319
1320    public Reference addAddresses() { //3
1321      Reference t = new Reference();
1322      if (this.addresses == null)
1323        this.addresses = new ArrayList<Reference>();
1324      this.addresses.add(t);
1325      return t;
1326    }
1327
1328    public Goal addAddresses(Reference t) { //3
1329      if (t == null)
1330        return this;
1331      if (this.addresses == null)
1332        this.addresses = new ArrayList<Reference>();
1333      this.addresses.add(t);
1334      return this;
1335    }
1336
1337    /**
1338     * @return The first repetition of repeating field {@link #addresses}, creating it if it does not already exist {3}
1339     */
1340    public Reference getAddressesFirstRep() { 
1341      if (getAddresses().isEmpty()) {
1342        addAddresses();
1343      }
1344      return getAddresses().get(0);
1345    }
1346
1347    /**
1348     * @return {@link #note} (Any comments related to the goal.)
1349     */
1350    public List<Annotation> getNote() { 
1351      if (this.note == null)
1352        this.note = new ArrayList<Annotation>();
1353      return this.note;
1354    }
1355
1356    /**
1357     * @return Returns a reference to <code>this</code> for easy method chaining
1358     */
1359    public Goal setNote(List<Annotation> theNote) { 
1360      this.note = theNote;
1361      return this;
1362    }
1363
1364    public boolean hasNote() { 
1365      if (this.note == null)
1366        return false;
1367      for (Annotation item : this.note)
1368        if (!item.isEmpty())
1369          return true;
1370      return false;
1371    }
1372
1373    public Annotation addNote() { //3
1374      Annotation t = new Annotation();
1375      if (this.note == null)
1376        this.note = new ArrayList<Annotation>();
1377      this.note.add(t);
1378      return t;
1379    }
1380
1381    public Goal addNote(Annotation t) { //3
1382      if (t == null)
1383        return this;
1384      if (this.note == null)
1385        this.note = new ArrayList<Annotation>();
1386      this.note.add(t);
1387      return this;
1388    }
1389
1390    /**
1391     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1392     */
1393    public Annotation getNoteFirstRep() { 
1394      if (getNote().isEmpty()) {
1395        addNote();
1396      }
1397      return getNote().get(0);
1398    }
1399
1400    /**
1401     * @return {@link #outcomeCode} (Identifies the change (or lack of change) at the point when the status of the goal is assessed.)
1402     */
1403    public List<CodeableConcept> getOutcomeCode() { 
1404      if (this.outcomeCode == null)
1405        this.outcomeCode = new ArrayList<CodeableConcept>();
1406      return this.outcomeCode;
1407    }
1408
1409    /**
1410     * @return Returns a reference to <code>this</code> for easy method chaining
1411     */
1412    public Goal setOutcomeCode(List<CodeableConcept> theOutcomeCode) { 
1413      this.outcomeCode = theOutcomeCode;
1414      return this;
1415    }
1416
1417    public boolean hasOutcomeCode() { 
1418      if (this.outcomeCode == null)
1419        return false;
1420      for (CodeableConcept item : this.outcomeCode)
1421        if (!item.isEmpty())
1422          return true;
1423      return false;
1424    }
1425
1426    public CodeableConcept addOutcomeCode() { //3
1427      CodeableConcept t = new CodeableConcept();
1428      if (this.outcomeCode == null)
1429        this.outcomeCode = new ArrayList<CodeableConcept>();
1430      this.outcomeCode.add(t);
1431      return t;
1432    }
1433
1434    public Goal addOutcomeCode(CodeableConcept t) { //3
1435      if (t == null)
1436        return this;
1437      if (this.outcomeCode == null)
1438        this.outcomeCode = new ArrayList<CodeableConcept>();
1439      this.outcomeCode.add(t);
1440      return this;
1441    }
1442
1443    /**
1444     * @return The first repetition of repeating field {@link #outcomeCode}, creating it if it does not already exist {3}
1445     */
1446    public CodeableConcept getOutcomeCodeFirstRep() { 
1447      if (getOutcomeCode().isEmpty()) {
1448        addOutcomeCode();
1449      }
1450      return getOutcomeCode().get(0);
1451    }
1452
1453    /**
1454     * @return {@link #outcomeReference} (Details of what's changed (or not changed).)
1455     */
1456    public List<Reference> getOutcomeReference() { 
1457      if (this.outcomeReference == null)
1458        this.outcomeReference = new ArrayList<Reference>();
1459      return this.outcomeReference;
1460    }
1461
1462    /**
1463     * @return Returns a reference to <code>this</code> for easy method chaining
1464     */
1465    public Goal setOutcomeReference(List<Reference> theOutcomeReference) { 
1466      this.outcomeReference = theOutcomeReference;
1467      return this;
1468    }
1469
1470    public boolean hasOutcomeReference() { 
1471      if (this.outcomeReference == null)
1472        return false;
1473      for (Reference item : this.outcomeReference)
1474        if (!item.isEmpty())
1475          return true;
1476      return false;
1477    }
1478
1479    public Reference addOutcomeReference() { //3
1480      Reference t = new Reference();
1481      if (this.outcomeReference == null)
1482        this.outcomeReference = new ArrayList<Reference>();
1483      this.outcomeReference.add(t);
1484      return t;
1485    }
1486
1487    public Goal addOutcomeReference(Reference t) { //3
1488      if (t == null)
1489        return this;
1490      if (this.outcomeReference == null)
1491        this.outcomeReference = new ArrayList<Reference>();
1492      this.outcomeReference.add(t);
1493      return this;
1494    }
1495
1496    /**
1497     * @return The first repetition of repeating field {@link #outcomeReference}, creating it if it does not already exist {3}
1498     */
1499    public Reference getOutcomeReferenceFirstRep() { 
1500      if (getOutcomeReference().isEmpty()) {
1501        addOutcomeReference();
1502      }
1503      return getOutcomeReference().get(0);
1504    }
1505
1506      protected void listChildren(List<Property> children) {
1507        super.listChildren(children);
1508        children.add(new Property("identifier", "Identifier", "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.", 0, java.lang.Integer.MAX_VALUE, identifier));
1509        children.add(new Property("lifecycleStatus", "code", "The state of the goal throughout its lifecycle.", 0, 1, lifecycleStatus));
1510        children.add(new Property("achievementStatus", "CodeableConcept", "Describes the progression, or lack thereof, towards the goal against the target.", 0, 1, achievementStatus));
1511        children.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, java.lang.Integer.MAX_VALUE, category));
1512        children.add(new Property("priority", "CodeableConcept", "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, 1, priority));
1513        children.add(new Property("description", "CodeableConcept", "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\".", 0, 1, description));
1514        children.add(new Property("subject", "Reference(Patient|Group|Organization)", "Identifies the patient, group or organization for whom the goal is being established.", 0, 1, subject));
1515        children.add(new Property("start[x]", "date|CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, 1, start));
1516        children.add(new Property("target", "", "Indicates what should be done by when.", 0, java.lang.Integer.MAX_VALUE, target));
1517        children.add(new Property("statusDate", "date", "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, 1, statusDate));
1518        children.add(new Property("statusReason", "string", "Captures the reason for the current status.", 0, 1, statusReason));
1519        children.add(new Property("expressedBy", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, 1, expressedBy));
1520        children.add(new Property("addresses", "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ServiceRequest|RiskAssessment)", "The identified conditions and other health record elements that are intended to be addressed by the goal.", 0, java.lang.Integer.MAX_VALUE, addresses));
1521        children.add(new Property("note", "Annotation", "Any comments related to the goal.", 0, java.lang.Integer.MAX_VALUE, note));
1522        children.add(new Property("outcomeCode", "CodeableConcept", "Identifies the change (or lack of change) at the point when the status of the goal is assessed.", 0, java.lang.Integer.MAX_VALUE, outcomeCode));
1523        children.add(new Property("outcomeReference", "Reference(Observation)", "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, outcomeReference));
1524      }
1525
1526      @Override
1527      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1528        switch (_hash) {
1529        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "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.", 0, java.lang.Integer.MAX_VALUE, identifier);
1530        case 1165552636: /*lifecycleStatus*/  return new Property("lifecycleStatus", "code", "The state of the goal throughout its lifecycle.", 0, 1, lifecycleStatus);
1531        case 104524801: /*achievementStatus*/  return new Property("achievementStatus", "CodeableConcept", "Describes the progression, or lack thereof, towards the goal against the target.", 0, 1, achievementStatus);
1532        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, java.lang.Integer.MAX_VALUE, category);
1533        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, 1, priority);
1534        case -1724546052: /*description*/  return new Property("description", "CodeableConcept", "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\".", 0, 1, description);
1535        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Organization)", "Identifies the patient, group or organization for whom the goal is being established.", 0, 1, subject);
1536        case 1316793566: /*start[x]*/  return new Property("start[x]", "date|CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, 1, start);
1537        case 109757538: /*start*/  return new Property("start[x]", "date|CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, 1, start);
1538        case -2129778896: /*startDate*/  return new Property("start[x]", "date", "The date or event after which the goal should begin being pursued.", 0, 1, start);
1539        case -1758833953: /*startCodeableConcept*/  return new Property("start[x]", "CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, 1, start);
1540        case -880905839: /*target*/  return new Property("target", "", "Indicates what should be done by when.", 0, java.lang.Integer.MAX_VALUE, target);
1541        case 247524032: /*statusDate*/  return new Property("statusDate", "date", "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, 1, statusDate);
1542        case 2051346646: /*statusReason*/  return new Property("statusReason", "string", "Captures the reason for the current status.", 0, 1, statusReason);
1543        case 175423686: /*expressedBy*/  return new Property("expressedBy", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, 1, expressedBy);
1544        case 874544034: /*addresses*/  return new Property("addresses", "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ServiceRequest|RiskAssessment)", "The identified conditions and other health record elements that are intended to be addressed by the goal.", 0, java.lang.Integer.MAX_VALUE, addresses);
1545        case 3387378: /*note*/  return new Property("note", "Annotation", "Any comments related to the goal.", 0, java.lang.Integer.MAX_VALUE, note);
1546        case 1062482015: /*outcomeCode*/  return new Property("outcomeCode", "CodeableConcept", "Identifies the change (or lack of change) at the point when the status of the goal is assessed.", 0, java.lang.Integer.MAX_VALUE, outcomeCode);
1547        case -782273511: /*outcomeReference*/  return new Property("outcomeReference", "Reference(Observation)", "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, outcomeReference);
1548        default: return super.getNamedProperty(_hash, _name, _checkValid);
1549        }
1550
1551      }
1552
1553      @Override
1554      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1555        switch (hash) {
1556        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1557        case 1165552636: /*lifecycleStatus*/ return this.lifecycleStatus == null ? new Base[0] : new Base[] {this.lifecycleStatus}; // Enumeration<GoalLifecycleStatus>
1558        case 104524801: /*achievementStatus*/ return this.achievementStatus == null ? new Base[0] : new Base[] {this.achievementStatus}; // CodeableConcept
1559        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1560        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1561        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // CodeableConcept
1562        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1563        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // DataType
1564        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // GoalTargetComponent
1565        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateType
1566        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // StringType
1567        case 175423686: /*expressedBy*/ return this.expressedBy == null ? new Base[0] : new Base[] {this.expressedBy}; // Reference
1568        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
1569        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1570        case 1062482015: /*outcomeCode*/ return this.outcomeCode == null ? new Base[0] : this.outcomeCode.toArray(new Base[this.outcomeCode.size()]); // CodeableConcept
1571        case -782273511: /*outcomeReference*/ return this.outcomeReference == null ? new Base[0] : this.outcomeReference.toArray(new Base[this.outcomeReference.size()]); // Reference
1572        default: return super.getProperty(hash, name, checkValid);
1573        }
1574
1575      }
1576
1577      @Override
1578      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1579        switch (hash) {
1580        case -1618432855: // identifier
1581          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1582          return value;
1583        case 1165552636: // lifecycleStatus
1584          value = new GoalLifecycleStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1585          this.lifecycleStatus = (Enumeration) value; // Enumeration<GoalLifecycleStatus>
1586          return value;
1587        case 104524801: // achievementStatus
1588          this.achievementStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1589          return value;
1590        case 50511102: // category
1591          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1592          return value;
1593        case -1165461084: // priority
1594          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1595          return value;
1596        case -1724546052: // description
1597          this.description = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1598          return value;
1599        case -1867885268: // subject
1600          this.subject = TypeConvertor.castToReference(value); // Reference
1601          return value;
1602        case 109757538: // start
1603          this.start = TypeConvertor.castToType(value); // DataType
1604          return value;
1605        case -880905839: // target
1606          this.getTarget().add((GoalTargetComponent) value); // GoalTargetComponent
1607          return value;
1608        case 247524032: // statusDate
1609          this.statusDate = TypeConvertor.castToDate(value); // DateType
1610          return value;
1611        case 2051346646: // statusReason
1612          this.statusReason = TypeConvertor.castToString(value); // StringType
1613          return value;
1614        case 175423686: // expressedBy
1615          this.expressedBy = TypeConvertor.castToReference(value); // Reference
1616          return value;
1617        case 874544034: // addresses
1618          this.getAddresses().add(TypeConvertor.castToReference(value)); // Reference
1619          return value;
1620        case 3387378: // note
1621          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
1622          return value;
1623        case 1062482015: // outcomeCode
1624          this.getOutcomeCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1625          return value;
1626        case -782273511: // outcomeReference
1627          this.getOutcomeReference().add(TypeConvertor.castToReference(value)); // Reference
1628          return value;
1629        default: return super.setProperty(hash, name, value);
1630        }
1631
1632      }
1633
1634      @Override
1635      public Base setProperty(String name, Base value) throws FHIRException {
1636        if (name.equals("identifier")) {
1637          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1638        } else if (name.equals("lifecycleStatus")) {
1639          value = new GoalLifecycleStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1640          this.lifecycleStatus = (Enumeration) value; // Enumeration<GoalLifecycleStatus>
1641        } else if (name.equals("achievementStatus")) {
1642          this.achievementStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1643        } else if (name.equals("category")) {
1644          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
1645        } else if (name.equals("priority")) {
1646          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1647        } else if (name.equals("description")) {
1648          this.description = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1649        } else if (name.equals("subject")) {
1650          this.subject = TypeConvertor.castToReference(value); // Reference
1651        } else if (name.equals("start[x]")) {
1652          this.start = TypeConvertor.castToType(value); // DataType
1653        } else if (name.equals("target")) {
1654          this.getTarget().add((GoalTargetComponent) value);
1655        } else if (name.equals("statusDate")) {
1656          this.statusDate = TypeConvertor.castToDate(value); // DateType
1657        } else if (name.equals("statusReason")) {
1658          this.statusReason = TypeConvertor.castToString(value); // StringType
1659        } else if (name.equals("expressedBy")) {
1660          this.expressedBy = TypeConvertor.castToReference(value); // Reference
1661        } else if (name.equals("addresses")) {
1662          this.getAddresses().add(TypeConvertor.castToReference(value));
1663        } else if (name.equals("note")) {
1664          this.getNote().add(TypeConvertor.castToAnnotation(value));
1665        } else if (name.equals("outcomeCode")) {
1666          this.getOutcomeCode().add(TypeConvertor.castToCodeableConcept(value));
1667        } else if (name.equals("outcomeReference")) {
1668          this.getOutcomeReference().add(TypeConvertor.castToReference(value));
1669        } else
1670          return super.setProperty(name, value);
1671        return value;
1672      }
1673
1674      @Override
1675      public Base makeProperty(int hash, String name) throws FHIRException {
1676        switch (hash) {
1677        case -1618432855:  return addIdentifier(); 
1678        case 1165552636:  return getLifecycleStatusElement();
1679        case 104524801:  return getAchievementStatus();
1680        case 50511102:  return addCategory(); 
1681        case -1165461084:  return getPriority();
1682        case -1724546052:  return getDescription();
1683        case -1867885268:  return getSubject();
1684        case 1316793566:  return getStart();
1685        case 109757538:  return getStart();
1686        case -880905839:  return addTarget(); 
1687        case 247524032:  return getStatusDateElement();
1688        case 2051346646:  return getStatusReasonElement();
1689        case 175423686:  return getExpressedBy();
1690        case 874544034:  return addAddresses(); 
1691        case 3387378:  return addNote(); 
1692        case 1062482015:  return addOutcomeCode(); 
1693        case -782273511:  return addOutcomeReference(); 
1694        default: return super.makeProperty(hash, name);
1695        }
1696
1697      }
1698
1699      @Override
1700      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1701        switch (hash) {
1702        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1703        case 1165552636: /*lifecycleStatus*/ return new String[] {"code"};
1704        case 104524801: /*achievementStatus*/ return new String[] {"CodeableConcept"};
1705        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1706        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
1707        case -1724546052: /*description*/ return new String[] {"CodeableConcept"};
1708        case -1867885268: /*subject*/ return new String[] {"Reference"};
1709        case 109757538: /*start*/ return new String[] {"date", "CodeableConcept"};
1710        case -880905839: /*target*/ return new String[] {};
1711        case 247524032: /*statusDate*/ return new String[] {"date"};
1712        case 2051346646: /*statusReason*/ return new String[] {"string"};
1713        case 175423686: /*expressedBy*/ return new String[] {"Reference"};
1714        case 874544034: /*addresses*/ return new String[] {"Reference"};
1715        case 3387378: /*note*/ return new String[] {"Annotation"};
1716        case 1062482015: /*outcomeCode*/ return new String[] {"CodeableConcept"};
1717        case -782273511: /*outcomeReference*/ return new String[] {"Reference"};
1718        default: return super.getTypesForProperty(hash, name);
1719        }
1720
1721      }
1722
1723      @Override
1724      public Base addChild(String name) throws FHIRException {
1725        if (name.equals("identifier")) {
1726          return addIdentifier();
1727        }
1728        else if (name.equals("lifecycleStatus")) {
1729          throw new FHIRException("Cannot call addChild on a primitive type Goal.lifecycleStatus");
1730        }
1731        else if (name.equals("achievementStatus")) {
1732          this.achievementStatus = new CodeableConcept();
1733          return this.achievementStatus;
1734        }
1735        else if (name.equals("category")) {
1736          return addCategory();
1737        }
1738        else if (name.equals("priority")) {
1739          this.priority = new CodeableConcept();
1740          return this.priority;
1741        }
1742        else if (name.equals("description")) {
1743          this.description = new CodeableConcept();
1744          return this.description;
1745        }
1746        else if (name.equals("subject")) {
1747          this.subject = new Reference();
1748          return this.subject;
1749        }
1750        else if (name.equals("startDate")) {
1751          this.start = new DateType();
1752          return this.start;
1753        }
1754        else if (name.equals("startCodeableConcept")) {
1755          this.start = new CodeableConcept();
1756          return this.start;
1757        }
1758        else if (name.equals("target")) {
1759          return addTarget();
1760        }
1761        else if (name.equals("statusDate")) {
1762          throw new FHIRException("Cannot call addChild on a primitive type Goal.statusDate");
1763        }
1764        else if (name.equals("statusReason")) {
1765          throw new FHIRException("Cannot call addChild on a primitive type Goal.statusReason");
1766        }
1767        else if (name.equals("expressedBy")) {
1768          this.expressedBy = new Reference();
1769          return this.expressedBy;
1770        }
1771        else if (name.equals("addresses")) {
1772          return addAddresses();
1773        }
1774        else if (name.equals("note")) {
1775          return addNote();
1776        }
1777        else if (name.equals("outcomeCode")) {
1778          return addOutcomeCode();
1779        }
1780        else if (name.equals("outcomeReference")) {
1781          return addOutcomeReference();
1782        }
1783        else
1784          return super.addChild(name);
1785      }
1786
1787  public String fhirType() {
1788    return "Goal";
1789
1790  }
1791
1792      public Goal copy() {
1793        Goal dst = new Goal();
1794        copyValues(dst);
1795        return dst;
1796      }
1797
1798      public void copyValues(Goal dst) {
1799        super.copyValues(dst);
1800        if (identifier != null) {
1801          dst.identifier = new ArrayList<Identifier>();
1802          for (Identifier i : identifier)
1803            dst.identifier.add(i.copy());
1804        };
1805        dst.lifecycleStatus = lifecycleStatus == null ? null : lifecycleStatus.copy();
1806        dst.achievementStatus = achievementStatus == null ? null : achievementStatus.copy();
1807        if (category != null) {
1808          dst.category = new ArrayList<CodeableConcept>();
1809          for (CodeableConcept i : category)
1810            dst.category.add(i.copy());
1811        };
1812        dst.priority = priority == null ? null : priority.copy();
1813        dst.description = description == null ? null : description.copy();
1814        dst.subject = subject == null ? null : subject.copy();
1815        dst.start = start == null ? null : start.copy();
1816        if (target != null) {
1817          dst.target = new ArrayList<GoalTargetComponent>();
1818          for (GoalTargetComponent i : target)
1819            dst.target.add(i.copy());
1820        };
1821        dst.statusDate = statusDate == null ? null : statusDate.copy();
1822        dst.statusReason = statusReason == null ? null : statusReason.copy();
1823        dst.expressedBy = expressedBy == null ? null : expressedBy.copy();
1824        if (addresses != null) {
1825          dst.addresses = new ArrayList<Reference>();
1826          for (Reference i : addresses)
1827            dst.addresses.add(i.copy());
1828        };
1829        if (note != null) {
1830          dst.note = new ArrayList<Annotation>();
1831          for (Annotation i : note)
1832            dst.note.add(i.copy());
1833        };
1834        if (outcomeCode != null) {
1835          dst.outcomeCode = new ArrayList<CodeableConcept>();
1836          for (CodeableConcept i : outcomeCode)
1837            dst.outcomeCode.add(i.copy());
1838        };
1839        if (outcomeReference != null) {
1840          dst.outcomeReference = new ArrayList<Reference>();
1841          for (Reference i : outcomeReference)
1842            dst.outcomeReference.add(i.copy());
1843        };
1844      }
1845
1846      protected Goal typedCopy() {
1847        return copy();
1848      }
1849
1850      @Override
1851      public boolean equalsDeep(Base other_) {
1852        if (!super.equalsDeep(other_))
1853          return false;
1854        if (!(other_ instanceof Goal))
1855          return false;
1856        Goal o = (Goal) other_;
1857        return compareDeep(identifier, o.identifier, true) && compareDeep(lifecycleStatus, o.lifecycleStatus, true)
1858           && compareDeep(achievementStatus, o.achievementStatus, true) && compareDeep(category, o.category, true)
1859           && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true) && compareDeep(subject, o.subject, true)
1860           && compareDeep(start, o.start, true) && compareDeep(target, o.target, true) && compareDeep(statusDate, o.statusDate, true)
1861           && compareDeep(statusReason, o.statusReason, true) && compareDeep(expressedBy, o.expressedBy, true)
1862           && compareDeep(addresses, o.addresses, true) && compareDeep(note, o.note, true) && compareDeep(outcomeCode, o.outcomeCode, true)
1863           && compareDeep(outcomeReference, o.outcomeReference, true);
1864      }
1865
1866      @Override
1867      public boolean equalsShallow(Base other_) {
1868        if (!super.equalsShallow(other_))
1869          return false;
1870        if (!(other_ instanceof Goal))
1871          return false;
1872        Goal o = (Goal) other_;
1873        return compareValues(lifecycleStatus, o.lifecycleStatus, true) && compareValues(statusDate, o.statusDate, true)
1874           && compareValues(statusReason, o.statusReason, true);
1875      }
1876
1877      public boolean isEmpty() {
1878        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, lifecycleStatus
1879          , achievementStatus, category, priority, description, subject, start, target, statusDate
1880          , statusReason, expressedBy, addresses, note, outcomeCode, outcomeReference);
1881      }
1882
1883  @Override
1884  public ResourceType getResourceType() {
1885    return ResourceType.Goal;
1886   }
1887
1888 /**
1889   * Search parameter: <b>achievement-status</b>
1890   * <p>
1891   * Description: <b>in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable</b><br>
1892   * Type: <b>token</b><br>
1893   * Path: <b>Goal.achievementStatus</b><br>
1894   * </p>
1895   */
1896  @SearchParamDefinition(name="achievement-status", path="Goal.achievementStatus", description="in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable", type="token" )
1897  public static final String SP_ACHIEVEMENT_STATUS = "achievement-status";
1898 /**
1899   * <b>Fluent Client</b> search parameter constant for <b>achievement-status</b>
1900   * <p>
1901   * Description: <b>in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable</b><br>
1902   * Type: <b>token</b><br>
1903   * Path: <b>Goal.achievementStatus</b><br>
1904   * </p>
1905   */
1906  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACHIEVEMENT_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACHIEVEMENT_STATUS);
1907
1908 /**
1909   * Search parameter: <b>category</b>
1910   * <p>
1911   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1912   * Type: <b>token</b><br>
1913   * Path: <b>Goal.category</b><br>
1914   * </p>
1915   */
1916  @SearchParamDefinition(name="category", path="Goal.category", description="E.g. Treatment, dietary, behavioral, etc.", type="token" )
1917  public static final String SP_CATEGORY = "category";
1918 /**
1919   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1920   * <p>
1921   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1922   * Type: <b>token</b><br>
1923   * Path: <b>Goal.category</b><br>
1924   * </p>
1925   */
1926  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1927
1928 /**
1929   * Search parameter: <b>lifecycle-status</b>
1930   * <p>
1931   * Description: <b>proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected</b><br>
1932   * Type: <b>token</b><br>
1933   * Path: <b>Goal.lifecycleStatus</b><br>
1934   * </p>
1935   */
1936  @SearchParamDefinition(name="lifecycle-status", path="Goal.lifecycleStatus", description="proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected", type="token" )
1937  public static final String SP_LIFECYCLE_STATUS = "lifecycle-status";
1938 /**
1939   * <b>Fluent Client</b> search parameter constant for <b>lifecycle-status</b>
1940   * <p>
1941   * Description: <b>proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected</b><br>
1942   * Type: <b>token</b><br>
1943   * Path: <b>Goal.lifecycleStatus</b><br>
1944   * </p>
1945   */
1946  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LIFECYCLE_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LIFECYCLE_STATUS);
1947
1948 /**
1949   * Search parameter: <b>start-date</b>
1950   * <p>
1951   * Description: <b>When goal pursuit begins</b><br>
1952   * Type: <b>date</b><br>
1953   * Path: <b>(Goal.start as date)</b><br>
1954   * </p>
1955   */
1956  @SearchParamDefinition(name="start-date", path="(Goal.start as date)", description="When goal pursuit begins", type="date" )
1957  public static final String SP_START_DATE = "start-date";
1958 /**
1959   * <b>Fluent Client</b> search parameter constant for <b>start-date</b>
1960   * <p>
1961   * Description: <b>When goal pursuit begins</b><br>
1962   * Type: <b>date</b><br>
1963   * Path: <b>(Goal.start as date)</b><br>
1964   * </p>
1965   */
1966  public static final ca.uhn.fhir.rest.gclient.DateClientParam START_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_START_DATE);
1967
1968 /**
1969   * Search parameter: <b>subject</b>
1970   * <p>
1971   * Description: <b>Who this goal is intended for</b><br>
1972   * Type: <b>reference</b><br>
1973   * Path: <b>Goal.subject</b><br>
1974   * </p>
1975   */
1976  @SearchParamDefinition(name="subject", path="Goal.subject", description="Who this goal is intended for", type="reference", target={Group.class, Organization.class, Patient.class } )
1977  public static final String SP_SUBJECT = "subject";
1978 /**
1979   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1980   * <p>
1981   * Description: <b>Who this goal is intended for</b><br>
1982   * Type: <b>reference</b><br>
1983   * Path: <b>Goal.subject</b><br>
1984   * </p>
1985   */
1986  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1987
1988/**
1989   * Constant for fluent queries to be used to add include statements. Specifies
1990   * the path value of "<b>Goal:subject</b>".
1991   */
1992  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Goal:subject").toLocked();
1993
1994 /**
1995   * Search parameter: <b>target-date</b>
1996   * <p>
1997   * Description: <b>Reach goal on or before</b><br>
1998   * Type: <b>date</b><br>
1999   * Path: <b>(Goal.target.due as date)</b><br>
2000   * </p>
2001   */
2002  @SearchParamDefinition(name="target-date", path="(Goal.target.due as date)", description="Reach goal on or before", type="date" )
2003  public static final String SP_TARGET_DATE = "target-date";
2004 /**
2005   * <b>Fluent Client</b> search parameter constant for <b>target-date</b>
2006   * <p>
2007   * Description: <b>Reach goal on or before</b><br>
2008   * Type: <b>date</b><br>
2009   * Path: <b>(Goal.target.due as date)</b><br>
2010   * </p>
2011   */
2012  public static final ca.uhn.fhir.rest.gclient.DateClientParam TARGET_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_TARGET_DATE);
2013
2014 /**
2015   * Search parameter: <b>identifier</b>
2016   * <p>
2017   * Description: <b>Multiple Resources: 
2018
2019* [AllergyIntolerance](allergyintolerance.html): External ids for this item
2020* [CarePlan](careplan.html): External Ids for this plan
2021* [CareTeam](careteam.html): External Ids for this team
2022* [Composition](composition.html): Version-independent identifier for the Composition
2023* [Condition](condition.html): A unique identifier of the condition record
2024* [Consent](consent.html): Identifier for this record (external references)
2025* [DetectedIssue](detectedissue.html): Unique id for the detected issue
2026* [DeviceRequest](devicerequest.html): Business identifier for request/order
2027* [DiagnosticReport](diagnosticreport.html): An identifier for the report
2028* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
2029* [DocumentReference](documentreference.html): Master Version Specific Identifier
2030* [Encounter](encounter.html): Identifier(s) by which this encounter is known
2031* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
2032* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
2033* [Goal](goal.html): External Ids for this goal
2034* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number
2035* [Immunization](immunization.html): Business identifier
2036* [List](list.html): Business identifier
2037* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
2038* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
2039* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
2040* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
2041* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
2042* [Observation](observation.html): The unique id for a particular observation
2043* [Procedure](procedure.html): A unique identifier for a procedure
2044* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
2045* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
2046* [SupplyDelivery](supplydelivery.html): External identifier
2047* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
2048* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
2049</b><br>
2050   * Type: <b>token</b><br>
2051   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
2052   * </p>
2053   */
2054  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Master Version Specific Identifier\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationStatement](medicationstatement.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
2055  public static final String SP_IDENTIFIER = "identifier";
2056 /**
2057   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2058   * <p>
2059   * Description: <b>Multiple Resources: 
2060
2061* [AllergyIntolerance](allergyintolerance.html): External ids for this item
2062* [CarePlan](careplan.html): External Ids for this plan
2063* [CareTeam](careteam.html): External Ids for this team
2064* [Composition](composition.html): Version-independent identifier for the Composition
2065* [Condition](condition.html): A unique identifier of the condition record
2066* [Consent](consent.html): Identifier for this record (external references)
2067* [DetectedIssue](detectedissue.html): Unique id for the detected issue
2068* [DeviceRequest](devicerequest.html): Business identifier for request/order
2069* [DiagnosticReport](diagnosticreport.html): An identifier for the report
2070* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
2071* [DocumentReference](documentreference.html): Master Version Specific Identifier
2072* [Encounter](encounter.html): Identifier(s) by which this encounter is known
2073* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
2074* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
2075* [Goal](goal.html): External Ids for this goal
2076* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number
2077* [Immunization](immunization.html): Business identifier
2078* [List](list.html): Business identifier
2079* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
2080* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
2081* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
2082* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
2083* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
2084* [Observation](observation.html): The unique id for a particular observation
2085* [Procedure](procedure.html): A unique identifier for a procedure
2086* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
2087* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
2088* [SupplyDelivery](supplydelivery.html): External identifier
2089* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
2090* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
2091</b><br>
2092   * Type: <b>token</b><br>
2093   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
2094   * </p>
2095   */
2096  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2097
2098 /**
2099   * Search parameter: <b>patient</b>
2100   * <p>
2101   * Description: <b>Multiple Resources: 
2102
2103* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2104* [CarePlan](careplan.html): Who the care plan is for
2105* [CareTeam](careteam.html): Who care team is for
2106* [ClinicalImpression](clinicalimpression.html): Patient or group assessed
2107* [Composition](composition.html): Who and/or what the composition is about
2108* [Condition](condition.html): Who has the condition?
2109* [Consent](consent.html): Who the consent applies to
2110* [DetectedIssue](detectedissue.html): Associated patient
2111* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2112* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient
2113* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2114* [DocumentManifest](documentmanifest.html): The subject of the set of documents
2115* [DocumentReference](documentreference.html): Who/what is the subject of the document
2116* [Encounter](encounter.html): The patient or group present at the encounter
2117* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2118* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2119* [Flag](flag.html): The identity of a subject to list flags for
2120* [Goal](goal.html): Who this goal is intended for
2121* [ImagingStudy](imagingstudy.html): Who the study is about
2122* [Immunization](immunization.html): The patient for the vaccination record
2123* [List](list.html): If all resources have the same subject
2124* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2125* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2126* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2127* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2128* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
2129* [Observation](observation.html): The subject that the observation is about (if patient)
2130* [Procedure](procedure.html): Search by subject - a patient
2131* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2132* [ServiceRequest](servicerequest.html): Search by subject - a patient
2133* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2134* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2135</b><br>
2136   * Type: <b>reference</b><br>
2137   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is Patient) | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
2138   * </p>
2139   */
2140  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is Patient) | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient or group assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient or group present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, CatalogEntry.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceMetric.class, DeviceRequest.class, DeviceUseStatement.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Media.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchDefinition.class, ResearchElementDefinition.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
2141  public static final String SP_PATIENT = "patient";
2142 /**
2143   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2144   * <p>
2145   * Description: <b>Multiple Resources: 
2146
2147* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2148* [CarePlan](careplan.html): Who the care plan is for
2149* [CareTeam](careteam.html): Who care team is for
2150* [ClinicalImpression](clinicalimpression.html): Patient or group assessed
2151* [Composition](composition.html): Who and/or what the composition is about
2152* [Condition](condition.html): Who has the condition?
2153* [Consent](consent.html): Who the consent applies to
2154* [DetectedIssue](detectedissue.html): Associated patient
2155* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2156* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient
2157* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2158* [DocumentManifest](documentmanifest.html): The subject of the set of documents
2159* [DocumentReference](documentreference.html): Who/what is the subject of the document
2160* [Encounter](encounter.html): The patient or group present at the encounter
2161* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2162* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2163* [Flag](flag.html): The identity of a subject to list flags for
2164* [Goal](goal.html): Who this goal is intended for
2165* [ImagingStudy](imagingstudy.html): Who the study is about
2166* [Immunization](immunization.html): The patient for the vaccination record
2167* [List](list.html): If all resources have the same subject
2168* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2169* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2170* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2171* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2172* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
2173* [Observation](observation.html): The subject that the observation is about (if patient)
2174* [Procedure](procedure.html): Search by subject - a patient
2175* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2176* [ServiceRequest](servicerequest.html): Search by subject - a patient
2177* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2178* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2179</b><br>
2180   * Type: <b>reference</b><br>
2181   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is Patient) | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
2182   * </p>
2183   */
2184  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2185
2186/**
2187   * Constant for fluent queries to be used to add include statements. Specifies
2188   * the path value of "<b>Goal:patient</b>".
2189   */
2190  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Goal:patient").toLocked();
2191
2192
2193}
2194