001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * 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.
047 */
048@ResourceDef(name="Goal", profile="http://hl7.org/fhir/Profile/Goal")
049public class Goal extends DomainResource {
050
051    public enum GoalStatus {
052        /**
053         * A goal is proposed for this patient
054         */
055        PROPOSED, 
056        /**
057         * A proposed goal was accepted or acknowledged
058         */
059        ACCEPTED, 
060        /**
061         * A goal is planned for this patient
062         */
063        PLANNED, 
064        /**
065         * The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)
066         */
067        INPROGRESS, 
068        /**
069         * The goal is on schedule for the planned timelines
070         */
071        ONTARGET, 
072        /**
073         * The goal is ahead of the planned timelines
074         */
075        AHEADOFTARGET, 
076        /**
077         * The goal is behind the planned timelines
078         */
079        BEHINDTARGET, 
080        /**
081         * The goal has been met, but ongoing activity is needed to sustain the goal objective
082         */
083        SUSTAINING, 
084        /**
085         * The goal has been met and no further action is needed
086         */
087        ACHIEVED, 
088        /**
089         * The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.
090         */
091        ONHOLD, 
092        /**
093         * The previously accepted goal is no longer being sought
094         */
095        CANCELLED, 
096        /**
097         * The goal was entered in error and voided.
098         */
099        ENTEREDINERROR, 
100        /**
101         * A proposed goal was rejected
102         */
103        REJECTED, 
104        /**
105         * added to help the parsers with the generic types
106         */
107        NULL;
108        public static GoalStatus fromCode(String codeString) throws FHIRException {
109            if (codeString == null || "".equals(codeString))
110                return null;
111        if ("proposed".equals(codeString))
112          return PROPOSED;
113        if ("accepted".equals(codeString))
114          return ACCEPTED;
115        if ("planned".equals(codeString))
116          return PLANNED;
117        if ("in-progress".equals(codeString))
118          return INPROGRESS;
119        if ("on-target".equals(codeString))
120          return ONTARGET;
121        if ("ahead-of-target".equals(codeString))
122          return AHEADOFTARGET;
123        if ("behind-target".equals(codeString))
124          return BEHINDTARGET;
125        if ("sustaining".equals(codeString))
126          return SUSTAINING;
127        if ("achieved".equals(codeString))
128          return ACHIEVED;
129        if ("on-hold".equals(codeString))
130          return ONHOLD;
131        if ("cancelled".equals(codeString))
132          return CANCELLED;
133        if ("entered-in-error".equals(codeString))
134          return ENTEREDINERROR;
135        if ("rejected".equals(codeString))
136          return REJECTED;
137        if (Configuration.isAcceptInvalidEnums())
138          return null;
139        else
140          throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
141        }
142        public String toCode() {
143          switch (this) {
144            case PROPOSED: return "proposed";
145            case ACCEPTED: return "accepted";
146            case PLANNED: return "planned";
147            case INPROGRESS: return "in-progress";
148            case ONTARGET: return "on-target";
149            case AHEADOFTARGET: return "ahead-of-target";
150            case BEHINDTARGET: return "behind-target";
151            case SUSTAINING: return "sustaining";
152            case ACHIEVED: return "achieved";
153            case ONHOLD: return "on-hold";
154            case CANCELLED: return "cancelled";
155            case ENTEREDINERROR: return "entered-in-error";
156            case REJECTED: return "rejected";
157            default: return "?";
158          }
159        }
160        public String getSystem() {
161          switch (this) {
162            case PROPOSED: return "http://hl7.org/fhir/goal-status";
163            case ACCEPTED: return "http://hl7.org/fhir/goal-status";
164            case PLANNED: return "http://hl7.org/fhir/goal-status";
165            case INPROGRESS: return "http://hl7.org/fhir/goal-status";
166            case ONTARGET: return "http://hl7.org/fhir/goal-status";
167            case AHEADOFTARGET: return "http://hl7.org/fhir/goal-status";
168            case BEHINDTARGET: return "http://hl7.org/fhir/goal-status";
169            case SUSTAINING: return "http://hl7.org/fhir/goal-status";
170            case ACHIEVED: return "http://hl7.org/fhir/goal-status";
171            case ONHOLD: return "http://hl7.org/fhir/goal-status";
172            case CANCELLED: return "http://hl7.org/fhir/goal-status";
173            case ENTEREDINERROR: return "http://hl7.org/fhir/goal-status";
174            case REJECTED: return "http://hl7.org/fhir/goal-status";
175            default: return "?";
176          }
177        }
178        public String getDefinition() {
179          switch (this) {
180            case PROPOSED: return "A goal is proposed for this patient";
181            case ACCEPTED: return "A proposed goal was accepted or acknowledged";
182            case PLANNED: return "A goal is planned for this patient";
183            case INPROGRESS: return "The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)";
184            case ONTARGET: return "The goal is on schedule for the planned timelines";
185            case AHEADOFTARGET: return "The goal is ahead of the planned timelines";
186            case BEHINDTARGET: return "The goal is behind the planned timelines";
187            case SUSTAINING: return "The goal has been met, but ongoing activity is needed to sustain the goal objective";
188            case ACHIEVED: return "The goal has been met and no further action is needed";
189            case ONHOLD: return "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.";
190            case CANCELLED: return "The previously accepted goal is no longer being sought";
191            case ENTEREDINERROR: return "The goal was entered in error and voided.";
192            case REJECTED: return "A proposed goal was rejected";
193            default: return "?";
194          }
195        }
196        public String getDisplay() {
197          switch (this) {
198            case PROPOSED: return "Proposed";
199            case ACCEPTED: return "Accepted";
200            case PLANNED: return "Planned";
201            case INPROGRESS: return "In Progress";
202            case ONTARGET: return "On Target";
203            case AHEADOFTARGET: return "Ahead of Target";
204            case BEHINDTARGET: return "Behind Target";
205            case SUSTAINING: return "Sustaining";
206            case ACHIEVED: return "Achieved";
207            case ONHOLD: return "On Hold";
208            case CANCELLED: return "Cancelled";
209            case ENTEREDINERROR: return "Entered In Error";
210            case REJECTED: return "Rejected";
211            default: return "?";
212          }
213        }
214    }
215
216  public static class GoalStatusEnumFactory implements EnumFactory<GoalStatus> {
217    public GoalStatus fromCode(String codeString) throws IllegalArgumentException {
218      if (codeString == null || "".equals(codeString))
219            if (codeString == null || "".equals(codeString))
220                return null;
221        if ("proposed".equals(codeString))
222          return GoalStatus.PROPOSED;
223        if ("accepted".equals(codeString))
224          return GoalStatus.ACCEPTED;
225        if ("planned".equals(codeString))
226          return GoalStatus.PLANNED;
227        if ("in-progress".equals(codeString))
228          return GoalStatus.INPROGRESS;
229        if ("on-target".equals(codeString))
230          return GoalStatus.ONTARGET;
231        if ("ahead-of-target".equals(codeString))
232          return GoalStatus.AHEADOFTARGET;
233        if ("behind-target".equals(codeString))
234          return GoalStatus.BEHINDTARGET;
235        if ("sustaining".equals(codeString))
236          return GoalStatus.SUSTAINING;
237        if ("achieved".equals(codeString))
238          return GoalStatus.ACHIEVED;
239        if ("on-hold".equals(codeString))
240          return GoalStatus.ONHOLD;
241        if ("cancelled".equals(codeString))
242          return GoalStatus.CANCELLED;
243        if ("entered-in-error".equals(codeString))
244          return GoalStatus.ENTEREDINERROR;
245        if ("rejected".equals(codeString))
246          return GoalStatus.REJECTED;
247        throw new IllegalArgumentException("Unknown GoalStatus code '"+codeString+"'");
248        }
249        public Enumeration<GoalStatus> fromType(Base code) throws FHIRException {
250          if (code == null)
251            return null;
252          if (code.isEmpty())
253            return new Enumeration<GoalStatus>(this);
254          String codeString = ((PrimitiveType) code).asStringValue();
255          if (codeString == null || "".equals(codeString))
256            return null;
257        if ("proposed".equals(codeString))
258          return new Enumeration<GoalStatus>(this, GoalStatus.PROPOSED);
259        if ("accepted".equals(codeString))
260          return new Enumeration<GoalStatus>(this, GoalStatus.ACCEPTED);
261        if ("planned".equals(codeString))
262          return new Enumeration<GoalStatus>(this, GoalStatus.PLANNED);
263        if ("in-progress".equals(codeString))
264          return new Enumeration<GoalStatus>(this, GoalStatus.INPROGRESS);
265        if ("on-target".equals(codeString))
266          return new Enumeration<GoalStatus>(this, GoalStatus.ONTARGET);
267        if ("ahead-of-target".equals(codeString))
268          return new Enumeration<GoalStatus>(this, GoalStatus.AHEADOFTARGET);
269        if ("behind-target".equals(codeString))
270          return new Enumeration<GoalStatus>(this, GoalStatus.BEHINDTARGET);
271        if ("sustaining".equals(codeString))
272          return new Enumeration<GoalStatus>(this, GoalStatus.SUSTAINING);
273        if ("achieved".equals(codeString))
274          return new Enumeration<GoalStatus>(this, GoalStatus.ACHIEVED);
275        if ("on-hold".equals(codeString))
276          return new Enumeration<GoalStatus>(this, GoalStatus.ONHOLD);
277        if ("cancelled".equals(codeString))
278          return new Enumeration<GoalStatus>(this, GoalStatus.CANCELLED);
279        if ("entered-in-error".equals(codeString))
280          return new Enumeration<GoalStatus>(this, GoalStatus.ENTEREDINERROR);
281        if ("rejected".equals(codeString))
282          return new Enumeration<GoalStatus>(this, GoalStatus.REJECTED);
283        throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
284        }
285    public String toCode(GoalStatus code) {
286      if (code == GoalStatus.PROPOSED)
287        return "proposed";
288      if (code == GoalStatus.ACCEPTED)
289        return "accepted";
290      if (code == GoalStatus.PLANNED)
291        return "planned";
292      if (code == GoalStatus.INPROGRESS)
293        return "in-progress";
294      if (code == GoalStatus.ONTARGET)
295        return "on-target";
296      if (code == GoalStatus.AHEADOFTARGET)
297        return "ahead-of-target";
298      if (code == GoalStatus.BEHINDTARGET)
299        return "behind-target";
300      if (code == GoalStatus.SUSTAINING)
301        return "sustaining";
302      if (code == GoalStatus.ACHIEVED)
303        return "achieved";
304      if (code == GoalStatus.ONHOLD)
305        return "on-hold";
306      if (code == GoalStatus.CANCELLED)
307        return "cancelled";
308      if (code == GoalStatus.ENTEREDINERROR)
309        return "entered-in-error";
310      if (code == GoalStatus.REJECTED)
311        return "rejected";
312      return "?";
313      }
314    public String toSystem(GoalStatus code) {
315      return code.getSystem();
316      }
317    }
318
319    @Block()
320    public static class GoalTargetComponent extends BackboneElement implements IBaseBackboneElement {
321        /**
322         * The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.
323         */
324        @Child(name = "measure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
325        @Description(shortDefinition="The parameter whose value is being tracked", formalDefinition="The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level." )
326        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
327        protected CodeableConcept measure;
328
329        /**
330         * The target value of the focus to be achieved to signify the fulfillment of 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.
331         */
332        @Child(name = "detail", type = {Quantity.class, Range.class, CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
333        @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." )
334        protected Type detail;
335
336        /**
337         * Indicates either the date or the duration after start by which the goal should be met.
338         */
339        @Child(name = "due", type = {DateType.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
340        @Description(shortDefinition="Reach goal on or before", formalDefinition="Indicates either the date or the duration after start by which the goal should be met." )
341        protected Type due;
342
343        private static final long serialVersionUID = -585108934L;
344
345    /**
346     * Constructor
347     */
348      public GoalTargetComponent() {
349        super();
350      }
351
352        /**
353         * @return {@link #measure} (The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
354         */
355        public CodeableConcept getMeasure() { 
356          if (this.measure == null)
357            if (Configuration.errorOnAutoCreate())
358              throw new Error("Attempt to auto-create GoalTargetComponent.measure");
359            else if (Configuration.doAutoCreate())
360              this.measure = new CodeableConcept(); // cc
361          return this.measure;
362        }
363
364        public boolean hasMeasure() { 
365          return this.measure != null && !this.measure.isEmpty();
366        }
367
368        /**
369         * @param value {@link #measure} (The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
370         */
371        public GoalTargetComponent setMeasure(CodeableConcept value) { 
372          this.measure = value;
373          return this;
374        }
375
376        /**
377         * @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.)
378         */
379        public Type getDetail() { 
380          return this.detail;
381        }
382
383        /**
384         * @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.)
385         */
386        public Quantity getDetailQuantity() throws FHIRException { 
387          if (!(this.detail instanceof Quantity))
388            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.detail.getClass().getName()+" was encountered");
389          return (Quantity) this.detail;
390        }
391
392        public boolean hasDetailQuantity() { 
393          return this.detail instanceof Quantity;
394        }
395
396        /**
397         * @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.)
398         */
399        public Range getDetailRange() throws FHIRException { 
400          if (!(this.detail instanceof Range))
401            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.detail.getClass().getName()+" was encountered");
402          return (Range) this.detail;
403        }
404
405        public boolean hasDetailRange() { 
406          return this.detail instanceof Range;
407        }
408
409        /**
410         * @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.)
411         */
412        public CodeableConcept getDetailCodeableConcept() throws FHIRException { 
413          if (!(this.detail instanceof CodeableConcept))
414            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.detail.getClass().getName()+" was encountered");
415          return (CodeableConcept) this.detail;
416        }
417
418        public boolean hasDetailCodeableConcept() { 
419          return this.detail instanceof CodeableConcept;
420        }
421
422        public boolean hasDetail() { 
423          return this.detail != null && !this.detail.isEmpty();
424        }
425
426        /**
427         * @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.)
428         */
429        public GoalTargetComponent setDetail(Type value) { 
430          this.detail = value;
431          return this;
432        }
433
434        /**
435         * @return {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
436         */
437        public Type getDue() { 
438          return this.due;
439        }
440
441        /**
442         * @return {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
443         */
444        public DateType getDueDateType() throws FHIRException { 
445          if (!(this.due instanceof DateType))
446            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.due.getClass().getName()+" was encountered");
447          return (DateType) this.due;
448        }
449
450        public boolean hasDueDateType() { 
451          return this.due instanceof DateType;
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 Duration getDueDuration() throws FHIRException { 
458          if (!(this.due instanceof Duration))
459            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.due.getClass().getName()+" was encountered");
460          return (Duration) this.due;
461        }
462
463        public boolean hasDueDuration() { 
464          return this.due instanceof Duration;
465        }
466
467        public boolean hasDue() { 
468          return this.due != null && !this.due.isEmpty();
469        }
470
471        /**
472         * @param value {@link #due} (Indicates either the date or the duration after start by which the goal should be met.)
473         */
474        public GoalTargetComponent setDue(Type value) { 
475          this.due = value;
476          return this;
477        }
478
479        protected void listChildren(List<Property> childrenList) {
480          super.listChildren(childrenList);
481          childrenList.add(new Property("measure", "CodeableConcept", "The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, java.lang.Integer.MAX_VALUE, measure));
482          childrenList.add(new Property("detail[x]", "Quantity|Range|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, java.lang.Integer.MAX_VALUE, detail));
483          childrenList.add(new Property("due[x]", "date|Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, java.lang.Integer.MAX_VALUE, due));
484        }
485
486      @Override
487      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
488        switch (hash) {
489        case 938321246: /*measure*/ return this.measure == null ? new Base[0] : new Base[] {this.measure}; // CodeableConcept
490        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // Type
491        case 99828: /*due*/ return this.due == null ? new Base[0] : new Base[] {this.due}; // Type
492        default: return super.getProperty(hash, name, checkValid);
493        }
494
495      }
496
497      @Override
498      public Base setProperty(int hash, String name, Base value) throws FHIRException {
499        switch (hash) {
500        case 938321246: // measure
501          this.measure = castToCodeableConcept(value); // CodeableConcept
502          return value;
503        case -1335224239: // detail
504          this.detail = castToType(value); // Type
505          return value;
506        case 99828: // due
507          this.due = castToType(value); // Type
508          return value;
509        default: return super.setProperty(hash, name, value);
510        }
511
512      }
513
514      @Override
515      public Base setProperty(String name, Base value) throws FHIRException {
516        if (name.equals("measure")) {
517          this.measure = castToCodeableConcept(value); // CodeableConcept
518        } else if (name.equals("detail[x]")) {
519          this.detail = castToType(value); // Type
520        } else if (name.equals("due[x]")) {
521          this.due = castToType(value); // Type
522        } else
523          return super.setProperty(name, value);
524        return value;
525      }
526
527      @Override
528      public Base makeProperty(int hash, String name) throws FHIRException {
529        switch (hash) {
530        case 938321246:  return getMeasure(); 
531        case -1973084529:  return getDetail(); 
532        case -1335224239:  return getDetail(); 
533        case -1320900084:  return getDue(); 
534        case 99828:  return getDue(); 
535        default: return super.makeProperty(hash, name);
536        }
537
538      }
539
540      @Override
541      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
542        switch (hash) {
543        case 938321246: /*measure*/ return new String[] {"CodeableConcept"};
544        case -1335224239: /*detail*/ return new String[] {"Quantity", "Range", "CodeableConcept"};
545        case 99828: /*due*/ return new String[] {"date", "Duration"};
546        default: return super.getTypesForProperty(hash, name);
547        }
548
549      }
550
551      @Override
552      public Base addChild(String name) throws FHIRException {
553        if (name.equals("measure")) {
554          this.measure = new CodeableConcept();
555          return this.measure;
556        }
557        else if (name.equals("detailQuantity")) {
558          this.detail = new Quantity();
559          return this.detail;
560        }
561        else if (name.equals("detailRange")) {
562          this.detail = new Range();
563          return this.detail;
564        }
565        else if (name.equals("detailCodeableConcept")) {
566          this.detail = new CodeableConcept();
567          return this.detail;
568        }
569        else if (name.equals("dueDate")) {
570          this.due = new DateType();
571          return this.due;
572        }
573        else if (name.equals("dueDuration")) {
574          this.due = new Duration();
575          return this.due;
576        }
577        else
578          return super.addChild(name);
579      }
580
581      public GoalTargetComponent copy() {
582        GoalTargetComponent dst = new GoalTargetComponent();
583        copyValues(dst);
584        dst.measure = measure == null ? null : measure.copy();
585        dst.detail = detail == null ? null : detail.copy();
586        dst.due = due == null ? null : due.copy();
587        return dst;
588      }
589
590      @Override
591      public boolean equalsDeep(Base other) {
592        if (!super.equalsDeep(other))
593          return false;
594        if (!(other instanceof GoalTargetComponent))
595          return false;
596        GoalTargetComponent o = (GoalTargetComponent) other;
597        return compareDeep(measure, o.measure, true) && compareDeep(detail, o.detail, true) && compareDeep(due, o.due, true)
598          ;
599      }
600
601      @Override
602      public boolean equalsShallow(Base other) {
603        if (!super.equalsShallow(other))
604          return false;
605        if (!(other instanceof GoalTargetComponent))
606          return false;
607        GoalTargetComponent o = (GoalTargetComponent) other;
608        return true;
609      }
610
611      public boolean isEmpty() {
612        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(measure, detail, due);
613      }
614
615  public String fhirType() {
616    return "Goal.target";
617
618  }
619
620  }
621
622    /**
623     * This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
624     */
625    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
626    @Description(shortDefinition="External Ids for this goal", formalDefinition="This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
627    protected List<Identifier> identifier;
628
629    /**
630     * Indicates whether the goal has been reached and is still considered relevant.
631     */
632    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
633    @Description(shortDefinition="proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected", formalDefinition="Indicates whether the goal has been reached and is still considered relevant." )
634    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-status")
635    protected Enumeration<GoalStatus> status;
636
637    /**
638     * Indicates a category the goal falls within.
639     */
640    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
641    @Description(shortDefinition="E.g. Treatment, dietary, behavioral, etc.", formalDefinition="Indicates a category the goal falls within." )
642    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-category")
643    protected List<CodeableConcept> category;
644
645    /**
646     * Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.
647     */
648    @Child(name = "priority", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
649    @Description(shortDefinition="high-priority | medium-priority | low-priority", formalDefinition="Identifies the mutually agreed level of importance associated with reaching/sustaining the goal." )
650    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-priority")
651    protected CodeableConcept priority;
652
653    /**
654     * 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".
655     */
656    @Child(name = "description", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=true)
657    @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\"." )
658    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
659    protected CodeableConcept description;
660
661    /**
662     * Identifies the patient, group or organization for whom the goal is being established.
663     */
664    @Child(name = "subject", type = {Patient.class, Group.class, Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
665    @Description(shortDefinition="Who this goal is intended for", formalDefinition="Identifies the patient, group or organization for whom the goal is being established." )
666    protected Reference subject;
667
668    /**
669     * The actual object that is the target of the reference (Identifies the patient, group or organization for whom the goal is being established.)
670     */
671    protected Resource subjectTarget;
672
673    /**
674     * The date or event after which the goal should begin being pursued.
675     */
676    @Child(name = "start", type = {DateType.class, CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
677    @Description(shortDefinition="When goal pursuit begins", formalDefinition="The date or event after which the goal should begin being pursued." )
678    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-start-event")
679    protected Type start;
680
681    /**
682     * Indicates what should be done by when.
683     */
684    @Child(name = "target", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
685    @Description(shortDefinition="Target outcome for the goal", formalDefinition="Indicates what should be done by when." )
686    protected GoalTargetComponent target;
687
688    /**
689     * Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
690     */
691    @Child(name = "statusDate", type = {DateType.class}, order=8, min=0, max=1, modifier=false, summary=true)
692    @Description(shortDefinition="When goal status took effect", formalDefinition="Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc." )
693    protected DateType statusDate;
694
695    /**
696     * Captures the reason for the current status.
697     */
698    @Child(name = "statusReason", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
699    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current status." )
700    protected StringType statusReason;
701
702    /**
703     * Indicates whose goal this is - patient goal, practitioner goal, etc.
704     */
705    @Child(name = "expressedBy", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=10, min=0, max=1, modifier=false, summary=true)
706    @Description(shortDefinition="Who's responsible for creating Goal?", formalDefinition="Indicates whose goal this is - patient goal, practitioner goal, etc." )
707    protected Reference expressedBy;
708
709    /**
710     * The actual object that is the target of the reference (Indicates whose goal this is - patient goal, practitioner goal, etc.)
711     */
712    protected Resource expressedByTarget;
713
714    /**
715     * The identified conditions and other health record elements that are intended to be addressed by the goal.
716     */
717    @Child(name = "addresses", type = {Condition.class, Observation.class, MedicationStatement.class, NutritionOrder.class, ProcedureRequest.class, RiskAssessment.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
718    @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." )
719    protected List<Reference> addresses;
720    /**
721     * The actual objects that are the target of the reference (The identified conditions and other health record elements that are intended to be addressed by the goal.)
722     */
723    protected List<Resource> addressesTarget;
724
725
726    /**
727     * Any comments related to the goal.
728     */
729    @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
730    @Description(shortDefinition="Comments about the goal", formalDefinition="Any comments related to the goal." )
731    protected List<Annotation> note;
732
733    /**
734     * Identifies the change (or lack of change) at the point when the status of the goal is assessed.
735     */
736    @Child(name = "outcomeCode", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
737    @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." )
738    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
739    protected List<CodeableConcept> outcomeCode;
740
741    /**
742     * Details of what's changed (or not changed).
743     */
744    @Child(name = "outcomeReference", type = {Observation.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
745    @Description(shortDefinition="Observation that resulted from goal", formalDefinition="Details of what's changed (or not changed)." )
746    protected List<Reference> outcomeReference;
747    /**
748     * The actual objects that are the target of the reference (Details of what's changed (or not changed).)
749     */
750    protected List<Observation> outcomeReferenceTarget;
751
752
753    private static final long serialVersionUID = -1045412647L;
754
755  /**
756   * Constructor
757   */
758    public Goal() {
759      super();
760    }
761
762  /**
763   * Constructor
764   */
765    public Goal(Enumeration<GoalStatus> status, CodeableConcept description) {
766      super();
767      this.status = status;
768      this.description = description;
769    }
770
771    /**
772     * @return {@link #identifier} (This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
773     */
774    public List<Identifier> getIdentifier() { 
775      if (this.identifier == null)
776        this.identifier = new ArrayList<Identifier>();
777      return this.identifier;
778    }
779
780    /**
781     * @return Returns a reference to <code>this</code> for easy method chaining
782     */
783    public Goal setIdentifier(List<Identifier> theIdentifier) { 
784      this.identifier = theIdentifier;
785      return this;
786    }
787
788    public boolean hasIdentifier() { 
789      if (this.identifier == null)
790        return false;
791      for (Identifier item : this.identifier)
792        if (!item.isEmpty())
793          return true;
794      return false;
795    }
796
797    public Identifier addIdentifier() { //3
798      Identifier t = new Identifier();
799      if (this.identifier == null)
800        this.identifier = new ArrayList<Identifier>();
801      this.identifier.add(t);
802      return t;
803    }
804
805    public Goal addIdentifier(Identifier t) { //3
806      if (t == null)
807        return this;
808      if (this.identifier == null)
809        this.identifier = new ArrayList<Identifier>();
810      this.identifier.add(t);
811      return this;
812    }
813
814    /**
815     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
816     */
817    public Identifier getIdentifierFirstRep() { 
818      if (getIdentifier().isEmpty()) {
819        addIdentifier();
820      }
821      return getIdentifier().get(0);
822    }
823
824    /**
825     * @return {@link #status} (Indicates whether the goal has been reached and is still considered relevant.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
826     */
827    public Enumeration<GoalStatus> getStatusElement() { 
828      if (this.status == null)
829        if (Configuration.errorOnAutoCreate())
830          throw new Error("Attempt to auto-create Goal.status");
831        else if (Configuration.doAutoCreate())
832          this.status = new Enumeration<GoalStatus>(new GoalStatusEnumFactory()); // bb
833      return this.status;
834    }
835
836    public boolean hasStatusElement() { 
837      return this.status != null && !this.status.isEmpty();
838    }
839
840    public boolean hasStatus() { 
841      return this.status != null && !this.status.isEmpty();
842    }
843
844    /**
845     * @param value {@link #status} (Indicates whether the goal has been reached and is still considered relevant.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
846     */
847    public Goal setStatusElement(Enumeration<GoalStatus> value) { 
848      this.status = value;
849      return this;
850    }
851
852    /**
853     * @return Indicates whether the goal has been reached and is still considered relevant.
854     */
855    public GoalStatus getStatus() { 
856      return this.status == null ? null : this.status.getValue();
857    }
858
859    /**
860     * @param value Indicates whether the goal has been reached and is still considered relevant.
861     */
862    public Goal setStatus(GoalStatus value) { 
863        if (this.status == null)
864          this.status = new Enumeration<GoalStatus>(new GoalStatusEnumFactory());
865        this.status.setValue(value);
866      return this;
867    }
868
869    /**
870     * @return {@link #category} (Indicates a category the goal falls within.)
871     */
872    public List<CodeableConcept> getCategory() { 
873      if (this.category == null)
874        this.category = new ArrayList<CodeableConcept>();
875      return this.category;
876    }
877
878    /**
879     * @return Returns a reference to <code>this</code> for easy method chaining
880     */
881    public Goal setCategory(List<CodeableConcept> theCategory) { 
882      this.category = theCategory;
883      return this;
884    }
885
886    public boolean hasCategory() { 
887      if (this.category == null)
888        return false;
889      for (CodeableConcept item : this.category)
890        if (!item.isEmpty())
891          return true;
892      return false;
893    }
894
895    public CodeableConcept addCategory() { //3
896      CodeableConcept t = new CodeableConcept();
897      if (this.category == null)
898        this.category = new ArrayList<CodeableConcept>();
899      this.category.add(t);
900      return t;
901    }
902
903    public Goal addCategory(CodeableConcept t) { //3
904      if (t == null)
905        return this;
906      if (this.category == null)
907        this.category = new ArrayList<CodeableConcept>();
908      this.category.add(t);
909      return this;
910    }
911
912    /**
913     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
914     */
915    public CodeableConcept getCategoryFirstRep() { 
916      if (getCategory().isEmpty()) {
917        addCategory();
918      }
919      return getCategory().get(0);
920    }
921
922    /**
923     * @return {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
924     */
925    public CodeableConcept getPriority() { 
926      if (this.priority == null)
927        if (Configuration.errorOnAutoCreate())
928          throw new Error("Attempt to auto-create Goal.priority");
929        else if (Configuration.doAutoCreate())
930          this.priority = new CodeableConcept(); // cc
931      return this.priority;
932    }
933
934    public boolean hasPriority() { 
935      return this.priority != null && !this.priority.isEmpty();
936    }
937
938    /**
939     * @param value {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
940     */
941    public Goal setPriority(CodeableConcept value) { 
942      this.priority = value;
943      return this;
944    }
945
946    /**
947     * @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".)
948     */
949    public CodeableConcept getDescription() { 
950      if (this.description == null)
951        if (Configuration.errorOnAutoCreate())
952          throw new Error("Attempt to auto-create Goal.description");
953        else if (Configuration.doAutoCreate())
954          this.description = new CodeableConcept(); // cc
955      return this.description;
956    }
957
958    public boolean hasDescription() { 
959      return this.description != null && !this.description.isEmpty();
960    }
961
962    /**
963     * @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".)
964     */
965    public Goal setDescription(CodeableConcept value) { 
966      this.description = value;
967      return this;
968    }
969
970    /**
971     * @return {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
972     */
973    public Reference getSubject() { 
974      if (this.subject == null)
975        if (Configuration.errorOnAutoCreate())
976          throw new Error("Attempt to auto-create Goal.subject");
977        else if (Configuration.doAutoCreate())
978          this.subject = new Reference(); // cc
979      return this.subject;
980    }
981
982    public boolean hasSubject() { 
983      return this.subject != null && !this.subject.isEmpty();
984    }
985
986    /**
987     * @param value {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
988     */
989    public Goal setSubject(Reference value) { 
990      this.subject = value;
991      return this;
992    }
993
994    /**
995     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient, group or organization for whom the goal is being established.)
996     */
997    public Resource getSubjectTarget() { 
998      return this.subjectTarget;
999    }
1000
1001    /**
1002     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient, group or organization for whom the goal is being established.)
1003     */
1004    public Goal setSubjectTarget(Resource value) { 
1005      this.subjectTarget = value;
1006      return this;
1007    }
1008
1009    /**
1010     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
1011     */
1012    public Type getStart() { 
1013      return this.start;
1014    }
1015
1016    /**
1017     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
1018     */
1019    public DateType getStartDateType() throws FHIRException { 
1020      if (!(this.start instanceof DateType))
1021        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.start.getClass().getName()+" was encountered");
1022      return (DateType) this.start;
1023    }
1024
1025    public boolean hasStartDateType() { 
1026      return this.start instanceof DateType;
1027    }
1028
1029    /**
1030     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
1031     */
1032    public CodeableConcept getStartCodeableConcept() throws FHIRException { 
1033      if (!(this.start instanceof CodeableConcept))
1034        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.start.getClass().getName()+" was encountered");
1035      return (CodeableConcept) this.start;
1036    }
1037
1038    public boolean hasStartCodeableConcept() { 
1039      return this.start instanceof CodeableConcept;
1040    }
1041
1042    public boolean hasStart() { 
1043      return this.start != null && !this.start.isEmpty();
1044    }
1045
1046    /**
1047     * @param value {@link #start} (The date or event after which the goal should begin being pursued.)
1048     */
1049    public Goal setStart(Type value) { 
1050      this.start = value;
1051      return this;
1052    }
1053
1054    /**
1055     * @return {@link #target} (Indicates what should be done by when.)
1056     */
1057    public GoalTargetComponent getTarget() { 
1058      if (this.target == null)
1059        if (Configuration.errorOnAutoCreate())
1060          throw new Error("Attempt to auto-create Goal.target");
1061        else if (Configuration.doAutoCreate())
1062          this.target = new GoalTargetComponent(); // cc
1063      return this.target;
1064    }
1065
1066    public boolean hasTarget() { 
1067      return this.target != null && !this.target.isEmpty();
1068    }
1069
1070    /**
1071     * @param value {@link #target} (Indicates what should be done by when.)
1072     */
1073    public Goal setTarget(GoalTargetComponent value) { 
1074      this.target = value;
1075      return this;
1076    }
1077
1078    /**
1079     * @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
1080     */
1081    public DateType getStatusDateElement() { 
1082      if (this.statusDate == null)
1083        if (Configuration.errorOnAutoCreate())
1084          throw new Error("Attempt to auto-create Goal.statusDate");
1085        else if (Configuration.doAutoCreate())
1086          this.statusDate = new DateType(); // bb
1087      return this.statusDate;
1088    }
1089
1090    public boolean hasStatusDateElement() { 
1091      return this.statusDate != null && !this.statusDate.isEmpty();
1092    }
1093
1094    public boolean hasStatusDate() { 
1095      return this.statusDate != null && !this.statusDate.isEmpty();
1096    }
1097
1098    /**
1099     * @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
1100     */
1101    public Goal setStatusDateElement(DateType value) { 
1102      this.statusDate = value;
1103      return this;
1104    }
1105
1106    /**
1107     * @return Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
1108     */
1109    public Date getStatusDate() { 
1110      return this.statusDate == null ? null : this.statusDate.getValue();
1111    }
1112
1113    /**
1114     * @param value Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
1115     */
1116    public Goal setStatusDate(Date value) { 
1117      if (value == null)
1118        this.statusDate = null;
1119      else {
1120        if (this.statusDate == null)
1121          this.statusDate = new DateType();
1122        this.statusDate.setValue(value);
1123      }
1124      return this;
1125    }
1126
1127    /**
1128     * @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
1129     */
1130    public StringType getStatusReasonElement() { 
1131      if (this.statusReason == null)
1132        if (Configuration.errorOnAutoCreate())
1133          throw new Error("Attempt to auto-create Goal.statusReason");
1134        else if (Configuration.doAutoCreate())
1135          this.statusReason = new StringType(); // bb
1136      return this.statusReason;
1137    }
1138
1139    public boolean hasStatusReasonElement() { 
1140      return this.statusReason != null && !this.statusReason.isEmpty();
1141    }
1142
1143    public boolean hasStatusReason() { 
1144      return this.statusReason != null && !this.statusReason.isEmpty();
1145    }
1146
1147    /**
1148     * @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
1149     */
1150    public Goal setStatusReasonElement(StringType value) { 
1151      this.statusReason = value;
1152      return this;
1153    }
1154
1155    /**
1156     * @return Captures the reason for the current status.
1157     */
1158    public String getStatusReason() { 
1159      return this.statusReason == null ? null : this.statusReason.getValue();
1160    }
1161
1162    /**
1163     * @param value Captures the reason for the current status.
1164     */
1165    public Goal setStatusReason(String value) { 
1166      if (Utilities.noString(value))
1167        this.statusReason = null;
1168      else {
1169        if (this.statusReason == null)
1170          this.statusReason = new StringType();
1171        this.statusReason.setValue(value);
1172      }
1173      return this;
1174    }
1175
1176    /**
1177     * @return {@link #expressedBy} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
1178     */
1179    public Reference getExpressedBy() { 
1180      if (this.expressedBy == null)
1181        if (Configuration.errorOnAutoCreate())
1182          throw new Error("Attempt to auto-create Goal.expressedBy");
1183        else if (Configuration.doAutoCreate())
1184          this.expressedBy = new Reference(); // cc
1185      return this.expressedBy;
1186    }
1187
1188    public boolean hasExpressedBy() { 
1189      return this.expressedBy != null && !this.expressedBy.isEmpty();
1190    }
1191
1192    /**
1193     * @param value {@link #expressedBy} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
1194     */
1195    public Goal setExpressedBy(Reference value) { 
1196      this.expressedBy = value;
1197      return this;
1198    }
1199
1200    /**
1201     * @return {@link #expressedBy} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates whose goal this is - patient goal, practitioner goal, etc.)
1202     */
1203    public Resource getExpressedByTarget() { 
1204      return this.expressedByTarget;
1205    }
1206
1207    /**
1208     * @param value {@link #expressedBy} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates whose goal this is - patient goal, practitioner goal, etc.)
1209     */
1210    public Goal setExpressedByTarget(Resource value) { 
1211      this.expressedByTarget = value;
1212      return this;
1213    }
1214
1215    /**
1216     * @return {@link #addresses} (The identified conditions and other health record elements that are intended to be addressed by the goal.)
1217     */
1218    public List<Reference> getAddresses() { 
1219      if (this.addresses == null)
1220        this.addresses = new ArrayList<Reference>();
1221      return this.addresses;
1222    }
1223
1224    /**
1225     * @return Returns a reference to <code>this</code> for easy method chaining
1226     */
1227    public Goal setAddresses(List<Reference> theAddresses) { 
1228      this.addresses = theAddresses;
1229      return this;
1230    }
1231
1232    public boolean hasAddresses() { 
1233      if (this.addresses == null)
1234        return false;
1235      for (Reference item : this.addresses)
1236        if (!item.isEmpty())
1237          return true;
1238      return false;
1239    }
1240
1241    public Reference addAddresses() { //3
1242      Reference t = new Reference();
1243      if (this.addresses == null)
1244        this.addresses = new ArrayList<Reference>();
1245      this.addresses.add(t);
1246      return t;
1247    }
1248
1249    public Goal addAddresses(Reference t) { //3
1250      if (t == null)
1251        return this;
1252      if (this.addresses == null)
1253        this.addresses = new ArrayList<Reference>();
1254      this.addresses.add(t);
1255      return this;
1256    }
1257
1258    /**
1259     * @return The first repetition of repeating field {@link #addresses}, creating it if it does not already exist
1260     */
1261    public Reference getAddressesFirstRep() { 
1262      if (getAddresses().isEmpty()) {
1263        addAddresses();
1264      }
1265      return getAddresses().get(0);
1266    }
1267
1268    /**
1269     * @deprecated Use Reference#setResource(IBaseResource) instead
1270     */
1271    @Deprecated
1272    public List<Resource> getAddressesTarget() { 
1273      if (this.addressesTarget == null)
1274        this.addressesTarget = new ArrayList<Resource>();
1275      return this.addressesTarget;
1276    }
1277
1278    /**
1279     * @return {@link #note} (Any comments related to the goal.)
1280     */
1281    public List<Annotation> getNote() { 
1282      if (this.note == null)
1283        this.note = new ArrayList<Annotation>();
1284      return this.note;
1285    }
1286
1287    /**
1288     * @return Returns a reference to <code>this</code> for easy method chaining
1289     */
1290    public Goal setNote(List<Annotation> theNote) { 
1291      this.note = theNote;
1292      return this;
1293    }
1294
1295    public boolean hasNote() { 
1296      if (this.note == null)
1297        return false;
1298      for (Annotation item : this.note)
1299        if (!item.isEmpty())
1300          return true;
1301      return false;
1302    }
1303
1304    public Annotation addNote() { //3
1305      Annotation t = new Annotation();
1306      if (this.note == null)
1307        this.note = new ArrayList<Annotation>();
1308      this.note.add(t);
1309      return t;
1310    }
1311
1312    public Goal addNote(Annotation t) { //3
1313      if (t == null)
1314        return this;
1315      if (this.note == null)
1316        this.note = new ArrayList<Annotation>();
1317      this.note.add(t);
1318      return this;
1319    }
1320
1321    /**
1322     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1323     */
1324    public Annotation getNoteFirstRep() { 
1325      if (getNote().isEmpty()) {
1326        addNote();
1327      }
1328      return getNote().get(0);
1329    }
1330
1331    /**
1332     * @return {@link #outcomeCode} (Identifies the change (or lack of change) at the point when the status of the goal is assessed.)
1333     */
1334    public List<CodeableConcept> getOutcomeCode() { 
1335      if (this.outcomeCode == null)
1336        this.outcomeCode = new ArrayList<CodeableConcept>();
1337      return this.outcomeCode;
1338    }
1339
1340    /**
1341     * @return Returns a reference to <code>this</code> for easy method chaining
1342     */
1343    public Goal setOutcomeCode(List<CodeableConcept> theOutcomeCode) { 
1344      this.outcomeCode = theOutcomeCode;
1345      return this;
1346    }
1347
1348    public boolean hasOutcomeCode() { 
1349      if (this.outcomeCode == null)
1350        return false;
1351      for (CodeableConcept item : this.outcomeCode)
1352        if (!item.isEmpty())
1353          return true;
1354      return false;
1355    }
1356
1357    public CodeableConcept addOutcomeCode() { //3
1358      CodeableConcept t = new CodeableConcept();
1359      if (this.outcomeCode == null)
1360        this.outcomeCode = new ArrayList<CodeableConcept>();
1361      this.outcomeCode.add(t);
1362      return t;
1363    }
1364
1365    public Goal addOutcomeCode(CodeableConcept t) { //3
1366      if (t == null)
1367        return this;
1368      if (this.outcomeCode == null)
1369        this.outcomeCode = new ArrayList<CodeableConcept>();
1370      this.outcomeCode.add(t);
1371      return this;
1372    }
1373
1374    /**
1375     * @return The first repetition of repeating field {@link #outcomeCode}, creating it if it does not already exist
1376     */
1377    public CodeableConcept getOutcomeCodeFirstRep() { 
1378      if (getOutcomeCode().isEmpty()) {
1379        addOutcomeCode();
1380      }
1381      return getOutcomeCode().get(0);
1382    }
1383
1384    /**
1385     * @return {@link #outcomeReference} (Details of what's changed (or not changed).)
1386     */
1387    public List<Reference> getOutcomeReference() { 
1388      if (this.outcomeReference == null)
1389        this.outcomeReference = new ArrayList<Reference>();
1390      return this.outcomeReference;
1391    }
1392
1393    /**
1394     * @return Returns a reference to <code>this</code> for easy method chaining
1395     */
1396    public Goal setOutcomeReference(List<Reference> theOutcomeReference) { 
1397      this.outcomeReference = theOutcomeReference;
1398      return this;
1399    }
1400
1401    public boolean hasOutcomeReference() { 
1402      if (this.outcomeReference == null)
1403        return false;
1404      for (Reference item : this.outcomeReference)
1405        if (!item.isEmpty())
1406          return true;
1407      return false;
1408    }
1409
1410    public Reference addOutcomeReference() { //3
1411      Reference t = new Reference();
1412      if (this.outcomeReference == null)
1413        this.outcomeReference = new ArrayList<Reference>();
1414      this.outcomeReference.add(t);
1415      return t;
1416    }
1417
1418    public Goal addOutcomeReference(Reference t) { //3
1419      if (t == null)
1420        return this;
1421      if (this.outcomeReference == null)
1422        this.outcomeReference = new ArrayList<Reference>();
1423      this.outcomeReference.add(t);
1424      return this;
1425    }
1426
1427    /**
1428     * @return The first repetition of repeating field {@link #outcomeReference}, creating it if it does not already exist
1429     */
1430    public Reference getOutcomeReferenceFirstRep() { 
1431      if (getOutcomeReference().isEmpty()) {
1432        addOutcomeReference();
1433      }
1434      return getOutcomeReference().get(0);
1435    }
1436
1437    /**
1438     * @deprecated Use Reference#setResource(IBaseResource) instead
1439     */
1440    @Deprecated
1441    public List<Observation> getOutcomeReferenceTarget() { 
1442      if (this.outcomeReferenceTarget == null)
1443        this.outcomeReferenceTarget = new ArrayList<Observation>();
1444      return this.outcomeReferenceTarget;
1445    }
1446
1447    /**
1448     * @deprecated Use Reference#setResource(IBaseResource) instead
1449     */
1450    @Deprecated
1451    public Observation addOutcomeReferenceTarget() { 
1452      Observation r = new Observation();
1453      if (this.outcomeReferenceTarget == null)
1454        this.outcomeReferenceTarget = new ArrayList<Observation>();
1455      this.outcomeReferenceTarget.add(r);
1456      return r;
1457    }
1458
1459      protected void listChildren(List<Property> childrenList) {
1460        super.listChildren(childrenList);
1461        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
1462        childrenList.add(new Property("status", "code", "Indicates whether the goal has been reached and is still considered relevant.", 0, java.lang.Integer.MAX_VALUE, status));
1463        childrenList.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, java.lang.Integer.MAX_VALUE, category));
1464        childrenList.add(new Property("priority", "CodeableConcept", "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, java.lang.Integer.MAX_VALUE, priority));
1465        childrenList.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, java.lang.Integer.MAX_VALUE, description));
1466        childrenList.add(new Property("subject", "Reference(Patient|Group|Organization)", "Identifies the patient, group or organization for whom the goal is being established.", 0, java.lang.Integer.MAX_VALUE, subject));
1467        childrenList.add(new Property("start[x]", "date|CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, java.lang.Integer.MAX_VALUE, start));
1468        childrenList.add(new Property("target", "", "Indicates what should be done by when.", 0, java.lang.Integer.MAX_VALUE, target));
1469        childrenList.add(new Property("statusDate", "date", "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, java.lang.Integer.MAX_VALUE, statusDate));
1470        childrenList.add(new Property("statusReason", "string", "Captures the reason for the current status.", 0, java.lang.Integer.MAX_VALUE, statusReason));
1471        childrenList.add(new Property("expressedBy", "Reference(Patient|Practitioner|RelatedPerson)", "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, java.lang.Integer.MAX_VALUE, expressedBy));
1472        childrenList.add(new Property("addresses", "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ProcedureRequest|RiskAssessment)", "The identified conditions and other health record elements that are intended to be addressed by the goal.", 0, java.lang.Integer.MAX_VALUE, addresses));
1473        childrenList.add(new Property("note", "Annotation", "Any comments related to the goal.", 0, java.lang.Integer.MAX_VALUE, note));
1474        childrenList.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));
1475        childrenList.add(new Property("outcomeReference", "Reference(Observation)", "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, outcomeReference));
1476      }
1477
1478      @Override
1479      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1480        switch (hash) {
1481        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1482        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<GoalStatus>
1483        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1484        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1485        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // CodeableConcept
1486        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1487        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // Type
1488        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // GoalTargetComponent
1489        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateType
1490        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // StringType
1491        case 175423686: /*expressedBy*/ return this.expressedBy == null ? new Base[0] : new Base[] {this.expressedBy}; // Reference
1492        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
1493        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1494        case 1062482015: /*outcomeCode*/ return this.outcomeCode == null ? new Base[0] : this.outcomeCode.toArray(new Base[this.outcomeCode.size()]); // CodeableConcept
1495        case -782273511: /*outcomeReference*/ return this.outcomeReference == null ? new Base[0] : this.outcomeReference.toArray(new Base[this.outcomeReference.size()]); // Reference
1496        default: return super.getProperty(hash, name, checkValid);
1497        }
1498
1499      }
1500
1501      @Override
1502      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1503        switch (hash) {
1504        case -1618432855: // identifier
1505          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1506          return value;
1507        case -892481550: // status
1508          value = new GoalStatusEnumFactory().fromType(castToCode(value));
1509          this.status = (Enumeration) value; // Enumeration<GoalStatus>
1510          return value;
1511        case 50511102: // category
1512          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
1513          return value;
1514        case -1165461084: // priority
1515          this.priority = castToCodeableConcept(value); // CodeableConcept
1516          return value;
1517        case -1724546052: // description
1518          this.description = castToCodeableConcept(value); // CodeableConcept
1519          return value;
1520        case -1867885268: // subject
1521          this.subject = castToReference(value); // Reference
1522          return value;
1523        case 109757538: // start
1524          this.start = castToType(value); // Type
1525          return value;
1526        case -880905839: // target
1527          this.target = (GoalTargetComponent) value; // GoalTargetComponent
1528          return value;
1529        case 247524032: // statusDate
1530          this.statusDate = castToDate(value); // DateType
1531          return value;
1532        case 2051346646: // statusReason
1533          this.statusReason = castToString(value); // StringType
1534          return value;
1535        case 175423686: // expressedBy
1536          this.expressedBy = castToReference(value); // Reference
1537          return value;
1538        case 874544034: // addresses
1539          this.getAddresses().add(castToReference(value)); // Reference
1540          return value;
1541        case 3387378: // note
1542          this.getNote().add(castToAnnotation(value)); // Annotation
1543          return value;
1544        case 1062482015: // outcomeCode
1545          this.getOutcomeCode().add(castToCodeableConcept(value)); // CodeableConcept
1546          return value;
1547        case -782273511: // outcomeReference
1548          this.getOutcomeReference().add(castToReference(value)); // Reference
1549          return value;
1550        default: return super.setProperty(hash, name, value);
1551        }
1552
1553      }
1554
1555      @Override
1556      public Base setProperty(String name, Base value) throws FHIRException {
1557        if (name.equals("identifier")) {
1558          this.getIdentifier().add(castToIdentifier(value));
1559        } else if (name.equals("status")) {
1560          value = new GoalStatusEnumFactory().fromType(castToCode(value));
1561          this.status = (Enumeration) value; // Enumeration<GoalStatus>
1562        } else if (name.equals("category")) {
1563          this.getCategory().add(castToCodeableConcept(value));
1564        } else if (name.equals("priority")) {
1565          this.priority = castToCodeableConcept(value); // CodeableConcept
1566        } else if (name.equals("description")) {
1567          this.description = castToCodeableConcept(value); // CodeableConcept
1568        } else if (name.equals("subject")) {
1569          this.subject = castToReference(value); // Reference
1570        } else if (name.equals("start[x]")) {
1571          this.start = castToType(value); // Type
1572        } else if (name.equals("target")) {
1573          this.target = (GoalTargetComponent) value; // GoalTargetComponent
1574        } else if (name.equals("statusDate")) {
1575          this.statusDate = castToDate(value); // DateType
1576        } else if (name.equals("statusReason")) {
1577          this.statusReason = castToString(value); // StringType
1578        } else if (name.equals("expressedBy")) {
1579          this.expressedBy = castToReference(value); // Reference
1580        } else if (name.equals("addresses")) {
1581          this.getAddresses().add(castToReference(value));
1582        } else if (name.equals("note")) {
1583          this.getNote().add(castToAnnotation(value));
1584        } else if (name.equals("outcomeCode")) {
1585          this.getOutcomeCode().add(castToCodeableConcept(value));
1586        } else if (name.equals("outcomeReference")) {
1587          this.getOutcomeReference().add(castToReference(value));
1588        } else
1589          return super.setProperty(name, value);
1590        return value;
1591      }
1592
1593      @Override
1594      public Base makeProperty(int hash, String name) throws FHIRException {
1595        switch (hash) {
1596        case -1618432855:  return addIdentifier(); 
1597        case -892481550:  return getStatusElement();
1598        case 50511102:  return addCategory(); 
1599        case -1165461084:  return getPriority(); 
1600        case -1724546052:  return getDescription(); 
1601        case -1867885268:  return getSubject(); 
1602        case 1316793566:  return getStart(); 
1603        case 109757538:  return getStart(); 
1604        case -880905839:  return getTarget(); 
1605        case 247524032:  return getStatusDateElement();
1606        case 2051346646:  return getStatusReasonElement();
1607        case 175423686:  return getExpressedBy(); 
1608        case 874544034:  return addAddresses(); 
1609        case 3387378:  return addNote(); 
1610        case 1062482015:  return addOutcomeCode(); 
1611        case -782273511:  return addOutcomeReference(); 
1612        default: return super.makeProperty(hash, name);
1613        }
1614
1615      }
1616
1617      @Override
1618      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1619        switch (hash) {
1620        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1621        case -892481550: /*status*/ return new String[] {"code"};
1622        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1623        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
1624        case -1724546052: /*description*/ return new String[] {"CodeableConcept"};
1625        case -1867885268: /*subject*/ return new String[] {"Reference"};
1626        case 109757538: /*start*/ return new String[] {"date", "CodeableConcept"};
1627        case -880905839: /*target*/ return new String[] {};
1628        case 247524032: /*statusDate*/ return new String[] {"date"};
1629        case 2051346646: /*statusReason*/ return new String[] {"string"};
1630        case 175423686: /*expressedBy*/ return new String[] {"Reference"};
1631        case 874544034: /*addresses*/ return new String[] {"Reference"};
1632        case 3387378: /*note*/ return new String[] {"Annotation"};
1633        case 1062482015: /*outcomeCode*/ return new String[] {"CodeableConcept"};
1634        case -782273511: /*outcomeReference*/ return new String[] {"Reference"};
1635        default: return super.getTypesForProperty(hash, name);
1636        }
1637
1638      }
1639
1640      @Override
1641      public Base addChild(String name) throws FHIRException {
1642        if (name.equals("identifier")) {
1643          return addIdentifier();
1644        }
1645        else if (name.equals("status")) {
1646          throw new FHIRException("Cannot call addChild on a primitive type Goal.status");
1647        }
1648        else if (name.equals("category")) {
1649          return addCategory();
1650        }
1651        else if (name.equals("priority")) {
1652          this.priority = new CodeableConcept();
1653          return this.priority;
1654        }
1655        else if (name.equals("description")) {
1656          this.description = new CodeableConcept();
1657          return this.description;
1658        }
1659        else if (name.equals("subject")) {
1660          this.subject = new Reference();
1661          return this.subject;
1662        }
1663        else if (name.equals("startDate")) {
1664          this.start = new DateType();
1665          return this.start;
1666        }
1667        else if (name.equals("startCodeableConcept")) {
1668          this.start = new CodeableConcept();
1669          return this.start;
1670        }
1671        else if (name.equals("target")) {
1672          this.target = new GoalTargetComponent();
1673          return this.target;
1674        }
1675        else if (name.equals("statusDate")) {
1676          throw new FHIRException("Cannot call addChild on a primitive type Goal.statusDate");
1677        }
1678        else if (name.equals("statusReason")) {
1679          throw new FHIRException("Cannot call addChild on a primitive type Goal.statusReason");
1680        }
1681        else if (name.equals("expressedBy")) {
1682          this.expressedBy = new Reference();
1683          return this.expressedBy;
1684        }
1685        else if (name.equals("addresses")) {
1686          return addAddresses();
1687        }
1688        else if (name.equals("note")) {
1689          return addNote();
1690        }
1691        else if (name.equals("outcomeCode")) {
1692          return addOutcomeCode();
1693        }
1694        else if (name.equals("outcomeReference")) {
1695          return addOutcomeReference();
1696        }
1697        else
1698          return super.addChild(name);
1699      }
1700
1701  public String fhirType() {
1702    return "Goal";
1703
1704  }
1705
1706      public Goal copy() {
1707        Goal dst = new Goal();
1708        copyValues(dst);
1709        if (identifier != null) {
1710          dst.identifier = new ArrayList<Identifier>();
1711          for (Identifier i : identifier)
1712            dst.identifier.add(i.copy());
1713        };
1714        dst.status = status == null ? null : status.copy();
1715        if (category != null) {
1716          dst.category = new ArrayList<CodeableConcept>();
1717          for (CodeableConcept i : category)
1718            dst.category.add(i.copy());
1719        };
1720        dst.priority = priority == null ? null : priority.copy();
1721        dst.description = description == null ? null : description.copy();
1722        dst.subject = subject == null ? null : subject.copy();
1723        dst.start = start == null ? null : start.copy();
1724        dst.target = target == null ? null : target.copy();
1725        dst.statusDate = statusDate == null ? null : statusDate.copy();
1726        dst.statusReason = statusReason == null ? null : statusReason.copy();
1727        dst.expressedBy = expressedBy == null ? null : expressedBy.copy();
1728        if (addresses != null) {
1729          dst.addresses = new ArrayList<Reference>();
1730          for (Reference i : addresses)
1731            dst.addresses.add(i.copy());
1732        };
1733        if (note != null) {
1734          dst.note = new ArrayList<Annotation>();
1735          for (Annotation i : note)
1736            dst.note.add(i.copy());
1737        };
1738        if (outcomeCode != null) {
1739          dst.outcomeCode = new ArrayList<CodeableConcept>();
1740          for (CodeableConcept i : outcomeCode)
1741            dst.outcomeCode.add(i.copy());
1742        };
1743        if (outcomeReference != null) {
1744          dst.outcomeReference = new ArrayList<Reference>();
1745          for (Reference i : outcomeReference)
1746            dst.outcomeReference.add(i.copy());
1747        };
1748        return dst;
1749      }
1750
1751      protected Goal typedCopy() {
1752        return copy();
1753      }
1754
1755      @Override
1756      public boolean equalsDeep(Base other) {
1757        if (!super.equalsDeep(other))
1758          return false;
1759        if (!(other instanceof Goal))
1760          return false;
1761        Goal o = (Goal) other;
1762        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
1763           && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true) && compareDeep(subject, o.subject, true)
1764           && compareDeep(start, o.start, true) && compareDeep(target, o.target, true) && compareDeep(statusDate, o.statusDate, true)
1765           && compareDeep(statusReason, o.statusReason, true) && compareDeep(expressedBy, o.expressedBy, true)
1766           && compareDeep(addresses, o.addresses, true) && compareDeep(note, o.note, true) && compareDeep(outcomeCode, o.outcomeCode, true)
1767           && compareDeep(outcomeReference, o.outcomeReference, true);
1768      }
1769
1770      @Override
1771      public boolean equalsShallow(Base other) {
1772        if (!super.equalsShallow(other))
1773          return false;
1774        if (!(other instanceof Goal))
1775          return false;
1776        Goal o = (Goal) other;
1777        return compareValues(status, o.status, true) && compareValues(statusDate, o.statusDate, true) && compareValues(statusReason, o.statusReason, true)
1778          ;
1779      }
1780
1781      public boolean isEmpty() {
1782        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
1783          , priority, description, subject, start, target, statusDate, statusReason, expressedBy
1784          , addresses, note, outcomeCode, outcomeReference);
1785      }
1786
1787  @Override
1788  public ResourceType getResourceType() {
1789    return ResourceType.Goal;
1790   }
1791
1792 /**
1793   * Search parameter: <b>identifier</b>
1794   * <p>
1795   * Description: <b>External Ids for this goal</b><br>
1796   * Type: <b>token</b><br>
1797   * Path: <b>Goal.identifier</b><br>
1798   * </p>
1799   */
1800  @SearchParamDefinition(name="identifier", path="Goal.identifier", description="External Ids for this goal", type="token" )
1801  public static final String SP_IDENTIFIER = "identifier";
1802 /**
1803   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1804   * <p>
1805   * Description: <b>External Ids for this goal</b><br>
1806   * Type: <b>token</b><br>
1807   * Path: <b>Goal.identifier</b><br>
1808   * </p>
1809   */
1810  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1811
1812 /**
1813   * Search parameter: <b>patient</b>
1814   * <p>
1815   * Description: <b>Who this goal is intended for</b><br>
1816   * Type: <b>reference</b><br>
1817   * Path: <b>Goal.subject</b><br>
1818   * </p>
1819   */
1820  @SearchParamDefinition(name="patient", path="Goal.subject", description="Who this goal is intended for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1821  public static final String SP_PATIENT = "patient";
1822 /**
1823   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1824   * <p>
1825   * Description: <b>Who this goal is intended for</b><br>
1826   * Type: <b>reference</b><br>
1827   * Path: <b>Goal.subject</b><br>
1828   * </p>
1829   */
1830  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1831
1832/**
1833   * Constant for fluent queries to be used to add include statements. Specifies
1834   * the path value of "<b>Goal:patient</b>".
1835   */
1836  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Goal:patient").toLocked();
1837
1838 /**
1839   * Search parameter: <b>subject</b>
1840   * <p>
1841   * Description: <b>Who this goal is intended for</b><br>
1842   * Type: <b>reference</b><br>
1843   * Path: <b>Goal.subject</b><br>
1844   * </p>
1845   */
1846  @SearchParamDefinition(name="subject", path="Goal.subject", description="Who this goal is intended for", type="reference", target={Group.class, Organization.class, Patient.class } )
1847  public static final String SP_SUBJECT = "subject";
1848 /**
1849   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1850   * <p>
1851   * Description: <b>Who this goal is intended for</b><br>
1852   * Type: <b>reference</b><br>
1853   * Path: <b>Goal.subject</b><br>
1854   * </p>
1855   */
1856  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1857
1858/**
1859   * Constant for fluent queries to be used to add include statements. Specifies
1860   * the path value of "<b>Goal:subject</b>".
1861   */
1862  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Goal:subject").toLocked();
1863
1864 /**
1865   * Search parameter: <b>start-date</b>
1866   * <p>
1867   * Description: <b>When goal pursuit begins</b><br>
1868   * Type: <b>date</b><br>
1869   * Path: <b>Goal.startDate</b><br>
1870   * </p>
1871   */
1872  @SearchParamDefinition(name="start-date", path="Goal.start.as(Date)", description="When goal pursuit begins", type="date" )
1873  public static final String SP_START_DATE = "start-date";
1874 /**
1875   * <b>Fluent Client</b> search parameter constant for <b>start-date</b>
1876   * <p>
1877   * Description: <b>When goal pursuit begins</b><br>
1878   * Type: <b>date</b><br>
1879   * Path: <b>Goal.startDate</b><br>
1880   * </p>
1881   */
1882  public static final ca.uhn.fhir.rest.gclient.DateClientParam START_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_START_DATE);
1883
1884 /**
1885   * Search parameter: <b>category</b>
1886   * <p>
1887   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1888   * Type: <b>token</b><br>
1889   * Path: <b>Goal.category</b><br>
1890   * </p>
1891   */
1892  @SearchParamDefinition(name="category", path="Goal.category", description="E.g. Treatment, dietary, behavioral, etc.", type="token" )
1893  public static final String SP_CATEGORY = "category";
1894 /**
1895   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1896   * <p>
1897   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1898   * Type: <b>token</b><br>
1899   * Path: <b>Goal.category</b><br>
1900   * </p>
1901   */
1902  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1903
1904 /**
1905   * Search parameter: <b>target-date</b>
1906   * <p>
1907   * Description: <b>Reach goal on or before</b><br>
1908   * Type: <b>date</b><br>
1909   * Path: <b>Goal.target.dueDate</b><br>
1910   * </p>
1911   */
1912  @SearchParamDefinition(name="target-date", path="Goal.target.due.as(Date)", description="Reach goal on or before", type="date" )
1913  public static final String SP_TARGET_DATE = "target-date";
1914 /**
1915   * <b>Fluent Client</b> search parameter constant for <b>target-date</b>
1916   * <p>
1917   * Description: <b>Reach goal on or before</b><br>
1918   * Type: <b>date</b><br>
1919   * Path: <b>Goal.target.dueDate</b><br>
1920   * </p>
1921   */
1922  public static final ca.uhn.fhir.rest.gclient.DateClientParam TARGET_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_TARGET_DATE);
1923
1924 /**
1925   * Search parameter: <b>status</b>
1926   * <p>
1927   * Description: <b>proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected</b><br>
1928   * Type: <b>token</b><br>
1929   * Path: <b>Goal.status</b><br>
1930   * </p>
1931   */
1932  @SearchParamDefinition(name="status", path="Goal.status", description="proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected", type="token" )
1933  public static final String SP_STATUS = "status";
1934 /**
1935   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1936   * <p>
1937   * Description: <b>proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected</b><br>
1938   * Type: <b>token</b><br>
1939   * Path: <b>Goal.status</b><br>
1940   * </p>
1941   */
1942  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1943
1944
1945}
1946