package thyyxxk.webserver.controller.zhuyuanyizheng;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.service.zhuyuanyisheng.PatientCriticalValuesService;

import java.util.List;

@RestController
@RequestMapping("/criticalValue")
public class AcceptPatientCriticalValuesControllre {

    private final PatientCriticalValuesService server;

    public AcceptPatientCriticalValuesControllre(PatientCriticalValuesService server) {
        this.server = server;
    }

    @GetMapping("/pushMessage")
    @PassToken
    public ResultVo<String> acceptCriticalValues(@RequestParam("message") String message) {
        return server.acceptCriticalValues(message);
    }

    @GetMapping("/getCriticalValuePatientList")
    public ResultVo<List<JSONObject>> getCriticalValuePatientList(@RequestParam("patNo") String patNo) {
        return server.getCriticalValuePatientList(patNo);
    }

    @GetMapping("/getCriticalValueByPatInfo")
    public ResultVo<List<String>> getCriticalValueByPatInfo(@RequestParam("patNo") String patNo,
                                                            @RequestParam("times") Integer times) {
        return server.getCriticalValueByPatInfo(patNo, times);
    }

}
