Browse Source

控制台 入院人数统计/入院记录24小时未记录

chengyao 4 years ago
parent
commit
e88bffc007

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

@@ -177,11 +177,11 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/export/badLevelPagePageExport").permitAll()
                 .antMatchers("/qc/medNurse/getMedNursePage").permitAll()
                 .antMatchers("/qc/behospitalInfo/exportQcresultByPerson").permitAll()
+                .antMatchers("/consoleByDept/beHosCountByDept").permitAll()
+                .antMatchers("/consoleByDept/casesEntryStatisticsByDept").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }
-
-
     @Override
     public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
         log.info("Configuring ResourceServerSecurityConfigurer");

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

@@ -221,6 +221,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/export/badLevelPagePageExport", request)
                 || matchers("/qc/medNurse/getMedNursePage", request)
                 || matchers("/qc/behospitalInfo/exportQcresultByPerson", request)
+                || matchers("/consoleByDept/beHosCountByDept", request)
+                || matchers("/consoleByDept/casesEntryStatisticsByDept", request)
                 || matchers("/", request)) {
             return true;
         }

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

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/12/24 13:07
+ */
+@Getter
+@Setter
+public class AdmissionCountDTO {
+    //医生id
+    private String doctorId;
+    //主管医生
+    private String doctorName;
+    //科室id
+    private String deptId;
+    //科室名称
+    private String deptName;
+    //总人数
+    private Integer num;
+}

