package com.zd.laboratory.service.impl;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.zd.common.core.domain.per.PerPrefix;
import com.zd.common.core.exception.ServiceException;
import com.zd.common.core.utils.DateUtils;
import com.zd.common.core.utils.StringUtils;
import com.zd.common.datascope.annotation.DataScope;
import com.zd.common.security.service.TokenService;
import com.zd.common.security.utils.SaveUtil;

import com.zd.laboratory.domain.LabCheckRecord;
import com.zd.laboratory.domain.LabCheckRecordDetailslog;
import com.zd.laboratory.domain.LabCheckRecordRelease;
import com.zd.laboratory.domain.vo.*;
import com.zd.laboratory.mapper.*;
import com.zd.laboratory.service.ILabCheckMachineMsgService;
import com.zd.laboratory.service.ILabMessageContentService;
import com.zd.system.api.domain.SysUser;
import com.zd.system.api.laboratory.domain.LabMessageContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.laboratory.domain.LabCheckRecordDetails;
import com.zd.laboratory.service.ILabCheckRecordDetailsService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 安全检查隐患表Service业务层处理
 *
 * @author zd
 * @date 2021-12-30
 */
@Service
public class LabCheckRecordDetailsServiceImpl implements ILabCheckRecordDetailsService
{
    @Autowired
    private LabCheckRecordDetailsMapper labCheckRecordDetailsMapper;
    @Autowired
    private LabCheckRecordReleaseMapper labCheckRecordReleaseMapper;
    @Autowired
    private LabCheckRecordMapper labCheckRecordMapper;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private LabCheckRecordDetailslogMapper labCheckRecordDetailslogMapper;
    @Autowired
    private ILabCheckMachineMsgService checkMachineMsgService;
    @Autowired
    private ILabMessageContentService labMessageContentService;
    @Autowired
    private LabSecurityApplyMapper labSecurityApplyMapper;

    /**
     * 查询安全检查隐患表
     *
     * @param id 安全检查隐患表主键
     * @return 安全检查隐患表
     */
    @Override
    public LabCheckRecordDetails selectLabCheckRecordDetailsById(Long id)
    {
        return labCheckRecordDetailsMapper.selectLabCheckRecordDetailsById(id);
    }

    /**
     * 查询安全检查隐患表列表
     *
     * @param labCheckRecordDetails 安全检查隐患表
     * @return 安全检查隐患表
     */
    @Override
    public List<LabCheckRecordDetails> selectLabCheckRecordDetailsList(LabCheckRecordDetails labCheckRecordDetails)
    {
        return labCheckRecordDetailsMapper.selectLabCheckRecordDetailsList(labCheckRecordDetails);
    }

    /**
     * 查询安全检查隐患表列表
     *
     * @param labCheckRecordDetailsVo 安全检查隐患表
     * @return 安全检查隐患表集合
     */
    @Override
    public List<LabCheckRecordDetailsVO> selectLabCheckRecordDetailsListVo(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        return labCheckRecordDetailsMapper.selectLabCheckRecordDetailsListVo(labCheckRecordDetailsVo);
    }

    /**
     * 新增安全检查隐患表
     *
     * @param labCheckRecordDetails 安全检查隐患表
     * @return 结果
     */
    @Override
    public int insertLabCheckRecordDetails(LabCheckRecordDetails labCheckRecordDetails)
    {
        //设置其他公共字段
        SaveUtil.setCommonAttr(labCheckRecordDetails);
        return labCheckRecordDetailsMapper.insertLabCheckRecordDetails(labCheckRecordDetails);
    }

    /**
     * 修改安全检查隐患表
     *
     * @param labCheckRecordDetails 安全检查隐患表
     * @return 结果
     */
    @Override
    public int updateLabCheckRecordDetails(LabCheckRecordDetails labCheckRecordDetails)
    {
        return labCheckRecordDetailsMapper.updateLabCheckRecordDetails(labCheckRecordDetails);
    }

    /**
     * 修改安全检查隐患表
     *
     * @param details 安全检查隐患表
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateLabCheckRecordDetailsList(LabCheckRecordDetails details) {
        //boolean senMsg = false;

        //获取当前登录用户
        SysUser sysUser = tokenService.getLoginUser().getSysUser();
        //查询检查单详情
        LabCheckRecord labCheckRecord = labCheckRecordMapper.selectLabCheckRecordById(details.getCheckId());

        //获取检查项详情
        LabCheckRecordDetails selcetDetails = labCheckRecordDetailsMapper.selectLabCheckRecordDetailsById(details.getId());

        int id=0;
        /*if(!sysUser.getUserId().equals(labCheckRecord.getFzrId())){
                throw new ServiceException("不是负责人，无权提交");
        }*/

