Bläddra i källkod

Merge remote-tracking branch 'origin/dev/20200702_1.3.7' into debug

zhaops 5 år sedan
förälder
incheckning
f7b29a543e

+ 6 - 0
src/main/java/com/diagbot/aggregate/MrStatisticsAggregate.java

@@ -88,14 +88,20 @@ public class MrStatisticsAggregate {
         retMap.put("死亡人数", 0);
         retMap.put("新生儿人数", 0);
         retMap.put("手术病人数", 0);
+        retMap.put("非医嘱离院人数", 0);
+        retMap.put("31日内再入院人数", 0);
         Integer totleNum = behospitalInfoFacade.leaveHosCount(filterVO);
         Integer deathNum = behospitalInfoFacade.deathCount(filterVO);
         Integer newBornNum = behospitalInfoFacade.newBornCount(filterVO);
         Integer operationNum = behospitalInfoFacade.operationCount(filterVO);
+        Integer nonAdviceNum = behospitalInfoFacade.nonAdviceCount(filterVO);
+        Integer reBehospitalNum = behospitalInfoFacade.get31DaysBehospitalCount(filterVO);
         retMap.put("总人数", totleNum);
         retMap.put("死亡人数", deathNum);
         retMap.put("新生儿人数", newBornNum);
         retMap.put("手术病人数", operationNum);
+        retMap.put("非医嘱离院人数", nonAdviceNum);
+        retMap.put("31日内再入院人数", reBehospitalNum);
         return retMap;
     }
 

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

