001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.exceptions.FHIRException; 045import org.hl7.fhir.utilities.Utilities; 046/** 047 * A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection. 048 */ 049@ResourceDef(name="AppointmentResponse", profile="http://hl7.org/fhir/Profile/AppointmentResponse") 050public class AppointmentResponse extends DomainResource { 051 052 public enum ParticipantStatus { 053 /** 054 * The appointment participant has accepted that they can attend the appointment at the time specified in the AppointmentResponse. 055 */ 056 ACCEPTED, 057 /** 058 * The appointment participant has declined the appointment. 059 */ 060 DECLINED, 061 /** 062 * The appointment participant has tentatively accepted the appointment. 063 */ 064 TENTATIVE, 065 /** 066 * The participant has in-process the appointment. 067 */ 068 INPROCESS, 069 /** 070 * The participant has completed the appointment. 071 */ 072 COMPLETED, 073 /** 074 * This is the intitial status of an appointment participant until a participant has replied. It implies that there is no commitment for the appointment. 075 */ 076 NEEDSACTION, 077 /** 078 * added to help the parsers 079 */ 080 NULL; 081 public static ParticipantStatus fromCode(String codeString) throws FHIRException { 082 if (codeString == null || "".equals(codeString)) 083 return null; 084 if ("accepted".equals(codeString)) 085 return ACCEPTED; 086 if ("declined".equals(codeString)) 087 return DECLINED; 088 if ("tentative".equals(codeString)) 089 return TENTATIVE; 090 if ("in-process".equals(codeString)) 091 return INPROCESS; 092 if ("completed".equals(codeString)) 093 return COMPLETED; 094 if ("needs-action".equals(codeString)) 095 return NEEDSACTION; 096 throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'"); 097 } 098 public String toCode() { 099 switch (this) { 100 case ACCEPTED: return "accepted"; 101 case DECLINED: return "declined"; 102 case TENTATIVE: return "tentative"; 103 case INPROCESS: return "in-process"; 104 case COMPLETED: return "completed"; 105 case NEEDSACTION: return "needs-action"; 106 case NULL: return null; 107 default: return "?"; 108 } 109 } 110 public String getSystem() { 111 switch (this) { 112 case ACCEPTED: return "http://hl7.org/fhir/participantstatus"; 113 case DECLINED: return "http://hl7.org/fhir/participantstatus"; 114 case TENTATIVE: return "http://hl7.org/fhir/participantstatus"; 115 case INPROCESS: return "http://hl7.org/fhir/participantstatus"; 116 case COMPLETED: return "http://hl7.org/fhir/participantstatus"; 117 case NEEDSACTION: return "http://hl7.org/fhir/participantstatus"; 118 case NULL: return null; 119 default: return "?"; 120 } 121 } 122 public String getDefinition() { 123 switch (this) { 124 case ACCEPTED: return "The appointment participant has accepted that they can attend the appointment at the time specified in the AppointmentResponse."; 125 case DECLINED: return "The appointment participant has declined the appointment."; 126 case TENTATIVE: return "The appointment participant has tentatively accepted the appointment."; 127 case INPROCESS: return "The participant has in-process the appointment."; 128 case COMPLETED: return "The participant has completed the appointment."; 129 case NEEDSACTION: return "This is the intitial status of an appointment participant until a participant has replied. It implies that there is no commitment for the appointment."; 130 case NULL: return null; 131 default: return "?"; 132 } 133 } 134 public String getDisplay() { 135 switch (this) { 136 case ACCEPTED: return "Accepted"; 137 case DECLINED: return "Declined"; 138 case TENTATIVE: return "Tentative"; 139 case INPROCESS: return "In Process"; 140 case COMPLETED: return "Completed"; 141 case NEEDSACTION: return "Needs Action"; 142 case NULL: return null; 143 default: return "?"; 144 } 145 } 146 } 147 148 public static class ParticipantStatusEnumFactory implements EnumFactory<ParticipantStatus> { 149 public ParticipantStatus fromCode(String codeString) throws IllegalArgumentException { 150 if (codeString == null || "".equals(codeString)) 151 if (codeString == null || "".equals(codeString)) 152 return null; 153 if ("accepted".equals(codeString)) 154 return ParticipantStatus.ACCEPTED; 155 if ("declined".equals(codeString)) 156 return ParticipantStatus.DECLINED; 157 if ("tentative".equals(codeString)) 158 return ParticipantStatus.TENTATIVE; 159 if ("in-process".equals(codeString)) 160 return ParticipantStatus.INPROCESS; 161 if ("completed".equals(codeString)) 162 return ParticipantStatus.COMPLETED; 163 if ("needs-action".equals(codeString)) 164 return ParticipantStatus.NEEDSACTION; 165 throw new IllegalArgumentException("Unknown ParticipantStatus code '"+codeString+"'"); 166 } 167 public Enumeration<ParticipantStatus> fromType(Base code) throws FHIRException { 168 if (code == null || code.isEmpty()) 169 return null; 170 String codeString = ((PrimitiveType) code).asStringValue(); 171 if (codeString == null || "".equals(codeString)) 172 return null; 173 if ("accepted".equals(codeString)) 174 return new Enumeration<ParticipantStatus>(this, ParticipantStatus.ACCEPTED); 175 if ("declined".equals(codeString)) 176 return new Enumeration<ParticipantStatus>(this, ParticipantStatus.DECLINED); 177 if ("tentative".equals(codeString)) 178 return new Enumeration<ParticipantStatus>(this, ParticipantStatus.TENTATIVE); 179 if ("in-process".equals(codeString)) 180 return new Enumeration<ParticipantStatus>(this, ParticipantStatus.INPROCESS); 181 if ("completed".equals(codeString)) 182 return new Enumeration<ParticipantStatus>(this, ParticipantStatus.COMPLETED); 183 if ("needs-action".equals(codeString)) 184 return new Enumeration<ParticipantStatus>(this, ParticipantStatus.NEEDSACTION); 185 throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'"); 186 } 187 public String toCode(ParticipantStatus code) { 188 if (code == ParticipantStatus.ACCEPTED) 189 return "accepted"; 190 if (code == ParticipantStatus.DECLINED) 191 return "declined"; 192 if (code == ParticipantStatus.TENTATIVE) 193 return "tentative"; 194 if (code == ParticipantStatus.INPROCESS) 195 return "in-process"; 196 if (code == ParticipantStatus.COMPLETED) 197 return "completed"; 198 if (code == ParticipantStatus.NEEDSACTION) 199 return "needs-action"; 200 return "?"; 201 } 202 } 203 204 /** 205 * This records identifiers associated with this appointment response 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. 206 */ 207 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 208 @Description(shortDefinition="External Ids for this item", formalDefinition="This records identifiers associated with this appointment response 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." ) 209 protected List<Identifier> identifier; 210 211 /** 212 * Appointment that this response is replying to. 213 */ 214 @Child(name = "appointment", type = {Appointment.class}, order=1, min=1, max=1, modifier=false, summary=true) 215 @Description(shortDefinition="Appointment this response relates to", formalDefinition="Appointment that this response is replying to." ) 216 protected Reference appointment; 217 218 /** 219 * The actual object that is the target of the reference (Appointment that this response is replying to.) 220 */ 221 protected Appointment appointmentTarget; 222 223 /** 224 * Date/Time that the appointment is to take place, or requested new start time. 225 */ 226 @Child(name = "start", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=false) 227 @Description(shortDefinition="Time from appointment, or requested new start time", formalDefinition="Date/Time that the appointment is to take place, or requested new start time." ) 228 protected InstantType start; 229 230 /** 231 * This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time. 232 */ 233 @Child(name = "end", type = {InstantType.class}, order=3, min=0, max=1, modifier=false, summary=false) 234 @Description(shortDefinition="Time from appointment, or requested new end time", formalDefinition="This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time." ) 235 protected InstantType end; 236 237 /** 238 * Role of participant in the appointment. 239 */ 240 @Child(name = "participantType", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 241 @Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." ) 242 protected List<CodeableConcept> participantType; 243 244 /** 245 * A Person, Location/HealthcareService or Device that is participating in the appointment. 246 */ 247 @Child(name = "actor", type = {Patient.class, Practitioner.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=5, min=0, max=1, modifier=false, summary=true) 248 @Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." ) 249 protected Reference actor; 250 251 /** 252 * The actual object that is the target of the reference (A Person, Location/HealthcareService or Device that is participating in the appointment.) 253 */ 254 protected Resource actorTarget; 255 256 /** 257 * Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty. 258 */ 259 @Child(name = "participantStatus", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true) 260 @Description(shortDefinition="accepted | declined | tentative | in-process | completed | needs-action", formalDefinition="Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty." ) 261 protected Enumeration<ParticipantStatus> participantStatus; 262 263 /** 264 * Additional comments about the appointment. 265 */ 266 @Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false) 267 @Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." ) 268 protected StringType comment; 269 270 private static final long serialVersionUID = 248548635L; 271 272 /* 273 * Constructor 274 */ 275 public AppointmentResponse() { 276 super(); 277 } 278 279 /* 280 * Constructor 281 */ 282 public AppointmentResponse(Reference appointment, Enumeration<ParticipantStatus> participantStatus) { 283 super(); 284 this.appointment = appointment; 285 this.participantStatus = participantStatus; 286 } 287 288 /** 289 * @return {@link #identifier} (This records identifiers associated with this appointment response 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.) 290 */ 291 public List<Identifier> getIdentifier() { 292 if (this.identifier == null) 293 this.identifier = new ArrayList<Identifier>(); 294 return this.identifier; 295 } 296 297 public boolean hasIdentifier() { 298 if (this.identifier == null) 299 return false; 300 for (Identifier item : this.identifier) 301 if (!item.isEmpty()) 302 return true; 303 return false; 304 } 305 306 /** 307 * @return {@link #identifier} (This records identifiers associated with this appointment response 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.) 308 */ 309 // syntactic sugar 310 public Identifier addIdentifier() { //3 311 Identifier t = new Identifier(); 312 if (this.identifier == null) 313 this.identifier = new ArrayList<Identifier>(); 314 this.identifier.add(t); 315 return t; 316 } 317 318 // syntactic sugar 319 public AppointmentResponse addIdentifier(Identifier t) { //3 320 if (t == null) 321 return this; 322 if (this.identifier == null) 323 this.identifier = new ArrayList<Identifier>(); 324 this.identifier.add(t); 325 return this; 326 } 327 328 /** 329 * @return {@link #appointment} (Appointment that this response is replying to.) 330 */ 331 public Reference getAppointment() { 332 if (this.appointment == null) 333 if (Configuration.errorOnAutoCreate()) 334 throw new Error("Attempt to auto-create AppointmentResponse.appointment"); 335 else if (Configuration.doAutoCreate()) 336 this.appointment = new Reference(); // cc 337 return this.appointment; 338 } 339 340 public boolean hasAppointment() { 341 return this.appointment != null && !this.appointment.isEmpty(); 342 } 343 344 /** 345 * @param value {@link #appointment} (Appointment that this response is replying to.) 346 */ 347 public AppointmentResponse setAppointment(Reference value) { 348 this.appointment = value; 349 return this; 350 } 351 352 /** 353 * @return {@link #appointment} 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. (Appointment that this response is replying to.) 354 */ 355 public Appointment getAppointmentTarget() { 356 if (this.appointmentTarget == null) 357 if (Configuration.errorOnAutoCreate()) 358 throw new Error("Attempt to auto-create AppointmentResponse.appointment"); 359 else if (Configuration.doAutoCreate()) 360 this.appointmentTarget = new Appointment(); // aa 361 return this.appointmentTarget; 362 } 363 364 /** 365 * @param value {@link #appointment} 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. (Appointment that this response is replying to.) 366 */ 367 public AppointmentResponse setAppointmentTarget(Appointment value) { 368 this.appointmentTarget = value; 369 return this; 370 } 371 372 /** 373 * @return {@link #start} (Date/Time that the appointment is to take place, or requested new start time.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value 374 */ 375 public InstantType getStartElement() { 376 if (this.start == null) 377 if (Configuration.errorOnAutoCreate()) 378 throw new Error("Attempt to auto-create AppointmentResponse.start"); 379 else if (Configuration.doAutoCreate()) 380 this.start = new InstantType(); // bb 381 return this.start; 382 } 383 384 public boolean hasStartElement() { 385 return this.start != null && !this.start.isEmpty(); 386 } 387 388 public boolean hasStart() { 389 return this.start != null && !this.start.isEmpty(); 390 } 391 392 /** 393 * @param value {@link #start} (Date/Time that the appointment is to take place, or requested new start time.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value 394 */ 395 public AppointmentResponse setStartElement(InstantType value) { 396 this.start = value; 397 return this; 398 } 399 400 /** 401 * @return Date/Time that the appointment is to take place, or requested new start time. 402 */ 403 public Date getStart() { 404 return this.start == null ? null : this.start.getValue(); 405 } 406 407 /** 408 * @param value Date/Time that the appointment is to take place, or requested new start time. 409 */ 410 public AppointmentResponse setStart(Date value) { 411 if (value == null) 412 this.start = null; 413 else { 414 if (this.start == null) 415 this.start = new InstantType(); 416 this.start.setValue(value); 417 } 418 return this; 419 } 420 421 /** 422 * @return {@link #end} (This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value 423 */ 424 public InstantType getEndElement() { 425 if (this.end == null) 426 if (Configuration.errorOnAutoCreate()) 427 throw new Error("Attempt to auto-create AppointmentResponse.end"); 428 else if (Configuration.doAutoCreate()) 429 this.end = new InstantType(); // bb 430 return this.end; 431 } 432 433 public boolean hasEndElement() { 434 return this.end != null && !this.end.isEmpty(); 435 } 436 437 public boolean hasEnd() { 438 return this.end != null && !this.end.isEmpty(); 439 } 440 441 /** 442 * @param value {@link #end} (This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value 443 */ 444 public AppointmentResponse setEndElement(InstantType value) { 445 this.end = value; 446 return this; 447 } 448 449 /** 450 * @return This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time. 451 */ 452 public Date getEnd() { 453 return this.end == null ? null : this.end.getValue(); 454 } 455 456 /** 457 * @param value This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time. 458 */ 459 public AppointmentResponse setEnd(Date value) { 460 if (value == null) 461 this.end = null; 462 else { 463 if (this.end == null) 464 this.end = new InstantType(); 465 this.end.setValue(value); 466 } 467 return this; 468 } 469 470 /** 471 * @return {@link #participantType} (Role of participant in the appointment.) 472 */ 473 public List<CodeableConcept> getParticipantType() { 474 if (this.participantType == null) 475 this.participantType = new ArrayList<CodeableConcept>(); 476 return this.participantType; 477 } 478 479 public boolean hasParticipantType() { 480 if (this.participantType == null) 481 return false; 482 for (CodeableConcept item : this.participantType) 483 if (!item.isEmpty()) 484 return true; 485 return false; 486 } 487 488 /** 489 * @return {@link #participantType} (Role of participant in the appointment.) 490 */ 491 // syntactic sugar 492 public CodeableConcept addParticipantType() { //3 493 CodeableConcept t = new CodeableConcept(); 494 if (this.participantType == null) 495 this.participantType = new ArrayList<CodeableConcept>(); 496 this.participantType.add(t); 497 return t; 498 } 499 500 // syntactic sugar 501 public AppointmentResponse addParticipantType(CodeableConcept t) { //3 502 if (t == null) 503 return this; 504 if (this.participantType == null) 505 this.participantType = new ArrayList<CodeableConcept>(); 506 this.participantType.add(t); 507 return this; 508 } 509 510 /** 511 * @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.) 512 */ 513 public Reference getActor() { 514 if (this.actor == null) 515 if (Configuration.errorOnAutoCreate()) 516 throw new Error("Attempt to auto-create AppointmentResponse.actor"); 517 else if (Configuration.doAutoCreate()) 518 this.actor = new Reference(); // cc 519 return this.actor; 520 } 521 522 public boolean hasActor() { 523 return this.actor != null && !this.actor.isEmpty(); 524 } 525 526 /** 527 * @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.) 528 */ 529 public AppointmentResponse setActor(Reference value) { 530 this.actor = value; 531 return this; 532 } 533 534 /** 535 * @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.) 536 */ 537 public Resource getActorTarget() { 538 return this.actorTarget; 539 } 540 541 /** 542 * @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.) 543 */ 544 public AppointmentResponse setActorTarget(Resource value) { 545 this.actorTarget = value; 546 return this; 547 } 548 549 /** 550 * @return {@link #participantStatus} (Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.). This is the underlying object with id, value and extensions. The accessor "getParticipantStatus" gives direct access to the value 551 */ 552 public Enumeration<ParticipantStatus> getParticipantStatusElement() { 553 if (this.participantStatus == null) 554 if (Configuration.errorOnAutoCreate()) 555 throw new Error("Attempt to auto-create AppointmentResponse.participantStatus"); 556 else if (Configuration.doAutoCreate()) 557 this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory()); // bb 558 return this.participantStatus; 559 } 560 561 public boolean hasParticipantStatusElement() { 562 return this.participantStatus != null && !this.participantStatus.isEmpty(); 563 } 564 565 public boolean hasParticipantStatus() { 566 return this.participantStatus != null && !this.participantStatus.isEmpty(); 567 } 568 569 /** 570 * @param value {@link #participantStatus} (Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.). This is the underlying object with id, value and extensions. The accessor "getParticipantStatus" gives direct access to the value 571 */ 572 public AppointmentResponse setParticipantStatusElement(Enumeration<ParticipantStatus> value) { 573 this.participantStatus = value; 574 return this; 575 } 576 577 /** 578 * @return Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty. 579 */ 580 public ParticipantStatus getParticipantStatus() { 581 return this.participantStatus == null ? null : this.participantStatus.getValue(); 582 } 583 584 /** 585 * @param value Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty. 586 */ 587 public AppointmentResponse setParticipantStatus(ParticipantStatus value) { 588 if (this.participantStatus == null) 589 this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory()); 590 this.participantStatus.setValue(value); 591 return this; 592 } 593 594 /** 595 * @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 596 */ 597 public StringType getCommentElement() { 598 if (this.comment == null) 599 if (Configuration.errorOnAutoCreate()) 600 throw new Error("Attempt to auto-create AppointmentResponse.comment"); 601 else if (Configuration.doAutoCreate()) 602 this.comment = new StringType(); // bb 603 return this.comment; 604 } 605 606 public boolean hasCommentElement() { 607 return this.comment != null && !this.comment.isEmpty(); 608 } 609 610 public boolean hasComment() { 611 return this.comment != null && !this.comment.isEmpty(); 612 } 613 614 /** 615 * @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 616 */ 617 public AppointmentResponse setCommentElement(StringType value) { 618 this.comment = value; 619 return this; 620 } 621 622 /** 623 * @return Additional comments about the appointment. 624 */ 625 public String getComment() { 626 return this.comment == null ? null : this.comment.getValue(); 627 } 628 629 /** 630 * @param value Additional comments about the appointment. 631 */ 632 public AppointmentResponse setComment(String value) { 633 if (Utilities.noString(value)) 634 this.comment = null; 635 else { 636 if (this.comment == null) 637 this.comment = new StringType(); 638 this.comment.setValue(value); 639 } 640 return this; 641 } 642 643 protected void listChildren(List<Property> childrenList) { 644 super.listChildren(childrenList); 645 childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this appointment response 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.", 0, java.lang.Integer.MAX_VALUE, identifier)); 646 childrenList.add(new Property("appointment", "Reference(Appointment)", "Appointment that this response is replying to.", 0, java.lang.Integer.MAX_VALUE, appointment)); 647 childrenList.add(new Property("start", "instant", "Date/Time that the appointment is to take place, or requested new start time.", 0, java.lang.Integer.MAX_VALUE, start)); 648 childrenList.add(new Property("end", "instant", "This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.", 0, java.lang.Integer.MAX_VALUE, end)); 649 childrenList.add(new Property("participantType", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, participantType)); 650 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)); 651 childrenList.add(new Property("participantStatus", "code", "Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.", 0, java.lang.Integer.MAX_VALUE, participantStatus)); 652 childrenList.add(new Property("comment", "string", "Additional comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, comment)); 653 } 654 655 @Override 656 public void setProperty(String name, Base value) throws FHIRException { 657 if (name.equals("identifier")) 658 this.getIdentifier().add(castToIdentifier(value)); 659 else if (name.equals("appointment")) 660 this.appointment = castToReference(value); // Reference 661 else if (name.equals("start")) 662 this.start = castToInstant(value); // InstantType 663 else if (name.equals("end")) 664 this.end = castToInstant(value); // InstantType 665 else if (name.equals("participantType")) 666 this.getParticipantType().add(castToCodeableConcept(value)); 667 else if (name.equals("actor")) 668 this.actor = castToReference(value); // Reference 669 else if (name.equals("participantStatus")) 670 this.participantStatus = new ParticipantStatusEnumFactory().fromType(value); // Enumeration<ParticipantStatus> 671 else if (name.equals("comment")) 672 this.comment = castToString(value); // StringType 673 else 674 super.setProperty(name, value); 675 } 676 677 @Override 678 public Base addChild(String name) throws FHIRException { 679 if (name.equals("identifier")) { 680 return addIdentifier(); 681 } 682 else if (name.equals("appointment")) { 683 this.appointment = new Reference(); 684 return this.appointment; 685 } 686 else if (name.equals("start")) { 687 throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.start"); 688 } 689 else if (name.equals("end")) { 690 throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.end"); 691 } 692 else if (name.equals("participantType")) { 693 return addParticipantType(); 694 } 695 else if (name.equals("actor")) { 696 this.actor = new Reference(); 697 return this.actor; 698 } 699 else if (name.equals("participantStatus")) { 700 throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.participantStatus"); 701 } 702 else if (name.equals("comment")) { 703 throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.comment"); 704 } 705 else 706 return super.addChild(name); 707 } 708 709 public String fhirType() { 710 return "AppointmentResponse"; 711 712 } 713 714 public AppointmentResponse copy() { 715 AppointmentResponse dst = new AppointmentResponse(); 716 copyValues(dst); 717 if (identifier != null) { 718 dst.identifier = new ArrayList<Identifier>(); 719 for (Identifier i : identifier) 720 dst.identifier.add(i.copy()); 721 }; 722 dst.appointment = appointment == null ? null : appointment.copy(); 723 dst.start = start == null ? null : start.copy(); 724 dst.end = end == null ? null : end.copy(); 725 if (participantType != null) { 726 dst.participantType = new ArrayList<CodeableConcept>(); 727 for (CodeableConcept i : participantType) 728 dst.participantType.add(i.copy()); 729 }; 730 dst.actor = actor == null ? null : actor.copy(); 731 dst.participantStatus = participantStatus == null ? null : participantStatus.copy(); 732 dst.comment = comment == null ? null : comment.copy(); 733 return dst; 734 } 735 736 protected AppointmentResponse typedCopy() { 737 return copy(); 738 } 739 740 @Override 741 public boolean equalsDeep(Base other) { 742 if (!super.equalsDeep(other)) 743 return false; 744 if (!(other instanceof AppointmentResponse)) 745 return false; 746 AppointmentResponse o = (AppointmentResponse) other; 747 return compareDeep(identifier, o.identifier, true) && compareDeep(appointment, o.appointment, true) 748 && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(participantType, o.participantType, true) 749 && compareDeep(actor, o.actor, true) && compareDeep(participantStatus, o.participantStatus, true) 750 && compareDeep(comment, o.comment, true); 751 } 752 753 @Override 754 public boolean equalsShallow(Base other) { 755 if (!super.equalsShallow(other)) 756 return false; 757 if (!(other instanceof AppointmentResponse)) 758 return false; 759 AppointmentResponse o = (AppointmentResponse) other; 760 return compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(participantStatus, o.participantStatus, true) 761 && compareValues(comment, o.comment, true); 762 } 763 764 public boolean isEmpty() { 765 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (appointment == null || appointment.isEmpty()) 766 && (start == null || start.isEmpty()) && (end == null || end.isEmpty()) && (participantType == null || participantType.isEmpty()) 767 && (actor == null || actor.isEmpty()) && (participantStatus == null || participantStatus.isEmpty()) 768 && (comment == null || comment.isEmpty()); 769 } 770 771 @Override 772 public ResourceType getResourceType() { 773 return ResourceType.AppointmentResponse; 774 } 775 776 @SearchParamDefinition(name="actor", path="AppointmentResponse.actor", description="The Person, Location/HealthcareService or Device that this appointment response replies for", type="reference" ) 777 public static final String SP_ACTOR = "actor"; 778 @SearchParamDefinition(name="identifier", path="AppointmentResponse.identifier", description="An Identifier in this appointment response", type="token" ) 779 public static final String SP_IDENTIFIER = "identifier"; 780 @SearchParamDefinition(name="practitioner", path="AppointmentResponse.actor", description="This Response is for this Practitioner", type="reference" ) 781 public static final String SP_PRACTITIONER = "practitioner"; 782 @SearchParamDefinition(name="part-status", path="AppointmentResponse.participantStatus", description="The participants acceptance status for this appointment", type="token" ) 783 public static final String SP_PARTSTATUS = "part-status"; 784 @SearchParamDefinition(name="patient", path="AppointmentResponse.actor", description="This Response is for this Patient", type="reference" ) 785 public static final String SP_PATIENT = "patient"; 786 @SearchParamDefinition(name="appointment", path="AppointmentResponse.appointment", description="The appointment that the response is attached to", type="reference" ) 787 public static final String SP_APPOINTMENT = "appointment"; 788 @SearchParamDefinition(name="location", path="AppointmentResponse.actor", description="This Response is for this Location", type="reference" ) 789 public static final String SP_LOCATION = "location"; 790 791}