Bladeren bron

入院人数统计

zhaops 4 jaren geleden
bovenliggende
commit
d4a64439cf

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

@@ -106,6 +106,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/unModifyMRStatistics").permitAll()
                 .antMatchers("/console/unModifyMRPage").permitAll()
                 .antMatchers("/console/reHos31DaysPage").permitAll()
+                .antMatchers("/console/beHosCount").permitAll()
                 .antMatchers("/consoleByDept/entryCountGroupByCaseAndDept").permitAll()
                 .antMatchers("/consoleByDept/entryCountGroupByCaseAndDeptPage").permitAll()
                 .antMatchers("/consoleByDept/entryCountGroupByEntryAndDept").permitAll()

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

@@ -149,6 +149,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/unModifyMRStatistics", request)
                 || matchers("/console/unModifyMRPage", request)
                 || matchers("/console/reHos31DaysPage", request)
+                || matchers("/console/beHosCount", request)
                 || matchers("/consoleByDept/entryCountGroupByCaseAndDept", request)
                 || matchers("/consoleByDept/entryCountGroupByCaseAndDeptPage", request)
                 || matchers("/consoleByDept/entryCountGroupByEntryAndDept", request)

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

@@ -1242,4 +1242,31 @@ public class ConsoleFacade {
         retPage.setRecords(retRecords);
         return retPage;
     }
+
+    /**
+     * 入院人数统计(首页)
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<NumDTO> beHosCount(FilterVO filterVO) {
+        filterFacade.filterVOSet(filterVO);
+        List<NumDTO> records = behospitalInfoFacade.beHosCount(filterVO);
+
+        NumDTO globleRecord = new NumDTO();
+        globleRecord.setName("全院");
+        Integer num = records.stream()
+                .map(NumDTO::getNum)
+                .reduce(0, Integer::sum);
+        globleRecord.setNum(num);
+        globleRecord.setTotleNum(num);
+        globleRecord.setPercent(1d);
+        globleRecord.setPercentStr("100%");
+        records.add(0, globleRecord);
+
+        if (records.size() > filterVO.getLimitCount()) {
+            records = records.subList(0, 10);
+        }
+        return records;
+    }
 }

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

@@ -365,4 +365,11 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<ReBeHosMergeDTO> reHos31DaysPage(@Param("reBeHosPageVO") ReBeHosPageVO reBeHosPageVO);
 
+    /**
+     * 入院人数统计-首页
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<NumDTO> beHosCount(FilterVO filterVO);
 }

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

@@ -356,4 +356,12 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @return
      */
     public IPage<ReBeHosMergeDTO> reHos31DaysPage(@Param("reBeHosPageVO") ReBeHosPageVO reBeHosPageVO);
+
+    /**
+     * 入院人数统计-首页
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<NumDTO> beHosCount(FilterVO filterVO);
 }

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

@@ -484,4 +484,15 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     public IPage<ReBeHosMergeDTO> reHos31DaysPage(@Param("reBeHosPageVO") ReBeHosPageVO reBeHosPageVO) {
         return baseMapper.reHos31DaysPage(reBeHosPageVO);
     }
+
+    /**
+     * 入院人数统计-首页
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<NumDTO> beHosCount(FilterVO filterVO) {
+        return baseMapper.beHosCount(filterVO);
+    }
 }

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

@@ -638,4 +638,19 @@ public class ConsoleController {
     public RespDTO<IPage<ReBeHosDTO>> reHos31DaysPage(@RequestBody @Valid ReBeHosPageVO reBeHosPageVO) {
         return RespDTO.onSuc(consoleFacade.reHos31DaysPage(reBeHosPageVO));
     }
+
+    /**
+     * 入院人数统计(首页)
+     *
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "入院人数统计(首页)[by:zhaops]",
+            notes = "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>")
+    @PostMapping("/beHosCount")
+    @SysLogger("beHosCount")
+    public RespDTO<List<NumDTO>> beHosCount(@RequestBody @Valid FilterVO filterVO) {
+        return RespDTO.onSuc(consoleFacade.beHosCount(filterVO));
+    }
 }

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

@@ -813,6 +813,45 @@
         </if>
     </select>
 
+    <!-- 入院人数统计-首页 -->
+    <select id="beHosCount" parameterType="com.diagbot.vo.FilterVO"
+            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
+        WHERE
+        a.is_deleted = 'N'
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <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
+    </select>
+
     <!-- 出院总人数统计-科室-首页 -->
     <select id="leaveHosCountByDept" parameterType="com.diagbot.vo.FilterVO"
             resultType="com.diagbot.dto.NumDTO">