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