From de428dd223bfc4a3b80578e8371f0915c77abaf4 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 13 五月 2026 17:25:53 +0800
Subject: [PATCH] 【市一】定时任务优化

---
 ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml                  |   18 +++++++++---------
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml                    |    2 +-
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java |    1 +
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java       |    2 +-
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
index 3c5eef3..d639291 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
@@ -115,6 +115,7 @@
             //鍚屾浣忛櫌鐥呬汉淇℃伅
             List<Map<String, Object>> syncTemp = syncList.stream().filter(row -> row.get("syncName").equals("pat_med_inhosp")).collect(Collectors.toList());
             if (syncTemp.size() > 0) {
+                log.info("startTime:" + syncTemp.get(0).get("startTime") + ", endTime: ", endTime);
                 count += syncMedInhosp(syncTemp.get(0).get("startTime") + "", endTime);
                 utilsMapper.updateSql("update sys_sync_time set startTime='" + endTime + "' where syncName='pat_med_inhosp' ");
             }
diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
index ed32dc8..bfda1d8 100644
--- a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
+++ b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
@@ -477,10 +477,10 @@
             <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if>
             <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if>
             <if test="lastStartTime != null and lastStartTime != ''">
-                and to_char(last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') >= #{lastStartTime}
+                and last_Update_Time &gt;= to_date(#{lastStartTime}, 'YYYY-MM-DD HH24:MI:SS')
             </if>
             <if test="lastEndTime != null and lastEndTime != ''">
-                and to_char(last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') &lt;= #{lastEndTime}
+                and last_Update_Time &lt;= to_date(#{lastEndTime}, 'YYYY-MM-DD HH24:MI:SS')
             </if>
             <if test="pageSize != null and pageSize!='' ">and rownum&lt;#{pageSize}</if>
 
@@ -559,16 +559,16 @@
         healthy_inhosp b
         where 1=1
             <if test="startOutHospTime != null ">
-                and to_char(b.endtime, 'YYYY-MM-DD HH24:MI:SS') &gt;=to_char(#{startOutHospTime},'YYYY-MM-DD HH24:MI:SS')
+                and b.endtime &gt;= #{startOutHospTime}
             </if>
             <if test="endOutHospTime != null ">
-                and to_char(b.endtime, 'YYYY-MM-DD HH24:MI:SS') &lt;= to_char(#{endOutHospTime},'YYYY-MM-DD HH24:MI:SS')
+                and b.endtime &lt;= #{endOutHospTime}
             </if>
             <if test="startInHospTime != null ">
-                and to_char(starttime, 'YYYY-MM-DD HH24:MI:SS') &gt;= to_char(#{startInHospTime},'YYYY-MM-DD HH24:MI:SS')
+                and starttime &gt;= #{startInHospTime}
             </if>
             <if test="endInHospTime != null ">
-                and to_char(starttime, 'YYYY-MM-DD HH24:MI:SS') &lt;=to_char(#{endInHospTime},'YYYY-MM-DD HH24:MI:SS')
+                and starttime &lt;= #{endInHospTime}
             </if>
             <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
             <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
@@ -581,10 +581,10 @@
             <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
             <if test="orgid != null ">and b.orgid = #{orgid}</if>
             <if test="lastStartTime != null and lastStartTime != ''">
-                and to_char(last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') >= #{lastStartTime}
+                and last_Update_Time &gt;= to_date(#{lastStartTime}, 'YYYY-MM-DD HH24:MI:SS')
             </if>
             <if test="lastEndTime != null and lastEndTime != ''">
-                and to_char(last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') &lt;= #{lastEndTime}
+                and last_Update_Time &lt;= to_date(#{lastEndTime}, 'YYYY-MM-DD HH24:MI:SS')
             </if>
     </select>
 
@@ -714,4 +714,4 @@
 
     </select>
 
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index d34e294..c60bd21 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -2416,7 +2416,7 @@
      * @return
      */
     @Override
-//    @Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
+    @Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
     public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
         log.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
         String groupKey = "drcode";
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index b71c096..24c2efc 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -396,7 +396,7 @@
         <if test="orgid != null and orgid != ''">
             and orgid = #{orgid}
         </if>
-        <if test="serialnum != null ">
+        <if test="serialnum != null and serialnum != ''">
             and b.serialnum = #{serialnum}
         </if>
         order by b.inhospid desc

--
Gitblit v1.9.3