001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient.
050 */
051@ResourceDef(name="CareTeam", profile="http://hl7.org/fhir/Profile/CareTeam")
052public class CareTeam extends DomainResource {
053
054    @Block()
055    public static class CareTeamParticipantComponent extends BackboneElement implements IBaseBackboneElement {
056        /**
057         * Indicates specific responsibility of an individual within the care team, such as "Primary physician", "Team coordinator", "Caregiver", etc.
058         */
059        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
060        @Description(shortDefinition="Type of involvement", formalDefinition="Indicates specific responsibility of an individual within the care team, such as \"Primary physician\", \"Team coordinator\", \"Caregiver\", etc." )
061        protected CodeableConcept role;
062
063        /**
064         * The specific person or organization who is participating/expected to participate in the care team.
065         */
066        @Child(name = "member", type = {Practitioner.class, RelatedPerson.class, Patient.class, Organization.class}, order=2, min=0, max=1, modifier=false, summary=true)
067        @Description(shortDefinition="Who is involved", formalDefinition="The specific person or organization who is participating/expected to participate in the care team." )
068        protected Reference member;
069
070        /**
071         * The actual object that is the target of the reference (The specific person or organization who is participating/expected to participate in the care team.)
072         */
073        protected Resource memberTarget;
074
075        /**
076         * Indicates when the specific member or organization did (or is intended to) come into effect and end.
077         */
078        @Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
079        @Description(shortDefinition="Time period of participant", formalDefinition="Indicates when the specific member or organization did (or is intended to) come into effect and end." )
080        protected Period period;
081
082        private static final long serialVersionUID = -1416929603L;
083
084    /**
085     * Constructor
086     */
087      public CareTeamParticipantComponent() {
088        super();
089      }
090
091        /**
092         * @return {@link #role} (Indicates specific responsibility of an individual within the care team, such as "Primary physician", "Team coordinator", "Caregiver", etc.)
093         */
094        public CodeableConcept getRole() { 
095          if (this.role == null)
096            if (Configuration.errorOnAutoCreate())
097              throw new Error("Attempt to auto-create CareTeamParticipantComponent.role");
098            else if (Configuration.doAutoCreate())
099              this.role = new CodeableConcept(); // cc
100          return this.role;
101        }
102
103        public boolean hasRole() { 
104          return this.role != null && !this.role.isEmpty();
105        }
106
107        /**
108         * @param value {@link #role} (Indicates specific responsibility of an individual within the care team, such as "Primary physician", "Team coordinator", "Caregiver", etc.)
109         */
110        public CareTeamParticipantComponent setRole(CodeableConcept value) { 
111          this.role = value;
112          return this;
113        }
114
115        /**
116         * @return {@link #member} (The specific person or organization who is participating/expected to participate in the care team.)
117         */
118        public Reference getMember() { 
119          if (this.member == null)
120            if (Configuration.errorOnAutoCreate())
121              throw new Error("Attempt to auto-create CareTeamParticipantComponent.member");
122            else if (Configuration.doAutoCreate())
123              this.member = new Reference(); // cc
124          return this.member;
125        }
126
127        public boolean hasMember() { 
128          return this.member != null && !this.member.isEmpty();
129        }
130
131        /**
132         * @param value {@link #member} (The specific person or organization who is participating/expected to participate in the care team.)
133         */
134        public CareTeamParticipantComponent setMember(Reference value) { 
135          this.member = value;
136          return this;
137        }
138
139        /**
140         * @return {@link #member} 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. (The specific person or organization who is participating/expected to participate in the care team.)
141         */
142        public Resource getMemberTarget() { 
143          return this.memberTarget;
144        }
145
146        /**
147         * @param value {@link #member} 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. (The specific person or organization who is participating/expected to participate in the care team.)
148         */
149        public CareTeamParticipantComponent setMemberTarget(Resource value) { 
150          this.memberTarget = value;
151          return this;
152        }
153
154        /**
155         * @return {@link #period} (Indicates when the specific member or organization did (or is intended to) come into effect and end.)
156         */
157        public Period getPeriod() { 
158          if (this.period == null)
159            if (Configuration.errorOnAutoCreate())
160              throw new Error("Attempt to auto-create CareTeamParticipantComponent.period");
161            else if (Configuration.doAutoCreate())
162              this.period = new Period(); // cc
163          return this.period;
164        }
165
166        public boolean hasPeriod() { 
167          return this.period != null && !this.period.isEmpty();
168        }
169
170        /**
171         * @param value {@link #period} (Indicates when the specific member or organization did (or is intended to) come into effect and end.)
172         */
173        public CareTeamParticipantComponent setPeriod(Period value) { 
174          this.period = value;
175          return this;
176        }
177
178        protected void listChildren(List<Property> childrenList) {
179          super.listChildren(childrenList);
180          childrenList.add(new Property("role", "CodeableConcept", "Indicates specific responsibility of an individual within the care team, such as \"Primary physician\", \"Team coordinator\", \"Caregiver\", etc.", 0, java.lang.Integer.MAX_VALUE, role));
181          childrenList.add(new Property("member", "Reference(Practitioner|RelatedPerson|Patient|Organization)", "The specific person or organization who is participating/expected to participate in the care team.", 0, java.lang.Integer.MAX_VALUE, member));
182          childrenList.add(new Property("period", "Period", "Indicates when the specific member or organization did (or is intended to) come into effect and end.", 0, java.lang.Integer.MAX_VALUE, period));
183        }
184
185      @Override
186      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
187        switch (hash) {
188        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
189        case -1077769574: /*member*/ return this.member == null ? new Base[0] : new Base[] {this.member}; // Reference
190        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
191        default: return super.getProperty(hash, name, checkValid);
192        }
193
194      }
195
196      @Override
197      public void setProperty(int hash, String name, Base value) throws FHIRException {
198        switch (hash) {
199        case 3506294: // role
200          this.role = castToCodeableConcept(value); // CodeableConcept
201          break;
202        case -1077769574: // member
203          this.member = castToReference(value); // Reference
204          break;
205        case -991726143: // period
206          this.period = castToPeriod(value); // Period
207          break;
208        default: super.setProperty(hash, name, value);
209        }
210
211      }
212
213      @Override
214      public void setProperty(String name, Base value) throws FHIRException {
215        if (name.equals("role"))
216          this.role = castToCodeableConcept(value); // CodeableConcept
217        else if (name.equals("member"))
218          this.member = castToReference(value); // Reference
219        else if (name.equals("period"))
220          this.period = castToPeriod(value); // Period
221        else
222          super.setProperty(name, value);
223      }
224
225      @Override
226      public Base makeProperty(int hash, String name) throws FHIRException {
227        switch (hash) {
228        case 3506294:  return getRole(); // CodeableConcept
229        case -1077769574:  return getMember(); // Reference
230        case -991726143:  return getPeriod(); // Period
231        default: return super.makeProperty(hash, name);
232        }
233
234      }
235
236      @Override
237      public Base addChild(String name) throws FHIRException {
238        if (name.equals("role")) {
239          this.role = new CodeableConcept();
240          return this.role;
241        }
242        else if (name.equals("member")) {
243          this.member = new Reference();
244          return this.member;
245        }
246        else if (name.equals("period")) {
247          this.period = new Period();
248          return this.period;
249        }
250        else
251          return super.addChild(name);
252      }
253
254      public CareTeamParticipantComponent copy() {
255        CareTeamParticipantComponent dst = new CareTeamParticipantComponent();
256        copyValues(dst);
257        dst.role = role == null ? null : role.copy();
258        dst.member = member == null ? null : member.copy();
259        dst.period = period == null ? null : period.copy();
260        return dst;
261      }
262
263      @Override
264      public boolean equalsDeep(Base other) {
265        if (!super.equalsDeep(other))
266          return false;
267        if (!(other instanceof CareTeamParticipantComponent))
268          return false;
269        CareTeamParticipantComponent o = (CareTeamParticipantComponent) other;
270        return compareDeep(role, o.role, true) && compareDeep(member, o.member, true) && compareDeep(period, o.period, true)
271          ;
272      }
273
274      @Override
275      public boolean equalsShallow(Base other) {
276        if (!super.equalsShallow(other))
277          return false;
278        if (!(other instanceof CareTeamParticipantComponent))
279          return false;
280        CareTeamParticipantComponent o = (CareTeamParticipantComponent) other;
281        return true;
282      }
283
284      public boolean isEmpty() {
285        return super.isEmpty() && (role == null || role.isEmpty()) && (member == null || member.isEmpty())
286           && (period == null || period.isEmpty());
287      }
288
289  public String fhirType() {
290    return "CareTeam.participant";
291
292  }
293
294  }
295
296    /**
297     * This records identifiers associated with this care team 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.
298     */
299    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
300    @Description(shortDefinition="External Ids for this team", formalDefinition="This records identifiers associated with this care team 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." )
301    protected List<Identifier> identifier;
302
303    /**
304     * Indicates whether the care team is currently active, suspended, inactive, or entered in error.
305     */
306    @Child(name = "status", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=true, summary=true)
307    @Description(shortDefinition="active | suspended | inactive | entered in error", formalDefinition="Indicates whether the care team is currently active, suspended, inactive, or entered in error." )
308    protected CodeableConcept status;
309
310    /**
311     * Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.
312     */
313    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
314    @Description(shortDefinition="Type of team", formalDefinition="Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team." )
315    protected List<CodeableConcept> type;
316
317    /**
318     * Name of the care team.
319     */
320    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
321    @Description(shortDefinition="Name of the team, such as crisis assessment team", formalDefinition="Name of the care team." )
322    protected StringType name;
323
324    /**
325     * Identifies the patient or group whose intended care is handled by the team.
326     */
327    @Child(name = "subject", type = {Patient.class, Group.class}, order=4, min=0, max=1, modifier=false, summary=true)
328    @Description(shortDefinition="Who care team is for", formalDefinition="Identifies the patient or group whose intended care is handled by the team." )
329    protected Reference subject;
330
331    /**
332     * The actual object that is the target of the reference (Identifies the patient or group whose intended care is handled by the team.)
333     */
334    protected Resource subjectTarget;
335
336    /**
337     * Indicates when the team did (or is intended to) come into effect and end.
338     */
339    @Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
340    @Description(shortDefinition="Time period team covers", formalDefinition="Indicates when the team did (or is intended to) come into effect and end." )
341    protected Period period;
342
343    /**
344     * Identifies all people and organizations who are expected to be involved in the care team.
345     */
346    @Child(name = "participant", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
347    @Description(shortDefinition="Members of the team", formalDefinition="Identifies all people and organizations who are expected to be involved in the care team." )
348    protected List<CareTeamParticipantComponent> participant;
349
350    /**
351     * The organization responsible for the care team.
352     */
353    @Child(name = "managingOrganization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
354    @Description(shortDefinition="Organization responsible for the care team", formalDefinition="The organization responsible for the care team." )
355    protected Reference managingOrganization;
356
357    /**
358     * The actual object that is the target of the reference (The organization responsible for the care team.)
359     */
360    protected Organization managingOrganizationTarget;
361
362    private static final long serialVersionUID = -917605050L;
363
364  /**
365   * Constructor
366   */
367    public CareTeam() {
368      super();
369    }
370
371    /**
372     * @return {@link #identifier} (This records identifiers associated with this care team 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.)
373     */
374    public List<Identifier> getIdentifier() { 
375      if (this.identifier == null)
376        this.identifier = new ArrayList<Identifier>();
377      return this.identifier;
378    }
379
380    public boolean hasIdentifier() { 
381      if (this.identifier == null)
382        return false;
383      for (Identifier item : this.identifier)
384        if (!item.isEmpty())
385          return true;
386      return false;
387    }
388
389    /**
390     * @return {@link #identifier} (This records identifiers associated with this care team 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.)
391     */
392    // syntactic sugar
393    public Identifier addIdentifier() { //3
394      Identifier t = new Identifier();
395      if (this.identifier == null)
396        this.identifier = new ArrayList<Identifier>();
397      this.identifier.add(t);
398      return t;
399    }
400
401    // syntactic sugar
402    public CareTeam addIdentifier(Identifier t) { //3
403      if (t == null)
404        return this;
405      if (this.identifier == null)
406        this.identifier = new ArrayList<Identifier>();
407      this.identifier.add(t);
408      return this;
409    }
410
411    /**
412     * @return {@link #status} (Indicates whether the care team is currently active, suspended, inactive, or entered in error.)
413     */
414    public CodeableConcept getStatus() { 
415      if (this.status == null)
416        if (Configuration.errorOnAutoCreate())
417          throw new Error("Attempt to auto-create CareTeam.status");
418        else if (Configuration.doAutoCreate())
419          this.status = new CodeableConcept(); // cc
420      return this.status;
421    }
422
423    public boolean hasStatus() { 
424      return this.status != null && !this.status.isEmpty();
425    }
426
427    /**
428     * @param value {@link #status} (Indicates whether the care team is currently active, suspended, inactive, or entered in error.)
429     */
430    public CareTeam setStatus(CodeableConcept value) { 
431      this.status = value;
432      return this;
433    }
434
435    /**
436     * @return {@link #type} (Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.)
437     */
438    public List<CodeableConcept> getType() { 
439      if (this.type == null)
440        this.type = new ArrayList<CodeableConcept>();
441      return this.type;
442    }
443
444    public boolean hasType() { 
445      if (this.type == null)
446        return false;
447      for (CodeableConcept item : this.type)
448        if (!item.isEmpty())
449          return true;
450      return false;
451    }
452
453    /**
454     * @return {@link #type} (Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.)
455     */
456    // syntactic sugar
457    public CodeableConcept addType() { //3
458      CodeableConcept t = new CodeableConcept();
459      if (this.type == null)
460        this.type = new ArrayList<CodeableConcept>();
461      this.type.add(t);
462      return t;
463    }
464
465    // syntactic sugar
466    public CareTeam addType(CodeableConcept t) { //3
467      if (t == null)
468        return this;
469      if (this.type == null)
470        this.type = new ArrayList<CodeableConcept>();
471      this.type.add(t);
472      return this;
473    }
474
475    /**
476     * @return {@link #name} (Name of the care team.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
477     */
478    public StringType getNameElement() { 
479      if (this.name == null)
480        if (Configuration.errorOnAutoCreate())
481          throw new Error("Attempt to auto-create CareTeam.name");
482        else if (Configuration.doAutoCreate())
483          this.name = new StringType(); // bb
484      return this.name;
485    }
486
487    public boolean hasNameElement() { 
488      return this.name != null && !this.name.isEmpty();
489    }
490
491    public boolean hasName() { 
492      return this.name != null && !this.name.isEmpty();
493    }
494
495    /**
496     * @param value {@link #name} (Name of the care team.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
497     */
498    public CareTeam setNameElement(StringType value) { 
499      this.name = value;
500      return this;
501    }
502
503    /**
504     * @return Name of the care team.
505     */
506    public String getName() { 
507      return this.name == null ? null : this.name.getValue();
508    }
509
510    /**
511     * @param value Name of the care team.
512     */
513    public CareTeam setName(String value) { 
514      if (Utilities.noString(value))
515        this.name = null;
516      else {
517        if (this.name == null)
518          this.name = new StringType();
519        this.name.setValue(value);
520      }
521      return this;
522    }
523
524    /**
525     * @return {@link #subject} (Identifies the patient or group whose intended care is handled by the team.)
526     */
527    public Reference getSubject() { 
528      if (this.subject == null)
529        if (Configuration.errorOnAutoCreate())
530          throw new Error("Attempt to auto-create CareTeam.subject");
531        else if (Configuration.doAutoCreate())
532          this.subject = new Reference(); // cc
533      return this.subject;
534    }
535
536    public boolean hasSubject() { 
537      return this.subject != null && !this.subject.isEmpty();
538    }
539
540    /**
541     * @param value {@link #subject} (Identifies the patient or group whose intended care is handled by the team.)
542     */
543    public CareTeam setSubject(Reference value) { 
544      this.subject = value;
545      return this;
546    }
547
548    /**
549     * @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 or group whose intended care is handled by the team.)
550     */
551    public Resource getSubjectTarget() { 
552      return this.subjectTarget;
553    }
554
555    /**
556     * @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 or group whose intended care is handled by the team.)
557     */
558    public CareTeam setSubjectTarget(Resource value) { 
559      this.subjectTarget = value;
560      return this;
561    }
562
563    /**
564     * @return {@link #period} (Indicates when the team did (or is intended to) come into effect and end.)
565     */
566    public Period getPeriod() { 
567      if (this.period == null)
568        if (Configuration.errorOnAutoCreate())
569          throw new Error("Attempt to auto-create CareTeam.period");
570        else if (Configuration.doAutoCreate())
571          this.period = new Period(); // cc
572      return this.period;
573    }
574
575    public boolean hasPeriod() { 
576      return this.period != null && !this.period.isEmpty();
577    }
578
579    /**
580     * @param value {@link #period} (Indicates when the team did (or is intended to) come into effect and end.)
581     */
582    public CareTeam setPeriod(Period value) { 
583      this.period = value;
584      return this;
585    }
586
587    /**
588     * @return {@link #participant} (Identifies all people and organizations who are expected to be involved in the care team.)
589     */
590    public List<CareTeamParticipantComponent> getParticipant() { 
591      if (this.participant == null)
592        this.participant = new ArrayList<CareTeamParticipantComponent>();
593      return this.participant;
594    }
595
596    public boolean hasParticipant() { 
597      if (this.participant == null)
598        return false;
599      for (CareTeamParticipantComponent item : this.participant)
600        if (!item.isEmpty())
601          return true;
602      return false;
603    }
604
605    /**
606     * @return {@link #participant} (Identifies all people and organizations who are expected to be involved in the care team.)
607     */
608    // syntactic sugar
609    public CareTeamParticipantComponent addParticipant() { //3
610      CareTeamParticipantComponent t = new CareTeamParticipantComponent();
611      if (this.participant == null)
612        this.participant = new ArrayList<CareTeamParticipantComponent>();
613      this.participant.add(t);
614      return t;
615    }
616
617    // syntactic sugar
618    public CareTeam addParticipant(CareTeamParticipantComponent t) { //3
619      if (t == null)
620        return this;
621      if (this.participant == null)
622        this.participant = new ArrayList<CareTeamParticipantComponent>();
623      this.participant.add(t);
624      return this;
625    }
626
627    /**
628     * @return {@link #managingOrganization} (The organization responsible for the care team.)
629     */
630    public Reference getManagingOrganization() { 
631      if (this.managingOrganization == null)
632        if (Configuration.errorOnAutoCreate())
633          throw new Error("Attempt to auto-create CareTeam.managingOrganization");
634        else if (Configuration.doAutoCreate())
635          this.managingOrganization = new Reference(); // cc
636      return this.managingOrganization;
637    }
638
639    public boolean hasManagingOrganization() { 
640      return this.managingOrganization != null && !this.managingOrganization.isEmpty();
641    }
642
643    /**
644     * @param value {@link #managingOrganization} (The organization responsible for the care team.)
645     */
646    public CareTeam setManagingOrganization(Reference value) { 
647      this.managingOrganization = value;
648      return this;
649    }
650
651    /**
652     * @return {@link #managingOrganization} 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. (The organization responsible for the care team.)
653     */
654    public Organization getManagingOrganizationTarget() { 
655      if (this.managingOrganizationTarget == null)
656        if (Configuration.errorOnAutoCreate())
657          throw new Error("Attempt to auto-create CareTeam.managingOrganization");
658        else if (Configuration.doAutoCreate())
659          this.managingOrganizationTarget = new Organization(); // aa
660      return this.managingOrganizationTarget;
661    }
662
663    /**
664     * @param value {@link #managingOrganization} 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. (The organization responsible for the care team.)
665     */
666    public CareTeam setManagingOrganizationTarget(Organization value) { 
667      this.managingOrganizationTarget = value;
668      return this;
669    }
670
671      protected void listChildren(List<Property> childrenList) {
672        super.listChildren(childrenList);
673        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this care team 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.", 0, java.lang.Integer.MAX_VALUE, identifier));
674        childrenList.add(new Property("status", "CodeableConcept", "Indicates whether the care team is currently active, suspended, inactive, or entered in error.", 0, java.lang.Integer.MAX_VALUE, status));
675        childrenList.add(new Property("type", "CodeableConcept", "Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.", 0, java.lang.Integer.MAX_VALUE, type));
676        childrenList.add(new Property("name", "string", "Name of the care team.", 0, java.lang.Integer.MAX_VALUE, name));
677        childrenList.add(new Property("subject", "Reference(Patient|Group)", "Identifies the patient or group whose intended care is handled by the team.", 0, java.lang.Integer.MAX_VALUE, subject));
678        childrenList.add(new Property("period", "Period", "Indicates when the team did (or is intended to) come into effect and end.", 0, java.lang.Integer.MAX_VALUE, period));
679        childrenList.add(new Property("participant", "", "Identifies all people and organizations who are expected to be involved in the care team.", 0, java.lang.Integer.MAX_VALUE, participant));
680        childrenList.add(new Property("managingOrganization", "Reference(Organization)", "The organization responsible for the care team.", 0, java.lang.Integer.MAX_VALUE, managingOrganization));
681      }
682
683      @Override
684      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
685        switch (hash) {
686        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
687        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
688        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
689        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
690        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
691        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
692        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // CareTeamParticipantComponent
693        case -2058947787: /*managingOrganization*/ return this.managingOrganization == null ? new Base[0] : new Base[] {this.managingOrganization}; // Reference
694        default: return super.getProperty(hash, name, checkValid);
695        }
696
697      }
698
699      @Override
700      public void setProperty(int hash, String name, Base value) throws FHIRException {
701        switch (hash) {
702        case -1618432855: // identifier
703          this.getIdentifier().add(castToIdentifier(value)); // Identifier
704          break;
705        case -892481550: // status
706          this.status = castToCodeableConcept(value); // CodeableConcept
707          break;
708        case 3575610: // type
709          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
710          break;
711        case 3373707: // name
712          this.name = castToString(value); // StringType
713          break;
714        case -1867885268: // subject
715          this.subject = castToReference(value); // Reference
716          break;
717        case -991726143: // period
718          this.period = castToPeriod(value); // Period
719          break;
720        case 767422259: // participant
721          this.getParticipant().add((CareTeamParticipantComponent) value); // CareTeamParticipantComponent
722          break;
723        case -2058947787: // managingOrganization
724          this.managingOrganization = castToReference(value); // Reference
725          break;
726        default: super.setProperty(hash, name, value);
727        }
728
729      }
730
731      @Override
732      public void setProperty(String name, Base value) throws FHIRException {
733        if (name.equals("identifier"))
734          this.getIdentifier().add(castToIdentifier(value));
735        else if (name.equals("status"))
736          this.status = castToCodeableConcept(value); // CodeableConcept
737        else if (name.equals("type"))
738          this.getType().add(castToCodeableConcept(value));
739        else if (name.equals("name"))
740          this.name = castToString(value); // StringType
741        else if (name.equals("subject"))
742          this.subject = castToReference(value); // Reference
743        else if (name.equals("period"))
744          this.period = castToPeriod(value); // Period
745        else if (name.equals("participant"))
746          this.getParticipant().add((CareTeamParticipantComponent) value);
747        else if (name.equals("managingOrganization"))
748          this.managingOrganization = castToReference(value); // Reference
749        else
750          super.setProperty(name, value);
751      }
752
753      @Override
754      public Base makeProperty(int hash, String name) throws FHIRException {
755        switch (hash) {
756        case -1618432855:  return addIdentifier(); // Identifier
757        case -892481550:  return getStatus(); // CodeableConcept
758        case 3575610:  return addType(); // CodeableConcept
759        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
760        case -1867885268:  return getSubject(); // Reference
761        case -991726143:  return getPeriod(); // Period
762        case 767422259:  return addParticipant(); // CareTeamParticipantComponent
763        case -2058947787:  return getManagingOrganization(); // Reference
764        default: return super.makeProperty(hash, name);
765        }
766
767      }
768
769      @Override
770      public Base addChild(String name) throws FHIRException {
771        if (name.equals("identifier")) {
772          return addIdentifier();
773        }
774        else if (name.equals("status")) {
775          this.status = new CodeableConcept();
776          return this.status;
777        }
778        else if (name.equals("type")) {
779          return addType();
780        }
781        else if (name.equals("name")) {
782          throw new FHIRException("Cannot call addChild on a primitive type CareTeam.name");
783        }
784        else if (name.equals("subject")) {
785          this.subject = new Reference();
786          return this.subject;
787        }
788        else if (name.equals("period")) {
789          this.period = new Period();
790          return this.period;
791        }
792        else if (name.equals("participant")) {
793          return addParticipant();
794        }
795        else if (name.equals("managingOrganization")) {
796          this.managingOrganization = new Reference();
797          return this.managingOrganization;
798        }
799        else
800          return super.addChild(name);
801      }
802
803  public String fhirType() {
804    return "CareTeam";
805
806  }
807
808      public CareTeam copy() {
809        CareTeam dst = new CareTeam();
810        copyValues(dst);
811        if (identifier != null) {
812          dst.identifier = new ArrayList<Identifier>();
813          for (Identifier i : identifier)
814            dst.identifier.add(i.copy());
815        };
816        dst.status = status == null ? null : status.copy();
817        if (type != null) {
818          dst.type = new ArrayList<CodeableConcept>();
819          for (CodeableConcept i : type)
820            dst.type.add(i.copy());
821        };
822        dst.name = name == null ? null : name.copy();
823        dst.subject = subject == null ? null : subject.copy();
824        dst.period = period == null ? null : period.copy();
825        if (participant != null) {
826          dst.participant = new ArrayList<CareTeamParticipantComponent>();
827          for (CareTeamParticipantComponent i : participant)
828            dst.participant.add(i.copy());
829        };
830        dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
831        return dst;
832      }
833
834      protected CareTeam typedCopy() {
835        return copy();
836      }
837
838      @Override
839      public boolean equalsDeep(Base other) {
840        if (!super.equalsDeep(other))
841          return false;
842        if (!(other instanceof CareTeam))
843          return false;
844        CareTeam o = (CareTeam) other;
845        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
846           && compareDeep(name, o.name, true) && compareDeep(subject, o.subject, true) && compareDeep(period, o.period, true)
847           && compareDeep(participant, o.participant, true) && compareDeep(managingOrganization, o.managingOrganization, true)
848          ;
849      }
850
851      @Override
852      public boolean equalsShallow(Base other) {
853        if (!super.equalsShallow(other))
854          return false;
855        if (!(other instanceof CareTeam))
856          return false;
857        CareTeam o = (CareTeam) other;
858        return compareValues(name, o.name, true);
859      }
860
861      public boolean isEmpty() {
862        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
863           && (type == null || type.isEmpty()) && (name == null || name.isEmpty()) && (subject == null || subject.isEmpty())
864           && (period == null || period.isEmpty()) && (participant == null || participant.isEmpty())
865           && (managingOrganization == null || managingOrganization.isEmpty());
866      }
867
868  @Override
869  public ResourceType getResourceType() {
870    return ResourceType.CareTeam;
871   }
872
873 /**
874   * Search parameter: <b>patient</b>
875   * <p>
876   * Description: <b>Who care team is for</b><br>
877   * Type: <b>reference</b><br>
878   * Path: <b>CareTeam.subject</b><br>
879   * </p>
880   */
881  @SearchParamDefinition(name="patient", path="CareTeam.subject", description="Who care team is for", type="reference" )
882  public static final String SP_PATIENT = "patient";
883 /**
884   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
885   * <p>
886   * Description: <b>Who care team is for</b><br>
887   * Type: <b>reference</b><br>
888   * Path: <b>CareTeam.subject</b><br>
889   * </p>
890   */
891  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
892
893/**
894   * Constant for fluent queries to be used to add include statements. Specifies
895   * the path value of "<b>CareTeam:patient</b>".
896   */
897  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CareTeam:patient").toLocked();
898
899 /**
900   * Search parameter: <b>status</b>
901   * <p>
902   * Description: <b>active | suspended | inactive | entered in error</b><br>
903   * Type: <b>token</b><br>
904   * Path: <b>CareTeam.status</b><br>
905   * </p>
906   */
907  @SearchParamDefinition(name="status", path="CareTeam.status", description="active | suspended | inactive | entered in error", type="token" )
908  public static final String SP_STATUS = "status";
909 /**
910   * <b>Fluent Client</b> search parameter constant for <b>status</b>
911   * <p>
912   * Description: <b>active | suspended | inactive | entered in error</b><br>
913   * Type: <b>token</b><br>
914   * Path: <b>CareTeam.status</b><br>
915   * </p>
916   */
917  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
918
919 /**
920   * Search parameter: <b>subject</b>
921   * <p>
922   * Description: <b>Who care team is for</b><br>
923   * Type: <b>reference</b><br>
924   * Path: <b>CareTeam.subject</b><br>
925   * </p>
926   */
927  @SearchParamDefinition(name="subject", path="CareTeam.subject", description="Who care team is for", type="reference" )
928  public static final String SP_SUBJECT = "subject";
929 /**
930   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
931   * <p>
932   * Description: <b>Who care team is for</b><br>
933   * Type: <b>reference</b><br>
934   * Path: <b>CareTeam.subject</b><br>
935   * </p>
936   */
937  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
938
939/**
940   * Constant for fluent queries to be used to add include statements. Specifies
941   * the path value of "<b>CareTeam:subject</b>".
942   */
943  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("CareTeam:subject").toLocked();
944
945 /**
946   * Search parameter: <b>participant</b>
947   * <p>
948   * Description: <b>Who is involved</b><br>
949   * Type: <b>reference</b><br>
950   * Path: <b>CareTeam.participant.member</b><br>
951   * </p>
952   */
953  @SearchParamDefinition(name="participant", path="CareTeam.participant.member", description="Who is involved", type="reference" )
954  public static final String SP_PARTICIPANT = "participant";
955 /**
956   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
957   * <p>
958   * Description: <b>Who is involved</b><br>
959   * Type: <b>reference</b><br>
960   * Path: <b>CareTeam.participant.member</b><br>
961   * </p>
962   */
963  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTICIPANT);
964
965/**
966   * Constant for fluent queries to be used to add include statements. Specifies
967   * the path value of "<b>CareTeam:participant</b>".
968   */
969  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include("CareTeam:participant").toLocked();
970
971 /**
972   * Search parameter: <b>type</b>
973   * <p>
974   * Description: <b>Type of team</b><br>
975   * Type: <b>token</b><br>
976   * Path: <b>CareTeam.type</b><br>
977   * </p>
978   */
979  @SearchParamDefinition(name="type", path="CareTeam.type", description="Type of team", type="token" )
980  public static final String SP_TYPE = "type";
981 /**
982   * <b>Fluent Client</b> search parameter constant for <b>type</b>
983   * <p>
984   * Description: <b>Type of team</b><br>
985   * Type: <b>token</b><br>
986   * Path: <b>CareTeam.type</b><br>
987   * </p>
988   */
989  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
990
991 /**
992   * Search parameter: <b>date</b>
993   * <p>
994   * Description: <b>Time period team covers</b><br>
995   * Type: <b>date</b><br>
996   * Path: <b>CareTeam.period</b><br>
997   * </p>
998   */
999  @SearchParamDefinition(name="date", path="CareTeam.period", description="Time period team covers", type="date" )
1000  public static final String SP_DATE = "date";
1001 /**
1002   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1003   * <p>
1004   * Description: <b>Time period team covers</b><br>
1005   * Type: <b>date</b><br>
1006   * Path: <b>CareTeam.period</b><br>
1007   * </p>
1008   */
1009  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1010
1011 /**
1012   * Search parameter: <b>identifier</b>
1013   * <p>
1014   * Description: <b>External Ids for this team</b><br>
1015   * Type: <b>token</b><br>
1016   * Path: <b>CareTeam.identifier</b><br>
1017   * </p>
1018   */
1019  @SearchParamDefinition(name="identifier", path="CareTeam.identifier", description="External Ids for this team", type="token" )
1020  public static final String SP_IDENTIFIER = "identifier";
1021 /**
1022   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1023   * <p>
1024   * Description: <b>External Ids for this team</b><br>
1025   * Type: <b>token</b><br>
1026   * Path: <b>CareTeam.identifier</b><br>
1027   * </p>
1028   */
1029  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1030
1031
1032}