package com.diagbot.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.diagbot.dto.*;
import com.diagbot.entity.BehospitalInfo;
import com.diagbot.mapper.BehospitalInfoMapper;
import com.diagbot.service.BehospitalInfoService;
import com.diagbot.vo.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 住院病历信息 服务实现类
 * </p>
 *
 * @author zhoutg
 * @since 2020-04-13
 */
@Service
public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper, BehospitalInfo> implements BehospitalInfoService {

    @Override
    public IPage<BehospitalInfoDTO> getPage(BehospitalPageVO behospitalPageVO) {
        return baseMapper.getPage(behospitalPageVO);
    }

    @Override
    public List<MsgDTO> getMsg(AnalyzeVO analyzeVO) {
        return baseMapper.getMsg(analyzeVO);
    }

    @Override
    public List<MsgDTO> getMsgByEntryCode(AnalyzeCodeVO analyzeCodeVO) {
        return baseMapper.getMsgByEntryCode(analyzeCodeVO);
    }

    /**
     * 各科室缺陷占比-全院-首页
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<NumDTO> entryByDept(FilterVO filterVO) {
        return baseMapper.entryByDept(filterVO);
    }

    /**
     * 质控结果缺陷总数查询
     *
     * @param filterVO
     * @return
     */
    @Override
    public int getTotleResultNum(FilterVO filterVO) {
        return baseMapper.getTotleResultNum(filterVO);
    }

    @Override
    public List<BehospitalInfo> getNoGrade(TaskVO taskVO) {
        return baseMapper.getNoGrade(taskVO);
    }

    @Override
    public IPage<BehospitalInfoDTO> getPageByDept(BehospitalPageVO behospitalPageVO) {
        return baseMapper.getPageByDept(behospitalPageVO);
    }

    @Override
    public IPage<BehospitalInfoDTO> getPageByPerson(BehospitalPageVO behospitalPageVO) {
        return baseMapper.getPageByPerson(behospitalPageVO);
    }

    @Override
    public IPage<BehospitalInfoDTO> getPageByGroup(BehospitalPageVO behospitalPageVO) {
        return baseMapper.getPageByGroup(behospitalPageVO);
    }

    /**
     * 出院总人数统计-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int leaveHosCount(FilterVO filterVO) {
        return baseMapper.leaveHosCount(filterVO);
    }

    /**
     * 新生儿出院人数统计-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int newBornCount(FilterVO filterVO) {
        return baseMapper.newBornCount(filterVO);
    }

    /**
     * 死亡人数统计-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int deathCount(FilterVO filterVO) {
        return baseMapper.deathCount(filterVO);
    }

    /**
     * 手术人数统计-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int operationCount(FilterVO filterVO) {
        return baseMapper.operationCount(filterVO);
    }

    /**
     * 一级手术级别人数-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int operationLevelOneCount(FilterVO filterVO) {
        return baseMapper.operationLevelOneCount(filterVO);
    }

    /**
     * 二级手术级别人数-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int operationLevelTwoCount(FilterVO filterVO) {
        return baseMapper.operationLevelTwoCount(filterVO);
    }

    /**
     * 三级手术级别人数-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int operationLevelThreeCount(FilterVO filterVO) {
        return baseMapper.operationLevelThreeCount(filterVO);
    }

    /**
     * 四级手术级别人数-全院-首页
     *
     * @param filterVO
     * @return
     */
    public int operationLevelFourCount(FilterVO filterVO) {
        return baseMapper.operationLevelFourCount(filterVO);
    }

    /**
     * 出院总人数统计-科室-首页
     *
     * @param filterVO
     * @return
     */
    public List<NumDTO> leaveHosCountByDept(FilterVO filterVO) {
        return baseMapper.leaveHosCountByDept(filterVO);
    }

    /**
     * 入院总人数统计-科室-首页
     *
     * @param filterVO
     * @return
     */
    public List<AdmissionCountDTO> admissionHosCountByDept(FilterVO filterVO) {
        return baseMapper.admissionHosCountByDept(filterVO);
    }

    /**
     * 新生儿出院人数统计-科室-首页
     *
     * @param filterVO
     * @return
     */
    public List<NumDTO> newBornCountByDept(FilterVO filterVO) {
        return baseMapper.newBornCountByDept(filterVO);
    }

    /**
     * 死亡人数统计-科室-首页
     *
     * @param filterVO
     * @return
     */
    public List<NumDTO> deathCountByDept(FilterVO filterVO) {
        return baseMapper.deathCountByDept(filterVO);
    }

    /**
     * 手术人数统计-科室-首页
     *
     * @param filterVO
     * @return
     */
    public List<NumDTO> operationCountByDept(FilterVO filterVO) {
        return baseMapper.operationCountByDept(filterVO);
    }

    /**
     * 病案首页合格/不合格数-科室
     *
     * @param qcResultPageVO
     * @return
     */
    public IPage<QcResultShortDTO> getOrGoodLevelByDept(QcResultPageVO qcResultPageVO) {
        return baseMapper.getIsGoodLevelByDept(qcResultPageVO);
    }

    /**
     * 各科室缺陷占比排行（分页）
     *
     * @param filterPageVO
     * @return
     */
    @Override
    public IPage<NumDTO> resultStatisticsByDeptPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
        return baseMapper.resultStatisticsByDeptPage(filterPageVO);
    }

    /**
     * 各科室缺陷占比（组合）
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<LevelStatisticsDTO> levelStatistics(FilterOrderVO filterOrderVO) {
        return baseMapper.levelStatistics(filterOrderVO);
    }

    /**
     * 病案首页合格率占比
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO) {
        return baseMapper.homePageLevelStatistics(filterOrderVO);
    }

    /**
     * 医师病案首页合格率占比 湘雅定制
     *
     * @param filterOrderXYPageVO
     * @return
     */
    @Override
    public IPage<HomePageNumXYDTO> homePageLevelStatisticsXY(FilterOrderXYPageVO filterOrderXYPageVO) {
        return baseMapper.homePageLevelStatisticsXY(filterOrderXYPageVO);
    }

    /**
     * 病历质控报表-扣分项
     *
     * @param caseScoreVO
     * @return
     */
    @Override
    public List<QualityControlDTO> getQualityCase(CaseScoreVO caseScoreVO) {
        return baseMapper.getQualityCase(caseScoreVO);
    }

    /**
     * 病历质控报表-扣分
     *
     * @param caseScoreVO
     * @return
     */
    @Override
    public List<QualityControlDTO> getQualitySorce(CaseScoreVO caseScoreVO) {
        return baseMapper.getQualitySorce(caseScoreVO);
    }

    /**
     * 病历质控报表-扣分数据
     *
     * @param caseScoreVO
     * @return
     */
    @Override
    public List<CaseScoreDTO> getQualityCaseSorce(CaseScoreVO caseScoreVO) {
        return baseMapper.getQualityCaseSorce(caseScoreVO);
    }

    /**
     * 病历质控报表科室-扣分数据
     *
     * @param caseScoreVO
     * @return
     */
    @Override
    public List<CaseScoreDTO> getQualityCaseSorceByDept(CaseScoreVO caseScoreVO) {
        return baseMapper.getQualityCaseSorceByDept(caseScoreVO);
    }

    /**
     * 病历质控报表
     *
     * @param behospitalPageVO
     * @return
     */
    @Override
    public IPage<QualityControlDTO> getQualityControl(BehospitalPageVO behospitalPageVO) {
        return baseMapper.getQualityControl(behospitalPageVO);
    }

    /**
     * 病历质控报表-科室
     *
     * @param behospitalPageVO
     * @return
     */
    @Override
    public IPage<QualityControlDTO> getQualityControlExport(BehospitalPageVO behospitalPageVO) {
        return baseMapper.getQualityControlExport(behospitalPageVO);
    }


    /**
     * 各科室缺陷占比（主任医生）
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<LevelStsByDeptDTO> levelStatisticsByDept(FilterOrderVO filterOrderVO) {
        return baseMapper.levelStatisticsByDept(filterOrderVO);
    }

    /**
     * 病案首页合格率占比（主任医生）
     *
     * @param filterOrderByDeptVO
     * @return
     */
    @Override
    public List<HomePageByDeptDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
        return baseMapper.homePageLevelStatisticsByDept(filterOrderByDeptVO);
    }

    /**
     * 单条条目缺陷统计-首页
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<AdmissionCountDTO> casesEntryStatisticsByDept(FilterVO filterVO) {
        return baseMapper.casesEntryStatisticsByDept(filterVO);
    }

    /**
     * 缺陷明细-科室（分页）
     *
     * @param filterPageByDeptVO
     * @return
     */
    public IPage<DeptNumDTO> resultStatisticsByDeptAndDoctorPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
        return baseMapper.resultStatisticsByDeptAndDoctorPage(filterPageByDeptVO);
    }

    /**
     * 各科室缺陷占比（组合）-全院-根据内外科系统统计-关联上级科室
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<LevelStatisticsTZDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO) {
        return baseMapper.levelStatisticsByDeptClass(filterOrderVO);
    }

    /**
     * 各科室缺陷占比（组合）-全院-根据内外科系统统计（台州）
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<LevelStatisticsTZDTO> levelStatisticsByDeptClass_TZ(FilterOrderVO filterOrderVO) {
        return baseMapper.levelStatisticsByDeptClass_TZ(filterOrderVO);
    }


    @Override
    public List<ExportExcelDTO> exportExcel() {
        return baseMapper.exportExcel();
    }

    /**
     * 质控评分导出到excel
     *
     * @param exportQcresultVO
     * @return
     */
    public List<ExportExcelDTO> exportQcresult(ExportQcresultVO exportQcresultVO) {
        return baseMapper.exportQcresult(exportQcresultVO);
    }

    /**
     * 个人质控评分导出到excel
     *
     * @param exportQcresultVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> exportQcresultByPerson(ExportQcresultVO exportQcresultVO) {
        return baseMapper.exportQcresultByPerson(exportQcresultVO);
    }

    /**
     * 科室质控评分导出到excel
     *
     * @param exportQcresultVO
     * @return
     */
    public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO) {
        return baseMapper.exportQcresultByDept(exportQcresultVO);
    }

    @Override
    public List<ExportExcelDTO> exportQcresultByGroup(ExportQcresultVO exportQcresultVO) {
        return baseMapper.exportQcresultByGroup(exportQcresultVO);
    }

    /**
     * 条目缺陷质控评分页（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    public IPage<QcResultShortDTO> qcResultShortPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcResultShortPage(qcResultShortPageVO);
    }

    /**
     * 条目缺陷质控评分页-科室（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    public IPage<QcResultShortDTO> qcResultShortByDeptPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcResultShortByDeptPage(qcResultShortPageVO);
    }

    /**
     * 根据编码、医院编码批量更新
     *
     * @param list
     */
    public void updateBatchByKey(List<BehospitalInfo> list) {
        this.baseMapper.updateBatchByKey(list);
    }

    /**
     * 关键条目缺陷占比统计
     *
     * @param entryStatisticsVO
     * @return
     */
    @Override
    public List<EntryStatisticsDTO> entryStatistics(EntryStatisticsVO entryStatisticsVO) {
        return baseMapper.entryStatistics(entryStatisticsVO);
    }

    /**
     * 关键条目缺陷占比统计-科室
     *
     * @param entryStatisticsVO
     * @return
     */
    @Override
    public List<EntryStasByDeptDTO> entryStatisticsByDept(EntryStatisticsVO entryStatisticsVO) {
        return baseMapper.entryStatisticsByDept(entryStatisticsVO);
    }

    /**
     * 非医嘱离院病人记录
     *
     * @param filterVO
     * @return
     */
    @Override
    public int nonAdviceCount(FilterVO filterVO) {
        return baseMapper.nonAdviceCount(filterVO);
    }

    /**
     * 31天内再入院记录
     *
     * @param filterVO
     * @return
     */
    @Override
    public int get31DaysBehospitalCount(FilterVO filterVO) {
        return baseMapper.get31DaysBehospitalCount(filterVO);
    }

    /**
     * 输血患者人数
     *
     * @param filterVO
     * @return
     */
    public int bloodCount(FilterVO filterVO){
        return baseMapper.bloodCount(filterVO);
    }

    /**
     * 癌痛患者人数
     *
     * @param filterVO
     * @return
     */
    public int cancerCount(FilterVO filterVO){
        return baseMapper.cancerCount(filterVO);
    }

    /**
     * 病案首页质控病历数统计-全院（首页）
     *
     * @param filterVO
     * @return
     */
    @Override
    public HomePageNumDTO homePageQcPercent(FilterVO filterVO) {
        return baseMapper.homePageQcPercent(filterVO);
    }

    /**
     * 病案首页完整率统计-全院（首页）
     *
     * @param filterVO
     * @return
     */
    @Override
    public HomePageNumDTO hmEmptyEntryPercent(FilterVO filterVO) {
        return baseMapper.hmEmptyEntryPercent(filterVO);
    }

    /**
     * 离院病人质控评分详情页
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> leaveHosMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        IPage<QcResultShortDTO> qcResultShortDTOIPage = baseMapper.leaveHosMRPage(qcResultShortPageVO);
        return qcResultShortDTOIPage;
    }

    /**
     * 离院病人质控评分详情页-科室
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> leaveHosMRPageByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        IPage<QcResultShortDTO> qcResultShortDTOIPage = baseMapper.leaveHosMRPageByDept(qcResultShortPageVO);
        return qcResultShortDTOIPage;
    }


    /**
     * 改善率统计-全院（首页）
     *
     * @param filterVO
     * @return
     */
    @Override
    public HomePageImproveDTO homePageImproveCount(FilterVO filterVO) {
        return baseMapper.homePageImproveCount(filterVO);
    }

    /**
     * 质控核查统计（内页）
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<HomePageImproveDTO> qcCheckStatistics(FilterOrderVO filterOrderVO) {
        return baseMapper.qcCheckStatistics(filterOrderVO);
    }

    /**
     * 质控核查统计-科室（内页）
     *
     * @param filterOrderVO
     * @return
     */
    @Override
    public List<ImproveByDeptDTO> qcCheckStatisticsByDept(FilterOrderVO filterOrderVO) {
        return baseMapper.qcCheckStatisticsByDept(filterOrderVO);
    }

    /**
     * 离院病人质控评分详情页导出到excel
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> leaveHosMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.leaveHosMRPageExport(qcResultShortPageVO);
    }

    /**
     * 离院病人质控评分详情页-科室导出到excel
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelByDeptDTO> leaveHosMRPageExportByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.leaveHosMRPageExportByDept(qcResultShortPageVO);
    }


    /**
     * 条目缺陷质控评分详情页导出到excel
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> qcResultShortPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcResultShortPageExport(qcResultShortPageVO);
    }

    /**
     * 条目缺陷质控评分详情页导出到excel-湘雅
     *
     * @param qcResultShortPageVO
     * @return
     */

    public List<ExportExcelDTO> qcResultShortXYPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcResultShortPageExport(qcResultShortPageVO);
    }

    /**
     * 缺陷详情质控评分页导出-科室
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelByDeptDTO> qcResultShortByDeptPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcResultShortByDeptPageExport(qcResultShortPageVO);
    }

    /**
     * 未整改病历统计
     *
     * @param filterUnModifyMRVO
     * @return
     */
    @Override
    public List<UnModifyMRDetailDTO> unModifyMRStatistics(FilterUnModifyMRVO filterUnModifyMRVO) {
        return baseMapper.unModifyMRStatistics(filterUnModifyMRVO);
    }

    /**
     * 未整改病历统计-科室
     *
     * @param filterUnModifyMRVO
     * @return
     */
    @Override
    public List<UnModifyMRDetailDTO> unModifyMRSByDept(FilterUnModifyMRVO filterUnModifyMRVO) {
        return baseMapper.unModifyMRSByDept(filterUnModifyMRVO);
    }

    /**
     * 病历质控报表-科室
     *
     * @param behospitalPageVO
     * @return
     */
    @Override
    public IPage<QualityControlDeptDTO> qualityControlByDept(BehospitalPageVO behospitalPageVO) {
        return baseMapper.qualityControlByDept(behospitalPageVO);
    }


    /**
     * 病历稽查表
     *
     * @param filterVO
     * @return
     */
    @Override
    public IPage<MedicalCheckDTO> getMedicalCheck(@Param("filterVO") FilterMedicalCheckVO filterVO, @Param("casesEntryIds") List<Long> casesEntryIds) {
        IPage<MedicalCheckDTO> medicalCheck = baseMapper.getMedicalCheck(filterVO);
        List<MedicalCheckIdNameDTO> medicalEntryIds = baseMapper.getMedicalEntryIds(casesEntryIds);

        List<MedicalCheckDTO> records = medicalCheck.getRecords();
        for (MedicalCheckDTO record : records) {
            for (MedicalCheckIdNameDTO medicalEntryId : medicalEntryIds) {
                if ("2170".equals(medicalEntryId.getId())) {
                    record.setEntry_2170_id(medicalEntryId.getId());
                    record.setEntry_2170_name(medicalEntryId.getName());
                }
                if ("2217".equals(medicalEntryId.getId())) {
                    record.setEntry_2217_id(medicalEntryId.getId());
                    record.setEntry_2217_name(medicalEntryId.getName());
                }
                if ("2218".equals(medicalEntryId.getId())) {
                    record.setEntry_2218_id(medicalEntryId.getId());
                    record.setEntry_2218_name(medicalEntryId.getName());
                }
                if ("2220".equals(medicalEntryId.getId())) {
                    record.setEntry_2220_id(medicalEntryId.getId());
                    record.setEntry_2220_name(medicalEntryId.getName());
                }
                if ("2229".equals(medicalEntryId.getId())) {
                    record.setEntry_2229_id(medicalEntryId.getId());
                    record.setEntry_2229_name(medicalEntryId.getName());
                }
                if ("2287".equals(medicalEntryId.getId())) {
                    record.setEntry_2287_id(medicalEntryId.getId());
                    record.setEntry_2287_name(medicalEntryId.getName());
                }
                if ("2486".equals(medicalEntryId.getId())) {
                    record.setEntry_2486_id(medicalEntryId.getId());
                    record.setEntry_2486_name(medicalEntryId.getName());
                }
                if ("2495".equals(medicalEntryId.getId())) {
                    record.setEntry_2495_id(medicalEntryId.getId());
                    record.setEntry_2495_name(medicalEntryId.getName());
                }
                if ("2654".equals(medicalEntryId.getId())) {
                    record.setEntry_2654_id(medicalEntryId.getId());
                    record.setEntry_2654_name(medicalEntryId.getName());
                }
                if ("2655".equals(medicalEntryId.getId())) {
                    record.setEntry_2655_id(medicalEntryId.getId());
                    record.setEntry_2655_name(medicalEntryId.getName());
                }
                if ("2657".equals(medicalEntryId.getId())) {
                    record.setEntry_2657_id(medicalEntryId.getId());
                    record.setEntry_2657_name(medicalEntryId.getName());
                }
                if ("2658".equals(medicalEntryId.getId())) {
                    record.setEntry_2658_id(medicalEntryId.getId());
                    record.setEntry_2658_name(medicalEntryId.getName());
                }
                if ("2686".equals(medicalEntryId.getId())) {
                    record.setEntry_2686_id(medicalEntryId.getId());
                    record.setEntry_2686_name(medicalEntryId.getName());
                }
                if ("2852".equals(medicalEntryId.getId())) {
                    record.setEntry_2852_id(medicalEntryId.getId());
                    record.setEntry_2852_name(medicalEntryId.getName());
                }
                if ("2900".equals(medicalEntryId.getId())) {
                    record.setEntry_2900_id(medicalEntryId.getId());
                    record.setEntry_2900_name(medicalEntryId.getName());
                }
                if ("2930".equals(medicalEntryId.getId())) {
                    record.setEntry_2930_id(medicalEntryId.getId());
                    record.setEntry_2930_name(medicalEntryId.getName());
                }
                if ("3010".equals(medicalEntryId.getId())) {
                    record.setEntry_3010_id(medicalEntryId.getId());
                    record.setEntry_3010_name(medicalEntryId.getName());
                }
                if ("3025".equals(medicalEntryId.getId())) {
                    record.setEntry_3025_id(medicalEntryId.getId());
                    record.setEntry_3025_name(medicalEntryId.getName());
                }
                if ("3062".equals(medicalEntryId.getId())) {
                    record.setEntry_3062_id(medicalEntryId.getId());
                    record.setEntry_3062_name(medicalEntryId.getName());
                }
                if ("3063".equals(medicalEntryId.getId())) {
                    record.setEntry_3063_id(medicalEntryId.getId());
                    record.setEntry_3063_name(medicalEntryId.getName());
                }
            }
        }

        return medicalCheck;

    }

    /**
     * 病历稽查表-科室
     *
     * @param filterVO
     * @return
     */
    @Override
    public IPage<MedicalCheckDTO> getMedicalChecks(@Param("filterVO") FilterMedicalCheckVO filterVO, @Param("casesEntryIds") List<Long> casesEntryIds) {
        IPage<MedicalCheckDTO> medicalCheck = baseMapper.getMedicalCheckByDept(filterVO);
        List<MedicalCheckIdNameDTO> medicalEntryIds = baseMapper.getMedicalEntryIds(casesEntryIds);

        List<MedicalCheckDTO> records = medicalCheck.getRecords();
        for (MedicalCheckDTO record : records) {
            for (MedicalCheckIdNameDTO medicalEntryId : medicalEntryIds) {
                if ("2170".equals(medicalEntryId.getId())) {
                    record.setEntry_2170_id(medicalEntryId.getId());
                    record.setEntry_2170_name(medicalEntryId.getName());
                }
                if ("2217".equals(medicalEntryId.getId())) {
                    record.setEntry_2217_id(medicalEntryId.getId());
                    record.setEntry_2217_name(medicalEntryId.getName());
                }
                if ("2218".equals(medicalEntryId.getId())) {
                    record.setEntry_2218_id(medicalEntryId.getId());
                    record.setEntry_2218_name(medicalEntryId.getName());
                }
                if ("2220".equals(medicalEntryId.getId())) {
                    record.setEntry_2220_id(medicalEntryId.getId());
                    record.setEntry_2220_name(medicalEntryId.getName());
                }
                if ("2229".equals(medicalEntryId.getId())) {
                    record.setEntry_2229_id(medicalEntryId.getId());
                    record.setEntry_2229_name(medicalEntryId.getName());
                }
                if ("2287".equals(medicalEntryId.getId())) {
                    record.setEntry_2287_id(medicalEntryId.getId());
                    record.setEntry_2287_name(medicalEntryId.getName());
                }
                if ("2486".equals(medicalEntryId.getId())) {
                    record.setEntry_2486_id(medicalEntryId.getId());
                    record.setEntry_2486_name(medicalEntryId.getName());
                }
                if ("2495".equals(medicalEntryId.getId())) {
                    record.setEntry_2495_id(medicalEntryId.getId());
                    record.setEntry_2495_name(medicalEntryId.getName());
                }
                if ("2654".equals(medicalEntryId.getId())) {
                    record.setEntry_2654_id(medicalEntryId.getId());
                    record.setEntry_2654_name(medicalEntryId.getName());
                }
                if ("2655".equals(medicalEntryId.getId())) {
                    record.setEntry_2655_id(medicalEntryId.getId());
                    record.setEntry_2655_name(medicalEntryId.getName());
                }
                if ("2657".equals(medicalEntryId.getId())) {
                    record.setEntry_2657_id(medicalEntryId.getId());
                    record.setEntry_2657_name(medicalEntryId.getName());
                }
                if ("2658".equals(medicalEntryId.getId())) {
                    record.setEntry_2658_id(medicalEntryId.getId());
                    record.setEntry_2658_name(medicalEntryId.getName());
                }
                if ("2686".equals(medicalEntryId.getId())) {
                    record.setEntry_2686_id(medicalEntryId.getId());
                    record.setEntry_2686_name(medicalEntryId.getName());
                }
                if ("2852".equals(medicalEntryId.getId())) {
                    record.setEntry_2852_id(medicalEntryId.getId());
                    record.setEntry_2852_name(medicalEntryId.getName());
                }
                if ("2900".equals(medicalEntryId.getId())) {
                    record.setEntry_2900_id(medicalEntryId.getId());
                    record.setEntry_2900_name(medicalEntryId.getName());
                }
                if ("2930".equals(medicalEntryId.getId())) {
                    record.setEntry_2930_id(medicalEntryId.getId());
                    record.setEntry_2930_name(medicalEntryId.getName());
                }
                if ("3010".equals(medicalEntryId.getId())) {
                    record.setEntry_3010_id(medicalEntryId.getId());
                    record.setEntry_3010_name(medicalEntryId.getName());
                }
                if ("3025".equals(medicalEntryId.getId())) {
                    record.setEntry_3025_id(medicalEntryId.getId());
                    record.setEntry_3025_name(medicalEntryId.getName());
                }
                if ("3062".equals(medicalEntryId.getId())) {
                    record.setEntry_3062_id(medicalEntryId.getId());
                    record.setEntry_3062_name(medicalEntryId.getName());
                }
                if ("3063".equals(medicalEntryId.getId())) {
                    record.setEntry_3063_id(medicalEntryId.getId());
                    record.setEntry_3063_name(medicalEntryId.getName());
                }
            }
        }

        return medicalCheck;

    }

    /**
     * 病历稽查表导出
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<MedicalCheckExportDTO> getMedicalCheckExport(@Param("filterVO") FilterMedicalCheckVO filterVO) {
        List<MedicalCheckExportDTO> medicalCheckExport = baseMapper.getMedicalCheckExport(filterVO);
        return medicalCheckExport;

    }

    /**
     * 病历稽查表导出-科室
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<MedicalDeptDTO> medicalCheckExportByDept(@Param("filterVO") FilterMedicalCheckVO filterVO) {
        List<MedicalDeptDTO> medicalCheckExport = baseMapper.medicalCheckExportByDept(filterVO);
        return medicalCheckExport;

    }


    /**
     * 未整改病历质控评分页（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> unModifyMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.unModifyMRPage(qcResultShortPageVO);
    }

    /**
     * 未整改病历质控评分页-科室（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> unModifyMRByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.unModifyMRByDept(qcResultShortPageVO);
    }


    /**
     * 不合格/合格数病历号（内页）
     *
     * @param qcResultPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> badLevelPage(@Param("qcResultPageVO") QcResultPageVO qcResultPageVO) {
        return baseMapper.badLevelPage(qcResultPageVO);
    }

    /**
     * 未整改病历缺陷评分详情页导出
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> unModifyMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.unModifyMRPageExport((qcResultShortPageVO));
    }

    /**
     * 未整改病历缺陷评分详情页导出-科室
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelByDeptDTO> unModifyExportByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.unModifyExportByDept((qcResultShortPageVO));
    }


    /**
     * 病案首页不合格/合格数病历详情页导出
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> badLevelPagePageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.badLevelPagePageExport((qcResultShortPageVO));
    }

    /**
     * 病案首页不合格/合格数病历详情页导出-科室
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelByDeptDTO> homePageOrLevelExportByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.homePageOrLevelExportByDept((qcResultShortPageVO));
    }


    /**
     * 31天再入院详情页
     *
     * @param reBeHosPageVO
     * @return
     */
    @Override
    public IPage<ReBeHosMergeDTO> reHos31DaysPage(@Param("reBeHosPageVO") ReBeHosPageVO reBeHosPageVO) {
        return baseMapper.reHos31DaysPage(reBeHosPageVO);
    }

    /**
     * 31天再入院详情页-科室
     *
     * @param reBeHosPageVO
     * @return
     */
    @Override
    public IPage<ReBeHosMergeDTO> reHos31DaysPageByDept(@Param("reBeHosPageVO") ReBeHosPageVO reBeHosPageVO) {
        return baseMapper.reHos31DaysPageByDept(reBeHosPageVO);
    }


    /**
     * 入院人数统计-首页
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<NumDTO> beHosCount(FilterVO filterVO) {
        return baseMapper.beHosCount(filterVO);
    }

    /**
     * 单条条目缺陷统计-首页
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<NumDTO> casesEntryStatisticsById(FilterVO filterVO) {
        return baseMapper.casesEntryStatisticsById(filterVO);
    }

    /**
     * 病案首页改善率质控评分页（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> hmImproveMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.hmImproveMRPage(qcResultShortPageVO);
    }

    /**
     * 病案首页改善率质控评分页-科室（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> hmImproveMRPageByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.hmImproveMRPageByDept(qcResultShortPageVO);
    }

    /**
     * 病案首页改善率质控评分页导出
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> hmImproveMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.hmImproveMRPageExport(qcResultShortPageVO);
    }

    /**
     * 病案首页改善率质控评分页导出-科室
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelByDeptDTO> improveMRExportByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.improveMRExportByDept(qcResultShortPageVO);
    }

    /**
     * 病案管理指标获取基础数据
     *
     * @param timeVo
     * @return
     */
    @Override
    public Map<String, Object> getBaseIndex(MedIndexFilterVO timeVo) {
        return baseMapper.getBaseIndex(timeVo);
    }

    /**
     * 病案管理规则质控参数查询
     *
     * @param filterVO
     * @return
     */
    @Override
    public Map<String, Object> getCountByEntry(FilterVO filterVO) {
        return baseMapper.getCountByEntry(filterVO);
    }

    /**
     * 病案管理规则质控病历参数查询
     *
     * @param filterVO
     * @return
     */
    @Override
    public List<MedManageParamsDTO> getMedManageParams(FilterVO filterVO) {
        return baseMapper.getMedManageParams(filterVO);
    }

    /**
     * 质控核查质控评分页（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> qcCheckMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcCheckMRPage(qcResultShortPageVO);
    }

    /**
     * 质控核查质控评分页-科室（内页）
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public IPage<QcResultShortDTO> qcCheckMRPageByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcCheckMRPageByDept(qcResultShortPageVO);
    }


    /**
     * 质控核查质控评分页导出
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelDTO> qcCheckMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcCheckMRPageExport(qcResultShortPageVO);
    }

    /**
     * 质控核查质控评分页-科室 导出
     *
     * @param qcResultShortPageVO
     * @return
     */
    @Override
    public List<ExportExcelByDeptDTO> qcCheckMRPageExportByDept(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
        return baseMapper.qcCheckMRPageExportByDept(qcResultShortPageVO);
    }

    /**
     * 手术费，抗菌药物，手术和病理费等含有人数
     *
     * @param filterVO
     * @return
     */
    public List<Map<String, String>> selectOperationNum(@Param("filterVO") FilterVO filterVO) {
        return baseMapper.selectOperationNum(filterVO);

    }

    /**
     * 触发规则人数
     *
     * @param filterVO
     * @return
     */
    public Map<String, Long> triggeringRules(@Param("filterVO") FilterVO filterVO) {
        return baseMapper.triggeringRules(filterVO);
    }

    /**
     * 病案首页关联的出院病历
     *
     * @param filterVO
     * @return
     */
    public List<Map<String, String>> getMedicalRecords(@Param("filterVO") FilterVO filterVO) {
        return baseMapper.getMedicalRecords(filterVO);
    }

    /**
     * 首页恶性肿瘤人数
     *
     * @param filterVO
     * @return
     */
    public List<Map<String, String>> malignancy(@Param("filterVO") FilterVO filterVO) {
        return baseMapper.malignancy(filterVO);
    }

    /**
     * 病历详情（H5）
     *
     * @param behInfoForH5VO
     * @return
     */
    public IPage<BehInfoForH5DTO> behospitalInfoForH5(BehInfoForH5VO behInfoForH5VO) {
        return baseMapper.behospitalInfoForH5(behInfoForH5VO);
    }

}
