Przeglądaj źródła

Merge remote-tracking branch 'origin/dev/20200426_2nd' into dev/20200426_2nd

zhoutg 5 lat temu
rodzic
commit
e4eaaf3f8d

+ 3 - 0
src/main/java/com/diagbot/aggregate/ResultStatisticsAggregate.java

@@ -80,6 +80,7 @@ public class ResultStatisticsAggregate {
         if (ListUtil.isEmpty(qcEntryNumList)) {
             standardEntryNumList.forEach(entryNum -> {
                 Integer totleNum = entryNum.getNum() * mrNum;
+                entryNum.setNum(0);
                 entryNum.setPercent(0d);
                 entryNum.setPercentStr("0%");
                 entryNum.setTotleNum(totleNum);
@@ -91,6 +92,7 @@ public class ResultStatisticsAggregate {
                 standardEntryNumList.forEach(entryNum -> {
                     Integer totleNum = entryNum.getNum() * mrNum;
                     if (qcEntryNumMap.containsKey(entryNum.getId())) {
+                        entryNum.setNum(qcEntryNumMap.get(entryNum.getId()));
                         Double percent = BigDecimal.valueOf(entryNum.getNum())
                                 .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
                                 .doubleValue();
@@ -101,6 +103,7 @@ public class ResultStatisticsAggregate {
                         entryNum.setPercent(percent);
                         entryNum.setPercentStr(percentStr);
                     } else {
+                        entryNum.setNum(0);
                         entryNum.setPercent(0d);
                         entryNum.setPercentStr("0%");
                         entryNum.setTotleNum(totleNum);

+ 16 - 0
src/main/java/com/diagbot/dto/DeptBaseDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/8 19:11
+ */
+@Getter
+@Setter
+public class DeptBaseDTO {
+    private String deptId;
+    private String deptName;
+}

+ 16 - 0
src/main/java/com/diagbot/dto/DeptNumDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/8 20:02
+ */
+@Getter
+@Setter
+public class DeptNumDTO extends NumDTO {
+    private String deptId;
+    private String deptName;
+}

+ 1 - 1
src/main/java/com/diagbot/dto/NumDTO.java

@@ -11,7 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class NumDTO {
-    private Long id;
+    private String id;
     private String name;
     private Integer totleNum;
     private Integer num;

+ 35 - 0
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -0,0 +1,35 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.DeptBaseDTO;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.FilterByDeptVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:主任医生相关首页
+ * @Author:zhaops
+ * @time: 2020/5/8 17:05
+ */
+@Component
+public class ConsoleByDeptFacade {
+    @Autowired
+    private BehospitalInfoFacade behospitalInfoFacade;
+    @Autowired
+    private QcresultInfoFacade qcresultInfoFacade;
+    @Autowired
+    private BasDeptInfoFacade basDeptInfoFacade;
+
+    public Map<String, Object> getDeptByUser(FilterByDeptVO filterByDeptVO) {
+        List<DeptBaseDTO> deptList = basDeptInfoFacade.getDeptByUser(filterByDeptVO);
+        if (ListUtil.isNotEmpty(deptList)) {
+            return EntityUtil.makeMapWithKeyValue(deptList, "deptName", "deptId");
+        } else {
+            return null;
+        }
+    }
+}

+ 177 - 0
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -1,7 +1,14 @@
 package com.diagbot.facade;
 
+import com.diagbot.aggregate.AverageStatisticsAggregate;
+import com.diagbot.aggregate.MrStatisticsAggregate;
+import com.diagbot.aggregate.ResultStatisticsAggregate;
+import com.diagbot.dto.AverageStatisticsDTO;
+import com.diagbot.dto.NumDTO;
+import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.FilterVO;
 import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
@@ -10,6 +17,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -24,6 +32,15 @@ public class ConsoleFacade {
     @Autowired
     private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
 
+    @Autowired
+    private AverageStatisticsAggregate averageStatisticsAggregate;
+    @Autowired
+    private MrStatisticsAggregate mrStatisticsAggregate;
+    @Autowired
+    private ResultStatisticsAggregate resultStatisticsAggregate;
+
+    //-----------------------聚合接口开始-------------------------------
+
     /**
      * 病历相关统计
      *
@@ -107,4 +124,164 @@ public class ConsoleFacade {
         }
         return retMap;
     }
+
+    //-----------------------聚合接口结束-------------------------------
+
+    //-----------------------单独接口开始-------------------------------
+    /**
+     * 平均住院天数
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> getAverageDayNum(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<AverageStatisticsDTO> averageDayNumList = averageStatisticsAggregate.getAverageDayNum(filterVO);
+        if (ListUtil.isNotEmpty(averageDayNumList)) {
+            retMap.put("平均住院日", averageDayNumList);
+        }
+        return retMap;
+    }
+
+    /**
+     * 平均住院费用
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> getAverageFee(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<AverageStatisticsDTO> averageFeeList = averageStatisticsAggregate.getAverageFee(filterVO);
+        if (ListUtil.isNotEmpty(averageFeeList)) {
+            retMap.put("平均住院费用", averageFeeList);
+        }
+        return retMap;
+    }
+
+    /**
+     * 质控平均分按科室统计
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> getAverageScore(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<AverageStatisticsDTO> averageScoreList = averageStatisticsAggregate.getAverageScore(filterVO);
+        if (ListUtil.isNotEmpty(averageScoreList)) {
+            retMap.put("各科室质控平均分", averageScoreList);
+        }
+        return retMap;
+    }
+
+    /**
+     * 各科室甲级病历占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> getLevelResultDept(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<QcResultPercentDTO> levelResults = mrStatisticsAggregate.getLevelResultDept(filterVO);
+        if (ListUtil.isNotEmpty(levelResults)) {
+            retMap.put("各科室甲级病历占比", levelResults);
+        }
+        return retMap;
+    }
+
+    /**
+     * 出院人数统计
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> leaveHosCount(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        Map<String, Object> leaveHosMap = mrStatisticsAggregate.leaveHosCount(filterVO);
+        if (leaveHosMap != null) {
+            retMap.put("出院人数统计", leaveHosMap);
+        }
+        return retMap;
+    }
+
+    /**
+     * 质控病历统计
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> mrCount(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<NumDTO> mrCountList = mrStatisticsAggregate.mrCount(filterVO);
+        if (ListUtil.isNotEmpty(mrCountList)) {
+            retMap.put("病历数统计", mrCountList);
+        }
+        return retMap;
+    }
+
+    /**
+     * 各模块缺陷占比排行
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> entryCountGroupByCase(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<NumDTO> deptList = resultStatisticsAggregate.entryCountGroupByCase(filterVO);
+        if (ListUtil.isNotEmpty(deptList)) {
+            retMap.put("各科室缺陷占比", deptList);
+        }
+        return retMap;
+    }
+
+    /**
+     * 条目缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> entryCountGroupByEntry(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<NumDTO> caseList = resultStatisticsAggregate.entryCountGroupByEntry(filterVO);
+        if (ListUtil.isNotEmpty(caseList)) {
+            retMap.put("各模块缺陷占比排行", caseList);
+        }
+        return retMap;
+    }
+
+    /**
+     * 各科室缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> entryByDept(FilterVO filterVO) {
+        Map<String, Object> retMap = new HashMap<>();
+        filterVOSet(filterVO);
+        List<NumDTO> entryList = resultStatisticsAggregate.entryByDept(filterVO);
+        if (ListUtil.isNotEmpty(entryList)) {
+            retMap.put("条目缺陷占比", entryList);
+        }
+        return retMap;
+    }
+
+    private void filterVOSet(FilterVO filterVO){
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String startDate = filterFacade.getStartDateStr(filterVO.getType(), null);
+        String endDate = filterFacade.getEndDateStr(filterVO.getType(), null);
+        filterVO.setStartDate(startDate);
+        filterVO.setEndDate(endDate);
+        filterVO.setHospitalId(hospitalId);
+        if (filterVO.getLimitCount() == null || filterVO.getLimitCount().equals(0)) {
+            filterVO.setLimitCount(10);
+        }
+    }
+    //-----------------------单独接口结束-------------------------------
 }

+ 10 - 0
src/main/java/com/diagbot/mapper/BasDeptInfoMapper.java

@@ -2,8 +2,10 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.BasDeptInfoDTO;
+import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.entity.BasDeptInfo;
 import com.diagbot.vo.BasDeptInfoVO;
+import com.diagbot.vo.FilterByDeptVO;
 
 import java.util.List;
 
@@ -19,4 +21,12 @@ public interface BasDeptInfoMapper extends BaseMapper<BasDeptInfo> {
     List<BasDeptInfoDTO> getList(BasDeptInfoVO basDeptInfoVO);
 
     List<BasDeptInfoDTO> getListUser(BasDeptInfoVO basDeptInfoVO);
+
+    /**
+     * 查询用户关联科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    List<DeptBaseDTO> getDeptByUser(FilterByDeptVO filterByDeptVO);
 }

+ 18 - 0
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -8,7 +8,9 @@ import com.diagbot.dto.NumDTO;
 import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.BehospitalPageVO;
+import com.diagbot.vo.FilterByDeptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.HPFilterByDeptVO;
 import com.diagbot.vo.HomePageFilterVO;
 
 import java.util.List;
@@ -89,4 +91,20 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @return
      */
     public int homePageCountForOperation(FilterVO filterVO);
+
+    /**
+     * 按科室统计病案首页病历数
+     *
+     * @param hpFilterByDeptVO
+     * @return
+     */
+    public List<NumDTO> homePageCountByDept(HPFilterByDeptVO hpFilterByDeptVO);
+
+    /**
+     * 按科室统计病案首页手术病历数
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    public List<NumDTO> homePageCountForOperationByDept(FilterByDeptVO filterByDeptVO);
 }

+ 27 - 0
src/main/java/com/diagbot/mapper/QcresultInfoMapper.java

@@ -2,10 +2,13 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.AverageStatisticsDTO;
+import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.entity.QcresultInfo;
+import com.diagbot.vo.FilterByDeptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.QcresultFilterByDeptVO;
 import com.diagbot.vo.QcresultFilterVO;
 
 import java.util.List;
@@ -68,4 +71,28 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @return
      */
     public List<AverageStatisticsDTO> getAverageScoreByDept(FilterVO filterVO);
+
+    /**
+     * 按科室统计质控病历数
+     *
+     * @param qcresultFilterByDeptVO
+     * @return
+     */
+    public List<NumDTO> resultCountByDept(QcresultFilterByDeptVO qcresultFilterByDeptVO);
+
+    /**
+     * 各模块缺陷占比-按科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    public List<DeptNumDTO> entryCountGroupByCaseAndDept(FilterByDeptVO filterByDeptVO);
+
+    /**
+     * 条目缺陷占比-按科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    public List<DeptNumDTO> entryCountGroupByEntryAndDept(FilterByDeptVO filterByDeptVO);
 }

+ 10 - 0
src/main/java/com/diagbot/service/BasDeptInfoService.java

@@ -1,9 +1,11 @@
 package com.diagbot.service;
 
 import com.diagbot.dto.BasDeptInfoDTO;
+import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.entity.BasDeptInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.vo.BasDeptInfoVO;
+import com.diagbot.vo.FilterByDeptVO;
 
 import java.util.List;
 
@@ -19,4 +21,12 @@ public interface BasDeptInfoService extends IService<BasDeptInfo> {
     List<BasDeptInfoDTO> getList(BasDeptInfoVO basDeptInfoVO);
 
     List<BasDeptInfoDTO> getListUser(BasDeptInfoVO basDeptInfoVO);
+
+    /**
+     * 查询用户关联科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    List<DeptBaseDTO> getDeptByUser(FilterByDeptVO filterByDeptVO);
 }

+ 18 - 0
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -8,7 +8,9 @@ import com.diagbot.dto.NumDTO;
 import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.BehospitalPageVO;
+import com.diagbot.vo.FilterByDeptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.HPFilterByDeptVO;
 import com.diagbot.vo.HomePageFilterVO;
 
 import java.util.List;
@@ -89,4 +91,20 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @return
      */
     public int homePageCountForOperation(FilterVO filterVO);
+
+    /**
+     * 按科室统计病案首页病历数
+     *
+     * @param hpFilterByDeptVO
+     * @return
+     */
+    public List<NumDTO> homePageCountByDept(HPFilterByDeptVO hpFilterByDeptVO);
+
+    /**
+     * 按科室统计病案首页手术病历数
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    public List<NumDTO> homePageCountForOperationByDept(FilterByDeptVO filterByDeptVO);
 }

+ 27 - 0
src/main/java/com/diagbot/service/QcresultInfoService.java

@@ -2,10 +2,13 @@ package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.AverageStatisticsDTO;
+import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.entity.QcresultInfo;
+import com.diagbot.vo.FilterByDeptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.QcresultFilterByDeptVO;
 import com.diagbot.vo.QcresultFilterVO;
 
 import java.util.List;
@@ -69,4 +72,28 @@ public interface QcresultInfoService extends IService<QcresultInfo> {
      * @return
      */
     public List<AverageStatisticsDTO> getAverageScoreByDept(FilterVO filterVO);
+
+    /**
+     * 按科室统计质控病历数
+     *
+     * @param qcresultFilterByDeptVO
+     * @return
+     */
+    public List<NumDTO> resultCountByDept(QcresultFilterByDeptVO qcresultFilterByDeptVO);
+
+    /**
+     * 各模块缺陷占比-按科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    public List<DeptNumDTO> entryCountGroupByCaseAndDept(FilterByDeptVO filterByDeptVO);
+
+    /**
+     * 条目缺陷占比-按科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    public List<DeptNumDTO> entryCountGroupByEntryAndDept(FilterByDeptVO filterByDeptVO);
 }

+ 16 - 3
src/main/java/com/diagbot/service/impl/BasDeptInfoServiceImpl.java

@@ -1,11 +1,13 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.BasDeptInfoDTO;
+import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.entity.BasDeptInfo;
 import com.diagbot.mapper.BasDeptInfoMapper;
 import com.diagbot.service.BasDeptInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.vo.BasDeptInfoVO;
+import com.diagbot.vo.FilterByDeptVO;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -22,12 +24,23 @@ import java.util.List;
 public class BasDeptInfoServiceImpl extends ServiceImpl<BasDeptInfoMapper, BasDeptInfo> implements BasDeptInfoService {
 
     @Override
-    public List<BasDeptInfoDTO> getList(BasDeptInfoVO basDeptInfoVO){
+    public List<BasDeptInfoDTO> getList(BasDeptInfoVO basDeptInfoVO) {
         return baseMapper.getList(basDeptInfoVO);
     }
 
     @Override
-    public List<BasDeptInfoDTO> getListUser(BasDeptInfoVO basDeptInfoVO){
+    public List<BasDeptInfoDTO> getListUser(BasDeptInfoVO basDeptInfoVO) {
         return baseMapper.getListUser(basDeptInfoVO);
     }
+
+    /**
+     * 查询用户关联科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    @Override
+    public List<DeptBaseDTO> getDeptByUser(FilterByDeptVO filterByDeptVO) {
+        return baseMapper.getDeptByUser(filterByDeptVO);
+    }
 }

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

@@ -10,7 +10,9 @@ import com.diagbot.mapper.BehospitalInfoMapper;
 import com.diagbot.service.BehospitalInfoService;
 import com.diagbot.vo.AnalyzeVO;
 import com.diagbot.vo.BehospitalPageVO;
+import com.diagbot.vo.FilterByDeptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.HPFilterByDeptVO;
 import com.diagbot.vo.HomePageFilterVO;
 import org.springframework.stereotype.Service;
 
@@ -128,4 +130,26 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     public int homePageCountForOperation(FilterVO filterVO) {
         return baseMapper.homePageCountForOperation(filterVO);
     }
+
+    /**
+     * 按科室统计病案首页病历数
+     *
+     * @param hpFilterByDeptVO
+     * @return
+     */
+    @Override
+    public List<NumDTO> homePageCountByDept(HPFilterByDeptVO hpFilterByDeptVO) {
+        return baseMapper.homePageCountByDept(hpFilterByDeptVO);
+    }
+
+    /**
+     * 按科室统计病案首页手术病历数
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    @Override
+    public List<NumDTO> homePageCountForOperationByDept(FilterByDeptVO filterByDeptVO) {
+        return baseMapper.homePageCountForOperationByDept(filterByDeptVO);
+    }
 }

+ 36 - 0
src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java

@@ -2,12 +2,15 @@ package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.AverageStatisticsDTO;
+import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.entity.QcresultInfo;
 import com.diagbot.mapper.QcresultInfoMapper;
 import com.diagbot.service.QcresultInfoService;
+import com.diagbot.vo.FilterByDeptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.QcresultFilterByDeptVO;
 import com.diagbot.vo.QcresultFilterVO;
 import org.springframework.stereotype.Service;
 
@@ -91,4 +94,37 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
     public List<AverageStatisticsDTO> getAverageScoreByDept(FilterVO filterVO) {
         return baseMapper.getAverageScoreByDept(filterVO);
     }
+
+    /**
+     * 按科室统计质控病历数
+     *
+     * @param qcresultFilterByDeptVO
+     * @return
+     */
+    @Override
+    public List<NumDTO> resultCountByDept(QcresultFilterByDeptVO qcresultFilterByDeptVO) {
+        return baseMapper.resultCountByDept(qcresultFilterByDeptVO);
+    }
+
+    /**
+     * 各模块缺陷占比-按科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    @Override
+    public List<DeptNumDTO> entryCountGroupByCaseAndDept(FilterByDeptVO filterByDeptVO) {
+        return baseMapper.entryCountGroupByCaseAndDept(filterByDeptVO);
+    }
+
+    /**
+     * 条目缺陷占比-按科室
+     *
+     * @param filterByDeptVO
+     * @return
+     */
+    @Override
+    public List<DeptNumDTO> entryCountGroupByEntryAndDept(FilterByDeptVO filterByDeptVO) {
+        return baseMapper.entryCountGroupByEntryAndDept(filterByDeptVO);
+    }
 }

+ 15 - 0
src/main/java/com/diagbot/vo/FilterByDeptVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:主任医生过滤
+ * @Author:zhaops
+ * @time: 2020/5/8 17:02
+ */
+@Getter
+@Setter
+public class FilterByDeptVO extends FilterVO {
+    private Long userId;
+}

+ 18 - 0
src/main/java/com/diagbot/vo/HPFilterByDeptVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/8 19:27
+ */
+@Getter
+@Setter
+public class HPFilterByDeptVO extends FilterByDeptVO {
+    /**
+     * 死亡
+     */
+    private Integer death;
+}

+ 23 - 0
src/main/java/com/diagbot/vo/QcresultFilterByDeptVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/5/8 19:50
+ */
+@Getter
+@Setter
+public class QcresultFilterByDeptVO {
+    /**
+     * 等级
+     */
+    private String level;
+
+    /**
+     * 评分类型
+     */
+    private Integer gradeType;
+}

+ 135 - 0
src/main/java/com/diagbot/web/ConsoleController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.Map;
 
@@ -28,10 +29,12 @@ public class ConsoleController {
     @Autowired
     private ConsoleFacade consoleFacade;
 
+    //-----------------------聚合接口开始-------------------------------
     @ApiOperation(value = "病历相关统计[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
     @PostMapping("/mrStatistics")
     @SysLogger("mrStatistics")
+    @ApiIgnore
     public RespDTO<Map<String, Object>> mrStatistics(@RequestBody FilterVO filterVO) {
         Map<String, Object> data = consoleFacade.mrStatistics(filterVO);
         return RespDTO.onSuc(data);
@@ -41,6 +44,7 @@ public class ConsoleController {
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
     @PostMapping("/resultStatistics")
     @SysLogger("resultStatistics")
+    @ApiIgnore
     public RespDTO<Map<String, Object>> resultStatistics(@RequestBody FilterVO filterVO) {
         Map<String, Object> data = consoleFacade.resultStatistics(filterVO);
         return RespDTO.onSuc(data);
@@ -50,8 +54,139 @@ public class ConsoleController {
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
     @PostMapping("/averageStatistics")
     @SysLogger("averageStatistics")
+    @ApiIgnore
     public RespDTO<Map<String, Object>> averageStatistics(@RequestBody FilterVO filterVO) {
         Map<String, Object> data = consoleFacade.averageStatistics(filterVO);
         return RespDTO.onSuc(data);
     }
+    //-----------------------聚合接口结束-------------------------------
+
+    //-----------------------单独接口开始-------------------------------
+
+    /**
+     * 平均住院天数
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "平均住院天数[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/getAverageDayNum")
+    @SysLogger("getAverageDayNum")
+    public RespDTO<Map<String, Object>> getAverageDayNum(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.getAverageDayNum(filterVO));
+    }
+
+    /**
+     * 平均住院费用
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "平均住院费用[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/getAverageFee")
+    @SysLogger("getAverageFee")
+    public RespDTO<Map<String, Object>> getAverageFee(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.getAverageFee(filterVO));
+    }
+
+    /**
+     * 质控平均分按科室统计
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "质控平均分按科室统计[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/getAverageScore")
+    @SysLogger("getAverageScore")
+    public RespDTO<Map<String, Object>> getAverageScore(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.getAverageScore(filterVO));
+    }
+
+    /**
+     * 各科室甲级病历占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "各科室甲级病历占比[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/getLevelResultDept")
+    @SysLogger("getLevelResultDept")
+    public RespDTO<Map<String, Object>> getLevelResultDept(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.getLevelResultDept(filterVO));
+    }
+
+    /**
+     * 出院人数统计
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "出院人数统计[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/leaveHosCount")
+    @SysLogger("leaveHosCount")
+    public RespDTO<Map<String, Object>> leaveHosCount(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.leaveHosCount(filterVO));
+    }
+
+    /**
+     * 质控病历统计
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "质控病历统计[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/mrCount")
+    @SysLogger("mrCount")
+    public RespDTO<Map<String, Object>> mrCount(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.mrCount(filterVO));
+    }
+
+    /**
+     * 各模块缺陷占比排行
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "各模块缺陷占比排行[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/entryCountGroupByCase")
+    @SysLogger("entryCountGroupByCase")
+    public RespDTO<Map<String, Object>> entryCountGroupByCase(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.entryCountGroupByCase(filterVO));
+    }
+
+    /**
+     * 条目缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "条目缺陷占比[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/entryCountGroupByEntry")
+    @SysLogger("entryCountGroupByEntry")
+    public RespDTO<Map<String, Object>> entryCountGroupByEntry(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.entryCountGroupByEntry(filterVO));
+    }
+
+    /**
+     * 各科室缺陷占比
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "各科室缺陷占比[by:zhaops]",
+            notes = "type: 统计维度 1-本月,2-本年(必填)<br>")
+    @PostMapping("/entryByDept")
+    @SysLogger("entryByDept")
+    public RespDTO<Map<String, Object>> entryByDept(@RequestBody FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.entryByDept(filterVO));
+    }
+    //-----------------------单独接口结束-------------------------------
 }

+ 21 - 0
src/main/resources/mapper/BasDeptInfoMapper.xml

@@ -55,4 +55,25 @@
         </if>
         ORDER BY t.dept_name ASC
     </select>
+
+    <!-- 查询用户关联科室 -->
+    <select id="getDeptByUser" parameterType="com.diagbot.vo.FilterByDeptVO" resultType="com.diagbot.dto.DeptBaseDTO">
+        SELECT
+        b.dept_id as deptId,
+        b.dept_name as deptName
+        FROM
+        sys_user_dept a,
+        bas_dept_info b
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.dept_id = b.dept_id
+        <if test="userId!=null">
+            AND a.user_id = #{userId}
+        </if>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+    </select>
 </mapper>

+ 77 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -538,4 +538,81 @@
             <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
         </if>
     </select>
+
+    <!-- 按科室统计病案首页病历数 -->
+    <select id="homePageCountByDept" parameterType="com.diagbot.vo.HPFilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
+        SELECT
+        a.beh_dept_id AS id,
+        a.beh_dept_name AS NAME,
+        COUNT(*) AS num
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        sys_user_dept c
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.beh_dept_id = c.dept_id
+        <if test="death!=null and death==1">
+            AND b.leave_hospital_type = '死亡'
+        </if>
+        <if test="userId!=null">
+            AND c.user_id = #{userId}
+        </if>
+        <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>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+    </select>
+
+    <!-- 按科室病案首页手术病历数 -->
+    <select id="homePageCountForOperationByDept" parameterType="com.diagbot.vo.FilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
+        SELECT
+        a.beh_dept_id AS id,
+        a.beh_dept_name AS NAME,
+        COUNT(*) AS num
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        sys_user_dept c,
+        med_home_operation_info d
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND b.home_page_id = d.home_page_id
+        AND a.beh_dept_id = c.dept_id
+        <if test="userId!=null">
+            AND c.user_id = #{userId}
+        </if>
+        <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>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+    </select>
 </mapper>

+ 146 - 0
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -230,4 +230,150 @@
         a.beh_dept_id,
         a.beh_dept_name
     </select>
+
+    <!-- 按科室统计质控病历数 -->
+    <select id="resultCountByDept" parameterType="com.diagbot.vo.QcresultFilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
+        SELECT
+        a.beh_dept_id AS id,
+        a.beh_dept_name AS NAME,
+        COUNT(*) AS num
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        med_qcresult_info c,
+        sys_user_dept d
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = d.dept_id
+        <if test="userId!=null">
+            AND d.user_id = #{userId}
+        </if>
+        <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="gradeType != null and gradeType != ''">
+            AND c.grade_type = #{gradeType}
+        </if>
+        <if test="level != null and level != ''">
+            AND c.level = #{level}
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+    </select>
+
+    <!-- 按模块统计质控缺陷数 -->
+    <select id="entryCountGroupByCaseAndDept" parameterType="com.diagbot.vo.FilterByDeptVO" resultType="com.diagbot.dto.DeptNumDTO">
+        SELECT
+        d.cases_id AS id,
+        e.NAME AS NAME,
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        count(*) AS num
+        FROM
+        med_behospital_info a,
+        med_home_page b,
+        med_qcresult_info c,
+        med_qcresult_detail d,
+        qc_cases e,
+        qc_cases_entry f,
+        sys_user_dept g
+        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 f.is_deleted = 'N'
+        AND g.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.hospital_id = g.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND d.cases_id = e.id
+        AND d.cases_entry_id = f.id
+        AND e.id = f.cases_id
+        AND a.beh_dept_id = g.dept_id
+        <if test="userId!=null">
+            AND g.user_id = #{userId}
+        </if>
+        <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>
+        GROUP BY
+        d.cases_id,
+        e.`name`,
+        a.beh_dept_id,
+        a.beh_dept_name
+    </select>
+
+    <!-- 条目缺陷分组统计 -->
+    <select id="entryCountGroupByEntryAndDept" parameterType="com.diagbot.vo.FilterByDeptVO" resultType="com.diagbot.dto.DeptNumDTO">
+        SELECT
+        d.id,
+        d.NAME,
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        count(*) AS num
+        FROM
+        med_behospital_info a,
+        med_home_page 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.beh_dept_id = e.dept_id
+        <if test="userId!=null">
+            AND e.user_id = #{userId}
+        </if>
+        <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>
+        GROUP BY
+        d.id,
+        d.NAME,
+        a.beh_dept_id,
+        a.beh_dept_name
+    </select>
 </mapper>