Преглед изворни кода

Merge remote-tracking branch 'origin/dev/20200603_1.3.1' into debug

zhaops пре 5 година
родитељ
комит
240b66102f

+ 1 - 0
src/main/java/com/diagbot/dto/DeptEntryNumDTO.java

@@ -32,4 +32,5 @@ public class DeptEntryNumDTO {
     private String percentStr;
     private Double score;
     private Integer isReject;
+    private Integer ruleType;
 }

+ 1 - 0
src/main/java/com/diagbot/dto/EntryNumDTO.java

@@ -27,4 +27,5 @@ public class EntryNumDTO {
     private String percentStr;
     private Double score;
     private Integer isReject;
+    private Integer ruleType;
 }

+ 90 - 29
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -1,10 +1,10 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.CaseAndDeptNumDTO;
 import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.util.BeanUtil;
@@ -490,7 +490,7 @@ public class ConsoleByDeptFacade {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(FilterPageByDeptVO filterPageByDeptVO) {
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(FilterPageByDeptVO filterPageByDeptVO) {
         if (StringUtil.isBlank(filterPageByDeptVO.getDeptName())) {
             List<DeptBaseDTO> deptList = this.getDept();
             //默认取第一个科室
@@ -499,7 +499,7 @@ public class ConsoleByDeptFacade {
             }
         }
         filterPageByDeptVOSet(filterPageByDeptVO);
-        IPage<CaseAndDeptNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
+        IPage<DeptEntryNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
         return page;
     }
 
@@ -573,7 +573,7 @@ public class ConsoleByDeptFacade {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
         List<DeptBaseDTO> deptList = getDept();
         if (ListUtil.isEmpty(deptList)) {
             return null;
@@ -589,7 +589,11 @@ public class ConsoleByDeptFacade {
         filterOrderByDeptVO.setEndDate(endDate);
         filterOrderByDeptVO.setHospitalId(hosptialId);
         filterOrderByDeptVO.setUserId(Long.valueOf(userId));
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+        if (item != null) {
+            records.add(0, item);
+        }
         return records;
     }
 
@@ -599,8 +603,8 @@ public class ConsoleByDeptFacade {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelByDeptLimit(FilterOrderByDeptVO filterOrderByDeptVO) {
-        DecimalFormat df = new DecimalFormat("#0.00");
+    public List<HomePageNumDTO> homePageLevelByDeptLimit(FilterOrderByDeptVO filterOrderByDeptVO) {
+
         List<DeptBaseDTO> deptList = getDept();
         if (ListUtil.isEmpty(deptList)) {
             return null;
@@ -619,62 +623,119 @@ public class ConsoleByDeptFacade {
         if (filterOrderByDeptVO.getLimitCount() == null || filterOrderByDeptVO.getLimitCount().equals(0)) {
             filterOrderByDeptVO.setLimitCount(10);
         }
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
-        //增加全科室
-        LevelStatisticsDTO item = new LevelStatisticsDTO();
+        List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
+        HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+        if (item != null) {
+            records.add(0, item);
+        }
+
+        records = records
+                .stream()
+                .limit(filterOrderByDeptVO.getLimitCount())
+                .collect(Collectors.toList());
+
+        return records;
+    }
+
+    /**
+     * 获取某个科室全科室数据
+     *
+     * @param records
+     * @param deptName
+     * @return
+     */
+    public HomePageNumDTO getGlobleRecord(List<HomePageNumDTO> records, String deptName) {
+        DecimalFormat df = new DecimalFormat("#0.00");
+        HomePageNumDTO item = new HomePageNumDTO();
+        //总病历数
         Integer mrNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getMrNum)
+                .map(HomePageNumDTO::getMrNum)
                 .reduce(0, Integer::sum);
         if (mrNum == null || mrNum == 0) {
-            return Lists.newLinkedList();
+            return null;
         }
+        //总缺陷数
         Integer entryNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getEntryNum)
+                .map(HomePageNumDTO::getEntryNum)
                 .reduce(0, Integer::sum);
-        Double totleFee = records
+        //总分
+        Double totleValue = records
                 .stream()
                 .map(i -> BigDecimal.valueOf(i.getTotleValue()))
                 .reduce(BigDecimal.ZERO, BigDecimal::add)
                 .doubleValue();
-        Double averageFee = BigDecimal.valueOf(totleFee)
+        //平均分
+        Double averageValue = BigDecimal.valueOf(totleValue)
                 .divide(BigDecimal.valueOf(mrNum), 2, RoundingMode.HALF_UP)
                 .doubleValue();
+        //合格病历总数
         Integer firstLevelNum = records
                 .stream()
-                .map(LevelStatisticsDTO::getFirstLevelNum)
+                .map(HomePageNumDTO::getFirstLevelNum)
                 .reduce(0, Integer::sum);
+        //合格病历占比
         Double firstLevelPercent = BigDecimal.valueOf(firstLevelNum)
                 .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String firstLevelPercentStr
                 = df.format(BigDecimal.valueOf(firstLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
-        Integer secondLevelNum = mrNum - firstLevelNum;
+        //不合格病历数
+        Integer secondLevelNum = records
+                .stream()
+                .map(HomePageNumDTO::getSecondLevelNum)
+                .reduce(0, Integer::sum);
+        //不合格病历占比
         Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
                 .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String secondLevelPercentStr
                 = df.format(BigDecimal.valueOf(secondLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
-        item.setDoctorName(filterOrderByDeptVO.getDeptName());
+        //条目缺陷总数(模块下条目*病历数)
+        Integer entryTotleNum = records
+                .stream()
+                .map(HomePageNumDTO::getEntryTotleNum)
+                .reduce(0, Integer::sum);
+        //空项总数
+        Integer emptyNum = records
+                .stream()
+                .map(HomePageNumDTO::getEmptyNum)
+                .reduce(0, Integer::sum);
+        Double emptyPercent = BigDecimal.valueOf(emptyNum)
+                .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
+                .doubleValue();
+        String emptyPercentStr
+                = df.format(BigDecimal.valueOf(emptyPercent).multiply(BigDecimal.valueOf(100))) + "%";
+        //错误项总数
+        Integer errorNum = records
+                .stream()
+                .map(HomePageNumDTO::getErrorNum)
+                .reduce(0, Integer::sum);
+        Double errorPercent = BigDecimal.valueOf(errorNum)
+                .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
+                .doubleValue();
+        String errorPercentStr
+                = df.format(BigDecimal.valueOf(errorPercent).multiply(BigDecimal.valueOf(100))) + "%";
+
+        item.setDeptName(deptName);
         item.setEntryNum(entryNum);
         item.setMrNum(mrNum);
-        item.setTotleValue(totleFee);
-        item.setAverageValue(averageFee);
+        item.setTotleValue(totleValue);
+        item.setAverageValue(averageValue);
         item.setFirstLevelNum(firstLevelNum);
         item.setFirstLevelPercent(firstLevelPercent);
         item.setFirstLevelPercentStr(firstLevelPercentStr);
         item.setSecondLevelNum(secondLevelNum);
         item.setSecondLevelPercent(secondLevelPercent);
         item.setSecondLevelPercentStr(secondLevelPercentStr);
-
-        records.add(0, item);
-
-        records = records
-                .stream()
-                .limit(filterOrderByDeptVO.getLimitCount())
-                .collect(Collectors.toList());
-
-        return records;
+        item.setEntryTotleNum(entryTotleNum);
+        item.setEmptyNum(emptyNum);
+        item.setEmptyPercent(emptyPercent);
+        item.setEmptyPercentStr(emptyPercentStr);
+        item.setErrorNum(errorNum);
+        item.setErrorPercent(errorPercent);
+        item.setErrorPercentStr(errorPercentStr);
+        return item;
     }
 }

+ 2 - 3
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -5,7 +5,6 @@ import com.diagbot.aggregate.AverageStatisticsAggregate;
 import com.diagbot.aggregate.MrStatisticsAggregate;
 import com.diagbot.aggregate.ResultStatisticsAggregate;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseNumDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.EntryNumDTO;
 import com.diagbot.dto.HomePageNumDTO;
@@ -466,9 +465,9 @@ public class ConsoleFacade {
      * @param filterPageVO
      * @return
      */
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(FilterPageVO filterPageVO) {
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(FilterPageVO filterPageVO) {
         filterPageVOSet(filterPageVO);
-        IPage<CaseNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryPage(filterPageVO);
+        IPage<EntryNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryPage(filterPageVO);
         return page;
     }
 

+ 1 - 1
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -164,7 +164,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
 
     /**
      * 科室缺陷占比-科室(分页)

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

@@ -3,8 +3,6 @@ package com.diagbot.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseAndDeptNumDTO;
-import com.diagbot.dto.CaseNumDTO;
 import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.EntryNumDTO;
@@ -116,7 +114,7 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @param filterPageVO
      * @return
      */
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
     /**
      * 各科室质控平均分(分页)
@@ -148,7 +146,7 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 条目缺陷占比(内页)

+ 1 - 1
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -166,7 +166,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @param filterOrderByDeptVO
      * @return
      */
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO);
 
     /**
      * 缺陷明细-科室(分页)

+ 2 - 4
src/main/java/com/diagbot/service/QcresultInfoService.java

@@ -3,8 +3,6 @@ package com.diagbot.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseAndDeptNumDTO;
-import com.diagbot.dto.CaseNumDTO;
 import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.EntryNumDTO;
@@ -117,7 +115,7 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @param filterPageVO
      * @return
      */
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
     /**
      * 各科室质控平均分(分页)
@@ -149,7 +147,7 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @param filterPageByDeptVO
      * @return
      */
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
      * 条目缺陷占比(内页)

+ 1 - 1
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -222,7 +222,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @return
      */
     @Override
-    public List<LevelStatisticsDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
+    public List<HomePageNumDTO> homePageLevelStatisticsByDept(FilterOrderByDeptVO filterOrderByDeptVO) {
         return baseMapper.homePageLevelStatisticsByDept(filterOrderByDeptVO);
     }
 

+ 2 - 4
src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java

@@ -3,8 +3,6 @@ package com.diagbot.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseAndDeptNumDTO;
-import com.diagbot.dto.CaseNumDTO;
 import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.EntryNumDTO;
@@ -152,7 +150,7 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public IPage<CaseNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
+    public IPage<EntryNumDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO) {
         return baseMapper.entryCountGroupByEntryPage(filterPageVO);
     }
 
@@ -196,7 +194,7 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
      * @return
      */
     @Override
-    public IPage<CaseAndDeptNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
+    public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO) {
         return baseMapper.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
     }
 

+ 5 - 0
src/main/java/com/diagbot/vo/FilterPageVO.java

@@ -65,4 +65,9 @@ public class FilterPageVO extends Page {
      * 单项否决
      */
     private Integer isReject;
+
+    /**
+     * 规则类型(0:无,1:空项,2:错误)
+     */
+    private Integer ruleType;
 }

+ 8 - 6
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -2,10 +2,10 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.CaseAndDeptNumDTO;
 import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.dto.DeptEntryNumDTO;
 import com.diagbot.dto.DeptNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ConsoleByDeptFacade;
@@ -90,7 +90,7 @@ public class ConsoleByDeptController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelByDeptLimit")
     @SysLogger("homePageLevelByDeptLimit")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelByDeptLimit(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelByDeptLimit(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
         return RespDTO.onSuc(consoleByDeptFacade.homePageLevelByDeptLimit(filterOrderByDeptVO));
     }
     //endregion -----------------------首页接口结束------------------------------
@@ -121,11 +121,13 @@ public class ConsoleByDeptController {
                     "name: 缺陷名称<br>" +
                     "deptName: 科室名称(必填)<br>" +
                     "casesId: 模块id:243=病案首页 <br>" +
-                    "casesName: 模块名称<br>")
+                    "casesName: 模块名称<br>"+
+                    "isReject: 单项否决 1-否决,0-非<br>" +
+                    "ruleType: 规则类型 0:无,1:空项,2:错误<br>")
     @PostMapping("/entryCountGroupByEntryAndDeptPage")
     @SysLogger("entryCountGroupByEntryAndDeptPage")
-    public RespDTO<IPage<CaseAndDeptNumDTO>> entryCountGroupByEntryAndDeptPage(@RequestBody @Valid FilterPageByDeptVO filterPageByDeptVO) {
-        IPage<CaseAndDeptNumDTO> data = consoleByDeptFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
+    public RespDTO<IPage<DeptEntryNumDTO>> entryCountGroupByEntryAndDeptPage(@RequestBody @Valid FilterPageByDeptVO filterPageByDeptVO) {
+        IPage<DeptEntryNumDTO> data = consoleByDeptFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
         return RespDTO.onSuc(data);
     }
 
@@ -195,7 +197,7 @@ public class ConsoleByDeptController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelStatisticsByDept")
     @SysLogger("homePageLevelStatisticsByDept")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelStatisticsByDept(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelStatisticsByDept(@RequestBody @Valid FilterOrderByDeptVO filterOrderByDeptVO) {
         return RespDTO.onSuc(consoleByDeptFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO));
     }
 

+ 6 - 5
src/main/java/com/diagbot/web/ConsoleController.java

@@ -3,9 +3,9 @@ package com.diagbot.web;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.CaseNumDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.EntryNumDTO;
+import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.RespDTO;
@@ -275,10 +275,11 @@ public class ConsoleController {
                     "deptName: 科室名称 <br>" +
                     "casesId: 模块id:243=病案首页 <br>" +
                     "casesName: 模块名称 <br>" +
-                    "isReject: 单项否决 1-否决,0-非<br>")
+                    "isReject: 单项否决 1-否决,0-非<br>" +
+                    "ruleType: 规则类型 0:无,1:空项,2:错误<br>")
     @PostMapping("/entryCountGroupByEntryPage")
     @SysLogger("entryCountGroupByEntryPage")
-    public RespDTO<IPage<CaseNumDTO>> entryCountGroupByEntryPage(@RequestBody @Valid FilterPageVO filterPageVO) {
+    public RespDTO<IPage<EntryNumDTO>> entryCountGroupByEntryPage(@RequestBody @Valid FilterPageVO filterPageVO) {
         return RespDTO.onSuc(consoleFacade.entryCountGroupByEntryPage(filterPageVO));
     }
 
@@ -420,7 +421,7 @@ public class ConsoleController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelStatistics")
     @SysLogger("homePageLevelStatistics")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelStatistics(@RequestBody @Valid FilterOrderVO filterOrderVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelStatistics(@RequestBody @Valid FilterOrderVO filterOrderVO) {
         return RespDTO.onSuc(consoleFacade.homePageLevelStatistics(filterOrderVO));
     }
 
@@ -438,7 +439,7 @@ public class ConsoleController {
                     "desc: 排序(降序) <br>")
     @PostMapping("/homePageLevelLimit")
     @SysLogger("homePageLevelLimit")
-    public RespDTO<List<LevelStatisticsDTO>> homePageLevelLimit(@RequestBody @Valid FilterOrderVO filterOrderVO) {
+    public RespDTO<List<HomePageNumDTO>> homePageLevelLimit(@RequestBody @Valid FilterOrderVO filterOrderVO) {
         return RespDTO.onSuc(consoleFacade.homePageLevelLimit(filterOrderVO));
     }
 }

+ 109 - 20
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -1633,7 +1633,7 @@
 
     <!-- 病案首页合格率占比-科室 -->
     <select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO"
-            resultType="com.diagbot.dto.LevelStatisticsDTO">
+            resultType="com.diagbot.dto.HomePageNumDTO">
         SELECT
         t1.doctorId,
         t1.doctorName,
@@ -1646,29 +1646,32 @@
         t1.firstLevelPercent,
         t1.secondLevelPercent,
         t1.firstLevelPercentStr,
-        t1.secondLevelPercentStr
+        t1.secondLevelPercentStr,
+        t3.emptyNum,
+        t3.errorNum,
+        t3.entryTotleNum,
+        t3.emptyPercent,
+        t3.errorPercent,
+        t3.emptyPercentStr,
+        t3.errorPercentStr
         FROM
         (
         SELECT
         a.doctor_id AS doctorId,
         a.doctor_name AS doctorName,
-        count( DISTINCT c.id ) AS mrNum,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
-        ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
+        count( DISTINCT a.behospital_code ) AS mrNum,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
+        ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
         COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
         COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4
-        ) AS firstLevelPercent,
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ),
-        4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
         concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS firstLevelPercentStr,
         concat(
-        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )*
-        100, 2 ),
+        ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
         '%'
         ) AS secondLevelPercentStr
         FROM
@@ -1762,10 +1765,88 @@
         GROUP BY
         a.doctor_id,
         a.doctor_name
-        ) t2
+        ) t2,(
+        SELECT
+        h1.doctorId,
+        h1.doctorName,
+        h1.emptyNum,
+        h1.errorNum,
+        h1.mrNum,
+        h2.entryNum,
+        h1.mrNum * h2.entryNum AS entryTotleNum,
+        ROUND( h1.emptyNum / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
+        ROUND( h1.errorNum / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
+        CONCAT( ROUND( h1.emptyNum / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
+        CONCAT( ROUND( h1.errorNum /( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
+        FROM
+        (
+        SELECT
+        a.doctor_id AS doctorId,
+        a.doctor_name AS doctorName,
+        sum( d.rule_type = 1 ) AS emptyNum,
+        round( sum( d.rule_type = 2 )/ 2, 0 ) AS errorNum,
+        count( DISTINCT a.behospital_code ) AS mrNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_cases b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        sys_user_dept e
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.is_placefile = '1'
+        AND d.cases_id = 243
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and b.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.doctor_name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="userId!=null and userId !=''">
+            AND e.user_id = #{userId}
+        </if>
+        <if test="deptName!=null and deptName !=''">
+            AND a.beh_dept_name = #{deptName}
+        </if>
+        GROUP BY
+        a.doctor_id,
+        a.doctor_name
+        ) h1,(
+        SELECT
+        count(*) AS entryNum
+        FROM
+        qc_cases_entry
+        WHERE
+        is_deleted = 'N'
+        AND cases_id = 243
+        ) h2
+        ) t3
         WHERE
         t1.doctorId = t2.doctorId
+        AND t1.doctorId = t3.doctorId
         AND t1.doctorName = t2.doctorName
+        AND t1.doctorName = t3.doctorName
         <if test="asc != null and asc !=''">
             order by
             <choose>
@@ -1777,13 +1858,17 @@
                 <when test='asc=="averageValue"'>averageValue asc</when>
                 <when test='asc=="firstLevelNum"'>firstLevelNum asc</when>
                 <when test='asc=="secondLevelNum"'>secondLevelNum asc</when>
-                <when test='asc=="thirdLevelNum"'>thirdLevelNum asc</when>
                 <when test='asc=="firstLevelPercent"'>firstLevelPercent asc</when>
                 <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
-                <when test='asc=="thirdLevelPercent"'>thirdLevelPercent asc</when>
                 <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
                 <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
-                <when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
+                <when test='asc=="emptyNum"'>emptyNum asc</when>
+                <when test='asc=="errorNum"'>errorNum asc</when>
+                <when test='asc=="entryTotleNum"'>entryTotleNum asc</when>
+                <when test='asc=="emptyPercent"'>emptyPercent asc</when>
+                <when test='asc=="errorPercent"'>errorPercent asc</when>
+                <when test='asc=="emptyPercentStr"'>emptyPercent asc</when>
+                <when test='asc=="errorPercentStr"'>errorPercent asc</when>
                 <otherwise>doctorName asc</otherwise>
             </choose>
         </if>
@@ -1798,13 +1883,17 @@
                 <when test='desc=="averageValue"'>averageValue desc</when>
                 <when test='desc=="firstLevelNum"'>firstLevelNum desc</when>
                 <when test='desc=="secondLevelNum"'>secondLevelNum desc</when>
-                <when test='desc=="thirdLevelNum"'>thirdLevelNum desc</when>
                 <when test='desc=="firstLevelPercent"'>firstLevelPercent desc</when>
                 <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
-                <when test='desc=="thirdLevelPercent"'>thirdLevelPercent desc</when>
                 <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
                 <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
-                <when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
+                <when test='desc=="emptyNum"'>emptyNum desc</when>
+                <when test='desc=="errorNum"'>errorNum desc</when>
+                <when test='desc=="entryTotleNum"'>entryTotleNum desc</when>
+                <when test='desc=="emptyPercent"'>emptyPercent desc</when>
+                <when test='desc=="errorPercent"'>errorPercent desc</when>
+                <when test='desc=="emptyPercentStr"'>emptyPercent desc</when>
+                <when test='desc=="errorPercentStr"'>errorPercent desc</when>
                 <otherwise>doctorName desc</otherwise>
             </choose>
         </if>

+ 55 - 7
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -975,7 +975,7 @@
     </select>
 
     <!-- 缺陷详情(分页) -->
-    <select id="entryCountGroupByEntryPage"  resultType="com.diagbot.dto.CaseNumDTO">
+    <select id="entryCountGroupByEntryPage"  resultType="com.diagbot.dto.EntryNumDTO">
         SELECT t.*
         FROM
         (SELECT
@@ -983,6 +983,8 @@
         t1.NAME,
         t1.casesId,
         t1.casesName,
+        t1.ruleType,
+        t1.isReject,
         count(*) AS num,
         t2.totleNum,
         ROUND( count(*) /t2.totleNum , 4 ) AS percent,
@@ -993,7 +995,9 @@
         e.id AS id,
         e.NAME AS NAME,
         e.cases_id as casesId,
-        e.cases_name as casesName
+        e.cases_name as casesName,
+        e.rule_type as ruleType,
+        f.is_reject as isReject
         FROM
         med_behospital_info a,
         <if test="filterPageVO.casesId != null and filterPageVO.casesId ==243">
@@ -1003,14 +1007,17 @@
             med_qcresult_info c,
         </if>
         med_qcresult_detail d,
-        qc_cases_entry e
+        qc_cases_entry e,
+        qc_cases_entry_hospital f
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         and e.is_deleted='N'
+        and f.is_deleted='N'
         AND a.hospital_id = c.hospital_id
         and a.hospital_id = d.hospital_id
+        and a.hospital_id = f.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -1019,6 +1026,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        and e.id = f.cases_entry_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
             AND d.cases_id = #{filterPageVO.casesId}
@@ -1041,6 +1049,12 @@
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
         </if>
+        <if test="filterPageVO.ruleType != null">
+            AND e.rule_type = #{filterPageVO.ruleType}
+        </if>
+        <if test="filterPageVO.isReject != null">
+            AND f.is_reject = #{filterPageVO.isReject}
+        </if>
         ) t1,(
         SELECT
         count(*) AS totleNum
@@ -1053,14 +1067,17 @@
             med_qcresult_info c,
         </if>
         med_qcresult_detail d,
-        qc_cases_entry e
+        qc_cases_entry e,
+        qc_cases_entry_hospital f
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         and e.is_deleted='N'
+        and f.is_deleted='N'
         AND a.hospital_id = c.hospital_id
         and a.hospital_id = d.hospital_id
+        and a.hospital_id = f.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -1069,6 +1086,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        and e.id = f.cases_entry_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
             AND d.cases_id = #{filterPageVO.casesId}
@@ -1091,6 +1109,12 @@
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
         </if>
+        <if test="filterPageVO.ruleType != null">
+            AND e.rule_type = #{filterPageVO.ruleType}
+        </if>
+        <if test="filterPageVO.isReject != null">
+            AND f.is_reject = #{filterPageVO.isReject}
+        </if>
         ) t2
         GROUP BY
         t1.id,
@@ -1324,7 +1348,7 @@
     </select>
 
     <!-- 缺陷详情-科室(分页) -->
-    <select id="entryCountGroupByEntryAndDeptPage"  resultType="com.diagbot.dto.CaseAndDeptNumDTO">
+    <select id="entryCountGroupByEntryAndDeptPage"  resultType="com.diagbot.dto.DeptEntryNumDTO">
         SELECT
         t.*
         FROM
@@ -1334,6 +1358,8 @@
         t1.NAME,
         t1.casesId,
         t1.casesName,
+        t1.ruleType,
+        t1.isReject,
         t1.deptId,
         t1.deptName,
         count(*) AS num,
@@ -1347,6 +1373,8 @@
         e.NAME,
         e.cases_id as casesId,
         e.cases_name as casesName,
+        e.rule_type as ruleType,
+        g.is_reject as isReject,
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName
         FROM
@@ -1359,16 +1387,19 @@
         </if>
         med_qcresult_detail d,
         qc_cases_entry e,
-        sys_user_dept f
+        sys_user_dept f,
+        qc_cases_entry_hospital g
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
         AND f.is_deleted = 'N'
+        AND g.is_deleted = 'N'
         AND a.hospital_id = c.hospital_id
         AND a.hospital_id = d.hospital_id
         AND a.hospital_id = f.hospital_id
+        AND a.hospital_id = g.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -1377,6 +1408,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        AND g.cases_entry_id = e.id
         AND a.beh_dept_id = f.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
@@ -1406,6 +1438,12 @@
         <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
             AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
         </if>
+        <if test="filterPageByDeptVO.ruleType != null ">
+            AND e.rule_type = #{filterPageByDeptVO.ruleType}
+        </if>
+        <if test="filterPageByDeptVO.isReject != null ">
+            AND g.is_reject = #{filterPageByDeptVO.isReject}
+        </if>
         ) t1,(
         SELECT
         count(*) AS totleNum
@@ -1419,16 +1457,19 @@
         </if>
         med_qcresult_detail d,
         qc_cases_entry e,
-        sys_user_dept f
+        sys_user_dept f,
+        qc_cases_entry_hospital g
         WHERE
         a.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
         AND e.is_deleted = 'N'
         AND f.is_deleted = 'N'
+        AND g.is_deleted = 'N'
         AND a.hospital_id = c.hospital_id
         AND a.hospital_id = d.hospital_id
         AND a.hospital_id = f.hospital_id
+        AND a.hospital_id = g.hospital_id
         AND a.behospital_code = c.behospital_code
         AND a.behospital_code = d.behospital_code
         AND a.is_placefile = '1'
@@ -1437,6 +1478,7 @@
         </if>
         AND d.cases_id = e.cases_id
         AND d.cases_entry_id = e.id
+        AND g.cases_entry_id = e.id
         AND a.beh_dept_id = f.dept_id
         <![CDATA[AND a.qc_type_id <>0 ]]>
         <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
@@ -1466,6 +1508,12 @@
         <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
         AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
         </if>
+        <if test="filterPageByDeptVO.ruleType != null ">
+            AND e.rule_type = #{filterPageByDeptVO.ruleType}
+        </if>
+        <if test="filterPageByDeptVO.isReject != null">
+            AND g.is_reject = #{filterPageByDeptVO.isReject}
+        </if>
         ) t2
         GROUP BY
         t1.id,