package com.ruoyi.web.controller.info;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.system.service.IIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: tjf
 * @Date: 2022/8/15 14:31
 * @Describe: 核酸校验平台后台首页统计
 */
@RestController
@RequestMapping("/index/info")
public class IndexController extends BaseController {

    @Autowired
    private IIndexService indexService;

    /**
     * 后台首页统计本月核酸人数,本周人数,对比上周人数
     * @return
     */
    @GetMapping
    public AjaxResult indexData() {
        return indexService.getIndexData();
    }

    /**
     * 本周职业 类别核酸情况统计
     * @return
     */
    @GetMapping("/jobStyle")
    public AjaxResult jobStyle() {
        return indexService.getJobStyle();
    }

    /**
     * 列表页计算多少次核酸
     * @return
     */
    @GetMapping("/heSuanCount")
    public AjaxResult heSuanCount() {
        LoginUser loginUser = getLoginUser();
        SysUser sysUser = loginUser.getUser();
        Long deptId = sysUser.getDeptId();
        return indexService.getHeSuanCount(deptId);
    }
}
