Kaynağa Gözat

条目缺陷改善科室统计

chengyao 3 yıl önce
ebeveyn
işleme
1230594f37

+ 0 - 2
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -273,8 +273,6 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/analysis/getEntryDefectImproveByExport").permitAll()
                 .antMatchers("/qc/analysis/getEntryDefectImproveInner").permitAll()
                 .antMatchers("/qc/analysis/getDefectImproveInnerByExport").permitAll()
-                .antMatchers("/qc/analysisDept/getQcClickDept").permitAll()
-                .antMatchers("/qc/analysisDept/getQcClickByDeptExport").permitAll()
                 .antMatchers("/qc/analysisDept/getEntryDefectImproveDept").permitAll()
                 .antMatchers("/qc/analysisDept/getEntryDefectImproveByDeptExport").permitAll()
                 .antMatchers("/qc/analysisDept/getEntryDefectImproveInnerDept").permitAll()

+ 0 - 2
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -317,8 +317,6 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/analysis/getEntryDefectImproveByExport", request)
                 || matchers("/qc/analysis/getEntryDefectImproveInner", request)
                 || matchers("/qc/analysis/getDefectImproveInnerByExport", request)
-                || matchers("/qc/analysisDept/getQcClickDept", request)
-                || matchers("/qc/analysisDept/getQcClickByDeptExport", request)
                 || matchers("/qc/analysisDept/getEntryDefectImproveDept", request)
                 || matchers("/qc/analysisDept/getEntryDefectImproveByDeptExport", request)
                 || matchers("/qc/analysisDept/getEntryDefectImproveInnerDept", request)

+ 25 - 0
src/main/java/com/diagbot/dto/EntryDefectImproveInnerDoctor.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class EntryDefectImproveInnerDoctor {
+    /**
+     * 医生id
+     */
+    private String doctorId;
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+
+    List<BehospitalCodeInfo> behospitalCodeInfos;
+}

+ 27 - 0
src/main/java/com/diagbot/dto/EntryDefectImproveInnerExport.java

@@ -0,0 +1,27 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class EntryDefectImproveInnerExport {
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室name
+     */
+    private String deptName;
+
+
+    List<EntryDefectImproveInnerDoctor> entryDefectImproveInnerDoctors;
+}

+ 3 - 3
src/main/java/com/diagbot/dto/GetEntryDefectImproveDeptDTO.java

