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