浏览代码

结算单住院天数优化

lighter 3 年之前
父节点
当前提交
5a1bff1396

+ 1 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -156,8 +156,7 @@ public interface SiQueryDao {
             "a.psn_type,a.cvlserv_flag,a.pat_no,a.setl_id,b.insuplc_admdvs, " +
             "tel=(select rtrim(home_tel) from a_patient_mi where a_patient_mi.inpatient_no=a.pat_no), " +
             "admDeptName=(select rtrim(name) from zd_unit_code where code=isnull(c.zk_ward,c.small_dept)), " +
-            "c.bed_no as admBed,c.admiss_date as begntime,c.dis_date as endtime, " +
-            "inHospdays=datediff(day ,c.admiss_date,c.dis_date), " +
+            "c.bed_no as admBed,c.admiss_date as begntime, c.dis_date as endtime, " +
             "a.certno,a.mdtrt_cert_type, b.psn_idet_type, " +
             "dscgMaindiagName=(select rtrim(dis_diag_comment) from zy_dis_diag_yb where zy_dis_diag_yb.inpatient_no=a.pat_no " +
             "and zy_dis_diag_yb.admiss_times=a.times and zy_dis_diag_yb.dis_diag_no=1), " +

+ 1 - 0
src/main/java/thyyxxk/webserver/service/externalhttp/SiInjurySystem.java

@@ -12,6 +12,7 @@ import thyyxxk.webserver.entity.yibao.patient.Patient;
 import java.util.Map;
 
 @BaseRequest(baseURL = "http://172.16.32.163:2000/siInjury")
+//@BaseRequest(baseURL = "http://localhost:2000/siInjury")
 public interface SiInjurySystem {
 
     @Post("/getPersonBaseinfo")

+ 4 - 3
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -809,13 +809,14 @@ public class SiQueryService {
         }
         if (index.getType() == SetlType.INPATIENT.getCode()) {
             InptntSetlmtLst lst = dao.selectZySetlifo(index.getSetlId());
+            if (null == lst) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
+            }
             if (siPatInfo.getLedgerSn() > 1) {
                 Date accountdate = dao.selectAccountDate(siPatInfo.getPatNo(), siPatInfo.getTimes(), siPatInfo.getLedgerSn() - 1);
                 lst.setBegntime(accountdate);
             }
-            if (null == lst) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到此患者的结算信息!");
-            }
+            lst.setInHospdays(DateUtil.daysBetween(lst.getBegntime(), lst.getEndtime()));
             PsnIdetType psnIdetType = PsnIdetType.get(lst.getPsnIdetType());
             if (null != psnIdetType) {
                 lst.setPsnIdetTypeName(psnIdetType.getName());

+ 8 - 11
src/main/java/thyyxxk/webserver/utils/DateUtil.java

@@ -88,12 +88,14 @@ public class DateUtil {
         return enddate + " 23:59:59.999";
     }
 
-    public static Date getDatetimeAfterCentury(Date date) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.set(2000, Calendar.DECEMBER, 31, calendar.get(Calendar.HOUR_OF_DAY),
-                calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND));
-        return calendar.getTime();
+    public static int daysBetween(Date begntime,Date endtime) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(begntime);
+        long time1 = cal.getTimeInMillis();
+        cal.setTime(endtime);
+        long time2 = cal.getTimeInMillis();
+        long between_days = (time2 - time1) / (1000 * 3600 * 24);
+        return Integer.parseInt(String.valueOf(between_days));
     }
 
     public static Integer calculateAge(Date birthDate) {
@@ -134,11 +136,6 @@ public class DateUtil {
         return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
     }
 
-    public static String plusSeconds(int seconds) {
-        LocalDateTime time = LocalDateTime.now().plusSeconds(seconds);
-        return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
-    }
-
     /**
      * @param nowTime   当前时间
      * @param startTime 开始时间