@@ -62,19 +62,19 @@ public class GetEntryDefectImproveDeptDTO {
      * 缺陷总数
      */
     @Excel(name = "总数量", width = 10d, orderNum = "6")
-    private Integer totalNum;
+    private Long totalNum=0L;
 
     /**
      * 已改善数
      */
     @Excel(name = "已改善数量", width = 13d, orderNum = "7")
-    private Integer handleNum;
+    private Long handleNum=0L;
 
     /**
      * 待改善数
      */
     @Excel(name = "待改善数量", width = 13d, orderNum = "8")
-    private Integer improveleNum;
+    private Long improveleNum=0L;
 
     /**
      * 改善率

+ 118 - 13
src/main/java/com/diagbot/facade/DataAnalysisDeptFacade.java

@@ -1,22 +1,33 @@
 package com.diagbot.facade;
+
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.BehospitalCodeInfo;
+import com.diagbot.dto.EntryDefectImproveInnerDoctor;
+import com.diagbot.dto.EntryDefectImproveInnerExport;
 import com.diagbot.dto.GetEntryDefectImproveDeptDTO;
+import com.diagbot.dto.GetEntryInfoDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.MedClickInfoServiceImpl;
-import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.GetEntryDefectImproveDeptVO;
-import com.diagbot.vo.GetEntryDefectImproveVO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -31,14 +42,87 @@ public class DataAnalysisDeptFacade {
     private MedClickInfoServiceImpl medClickInfoService;
 
     public IPage<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
-        GetEntryDefectImproveVO getEntryDefectImproveVO = new GetEntryDefectImproveVO();
-        BeanUtil.copyProperties(getEntryDefectImproveDeptVO,getEntryDefectImproveVO);
-        entryDefectSet(getEntryDefectImproveVO);
-        IPage<GetEntryDefectImproveDeptDTO> records = medClickInfoService.getBaseMapper().getEntryDefectImproveDept(getEntryDefectImproveDeptVO);
-        return records;
+        int current = (int) getEntryDefectImproveDeptVO.getCurrent();
+        int size = (int) getEntryDefectImproveDeptVO.getSize();
+        entryDefectDeptSet(getEntryDefectImproveDeptVO);
+        IPage<GetEntryDefectImproveDeptDTO> page = new Page<>();
+        List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOList = new ArrayList<>();
+        //获取标准缺陷信息
+        List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
+        //查询基础数据源
+        List<EntryDefectImproveInnerExport> records = medClickInfoService.getBaseMapper().getEntryDefectImproveDept(getEntryDefectImproveDeptVO);
+        //遍历科室
+        for (EntryDefectImproveInnerExport entryDefectImproveInnerExport : records) {
+            List<EntryDefectImproveInnerDoctor> entryDefectImproveInnerDoctors = entryDefectImproveInnerExport.getEntryDefectImproveInnerDoctors();
+            for (EntryDefectImproveInnerDoctor entryDefectImproveInnerDoctor : entryDefectImproveInnerDoctors) {
+                //对科室下医生质控的病历缺陷计数
+                Map<String, Long> totalMap = new HashMap<>();
+                Map<String, Long> improveleMap = new HashMap<>();
+                List<BehospitalCodeInfo> behospitalCodeInfoList = entryDefectImproveInnerDoctor.getBehospitalCodeInfos();
+                //多份病历多次质控评分得到质控缺陷总量、待改善总量
+                DataAnalysisFacade.unitProcessing(behospitalCodeInfoList, totalMap, improveleMap);
+                //按照全院维度进行数据封装
+                for (Map.Entry<String, Long> stringLongEntry : totalMap.entrySet()) {
+                    GetEntryDefectImproveDeptDTO getEntryDefectImproveDeptDTO = new GetEntryDefectImproveDeptDTO();
+                    getEntryDefectImproveDeptDTO.setDeptId(entryDefectImproveInnerExport.getDeptId());
+                    getEntryDefectImproveDeptDTO.setDeptName(entryDefectImproveInnerExport.getDeptName());
+                    getEntryDefectImproveDeptDTO.setDoctorId(entryDefectImproveInnerDoctor.getDoctorId());
+                    getEntryDefectImproveDeptDTO.setDoctorName(entryDefectImproveInnerDoctor.getDoctorName());
+                    getEntryDefectImproveDeptDTO.setEntryId(stringLongEntry.getKey());
+                    getEntryInfoByDept(entryInfo, stringLongEntry, getEntryDefectImproveDeptDTO);
+                    getEntryDefectImproveDeptDTO.setTotalNum(stringLongEntry.getValue());
+                    if (improveleMap.containsKey(stringLongEntry.getKey())) {
+                        getEntryDefectImproveDeptDTO.setImproveleNum(improveleMap.get(stringLongEntry.getKey()));
+                    }
+                    getEntryDefectImproveDeptDTO.setHandleNum(getEntryDefectImproveDeptDTO.getTotalNum() - getEntryDefectImproveDeptDTO.getImproveleNum());
+                    getEntryDefectImproveDeptDTOList.add(getEntryDefectImproveDeptDTO);
+                }
+            }
+        }
+        //(部分模糊查询在此)
+        if (ListUtil.isNotEmpty(getEntryDefectImproveDeptDTOList)) {
+            if (StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getCasesName()) || StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getEntryName())) {
+                getEntryDefectImproveQueryDept(getEntryDefectImproveDeptVO, getEntryDefectImproveDeptDTOList);
+            }
+        }
+
+        //导出操作
+        if (getEntryDefectImproveDeptVO.getExportType() == 1L) {
+            size = getEntryDefectImproveDeptDTOList.size();
+        }
+        page.setSize(size);
+        page.setTotal(getEntryDefectImproveDeptDTOList.size());
+        page.setCurrent(current);
+        //分页操作
+        List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOS = DataAnalysisFacade.page(getEntryDefectImproveDeptDTOList, size, current);
+        if (ListUtil.isNotEmpty(getEntryDefectImproveDeptDTOS)) {
+            //排序操作
+            getEntryDefectImproveDeptDTOS = DataAnalysisFacade.sortList(getEntryDefectImproveDeptDTOS, getEntryDefectImproveDeptVO.getAsc() != null ? getEntryDefectImproveDeptVO.getAsc() : getEntryDefectImproveDeptVO.getDesc() + " desc");
+        }
+        ;
+        page.setRecords(getEntryDefectImproveDeptDTOS);
+        return page;
+    }
+
+    public void getEntryDefectImproveQueryDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO, List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOList) {
+
+        Iterator<GetEntryDefectImproveDeptDTO> iterator = getEntryDefectImproveDeptDTOList.iterator();
+        while (iterator.hasNext()) {
+            boolean mark = true;
+            GetEntryDefectImproveDeptDTO kfc = iterator.next();
+            if (StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getCasesName()) &&
+                    !kfc.getCasesName().contains(getEntryDefectImproveDeptVO.getCasesName())) {
+                iterator.remove();
+                mark = false;
+            }
+            if (mark && StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getEntryName()) &&
+                    !kfc.getEntryName().contains(getEntryDefectImproveDeptVO.getEntryName())) {
+                iterator.remove();
+            }
+        }
     }
 
-    public void getEntryDefectImproveByDeptExport(HttpServletResponse response,GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+    public void getEntryDefectImproveByDeptExport(HttpServletResponse response, GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
         getEntryDefectImproveDeptVO.setCurrent(1L);
         getEntryDefectImproveDeptVO.setSize(Long.MAX_VALUE);
         getEntryDefectImproveDeptVO.setSearchCount(false);
@@ -47,20 +131,41 @@ public class DataAnalysisDeptFacade {
         ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetEntryDefectImproveDeptDTO.class, fileName, response, 12.8f);
     }
 
-    private void entryDefectSet(GetEntryDefectImproveVO getEntryDefectImproveVO) {
+    private void entryDefectDeptSet(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+        getEntryDefectImproveDeptVO.setCurrent(1L);
+        getEntryDefectImproveDeptVO.setSize(Long.MAX_VALUE);
         //入参验证
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
         Date startDate = null;
         Date endDate = null;
         try {
-            startDate = simpleDateFormat.parse(getEntryDefectImproveVO.getStartDate());
-            endDate = simpleDateFormat.parse(getEntryDefectImproveVO.getEndDate());
+            startDate = simpleDateFormat.parse(getEntryDefectImproveDeptVO.getStartDate());
+            endDate = simpleDateFormat.parse(getEntryDefectImproveDeptVO.getEndDate());
         } catch (ParseException e) {
             e.printStackTrace();
         }
-        if (DateUtil.after(startDate,endDate)){
+        if (DateUtil.after(startDate, endDate)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
         }
-        getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+        getEntryDefectImproveDeptVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+    /**
+     * @Description: 缺陷信息封装
+     * @Param: [entryInfo, stringLongEntry, getEntryDefectImprove]
+     * @return: com.diagbot.dto.GetEntryDefectImproveDTO
+     * @Author: cy
+     * @Date: 2021/12/3
+     */
+    public GetEntryDefectImproveDeptDTO getEntryInfoByDept(List<GetEntryInfoDTO> entryInfo, Map.Entry<String, Long> stringLongEntry,
+                                                           GetEntryDefectImproveDeptDTO getEntryDefectImproveDeptDTO) {
+        entryInfo.parallelStream().filter(kfc -> kfc.getEntryId().equals(stringLongEntry.getKey())).forEach(
+                obj -> {
+                    getEntryDefectImproveDeptDTO.setCasesId(obj.getCasesId());
+                    getEntryDefectImproveDeptDTO.setCasesName(obj.getCasesName());
+                    getEntryDefectImproveDeptDTO.setEntryName(obj.getEntryName());
+                }
+        );
+        return getEntryDefectImproveDeptDTO;
     }
 }

