package com.example.monitorpatientstatus.controller;
import com.example.monitorpatientstatus.entity.Patient;
import com.example.monitorpatientstatus.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Patient")
public class PatientController {
    @Autowired
    PatientService patientService;

    @PostMapping("/modify")
    public String modify(Patient patient){
              return patientService.modify(patient);
    }

    @PostMapping("/showInfo")
    public String showInfo(Patient patient){return patientService.showInfo(patient);}

    /**
     * 解决查询数据库中文出现乱码问题
     * @return
     */
    @RequestMapping(value = "/alluser", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public List<Patient> findAll(){
        return patientService.findAll();
    }
}