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