+ 38 - 15
src/main/java/com/diagbot/facade/DataAnalysisFacade.java

@@ -8,8 +8,6 @@ import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.dto.EntryDefectImprove;
 import com.diagbot.dto.EntryDefectImproveInner;
-import com.diagbot.dto.ExportExcelBehospitalDTO;
-import com.diagbot.dto.ExportExcelDTO;
 import com.diagbot.dto.GetEntryDefectImproveDTO;
 import com.diagbot.dto.GetEntryInfoDTO;
 import com.diagbot.dto.GetQcClickDTO;
@@ -53,6 +51,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -222,11 +221,11 @@ public class DataAnalysisFacade {
             unitProcessing(behospitalCodeInfoList, totalMap, improveleMap);
             //按照全院维度进行数据封装
             for (Map.Entry<String, Long> stringLongEntry : totalMap.entrySet()) {
+                //封装DTO
                 GetEntryDefectImproveDTO getEntryDefectImprove = new GetEntryDefectImproveDTO();
                 getEntryDefectImprove.setDeptId(entryDefectImprove.getDeptId());
                 getEntryDefectImprove.setDeptName(entryDefectImprove.getDeptName());
                 getEntryDefectImprove.setEntryId(stringLongEntry.getKey());
-                //封装信息
                 getEntryInfo(entryInfo, stringLongEntry, getEntryDefectImprove);
                 getEntryDefectImprove.setTotalNum(stringLongEntry.getValue());
                 if (improveleMap.containsKey(stringLongEntry.getKey())) {
@@ -236,6 +235,13 @@ public class DataAnalysisFacade {
                 getEntryDefectImproveDTO.add(getEntryDefectImprove);
             }
         }
+        //(部分模糊查询在此)
+            if (ListUtil.isNotEmpty(getEntryDefectImproveDTO)) {
+                if (StringUtils.isNotBlank(getEntryDefectImproveVO.getCasesName()) || StringUtils.isNotBlank(getEntryDefectImproveVO.getEntryName())) {
+                getEntryDefectImproveQuery(getEntryDefectImproveVO, getEntryDefectImproveDTO);
+            }
+        }
+
 
         //导出操作
         if (getEntryDefectImproveVO.getExportType() == 1L) {
@@ -246,7 +252,7 @@ public class DataAnalysisFacade {
         page.setCurrent(current);
         //分页操作
         List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS = page(getEntryDefectImproveDTO, size, current);
-        if(ListUtil.isNotEmpty(getEntryDefectImproveDTOS)) {
+        if (ListUtil.isNotEmpty(getEntryDefectImproveDTOS)) {
             //排序操作
             getEntryDefectImproveDTOS = sortList(getEntryDefectImproveDTOS, getEntryDefectImproveVO.getAsc() != null ? getEntryDefectImproveVO.getAsc() : getEntryDefectImproveVO.getDesc() + " desc");
         };
@@ -280,8 +286,8 @@ public class DataAnalysisFacade {
      * @Author: cy
      * @Date: 2021/12/3
      */
-    public void unitProcessing(List<BehospitalCodeInfo> behospitalCodeInfoList, Map<String, Long> totalMap,
-                               Map<String, Long> improveleMap) {
+    public static void unitProcessing(List<BehospitalCodeInfo> behospitalCodeInfoList, Map<String, Long> totalMap,
+                                      Map<String, Long> improveleMap) {
         for (BehospitalCodeInfo behospitalCodeInfo : behospitalCodeInfoList) {
             //病历下
             List<QcResultDetailInfo> qcResultDetailInfos = behospitalCodeInfo.getQcResultDetailInfos();
@@ -294,6 +300,23 @@ public class DataAnalysisFacade {
     }
 
 
+    public void getEntryDefectImproveQuery(GetEntryDefectImproveVO getEntryDefectImproveVO, List<GetEntryDefectImproveDTO> getEntryDefectImproveDTO) {
+        Iterator<GetEntryDefectImproveDTO> iterator = getEntryDefectImproveDTO.iterator();
+        while (iterator.hasNext()) {
+            boolean mark = true;
+            GetEntryDefectImproveDTO kfc = iterator.next();
+            if (StringUtils.isNotBlank(getEntryDefectImproveVO.getCasesName()) &&
+                    !kfc.getCasesName().contains(getEntryDefectImproveVO.getCasesName())) {
+                iterator.remove();
+                mark = false;
+            }
+            if (mark && StringUtils.isNotBlank(getEntryDefectImproveVO.getEntryName()) &&
+                    !kfc.getEntryName().contains(getEntryDefectImproveVO.getEntryName())) {
+                iterator.remove();
+            }
+        }
+    }
+
     /**
      * @Description:分页数据
      * @Param: [dataList, pageSize, currentPage]
@@ -301,7 +324,7 @@ public class DataAnalysisFacade {
      * @Author: cy
      * @Date: 2021/12/2
      */
-    public static<T> List<T> page(List<T> retRecords, int pageSize, int currentPage) {
+    public static <T> List<T> page(List<T> retRecords, int pageSize, int currentPage) {
         List<T> currentPageList = new ArrayList<>();
         if (retRecords != null && retRecords.size() > 0) {
             int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
@@ -336,7 +359,7 @@ public class DataAnalysisFacade {
         return list;
     }
 
-    public Map getEntryTotalMap(List<QcResultDetailInfo> qcResultDetailInfos, Map<String, Long> totalMap) {
+    public static Map getEntryTotalMap(List<QcResultDetailInfo> qcResultDetailInfos, Map<String, Long> totalMap) {
         Set<String> totalSet = new HashSet<String>();
         for (QcResultDetailInfo qcResultDetailInfo : qcResultDetailInfos) {
             //质控下获取科室下总缺陷
@@ -347,7 +370,7 @@ public class DataAnalysisFacade {
         return totalMap;
     }
 
-    public Map getEntryImproveleMap(QcResultDetailInfo qcResultDetailInfo, Map<String, Long> improveMap) {
+    public static Map getEntryImproveleMap(QcResultDetailInfo qcResultDetailInfo, Map<String, Long> improveMap) {
         Set<String> improveleSet = new HashSet<String>();
         String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
         improveleSet = getSetEntry(casesEntryIds, improveleSet);
@@ -355,7 +378,7 @@ public class DataAnalysisFacade {
         return improveMap;
     }
 
-    public Set getSetEntry(String casesEntryIds, Set set) {
+    public static Set getSetEntry(String casesEntryIds, Set set) {
         if (StringUtils.isNotBlank(casesEntryIds) && !"0".equals(casesEntryIds)) {
             if (casesEntryIds.contains("、")) {
                 String[] split = casesEntryIds.split("、");
@@ -369,7 +392,7 @@ public class DataAnalysisFacade {
         return set;
     }
 
-    public Map getSetEntryCount(Map<String, Long> map, Set<String> sets) {
+    public static Map getSetEntryCount(Map<String, Long> map, Set<String> sets) {
         for (String set : sets) {
             if (map.containsKey(set)) {
                 long count = map.get(set) + 1l;
@@ -400,7 +423,7 @@ public class DataAnalysisFacade {
         IPage<BehospitalInfoDTO> page = new Page<>();
         List<BehospitalInfoDTO> behospitalInfoDTOS = new ArrayList<>();
         entryDefectInnerSet(getEntryDefectImproveInnerVO);
-       // List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
+        // List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
         List<EntryDefectImproveInner> records = medClickInfoService.getBaseMapper().getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
         if (ListUtil.isNotEmpty(records) && records.size() == 1) {
             EntryDefectImproveInner entryDefectImproveInner = records.get(0);
@@ -414,7 +437,7 @@ public class DataAnalysisFacade {
                     totalSet = getSetEntry(casesEntryIds, totalSet);
                 }
                 QcResultDetailInfo qcResultDetailInfo = qcResultDetailInfos.get(qcResultDetailInfos.size() - 1);
-                if(null != qcResultDetailInfo && StringUtils.isNotBlank(qcResultDetailInfo.getCasesEntryIds())){
+                if (null != qcResultDetailInfo && StringUtils.isNotBlank(qcResultDetailInfo.getCasesEntryIds())) {
                     improveleSet = getSetEntry(qcResultDetailInfo.getCasesEntryIds(), improveleSet);
                 }
                 if ("0".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
@@ -439,11 +462,11 @@ public class DataAnalysisFacade {
         page.setCurrent(current);
         //分页操作
         List<BehospitalInfoDTO> behospitalInfoDTOList = page(behospitalInfoDTOS, size, current);
-        if(ListUtil.isNotEmpty(behospitalInfoDTOList)){
+        if (ListUtil.isNotEmpty(behospitalInfoDTOList)) {
             //排序操作
             behospitalInfoDTOList = sortList(behospitalInfoDTOList, getEntryDefectImproveInnerVO.getAsc() != null ? getEntryDefectImproveInnerVO.getAsc() : getEntryDefectImproveInnerVO.getDesc() + " desc");
         }
-      page.setRecords(behospitalInfoDTOList);
+        page.setRecords(behospitalInfoDTOList);
         return page;
     }
 

+ 2 - 4
src/main/java/com/diagbot/mapper/MedClickInfoMapper.java

@@ -1,12 +1,10 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.EntryDefectImprove;
 import com.diagbot.dto.EntryDefectImproveInner;
+import com.diagbot.dto.EntryDefectImproveInnerExport;
 import com.diagbot.dto.ExportExcelDTO;
-import com.diagbot.dto.GetEntryDefectImproveDTO;
-import com.diagbot.dto.GetEntryDefectImproveDeptDTO;
 import com.diagbot.dto.GetEntryInfoDTO;
 import com.diagbot.dto.GetQcClickDTO;
 import com.diagbot.dto.GetQcClickInnerPageDTO;
@@ -33,7 +31,7 @@ public interface MedClickInfoMapper extends BaseMapper<MedClickInfo> {
     public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO);
     public List<EntryDefectImprove> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO);
     public List<GetEntryInfoDTO> getEntryInfo();
-    public IPage<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO);
+    public List<EntryDefectImproveInnerExport> getEntryDefectImproveDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO);
     public List<EntryDefectImproveInner> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO);
     public List<ExportExcelDTO> getDefectImproveInnerByExport(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO);
 }

+ 14 - 0
src/main/java/com/diagbot/vo/GetEntryDefectImproveDeptVO.java

@@ -56,5 +56,19 @@ public class GetEntryDefectImproveDeptVO extends Page {
 
     @NotNull(message = "请输入截止时间")
     private String endDate;
+    /**
+     * 0-不导出 1-导出
+     */
+    private Long exportType = 0L;
+
+    /**
+     * 排序(升序)
+     */
+    private String asc;
+
+    /**
+     * 排序(降序)
+     */
+    private String desc;
 
 }

+ 0 - 26
src/main/java/com/diagbot/web/DataAnalysisDeptController.java

@@ -38,32 +38,6 @@ public class DataAnalysisDeptController {
     @Autowired
     DataAnalysisDeptFacade dataAnalysisDeptFacade;
 
-    /**
-     * 临床质控使用统计(科室)
-     *
-     * @param getQcClickInnerPageVO
-     * @return
-     */
-    @ApiOperation(value = "临床质控使用统计(科室)[by:cy]")
-    @PostMapping("/getQcClickDept")
-    @SysLogger("getQcClickDept")
-    public RespDTO<List<GetQcClickDTO>> getQcClickDept(@RequestBody @Valid GetQcClickInnerPageVO getQcClickInnerPageVO) {
-        return RespDTO.onSuc(dataAnalysisFacade.getQcClickInnerPage(getQcClickInnerPageVO));
-    }
-
-    /**
-     * 临床质控使用统计(科室)-导出
-     *
-     * @param getQcClickInnerPageVO
-     * @return
-     */
-    @ApiOperation(value = "临床质控使用统计(科室)-导出[by:cy]")
-    @PostMapping("/getQcClickByDeptExport")
-    @SysLogger("getQcClickByDeptExport")
-    public void getQcClickByDeptExport(HttpServletResponse response, @RequestBody @Valid GetQcClickInnerPageVO getQcClickInnerPageVO) {
-         dataAnalysisFacade.getQcClickInnerPageByExport(response,getQcClickInnerPageVO);
-    }
-
 
     /**
      * 条目缺陷改善统计(科室)

+ 40 - 224
src/main/resources/mapper/MedClickInfoMapper.xml

@@ -77,6 +77,22 @@
     </resultMap>
 
 
+    <resultMap id="entryDefectImproveInnerExportMap" type="com.diagbot.dto.EntryDefectImproveInnerExport">
+        <result column="deptId" property="deptId"/>
+        <result column="deptName" property="deptName"/>
+        <collection property="entryDefectImproveInnerDoctors" ofType="com.diagbot.dto.EntryDefectImproveInnerDoctor">
+            <result column="doctorId" property="doctorId"/>
+            <result column="doctorName" property="doctorName"/>
+            <collection property="behospitalCodeInfos" ofType="com.diagbot.dto.BehospitalCodeInfo">
+                <result column="behospitalCode" property="behospitalCode"/>
+                    <collection property="qcResultDetailInfos" ofType="com.diagbot.dto.QcResultDetailInfo">
+                        <result column="CasesEntryIds" property="CasesEntryIds"/>
+                </collection>
+            </collection>
+        </collection>
+    </resultMap>
+
+
     <select id="getQcClick" resultType="com.diagbot.dto.GetQcClickDTO">
         SELECT
         a.dept_id AS deptId,
@@ -274,244 +290,44 @@
         AND n.is_deleted = 'N'
     </select>
 
-    <select id="getEntryDefectImproveDept" resultType="com.diagbot.dto.GetEntryDefectImproveDeptDTO">
+    <select id="getEntryDefectImproveDept" resultMap="entryDefectImproveInnerExportMap">
         SELECT
-        s.hospitalId,
-        s.deptId,
-        s.deptName,
-        s.doctorId,
-        s.doctorName,
-        s.casesId,
-        s.casesName,
-        s.entryName,
-        s.entryId,
-        sum(s.totalNum) AS totalNum,
-        sum(s.improveleNum) AS improveleNum,
-        sum(s.totalNum) - sum(s.improveleNum) AS handleNum,
-        concat(ROUND((sum(s.totalNum) - sum(s.improveleNum)) / sum(s.totalNum) * 100,2),'%') AS handleStr
-        FROM
-        (
-        SELECT
-        f.hospitalId,
-        f.deptId,
-        f.deptName,
-        f.doctorId,
-        f.doctorName,
-        f.behospitalCode,
-        f.casesId,
-        f.casesName,
-        f.casesEntryName as entryName,
-        f.beforeCasesEntryId as entryId,
-        count(f.beforeCasesEntryId) AS totalNum,
-        CASE
-        WHEN count(f.lastCasesEntryId) &gt; 0 AND count(f.beforeCasesEntryId) - count(f.lastCasesEntryId) &lt;= 0 THEN
-        count(f.beforeCasesEntryId)
-        WHEN count(f.lastCasesEntryId) &gt; 0 AND count(f.beforeCasesEntryId) - count(f.lastCasesEntryId) &gt; 0 THEN
-        count(f.beforeCasesEntryId) - count(f.lastCasesEntryId)
-        WHEN count(f.lastCasesEntryId) = 0 THEN 0
-        END AS improveleNum
-        FROM
-        (
-        SELECT
-        k.*, i. NAME AS casesName,
-        o. NAME AS casesEntryName,
-        y.cases_entry_id AS lastCasesEntryId
-        FROM
-        (
-        SELECT
-        e.hospital_id AS hospitalId,
-        e.dept_id AS deptId,
-        e.dept_name AS deptName,
-        e.doctor_id AS doctorId,
-        e.doctor_name AS doctorName,
-        e.behospital_code AS behospitalCode,
-        e.lastQcresultInfoId,
-        t.beforeQcresultInfoId,
-        u.cases_id AS casesId,
-        u.cases_entry_id AS beforeCasesEntryId
-        FROM
-        (
-        SELECT
-        h.hospital_id,
-        h.dept_id,
-        h.dept_name,
-        h.doctor_id,
-        h.doctor_name,
-        h.behospital_code,
-        h.lastQcresultInfoId
-        FROM
-        (
-        SELECT DISTINCT
-        w.hospital_id,
-        w.behospital_code
-        FROM
-        med_click_info w
-        WHERE
-        w.is_deleted = 'N'
-        <if test="hospitalId != null and hospitalId != ''">
-            AND w.hospital_id = #{hospitalId}
-        </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND w.gmt_create >= #{startDate}]]>
-        </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND w.gmt_create <= #{endDate}]]>
-        </if>
-        ) g
-        LEFT JOIN (
-        SELECT
-        q.hospital_id,
-        q.beh_dept_id AS dept_id,
-        q.beh_dept_name AS dept_name,
-        q.doctor_id,
-        q.doctor_name,
-        w.behospital_code,
-        max(w.qcresult_info_id) AS lastQcresultInfoId
-        FROM
-        med_behospital_info q,
-        med_click_info w
-        WHERE
-        q.is_deleted = 'N'
-        AND w.is_deleted = 'N'
-        AND q.hospital_id = w.hospital_id
-        AND q.behospital_code = w.behospital_code
-        AND q.qc_type_id != 0
-        <if test="hospitalId != null and hospitalId != ''">
-            AND q.hospital_id = #{hospitalId}
-        </if>
-        <if test="deptId != null and deptId != ''">
-            and q.beh_dept_id = #{deptId}
-        </if>
-        <if test="deptName != null and deptName != ''">
-            and q.beh_dept_name like CONCAT('%',#{deptName},'%')
-        </if>
-        <if test="doctorId != null and doctorId != ''">
-            and q.doctor_id =,#{doctorId}
-        </if>
-        <if test="doctorName != null and doctorName != ''">
-            and q.doctor_name like CONCAT('%',#{doctorName},'%')
-        </if>
-        GROUP BY
-        q.beh_dept_id,
-        q.beh_dept_name,
-        q.behospital_code
-        ) h ON g.hospital_id = h.hospital_id
-        AND g.behospital_code = h.behospital_code
-        ) e
-        LEFT JOIN (
-        SELECT
-        q.hospital_id,
-        q.beh_dept_id AS dept_id,
-        q.beh_dept_name AS dept_name,
-        w.behospital_code,
-        min(w.qcresult_info_id) AS beforeQcresultInfoId
+        a.hospital_id as hospitalId,
+        a.dept_id as deptId,
+        a.dept_name as deptName,
+        a.behospital_code as behospitalCode,
+        b.doctor_id AS doctorId,
+        b.doctor_name AS doctorName,
+        a.cases_entry_ids as casesEntryIds
         FROM
-        med_behospital_info q,
-        med_click_info w,
-        med_qcresult_detail e
+        med_qcresult_click a,
+        med_behospital_info b
         WHERE
-        q.is_deleted = 'N'
-        AND w.is_deleted = 'N'
-        AND e.is_deleted = 'Y'
-        AND q.hospital_id = w.hospital_id
-        AND q.hospital_id = e.hospital_id
-        AND q.behospital_code = w.behospital_code
-        AND w.qcresult_info_id =e.qcresult_info_id
-        AND q.qc_type_id != 0
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.hospital_id =b.hospital_id
+        AND a.behospital_code =b.behospital_code
         <if test="hospitalId != null and hospitalId != ''">
-            AND q.hospital_id = #{hospitalId}
+            AND a.hospital_id = #{hospitalId}
         </if>
         <if test="deptId != null and deptId != ''">
-            and q.beh_dept_id = #{deptId}
+            and a.dept_id = #{deptId}
         </if>
         <if test="deptName != null and deptName != ''">
-            and q.beh_dept_name like CONCAT('%',#{deptName},'%')
+            and a.dept_name = #{deptName}
         </if>
         <if test="doctorId != null and doctorId != ''">
-            and q.doctor_id =,#{doctorId}
+            and b.doctor_id = #{doctor_id}
         </if>
         <if test="doctorName != null and doctorName != ''">
-            and q.doctor_name like CONCAT('%',#{doctorName},'%')
-        </if>
-        GROUP BY
-        q.beh_dept_id,
-        q.beh_dept_name,
-        q.behospital_code
-        UNION
-        SELECT
-        q.hospital_id,
-        q.beh_dept_id AS dept_id,
-        q.beh_dept_name AS dept_name,
-        w.behospital_code,
-        min(w.qcresult_info_id) AS beforeQcresultInfoId
-        FROM
-        med_behospital_info q,
-        med_click_info w
-        WHERE
-        q.is_deleted = 'N'
-        AND w.is_deleted = 'N'
-        AND q.hospital_id = w.hospital_id
-        AND q.behospital_code = w.behospital_code
-        AND q.qc_type_id != 0
-        <if test="hospitalId != null and hospitalId != ''">
-            AND q.hospital_id = #{hospitalId}
-        </if>
-        <if test="deptId != null and deptId != ''">
-            and q.beh_dept_id = #{deptId}
+            and b.doctor_name like CONCAT('%',#{doctorName},'%')
         </if>
-        <if test="deptName != null and deptName != ''">
-            and q.beh_dept_name like CONCAT('%',#{deptName},'%')
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ AND a.gmt_create >= #{startDate}]]>
         </if>
-        <if test="doctorId != null and doctorId != ''">
-            and q.doctor_id =,#{doctorId}
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[ AND a.gmt_create <= #{endDate}]]>
         </if>
-        <if test="doctorName != null and doctorName != ''">
-            and q.doctor_name like CONCAT('%',#{doctorName},'%')
-        </if>
-        GROUP BY
-        q.beh_dept_id,
-        q.beh_dept_name,
-        q.behospital_code
-        HAVING
-        count(q.behospital_code) = 1
-        ) t ON e.hospital_id = t.hospital_id
-        AND e.behospital_code = t.behospital_code
-        LEFT JOIN med_qcresult_detail u ON t.hospital_id = u.hospital_id
-        AND t.beforeQcresultInfoId = u.qcresult_info_id
-        WHERE
-        u.grade_type = 1
-        ORDER BY
-        t.dept_name
-        ) k
-        LEFT JOIN med_qcresult_detail y ON k.hospitalId = y.hospital_id
-        AND k.lastQcresultInfoId = y.qcresult_info_id
-        AND k.beforeCasesEntryId = y.cases_entry_id
-        LEFT JOIN qc_cases i ON i.id = k.casesId
-        AND i.is_deleted = 'N'
-        LEFT JOIN qc_cases_entry o ON o.id = k.beforeCasesEntryId
-        AND o.is_deleted = 'N'
-        WHERE
-        (y.grade_type = 1 OR y.cases_entry_id IS NULL)
-        <if test="casesName != null and casesName != ''">
-            and i.name like CONCAT('%',#{casesName},'%')
-        </if>
-        <if test="entryName != null and entryName != ''">
-            and o.name like CONCAT('%',#{entryName},'%')
-        </if>
-        ) f
-        GROUP BY
-        f.deptId,
-        f.deptName,
-        f.behospitalCode,
-        f.casesId,
-        f.beforeCasesEntryId
-        ) s
-        GROUP BY
-        s.deptId,
-        s.deptName,
-        s.doctorId,
-        s.doctorName,
-        s.casesId,
-        s.entryId
+        order by a.gmt_create
     </select>
 </mapper>