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