        //完成整改
        if(1==details.getSpStatus()){
            details.setZgUserId(sysUser.getUserId());//整改人id
            details.setZgUserName(sysUser.getNickName());//姓名
            details.setZgTime(new Date());//整改时间
            details.setIsZg(0L);//完成整改

            //操作日志表对象
            LabCheckRecordDetailslog detailslog = new LabCheckRecordDetailslog();
            //detailslog.setCheckId(labCheckRecord.getId());
            //detailslog.setCheckDetailsId(selcetDetails.getId());
            //List<LabCheckRecordDetailslog> listlog=labCheckRecordDetailslogMapper.selectLabCheckRecordDetailslogList(detailslog);

            detailslog.setCheckId(selcetDetails.getCheckId());
            detailslog.setCheckDetailsId(selcetDetails.getId());
            detailslog.setZgTime(new Date());//整改时间
            detailslog.setZgUserId(sysUser.getUserId());//整改人id
            detailslog.setZgUserName(sysUser.getNickName());//整改人姓名
            detailslog.setZgMs(details.getZgMs());//描述
            detailslog.setYhZghImg(details.getYhZghImg());//整改图片
            /*detailslog.setSpTime(new Date());//审核时间
            detailslog.setSpUserName(sysUser.getNickName());//审核人
            detailslog.setSpUserId(sysUser.getUserId());//审核人id
            detailslog.setSpStatus(1L);//整改完成待确认
            detailslog.setSpSm(details.getSpMs());//审核说明*/
            detailslog.setCreateTime(new Date());//创建时间
            //整改日志表数据录入
            labCheckRecordDetailslogMapper.insertLabCheckRecordDetailslog(detailslog);

            //3.消息通知
            // 整改通知，提交时发送给检查者 传参时需要将 0一般整改改为1，否则为2 重大整改
            checkMachineMsgService.insertLabCheckMachineJcz(labCheckRecord.getZgType()==0?1:2, labCheckRecord.getId());
        }else if(2==details.getSpStatus()){
        //驳回
            details.setSpUserId(sysUser.getUserId());//审核人id
            details.setSpUserName(sysUser.getNickName());//姓名
            details.setSpTime(new Date());//审核时间

            //操作日志表信息
            LabCheckRecordDetailslog  logdetails = new LabCheckRecordDetailslog();
            logdetails.setCheckDetailsId(selcetDetails.getId());
            List<LabCheckRecordDetailslog> listlog=labCheckRecordDetailslogMapper.selectLabCheckRecordDetailslogList(logdetails);
            if(listlog.size()>0) {
                logdetails.setId(listlog.get(0).getId());
                logdetails.setCheckId(selcetDetails.getCheckId());
                logdetails.setCheckDetailsId(selcetDetails.getId());
                logdetails.setZgTime(selcetDetails.getZgTime());//整改时间
                logdetails.setZgUserId(selcetDetails.getZgUserId());//整改人id
                logdetails.setZgUserName(selcetDetails.getZgUserName());//整改人姓名
                logdetails.setZgMs(selcetDetails.getZgMs());//描述
                logdetails.setYhZghImg(selcetDetails.getYhZghImg());//整改图片

                logdetails.setSpTime(new Date());//审核时间
                logdetails.setSpUserName(sysUser.getNickName());//审核人
                logdetails.setSpUserId(sysUser.getUserId());//审核人id
                logdetails.setSpStatus(2L);//驳回
                logdetails.setSpSm(details.getSpMs());//审核说明
                //整改日志表数据录入
                labCheckRecordDetailslogMapper.updateLabCheckRecordDetailslog(logdetails);
             }

            //3.消息通知
            // 整改通知发送给 实验室负责人
            //checkMachineMsgService.insertLabCheckMachineTjz(labCheckRecord.getZgType()==0?1:2, labCheckRecord.getId(),2);

            //发送通知到整改人员手机端
            //查询有效期内的学生申请集合
            LabSecurityApplyVO applyvo = new LabSecurityApplyVO();
            applyvo.setSubjectId(Long.valueOf(labCheckRecord.getLaboratoryId()));
            List<LabSecurityApplyVO> applist = labSecurityApplyMapper.selectApplyListEffective(applyvo);
            String userids="";//有准入资格的学生集合
            //获取学生集合
            if(applist.size()>0){
                for (int i=0;i<applist.size();i++){
                    userids+=applist.get(i).getUserId()+",";
                }
            }
            //小程序消息通知发送 给检查者
            LabMessageContent labMessageContent = new LabMessageContent();
            labMessageContent.setSendMode(2);
            labMessageContent.setSendRange(3);
            labMessageContent.setMessClass(1);
            labMessageContent.setMessType(12);//驳回
            labMessageContent.setSubIds(labCheckRecord.getLaboratoryId());
            // 喷雾降尘实验室(103),隐患项即将整改过期,隐患项单号：JC1649410773849,隐患描述:AAA
            StringBuffer str = new StringBuffer();
            str.append("安全检查，实验室："+labCheckRecord.getLaboratoryName()+"，检查单号："+labCheckRecord.getCheckNum()+"，隐患项复核驳回，请注意查看");
            labMessageContent.setContent(str.toString());
            labMessageContent.setUserIds(userids+labCheckRecord.getCreateUserId());
            labMessageContentService.insertLabMessageContent(labMessageContent);

        }else if(3==details.getSpStatus()){
            //整改中
            details.setZgUserId(sysUser.getUserId());//整改人id
            details.setZgUserName(sysUser.getNickName());//姓名
            details.setIsZgStatus(1);//暂无法整改标识
            details.setSpStatus(1);// 待审核
            details.setZgTime(new Date());//整改时间

            //操作日志表信息
            LabCheckRecordDetailslog  logdetails = new LabCheckRecordDetailslog();
            logdetails.setCheckDetailsId(selcetDetails.getId());
            List<LabCheckRecordDetailslog> listlog=labCheckRecordDetailslogMapper.selectLabCheckRecordDetailslogList(logdetails);
            logdetails.setCheckId(selcetDetails.getCheckId());
            logdetails.setZgUserId(sysUser.getUserId());//整改人id
            logdetails.setZgUserName(sysUser.getNickName());//整改人姓名
            logdetails.setZgMs(details.getZgMs());//描述
            logdetails.setYhZghImg(details.getYhZghImg()!=null?details.getYhZghImg():null);//整改图片

            /*logdetails.setSpTime(new Date());//审核时间
            logdetails.setSpUserName(sysUser.getNickName());//审核人
            logdetails.setSpUserId(sysUser.getUserId());//审核人id
            logdetails.setSpStatus(1L);//待审核
            logdetails.setSpSm(details.getSpMs());//审核说明*/
            if(listlog.size()==0){
                logdetails.setZgTime(new Date());//整改时间
                logdetails.setCreateTime(new Date());//创建时间
                //整改日志表数据录入
                labCheckRecordDetailslogMapper.insertLabCheckRecordDetailslog(logdetails);
            }else{
                if(2==listlog.get(0).getSpStatus()){
                    //驳回 的时候添加数据
                    logdetails.setZgTime(new Date());//整改时间
                    logdetails.setCreateTime(new Date());//创建时间
                    //整改日志表数据录入
                    labCheckRecordDetailslogMapper.insertLabCheckRecordDetailslog(logdetails);
                }else{
                    //非驳回时修改数据
                    logdetails.setId(listlog.get(0).getId());
                    labCheckRecordDetailslogMapper.updateLabCheckRecordDetailslog(logdetails);
                }
            }

            //整改通知发送给 发送给检查者
            //checkMachineMsgService.insertLabCheckMachineTjz(labCheckRecord.getZgType()==0?1:2, labCheckRecord.getId(),3);


            //小程序消息通知发送 给检查者
            LabMessageContent labMessageContent = new LabMessageContent();
            labMessageContent.setSendMode(2);
            labMessageContent.setSendRange(3);
            labMessageContent.setMessClass(1);
            labMessageContent.setMessType(13);//无法整改
            labMessageContent.setSubIds(labCheckRecord.getLaboratoryId());
            // 喷雾降尘实验室(103),隐患项即将整改过期,隐患项单号：JC1649410773849,隐患描述:AAA
            StringBuffer str = new StringBuffer();
            str.append("安全检查，实验室："+labCheckRecord.getLaboratoryName()+"，检查单号："+labCheckRecord.getCheckNum()+"，隐患项暂无法整改，请注意查看");
            labMessageContent.setContent(str.toString());
            labMessageContent.setUserIds(String.valueOf(labCheckRecord.getCreateUserId()));
            labMessageContentService.insertLabMessageContent(labMessageContent);

        }else if(4==details.getSpStatus()){
         //审核通过
            details.setSpUserId(sysUser.getUserId());//审核人id
            details.setSpUserName(sysUser.getNickName());//姓名
            details.setSpTime(new Date());//审核时间
            // 整改通知发送给 实验室负责人
            //checkMachineMsgService.insertLabCheckMachineTjz(labCheckRecord.getZgType()==0?1:2, labCheckRecord.getId(),4);


            //发送通知到整改人员手机端
            //查询有效期内的学生申请集合
            LabSecurityApplyVO applyvo = new LabSecurityApplyVO();
            applyvo.setSubjectId(Long.valueOf(labCheckRecord.getLaboratoryId()));
            List<LabSecurityApplyVO> applist = labSecurityApplyMapper.selectApplyListEffective(applyvo);
            String userids="";//有准入资格的学生集合
            //获取学生集合
            if(applist.size()>0){
                for (int i=0;i<applist.size();i++){
                    userids+=applist.get(i).getUserId()+",";
                }
            }

            //小程序消息通知发送 给检查者
            LabMessageContent labMessageContent = new LabMessageContent();
            labMessageContent.setSendMode(2);
            labMessageContent.setSendRange(3);
            labMessageContent.setMessClass(1);
            labMessageContent.setMessType(14);//整改完成
            labMessageContent.setSubIds(labCheckRecord.getLaboratoryId());
            // 喷雾降尘实验室(103),隐患项即将整改过期,隐患项单号：JC1649410773849,隐患描述:AAA
            StringBuffer str = new StringBuffer();
            str.append("安全检查，实验室："+labCheckRecord.getLaboratoryName()+"，检查单号："+labCheckRecord.getCheckNum()+"，隐患项整改完成，请注意查看");
            labMessageContent.setContent(str.toString());
            labMessageContent.setUserIds(userids+labCheckRecord.getCreateUserId());
            labMessageContentService.insertLabMessageContent(labMessageContent);

            //操作日志表信息
           LabCheckRecordDetailslog  logdetails = new LabCheckRecordDetailslog();
            logdetails.setCheckDetailsId(selcetDetails.getId());
            List<LabCheckRecordDetailslog> listlog=labCheckRecordDetailslogMapper.selectLabCheckRecordDetailslogList(logdetails);
            if(listlog.size()>0){
                logdetails.setId(listlog.get(0).getId());
                /*logdetails.setCheckId(selcetDetails.getCheckId());
                logdetails.setCheckDetailsId(selcetDetails.getId());
                logdetails.setZgTime(selcetDetails.getZgTime());//整改时间
                logdetails.setZgUserId(selcetDetails.getZgUserId());//整改人id
                logdetails.setZgUserName(selcetDetails.getZgUserName());//整改人姓名
                logdetails.setZgMs(selcetDetails.getZgMs());//描述
                logdetails.setYhZghImg(selcetDetails.getYhZghImg());//整改图片*/

                logdetails.setSpTime(new Date());//审核时间
                logdetails.setSpUserName(sysUser.getNickName());//审核人
                logdetails.setSpUserId(sysUser.getUserId());//审核人id
                logdetails.setSpStatus(1L);//通过
                logdetails.setSpSm(details.getSpMs());//审核说明
                //整改日志表数据录入
                labCheckRecordDetailslogMapper.updateLabCheckRecordDetailslog(logdetails);
            }

        }
            //数据操作
            //1.详情表数据修改
            details.setUpdateTime(new Date());
            id =labCheckRecordDetailsMapper.updateLabCheckRecordDetails(details);

