浏览代码

入院间隔中还要查询在院患者

DESKTOP-0GD05B0\Administrator 2 年之前
父节点
当前提交
295a7db7a4

+ 64 - 22
src/main/java/thyyxxk/webserver/dao/his/reports/IllegalChargesAnalysisDao.java

@@ -88,15 +88,32 @@ public interface IllegalChargesAnalysisDao {
 
 
     @Select("<script>" +
-            "select rtrim(a.inpatient_no) inpatient_no,rtrim(a.name) name,a.admiss_times," +
-            "a.admiss_date,b.dis_date,DATEDIFF(day,b.dis_date,a.admiss_date) differ_date," +
-            "(select name from zd_unit_code where code=isnull(a.small_dept,a.admiss_dept)) dept_name," +
-            "responce_type_name = (select name from zy_zd_responce_type where a.responce_type = zy_zd_responce_type.code) " +
-            "from zy_inactpatient a ,zy_inactpatient b " +
-            "where a.inpatient_no=b.inpatient_no" +
-            "  and a.admiss_times=b.admiss_times+1" +
-            "  and a.inpatient_no not like 'JT%'" +
-            "  and DATEDIFF(day,b.dis_date,a.admiss_date)&lt;2 " +
+            "select                   rtrim(a.inpatient_no)                              inpatient_no, " +
+            "                         rtrim(a.name)                                      name, " +
+            "                         a.admiss_times, " +
+            "                         a.admiss_date, " +
+            "                         b.dis_date, " +
+            "                         DATEDIFF(day, " +
+            "                                  b.dis_date, " +
+            "                                  a.admiss_date)                            differ_date, " +
+            "                         (select name " +
+            "                          from zd_unit_code " +
+            "                          where code = isnull(a.small_dept, a.admiss_dept)) dept_name, " +
+            "    responce_type_name = (select name " +
+            "                          from zy_zd_responce_type " +
+            "                          where a.responce_type = zy_zd_responce_type.code), " +
+            "                         c.dis_diag, " +
+            "                         c.dis_diag_comment " +
+            "from zy_actpatient a, " +
+            "     zy_inactpatient b, " +
+            "     ba_first_page1 c " +
+            "where a.inpatient_no = b.inpatient_no " +
+            "  and a.admiss_times = b.admiss_times + 1 " +
+            "  and a.inpatient_no not like 'JT%' " +
+            "  and DATEDIFF(day, b.dis_date, a.admiss_date) &lt; 2 " +
+            "  and a.inpatient_no = c.inpatient_no " +
+            "  and a.admiss_times = c.admiss_times " +
+            "  and c.dis_diag_no = 1 " +
             "<if test=\"start !=null and start != '' \">" +
             " and a.admiss_date &gt;= #{start} and a.admiss_date &lt;= #{end} " +
             "</if>" +
@@ -106,24 +123,49 @@ public interface IllegalChargesAnalysisDao {
             "#{item}" +
             "</foreach>" +
             "</if>" +
-            "order by a.inpatient_no,a.admiss_times" +
+            "union " +
+            "select                   rtrim(a.inpatient_no)                              inpatient_no, " +
+            "                         rtrim(a.name)                                      name, " +
+            "                         a.admiss_times, " +
+            "                         a.admiss_date, " +
+            "                         b.dis_date, " +
+            "                         DATEDIFF(day, " +
+            "                                  b.dis_date, " +
+            "                                  a.admiss_date)                            differ_date, " +
+            "                         (select name " +
+            "                          from zd_unit_code " +
+            "                          where code = isnull(a.small_dept, a.admiss_dept)) dept_name, " +
+            "    responce_type_name = (select name " +
+            "                          from zy_zd_responce_type " +
+            "                          where a.responce_type = zy_zd_responce_type.code), " +
+            "                         c.dis_diag, " +
+            "                         c.dis_diag_comment " +
+            "from zy_inactpatient a, " +
+            "     zy_inactpatient b, " +
+            "     ba_first_page1 c " +
+            "where a.inpatient_no = b.inpatient_no " +
+            "  and a.admiss_times = b.admiss_times + 1 " +
+            "  and a.inpatient_no not like 'JT%' " +
+            "  and DATEDIFF(day, b.dis_date, a.admiss_date) &lt; 2 " +
+            "  and a.inpatient_no = c.inpatient_no " +
+            "  and a.admiss_times = c.admiss_times " +
+            "  and c.dis_diag_no = 1 " +
+            "<if test=\"start !=null and start != '' \">" +
+            " and a.admiss_date &gt;= #{start} and a.admiss_date &lt;= #{end} " +
+            "</if>" +
+            "<if test=\"responces.size > 0\" >" +
+            "and a.responce_type in " +
+            "<foreach collection='responces' item='item' index='index' open='(' close=')' separator=','>" +
+            "#{item}" +
+            "</foreach>" +
+            "</if>" +
+            "order by a.inpatient_no, " +
+            "         a.admiss_times" +
             "</script>")
     List<IllegalChargeData> queryHuanZheLiangCiRuYuanRiQi(@Param("start") String start,
                                                           @Param("end") String end,
                                                           @Param("responces") List<String> responces);
 
-
-    @Select("<script>" +
-            "select rtrim(inpatient_no) inpatient_no,admiss_times,dis_diag_comment,dis_diag from ba_first_page1 where " +
-            "inpatient_no in  " +
-            "<foreach collection='inpatientNoList' item='item' index='index' open='(' close=')' separator=','>" +
-            "#{item.inpatientNo}" +
-            "</foreach>" +
-            " and dis_diag_no = 1" +
-            "</script>")
-    List<IllegalChargeData> queryZhenDuan(@Param("inpatientNoList") List<IllegalChargeData> inpatientNoList);
-
-
     @Select("select inpatient_no, " +
             "       rtrim(name) name, " +
             "       dept_name   = (select rtrim(name) name from zd_unit_code where code = small_dept), " +

+ 0 - 10
src/main/java/thyyxxk/webserver/service/reports/IllegalChargesAnalysisService.java

@@ -258,16 +258,6 @@ public class IllegalChargesAnalysisService {
         if (list.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
         }
-        List<IllegalChargeData> illegalChargeData = dao.queryZhenDuan(list);
-        for (IllegalChargeData chargeData : list) {
-            for (IllegalChargeData illegalChargeDatum : illegalChargeData) {
-                if (chargeData.getInpatientNo().equals(illegalChargeDatum.getInpatientNo()) && chargeData.getAdmissTimes().equals(illegalChargeDatum.getAdmissTimes())) {
-                    chargeData.setDisDiag(illegalChargeDatum.getDisDiag());
-                    chargeData.setDisDiagComment(illegalChargeDatum.getDisDiagComment());
-                    break;
-                }
-            }
-        }
         return ResultVoUtil.success(list);
     }