Class DoctorController

java.lang.Object
com.example.seraphine.controller.DoctorController

@RestController @RequestMapping("api/v1/doctor") @CrossOrigin(origins="http://localhost:3000/search") public class DoctorController extends Object
The controller for the doctor operations.
Author:
Vinh Truong Canh Thanh
  • Constructor Details

    • DoctorController

      public DoctorController()
  • Method Details

    • createDoctor

      @PostMapping("/post") public String createDoctor(@RequestBody Doctor doctor)
      Add a doctor to database
      Parameters:
      doctor - Doctor
      Returns:
      String
    • showAllDoctors

      @GetMapping("/all") public List<Doctor> showAllDoctors()
      List all doctors
      Returns:
      list of all doctor
    • getDoctor

      @GetMapping("/{id}") public org.springframework.http.ResponseEntity<Optional<Doctor>> getDoctor(@PathVariable("id") Long doctor_id)
      Get a doctor based on id
      Parameters:
      doctor_id - Long
      Returns:
      doctor JSON data based on id
    • updateDoctor

      @PutMapping("/{id}") public String updateDoctor(@PathVariable("id") Long doctor_id, @RequestBody Doctor newDoctor)
      Edit doctor information
      Parameters:
      doctor_id - Long
      newDoctor - Doctor
      Returns:
      String
    • deleteDoctor

      @DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> deleteDoctor(@PathVariable("id") Long doctor_id)
      Delete a doctor based on id
      Parameters:
      doctor_id - long
      Returns:
      status for empty doctor
    • displayAllDoctorsWithQuery

      @GetMapping(path="/search/query") public List<Doctor> displayAllDoctorsWithQuery(@RequestParam String issue_covered, @RequestParam String address, @RequestParam int distance_to_user)
      Search query doctor in database
      Parameters:
      issue_covered - String
      address - String
      distance_to_user - int
      Returns:
      list of doctor satisfied the condition
    • displayAllAppointments

      @GetMapping("/appointment/{id}/all") public List<Appointment> displayAllAppointments(@PathVariable("id") Long doctor_id)
      Show all available appointment for doctor based on id
      Parameters:
      doctor_id - Long
      Returns:
      List of appointment