package thyyxxk.webserver.controller.mzmedical;

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.config.auth.PassToken;
import thyyxxk.webserver.config.exception.ExceptionEnum;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.mzmedical.MzMedicalField;
import thyyxxk.webserver.entity.mzmedical.MzMedicalMain;
import thyyxxk.webserver.entity.mzmedical.MzMedicalMainParam;
import thyyxxk.webserver.service.mzmedical.MzMedicalMainService;
import thyyxxk.webserver.utils.ResultVoUtil;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author:lihong
 * @Date: 2025/4/14
 */
@RestController
@RequestMapping("/mzMedicalMain")
public class MzMedicalMainController {
    @Resource
    private MzMedicalMainService service;

    @GetMapping("/queryMzMedicalField")
    public ResultVo<List<MzMedicalField>> queryMzMedicalField(){
        return ResultVoUtil.success(service.queryMzMedicalField());
    }

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


    @PostMapping("/updateDelFlag")
    public ResultVo<String> updateDelFlag(@RequestBody MzMedicalMain mzMedicalMain){
        service.updateDelFlag(mzMedicalMain);
        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
    }

    @PostMapping("/queryMzMedicalMainPage")
    public ResultVo<Map<String,Object>> queryMzMedicalMainPage(@RequestBody MzMedicalMainParam param){
        return service.queryMzMedicalMainPage(param);
    }
    /**
     * @description: 生成 几月的数据
     * @author: lihong
     * @date: 2025/4/14 11:46
     * @param: param
     * @return: thyyxxk.webserver.entity.ResultVo<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    @PassToken
    @PostMapping("/generateMzMedicalMainByMoth")
    public ResultVo<String> generateMzMedicalMainByMoth(@RequestBody MzMedicalMainParam param){
        return service.generateMzMedicalMainByMoth(param);
    }

}
