package thyyxxk.webserver.controller.medicaladvice.nursing;

import com.baomidou.mybatisplus.core.metadata.IPage;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.datamodify.YzTemperature;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.inpatient.patient.Patient;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.GraphicsDataVO;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.GraphicsParam;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.PsInfoVO;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzHlMb;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzTemperatureSum;
import thyyxxk.webserver.entity.medicaladvice.medicamanage.YzTemperatureVO;
import thyyxxk.webserver.service.medicaladvice.nursing.NursingManagementService;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author:lihong
 * @Date: 2023/4/21
 */
@RestController
@RequestMapping("/medicalAdvice/nursingManagement/")
public class NursingManagementController {
    @Autowired
    private NursingManagementService service;


    @GetMapping("getrecTimeSelect")
    public ResultVo<List<Map<String, String>>> getrecTimeSelect(){
        List<Map<String, String>> maps = service.getrecTimeSelect();
        return ResultVoUtil.success(maps);
    }


    /**
     * @description: 查询三测单 所有列表数据
     * @author: lihong
     * @date: 2023/4/24 8:38
     * @param: yzTemperature
     * @return: thyyxxk.webserver.entity.ResultVo
     **/
    @PostMapping("queryThreeTestList")
    public ResultVo<Map<String, Object>> queryThreeTestList(@RequestBody YzTemperatureVO yzTemperature){
        Map<String, Object> data = service.queryThreeTestList(yzTemperature);
        return ResultVoUtil.success(data);
    }
    @PostMapping("queyGm")
    public ResultVo<List<String>> queyGm(@RequestBody YzTemperatureVO yzTemperature){
        return ResultVoUtil.success(service.queyGm(yzTemperature));
    }

    @PostMapping("saveGm")
    public ResultVo<String> saveGm(@RequestBody YzTemperatureVO yzTemperature){
        return service.saveGm(yzTemperature);
    }

    /**
     * @description: 查询皮试信息
     * @author: lihong
     * @date: 2023/4/24 8:38
     * @param: yzTemperature
     * @return: thyyxxk.webserver.entity.ResultVo
     **/
    @PostMapping("queryPsInfo")
    public ResultVo<List<PsInfoVO>> queryPsInfo(@RequestBody PsInfoVO psInfoVO){
        return ResultVoUtil.success(service.queryPsInfo(psInfoVO));
    }

    @PostMapping("saveThreeTest")
    public ResultVo<String> saveThreeTest(@RequestBody YzTemperatureVO saveData){
        return service.saveThreeTest(saveData);
    }

    @PostMapping("deleteYzTemperatureSum")
    public ResultVo<String> deleteYzTemperatureSum(@RequestBody YzTemperatureSum data){
        return service.deleteYzTemperatureSum(data);
    }

    @PostMapping("deleteYzTemperature")
    public ResultVo<String> deleteYzTemperature(@RequestBody YzTemperatureVO data){
        return service.deleteYzTemperature(data);
    }


    @PostMapping("updatePsInfo")
    public ResultVo<String> updatePsInfo(@RequestBody List<PsInfoVO> psInfos){
        return service.updatePsInfo(psInfos);
    }

    @GetMapping("selectEmpInfo")
    public ResultVo<List<Map<String,Object>>> selectEmpInfo(String keyWard){
        return ResultVoUtil.success(service.selectEmpInfo(keyWard));
    }

    /**
     * @description:查询护理记录
     * @author: lihong
     * @date: 2023/4/27 17:17
     * @param: query
     * @return: thyyxxk.webserver.entity.ResultVo<java.util.List<thyyxxk.webserver.entity.datamodify.YzTemperature>>
     **/
    @PostMapping("queryNursingRecord")
    public ResultVo<IPage<YzTemperature>> queryNursingRecord(@RequestBody YzTemperatureVO query){
        return ResultVoUtil.success(service.queryNursingRecord(query ));
    }

    @PostMapping("queryOrderTime")
    public ResultVo<List<Map<String,Object>>> queryOrderTime(@RequestBody Patient patient){
        return ResultVoUtil.success(service.getOrderTime(patient));
    }

    @PostMapping("saveYzTemperature")
    public ResultVo<String> saveYzTemperature(@RequestBody YzTemperatureVO query){
        return service.saveYzTemperature(query );
    }
    /**
     * @description:获取单个时间节点的三测单
     * @author: lihong
     * @date: 2023/5/9 15:36
     * @param: query
     * @return: thyyxxk.webserver.entity.ResultVo<java.lang.String>
     **/
    @PostMapping("queryScdYzTemperature")
    public ResultVo<YzTemperature> queryScdYzTemperature(@RequestBody YzTemperatureVO query){
        return service.queryScdYzTemperature(query );
    }
    /**
     * @description:计算入 出量 求和  7点到当前时间
     * @author: lihong
     * @date: 2023/5/9 15:47
     * @param: query
     * @return: thyyxxk.webserver.entity.ResultVo<thyyxxk.webserver.entity.datamodify.YzTemperature>
     **/
    @PostMapping("calInputOutSum")
    public ResultVo<YzTemperature> calInputOutSum(@RequestBody YzTemperatureVO query){
        return service.calInputOutSum(query);
    }


    @PostMapping("queryyzHlMb")
    public ResultVo<List<YzHlMb>> queryyzHlMb(@RequestBody YzHlMb query){
        return service.queryyzHlMb(query);
    }

    @PostMapping("saveHlMb")
    public ResultVo<String> saveHlMb(@RequestBody YzHlMb query){
        return service.saveHlMb(query);
    }

    @PostMapping("delHlMb")
    public ResultVo<String> delHlMb(@RequestBody List<YzHlMb> param){
        return service.delHlMb(param);
    }


    @PostMapping("getChartData")
    public ResultVo<GraphicsDataVO> getChartData(@RequestBody GraphicsParam query){
        return service.getChartData(query);
    }

    @PostMapping("getWeek")
    public ResultVo<Map<Object,Object>> getWeek(@RequestBody YzTemperatureVO query){
        return service.getWeek(query);
    }

    @PostMapping("getAllPatintInfo")
    public ResultVo<Patient> getAllPatintInfo(@RequestBody YzTemperatureVO query){
        return service.getAllPatintInfo(query);
    }

    @GetMapping("getAllWards")
    public ResultVo<List<CodeName>> getAllWards(){
        return service.getAllWards();
    }
    /**
     * @description: 查询体温脉搏范围值
     * @author: lihong
     * @date: 2024/1/30 10:37
     * @return: thyyxxk.webserver.entity.ResultVo<java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>
     **/
    @GetMapping("queryTwMbRange")
    public ResultVo<Map<String,Object>> queryTwMbRange(){
        return service.queryTwMbRange();
    }

    @PostMapping("saveTwMbRange")
    public ResultVo<Patient> saveTwMbRange(@RequestBody Map<String,Object> param){
        return service.saveTwMbRange(param);
    }

}
