package com.example.monitorpatientstatus.controller;

import com.example.monitorpatientstatus.entity.Doctor;
import com.example.monitorpatientstatus.entity.Drug;
import com.example.monitorpatientstatus.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/doctor")
@RestController
public class DoctorController {
    @Autowired
    DoctorService doctorService;

    //public String regist(Doctor user){return doctorService.regist(user);}
    public List<Doctor> findAll(){
        return doctorService.findAll();
    }

    @PostMapping("/modify")
    public String modify(Doctor doctor){
        return doctorService.modify(doctor);
    }
    @GetMapping("/searchDurgByNmae")
    public Drug searchDrug(String name){return doctorService.searchDrugByName(name);}
    @GetMapping("/searchDurgById")
    public Drug searchDrug(int number){return doctorService.searchDrugByNumber(number);}
}
