Search in sources :

Example 1 with Slot

use of org.hl7.fhir.r4.model.Slot in project elexis-server by elexis.

the class AppointmentTest method testDirectLoadAppointmentInContactAssignedArea.

@Test
public void testDirectLoadAppointmentInContactAssignedArea() {
    Appointment appointment = client.read().resource(Appointment.class).withId("Af322a333db4daf37093177").execute();
    assertNotNull(appointment);
    assertEquals(1484116200000l, appointment.getStart().getTime());
    assertEquals(1484121600000l, appointment.getEnd().getTime());
    assertEquals(90, appointment.getMinutesDuration());
    List<AppointmentParticipantComponent> participants = appointment.getParticipant();
    assertEquals(1, participants.size());
    assertEquals(ParticipantRequired.REQUIRED, participants.get(0).getRequired());
    Practitioner practitioner = client.read().resource(Practitioner.class).withId(participants.get(0).getActor().getReferenceElement()).execute();
    assertNotNull(practitioner);
    assertEquals("Nachname", practitioner.getName().get(0).getFamily());
    List<Reference> slotReference = appointment.getSlot();
    assertNotNull(slotReference);
    Slot slot = client.read().resource(Slot.class).withId(slotReference.get(0).getReferenceElement()).execute();
    assertNotNull(slot);
    assertEquals(SlotStatus.BUSY, slot.getStatus());
    Schedule schedule = client.read().resource(Schedule.class).withId(slot.getSchedule().getReferenceElement()).execute();
    assertNotNull(schedule);
// practitioner = client.read().resource(Practitioner.class)
// .withId(schedule.getActor().get(0).getReferenceElement()).execute();
// assertEquals("Nachname", practitioner.getName().get(0).getFamily());
}
Also used : Appointment(org.hl7.fhir.r4.model.Appointment) Practitioner(org.hl7.fhir.r4.model.Practitioner) AppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent) Reference(org.hl7.fhir.r4.model.Reference) Schedule(org.hl7.fhir.r4.model.Schedule) Slot(org.hl7.fhir.r4.model.Slot) Test(org.junit.Test)

Example 2 with Slot

use of org.hl7.fhir.r4.model.Slot in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeAppointment.