+ 57 - 41
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -1,13 +1,7 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-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.dto.QcResultShortDTO;
+import com.diagbot.dto.*;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
@@ -69,7 +63,6 @@ public class ConsoleByDeptFacade {
         Map<String, NumDTO> deathMap = new HashMap<>();
         Map<String, NumDTO> operationMap = new HashMap<>();
         //终末--死亡人数/手术病人数
-        if("1".equals(filterVO.getIsPlacefile())){
             //死亡人数
             List<NumDTO> deathNumList = behospitalInfoFacade.deathCountByDept(filterVO);
              deathMap = ListUtil.isEmpty(deathNumList)
@@ -80,36 +73,41 @@ public class ConsoleByDeptFacade {
              operationMap = ListUtil.isEmpty(operationNumList)
                     ? new HashMap<>()
                     : EntityUtil.makeEntityMap(operationNumList, "name");
-        }
-
-//        //新生儿人数
-//        List<NumDTO> newBornNumList = behospitalInfoFacade.newBornCountByDept(filterVO);
-//        Map<String, NumDTO> newBornMap = ListUtil.isEmpty(newBornNumList)
-//                ? new HashMap<>()
-//                : EntityUtil.makeEntityMap(newBornNumList, "name");
 
         for (String deptName : deptMap.keySet()) {
             Map<String, Object> map = new LinkedHashMap<>();
             map.put("总人数", 0);
+            map.put("死亡人数", 0);
+            map.put("手术病人数", 0);
             if (totleMap.containsKey(deptName)) {
                 map.put("总人数", totleMap.get(deptName).getNum());
             }
-
-            if("1".equals(filterVO.getIsPlacefile())){
-                map.put("死亡人数", 0);
-                map.put("手术病人数", 0);
-                if(deathMap.containsKey(deptName)) {
-                    map.put("死亡人数", deathMap.get(deptName).getNum());
-                }
-                if(operationMap.containsKey(deptName)) {
-                    map.put("手术病人数", operationMap.get(deptName).getNum());
-                }
+            if(deathMap.containsKey(deptName)) {
+                map.put("死亡人数", deathMap.get(deptName).getNum());
+            }
+            if(operationMap.containsKey(deptName)) {
+                map.put("手术病人数", operationMap.get(deptName).getNum());
             }
             retMap.put(deptName, map);
         }
         return retMap;
     }
 
+
+    /**
+     * 入院人数统计-按科室
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, List<AdmissionCountDTO>> admissionHosCountByDept(FilterVO filterVO) {
+        filterFacade.filterVOSet(filterVO);
+        List<AdmissionCountDTO> totleNumList = behospitalInfoFacade.admissionHosCountByDept(filterVO);
+        Map<String, List<AdmissionCountDTO>> resourceData = mapResource(filterVO, totleNumList);
+        return resourceData;
+    }
+
+
     /**
      * 病历数统计-按科室
      *
@@ -521,25 +519,43 @@ public class ConsoleByDeptFacade {
      * @param filterVO
      * @return
      */
-    public List<NumDTO> casesEntryStatisticsByDept(FilterVO filterVO) {
+    public  Map<String, List<AdmissionCountDTO>>casesEntryStatisticsByDept(FilterVO filterVO) {
         filterFacade.filterVOSet(filterVO);
-        List<NumDTO> records = behospitalInfoFacade.casesEntryStatisticsByDept(filterVO);
-
-        if (ListUtil.isNotEmpty(records)) {
-            NumDTO globleRecord = new NumDTO();
-            globleRecord.setName("全院");
-            Integer num = records.stream()
-                    .map(NumDTO::getNum)
-                    .reduce(0, Integer::sum);
-            globleRecord.setNum(num);
-            records.add(0, globleRecord);
-        }
+        List<AdmissionCountDTO> totleNumList = behospitalInfoFacade.casesEntryStatisticsByDept(filterVO);
+        Map<String, List<AdmissionCountDTO>> resourceData = mapResource(filterVO, totleNumList);
+        return resourceData;
+    }
+
+    public Map<String, List<AdmissionCountDTO>> mapResource(FilterVO filterVO,List<AdmissionCountDTO>totleNumList){
+        Map<String, Object> deptMap = getDeptByUser(filterVO);
+            Map<String, List<AdmissionCountDTO>> mapSource = new HashMap<>();
+            Map<String, List<AdmissionCountDTO>> returnSource = new HashMap<>();
+            if (deptMap == null) {
+                return mapSource;
+            }
 
-        if (ListUtil.isNotEmpty(records) && records.size() > filterVO.getLimitCount()) {
-            records = records.subList(0, 10);
+            if(ListUtil.isNotEmpty(totleNumList)) {
+                mapSource = EntityUtil.makeEntityListMap(totleNumList, "deptName");
+                for (String deptName : deptMap.keySet()) {
+                    List<AdmissionCountDTO> admissionCountDTOS = mapSource.get(deptName);
+                if(ListUtil.isNotEmpty(admissionCountDTOS) ){
+//                    if ( admissionCountDTOS.size()> filterVO.getLimitCount()) {
+//                        admissionCountDTOS = admissionCountDTOS.subList(0, 10);
+//                      }
+                    AdmissionCountDTO admissionCount = new AdmissionCountDTO();
+                    Integer tolCount = admissionCountDTOS.stream()
+                            .map(AdmissionCountDTO::getNum)
+                            .reduce(0, Integer::sum);
+                    admissionCount.setDoctorName(deptName);
+                    admissionCount.setNum(tolCount);
+                    admissionCountDTOS.add(0, admissionCount);
+                    returnSource.put(deptName,admissionCountDTOS);
+                    }
+                }
+            }
+            return returnSource;
         }
-        return records;
-    }
+
 
     /**
      * 病案首页合格率占比(首页)

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

@@ -91,6 +91,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<NumDTO> leaveHosCountByDept(FilterVO filterVO);
 
+    /**
+     * 入院总人数统计-科室-首页
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<AdmissionCountDTO> admissionHosCountByDept(FilterVO filterVO);
+
     /**
      * 新生儿出院人数统计-科室-首页
      *
@@ -161,7 +169,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @param filterVO
      * @return
      */
-    public List<NumDTO> casesEntryStatisticsByDept(FilterVO filterVO);
+    public List<AdmissionCountDTO> casesEntryStatisticsByDept(FilterVO filterVO);
 
     /**
      * 科室缺陷占比-科室(分页)

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

@@ -91,6 +91,15 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public List<NumDTO> leaveHosCountByDept(FilterVO filterVO);
 
+    /**
+     * 入院总人数统计-科室-首页
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<AdmissionCountDTO> admissionHosCountByDept(FilterVO filterVO);
+
+
     /**
      * 新生儿出院人数统计-科室-首页
      *
@@ -153,7 +162,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @param filterVO
      * @return
      */
-    public List<NumDTO> casesEntryStatisticsByDept(FilterVO filterVO);
+    public List<AdmissionCountDTO> casesEntryStatisticsByDept(FilterVO filterVO);
 
 
     /**

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

@@ -134,6 +134,16 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.leaveHosCountByDept(filterVO);
     }
 
+    /**
+     * 入院总人数统计-科室-首页
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<AdmissionCountDTO> admissionHosCountByDept(FilterVO filterVO) {
+        return baseMapper.admissionHosCountByDept(filterVO);
+    }
+
     /**
      * 新生儿出院人数统计-科室-首页
      *
@@ -226,7 +236,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @return
      */
     @Override
-    public List<NumDTO> casesEntryStatisticsByDept(FilterVO filterVO) {
+    public List<AdmissionCountDTO> casesEntryStatisticsByDept(FilterVO filterVO) {
         return baseMapper.casesEntryStatisticsByDept(filterVO);
     }
 

+ 3 - 2
src/main/java/com/diagbot/vo/FilterVO.java

@@ -50,7 +50,7 @@ public class FilterVO {
      * 限制条数
      */
     @ApiModelProperty(hidden = true)
-    private Integer limitCount;
+    private Integer limitCount = 10;
 
     @ApiModelProperty(hidden = true)
     private Long userId;
@@ -59,9 +59,10 @@ public class FilterVO {
      * 科室分类
      */
     private String deptClass;
+    //科室名称
+    private String deptName;
 
     private String level;
-
     /**
      * 是否归档(0:未归档,1:已归档)
      */

+ 9 - 0
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -44,6 +44,15 @@ public class ConsoleByDeptController {
         Map<String, Object> data = consoleByDeptFacade.leaveHosCountByDept(filterVO);
         return RespDTO.onSuc(data);
     }
+        @ApiOperation(value = "入院病人统计(科室)-首页[by:zhaops]",
+                notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
+                        "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
+        @PostMapping("/beHosCountByDept")
+        @SysLogger("beHosCountByDept")
+        public RespDTO<Map<String, List<AdmissionCountDTO>>> beHosCountByDept(@RequestBody @Valid FilterVO filterVO) {
+            Map<String, List<AdmissionCountDTO>> data = consoleByDeptFacade.admissionHosCountByDept(filterVO);
+            return RespDTO.onSuc(data);
+    }
 
     @ApiOperation(value = "病历数统计(科室)-首页[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +

+ 57 - 4
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -925,6 +925,55 @@
         a.beh_dept_name
     </select>
 
+    <!-- 入院总人数统计-科室-首页 -->
+    <select id="admissionHosCountByDept" parameterType="com.diagbot.vo.FilterVO"
+            resultType="com.diagbot.dto.AdmissionCountDTO">
+        SELECT
+        a.beh_dept_id as deptId,
+        a.beh_dept_name as deptName,
+        a.doctor_id as doctorId,
+        a.doctor_name as doctorName,
+        COUNT(*) AS num
+        FROM
+        med_behospital_info a,
+        sys_user_dept c
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.beh_dept_id = c.dept_id
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </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="isPlacefile != null and isPlacefile == 0">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name,
+        a.doctor_id,
+        a.doctor_name
+    </select>
+
     <!-- 新生儿出院人数统计-科室-首页 -->
     <select id="newBornCountByDept" parameterType="com.diagbot.vo.FilterVO"
             resultType="com.diagbot.dto.NumDTO">
@@ -9275,10 +9324,12 @@
     </select>
 
     <!-- 单条条目缺陷统计-->
-    <select id="casesEntryStatisticsByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
+    <select id="casesEntryStatisticsByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.AdmissionCountDTO">
         SELECT
-        a.beh_dept_id AS id,
-        a.beh_dept_name AS NAME,
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        a.doctor_id as doctorId,
+        a.doctor_name as doctorName,
         count(*) AS num
         FROM
         med_behospital_info a,
@@ -9321,7 +9372,9 @@
         </if>
         GROUP BY
         a.beh_dept_id,
-        a.beh_dept_name
+        a.beh_dept_name,
+        a.doctor_id,
+        a.doctor_name
     </select>
 
     <!-- 病案首页改善率质控评分页(内页)-->