001package org.hl7.fhir.dstu2.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023 024/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, 034 this list of conditions and the following disclaimer in the documentation 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 049 POSSIBILITY OF SUCH DAMAGE. 050 051*/ 052 053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 057 058import ca.uhn.fhir.model.api.annotation.Block; 059import ca.uhn.fhir.model.api.annotation.Child; 060import ca.uhn.fhir.model.api.annotation.Description; 061import ca.uhn.fhir.model.api.annotation.ResourceDef; 062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 063import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 064import org.hl7.fhir.exceptions.FHIRException; 065import org.hl7.fhir.utilities.Utilities; 066/** 067 * 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). 068 */ 069@ResourceDef(name="Appointment", profile="http://hl7.org/fhir/Profile/Appointment") 070public class Appointment extends DomainResource { 071 072 public enum AppointmentStatus { 073 /** 074 * None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time may not be set yet. 075 */ 076 PROPOSED, 077 /** 078 * Some or all of the participant(s) have not finalized their acceptance of the appointment request. 079 */ 080 PENDING, 081 /** 082 * All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified. 083 */ 084 BOOKED, 085 /** 086 * Some of the patients have arrived. 087 */ 088 ARRIVED, 089 /** 090 * This appointment has completed and may have resulted in an encounter. 091 */ 092 FULFILLED, 093 /** 094 * The appointment has been cancelled. 095 */ 096 CANCELLED, 097 /** 098 * Some or all of the participant(s) have not/did not appear for the appointment (usually the patient). 099 */ 100 NOSHOW, 101 /** 102 * added to help the parsers 103 */ 104 NULL; 105 public static AppointmentStatus fromCode(String codeString) throws FHIRException { 106 if (codeString == null || "".equals(codeString)) 107 return null; 108 if ("proposed".equals(codeString)) 109 return PROPOSED; 110 if ("pending".equals(codeString)) 111 return PENDING; 112 if ("booked".equals(codeString)) 113 return BOOKED; 114 if ("arrived".equals(codeString)) 115 return ARRIVED; 116 if ("fulfilled".equals(codeString)) 117 return FULFILLED; 118 if ("cancelled".equals(codeString)) 119 return CANCELLED; 120 if ("noshow".equals(codeString)) 121 return NOSHOW; 122 throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'"); 123 } 124 public String toCode() { 125 switch (this) { 126 case PROPOSED: return "proposed"; 127 case PENDING: return "pending"; 128 case BOOKED: return "booked"; 129 case ARRIVED: return "arrived"; 130 case FULFILLED: return "fulfilled"; 131 case CANCELLED: return "cancelled"; 132 case NOSHOW: return "noshow"; 133 default: return "?"; 134 } 135 } 136 public String getSystem() { 137 switch (this) { 138 case PROPOSED: return "http://hl7.org/fhir/appointmentstatus"; 139 case PENDING: return "http://hl7.org/fhir/appointmentstatus"; 140 case BOOKED: return "http://hl7.org/fhir/appointmentstatus"; 141 case ARRIVED: return "http://hl7.org/fhir/appointmentstatus"; 142 case FULFILLED: return "http://hl7.org/fhir/appointmentstatus"; 143 case CANCELLED: return "http://hl7.org/fhir/appointmentstatus"; 144 case NOSHOW: return "http://hl7.org/fhir/appointmentstatus"; 145 default: return "?"; 146 } 147 } 148 public String getDefinition() { 149 switch (this) { 150 case PROPOSED: return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time may not be set yet."; 151 case PENDING: return "Some or all of the participant(s) have not finalized their acceptance of the appointment request."; 152 case BOOKED: return "All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified."; 153 case ARRIVED: return "Some of the patients have arrived."; 154 case FULFILLED: return "This appointment has completed and may have resulted in an encounter."; 155 case CANCELLED: return "The appointment has been cancelled."; 156 case NOSHOW: return "Some or all of the participant(s) have not/did not appear for the appointment (usually the patient)."; 157 default: return "?"; 158 } 159 } 160 public String getDisplay() { 161 switch (this) { 162 case PROPOSED: return "Proposed"; 163 case PENDING: return "Pending"; 164 case BOOKED: return "Booked"; 165 case ARRIVED: return "Arrived"; 166 case FULFILLED: return "Fulfilled"; 167 case CANCELLED: return "Cancelled"; 168 case NOSHOW: return "No Show"; 169 default: return "?"; 170 } 171 } 172 } 173 174 public static class AppointmentStatusEnumFactory implements EnumFactory<AppointmentStatus> { 175 public AppointmentStatus fromCode(String codeString) throws IllegalArgumentException { 176 if (codeString == null || "".equals(codeString)) 177 if (codeString == null || "".equals(codeString)) 178 return null; 179 if ("proposed".equals(codeString)) 180 return AppointmentStatus.PROPOSED; 181 if ("pending".equals(codeString)) 182 return AppointmentStatus.PENDING; 183 if ("booked".equals(codeString)) 184 return AppointmentStatus.BOOKED; 185 if ("arrived".equals(codeString)) 186 return AppointmentStatus.ARRIVED; 187 if ("fulfilled".equals(codeString)) 188 return AppointmentStatus.FULFILLED; 189 if ("cancelled".equals(codeString)) 190 return AppointmentStatus.CANCELLED; 191 if ("noshow".equals(codeString)) 192 return AppointmentStatus.NOSHOW; 193 throw new IllegalArgumentException("Unknown AppointmentStatus code '"+codeString+"'"); 194 } 195 public Enumeration<AppointmentStatus> fromType(Base code) throws FHIRException { 196 if (code == null || code.isEmpty()) 197 return null; 198 String codeString = ((PrimitiveType) code).asStringValue(); 199 if (codeString == null || "".equals(codeString)) 200 return null; 201 if ("proposed".equals(codeString)) 202 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PROPOSED); 203 if ("pending".equals(codeString)) 204 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.PENDING); 205 if ("booked".equals(codeString)) 206 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.BOOKED); 207 if ("arrived".equals(codeString)) 208 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.ARRIVED); 209 if ("fulfilled".equals(codeString)) 210 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.FULFILLED); 211 if ("cancelled".equals(codeString)) 212 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.CANCELLED); 213 if ("noshow".equals(codeString)) 214 return new Enumeration<AppointmentStatus>(this, AppointmentStatus.NOSHOW); 215 throw new FHIRException("Unknown AppointmentStatus code '"+codeString+"'"); 216 } 217 public String toCode(AppointmentStatus code) { 218 if (code == AppointmentStatus.PROPOSED) 219 return "proposed"; 220 if (code == AppointmentStatus.PENDING) 221 return "pending"; 222 if (code == AppointmentStatus.BOOKED) 223 return "booked"; 224 if (code == AppointmentStatus.ARRIVED) 225 return "arrived"; 226 if (code == AppointmentStatus.FULFILLED) 227 return "fulfilled"; 228 if (code == AppointmentStatus.CANCELLED) 229 return "cancelled"; 230 if (code == AppointmentStatus.NOSHOW) 231 return "noshow"; 232 return "?"; 233 } 234 } 235 236 public enum ParticipantRequired { 237 /** 238 * The participant is required to attend the appointment. 239 */ 240 REQUIRED, 241 /** 242 * The participant may optionally attend the appointment. 243 */ 244 OPTIONAL, 245 /** 246 * The participant is excluded from the appointment, and may not be informed of the appointment taking place. (Appointment is about them, not for them - such as 2 doctors discussing results about a patient's test). 247 */ 248 INFORMATIONONLY, 249 /** 250 * added to help the parsers 251 */ 252 NULL; 253 public static ParticipantRequired fromCode(String codeString) throws FHIRException { 254 if (codeString == null || "".equals(codeString)) 255 return null; 256 if ("required".equals(codeString)) 257 return REQUIRED; 258 if ("optional".equals(codeString)) 259 return OPTIONAL; 260 if ("information-only".equals(codeString)) 261 return INFORMATIONONLY; 262 throw new FHIRException("Unknown ParticipantRequired code '"+codeString+"'"); 263 } 264 public String toCode() { 265 switch (this) { 266 case REQUIRED: return "required"; 267 case OPTIONAL: return "optional"; 268 case INFORMATIONONLY: return "information-only"; 269 default: return "?"; 270 } 271 } 272 public String getSystem() { 273 switch (this) { 274 case REQUIRED: return "http://hl7.org/fhir/participantrequired"; 275 case OPTIONAL: return "http://hl7.org/fhir/participantrequired"; 276 case INFORMATIONONLY: return "http://hl7.org/fhir/participantrequired"; 277 default: return "?"; 278 } 279 } 280 public String getDefinition() { 281 switch (this) { 282 case REQUIRED: return "The participant is required to attend the appointment."; 283 case OPTIONAL: return "The participant may optionally attend the appointment."; 284 case INFORMATIONONLY: return "The participant is excluded from the appointment, and may not be informed of the appointment taking place. (Appointment is about them, not for them - such as 2 doctors discussing results about a patient's test)."; 285 default: return "?"; 286 } 287 } 288 public String getDisplay() { 289 switch (this) { 290 case REQUIRED: return "Required"; 291 case OPTIONAL: return "Optional"; 292 case INFORMATIONONLY: return "Information Only"; 293 default: return "?"; 294 } 295 } 296 } 297 298 public static class ParticipantRequiredEnumFactory implements EnumFactory<ParticipantRequired> { 299 public ParticipantRequired fromCode(String codeString) throws IllegalArgumentException { 300 if (codeString == null || "".equals(codeString)) 301 if (codeString == null || "".equals(codeString)) 302 return null; 303 if ("required".equals(codeString)) 304 return ParticipantRequired.REQUIRED; 305 if ("optional".equals(codeString)) 306 return ParticipantRequired.OPTIONAL; 307 if ("information-only".equals(codeString)) 308 return ParticipantRequired.INFORMATIONONLY; 309 throw new IllegalArgumentException("Unknown ParticipantRequired code '"+codeString+"'"); 310 } 311 public Enumeration<ParticipantRequired> fromType(Base code) throws FHIRException { 312 if (code == null || code.isEmpty()) 313 return null; 314 String codeString = ((PrimitiveType) code).asStringValue(); 315 if (codeString == null || "".equals(codeString)) 316 return null; 317 if ("required".equals(codeString)) 318 return new Enumeration<ParticipantRequired>(this, ParticipantRequired.REQUIRED); 319 if ("optional".equals(codeString)) 320 return new Enumeration<ParticipantRequired>(this, ParticipantRequired.OPTIONAL); 321 if ("information-only".equals(codeString)) 322 return new Enumeration<ParticipantRequired>(this, ParticipantRequired.INFORMATIONONLY); 323 throw new FHIRException("Unknown ParticipantRequired code '"+codeString+"'"); 324 } 325 public String toCode(ParticipantRequired code) { 326 if (code == ParticipantRequired.REQUIRED) 327 return "required"; 328 if (code == ParticipantRequired.OPTIONAL) 329 return "optional"; 330 if (code == ParticipantRequired.INFORMATIONONLY) 331 return "information-only"; 332 return "?"; 333 } 334 } 335 336 public enum ParticipationStatus { 337 /** 338 * The participant has accepted the appointment. 339 */ 340 ACCEPTED, 341 /** 342 * The participant has declined the appointment and will not participate in the appointment. 343 */ 344 DECLINED, 345 /** 346 * The participant has tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur. 347 */ 348 TENTATIVE, 349 /** 350 * The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses. 351 */ 352 NEEDSACTION, 353 /** 354 * added to help the parsers 355 */ 356 NULL; 357 public static ParticipationStatus fromCode(String codeString) throws FHIRException { 358 if (codeString == null || "".equals(codeString)) 359 return null; 360 if ("accepted".equals(codeString)) 361 return ACCEPTED; 362 if ("declined".equals(codeString)) 363 return DECLINED; 364 if ("tentative".equals(codeString)) 365 return TENTATIVE; 366 if ("needs-action".equals(codeString)) 367 return NEEDSACTION; 368 throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'"); 369 } 370 public String toCode() { 371 switch (this) { 372 case ACCEPTED: return "accepted"; 373 case DECLINED: return "declined"; 374 case TENTATIVE: return "tentative"; 375 case NEEDSACTION: return "needs-action"; 376 default: return "?"; 377 } 378 } 379 public String getSystem() { 380 switch (this) { 381 case ACCEPTED: return "http://hl7.org/fhir/participationstatus"; 382 case DECLINED: return "http://hl7.org/fhir/participationstatus"; 383 case TENTATIVE: return "http://hl7.org/fhir/participationstatus"; 384 case NEEDSACTION: return "http://hl7.org/fhir/participationstatus"; 385 default: return "?"; 386 } 387 } 388 public String getDefinition() { 389 switch (this) { 390 case ACCEPTED: return "The participant has accepted the appointment."; 391 case DECLINED: return "The participant has declined the appointment and will not participate in the appointment."; 392 case TENTATIVE: return "The participant has tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur."; 393 case NEEDSACTION: return "The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses."; 394 default: return "?"; 395 } 396 } 397 public String getDisplay() { 398 switch (this) { 399 case ACCEPTED: return "Accepted"; 400 case DECLINED: return "Declined"; 401 case TENTATIVE: return "Tentative"; 402 case NEEDSACTION: return "Needs Action"; 403 default: return "?"; 404 } 405 } 406 } 407 408 public static class ParticipationStatusEnumFactory implements EnumFactory<ParticipationStatus> { 409 public ParticipationStatus fromCode(String codeString) throws IllegalArgumentException { 410 if (codeString == null || "".equals(codeString)) 411 if (codeString == null || "".equals(codeString)) 412 return null; 413 if ("accepted".equals(codeString)) 414 return ParticipationStatus.ACCEPTED; 415 if ("declined".equals(codeString)) 416 return ParticipationStatus.DECLINED; 417 if ("tentative".equals(codeString)) 418 return ParticipationStatus.TENTATIVE; 419 if ("needs-action".equals(codeString)) 420 return ParticipationStatus.NEEDSACTION; 421 throw new IllegalArgumentException("Unknown ParticipationStatus code '"+codeString+"'"); 422 } 423 public Enumeration<ParticipationStatus> fromType(Base code) throws FHIRException { 424 if (code == null || code.isEmpty()) 425 return null; 426 String codeString = ((PrimitiveType) code).asStringValue(); 427 if (codeString == null || "".equals(codeString)) 428 return null; 429 if ("accepted".equals(codeString)) 430 return new Enumeration<ParticipationStatus>(this, ParticipationStatus.ACCEPTED); 431 if ("declined".equals(codeString)) 432 return new Enumeration<ParticipationStatus>(this, ParticipationStatus.DECLINED); 433 if ("tentative".equals(codeString)) 434 return new Enumeration<ParticipationStatus>(this, ParticipationStatus.TENTATIVE); 435 if ("needs-action".equals(codeString)) 436 return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NEEDSACTION); 437 throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'"); 438 } 439 public String toCode(ParticipationStatus code) { 440 if (code == ParticipationStatus.ACCEPTED) 441 return "accepted"; 442 if (code == ParticipationStatus.DECLINED) 443 return "declined"; 444 if (code == ParticipationStatus.TENTATIVE) 445 return "tentative"; 446 if (code == ParticipationStatus.NEEDSACTION) 447 return "needs-action"; 448 return "?"; 449 } 450 } 451 452 @Block() 453 public static class AppointmentParticipantComponent extends BackboneElement implements IBaseBackboneElement { 454 /** 455 * Role of participant in the appointment. 456 */ 457 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 458 @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." ) 459 protected List<CodeableConcept> type; 460 461 /** 462 * A Person, Location/HealthcareService or Device that is participating in the appointment. 463 */ 464 @Child(name = "actor", type = {Patient.class, Practitioner.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=2, min=0, max=1, modifier=false, summary=true) 465 @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." ) 466 protected Reference actor; 467 468 /** 469 * The actual object that is the target of the reference (A Person, Location/HealthcareService or Device that is participating in the appointment.) 470 */ 471 protected Resource actorTarget; 472 473 /** 474 * Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present. 475 */ 476 @Child(name = "required", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true) 477 @Description(shortDefinition="required | optional | information-only", formalDefinition="Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present." ) 478 protected Enumeration<ParticipantRequired> required; 479 480 /** 481 * Participation status of the Patient. 482 */ 483 @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=false) 484 @Description(shortDefinition="accepted | declined | tentative | needs-action", formalDefinition="Participation status of the Patient." ) 485 protected Enumeration<ParticipationStatus> status; 486 487 private static final long serialVersionUID = -1620552507L; 488 489 /* 490 * Constructor 491 */ 492 public AppointmentParticipantComponent() { 493 super(); 494 } 495 496 /* 497 * Constructor 498 */ 499 public AppointmentParticipantComponent(Enumeration<ParticipationStatus> status) { 500 super(); 501 this.status = status; 502 } 503 504 /** 505 * @return {@link #type} (Role of participant in the appointment.) 506 */ 507 public List<CodeableConcept> getType() { 508 if (this.type == null) 509 this.type = new ArrayList<CodeableConcept>(); 510 return this.type; 511 } 512 513 public boolean hasType() { 514 if (this.type == null) 515 return false; 516 for (CodeableConcept item : this.type) 517 if (!item.isEmpty()) 518 return true; 519 return false; 520 } 521 522 /** 523 * @return {@link #type} (Role of participant in the appointment.) 524 */ 525 // syntactic sugar 526 public CodeableConcept addType() { //3 527 CodeableConcept t = new CodeableConcept(); 528 if (this.type == null) 529 this.type = new ArrayList<CodeableConcept>(); 530 this.type.add(t); 531 return t; 532 } 533 534 // syntactic sugar 535 public AppointmentParticipantComponent addType(CodeableConcept t) { //3 536 if (t == null) 537 return this; 538 if (this.type == null) 539 this.type = new ArrayList<CodeableConcept>(); 540 this.type.add(t); 541 return this; 542 } 543 544 /** 545 * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.) 546 */ 547 public Reference getActor() { 548 if (this.actor == null) 549 if (Configuration.errorOnAutoCreate()) 550 throw new Error("Attempt to auto-create AppointmentParticipantComponent.actor"); 551 else if (Configuration.doAutoCreate()) 552 this.actor = new Reference(); // cc 553 return this.actor; 554 } 555 556 public boolean hasActor() { 557 return this.actor != null && !this.actor.isEmpty(); 558 } 559 560 /** 561 * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.) 562 */ 563 public AppointmentParticipantComponent setActor(Reference value) { 564 this.actor = value; 565 return this; 566 } 567 568 /** 569 * @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A Person, Location/HealthcareService or Device that is participating in the appointment.) 570 */ 571 public Resource getActorTarget() { 572 return this.actorTarget; 573 } 574 575 /** 576 * @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A Person, Location/HealthcareService or Device that is participating in the appointment.) 577 */ 578 public AppointmentParticipantComponent setActorTarget(Resource value) { 579 this.actorTarget = value; 580 return this; 581 } 582 583 /** 584 * @return {@link #required} (Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value 585 */ 586 public Enumeration<ParticipantRequired> getRequiredElement() { 587 if (this.required == null) 588 if (Configuration.errorOnAutoCreate()) 589 throw new Error("Attempt to auto-create AppointmentParticipantComponent.required"); 590 else if (Configuration.doAutoCreate()) 591 this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory()); // bb 592 return this.required; 593 } 594 595 public boolean hasRequiredElement() { 596 return this.required != null && !this.required.isEmpty(); 597 } 598 599 public boolean hasRequired() { 600 return this.required != null && !this.required.isEmpty(); 601 } 602 603 /** 604 * @param value {@link #required} (Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value 605 */ 606 public AppointmentParticipantComponent setRequiredElement(Enumeration<ParticipantRequired> value) { 607 this.required = value; 608 return this; 609 } 610 611 /** 612 * @return Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present. 613 */ 614 public ParticipantRequired getRequired() { 615 return this.required == null ? null : this.required.getValue(); 616 } 617 618 /** 619 * @param value Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present. 620 */ 621 public AppointmentParticipantComponent setRequired(ParticipantRequired value) { 622 if (value == null) 623 this.required = null; 624 else { 625 if (this.required == null) 626 this.required = new Enumeration<ParticipantRequired>(new ParticipantRequiredEnumFactory()); 627 this.required.setValue(value); 628 } 629 return this; 630 } 631 632 /** 633 * @return {@link #status} (Participation status of the Patient.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 634 */ 635 public Enumeration<ParticipationStatus> getStatusElement() { 636 if (this.status == null) 637 if (Configuration.errorOnAutoCreate()) 638 throw new Error("Attempt to auto-create AppointmentParticipantComponent.status"); 639 else if (Configuration.doAutoCreate()) 640 this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory()); // bb 641 return this.status; 642 } 643 644 public boolean hasStatusElement() { 645 return this.status != null && !this.status.isEmpty(); 646 } 647 648 public boolean hasStatus() { 649 return this.status != null && !this.status.isEmpty(); 650 } 651 652 /** 653 * @param value {@link #status} (Participation status of the Patient.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 654 */ 655 public AppointmentParticipantComponent setStatusElement(Enumeration<ParticipationStatus> value) { 656 this.status = value; 657 return this; 658 } 659 660 /** 661 * @return Participation status of the Patient. 662 */ 663 public ParticipationStatus getStatus() { 664 return this.status == null ? null : this.status.getValue(); 665 } 666 667 /** 668 * @param value Participation status of the Patient. 669 */ 670 public AppointmentParticipantComponent setStatus(ParticipationStatus value) { 671 if (this.status == null) 672 this.status = new Enumeration<ParticipationStatus>(new ParticipationStatusEnumFactory()); 673 this.status.setValue(value); 674 return this; 675 } 676 677 protected void listChildren(List<Property> childrenList) { 678 super.listChildren(childrenList); 679 childrenList.add(new Property("type", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, type)); 680 childrenList.add(new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, java.lang.Integer.MAX_VALUE, actor)); 681 childrenList.add(new Property("required", "code", "Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.", 0, java.lang.Integer.MAX_VALUE, required)); 682 childrenList.add(new Property("status", "code", "Participation status of the Patient.", 0, java.lang.Integer.MAX_VALUE, status)); 683 } 684 685 @Override 686 public void setProperty(String name, Base value) throws FHIRException { 687 if (name.equals("type")) 688 this.getType().add(castToCodeableConcept(value)); 689 else if (name.equals("actor")) 690 this.actor = castToReference(value); // Reference 691 else if (name.equals("required")) 692 this.required = new ParticipantRequiredEnumFactory().fromType(value); // Enumeration<ParticipantRequired> 693 else if (name.equals("status")) 694 this.status = new ParticipationStatusEnumFactory().fromType(value); // Enumeration<ParticipationStatus> 695 else 696 super.setProperty(name, value); 697 } 698 699 @Override 700 public Base addChild(String name) throws FHIRException { 701 if (name.equals("type")) { 702 return addType(); 703 } 704 else if (name.equals("actor")) { 705 this.actor = new Reference(); 706 return this.actor; 707 } 708 else if (name.equals("required")) { 709 throw new FHIRException("Cannot call addChild on a primitive type Appointment.required"); 710 } 711 else if (name.equals("status")) { 712 throw new FHIRException("Cannot call addChild on a primitive type Appointment.status"); 713 } 714 else 715 return super.addChild(name); 716 } 717 718 public AppointmentParticipantComponent copy() { 719 AppointmentParticipantComponent dst = new AppointmentParticipantComponent(); 720 copyValues(dst); 721 if (type != null) { 722 dst.type = new ArrayList<CodeableConcept>(); 723 for (CodeableConcept i : type) 724 dst.type.add(i.copy()); 725 }; 726 dst.actor = actor == null ? null : actor.copy(); 727 dst.required = required == null ? null : required.copy(); 728 dst.status = status == null ? null : status.copy(); 729 return dst; 730 } 731 732 @Override 733 public boolean equalsDeep(Base other) { 734 if (!super.equalsDeep(other)) 735 return false; 736 if (!(other instanceof AppointmentParticipantComponent)) 737 return false; 738 AppointmentParticipantComponent o = (AppointmentParticipantComponent) other; 739 return compareDeep(type, o.type, true) && compareDeep(actor, o.actor, true) && compareDeep(required, o.required, true) 740 && compareDeep(status, o.status, true); 741 } 742 743 @Override 744 public boolean equalsShallow(Base other) { 745 if (!super.equalsShallow(other)) 746 return false; 747 if (!(other instanceof AppointmentParticipantComponent)) 748 return false; 749 AppointmentParticipantComponent o = (AppointmentParticipantComponent) other; 750 return compareValues(required, o.required, true) && compareValues(status, o.status, true); 751 } 752 753 public boolean isEmpty() { 754 return super.isEmpty() && (type == null || type.isEmpty()) && (actor == null || actor.isEmpty()) 755 && (required == null || required.isEmpty()) && (status == null || status.isEmpty()); 756 } 757 758 public String fhirType() { 759 return "Appointment.participant"; 760 761 } 762 763 } 764 765 /** 766 * 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). 767 */ 768 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 769 @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)." ) 770 protected List<Identifier> identifier; 771 772 /** 773 * 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. 774 */ 775 @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 776 @Description(shortDefinition="proposed | pending | booked | arrived | fulfilled | cancelled | noshow", 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." ) 777 protected Enumeration<AppointmentStatus> status; 778 779 /** 780 * The type of appointment that is being booked (This may also be associated with participants for location, and/or a HealthcareService). 781 */ 782 @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 783 @Description(shortDefinition="The type of appointment that is being booked", formalDefinition="The type of appointment that is being booked (This may also be associated with participants for location, and/or a HealthcareService)." ) 784 protected CodeableConcept type; 785 786 /** 787 * The reason that this appointment is being scheduled. This is more clinical than administrative. 788 */ 789 @Child(name = "reason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 790 @Description(shortDefinition="Reason this appointment is scheduled", formalDefinition="The reason that this appointment is being scheduled. This is more clinical than administrative." ) 791 protected CodeableConcept reason; 792 793 /** 794 * 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). 795 */ 796 @Child(name = "priority", type = {UnsignedIntType.class}, order=4, min=0, max=1, modifier=false, summary=false) 797 @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)." ) 798 protected UnsignedIntType priority; 799 800 /** 801 * 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. 802 */ 803 @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false) 804 @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." ) 805 protected StringType description; 806 807 /** 808 * Date/Time that the appointment is to take place. 809 */ 810 @Child(name = "start", type = {InstantType.class}, order=6, min=0, max=1, modifier=false, summary=true) 811 @Description(shortDefinition="When appointment is to take place", formalDefinition="Date/Time that the appointment is to take place." ) 812 protected InstantType start; 813 814 /** 815 * Date/Time that the appointment is to conclude. 816 */ 817 @Child(name = "end", type = {InstantType.class}, order=7, min=0, max=1, modifier=false, summary=true) 818 @Description(shortDefinition="When appointment is to conclude", formalDefinition="Date/Time that the appointment is to conclude." ) 819 protected InstantType end; 820 821 /** 822 * Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request). 823 */ 824 @Child(name = "minutesDuration", type = {PositiveIntType.class}, order=8, min=0, max=1, modifier=false, summary=false) 825 @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 (where actual time of appointment is only an estimate or is a planned appointment request)." ) 826 protected PositiveIntType minutesDuration; 827 828 /** 829 * The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot. 830 */ 831 @Child(name = "slot", type = {Slot.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 832 @Description(shortDefinition="If provided, then no schedule and start/end values MUST match slot", formalDefinition="The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot." ) 833 protected List<Reference> slot; 834 /** 835 * The actual objects that are the target of the reference (The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.) 836 */ 837 protected List<Slot> slotTarget; 838 839 840 /** 841 * Additional comments about the appointment. 842 */ 843 @Child(name = "comment", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false) 844 @Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." ) 845 protected StringType comment; 846 847 /** 848 * List of participants involved in the appointment. 849 */ 850 @Child(name = "participant", type = {}, order=11, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 851 @Description(shortDefinition="Participants involved in appointment", formalDefinition="List of participants involved in the appointment." ) 852 protected List<AppointmentParticipantComponent> participant; 853 854 private static final long serialVersionUID = -1403944125L; 855 856 /* 857 * Constructor 858 */ 859 public Appointment() { 860 super(); 861 } 862 863 /* 864 * Constructor 865 */ 866 public Appointment(Enumeration<AppointmentStatus> status) { 867 super(); 868 this.status = status; 869 } 870 871 /** 872 * @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).) 873 */ 874 public List<Identifier> getIdentifier() { 875 if (this.identifier == null) 876 this.identifier = new ArrayList<Identifier>(); 877 return this.identifier; 878 } 879 880 public boolean hasIdentifier() { 881 if (this.identifier == null) 882 return false; 883 for (Identifier item : this.identifier) 884 if (!item.isEmpty()) 885 return true; 886 return false; 887 } 888 889 /** 890 * @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).) 891 */ 892 // syntactic sugar 893 public Identifier addIdentifier() { //3 894 Identifier t = new Identifier(); 895 if (this.identifier == null) 896 this.identifier = new ArrayList<Identifier>(); 897 this.identifier.add(t); 898 return t; 899 } 900 901 // syntactic sugar 902 public Appointment addIdentifier(Identifier t) { //3 903 if (t == null) 904 return this; 905 if (this.identifier == null) 906 this.identifier = new ArrayList<Identifier>(); 907 this.identifier.add(t); 908 return this; 909 } 910 911 /** 912 * @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 913 */ 914 public Enumeration<AppointmentStatus> getStatusElement() { 915 if (this.status == null) 916 if (Configuration.errorOnAutoCreate()) 917 throw new Error("Attempt to auto-create Appointment.status"); 918 else if (Configuration.doAutoCreate()) 919 this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory()); // bb 920 return this.status; 921 } 922 923 public boolean hasStatusElement() { 924 return this.status != null && !this.status.isEmpty(); 925 } 926 927 public boolean hasStatus() { 928 return this.status != null && !this.status.isEmpty(); 929 } 930 931 /** 932 * @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 933 */ 934 public Appointment setStatusElement(Enumeration<AppointmentStatus> value) { 935 this.status = value; 936 return this; 937 } 938 939 /** 940 * @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. 941 */ 942 public AppointmentStatus getStatus() { 943 return this.status == null ? null : this.status.getValue(); 944 } 945 946 /** 947 * @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. 948 */ 949 public Appointment setStatus(AppointmentStatus value) { 950 if (this.status == null) 951 this.status = new Enumeration<AppointmentStatus>(new AppointmentStatusEnumFactory()); 952 this.status.setValue(value); 953 return this; 954 } 955 956 /** 957 * @return {@link #type} (The type of appointment that is being booked (This may also be associated with participants for location, and/or a HealthcareService).) 958 */ 959 public CodeableConcept getType() { 960 if (this.type == null) 961 if (Configuration.errorOnAutoCreate()) 962 throw new Error("Attempt to auto-create Appointment.type"); 963 else if (Configuration.doAutoCreate()) 964 this.type = new CodeableConcept(); // cc 965 return this.type; 966 } 967 968 public boolean hasType() { 969 return this.type != null && !this.type.isEmpty(); 970 } 971 972 /** 973 * @param value {@link #type} (The type of appointment that is being booked (This may also be associated with participants for location, and/or a HealthcareService).) 974 */ 975 public Appointment setType(CodeableConcept value) { 976 this.type = value; 977 return this; 978 } 979 980 /** 981 * @return {@link #reason} (The reason that this appointment is being scheduled. This is more clinical than administrative.) 982 */ 983 public CodeableConcept getReason() { 984 if (this.reason == null) 985 if (Configuration.errorOnAutoCreate()) 986 throw new Error("Attempt to auto-create Appointment.reason"); 987 else if (Configuration.doAutoCreate()) 988 this.reason = new CodeableConcept(); // cc 989 return this.reason; 990 } 991 992 public boolean hasReason() { 993 return this.reason != null && !this.reason.isEmpty(); 994 } 995 996 /** 997 * @param value {@link #reason} (The reason that this appointment is being scheduled. This is more clinical than administrative.) 998 */ 999 public Appointment setReason(CodeableConcept value) { 1000 this.reason = value; 1001 return this; 1002 } 1003 1004 /** 1005 * @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).). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1006 */ 1007 public UnsignedIntType getPriorityElement() { 1008 if (this.priority == null) 1009 if (Configuration.errorOnAutoCreate()) 1010 throw new Error("Attempt to auto-create Appointment.priority"); 1011 else if (Configuration.doAutoCreate()) 1012 this.priority = new UnsignedIntType(); // bb 1013 return this.priority; 1014 } 1015 1016 public boolean hasPriorityElement() { 1017 return this.priority != null && !this.priority.isEmpty(); 1018 } 1019 1020 public boolean hasPriority() { 1021 return this.priority != null && !this.priority.isEmpty(); 1022 } 1023 1024 /** 1025 * @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).). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1026 */ 1027 public Appointment setPriorityElement(UnsignedIntType value) { 1028 this.priority = value; 1029 return this; 1030 } 1031 1032 /** 1033 * @return 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). 1034 */ 1035 public int getPriority() { 1036 return this.priority == null || this.priority.isEmpty() ? 0 : this.priority.getValue(); 1037 } 1038 1039 /** 1040 * @param value 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). 1041 */ 1042 public Appointment setPriority(int value) { 1043 if (this.priority == null) 1044 this.priority = new UnsignedIntType(); 1045 this.priority.setValue(value); 1046 return this; 1047 } 1048 1049 /** 1050 * @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 1051 */ 1052 public StringType getDescriptionElement() { 1053 if (this.description == null) 1054 if (Configuration.errorOnAutoCreate()) 1055 throw new Error("Attempt to auto-create Appointment.description"); 1056 else if (Configuration.doAutoCreate()) 1057 this.description = new StringType(); // bb 1058 return this.description; 1059 } 1060 1061 public boolean hasDescriptionElement() { 1062 return this.description != null && !this.description.isEmpty(); 1063 } 1064 1065 public boolean hasDescription() { 1066 return this.description != null && !this.description.isEmpty(); 1067 } 1068 1069 /** 1070 * @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 1071 */ 1072 public Appointment setDescriptionElement(StringType value) { 1073 this.description = value; 1074 return this; 1075 } 1076 1077 /** 1078 * @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. 1079 */ 1080 public String getDescription() { 1081 return this.description == null ? null : this.description.getValue(); 1082 } 1083 1084 /** 1085 * @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. 1086 */ 1087 public Appointment setDescription(String value) { 1088 if (Utilities.noString(value)) 1089 this.description = null; 1090 else { 1091 if (this.description == null) 1092 this.description = new StringType(); 1093 this.description.setValue(value); 1094 } 1095 return this; 1096 } 1097 1098 /** 1099 * @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 1100 */ 1101 public InstantType getStartElement() { 1102 if (this.start == null) 1103 if (Configuration.errorOnAutoCreate()) 1104 throw new Error("Attempt to auto-create Appointment.start"); 1105 else if (Configuration.doAutoCreate()) 1106 this.start = new InstantType(); // bb 1107 return this.start; 1108 } 1109 1110 public boolean hasStartElement() { 1111 return this.start != null && !this.start.isEmpty(); 1112 } 1113 1114 public boolean hasStart() { 1115 return this.start != null && !this.start.isEmpty(); 1116 } 1117 1118 /** 1119 * @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 1120 */ 1121 public Appointment setStartElement(InstantType value) { 1122 this.start = value; 1123 return this; 1124 } 1125 1126 /** 1127 * @return Date/Time that the appointment is to take place. 1128 */ 1129 public Date getStart() { 1130 return this.start == null ? null : this.start.getValue(); 1131 } 1132 1133 /** 1134 * @param value Date/Time that the appointment is to take place. 1135 */ 1136 public Appointment setStart(Date value) { 1137 if (value == null) 1138 this.start = null; 1139 else { 1140 if (this.start == null) 1141 this.start = new InstantType(); 1142 this.start.setValue(value); 1143 } 1144 return this; 1145 } 1146 1147 /** 1148 * @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 1149 */ 1150 public InstantType getEndElement() { 1151 if (this.end == null) 1152 if (Configuration.errorOnAutoCreate()) 1153 throw new Error("Attempt to auto-create Appointment.end"); 1154 else if (Configuration.doAutoCreate()) 1155 this.end = new InstantType(); // bb 1156 return this.end; 1157 } 1158 1159 public boolean hasEndElement() { 1160 return this.end != null && !this.end.isEmpty(); 1161 } 1162 1163 public boolean hasEnd() { 1164 return this.end != null && !this.end.isEmpty(); 1165 } 1166 1167 /** 1168 * @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 1169 */ 1170 public Appointment setEndElement(InstantType value) { 1171 this.end = value; 1172 return this; 1173 } 1174 1175 /** 1176 * @return Date/Time that the appointment is to conclude. 1177 */ 1178 public Date getEnd() { 1179 return this.end == null ? null : this.end.getValue(); 1180 } 1181 1182 /** 1183 * @param value Date/Time that the appointment is to conclude. 1184 */ 1185 public Appointment setEnd(Date value) { 1186 if (value == null) 1187 this.end = null; 1188 else { 1189 if (this.end == null) 1190 this.end = new InstantType(); 1191 this.end.setValue(value); 1192 } 1193 return this; 1194 } 1195 1196 /** 1197 * @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 (where actual time of appointment is only an estimate or is a planned appointment request).). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value 1198 */ 1199 public PositiveIntType getMinutesDurationElement() { 1200 if (this.minutesDuration == null) 1201 if (Configuration.errorOnAutoCreate()) 1202 throw new Error("Attempt to auto-create Appointment.minutesDuration"); 1203 else if (Configuration.doAutoCreate()) 1204 this.minutesDuration = new PositiveIntType(); // bb 1205 return this.minutesDuration; 1206 } 1207 1208 public boolean hasMinutesDurationElement() { 1209 return this.minutesDuration != null && !this.minutesDuration.isEmpty(); 1210 } 1211 1212 public boolean hasMinutesDuration() { 1213 return this.minutesDuration != null && !this.minutesDuration.isEmpty(); 1214 } 1215 1216 /** 1217 * @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 (where actual time of appointment is only an estimate or is a planned appointment request).). This is the underlying object with id, value and extensions. The accessor "getMinutesDuration" gives direct access to the value 1218 */ 1219 public Appointment setMinutesDurationElement(PositiveIntType value) { 1220 this.minutesDuration = value; 1221 return this; 1222 } 1223 1224 /** 1225 * @return Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request). 1226 */ 1227 public int getMinutesDuration() { 1228 return this.minutesDuration == null || this.minutesDuration.isEmpty() ? 0 : this.minutesDuration.getValue(); 1229 } 1230 1231 /** 1232 * @param value Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request). 1233 */ 1234 public Appointment setMinutesDuration(int value) { 1235 if (this.minutesDuration == null) 1236 this.minutesDuration = new PositiveIntType(); 1237 this.minutesDuration.setValue(value); 1238 return this; 1239 } 1240 1241 /** 1242 * @return {@link #slot} (The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.) 1243 */ 1244 public List<Reference> getSlot() { 1245 if (this.slot == null) 1246 this.slot = new ArrayList<Reference>(); 1247 return this.slot; 1248 } 1249 1250 public boolean hasSlot() { 1251 if (this.slot == null) 1252 return false; 1253 for (Reference item : this.slot) 1254 if (!item.isEmpty()) 1255 return true; 1256 return false; 1257 } 1258 1259 /** 1260 * @return {@link #slot} (The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.) 1261 */ 1262 // syntactic sugar 1263 public Reference addSlot() { //3 1264 Reference t = new Reference(); 1265 if (this.slot == null) 1266 this.slot = new ArrayList<Reference>(); 1267 this.slot.add(t); 1268 return t; 1269 } 1270 1271 // syntactic sugar 1272 public Appointment addSlot(Reference t) { //3 1273 if (t == null) 1274 return this; 1275 if (this.slot == null) 1276 this.slot = new ArrayList<Reference>(); 1277 this.slot.add(t); 1278 return this; 1279 } 1280 1281 /** 1282 * @return {@link #slot} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.) 1283 */ 1284 public List<Slot> getSlotTarget() { 1285 if (this.slotTarget == null) 1286 this.slotTarget = new ArrayList<Slot>(); 1287 return this.slotTarget; 1288 } 1289 1290 // syntactic sugar 1291 /** 1292 * @return {@link #slot} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.) 1293 */ 1294 public Slot addSlotTarget() { 1295 Slot r = new Slot(); 1296 if (this.slotTarget == null) 1297 this.slotTarget = new ArrayList<Slot>(); 1298 this.slotTarget.add(r); 1299 return r; 1300 } 1301 1302 /** 1303 * @return {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value 1304 */ 1305 public StringType getCommentElement() { 1306 if (this.comment == null) 1307 if (Configuration.errorOnAutoCreate()) 1308 throw new Error("Attempt to auto-create Appointment.comment"); 1309 else if (Configuration.doAutoCreate()) 1310 this.comment = new StringType(); // bb 1311 return this.comment; 1312 } 1313 1314 public boolean hasCommentElement() { 1315 return this.comment != null && !this.comment.isEmpty(); 1316 } 1317 1318 public boolean hasComment() { 1319 return this.comment != null && !this.comment.isEmpty(); 1320 } 1321 1322 /** 1323 * @param value {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value 1324 */ 1325 public Appointment setCommentElement(StringType value) { 1326 this.comment = value; 1327 return this; 1328 } 1329 1330 /** 1331 * @return Additional comments about the appointment. 1332 */ 1333 public String getComment() { 1334 return this.comment == null ? null : this.comment.getValue(); 1335 } 1336 1337 /** 1338 * @param value Additional comments about the appointment. 1339 */ 1340 public Appointment setComment(String value) { 1341 if (Utilities.noString(value)) 1342 this.comment = null; 1343 else { 1344 if (this.comment == null) 1345 this.comment = new StringType(); 1346 this.comment.setValue(value); 1347 } 1348 return this; 1349 } 1350 1351 /** 1352 * @return {@link #participant} (List of participants involved in the appointment.) 1353 */ 1354 public List<AppointmentParticipantComponent> getParticipant() { 1355 if (this.participant == null) 1356 this.participant = new ArrayList<AppointmentParticipantComponent>(); 1357 return this.participant; 1358 } 1359 1360 public boolean hasParticipant() { 1361 if (this.participant == null) 1362 return false; 1363 for (AppointmentParticipantComponent item : this.participant) 1364 if (!item.isEmpty()) 1365 return true; 1366 return false; 1367 } 1368 1369 /** 1370 * @return {@link #participant} (List of participants involved in the appointment.) 1371 */ 1372 // syntactic sugar 1373 public AppointmentParticipantComponent addParticipant() { //3 1374 AppointmentParticipantComponent t = new AppointmentParticipantComponent(); 1375 if (this.participant == null) 1376 this.participant = new ArrayList<AppointmentParticipantComponent>(); 1377 this.participant.add(t); 1378 return t; 1379 } 1380 1381 // syntactic sugar 1382 public Appointment addParticipant(AppointmentParticipantComponent t) { //3 1383 if (t == null) 1384 return this; 1385 if (this.participant == null) 1386 this.participant = new ArrayList<AppointmentParticipantComponent>(); 1387 this.participant.add(t); 1388 return this; 1389 } 1390 1391 protected void listChildren(List<Property> childrenList) { 1392 super.listChildren(childrenList); 1393 childrenList.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)); 1394 childrenList.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, java.lang.Integer.MAX_VALUE, status)); 1395 childrenList.add(new Property("type", "CodeableConcept", "The type of appointment that is being booked (This may also be associated with participants for location, and/or a HealthcareService).", 0, java.lang.Integer.MAX_VALUE, type)); 1396 childrenList.add(new Property("reason", "CodeableConcept", "The reason that this appointment is being scheduled. This is more clinical than administrative.", 0, java.lang.Integer.MAX_VALUE, reason)); 1397 childrenList.add(new Property("priority", "unsignedInt", "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, java.lang.Integer.MAX_VALUE, priority)); 1398 childrenList.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, java.lang.Integer.MAX_VALUE, description)); 1399 childrenList.add(new Property("start", "instant", "Date/Time that the appointment is to take place.", 0, java.lang.Integer.MAX_VALUE, start)); 1400 childrenList.add(new Property("end", "instant", "Date/Time that the appointment is to conclude.", 0, java.lang.Integer.MAX_VALUE, end)); 1401 childrenList.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 (where actual time of appointment is only an estimate or is a planned appointment request).", 0, java.lang.Integer.MAX_VALUE, minutesDuration)); 1402 childrenList.add(new Property("slot", "Reference(Slot)", "The slot that this appointment is filling. If provided then the schedule will not be provided as slots are not recursive, and the start/end values MUST be the same as from the slot.", 0, java.lang.Integer.MAX_VALUE, slot)); 1403 childrenList.add(new Property("comment", "string", "Additional comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, comment)); 1404 childrenList.add(new Property("participant", "", "List of participants involved in the appointment.", 0, java.lang.Integer.MAX_VALUE, participant)); 1405 } 1406 1407 @Override 1408 public void setProperty(String name, Base value) throws FHIRException { 1409 if (name.equals("identifier")) 1410 this.getIdentifier().add(castToIdentifier(value)); 1411 else if (name.equals("status")) 1412 this.status = new AppointmentStatusEnumFactory().fromType(value); // Enumeration<AppointmentStatus> 1413 else if (name.equals("type")) 1414 this.type = castToCodeableConcept(value); // CodeableConcept 1415 else if (name.equals("reason")) 1416 this.reason = castToCodeableConcept(value); // CodeableConcept 1417 else if (name.equals("priority")) 1418 this.priority = castToUnsignedInt(value); // UnsignedIntType 1419 else if (name.equals("description")) 1420 this.description = castToString(value); // StringType 1421 else if (name.equals("start")) 1422 this.start = castToInstant(value); // InstantType 1423 else if (name.equals("end")) 1424 this.end = castToInstant(value); // InstantType 1425 else if (name.equals("minutesDuration")) 1426 this.minutesDuration = castToPositiveInt(value); // PositiveIntType 1427 else if (name.equals("slot")) 1428 this.getSlot().add(castToReference(value)); 1429 else if (name.equals("comment")) 1430 this.comment = castToString(value); // StringType 1431 else if (name.equals("participant")) 1432 this.getParticipant().add((AppointmentParticipantComponent) value); 1433 else 1434 super.setProperty(name, value); 1435 } 1436 1437 @Override 1438 public Base addChild(String name) throws FHIRException { 1439 if (name.equals("identifier")) { 1440 return addIdentifier(); 1441 } 1442 else if (name.equals("status")) { 1443 throw new FHIRException("Cannot call addChild on a primitive type Appointment.status"); 1444 } 1445 else if (name.equals("type")) { 1446 this.type = new CodeableConcept(); 1447 return this.type; 1448 } 1449 else if (name.equals("reason")) { 1450 this.reason = new CodeableConcept(); 1451 return this.reason; 1452 } 1453 else if (name.equals("priority")) { 1454 throw new FHIRException("Cannot call addChild on a primitive type Appointment.priority"); 1455 } 1456 else if (name.equals("description")) { 1457 throw new FHIRException("Cannot call addChild on a primitive type Appointment.description"); 1458 } 1459 else if (name.equals("start")) { 1460 throw new FHIRException("Cannot call addChild on a primitive type Appointment.start"); 1461 } 1462 else if (name.equals("end")) { 1463 throw new FHIRException("Cannot call addChild on a primitive type Appointment.end"); 1464 } 1465 else if (name.equals("minutesDuration")) { 1466 throw new FHIRException("Cannot call addChild on a primitive type Appointment.minutesDuration"); 1467 } 1468 else if (name.equals("slot")) { 1469 return addSlot(); 1470 } 1471 else if (name.equals("comment")) { 1472 throw new FHIRException("Cannot call addChild on a primitive type Appointment.comment"); 1473 } 1474 else if (name.equals("participant")) { 1475 return addParticipant(); 1476 } 1477 else 1478 return super.addChild(name); 1479 } 1480 1481 public String fhirType() { 1482 return "Appointment"; 1483 1484 } 1485 1486 public Appointment copy() { 1487 Appointment dst = new Appointment(); 1488 copyValues(dst); 1489 if (identifier != null) { 1490 dst.identifier = new ArrayList<Identifier>(); 1491 for (Identifier i : identifier) 1492 dst.identifier.add(i.copy()); 1493 }; 1494 dst.status = status == null ? null : status.copy(); 1495 dst.type = type == null ? null : type.copy(); 1496 dst.reason = reason == null ? null : reason.copy(); 1497 dst.priority = priority == null ? null : priority.copy(); 1498 dst.description = description == null ? null : description.copy(); 1499 dst.start = start == null ? null : start.copy(); 1500 dst.end = end == null ? null : end.copy(); 1501 dst.minutesDuration = minutesDuration == null ? null : minutesDuration.copy(); 1502 if (slot != null) { 1503 dst.slot = new ArrayList<Reference>(); 1504 for (Reference i : slot) 1505 dst.slot.add(i.copy()); 1506 }; 1507 dst.comment = comment == null ? null : comment.copy(); 1508 if (participant != null) { 1509 dst.participant = new ArrayList<AppointmentParticipantComponent>(); 1510 for (AppointmentParticipantComponent i : participant) 1511 dst.participant.add(i.copy()); 1512 }; 1513 return dst; 1514 } 1515 1516 protected Appointment typedCopy() { 1517 return copy(); 1518 } 1519 1520 @Override 1521 public boolean equalsDeep(Base other) { 1522 if (!super.equalsDeep(other)) 1523 return false; 1524 if (!(other instanceof Appointment)) 1525 return false; 1526 Appointment o = (Appointment) other; 1527 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true) 1528 && compareDeep(reason, o.reason, true) && compareDeep(priority, o.priority, true) && compareDeep(description, o.description, true) 1529 && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(minutesDuration, o.minutesDuration, true) 1530 && compareDeep(slot, o.slot, true) && compareDeep(comment, o.comment, true) && compareDeep(participant, o.participant, true) 1531 ; 1532 } 1533 1534 @Override 1535 public boolean equalsShallow(Base other) { 1536 if (!super.equalsShallow(other)) 1537 return false; 1538 if (!(other instanceof Appointment)) 1539 return false; 1540 Appointment o = (Appointment) other; 1541 return compareValues(status, o.status, true) && compareValues(priority, o.priority, true) && compareValues(description, o.description, true) 1542 && compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(minutesDuration, o.minutesDuration, true) 1543 && compareValues(comment, o.comment, true); 1544 } 1545 1546 public boolean isEmpty() { 1547 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 1548 && (type == null || type.isEmpty()) && (reason == null || reason.isEmpty()) && (priority == null || priority.isEmpty()) 1549 && (description == null || description.isEmpty()) && (start == null || start.isEmpty()) && (end == null || end.isEmpty()) 1550 && (minutesDuration == null || minutesDuration.isEmpty()) && (slot == null || slot.isEmpty()) 1551 && (comment == null || comment.isEmpty()) && (participant == null || participant.isEmpty()) 1552 ; 1553 } 1554 1555 @Override 1556 public ResourceType getResourceType() { 1557 return ResourceType.Appointment; 1558 } 1559 1560 @SearchParamDefinition(name="date", path="Appointment.start", description="Appointment date/time.", type="date" ) 1561 public static final String SP_DATE = "date"; 1562 @SearchParamDefinition(name="actor", path="Appointment.participant.actor", description="Any one of the individuals participating in the appointment", type="reference" ) 1563 public static final String SP_ACTOR = "actor"; 1564 @SearchParamDefinition(name="identifier", path="Appointment.identifier", description="An Identifier of the Appointment", type="token" ) 1565 public static final String SP_IDENTIFIER = "identifier"; 1566 @SearchParamDefinition(name="practitioner", path="Appointment.participant.actor", description="One of the individuals of the appointment is this practitioner", type="reference" ) 1567 public static final String SP_PRACTITIONER = "practitioner"; 1568 @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" ) 1569 public static final String SP_PARTSTATUS = "part-status"; 1570 @SearchParamDefinition(name="patient", path="Appointment.participant.actor", description="One of the individuals of the appointment is this patient", type="reference" ) 1571 public static final String SP_PATIENT = "patient"; 1572 @SearchParamDefinition(name="location", path="Appointment.participant.actor", description="This location is listed in the participants of the appointment", type="reference" ) 1573 public static final String SP_LOCATION = "location"; 1574 @SearchParamDefinition(name="status", path="Appointment.status", description="The overall status of the appointment", type="token" ) 1575 public static final String SP_STATUS = "status"; 1576 1577} 1578