@@ -18,9 +18,9 @@ public class AverageStatisticsDTO {
     private Integer num;
     @Excel(name = "本年平均住院天数(天)", width = 15, orderNum = "2")
     private Double averageValue = 0d;
-    @Excel(name = "去年平均住院天数(天)", width = 15, orderNum = "3")
     private Double totleValue = 0d;
     //环比平均值
+    @Excel(name = "去年平均住院天数(天)", width = 15, orderNum = "3")
     private Double lastAverageValue = 0d;
     //同比平均值
     private Double lastYearAverageValue = 0d;

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

@@ -18,9 +18,9 @@ public class AverageStatisticsFeeDTO {
     private Integer num;
     @Excel(name = "本年平均住院花费(元)", width = 15, orderNum = "2")
     private Double averageValue = 0d;
-    @Excel(name = "去年平均住院花费(元)", width = 15, orderNum = "3")
     private Double totleValue = 0d;
     //环比平均值
+    @Excel(name = "去年平均住院花费(元)", width = 15, orderNum = "3")
     private Double lastAverageValue = 0d;
     //同比平均值
     private Double lastYearAverageValue = 0d;

+ 30 - 0
src/main/java/com/diagbot/dto/AverageStatisticsFeeMonthDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/15 19:44
+ */
+@Getter
+@Setter
+public class AverageStatisticsFeeMonthDTO {
+    private String id;
+    @Excel(name = "科室名称", width = 30, orderNum = "1")
+    private String name;
+    private Integer num;
+    @Excel(name = "本月平均住院花费(元)", width = 15, orderNum = "2")
+    private Double averageValue = 0d;
+    private Double totleValue = 0d;
+    //环比平均值
+    @Excel(name = "上月平均住院花费(元)", width = 15, orderNum = "3")
+    private Double lastAverageValue = 0d;
+    //同比平均值
+    @Excel(name = "去年本月平均住院花费(元)", width = 15, orderNum = "4")
+    private Double lastYearAverageValue = 0d;
+    //科室分类
+    private String deptClass;
+}

+ 30 - 0
src/main/java/com/diagbot/dto/AverageStatisticsMonthDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/4/15 19:44
+ */
+@Getter
+@Setter
+public class AverageStatisticsMonthDTO {
+    private String id;
+    @Excel(name = "科室名称", width = 30, orderNum = "1")
+    private String name;
+    private Integer num;
+    @Excel(name = "本月平均住院天数(天)", width = 15, orderNum = "2")
+    private Double averageValue = 0d;
+    private Double totleValue = 0d;
+    //环比平均值
+    @Excel(name = "上月平均住院天数(天)", width = 15, orderNum = "3")
+    private Double lastAverageValue = 0d;
+    //同比平均值
+    @Excel(name = "去年本月平均住院天数(天)", width = 15, orderNum = "4")
+    private Double lastYearAverageValue = 0d;
+    //科室分类
+    private String deptClass;
+}

+ 2 - 2
src/main/java/com/diagbot/dto/QcResultShortDTO.java

@@ -30,7 +30,7 @@ public class QcResultShortDTO {
      */
     @Excel(name = "病历得分", width = 30, orderNum = "2")
     private Double scoreRes;
-    @Excel(name = "病人住院号", width = 40, orderNum = "3")
+    @Excel(name = "病人住院号", width = 40, orderNum = "3")
     private String behospitalCode;
     @Excel(name = "病案号", width = 30, orderNum = "4")
     private String fileCode;
@@ -63,7 +63,7 @@ public class QcResultShortDTO {
     /**
      * 主治医生姓名
      */
-    @Excel(name = "主医生", width = 30, orderNum = "14")
+    @Excel(name = "主医生", width = 30, orderNum = "14")
     private String doctorName;
     private String directorDoctorId;
     @Excel(name = "主任医生", width = 30, orderNum = "15")

+ 20 - 2
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -3,6 +3,8 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.AverageStatisticsDTO;
 import com.diagbot.dto.AverageStatisticsFeeDTO;
+import com.diagbot.dto.AverageStatisticsFeeMonthDTO;
+import com.diagbot.dto.AverageStatisticsMonthDTO;
 import com.diagbot.dto.EntryNumDTO;
 import com.diagbot.dto.EntryNumGroupDTO;
 import com.diagbot.dto.EntryStatisticsDTO;
@@ -12,6 +14,7 @@ import com.diagbot.dto.LevelStatisticsTZDTO;
 import com.diagbot.dto.NumDTO;
 import com.diagbot.dto.QcResultPercentDTO;
 import com.diagbot.dto.QcResultShortDTO;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ExcelUtils;
 import com.diagbot.vo.EntryStatisticsVO;
 import com.diagbot.vo.FilterOrderVO;
@@ -100,7 +103,15 @@ public class ConsoleExportFacade {
         filterPageByAverageVO.setSearchCount(false);
         IPage<AverageStatisticsDTO> page = consoleFacade.getAverageDayNumPage(filterPageByAverageVO);
         String fileName = " 按科室统计平均住院天数.xls";
-        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", AverageStatisticsDTO.class, fileName, response, 12.8f);
+
+        if (filterPageByAverageVO.getType() == 2) {
+            ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", AverageStatisticsDTO.class, fileName, response, 12.8f);
+        }
+        if (filterPageByAverageVO.getType() == 1) {
+            List<AverageStatisticsMonthDTO> list = BeanUtil.listCopyTo(page.getRecords(), AverageStatisticsMonthDTO.class);
+            ExcelUtils.exportExcel(list, null, "sheet1", AverageStatisticsMonthDTO.class, fileName, response, 12.8f);
+        }
+
     }
 
     /**
@@ -115,7 +126,14 @@ public class ConsoleExportFacade {
         filterPageByAverageVO.setSearchCount(false);
         IPage<AverageStatisticsFeeDTO> page = consoleFacade.getAverageFeePage(filterPageByAverageVO);
         String fileName = " 按科室统计平均住院费用.xls";
-        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", AverageStatisticsFeeDTO.class, fileName, response, 12.8f);
+
+        if (filterPageByAverageVO.getType() == 2) {
+            ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", AverageStatisticsFeeDTO.class, fileName, response, 12.8f);
+        }
+        if (filterPageByAverageVO.getType() == 1) {
+            List<AverageStatisticsFeeMonthDTO> list = BeanUtil.listCopyTo(page.getRecords(), AverageStatisticsFeeMonthDTO.class);
+            ExcelUtils.exportExcel(list, null, "sheet1", AverageStatisticsFeeMonthDTO.class, fileName, response, 12.8f);
+        }
     }
 
     /**

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

@@ -254,4 +254,20 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @return
      */
     public List<EntryStatisticsDTO> entryStatistics(EntryStatisticsVO entryStatisticsVO);
+
+    /**
+     * 非医嘱离院病人记录
+     *
+     * @param filterVO
+     * @return
+     */
+    public int nonAdviceCount(FilterVO filterVO);
+
+    /**
+     * 31天内再入院记录
+     *
+     * @param filterVO
+     * @return
+     */
+    public int get31DaysBehospitalCount(FilterVO filterVO);
 }

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

@@ -247,4 +247,20 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @return
      */
     public List<EntryStatisticsDTO> entryStatistics(EntryStatisticsVO entryStatisticsVO);
+
+    /**
+     * 非医嘱离院病人记录
+     *
+     * @param filterVO
+     * @return
+     */
+    public int nonAdviceCount(FilterVO filterVO);
+
+    /**
+     * 31天内再入院记录
+     *
+     * @param filterVO
+     * @return
+     */
+    public int get31DaysBehospitalCount(FilterVO filterVO);
 }

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

@@ -336,4 +336,26 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
     public List<EntryStatisticsDTO> entryStatistics(EntryStatisticsVO entryStatisticsVO) {
         return baseMapper.entryStatistics(entryStatisticsVO);
     }
+
+    /**
+     * 非医嘱离院病人记录
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public int nonAdviceCount(FilterVO filterVO) {
+        return baseMapper.nonAdviceCount(filterVO);
+    }
+
+    /**
+     * 31天内再入院记录
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public int get31DaysBehospitalCount(FilterVO filterVO) {
+        return baseMapper.get31DaysBehospitalCount(filterVO);
+    }
 }

+ 243 - 2
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -2819,12 +2819,12 @@
             AND tt1.behospital_code = tt2.behospital_code
         </if>
         ) t1
-        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2166)">
+        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
             LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
             AND t1.behospital_code = t2.behospital_code
             AND t2.is_deleted = 'N'
         </if>
-        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2166)">
+        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
             , med_home_page t2
             , med_home_operation_info t3
             WHERE t1.hospital_id = t2.hospital_id
@@ -3387,4 +3387,245 @@
             </choose>
         </if>
     </select>
+
+    <!-- 非医嘱离院病人记录-->
+    <select id="nonAdviceCount" resultType="int" parameterType="com.diagbot.vo.FilterVO">
+        SELECT
+        count(*)
+        FROM
+        med_behospital_info a,
+        med_home_page b
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND b.leave_hospital_type = '非医嘱离院'
+        AND a.is_placefile = '1'
+        AND a.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null">
+            <![CDATA[ AND a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+    </select>
+
+    <!-- 31天内再入院记录-->
+    <select id="get31DaysBehospitalCount" resultType="int" parameterType="com.diagbot.vo.FilterVO">
+        SELECT
+        count(*)
+        FROM
+        (
+        SELECT
+        bc1.file_code,
+        bc1.diagnose,
+        bc1.behospitalCode,
+        bc1.behospitalDate,
+        bc1.leaveHospitalDate
+        FROM
+        (
+        SELECT
+        t1.file_code,
+        t1.diagnose,
+        t1.behospital_code AS behospitalCode,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t2.behospital_code AS lastBehospitalCode,
+        t2.behospital_date AS lastBehospitalDate,
+        t1.behospital_date AS behospitalDate,
+        t2.leave_hospital_date AS lastLeaveHospitalDate
+        FROM
+        (
+        SELECT
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_code,
+        tt2.behospital_date,
+        tt2.leave_hospital_date
+        FROM
+        (
+        SELECT
+        a.file_code,
+        a.diagnose
+        FROM
+        med_behospital_info a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.is_placefile = '1'
+        AND a.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null">
+            <![CDATA[ AND a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        AND IFNULL( a.diagnose, '' )!= ''
+        GROUP BY
+        a.file_code,
+        a.diagnose
+        HAVING
+        count(*)> 1
+        ) tt1,
+        med_behospital_info tt2
+        WHERE
+        tt2.is_deleted = 'N'
+        AND tt1.file_code = tt2.file_code
+        AND tt1.diagnose = tt2.diagnose
+        ORDER BY
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_date DESC
+        ) t1,
+        (
+        SELECT
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_code,
+        tt2.behospital_date,
+        tt2.leave_hospital_date
+        FROM
+        (
+        SELECT
+        a.file_code,
+        a.diagnose
+        FROM
+        med_behospital_info a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.is_placefile = 1
+        AND a.qc_type_id != 0
+        AND a.hospital_id = 1
+        AND IFNULL( a.diagnose, '' )!= ''
+        GROUP BY
+        a.file_code,
+        a.diagnose
+        HAVING
+        count(*)> 1
+        ) tt1,
+        med_behospital_info tt2
+        WHERE
+        tt2.is_deleted = 'N'
+        AND tt1.file_code = tt2.file_code
+        AND tt1.diagnose = tt2.diagnose
+        ORDER BY
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_date DESC
+        ) t2
+        WHERE
+        t1.file_code = t2.file_code
+        AND t1.diagnose = t2.diagnose
+        AND t1.behospital_code != t2.behospital_code
+        AND ( TIMESTAMPDIFF( DAY, DATE( t2.leave_hospital_date ), DATE( t1.behospital_date )) BETWEEN 0 AND 31 )) bc1 UNION
+        SELECT
+        bc2.file_code,
+        bc2.diagnose,
+        bc2.lastBehospitalCode,
+        bc2.lastBehospitalDate,
+        bc2.lastLeaveHospitalDate
+        FROM
+        (
+        SELECT
+        t1.file_code,
+        t1.diagnose,
+        t1.behospital_code AS behospitalCode,
+        t1.leave_hospital_date AS leaveHospitalDate,
+        t2.behospital_code AS lastBehospitalCode,
+        t2.behospital_date AS lastBehospitalDate,
+        t1.behospital_date AS behospitalDate,
+        t2.leave_hospital_date AS lastLeaveHospitalDate
+        FROM
+        (
+        SELECT
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_code,
+        tt2.behospital_date,
+        tt2.leave_hospital_date
+        FROM
+        (
+        SELECT
+        a.file_code,
+        a.diagnose
+        FROM
+        med_behospital_info a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.is_placefile = '1'
+        AND a.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null">
+            <![CDATA[ AND a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        AND IFNULL( a.diagnose, '' )!= ''
+        GROUP BY
+        a.file_code,
+        a.diagnose
+        HAVING
+        count(*)> 1
+        ) tt1,
+        med_behospital_info tt2
+        WHERE
+        tt2.is_deleted = 'N'
+        AND tt1.file_code = tt2.file_code
+        AND tt1.diagnose = tt2.diagnose
+        ORDER BY
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_date DESC
+        ) t1,
+        (
+        SELECT
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_code,
+        tt2.behospital_date,
+        tt2.leave_hospital_date
+        FROM
+        (
+        SELECT
+        a.file_code,
+        a.diagnose
+        FROM
+        med_behospital_info a
+        WHERE
+        a.is_deleted = 'N'
+        AND a.is_placefile = 1
+        AND a.qc_type_id != 0
+        AND a.hospital_id = 1
+        AND IFNULL( a.diagnose, '' )!= ''
+        GROUP BY
+        a.file_code,
+        a.diagnose
+        HAVING
+        count(*)> 1
+        ) tt1,
+        med_behospital_info tt2
+        WHERE
+        tt2.is_deleted = 'N'
+        AND tt1.file_code = tt2.file_code
+        AND tt1.diagnose = tt2.diagnose
+        ORDER BY
+        tt1.file_code,
+        tt1.diagnose,
+        tt2.behospital_date DESC
+        ) t2
+        WHERE
+        t1.file_code = t2.file_code
+        AND t1.diagnose = t2.diagnose
+        AND t1.behospital_code != t2.behospital_code
+        AND ( TIMESTAMPDIFF( DAY, DATE( t2.leave_hospital_date ), DATE( t1.behospital_date )) BETWEEN 0 AND 31 )) bc2
+        ) t
+    </select>
 </mapper>