package com.diagbot.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.CheckWorkDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.MedCheckWorkFacade;
import com.diagbot.vo.CheckWorkPageVO;
import com.diagbot.vo.MedCheckWorkAddVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 *
 * @author songxl
 * @since 2021-05-11
 */
@RestController
@RequestMapping("/qc/medCheckWork")
@Api(value = "生成核查任务--相关接口API", tags = { "生成核查任务--相关接口API" })
public class MedCheckWorkController {
    @Autowired
    MedCheckWorkFacade medCheckworkFacade;

    @ApiOperation(value = "生成/取消核查任务[by:wangsy]",
            notes = "生成/取消核查任务 <br>" +
            "behospitalCodeList：病历id(List) 【必填】<br>" +
            "jobType：核查任务类型(0-科室任务 1-院级 1-质控科) 【必填】<br>" +
            "checkStatus：操作类型(0-取消，1-添加) 【必填】<br>" +
            "createTime: 操作时间<br>" +
            "checkType：核查类型(0病历，1病案首页,2全部 默认)<br>")
    @PostMapping("/addCheckWork")
    @SysLogger("addCheckWork")
    public RespDTO<Boolean> addCheckTask(@RequestBody MedCheckWorkAddVO medCheckWorkVO) {
        Boolean res = medCheckworkFacade.addCheckWork(medCheckWorkVO);
        return RespDTO.onSuc(res);
    }

    @ApiOperation(value = "获取患者病历列表[by:wangsy]",
            notes = "startDate：出院开始时间 【必填】<br>" +
                    "endDate：出院结束时间 【必填】<br>" +
                    "creatStatus：生成状态(0-未生成 1-已生成) 【必填】<br>" +
                    "jobType：核查任务类型(0-科室任务 1-质控科 2-院级) <br>" +
                    "hospitalId: 医院ID<br>" +
                    "behospitalCode：病人住院序号<br>" +
                    "departments：科室<br>" +
                    "level：病历等级<br>" +
                    "name：病人姓名<br>" +
                    "doctorName：医生姓名<br>" +
                    "diagnose：主诊断<br>" +
                    "smallDay：最小天数<br>" +
                    "bigDay：最大天数<br>" +
                    "isPlacefile：是否归档<br>")
    @PostMapping("/getUserList")
    @SysLogger("getUserList")
    public RespDTO<IPage<CheckWorkDTO>> checkWorkPage(@RequestBody CheckWorkPageVO checkWorkPageVO) {
        IPage<CheckWorkDTO> data = medCheckworkFacade.pageFac(checkWorkPageVO);
        return RespDTO.onSuc(data);
    }
}