            //4.检查单表 状态修改
                LabCheckRecordDetails labCheckRecordDetails = new LabCheckRecordDetails();
                labCheckRecordDetails.setCheckId(labCheckRecord.getId());
                List<LabCheckRecordDetails> detailsList = labCheckRecordDetailsMapper.selectLabCheckRecordDetailsList(labCheckRecordDetails);

                //循环检查项 判断检查单的具体状态
                String iszgStr="";//是否整改字符串集合
                String spStatusStr="";//审核状态字符串集合
                for (int i=0;i<detailsList.size();i++){
                    //将集合中的检查项 和当前修改的检查项比对并且赋值
                    if(details.getId() == detailsList.get(i).getId()){
                        detailsList.get(i).setIsZg(details.getIsZg());
                        detailsList.get(i).setSpStatus(details.getSpStatus());
                    }
                    //Long iszg= detailsList.get(i).getIsZg();
                    iszgStr+=String.valueOf(detailsList.get(i).getIsZg())+",";
                    spStatusStr+=String.valueOf(detailsList.get(i).getSpStatus())+",";
                }

                 //需要修改的检查单对象
                 LabCheckRecord bhcr = new LabCheckRecord();
                 bhcr.setId(labCheckRecord.getId());//主键
                    if(spStatusStr.indexOf("2")!=-1){
                        //驳回
                        bhcr.setZgStatus(2);//驳回
                    }else if(labCheckRecord.getZgjzTime().getTime()< new Date().getTime() && iszgStr.indexOf("0")!=-1){
                        //-逾期: 检查整改时间已到期并且还有没有整改完成的隐患项
                        bhcr.setZgStatus(5);//逾期
                    }else if(spStatusStr.indexOf("0")!=-1){
                        //待整改
                        bhcr.setZgStatus(0);//待整改
                    }else if(spStatusStr.indexOf("1")!=-1){
                        //整改待确认
                        bhcr.setZgStatus(1);//整改待确认
                    }else if(spStatusStr.indexOf("3")!=-1){
                        if(detailsList.size()==1){
                            //无法整改整改
                            bhcr.setZgStatus(3);//无法整改 -只有一项时也算整改完成
                            bhcr.setIsZgStatus(1);//该检查单只有一条隐患且无法整改
                        }else{
                            boolean flg = false;
                            for (int i=0;i<detailsList.size();i++){
                                if(detailsList.get(i).getSpStatus()!=3){
                                    flg=true;
                                    break;
                                }
                            }
                            if(flg){
                                //无法整改整改
                                bhcr.setZgStatus(3);//无法整改 -有多个隐患项，并且都为暂时无法整改
                                bhcr.setIsZgStatus(1);//该检查单多条隐患且都无法整改
                            }
                        }
                    }else {
                        //整改完成
                        bhcr.setZgStatus(4);//整改完成
                    }
                 labCheckRecordMapper.updateLabCheckRecord(bhcr);//修改检查单状态
        return id;
    }

    /**
     * 批量删除安全检查隐患表
     *
     * @param ids 需要删除的安全检查隐患表主键
     * @return 结果
     */
    @Override
    public int deleteLabCheckRecordDetailsByIds(Long[] ids)
    {
        return labCheckRecordDetailsMapper.deleteLabCheckRecordDetailsByIds(ids);
    }

    /**
     * 删除安全检查隐患表信息
     *
     * @param id 安全检查隐患表主键
     * @return 结果
     */
    @Override
    public int deleteLabCheckRecordDetailsById(Long id)
    {
        return labCheckRecordDetailsMapper.deleteLabCheckRecordDetailsById(id);
    }

    /***
     * 根据检查项id查询集合
     * @param jcxId
     * @return
     */
    @Override
    public List<LabCheckRecordDetails> selectListByJcxId(String jcxId) {
        return labCheckRecordDetailsMapper.selectListByJcxId(jcxId);
    }

    /**
     * 大屏安全检查列表
     *
     * @param labCheckRecordDetailsVo
     * @return
     */
    @Override
    public List<LabCheckRecordDetailsVO> selectLabCheckRecordListVoIndex(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        /*//查询发布批次表 并获取最新一次的发布批次
        List<LabCheckRecordRelease> rrlist = labCheckRecordReleaseMapper.selectLabCheckRecordReleaseList(new LabCheckRecordRelease());
        List<LabCheckRecordDetailsVO> list = new ArrayList<>();
        List<LabCheckRecordDetailsVO> listCount = new ArrayList<>();
        if(rrlist.size()>0){
          String[] strids=  rrlist.get(0).getCheckId().split(",");
          //Long[] ids = new Long[strids.length];
            List<Long> ids= new ArrayList<>();
          for (int i=0;i<strids.length;i++){
              ids.add(Long.valueOf(strids[i]));
          }
          labCheckRecordDetailsVo.setIds(ids);
          list=labCheckRecordDetailsMapper.selectLabCheckRecordListVoIndex(labCheckRecordDetailsVo);
          //查询隐患总数、已整改、未整改数据
          listCount= labCheckRecordDetailsMapper.selectLabCheckRecordCountIndex(labCheckRecordDetailsVo);
          list.get(0).setListVo(listCount);
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
          String remarkDate = sdf.format(rrlist.get(0).getCreateTime());
          list.get(0).setRemark(remarkDate);//检查时间
        }*/
        return labCheckRecordDetailsMapper.selectLabCheckRecordListVoIndex(labCheckRecordDetailsVo);
    }

    /**
     * 大屏安全检查列表安全隐患项统计
     *
     * @param labCheckRecordDetailsVo
     * @return
     */
    @Override
    public LabCheckRecordDetailsVO selectLabCheckRecordCountIndex(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        /*//查询发布批次表 并获取最新一次的发布批次
        List<LabCheckRecordRelease> rrlist = labCheckRecordReleaseMapper.selectLabCheckRecordReleaseList(new LabCheckRecordRelease());
        List<LabCheckRecordDetailsVO> list = new ArrayList<>();
        if(rrlist.size()>0){
            String[] strids=  rrlist.get(0).getCheckId().split(",");
            //Long[] ids = new Long[strids.length];
            List<Long> ids= new ArrayList<>();
            for (int i=0;i<strids.length;i++){
                ids.add(Long.valueOf(strids[i]));
            }
            labCheckRecordDetailsVo.setIds(ids);
            list=labCheckRecordDetailsMapper.selectLabCheckRecordCountIndex(labCheckRecordDetailsVo);
        }*/
        return labCheckRecordDetailsMapper.selectLabCheckRecordCountIndex(labCheckRecordDetailsVo);
    }

    /***
     * 大屏安全检查批次列表 详情跳转
     * @param labCheckRecordDetailsVo
     * @return
     */
    @Override
    public List<LabCheckRecordDetailsVO> selectLabCheckRecordIndexDetals(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        //查询发布批次表 并获取最新一次的发布批次
        //List<LabCheckRecordRelease> rrlist = labCheckRecordReleaseMapper.selectLabCheckRecordReleaseList(null);
        /*List<LabCheckRecordDetailsVO> list = new ArrayList<>();
        list=labCheckRecordDetailsMapper.selectLabCheckRecordIndexDetals(labCheckRecordDetailsVo);*/

        return labCheckRecordDetailsMapper.selectLabCheckRecordIndexDetals(labCheckRecordDetailsVo);
    }

    /****
     * 大屏安全检查历史遗留问题总数查询
     * @param labCheckRecordDetailsVo
     * @return
     */
    @Override
    public LabCheckRecordDetailsVO selectLabCheckRecordHistoryQuestionCount(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        return labCheckRecordDetailsMapper.selectLabCheckRecordHistoryQuestionCount(labCheckRecordDetailsVo);
    }

    /***
     * 待整改列表
     * @param labCheckRecordDetailsVo
     * @return
     */
    @Override
   // @DataScope(deptAlias = "s" , userAlias = "u" , permi = PerPrefix.LABORATORY_CHECKRECORDDETAILS)
    public List<LabCheckRecordDetailsVO> selectLabCheckRecordDzg(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        return labCheckRecordDetailsMapper.selectLabCheckRecordDzg(labCheckRecordDetailsVo);
    }

    /***
     * 问题整改列表
     * @param labCheckRecordDetailsVo
     * @return
     */
    //@DataScope(deptAlias = "s" , userAlias = "u" , permi = PerPrefix.LABORATORY_CHECKRECORDDETAILS)
    @Override
    public List<LabCheckRecordDetailsVO> selectLabCheckRecordWtzg(LabCheckRecordDetailsVO labCheckRecordDetailsVo) {
        return labCheckRecordDetailsMapper.selectLabCheckRecordWtzg(labCheckRecordDetailsVo);
    }

    /***
     * 隐患项 各个状态汇总
     * @param labCheckRecordVo
     * @return
     */
    //@DataScope(deptAlias = "s",  permi = PerPrefix.LABORATORY_CHECKRECORDDETAILS)
    @Override
    public List<Map<String, Object>> selectDetailsStatusList(LabCheckRecordVO labCheckRecordVo) {
        return labCheckRecordDetailsMapper.selectDetailsStatusList(labCheckRecordVo);
    }


    @Override
    public List<LabCheckMachineMsgDetailVo> selectCheckMsgDetail(Long checkId) {
        return labCheckRecordDetailsMapper.selectCheckMsgDetail(checkId);
    }
}