protected void composeAppointment(Complex parent, String parentType, String name, Appointment element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Appointment", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Appointment", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Appointment", "status", element.getStatusElement(), -1);
    if (element.hasServiceCategory())
        composeCodeableConcept(t, "Appointment", "serviceCategory", element.getServiceCategory(), -1);
    for (int i = 0; i < element.getServiceType().size(); i++) composeCodeableConcept(t, "Appointment", "serviceType", element.getServiceType().get(i), i);
    for (int i = 0; i < element.getSpecialty().size(); i++) composeCodeableConcept(t, "Appointment", "specialty", element.getSpecialty().get(i), i);
    if (element.hasAppointmentType())
        composeCodeableConcept(t, "Appointment", "appointmentType", element.getAppointmentType(), -1);
    if (element.hasReason())
        composeCodeableConcept(t, "Appointment", "reason", element.getReason(), -1);
    if (element.hasPriorityElement())
        composeUnsignedInt(t, "Appointment", "priority", element.getPriorityElement(), -1);
    if (element.hasDescriptionElement())
        composeString(t, "Appointment", "description", element.getDescriptionElement(), -1);
    if (element.hasStartElement())
        composeInstant(t, "Appointment", "start", element.getStartElement(), -1);
    if (element.hasEndElement())
        composeInstant(t, "Appointment", "end", element.getEndElement(), -1);
    if (element.hasMinutesDurationElement())
        composePositiveInt(t, "Appointment", "minutesDuration", element.getMinutesDurationElement(), -1);
    for (int i = 0; i < element.getSlot().size(); i++) composeReference(t, "Appointment", "slot", element.getSlot().get(i), i);
    if (element.hasCreatedElement())
        composeDateTime(t, "Appointment", "created", element.getCreatedElement(), -1);
    if (element.hasCommentElement())
        composeString(t, "Appointment", "comment", element.getCommentElement(), -1);
    for (int i = 0; i < element.getParticipant().size(); i++) composeAppointmentAppointmentParticipantComponent(t, "Appointment", "participant", element.getParticipant().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 3 with Slot

use of org.hl7.fhir.r4.model.Slot in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeSlot.

protected void composeSlot(Complex parent, String parentType, String name, Slot element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Slot", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Slot", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getServiceCategory().size(); i++) composeCodeableConcept(t, "Slot", "serviceCategory", element.getServiceCategory().get(i), i);
    for (int i = 0; i < element.getServiceType().size(); i++) composeCodeableConcept(t, "Slot", "serviceType", element.getServiceType().get(i), i);
    for (int i = 0; i < element.getSpecialty().size(); i++) composeCodeableConcept(t, "Slot", "specialty", element.getSpecialty().get(i), i);
    if (element.hasAppointmentType())
        composeCodeableConcept(t, "Slot", "appointmentType", element.getAppointmentType(), -1);
    if (element.hasSchedule())
        composeReference(t, "Slot", "schedule", element.getSchedule(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "Slot", "status", element.getStatusElement(), -1);
    if (element.hasStartElement())
        composeInstant(t, "Slot", "start", element.getStartElement(), -1);
    if (element.hasEndElement())
        composeInstant(t, "Slot", "end", element.getEndElement(), -1);
    if (element.hasOverbookedElement())
        composeBoolean(t, "Slot", "overbooked", element.getOverbookedElement(), -1);
    if (element.hasCommentElement())
        composeString(t, "Slot", "comment", element.getCommentElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 4 with Slot

use of org.hl7.fhir.r4.model.Slot in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeAppointment.

protected void composeAppointment(Complex parent, String parentType, String name, Appointment element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Appointment", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Appointment", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Appointment", "status", element.getStatusElement(), -1);
    if (element.hasCancelationReason())
        composeCodeableConcept(t, "Appointment", "cancelationReason", element.getCancelationReason(), -1);
    for (int i = 0; i < element.getServiceCategory().size(); i++) composeCodeableConcept(t, "Appointment", "serviceCategory", element.getServiceCategory().get(i), i);
    for (int i = 0; i < element.getServiceType().size(); i++) composeCodeableConcept(t, "Appointment", "serviceType", element.getServiceType().get(i), i);
    for (int i = 0; i < element.getSpecialty().size(); i++) composeCodeableConcept(t, "Appointment", "specialty", element.getSpecialty().get(i), i);
    if (element.hasAppointmentType())
        composeCodeableConcept(t, "Appointment", "appointmentType", element.getAppointmentType(), -1);
    for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "Appointment", "reasonCode", element.getReasonCode().get(i), i);
    for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "Appointment", "reasonReference", element.getReasonReference().get(i), i);
    if (element.hasPriorityElement())
        composeUnsignedInt(t, "Appointment", "priority", element.getPriorityElement(), -1);
    if (element.hasDescriptionElement())
        composeString(t, "Appointment", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getSupportingInformation().size(); i++) composeReference(t, "Appointment", "supportingInformation", element.getSupportingInformation().get(i), i);
    if (element.hasStartElement())
        composeInstant(t, "Appointment", "start", element.getStartElement(), -1);
    if (element.hasEndElement())
        composeInstant(t, "Appointment", "end", element.getEndElement(), -1);
    if (element.hasMinutesDurationElement())
        composePositiveInt(t, "Appointment", "minutesDuration", element.getMinutesDurationElement(), -1);
    for (int i = 0; i < element.getSlot().size(); i++) composeReference(t, "Appointment", "slot", element.getSlot().get(i), i);
    if (element.hasCreatedElement())
        composeDateTime(t, "Appointment", "created", element.getCreatedElement(), -1);
    if (element.hasCommentElement())
        composeString(t, "Appointment", "comment", element.getCommentElement(), -1);
    if (element.hasPatientInstructionElement())
        composeString(t, "Appointment", "patientInstruction", element.getPatientInstructionElement(), -1);
    for (int i = 0; i < element.getBasedOn().size(); i++) composeReference(t, "Appointment", "basedOn", element.getBasedOn().get(i), i);
    for (int i = 0; i < element.getParticipant().size(); i++) composeAppointmentAppointmentParticipantComponent(t, "Appointment", "participant", element.getParticipant().get(i), i);
    for (int i = 0; i < element.getRequestedPeriod().size(); i++) composePeriod(t, "Appointment", "requestedPeriod", element.getRequestedPeriod().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 5 with Slot

use of org.hl7.fhir.r4.model.Slot in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_slot_example_busy.

@Test
public void test_slot_example_busy() throws FileNotFoundException, IOException, Exception {
    System.out.println("slot-example-busy.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\slot-example-busy.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Aggregations

SlotDetail (uk.gov.hscic.model.appointment.SlotDetail)10 ArrayList (java.util.ArrayList)6 Slot (org.hl7.fhir.dstu3.model.Slot)6 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)4 Test (org.junit.jupiter.api.Test)4 AppointmentDetail (uk.gov.hscic.model.appointment.AppointmentDetail)4 IdDt (ca.uhn.fhir.model.primitive.IdDt)3 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)3 AppointmentParticipantComponent (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent)3 ScheduleDetail (uk.gov.hscic.model.appointment.ScheduleDetail)3 Date (java.util.Date)2 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)2 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)2 IdType (org.hl7.fhir.dstu3.model.IdType)2 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)2 Reference (org.hl7.fhir.dstu3.model.Reference)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)2 VC (uk.gov.hscic.common.validators.VC)2 BookingOrgDetail (uk.gov.hscic.model.appointment.BookingOrgDetail)2