Skip to content

Microservice to be used by doctors and patients to manage appointments

Notifications You must be signed in to change notification settings

neogopher/appointment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

appointment

Microservice to be used by doctors and patients to manage appointments

Appointment lets Doctor create schedule for their availability. Patient can check Doctor's schedule and book an Appointment if slot is available. Doctor can only create schedule for the current day. The size of a slot is 15 mins.

Endpoints

/schedule : Doctor can use this to specify what time he/she is available for appointments.

/book : Used by Patient to book the 15 min time slot with the Doctor.

/list : Used to list the complete schedule of the Doctor's appointments for the day.

/cancel : Used to cancel an appointment. Can be used by either Doctor or Patient.

/signup : Used to signup for the service and recieve a token which will be required in all further interactions.



N.B Listening port of the service can be configured by using the PORT environment variable. defaults to 8080.



Usage

All endpoints accept valid JSON and respond with valid JSON.

All Time values to be provided in "YYYY-mm-ddTHH:MM:SSZ" format only. e.g. 2021-07-18T13:30:00Z

POST: /signup


The first step is to hit the /signup endpoint to get a Token

Request Body:

{
  "name": "Sachin",
  "usertype": "Doctor"
}

Fields:

  • name (String) : Name of the User

  • usertype (String) : Type of User. Allowed values - "Patient" or "Doctor"

Response Body:

{
  "message": "Account created",
  "status": 200,
  "token": "MXxEb2N0b3I"
}

POST: /schedule


Next the Doctor can create his/her schedule

Request Body:

{
  "starttime": "2021-07-18T19:00:00Z",
  "endtime": "2021-07-18T20:30:00Z",
  "token": "MXxEb2N0b3I"
}

Fields:

  • starttime (Time) : Start time of schedule

  • endtime (Time) : End time of schedule

  • token : Token generated in Step 1

Response Body:

{
  "message": "Schedule created",
  "status": 200
}

POST: /list


Patient can list Doctor's schedule

Request Body:

{
  "doctorname": "Sachin",
  "token": "MXxQYXRpZW50"
}

Fields:

  • doctorname (String) : Name of the doctor to list schedule for

  • token : Token generated in Step 1

Response Body:

{
  "appointments": [
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:00:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:15:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:30:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:45:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T20:00:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T20:15:00Z",
      "booked": false
    }
  ],
  "message": "Appointments Listed",
  "status": 200
}

POST: /book


Patient can book an Appointment

Request Body:

{
  "doctorname": "Sachin",
  "starttime": "2021-07-18T19:30:00Z",
  "token": "MXxQYXRpZW50"
}

Fields:

  • doctorname (String) : Name of the doctor whose appointment to be booked

  • starttime (Time) : Start time of appointment

  • token : Token generated in Step 1

Response Body:

{
  "appointmentid": 1,
  "message": "Appointment booked",
  "status": 200
}
  • appointmentid : To be used while cancelling appointment

Another Patient cant book the same slot
Request:
{
  "doctorname": "Sachin",
  "starttime": "2021-07-18T19:30:00Z",
  "token": "MnxQYXRpZW50"
}

Response:

{
  "message": "Slot already taken",
  "status": 400,
  "error": ""
}

They can book a different slot
Request:
{
  "doctorname": "Sachin",
  "starttime": "2021-07-18T20:00:00Z",
  "token": "MnxQYXRpZW50"
}

Response:

{
  "appointmentid": 2,
  "message": "Appointment booked",
  "status": 200
}

Schedule listing after 2 slots were booked
{
  "appointments": [
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:00:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:15:00Z",
      "booked": false
    },
    {
      "appointmentid": "1",
      "doctorid": "1",
      "patientid": "1",
      "starttime": "2021-07-18T19:30:00Z",
      "booked": true
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:45:00Z",
      "booked": false
    },
    {
      "appointmentid": "2",
      "doctorid": "1",
      "patientid": "2",
      "starttime": "2021-07-18T20:00:00Z",
      "booked": true
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T20:15:00Z",
      "booked": false
    }
  ],
  "message": "Appointments Listed",
  "status": 200
}

POST: /cancel


Patient can cancel their appointment

Request Body:

{
  "appointmentid": 1,
  "token": "MXxQYXRpZW50"
}

Fields:

  • appointmentid (Int) : Appointment ID received when slot was booked

  • token : Token generated in Step 1

Response Body:

{
  "message": "Appointment cancelled",
  "status": 200
}

Schedule listing after 1 cancellation
{
  "appointments": [
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:00:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:15:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:30:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:45:00Z",
      "booked": false
    },
    {
      "appointmentid": "2",
      "doctorid": "1",
      "patientid": "2",
      "starttime": "2021-07-18T20:00:00Z",
      "booked": true
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T20:15:00Z",
      "booked": false
    }
  ],
  "message": "Appointments Listed",
  "status": 200
}

Doctor can also cancel an appointment

Request:

{
  "appointmentid": 2,
  "token": "MXxEb2N0b3I"
}

Response:

{
  "message": "Appointment cancelled",
  "status": 200
}

Schedule listing after both cancellations
{
  "appointments": [
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:00:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:15:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:30:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T19:45:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T20:00:00Z",
      "booked": false
    },
    {
      "appointmentid": "",
      "doctorid": "1",
      "patientid": "",
      "starttime": "2021-07-18T20:15:00Z",
      "booked": false
    }
  ],
  "message": "Appointments Listed",
  "status": 200
}

About

Microservice to be used by doctors and patients to manage appointments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages