001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).
052 */
053@ResourceDef(name="Appointment", profile="http://hl7.org/fhir/StructureDefinition/Appointment")
054public class Appointment extends DomainResource {
055
056    public enum AppointmentStatus {
057        /**
058         * None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time might not be set yet.
059         */
060        PROPOSED, 
061        /**
062         * Some or all of the participant(s) have not finalized their acceptance of the appointment request.
063         */
064        PENDING, 
065        /**
066         * All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.
067         */
068        BOOKED, 
069        /**
070         * The patient/patients has/have arrived and is/are waiting to be seen.
071         */
072        ARRIVED, 
073        /**
074         * The planning stages of the appointment are now complete, the encounter resource will exist and will track further status changes. Note that an encounter may exist before the appointment status is fulfilled for many reasons.
075         */
076        FULFILLED, 
077        /**
078         * The appointment has been cancelled.
079         */
080        CANCELLED, 
081        /**
082         * Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).
083         */
084        NOSHOW, 
085        /**
086         * This instance should not have been part of this patient's medical record.
087         */
088        ENTEREDINERROR, 
089        /**
090         * When checked in, all pre-encounter administrative work is complete, and the encounter may begin. (where multiple patients are involved, they are all present).
091         */
092        CHECKEDIN, 
093        /**
094         * The appointment has been placed on a waitlist, to be scheduled/confirmed in the future when a slot/service is available.\nA specific time might or might not be pre-allocated.
095         */
096        WAITLIST, 
097        /**
098         * added to help the parsers with the generic types
099         */
100        NULL;
101        public static AppointmentStatus fromCode(String codeString) throws FHIRException {
102            if (codeString == null || "".equals(codeString))
103                return null;
104        if ("proposed".equals(codeString))
105          return PROPOSED;
106        if ("pending".equals(codeString))
107          return PENDING;
108        if ("booked".equals(codeString))
109          return BOOKED;
110        if ("arrived".equals(codeString))
111          return ARRIVED;
112        if ("fulfilled".equals(codeString))
113          return FULFILLED;
114        if ("cancelled".equals(codeString))
115          return CANCELLED;
116        if ("noshow".equals(codeString))
117          return NOSHOW;
118        if ("entered-in-error".equals(codeString))
119          return ENTEREDINERROR;
120        if ("checked-in".equals(codeString))
121          return CHECKEDIN;
122        if ("waitlist".equals(codeString))
123          return WAITLIST;
124        if (Configuration.isAcceptInvalidEnums())
125          return null;
126        else
127          throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
128        }
129        public String toCode() {
130          switch (this) {
131            case PROPOSED: return "proposed";
132            case PENDING: return "pending";
133            case BOOKED: return "booked";
134            case ARRIVED: return "arrived";
135            case FULFILLED: return "fulfilled";
136            case CANCELLED: return "cancelled";
137            case NOSHOW: return "noshow";
138            case ENTEREDINERROR: return "entered-in-error";
139            case CHECKEDIN: return "checked-in";
140            case WAITLIST: return "waitlist";
141            default: return "?";
142          }
143        }
144        public String getSystem() {
145          switch (this) {
146            case PROPOSED: return "http://hl7.org/fhir/appointmentstatus";
147            case PENDING: return "http://hl7.org/fhir/appointmentstatus";
148            case BOOKED: return "http://hl7.org/fhir/appointmentstatus";
149            case ARRIVED: return "http://hl7.org/fhir/appointmentstatus";
150            case FULFILLED: return "http://hl7.org/fhir/appointmentstatus";
151            case CANCELLED: return "http://hl7.org/fhir/appointmentstatus";
152            case NOSHOW: return "http://hl7.org/fhir/appointmentstatus";
153            case ENTEREDINERROR: return "http://hl7.org/fhir/appointmentstatus";
154            case CHECKEDIN: return "http://hl7.org/fhir/appointmentstatus";
155            case WAITLIST: return "http://hl7.org/fhir/appointmentstatus";
156            default: return "?";
157          }
158        }
159        public String getDefinition() {
160          switch (this) {
161            case PROPOSED: return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time might not be set yet.";
162            case PENDING: return "Some or all of the participant(s) have not finalized their acceptance of the appointment request.";
163            case BOOKED: return "All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.";
164            case ARRIVED: return "The patient/patients has/have arrived and is/are waiting to be seen.";
165            case FULFILLED: return "The planning stages of the appointment are now complete, the encounter resource will exist and will track further status changes. Note that an encounter may exist before the appointment status is fulfilled for many reasons.";
166            case CANCELLED: return "The appointment has been cancelled.";
167            case NOSHOW: return "Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).";
168            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
169            case CHECKEDIN: return "When checked in, all pre-encounter administrative work is complete, and the encounter may begin. (where multiple patients are involved, they are all present).";
170            case WAITLIST: return "The appointment has been placed on a waitlist, to be scheduled/confirmed in the future when a slot/service is available.\nA specific time might or might not be pre-allocated.";
171            default: return "?";
172          }
173        }
174        public String getDisplay() {
175          switch (this) {
176            case PROPOSED: return "Proposed";
177            case PENDING: return "Pending";
178            case BOOKED: return "Booked";
179            case ARRIVED: return "Arrived";
180            case FULFILLED: return "Fulfilled";
181            case CANCELLED: return "Cancelled";
182            case NOSHOW: return "No Show";
183            case ENTEREDINERROR: return "Entered in error";
184            case CHECKEDIN: return "Checked In";
185            case WAITLIST: return "Waitlisted";
186            default: return "?";
187          }
188        }
189    }
190
191  public static class AppointmentStatusEnumFactory implements EnumFactory<AppointmentStatus> {
192    public AppointmentStatus fromCode(String codeString) throws IllegalArgumentException {
193      if (codeString == null || "".equals(codeString))
194            if (codeString == null || "".equals(codeString))
195                return null;
196        if ("proposed".equals(codeString))
197          return AppointmentStatus.PROPOSED;
198        if ("pending".equals(codeString))
199          return AppointmentStatus.PENDING;
200        if ("booked".equals(codeString))
201          return AppointmentStatus.BOOKED;
202        if ("arrived".equals(codeString))
203          return AppointmentStatus.ARRIVED;
204        if ("fulfilled".equals(codeString))
205          return AppointmentStatus.FULFILLED;
206        if ("cancelled".equals(codeString))
207          return AppointmentStatus.CANCELLED;
208        if ("noshow".equals(codeString))
209          return AppointmentStatus.NOSHOW;
210        if ("entered-in-error".equals(codeString))
211          return AppointmentStatus.ENTEREDINERROR;
212        if ("checked-in".equals(codeString))
213          return AppointmentStatus.CHECKEDIN;
214        if ("waitlist".equals(codeString))
215          return AppointmentStatus.WAITLIST;
216        throw new IllegalArgumentException("Unknown AppointmentStatus code '"+codeString+"'");
217        }
218        public Enumeration<AppointmentStatus> fromType(Base code) throws FHIRException {
219          if (code == null)
220            return null;
221          if (code.isEmpty())
222            return new Enumeration<AppointmentStatus>(this);
223          String codeString = ((PrimitiveType) code).asStringValue();
224          if (codeString == null || "".equals(codeString))
225            return null;
226        if ("proposed".equals(codeString))
227          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PROPOSED);
228        if ("pending".equals(codeString))
229          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PENDING);
230        if ("booked".equals(codeString))
231          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.BOOKED);
232        if ("arrived".equals(codeString))
233          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ARRIVED);
234        if ("fulfilled".equals(codeString))
235          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.FULFILLED);
236        if ("cancelled".equals(codeString))
237          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CANCELLED);
238        if ("noshow".equals(codeString))
239          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NOSHOW);
240        if ("entered-in-error".equals(codeString))
241          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ENTEREDINERROR);
242        if ("checked-in".equals(codeString))
243          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CHECKEDIN);
244        if ("waitlist".equals(codeString))
245          return new Enumeration<AppointmentStatus>(this, AppointmentStatus.WAITLIST);
246        throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'");
247        }
248    public String toCode(AppointmentStatus code) {
249      if (code == AppointmentStatus.PROPOSED)
250        return "proposed";
251      if (code == AppointmentStatus.PENDING)
252        return "pending";
253      if (code == AppointmentStatus.BOOKED)
254        return "booked";
255      if (code == AppointmentStatus.ARRIVED)
256        return "arrived";
257      if (code == AppointmentStatus.FULFILLED)
258        return "fulfilled";
259      if (code == AppointmentStatus.CANCELLED)
260        return "cancelled";
261      if (code == AppointmentStatus.NOSHOW)
262        return "noshow";
263      if (code == AppointmentStatus.ENTEREDINERROR)
264        return "entered-in-error";
265      if (code == AppointmentStatus.CHECKEDIN)
266        return "checked-in";
267      if (code == AppointmentStatus.WAITLIST)
268        return "waitlist";
269      return "?";
270      }
271    public String toSystem(AppointmentStatus code) {
272      return code.getSystem();
273      }
274    }
275
276    @Block()
277    public static class AppointmentParticipantComponent extends BackboneElement implements IBaseBackboneElement {
278        /**
279         * Role of participant in the appointment.
280         */
281        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
282        @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." )
283        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-participant-type")
284        protected List<CodeableConcept> type;
285
286        /**
287         * Participation period of the actor.
288         */
289        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
290        @Description(shortDefinition="Participation period of the actor", formalDefinition="Participation period of the actor." )
291        protected Period period;
292
293        /**
294         * A Person, Location/HealthcareService or Device that is participating in the appointment.
295         */
296        @Child(name = "actor", type = {Patient.class, Group.class, Practitioner.class, PractitionerRole.class, CareTeam.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=true)
297        @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." )
298        protected Reference actor;
299
300        /**
301         * Whether this participant is required to be present at the meeting. If false, the participant is optional.
302         */
303        @Child(name = "required", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
304        @Description(shortDefinition="The participant is required to attend (optional when false)", formalDefinition="Whether this participant is required to be present at the meeting. If false, the participant is optional." )
305        protected BooleanType required;
306
307        /**
308         * Participation status of the actor.
309         */
310        @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=true)
311        @Description(shortDefinition="accepted | declined | tentative | needs-action", formalDefinition="Participation status of the actor." )
312        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participationstatus")
313        protected Enumeration<ParticipationStatus> status;
314
315        private static final long serialVersionUID = 1537536134L;
316
317    /**
318     * Constructor
319     */
320      public AppointmentParticipantComponent() {
321        super();
322      }
323
324    /**
325     * Constructor
326     */
327      public AppointmentParticipantComponent(ParticipationStatus status) {
328        super();
329        this.setStatus(status);
330      }
331
332        /**
333         * @return {@link #type} (Role of participant in the appointment.)
334         */
335        public List<CodeableConcept> getType() { 
336          if (this.type == null)
337            this.type = new ArrayList<CodeableConcept>();
338          return this.type;
339        }
340
341        /**
342         * @return Returns a reference to <code>this</code> for easy method chaining
343         */
344        public AppointmentParticipantComponent setType(List<CodeableConcept> theType) { 
345          this.type = theType;
346          return this;
347        }
348
349        public boolean hasType() { 
350          if (this.type == null)
351            return false;
352          for (CodeableConcept item : this.type)
353            if (!item.isEmpty())
354              return true;
355          return false;
356        }
357
358        public CodeableConcept addType() { //3
359          CodeableConcept t = new CodeableConcept();
360          if (this.type == null)
361            this.type = new ArrayList<CodeableConcept>();
362          this.type.add(t);
363          return t;
364        }
365
366        public AppointmentParticipantComponent addType(CodeableConcept t) { //3
367          if (t == null)
368            return this;
369          if (this.type == null)
370            this.type = new ArrayList<CodeableConcept>();
371          this.type.add(t);
372          return this;
373        }
374
375        /**
376         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
377         */
378        public CodeableConcept getTypeFirstRep() { 
379          if (getType().isEmpty()) {
380            addType();
381          }
382          return getType().get(0);
383        }
384
385        /**
386         * @return {@link #period} (Participation period of the actor.)
387         */
388        public Period getPeriod() { 
389          if (this.period == null)
390            if (Configuration.errorOnAutoCreate())
391              throw new Error("Attempt to auto-create AppointmentParticipantComponent.period");
392            else if (Configuration.doAutoCreate())
393              this.period = new Period(); // cc
394          return this.period;
395        }
396
397        public boolean hasPeriod() { 
398          return this.period != null && !this.period.isEmpty();
399        }
400
401        /**
402         * @param value {@link #period} (Participation period of the actor.)
403         */
404        public AppointmentParticipantComponent setPeriod(Period value) { 
405          this.period = value;
406          return this;
407        }
408
409        /**
410         * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
411         */
412        public Reference getActor() { 
413          if (this.actor == null)
414            if (Configuration.errorOnAutoCreate())
415              throw new Error("Attempt to auto-create AppointmentParticipantComponent.actor");
416            else if (Configuration.doAutoCreate())
417              this.actor = new Reference(); // cc
418          return this.actor;
419        }
420
421        public boolean hasActor() { 
422          return this.actor != null && !this.actor.isEmpty();
423        }
424
425        /**
426         * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
427         */
428        public AppointmentParticipantComponent setActor(Reference value) { 
429          this.actor = value;
430          return this;
431        }
432
433        /**
434         * @return {@link #required} (Whether this participant is required to be present at the meeting. If false, the participant is optional.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
435         */
436        public BooleanType getRequiredElement() { 
437          if (this.required == null)
438            if (Configuration.errorOnAutoCreate())
439              throw new Error("Attempt to auto-create AppointmentParticipantComponent.required");
440            else if (Configuration.doAutoCreate())
441              this.required = new BooleanType(); // bb
442          return this.required;
443        }
444
445        public boolean hasRequiredElement() { 
446          return this.required != null && !this.required.isEmpty();
447        }
448
449        public boolean hasRequired() { 
450          return this.required != null && !this.required.isEmpty();
451        }
452
453        /**
454         * @param value {@link #required} (Whether this participant is required to be present at the meeting. If false, the participant is optional.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
455         */
456        public AppointmentParticipantComponent setRequiredElement(BooleanType value) { 
457          this.required = value;
458          return this;
459        }
460
461        /**
462         * @return Whether this participant is required to be present at the meeting. If false, the participant is optional.
463         */
464        public boolean getRequired() { 
465          return this.required == null || this.required.isEmpty() ? false : this.required.getValue();
466        }
467
468        /**
469         * @param value Whether this participant is required to be present at the meeting. If false, the participant is optional.
470         */
471        public AppointmentParticipantComponent setRequired(boolean value) { 
472            if (this.required == null)
473              this.required = new BooleanType();
474            this.required.setValue(value);
475          return this;
476        }
477
478        /**
479         * @return {@link #status} (Participation status of the actor.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
480         */
481        public Enumeration<ParticipationStatus> getStatusElement() { 
482          if (this.status == null)
483            if (Configuration.errorOnAutoCreate())
484              throw new Error("Attempt to auto-create AppointmentParticipantComponent.status");
485            else if (Configuration.doAutoCreate())
486              this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory()); // bb
487          return this.status;
488        }
489
490        public boolean hasStatusElement() { 
491          return this.status != null && !this.status.isEmpty();
492        }
493
494        public boolean hasStatus() { 
495          return this.status != null && !this.status.isEmpty();
496        }
497
498        /**
499         * @param value {@link #status} (Participation status of the actor.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
500         */
501        public AppointmentParticipantComponent setStatusElement(Enumeration<ParticipationStatus> value) { 
502          this.status = value;
503          return this;
504        }
505
506        /**
507         * @return Participation status of the actor.
508         */
509        public ParticipationStatus getStatus() { 
510          return this.status == null ? null : this.status.getValue();
511        }
512
513        /**
514         * @param value Participation status of the actor.
515         */
516        public AppointmentParticipantComponent setStatus(ParticipationStatus value) { 
517            if (this.status == null)
518              this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory());
519            this.status.setValue(value);
520          return this;
521        }
522
523        protected void listChildren(List<Property> children) {
524          super.listChildren(children);
525          children.add(new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type));
526          children.add(new Property("period", "Period", "Participation period of the actor.", 0, 1, period));
527          children.add(new Property("actor", "Reference(Patient|Group|Practitioner|PractitionerRole|CareTeam|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor));
528          children.add(new Property("required", "boolean", "Whether this participant is required to be present at the meeting. If false, the participant is optional.", 0, 1, required));
529          children.add(new Property("status", "code", "Participation status of the actor.", 0, 1, status));
530        }
531
532        @Override
533        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
534          switch (_hash) {
535          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type);
536          case -991726143: /*period*/  return new Property("period", "Period", "Participation period of the actor.", 0, 1, period);
537          case 92645877: /*actor*/  return new Property("actor", "Reference(Patient|Group|Practitioner|PractitionerRole|CareTeam|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, 1, actor);
538          case -393139297: /*required*/  return new Property("required", "boolean", "Whether this participant is required to be present at the meeting. If false, the participant is optional.", 0, 1, required);
539          case -892481550: /*status*/  return new Property("status", "code", "Participation status of the actor.", 0, 1, status);
540          default: return super.getNamedProperty(_hash, _name, _checkValid);
541          }
542
543        }
544
545      @Override
546      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
547        switch (hash) {
548        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
549        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
550        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
551        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // BooleanType
552        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ParticipationStatus>
553        default: return super.getProperty(hash, name, checkValid);
554        }
555
556      }
557
558      @Override
559      public Base setProperty(int hash, String name, Base value) throws FHIRException {
560        switch (hash) {
561        case 3575610: // type
562          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
563          return value;
564        case -991726143: // period
565          this.period = TypeConvertor.castToPeriod(value); // Period
566          return value;
567        case 92645877: // actor
568          this.actor = TypeConvertor.castToReference(value); // Reference
569          return value;
570        case -393139297: // required
571          this.required = TypeConvertor.castToBoolean(value); // BooleanType
572          return value;
573        case -892481550: // status
574          value = new ParticipationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
575          this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
576          return value;
577        default: return super.setProperty(hash, name, value);
578        }
579
580      }
581
582      @Override
583      public Base setProperty(String name, Base value) throws FHIRException {
584        if (name.equals("type")) {
585          this.getType().add(TypeConvertor.castToCodeableConcept(value));
586        } else if (name.equals("period")) {
587          this.period = TypeConvertor.castToPeriod(value); // Period
588        } else if (name.equals("actor")) {
589          this.actor = TypeConvertor.castToReference(value); // Reference
590        } else if (name.equals("required")) {
591          this.required = TypeConvertor.castToBoolean(value); // BooleanType
592        } else if (name.equals("status")) {
593          value = new ParticipationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
594          this.status = (Enumeration) value; // Enumeration<ParticipationStatus>
595        } else
596          return super.setProperty(name, value);
597        return value;
598      }
599
600      @Override
601      public Base makeProperty(int hash, String name) throws FHIRException {
602        switch (hash) {
603        case 3575610:  return addType(); 
604        case -991726143:  return getPeriod();
605        case 92645877:  return getActor();
606        case -393139297:  return getRequiredElement();
607        case -892481550:  return getStatusElement();
608        default: return super.makeProperty(hash, name);
609        }
610
611      }
612
613      @Override
614      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
615        switch (hash) {
616        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
617        case -991726143: /*period*/ return new String[] {"Period"};
618        case 92645877: /*actor*/ return new String[] {"Reference"};
619        case -393139297: /*required*/ return new String[] {"boolean"};
620        case -892481550: /*status*/ return new String[] {"code"};
621        default: return super.getTypesForProperty(hash, name);
622        }
623
624      }
625
626      @Override
627      public Base addChild(String name) throws FHIRException {
628        if (name.equals("type")) {
629          return addType();
630        }
631        else if (name.equals("period")) {
632          this.period = new Period();
633          return this.period;
634        }
635        else if (name.equals("actor")) {
636          this.actor = new Reference();
637          return this.actor;
638        }
639        else if (name.equals("required")) {
640          throw new FHIRException("Cannot call addChild on a primitive type Appointment.participant.required");
641        }
642        else if (name.equals("status")) {
643          throw new FHIRException("Cannot call addChild on a primitive type Appointment.participant.status");
644        }
645        else
646          return super.addChild(name);
647      }
648
649      public AppointmentParticipantComponent copy() {
650        AppointmentParticipantComponent dst = new AppointmentParticipantComponent();
651        copyValues(dst);
652        return dst;
653      }
654
655      public void copyValues(AppointmentParticipantComponent dst) {
656        super.copyValues(dst);
657        if (type != null) {
658          dst.type = new ArrayList<CodeableConcept>();
659          for (CodeableConcept i : type)
660            dst.type.add(i.copy());
661        };
662        dst.period = period == null ? null : period.copy();
663        dst.actor = actor == null ? null : actor.copy();
664        dst.required = required == null ? null : required.copy();
665        dst.status = status == null ? null : status.copy();
666      }
667
668      @Override
669      public boolean equalsDeep(Base other_) {
670        if (!super.equalsDeep(other_))
671          return false;
672        if (!(other_ instanceof AppointmentParticipantComponent))
673          return false;
674        AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
675        return compareDeep(type, o.type, true) && compareDeep(period, o.period, true) && compareDeep(actor, o.actor, true)
676           && compareDeep(required, o.required, true) && compareDeep(status, o.status, true);
677      }
678
679      @Override
680      public boolean equalsShallow(Base other_) {
681        if (!super.equalsShallow(other_))
682          return false;
683        if (!(other_ instanceof AppointmentParticipantComponent))
684          return false;
685        AppointmentParticipantComponent o = (AppointmentParticipantComponent) other_;
686        return compareValues(required, o.required, true) && compareValues(status, o.status, true);
687      }
688
689      public boolean isEmpty() {
690        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, period, actor, required
691          , status);
692      }
693
694  public String fhirType() {
695    return "Appointment.participant";
696
697  }
698
699  }
700
701    /**
702     * This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
703     */
704    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
705    @Description(shortDefinition="External Ids for this item", formalDefinition="This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
706    protected List<Identifier> identifier;
707
708    /**
709     * The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.
710     */
711    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
712    @Description(shortDefinition="proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist", formalDefinition="The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status." )
713    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/appointmentstatus")
714    protected Enumeration<AppointmentStatus> status;
715
716    /**
717     * The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.
718     */
719    @Child(name = "cancellationReason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
720    @Description(shortDefinition="The coded reason for the appointment being cancelled", formalDefinition="The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply." )
721    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/appointment-cancellation-reason")
722    protected CodeableConcept cancellationReason;
723
724    /**
725     * A broad categorization of the service that is to be performed during this appointment.
726     */
727    @Child(name = "serviceCategory", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
728    @Description(shortDefinition="A broad categorization of the service that is to be performed during this appointment", formalDefinition="A broad categorization of the service that is to be performed during this appointment." )
729    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-category")
730    protected List<CodeableConcept> serviceCategory;
731
732    /**
733     * The specific service that is to be performed during this appointment.
734     */
735    @Child(name = "serviceType", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
736    @Description(shortDefinition="The specific service that is to be performed during this appointment", formalDefinition="The specific service that is to be performed during this appointment." )
737    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-type")
738    protected List<CodeableConcept> serviceType;
739
740    /**
741     * The specialty of a practitioner that would be required to perform the service requested in this appointment.
742     */
743    @Child(name = "specialty", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
744    @Description(shortDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment", formalDefinition="The specialty of a practitioner that would be required to perform the service requested in this appointment." )
745    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
746    protected List<CodeableConcept> specialty;
747
748    /**
749     * The style of appointment or patient that has been booked in the slot (not service type).
750     */
751    @Child(name = "appointmentType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
752    @Description(shortDefinition="The style of appointment or patient that has been booked in the slot (not service type)", formalDefinition="The style of appointment or patient that has been booked in the slot (not service type)." )
753    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0276")
754    protected CodeableConcept appointmentType;
755
756    /**
757     * The reason that this appointment is being scheduled. This is more clinical than administrative. This can be coded, or as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.
758     */
759    @Child(name = "reason", type = {CodeableReference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
760    @Description(shortDefinition="Reason this appointment is scheduled", formalDefinition="The reason that this appointment is being scheduled. This is more clinical than administrative. This can be coded, or as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure." )
761    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-reason")
762    protected List<CodeableReference> reason;
763
764    /**
765     * The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).
766     */
767    @Child(name = "priority", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
768    @Description(shortDefinition="Used to make informed decisions if needing to re-prioritize", formalDefinition="The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority)." )
769    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActPriority")
770    protected CodeableConcept priority;
771
772    /**
773     * The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.
774     */
775    @Child(name = "description", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
776    @Description(shortDefinition="Shown on a subject line in a meeting request, or appointment list", formalDefinition="The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field." )
777    protected StringType description;
778
779    /**
780     * Appointment replaced by this Appointment in cases where there is a cancellation, the details of the cancellation can be found in the cancellationReason property (on the referenced resource).
781     */
782    @Child(name = "replaces", type = {Appointment.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
783    @Description(shortDefinition="Appointment replaced by this Appointment", formalDefinition="Appointment replaced by this Appointment in cases where there is a cancellation, the details of the cancellation can be found in the cancellationReason property (on the referenced resource)." )
784    protected List<Reference> replaces;
785
786    /**
787     * Additional information to support the appointment provided when making the appointment.
788     */
789    @Child(name = "supportingInformation", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
790    @Description(shortDefinition="Additional information to support the appointment", formalDefinition="Additional information to support the appointment provided when making the appointment." )
791    protected List<Reference> supportingInformation;
792
793    /**
794     * Date/Time that the appointment is to take place.
795     */
796    @Child(name = "start", type = {InstantType.class}, order=12, min=0, max=1, modifier=false, summary=true)
797    @Description(shortDefinition="When appointment is to take place", formalDefinition="Date/Time that the appointment is to take place." )
798    protected InstantType start;
799
800    /**
801     * Date/Time that the appointment is to conclude.
802     */
803    @Child(name = "end", type = {InstantType.class}, order=13, min=0, max=1, modifier=false, summary=true)
804    @Description(shortDefinition="When appointment is to conclude", formalDefinition="Date/Time that the appointment is to conclude." )
805    protected InstantType end;
806
807    /**
808     * Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.
809     */
810    @Child(name = "minutesDuration", type = {PositiveIntType.class}, order=14, min=0, max=1, modifier=false, summary=false)
811    @Description(shortDefinition="Can be less than start/end (e.g. estimate)", formalDefinition="Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end." )
812    protected PositiveIntType minutesDuration;
813
814    /**
815     * The slots from the participants' schedules that will be filled by the appointment.
816     */
817    @Child(name = "slot", type = {Slot.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
818    @Description(shortDefinition="The slots that this appointment is filling", formalDefinition="The slots from the participants' schedules that will be filled by the appointment." )
819    protected List<Reference> slot;
820
821    /**
822     * The set of accounts that is expected to be used for billing the activities that result from this Appointment.
823     */
824    @Child(name = "account", type = {Account.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
825    @Description(shortDefinition="The set of accounts that may be used for billing for this Appointment", formalDefinition="The set of accounts that is expected to be used for billing the activities that result from this Appointment." )
826    protected List<Reference> account;
827
828    /**
829     * The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.
830     */
831    @Child(name = "created", type = {DateTimeType.class}, order=17, min=0, max=1, modifier=false, summary=false)
832    @Description(shortDefinition="The date that this appointment was initially created", formalDefinition="The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment." )
833    protected DateTimeType created;
834
835    /**
836     * Additional notes/comments about the appointment.
837     */
838    @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
839    @Description(shortDefinition="Additional comments", formalDefinition="Additional notes/comments about the appointment." )
840    protected List<Annotation> note;
841
842    /**
843     * While Appointment.note contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).
844     */
845    @Child(name = "patientInstruction", type = {CodeableReference.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
846    @Description(shortDefinition="Detailed information and instructions for the patient", formalDefinition="While Appointment.note contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before)." )
847    protected List<CodeableReference> patientInstruction;
848
849    /**
850     * The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).
851     */
852    @Child(name = "basedOn", type = {ServiceRequest.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
853    @Description(shortDefinition="The service request this appointment is allocated to assess", formalDefinition="The service request this appointment is allocated to assess (e.g. incoming referral or procedure request)." )
854    protected List<Reference> basedOn;
855
856    /**
857     * The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element.
858     */
859    @Child(name = "subject", type = {Patient.class, Group.class}, order=21, min=0, max=1, modifier=false, summary=true)
860    @Description(shortDefinition="The patient or group associated with the appointment", formalDefinition="The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element." )
861    protected Reference subject;
862
863    /**
864     * List of participants involved in the appointment.
865     */
866    @Child(name = "participant", type = {}, order=22, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
867    @Description(shortDefinition="Participants involved in appointment", formalDefinition="List of participants involved in the appointment." )
868    protected List<AppointmentParticipantComponent> participant;
869
870    /**
871     * A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.
872
873The duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.
874     */
875    @Child(name = "requestedPeriod", type = {Period.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
876    @Description(shortDefinition="Potential date/time interval(s) requested to allocate the appointment within", formalDefinition="A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.\n\nThe duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system." )
877    protected List<Period> requestedPeriod;
878
879    private static final long serialVersionUID = -1812760665L;
880
881  /**
882   * Constructor
883   */
884    public Appointment() {
885      super();
886    }
887
888  /**
889   * Constructor
890   */
891    public Appointment(AppointmentStatus status, AppointmentParticipantComponent participant) {
892      super();
893      this.setStatus(status);
894      this.addParticipant(participant);
895    }
896
897    /**
898     * @return {@link #identifier} (This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
899     */
900    public List<Identifier> getIdentifier() { 
901      if (this.identifier == null)
902        this.identifier = new ArrayList<Identifier>();
903      return this.identifier;
904    }
905
906    /**
907     * @return Returns a reference to <code>this</code> for easy method chaining
908     */
909    public Appointment setIdentifier(List<Identifier> theIdentifier) { 
910      this.identifier = theIdentifier;
911      return this;
912    }
913
914    public boolean hasIdentifier() { 
915      if (this.identifier == null)
916        return false;
917      for (Identifier item : this.identifier)
918        if (!item.isEmpty())
919          return true;
920      return false;
921    }
922
923    public Identifier addIdentifier() { //3
924      Identifier t = new Identifier();
925      if (this.identifier == null)
926        this.identifier = new ArrayList<Identifier>();
927      this.identifier.add(t);
928      return t;
929    }
930
931    public Appointment addIdentifier(Identifier t) { //3
932      if (t == null)
933        return this;
934      if (this.identifier == null)
935        this.identifier = new ArrayList<Identifier>();
936      this.identifier.add(t);
937      return this;
938    }
939
940    /**
941     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
942     */
943    public Identifier getIdentifierFirstRep() { 
944      if (getIdentifier().isEmpty()) {
945        addIdentifier();
946      }
947      return getIdentifier().get(0);
948    }
949
950    /**
951     * @return {@link #status} (The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
952     */
953    public Enumeration<AppointmentStatus> getStatusElement() { 
954      if (this.status == null)
955        if (Configuration.errorOnAutoCreate())
956          throw new Error("Attempt to auto-create Appointment.status");
957        else if (Configuration.doAutoCreate())
958          this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory()); // bb
959      return this.status;
960    }
961
962    public boolean hasStatusElement() { 
963      return this.status != null && !this.status.isEmpty();
964    }
965
966    public boolean hasStatus() { 
967      return this.status != null && !this.status.isEmpty();
968    }
969
970    /**
971     * @param value {@link #status} (The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
972     */
973    public Appointment setStatusElement(Enumeration<AppointmentStatus> value) { 
974      this.status = value;
975      return this;
976    }
977
978    /**
979     * @return The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.
980     */
981    public AppointmentStatus getStatus() { 
982      return this.status == null ? null : this.status.getValue();
983    }
984
985    /**
986     * @param value The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.
987     */
988    public Appointment setStatus(AppointmentStatus value) { 
989        if (this.status == null)
990          this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory());
991        this.status.setValue(value);
992      return this;
993    }
994
995    /**
996     * @return {@link #cancellationReason} (The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.)
997     */
998    public CodeableConcept getCancellationReason() { 
999      if (this.cancellationReason == null)
1000        if (Configuration.errorOnAutoCreate())
1001          throw new Error("Attempt to auto-create Appointment.cancellationReason");
1002        else if (Configuration.doAutoCreate())
1003          this.cancellationReason = new CodeableConcept(); // cc
1004      return this.cancellationReason;
1005    }
1006
1007    public boolean hasCancellationReason() { 
1008      return this.cancellationReason != null && !this.cancellationReason.isEmpty();
1009    }
1010
1011    /**
1012     * @param value {@link #cancellationReason} (The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.)
1013     */
1014    public Appointment setCancellationReason(CodeableConcept value) { 
1015      this.cancellationReason = value;
1016      return this;
1017    }
1018
1019    /**
1020     * @return {@link #serviceCategory} (A broad categorization of the service that is to be performed during this appointment.)
1021     */
1022    public List<CodeableConcept> getServiceCategory() { 
1023      if (this.serviceCategory == null)
1024        this.serviceCategory = new ArrayList<CodeableConcept>();
1025      return this.serviceCategory;
1026    }
1027
1028    /**
1029     * @return Returns a reference to <code>this</code> for easy method chaining
1030     */
1031    public Appointment setServiceCategory(List<CodeableConcept> theServiceCategory) { 
1032      this.serviceCategory = theServiceCategory;
1033      return this;
1034    }
1035
1036    public boolean hasServiceCategory() { 
1037      if (this.serviceCategory == null)
1038        return false;
1039      for (CodeableConcept item : this.serviceCategory)
1040        if (!item.isEmpty())
1041          return true;
1042      return false;
1043    }
1044
1045    public CodeableConcept addServiceCategory() { //3
1046      CodeableConcept t = new CodeableConcept();
1047      if (this.serviceCategory == null)
1048        this.serviceCategory = new ArrayList<CodeableConcept>();
1049      this.serviceCategory.add(t);
1050      return t;
1051    }
1052
1053    public Appointment addServiceCategory(CodeableConcept t) { //3
1054      if (t == null)
1055        return this;
1056      if (this.serviceCategory == null)
1057        this.serviceCategory = new ArrayList<CodeableConcept>();
1058      this.serviceCategory.add(t);
1059      return this;
1060    }
1061
1062    /**
1063     * @return The first repetition of repeating field {@link #serviceCategory}, creating it if it does not already exist {3}
1064     */
1065    public CodeableConcept getServiceCategoryFirstRep() { 
1066      if (getServiceCategory().isEmpty()) {
1067        addServiceCategory();
1068      }
1069      return getServiceCategory().get(0);
1070    }
1071
1072    /**
1073     * @return {@link #serviceType} (The specific service that is to be performed during this appointment.)
1074     */
1075    public List<CodeableConcept> getServiceType() { 
1076      if (this.serviceType == null)
1077        this.serviceType = new ArrayList<CodeableConcept>();
1078      return this.serviceType;
1079    }
1080
1081    /**
1082     * @return Returns a reference to <code>this</code> for easy method chaining
1083     */
1084    public Appointment setServiceType(List<CodeableConcept> theServiceType) { 
1085      this.serviceType = theServiceType;
1086      return this;
1087    }
1088
1089    public boolean hasServiceType() { 
1090      if (this.serviceType == null)
1091        return false;
1092      for (CodeableConcept item : this.serviceType)
1093        if (!item.isEmpty())
1094          return true;
1095      return false;
1096    }
1097
1098    public CodeableConcept addServiceType() { //3
1099      CodeableConcept t = new CodeableConcept();
1100      if (this.serviceType == null)
1101        this.serviceType = new ArrayList<CodeableConcept>();
1102      this.serviceType.add(t);
1103      return t;
1104    }
1105
1106    public Appointment addServiceType(CodeableConcept t) { //3
1107      if (t == null)
1108        return this;
1109      if (this.serviceType == null)
1110        this.serviceType = new ArrayList<CodeableConcept>();
1111      this.serviceType.add(t);
1112      return this;
1113    }
1114
1115    /**
1116     * @return The first repetition of repeating field {@link #serviceType}, creating it if it does not already exist {3}
1117     */
1118    public CodeableConcept getServiceTypeFirstRep() { 
1119      if (getServiceType().isEmpty()) {
1120        addServiceType();
1121      }
1122      return getServiceType().get(0);
1123    }
1124
1125    /**
1126     * @return {@link #specialty} (The specialty of a practitioner that would be required to perform the service requested in this appointment.)
1127     */
1128    public List<CodeableConcept> getSpecialty() { 
1129      if (this.specialty == null)
1130        this.specialty = new ArrayList<CodeableConcept>();
1131      return this.specialty;
1132    }
1133
1134    /**
1135     * @return Returns a reference to <code>this</code> for easy method chaining
1136     */
1137    public Appointment setSpecialty(List<CodeableConcept> theSpecialty) { 
1138      this.specialty = theSpecialty;
1139      return this;
1140    }
1141
1142    public boolean hasSpecialty() { 
1143      if (this.specialty == null)
1144        return false;
1145      for (CodeableConcept item : this.specialty)
1146        if (!item.isEmpty())
1147          return true;
1148      return false;
1149    }
1150
1151    public CodeableConcept addSpecialty() { //3
1152      CodeableConcept t = new CodeableConcept();
1153      if (this.specialty == null)
1154        this.specialty = new ArrayList<CodeableConcept>();
1155      this.specialty.add(t);
1156      return t;
1157    }
1158
1159    public Appointment addSpecialty(CodeableConcept t) { //3
1160      if (t == null)
1161        return this;
1162      if (this.specialty == null)
1163        this.specialty = new ArrayList<CodeableConcept>();
1164      this.specialty.add(t);
1165      return this;
1166    }
1167
1168    /**
1169     * @return The first repetition of repeating field {@link #specialty}, creating it if it does not already exist {3}
1170     */
1171    public CodeableConcept getSpecialtyFirstRep() { 
1172      if (getSpecialty().isEmpty()) {
1173        addSpecialty();
1174      }
1175      return getSpecialty().get(0);
1176    }
1177
1178    /**
1179     * @return {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
1180     */
1181    public CodeableConcept getAppointmentType() { 
1182      if (this.appointmentType == null)
1183        if (Configuration.errorOnAutoCreate())
1184          throw new Error("Attempt to auto-create Appointment.appointmentType");
1185        else if (Configuration.doAutoCreate())
1186          this.appointmentType = new CodeableConcept(); // cc
1187      return this.appointmentType;
1188    }
1189
1190    public boolean hasAppointmentType() { 
1191      return this.appointmentType != null && !this.appointmentType.isEmpty();
1192    }
1193
1194    /**
1195     * @param value {@link #appointmentType} (The style of appointment or patient that has been booked in the slot (not service type).)
1196     */
1197    public Appointment setAppointmentType(CodeableConcept value) { 
1198      this.appointmentType = value;
1199      return this;
1200    }
1201
1202    /**
1203     * @return {@link #reason} (The reason that this appointment is being scheduled. This is more clinical than administrative. This can be coded, or as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.)
1204     */
1205    public List<CodeableReference> getReason() { 
1206      if (this.reason == null)
1207        this.reason = new ArrayList<CodeableReference>();
1208      return this.reason;
1209    }
1210
1211    /**
1212     * @return Returns a reference to <code>this</code> for easy method chaining
1213     */
1214    public Appointment setReason(List<CodeableReference> theReason) { 
1215      this.reason = theReason;
1216      return this;
1217    }
1218
1219    public boolean hasReason() { 
1220      if (this.reason == null)
1221        return false;
1222      for (CodeableReference item : this.reason)
1223        if (!item.isEmpty())
1224          return true;
1225      return false;
1226    }
1227
1228    public CodeableReference addReason() { //3
1229      CodeableReference t = new CodeableReference();
1230      if (this.reason == null)
1231        this.reason = new ArrayList<CodeableReference>();
1232      this.reason.add(t);
1233      return t;
1234    }
1235
1236    public Appointment addReason(CodeableReference t) { //3
1237      if (t == null)
1238        return this;
1239      if (this.reason == null)
1240        this.reason = new ArrayList<CodeableReference>();
1241      this.reason.add(t);
1242      return this;
1243    }
1244
1245    /**
1246     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
1247     */
1248    public CodeableReference getReasonFirstRep() { 
1249      if (getReason().isEmpty()) {
1250        addReason();
1251      }
1252      return getReason().get(0);
1253    }
1254
1255    /**
1256     * @return {@link #priority} (The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).)
1257     */
1258    public CodeableConcept getPriority() { 
1259      if (this.priority == null)
1260        if (Configuration.errorOnAutoCreate())
1261          throw new Error("Attempt to auto-create Appointment.priority");
1262        else if (Configuration.doAutoCreate())
1263          this.priority = new CodeableConcept(); // cc
1264      return this.priority;
1265    }
1266
1267    public boolean hasPriority() { 
1268      return this.priority != null && !this.priority.isEmpty();
1269    }
1270
1271    /**
1272     * @param value {@link #priority} (The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).)
1273     */
1274    public Appointment setPriority(CodeableConcept value) { 
1275      this.priority = value;
1276      return this;
1277    }
1278
1279    /**
1280     * @return {@link #description} (The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1281     */
1282    public StringType getDescriptionElement() { 
1283      if (this.description == null)
1284        if (Configuration.errorOnAutoCreate())
1285          throw new Error("Attempt to auto-create Appointment.description");
1286        else if (Configuration.doAutoCreate())
1287          this.description = new StringType(); // bb
1288      return this.description;
1289    }
1290
1291    public boolean hasDescriptionElement() { 
1292      return this.description != null && !this.description.isEmpty();
1293    }
1294
1295    public boolean hasDescription() { 
1296      return this.description != null && !this.description.isEmpty();
1297    }
1298
1299    /**
1300     * @param value {@link #description} (The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1301     */
1302    public Appointment setDescriptionElement(StringType value) { 
1303      this.description = value;
1304      return this;
1305    }
1306
1307    /**
1308     * @return The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.
1309     */
1310    public String getDescription() { 
1311      return this.description == null ? null : this.description.getValue();
1312    }
1313
1314    /**
1315     * @param value The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.
1316     */
1317    public Appointment setDescription(String value) { 
1318      if (Utilities.noString(value))
1319        this.description = null;
1320      else {
1321        if (this.description == null)
1322          this.description = new StringType();
1323        this.description.setValue(value);
1324      }
1325      return this;
1326    }
1327
1328    /**
1329     * @return {@link #replaces} (Appointment replaced by this Appointment in cases where there is a cancellation, the details of the cancellation can be found in the cancellationReason property (on the referenced resource).)
1330     */
1331    public List<Reference> getReplaces() { 
1332      if (this.replaces == null)
1333        this.replaces = new ArrayList<Reference>();
1334      return this.replaces;
1335    }
1336
1337    /**
1338     * @return Returns a reference to <code>this</code> for easy method chaining
1339     */
1340    public Appointment setReplaces(List<Reference> theReplaces) { 
1341      this.replaces = theReplaces;
1342      return this;
1343    }
1344
1345    public boolean hasReplaces() { 
1346      if (this.replaces == null)
1347        return false;
1348      for (Reference item : this.replaces)
1349        if (!item.isEmpty())
1350          return true;
1351      return false;
1352    }
1353
1354    public Reference addReplaces() { //3
1355      Reference t = new Reference();
1356      if (this.replaces == null)
1357        this.replaces = new ArrayList<Reference>();
1358      this.replaces.add(t);
1359      return t;
1360    }
1361
1362    public Appointment addReplaces(Reference t) { //3
1363      if (t == null)
1364        return this;
1365      if (this.replaces == null)
1366        this.replaces = new ArrayList<Reference>();
1367      this.replaces.add(t);
1368      return this;
1369    }
1370
1371    /**
1372     * @return The first repetition of repeating field {@link #replaces}, creating it if it does not already exist {3}
1373     */
1374    public Reference getReplacesFirstRep() { 
1375      if (getReplaces().isEmpty()) {
1376        addReplaces();
1377      }
1378      return getReplaces().get(0);
1379    }
1380
1381    /**
1382     * @return {@link #supportingInformation} (Additional information to support the appointment provided when making the appointment.)
1383     */
1384    public List<Reference> getSupportingInformation() { 
1385      if (this.supportingInformation == null)
1386        this.supportingInformation = new ArrayList<Reference>();
1387      return this.supportingInformation;
1388    }
1389
1390    /**
1391     * @return Returns a reference to <code>this</code> for easy method chaining
1392     */
1393    public Appointment setSupportingInformation(List<Reference> theSupportingInformation) { 
1394      this.supportingInformation = theSupportingInformation;
1395      return this;
1396    }
1397
1398    public boolean hasSupportingInformation() { 
1399      if (this.supportingInformation == null)
1400        return false;
1401      for (Reference item : this.supportingInformation)
1402        if (!item.isEmpty())
1403          return true;
1404      return false;
1405    }
1406
1407    public Reference addSupportingInformation() { //3
1408      Reference t = new Reference();
1409      if (this.supportingInformation == null)
1410        this.supportingInformation = new ArrayList<Reference>();
1411      this.supportingInformation.add(t);
1412      return t;
1413    }
1414
1415    public Appointment addSupportingInformation(Reference t) { //3
1416      if (t == null)
1417        return this;
1418      if (this.supportingInformation == null)
1419        this.supportingInformation = new ArrayList<Reference>();
1420      this.supportingInformation.add(t);
1421      return this;
1422    }
1423
1424    /**
1425     * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist {3}
1426     */
1427    public Reference getSupportingInformationFirstRep() { 
1428      if (getSupportingInformation().isEmpty()) {
1429        addSupportingInformation();
1430      }
1431      return getSupportingInformation().get(0);
1432    }
1433
1434    /**
1435     * @return {@link #start} (Date/Time that the appointment is to take place.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
1436     */
1437    public InstantType getStartElement() { 
1438      if (this.start == null)
1439        if (Configuration.errorOnAutoCreate())
1440          throw new Error("Attempt to auto-create Appointment.start");
1441        else if (Configuration.doAutoCreate())
1442          this.start = new InstantType(); // bb
1443      return this.start;
1444    }
1445
1446    public boolean hasStartElement() { 
1447      return this.start != null && !this.start.isEmpty();
1448    }
1449
1450    public boolean hasStart() { 
1451      return this.start != null && !this.start.isEmpty();
1452    }
1453
1454    /**
1455     * @param value {@link #start} (Date/Time that the appointment is to take place.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
1456     */
1457    public Appointment setStartElement(InstantType value) { 
1458      this.start = value;
1459      return this;
1460    }
1461
1462    /**
1463     * @return Date/Time that the appointment is to take place.
1464     */
1465    public Date getStart() { 
1466      return this.start == null ? null : this.start.getValue();
1467    }
1468
1469    /**
1470     * @param value Date/Time that the appointment is to take place.
1471     */
1472    public Appointment setStart(Date value) { 
1473      if (value == null)
1474        this.start = null;
1475      else {
1476        if (this.start == null)
1477          this.start = new InstantType();
1478        this.start.setValue(value);
1479      }
1480      return this;
1481    }
1482
1483    /**
1484     * @return {@link #end} (Date/Time that the appointment is to conclude.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
1485     */
1486    public InstantType getEndElement() { 
1487      if (this.end == null)
1488        if (Configuration.errorOnAutoCreate())
1489          throw new Error("Attempt to auto-create Appointment.end");
1490        else if (Configuration.doAutoCreate())
1491          this.end = new InstantType(); // bb
1492      return this.end;
1493    }
1494
1495    public boolean hasEndElement() { 
1496      return this.end != null && !this.end.isEmpty();
1497    }
1498
1499    public boolean hasEnd() { 
1500      return this.end != null && !this.end.isEmpty();
1501    }
1502
1503    /**
1504     * @param value {@link #end} (Date/Time that the appointment is to conclude.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
1505     */
1506    public Appointment setEndElement(InstantType value) { 
1507      this.end = value;
1508      return this;
1509    }
1510
1511    /**
1512     * @return Date/Time that the appointment is to conclude.
1513     */
1514    public Date getEnd() { 
1515      return this.end == null ? null : this.end.getValue();
1516    }
1517
1518    /**
1519     * @param value Date/Time that the appointment is to conclude.
1520     */
1521    public Appointment setEnd(Date value) { 
1522      if (value == null)
1523        this.end = null;
1524      else {
1525        if (this.end == null)
1526          this.end = new InstantType();
1527        this.end.setValue(value);
1528      }
1529      return this;
1530    }
1531
1532    /**
1533     * @return {@link #minutesDuration} (Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
1534     */
1535    public PositiveIntType getMinutesDurationElement() { 
1536      if (this.minutesDuration == null)
1537        if (Configuration.errorOnAutoCreate())
1538          throw new Error("Attempt to auto-create Appointment.minutesDuration");
1539        else if (Configuration.doAutoCreate())
1540          this.minutesDuration = new PositiveIntType(); // bb
1541      return this.minutesDuration;
1542    }
1543
1544    public boolean hasMinutesDurationElement() { 
1545      return this.minutesDuration != null && !this.minutesDuration.isEmpty();
1546    }
1547
1548    public boolean hasMinutesDuration() { 
1549      return this.minutesDuration != null && !this.minutesDuration.isEmpty();
1550    }
1551
1552    /**
1553     * @param value {@link #minutesDuration} (Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value
1554     */
1555    public Appointment setMinutesDurationElement(PositiveIntType value) { 
1556      this.minutesDuration = value;
1557      return this;
1558    }
1559
1560    /**
1561     * @return Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.
1562     */
1563    public int getMinutesDuration() { 
1564      return this.minutesDuration == null || this.minutesDuration.isEmpty() ? 0 : this.minutesDuration.getValue();
1565    }
1566
1567    /**
1568     * @param value Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.
1569     */
1570    public Appointment setMinutesDuration(int value) { 
1571        if (this.minutesDuration == null)
1572          this.minutesDuration = new PositiveIntType();
1573        this.minutesDuration.setValue(value);
1574      return this;
1575    }
1576
1577    /**
1578     * @return {@link #slot} (The slots from the participants' schedules that will be filled by the appointment.)
1579     */
1580    public List<Reference> getSlot() { 
1581      if (this.slot == null)
1582        this.slot = new ArrayList<Reference>();
1583      return this.slot;
1584    }
1585
1586    /**
1587     * @return Returns a reference to <code>this</code> for easy method chaining
1588     */
1589    public Appointment setSlot(List<Reference> theSlot) { 
1590      this.slot = theSlot;
1591      return this;
1592    }
1593
1594    public boolean hasSlot() { 
1595      if (this.slot == null)
1596        return false;
1597      for (Reference item : this.slot)
1598        if (!item.isEmpty())
1599          return true;
1600      return false;
1601    }
1602
1603    public Reference addSlot() { //3
1604      Reference t = new Reference();
1605      if (this.slot == null)
1606        this.slot = new ArrayList<Reference>();
1607      this.slot.add(t);
1608      return t;
1609    }
1610
1611    public Appointment addSlot(Reference t) { //3
1612      if (t == null)
1613        return this;
1614      if (this.slot == null)
1615        this.slot = new ArrayList<Reference>();
1616      this.slot.add(t);
1617      return this;
1618    }
1619
1620    /**
1621     * @return The first repetition of repeating field {@link #slot}, creating it if it does not already exist {3}
1622     */
1623    public Reference getSlotFirstRep() { 
1624      if (getSlot().isEmpty()) {
1625        addSlot();
1626      }
1627      return getSlot().get(0);
1628    }
1629
1630    /**
1631     * @return {@link #account} (The set of accounts that is expected to be used for billing the activities that result from this Appointment.)
1632     */
1633    public List<Reference> getAccount() { 
1634      if (this.account == null)
1635        this.account = new ArrayList<Reference>();
1636      return this.account;
1637    }
1638
1639    /**
1640     * @return Returns a reference to <code>this</code> for easy method chaining
1641     */
1642    public Appointment setAccount(List<Reference> theAccount) { 
1643      this.account = theAccount;
1644      return this;
1645    }
1646
1647    public boolean hasAccount() { 
1648      if (this.account == null)
1649        return false;
1650      for (Reference item : this.account)
1651        if (!item.isEmpty())
1652          return true;
1653      return false;
1654    }
1655
1656    public Reference addAccount() { //3
1657      Reference t = new Reference();
1658      if (this.account == null)
1659        this.account = new ArrayList<Reference>();
1660      this.account.add(t);
1661      return t;
1662    }
1663
1664    public Appointment addAccount(Reference t) { //3
1665      if (t == null)
1666        return this;
1667      if (this.account == null)
1668        this.account = new ArrayList<Reference>();
1669      this.account.add(t);
1670      return this;
1671    }
1672
1673    /**
1674     * @return The first repetition of repeating field {@link #account}, creating it if it does not already exist {3}
1675     */
1676    public Reference getAccountFirstRep() { 
1677      if (getAccount().isEmpty()) {
1678        addAccount();
1679      }
1680      return getAccount().get(0);
1681    }
1682
1683    /**
1684     * @return {@link #created} (The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1685     */
1686    public DateTimeType getCreatedElement() { 
1687      if (this.created == null)
1688        if (Configuration.errorOnAutoCreate())
1689          throw new Error("Attempt to auto-create Appointment.created");
1690        else if (Configuration.doAutoCreate())
1691          this.created = new DateTimeType(); // bb
1692      return this.created;
1693    }
1694
1695    public boolean hasCreatedElement() { 
1696      return this.created != null && !this.created.isEmpty();
1697    }
1698
1699    public boolean hasCreated() { 
1700      return this.created != null && !this.created.isEmpty();
1701    }
1702
1703    /**
1704     * @param value {@link #created} (The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1705     */
1706    public Appointment setCreatedElement(DateTimeType value) { 
1707      this.created = value;
1708      return this;
1709    }
1710
1711    /**
1712     * @return The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.
1713     */
1714    public Date getCreated() { 
1715      return this.created == null ? null : this.created.getValue();
1716    }
1717
1718    /**
1719     * @param value The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.
1720     */
1721    public Appointment setCreated(Date value) { 
1722      if (value == null)
1723        this.created = null;
1724      else {
1725        if (this.created == null)
1726          this.created = new DateTimeType();
1727        this.created.setValue(value);
1728      }
1729      return this;
1730    }
1731
1732    /**
1733     * @return {@link #note} (Additional notes/comments about the appointment.)
1734     */
1735    public List<Annotation> getNote() { 
1736      if (this.note == null)
1737        this.note = new ArrayList<Annotation>();
1738      return this.note;
1739    }
1740
1741    /**
1742     * @return Returns a reference to <code>this</code> for easy method chaining
1743     */
1744    public Appointment setNote(List<Annotation> theNote) { 
1745      this.note = theNote;
1746      return this;
1747    }
1748
1749    public boolean hasNote() { 
1750      if (this.note == null)
1751        return false;
1752      for (Annotation item : this.note)
1753        if (!item.isEmpty())
1754          return true;
1755      return false;
1756    }
1757
1758    public Annotation addNote() { //3
1759      Annotation t = new Annotation();
1760      if (this.note == null)
1761        this.note = new ArrayList<Annotation>();
1762      this.note.add(t);
1763      return t;
1764    }
1765
1766    public Appointment addNote(Annotation t) { //3
1767      if (t == null)
1768        return this;
1769      if (this.note == null)
1770        this.note = new ArrayList<Annotation>();
1771      this.note.add(t);
1772      return this;
1773    }
1774
1775    /**
1776     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1777     */
1778    public Annotation getNoteFirstRep() { 
1779      if (getNote().isEmpty()) {
1780        addNote();
1781      }
1782      return getNote().get(0);
1783    }
1784
1785    /**
1786     * @return {@link #patientInstruction} (While Appointment.note contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).)
1787     */
1788    public List<CodeableReference> getPatientInstruction() { 
1789      if (this.patientInstruction == null)
1790        this.patientInstruction = new ArrayList<CodeableReference>();
1791      return this.patientInstruction;
1792    }
1793
1794    /**
1795     * @return Returns a reference to <code>this</code> for easy method chaining
1796     */
1797    public Appointment setPatientInstruction(List<CodeableReference> thePatientInstruction) { 
1798      this.patientInstruction = thePatientInstruction;
1799      return this;
1800    }
1801
1802    public boolean hasPatientInstruction() { 
1803      if (this.patientInstruction == null)
1804        return false;
1805      for (CodeableReference item : this.patientInstruction)
1806        if (!item.isEmpty())
1807          return true;
1808      return false;
1809    }
1810
1811    public CodeableReference addPatientInstruction() { //3
1812      CodeableReference t = new CodeableReference();
1813      if (this.patientInstruction == null)
1814        this.patientInstruction = new ArrayList<CodeableReference>();
1815      this.patientInstruction.add(t);
1816      return t;
1817    }
1818
1819    public Appointment addPatientInstruction(CodeableReference t) { //3
1820      if (t == null)
1821        return this;
1822      if (this.patientInstruction == null)
1823        this.patientInstruction = new ArrayList<CodeableReference>();
1824      this.patientInstruction.add(t);
1825      return this;
1826    }
1827
1828    /**
1829     * @return The first repetition of repeating field {@link #patientInstruction}, creating it if it does not already exist {3}
1830     */
1831    public CodeableReference getPatientInstructionFirstRep() { 
1832      if (getPatientInstruction().isEmpty()) {
1833        addPatientInstruction();
1834      }
1835      return getPatientInstruction().get(0);
1836    }
1837
1838    /**
1839     * @return {@link #basedOn} (The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).)
1840     */
1841    public List<Reference> getBasedOn() { 
1842      if (this.basedOn == null)
1843        this.basedOn = new ArrayList<Reference>();
1844      return this.basedOn;
1845    }
1846
1847    /**
1848     * @return Returns a reference to <code>this</code> for easy method chaining
1849     */
1850    public Appointment setBasedOn(List<Reference> theBasedOn) { 
1851      this.basedOn = theBasedOn;
1852      return this;
1853    }
1854
1855    public boolean hasBasedOn() { 
1856      if (this.basedOn == null)
1857        return false;
1858      for (Reference item : this.basedOn)
1859        if (!item.isEmpty())
1860          return true;
1861      return false;
1862    }
1863
1864    public Reference addBasedOn() { //3
1865      Reference t = new Reference();
1866      if (this.basedOn == null)
1867        this.basedOn = new ArrayList<Reference>();
1868      this.basedOn.add(t);
1869      return t;
1870    }
1871
1872    public Appointment addBasedOn(Reference t) { //3
1873      if (t == null)
1874        return this;
1875      if (this.basedOn == null)
1876        this.basedOn = new ArrayList<Reference>();
1877      this.basedOn.add(t);
1878      return this;
1879    }
1880
1881    /**
1882     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
1883     */
1884    public Reference getBasedOnFirstRep() { 
1885      if (getBasedOn().isEmpty()) {
1886        addBasedOn();
1887      }
1888      return getBasedOn().get(0);
1889    }
1890
1891    /**
1892     * @return {@link #subject} (The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element.)
1893     */
1894    public Reference getSubject() { 
1895      if (this.subject == null)
1896        if (Configuration.errorOnAutoCreate())
1897          throw new Error("Attempt to auto-create Appointment.subject");
1898        else if (Configuration.doAutoCreate())
1899          this.subject = new Reference(); // cc
1900      return this.subject;
1901    }
1902
1903    public boolean hasSubject() { 
1904      return this.subject != null && !this.subject.isEmpty();
1905    }
1906
1907    /**
1908     * @param value {@link #subject} (The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element.)
1909     */
1910    public Appointment setSubject(Reference value) { 
1911      this.subject = value;
1912      return this;
1913    }
1914
1915    /**
1916     * @return {@link #participant} (List of participants involved in the appointment.)
1917     */
1918    public List<AppointmentParticipantComponent> getParticipant() { 
1919      if (this.participant == null)
1920        this.participant = new ArrayList<AppointmentParticipantComponent>();
1921      return this.participant;
1922    }
1923
1924    /**
1925     * @return Returns a reference to <code>this</code> for easy method chaining
1926     */
1927    public Appointment setParticipant(List<AppointmentParticipantComponent> theParticipant) { 
1928      this.participant = theParticipant;
1929      return this;
1930    }
1931
1932    public boolean hasParticipant() { 
1933      if (this.participant == null)
1934        return false;
1935      for (AppointmentParticipantComponent item : this.participant)
1936        if (!item.isEmpty())
1937          return true;
1938      return false;
1939    }
1940
1941    public AppointmentParticipantComponent addParticipant() { //3
1942      AppointmentParticipantComponent t = new AppointmentParticipantComponent();
1943      if (this.participant == null)
1944        this.participant = new ArrayList<AppointmentParticipantComponent>();
1945      this.participant.add(t);
1946      return t;
1947    }
1948
1949    public Appointment addParticipant(AppointmentParticipantComponent t) { //3
1950      if (t == null)
1951        return this;
1952      if (this.participant == null)
1953        this.participant = new ArrayList<AppointmentParticipantComponent>();
1954      this.participant.add(t);
1955      return this;
1956    }
1957
1958    /**
1959     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist {3}
1960     */
1961    public AppointmentParticipantComponent getParticipantFirstRep() { 
1962      if (getParticipant().isEmpty()) {
1963        addParticipant();
1964      }
1965      return getParticipant().get(0);
1966    }
1967
1968    /**
1969     * @return {@link #requestedPeriod} (A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.
1970
1971The duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.)
1972     */
1973    public List<Period> getRequestedPeriod() { 
1974      if (this.requestedPeriod == null)
1975        this.requestedPeriod = new ArrayList<Period>();
1976      return this.requestedPeriod;
1977    }
1978
1979    /**
1980     * @return Returns a reference to <code>this</code> for easy method chaining
1981     */
1982    public Appointment setRequestedPeriod(List<Period> theRequestedPeriod) { 
1983      this.requestedPeriod = theRequestedPeriod;
1984      return this;
1985    }
1986
1987    public boolean hasRequestedPeriod() { 
1988      if (this.requestedPeriod == null)
1989        return false;
1990      for (Period item : this.requestedPeriod)
1991        if (!item.isEmpty())
1992          return true;
1993      return false;
1994    }
1995
1996    public Period addRequestedPeriod() { //3
1997      Period t = new Period();
1998      if (this.requestedPeriod == null)
1999        this.requestedPeriod = new ArrayList<Period>();
2000      this.requestedPeriod.add(t);
2001      return t;
2002    }
2003
2004    public Appointment addRequestedPeriod(Period t) { //3
2005      if (t == null)
2006        return this;
2007      if (this.requestedPeriod == null)
2008        this.requestedPeriod = new ArrayList<Period>();
2009      this.requestedPeriod.add(t);
2010      return this;
2011    }
2012
2013    /**
2014     * @return The first repetition of repeating field {@link #requestedPeriod}, creating it if it does not already exist {3}
2015     */
2016    public Period getRequestedPeriodFirstRep() { 
2017      if (getRequestedPeriod().isEmpty()) {
2018        addRequestedPeriod();
2019      }
2020      return getRequestedPeriod().get(0);
2021    }
2022
2023      protected void listChildren(List<Property> children) {
2024        super.listChildren(children);
2025        children.add(new Property("identifier", "Identifier", "This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
2026        children.add(new Property("status", "code", "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.", 0, 1, status));
2027        children.add(new Property("cancellationReason", "CodeableConcept", "The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.", 0, 1, cancellationReason));
2028        children.add(new Property("serviceCategory", "CodeableConcept", "A broad categorization of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory));
2029        children.add(new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType));
2030        children.add(new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty));
2031        children.add(new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1, appointmentType));
2032        children.add(new Property("reason", "CodeableReference(Condition|Procedure|Observation|ImmunizationRecommendation)", "The reason that this appointment is being scheduled. This is more clinical than administrative. This can be coded, or as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.", 0, java.lang.Integer.MAX_VALUE, reason));
2033        children.add(new Property("priority", "CodeableConcept", "The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).", 0, 1, priority));
2034        children.add(new Property("description", "string", "The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.", 0, 1, description));
2035        children.add(new Property("replaces", "Reference(Appointment)", "Appointment replaced by this Appointment in cases where there is a cancellation, the details of the cancellation can be found in the cancellationReason property (on the referenced resource).", 0, java.lang.Integer.MAX_VALUE, replaces));
2036        children.add(new Property("supportingInformation", "Reference(Any)", "Additional information to support the appointment provided when making the appointment.", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
2037        children.add(new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start));
2038        children.add(new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end));
2039        children.add(new Property("minutesDuration", "positiveInt", "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.", 0, 1, minutesDuration));
2040        children.add(new Property("slot", "Reference(Slot)", "The slots from the participants' schedules that will be filled by the appointment.", 0, java.lang.Integer.MAX_VALUE, slot));
2041        children.add(new Property("account", "Reference(Account)", "The set of accounts that is expected to be used for billing the activities that result from this Appointment.", 0, java.lang.Integer.MAX_VALUE, account));
2042        children.add(new Property("created", "dateTime", "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.", 0, 1, created));
2043        children.add(new Property("note", "Annotation", "Additional notes/comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, note));
2044        children.add(new Property("patientInstruction", "CodeableReference(DocumentReference|Binary|Communication)", "While Appointment.note contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).", 0, java.lang.Integer.MAX_VALUE, patientInstruction));
2045        children.add(new Property("basedOn", "Reference(ServiceRequest)", "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).", 0, java.lang.Integer.MAX_VALUE, basedOn));
2046        children.add(new Property("subject", "Reference(Patient|Group)", "The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element.", 0, 1, subject));
2047        children.add(new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant));
2048        children.add(new Property("requestedPeriod", "Period", "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.\n\nThe duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.", 0, java.lang.Integer.MAX_VALUE, requestedPeriod));
2049      }
2050
2051      @Override
2052      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2053        switch (_hash) {
2054        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier);
2055        case -892481550: /*status*/  return new Property("status", "code", "The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.", 0, 1, status);
2056        case 2135095591: /*cancellationReason*/  return new Property("cancellationReason", "CodeableConcept", "The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.", 0, 1, cancellationReason);
2057        case 1281188563: /*serviceCategory*/  return new Property("serviceCategory", "CodeableConcept", "A broad categorization of the service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceCategory);
2058        case -1928370289: /*serviceType*/  return new Property("serviceType", "CodeableConcept", "The specific service that is to be performed during this appointment.", 0, java.lang.Integer.MAX_VALUE, serviceType);
2059        case -1694759682: /*specialty*/  return new Property("specialty", "CodeableConcept", "The specialty of a practitioner that would be required to perform the service requested in this appointment.", 0, java.lang.Integer.MAX_VALUE, specialty);
2060        case -1596426375: /*appointmentType*/  return new Property("appointmentType", "CodeableConcept", "The style of appointment or patient that has been booked in the slot (not service type).", 0, 1, appointmentType);
2061        case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Procedure|Observation|ImmunizationRecommendation)", "The reason that this appointment is being scheduled. This is more clinical than administrative. This can be coded, or as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.", 0, java.lang.Integer.MAX_VALUE, reason);
2062        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).", 0, 1, priority);
2063        case -1724546052: /*description*/  return new Property("description", "string", "The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.", 0, 1, description);
2064        case -430332865: /*replaces*/  return new Property("replaces", "Reference(Appointment)", "Appointment replaced by this Appointment in cases where there is a cancellation, the details of the cancellation can be found in the cancellationReason property (on the referenced resource).", 0, java.lang.Integer.MAX_VALUE, replaces);
2065        case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "Reference(Any)", "Additional information to support the appointment provided when making the appointment.", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
2066        case 109757538: /*start*/  return new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, 1, start);
2067        case 100571: /*end*/  return new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, 1, end);
2068        case -413630573: /*minutesDuration*/  return new Property("minutesDuration", "positiveInt", "Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.", 0, 1, minutesDuration);
2069        case 3533310: /*slot*/  return new Property("slot", "Reference(Slot)", "The slots from the participants' schedules that will be filled by the appointment.", 0, java.lang.Integer.MAX_VALUE, slot);
2070        case -1177318867: /*account*/  return new Property("account", "Reference(Account)", "The set of accounts that is expected to be used for billing the activities that result from this Appointment.", 0, java.lang.Integer.MAX_VALUE, account);
2071        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.", 0, 1, created);
2072        case 3387378: /*note*/  return new Property("note", "Annotation", "Additional notes/comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, note);
2073        case 737543241: /*patientInstruction*/  return new Property("patientInstruction", "CodeableReference(DocumentReference|Binary|Communication)", "While Appointment.note contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).", 0, java.lang.Integer.MAX_VALUE, patientInstruction);
2074        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(ServiceRequest)", "The service request this appointment is allocated to assess (e.g. incoming referral or procedure request).", 0, java.lang.Integer.MAX_VALUE, basedOn);
2075        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element.", 0, 1, subject);
2076        case 767422259: /*participant*/  return new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant);
2077        case -897241393: /*requestedPeriod*/  return new Property("requestedPeriod", "Period", "A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within.\n\nThe duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.", 0, java.lang.Integer.MAX_VALUE, requestedPeriod);
2078        default: return super.getNamedProperty(_hash, _name, _checkValid);
2079        }
2080
2081      }
2082
2083      @Override
2084      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2085        switch (hash) {
2086        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2087        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AppointmentStatus>
2088        case 2135095591: /*cancellationReason*/ return this.cancellationReason == null ? new Base[0] : new Base[] {this.cancellationReason}; // CodeableConcept
2089        case 1281188563: /*serviceCategory*/ return this.serviceCategory == null ? new Base[0] : this.serviceCategory.toArray(new Base[this.serviceCategory.size()]); // CodeableConcept
2090        case -1928370289: /*serviceType*/ return this.serviceType == null ? new Base[0] : this.serviceType.toArray(new Base[this.serviceType.size()]); // CodeableConcept
2091        case -1694759682: /*specialty*/ return this.specialty == null ? new Base[0] : this.specialty.toArray(new Base[this.specialty.size()]); // CodeableConcept
2092        case -1596426375: /*appointmentType*/ return this.appointmentType == null ? new Base[0] : new Base[] {this.appointmentType}; // CodeableConcept
2093        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
2094        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
2095        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2096        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
2097        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
2098        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // InstantType
2099        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
2100        case -413630573: /*minutesDuration*/ return this.minutesDuration == null ? new Base[0] : new Base[] {this.minutesDuration}; // PositiveIntType
2101        case 3533310: /*slot*/ return this.slot == null ? new Base[0] : this.slot.toArray(new Base[this.slot.size()]); // Reference
2102        case -1177318867: /*account*/ return this.account == null ? new Base[0] : this.account.toArray(new Base[this.account.size()]); // Reference
2103        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
2104        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2105        case 737543241: /*patientInstruction*/ return this.patientInstruction == null ? new Base[0] : this.patientInstruction.toArray(new Base[this.patientInstruction.size()]); // CodeableReference
2106        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2107        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2108        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AppointmentParticipantComponent
2109        case -897241393: /*requestedPeriod*/ return this.requestedPeriod == null ? new Base[0] : this.requestedPeriod.toArray(new Base[this.requestedPeriod.size()]); // Period
2110        default: return super.getProperty(hash, name, checkValid);
2111        }
2112
2113      }
2114
2115      @Override
2116      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2117        switch (hash) {
2118        case -1618432855: // identifier
2119          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2120          return value;
2121        case -892481550: // status
2122          value = new AppointmentStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2123          this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
2124          return value;
2125        case 2135095591: // cancellationReason
2126          this.cancellationReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2127          return value;
2128        case 1281188563: // serviceCategory
2129          this.getServiceCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2130          return value;
2131        case -1928370289: // serviceType
2132          this.getServiceType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2133          return value;
2134        case -1694759682: // specialty
2135          this.getSpecialty().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2136          return value;
2137        case -1596426375: // appointmentType
2138          this.appointmentType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2139          return value;
2140        case -934964668: // reason
2141          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
2142          return value;
2143        case -1165461084: // priority
2144          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2145          return value;
2146        case -1724546052: // description
2147          this.description = TypeConvertor.castToString(value); // StringType
2148          return value;
2149        case -430332865: // replaces
2150          this.getReplaces().add(TypeConvertor.castToReference(value)); // Reference
2151          return value;
2152        case -1248768647: // supportingInformation
2153          this.getSupportingInformation().add(TypeConvertor.castToReference(value)); // Reference
2154          return value;
2155        case 109757538: // start
2156          this.start = TypeConvertor.castToInstant(value); // InstantType
2157          return value;
2158        case 100571: // end
2159          this.end = TypeConvertor.castToInstant(value); // InstantType
2160          return value;
2161        case -413630573: // minutesDuration
2162          this.minutesDuration = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2163          return value;
2164        case 3533310: // slot
2165          this.getSlot().add(TypeConvertor.castToReference(value)); // Reference
2166          return value;
2167        case -1177318867: // account
2168          this.getAccount().add(TypeConvertor.castToReference(value)); // Reference
2169          return value;
2170        case 1028554472: // created
2171          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
2172          return value;
2173        case 3387378: // note
2174          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
2175          return value;
2176        case 737543241: // patientInstruction
2177          this.getPatientInstruction().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
2178          return value;
2179        case -332612366: // basedOn
2180          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
2181          return value;
2182        case -1867885268: // subject
2183          this.subject = TypeConvertor.castToReference(value); // Reference
2184          return value;
2185        case 767422259: // participant
2186          this.getParticipant().add((AppointmentParticipantComponent) value); // AppointmentParticipantComponent
2187          return value;
2188        case -897241393: // requestedPeriod
2189          this.getRequestedPeriod().add(TypeConvertor.castToPeriod(value)); // Period
2190          return value;
2191        default: return super.setProperty(hash, name, value);
2192        }
2193
2194      }
2195
2196      @Override
2197      public Base setProperty(String name, Base value) throws FHIRException {
2198        if (name.equals("identifier")) {
2199          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2200        } else if (name.equals("status")) {
2201          value = new AppointmentStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2202          this.status = (Enumeration) value; // Enumeration<AppointmentStatus>
2203        } else if (name.equals("cancellationReason")) {
2204          this.cancellationReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2205        } else if (name.equals("serviceCategory")) {
2206          this.getServiceCategory().add(TypeConvertor.castToCodeableConcept(value));
2207        } else if (name.equals("serviceType")) {
2208          this.getServiceType().add(TypeConvertor.castToCodeableConcept(value));
2209        } else if (name.equals("specialty")) {
2210          this.getSpecialty().add(TypeConvertor.castToCodeableConcept(value));
2211        } else if (name.equals("appointmentType")) {
2212          this.appointmentType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2213        } else if (name.equals("reason")) {
2214          this.getReason().add(TypeConvertor.castToCodeableReference(value));
2215        } else if (name.equals("priority")) {
2216          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2217        } else if (name.equals("description")) {
2218          this.description = TypeConvertor.castToString(value); // StringType
2219        } else if (name.equals("replaces")) {
2220          this.getReplaces().add(TypeConvertor.castToReference(value));
2221        } else if (name.equals("supportingInformation")) {
2222          this.getSupportingInformation().add(TypeConvertor.castToReference(value));
2223        } else if (name.equals("start")) {
2224          this.start = TypeConvertor.castToInstant(value); // InstantType
2225        } else if (name.equals("end")) {
2226          this.end = TypeConvertor.castToInstant(value); // InstantType
2227        } else if (name.equals("minutesDuration")) {
2228          this.minutesDuration = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2229        } else if (name.equals("slot")) {
2230          this.getSlot().add(TypeConvertor.castToReference(value));
2231        } else if (name.equals("account")) {
2232          this.getAccount().add(TypeConvertor.castToReference(value));
2233        } else if (name.equals("created")) {
2234          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
2235        } else if (name.equals("note")) {
2236          this.getNote().add(TypeConvertor.castToAnnotation(value));
2237        } else if (name.equals("patientInstruction")) {
2238          this.getPatientInstruction().add(TypeConvertor.castToCodeableReference(value));
2239        } else if (name.equals("basedOn")) {
2240          this.getBasedOn().add(TypeConvertor.castToReference(value));
2241        } else if (name.equals("subject")) {
2242          this.subject = TypeConvertor.castToReference(value); // Reference
2243        } else if (name.equals("participant")) {
2244          this.getParticipant().add((AppointmentParticipantComponent) value);
2245        } else if (name.equals("requestedPeriod")) {
2246          this.getRequestedPeriod().add(TypeConvertor.castToPeriod(value));
2247        } else
2248          return super.setProperty(name, value);
2249        return value;
2250      }
2251
2252      @Override
2253      public Base makeProperty(int hash, String name) throws FHIRException {
2254        switch (hash) {
2255        case -1618432855:  return addIdentifier(); 
2256        case -892481550:  return getStatusElement();
2257        case 2135095591:  return getCancellationReason();
2258        case 1281188563:  return addServiceCategory(); 
2259        case -1928370289:  return addServiceType(); 
2260        case -1694759682:  return addSpecialty(); 
2261        case -1596426375:  return getAppointmentType();
2262        case -934964668:  return addReason(); 
2263        case -1165461084:  return getPriority();
2264        case -1724546052:  return getDescriptionElement();
2265        case -430332865:  return addReplaces(); 
2266        case -1248768647:  return addSupportingInformation(); 
2267        case 109757538:  return getStartElement();
2268        case 100571:  return getEndElement();
2269        case -413630573:  return getMinutesDurationElement();
2270        case 3533310:  return addSlot(); 
2271        case -1177318867:  return addAccount(); 
2272        case 1028554472:  return getCreatedElement();
2273        case 3387378:  return addNote(); 
2274        case 737543241:  return addPatientInstruction(); 
2275        case -332612366:  return addBasedOn(); 
2276        case -1867885268:  return getSubject();
2277        case 767422259:  return addParticipant(); 
2278        case -897241393:  return addRequestedPeriod(); 
2279        default: return super.makeProperty(hash, name);
2280        }
2281
2282      }
2283
2284      @Override
2285      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2286        switch (hash) {
2287        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2288        case -892481550: /*status*/ return new String[] {"code"};
2289        case 2135095591: /*cancellationReason*/ return new String[] {"CodeableConcept"};
2290        case 1281188563: /*serviceCategory*/ return new String[] {"CodeableConcept"};
2291        case -1928370289: /*serviceType*/ return new String[] {"CodeableConcept"};
2292        case -1694759682: /*specialty*/ return new String[] {"CodeableConcept"};
2293        case -1596426375: /*appointmentType*/ return new String[] {"CodeableConcept"};
2294        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
2295        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
2296        case -1724546052: /*description*/ return new String[] {"string"};
2297        case -430332865: /*replaces*/ return new String[] {"Reference"};
2298        case -1248768647: /*supportingInformation*/ return new String[] {"Reference"};
2299        case 109757538: /*start*/ return new String[] {"instant"};
2300        case 100571: /*end*/ return new String[] {"instant"};
2301        case -413630573: /*minutesDuration*/ return new String[] {"positiveInt"};
2302        case 3533310: /*slot*/ return new String[] {"Reference"};
2303        case -1177318867: /*account*/ return new String[] {"Reference"};
2304        case 1028554472: /*created*/ return new String[] {"dateTime"};
2305        case 3387378: /*note*/ return new String[] {"Annotation"};
2306        case 737543241: /*patientInstruction*/ return new String[] {"CodeableReference"};
2307        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2308        case -1867885268: /*subject*/ return new String[] {"Reference"};
2309        case 767422259: /*participant*/ return new String[] {};
2310        case -897241393: /*requestedPeriod*/ return new String[] {"Period"};
2311        default: return super.getTypesForProperty(hash, name);
2312        }
2313
2314      }
2315
2316      @Override
2317      public Base addChild(String name) throws FHIRException {
2318        if (name.equals("identifier")) {
2319          return addIdentifier();
2320        }
2321        else if (name.equals("status")) {
2322          throw new FHIRException("Cannot call addChild on a primitive type Appointment.status");
2323        }
2324        else if (name.equals("cancellationReason")) {
2325          this.cancellationReason = new CodeableConcept();
2326          return this.cancellationReason;
2327        }
2328        else if (name.equals("serviceCategory")) {
2329          return addServiceCategory();
2330        }
2331        else if (name.equals("serviceType")) {
2332          return addServiceType();
2333        }
2334        else if (name.equals("specialty")) {
2335          return addSpecialty();
2336        }
2337        else if (name.equals("appointmentType")) {
2338          this.appointmentType = new CodeableConcept();
2339          return this.appointmentType;
2340        }
2341        else if (name.equals("reason")) {
2342          return addReason();
2343        }
2344        else if (name.equals("priority")) {
2345          this.priority = new CodeableConcept();
2346          return this.priority;
2347        }
2348        else if (name.equals("description")) {
2349          throw new FHIRException("Cannot call addChild on a primitive type Appointment.description");
2350        }
2351        else if (name.equals("replaces")) {
2352          return addReplaces();
2353        }
2354        else if (name.equals("supportingInformation")) {
2355          return addSupportingInformation();
2356        }
2357        else if (name.equals("start")) {
2358          throw new FHIRException("Cannot call addChild on a primitive type Appointment.start");
2359        }
2360        else if (name.equals("end")) {
2361          throw new FHIRException("Cannot call addChild on a primitive type Appointment.end");
2362        }
2363        else if (name.equals("minutesDuration")) {
2364          throw new FHIRException("Cannot call addChild on a primitive type Appointment.minutesDuration");
2365        }
2366        else if (name.equals("slot")) {
2367          return addSlot();
2368        }
2369        else if (name.equals("account")) {
2370          return addAccount();
2371        }
2372        else if (name.equals("created")) {
2373          throw new FHIRException("Cannot call addChild on a primitive type Appointment.created");
2374        }
2375        else if (name.equals("note")) {
2376          return addNote();
2377        }
2378        else if (name.equals("patientInstruction")) {
2379          return addPatientInstruction();
2380        }
2381        else if (name.equals("basedOn")) {
2382          return addBasedOn();
2383        }
2384        else if (name.equals("subject")) {
2385          this.subject = new Reference();
2386          return this.subject;
2387        }
2388        else if (name.equals("participant")) {
2389          return addParticipant();
2390        }
2391        else if (name.equals("requestedPeriod")) {
2392          return addRequestedPeriod();
2393        }
2394        else
2395          return super.addChild(name);
2396      }
2397
2398  public String fhirType() {
2399    return "Appointment";
2400
2401  }
2402
2403      public Appointment copy() {
2404        Appointment dst = new Appointment();
2405        copyValues(dst);
2406        return dst;
2407      }
2408
2409      public void copyValues(Appointment dst) {
2410        super.copyValues(dst);
2411        if (identifier != null) {
2412          dst.identifier = new ArrayList<Identifier>();
2413          for (Identifier i : identifier)
2414            dst.identifier.add(i.copy());
2415        };
2416        dst.status = status == null ? null : status.copy();
2417        dst.cancellationReason = cancellationReason == null ? null : cancellationReason.copy();
2418        if (serviceCategory != null) {
2419          dst.serviceCategory = new ArrayList<CodeableConcept>();
2420          for (CodeableConcept i : serviceCategory)
2421            dst.serviceCategory.add(i.copy());
2422        };
2423        if (serviceType != null) {
2424          dst.serviceType = new ArrayList<CodeableConcept>();
2425          for (CodeableConcept i : serviceType)
2426            dst.serviceType.add(i.copy());
2427        };
2428        if (specialty != null) {
2429          dst.specialty = new ArrayList<CodeableConcept>();
2430          for (CodeableConcept i : specialty)
2431            dst.specialty.add(i.copy());
2432        };
2433        dst.appointmentType = appointmentType == null ? null : appointmentType.copy();
2434        if (reason != null) {
2435          dst.reason = new ArrayList<CodeableReference>();
2436          for (CodeableReference i : reason)
2437            dst.reason.add(i.copy());
2438        };
2439        dst.priority = priority == null ? null : priority.copy();
2440        dst.description = description == null ? null : description.copy();
2441        if (replaces != null) {
2442          dst.replaces = new ArrayList<Reference>();
2443          for (Reference i : replaces)
2444            dst.replaces.add(i.copy());
2445        };
2446        if (supportingInformation != null) {
2447          dst.supportingInformation = new ArrayList<Reference>();
2448          for (Reference i : supportingInformation)
2449            dst.supportingInformation.add(i.copy());
2450        };
2451        dst.start = start == null ? null : start.copy();
2452        dst.end = end == null ? null : end.copy();
2453        dst.minutesDuration = minutesDuration == null ? null : minutesDuration.copy();
2454        if (slot != null) {
2455          dst.slot = new ArrayList<Reference>();
2456          for (Reference i : slot)
2457            dst.slot.add(i.copy());
2458        };
2459        if (account != null) {
2460          dst.account = new ArrayList<Reference>();
2461          for (Reference i : account)
2462            dst.account.add(i.copy());
2463        };
2464        dst.created = created == null ? null : created.copy();
2465        if (note != null) {
2466          dst.note = new ArrayList<Annotation>();
2467          for (Annotation i : note)
2468            dst.note.add(i.copy());
2469        };
2470        if (patientInstruction != null) {
2471          dst.patientInstruction = new ArrayList<CodeableReference>();
2472          for (CodeableReference i : patientInstruction)
2473            dst.patientInstruction.add(i.copy());
2474        };
2475        if (basedOn != null) {
2476          dst.basedOn = new ArrayList<Reference>();
2477          for (Reference i : basedOn)
2478            dst.basedOn.add(i.copy());
2479        };
2480        dst.subject = subject == null ? null : subject.copy();
2481        if (participant != null) {
2482          dst.participant = new ArrayList<AppointmentParticipantComponent>();
2483          for (AppointmentParticipantComponent i : participant)
2484            dst.participant.add(i.copy());
2485        };
2486        if (requestedPeriod != null) {
2487          dst.requestedPeriod = new ArrayList<Period>();
2488          for (Period i : requestedPeriod)
2489            dst.requestedPeriod.add(i.copy());
2490        };
2491      }
2492
2493      protected Appointment typedCopy() {
2494        return copy();
2495      }
2496
2497      @Override
2498      public boolean equalsDeep(Base other_) {
2499        if (!super.equalsDeep(other_))
2500          return false;
2501        if (!(other_ instanceof Appointment))
2502          return false;
2503        Appointment o = (Appointment) other_;
2504        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(cancellationReason, o.cancellationReason, true)
2505           && compareDeep(serviceCategory, o.serviceCategory, true) && compareDeep(serviceType, o.serviceType, true)
2506           && compareDeep(specialty, o.specialty, true) && compareDeep(appointmentType, o.appointmentType, true)
2507           && compareDeep(reason, o.reason, true) && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true)
2508           && compareDeep(replaces, o.replaces, true) && compareDeep(supportingInformation, o.supportingInformation, true)
2509           && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(minutesDuration, o.minutesDuration, true)
2510           && compareDeep(slot, o.slot, true) && compareDeep(account, o.account, true) && compareDeep(created, o.created, true)
2511           && compareDeep(note, o.note, true) && compareDeep(patientInstruction, o.patientInstruction, true)
2512           && compareDeep(basedOn, o.basedOn, true) && compareDeep(subject, o.subject, true) && compareDeep(participant, o.participant, true)
2513           && compareDeep(requestedPeriod, o.requestedPeriod, true);
2514      }
2515
2516      @Override
2517      public boolean equalsShallow(Base other_) {
2518        if (!super.equalsShallow(other_))
2519          return false;
2520        if (!(other_ instanceof Appointment))
2521          return false;
2522        Appointment o = (Appointment) other_;
2523        return compareValues(status, o.status, true) && compareValues(description, o.description, true) && compareValues(start, o.start, true)
2524           && compareValues(end, o.end, true) && compareValues(minutesDuration, o.minutesDuration, true) && compareValues(created, o.created, true)
2525          ;
2526      }
2527
2528      public boolean isEmpty() {
2529        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, cancellationReason
2530          , serviceCategory, serviceType, specialty, appointmentType, reason, priority, description
2531          , replaces, supportingInformation, start, end, minutesDuration, slot, account
2532          , created, note, patientInstruction, basedOn, subject, participant, requestedPeriod
2533          );
2534      }
2535
2536  @Override
2537  public ResourceType getResourceType() {
2538    return ResourceType.Appointment;
2539   }
2540
2541 /**
2542   * Search parameter: <b>actor</b>
2543   * <p>
2544   * Description: <b>Any one of the individuals participating in the appointment</b><br>
2545   * Type: <b>reference</b><br>
2546   * Path: <b>Appointment.participant.actor</b><br>
2547   * </p>
2548   */
2549  @SearchParamDefinition(name="actor", path="Appointment.participant.actor", description="Any one of the individuals participating in the appointment", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={CareTeam.class, Device.class, Group.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2550  public static final String SP_ACTOR = "actor";
2551 /**
2552   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
2553   * <p>
2554   * Description: <b>Any one of the individuals participating in the appointment</b><br>
2555   * Type: <b>reference</b><br>
2556   * Path: <b>Appointment.participant.actor</b><br>
2557   * </p>
2558   */
2559  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
2560
2561/**
2562   * Constant for fluent queries to be used to add include statements. Specifies
2563   * the path value of "<b>Appointment:actor</b>".
2564   */
2565  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Appointment:actor").toLocked();
2566
2567 /**
2568   * Search parameter: <b>appointment-type</b>
2569   * <p>
2570   * Description: <b>The style of appointment or patient that has been booked in the slot (not service type)</b><br>
2571   * Type: <b>token</b><br>
2572   * Path: <b>Appointment.appointmentType</b><br>
2573   * </p>
2574   */
2575  @SearchParamDefinition(name="appointment-type", path="Appointment.appointmentType", description="The style of appointment or patient that has been booked in the slot (not service type)", type="token" )
2576  public static final String SP_APPOINTMENT_TYPE = "appointment-type";
2577 /**
2578   * <b>Fluent Client</b> search parameter constant for <b>appointment-type</b>
2579   * <p>
2580   * Description: <b>The style of appointment or patient that has been booked in the slot (not service type)</b><br>
2581   * Type: <b>token</b><br>
2582   * Path: <b>Appointment.appointmentType</b><br>
2583   * </p>
2584   */
2585  public static final ca.uhn.fhir.rest.gclient.TokenClientParam APPOINTMENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_APPOINTMENT_TYPE);
2586
2587 /**
2588   * Search parameter: <b>based-on</b>
2589   * <p>
2590   * Description: <b>The service request this appointment is allocated to assess</b><br>
2591   * Type: <b>reference</b><br>
2592   * Path: <b>Appointment.basedOn</b><br>
2593   * </p>
2594   */
2595  @SearchParamDefinition(name="based-on", path="Appointment.basedOn", description="The service request this appointment is allocated to assess", type="reference", target={ServiceRequest.class } )
2596  public static final String SP_BASED_ON = "based-on";
2597 /**
2598   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2599   * <p>
2600   * Description: <b>The service request this appointment is allocated to assess</b><br>
2601   * Type: <b>reference</b><br>
2602   * Path: <b>Appointment.basedOn</b><br>
2603   * </p>
2604   */
2605  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2606
2607/**
2608   * Constant for fluent queries to be used to add include statements. Specifies
2609   * the path value of "<b>Appointment:based-on</b>".
2610   */
2611  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Appointment:based-on").toLocked();
2612
2613 /**
2614   * Search parameter: <b>date</b>
2615   * <p>
2616   * Description: <b>Appointment date/time.</b><br>
2617   * Type: <b>date</b><br>
2618   * Path: <b>(start | requestedPeriod.start).first()</b><br>
2619   * </p>
2620   */
2621  @SearchParamDefinition(name="date", path="(start | requestedPeriod.start).first()", description="Appointment date/time.", type="date" )
2622  public static final String SP_DATE = "date";
2623 /**
2624   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2625   * <p>
2626   * Description: <b>Appointment date/time.</b><br>
2627   * Type: <b>date</b><br>
2628   * Path: <b>(start | requestedPeriod.start).first()</b><br>
2629   * </p>
2630   */
2631  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2632
2633 /**
2634   * Search parameter: <b>group</b>
2635   * <p>
2636   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2637   * Type: <b>reference</b><br>
2638   * Path: <b>Appointment.participant.actor.where(resolve() is Group) | Appointment.subject.where(resolve() is Group)</b><br>
2639   * </p>
2640   */
2641  @SearchParamDefinition(name="group", path="Appointment.participant.actor.where(resolve() is Group) | Appointment.subject.where(resolve() is Group)", description="One of the individuals of the appointment is this patient", type="reference", target={CareTeam.class, Device.class, Group.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2642  public static final String SP_GROUP = "group";
2643 /**
2644   * <b>Fluent Client</b> search parameter constant for <b>group</b>
2645   * <p>
2646   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2647   * Type: <b>reference</b><br>
2648   * Path: <b>Appointment.participant.actor.where(resolve() is Group) | Appointment.subject.where(resolve() is Group)</b><br>
2649   * </p>
2650   */
2651  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam GROUP = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_GROUP);
2652
2653/**
2654   * Constant for fluent queries to be used to add include statements. Specifies
2655   * the path value of "<b>Appointment:group</b>".
2656   */
2657  public static final ca.uhn.fhir.model.api.Include INCLUDE_GROUP = new ca.uhn.fhir.model.api.Include("Appointment:group").toLocked();
2658
2659 /**
2660   * Search parameter: <b>identifier</b>
2661   * <p>
2662   * Description: <b>An Identifier of the Appointment</b><br>
2663   * Type: <b>token</b><br>
2664   * Path: <b>Appointment.identifier</b><br>
2665   * </p>
2666   */
2667  @SearchParamDefinition(name="identifier", path="Appointment.identifier", description="An Identifier of the Appointment", type="token" )
2668  public static final String SP_IDENTIFIER = "identifier";
2669 /**
2670   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2671   * <p>
2672   * Description: <b>An Identifier of the Appointment</b><br>
2673   * Type: <b>token</b><br>
2674   * Path: <b>Appointment.identifier</b><br>
2675   * </p>
2676   */
2677  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2678
2679 /**
2680   * Search parameter: <b>location</b>
2681   * <p>
2682   * Description: <b>This location is listed in the participants of the appointment</b><br>
2683   * Type: <b>reference</b><br>
2684   * Path: <b>Appointment.participant.actor.where(resolve() is Location)</b><br>
2685   * </p>
2686   */
2687  @SearchParamDefinition(name="location", path="Appointment.participant.actor.where(resolve() is Location)", description="This location is listed in the participants of the appointment", type="reference", target={CareTeam.class, Device.class, Group.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2688  public static final String SP_LOCATION = "location";
2689 /**
2690   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2691   * <p>
2692   * Description: <b>This location is listed in the participants of the appointment</b><br>
2693   * Type: <b>reference</b><br>
2694   * Path: <b>Appointment.participant.actor.where(resolve() is Location)</b><br>
2695   * </p>
2696   */
2697  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2698
2699/**
2700   * Constant for fluent queries to be used to add include statements. Specifies
2701   * the path value of "<b>Appointment:location</b>".
2702   */
2703  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Appointment:location").toLocked();
2704
2705 /**
2706   * Search parameter: <b>part-status</b>
2707   * <p>
2708   * Description: <b>The Participation status of the subject, or other participant on the appointment. Can be used to locate participants that have not responded to meeting requests.</b><br>
2709   * Type: <b>token</b><br>
2710   * Path: <b>Appointment.participant.status</b><br>
2711   * </p>
2712   */
2713  @SearchParamDefinition(name="part-status", path="Appointment.participant.status", description="The Participation status of the subject, or other participant on the appointment. Can be used to locate participants that have not responded to meeting requests.", type="token" )
2714  public static final String SP_PART_STATUS = "part-status";
2715 /**
2716   * <b>Fluent Client</b> search parameter constant for <b>part-status</b>
2717   * <p>
2718   * Description: <b>The Participation status of the subject, or other participant on the appointment. Can be used to locate participants that have not responded to meeting requests.</b><br>
2719   * Type: <b>token</b><br>
2720   * Path: <b>Appointment.participant.status</b><br>
2721   * </p>
2722   */
2723  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PART_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PART_STATUS);
2724
2725 /**
2726   * Search parameter: <b>patient</b>
2727   * <p>
2728   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2729   * Type: <b>reference</b><br>
2730   * Path: <b>Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient)</b><br>
2731   * </p>
2732   */
2733  @SearchParamDefinition(name="patient", path="Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient)", description="One of the individuals of the appointment is this patient", type="reference", target={CareTeam.class, Device.class, Group.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2734  public static final String SP_PATIENT = "patient";
2735 /**
2736   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2737   * <p>
2738   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2739   * Type: <b>reference</b><br>
2740   * Path: <b>Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient)</b><br>
2741   * </p>
2742   */
2743  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2744
2745/**
2746   * Constant for fluent queries to be used to add include statements. Specifies
2747   * the path value of "<b>Appointment:patient</b>".
2748   */
2749  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Appointment:patient").toLocked();
2750
2751 /**
2752   * Search parameter: <b>practitioner</b>
2753   * <p>
2754   * Description: <b>One of the individuals of the appointment is this practitioner</b><br>
2755   * Type: <b>reference</b><br>
2756   * Path: <b>Appointment.participant.actor.where(resolve() is Practitioner)</b><br>
2757   * </p>
2758   */
2759  @SearchParamDefinition(name="practitioner", path="Appointment.participant.actor.where(resolve() is Practitioner)", description="One of the individuals of the appointment is this practitioner", type="reference", target={CareTeam.class, Device.class, Group.class, HealthcareService.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2760  public static final String SP_PRACTITIONER = "practitioner";
2761 /**
2762   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
2763   * <p>
2764   * Description: <b>One of the individuals of the appointment is this practitioner</b><br>
2765   * Type: <b>reference</b><br>
2766   * Path: <b>Appointment.participant.actor.where(resolve() is Practitioner)</b><br>
2767   * </p>
2768   */
2769  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
2770
2771/**
2772   * Constant for fluent queries to be used to add include statements. Specifies
2773   * the path value of "<b>Appointment:practitioner</b>".
2774   */
2775  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("Appointment:practitioner").toLocked();
2776
2777 /**
2778   * Search parameter: <b>reason-code</b>
2779   * <p>
2780   * Description: <b>Reference to a concept (by class)</b><br>
2781   * Type: <b>token</b><br>
2782   * Path: <b>Appointment.reason.concept</b><br>
2783   * </p>
2784   */
2785  @SearchParamDefinition(name="reason-code", path="Appointment.reason.concept", description="Reference to a concept (by class)", type="token" )
2786  public static final String SP_REASON_CODE = "reason-code";
2787 /**
2788   * <b>Fluent Client</b> search parameter constant for <b>reason-code</b>
2789   * <p>
2790   * Description: <b>Reference to a concept (by class)</b><br>
2791   * Type: <b>token</b><br>
2792   * Path: <b>Appointment.reason.concept</b><br>
2793   * </p>
2794   */
2795  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_CODE);
2796
2797 /**
2798   * Search parameter: <b>reason-reference</b>
2799   * <p>
2800   * Description: <b>Reference to a resource (by instance)</b><br>
2801   * Type: <b>reference</b><br>
2802   * Path: <b>Appointment.reason.reference</b><br>
2803   * </p>
2804   */
2805  @SearchParamDefinition(name="reason-reference", path="Appointment.reason.reference", description="Reference to a resource (by instance)", type="reference" )
2806  public static final String SP_REASON_REFERENCE = "reason-reference";
2807 /**
2808   * <b>Fluent Client</b> search parameter constant for <b>reason-reference</b>
2809   * <p>
2810   * Description: <b>Reference to a resource (by instance)</b><br>
2811   * Type: <b>reference</b><br>
2812   * Path: <b>Appointment.reason.reference</b><br>
2813   * </p>
2814   */
2815  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REASON_REFERENCE);
2816
2817/**
2818   * Constant for fluent queries to be used to add include statements. Specifies
2819   * the path value of "<b>Appointment:reason-reference</b>".
2820   */
2821  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_REFERENCE = new ca.uhn.fhir.model.api.Include("Appointment:reason-reference").toLocked();
2822
2823 /**
2824   * Search parameter: <b>requested-period</b>
2825   * <p>
2826   * Description: <b>During what period was the Appointment requested to take place</b><br>
2827   * Type: <b>date</b><br>
2828   * Path: <b>requestedPeriod</b><br>
2829   * </p>
2830   */
2831  @SearchParamDefinition(name="requested-period", path="requestedPeriod", description="During what period was the Appointment requested to take place", type="date" )
2832  public static final String SP_REQUESTED_PERIOD = "requested-period";
2833 /**
2834   * <b>Fluent Client</b> search parameter constant for <b>requested-period</b>
2835   * <p>
2836   * Description: <b>During what period was the Appointment requested to take place</b><br>
2837   * Type: <b>date</b><br>
2838   * Path: <b>requestedPeriod</b><br>
2839   * </p>
2840   */
2841  public static final ca.uhn.fhir.rest.gclient.DateClientParam REQUESTED_PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_REQUESTED_PERIOD);
2842
2843 /**
2844   * Search parameter: <b>service-category</b>
2845   * <p>
2846   * Description: <b>A broad categorization of the service that is to be performed during this appointment</b><br>
2847   * Type: <b>token</b><br>
2848   * Path: <b>Appointment.serviceCategory</b><br>
2849   * </p>
2850   */
2851  @SearchParamDefinition(name="service-category", path="Appointment.serviceCategory", description="A broad categorization of the service that is to be performed during this appointment", type="token" )
2852  public static final String SP_SERVICE_CATEGORY = "service-category";
2853 /**
2854   * <b>Fluent Client</b> search parameter constant for <b>service-category</b>
2855   * <p>
2856   * Description: <b>A broad categorization of the service that is to be performed during this appointment</b><br>
2857   * Type: <b>token</b><br>
2858   * Path: <b>Appointment.serviceCategory</b><br>
2859   * </p>
2860   */
2861  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_CATEGORY);
2862
2863 /**
2864   * Search parameter: <b>service-type</b>
2865   * <p>
2866   * Description: <b>The specific service that is to be performed during this appointment</b><br>
2867   * Type: <b>token</b><br>
2868   * Path: <b>Appointment.serviceType</b><br>
2869   * </p>
2870   */
2871  @SearchParamDefinition(name="service-type", path="Appointment.serviceType", description="The specific service that is to be performed during this appointment", type="token" )
2872  public static final String SP_SERVICE_TYPE = "service-type";
2873 /**
2874   * <b>Fluent Client</b> search parameter constant for <b>service-type</b>
2875   * <p>
2876   * Description: <b>The specific service that is to be performed during this appointment</b><br>
2877   * Type: <b>token</b><br>
2878   * Path: <b>Appointment.serviceType</b><br>
2879   * </p>
2880   */
2881  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERVICE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERVICE_TYPE);
2882
2883 /**
2884   * Search parameter: <b>slot</b>
2885   * <p>
2886   * Description: <b>The slots that this appointment is filling</b><br>
2887   * Type: <b>reference</b><br>
2888   * Path: <b>Appointment.slot</b><br>
2889   * </p>
2890   */
2891  @SearchParamDefinition(name="slot", path="Appointment.slot", description="The slots that this appointment is filling", type="reference", target={Slot.class } )
2892  public static final String SP_SLOT = "slot";
2893 /**
2894   * <b>Fluent Client</b> search parameter constant for <b>slot</b>
2895   * <p>
2896   * Description: <b>The slots that this appointment is filling</b><br>
2897   * Type: <b>reference</b><br>
2898   * Path: <b>Appointment.slot</b><br>
2899   * </p>
2900   */
2901  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SLOT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SLOT);
2902
2903/**
2904   * Constant for fluent queries to be used to add include statements. Specifies
2905   * the path value of "<b>Appointment:slot</b>".
2906   */
2907  public static final ca.uhn.fhir.model.api.Include INCLUDE_SLOT = new ca.uhn.fhir.model.api.Include("Appointment:slot").toLocked();
2908
2909 /**
2910   * Search parameter: <b>specialty</b>
2911   * <p>
2912   * Description: <b>The specialty of a practitioner that would be required to perform the service requested in this appointment</b><br>
2913   * Type: <b>token</b><br>
2914   * Path: <b>Appointment.specialty</b><br>
2915   * </p>
2916   */
2917  @SearchParamDefinition(name="specialty", path="Appointment.specialty", description="The specialty of a practitioner that would be required to perform the service requested in this appointment", type="token" )
2918  public static final String SP_SPECIALTY = "specialty";
2919 /**
2920   * <b>Fluent Client</b> search parameter constant for <b>specialty</b>
2921   * <p>
2922   * Description: <b>The specialty of a practitioner that would be required to perform the service requested in this appointment</b><br>
2923   * Type: <b>token</b><br>
2924   * Path: <b>Appointment.specialty</b><br>
2925   * </p>
2926   */
2927  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIALTY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIALTY);
2928
2929 /**
2930   * Search parameter: <b>status</b>
2931   * <p>
2932   * Description: <b>The overall status of the appointment</b><br>
2933   * Type: <b>token</b><br>
2934   * Path: <b>Appointment.status</b><br>
2935   * </p>
2936   */
2937  @SearchParamDefinition(name="status", path="Appointment.status", description="The overall status of the appointment", type="token" )
2938  public static final String SP_STATUS = "status";
2939 /**
2940   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2941   * <p>
2942   * Description: <b>The overall status of the appointment</b><br>
2943   * Type: <b>token</b><br>
2944   * Path: <b>Appointment.status</b><br>
2945   * </p>
2946   */
2947  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2948
2949 /**
2950   * Search parameter: <b>subject</b>
2951   * <p>
2952   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2953   * Type: <b>reference</b><br>
2954   * Path: <b>Appointment.subject</b><br>
2955   * </p>
2956   */
2957  @SearchParamDefinition(name="subject", path="Appointment.subject", description="One of the individuals of the appointment is this patient", type="reference", target={Group.class, Patient.class } )
2958  public static final String SP_SUBJECT = "subject";
2959 /**
2960   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2961   * <p>
2962   * Description: <b>One of the individuals of the appointment is this patient</b><br>
2963   * Type: <b>reference</b><br>
2964   * Path: <b>Appointment.subject</b><br>
2965   * </p>
2966   */
2967  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2968
2969/**
2970   * Constant for fluent queries to be used to add include statements. Specifies
2971   * the path value of "<b>Appointment:subject</b>".
2972   */
2973  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Appointment:subject").toLocked();
2974
2975 /**
2976   * Search parameter: <b>supporting-info</b>
2977   * <p>
2978   * Description: <b>Additional information to support the appointment</b><br>
2979   * Type: <b>reference</b><br>
2980   * Path: <b>Appointment.supportingInformation</b><br>
2981   * </p>
2982   */
2983  @SearchParamDefinition(name="supporting-info", path="Appointment.supportingInformation", description="Additional information to support the appointment", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, ConceptMap2.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
2984  public static final String SP_SUPPORTING_INFO = "supporting-info";
2985 /**
2986   * <b>Fluent Client</b> search parameter constant for <b>supporting-info</b>
2987   * <p>
2988   * Description: <b>Additional information to support the appointment</b><br>
2989   * Type: <b>reference</b><br>
2990   * Path: <b>Appointment.supportingInformation</b><br>
2991   * </p>
2992   */
2993  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPORTING_INFO = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUPPORTING_INFO);
2994
2995/**
2996   * Constant for fluent queries to be used to add include statements. Specifies
2997   * the path value of "<b>Appointment:supporting-info</b>".
2998   */
2999  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPORTING_INFO = new ca.uhn.fhir.model.api.Include("Appointment:supporting-info").toLocked();
3000
3001
3002}
3003