Quellcode durchsuchen

断账患者的入院时间,取医保的时间

xiaochan vor 3 Jahren
Ursprung
Commit
3ab489046c

+ 28 - 15
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -90,26 +90,15 @@ public interface UpIdCollectionDao {
             "                     (select yb_code\n" +
             "                      from a_employee_mi\n" +
             "                      where code = main_doctor)                 as chfpdr_code/*主诊医师代码*/,\n" +
-            "                     a.admiss_date                              as adm_time/*入院时间*/,\n" +
-            "                     a.admiss_date                              as setl_begn_date /*结算开始日期*/,\n" +
             "                     (select rtrim(si_caty)\n" +
             "                      from zd_unit_code\n" +
             "                      where code = b.small_dept)                as adm_caty/*入院科别*/,\n" +
             "                     (select rtrim(si_caty)\n" +
             "                      from zd_unit_code\n" +
             "                      where code = b.zk_ward)                   as refldept_dept /*转科科别*/,\n" +
-            "                     dismiss_date                               as dscg_time/*出院时间*/,\n" +
             "                     (select rtrim(si_caty)\n" +
             "                      from zd_unit_code\n" +
             "                      where code = isnull(zk_ward, small_dept)) as dscg_caty /*出院科别*/,\n" +
-            "                     case\n" +
-            "                         when datediff(day,\n" +
-            "                                       a.admiss_date,\n" +
-            "                                       dismiss_date) <= 0 then 1\n" +
-            "                         else datediff(day,\n" +
-            "                                       a.admiss_date,\n" +
-            "                                       dismiss_date)\n" +
-            "                         end                                    as act_ipt_days,\n" +
             "    /*实际住院天数*/\n" +
             "                     zy_serial_no                               as biz_sn /*业务流水号*/,\n" +
             "                     case age_days\n" +
@@ -142,6 +131,30 @@ public interface UpIdCollectionDao {
             "  and b.admiss_times = #{times};")
     SetlinfoUpld setlinfo2(@Param("patNo") String patNo, @Param("times") Integer times);
 
+    @Select("select yb_register_date as adm_time,\n" +
+            "       yb_register_date as setl_begn_date,\n" +
+            "       endtime          as dscg_time,\n" +
+            "       yb_register_date,\n" +
+            "       case\n" +
+            "           when datediff(day,\n" +
+            "                         yb_register_date,\n" +
+            "                         endtime) <= 0 then 1\n" +
+            "           else datediff(day,\n" +
+            "                         yb_register_date,\n" +
+            "                         endtime)\n" +
+            "           end          as act_ipt_days\n" +
+            "from t_si_setlinfo,\n" +
+            "     zy_inactpatient\n" +
+            "where pat_no = #{patNo}\n" +
+            "  and times = #{times}\n" +
+            "  and ledger_sn = #{ledgerSn}\n" +
+            "  and revoked = 0\n" +
+            "  and inpatient_no = pat_no\n" +
+            "  and admiss_times = times")
+    SetlinfoUpld setlinfo5(@Param("patNo") String patNo,
+                           @Param("times") Integer times,
+                           @Param("ledgerSn") Integer ledgerSn);
+
 
     @Select("select home_street as currAddr," +
             "(select wjw_code from zd_nation_code where code = nation_code)          as naty/*民族*/,\n" +
@@ -163,10 +176,10 @@ public interface UpIdCollectionDao {
 
     @Select("select (select si_code from zd_country_code where code = country)                    as ntly, " +
             "       dis_date                               as setl_end_date, " +
-            "       admiss_date                            as setl_begn_date, " +
-            "       admiss_date                            as adm_time," +
-            "       case " + "           when datediff(day, admiss_date, dis_date) <= 0 then 1 " +
-            "           else datediff(day, admiss_date, dis_date) end  as act_ipt_days,/*实际住院天数*/ " +
+            "       yb_register_date                            as setl_begn_date, " +
+            "       yb_register_date                            as adm_time," +
+            "       case " + "           when datediff(day, yb_register_date, dis_date) <= 0 then 1 " +
+            "           else datediff(day, yb_register_date, dis_date) end  as act_ipt_days,/*实际住院天数*/ " +
             "       dis_date as dscg_time, " +
             "       isnull(nullif(occupation_code, ''), 90) as prfs," +
             "       adm_way = '2' " +

+ 3 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.service.medicalinsurance;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -52,6 +53,7 @@ import java.util.stream.Collectors;
  */
 @Service
 @Slf4j
+@DS("his")
 public class SetlListUpldService {
 
     private static final int NOT_UPLOADED = 1;
@@ -184,6 +186,7 @@ public class SetlListUpldService {
         EntityCopy.Copy(dao.setlinfo2(patNo, times), setlinfoUpld);
         EntityCopy.Copy(dao.setlinfo3(String.format("inpatient_no ='%s'", patNo)), setlinfoUpld);
         EntityCopy.Copy(dao.setlinfo4(patNo, times), setlinfoUpld);
+        EntityCopy.Copy(dao.setlinfo5(patNo, times,ledgerSn), setlinfoUpld);
 
         if (patNo.startsWith("JT")) {
             EntityCopy.Copy(dao.singleDiseasePatientInformation(patNo, times), setlinfoUpld);