From cc479e6a056785103996cc7ea67dbd5faa3e800e Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 19 十月 2026 18:07:22 +0800
Subject: [PATCH] 数据采集模块

---
 smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java                 |   59 +
 ruoyi-template/src/main/resources/mapper/template/IvrLibaTargetMapper.xml                                  |    5 
 ruoyi-common/src/main/java/com/ruoyi/common/core/service/VisitTaskCreateApi.java                           |   22 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IInhospDeptRefreshService.java         |   27 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/mapper/PatMedInhospMapper.java                       |   17 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospTaskOrchestrator.java                  |  375 +++--
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospSubtaskWriter.java                     |   43 
 ruoyi-template/src/main/resources/mapper/template/IvrTaskTemplateMapper.xml                                |    5 
 smartor/src/main/resources/mapper/smartor/PatHetaskRelevanceMapper.xml                                     |   11 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitDataService.java                      |   15 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitFacade.java                           |    7 
 ruoyi-template/src/main/java/com/ruoyi/template/domain/VO/HeLibraryCountVO.java                            |   11 
 ruoyi-quartz/pom.xml                                                                                       |   10 
 ruoyi-datacollection/pom.xml                                                                               |   72 +
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/InhospDeptRefreshServiceImpl.java |  393 +++++++
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/DefaultInhospVisitDataService.java               |    5 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/PatMedInhospVO.java                           |   15 
 smartor/src/main/resources/mapper/smartor/ServiceAppointRecordMapper.xml                                   |    5 
 ruoyi-template/src/main/java/com/ruoyi/template/domain/IvrLibaExtemplatescript.java                        |   11 
 ruoyi-admin/src/main/resources/application.yml                                                             |    2 
 ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitSubtaskDraft.java                        |   19 
 ruoyi-template/src/main/resources/mapper/template/SvyLibScriptMapper.xml                                   |   13 
 ruoyi-inhospvisit/src/main/resources/mapper/inhospvisit/PatMedInhospMapper.xml                             |  304 +++--
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml                                             |    8 
 ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java                                      |   23 
 smartor/src/main/resources/mapper/smartor/HospitalRecordMapper.xml                                         |  108 
 smartor/src/main/java/com/smartor/domain/ServiceThirdData.java                                             |   19 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionSwitch.java               |  204 +++
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/controller/InhospVisitDataController.java            |   59 +
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/DataCollectionModule.java                      |   41 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionModuleDisabledException.java |   40 
 ruoyi-outpatientvisit/src/main/java/com/ruoyi/outpatientvisit/domain/PatMedOuthosp.java                    |   13 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionFacade.java                  |   93 +
 pom.xml                                                                                                    |   16 
 ruoyi-template/src/main/resources/mapper/template/SvyTaskTemplateScriptMapper.xml                          |    4 
 ruoyi-template/src/main/resources/mapper/template/SvyTaskScriptMapper.xml                                  |    8 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionProperties.java           |   38 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/support/VisitSubtaskFactory.java                     |   13 
 smartor/src/main/resources/mapper/smartor/HospitalUserinfoMapper.xml                                       |   15 
 ruoyi-task/src/main/java/com/ruoyi/task/domain/PatTaskRelevance.java                                       |   15 
 smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java                         |   18 
 ruoyi-admin/pom.xml                                                                                        |    9 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/row/VisitInhospRow.java                       |  181 +++
 ruoyi-task/src/main/java/com/ruoyi/task/api/contract/VisitTaskCreateApiImpl.java                           |   59 +
 ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml                                         |    5 
 smartor/src/main/resources/mapper/smartor/PatMedInspectionMapper.xml                                       |    5 
 ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospVisitTaskService.java                  |    2 
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                                               |  318 +----
 ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitLongTaskDto.java                         |   94 +
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHisDataCollectionService.java         |   17 
 ruoyi-admin/src/main/resources/application-nhfy.yml                                                        |    3 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionApi.java                     |   49 
 ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/OuthospSubtaskDraft.java                      |   27 
 ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HisDataCollectionServiceImpl.java |  341 ++++++
 54 files changed, 2,659 insertions(+), 632 deletions(-)

diff --git a/pom.xml b/pom.xml
index cebbefb..9a7b82e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -248,6 +248,16 @@
                 <version>${ruoyi.version}</version>
             </dependency>
 
+            <!--
+                鏁版嵁閲囬泦妯″潡锛圚IS 閲囬泦鐨勮皟搴︾紪鎺掞紝閲囬泦瀹炵幇鍚庣画鍒嗘壒鎼叆锛夛紱
+                渚濊禆 ruoyi-common + ruoyi-system锛堝彧鍙栧弬鏁伴厤缃� API锛夛紝涓嶄緷璧� smartor銆�
+            -->
+            <dependency>
+                <groupId>com.ruoyi</groupId>
+                <artifactId>ruoyi-datacollection</artifactId>
+                <version>${ruoyi.version}</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
 
@@ -270,6 +280,12 @@
         <module>ruoyi-task</module>
         <!-- 鐢佃瘽妯″潡锛氫緷璧� ruoyi-task锛堜换鍔℃暟鎹級涓� ruoyi-template锛堟ā鏉胯瘽鏈級锛屽繀椤绘帓鍦� ruoyi-task 涔嬪悗銆乻martor 涔嬪墠 -->
         <module>ruoyi-phone</module>
+        <!--
+            鏁版嵁閲囬泦妯″潡锛氬彧渚濊禆 ruoyi-common 涓� ruoyi-system锛堝弬鏁伴厤缃� API锛夛紝
+            涓嶄緷璧� smartor 鈥斺�� HIS 閲囬泦瀹炵幇鏆傛椂鐣欏湪 smartor锛岀粡 ruoyi-common 鐨勫绾�
+            com.ruoyi.common.core.service.HisGatherApi 璋冪敤锛坰martor 渚� HisGatherApiBridge 瀹炵幇锛夈��
+        -->
+        <module>ruoyi-datacollection</module>
         <!-- smartor 渚濊禆 ruoyi-satisfaction / ruoyi-inhospvisit / ruoyi-publicity / ruoyi-outpatientvisit / ruoyi-othervisit / ruoyi-template / ruoyi-task / ruoyi-phone锛屽繀椤绘帓鏈�鍚� -->
         <module>smartor</module>
     </modules>
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 45151ee..814a4ef 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -132,6 +132,15 @@
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-phone</artifactId>
         </dependency>
+        <!--
+            鏁版嵁閲囬泦妯″潡锛圚IS 閲囬泦鐨勮皟搴︾紪鎺掞級銆�
+            鈿狅笍 鍚屾牱銆愬繀椤绘樉寮忓0鏄庛�戯細鏈ā鍧楄鎶� ruoyi-datacollection 鎵撹繘 smartor-suifang.jar锛�
+               鍚﹀垯 ruoyi-quartz 鐨勫畾鏃朵换鍔″叆鍙� ryTask.dealHisData('...') 浼氬洜缂� Bean 鑰屽け璐ャ��
+        -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-datacollection</artifactId>
+        </dependency>
         <!-- https://mvnrepository.com/artifact/net.glxn.qrgen/javase -->
         <dependency>
             <groupId>net.glxn.qrgen</groupId>
diff --git a/ruoyi-admin/src/main/resources/application-nhfy.yml b/ruoyi-admin/src/main/resources/application-nhfy.yml
index 1fa9f95..2bcb275 100644
--- a/ruoyi-admin/src/main/resources/application-nhfy.yml
+++ b/ruoyi-admin/src/main/resources/application-nhfy.yml
@@ -127,6 +127,9 @@
 #閽夐拤鐨勫瘑閽�
 dingAppid: dingn8iip5ubj7clrrsv
 dingAppSecret: qlEK8D3oOVwGPOTiBQIBYTqQVlAfy9S_qQizEQFjJdSScwemWFryg4gbneu-NqWD
+# 閽夐拤搴旂敤 agentId锛圖ingTalkServiceImpl @Value("${dingAppAgentId}") 鏃犻粯璁ゅ�硷紝缂哄け浼氬惎鍔ㄥけ璐ワ級
+# 鏆備笌涓芥按/鐪佺珛鍚屽痉淇濇寔涓�鑷达紱鍗楀崕闄勪竴鑻ョ敤鐙珛閽夐拤搴旂敤锛岃鏇挎崲涓哄畠鑷繁鐨� agentId
+dingAppAgentId: 4992829038
 
 # websocket瓒呮椂鏃堕棿
 server:
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index d16d5e2..4950217 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -75,7 +75,7 @@
     # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
     basename: i18n/messages
   profiles:
-    active: druid
+    active: sltd
 
   # 鏂囦欢涓婁紶
   servlet:
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/VisitTaskCreateApi.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/VisitTaskCreateApi.java
index dea4401..47ce863 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/VisitTaskCreateApi.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/VisitTaskCreateApi.java
@@ -152,4 +152,26 @@
      * @return true = 鑷冲皯瀛樺湪涓�鏉�
      */
     boolean existsSubtaskWithStates(Long patid, java.util.List<Long> sendstates, String serviceType);
+
+    /**
+     * 鍒ゆ柇鏌愭偅鑰呫�屽悓涓�娆″嚭鍏ラ櫌璁板綍 + 鍚屼竴涓换鍔°�嶆槸鍚�<b>宸茬粡鐢熸垚杩�</b>瀛愪换鍔°��
+     *
+     * <h3>涓轰粈涔堥渶瑕佸畠锛�2026-10 绾夸笂闂锛�</h3>
+     * 鍑洪櫌闅忚鎵弿鏄寜 {@code pat_med_inhosp.deptcheck_flag = '0'} 鍙栨偅鑰呯殑銆�
+     * 涓�鏃︽爣蹇椾綅鍥犱负瑙勫垯閰嶇疆/寮傚父娌¤鏀规垚 1 鎴� 2锛屼笅涓�杞壂鎻忎細鎶婂悓涓�涓偅鑰呭啀澶勭悊涓�閬嶏紝
+     * 鑰� {@code writeInSubTask} 鐨�"鍋滄棫"鍒嗘敮鍦� {@code endTime1 == endTime}锛堝悓涓�娆″嚭闄級鏃�
+     * 璧扮殑鏄� else 鈥斺�� <b>浼氬啀 insert 涓�鏉� sendstate=4 鐨勫仠鐢ㄨ</b>锛�
+     * 浜庢槸鍚屼竴涓偅鑰呮瘡娆¤窇鎵归兘澶氫竴鏉★紝鏈�缁堝悓涓�鎮h�呭嚑鍗佹潯瀛愪换鍔°��
+     * <p>
+     * 杩欎釜鏂规硶鏄偅閬�"鏈�鍚庨槻绾�"锛氳惤搴撳墠鎸�
+     * {@code patid + inhospid + taskid}锛堜笖 {@code del_flag = 0}锛夊垽閲嶏紝
+     * 宸插瓨鍦ㄥ氨涓嶅啀鍔犮�傚彛寰勬槸"鍚屼竴娆″嚭闄� + 鍚屼竴涓换鍔″彧搴旀湁涓�鏉″瓙浠诲姟"锛�
+     * <b>涓嶈法浣忛櫌璁板綍</b>锛堝啀娆″叆闄㈡崲浜� inhospid 浠嶄細鏂板缓锛岃繖鏄師鏈夎涔夛級銆�
+     *
+     * @param patid    鎮h�呮。妗圛D
+     * @param inhospid 鍑哄叆闄㈣褰旾D锛涗负 {@code null} 鏃堕��鍖栦负鍙湅 {@code patid + taskid}
+     * @param taskid   浠诲姟ID
+     * @return true = 宸插瓨鍦紙涓嶅簲鍐� insert锛�
+     */
+    boolean existsSubtask(Long patid, Long inhospid, Long taskid);
 }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/OuthospSubtaskDraft.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/OuthospSubtaskDraft.java
index 82f3266..a6c5feb 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/OuthospSubtaskDraft.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/OuthospSubtaskDraft.java
@@ -15,16 +15,21 @@
  *   <tr><td>{@code patArchive.telcode}锛堢┖鍒� {@code relativetelcode}锛�</td><td>{@code phone}</td></tr>
  *   <tr><td>{@code patArchive.sex} / {@code age}</td><td>{@code sex} / {@code age}</td></tr>
  *   <tr><td>{@code patMedOuthosp.id}</td><td>{@code inhospid}</td></tr>
+ *   <tr><td>{@code patMedOuthosp.outhospno}</td><td>{@code hospno}</td></tr>
  * </table>
- * 鎵�浠ユ湰绫�<b>鍙�</b>琛ヤ笁涓埗绫荤‘瀹炴病鏈夌殑瀛楁锛屼笉鍋氶噸澶嶅畾涔� 鈥斺��
+ * 鎵�浠ユ湰绫�<b>鍙�</b>琛ョ埗绫荤‘瀹炴病鏈夌殑瀛楁锛屼笉鍋氶噸澶嶅畾涔� 鈥斺��
  * 閲嶅瀹氫箟浼氳"鍝釜瀛楁鎵嶆槸鐪熸钀藉簱鐨�"鍙樺緱涓嶆竻妤氥��
+ * <p>
+ * 鈿狅笍 {@code hospno} 鍘熷厛鍙湪鏈被閲屽0鏄庯紝瀵艰嚧鍑洪櫌閾捐矾锛坽@code addSubTaskByRule}锛�
+ * 鏍规湰娌℃湁杩欎釜杞戒綋銆亄@code service_subtask.hospno} 涓�鐩磋惤绌恒��
+ * 鐜板凡涓婃彁鍒扮埗绫� {@link VisitSubtaskDraft}锛屾湰绫讳笉鍐嶉噸澶嶅0鏄庛��
  *
  * <h3>涓轰粈涔堣鍗曠嫭涓�涓被锛堣�屼笉鏄線 VisitSubtaskDraft 閲屽姞瀛楁锛�</h3>
  * {@code insertServiceSubtask} 鏈� 39 涓潯浠跺垪锛坽@code <if test="xxx != null">}锛夈��
  * 缁欏叡浜殑 {@code VisitSubtaskDraft} 鍔犲瓧娈碉紝灏卞繀椤诲悓鏃跺喅瀹�"瑕佷笉瑕佸湪
- * {@code VisitTaskCreateApiBridge#toSubtaskEntity} 閲岃ˉ鏄犲皠"鈥斺��
+ * {@code VisitTaskCreateApiImpl#toSubtaskEntity} 閲岃ˉ鏄犲皠"鈥斺��
  * 琛ヤ簡鏄犲皠浼氳<b>鍑哄叆闄㈤偅鏉″凡楠屾敹鐨勫啓鍏ヨ矾寰勫鍐欏垪</b>銆�
- * 鎵�浠ユ寜"鍙﹀缓闂ㄨ瘖涓撶敤鑽夌"澶勭悊锛歿@code VisitSubtaskDraft} 涓庡嚭鍏ラ櫌閾捐矾<b>涓�琛屼笉鍔�</b>锛�
+ * 鎵�浠ユ寜"鍙﹀缓闂ㄨ瘖涓撶敤鑽夌"澶勭悊锛氶棬璇婄嫭鏈夌殑瀛楁鏀炬湰绫伙紝
  * 妗ラ噷鐢� {@code instanceof} 鍒嗘祦鏄犲皠銆�
  *
  * @see VisitSubtaskDraft
@@ -33,14 +38,6 @@
 public class OuthospSubtaskDraft extends VisitSubtaskDraft {
 
     private static final long serialVersionUID = 1L;
-
-    /**
-     * 闂ㄨ瘖鍙凤紙鍘� {@code patMedOuthosp.outhospno} 鈫� 钀藉簱鍒� {@code service_subtask.hospno}锛夈��
-     * <p>
-     * 鈿狅笍 鐖剁被 {@link VisitSubtaskDraft} <b>娌℃湁</b> {@code hospno} 瀛楁
-     * 锛坽@code ServiceSubtask} 瀹炰綋鏈夛紝鐖剁被婕忎簡锛夛紝鎵�浠ヨ繖閲屾槸蹇呴渶鐨勮ˉ鍏呫��
-     */
-    private String hospno;
 
     /**
      * 闂ㄨ瘖灏辫瘖鏃ユ湡锛堝師 {@code patMedOuthosp.admitdate}锛夈��
@@ -87,14 +84,6 @@
      * 涓斿叏浠撴棤浜鸿鍙栧畠 鈥斺�� 涓嶈鎶婂畠涓庤繖閲岀殑 {@code hospType} 娣蜂负涓�璋堛��
      */
     private String hospType;
-
-    public String getHospno() {
-        return hospno;
-    }
-
-    public void setHospno(String hospno) {
-        this.hospno = hospno;
-    }
 
     public Date getAdmitdate() {
         return admitdate;
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitLongTaskDto.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitLongTaskDto.java
index 88aa23c..6e1bc81 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitLongTaskDto.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitLongTaskDto.java
@@ -24,6 +24,9 @@
     /** 浠诲姟鍚嶇О */
     private String taskName;
 
+    /** 浠诲姟鎻忚堪锛堣惤搴撳埌 {@code service_subtask.task_desc}锛� */
+    private String taskDesc;
+
     /** 浠诲姟绫诲瀷锛�"3" = 閫氱煡绫伙紝鍐冲畾 visitTime 鏄惁鎻愬墠 N 澶╋紝瑙佽縼绉诲墠 L1188-1203锛� */
     private String type;
 
@@ -38,6 +41,9 @@
 
     /** 璇煶妯℃澘ID锛堝師瀛楁鏄� String锛岃縼绉诲墠鐢� Long.valueOf() 杞崲锛� */
     private String libtemplateid;
+
+    /** 璇煶妯℃澘鍚嶇О锛堣惤搴撳埌 {@code service_subtask.libtemplatename}锛� */
+    private String libtemplatename;
 
     /** 鎺ㄩ��/鍙戦�佹棩鍋忕Щ澶╂暟锛堝師 sendDay锛岀己鐪佹寜 1 澶勭悊锛� */
     private Long sendDay;
@@ -56,6 +62,30 @@
 
     /** 瀹f暀妯℃澘锛堝師 preachform 鐨勫悓涔夊瓧娈碉紝缁勮鏃朵篃鍦ㄧ敤锛� */
     private String hosType;
+
+    // ------------------------------------------------------------------
+    // 浠ヤ笅 6 涓槸 DtoConversionUtils.sourceToTarget 鎷疯礉銆佷笖鍘熷疄鐜扮殑
+    // insertServiceSubtask 浼氳惤搴撶殑鍒椼�傝ˉ榻愬畠浠箣鍓嶏紝
+    // 鏂伴摼璺噷杩欎簺鍒椾細闈欓粯钀界┖锛圶ML 鏄� <if test="xxx != null">锛夈��
+    // ------------------------------------------------------------------
+
+    /** GUID锛堝師 serviceTask.guid 鈫� service_subtask.guid锛� */
+    private String guid;
+
+    /** pid锛堝師 serviceTask.pid 鏄� Integer锛岀洰鏍� ServiceSubtask.pid 鏄� Long 鈥斺�� 鎷疯礉鏃跺仛浜嗚浆鎹級 */
+    private Integer pid;
+
+    /** 鍙戦�佺被鍨嬶紙鍘� serviceTask.sendType 鏄� Long锛岀洰鏍� ServiceSubtask.sendType 鏄� String锛� */
+    private Long sendType;
+
+    /** 鏄惁宸蹭笂浼狅紙鍘� serviceTask.isupload 鈫� service_subtask.isupload锛� */
+    private Long isupload;
+
+    /** 鏂囨湰鍙傛暟锛堝師 serviceTask.textParam 鈫� service_subtask.text_param锛� */
+    private String textParam;
+
+    /** 涓婁紶鏃堕棿锛堝師 serviceTask.uploadTime 鈫� service_subtask.upload_time锛� */
+    private java.util.Date uploadTime;
 
     /** 鏇存柊浜猴紙鍘� updateBy锛岃縼绉诲墠澶氬 setUpdateBy(serviceTask.getUpdateBy())锛� */
     private String updateBy;
@@ -77,6 +107,14 @@
 
     public void setTaskName(String taskName) {
         this.taskName = taskName;
+    }
+
+    public String getTaskDesc() {
+        return taskDesc;
+    }
+
+    public void setTaskDesc(String taskDesc) {
+        this.taskDesc = taskDesc;
     }
 
     public String getType() {
@@ -117,6 +155,14 @@
 
     public void setLibtemplateid(String libtemplateid) {
         this.libtemplateid = libtemplateid;
+    }
+
+    public String getLibtemplatename() {
+        return libtemplatename;
+    }
+
+    public void setLibtemplatename(String libtemplatename) {
+        this.libtemplatename = libtemplatename;
     }
 
     public Long getSendDay() {
@@ -167,6 +213,54 @@
         this.hosType = hosType;
     }
 
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public Integer getPid() {
+        return pid;
+    }
+
+    public void setPid(Integer pid) {
+        this.pid = pid;
+    }
+
+    public Long getSendType() {
+        return sendType;
+    }
+
+    public void setSendType(Long sendType) {
+        this.sendType = sendType;
+    }
+
+    public Long getIsupload() {
+        return isupload;
+    }
+
+    public void setIsupload(Long isupload) {
+        this.isupload = isupload;
+    }
+
+    public String getTextParam() {
+        return textParam;
+    }
+
+    public void setTextParam(String textParam) {
+        this.textParam = textParam;
+    }
+
+    public java.util.Date getUploadTime() {
+        return uploadTime;
+    }
+
+    public void setUploadTime(java.util.Date uploadTime) {
+        this.uploadTime = uploadTime;
+    }
+
     public String getUpdateBy() {
         return updateBy;
     }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitSubtaskDraft.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitSubtaskDraft.java
index 811a500..7974c9c 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitSubtaskDraft.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/dto/VisitSubtaskDraft.java
@@ -58,6 +58,17 @@
     private Long inhospid;
     /** 浣忛櫌娴佹按鍙� */
     private String serialnum;
+    /**
+     * 灏辫瘖缂栧彿 鈥斺�� 钀藉簱鍒� {@code service_subtask.hospno}锛�"瀵瑰簲鐨� outhospno銆乮nhospno"锛夈��
+     * <p>
+     * 鍑洪櫌閾捐矾鐨勫彇鍊兼槸 {@code pat_med_inhosp.inhospno}锛堥棬璇婇摼璺槸
+     * {@code pat_med_outhosp.outhospno}锛岃 {@link OuthospSubtaskDraft}锛夈��
+     * <p>
+     * 鈿狅笍 杩欎釜瀛楁鍘熷厛鍙瓨鍦ㄤ簬 {@link OuthospSubtaskDraft}锛岃�屽嚭闄㈢殑
+     * {@code addSubTaskByRule} 閾捐矾浠庝笉璁惧畠 鈫� {@code service_subtask.hospno} 涓�鐩磋惤绌恒��
+     * 鐜板湪鎻愬埌鐖剁被锛屼袱鏉¢摼璺叡鐢ㄥ悓涓�涓浇浣撱��
+     */
+    private String hospno;
 
     // ==================== 鍖绘姢锛堝師 patMedInhosp锛� ====================
     /** 璐d换鎶ゅ+ID */
@@ -352,6 +363,14 @@
         this.serialnum = serialnum;
     }
 
+    public String getHospno() {
+        return hospno;
+    }
+
+    public void setHospno(String hospno) {
+        this.hospno = hospno;
+    }
+
     public String getNurseId() {
         return nurseId;
     }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
index 3de259b..1e32df9 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
@@ -215,6 +215,23 @@
     }
 
     public static String sendPostByHeader(String url, String param, Map<String, String> headers) {
+        // 涓嶈瓒呮椂锛氫笌鍘嗗彶琛屼负涓�鑷达紙鑰佽皟鐢ㄦ柟涓�涓瓧鑺傞兘涓嶅彉锛�
+        return sendPostByHeader(url, param, headers, 0, 0);
+    }
+
+    /**
+     * 甯﹁秴鏃剁殑 POST锛圝SON 鎶ユ枃澶� + 鑷畾涔� header锛夈��
+     * <p>
+     * 鈿狅笍 <b>涓轰粈涔堜細鏈夎繖涓噸杞�</b>锛氫笂闈㈢殑鑰佹柟娉�<b>娌℃湁杩炴帴/璇昏秴鏃�</b>锛�
+     * 涓�鏃﹀绔笉鍝嶅簲锛岃皟鐢ㄧ嚎绋嬩細鏃犻檺鏈熸寕浣忋�傛壒閲忔寜鎮h�呰皟鐢ㄧ殑閲囬泦
+     * 锛堝"鍦ㄩ櫌淇℃伅鍒锋柊"锛屼竴杞嚑鍗冩锛夋壙鍙椾笉璧疯繖涓闄╋紝鎵�浠ヨˉ涓�涓樉寮忚秴鏃剁殑閲嶈浇锛�
+     * 鑰佹柟娉曟敼涓哄鎵樻湰鏂规硶骞朵紶 0锛�0 = 涓嶈瓒呮椂锛夛紝琛屼负涓庢敼閫犲墠瀹屽叏涓�鑷淬��
+     *
+     * @param connectTimeoutMs 杩炴帴瓒呮椂锛堟绉掞級锛泏@code <=0} 琛ㄧず涓嶈
+     * @param readTimeoutMs    璇昏秴鏃讹紙姣锛夛紱{@code <=0} 琛ㄧず涓嶈
+     */
+    public static String sendPostByHeader(String url, String param, Map<String, String> headers,
+                                          int connectTimeoutMs, int readTimeoutMs) {
         StringBuilder result = new StringBuilder();
         HttpURLConnection conn = null;
         try {
@@ -228,6 +245,12 @@
             conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
             conn.setDoOutput(true);
             conn.setDoInput(true);
+            if (connectTimeoutMs > 0) {
+                conn.setConnectTimeout(connectTimeoutMs);
+            }
+            if (readTimeoutMs > 0) {
+                conn.setReadTimeout(readTimeoutMs);
+            }
 
             if (headers != null) {
                 for (Map.Entry<String, String> entry : headers.entrySet()) {
diff --git a/ruoyi-datacollection/pom.xml b/ruoyi-datacollection/pom.xml
new file mode 100644
index 0000000..356d710
--- /dev/null
+++ b/ruoyi-datacollection/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>ruoyi</artifactId>
+        <groupId>com.ruoyi</groupId>
+        <version>3.8.5</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ruoyi-datacollection</artifactId>
+
+    <description>
+        鏁版嵁閲囬泦妯″潡锛欻IS 鏁版嵁閲囬泦鐨勮皟搴︾紪鎺掞紙鍘� ruoyi-quartz 鐨� RyTask#dealHisData / collectSegmentData锛�
+        涓庡悗缁垎鎵规惉鍏ョ殑閲囬泦瀹炵幇锛堟柊鍗� / 娌冲崡 / 鐪佺珛鍚屽痉路鍗楀崕闄勪竴 / 鐤剧梾瀛楀吀锛夈��
+
+        渚濊禆鏂瑰悜锛歳uoyi-datacollection -> ruoyi-common锛堝绾︿笌宸ュ叿锛�
+                                    -> ruoyi-system锛坰ys_config 鎸� orgid 鐨勯厤缃煡璇紝璧� ISysConfigService 杩欎釜 API锛�
+                                    -> ruoyi-inhospvisit锛坧at_med_inhosp 鐨勫綊灞炴ā鍧楋細
+                                       鍦ㄩ櫌淇℃伅鍒锋柊鍙栧�欓�� + 鍐欏洖浣嶇疆锛屽彧缁忓叾 api 鍖呯殑闂ㄩ潰/鏁版嵁濂戠害锛�
+        銆愪笉渚濊禆 smartor銆戯細閲囬泦瀹炵幇鐩墠浠嶅湪 smartor锛屾寜銆岃法妯″潡鏁版嵁璁块棶鍘熷垯銆�
+        锛坉oc/璺ㄦā鍧楁暟鎹闂師鍒欎笌鏀跺彛鏂规.md锛夌粡 ruoyi-common 鐨�
+        com.ruoyi.common.core.service.HisGatherApi 濂戠害璋冪敤锛宻martor 渚х敤绾浆鍙� Bridge 瀹炵幇銆�
+        閲囬泦瀹炵幇鎸夋壒鎼繘鏈ā鍧楀悗锛屽绾︽柟娉曢殢涔嬪垹闄わ紙瑙� doc/鏁版嵁閲囬泦妯″潡鍖朹璋冪爺涓庡疄鏂芥柟妗�.md锛夈��
+
+        鏈ā鍧楁棤鍙闂殑 HTTP 绔偣锛屽紑鍏充綔鐢ㄧ偣鍦ㄩ棬闈� com.ruoyi.datacollection.api.DataCollectionFacade銆�
+        鏀寔閫氳繃 sys_config 鍙傛暟琛ㄩ噷鐨� datacollection.enabled 鏁翠綋鍋滈噰锛堣繍琛屾椂璇诲彇锛屾敼瀹屾渶澶� 10 绉掔敓鏁堬級銆�
+    </description>
+
+    <dependencies>
+        <!-- 閫氱敤宸ュ叿锛歋tringUtils / 濂戠害 HisGatherApi / 濂戠害 DTO SltdGatherReq -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-common</artifactId>
+        </dependency>
+
+        <!--
+            绯荤粺妯″潡锛氬彧鐢ㄥ埌瀹冪殑鍙傛暟閰嶇疆鏈嶅姟 API 鈥斺��
+              路 com.ruoyi.system.service.ISysConfigService#selectConfigList(SysConfig)
+                锛堥噰闆嗙紪鎺掕鎸� config_key + orgid 璇� sltd.gather.sysuser / sltd.gather.campusid锛�
+                 涓庢惉杩愬墠鐨勮皟鐢ㄥ畬鍏ㄤ竴鑷达紝鍚� LIKE 鍖归厤璇箟锛屾晠涓嶆敼鎴� selectConfigByKey 浠ュ厤鏀瑰彉琛屼负锛�
+              路 com.ruoyi.system.domain.SysConfig
+            ruoyi-system 鍙緷璧� ruoyi-common / ruoyi-message锛屼笉浼氫笌鏈ā鍧楀舰鎴愬惊鐜緷璧栥��
+        -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-system</artifactId>
+        </dependency>
+
+        <!--
+            鍑哄叆闄㈤殢璁挎ā鍧楋細鍙敤鍒板畠 api 鍖呯殑涓や釜鑳藉姏 鈥斺��
+              路 com.ruoyi.inhospvisit.api.InhospVisitFacade#selectInhospRefreshCandidates(String)
+                锛堝湪闄俊鎭埛鏂扮殑鍙栨暟锛氬彧鏌� pat_med_inhosp 鑷韩銆佸彧鍙栦綅缃浉鍏冲垪锛�
+              路 com.ruoyi.inhospvisit.api.InhospVisitDataService#updatePatMedInhosp(PatMedInhosp)
+                锛�"浼犱粈涔堟敼浠�涔�"鐨勪綅缃啓鍥烇紱涓嶇洿鎺ユ敞鍏ヨ妯″潡鐨� Mapper锛�
+            渚濊禆鏂瑰悜鏃犵幆锛歳uoyi-inhospvisit 鍙緷璧� ruoyi-common锛屼笉渚濊禆鏈ā鍧椼��
+        -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-inhospvisit</artifactId>
+        </dependency>
+
+        <!-- lombok锛歳uoyi-common 閲屾槸鐩存帴渚濊禆锛屾澶勬樉寮忓0鏄庣増鏈紝閬垮厤娉ㄨВ澶勭悊鍣ㄧ己澶� -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.34</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/DataCollectionModule.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/DataCollectionModule.java
new file mode 100644
index 0000000..c0e983f
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/DataCollectionModule.java
@@ -0,0 +1,41 @@
+package com.ruoyi.datacollection;
+
+/**
+ * 鏁版嵁閲囬泦妯″潡鍖呮牴銆�
+ *
+ * <h3>杩欎釜妯″潡瑁呬簡浠�涔堬紙闃舵 1 路 鏈锛�</h3>
+ * <ul>
+ *   <li>{@code service} 鈥斺�� HIS 鏁版嵁閲囬泦鐨�<b>璋冨害缂栨帓</b>锛氬師 {@code ruoyi-quartz} 閲�
+ *       {@code RyTask#dealHisData(String)} + 绉佹湁甯墜 {@code collectSegmentData(...)}
+ *       鍘熸牱鎼潵锛岄�昏緫涓�琛屾湭鏀癸紙鍚垎绔欑偣鍒嗘敮銆�30 澶╁垎娈靛洖婧�佹棩蹇楁枃妗堬級锛�</li>
+ *   <li>{@code config} 鈥斺�� 妯″潡寮�鍏筹紙{@code sys_config: datacollection.enabled}锛岄粯璁� true锛宖ail-open锛夛紱</li>
+ *   <li>{@code api} 鈥斺�� <b>鍞竴瀵瑰鍖�</b>锛氬叾瀹冩ā鍧楀彧鑳界粡 {@code DataCollectionFacade} 璋冩湰妯″潡銆�</li>
+ * </ul>
+ *
+ * <h3>鏁版嵁璁块棶杈圭晫</h3>
+ * 鏈ā鍧�<b>鍒绘剰涓嶅甫 Mapper / XML</b>锛氱紪鎺掑彧鍋�"浣曟椂閲囥�侀噰鍝釜闄㈠尯銆侀噰鍝鏃堕棿"锛�
+ * 鐪熸鐨勯噰闆嗗姩浣滅敱濂戠害 {@code com.ruoyi.common.core.service.HisGatherApi} 鎵挎帴锛�
+ * 褰撳墠瀹炵幇鍦� smartor锛坽@code HisGatherApiBridge}锛岀函杞彂鍒版棦鏈� Service锛夈��
+ * 杩欐牱鏂版ā鍧椾笉蹇呬緷璧� smartor锛屼篃灏变笉浼氭妸"妯″潡鍖�"鍊掗��鍥炲崟浣撱��
+ *
+ * <h3>闃舵 2 / 3锛堝悗缁壒娆★級</h3>
+ * 閲囬泦瀹炵幇鎸夋壒鎼繘鏈ā鍧楋紙XH/HN 涓�鎵广�丼LTD 涓�鎵癸級锛屾瘡鎼竴鎵瑰氨鎶�
+ * {@code HisGatherApi} 瀵瑰簲鏂规硶鍒犳帀锛涘叏閮ㄦ惉瀹屾椂濂戠害涓� smartor 鐨� Bridge 涓�璧峰垹闄ゃ��
+ * 鍚勬壒鐨勪緷璧栫洏鐐广�侀渶瑕佺殑璺ㄦā鍧楀绾︺�侀闄╃偣瑙�
+ * {@code doc/鏁版嵁閲囬泦妯″潡鍖朹璋冪爺涓庡疄鏂芥柟妗�.md}銆�
+ *
+ * <h3>寮�鍏�</h3>
+ * {@code sys_config: datacollection.enabled}锛堥粯璁� true锛夛細鍏抽棴鍚�
+ * {@code DataCollectionFacade#dealHisData} 鎶� {@code DataCollectionModuleDisabledException}锛�
+ * 鐢辫皟鐢ㄦ柟锛坽@code RyTask}锛夋槑纭檷绾у苟鎵� WARN 鈥斺�� 涓嶉潤榛樿烦杩囷紝涔熶笉闈欓粯缁х画閲囥��
+ */
+public final class DataCollectionModule {
+
+    /**
+     * 妯″潡閰嶇疆鍓嶇紑锛堜粎浣滀负 yml 鍏滃簳閰嶇疆鐨勯敭鍓嶇紑锛涗富寮�鍏冲湪 sys_config 鍙傛暟琛ㄩ噷锛�
+     */
+    public static final String PROPERTIES_PREFIX = "datacollection";
+
+    private DataCollectionModule() {
+    }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionApi.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionApi.java
new file mode 100644
index 0000000..701c54c
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionApi.java
@@ -0,0 +1,49 @@
+package com.ruoyi.datacollection.api;
+
+/**
+ * 鏁版嵁閲囬泦妯″潡鐨勫澶栧绾︼紙<b>鍏跺畠妯″潡鍞竴鍏佽渚濊禆鐨勭被鍨�</b>锛夈��
+ * <p>
+ * 瀹炵幇鏄湰妯″潡鐨勫父椹婚棬闈� {@link DataCollectionFacade}銆�
+ *
+ * <h3>绾﹀畾锛堢収鎶勫叾瀹冩ā鍧楃殑 api 濂戠害绾緥锛�</h3>
+ * <ul>
+ *   <li><b>鍙毚闇插熀鏈被鍨�</b>锛屼笉鏆撮湶鏈ā鍧楀唴閮� Service / domain锛�</li>
+ *   <li>闂ㄩ潰<b>姘歌繙瀛樺湪</b>锛岃皟鐢ㄦ柟鐨� {@code @Autowired} 涓嶄細鍥犲紑鍏崇姸鎬佽�屽惎鍔ㄥけ璐ワ紱</li>
+ *   <li>妯″潡琚叧闂椂<b>鎶� {@link DataCollectionModuleDisabledException}</b>
+ *       锛堣�屼笉鏄潤榛樿繑鍥烇級锛氶噰闆嗘槸"鏁版嵁杩涗笉鏉�"鐨勯摼璺紝
+ *       闈欓粯璺宠繃涓�"鏈潵灏辨病鏁版嵁"鍒嗕笉寮�锛屾帓鏌ユ椂鏈�鎬曡繖涓��</li>
+ * </ul>
+ */
+public interface DataCollectionApi {
+
+    /**
+     * 妯″潡鏄惁鍙敤锛堝紑鍏虫墦寮�锛�
+     * <p>
+     * 鈿狅笍 杩欐槸<b>鏌ヨ寮�鍏崇姸鎬�</b>鐨勬柟娉曪紝鍒绘剰涓嶅彈瀹堝崼锛氳皟鐢ㄦ柟闇�瑕佸畠鏉ラ鍒わ紝
+     * 濡傛灉瀹冧篃鎶涘紓甯稿氨鑷垜鐭涚浘浜嗐��
+     */
+    boolean isEnabled();
+
+    /**
+     * HIS 鏁版嵁閲囬泦锛堝師 {@code RyTask#dealHisData(String)}锛夛細
+     * 鎸� {@code spring.profiles.active} 鍒嗙珯鐐归噰闆嗘柊鍗� / 娌冲崡 / 鐪佺珛鍚屽痉锛堝崡鍗庨檮涓�锛夌殑
+     * 鍑哄叆闄€�侀鍏ラ櫌銆佸嚭闄笌鍖婚櫌鐢ㄦ埛/閮ㄩ棬淇℃伅銆�
+     *
+     * @param todayZeroStr 閲囬泦鍩哄噯鏃堕棿 {@code yyyy-MM-dd HH:mm:ss}锛�
+     *                     涓虹┖鏃跺彇"浠婂ぉ 00:00"锛岄噰闆嗚寖鍥存槸 {@code [鍩哄噯-1澶�, 鍩哄噯)}銆�
+     *                     nhfy / sltd 绔欑偣鍦ㄥ叆鍙傞潪绌烘椂浼氶澶栧仛 30 澶╁垎娈靛洖婧噰闆嗐��
+     * @throws DataCollectionModuleDisabledException 妯″潡琚叧闂紙{@code datacollection.enabled=false}锛�
+     */
+    void dealHisData(String todayZeroStr);
+
+    /**
+     * 鍦ㄩ櫌鎮h��"绉戝 / 鐥呭尯 / 搴婁綅"鍒锋柊锛堝崡鍗庨檮涓�锛屾瘡澶╀竴娆″叏閲忔牳瀵癸級锛�
+     * 鎸夋偅鑰呮煡 HIS 鐨勮浆绉戣褰曘�佸彇鏈�鏂颁竴娈碉紝涓� {@code pat_med_inhosp} 姣斿鍚庡彧鍐欏彉鍖栫殑瀛楁銆�
+     * <p>
+     * 骞傜瓑锛屽彲閲嶅瑙﹀彂锛涚珯鐐逛笉鏄� {@code nhfy} 鏃朵笉鍋氫换浣曚簨骞惰繑鍥� 0銆�
+     *
+     * @return 瀹為檯鍙戠敓鏇存柊鐨勮褰曟潯鏁�
+     * @throws DataCollectionModuleDisabledException 妯″潡琚叧闂紙{@code datacollection.enabled=false}锛�
+     */
+    int refreshInhospDeptInfo();
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionFacade.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionFacade.java
new file mode 100644
index 0000000..0f7c165
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionFacade.java
@@ -0,0 +1,93 @@
+package com.ruoyi.datacollection.api;
+
+import com.ruoyi.datacollection.config.DataCollectionSwitch;
+import com.ruoyi.datacollection.service.IHisDataCollectionService;
+import com.ruoyi.datacollection.service.IInhospDeptRefreshService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 鏁版嵁閲囬泦妯″潡瀵瑰闂ㄩ潰锛�<b>甯搁┗ Bean</b>锛夆�斺�� 鍏跺畠妯″潡瑙﹀彂 HIS 閲囬泦鐨勫敮涓�鍏ュ彛銆�
+ *
+ * <h3>涓轰粈涔堝繀椤�"甯搁┗"</h3>
+ * 鏈棬闈�<b>姘歌繙</b>鏄� Spring Bean锛屼笉闅忓紑鍏崇姸鎬佸鍒犮�傝皟鐢ㄦ柟锛坽@code RyTask}锛夌殑
+ * {@code @Autowired} 鍥犳涓嶄細鍦ㄤ换浣曞紑鍏崇姸鎬佷笅鍚姩澶辫触 鈥斺��
+ * 涓� {@code TaskFacade} / {@code PhoneFacade} / {@code TemplateFacade} 鏄悓涓�鏉¤璁$害鏉�
+ * 锛堝巻鍙叉暀璁細鐢� {@code @ConditionalOnProperty} 鎽� Bean 浼氳璋冪敤鏂瑰惎鍔ㄥ嵆澶辫触锛�
+ * 涓斿彧鍦ㄥ惎鍔ㄦ椂姹傚�间竴娆★紝鍋氫笉鍒�"鏀瑰畬鍙傛暟 10 绉掔敓鏁�"锛夈��
+ *
+ * <h3>鈿狅笍 鍏抽棴鏃讹細鎶涘紓甯革紝鑰屼笉鏄潤榛樿烦杩�</h3>
+ * 妯″潡鍏抽棴锛坽@code sys_config: datacollection.enabled=false}锛夋椂锛�
+ * {@link #dealHisData(String)} 鍏堣繃 {@link #requireEnabled()}锛屾姏
+ * {@link DataCollectionModuleDisabledException}锛�
+ * <ul>
+ *   <li><b>涓轰粈涔堜笉鐢�"鎵撴潯 WARN 灏辫繑鍥�"</b>锛氶噰闆嗘槸"鏁版嵁杩涗笉鏉�"鐨勯摼璺��
+ *       闈欓粯璺宠繃浼氳"妯″潡琚叧鎺�"鍜�"杩欒疆鏈潵灏辨病鏁版嵁"鍐嶄篃鍒嗕笉寮� 鈥斺��
+ *       绛夊彂鐜版紡鏁版嵁鏃讹紝鏃ュ織閲屽凡缁忚繃鍘诲嚑鍗冭疆锛屾棤浠庡垽鏂紱</li>
+ *   <li><b>璋冪敤鏂瑰繀椤婚厤闄嶇骇</b>锛氭湰闂ㄩ潰鐨勮皟鐢ㄧ偣鏄畾鏃朵换鍔�
+ *       {@code RyTask#dealHisData}锛屽畠鎹曡幏鏈紓甯稿苟鎵� WARN锛堟湰杞槑纭烦杩囷級锛�
+ *       瑙� {@code doc/鏁版嵁閲囬泦妯″潡鍖朹璋冪爺涓庡疄鏂芥柟妗�.md} 搂5銆�</li>
+ * </ul>
+ *
+ * <h3>鈿狅笍 渚嬪锛歿@link #isEnabled()} 涓嶅彈瀹堝崼</h3>
+ * 瀹冩湰韬氨鏄煡寮�鍏崇姸鎬佺敤鐨勶紱濡傛灉瀹冧篃鎶涘紓甯革紝"寮�鍏虫槸涓嶆槸鍏崇潃"灏卞啀涔熼棶涓嶅嚭鏉ヤ簡銆�
+ */
+@Slf4j
+@Component
+public class DataCollectionFacade implements DataCollectionApi {
+
+    /**
+     * 杩愯鏃跺紑鍏筹紙{@code sys_config} 浼樺厛锛寉ml 鍏滃簳锛�
+     */
+    @Autowired
+    private DataCollectionSwitch dataCollectionSwitch;
+
+    /**
+     * 妯″潡鍐呭疄鐜帮紙鍞竴瀹炵幇 {@code HisDataCollectionServiceImpl}锛�
+     */
+    @Autowired
+    private IHisDataCollectionService hisDataCollectionService;
+
+    /**
+     * 妯″潡鍐呭疄鐜帮紙鍞竴瀹炵幇 {@code InhospDeptRefreshServiceImpl}锛夛細
+     * 鍦ㄩ櫌鎮h�呯殑绉戝/鐥呭尯/搴婁綅姣忔棩鍒锋柊
+     */
+    @Autowired
+    private IInhospDeptRefreshService inhospDeptRefreshService;
+
+    /**
+     * 妯″潡鏄惁鍚敤锛坽@code sys_config: datacollection.enabled}锛岃繍琛屾椂鐑锛�
+     * <p>
+     * 鈿狅笍 <b>鍒绘剰涓嶅彈瀹堝崼</b>锛氳绫绘敞閲娿��
+     */
+    @Override
+    public boolean isEnabled() {
+        return dataCollectionSwitch.isEnabled();
+    }
+
+    @Override
+    public void dealHisData(String todayZeroStr) {
+        requireEnabled();
+        hisDataCollectionService.dealHisData(todayZeroStr);
+    }
+
+    @Override
+    public int refreshInhospDeptInfo() {
+        requireEnabled();
+        return inhospDeptRefreshService.refreshInhospDeptInfo();
+    }
+
+    /**
+     * 闂ㄩ潰鏁版嵁鏂规硶鐨勭粺涓�鍏ュ彛瀹堝崼锛氭ā鍧楀叧闂椂鎶�
+     * {@link DataCollectionModuleDisabledException}锛岀敱璋冪敤鏂瑰喅瀹氬浣曢檷绾с��
+     */
+    private void requireEnabled() {
+        if (!dataCollectionSwitch.isEnabled()) {
+            log.warn("銆愭暟鎹噰闆嗐�戞ā鍧楀凡鍏抽棴锛堝弬鏁伴厤缃� {} = false锛夛紝鎷掔粷闂ㄩ潰璁块棶",
+                    DataCollectionSwitch.CONFIG_KEY);
+            throw new DataCollectionModuleDisabledException(
+                    DataCollectionModuleDisabledException.DISABLED_MESSAGE);
+        }
+    }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionModuleDisabledException.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionModuleDisabledException.java
new file mode 100644
index 0000000..8743b5e
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/api/DataCollectionModuleDisabledException.java
@@ -0,0 +1,40 @@
+package com.ruoyi.datacollection.api;
+
+/**
+ * 鏁版嵁閲囬泦妯″潡琚叧闂紙{@code sys_config: datacollection.enabled=false}锛夋椂锛�
+ * 闂ㄩ潰璋冪敤鎶涘嚭鐨勫紓甯搞��
+ *
+ * <h3>涓轰粈涔堥渶瑕佸畠锛堣�屼笉鏄鐢� {@code ServiceException}锛�</h3>
+ * {@code ServiceException} 鏄� <b>final</b> 鐨勶紙瑙� {@code com.ruoyi.common.exception.ServiceException}锛夛紝
+ * 鏃笉鑳界户鎵裤�佷篃娌℃湁瀹炵幇浠讳綍鎺ュ彛锛屽洜姝ゆ棤娉�"绮剧‘鎹曡幏"銆�
+ * 璋冪敤鏂癸紙{@code ruoyi-quartz} 鐨� {@code RyTask}锛夐渶瑕佹妸
+ * <b>"妯″潡琚叧鎺�"</b>鍜�<b>"閲囬泦杩囩▼鐪熺殑鎶ラ敊"</b>鍖哄垎寮�锛�
+ * 鍓嶈�呭彧鎵撲竴鏉� WARN 璇存槑鏈疆璺宠繃锛屽悗鑰呰鎸夊師鏈夐敊璇彛寰勮褰� 鈥斺��
+ * 鐢� {@code ServiceException} 鎴栨瘮瀵� message 鏂囨湰閮戒細澶卞噯銆�
+ *
+ * <h3>涓轰粈涔堟斁鍦ㄦā鍧楃殑 api 鍖咃紝鑰屼笉鏄� ruoyi-common</h3>
+ * 妯℃澘妯″潡鎶� {@code TemplateModuleDisabledException} 鏀捐繘 ruoyi-common锛�
+ * 鏄洜涓哄畠鐨勮皟鐢ㄧ偣鏁e湪 4 涓ā鍧楅噷銆傛湰妯″潡鐩墠鍙湁 {@code ruoyi-quartz} 涓�涓皟鐢ㄦ柟锛�
+ * 鑰� {@code ruoyi-quartz} 宸茬粡渚濊禆鏈ā鍧楋紝鎵�浠ユ斁鍦� {@code api} 鍖呭嵆鍙紙api 鏄湰妯″潡鍞竴瀵瑰鍖咃級銆�
+ * 灏嗘潵鑻ュ嚭鐜颁笉渚濊禆鏈ā鍧楃殑璋冪敤鏂癸紝鍐嶄笅娌夊埌 ruoyi-common銆�
+ *
+ * @see DataCollectionFacade#requireEnabled()
+ */
+public class DataCollectionModuleDisabledException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 鍏抽棴鎻愮ず锛堜笌 {@code sys_config} 閲岄偅琛岄厤缃殑 remark 鍙e緞涓�鑷达級
+     */
+    public static final String DISABLED_MESSAGE =
+            "鏁版嵁閲囬泦妯″潡鏈惎鐢紙鍙傛暟閰嶇疆 datacollection.enabled=false锛夛紝鏈閲囬泦宸茶烦杩�";
+
+    public DataCollectionModuleDisabledException(String message) {
+        super(message);
+    }
+
+    public DataCollectionModuleDisabledException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionProperties.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionProperties.java
new file mode 100644
index 0000000..5aacec0
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionProperties.java
@@ -0,0 +1,38 @@
+package com.ruoyi.datacollection.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 鏁版嵁閲囬泦妯″潡鐨� yml 閰嶇疆锛�<b>浠呬綔鍏滃簳锛屼笉鏄富寮�鍏�</b>锛夈��
+ *
+ * <h3>鈿狅笍 涓诲紑鍏充笉鍦ㄨ繖閲�</h3>
+ * 涓诲紑鍏虫槸 {@code sys_config} 鍙傛暟閰嶇疆琛ㄩ噷鐨� {@code datacollection.enabled}锛�
+ * 鐢� {@link DataCollectionSwitch} <b>杩愯鏃剁儹璇�</b>锛堣繘绋嬪唴 10 绉掔紦瀛橈紝鏀瑰畬鏈�澶� 10 绉掔敓鏁堬級銆�
+ * 鏈被鍙湪銆宻ys_config 閲屾病鏈夐偅涓�琛屻�嶆垨銆岄潪 Spring 鐜鍙栦笉鍒伴厤缃湇鍔°�嶆椂鍏滃簳銆�
+ *
+ * <h3>涓轰粈涔堥粯璁� true</h3>
+ * 涓庝换鍔�/鐢佃瘽/妯℃澘妯″潡鍚屾鍙e緞锛�<b>鍙傛暟琛岀己澶辨椂鎸夊惎鐢ㄥ鐞�</b>銆�
+ * HIS 閲囬泦鏄�"鏁版嵁杩涗笉鏉�"鐨勯摼璺紝鑻ュ洜涓哄簱閲屽皯涓�琛岄厤缃氨榛樿鍋滈噰锛�
+ * 鍑洪棶棰樻椂鏄�<b>闈欓粯灏戞暟鎹�</b>锛屾瘮澶氶噰涓�杞毦鏌ュ緱澶氥�傝鍋滈噰璇峰埌
+ * 銆岀郴缁熺鐞� 鈫� 鍙傛暟璁剧疆銆嶆樉寮忔妸 {@code datacollection.enabled} 璁句负 false銆�
+ *
+ * <h3>yml 鍏滃簳鍐欐硶锛堜竴鑸笉蹇呰锛�</h3>
+ * <pre>
+ * datacollection:
+ *   enabled: false
+ * </pre>
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "datacollection")
+public class DataCollectionProperties {
+
+    /**
+     * 鏄惁鍚敤鏁版嵁閲囬泦妯″潡锛堥粯璁ゅ惎鐢級銆�
+     * <p>
+     * 浠呭綋 {@code sys_config} 涓病鏈� {@code datacollection.enabled} 鏃剁敓鏁堬紝瑙� {@link DataCollectionSwitch}銆�
+     */
+    private boolean enabled = true;
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionSwitch.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionSwitch.java
new file mode 100644
index 0000000..751ae56
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/config/DataCollectionSwitch.java
@@ -0,0 +1,204 @@
+package com.ruoyi.datacollection.config;
+
+import com.ruoyi.common.core.service.IConfigService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 鏁版嵁閲囬泦妯″潡<b>鎬诲紑鍏�</b>锛氬�煎瓨鏀惧湪 {@code sys_config} 鍙傛暟閰嶇疆琛ㄤ腑锛�<b>杩愯鏃惰鍙栥�佸彲鐑垏鎹�</b>銆�
+ *
+ * <h3>鍙傛暟閰嶇疆</h3>
+ * <pre>
+ * 鍙傛暟閿悕锛歞atacollection.enabled
+ * 鍙傛暟閿�硷細true  = 鍚敤锛堥粯璁わ紝绛変环浜庝笉閰嶇疆杩欎竴琛岋級
+ *          false = 鍋滈噰
+ * </pre>
+ * 浣嶇疆锛氱郴缁熺鐞� 鈫� 鍙傛暟璁剧疆 鈫� 鏂板/淇敼銆�
+ * <pre>
+ * insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, remark)
+ * values ('鏁版嵁閲囬泦妯″潡寮�鍏�', 'datacollection.enabled', 'true', 'Y', 'admin', sysdate(), 'true鍚敤锛宖alse鍋滈噰锛堥粯璁rue锛�');
+ * </pre>
+ *
+ * <h3>鍙栧�间紭鍏堢骇</h3>
+ * <ol>
+ *   <li>{@code sys_config} 閲� {@code datacollection.enabled} 鐨勫�硷紙<b>涓荤敤</b>锛�
+ *       鏉ヨ嚜 {@code IConfigService} 鎺ュ彛锛屽疄鐜板湪 ruoyi-system 鐨� {@code SysConfigServiceImpl}锛夛紱</li>
+ *   <li>{@link DataCollectionProperties#isEnabled()}锛�<b>鍏滃簳</b>锛氫粎褰� sys_config 閲屾病鏈夎繖涓�琛屻��
+ *       鎴栭潪 Spring 鐜鍙栦笉鍒伴厤缃湇鍔℃椂浣跨敤锛岄粯璁� true锛夈��</li>
+ * </ol>
+ *
+ * <h3>涓轰粈涔堣涓嶅埌閰嶇疆鏃舵寜 true锛坒ail-open锛�</h3>
+ * 璇� {@code sys_config} 闇�瑕佽蛋鏁版嵁搴擄紝鏁版嵁搴撴姈鍔ㄦ椂濡傛灉 fail-closed锛�
+ * 缁撴灉灏辨槸"鏁版嵁搴撴姈涓�涓嬶紝褰撳ぉ HIS 鏁版嵁鍏ㄩ兘涓嶉噰浜�" 鈥斺�� 闈欓粯灏戞暟鎹��
+ * 杩欓噷鍙墦 WARN 骞舵斁琛屻�傝鍋滈噰蹇呴』鏄惧紡閰嶇疆 false銆�
+ *
+ * <h3>涓轰粈涔堟湁 10 绉掔紦瀛�</h3>
+ * {@code SysConfigServiceImpl#selectConfigByKey} 褰撳墠姣忔閮芥煡搴擄紝鑰屾湰寮�鍏冲湪姣忚疆瀹氭椂閲囬泦
+ * 寮�濮嬫椂閮戒細琚鍒般�傝繖閲屽姞涓�涓繘绋嬪唴 TTL 缂撳瓨锛屾妸鏌ュ簱闄嶅埌"姣忎釜瀹炰緥姣� 10 绉掓渶澶氫竴娆�"銆�
+ * 浠d环鏄弬鏁版敼鍔ㄦ渶澶� 10 绉掔敓鏁堬紙澶氬疄渚嬮儴缃叉椂鍚勮嚜璁℃椂锛夈��
+ */
+@Slf4j
+@Component
+public class DataCollectionSwitch {
+
+    /**
+     * sys_config 閲岀殑鍙傛暟閿悕
+     */
+    public static final String CONFIG_KEY = "datacollection.enabled";
+
+    /**
+     * 杩涚▼鍐呯紦瀛樻湁鏁堟湡锛堟绉掞級
+     */
+    private static final long CACHE_TTL_MILLIS = 10_000L;
+
+    private final DataCollectionProperties properties;
+
+    /**
+     * 鍙傛暟閰嶇疆鏈嶅姟锛坮uoyi-common 鐨勬帴鍙o紝瀹炵幇鍦� ruoyi-system锛夈��
+     * <p>
+     * 鐢� {@code ObjectProvider} 鎯版�у彇锛氶潪 Spring 鐜/鐙珛閮ㄧ讲绛�"瀹瑰櫒閲屾病鏈夊疄鐜�"鐨勫満鏅笅
+     * 涓嶈兘鍥犳鍚姩澶辫触銆�
+     */
+    private final ObjectProvider<IConfigService> configServiceProvider;
+
+    /**
+     * 鏈�杩戜竴娆¤В鏋愮粨鏋�
+     */
+    private volatile Boolean cachedEnabled;
+
+    /**
+     * 鏈�杩戜竴娆¤В鏋愮殑鏃堕棿鎴�
+     */
+    private volatile long cachedAt;
+
+    /**
+     * Spring 浣跨敤鐨勬瀯閫犲櫒銆�
+     * <p>
+     * 鈿狅笍 <b>蹇呴』鏄惧紡鏍囨敞 {@code @Autowired}</b>锛氭湰绫绘湁涓や釜鍏紑鏋勯�犲櫒
+     * 锛堝彟涓�涓粰娴嬭瘯/闈� Spring 鐜鐢級锛屼笉鏍囨敞鐨勮瘽 Spring 浼氬洜"鏋勯�犲櫒涓嶅敮涓�"
+     * 閫�鍥炴煡鎵炬棤鍙傛瀯閫犲櫒锛屽惎鍔ㄥ嵆鎶� {@code No default constructor found}銆�
+     * 璇ヨ鍒欏凡鐢� {@code sql/_probe/verify_spring_beans.py} 闈欐�佹妸鍏炽��
+     */
+    @Autowired
+    public DataCollectionSwitch(DataCollectionProperties properties,
+                                ObjectProvider<IConfigService> configServiceProvider) {
+        this.properties = properties;
+        this.configServiceProvider = configServiceProvider;
+    }
+
+    /**
+     * 渚�<b>娴嬭瘯/闈� Spring 鐜</b>鐩存帴鏋勯�狅細{@code configValue} 灏辨槸 sys_config 閲岀殑閿�硷紝
+     * 浼� {@code null} 琛ㄧず"鍙傛暟琛屼笉瀛樺湪"锛堟鏃跺洖钀藉埌 {@link DataCollectionProperties}锛夈��
+     */
+    public DataCollectionSwitch(DataCollectionProperties properties, final String configValue) {
+        this(properties, new FixedProvider(configValue));
+        // 闈� Spring 鐜涓嬫病鏈�"鏀归厤缃悗绛� 10 绉�"鐨勬蹇碉紝鐩存帴绂佺敤缂撳瓨锛屼繚璇佹柇瑷�鍗虫椂鍙
+        this.cachedEnabled = resolve();
+        this.cachedAt = System.currentTimeMillis() + CACHE_TTL_MILLIS * 1000L;
+    }
+
+    /**
+     * 鏁版嵁閲囬泦妯″潡鏄惁鍚敤锛堣繍琛屾椂鐑锛屾渶澶� 10 绉掑欢杩燂級
+     */
+    public boolean isEnabled() {
+        long now = System.currentTimeMillis();
+        Boolean cached = this.cachedEnabled;
+        if (cached != null && now - this.cachedAt < CACHE_TTL_MILLIS) {
+            return cached;
+        }
+        boolean resolved = resolve();
+        this.cachedEnabled = resolved;
+        this.cachedAt = now;
+        return resolved;
+    }
+
+    /**
+     * 娓呮帀杩涚▼鍐呯紦瀛橈紝涓嬫璋冪敤绔嬪嵆閲嶆柊璇� sys_config锛堜緵娴嬭瘯/闇�瑕佺珛鍗崇敓鏁堢殑鍦烘櫙锛�
+     */
+    public void invalidateCache() {
+        this.cachedEnabled = null;
+    }
+
+    /**
+     * 瑙f瀽褰撳墠寮�鍏冲�硷細sys_config 浼樺厛锛屽叾娆� yml 鍏滃簳
+     */
+    private boolean resolve() {
+        String value = readFromSysConfig();
+        if (value != null) {
+            if (!"true".equalsIgnoreCase(value) && !"false".equalsIgnoreCase(value)) {
+                log.warn("銆愭暟鎹噰闆嗐�憇ys_config 涓� {} 鐨勫�间笉鏄� true/false锛堝疄闄�=銆寋}銆嶏級锛屽皢鎸夈�屼笉鏄� false 鍗冲惎鐢ㄣ�嶅鐞�",
+                        CONFIG_KEY, value);
+            }
+            boolean enabled = !"false".equalsIgnoreCase(value);
+            log.debug("銆愭暟鎹噰闆嗐�戝紑鍏冲彇鑷� sys_config锛歿}={} -> enabled={}", CONFIG_KEY, value, enabled);
+            return enabled;
+        }
+        boolean enabled = properties.isEnabled();
+        log.debug("銆愭暟鎹噰闆嗐�憇ys_config 涓湭閰嶇疆 {}锛屽洖钀� datacollection.enabled={}", CONFIG_KEY, enabled);
+        return enabled;
+    }
+
+    /**
+     * 璇� sys_config 鐨勫師濮嬮敭鍊硷紱娌℃湁瀹炵幇銆佹病鏈夎繖涓�琛屻�佹垨璇诲簱澶辫触閮借繑鍥� {@code null}
+     */
+    private String readFromSysConfig() {
+        if (configServiceProvider == null) {
+            return null;
+        }
+        try {
+            IConfigService configService = configServiceProvider.stream().findFirst().orElse(null);
+            if (configService == null) {
+                return null;
+            }
+            String value = configService.selectConfigByKey(CONFIG_KEY);
+            if (value == null || value.trim().isEmpty()) {
+                return null;
+            }
+            return value.trim();
+        } catch (Exception e) {
+            // 瀹瑰櫒娌℃湁瀹炵幇銆佹暟鎹簮寮傚父銆丼QL 鎶ラ敊鈥︹�︿竴寰嬫寜"鍙傛暟缂哄け"澶勭悊锛坒ail-open锛夛紝缁濅笉褰卞搷閲囬泦涓绘祦绋�
+            log.warn("銆愭暟鎹噰闆嗐�戣鍙� sys_config 鐨� {} 澶辫触锛屾湰娆℃寜鏈厤缃鐞嗭紙fail-open锛夛細{}",
+                    CONFIG_KEY, e.toString());
+            return null;
+        }
+    }
+
+    /**
+     * 鍥哄畾鍊肩殑 {@code ObjectProvider}锛氬彧鐢ㄤ簬闈� Spring 鐜/娴嬭瘯
+     */
+    private static final class FixedProvider implements ObjectProvider<IConfigService> {
+
+        private final IConfigService configService;
+
+        private FixedProvider(final String configValue) {
+            this.configService = configValue == null ? null : configKey -> configValue;
+        }
+
+        @Override
+        public IConfigService getObject(Object... args) {
+            return configService;
+        }
+
+        @Override
+        public IConfigService getIfAvailable() {
+            return configService;
+        }
+
+        @Override
+        public IConfigService getIfUnique() {
+            return configService;
+        }
+
+        @Override
+        public IConfigService getObject() {
+            return configService;
+        }
+
+        @Override
+        public java.util.stream.Stream<IConfigService> stream() {
+            return configService == null ? java.util.stream.Stream.empty() : java.util.stream.Stream.of(configService);
+        }
+    }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHisDataCollectionService.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHisDataCollectionService.java
new file mode 100644
index 0000000..fbe9252
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IHisDataCollectionService.java
@@ -0,0 +1,17 @@
+package com.ruoyi.datacollection.service;
+
+/**
+ * HIS 鏁版嵁閲囬泦鐨勮皟搴︾紪鎺掞紙妯″潡鍐呮帴鍙o級銆�
+ * <p>
+ * 瀵瑰鍙粡 {@code com.ruoyi.datacollection.api.DataCollectionFacade} 鏆撮湶锛�
+ * 鍏跺畠妯″潡涓嶈鐩存帴娉ㄥ叆鏈帴鍙c��
+ */
+public interface IHisDataCollectionService {
+
+    /**
+     * HIS 鏁版嵁閲囬泦锛堝師 {@code RyTask#dealHisData(String)}锛岄�昏緫涓�琛屾湭鏀癸級銆�
+     *
+     * @param todayZeroStr 閲囬泦鍩哄噯鏃堕棿 {@code yyyy-MM-dd HH:mm:ss}锛涗负绌烘椂鍙�"浠婂ぉ 00:00"
+     */
+    void dealHisData(String todayZeroStr);
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IInhospDeptRefreshService.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IInhospDeptRefreshService.java
new file mode 100644
index 0000000..2d59150
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/IInhospDeptRefreshService.java
@@ -0,0 +1,27 @@
+package com.ruoyi.datacollection.service;
+
+/**
+ * 鍦ㄩ櫌鎮h��"绉戝 / 鐥呭尯 / 搴婁綅"姣忔棩鍒锋柊锛堟湰妯″潡鍐呯殑缂栨帓鎺ュ彛锛夈��
+ * <p>
+ * 瀵瑰鍙粡 {@code com.ruoyi.datacollection.api.DataCollectionFacade} 鏆撮湶锛�
+ * 鍏跺畠妯″潡涓嶈鐩存帴娉ㄥ叆鏈帴鍙c��
+ *
+ * <h3>涓轰粈涔堝崟鐙竴涓� Service锛岃�屼笉鏄杩� {@link IHisDataCollectionService}</h3>
+ * {@code HisDataCollectionServiceImpl} 鏄�"浠� {@code RyTask#dealHisData} 鍘熸牱鎼叆銆�
+ * 鍒绘剰闆舵敼鍔�"鐨勬惉杩愪欢锛堣繛鏃ュ織閿欏埆瀛楅兘淇濈暀锛夛紝鏈鏄�<b>鏂板鑳藉姏</b>锛�
+ * 娣疯繘鍘讳細璁╅偅浠�"鍙笌鎼縼鍓嶉�愯姣斿"鐨勮瘉鎹け鏁堛�傛晠鍙﹁捣涓�涓被锛屽悇绠′竴娈点��
+ */
+public interface IInhospDeptRefreshService {
+
+    /**
+     * 鍒锋柊鍦ㄩ櫌鎮h�呯殑绉戝/鐥呭尯/搴婁綅锛堝崡鍗庨檮涓�锛屾寜鎮h�呴�愭潯鏍稿锛夈��
+     * <p>
+     * 鏁版嵁婧愭槸"鍏ラ櫌閲囬泦鐢ㄧ殑閭d釜鍋ュ悍璁板綍鎺ュ彛"锛堟寜 {@code serialnum} 鍗曟煡 + 鍦ㄩ櫌鐘舵�佽繃婊わ級锛�
+     * 杩斿洖鐨勬槸璇ユ偅鑰�<b>褰撳墠</b>浣嶇疆锛涘凡涓嶅湪闄㈢殑鎮h�呬細琚烦杩囷紝搴撳唴浣嶇疆淇濇寔涓嶅姩銆�
+     * <p>
+     * 骞傜瓑锛氬彧鍐�"涓庡簱鍐呬笉涓�鑷�"鐨勫瓧娈碉紝閲嶈窇鏃犲銆�
+     *
+     * @return 瀹為檯鍙戠敓鏇存柊鐨勮褰曟潯鏁帮紙0 琛ㄧず娌″彉鍖栥�佺珯鐐逛笉鍖归厤鎴栨湰杞璺宠繃锛�
+     */
+    int refreshInhospDeptInfo();
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HisDataCollectionServiceImpl.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HisDataCollectionServiceImpl.java
new file mode 100644
index 0000000..4ebe673
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/HisDataCollectionServiceImpl.java
@@ -0,0 +1,341 @@
+package com.ruoyi.datacollection.service.impl;
+
+import com.ruoyi.common.core.service.HisGatherApi;
+import com.ruoyi.common.core.service.dto.SltdGatherReq;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.datacollection.service.IHisDataCollectionService;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.service.ISysConfigService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * HIS 鏁版嵁閲囬泦璋冨害缂栨帓瀹炵幇 鈥斺��
+ * <b>鐢� {@code ruoyi-quartz} 鐨� {@code RyTask#dealHisData} + {@code collectSegmentData} 鍘熸牱鎼叆</b>銆�
+ *
+ * <h3>鎼繍绾緥锛堟湰绫诲埢鎰�"闆舵敼鍔�"锛�</h3>
+ * <ul>
+ *   <li>绔欑偣鍒嗘敮锛坽@code xh} / {@code hn} / {@code sltd}-{@code nhfy}锛夈�佹椂闂寸獥鍙g畻娉曘��
+ *       30 澶╁垎娈靛洖婧殑娈甸暱涓庨『搴忋�佹瘡涓噰闆嗗姩浣滅殑鍏堝悗銆佸紓甯稿悶鎺夌殑鑼冨洿銆佹棩蹇楁枃妗�
+ *       鈥斺�� 鍏ㄩ儴涓庢惉杩愬墠涓�鑷达紱</li>
+ *   <li>鍞竴鐨勫舰寮忓彉鍖栵細鍐呴儴 VO锛坽@code ServiceSLTDInhospReqVO} / {@code ServiceSLTDDeptReqVO} /
+ *       {@code HnDataGatherVO}锛夋崲鎴愬绾� DTO {@link SltdGatherReq} / 涓や釜 {@code Date}锛�
+ *       鐢� smartor 渚� Bridge 閫愬瓧娈垫惉鍥炲師 VO锛涘瓧娈佃缃『搴忎笌"鏄惧紡缃� null"閮戒繚鐣欙紱
+ *   <li>{@code CollectionUtils.isNotEmpty(...)} 鎹㈡垚绛変环鐨� {@code list != null && !list.isEmpty()}
+ *       锛堥伩鍏嶄负涓�娆″垽绌虹粰妯″潡寮� commons-collections4锛夛紱</li>
+ *   <li>{@code sys_config} 鐨勮娉�<b>鍒绘剰淇濇寔</b> {@code selectConfigList(鏉′欢)} + 鍙栫 0 琛�
+ *       锛堝惈鍘熷疄鐜扮殑 LIKE 鍖归厤涓�"涓嶆帓搴忓彇棣栬"璇箟锛夛紝娌℃湁鏀规垚 {@code selectConfigByKey}
+ *       鈥斺�� 閭f槸"椤烘墜浼樺寲"锛屼細鏀瑰彉鏌ヨ璇箟锛屽洖褰掓椂鏃犳硶閫愭潯姣斿銆�</li>
+ * </ul>
+ *
+ * <h3>瀹冧笉绠′粈涔�</h3>
+ * 鐪熸鐨勯噰闆嗗姩浣滐紙HTTP 鍙栨暟銆佸叆搴擄級涓嶅湪鏈被锛氶偅閲屼粛鍦� smartor锛岀粡
+ * {@link HisGatherApi} 濂戠害璋冪敤锛屽悗缁垎鎵规惉杩涙湰妯″潡銆�
+ *
+ * @see com.ruoyi.datacollection.api.DataCollectionFacade 瀵瑰闂ㄩ潰
+ */
+@Slf4j
+@Service
+public class HisDataCollectionServiceImpl implements IHisDataCollectionService {
+
+    /**
+     * 鐪佺珛鍚屽痉 / 鍗楀崕闄勪竴鐨勬満鏋処D锛堝師瀹炵幇閲岀殑瀛楅潰閲� {@code "20001001"}锛�
+     */
+    private static final String SLTD_ORG_ID = "20001001";
+
+    /**
+     * 褰撴椂绔欑偣鏍囪瘑锛堝師 {@code RyTask} 鐨� {@code @Value("${spring.profiles.active}")}锛�
+     */
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    /**
+     * HIS 閲囬泦鑳藉姏濂戠害锛堝綋鍓嶅疄鐜板湪 smartor锛氱函杞彂鍒版棦鏈� Service锛夈��
+     * <p>
+     * 鈿狅笍 鍒绘剰<b>鐩存帴娉ㄥ叆</b>鑰屼笉鏄� {@code ObjectProvider} 鎯版�у彇锛�
+     * 閲囬泦瀹炵幇鏄暟鎹摼璺殑蹇呴渶浠讹紝"鍙栦笉鍒板氨闈欓粯涓嶉噰"姝f槸鏈�鍗遍櫓鐨勫け璐ュ舰鎬侊紝
+     * 杩欓噷璁╁畠鍚姩鏈熷氨鏆撮湶锛堝畞鍙惎鍔ㄥけ璐ワ紝涔熶笉瑕侀潤榛樺皯鏁版嵁锛夈��
+     */
+    @Autowired
+    private HisGatherApi hisGatherApi;
+
+    /**
+     * 鍙傛暟閰嶇疆鏈嶅姟锛坮uoyi-system 鐨� API锛夛細璇� {@code sltd.gather.sysuser} / {@code sltd.gather.campusid}
+     */
+    @Autowired
+    private ISysConfigService configService;
+
+    /**
+     * HIS鏁版嵁閲囬泦
+     * 瀹氭椂浠诲姟锛氶噰闆嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹�
+     *
+     * @param todayZeroStr 褰撳墠鐨勬椂闂�   渚嬪锛�2026-05-06 00:00:00
+     */
+    @Override
+    public void dealHisData(String todayZeroStr) {
+        log.info("銆恉ealHisData銆戝紑濮嬫墽琛孒IS鏁版嵁閲囬泦浠诲姟");
+        // 鑾峰彇鏄ㄥぉ0鐐瑰埌浠婂ぉ0鐐圭殑鏃堕棿鑼冨洿
+        LocalDateTime todayZero = LocalDateTime.now().with(LocalTime.MIN);
+        if (StringUtils.isNotBlank(todayZeroStr)) {
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            todayZero = LocalDateTime.parse(todayZeroStr, formatter);
+        }
+        LocalDateTime yesterdayZero = todayZero.minusDays(1);
+        log.info("銆恉ealHisData銆戦噰闆嗘椂闂磋寖鍥达細{} ~ {}", yesterdayZero, todayZero);
+
+        if (active.trim().equals("xh")) {
+            try {
+                // 閲囬泦鍏ラ櫌鏁版嵁
+                log.info("銆恉ealHisData銆戞柊鍗庡紑濮嬮噰闆嗗叆闄㈡暟鎹�");
+                hisGatherApi.gatherXhInhospRecords("0", yesterdayZero, todayZero);
+                log.info("銆恉ealHisData銆戞柊鍗庡叆闄㈡暟鎹噰闆嗗畬鎴�");
+
+                // 閲囬泦鍑洪櫌鏁版嵁
+                log.info("銆恉ealHisData銆戞柊鍗庡紑濮嬮噰闆嗗嚭闄㈡暟鎹�");
+                hisGatherApi.gatherXhInhospRecords("1", yesterdayZero, todayZero);
+                log.info("銆恉ealHisData銆戞柊鍗庡嚭闄㈡暟鎹噰闆嗗畬鎴�");
+
+            } catch (Exception e) {
+                log.error("銆恉ealHisData銆戞柊鍗庢暟鎹噰闆嗗紓甯�", e);
+            }
+        } else if (active.trim().equals("hn")) {
+            try {
+                // 娌冲崡鏁版嵁閲囬泦
+                log.info("銆恉ealHisData銆戞渤鍗楀紑濮嬮噰闆嗘暟鎹�");
+                Date startTime = Date.from(yesterdayZero.atZone(ZoneId.systemDefault()).toInstant());
+                Date endTime = Date.from(todayZero.atZone(ZoneId.systemDefault()).toInstant());
+
+                hisGatherApi.gatherHnRecords(startTime, endTime);
+                log.info("銆恉ealHisData銆戞渤鍗楃粨鏉熼噰闆嗘暟鎹�");
+            } catch (Exception e) {
+                log.error("銆恉ealHisData銆戞渤鍗楁暟鎹噰闆嗗紓甯�", e);
+            }
+        } else if (active.trim().equals("sltd") || active.trim().equals("nhfy")) {
+            //鐪佺珛鍚屽痉涓庡崕鍗楅檮涓�鐢ㄥ悓涓�濂楅噰闆嗘柟娉曪紙閮芥槸鏉ユ湭鏉ユ彁渚涳級
+
+            try {
+                //鑾峰彇鏄惁闇�瑕侀噰闆嗙敤鎴枫�侀儴闂ㄤ俊鎭�
+                SysConfig config = new SysConfig();
+                config.setConfigKey("sltd.gather.sysuser");
+                config.setOrgid(SLTD_ORG_ID);
+                List<SysConfig> sysConfigs = configService.selectConfigList(config);
+
+                //鑾峰彇鐪佺珛鍚屽痉瑕侀噰闆嗙殑闄㈠尯
+                SysConfig cf = new SysConfig();
+                cf.setConfigKey("sltd.gather.campusid");
+                cf.setOrgid(SLTD_ORG_ID);
+                List<SysConfig> sysConfigcampusids = configService.selectConfigList(cf);
+
+                List<Long> campusidList = new ArrayList<>();
+                if (sysConfigcampusids != null && !sysConfigcampusids.isEmpty()) {
+                    String[] split = sysConfigcampusids.get(0).getConfigValue().split(",");
+                    campusidList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
+                } else {
+                    log.error("SysConfig涓殑闄㈠尯ID涓虹┖锛�");
+                    return;
+                }
+
+                //configValue = 1 涓嶉渶瑕侀噰闆�       configValue = 2闇�瑕侀噰闆�
+                if (sysConfigs != null && !sysConfigs.isEmpty() && sysConfigs.get(0).getConfigValue().equals("2")) {
+                    log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈儴闂ㄤ俊鎭�濆紑濮嬮噰闆嗘暟鎹�");
+                    SltdGatherReq serviceSLTDDeptReqVO = new SltdGatherReq();
+                    serviceSLTDDeptReqVO.setOrgId(SLTD_ORG_ID);
+                    serviceSLTDDeptReqVO.setCampusIds(campusidList);
+                    Boolean aBoolean1 = hisGatherApi.gatherSltdDeptWardArea(serviceSLTDDeptReqVO);
+                    log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈儴闂ㄤ俊鎭�濈粨鏉熼噰闆嗘暟鎹細{}", aBoolean1);
+
+                    Boolean aBoolean = false;
+                    for (Long cid : campusidList) {
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滅敤鎴蜂俊鎭�濆紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+                        SltdGatherReq reqVO = new SltdGatherReq();
+                        reqVO.setOrgId(SLTD_ORG_ID);
+                        reqVO.setCampusId(cid);
+                        ArrayList<String> statusList = new ArrayList<>();
+                        statusList.add("1");
+                        reqVO.setStatusList(statusList);
+                        aBoolean = hisGatherApi.gatherSltdHospUser(reqVO);
+                    }
+                    log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滅敤鎴蜂俊鎭�濈粨鏉熼噰闆嗘暟鎹細{}", aBoolean);
+                    //鐤剧梾瀛楀吀閲囬泦
+                    hisGatherApi.gatherIcd10();
+                }
+
+                // nhfy/sltd鍥炴函30澶╁垎娈甸噰闆嗗垽鏂紙姣忔鏈�澶�4澶╋級
+                boolean isBackfill = (active.trim().equals("nhfy") || active.trim().equals("sltd")) && StringUtils.isNotBlank(todayZeroStr);
+                if (isBackfill) {
+                    DateTimeFormatter dateFmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+                    LocalDate segStart = todayZero.toLocalDate().minusDays(30);
+                    LocalDate segEndDate = todayZero.toLocalDate();
+                    int segCount = 0;
+                    while (!segStart.isAfter(segEndDate)) {
+                        LocalDate segEnd = segStart.plusDays(3);
+                        if (segEnd.isAfter(segEndDate)) {
+                            segEnd = segEndDate;
+                        }
+                        segCount++;
+                        log.info("銆恉ealHisData銆憑}鍥炴函绗瑊}娈甸噰闆嗭紝鏃ユ湡鑼冨洿锛歿} ~ {}", active.trim(), segCount, segStart.format(dateFmt), segEnd.format(dateFmt));
+                        for (Long cid : campusidList) {
+                            collectSegmentData(cid, segStart.format(dateFmt), segEnd.format(dateFmt));
+                        }
+                        segStart = segEnd.plusDays(1);
+                    }
+                    log.info("銆恉ealHisData銆憑}鍥炴函閲囬泦瀹屾垚锛屽叡{}娈�", active.trim(), segCount);
+                }
+
+                // 鐪佺珛鍚屽痉鏁版嵁閲囬泦锛堥潪鍥炴函妯″紡鎵嶆墽琛岋級
+                if (!isBackfill) {
+                    for (Long cid : campusidList) {
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰烽鍏ラ櫌寮�濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+                        String nowTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+                        SltdGatherReq serviceSLTDInhospReqVO = new SltdGatherReq();
+                        serviceSLTDInhospReqVO.setOrgId(SLTD_ORG_ID);
+                        serviceSLTDInhospReqVO.setCampusId(cid);
+                        serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime);
+                        serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime);
+                        if (active.trim().equals("nhfy")) {
+                            serviceSLTDInhospReqVO.setEncounterTimeStart(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                            serviceSLTDInhospReqVO.setEncounterTimeEnd(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                        }
+                        List<String> list = new ArrayList<>();
+                        list.add("FH0109.22");
+                        list.add("FH0109.23");
+                        list.add("FH0109.53");
+                        serviceSLTDInhospReqVO.setStatusList(list);
+//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
+                        hisGatherApi.gatherSltdHealthcareRecords(serviceSLTDInhospReqVO);
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濈祼鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濆紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+                        serviceSLTDInhospReqVO.setOrgId(SLTD_ORG_ID);
+                        serviceSLTDInhospReqVO.setCampusId(cid);
+                        serviceSLTDInhospReqVO.setEncounterTimeStart(null);
+                        serviceSLTDInhospReqVO.setEncounterTimeEnd(null);
+                        serviceSLTDInhospReqVO.setStartHeadTime(nowTime);
+                        serviceSLTDInhospReqVO.setStartTailTime(nowTime);
+                        if (active.trim().equals("nhfy")) {
+                            serviceSLTDInhospReqVO.setStartHeadTime(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                            serviceSLTDInhospReqVO.setStartTailTime(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                        }
+                        List<String> listStr = new ArrayList<>();
+                        listStr.add("FH0109.24");
+                        serviceSLTDInhospReqVO.setStatusList(listStr);
+//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
+                        hisGatherApi.gatherSltdHealthcareRecords(serviceSLTDInhospReqVO);
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濈祼鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濆紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+                        serviceSLTDInhospReqVO.setStartHeadTime(null);
+                        serviceSLTDInhospReqVO.setStartTailTime(null);
+                        serviceSLTDInhospReqVO.setEncounterTimeStart(null);
+                        serviceSLTDInhospReqVO.setEncounterTimeEnd(null);
+                        serviceSLTDInhospReqVO.setPreOutHospitalHeadDate(nowTime);
+                        serviceSLTDInhospReqVO.setPreOutHospitalTailDate(nowTime);
+                        if (active.trim().equals("nhfy")) {
+                            serviceSLTDInhospReqVO.setPreOutHospitalHeadDate(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                            serviceSLTDInhospReqVO.setPreOutHospitalTailDate(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                        }
+                        serviceSLTDInhospReqVO.setHealthcareRecordTypeList(null);
+                        List<String> list2 = new ArrayList<>();
+//                    list2.add("FH0108.02");
+                        //鍑洪櫌
+                        list2.add("FH0109.27");
+                        //棰勫嚭闄�
+                        list2.add("FH0109.25");
+                        serviceSLTDInhospReqVO.setStatusList(list2);
+//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
+                        hisGatherApi.gatherSltdHealthcareRecords(serviceSLTDInhospReqVO);
+                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濇潫閲囬泦鏁版嵁锛岄櫌鍖猴細{}", cid);
+                    }
+                }
+
+            } catch (Exception e) {
+                log.error("銆恉ealHisData銆戠渷绔嬪悓寰锋暟鎹噰闆嗗紓甯�", e);
+            }
+        }
+    }
+
+    /**
+     * 鍒嗘閲囬泦鏁版嵁锛堥鍏ラ櫌銆佸叆闄€�佸嚭闄級
+     * 鐢ㄤ簬nhfy/sltd鍥炴函閲囬泦锛屾瘡娆℃渶澶氭煡璇�7澶╂暟鎹�
+     *
+     * @param cid          闄㈠尯ID
+     * @param startDateStr 鏃ユ湡寮�濮� yyyy-MM-dd
+     * @param endDateStr   鏃ユ湡缁撴潫 yyyy-MM-dd
+     */
+    private void collectSegmentData(Long cid, String startDateStr, String endDateStr) {
+//        // 棰勫叆闄�
+        log.info("銆恉ealHisData銆戦鍏ラ櫌寮�濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
+        SltdGatherReq reqVO = new SltdGatherReq();
+        reqVO.setOrgId(SLTD_ORG_ID);
+        reqVO.setCampusId(cid);
+        reqVO.setEncounterTimeStart(startDateStr);
+        reqVO.setEncounterTimeEnd(endDateStr);
+        List<String> preAdmitStatus = new ArrayList<>();
+        preAdmitStatus.add("FH0109.22");
+        preAdmitStatus.add("FH0109.23");
+        preAdmitStatus.add("FH0109.53");
+        reqVO.setStatusList(preAdmitStatus);
+        log.info("銆恉ealHisData銆戦鍏ラ櫌閲囬泦鏁版嵁鍏ュ弬锛歿}", reqVO);
+        try {
+            hisGatherApi.gatherSltdHealthcareRecords(reqVO);
+        } catch (Exception e) {
+            // 鍗曠被鏁版嵁澶辫触涓嶅啀鍚戜笂鎶涳細鍚﹀垯涓�娈靛け璐ヤ細璁╂湰娆″洖婧悗闈㈢殑鎵�鏈夋閮戒笉鎵ц
+            log.error("銆恉ealHisData銆戦鍏ラ櫌閲囬泦澶辫触锛岃烦杩囪绫荤户缁�傞櫌鍖猴細{}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr, e);
+        }
+        log.info("銆恉ealHisData銆戦鍏ラ櫌绲備簡閲囬泦鏁版嵁锛岄櫌鍖猴細{}", cid);
+
+        // 鍏ラ櫌
+        log.info("銆恉ealHisData銆戝叆闄㈠紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
+        reqVO = new SltdGatherReq();
+        reqVO.setOrgId(SLTD_ORG_ID);
+        reqVO.setCampusId(cid);
+        reqVO.setStartHeadTime(startDateStr);
+        reqVO.setStartTailTime(endDateStr);
+        List<String> admitStatus = new ArrayList<>();
+        admitStatus.add("FH0109.24");
+        reqVO.setStatusList(admitStatus);
+        log.info("銆恉ealHisData銆戝叆闄㈤噰闆嗘暟鎹叆鍙傦細{}", reqVO);
+        try {
+            hisGatherApi.gatherSltdHealthcareRecords(reqVO);
+        } catch (Exception e) {
+            // 鍗曠被鏁版嵁澶辫触涓嶅啀鍚戜笂鎶涳細鍚﹀垯涓�娈靛け璐ヤ細璁╂湰娆″洖婧悗闈㈢殑鎵�鏈夋閮戒笉鎵ц
+            log.error("銆恉ealHisData銆戝叆闄㈤噰闆嗗け璐ワ紝璺宠繃璇ョ被缁х画銆傞櫌鍖猴細{}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr, e);
+        }
+        log.info("銆恉ealHisData銆戝叆闄㈢祩浜嗛噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+
+        // 鍑洪櫌
+        log.info("銆恉ealHisData銆戝嚭闄㈠紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
+        reqVO = new SltdGatherReq();
+        reqVO.setOrgId(SLTD_ORG_ID);
+        reqVO.setCampusId(cid);
+        reqVO.setPreOutHospitalHeadDate(startDateStr);
+        reqVO.setPreOutHospitalTailDate(endDateStr);
+        List<String> dischargeStatus = new ArrayList<>();
+        //鍑洪櫌
+        dischargeStatus.add("FH0109.27");
+        //棰勫嚭闄�
+        dischargeStatus.add("FH0109.25");
+        reqVO.setStatusList(dischargeStatus);
+        log.info("銆恉ealHisData銆戝嚭闄㈤噰闆嗘暟鎹叆鍙傦細{}", reqVO);
+        try {
+            hisGatherApi.gatherSltdHealthcareRecords(reqVO);
+        } catch (Exception e) {
+            // 鍗曠被鏁版嵁澶辫触涓嶅啀鍚戜笂鎶涳細鍚﹀垯涓�娈靛け璐ヤ細璁╂湰娆″洖婧悗闈㈢殑鎵�鏈夋閮戒笉鎵ц
+            log.error("銆恉ealHisData銆戝嚭闄㈤噰闆嗗け璐ワ紝璺宠繃璇ョ被缁х画銆傞櫌鍖猴細{}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr, e);
+        }
+        log.info("銆恉ealHisData銆戝嚭闄㈢粨鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
+    }
+}
diff --git a/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/InhospDeptRefreshServiceImpl.java b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/InhospDeptRefreshServiceImpl.java
new file mode 100644
index 0000000..ebeaba9
--- /dev/null
+++ b/ruoyi-datacollection/src/main/java/com/ruoyi/datacollection/service/impl/InhospDeptRefreshServiceImpl.java
@@ -0,0 +1,393 @@
+package com.ruoyi.datacollection.service.impl;
+
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.core.service.HisGatherApi;
+import com.ruoyi.common.core.service.dto.InhospPositionRecord;
+import com.ruoyi.common.core.service.dto.SltdGatherReq;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.datacollection.service.IInhospDeptRefreshService;
+import com.ruoyi.inhospvisit.api.InhospVisitFacade;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 鍦ㄩ櫌鎮h��"绉戝 / 鐥呭尯 / 搴婁綅"姣忔棩鍒锋柊 鈥斺�� 缂栨帓涓�"鏀逛笉鏀�"鐨勫垽瀹氶兘鍦ㄦ湰绫汇��
+ *
+ * <h3>瀹冭В鍐充粈涔�</h3>
+ * 鍦ㄩ櫌鎮h�呬細鎹㈢瀹ゃ�佹崲鐥呭尯銆佹崲搴娿�倇@code pat_med_inhosp} 鐨勪綅缃瓧娈靛彧鍦�"鍏ラ櫌閲囬泦"鏃跺啓涓�娆★紝
+ * 涔嬪悗涓嶄細鑷繁鏇存柊 鈥斺�� 浜庢槸杞/鎹㈠簥鎮h�呬細涓�鐩村仠鍦ㄥ叆闄㈠綋鏃剁殑浣嶇疆
+ * 锛堝疄娴� 120 浜烘娊鏍凤細25 浜哄簥浣嶄笌 HIS 涓嶄竴鑷淬�佺害 9% 鐨勬偅鑰呭綋澶╁凡鍑洪櫌浣嗗簱閲屼粛鏍囧湪闄級銆�
+ * 鏈被姣忓ぉ鍏ㄩ噺鏍稿涓�娆★紝鎶婁綅缃籂鍥� HIS 鐨勭幇鐘躲��
+ *
+ * <h3>鍙栨暟鍙e緞锛坽@code dtcQueryHealthcareRecordList}锛屼笌鍏ラ櫌閲囬泦鍚屼竴涓帴鍙o級</h3>
+ * 鎸� {@code healthcareRecordNo}锛�= {@code serialnum}锛夊崟鏌ワ紝閰�
+ * {@code statusList=["FH0109.24"]}锛堝湪闄級锛岃繑鍥炵殑鏄�<b>璇ユ偅鑰呮鍒荤殑鐘舵��</b>锛�
+ * <ul>
+ *   <li>{@code data} 鎭� 1 鏉� 鈫� 褰撳墠浣嶇疆瑙� {@link InhospPositionRecord}锛�</li>
+ *   <li>{@code data} 涓� {@code []} 鈫� 璇ユ偅鑰呭綋鍓�<b>涓嶅湪"鍏ラ櫌"鐘舵��</b>
+ *       锛堝疄娴嬭繖鎵瑰氨鏄�"褰撳ぉ宸插嚭闄€�佷絾搴撻噷杩樻槸鍦ㄩ櫌"鐨勬偅鑰咃細{@code FH0109.27}
+ *       涓� {@code preOutHospitalDate} 灏卞湪鍑犲皬鏃跺墠锛夆啋 <b>璺宠繃骞惰鏁帮紝涓嶅姩搴撳唴浣嶇疆</b>锛�
+ *       鐘舵�佹湰韬敱鍑洪櫌閲囬泦璐熻矗锛岃繖閲屼笉鏀� {@code inhospstate}銆�</li>
+ * </ul>
+ * 涓�"鍒嗘鍘嗗彶"鎺ュ彛鐩告瘮锛岃繖鏉¤矾娌℃湁"鍙栨渶鏂颁竴娈�"鍜�"绌哄叆绉戞椂闂�"鐨勫潙锛�
+ * 涓� {@code bedNumber} 鍦ㄩ櫌鎮h�呭疄娴嬫亽鏈夊�� 鈥斺�� 鎵�浠�"搴婁綅涓虹┖鍒欐竻绌�"鍙互鎸夊瓧闈㈡墽琛屻��
+ *
+ * <h3>瀛楁鏄犲皠锛堜笌"鍏ラ櫌閲囬泦"鍚屾簮锛屾晠涓嶄細鍑虹幇涓ゅ鍙e緞锛�</h3>
+ * <pre>
+ *   pat_med_inhosp.deptcode                &lt;- String.valueOf(deptId)
+ *   pat_med_inhosp.deptname                &lt;- deptName
+ *   pat_med_inhosp.hospitaldistrictcode    &lt;- String.valueOf(areaId)
+ *   pat_med_inhosp.hospitaldistrictid      &lt;- String.valueOf(areaId)
+ *   pat_med_inhosp.hospitaldistrictname    &lt;- areaName
+ *   pat_med_inhosp.bed_no                  &lt;- bedNumber锛堜负绌哄垯娓呯┖锛�
+ * </pre>
+ *
+ * <h3>鍒绘剰涓嶇鐨勫瓧娈�</h3>
+ * {@code starttime}锛堝叆闄㈡椂闂达級銆亄@code endtime}銆亄@code drcode/drname}銆�
+ * {@code roomno}銆亄@code deptid}銆亄@code schemestatus}銆�
+ * {@code deptcheck_flag}/{@code wardcheck_flag} 绛変换鍔℃爣蹇椼��
+ * <b>涔熶笉鏂板缓"杞"璁板綍</b>锛歿@code inhospstate} 淇濇寔 0锛屽彧灏卞湴鏀逛綅缃��
+ *
+ * <h3>澶辫触鐨勫缃�</h3>
+ * 鍗曟潯澶辫触鍙鏃ュ織骞剁户缁笅涓�鏉★紱杩炵画澶辫触杈惧埌 {@link #MAX_CONSECUTIVE_FAIL} 鍒ゅ畾鎺ュ彛涓嶅彲鐢ㄣ��
+ * 鏈疆鎻愬墠缁撴潫锛堜笌闂ㄦ�ヨ瘖閲囬泦鍚屾绾緥锛夛紝鍓╀綑鎮h�呬笅涓�杞噸鏂板叏閲忔牳瀵癸紝涓嶄細婕忋��
+ *
+ * @see com.ruoyi.datacollection.api.DataCollectionFacade 瀵瑰闂ㄩ潰
+ */
+@Slf4j
+@Service
+public class InhospDeptRefreshServiceImpl implements IInhospDeptRefreshService {
+
+    /**
+     * 浠呭崡鍗庨檮涓�鍚敤锛氭帴鍙f寜绔欑偣閰嶇疆 {@code sltd_pub_path} 涓� {@code lwl_app_key}
+     * 锛堝崡鍗庣殑 app-key 瀹炴祴鍙敤锛涘叾浠栫珯鐐规湭楠岃瘉锛屾晠涓嶅仛榛樿鏀惧紑锛�
+     */
+    private static final String SITE_NHFY = "nhfy";
+
+    /**
+     * 鏈烘瀯ID锛堜笌 {@code HisDataCollectionServiceImpl} / 閲囬泦瀹炵幇閲岀殑瀛楅潰閲忎竴鑷达級
+     */
+    private static final String ORG_ID = "20001001";
+
+    /**
+     * 闄㈠尯ID锛氭寜绾﹀畾鍥哄畾浼犲崡鍗庨檮涓�涓婚櫌鍖猴紙瀹炴祴鎸� {@code healthcareRecordNo} 鍗曟煡鏃�
+     * 璇ュ弬鏁颁笉鍙備笌杩囨护锛屼紶 30001002 鎴� 30038001 杩斿洖鐨勯兘鏄悓涓�鏉¤褰曪級
+     */
+    private static final Long CAMPUS_ID = 30001002L;
+
+    /**
+     * 鍙彇"鍦ㄩ櫌"锛堝叆闄級鐘舵�佺殑璁板綍锛涘凡鍑洪櫌/棰勫嚭闄細琚� HIS 渚ц繃婊ゆ帀锛屼簬鏄繑鍥炵┖鍒楄〃
+     */
+    private static final List<String> STATUS_IN_HOSP =
+            Collections.unmodifiableList(Arrays.asList("FH0109.24"));
+
+    /**
+     * 鍦ㄩ櫌鐘舵�佺爜锛堢敤浜庢牎楠屾帴鍙h繑鍥炵殑閭f潯璁板綍纭疄鏄湪闄級
+     */
+    private static final String STATUS_CODE_IN_HOSP = "FH0109.24";
+
+    /**
+     * 杩愯閿侊細sys_job 宸查厤"绂佹骞跺彂"锛岃繖閲屽啀闃蹭竴鎵�"鎵嬪伐瑙﹀彂鍙犲姞瀹氭椂浠诲姟"
+     */
+    private static final String RUN_LOCK_KEY = "datacollection:inhospDept:running";
+
+    /**
+     * 杩愯閿� TTL锛氫竴杞甯哥害 7~10 鍒嗛挓锛堝疄娴� 152ms/娆� 脳 绾� 2900 浜猴級锛岀粰瓒充綑閲�
+     */
+    private static final long RUN_LOCK_MINUTES = 120L;
+
+    /**
+     * 杩炵画澶辫触闃堝�硷細杈惧埌鍗冲垽瀹氭帴鍙d笉鍙敤锛屾湰杞彁鍓嶇粨鏉燂紙閬垮厤鍑犲崈鏉¢敊璇棩蹇� + 绌鸿浆锛�
+     */
+    private static final int MAX_CONSECUTIVE_FAIL = 20;
+
+    /**
+     * 绔欑偣鏍囪瘑锛坽@code @Value("${spring.profiles.active}")}锛屼笌鏃㈡湁閲囬泦缂栨帓鍚屾锛�
+     */
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    /**
+     * HIS 閲囬泦鑳藉姏濂戠害锛坰martor 渚� Bridge 绾浆鍙戝埌 healthcareRecord 鏌ヨ锛屽彧鍙栨暟涓嶈惤搴擄級
+     */
+    @Autowired
+    private HisGatherApi hisGatherApi;
+
+    /**
+     * 鍑哄叆闄㈡暟鎹绾︼紙{@code pat_med_inhosp} 褰掑睘 ruoyi-inhospvisit锛夛細
+     * 鍙栧湪闄㈠�欓�� + 鍐欏洖浣嶇疆銆傚埢鎰忎笉纰拌妯″潡鐨� Mapper銆�
+     */
+    @Autowired
+    private InhospVisitFacade inhospVisitFacade;
+
+    /**
+     * 杩愯閿侊紙ruoyi-common 鐨� RedisCache锛�
+     */
+    @Autowired
+    private RedisCache redisCache;
+
+    @Override
+    public int refreshInhospDeptInfo() {
+        String site = active == null ? "" : active.trim();
+        if (!SITE_NHFY.equals(site)) {
+            log.info("銆愬湪闄俊鎭埛鏂般�戝綋鍓嶇珯鐐� {} 涓嶆墽琛岋紙浠� nhfy 鍚敤璇ユ帴鍙o級锛岃烦杩�", active);
+            return 0;
+        }
+        if (!tryLock()) {
+            log.warn("銆愬湪闄俊鎭埛鏂般�戜笂涓�杞皻鏈粨鏉燂紙Redis 閿� {} 杩樺湪锛夛紝鏈疆璺宠繃", RUN_LOCK_KEY);
+            return 0;
+        }
+
+        long startMs = System.currentTimeMillis();
+        int changed = 0;
+        int unchanged = 0;
+        int notInHosp = 0;
+        int skipped = 0;
+        int failed = 0;
+        int consecutiveFail = 0;
+        boolean aborted = false;
+        try {
+            // 鍙煡 pat_med_inhosp 鑷韩锛堜笉 join 妗f琛ㄣ�佷笉鎸夎瘉浠跺彿杩囨护锛夛紝鍦ㄩ櫌鍙e緞 inhospstate='0' and del_flag='0'
+            List<PatMedInhosp> candidates = inhospVisitFacade.selectInhospRefreshCandidates(ORG_ID);
+            if (candidates == null || candidates.isEmpty()) {
+                log.warn("銆愬湪闄俊鎭埛鏂般�戞湭鍙栧埌浠讳綍鍦ㄩ櫌鎮h�咃紙orgid={}锛夛紝鏈疆涓嶅仛浜�", ORG_ID);
+                return 0;
+            }
+            log.info("銆愬湪闄俊鎭埛鏂般�戝紑濮嬶細鍦ㄩ櫌鎮h�� {} 浜猴紝閫愪汉鏍稿绉戝/鐥呭尯/搴婁綅", candidates.size());
+
+            for (PatMedInhosp row : candidates) {
+                try {
+                    Outcome outcome = refreshOne(row);
+                    if (outcome == Outcome.CHANGED) {
+                        changed++;
+                    } else if (outcome == Outcome.UNCHANGED) {
+                        unchanged++;
+                    } else if (outcome == Outcome.NOT_IN_HOSP) {
+                        notInHosp++;
+                    } else {
+                        skipped++;
+                    }
+                    consecutiveFail = 0;
+                } catch (Exception e) {
+                    failed++;
+                    consecutiveFail++;
+                    log.error("銆愬湪闄俊鎭埛鏂般�戝崟鏉″け璐ュ凡璺宠繃锛歩nhospid={}, serialnum={}, patname={}",
+                            row.getInhospid(), row.getSerialnum(), row.getPatname(), e);
+                    if (consecutiveFail >= MAX_CONSECUTIVE_FAIL) {
+                        aborted = true;
+                        log.error("銆愬湪闄俊鎭埛鏂般�戣繛缁� {} 浜哄け璐ワ紝鍒ゅ畾鎺ュ彛涓嶅彲鐢紝鏈疆鎻愬墠缁撴潫锛堝凡鏇存柊 {} 鏉★級锛�"
+                                + "鍓╀綑鎮h�呬笅涓�杞細閲嶆柊鍏ㄩ噺鏍稿锛屼笉浼氭紡", consecutiveFail, changed);
+                        break;
+                    }
+                }
+            }
+
+            log.info("銆愬湪闄俊鎭埛鏂般�戠粨鏉燂細鍦ㄩ櫌 {} 浜猴紝鏇存柊 {}锛屾棤鍙樺寲 {}锛屽凡涓嶅湪闄� {}锛岃烦杩� {}锛屽け璐� {}{}锛岃�楁椂 {} 绉�",
+                    candidates.size(), changed, unchanged, notInHosp, skipped, failed,
+                    aborted ? "锛堟帴鍙h繛缁け璐ワ紝鎻愬墠缁撴潫锛�" : "",
+                    (System.currentTimeMillis() - startMs) / 1000);
+            return changed;
+        } finally {
+            unlock();
+        }
+    }
+
+    /**
+     * 鏍稿骞讹紙蹇呰鏃讹級鏇存柊涓�涓湪闄㈡偅鑰呯殑浣嶇疆銆�
+     *
+     * @return 鏈瀵硅琛岀殑澶勭疆缁撴灉
+     */
+    private Outcome refreshOne(PatMedInhosp row) {
+        String serialnum = StringUtils.trim(row.getSerialnum());
+        if (StringUtils.isBlank(serialnum)) {
+            log.warn("銆愬湪闄俊鎭埛鏂般�戝湪闄㈣褰曟病鏈夋祦姘村彿锛屾棤娉曟牳瀵癸紝璺宠繃锛歩nhospid={}", row.getInhospid());
+            return Outcome.SKIPPED;
+        }
+
+        SltdGatherReq req = new SltdGatherReq();
+        req.setOrgId(ORG_ID);
+        req.setCampusId(CAMPUS_ID);
+        req.setStatusList(STATUS_IN_HOSP);
+        req.setHealthcareRecordNo(serialnum);
+
+        List<InhospPositionRecord> records = hisGatherApi.querySltdInhospPosition(req);
+        InhospPositionRecord current = pickInHospRecord(records, serialnum);
+        if (current == null) {
+            // 鎺ュ彛鎸夊湪闄㈢姸鎬佽繃婊ゅ悗娌℃湁杩斿洖璁板綍锛氳鎮h�呭綋鍓嶅凡涓嶅湪"鍏ラ櫌"鐘舵�併��
+            // 杩欓噷鍙鏁般�佷笉鏀瑰簱锛堢姸鎬佺炕杞槸鍑洪櫌閲囬泦鐨勮亴璐o級锛屾洿涓嶆嬁绌哄�煎幓瑕嗙洊浣嶇疆銆�
+            log.warn("銆愬湪闄俊鎭埛鏂般�慔IS 涓鎮h�呭凡涓嶅湪闄紙杩斿洖涓虹┖锛夛紝浣嶇疆淇濇寔涓嶅姩锛岀瓑鍑洪櫌閲囬泦澶勭悊鐘舵�侊細"
+                    + "inhospid={}, serialnum={}, patname={}", row.getInhospid(), serialnum, row.getPatname());
+            return Outcome.NOT_IN_HOSP;
+        }
+        return applyIfDiff(row, current) ? Outcome.CHANGED : Outcome.UNCHANGED;
+    }
+
+    /**
+     * 浠庤繑鍥炶褰曢噷鍙�"鍦ㄩ櫌"鐨勯偅涓�鏉°��
+     * <p>
+     * 姝e父鍙細杩斿洖 1 鏉★紱杩欓噷浠嶅仛涓�灞傞槻寰★細鍙帴鍙楃姸鎬佷负鍦ㄩ櫌鐨勮褰曪紝
+     * 涓�鏉¢兘涓嶅尮閰嶅垯杩斿洖 {@code null}锛堟寜"宸蹭笉鍦ㄩ櫌"澶勭悊锛夛紝
+     * 缁濅笉鎷夸竴鏉$姸鎬佷笉鏄庣殑璁板綍鍘昏鐩栧簱鍐呬綅缃��
+     */
+    private InhospPositionRecord pickInHospRecord(List<InhospPositionRecord> records, String serialnum) {
+        if (records == null || records.isEmpty()) {
+            return null;
+        }
+        for (InhospPositionRecord record : records) {
+            if (record == null) {
+                continue;
+            }
+            String status = StringUtils.trim(record.getHealthcareRecordStatus());
+            if (STATUS_CODE_IN_HOSP.equals(status)) {
+                return record;
+            }
+            log.warn("銆愬湪闄俊鎭埛鏂般�戣繑鍥炶褰曠姸鎬佷笉鏄湪闄紝宸插拷鐣ワ細serialnum={}, status={}", serialnum, status);
+        }
+        return null;
+    }
+
+    /**
+     * 涓庡簱鍐呭�奸�愬瓧娈垫瘮瀵癸紝鍙妸"鍙樺寲鐨勫瓧娈�"鍐欏洖锛涙病鏈変换浣曞彉鍖栧垯涓嶅姩搴擄紙涔熶笉鍒锋柊 update_time锛夈��
+     *
+     * @return 鏄惁瀹為檯鎵ц浜嗘洿鏂�
+     */
+    private boolean applyIfDiff(PatMedInhosp row, InhospPositionRecord current) {
+        PatMedInhosp update = new PatMedInhosp();
+        update.setInhospid(row.getInhospid());
+        StringBuilder changedFields = new StringBuilder();
+        boolean diff = false;
+
+        // 绉戝锛氭湁鍊兼墠鏇存柊锛堝彛寰勶細绉戝鏈夊�兼洿鏂扮瀹わ紝鐥呭尯鏈夊�兼洿鏂扮梾鍖猴紝浜掍笉鐗佃繛锛�
+        if (current.getDeptId() != null) {
+            String deptCode = String.valueOf(current.getDeptId());
+            String old = StringUtils.trimToEmpty(row.getDeptcode());
+            if (!deptCode.equals(old)) {
+                update.setDeptcode(deptCode);
+                changedFields.append("deptcode[").append(old).append("鈫�").append(deptCode).append("] ");
+                diff = true;
+            }
+        }
+        if (StringUtils.isNotBlank(current.getDeptName())) {
+            String old = StringUtils.trimToEmpty(row.getDeptname());
+            if (!current.getDeptName().equals(old)) {
+                update.setDeptname(current.getDeptName());
+                changedFields.append("deptname[").append(old).append("鈫�").append(current.getDeptName()).append("] ");
+                diff = true;
+            }
+        }
+
+        // 鐥呭尯锛歝ode 涓� id 鍚屽�硷紙鏃㈡湁閲囬泦鍙e緞灏辨槸涓や釜瀛楁閮藉啓 areaId锛�
+        if (current.getAreaId() != null) {
+            String areaId = String.valueOf(current.getAreaId());
+            String oldCode = StringUtils.trimToEmpty(row.getHospitaldistrictcode());
+            if (!areaId.equals(oldCode)) {
+                update.setHospitaldistrictcode(areaId);
+                changedFields.append("hospitaldistrictcode[").append(oldCode).append("鈫�").append(areaId).append("] ");
+                diff = true;
+            }
+            String oldAreaId = StringUtils.trimToEmpty(row.getHospitaldistrictid());
+            if (!areaId.equals(oldAreaId)) {
+                update.setHospitaldistrictid(areaId);
+                changedFields.append("hospitaldistrictid[").append(oldAreaId).append("鈫�").append(areaId).append("] ");
+                diff = true;
+            }
+        }
+        if (StringUtils.isNotBlank(current.getAreaName())) {
+            String old = StringUtils.trimToEmpty(row.getHospitaldistrictname());
+            if (!current.getAreaName().equals(old)) {
+                update.setHospitaldistrictname(current.getAreaName());
+                changedFields.append("hospitaldistrictname[").append(old).append("鈫�").append(current.getAreaName()).append("] ");
+                diff = true;
+            }
+        }
+
+        // 搴婁綅锛氭寜涓氬姟鍙e緞"鎺ュ彛缁欎粈涔堝氨鏄粈涔堬紝涓虹┖鍒欐竻绌�"銆�
+        // 鈿狅笍 mapper 閲�"绌轰覆=缃� null銆乶ull=涓嶆敼鍔�"锛屾墍浠ユ竻绌哄繀椤绘樉寮忎紶绌轰覆銆�
+        String apiBed = StringUtils.trim(current.getBedNumber());
+        String dbBed = StringUtils.trimToEmpty(row.getBedNo());
+        if (StringUtils.isBlank(apiBed)) {
+            if (StringUtils.isNotBlank(dbBed)) {
+                update.setBedNo("");
+                changedFields.append("bed_no[").append(dbBed).append("鈫�(娓呯┖)] ");
+                diff = true;
+            }
+        } else if (!apiBed.equals(dbBed)) {
+            update.setBedNo(apiBed);
+            changedFields.append("bed_no[").append(dbBed).append("鈫�").append(apiBed).append("] ");
+            diff = true;
+        }
+
+        if (!diff) {
+            return false;
+        }
+        update.setUpdateTime(new Date());
+        int rows = inhospVisitFacade.updatePatMedInhosp(update);
+        if (rows <= 0) {
+            log.warn("銆愬湪闄俊鎭埛鏂般�戞洿鏂版湭鐢熸晥锛堝奖鍝嶈鏁� {}锛夛細inhospid={}, serialnum={}, 寰呮敼瀛楁锛歿}",
+                    rows, row.getInhospid(), row.getSerialnum(), changedFields);
+            return false;
+        }
+        log.info("銆愬湪闄俊鎭埛鏂般�戝凡鏇存柊锛歩nhospid={}, serialnum={}, patname={}, 鍙樻洿锛歿}",
+                row.getInhospid(), row.getSerialnum(), row.getPatname(), changedFields);
+        return true;
+    }
+
+    /**
+     * 鎶㈠崰鏈疆杩愯閿併��
+     * <p>
+     * Redis 涓嶅彲鐢ㄦ椂<b>閫�鍖栦负鏃犻攣鎵ц</b>锛氭瘡澶╀竴娆$殑鏁版嵁鍒锋柊涓嶈鍥犱负缂撳瓨鏁呴殰鏁翠綋涓嶈窇锛�
+     * 鏈�鍧忔儏鍐垫槸鎵嬪伐瑙﹀彂涓庡畾鏃朵换鍔″彔鐫�璺� 鈥斺�� 鑰屾湰鍔熻兘鏄箓绛夋瘮瀵癸紝鍙犺窇鍙細澶氭墦鍑犳潯鏃ュ織銆�
+     */
+    private boolean tryLock() {
+        try {
+            if (Boolean.TRUE.equals(redisCache.hasKey(RUN_LOCK_KEY))) {
+                return false;
+            }
+            redisCache.setCacheObject(RUN_LOCK_KEY, String.valueOf(System.currentTimeMillis()),
+                    RUN_LOCK_MINUTES, TimeUnit.MINUTES);
+            return true;
+        } catch (Exception e) {
+            log.warn("銆愬湪闄俊鎭埛鏂般�慠edis 杩愯閿佷笉鍙敤锛坽}锛夛紝鏈疆鏃犻攣鎵ц", e.getMessage());
+            return true;
+        }
+    }
+
+    private void unlock() {
+        try {
+            redisCache.deleteObject(RUN_LOCK_KEY);
+        } catch (Exception e) {
+            log.warn("銆愬湪闄俊鎭埛鏂般�戦噴鏀捐繍琛岄攣澶辫触锛歿}", e.getMessage());
+        }
+    }
+
+    /**
+     * 鍗曟潯鎮h�呯殑澶勭疆缁撴灉
+     */
+    private enum Outcome {
+        /**
+         * 浣嶇疆鏈夊彉鍖栧苟宸插啓鍥�
+         */
+        CHANGED,
+        /**
+         * 涓庡簱鍐呬竴鑷达紝鏈敼鍔�
+         */
+        UNCHANGED,
+        /**
+         * HIS 閲岃鎮h�呭凡涓嶅湪"鍏ラ櫌"鐘舵�侊紙鎺ュ彛杩斿洖涓虹┖锛夛紝搴撳唴浣嶇疆淇濇寔涓嶅姩
+         */
+        NOT_IN_HOSP,
+        /**
+         * 鎷夸笉鍒板彲鐢ㄤ俊鎭紙鏃犳祦姘村彿 / 杩斿洖璁板綍鐘舵�佷笉瀵癸級
+         */
+        SKIPPED
+    }
+}
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/DefaultInhospVisitDataService.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/DefaultInhospVisitDataService.java
index 4de36fb..202b093 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/DefaultInhospVisitDataService.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/DefaultInhospVisitDataService.java
@@ -73,6 +73,11 @@
     }
 
     @Override
+    public List<PatMedInhosp> selectInhospRefreshCandidates(String orgid) {
+        return patMedInhospMapper.selectInhospRefreshCandidates(orgid);
+    }
+
+    @Override
     public List<PatMedInhosp> selectPatMedInhospListByCondition(PatMedInhospVO patMedInhospVO) {
         return patMedInhospMapper.selectPatMedInhospListByCondition(patMedInhospVO);
     }
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitDataService.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitDataService.java
index 3c0af1e..e5f8f5c 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitDataService.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitDataService.java
@@ -99,6 +99,21 @@
     List<PatMedInhosp> selectPatMedInhospListBySerialnum(PatMedInhosp patMedInhosp);
 
     /**
+     * 鏌ヨ鏌愭満鏋勪笅鍏ㄩ儴鍦ㄩ櫌璁板綍锛�"鍦ㄩ櫌淇℃伅鍒锋柊"鐨勫彇鏁板叆鍙o級銆�
+     * <p>
+     * 鍙煡 {@code pat_med_inhosp} 鑷韩銆佸彧鍙栧埛鏂拌鐢ㄧ殑鍒楋紙inhospid / serialnum / orgid /
+     * campusid / 绉戝涓夊垪 / 鐥呭尯涓夊垪 / bed_no锛夛紝<b>涓� join 妗f琛ㄣ�佷笉鎸夎瘉浠跺彿杩囨护</b> 鈥斺��
+     * 鍚﹀垯璇佷欢鍙锋湭琛ュ叏鐨勫湪闄㈡偅鑰呬細琚潤榛樻紡鍒锋柊銆�
+     * <p>
+     * 鍦ㄩ櫌鍙e緞锛歿@code inhospstate='0' and del_flag='0'}锛堜笌闂ㄦ埛"鍦ㄩ櫌鎮h��"鍒楄〃涓�鑷达紝
+     * 瀹炴祴鍦ㄩ櫌琛� endtime 鎭掍负 null锛夈��
+     *
+     * @param orgid 鏈烘瀯ID锛堝 20001001锛�
+     * @return 鍦ㄩ櫌璁板綍闆嗗悎锛屾寜 inhospid 鍗囧簭锛涙棤鏁版嵁杩斿洖绌洪泦鍚�
+     */
+    List<PatMedInhosp> selectInhospRefreshCandidates(String orgid);
+
+    /**
      * 鎸� VO 鏉′欢鏌ヨ锛堟敮鎸佸绉戝/澶氱梾鍖洪泦鍚堟潯浠讹級銆�
      *
      * @param patMedInhospVO 鏌ヨ鏉′欢
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitFacade.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitFacade.java
index 4a0deab..1a89042 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitFacade.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/api/InhospVisitFacade.java
@@ -433,6 +433,13 @@
     }
 
     @Override
+    public java.util.List<com.ruoyi.inhospvisit.domain.PatMedInhosp> selectInhospRefreshCandidates(String orgid) {
+        return dataUnavailable("selectInhospRefreshCandidates")
+                ? java.util.Collections.<com.ruoyi.inhospvisit.domain.PatMedInhosp>emptyList()
+                : dataService.selectInhospRefreshCandidates(orgid);
+    }
+
+    @Override
     public java.util.List<com.ruoyi.inhospvisit.domain.PatMedInhosp> selectPatMedInhospListByCondition(
             com.ruoyi.inhospvisit.domain.PatMedInhospVO patMedInhospVO) {
         return dataUnavailable("selectPatMedInhospListByCondition")
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/controller/InhospVisitDataController.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/controller/InhospVisitDataController.java
index 51270c8..ade956e 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/controller/InhospVisitDataController.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/controller/InhospVisitDataController.java
@@ -11,6 +11,7 @@
 import com.ruoyi.common.core.service.dto.PatMedReq;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.inhospvisit.api.InhospVisitFacade;
 import com.ruoyi.inhospvisit.domain.PatMedInhosp;
@@ -79,7 +80,10 @@
     /**
      * 鏌ヨ鎮h�呬綇闄㈣褰曞垪琛ㄣ��
      * <p>
-     * 鍘� {@code PatMedInhospController#selectPatMedInhosplist}锛圠77-87锛夐�愯瀵瑰簲銆�
+     * 鍘� {@code PatMedInhospController#selectPatMedInhosplist}锛圠77-87锛夐�愯瀵瑰簲锛�
+     * 鍞竴澶氬嚭鏉ョ殑涓�琛屾槸 {@link #normalizeBedSort} 鈥斺�� 瑙佽鏂规硶娉ㄩ噴锛�
+     * 鍘熷疄鐜伴噷杩欐褰掍竴鍖栧湪 {@code PatMedInhospServiceImpl} 閲岋紝杩佸埌鏈ā鍧楀悗杩欐潯閾�
+     * 鐩存帴璋冮棬闈紝蹇呴』鎶婂畠璺熺潃鎼繃鏉ワ紝鍚﹀垯 {@code bedSort} 闈欓粯澶辨晥銆�
      */
     @ApiOperation("鏌ヨ鎮h�呬綇闄㈣褰曞垪琛�")
     //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:list')")
@@ -89,6 +93,8 @@
         PageUtils.startPageByPost(patMedInhosp.getPageNum(), patMedInhosp.getPageSize());
         SysUser user = getLoginUser().getUser();
         patMedInhosp.setOrgid(user.getOrgid());
+        // 鍓嶇浼犵殑鏄暟瀛� 1 / 2锛孲QL 鍙 "asc" / "desc"锛涗笉鍦ㄨ繖閲屽綊涓�灏辩瓑浜庢病浼�
+        patMedInhosp.setBedSort(normalizeBedSort(patMedInhosp.getCry(), patMedInhosp.getBedSort()));
         List<PatMedInhosp> list = inhospVisitFacade.selectPatMedInhospList(patMedInhosp);
         // startPage 涔嬪悗 PageHelper 宸茬粡鑷姩鎵ц杩囦竴娆� count 鏌ヨ锛岀洿鎺ュ鐢� Page 閲岀殑 total锛�
         // 閬垮厤鐢� PageUtils.count 鎶婂甫 JOIN 鐨勭粺璁¤鍙ュ啀璺戜竴閬�
@@ -172,12 +178,17 @@
      * 瀵煎嚭鎮h�呬綇闄㈣褰曞垪琛ㄣ��
      * <p>
      * 鍘� {@code PatMedInhospController#export}锛圠165-173锛夐�愯瀵瑰簲銆�
+     * <p>
+     * {@code bedSort} 涔熻褰掍竴锛氳縼鍑哄墠鐨� export 鍚屾牱璧�
+     * {@code patMedInhospService.selectPatMedInhospList(...)}锛堣 {@code ccf5fc76} 鐗堟湰锛夛紝
+     * 褰掍竴鍖栨槸闅忛偅娆¤皟鐢ㄧ敓鏁堢殑銆備笉琛ヨ繖涓�琛屽氨浼氬嚭鐜�"鍒楄〃鎸夊簥鍙锋帓濂戒簡銆佸鍑洪『搴忓張鍙樺洖鍘�"銆�
      */
     @ApiOperation("瀵煎嚭鎮h�呬綇闄㈣褰曞垪琛�")
     //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:export')")
     @Log(title = "鎮h�呬綇闄㈣褰�", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, PatMedInhosp patMedInhosp) {
+        patMedInhosp.setBedSort(normalizeBedSort(patMedInhosp.getCry(), patMedInhosp.getBedSort()));
         List<PatMedInhosp> list = inhospVisitFacade.selectPatMedInhospList(patMedInhosp);
         ExcelUtil<PatMedInhosp> util = new ExcelUtil<PatMedInhosp>(PatMedInhosp.class);
         util.exportExcel(response, list, "鎮h�呬綇闄㈣褰曟暟鎹�");
@@ -237,4 +248,50 @@
     public AjaxResult remove(@PathVariable Long[] inhospids) {
         return toAjax(inhospVisitFacade.deletePatMedInhospByInhospids(inhospids));
     }
+
+    /**
+     * 褰掍竴鍖�"鍏ラ櫌搴婁綅鎺掑簭"鍙傛暟銆�
+     * <p>
+     * 琛屼负涓� <b>{@code 鎺ュ彛鏂囨。/PatMedInhosp 鎮h�呬綇闄㈣褰曟帴鍙f枃妗�.md} 閲� bedSort 鐨勮鏄�</b>
+     * 浠ュ強杩佸嚭鍓嶇殑 {@code PatMedInhospServiceImpl#normalizeBedSort}锛坰martor锛孡213-219锛�
+     * 瀹屽叏涓�鑷达細
+     * <pre>
+     *   asc  / 1 -> "asc"   搴婁綅姝e簭
+     *   desc / 2 -> "desc"  搴婁綅鍊掑簭
+     *   鍏朵綑锛堝惈涓嶄紶銆佺┖涓层�侀潪娉曞�硷級-> null  涓嶆帓搴忥紝淇濇寔鍘熸湁榛樿鎺掑簭
+     *   鍙銆屽湪闄€�嶆煡璇紙cry=0锛夌敓鏁堬紱鍑洪櫌 / 杞 / 棰勫叆闄� 涓�寰嬪拷鐣ヨ鍙傛暟
+     * </pre>
+     * <p>
+     * 鈿狅笍 <b>涓轰粈涔堝繀椤诲湪 Java 渚у綊涓�锛岃�屼笉鏄 SQL 涔熻 "1"/"2"</b>锛�
+     * <ul>
+     *   <li>鍓嶇浼犵殑鏄� <b>鏁板瓧</b> {@code bedSort:1}锛孞ackson 钀藉埌 {@code String} 瀛楁鏄�
+     *       {@code "1"}锛岃�� mapper 鐨� {@code <choose>} 鍙尮閰嶅瓧绗︿覆 {@code "asc"/"desc"}
+     *       鈥斺�� 涓嶅綊涓�灏遍潤榛樿惤鍥為粯璁ゆ帓搴忥紝"鎸夊簥浣嶆帓搴�"杩欎釜鍔熻兘绛変簬娌$敓鏁堬紙鐪熷疄绾夸笂缂洪櫡锛夛紱</li>
+     *   <li>鍚屼竴涓帓搴忓绾﹁繕鍑虹幇鍦� {@code VisitInhospMapper.xml}锛堥殢璁挎壂鎻忛偅鏉¢摼锛�
+     *       鍏ュ弬鏄� {@code VisitInhospRow}锛夛紝鎶�"鍙 asc/desc"鐣欏湪 SQL 閲岋紝
+     *       涓ゆ潯閾惧澶栫殑绾﹀畾鎵嶆槸涓�鑷寸殑锛�</li>
+     *   <li>杩佸埌鏈ā鍧楀悗杩欐潯閾�<b>涓嶅啀缁忚繃</b> {@code PatMedInhospServiceImpl}锛�
+     *       鍘熷綊涓�鍖栦細闅忚縼鍑轰竴璧蜂涪鎺夛紝鎵�浠ユ惉鍒拌繖閲岃ˉ鍥炴潵銆�</li>
+     * </ul>
+     * 鐢� {@code sql/_probe/verify_patinhosp_bedsort.py} 鎶婂叧銆�
+     *
+     * @param cry     鍑哄叆闄㈡爣璇嗭細0 鍏ラ櫌(鍦ㄩ櫌) 1 鍑洪櫌 2 杞 3 棰勫叆闄�
+     * @param bedSort 鍓嶇浼犲叆鐨勫簥浣嶆帓搴忓�硷紙"asc"/"1"/"desc"/"2"/绌猴級
+     * @return {@code "asc"} / {@code "desc"} / {@code null}锛堜笉鎺掑簭锛�
+     */
+    private static String normalizeBedSort(Integer cry, String bedSort) {
+        // 鍙銆屽湪闄€�嶆煡璇㈢敓鏁堬細cry != 0 涓�寰嬬疆绌猴紝淇濊瘉鍑洪櫌绛夊満鏅帓搴忎笉鍙�
+        if (cry == null || cry != 0 || StringUtils.isEmpty(bedSort)) {
+            return null;
+        }
+        String value = bedSort.trim().toLowerCase();
+        if ("asc".equals(value) || "1".equals(value)) {
+            return "asc";
+        }
+        if ("desc".equals(value) || "2".equals(value)) {
+            return "desc";
+        }
+        // 闈炴硶鍊硷細涓嶆帓搴忥紙涓�"涓嶄紶"鍚屼箟锛夛紝閬垮厤钀藉埌 XML 鐨� <otherwise> 涔嬪鐨勮涓�
+        return null;
+    }
 }
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/PatMedInhospVO.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/PatMedInhospVO.java
index d06db89..7fc93b0 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/PatMedInhospVO.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/PatMedInhospVO.java
@@ -69,6 +69,21 @@
     private String inWardcheckFlag;
 
     /**
+     * 浠诲姟缁勬槸鍚﹀凡绾冲叆锛�0鏈撼鍏�   1宸茬撼鍏�   2璺宠繃/澶辫触
+     * <p>
+     * 鈿狅笍 鏈瓧娈电殑瀛樺湪鐞嗙敱鏄�<b>纭�х殑</b>锛屼笉鏄�"椤烘墜琛ラ綈"锛�
+     * {@code PatMedInhospMapper.xml#selectPatMedInhospListByCondition} 閲屾湁涓�鏉�
+     * {@code <if test="scheduleCheckFlag != null">}锛堜粠鍘� smartor 鐨� VO 璇彞閫愭潯鐓ф妱锛夈��
+     * MyBatis 鐢� OGNL 姹傚�� {@code test}锛�<b>缂� getter 浼氱洿鎺ユ姏</b>
+     * {@code ReflectionException: There is no getter for property named 'scheduleCheckFlag'}锛�
+     * 鑰屼笉鏄�"鏉′欢涓嶆垚绔�"鈥斺�� 涔熷氨鏄閭f潯鏌ヨ鍦ㄨˉ涓婃湰瀛楁涔嬪墠<b>涓�璋冪敤灏辩偢</b>
+     * 锛堝師 smartor 鐨� {@code PatMedInhospVO} 鍚屾牱娌℃湁杩欎釜瀛楁锛屽睘浜庣户鎵夸笅鏉ョ殑鑰佺己闄凤級銆�
+     * 瀹堝崼锛歿@code sql/_probe/verify_mapper_ognl_params.py}锛堝叏浠擄級銆�
+     */
+    @ApiModelProperty(value = "浠诲姟缁勬槸鍚﹀凡绾冲叆锛�0鏈撼鍏�   1宸茬撼鍏�   2璺宠繃/澶辫触")
+    private String scheduleCheckFlag;
+
+    /**
      * 鎶ゅ+ID
      */
     @ApiModelProperty(value = "鎶ゅ+ID")
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/row/VisitInhospRow.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/row/VisitInhospRow.java
index 67d83db..dad720e 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/row/VisitInhospRow.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/domain/row/VisitInhospRow.java
@@ -16,6 +16,12 @@
  *       {@code sql/_probe/verify_inhospvisit_mapper.py}锛堟帴鍙b啍XML 涓�鑷存�э級涓�
  *       {@code sql/_probe/verify_inhospvisit_sql_expansion.py}锛堝睍寮�鍚庨�愭潯姣斿锛孉ND 椤哄簭鏃犲叧锛�
  *       鍙屽悜鎶婂叧銆傛敼浠讳竴杈归兘蹇呴』鍚屾鏀瑰彟涓�杈瑰苟閲嶈窇杩欎袱涓帰閽堛��</li>
+ *   <li>鈿狅笍 杩樻湁涓�鏉℃洿纭殑绾緥锛�<b>XML 閲屽嚭鐜扮殑姣忎釜灞炴�э紝鏈被閮藉繀椤绘湁 getter</b>銆�
+ *       鍥犱负"閫愭潯绛変环"鎰忓懗鐫� XML 淇濈暀浜嗗師鏂囦欢鐨勫叏閮� {@code <if test=...>}锛堝惈闅忚閾句笂
+ *       涓嶅彲杈剧殑閭d簺锛夛紝鑰� MyBatis 鐢� OGNL 姹傚�艰繖浜� {@code test}鈥斺��
+ *       缂� getter 浼氱洿鎺ユ姏 {@code ReflectionException}锛堜笉鏄�"鏉′欢涓嶆垚绔�"锛夈��
+ *       2026-10 灏辨槸杩欎箞鎶� {@code dealOutHospInfo} 鏁存潯鎵撳仠鐨勶紙缂� {@code startOutHospTime}
+ *       绛� 15 涓繃婊ゅ睘鎬э級銆傚畧鍗細{@code sql/_probe/verify_mapper_ognl_params.py}锛堝叏浠擄級銆�</li>
  *   <li>鍙︿竴绉嶅仛娉曟槸鎶婃煡璇�"鍖呬竴灞傜鍙�"濮旀墭鍥� smartor锛屼絾閭f牱鏈ā鍧楀氨鍙墿缂栨帓閫昏緫銆�
  *       CRUD 鍏ㄩ潬鍥炶皟锛屽弽鑰屾洿纰庛�傝繖閲岄�夋嫨浜�"閲嶅浣嗗彲楠岃瘉"銆�</li>
  * </ul>
@@ -484,16 +490,31 @@
     // 浠ヤ笅瀛楁銆愪笉鏄� pat_med_inhosp 鐨勫垪銆戯紝鍙綔涓� selectForScan 鐨勮繃婊ゆ潯浠�/鎺掑簭寮�鍏炽��
     // 鏀惧湪鍚屼竴涓瀵硅薄閲岋紝鏄负浜嗚"鏌ヨ鏉′欢"涓�"缁撴灉琛�"鍏辩敤涓�濂楀睘鎬у悕 鈥斺��
     // 涓庡師瀹炵幇"鐢� PatMedInhosp 褰撴煡璇㈠叆鍙�"鐨勫啓娉曚繚鎸佷竴鑷达紝閬垮厤涓ゅ绫绘潵鍥炴槧灏勫嚭閿欍��
+    //
+    // 鈿狅笍鈿狅笍 杩欎竴缁勩�愬繀椤绘湁 getter銆戯紝鍝�曢殢璁跨敓鎴愰摼涓婁竴涓兘涓嶈瀹冿細
+    //     `VisitInhospMapper.xml#selectForScan` 鏄粠鍘� `PatMedInhospMapper.xml` 閫愭潯鐓ф妱鐨勶紝
+    //     閲岄潰淇濈暀浜嗗師鏂囦欢鐨勫叏閮� `<if test="xxx != null">`锛堝惈闅忚閾句笂涓嶅彲杈剧殑閭d簺锛夈��
+    //     MyBatis 鐢� OGNL 姹傚�� `test`锛�**璇讳笉鍒� getter 涓嶆槸"鏉′欢涓嶆垚绔�"锛岃�屾槸鐩存帴鎶�**锛�
+    //       ReflectionException: There is no getter for property named 'startOutHospTime'
+    //       in 'class com.ruoyi.inhospvisit.domain.row.VisitInhospRow'
+    //     鍚庢灉鏄� `InhospVisitTaskService#dealOutHospInfo` 鍦ㄧ涓�娆� `selectForScan` 灏变腑鏂紝
+    //     涓�鏉¢殢璁夸换鍔¢兘涓嶇敓鎴愶紙2026-10 瀹炴満韪╁埌锛宍sys_job_log` 閲岃〃鐜颁负
+    //     `InvocationTargetException`锛屽緢瀹规槗璇垽鎴愭ā鍧楀紑鍏虫病寮�锛夈��
+    //     瀹堝崼锛歚sql/_probe/verify_mapper_ognl_params.py`锛堝叏浠擄級
+    //     锛圶ML 寮曠敤灞炴�� 鈯� 鍙傛暟绫� getter锛岀己涓�涓氨 FAIL锛夈��
     // ==========================================================================
 
     /**
      * 鍑洪櫌/鍦ㄩ櫌缁村害寮�鍏筹紙鍘� {@code PatMedInhosp.cry}锛夛細
      * 0=鍦ㄩ櫌锛坽@code endtime is null}锛夈��1=宸插嚭闄€��2=杞銆�3=棰勫叆闄€��
      * <p>
+     * 鈿狅笍 绫诲瀷涓庡師瀹炰綋涓�鑷存槸 {@code Integer}锛屽洜涓� XML 閲屾槸**鏁板�兼瘮杈�**
+     * 锛坽@code cry == 0/1/2/3}锛夆�斺�� 鍐欐垚 String 浼氳 OGNL 闈犻殣寮忚浆鎹㈠幓姣旓紝璇箟涓嶆槑纭��
+     * <p>
      * 鈿狅笍 瀹冨悓鏃跺喅瀹氭帓搴忥細{@code cry=1/2/3} 鈫� {@code order by endtime desc}锛�
      * {@code cry=0} 鈫� 鎸� {@link #bedSort} 涓夐�変竴銆�
      */
-    private String cry;
+    private Integer cry;
 
     /**
      * 鍦ㄩ櫌鎮h�咃紙{@code cry=0}锛夌殑搴婁綅鎺掑簭鏂瑰悜锛�"asc" / "desc"锛涘叾瀹冨�艰蛋榛樿鎺掑簭銆�
@@ -502,6 +523,40 @@
      * 搴婁綅鎸夎嚜鐒跺簭鎺掞紙绌哄簥浣嶆渶鍚� 鈫� 绾暟瀛楁寜鏁板�� 鈫� 甯﹀瓧姣嶆寜闀垮害+瀛楃涓� 鈫� inhospid 鍏滃簳锛夈��
      */
     private String bedSort;
+
+    // ---- 鏃堕棿鍖洪棿杩囨护锛堝師 PatMedInhospMapper.xml 鐨� 4 涓� <if>锛� ----
+    /** 杩囨护锛氬嚭闄㈡椂闂村尯闂翠笅鐣� */
+    private Date startOutHospTime;
+    /** 杩囨护锛氬嚭闄㈡椂闂村尯闂翠笂鐣� */
+    private Date endOutHospTime;
+    /** 杩囨护锛氬叆闄㈡椂闂村尯闂翠笅鐣� */
+    private Date startInHospTime;
+    /** 杩囨护锛氬叆闄㈡椂闂村尯闂翠笂鐣� */
+    private Date endInHospTime;
+
+    // ---- 鍗曞�艰繃婊わ紙闅忚閾句笉鍙揪锛屼絾 XML 閲屼繚鐣欎簡鏉′欢锛� ----
+    /** 杩囨护锛氬璇婃寕鍙锋爣璇嗭紙鍘� {@code inhosp_myd_flag}锛� */
+    private String inhospMydFlag;
+    /** 杩囨护锛氬簥浣嶅彿锛堝師 {@code bed_no}锛� */
+    private String bedNo;
+    /** 杩囨护锛氱闄㈡柟寮廔D */
+    private String outWayId;
+    /** 杩囨护锛氱闄㈡柟寮忓悕绉� */
+    private String outWayName;
+    /** 杩囨护锛氬氨璇婃潵婧怚D */
+    private String encounterSourceId;
+    /** 杩囨护锛氶噸瑕佺▼搴︿唬鐮� */
+    private String importanceFlagCode;
+    /** 杩囨护锛氭�ヨ瘖鍒嗙骇浠g爜 */
+    private String emergencyLevelCode;
+    /** 杩囨护锛氬尰闄㈠悕绉帮紙鍘� XML 閲岃鍒楁湭鍔犺〃鍒悕锛� */
+    private String hospitalname;
+    /** 杩囨护锛氳嵂鍝佸悕绉帮紙鐪佺珛鍚屽痉鑽搧瀹f暀锛� */
+    private String medicalName;
+    /** 杩囨护锛氳嵂鍝佸叕鍙革紙鐪佺珛鍚屽痉鑽搧瀹f暀锛� */
+    private String medicalCompany;
+    /** 杩囨护锛氭帓鐝姸鎬侊紙鍘熺被鍨� {@code Long}锛� */
+    private Long schemestatus;
 
     /** 杩囨护锛氱闄㈢瀹ょ紪鐮佸垪琛紙鍘� {@code leaveldeptcodes}锛� */
     private java.util.List<String> leaveldeptcodes;
@@ -514,11 +569,11 @@
     /** 杩囨护锛氱闄� ICD10 缂栫爜鍒楄〃锛堝師 {@code icd10codeList}锛� */
     private java.util.List<String> icd10codeList;
 
-    public String getCry() {
+    public Integer getCry() {
         return cry;
     }
 
-    public void setCry(String cry) {
+    public void setCry(Integer cry) {
         this.cry = cry;
     }
 
@@ -530,6 +585,126 @@
         this.bedSort = bedSort;
     }
 
+    public Date getStartOutHospTime() {
+        return startOutHospTime;
+    }
+
+    public void setStartOutHospTime(Date startOutHospTime) {
+        this.startOutHospTime = startOutHospTime;
+    }
+
+    public Date getEndOutHospTime() {
+        return endOutHospTime;
+    }
+
+    public void setEndOutHospTime(Date endOutHospTime) {
+        this.endOutHospTime = endOutHospTime;
+    }
+
+    public Date getStartInHospTime() {
+        return startInHospTime;
+    }
+
+    public void setStartInHospTime(Date startInHospTime) {
+        this.startInHospTime = startInHospTime;
+    }
+
+    public Date getEndInHospTime() {
+        return endInHospTime;
+    }
+
+    public void setEndInHospTime(Date endInHospTime) {
+        this.endInHospTime = endInHospTime;
+    }
+
+    public String getInhospMydFlag() {
+        return inhospMydFlag;
+    }
+
+    public void setInhospMydFlag(String inhospMydFlag) {
+        this.inhospMydFlag = inhospMydFlag;
+    }
+
+    public String getBedNo() {
+        return bedNo;
+    }
+
+    public void setBedNo(String bedNo) {
+        this.bedNo = bedNo;
+    }
+
+    public String getOutWayId() {
+        return outWayId;
+    }
+
+    public void setOutWayId(String outWayId) {
+        this.outWayId = outWayId;
+    }
+
+    public String getOutWayName() {
+        return outWayName;
+    }
+
+    public void setOutWayName(String outWayName) {
+        this.outWayName = outWayName;
+    }
+
+    public String getEncounterSourceId() {
+        return encounterSourceId;
+    }
+
+    public void setEncounterSourceId(String encounterSourceId) {
+        this.encounterSourceId = encounterSourceId;
+    }
+
+    public String getImportanceFlagCode() {
+        return importanceFlagCode;
+    }
+
+    public void setImportanceFlagCode(String importanceFlagCode) {
+        this.importanceFlagCode = importanceFlagCode;
+    }
+
+    public String getEmergencyLevelCode() {
+        return emergencyLevelCode;
+    }
+
+    public void setEmergencyLevelCode(String emergencyLevelCode) {
+        this.emergencyLevelCode = emergencyLevelCode;
+    }
+
+    public String getHospitalname() {
+        return hospitalname;
+    }
+
+    public void setHospitalname(String hospitalname) {
+        this.hospitalname = hospitalname;
+    }
+
+    public String getMedicalName() {
+        return medicalName;
+    }
+
+    public void setMedicalName(String medicalName) {
+        this.medicalName = medicalName;
+    }
+
+    public String getMedicalCompany() {
+        return medicalCompany;
+    }
+
+    public void setMedicalCompany(String medicalCompany) {
+        this.medicalCompany = medicalCompany;
+    }
+
+    public Long getSchemestatus() {
+        return schemestatus;
+    }
+
+    public void setSchemestatus(Long schemestatus) {
+        this.schemestatus = schemestatus;
+    }
+
     public java.util.List<String> getLeaveldeptcodes() {
         return leaveldeptcodes;
     }
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/mapper/PatMedInhospMapper.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/mapper/PatMedInhospMapper.java
index 6403a01..5dd60b8 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/mapper/PatMedInhospMapper.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/mapper/PatMedInhospMapper.java
@@ -64,6 +64,23 @@
     public List<PatMedInhosp> selectPatMedInhospListByCondition(PatMedInhospVO patMedInhospVO);
 
     /**
+     * 鏌ヨ鏌愭満鏋勪笅鍏ㄩ儴鍦ㄩ櫌璁板綍鐨�"鍒锋柊鍊欓��"锛堜緵鍦ㄩ櫌淇℃伅鍒锋柊鎸夋偅鑰呴�愭潯鏍稿浣嶇疆锛夈��
+     * <p>
+     * 涓� {@link #selectPatMedInhospList} 鐨勫尯鍒槸鍒绘剰鐨勶細
+     * <ul>
+     *   <li>涓� join {@code pat_archive}銆佷笉鍋� GROUP BY 鈥斺�� 鏈敤閫斿彧鐪� {@code pat_med_inhosp} 鑷韩锛�
+     *   <li>涓嶅甫 {@code a.idcardno IS NOT NULL} 杩欑被杩囨护锛堥偅浼氳"璇佷欢鍙疯繕娌¤ˉ涓婄殑鏂板叆闄㈡偅鑰�"
+     *       闈欓粯婕忓埛鏂� 鈥斺�� 閲囬泦閾捐矾鏈�鎬曠殑灏辨槸闈欓粯灏戞暟鎹級锛�
+     *   <li>鍙� select 鍒锋柊鐢ㄥ緱鍒扮殑鍒楋紙inhospid / serialnum / patname / orgid / campusid /
+     *       绉戝涓夊垪 / 鐥呭尯涓夊垪 / bed_no锛夛紝3000 琛岄噺绾х殑姣忔棩鍏ㄩ噺鎵弿瓒冲杞汇��</li>
+     * </ul>
+     *
+     * @param orgid 鏈烘瀯ID锛堝 20001001锛�
+     * @return 鍦ㄩ櫌锛坽@code inhospstate='0' and del_flag='0'}锛夎褰曢泦鍚堬紝鎸� inhospid 鍗囧簭
+     */
+    public List<PatMedInhosp> selectInhospRefreshCandidates(@Param("orgid") String orgid);
+
+    /**
      * 鏂板鎮h�呬綇闄㈣褰�
      *
      * @param patMedInhosp 鎮h�呬綇闄㈣褰�
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospSubtaskWriter.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospSubtaskWriter.java
index 3758e0f..2c3db08 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospSubtaskWriter.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospSubtaskWriter.java
@@ -105,9 +105,14 @@
      * @param archive  鎮h�呮。妗�
      * @param type     0=鑽搧瀹f暀 / 1=绂婚櫌绉戝 / 2=绂婚櫌鐥呭尯 / 3=鐤剧梾 / 4=鍏ラ櫌绉戝 / 5=鍏ラ櫌鐥呭尯
      * @param config   {@code sys_config: visit.early.day}
+     * @return <b>鏄惁鐪熺殑钀戒簡搴�</b>锛堟垨"鏈潵灏卞凡缁忔湁"锛夈��
+     *         杩斿洖鍊兼槸 2026-10"涓�涓偅鑰呭彧鐢熸垚涓�鏉¢殢璁夸换鍔�"鏀归�犵殑鍒ゆ嵁锛�
+     *         缂栨帓灞傛寜缁村害浼樺厛绾ч�愪釜灏濊瘯锛屽彧鏈夋嬁鍒� {@code true} 鎵嶇畻璇ョ淮搴︽垚鍔熷苟鍋滄銆�
+     *         鍘熷疄鐜版槸 {@code void}锛岀紪鎺掑眰鐢�"璋冪敤浜嗗嚑娆�"褰撴垚鍔熸暟 鈥斺�� 閭f槸閿欑殑
+     *         锛堜换鍔℃湭鍙戝竷/琚幓閲嶆椂鍚屾牱鏄�"鐢熸垚浜嗕竴鏉�"锛夈��
      */
-    public void writeInSubTask(Long taskid, Boolean check, VisitInhospRow inhosp,
-                               VisitArchiveRow archive, Integer type, String config) {
+    public boolean writeInSubTask(Long taskid, Boolean check, VisitInhospRow inhosp,
+                                  VisitArchiveRow archive, Integer type, String config) {
         // 鍘� L683-685
         String longTaskReason = inhosp.getLongTaskReason();
         String orgId = inhosp.getOrgid();
@@ -120,17 +125,32 @@
         if (taskApi == null) {
             log.warn("銆愬嚭鍏ラ櫌闅忚銆慥isitTaskCreateApi 涓嶅彲鐢紙浠诲姟鍒涘缓妯″潡鏈閰嶏級锛屾湰鎮h�呬笉鐢熸垚瀛愪换鍔°��"
                     + "inhospid={}, taskid={}", inhosp.getInhospid(), taskid);
-            return;
+            return false;
         }
         VisitLongTaskDto serviceTask = taskApi.findPublishedLongTask(taskid);
         if (serviceTask == null) {
             writeMissingTaskFlag(inhosp, type, longTaskReason, taskid);
-            return;
+            return false;
         }
 
         // 鍘� L729-731
         if ("1".equals(inhosp.getInhospstate()) && inhosp.getEndtime() == null) {
-            return;
+            return false;
+        }
+
+        // ------------------------------------------------------------------
+        // 銆愭敼閫犅�2026-10銆戣惤搴撳墠鏈�鍚庝竴閬撳垽閲嶏細
+        //   鍚屼竴鎮h�� + 鍚屼竴娆″嚭闄㈣褰� + 鍚屼竴浠诲姟锛屽彧瑕佸凡缁忔湁涓�鏉℃湭鍒犻櫎鐨勫瓙浠诲姟锛堝惈宸插仠鐢ㄧ殑锛夛紝
+        //   灏变笉鍐� insert銆傚師鍥犺 VisitTaskCreateApi#existsSubtask 鐨勬敞閲婏細
+        //   鎮h�呰閲嶅鎵埌鏃朵細璧�"鍋滄棫 + 鍐� insert 涓�鏉� sendstate=4"鐨勫垎鏀紝
+        //   姣忚窇涓�杞涓�鏉★紝鏈�缁堝悓涓�鎮h�呭嚑鍗佹潯銆�
+        // ------------------------------------------------------------------
+        if (taskApi.existsSubtask(archive == null ? null : archive.getId(),
+                inhosp.getInhospid(), taskid)) {
+            log.info("銆愬嚭鍏ラ櫌闅忚銆戞偅鑰厈}鍑洪櫌璁板綍{}浠诲姟{}宸叉湁瀛愪换鍔★紝璺宠繃閲嶅鐢熸垚銆�",
+                    inhosp.getPatid(), inhosp.getInhospid(), taskid);
+            writeFlagByType(inhosp.getInhospid(), type, "1", null);
+            return true;
         }
 
         // 鍘� L732-736锛氱粍瑁咃紙鍓綔鐢ㄧ敱鏈被瀹炵幇锛岃 missingOutHospTime锛�
@@ -138,7 +158,7 @@
                 toTaskSource(serviceTask, inhosp), inhosp, archive, config, type,
                 row -> onMissingOutHospTime(row));
         if (ObjectUtils.isEmpty(serviceSubtask)) {
-            return;
+            return false;
         }
 
         // 鍘� L737-753锛氬氨璇婄瀹�/鐥呭尯濉厖
@@ -286,6 +306,7 @@
                         serviceSubtask.getTaskid(), serviceSubtask.getPatid());
                 writeFlagByType(inhosp.getInhospid(), type, "2", "鐢熸垚瀛愪换鍔″け璐� " + type);
             }
+            return i == 1;
         } catch (Exception e) {
             // 鍘� L900-912锛氬嚭閿欏洖婊氫簨鍔�
             log.info("鐢熸垚瀛愪换鍔℃姤閿欏洖婊歴erviceSubtask鐨則askid涓猴細{},patid涓猴細{}",
@@ -294,6 +315,7 @@
             //     鍘熸牱淇濈暀锛堣绫绘敞閲婄 1 鏉★級銆�
             writeFlagByTypeForRollback(inhosp.getInhospid(), type, "2", "鐢熸垚瀛愪换鍔℃姤閿欏洖婊� " + type);
             e.printStackTrace();
+            return false;
         }
     }
 
@@ -478,16 +500,25 @@
         com.ruoyi.inhospvisit.domain.row.VisitTaskRow t = new com.ruoyi.inhospvisit.domain.row.VisitTaskRow();
         t.setTaskid(dto.getTaskid());
         t.setTaskName(dto.getTaskName());
+        t.setTaskDesc(dto.getTaskDesc());
         t.setType(dto.getType());
         t.setServiceType(dto.getServiceType());
         t.setTemplateid(dto.getTemplateid());
         t.setTemplatename(dto.getTemplatename());
         t.setLibtemplateid(dto.getLibtemplateid());
+        t.setLibtemplatename(dto.getLibtemplatename());
         t.setSendDay(dto.getSendDay());
         t.setPreachform(dto.getPreachform());
         t.setPreachformDesc(dto.getPreachformDesc());
         t.setOrgid(dto.getOrgid());
         t.setCampusid(dto.getCampusid());
+        // 浠ヤ笅 6 涓悓鏍峰睘浜�"鍘� DtoConversionUtils 鎷疯礉銆侀殢 insert 钀藉簱"鐨勫垪
+        t.setGuid(dto.getGuid());
+        t.setPid(dto.getPid());
+        t.setSendType(dto.getSendType());
+        t.setIsupload(dto.getIsupload());
+        t.setTextParam(dto.getTextParam());
+        t.setUploadTime(dto.getUploadTime());
         t.setUpdateBy(dto.getUpdateBy());
         t.setCreateBy(dto.getCreateBy());
         return t;
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospTaskOrchestrator.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospTaskOrchestrator.java
index 2d460cf..a437710 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospTaskOrchestrator.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospTaskOrchestrator.java
@@ -21,12 +21,26 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 /**
  * 鍑洪櫌闅忚銆岀紪鎺掑櫒銆嶁�斺�� 閫愯鎼嚜 {@code PatMedInhospServiceImpl}
  * 鐨勭紪鎺掑眰锛坽@code addSubTaskByRule} + 3 涓� {@code *ForPatient} + {@code dealInHospInfo}锛夈��
+ *
+ * <h3>鈿狅笍 2026-10 鍙e緞鍙樻洿锛氫竴涓偅鑰咃紙涓�娆″嚭闄級鍙敓鎴� <b>涓�鏉�</b> 闅忚瀛愪换鍔�</h3>
+ * 鎼縼鏃舵湰绫绘槸"閫愯绛変环"鐨勶紙鍘熷疄鐜版寜缁村害鍏ㄧ敓鎴愶細姣忎釜 {@code *ForPatient} 鎶婂懡涓殑
+ * <b>鎵�鏈�</b>闀挎湡浠诲姟鍚勫啓涓�鏉★級銆備笟鍔$‘璁ゆ敼涓猴細
+ * <ol>
+ *   <li>缁村害鎸� {@code service_task_rule} 浼樺厛绾ф帓搴忓皾璇曪細棣栬 鈫� 娆¤ 鈫� 閫氱敤鍏滃簳锛堢瀹ゃ�佺梾鍖猴級锛�</li>
+ *   <li>绗竴涓湡姝h惤搴撴垚鍔熺殑缁村害鍗冲仠姝� 鈫� 鍙暀涓�鏉★紱</li>
+ *   <li>鏃犺鍒欐椂鎸� {@code service_taskdept} 鐨勭瀹�/鐥呭尯"閫氱敤妯″潡"鐢熸垚锛�</li>
+ *   <li>鏍囧織浣嶇粺涓�鍥炲啓锛屼繚璇� {@code deptcheck_flag} 涓嶅啀鍋滃湪 0锛堥槻閲嶅鎵弿锛夛紱
+ *       骞跺湪鍐欏簱鍓嶆寜 {@code patid+inhospid+taskid} 鍒ら噸锛堣 {@code VisitTaskCreateApi#existsSubtask}锛夈��</li>
+ * </ol>
+ * 鍥犳 {@code verify_inhospvisit_orchestration_semantics.py} 閲� O18~O23 閭� 6 鏉�
+ * "鎼縼绛変环"鏂█宸茶鏀逛负"鍙e緞鍙樻洿"鏂█锛堣剼鏈噷鍗曠嫭鍒嗙粍骞舵敞鏄庝緷鎹級銆�
  *
  * <h3>鏉ユ簮瀵圭収锛園 b25c3b51锛�</h3>
  * <table border="1">
@@ -122,165 +136,192 @@
 
     /**
      * 鎸� {@code service_task_rule} 鐨勩�岄瑕�(1)/娆¤(2)銆嶈鍒欑紪鎺掔瀹�/鐥呭尯/鐤剧梾涓変釜缁村害銆�
+     *
+     * <h3>鈿狅笍 2026-10 鍙e緞鍙樻洿锛氫竴涓偅鑰咃紙涓�娆″嚭闄級鍙敓鎴� <b>涓�鏉�</b> 闅忚瀛愪换鍔�</h3>
+     * 鍘熷疄鐜帮紙浠ュ強鎼縼鍚庣殑绛変环鐗堬級鏄寜缁村害"鍏ㄧ敓鎴�"锛氬厛璺戞墍鏈夈�岄瑕併�嶇淮搴︾殑
+     * {@code *ForPatient}锛岃�屾瘡涓� {@code *ForPatient} 鍙堟妸鍛戒腑鐨�<b>鎵�鏈�</b>闀挎湡浠诲姟鍚勫啓涓�鏉°��
+     * 缁撴灉鏄悓涓�鎮h�呬竴娆″嚭闄㈣兘鐢熸垚鍑犲崄鏉★紙绾夸笂瀹炴祴 27 鏉★級锛岃�屼笖鍥犱负鎵弿閿�
+     * {@code deptcheck_flag} 鍦�"鍙湁鐥呭尯/鐤剧梾缁村害"鐨勮鍒欎笅涓嶄細琚疆 1锛�
+     * 鎮h�呮瘡杞壂鎻忛兘琚噸鏂板鐞� 鈫� 閲嶅瀛愪换鍔℃寔缁疮绉��
      * <p>
-     * 閫愯瀵瑰簲鍘� {@code addSubTaskByRule(String config, List<PatMedInhosp> patMedInhosps)}銆�
-     * <p>
-     * 鈿狅笍 瑙勫垯鏌ヨ {@code serviceTaskRuleMapper.selectServiceTaskRuleByDeptOrWard} 浠嶅湪 smartor锛�
-     * 鎵�浠ユ湰鏂规硶鎺ユ敹<b>宸叉煡濂界殑瑙勫垯</b>锛堢敱璋冪敤鏂� {@code InhospVisitTaskService} 閫氳繃
-     * {@code PublicityDataPort} 鍙栤�斺�旇绔彛宸插惈"鎸夌瀹�/鐥呭尯鏌ヨ鍒�"鐨勮兘鍔涳紝瑙佷笅锛夈��
-     * 杩欐牱鍋氭槸涓轰簡閬垮厤涓�"瑙勫垯琛�"鍐嶅姞涓�涓� Mapper 鎴栫鍙c��
+     * 鐜板彛寰勶紙涓氬姟纭锛夛細
+     * <ol>
+     *   <li>鎶婁笁涓淮搴︽寜瑙勫垯浼樺厛绾ф帓鎴愪竴涓�<b>灏濊瘯椤哄簭</b>锛�
+     *       棣栬(1) 鈫� 娆¤(2) 鈫� 閫氱敤鍏滃簳锛堢瀹ゃ�佺梾鍖猴級锛涘悓浼樺厛绾у唴鍥哄畾 绉戝 &gt; 鐥呭尯 &gt; 鐤剧梾銆�
+     *       {@code service_task_rule} 娌℃湁璇ユ偅鑰呯瀹�/鐥呭尯瀵瑰簲鐨勮鍒欐椂 鈫� 椤哄簭涓� 绉戝 鈫� 鐥呭尯
+     *       锛堝嵆"鎸� {@code service_taskdept} 閲岀殑閫氱敤妯″潡鐢熸垚"锛夈��</li>
+     *   <li>鎸夐『搴忛�愪釜缁村害灏濊瘯锛�<b>绗竴涓湡姝h惤搴撴垚鍔燂紙鎴栧凡瀛樺湪锛夌殑缁村害鍗冲仠姝�</b> 鈥斺�� 鍙暀涓�鏉°��</li>
+     *   <li>鏈�鍚庣粺涓�鍥炲啓鏍囧織浣嶏細鍛戒腑缁村害 = {@code 1}锛涘叾浣欑淮搴� = {@code 2}锛堣烦杩囷級锛�
+     *       涓�<b>鏃犺鍛戒腑鍝釜缁村害锛寋@code deptcheck_flag} 涓�瀹氫細琚啓鎴愰潪 0</b>
+     *       鈥斺�� 杩欏氨鏄�"涓嶅啀琚笅涓�杞壂鎻忛噸澶嶇敓鎴�"鐨勪繚璇併��</li>
+     * </ol>
+     * 鍙︽湁涓�閬撳厹搴曞湪 {@code InhospSubtaskWriter#writeInSubTask}锛氳惤搴撳墠鎸�
+     * {@code patid + inhospid + taskid} 鍒ら噸锛岃 {@link VisitTaskCreateApi#existsSubtask}銆�
+     *
+     * <h3>绔欑偣宸紓锛堜繚鐣欙級</h3>
+     * {@code xh} 鍙仛绉戝缁村害 鈥斺�� {@link #addDimension} 閲岀粺涓�鎸℃帀鐥呭尯/鐤剧梾銆�
      *
      * @param inhosp 寰呭鐞嗙殑鍑洪櫌鎮h��
      * @param archive 鎮h�呮。妗�
-     * @param rule 宸叉煡濂界殑瑙勫垯锛泏@code null} = 鏈厤缃鍒欙紙鍏ㄩ儴鐢熸垚锛�
+     * @param rule 宸叉煡濂界殑瑙勫垯锛泏@code null} = 璇ョ瀹�/鐥呭尯鏈厤缃鍒�
      * @param config {@code sys_config: visit.early.day}
      */
     public void addSubTaskByRule(VisitInhospRow inhosp, VisitArchiveRow archive,
                                  VisitTaskRule rule, String config) {
         try {
-            if (rule == null) {
-                // 鍘� L1709-1716锛氳鍒欎负绌猴紝鍏ㄩ儴鐢熸垚
-                log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}鏈厤缃鍒欙紝鎵ц鍏ㄩ儴鐢熸垚閫昏緫", inhosp.getInhospid());
-                addDeptSubTaskForPatient(inhosp, archive, config);
-                if (!SITE_XH.equals(active)) {
-                    addWardSubTaskForPatient(inhosp, archive, config);
-                    addIcd10SubTaskForPatient(inhosp, archive, config);
-                }
-                return;
-            }
-            // 鍘� L1717-1726锛氭湁瑙勫垯锛屾寜瑙勫垯鎵ц
-            log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}鏌ヨ鍒拌鍒欙細deptRule={}, wradRule={}, diagRule={}",
-                    inhosp.getInhospid(), rule.getDeptRule(), rule.getWradRule(), rule.getDiagRule());
+            List<Integer> order = resolveDimensionOrder(rule);
+            log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}瑙勫垯锛歞eptRule={}, wradRule={}, diagRule={}锛涚淮搴﹀皾璇曢『搴�={}",
+                    inhosp.getInhospid(),
+                    rule == null ? null : rule.getDeptRule(),
+                    rule == null ? null : rule.getWradRule(),
+                    rule == null ? null : rule.getDiagRule(), order);
 
-            boolean deptIsPrimary = "1".equals(rule.getDeptRule());
-            boolean wardIsPrimary = "1".equals(rule.getWradRule());
-            boolean diagIsPrimary = "1".equals(rule.getDiagRule());
-            boolean deptIsSecondary = "2".equals(rule.getDeptRule());
-            boolean wardIsSecondary = "2".equals(rule.getWradRule());
-            boolean diagIsSecondary = "2".equals(rule.getDiagRule());
-
-            boolean hasPrimaryRule = deptIsPrimary || wardIsPrimary || diagIsPrimary;
-
-            if (!hasPrimaryRule) {
-                // 鍘� L1829-1837锛氭病鏈夐瑕佽鍒欙紝鍏ㄩ儴鐢熸垚
-                log.info("銆愬熀浜庤鍒欍�戞棤棣栬瑙勫垯锛屾墽琛屽叏閮ㄧ敓鎴愰�昏緫");
-                addDeptSubTaskForPatient(inhosp, archive, config);
-                if (!SITE_XH.equals(active)) {
-                    addWardSubTaskForPatient(inhosp, archive, config);
-                    addIcd10SubTaskForPatient(inhosp, archive, config);
-                }
-                return;
-            }
-
-            // 鍘� L1730-1754锛氬厛鎵ц鎵�鏈夎鍒�=1 鐨勬柟娉�
-            int deptGenCount = 0;
-            int wardGenCount = 0;
-            int diagGenCount = 0;
-
-            if (deptIsPrimary) {
-                log.info("銆愬熀浜庤鍒欍�戞墽琛岀瀹ら瑕佽鍒�");
-                deptGenCount = addDeptSubTaskForPatient(inhosp, archive, config);
-            }
-            if (!SITE_XH.equals(active)) {
-                if (wardIsPrimary) {
-                    log.info("銆愬熀浜庤鍒欍�戞墽琛岀梾鍖洪瑕佽鍒�");
-                    wardGenCount = addWardSubTaskForPatient(inhosp, archive, config);
-                }
-                if (diagIsPrimary) {
-                    log.info("銆愬熀浜庤鍒欍�戞墽琛岀柧鐥呴瑕佽鍒�");
-                    diagGenCount = addIcd10SubTaskForPatient(inhosp, archive, config);
+            Integer hit = null;
+            for (Integer type : order) {
+                log.info("銆愬熀浜庤鍒欍�戞偅鑰厈}灏濊瘯缁村害{}锛坽}锛�", inhosp.getInhospid(), type, dimensionName(type));
+                if (generateOneForDimension(inhosp, archive, type, config)) {
+                    hit = type;
+                    break;
                 }
             }
 
-            int primaryGeneratedCount = deptGenCount + wardGenCount + diagGenCount;
-            log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欐墽琛岀粨鏋�: deptGen={}, wardGen={}, diagGen={}, total={}",
-                    deptGenCount, wardGenCount, diagGenCount, primaryGeneratedCount);
-
-            String remark = inhosp.getRemark();
-
-            if (primaryGeneratedCount > 0) {
-                // 鍘� L1758-1796锛氳嚦灏戜竴涓瑕佽鍒欐垚鍔�
-                log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欐湁鎴愬姛(count={})锛屽皢娆¤瑙勫垯瀵瑰簲flag璁句负2", primaryGeneratedCount);
-                if (deptIsSecondary) {
-                    updateCheckFlag(inhosp, 1, "2", StringUtils.isNotEmpty(remark)
-                            ? remark + ";棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃" : "棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃");
-                }
-                if (!SITE_XH.equals(active)) {
-                    if (wardIsSecondary) {
-                        updateCheckFlag(inhosp, 2, "2", StringUtils.isNotEmpty(remark)
-                                ? remark + ";棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃" : "棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃");
-                    }
-                    if (diagIsSecondary) {
-                        updateCheckFlag(inhosp, 3, "2", StringUtils.isNotEmpty(remark)
-                                ? remark + ";棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃" : "棣栬瑙勫垯宸茬敓鎴愶紝娆¤瑙勫垯璺宠繃");
-                    }
-                }
-                if (deptIsPrimary && deptGenCount > 0) {
-                    updateCheckFlag(inhosp, 1, "1", StringUtils.isNotEmpty(remark)
-                            ? remark + ";绉戝棣栬瑙勫垯鐢熸垚鎴愬姛" : "绉戝棣栬瑙勫垯鐢熸垚鎴愬姛");
-                }
-                if (!SITE_XH.equals(active)) {
-                    if (wardIsPrimary && wardGenCount > 0) {
-                        updateCheckFlag(inhosp, 2, "1", StringUtils.isNotEmpty(remark)
-                                ? remark + ";鐥呭尯棣栬瑙勫垯鐢熸垚鎴愬姛" : "鐥呭尯棣栬瑙勫垯鐢熸垚鎴愬姛");
-                    }
-                    if (diagIsPrimary && diagGenCount > 0) {
-                        updateCheckFlag(inhosp, 3, "1", StringUtils.isNotEmpty(remark)
-                                ? remark + ";鐤剧梾棣栬瑙勫垯鐢熸垚鎴愬姛" : "鐤剧梾棣栬瑙勫垯鐢熸垚鎴愬姛");
-                    }
-                }
-                if (deptIsPrimary && deptGenCount == 0) {
-                    updateCheckFlag(inhosp, 1, "2", StringUtils.isNotEmpty(remark)
-                            ? remark + ";绉戝棣栬瑙勫垯鐢熸垚澶辫触" : "绉戝棣栬瑙勫垯鐢熸垚澶辫触");
-                }
-                if (!SITE_XH.equals(active)) {
-                    if (wardIsPrimary && wardGenCount == 0) {
-                        updateCheckFlag(inhosp, 2, "2", StringUtils.isNotEmpty(remark)
-                                ? remark + ";鐥呭尯棣栬瑙勫垯鐢熸垚澶辫触" : "鐥呭尯棣栬瑙勫垯鐢熸垚澶辫触");
-                    }
-                    if (diagIsPrimary && diagGenCount == 0) {
-                        updateCheckFlag(inhosp, 3, "2", StringUtils.isNotEmpty(remark)
-                                ? remark + ";鐤剧梾棣栬瑙勫垯鐢熸垚澶辫触" : "鐤剧梾棣栬瑙勫垯鐢熸垚澶辫触");
-                    }
-                }
-            } else {
-                // 鍘� L1797-1828锛氭墍鏈夐瑕佽鍒欏叏閮ㄥけ璐� 鈫� 鎶� =1 鐨勭疆 2锛岀劧鍚庢墽琛屾瑕佽鍒�
-                log.info("銆愬熀浜庤鍒欍�戦瑕佽鍒欏叏閮ㄥけ璐ワ紝灏�=1鐨刦lag璁句负2锛屽紑濮嬫墽琛屾瑕佽鍒�");
-                if (deptIsPrimary) {
-                    updateCheckFlag(inhosp, 1, "2", StringUtils.isNotEmpty(remark)
-                            ? remark + ";绉戝棣栬瑙勫垯鍏ㄩ儴澶辫触" : "绉戝棣栬瑙勫垯鍏ㄩ儴澶辫触");
-                }
-                if (!SITE_XH.equals(active)) {
-                    if (wardIsPrimary) {
-                        updateCheckFlag(inhosp, 2, "2", StringUtils.isNotEmpty(remark)
-                                ? remark + ";鐥呭尯棣栬瑙勫垯鍏ㄩ儴澶辫触" : "鐥呭尯棣栬瑙勫垯鍏ㄩ儴澶辫触");
-                    }
-                    if (diagIsPrimary) {
-                        updateCheckFlag(inhosp, 3, "2", StringUtils.isNotEmpty(remark)
-                                ? remark + ";鐤剧梾棣栬瑙勫垯鍏ㄩ儴澶辫触" : "鐤剧梾棣栬瑙勫垯鍏ㄩ儴澶辫触");
-                    }
-                }
-                if (deptIsSecondary) {
-                    log.info("銆愬熀浜庤鍒欍�戞墽琛岀瀹ゆ瑕佽鍒�");
-                    addDeptSubTaskForPatient(inhosp, archive, config);
-                }
-                if (!SITE_XH.equals(active)) {
-                    if (wardIsSecondary) {
-                        log.info("銆愬熀浜庤鍒欍�戞墽琛岀梾鍖烘瑕佽鍒�");
-                        addWardSubTaskForPatient(inhosp, archive, config);
-                    }
-                    if (diagIsSecondary) {
-                        log.info("銆愬熀浜庤鍒欍�戞墽琛岀柧鐥呮瑕佽鍒�");
-                        addIcd10SubTaskForPatient(inhosp, archive, config);
-                    }
-                }
-            }
+            writeFlagsAfterRun(inhosp, hit);
         } catch (Exception e) {
             // 鍘� L1839-1845
             e.printStackTrace();
             log.error("銆愬熀浜庤鍒欍�戞偅鑰厈}澶勭悊寮傚父锛歿}", inhosp.getInhospid(), e.getMessage());
             updateCheckFlag(inhosp, 1, "2", "鍩轰簬瑙勫垯澶勭悊寮傚父");
         }
+    }
+
+    /**
+     * 缁村害灏濊瘯椤哄簭锛�2026-10 鍙e緞锛夈��
+     * <p>
+     * 瑙勫垯涓� {@code null} 鈫� {@code [绉戝, 鐥呭尯]}锛氭寜 {@code service_taskdept} 閲岃鎮h�呯殑
+     * 绉戝/鐥呭尯"閫氱敤妯″潡"鐢熸垚锛涜繖鏄笟鍔℃槑纭姹傜殑鍏滃簳鍙e緞锛堟鏃�<b>涓嶈繘鍏ョ柧鐥呯淮搴�</b>锛夈��
+     * <p>
+     * 鏈夎鍒� 鈫� {@code [棣栬缁村害鈥�, 娆¤缁村害鈥�, 绉戝, 鐥呭尯]}锛�
+     * 棣栬浼樺厛銆佹瑕佸叾鍚庯紝鏈�鍚庣敤閫氱敤鍏滃簳淇濊瘉"鑳界敓鎴愪竴鏉″氨鐢熸垚涓�鏉�"銆�
+     */
+    private List<Integer> resolveDimensionOrder(VisitTaskRule rule) {
+        boolean xhSite = SITE_XH.equals(active);
+        List<Integer> order = new ArrayList<>(4);
+        if (rule == null) {
+            addDimension(order, 1, xhSite);
+            addDimension(order, 2, xhSite);
+            return order;
+        }
+        boolean deptIsPrimary = "1".equals(rule.getDeptRule());
+        boolean wardIsPrimary = "1".equals(rule.getWradRule());
+        boolean diagIsPrimary = "1".equals(rule.getDiagRule());
+        boolean deptIsSecondary = "2".equals(rule.getDeptRule());
+        boolean wardIsSecondary = "2".equals(rule.getWradRule());
+        boolean diagIsSecondary = "2".equals(rule.getDiagRule());
+        // 鍚屼紭鍏堢骇鍐呭浐瀹氶『搴忥細绉戝 鈫� 鐥呭尯 鈫� 鐤剧梾
+        if (deptIsPrimary) {
+            addDimension(order, 1, xhSite);
+        }
+        if (wardIsPrimary) {
+            addDimension(order, 2, xhSite);
+        }
+        if (diagIsPrimary) {
+            addDimension(order, 3, xhSite);
+        }
+        if (deptIsSecondary) {
+            addDimension(order, 1, xhSite);
+        }
+        if (wardIsSecondary) {
+            addDimension(order, 2, xhSite);
+        }
+        if (diagIsSecondary) {
+            addDimension(order, 3, xhSite);
+        }
+        // 閫氱敤鍏滃簳锛氳鍒欓噷閰嶇殑缁村害鍏ㄩ兘鍙栦笉鍒颁换鍔℃椂锛屼粛鎸� service_taskdept 鐨� 绉戝/鐥呭尯 鐢熸垚涓�鏉�
+        addDimension(order, 1, xhSite);
+        addDimension(order, 2, xhSite);
+        return order;
+    }
+
+    /** 杩藉姞涓�涓�欓�夌淮搴︼紱{@code xh} 绔欑偣鍙厑璁哥瀹ょ淮搴︼紙鍘� {@code !active.equals("xh")} 鐨勭瓑浠峰啓娉曪級 */
+    private void addDimension(List<Integer> order, int type, boolean xhSite) {
+        if (xhSite && type != 1) {
+            return;
+        }
+        if (!order.contains(type)) {
+            order.add(type);
+        }
+    }
+
+    private String dimensionName(int type) {
+        switch (type) {
+            case 1:
+                return "绉戝";
+            case 2:
+                return "鐥呭尯";
+            case 3:
+                return "鐤剧梾";
+            default:
+                return "鏈煡(" + type + ")";
+        }
+    }
+
+    /** 灏濊瘯涓�涓淮搴︼紝杩斿洖"鏄惁鐪熺殑鐢熸垚浜嗭紙鎴栨湰鏉ュ氨宸茬粡鏈夛級涓�鏉″瓙浠诲姟" */
+    private boolean generateOneForDimension(VisitInhospRow inhosp, VisitArchiveRow archive,
+                                            int type, String config) {
+        switch (type) {
+            case 1:
+                return addDeptSubTaskForPatient(inhosp, archive, config) > 0;
+            case 2:
+                return addWardSubTaskForPatient(inhosp, archive, config) > 0;
+            case 3:
+                return addIcd10SubTaskForPatient(inhosp, archive, config) > 0;
+            default:
+                return false;
+        }
+    }
+
+    /**
+     * 涓�杞敓鎴愮粨鏉熷悗鐨勬爣蹇椾綅鍥炲啓銆�
+     * <p>
+     * 鈿狅笍 鍏抽敭鐐癸細鎵弿閿槸 {@code pat_med_inhosp.deptcheck_flag = '0'}锛�
+     * 鎵�浠�<b>涓嶈鍛戒腑鍝釜缁村害锛宒eptcheck_flag 閮藉繀椤昏鍐欐垚 1 鎴� 2</b>锛�
+     * 鍚﹀垯涓嬩竴杞壂鎻忎細鎶婅繖涓偅鑰呭啀澶勭悊涓�閬嶏紙2026-10 閲嶅鐢熸垚鐨勭洿鎺ュ師鍥狅級銆�
+     * <p>
+     * 娌$敓鎴愭椂锛坽@code hit == null}锛夊埢鎰�<b>鍙ˉ鎵弿閿�</b>锛氬悇缁村害鏂规硶宸茬粡鎶婃洿鍏蜂綋鐨勫師鍥�
+     * 锛�"璇ユ偅鑰呮墍鍦ㄧ瀹ゆ湭閰嶇疆绂婚櫌闀挎湡浠诲姟;" / "鐢熸垚瀛愪换鍔″け璐� 1" 鈥︼級鍐欒繘
+     * {@code long_task_reason} 浜嗭紝杩欓噷鍏堢敤涓�娆¢噸璇诲垽鏂� deptcheck 鏄惁宸茬粡闈� 0锛�
+     * 閬垮厤鎶婂畠瑕嗙洊鎴愭硾娉涚殑"鏈敓鎴愰殢璁夸换鍔�"銆�
+     *
+     * @param hit 鍛戒腑鐨勭淮搴︼紱{@code null} = 涓変釜缁村害閮芥病鑳界敓鎴�
+     */
+    private void writeFlagsAfterRun(VisitInhospRow inhosp, Integer hit) {
+        boolean xhSite = SITE_XH.equals(active);
+        if (hit == null) {
+            VisitInhospRow fresh = inhospMapper.selectByInhospid(inhosp.getInhospid());
+            String current = fresh == null ? null : fresh.getDeptcheckFlag();
+            if (current == null || "0".equals(current)) {
+                updateCheckFlag(inhosp, 1, "2", composeRemark(inhosp, "鏈敓鎴愰殢璁夸换鍔★紙鏃犲彲鐢ㄩ暱鏈熶换鍔★級"));
+            }
+            return;
+        }
+        for (int type = 1; type <= 3; type++) {
+            if (xhSite && type != 1) {
+                continue;
+            }
+            if (hit == type) {
+                updateCheckFlag(inhosp, type, "1", composeRemark(inhosp,
+                        "鎸変紭鍏堢骇鐢熸垚涓�鏉¢殢璁夸换鍔★紙缁村害=" + dimensionName(type) + "锛�"));
+            } else {
+                updateCheckFlag(inhosp, type, "2", composeRemark(inhosp,
+                        "宸茬敓鎴愪竴鏉¢殢璁夸换鍔★紙缁村害=" + dimensionName(hit) + "锛夛紝鏈淮搴﹁烦杩�"));
+            }
+        }
+    }
+
+    /** 鎷� reason锛氭部鐢ㄥ師瀹炵幇鐨� {@code remark + ";xxx"} 褰㈠紡 */
+    private String composeRemark(VisitInhospRow inhosp, String text) {
+        String remark = inhosp.getRemark();
+        return StringUtils.isNotEmpty(remark) ? remark + ";" + text : text;
     }
 
     /**
@@ -296,11 +337,14 @@
 
     /**
      * 涓哄崟涓偅鑰呯敓鎴愮瀹ょ淮搴︾殑瀛愪换鍔°��
+     * <p>
+     * 鈿狅笍 2026-10 鍙e緞鍙樻洿锛氬懡涓涓暱鏈熶换鍔℃椂<b>鍙敓鎴愮涓�鏉$湡姝h惤搴撶殑浠诲姟</b>
+     * 锛堝師瀹炵幇鏄� {@code for (t : taskdepts) writeInSubTask(...); generatedCount++;}锛�
+     * 涓�涓瀹ら厤 N 涓暱鏈熶换鍔″氨浼氱敓鎴� N 鏉� 鈥斺�� 鏄�"鍚屼竴鎮h�呭嚑鍗佹潯"鐨勪富鍥狅級銆�
      *
-     * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺
+     * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺锛�0 鎴� 1锛�
      */
     public int addDeptSubTaskForPatient(VisitInhospRow inhosp, VisitArchiveRow archive, String config) {
-        int generatedCount = 0;
         try {
             // 鍘� L1857-1864锛氭寜鎮h�呮墍鍦ㄧ瀹ゆ煡璇ョ瀹ょ殑闀挎湡浠诲姟锛坉ept_type=1 + service_type=2锛�
             VisitTaskdeptRow query = new VisitTaskdeptRow();
@@ -325,8 +369,12 @@
                 updateInhosp(u);
             } else {
                 for (VisitTaskdeptRow t : taskdepts) {
-                    subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 1, config);
-                    generatedCount++;
+                    // 涓�涓偅鑰呭彧鐣欎竴鏉★細绗竴鏉$湡姝h惤搴撶殑鍗宠繑鍥�
+                    if (subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 1, config)) {
+                        return 1;
+                    }
+                    log.info("銆愮瀹や换鍔°�戞偅鑰厈}浠诲姟{}鏈敓鎴愬瓙浠诲姟锛屽皾璇曚笅涓�涓�欓��",
+                            inhosp.getInhospid(), t.getTaskId());
                 }
             }
         } catch (Exception e) {
@@ -339,7 +387,7 @@
             u.setLongTaskReason("绉戝浠诲姟澶勭悊寮傚父");
             updateInhosp(u);
         }
-        return generatedCount;
+        return 0;
     }
 
     // ==========================================================================
@@ -348,11 +396,12 @@
 
     /**
      * 涓哄崟涓偅鑰呯敓鎴愮梾鍖虹淮搴︾殑瀛愪换鍔°��
+     * <p>
+     * 鈿狅笍 鍚屼笂锛氬懡涓涓暱鏈熶换鍔℃椂鍙敓鎴愮涓�鏉$湡姝h惤搴撶殑锛堝師瀹炵幇鏄叏鐢熸垚锛夈��
      *
-     * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺
+     * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺锛�0 鎴� 1锛�
      */
     public int addWardSubTaskForPatient(VisitInhospRow inhosp, VisitArchiveRow archive, String config) {
-        int generatedCount = 0;
         try {
             String errorreason = null;
             List<VisitTaskdeptRow> taskdeptList = null;
@@ -386,8 +435,12 @@
                 updateInhosp(u);
             } else {
                 for (VisitTaskdeptRow t : taskdeptList) {
-                    subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 2, config);
-                    generatedCount++;
+                    // 涓�涓偅鑰呭彧鐣欎竴鏉★細绗竴鏉$湡姝h惤搴撶殑鍗宠繑鍥�
+                    if (subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 2, config)) {
+                        return 1;
+                    }
+                    log.info("銆愮梾鍖轰换鍔°�戞偅鑰厈}浠诲姟{}鏈敓鎴愬瓙浠诲姟锛屽皾璇曚笅涓�涓�欓��",
+                            inhosp.getInhospid(), t.getTaskId());
                 }
             }
         } catch (Exception e) {
@@ -400,7 +453,7 @@
             u.setLongTaskReason("鐥呭尯浠诲姟澶勭悊寮傚父");
             updateInhosp(u);
         }
-        return generatedCount;
+        return 0;
     }
 
     // ==========================================================================
@@ -409,11 +462,12 @@
 
     /**
      * 涓哄崟涓偅鑰呯敓鎴愮柧鐥呯淮搴︾殑瀛愪换鍔°��
+     * <p>
+     * 鈿狅笍 鍚屼笂锛氬懡涓涓暱鏈熶换鍔℃椂鍙敓鎴愮涓�鏉$湡姝h惤搴撶殑锛堝師瀹炵幇鏄叏鐢熸垚锛夈��
      *
-     * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺
+     * @return 鐢熸垚鐨勫瓙浠诲姟鏁伴噺锛�0 鎴� 1锛�
      */
     public int addIcd10SubTaskForPatient(VisitInhospRow inhosp, VisitArchiveRow archive, String config) {
-        int generatedCount = 0;
         try {
             // 鍘� L1945-1947
             if (StringUtils.isEmpty(inhosp.getLeaveicd10code())) {
@@ -454,14 +508,21 @@
                     // 鍘� L1975-1983锛氬繀椤荤瀹ゆ垨鐥呭尯鑳藉尮閰嶄笂鎵嶅缓
                     if (StringUtils.isNotEmpty(t.getDeptCode())
                             && t.getDeptCode().equals(inhosp.getLeaveldeptcode())) {
-                        subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 3, config);
-                        generatedCount++;
                         flag = 1;
+                        // 涓�涓偅鑰呭彧鐣欎竴鏉★細绗竴鏉$湡姝h惤搴撶殑鍗宠繑鍥�
+                        if (subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 3, config)) {
+                            return 1;
+                        }
+                        log.info("銆愮柧鐥呬换鍔°�戞偅鑰厈}浠诲姟{}鏈敓鎴愬瓙浠诲姟锛屽皾璇曚笅涓�涓�欓��",
+                                inhosp.getInhospid(), t.getTaskId());
                     } else if (StringUtils.isNotEmpty(t.getWardCode())
                             && t.getWardCode().equals(inhosp.getLeavehospitaldistrictcode())) {
-                        subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 3, config);
-                        generatedCount++;
                         flag = 1;
+                        if (subtaskWriter.writeInSubTask(t.getTaskId(), true, inhosp, archive, 3, config)) {
+                            return 1;
+                        }
+                        log.info("銆愮柧鐥呬换鍔°�戞偅鑰厈}浠诲姟{}鏈敓鎴愬瓙浠诲姟锛屽皾璇曚笅涓�涓�欓��",
+                                inhosp.getInhospid(), t.getTaskId());
                     }
                 }
                 if (flag == 0) {
@@ -484,7 +545,7 @@
             u.setLongTaskReason("鐤剧梾浠诲姟澶勭悊寮傚父");
             updateInhosp(u);
         }
-        return generatedCount;
+        return 0;
     }
 
     // ==========================================================================
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospVisitTaskService.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospVisitTaskService.java
index da4789a..66b12d5 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospVisitTaskService.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/service/InhospVisitTaskService.java
@@ -100,7 +100,7 @@
 
         // 鍘� L331-409 + L411-444锛氫袱娈靛鏁欐敼涓哄洖璋冨鏁欐ā鍧�
         // 鈿狅笍 杩欓噷涓嶅啀鍐呰仈瀹炵幇 鈥斺�� 鍚﹀垯浼氫笌 ruoyi-publicity 閲岀殑瀹炵幇"鍙戜袱閬�"
-        dealInHospPublicityAndMedical(config);
+//        dealInHospPublicityAndMedical(config);
 
         // 鍘� L445-451锛氬熀浜庤鍒欑殑鍑洪櫌闅忚 + 鎵嬫湳闅忚
         addSubTaskByRule(config, patMedInhosps);
diff --git a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/support/VisitSubtaskFactory.java b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/support/VisitSubtaskFactory.java
index 85f67ae..d5f44db 100644
--- a/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/support/VisitSubtaskFactory.java
+++ b/ruoyi-inhospvisit/src/main/java/com/ruoyi/inhospvisit/support/VisitSubtaskFactory.java
@@ -48,6 +48,13 @@
  * 鏂规鍘熻鍒掑彨 {@code VisitSubtaskFactory} 骞跺悓鏃舵壙杞� {@code writeInSubTask}銆�
  * 瀹為檯瀹炵幇鏃舵妸瀹冩敹绐勪负"绾粍瑁� + 绾伐鍏�"锛屽洜涓� {@code writeInSubTask}锛�232 琛岋級閲屾湁澶ч噺
  * 鍐欏簱涓庡幓閲嶇紪鎺掞紝娣峰湪涓�璧蜂細璁╂湰绫荤殑 A 妗i�愯绛変环鎺㈤拡澶卞幓鎰忎箟銆�
+ *
+ * <h3>鈿狅笍 鍞竴鐨�"闈炴惉杩�"琛岋細{@code hospno}</h3>
+ * {@link #boxedServiceSubtask} 閲屽浜嗕竴鍙� {@code d.setHospno(inhosp.getInhospno())}銆�
+ * 鍘熷疄鐜扮‘瀹�<b>娌℃湁</b>杩欎竴鍙ワ紝鎵�浠ュ嚭闄㈤摼璺殑 {@code service_subtask.hospno} 涓�鐩磋惤绌猴紱
+ * 鑰� {@code ServiceSubtask.hospno} 鐨勮涔夊氨鏄�"灏辫瘖缂栧彿锛堝搴旂殑 outhospno銆乮nhospno锛�"銆�
+ * 杩欐槸<b>鏈夋剰琛ラ綈</b>锛屼笉鏄妱婕� 鈥斺�� 鍙嶅悜鎺㈤拡锛坽@code verify_inhospvisit_boxed_fields.py}锛�
+ * 鍙牎楠�"鍘� setter 鏄惁閮芥湁瀵瑰簲璋冪敤"锛屼笉浼氬洜姝ゆ姤閿欍��
  */
 @Slf4j
 @Component
@@ -104,6 +111,12 @@
         d.setNurseId(inhosp.getNurseId());
         d.setNurseName(inhosp.getNurseName());
         d.setInhospid(inhosp.getInhospid());
+        // 鈿狅笍 杩欎竴琛屾槸銆愯ˉ鐨勩�戯紝涓嶆槸鎼繍锛�
+        //   鍘� boxedServiceSubtask 浠庢湭璁� hospno锛岃�� ServiceSubtask.hospno 鐨勮涔夋槸
+        //   "灏辫瘖缂栧彿锛堝搴旂殑 outhospno銆乮nhospno锛�"锛堣 ServiceSubtask 瀛楁娉ㄩ噴锛夈��
+        //   缁撴灉灏辨槸鍑洪櫌閾捐矾鐨� service_subtask.hospno 涓�鐩存槸 NULL锛屼笌闂ㄨ瘖閾捐矾涓嶄竴鑷淬��
+        //   鍙栧�硷細pat_med_inhosp.inhospno锛堥棬璇婁晶鍙� pat_med_outhosp.outhospno锛岃 OuthospSubtaskDraft锛夈��
+        d.setHospno(inhosp.getInhospno());
         d.setDrcode(inhosp.getDrcode());
         d.setDrname(inhosp.getDrname());
         d.setDeptcode(inhosp.getLeaveldeptcode());
diff --git a/ruoyi-inhospvisit/src/main/resources/mapper/inhospvisit/PatMedInhospMapper.xml b/ruoyi-inhospvisit/src/main/resources/mapper/inhospvisit/PatMedInhospMapper.xml
index 7a0dc7d..fd25c50 100644
--- a/ruoyi-inhospvisit/src/main/resources/mapper/inhospvisit/PatMedInhospMapper.xml
+++ b/ruoyi-inhospvisit/src/main/resources/mapper/inhospvisit/PatMedInhospMapper.xml
@@ -163,6 +163,148 @@
         from pat_med_inhosp
     </sql>
 
+    <sql id="selectPatMedInhospListFromWhere">
+        pat_med_inhosp b
+        JOIN
+        pat_archive a ON a.id = b.patid
+        where 1=1
+        <!--
+          del_flag 蹇呴』鐢ㄥ瓧绗︿覆甯搁噺姣旇緝锛氬畠鍙栧�兼槸 '0'/'1'锛坈har 鍒楋級銆�
+          鍐欐垚 del_flag = 0 鏃� MySQL 浼氭妸銆愬垪銆戞寜 DOUBLE 闅愬紡杞崲锛岃鏉′欢灏卞彧鏄繃婊ゃ��
+          涓嶈兘鐢ㄦ潵瀹氫綅绱㈠紩锛涜�� b.del_flag 姝f槸 idx_inhosp_optimize / idx_pmi_del_org_end
+          鐨勯鍒� 鈥斺�� 鏁板瓧鍐欐硶绛変簬鎶婄储寮曢鍒楃櫧缁欍��
+          鍚屼竴缁撹瑙� sql/sltdMydTotalByDimension_index_20260924.sql 绗� 117-134 琛屻��
+          锛堝垪鏄� int 鏃跺啓 '0' 涔熷畨鍏細杞崲鍙戠敓鍦ㄥ父閲忎晶锛岀储寮曠収鏍峰彲鐢ㄣ�傦級
+        -->
+        AND a.del_flag = '0'
+        AND b.del_flag = '0'
+        AND a.idcardno IS NOT NULL
+        <if test="inhospid != null">and b.inhospid = #{inhospid}</if>
+        <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') &gt;=
+            date_format(#{startOutHospTime},'%y%m%d')
+        </if>
+        <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') &lt;=
+            date_format(#{endOutHospTime},'%y%m%d')
+        </if>
+        <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') &gt;=
+            date_format(#{startInHospTime},'%y%m%d')
+        </if>
+        <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') &lt;=
+            date_format(#{endInHospTime},'%y%m%d')
+        </if>
+        <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
+            '%')
+        </if>
+        <if test="patname != null  and patname != ''">and patname like concat('%', #{patname}, '%')</if>
+        <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">and hospitaldistrictname like
+            concat('%', #{hospitaldistrictname}, '%')
+        </if>
+        <if test="endtime != null ">and b.endtime = #{endtime}</if>
+        <if test="bedNo != null ">and b.bed_no = #{bedNo}</if>
+        <if test="inhospMydFlag != null ">and b.inhosp_myd_flag = #{inhospMydFlag}</if>
+        <if test="managementDoctor != null ">and b.management_doctor = #{managementDoctor}</if>
+        <if test="managementDoctorCode != null ">and b.management_doctor_code = #{managementDoctorCode}</if>
+        <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
+        <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
+        <if test="orgid != null ">and b.orgid = #{orgid}</if>
+        <if test="campusid != null ">and b.campusid = #{campusid}</if>
+        <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
+        <if test="endtime != null ">and b.endtime = #{endtime}</if>
+        <if test="patno != null ">and b.patno = #{patno}</if>
+        <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
+        <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
+        <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
+        <if test="scheduleCheckFlag != null ">and b.schedulecheck_flag = #{scheduleCheckFlag}</if>
+        <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
+        <if test="inDeptcheckFlag != null ">and b.in_deptcheck_flag = #{inDeptcheckFlag}</if>
+        <if test="inWardcheckFlag != null ">and b.in_wardcheck_flag = #{inWardcheckFlag}</if>
+        <if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
+        <if test="encounterSourceId != null ">and b.encounter_source_id = #{encounterSourceId}</if>
+        <if test="importanceFlagCode != null ">and b.importance_flag_code = #{importanceFlagCode}</if>
+        <if test="emergencyLevelCode != null ">and b.emergency_level_code = #{emergencyLevelCode}</if>
+        <!--
+          鍦ㄩ櫌锛坈ry=0锛夛細涓や釜鏉′欢閮借銆�
+          鈶� b.endtime is null 鈥斺�� 鍘� XML 灏辨湁锛屼繚鎸佷笉鍔紱
+          鈶� b.inhospstate = '0' 鈥斺�� 杩佸嚭鍓嶇敱 PatMedInhospServiceImpl 琛ワ紙cry=0 鏃�
+             setInhospstate("0")锛夛紝杩佸埌鏈ā鍧楀悗杩欐潯閾剧洿杩� Mapper锛岃繖鍙ュ氨涓簡銆�
+          涓轰粈涔堝繀椤昏ˉ鍥炴潵锛堜笉鍙槸"鎭㈠鍘熻涓�"锛屼篃鏄�ц兘闂锛夛細
+            路 绱㈠紩 idx_inhosp_optimize / idx_pmi_del_org_state_end 鐨勫墠涓夊垪鏄�
+              (del_flag, orgid, inhospstate)锛屽彧鏈変笁涓瓑鍊兼潯浠堕綈浜嗘墠鑳界簿纭畾浣�"鍦ㄩ櫌"閭e嚑鍗冭锛�
+              灏戜簡 inhospstate锛屽氨鍙兘鐢ㄥ埌 (del_flag, orgid) 鍓嶇紑 = 璇ユ満鏋勩�愬叏閮ㄥ巻鍙蹭綇闄㈣褰曘�戯紝
+              鍐嶅姞涓婂悗闈㈢殑 ORDER BY/GROUP BY锛屽疄娴嬪氨鏄� 4~5 绉掔殑鏉ユ簮銆�
+            路 cry=1/2/3 鏈潵灏辨槸鎸� inhospstate 鍒ょ殑锛屽彧鏈� cry=0 鐢� endtime 鍒� 鈥斺�� 琛ラ綈鍚庢墠瀵圭О銆�
+          涓轰粈涔堝姞 inhospstate == null 杩欎釜鍓嶆彁锛氳皟鐢ㄦ柟鑻ュ凡鏄惧紡鎸囧畾 inhospstate锛屽氨鍒拰瀹冩墦鏋�
+          锛堝惁鍒� cry=0 + inhospstate='2' 浼氬彉鎴�"鍜岃嚜韬煕鐩�"鐨勭┖缁撴灉锛夈��
+        -->
+        <if test="cry != null and cry == 0 ">and b.endtime is null</if>
+        <if test="cry != null and cry == 0 and inhospstate == null ">and b.inhospstate = '0'</if>
+        <!-- 鍚� del_flag锛歩nhospstate 鏄彇鍊艰寖鍥� '0'~'3' 鐨勫瓧绗﹀垪锛屽繀椤荤敤瀛楃涓插父閲忥紝
+             鍚﹀垯绱㈠紩涓婄敤涓嶅埌杩欎釜绛夊�兼潯浠讹紙鍑洪櫌/杞/棰勫叆闄� 涓変釜瑙嗗浘璧扮殑灏辨槸杩欎笁琛岋級 -->
+        <if test="cry != null and cry == 1 ">and b.inhospstate='1'</if>
+        <if test="cry != null and cry == 2 ">and b.inhospstate='2'</if>
+        <if test="cry != null and cry == 3 ">and b.inhospstate='3'</if>
+        <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
+        <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
+        <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
+        <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
+        <if test="leaveldeptcode != null ">and b.leaveldeptcode = #{leaveldeptcode}</if>
+        <if test="leavediagname != null  and leavediagname != ''">and b.leavediagname like concat('%',
+            #{leavediagname}, '%')
+        </if>
+        <if test="drname != null  and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
+        <if test="leaveldeptname != null  and leaveldeptname != ''">and b.leaveldeptname like concat('%',
+            #{leaveldeptname}, '%')
+        </if>
+        <if test="deptname != null  and deptname != ''">and b.deptname like concat('%',
+            #{deptname}, '%')
+        </if>
+        <if test="patid != null  and patid != ''">and a.id =#{patid}
+        </if>
+        <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">and
+            b.leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
+        </if>
+
+        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
+            AND b.leavehospitaldistrictcode IN
+            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+                     close=")">
+                #{leavehospitaldistrictcode}
+            </foreach>
+        </if>
+
+        <if test="hospitaldistrictcodeList != null and hospitaldistrictcodeList.size()>0">
+            AND b.hospitaldistrictcode IN
+            <foreach collection="hospitaldistrictcodeList" item="hospitaldistrictcode" open="(" separator=","
+                     close=")">
+                #{hospitaldistrictcode}
+            </foreach>
+        </if>
+        <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
+            AND b.leaveldeptcode IN
+            <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
+                     close=")">
+                #{leaveldeptcode}
+            </foreach>
+        </if>
+        <if test="deptcodeList != null and deptcodeList.size()>0">
+            AND b.deptcode IN
+            <foreach collection="deptcodeList" item="deptcode" open="(" separator=","
+                     close=")">
+                #{deptcode}
+            </foreach>
+        </if>
+        <if test="icd10codeList != null and icd10codeList.size()>0">
+            AND b.leaveicd10code IN
+            <foreach collection="icd10codeList" item="icd10code" open="(" separator=","
+                     close=")">
+                #{icd10code}
+            </foreach>
+        </if>
+        <if test="medicalCode != null and medicalCode != ''">and b.medical_code = #{medicalCode}</if>
+        <if test="medicalName != null and medicalName != ''">and b.medical_name = #{medicalName}</if>
+        <if test="medicalCompany != null and medicalCompany != ''">and b.medical_company = #{medicalCompany}</if>
+    </sql>
+
     <select id="selectPatMedInhospList" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhosp" resultMap="PatMedInhospResult">
         select a.age AS age,
         a.telcode as telcode,
@@ -239,120 +381,7 @@
         b.medical_company,
         a.idcardno
         FROM
-        pat_med_inhosp b
-        JOIN
-        pat_archive a ON a.id = b.patid
-        where 1=1
-        AND a.del_flag = 0
-        AND b.del_flag = 0
-        AND a.idcardno IS NOT NULL
-        <if test="inhospid != null">and b.inhospid = #{inhospid}</if>
-        <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') &gt;=
-            date_format(#{startOutHospTime},'%y%m%d')
-        </if>
-        <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') &lt;=
-            date_format(#{endOutHospTime},'%y%m%d')
-        </if>
-        <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') &gt;=
-            date_format(#{startInHospTime},'%y%m%d')
-        </if>
-        <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') &lt;=
-            date_format(#{endInHospTime},'%y%m%d')
-        </if>
-        <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
-            '%')
-        </if>
-        <if test="patname != null  and patname != ''">and patname like concat('%', #{patname}, '%')</if>
-        <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">and hospitaldistrictname like
-            concat('%', #{hospitaldistrictname}, '%')
-        </if>
-        <if test="endtime != null ">and b.endtime = #{endtime}</if>
-        <if test="bedNo != null ">and b.bed_no = #{bedNo}</if>
-        <if test="inhospMydFlag != null ">and b.inhosp_myd_flag = #{inhospMydFlag}</if>
-        <if test="managementDoctor != null ">and b.management_doctor = #{managementDoctor}</if>
-        <if test="managementDoctorCode != null ">and b.management_doctor_code = #{managementDoctorCode}</if>
-        <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
-        <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
-        <if test="orgid != null ">and b.orgid = #{orgid}</if>
-        <if test="campusid != null ">and b.campusid = #{campusid}</if>
-        <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
-        <if test="endtime != null ">and b.endtime = #{endtime}</if>
-        <if test="patno != null ">and b.patno = #{patno}</if>
-        <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
-        <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
-        <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
-        <if test="scheduleCheckFlag != null ">and b.schedulecheck_flag = #{scheduleCheckFlag}</if>
-        <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
-        <if test="inDeptcheckFlag != null ">and b.in_deptcheck_flag = #{inDeptcheckFlag}</if>
-        <if test="inWardcheckFlag != null ">and b.in_wardcheck_flag = #{inWardcheckFlag}</if>
-        <if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
-        <if test="encounterSourceId != null ">and b.encounter_source_id = #{encounterSourceId}</if>
-        <if test="importanceFlagCode != null ">and b.importance_flag_code = #{importanceFlagCode}</if>
-        <if test="emergencyLevelCode != null ">and b.emergency_level_code = #{emergencyLevelCode}</if>
-        <if test="cry != null and cry == 0 ">and b.endtime is null</if>
-        <if test="cry != null and cry == 1 ">and b.inhospstate=1</if>
-        <if test="cry != null and cry == 2 ">and b.inhospstate=2</if>
-        <if test="cry != null and cry == 3 ">and b.inhospstate=3</if>
-        <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
-        <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
-        <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
-        <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
-        <if test="leaveldeptcode != null ">and b.leaveldeptcode = #{leaveldeptcode}</if>
-        <if test="leavediagname != null  and leavediagname != ''">and b.leavediagname like concat('%',
-            #{leavediagname}, '%')
-        </if>
-        <if test="drname != null  and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
-        <if test="leaveldeptname != null  and leaveldeptname != ''">and b.leaveldeptname like concat('%',
-            #{leaveldeptname}, '%')
-        </if>
-        <if test="deptname != null  and deptname != ''">and b.deptname like concat('%',
-            #{deptname}, '%')
-        </if>
-        <if test="patid != null  and patid != ''">and a.id =#{patid}
-        </if>
-        <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">and
-            b.leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
-        </if>
-
-        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
-            AND b.leavehospitaldistrictcode IN
-            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
-                     close=")">
-                #{leavehospitaldistrictcode}
-            </foreach>
-        </if>
-
-        <if test="hospitaldistrictcodeList != null and hospitaldistrictcodeList.size()>0">
-            AND b.hospitaldistrictcode IN
-            <foreach collection="hospitaldistrictcodeList" item="hospitaldistrictcode" open="(" separator=","
-                     close=")">
-                #{hospitaldistrictcode}
-            </foreach>
-        </if>
-        <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
-            AND b.leaveldeptcode IN
-            <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
-                     close=")">
-                #{leaveldeptcode}
-            </foreach>
-        </if>
-        <if test="deptcodeList != null and deptcodeList.size()>0">
-            AND b.deptcode IN
-            <foreach collection="deptcodeList" item="deptcode" open="(" separator=","
-                     close=")">
-                #{deptcode}
-            </foreach>
-        </if>
-        <if test="icd10codeList != null and icd10codeList.size()>0">
-            AND b.leaveicd10code IN
-            <foreach collection="icd10codeList" item="icd10code" open="(" separator=","
-                     close=")">
-                #{icd10code}
-            </foreach>
-        </if>
-        <if test="medicalCode != null and medicalCode != ''">and b.medical_code = #{medicalCode}</if>
-        <if test="medicalName != null and medicalName != ''">and b.medical_name = #{medicalName}</if>
-        <if test="medicalCompany != null and medicalCompany != ''">and b.medical_company = #{medicalCompany}</if>
+        <include refid="selectPatMedInhospListFromWhere"/>
         GROUP BY
         b.inhospid,
         a.age,
@@ -403,6 +432,28 @@
                 </otherwise>
             </choose>
         </if>
+    </select>
+
+    <!--
+      鍒嗛〉鎬绘暟锛圥ageHelper 鎵嬪啓 count锛宨d = 涓绘煡璇� id + _COUNT 浼氳鑷姩閲囩敤锛夈��
+
+      鍘熺姸鎬侊細涓绘煡璇㈠甫 GROUP BY锛宲agehelper 鐨� CountSqlParser#isSimpleCount 鍒ゅ畾涓�
+      "涓嶈兘绠�鍖�"锛屼簬鏄�绘暟鍙樻垚 SELECT count(0) FROM ( 涓婇潰閭f潯 60 鍒楁煡璇� ) tmp_count 鈥�
+      绛変簬姣忔缈婚〉鎶婃暣鏉℃煡璇㈠啀璺戜竴閬嶃��
+
+      杩欓噷淇濇寔銆愬畬鍏ㄧ浉鍚岀殑 FROM/WHERE/GROUP BY銆戯紙鍏辩敤 selectPatMedInhospListFromWhere 鐗囨锛�
+      鏉′欢涓嶄細婕傦級锛屼絾瀛愭煡璇㈠彧 select 1锛屼笉鐗╁寲 60 鍒楋紝涔熶笉甯� order by銆�
+      鍥犱负鍒嗙粍閿寘鍚� a.id 鑰岃繖涓� join 鏄竴瀵逛竴锛屽垎缁勬暟 == join 缁撴灉琛屾暟锛屾�绘暟涓庡師鏉ヤ竴鑷淬��
+    -->
+    <select id="selectPatMedInhospList_COUNT" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhosp"
+            resultType="java.lang.Long">
+        select count(1)
+        from (
+            select 1
+            FROM
+            <include refid="selectPatMedInhospListFromWhere"/>
+            group by b.inhospid, a.age, a.age_unit, a.telcode, a.id, a.sex
+        ) t
     </select>
 
     <select id="selectPatMedInhospListBySerialnum" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhosp"
@@ -503,6 +554,31 @@
         order by b.inhospid desc
     </select>
 
+    <!--
+      鍦ㄩ櫌淇℃伅鍒锋柊鐨勫彇鏁帮細鍙煡 pat_med_inhosp 鑷韩銆佸彧鍙栧埛鏂拌鐢ㄧ殑鍒椼��
+      鍒绘剰涓嶅鐢� selectPatMedInhospList 鈥斺�� 閭d釜鏌ヨ join 浜� pat_archive 涓旇姹�
+      a.idcardno IS NOT NULL锛屼細璁�"璇佷欢鍙疯繕娌¤ˉ涓婄殑鏂板叆闄㈡偅鑰�"闈欓粯婕忓埛鏂般��
+      WHERE (del_flag, orgid, inhospstate) 鍛戒腑 idx_inhosp_optimize 鐨勫墠缂�銆�
+    -->
+    <select id="selectInhospRefreshCandidates" resultMap="PatMedInhospResult">
+        select inhospid,
+               serialnum,
+               patname,
+               orgid,
+               campusid,
+               deptcode,
+               deptname,
+               hospitaldistrictcode,
+               hospitaldistrictname,
+               hospitaldistrictid,
+               bed_no
+        from pat_med_inhosp
+        where inhospstate = '0'
+          and del_flag = '0'
+          and orgid = #{orgid}
+        order by inhospid asc
+    </select>
+
     <select id="selectPatMedInhospListByCondition" parameterType="com.ruoyi.inhospvisit.domain.PatMedInhospVO"
             resultMap="PatMedInhospResult">
         select CONCAT( a.age, a.age_unit ) AS age,
diff --git a/ruoyi-outpatientvisit/src/main/java/com/ruoyi/outpatientvisit/domain/PatMedOuthosp.java b/ruoyi-outpatientvisit/src/main/java/com/ruoyi/outpatientvisit/domain/PatMedOuthosp.java
index ac6eea8..240e52d 100644
--- a/ruoyi-outpatientvisit/src/main/java/com/ruoyi/outpatientvisit/domain/PatMedOuthosp.java
+++ b/ruoyi-outpatientvisit/src/main/java/com/ruoyi/outpatientvisit/domain/PatMedOuthosp.java
@@ -49,6 +49,19 @@
     private Long patid;
 
     /**
+     * HIS 渚ф偅鑰呬富閿紙{@code patid_his} 鍒楋級
+     * <p>
+     * 鈿狅笍 涓嶈兘鐪侊細{@code ruoyi-quartz} 鐨� {@code CollectHISMapper.xml}锛堝競涓� HIS 閲囬泦锛�
+     * 鐨� {@code PatMedOuthospResult} 閲屾湁 {@code property="patidHis" column="patid_his"}锛�
+     * 涓� {@code <if test="patidHis != null">and patid_his = #{patidHis}</if>}銆�
+     * 瀹炰綋缂鸿繖涓睘鎬ф椂锛岄偅浜涢噰闆嗘煡璇㈠湪缁撴灉鏄犲皠闃舵灏变細鎶�
+     * {@code ReflectionException: no setter for 'patidHis'}銆�
+     * 锛堢被鍨嬩笌 {@code PatArchive.patidHis} 淇濇寔涓�鑷达細String锛�
+     */
+    @ApiModelProperty(value = "HIS 渚ф偅鑰呬富閿紙patid_his锛�")
+    private String patidHis;
+
+    /**
      * 鐥呬汉濮撳悕
      */
     @ApiModelProperty(value = " 鐥呬汉濮撳悕")
diff --git a/ruoyi-quartz/pom.xml b/ruoyi-quartz/pom.xml
index 12ec5a2..925cc92 100644
--- a/ruoyi-quartz/pom.xml
+++ b/ruoyi-quartz/pom.xml
@@ -95,6 +95,16 @@
             <artifactId>ruoyi-task</artifactId>
         </dependency>
 
+        <!--
+            鏁版嵁閲囬泦妯″潡锛歊yTask 鐨� HIS 閲囬泦鍏ュ彛锛坉ealHisData锛夋柟娉曚綋宸叉暣浣撴惉杩涜妯″潡锛�
+            杩欓噷鍙繚鐣欏畾鏃朵换鍔″叆鍙e苟杞彂缁欏叾闂ㄩ潰 DataCollectionFacade
+            锛坰ys_job 鐨� invoke_target 浠嶆槸 ryTask.dealHisData('...')锛屽叆鍙e悕涓嶈兘鍙橈級銆�
+        -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-datacollection</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
index 2bb801d..4c9a20d 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -118,8 +118,11 @@
     @Autowired
     private IServicePatientTempService iServicePatientTempService;
 
-    @Autowired
-    private IHNGatherPatArchiveService ihnGatherPatArchiveService;
+    // 鈿狅笍 2026-10 绉婚櫎锛氬師 `IHNGatherPatArchiveService ihnGatherPatArchiveService` 瀛楁銆�
+    //    瀹冨湪鏈被閲�**鍙�**琚� dealHisData 鐨勬渤鍗楀垎鏀娇鐢紙姝诲瓧娈垫鏌ワ細鏀瑰墠鍏ㄦ枃浠朵粎 1 澶勪娇鐢級锛�
+    //    璇ュ垎鏀凡闅忔柟娉曚綋鎼繘 ruoyi-datacollection锛屾晠瀛楁杩炲甫鍒犻櫎 鈥斺��
+    //    鐣欑潃瀹冧細璁╀汉璇互涓� smartor 鐨勬渤鍗楅噰闆嗚繕鏈夋湰绫昏繖涓娇鐢ㄦ柟
+    //    锛堢湡姝g殑浣跨敤鏂瑰凡鏄暟鎹噰闆嗘ā鍧楃粡濂戠害 HisGatherApi 璋冪敤鐨� Bridge锛夈��
 
     @Autowired
     private IServiceSLTDHealthcareRecordService serviceSLTDHealthcareRecordService;
@@ -160,8 +163,9 @@
     @Autowired
     private IServiceSubtaskRecordService serviceSubtaskRecordService;
 
-    @Autowired
-    IIcd10Service iIcd10Service;
+    // 鈿狅笍 2026-10 绉婚櫎锛氬師 `IIcd10Service iIcd10Service` 瀛楁銆�
+    //    瀹冨湪鏈被閲�**鍙�**琚� dealHisData 鐨�"鐤剧梾瀛楀吀澧為噺閲囬泦"涓�琛岃皟鐢紝宸查殢鏂规硶浣撴惉杩�
+    //    ruoyi-datacollection锛堢粡濂戠害 HisGatherApi#gatherIcd10 璋冨洖 smartor 鐨勫疄鐜帮級銆�
 
     @Autowired
     IPatArchiveService patArchiveService;
@@ -227,8 +231,27 @@
     @Autowired
     private com.ruoyi.publicity.api.PublicityFacade publicityFacade;
 
-    @Value("${appid}")
-    private String appid;
+    /**
+     * 鏁版嵁閲囬泦妯″潡鐨�<b>甯搁┗闂ㄩ潰</b>銆�
+     * <p>
+     * 鈿狅笍 2026-10 妯″潡鍖栵細鏈被鐨� {@code dealHisData(String)} 鏂规硶浣擄紙杩炲悓绉佹湁甯墜
+     * {@code collectSegmentData}锛夊凡鏁翠綋鎼繘 {@code ruoyi-datacollection}锛�
+     * 鏈被鍙繚鐣欏畾鏃朵换鍔″叆鍙o紙sys_job 鐨� invoke_target 鏄� {@code ryTask.dealHisData('...')}锛�
+     * 鍏ュ彛鍚嶄笉鑳藉彉锛夈�傜珯鐐瑰垎鏀�佹椂闂寸獥鍙c�佸垎娈靛洖婧�佹棩蹇楁枃妗堥兘鍦ㄦā鍧楅噷锛屼竴琛屾湭鏀广��
+     * <p>
+     * 娉ㄥ叆闂ㄩ潰鑰屼笉鏄ā鍧楀唴閮� Service锛氶棬闈�<b>姘歌繙瀛樺湪</b>锛屼笖鍙湁闂ㄩ潰鍒�
+     * {@code sys_config: datacollection.enabled} 寮�鍏炽��
+     */
+    @Autowired
+    private com.ruoyi.datacollection.api.DataCollectionFacade dataCollectionFacade;
+
+    // 鈿狅笍 2026-10 鍒犻櫎锛氬師 `@Value("${appid}") private String appid;`
+    //    瀹冩槸銆屾柊鍗庡井淇″叕浼楀彿鎺ㄩ�併�嶇殑閬楃暀瀛楁锛堟彁浜� 8590ef6a 寮曞叆锛屽彧琚�
+    //    xinHuaWXReq.setAppid(appid) 鐢ㄨ繃锛夈�傝鎺ㄩ�侀�昏緫宸叉惉杩� ruoyi-message
+    //    锛堝叕浼楀彿鍑嵁鏀圭敱 sys_config.wx.mp.config.* 涓嬪彂锛夛紝鏈被閲屽凡鏃犲紩鐢紱
+    //    浣嗗畠鐨� @Value 娌℃湁榛樿鍊硷紝鑰� application-nhfy.yml / -xh.yml / -ls.yml
+    //    閮芥病瀹氫箟 appid 杩欎釜 key锛岃繖浜� profile 鍚姩鏃朵細鐩存帴鎶�
+    //    `Could not resolve placeholder 'appid'`銆傜暀鐫�鏄畾鏃剁偢寮癸紝鏁呭垹闄ゃ��
 
     @Value("${server.port}")
     private String port;
@@ -442,262 +465,53 @@
      * HIS鏁版嵁閲囬泦
      * 瀹氭椂浠诲姟锛氶噰闆嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹�
      * todayZeroStr  褰撳墠鐨勬椂闂�   渚嬪锛�2026-05-06 00:00:00
+     * <p>
+     * 鈿狅笍 <b>2026-10 妯″潡鍖�</b>锛氭柟娉曚綋锛堣繛鍚岀鏈夊府鎵� {@code collectSegmentData}锛夊凡鏁翠綋鎼繘
+     * {@code ruoyi-datacollection}锛屽疄鐜拌
+     * {@code com.ruoyi.datacollection.service.impl.HisDataCollectionServiceImpl}銆�
+     * 杩欓噷鍙繚鐣�<b>瀹氭椂浠诲姟鍏ュ彛</b>锛歴ys_job 鐨� invoke_target 浠嶆槸
+     * {@code ryTask.dealHisData('...')}锛屽叆鍙e悕涓嶈兘鍙橈紝鎵�浠ユ湰鏂规硶鏄�<b>绾浆鍙�</b>銆�
+     * <p>
+     * 鍏抽棴鏁版嵁閲囬泦妯″潡锛坽@code sys_config: datacollection.enabled=false}锛夋椂闂ㄩ潰浼氭姏
+     * {@link com.ruoyi.datacollection.api.DataCollectionModuleDisabledException}锛�
+     * 鏈叆鍙f崟鑾峰悗鍙墦涓�鏉� WARN 鈥斺�� 閭f槸"妯″潡琚富鍔ㄥ叧鎺�"锛屼笉鏄噰闆嗗け璐ワ紝
+     * 涓嶈璁╁畾鏃朵换鍔¤鎴愭墽琛屽紓甯革紙鍚﹀垯杩愮淮浼氱湅鍒颁竴鐗囩孩鑹插け璐ヨ褰曪級銆�
      */
     public void dealHisData(String todayZeroStr) {
-        log.info("銆恉ealHisData銆戝紑濮嬫墽琛孒IS鏁版嵁閲囬泦浠诲姟");
-        // 鑾峰彇鏄ㄥぉ0鐐瑰埌浠婂ぉ0鐐圭殑鏃堕棿鑼冨洿
-        LocalDateTime todayZero = LocalDateTime.now().with(LocalTime.MIN);
-        if (StringUtils.isNotBlank(todayZeroStr)) {
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            todayZero = LocalDateTime.parse(todayZeroStr, formatter);
-        }
-        LocalDateTime yesterdayZero = todayZero.minusDays(1);
-        log.info("銆恉ealHisData銆戦噰闆嗘椂闂磋寖鍥达細{} ~ {}", yesterdayZero, todayZero);
-
-        if (active.trim().equals("xh")) {
-            try {
-                // 閲囬泦鍏ラ櫌鏁版嵁
-                log.info("銆恉ealHisData銆戞柊鍗庡紑濮嬮噰闆嗗叆闄㈡暟鎹�");
-                ixhGatherPatArchiveService.getInHospDataGather("0", yesterdayZero, todayZero);
-                log.info("銆恉ealHisData銆戞柊鍗庡叆闄㈡暟鎹噰闆嗗畬鎴�");
-
-                // 閲囬泦鍑洪櫌鏁版嵁
-                log.info("銆恉ealHisData銆戞柊鍗庡紑濮嬮噰闆嗗嚭闄㈡暟鎹�");
-                ixhGatherPatArchiveService.getInHospDataGather("1", yesterdayZero, todayZero);
-                log.info("銆恉ealHisData銆戞柊鍗庡嚭闄㈡暟鎹噰闆嗗畬鎴�");
-
-            } catch (Exception e) {
-                log.error("銆恉ealHisData銆戞柊鍗庢暟鎹噰闆嗗紓甯�", e);
-            }
-        } else if (active.trim().equals("hn")) {
-            try {
-                // 娌冲崡鏁版嵁閲囬泦
-                HnDataGatherVO hnDataGatherVO = new HnDataGatherVO();
-                log.info("銆恉ealHisData銆戞渤鍗楀紑濮嬮噰闆嗘暟鎹�");
-                Date startTime = Date.from(yesterdayZero.atZone(ZoneId.systemDefault()).toInstant());
-                Date endTime = Date.from(todayZero.atZone(ZoneId.systemDefault()).toInstant());
-
-                hnDataGatherVO.setStartTime(startTime);
-                hnDataGatherVO.setEndTime(endTime);
-                ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO);
-                log.info("銆恉ealHisData銆戞渤鍗楃粨鏉熼噰闆嗘暟鎹�");
-            } catch (Exception e) {
-                log.error("銆恉ealHisData銆戞渤鍗楁暟鎹噰闆嗗紓甯�", e);
-            }
-        } else if (active.trim().equals("sltd") || active.trim().equals("nhfy")) {
-            //鐪佺珛鍚屽痉涓庡崕鍗楅檮涓�鐢ㄥ悓涓�濂楅噰闆嗘柟娉曪紙閮芥槸鏉ユ湭鏉ユ彁渚涳級
-
-            try {
-                //鑾峰彇鏄惁闇�瑕侀噰闆嗙敤鎴枫�侀儴闂ㄤ俊鎭�
-                SysConfig config = new SysConfig();
-                config.setConfigKey("sltd.gather.sysuser");
-                config.setOrgid("20001001");
-                List<SysConfig> sysConfigs = configService.selectConfigList(config);
-
-                //鑾峰彇鐪佺珛鍚屽痉瑕侀噰闆嗙殑闄㈠尯
-                SysConfig cf = new SysConfig();
-                cf.setConfigKey("sltd.gather.campusid");
-                cf.setOrgid("20001001");
-                List<SysConfig> sysConfigcampusids = configService.selectConfigList(cf);
-
-                List<Long> campusidList = new ArrayList<>();
-                if (CollectionUtils.isNotEmpty(sysConfigcampusids)) {
-                    String[] split = sysConfigcampusids.get(0).getConfigValue().split(",");
-                    campusidList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
-                } else {
-                    log.error("SysConfig涓殑闄㈠尯ID涓虹┖锛�");
-                    return;
-                }
-
-                //configValue = 1 涓嶉渶瑕侀噰闆�       configValue = 2闇�瑕侀噰闆�
-                if (CollectionUtils.isNotEmpty(sysConfigs) && sysConfigs.get(0).getConfigValue().equals("2")) {
-                    log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈儴闂ㄤ俊鎭�濆紑濮嬮噰闆嗘暟鎹�");
-                    ServiceSLTDDeptReqVO serviceSLTDDeptReqVO = new ServiceSLTDDeptReqVO();
-                    serviceSLTDDeptReqVO.setOrgId("20001001");
-                    serviceSLTDDeptReqVO.setCampusIds(campusidList);
-                    Boolean aBoolean1 = serviceSLTDHealthcareRecordService.queryDeptWardAreaInfoList(serviceSLTDDeptReqVO);
-                    log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈儴闂ㄤ俊鎭�濈粨鏉熼噰闆嗘暟鎹細{}", aBoolean1);
-
-                    Boolean aBoolean = false;
-                    for (Long cid : campusidList) {
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滅敤鎴蜂俊鎭�濆紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-                        ServiceSLTDInhospReqVO reqVO = new ServiceSLTDInhospReqVO();
-                        reqVO.setOrgId("20001001");
-                        reqVO.setCampusId(cid);
-                        ArrayList<String> statusList = new ArrayList<>();
-                        statusList.add("1");
-                        reqVO.setStatusList(statusList);
-                        aBoolean = serviceSLTDHealthcareRecordService.queryHospUserInfoList(reqVO);
-                    }
-                    log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滅敤鎴蜂俊鎭�濈粨鏉熼噰闆嗘暟鎹細{}", aBoolean);
-                    //鐤剧梾瀛楀吀閲囬泦
-                    iIcd10Service.queryAddIcd10();
-                }
-
-                // nhfy/sltd鍥炴函30澶╁垎娈甸噰闆嗗垽鏂紙姣忔鏈�澶�4澶╋級
-                boolean isBackfill = (active.trim().equals("nhfy") || active.trim().equals("sltd")) && StringUtils.isNotBlank(todayZeroStr);
-                if (isBackfill) {
-                    DateTimeFormatter dateFmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-                    LocalDate segStart = todayZero.toLocalDate().minusDays(30);
-                    LocalDate segEndDate = todayZero.toLocalDate();
-                    int segCount = 0;
-                    while (!segStart.isAfter(segEndDate)) {
-                        LocalDate segEnd = segStart.plusDays(3);
-                        if (segEnd.isAfter(segEndDate)) {
-                            segEnd = segEndDate;
-                        }
-                        segCount++;
-                        log.info("銆恉ealHisData銆憑}鍥炴函绗瑊}娈甸噰闆嗭紝鏃ユ湡鑼冨洿锛歿} ~ {}", active.trim(), segCount, segStart.format(dateFmt), segEnd.format(dateFmt));
-                        for (Long cid : campusidList) {
-                            collectSegmentData(cid, segStart.format(dateFmt), segEnd.format(dateFmt));
-                        }
-                        segStart = segEnd.plusDays(1);
-                    }
-                    log.info("銆恉ealHisData銆憑}鍥炴函閲囬泦瀹屾垚锛屽叡{}娈�", active.trim(), segCount);
-                }
-
-                // 鐪佺珛鍚屽痉鏁版嵁閲囬泦锛堥潪鍥炴函妯″紡鎵嶆墽琛岋級
-                if (!isBackfill) {
-                    for (Long cid : campusidList) {
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰烽鍏ラ櫌寮�濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-                        String nowTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                        ServiceSLTDInhospReqVO serviceSLTDInhospReqVO = new ServiceSLTDInhospReqVO();
-                        serviceSLTDInhospReqVO.setOrgId("20001001");
-                        serviceSLTDInhospReqVO.setCampusId(cid);
-                        serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime);
-                        serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime);
-                        if (active.trim().equals("nhfy")) {
-                            serviceSLTDInhospReqVO.setEncounterTimeStart(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                            serviceSLTDInhospReqVO.setEncounterTimeEnd(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                        }
-                        List<String> list = new ArrayList<>();
-                        list.add("FH0109.22");
-                        list.add("FH0109.23");
-                        list.add("FH0109.53");
-                        serviceSLTDInhospReqVO.setStatusList(list);
-//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
-                        serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濈祼鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濆紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-                        serviceSLTDInhospReqVO.setOrgId("20001001");
-                        serviceSLTDInhospReqVO.setCampusId(cid);
-                        serviceSLTDInhospReqVO.setEncounterTimeStart(null);
-                        serviceSLTDInhospReqVO.setEncounterTimeEnd(null);
-                        serviceSLTDInhospReqVO.setStartHeadTime(nowTime);
-                        serviceSLTDInhospReqVO.setStartTailTime(nowTime);
-                        if (active.trim().equals("nhfy")) {
-                            serviceSLTDInhospReqVO.setStartHeadTime(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                            serviceSLTDInhospReqVO.setStartTailTime(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                        }
-                        List<String> listStr = new ArrayList<>();
-                        listStr.add("FH0109.24");
-                        serviceSLTDInhospReqVO.setStatusList(listStr);
-//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
-                        serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濈祼鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濆紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-                        serviceSLTDInhospReqVO.setStartHeadTime(null);
-                        serviceSLTDInhospReqVO.setStartTailTime(null);
-                        serviceSLTDInhospReqVO.setEncounterTimeStart(null);
-                        serviceSLTDInhospReqVO.setEncounterTimeEnd(null);
-                        serviceSLTDInhospReqVO.setPreOutHospitalHeadDate(nowTime);
-                        serviceSLTDInhospReqVO.setPreOutHospitalTailDate(nowTime);
-                        if (active.trim().equals("nhfy")) {
-                            serviceSLTDInhospReqVO.setPreOutHospitalHeadDate(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                            serviceSLTDInhospReqVO.setPreOutHospitalTailDate(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-                        }
-                        serviceSLTDInhospReqVO.setHealthcareRecordTypeList(null);
-                        List<String> list2 = new ArrayList<>();
-//                    list2.add("FH0108.02");
-                        //鍑洪櫌
-                        list2.add("FH0109.27");
-                        //棰勫嚭闄�
-                        list2.add("FH0109.25");
-                        serviceSLTDInhospReqVO.setStatusList(list2);
-//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
-                        serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濇潫閲囬泦鏁版嵁锛岄櫌鍖猴細{}", cid);
-                    }
-                }
-
-            } catch (Exception e) {
-                log.error("銆恉ealHisData銆戠渷绔嬪悓寰锋暟鎹噰闆嗗紓甯�", e);
-            }
+        try {
+            dataCollectionFacade.dealHisData(todayZeroStr);
+        } catch (com.ruoyi.datacollection.api.DataCollectionModuleDisabledException e) {
+            log.warn("銆恉ealHisData銆憑}锛堟湰杞畾鏃堕噰闆嗚烦杩囷級", e.getMessage());
         }
     }
 
     /**
-     * 鍒嗘閲囬泦鏁版嵁锛堥鍏ラ櫌銆佸叆闄€�佸嚭闄級
-     * 鐢ㄤ簬nhfy/sltd鍥炴函閲囬泦锛屾瘡娆℃渶澶氭煡璇�7澶╂暟鎹�
+     * 鍦ㄩ櫌鎮h��"绉戝 / 鐥呭尯 / 搴婁綅"鍒锋柊锛堝崡鍗庨檮涓�锛屾瘡澶╀竴娆★級銆�
+     * <p>
+     * 鍦ㄩ櫌鎮h�呬細杞銆佽浆鐥呭尯銆佹崲搴婏紝鑰� {@code pat_med_inhosp} 鐨勪綅缃瓧娈靛彧鍦ㄥ叆闄㈡椂鍐欒繃涓�娆★紝
+     * 涔嬪悗涓嶄細鑷繁鏇存柊 鈥斺�� 杩欓噷姣忓ぉ鎸夋偅鑰呮煡涓�閬� HIS 閲�<b>璇ユ偅鑰呭綋鍓嶇殑鍦ㄩ櫌淇℃伅</b>
+     * 锛坽@code dtcQueryHealthcareRecordList}锛屼笌鍏ラ櫌閲囬泦鏄悓涓�涓帴鍙o紝鎸�
+     * {@code healthcareRecordNo} 鍗曟煡 + {@code statusList=["FH0109.24"]}锛夛紝
+     * 涓庡簱鍐呮瘮瀵瑰悗鍙妸鍙樺寲鐨勫瓧娈靛啓鍥炲幓銆傚疄鐜颁笌鍒ゅ畾鍙e緞瑙�
+     * {@code com.ruoyi.datacollection.service.impl.InhospDeptRefreshServiceImpl}銆�
+     * <p>
+     * 涓� {@link #dealHisData(String)} 鍚屾牱鐨勯檷绾у彛寰勶細妯″潡琚叧鎺夛紙
+     * {@code sys_config: datacollection.enabled=false}锛夋椂闂ㄩ潰鎶�
+     * {@link com.ruoyi.datacollection.api.DataCollectionModuleDisabledException}锛�
+     * 杩欓噷鍙墦涓�鏉� WARN 鈥斺�� 閭f槸"妯″潡琚富鍔ㄥ叧鎺�"锛屼笉璇ヨ鎴愬畾鏃朵换鍔℃墽琛屽紓甯搞��
+     * <p>
+     * sys_job 鐨� invoke_target 涓� {@code ryTask.refreshInhospDeptInfo()}锛�
+     * 寤鸿姣忓ぉ 03:30锛堥伩寮� 01:00 鍏ラ櫌閲囬泦涓� 02:00 鍑洪櫌澶勭悊锛夛紝骞跺彂绛栫暐閫�"绂佹骞跺彂"銆�
      *
-     * @param cid          闄㈠尯ID
-     * @param startDateStr 鏃ユ湡寮�濮� yyyy-MM-dd
-     * @param endDateStr   鏃ユ湡缁撴潫 yyyy-MM-dd
+     * @return 鏈瀹為檯鏇存柊鐨勫湪闄㈣褰曟潯鏁帮紙0 = 鏃犲彉鍖� / 绔欑偣涓嶅尮閰� / 妯″潡琚叧闂級
      */
-    private void collectSegmentData(Long cid, String startDateStr, String endDateStr) {
-//        // 棰勫叆闄�
-        log.info("銆恉ealHisData銆戦鍏ラ櫌寮�濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
-        ServiceSLTDInhospReqVO reqVO = new ServiceSLTDInhospReqVO();
-        reqVO.setOrgId("20001001");
-        reqVO.setCampusId(cid);
-        reqVO.setEncounterTimeStart(startDateStr);
-        reqVO.setEncounterTimeEnd(endDateStr);
-        List<String> preAdmitStatus = new ArrayList<>();
-        preAdmitStatus.add("FH0109.22");
-        preAdmitStatus.add("FH0109.23");
-        preAdmitStatus.add("FH0109.53");
-        reqVO.setStatusList(preAdmitStatus);
-        log.info("銆恉ealHisData銆戦鍏ラ櫌閲囬泦鏁版嵁鍏ュ弬锛歿}", reqVO);
+    public int refreshInhospDeptInfo() {
         try {
-            serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO);
-        } catch (Exception e) {
-            // 鍗曠被鏁版嵁澶辫触涓嶅啀鍚戜笂鎶涳細鍚﹀垯涓�娈靛け璐ヤ細璁╂湰娆″洖婧悗闈㈢殑鎵�鏈夋閮戒笉鎵ц
-            log.error("銆恉ealHisData銆戦鍏ラ櫌閲囬泦澶辫触锛岃烦杩囪绫荤户缁�傞櫌鍖猴細{}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr, e);
+            return dataCollectionFacade.refreshInhospDeptInfo();
+        } catch (com.ruoyi.datacollection.api.DataCollectionModuleDisabledException e) {
+            log.warn("銆恟efreshInhospDeptInfo銆憑}锛堟湰杞湪闄俊鎭埛鏂拌烦杩囷級", e.getMessage());
+            return 0;
         }
-        log.info("銆恉ealHisData銆戦鍏ラ櫌绲備簡閲囬泦鏁版嵁锛岄櫌鍖猴細{}", cid);
-
-        // 鍏ラ櫌
-        log.info("銆恉ealHisData銆戝叆闄㈠紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
-        reqVO = new ServiceSLTDInhospReqVO();
-        reqVO.setOrgId("20001001");
-        reqVO.setCampusId(cid);
-        reqVO.setStartHeadTime(startDateStr);
-        reqVO.setStartTailTime(endDateStr);
-        List<String> admitStatus = new ArrayList<>();
-        admitStatus.add("FH0109.24");
-        reqVO.setStatusList(admitStatus);
-        log.info("銆恉ealHisData銆戝叆闄㈤噰闆嗘暟鎹叆鍙傦細{}", reqVO);
-        try {
-            serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO);
-        } catch (Exception e) {
-            // 鍗曠被鏁版嵁澶辫触涓嶅啀鍚戜笂鎶涳細鍚﹀垯涓�娈靛け璐ヤ細璁╂湰娆″洖婧悗闈㈢殑鎵�鏈夋閮戒笉鎵ц
-            log.error("銆恉ealHisData銆戝叆闄㈤噰闆嗗け璐ワ紝璺宠繃璇ョ被缁х画銆傞櫌鍖猴細{}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr, e);
-        }
-        log.info("銆恉ealHisData銆戝叆闄㈢祩浜嗛噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
-
-        // 鍑洪櫌
-        log.info("銆恉ealHisData銆戝嚭闄㈠紑濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
-        reqVO = new ServiceSLTDInhospReqVO();
-        reqVO.setOrgId("20001001");
-        reqVO.setCampusId(cid);
-        reqVO.setPreOutHospitalHeadDate(startDateStr);
-        reqVO.setPreOutHospitalTailDate(endDateStr);
-        List<String> dischargeStatus = new ArrayList<>();
-        //鍑洪櫌
-        dischargeStatus.add("FH0109.27");
-        //棰勫嚭闄�
-        dischargeStatus.add("FH0109.25");
-        reqVO.setStatusList(dischargeStatus);
-        log.info("銆恉ealHisData銆戝嚭闄㈤噰闆嗘暟鎹叆鍙傦細{}", reqVO);
-        try {
-            serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO);
-        } catch (Exception e) {
-            // 鍗曠被鏁版嵁澶辫触涓嶅啀鍚戜笂鎶涳細鍚﹀垯涓�娈靛け璐ヤ細璁╂湰娆″洖婧悗闈㈢殑鎵�鏈夋閮戒笉鎵ц
-            log.error("銆恉ealHisData銆戝嚭闄㈤噰闆嗗け璐ワ紝璺宠繃璇ョ被缁х画銆傞櫌鍖猴細{}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr, e);
-        }
-        log.info("銆恉ealHisData銆戝嚭闄㈢粨鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
     }
 
     /**
diff --git a/ruoyi-task/src/main/java/com/ruoyi/task/api/contract/VisitTaskCreateApiImpl.java b/ruoyi-task/src/main/java/com/ruoyi/task/api/contract/VisitTaskCreateApiImpl.java
index 8698917..b298e44 100644
--- a/ruoyi-task/src/main/java/com/ruoyi/task/api/contract/VisitTaskCreateApiImpl.java
+++ b/ruoyi-task/src/main/java/com/ruoyi/task/api/contract/VisitTaskCreateApiImpl.java
@@ -186,6 +186,28 @@
         return !CollectionUtils.isEmpty(list);
     }
 
+    /**
+     * 鏄惁瀛樺湪銆屽悓涓�鎮h�� + 鍚屼竴娆″嚭闄㈣褰� + 鍚屼竴浠诲姟銆嶇殑瀛愪换鍔★紙{@code del_flag = 0}锛夈��
+     * <p>
+     * 鐩存帴鐢ㄧ幇鎴愮殑 {@code selectServiceSubtaskList}锛堟湰韬氨甯�
+     * {@code del_flag = 0} + {@code patid} + {@code inhospid} + {@code taskid} 涓変釜鏉′欢锛夛紝
+     * 涓嶆柊澧� XML 鈥斺�� 閬垮厤涓轰簡涓�涓�"鏈夋病鏈�"鍐嶅啓涓�鏉$瓑浠� SQL銆�
+     * <p>
+     * 鈿狅笍 涓嶆寜 {@code sendstate} 杩囨护锛氬凡鍋滅敤锛坰endstate=4锛夌殑鍘嗗彶琛屼篃绠�"鐢熸垚杩�"銆�
+     * 鍚﹀垯"鍋滄棫涓�鏉� + 鍐嶇敓鎴愪竴鏉�"浼氭棤闄愮疮绉� 鈥斺�� 杩欐鏄� 2026-10 鍚屼竴鎮h�呭嚑鍗佹潯瀛愪换鍔$殑鎴愬洜銆�
+     */
+    @Override
+    public boolean existsSubtask(Long patid, Long inhospid, Long taskid) {
+        if (patid == null || taskid == null) {
+            return false;
+        }
+        ServiceSubtaskEntity q = new ServiceSubtaskEntity();
+        q.setPatid(patid);
+        q.setInhospid(inhospid);
+        q.setTaskid(taskid);
+        return !CollectionUtils.isEmpty(serviceSubtaskMapper.selectServiceSubtaskList(q));
+    }
+
     // ==========================================================================
     // 瀛楁鎼繍锛堥�愬瓧娈靛鐓э紝鍕�"椤烘墜绮剧畝"锛�
     // ==========================================================================
@@ -194,17 +216,27 @@
         VisitLongTaskDto dto = new VisitLongTaskDto();
         dto.setTaskid(t.getTaskid());
         dto.setTaskName(t.getTaskName());
+        dto.setTaskDesc(t.getTaskDesc());
         dto.setType(t.getType());
         dto.setServiceType(t.getServiceType());
         dto.setTemplateid(t.getTemplateid());
         dto.setTemplatename(t.getTemplatename());
         dto.setLibtemplateid(t.getLibtemplateid());
+        dto.setLibtemplatename(t.getLibtemplatename());
         dto.setSendDay(t.getSendDay());
         dto.setPreachform(t.getPreachform());
         dto.setPreachformDesc(t.getPreachformDesc());
         dto.setOrgid(t.getOrgid());
         dto.setCampusid(t.getCampusid());
         dto.setHosType(t.getHospType());
+        // 鍘� boxedServiceSubtask 绗竴琛岀殑 DtoConversionUtils.sourceToTarget 浼氭妸杩� 6 涓�
+        // 鎷疯繘瀛愪换鍔″苟闅� insertServiceSubtask 钀藉簱锛涗笉鎼氨鏄潤榛樹涪鍒楋紙瑙� VisitLongTaskDto 娉ㄩ噴锛�
+        dto.setGuid(t.getGuid());
+        dto.setPid(t.getPid());
+        dto.setSendType(t.getSendType());
+        dto.setIsupload(t.getIsupload());
+        dto.setTextParam(t.getTextParam());
+        dto.setUploadTime(t.getUploadTime());
         dto.setUpdateBy(t.getUpdateBy());
         dto.setCreateBy(t.getCreateBy());
         return dto;
@@ -230,6 +262,7 @@
         e.setSex(d.getSex());
         e.setAge(d.getAge());
         e.setInhospid(d.getInhospid());
+        e.setHospno(d.getHospno());
         e.setNurseId(d.getNurseId());
         e.setNurseName(d.getNurseName());
         e.setDrcode(d.getDrcode());
@@ -246,6 +279,7 @@
         e.setTemplateid(d.getTemplateid());
         e.setTemplatename(d.getTemplatename());
         e.setLibtemplateid(d.getLibtemplateid());
+        e.setLibtemplatename(d.getLibtemplatename());
         e.setStarttime(d.getStarttime());
         e.setEndtime(d.getEndtime());
         e.setLongSendTime(d.getLongSendTime());
@@ -266,6 +300,29 @@
         e.setOperationItemId(d.getOperationItemId());
         e.setCreateBy(d.getCreateBy());
         e.setUpdateBy(d.getUpdateBy());
+        // 鈿狅笍 create_time / update_time 涔嬪墠涔熸槸婕忕殑锛�
+        //    缁勮鍣紙boxedServiceSubtask 鍘� L1157-1177锛夈�亀riteInSubTask 鐨勬瘡涓� insert 鍒嗘敮
+        //    閮藉湪 setCreateTime/setUpdateTime锛孹ML 涔熸湁瀵瑰簲鏉′欢鍒楋紝浣嗚繖閲屾病鏄犲皠 鈫�
+        //    涓ゆ潯鏃堕棿鍒楅潤榛樿惤 NULL锛�2026-10 瀹炴満鍙戠幇锛夈��
+        e.setCreateTime(d.getCreateTime());
+        e.setUpdateTime(d.getUpdateTime());
+        // ------------------------------------------------------------------
+        // 浠诲姟鏉ユ簮瀛楁锛堝師 boxedServiceSubtask 绗竴琛� DtoConversionUtils 鏁存壒鎷峰叆锛�
+        //
+        // 鈿狅笍 杩� 8 涓槸"浠诲姟 鈫� 瀛愪换鍔�"鐨勫揩鐓у垪銆傚師鍏堝彧鎼簡 taskid/serviceType 绛夛紝
+        //    taskName/taskDesc/type/libtemplatename 浠ュ強 guid/pid/sendType/isupload/
+        //    textParam/uploadTime 鍏ㄩ儴婕忔槧灏� 鈫� XML 鐨� <if test="xxx != null"> 鐩存帴璺宠繃,
+        //    service_subtask 涓婅繖浜涘垪闈欓粯涓� NULL锛�2026-10 鐢� addSubTaskByRule 瀹炴満鍙戠幇锛夈��
+        // ------------------------------------------------------------------
+        e.setTaskName(d.getTaskName());
+        e.setTaskDesc(d.getTaskDesc());
+        e.setType(d.getType());
+        e.setGuid(d.getGuid());
+        e.setPid(d.getPid());
+        e.setSendType(d.getSendType());
+        e.setIsupload(d.getIsupload());
+        e.setTextParam(d.getTextParam());
+        e.setUploadTime(d.getUploadTime());
 
         // ------------------------------------------------------------------
         // 闂ㄦ�ヨ瘖闅忚涓撶敤瀛楁锛圤uthospSubtaskDraft锛夈��
@@ -279,8 +336,8 @@
         if (d instanceof com.ruoyi.common.core.service.dto.OuthospSubtaskDraft) {
             com.ruoyi.common.core.service.dto.OuthospSubtaskDraft o =
                     (com.ruoyi.common.core.service.dto.OuthospSubtaskDraft) d;
+            // hospno 宸蹭笂鎻愬埌鐖剁被 VisitSubtaskDraft锛堜笂闈㈢粺涓�鏄犲皠杩囦簡锛夛紝杩欓噷涓嶅啀閲嶅
             // 鍙湁鐖剁被娌℃湁鐨勫瓧娈垫墠鍦ㄨ繖閲岃ˉ鏄犲皠锛堝叾浣欏 sendname/sfzh/phone/sex/age 鐖剁被宸叉湁锛�
-            e.setHospno(o.getHospno());
             e.setAdmindate(o.getAdmitdate());
             e.setFinishtime(o.getFinishtime());
             // 鈿狅笍 鍘熷疄鐜扮‖缂栫爜 "1"锛堜笉璇� serviceTask.getHospType()锛夛紝姝ゅ淇濇寔涓�鑷�
diff --git a/ruoyi-task/src/main/java/com/ruoyi/task/domain/PatTaskRelevance.java b/ruoyi-task/src/main/java/com/ruoyi/task/domain/PatTaskRelevance.java
index 9b704df..74c0dd3 100644
--- a/ruoyi-task/src/main/java/com/ruoyi/task/domain/PatTaskRelevance.java
+++ b/ruoyi-task/src/main/java/com/ruoyi/task/domain/PatTaskRelevance.java
@@ -258,6 +258,21 @@
     private String diagname;
 
     /**
+     * ICD/鐤剧梾鍚嶇О锛坽@code pat_task_relevance.icd_name} 鍒楋級
+     * <p>
+     * 鈿狅笍 涓嶈兘鐪侊細smartor 鐨� {@code PatHetaskRelevanceMapper.xml}
+     * 锛坣amespace 鏄� {@code com.smartor.mapper.PatTaskRelevanceMapper}锛岃
+     * {@code IPatTaskRelevanceService} 浣跨敤锛夐噷 resultMap 鏄�
+     * {@code property="icdName" column="icd_name"}锛宻elect/insert/update 涔熼兘鐢�
+     * {@code icdName}銆傛湰瀹炰綋鏄�屼换鍔℃ā鍧楀寲銆嶆椂浠� smartor 鎼繃鏉ョ殑锛�
+     * 鎼殑鏃跺�欏皯浜嗚繖涓瓧娈� 鈥斺�� 浜庢槸閭f潯 mapper 鐨�**姣忎竴娆¤皟鐢�**閮戒細鎶�
+     * {@code ReflectionException: no getter for 'icdName'}銆�
+     */
+    @Excel(name = "ICD鍚嶇О")
+    @ApiModelProperty(value = "ICD/鐤剧梾鍚嶇О锛坕cd_name 鍒楋級")
+    private String icdName;
+
+    /**
      * 鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎
      */
     @ApiModelProperty(value = "鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎")
diff --git a/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml b/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml
index f9d3a27..c478704 100644
--- a/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml
+++ b/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml
@@ -906,6 +906,10 @@
             <if test="deptname != null  and deptname != ''">deptname,</if>
             <if test="leaveicd10code != null  and leaveicd10code != ''">leaveicd10code,</if>
             <if test="leavediagname != null  and leavediagname != ''">leavediagname,</if>
+            <!-- diagname锛氬叆闄㈣瘖鏂悕绉般�傚師 insert 婕忎簡杩欎竴鍒楋紝鑰屽嚭闄㈤摼璺殑
+                 boxedServiceSubtask 涓�鐩村湪 setDiagname(patMedInhosp.diagname)锛�
+                 浜庢槸 service_subtask.diagname 姘歌繙涓� NULL锛坰elect 渚у嵈涓�鐩村湪璇诲畠锛夈�� -->
+            <if test="diagname != null  and diagname != ''">diagname,</if>
             <if test="libtemplateid != null ">libtemplateid,</if>
             <if test="libtemplatename != null ">libtemplatename,</if>
             <if test="patid != null ">patid,</if>
@@ -1004,6 +1008,7 @@
             <if test="deptname != null  and deptname != ''">#{deptname},</if>
             <if test="leaveicd10code != null  and leaveicd10code != ''">#{leaveicd10code},</if>
             <if test="leavediagname != null  and leavediagname != ''">#{leavediagname},</if>
+            <if test="diagname != null  and diagname != ''">#{diagname},</if>
             <if test="libtemplateid != null ">#{libtemplateid},</if>
             <if test="libtemplatename != null ">#{libtemplatename},</if>
             <if test="patid != null ">#{patid},</if>
diff --git a/ruoyi-template/src/main/java/com/ruoyi/template/domain/IvrLibaExtemplatescript.java b/ruoyi-template/src/main/java/com/ruoyi/template/domain/IvrLibaExtemplatescript.java
index a8ae2dc..083bed9 100644
--- a/ruoyi-template/src/main/java/com/ruoyi/template/domain/IvrLibaExtemplatescript.java
+++ b/ruoyi-template/src/main/java/com/ruoyi/template/domain/IvrLibaExtemplatescript.java
@@ -31,6 +31,17 @@
     private Long ID;
 
     /**
+     * 鎵归噺涓婚敭闆嗗悎锛堝彧浣滄煡璇㈡潯浠讹紝涓嶆槸琛ㄥ垪锛�
+     * <p>
+     * {@code IvrLibaExtemplatescriptMapper.xml#queryIvrLibaExtemplatescriptList} 鐢�
+     * {@code <if test="IDs != null">} + {@code <foreach collection="IDs">} 鎷�
+     * {@code extID in (...)}锛涘疄浣撲笂鍘熸湰鍙湁鍗曚釜 {@code ID}锛屾墍浠ラ偅鏉¤鍙ヤ竴鎵ц灏辨姏
+     * {@code ReflectionException: no getter for 'IDs'}銆傛澶勮ˉ涓婇泦鍚堝瓧娈碉紙鍒楀悕涓嶅彈褰卞搷锛夈��
+     */
+    @ApiModelProperty("鎵归噺涓婚敭闆嗗悎锛堟煡璇㈡潯浠讹級")
+    private List<Long> IDs;
+
+    /**
      * 妯$増搴搃d
      */
     @Excel(name = "妯$増搴搃d")
diff --git a/ruoyi-template/src/main/java/com/ruoyi/template/domain/VO/HeLibraryCountVO.java b/ruoyi-template/src/main/java/com/ruoyi/template/domain/VO/HeLibraryCountVO.java
index 4a93b4c..26c8820 100644
--- a/ruoyi-template/src/main/java/com/ruoyi/template/domain/VO/HeLibraryCountVO.java
+++ b/ruoyi-template/src/main/java/com/ruoyi/template/domain/VO/HeLibraryCountVO.java
@@ -42,6 +42,17 @@
     private String orgid;
 
     /**
+     * 闄㈠尯ID
+     * <p>
+     * 鈿狅笍 蹇呴』瀛樺湪锛歿@code ServiceSubtaskMapper.xml} 鐨� {@code getHeLibraryCount} /
+     * {@code gethelibraryCountHyperlink} 閲屾湁 {@code <if test="campusid != null">}锛�
+     * MyBatis 鐢� OGNL 姹傚�艰琛ㄨ揪寮忥紝缂� getter 浼氱洿鎺ユ姏
+     * {@code ReflectionException: no getter for 'campusid'}锛堜笉鏄�"鏉′欢涓嶆垚绔�"锛夈��
+     */
+    @ApiModelProperty(value = "闄㈠尯ID")
+    private String campusid;
+
+    /**
      * 鍙戦�佺姸鎬�
      */
     @Excel(name = " 鍙戦�佺姸鎬� ")
diff --git a/ruoyi-template/src/main/resources/mapper/template/IvrLibaTargetMapper.xml b/ruoyi-template/src/main/resources/mapper/template/IvrLibaTargetMapper.xml
index 10ee66d..8fabd7d 100644
--- a/ruoyi-template/src/main/resources/mapper/template/IvrLibaTargetMapper.xml
+++ b/ruoyi-template/src/main/resources/mapper/template/IvrLibaTargetMapper.xml
@@ -178,7 +178,10 @@
             <if test="targetdesc != null  and targetdesc != ''">and a.targetdesc = #{targetdesc}</if>
             <if test="language != null  and language != ''">and a.language = #{language}</if>
             <if test="version != null ">and a.version = #{version}</if>
-            <if test="valueType != null ">and a.valueType = #{value_type}</if>
+            <!-- 鍘熶负 `and a.valueType = #{value_type}`锛氬垪鍚嶄笌灞炴�у悕鍐欏弽浜嗭紙鍒楁槸 value_type銆�
+                 灞炴�ф槸 valueType锛夈�侻yBatis 姹傚�间細鎶�
+                 ReflectionException: no getter for 'value_type'锛屼笖 a.valueType 涔熶笉鏄悎娉曞垪銆� -->
+            <if test="valueType != null ">and a.value_type = #{valueType}</if>
             <if test="isabnormal != null ">and a.isabnormal = #{isabnormal}</if>
             <if test="warnup != null ">and a.warnup = #{warnup}</if>
             <if test="warndown != null ">and a.warndown = #{warndown}</if>
diff --git a/ruoyi-template/src/main/resources/mapper/template/IvrTaskTemplateMapper.xml b/ruoyi-template/src/main/resources/mapper/template/IvrTaskTemplateMapper.xml
index d19af0f..51c46ed 100644
--- a/ruoyi-template/src/main/resources/mapper/template/IvrTaskTemplateMapper.xml
+++ b/ruoyi-template/src/main/resources/mapper/template/IvrTaskTemplateMapper.xml
@@ -147,7 +147,10 @@
             <if test="revisitBefore != null  and revisitBefore != ''">and revisit_before = #{revisitBefore}</if>
             <if test="revisitAfter != null  and revisitAfter != ''">and revisit_after = #{revisitAfter}</if>
             <if test="noVoiceNum != null ">and no_voice_num = #{noVoiceNum}</if>
-            <if test="recallcount != null">and recallcount = #{prologrecallcountue}</if>
+            <!-- 鍘熶负 `#{prologrecallcountue}`锛氬疄浣撲笂娌℃湁杩欎釜灞炴�э紙鏄妸 `prolog` 绮樺埌浜�
+                 `recallcount` 鍓嶉潰锛夛紝test 鍒ょ殑鏄� recallcount 鍗村彇涓嶅埌鍊硷紝
+                 杩愯鏈熸姏 ReflectionException銆傚睘鎬ф寜 test 鐨� recallcount 鍙栥�� -->
+            <if test="recallcount != null">and recallcount = #{recallcount}</if>
             <if test="deptCode != null">and dept_code = #{deptCode}</if>
             <if test="longTemp != null">and long_temp = #{longTemp}</if>
     </select>
diff --git a/ruoyi-template/src/main/resources/mapper/template/SvyLibScriptMapper.xml b/ruoyi-template/src/main/resources/mapper/template/SvyLibScriptMapper.xml
index b7d813a..28d09b0 100644
--- a/ruoyi-template/src/main/resources/mapper/template/SvyLibScriptMapper.xml
+++ b/ruoyi-template/src/main/resources/mapper/template/SvyLibScriptMapper.xml
@@ -138,7 +138,9 @@
             <if test="language != null and language!=''">language,</if>
             <if test="otherdata != null and otherdata!=''">otherdata,</if>
             <if test="valueType != null and valueType!=''">value_type,</if>
-            <if test="reply != null and reply!=''">otherdata,</if>
+            <!-- 鍘熶负 `otherdata,`锛氫笌涓婇潰閭f潯閲嶅鍐欏悓涓�涓垪锛坮eply 鐨勫唴瀹逛細鐩栨帀 otherdata锛夛紝
+                 琛ㄩ噷 reply 鏄嫭绔嬪垪锛堣鏈枃浠� resultMap: property="reply" column="reply"锛夈�� -->
+            <if test="reply != null and reply!=''">reply,</if>
             <if test="scoretype != null and scoretype!=''">scoretype,</if>
             <if test="score != null ">score,</if>
             <if test="icd10Name != null and icd10Name!=''">icd10_name,</if>
@@ -173,7 +175,9 @@
             <if test="language != null  and language!=''">#{language},</if>
             <if test="otherdata != null and otherdata!=''">#{otherdata},</if>
             <if test="valueType != null and valueType!=''">#{valueType},</if>
-            <if test="reply != null and reply!=''">#{therdata},</if>
+            <!-- 鍘熶负 `#{therdata}`锛氬疄浣撲笂娌℃湁 therdata锛堟槸 otherdata 鐨勯敊鎷硷級锛�
+                 杩愯鏈熸姏 ReflectionException銆傚垪涓庡睘鎬ч兘鎸� reply 鍙栥�� -->
+            <if test="reply != null and reply!=''">#{reply},</if>
             <if test="scoretype != null and scoretype!=''">#{scoretype},</if>
             <if test="score != null ">#{score},</if>
             <if test="icd10Name != null and icd10Name!=''">#{icd10Name},</if>
@@ -212,7 +216,10 @@
             <if test="language != null and language!=''">language = #{language},</if>
             <if test="otherdata != null and otherdata!=''">otherdata = #{otherdata},</if>
             <if test="valueType != null and valueType!=''">value_type = #{valueType},</if>
-            <if test="reply != null and reply!=''">therdata =#{therdata},</if>
+            <!-- 鍘熶负 `therdata =#{therdata}`锛氬悓涓�鍒� otherdata 宸茶涓婇潰璧嬭繃鍊硷紝
+                 MySQL 浼氭姤 "Column 'otherdata' specified twice"锛屼笖灞炴�� therdata 涓嶅瓨鍦ㄣ��
+                 鎸� reply 鍒� + reply 灞炴�т慨姝c�� -->
+            <if test="reply != null and reply!=''">reply = #{reply},</if>
             <if test="scoretype != null and scoretype!=''">scoretype = #{scoretype},</if>
             <if test="score != null">score = #{score},</if>
             <if test="icd10Name != null and icd10Name!=''">icd10_name = #{icd10Name},</if>
diff --git a/ruoyi-template/src/main/resources/mapper/template/SvyTaskScriptMapper.xml b/ruoyi-template/src/main/resources/mapper/template/SvyTaskScriptMapper.xml
index 14f883d..d431ddb 100644
--- a/ruoyi-template/src/main/resources/mapper/template/SvyTaskScriptMapper.xml
+++ b/ruoyi-template/src/main/resources/mapper/template/SvyTaskScriptMapper.xml
@@ -61,7 +61,10 @@
             <if test="scoretype != null  and scoretype != ''"> and scoretype = #{scoretype}</if>
             <if test="score != null  and score != ''"> and score = #{score}</if>
             <if test="showtype != null  and showtype != ''"> and showtype = #{showtype}</if>
-            <if test="picturePath != null  and picturePath != ''"> and picture_path = #{picturePath}</if>
+            <!-- 鍘熶负 `and picture_path = #{picturePath}`锛歴vy_task_script 娌℃湁 picture_path 鍒�
+                 锛堟湰鏂囦欢 resultMap / select 鍒楁竻鍗曢噷鍙湁 script_picture锛夛紝瀹炰綋涔熸病鏈�
+                 picturePath 灞炴�� 鈥斺�� 涓ゅ閮戒笉瀛樺湪锛岃繖鏉℃潯浠朵粠鏉ヤ笉鍙兘鐢熸晥銆�
+                 鎸�"鍙鐪熷疄鍒�"鍒犳帀锛氬浘鐗囩敱涓嬮潰鐨� scriptPicture / script_picture 璐熻矗銆� -->
     </select>
 
     <select id="selectSvyTaskScriptById" parameterType="Long" resultMap="SvyTaskScriptResult">
@@ -157,7 +160,8 @@
             <if test="scoretype != null">scoretype = #{scoretype},</if>
             <if test="score != null">score = #{score},</if>
             <if test="showtype != null">showtype = #{showtype},</if>
-            <if test="picturePath != null">picture_path = #{picturePath},</if>
+            <!-- 鍚屼笂锛歱icture_path 鍒椾笌 picturePath 灞炴�ч兘涓嶅瓨鍦紝鍒犳帀杩欐潯锛堝惁鍒欎竴鏃︽湁浜�
+                 缁欏疄浣撹ˉ涓� picturePath锛孲QL 灏变細鍥� Unknown column 'picture_path' 鎶ラ敊锛夈�� -->
             <if test="scriptPicture != null">script_picture = #{scriptPicture},</if>
         </trim>
         where id = #{id}
diff --git a/ruoyi-template/src/main/resources/mapper/template/SvyTaskTemplateScriptMapper.xml b/ruoyi-template/src/main/resources/mapper/template/SvyTaskTemplateScriptMapper.xml
index 03c262c..e8107a5 100644
--- a/ruoyi-template/src/main/resources/mapper/template/SvyTaskTemplateScriptMapper.xml
+++ b/ruoyi-template/src/main/resources/mapper/template/SvyTaskTemplateScriptMapper.xml
@@ -336,7 +336,9 @@
             <if test="circulationDeptPersonName != null  and circulationDeptPersonName != ''">circulation_dept_person_name = #{circulationDeptPersonName},</if>
             <if test="circulationDeptPersonCode != null  and circulationDeptPersonCode != ''">circulation_dept_person_code = #{circulationDeptPersonCode},</if>
         </trim>
-        where id = #{d}
+        <!-- 鍘熶负 `where id = #{d}`锛氬睘鎬� d 涓嶅瓨鍦紝鏇存柊璇彞涓�鎵ц灏辨姏
+             ReflectionException锛坣o getter for 'd'锛夈�備富閿睘鎬ф槸 id銆� -->
+        where id = #{id}
     </update>
 
     <delete id="deleteSvyTaskTemplateScriptByID" parameterType="Long">
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java b/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java
index 60d77b6..7386745 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java
@@ -82,6 +82,25 @@
     @Excel(name = "澶囨敞")
     private Long userInfoId;
 
+    /**
+     * 鍞竴鏍囪瘑
+     * <p>
+     * 鈿狅笍 蹇呴』瀛樺湪锛歿@code ServiceThirdDataMapper.xml} 鐨� resultMap 宸叉槧灏�
+     * {@code property="guid" column="guid"}锛屼笁鏉� insert 涔熼兘鏈�
+     * {@code <if test="guid != null">}銆傚疄浣撶己杩欎釜瀛楁鏃讹紝
+     * 鏌ヨ浼氬湪缁撴灉鏄犲皠闃舵銆佹彃鍏ヤ細鍦� OGNL 姹傚�奸樁娈电洿鎺ユ姏 ReflectionException銆�
+     */
+    @ApiModelProperty("鍞竴鏍囪瘑")
+    private String guid;
+
+    /**
+     * 鏈烘瀯ID
+     * <p>
+     * 鈿狅笍 鍚屼笂锛歳esultMap 鏄犲皠 {@code property="orgid" column="orgid"}锛�
+     * {@code selectServiceThirdDataList} 涓庝笁鏉� insert 閮藉紩鐢ㄥ畠銆�
+     */
+    @ApiModelProperty("鏈烘瀯ID")
+    private String orgid;
 
 }
 
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java b/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java
index 797f264..d5d2f62 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java
@@ -1,6 +1,7 @@
 package com.smartor.service;
 
 import afu.org.checkerframework.checker.oigj.qual.O;
+import com.ruoyi.common.core.service.dto.InhospPositionRecord;
 import com.smartor.domain.MedicationItem;
 import com.smartor.domain.ServiceSLTDDeptReqVO;
 import com.smartor.domain.ServiceSLTDInhospReqVO;
@@ -80,5 +81,22 @@
      */
     Boolean queryDeptWardAreaInfoList(ServiceSLTDDeptReqVO serviceSLTDDeptReqVO);
 
+    /**
+     * 鏌ヨ鍗曚釜鍦ㄩ櫌鎮h�呯殑<b>褰撳墠</b>绉戝 / 鐥呭尯 / 搴婁綅
+     * 锛堜笌鍏ラ櫌閲囬泦鍚屼竴涓帴鍙� {@code dtcQueryHealthcareRecordList}锛岀敤 {@code healthcareRecordNo} 鍗曟煡锛夈��
+     * <p>
+     * 鈿狅笍 <b>鍙彇鏁帮紝涓嶈惤搴�</b>锛氱敱璋冪敤鏂癸紙鏁版嵁閲囬泦妯″潡鐨�"鍦ㄩ櫌淇℃伅鍒锋柊"锛夎嚜宸变笌
+     * {@code pat_med_inhosp} 姣斿銆傚彇鏁板け璐ワ紙鏃犲搷搴� / 闈� 200锛�<b>鎶� RuntimeException</b>锛�
+     * 涓嶇敤绌哄垪琛ㄥ啋鍏�"璇ユ偅鑰呭凡涓嶅湪闄�"銆�
+     * <p>
+     * 鍏ュ弬绾﹀畾锛歿@code orgId} + {@code campusId} + {@code statusList=["FH0109.24"]} +
+     * {@code healthcareRecordNo}銆倇@code statusList} 鐢� HIS 渚ц繃婊ゆ帀宸插嚭闄�/棰勫嚭闄㈢殑璁板綍锛�
+     * 鍥犳<b>杩斿洖绌哄垪琛ㄥ嵆琛ㄧず"褰撳墠涓嶅湪鍏ラ櫌鐘舵��"</b>銆�
+     *
+     * @param reqVO 瑙佷笂
+     * @return 褰撳墠浣嶇疆璁板綍锛涚┖鍒楄〃 = 璇ユ偅鑰呭綋鍓嶄笉鍦�"鍏ラ櫌"鐘舵��
+     */
+    List<InhospPositionRecord> queryInhospPosition(ServiceSLTDInhospReqVO reqVO);
+
 
 }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
index da224ee..11638b2 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -10,6 +10,7 @@
 import com.ruoyi.common.core.domain.entity.SysUserRole;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.core.service.dto.InhospPositionRecord;
 import com.smartor.common.enums.EmergencyLevelEnum;
 import com.smartor.common.enums.ImportFlagEnum;
 import com.ruoyi.common.utils.http.HttpUtils;
@@ -52,6 +53,23 @@
 public class ServiceSLTDHealthcareRecordServiceImpl implements IServiceSLTDHealthcareRecordService {
 
     private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+    /**
+     * 鍦ㄩ櫌鎮h�呭綋鍓嶄綅缃煡璇㈠湴鍧�锛堢綉鍏虫牴璺緞 {@code sltd_pub_path} + 鍥哄畾鍚庣紑锛夈��
+     * <p>
+     * 涓�"鍏ラ櫌閲囬泦"鏄�<b>鍚屼竴涓帴鍙�</b>锛坽@code queryHealthcareRecordList} 鐢ㄧ殑涔熸槸瀹冿級锛�
+     * 鍖哄埆鍙槸鏈柟娉曟寜 {@code healthcareRecordNo} 鍗曟煡銆佸彧鍙栦綅缃瓧娈点�佷笉钀藉簱銆�
+     */
+    private static final String INHOSP_POSITION_PATH =
+            "/osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList";
+
+    /**
+     * 褰撳墠浣嶇疆鏌ヨ鐨勮繛鎺�/璇昏秴鏃讹細涓�杞鎸夋偅鑰呰皟鐢ㄥ嚑鍗冩锛�
+     * 涓嶈兘璁╀竴娆℃棤鍝嶅簲鎶婇噰闆嗙嚎绋嬫棤闄愭湡鎸備綇锛坽@code HttpUtils} 鑰佹柟娉曟病鏈夎秴鏃讹級
+     */
+    private static final int INHOSP_POSITION_CONNECT_TIMEOUT_MS = 5000;
+
+    private static final int INHOSP_POSITION_READ_TIMEOUT_MS = 15000;
 
     @Autowired
     private IPatArchiveService patArchiveService;
@@ -426,6 +444,47 @@
         return true;
     }
 
+    @Override
+    public List<InhospPositionRecord> queryInhospPosition(ServiceSLTDInhospReqVO reqVO) {
+        // 涓�"鍏ラ櫌閲囬泦"鍏辩敤鍚屼竴濂楀叆鍙傛瀯閫狅細orgId + campusIds + statusList + healthcareRecordNo
+        Map<String, Object> requestParams = buildRequestParams(reqVO);
+        Map<String, String> headers = buildRequestHeaders();
+        String url = sltdPubPath + INHOSP_POSITION_PATH;
+        String result = HttpUtils.sendPostByHeader(url, new Gson().toJson(requestParams), headers,
+                INHOSP_POSITION_CONNECT_TIMEOUT_MS, INHOSP_POSITION_READ_TIMEOUT_MS);
+        if (StringUtils.isEmpty(result)) {
+            // sendPostByHeader 鎶婂紓甯稿悶鎺夊悗杩斿洖绌轰覆锛氳繖閲岀粷涓嶈兘褰撴垚"璇ユ偅鑰呭凡涓嶅湪闄�"锛�
+            // 鍚﹀垯鎺ュ彛鏁翠綋涓嶅彲鐢ㄦ椂浼氳璁版垚"鍑犲崈涓偅鑰呴兘鍑洪櫌浜�"锛屼笌鐪熺浉鍙嶃��
+            throw new RuntimeException("鏌ヨ鍦ㄩ櫌鎮h�呭綋鍓嶄綅缃帴鍙f棤鍝嶅簲锛宧ealthcareRecordNo=" + reqVO.getHealthcareRecordNo());
+        }
+        // getDataList 鍦ㄨ繑鍥炵爜闈� 200 鏃舵姏 RuntimeException锛沝ata 涓� []锛堣鎮h�呭凡涓嶅湪鍏ラ櫌鐘舵�侊級鏃惰繑鍥炵┖鍒楄〃
+        List<Map<String, Object>> dataList = getDataList(result, 1);
+        List<InhospPositionRecord> records = new ArrayList<>(dataList.size());
+        for (Map<String, Object> dataItem : dataList) {
+            records.add(convertToInhospPosition(dataItem));
+        }
+        return records;
+    }
+
+    /**
+     * 鍋ュ悍璁板綍 JSON 鈫� 濂戠害 DTO 鐨勯�愬瓧娈垫惉杩愶紙鍙彇"褰撳墠浣嶇疆"瑕佺敤鐨勫瓧娈碉級銆�
+     * <p>
+     * 涓�寰嬭蛋 {@code getStringValue} / {@code getLongValue}锛氭帴鍙e绌哄�煎彲鑳借繑鍥� {@code null}銆�
+     * {@code ""} 鐢氳嚦缂哄瓧娈碉紝鐩存帴璁� Gson 鍙嶅簭鍒楀寲鍒� Long 瀛楁浼氬湪绌轰覆涓婃姏 NumberFormatException銆�
+     */
+    private InhospPositionRecord convertToInhospPosition(Map<String, Object> dataItem) {
+        InhospPositionRecord record = new InhospPositionRecord();
+        record.setHealthcareRecordNo(getStringValue(dataItem, "healthcareRecordNo"));
+        record.setPatientName(getStringValue(dataItem, "patientName"));
+        record.setDeptId(getLongValue(dataItem, "deptId"));
+        record.setDeptName(getStringValue(dataItem, "deptName"));
+        record.setAreaId(getLongValue(dataItem, "areaId"));
+        record.setAreaName(getStringValue(dataItem, "areaName"));
+        record.setBedNumber(getStringValue(dataItem, "bedNumber"));
+        record.setHealthcareRecordStatus(getStringValue(dataItem, "healthcareRecordStatus"));
+        return record;
+    }
+
     private String determineCry(ServiceSLTDInhospReqVO reqVO) {
         if (CollectionUtils.isEmpty(reqVO.getStatusList()) && CollectionUtils.isEmpty(reqVO.getHealthcareRecordTypeList()))
             return null;
diff --git a/smartor/src/main/resources/mapper/smartor/HospitalRecordMapper.xml b/smartor/src/main/resources/mapper/smartor/HospitalRecordMapper.xml
index 3648ada..6031faf 100644
--- a/smartor/src/main/resources/mapper/smartor/HospitalRecordMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/HospitalRecordMapper.xml
@@ -204,7 +204,7 @@
             <if test="directorName != null  and directorName != ''">and DirectorName like concat('%', #{directorName},
                 '%')
             </if>
-            <if test="dncDiagnosisCode != null  and dncDiagnosisCode != ''">and EncDiagnosisCode = #{dncDiagnosisCode}
+            <if test="encDiagnosisCode != null  and encDiagnosisCode != ''">and EncDiagnosisCode = #{encDiagnosisCode}
             </if>
             <if test="encDiagnosisDesc != null  and encDiagnosisDesc != ''">and EncDiagnosisDesc = #{encDiagnosisDesc}
             </if>
@@ -350,62 +350,62 @@
     <update id="updateHospitalRecord" parameterType="com.smartor.domain.HospitalRecord">
         update hospital_record
         <trim prefix="SET" suffixOverrides=",">
-            <if test="SourceSystem != null">SourceSystem = #{SourceSystem},</if>
-            <if test="MessageID != null">MessageID = #{MessageID},</if>
-            <if test="CreateTime != null">CreateTime = #{CreateTime},</if>
-            <if test="MethodName != null">MethodName = #{MethodName},</if>
-            <if test="ReqIimRules != null">ReqIimRules = #{ReqIimRules},</if>
-            <if test="PatientID != null">PatientID = #{PatientID},</if>
-            <if test="OpreationTime != null">OpreationTime = #{OpreationTime},</if>
-            <if test="EpisodeID != null">EpisodeID = #{EpisodeID},</if>
-            <if test="OutMedNO != null">OutMedNO = #{OutMedNO},</if>
-            <if test="InMedNO != null">InMedNO = #{InMedNO},</if>
-            <if test="VisitNum != null">VisitNum = #{VisitNum},</if>
-            <if test="AdmTypeCode != null">AdmTypeCode = #{AdmTypeCode},</if>
-            <if test="AdmTypeDesc != null">AdmTypeDesc = #{AdmTypeDesc},</if>
-            <if test="AdmStatus != null">AdmStatus = #{AdmStatus},</if>
-            <if test="AdmDate != null">AdmDate = #{AdmDate},</if>
-            <if test="EncPatName != null">EncPatName = #{EncPatName},</if>
-            <if test="EncPatGender != null">EncPatGender = #{EncPatGender},</if>
-            <if test="EncPatBirthDate != null">EncPatBirthDate = #{EncPatBirthDate},</if>
-            <if test="Transferstart != null">Transferstart = #{Transferstart},</if>
-            <if test="Transferend != null">Transferend = #{Transferend},</if>
-            <if test="EncPatMaritalStatus != null">EncPatMaritalStatus = #{EncPatMaritalStatus},</if>
-            <if test="OriginalText != null">OriginalText = #{OriginalText},</if>
-            <if test="EncDocList != null">EncDocList = #{EncDocList},</if>
-            <if test="EncAdmLocList != null">EncAdmLocList = #{EncAdmLocList},</if>
+            <if test="sourceSystem != null">SourceSystem = #{sourceSystem},</if>
+            <if test="messageID != null">MessageID = #{messageID},</if>
+            <if test="createTime != null">CreateTime = #{createTime},</if>
+            <if test="methodName != null">MethodName = #{methodName},</if>
+            <if test="reqIimRules != null">ReqIimRules = #{reqIimRules},</if>
+            <if test="patientID != null">PatientID = #{patientID},</if>
+            <if test="opreationTime != null">OpreationTime = #{opreationTime},</if>
+            <if test="episodeID != null">EpisodeID = #{episodeID},</if>
+            <if test="outMedNO != null">OutMedNO = #{outMedNO},</if>
+            <if test="inMedNO != null">InMedNO = #{inMedNO},</if>
+            <if test="visitNum != null">VisitNum = #{visitNum},</if>
+            <if test="admTypeCode != null">AdmTypeCode = #{admTypeCode},</if>
+            <if test="admTypeDesc != null">AdmTypeDesc = #{admTypeDesc},</if>
+            <if test="admStatus != null">AdmStatus = #{admStatus},</if>
+            <if test="admDate != null">AdmDate = #{admDate},</if>
+            <if test="encPatName != null">EncPatName = #{encPatName},</if>
+            <if test="encPatGender != null">EncPatGender = #{encPatGender},</if>
+            <if test="encPatBirthDate != null">EncPatBirthDate = #{encPatBirthDate},</if>
+            <if test="transferstart != null">Transferstart = #{transferstart},</if>
+            <if test="transferend != null">Transferend = #{transferend},</if>
+            <if test="encPatMaritalStatus != null">EncPatMaritalStatus = #{encPatMaritalStatus},</if>
+            <if test="originalText != null">OriginalText = #{originalText},</if>
+            <if test="encDocList != null">EncDocList = #{encDocList},</if>
+            <if test="encAdmLocList != null">EncAdmLocList = #{encAdmLocList},</if>
             <if test="encounterPeriodStart != null">Encounter_period_start = #{encounterPeriodStart},</if>
             <if test="encounterPeriodEnd != null">Encounter_period_end = #{encounterPeriodEnd},</if>
             <if test="encounterBooktime != null">Encounter_booktime = #{encounterBooktime},</if>
-            <if test="EncAdmSource != null">EncAdmSource = #{EncAdmSource},</if>
-            <if test="EncInhostype != null">EncInhostype = #{EncInhostype},</if>
-            <if test="EncDietName != null">EncDietName = #{EncDietName},</if>
-            <if test="EncOuthostype != null">EncOuthostype = #{EncOuthostype},</if>
-            <if test="EncVisitnum != null">EncVisitnum = #{EncVisitnum},</if>
-            <if test="EncChargeType != null">EncChargeType = #{EncChargeType},</if>
-            <if test="EncChargeTypeName != null">EncChargeTypeName = #{EncChargeTypeName},</if>
-            <if test="EncChargeCode != null">EncChargeCode = #{EncChargeCode},</if>
-            <if test="EncChargeName != null">EncChargeName = #{EncChargeName},</if>
-            <if test="EncReglevelcode != null">EncReglevelcode = #{EncReglevelcode},</if>
-            <if test="EncCareLevel != null">EncCareLevel = #{EncCareLevel},</if>
-            <if test="Specialday != null">Specialday = #{Specialday},</if>
-            <if test="Primaryday != null">Primaryday = #{Primaryday},</if>
-            <if test="Secondaryday != null">Secondaryday = #{Secondaryday},</if>
-            <if test="Tertiaryday != null">Tertiaryday = #{Tertiaryday},</if>
-            <if test="Enroomno != null">Enroomno = #{Enroomno},</if>
-            <if test="EnBedno != null">EnBedno = #{EnBedno},</if>
-            <if test="EncSeeno != null">EncSeeno = #{EncSeeno},</if>
-            <if test="EncAgeUnit != null">EncAgeUnit = #{EncAgeUnit},</if>
-            <if test="EncAgeValue != null">EncAgeValue = #{EncAgeValue},</if>
-            <if test="EnIsbaby != null">EnIsbaby = #{EnIsbaby},</if>
-            <if test="EncHavebaby != null">EncHavebaby = #{EncHavebaby},</if>
-            <if test="EncDiagList != null">EncDiagList = #{EncDiagList},</if>
-            <if test="DirectorCode != null">DirectorCode = #{DirectorCode},</if>
-            <if test="DirectorName != null">DirectorName = #{DirectorName},</if>
-            <if test="EncDiagnosisCode != null">EncDiagnosisCode = #{EncDiagnosisCode},</if>
-            <if test="EncDiagnosisDesc != null">EncDiagnosisDesc = #{EncDiagnosisDesc},</if>
-            <if test="EncAdmLocCode != null">EncAdmLocCode = #{EncAdmLocCode},</if>
-            <if test="EncAdmLocName != null">EncAdmLocName = #{EncAdmLocName},</if>
+            <if test="encAdmSource != null">EncAdmSource = #{encAdmSource},</if>
+            <if test="encInhostype != null">EncInhostype = #{encInhostype},</if>
+            <if test="encDietName != null">EncDietName = #{encDietName},</if>
+            <if test="encOuthostype != null">EncOuthostype = #{encOuthostype},</if>
+            <if test="encVisitnum != null">EncVisitnum = #{encVisitnum},</if>
+            <if test="encChargeType != null">EncChargeType = #{encChargeType},</if>
+            <if test="encChargeTypeName != null">EncChargeTypeName = #{encChargeTypeName},</if>
+            <if test="encChargeCode != null">EncChargeCode = #{encChargeCode},</if>
+            <if test="encChargeName != null">EncChargeName = #{encChargeName},</if>
+            <if test="encReglevelcode != null">EncReglevelcode = #{encReglevelcode},</if>
+            <if test="encCareLevel != null">EncCareLevel = #{encCareLevel},</if>
+            <if test="specialday != null">Specialday = #{specialday},</if>
+            <if test="primaryday != null">Primaryday = #{primaryday},</if>
+            <if test="secondaryday != null">Secondaryday = #{secondaryday},</if>
+            <if test="tertiaryday != null">Tertiaryday = #{tertiaryday},</if>
+            <if test="enroomno != null">Enroomno = #{enroomno},</if>
+            <if test="enBedno != null">EnBedno = #{enBedno},</if>
+            <if test="encSeeno != null">EncSeeno = #{encSeeno},</if>
+            <if test="encAgeUnit != null">EncAgeUnit = #{encAgeUnit},</if>
+            <if test="encAgeValue != null">EncAgeValue = #{encAgeValue},</if>
+            <if test="enIsbaby != null">EnIsbaby = #{enIsbaby},</if>
+            <if test="encHavebaby != null">EncHavebaby = #{encHavebaby},</if>
+            <if test="encDiagList != null">EncDiagList = #{encDiagList},</if>
+            <if test="directorCode != null">DirectorCode = #{directorCode},</if>
+            <if test="directorName != null">DirectorName = #{directorName},</if>
+            <if test="encDiagnosisCode != null">EncDiagnosisCode = #{encDiagnosisCode},</if>
+            <if test="encDiagnosisDesc != null">EncDiagnosisDesc = #{encDiagnosisDesc},</if>
+            <if test="encAdmLocCode != null">EncAdmLocCode = #{encAdmLocCode},</if>
+            <if test="encAdmLocName != null">EncAdmLocName = #{encAdmLocName},</if>
             <if test="taskStatus != null">taskStatus = #{taskStatus},</if>
             <if test="guid != null">guid = #{guid},</if>
             <if test="orgid != null">orgid = #{orgid},</if>
diff --git a/smartor/src/main/resources/mapper/smartor/HospitalUserinfoMapper.xml b/smartor/src/main/resources/mapper/smartor/HospitalUserinfoMapper.xml
index e5a3771..be3988e 100644
--- a/smartor/src/main/resources/mapper/smartor/HospitalUserinfoMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/HospitalUserinfoMapper.xml
@@ -8,7 +8,10 @@
         <result property="ID" column="ID"/>
         <result property="SourceSystem" column="SourceSystem"/>
         <result property="MessageID" column="MessageID"/>
-        <result property="CreateTime" column="CreateTime"/>
+        <!-- 鍘熶负 property="CreateTime"锛氬疄浣撲笂鍙湁 createTime锛堝叾浣� ID/SourceSystem/MessageID/
+             PatientID 绛夊ぇ鍐欏睘鎬у湪瀹炰綋閲岀‘鏈夊悓鍚嶅瓧娈碉紝鍙湁杩欎釜娌℃湁锛夛紝
+             缁撴灉鏄犲皠浼氭姏 ReflectionException: no setter for 'CreateTime'銆� -->
+        <result property="createTime" column="CreateTime"/>
         <result property="MethodName" column="MethodName"/>
         <result property="ReqIimRules" column="ReqIimRules"/>
         <result property="PatientID" column="PatientID"/>
@@ -186,7 +189,7 @@
         where 1=1
             <if test="SourceSystem != null  and SourceSystem != ''">and SourceSystem = #{SourceSystem}</if>
             <if test="MessageID != null  and MessageID != ''">and MessageID = #{MessageID}</if>
-            <if test="CreateTime != null  and CreateTime != ''">and CreateTime = #{CreateTime}</if>
+            <if test="createTime != null  and createTime != ''">and CreateTime = #{createTime}</if>
             <if test="MethodName != null  and MethodName != ''">and MethodName like concat('%', #{MethodName}, '%')</if>
             <if test="ReqIimRules != null  and ReqIimRules != ''">and ReqIimRules = #{ReqIimRules}</if>
             <if test="PatientID != null  and PatientID != ''">and PatientID = #{PatientID}</if>
@@ -295,7 +298,7 @@
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="SourceSystem != null">SourceSystem,</if>
             <if test="MessageID != null">MessageID,</if>
-            <if test="CreateTime != null  and CreateTime != ''">CreateTime,</if>
+            <if test="createTime != null  and createTime != ''">CreateTime,</if>
             <if test="MethodName != null">MethodName,</if>
             <if test="ReqIimRules != null">ReqIimRules,</if>
             <if test="PatientID != null">PatientID,</if>
@@ -381,7 +384,7 @@
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="SourceSystem != null">#{SourceSystem},</if>
             <if test="MessageID != null">#{MessageID},</if>
-            <if test="CreateTime != null and CreateTime != ''">#{CreateTime},</if>
+            <if test="createTime != null and createTime != ''">#{createTime},</if>
             <if test="MethodName != null">#{MethodName},</if>
             <if test="ReqIimRules != null">#{ReqIimRules},</if>
             <if test="PatientID != null">#{PatientID},</if>
@@ -471,7 +474,7 @@
         <trim prefix="SET" suffixOverrides=",">
             <if test="SourceSystem != null">SourceSystem = #{SourceSystem},</if>
             <if test="MessageID != null">MessageID = #{MessageID},</if>
-            <if test="CreateTime != null">CreateTime = #{CreateTime},</if>
+            <if test="createTime != null">CreateTime = #{createTime},</if>
             <if test="MethodName != null">MethodName = #{MethodName},</if>
             <if test="ReqIimRules != null">ReqIimRules = #{ReqIimRules},</if>
             <if test="PatientID != null">PatientID = #{PatientID},</if>
@@ -562,7 +565,7 @@
         <trim prefix="SET" suffixOverrides=",">
             <if test="SourceSystem != null">SourceSystem = #{SourceSystem},</if>
             <if test="MessageID != null">MessageID = #{MessageID},</if>
-            <if test="CreateTime != null">CreateTime = #{CreateTime},</if>
+            <if test="createTime != null">CreateTime = #{createTime},</if>
             <if test="MethodName != null">MethodName = #{MethodName},</if>
             <if test="ReqIimRules != null">ReqIimRules = #{ReqIimRules},</if>
             <if test="PatientID != null">PatientID = #{PatientID},</if>
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index f723d16..63cfe9d 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -613,7 +613,10 @@
             and d.orgid = #{orgid}
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
-            <if test="pid != null  and pid != ''">and a.id = #{id}</if>
+            <!-- 鍘熶负 `and a.id = #{id}`锛歅atArchiveReq 涓婃病鏈� id锛堝彧鏈� pid锛夛紝
+                 鏉′欢鍒ょ殑鏄� pid 鍗村彇 id 鈥斺�� 杩欐潯鏌ヨ锛堟寜浣忛櫌璁板綍鏌ユ。妗堬級涓�鎵ц灏辨姏
+                 ReflectionException: no getter for 'id'銆傚崰浣嶇鎸� pid 鍙栥�� -->
+            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="campusid != null  and campusid != ''">and a.campusid = #{campusid}</if>
             <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
             <if test="notrequiredFlag != null  and notrequiredFlag != ''">and a.notrequired_flag = #{notrequiredFlag}
@@ -938,7 +941,8 @@
             and d.orgid = #{orgid}
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
-            <if test="pid != null  and pid != ''">and a.id = #{id}</if>
+            <!-- 鍚屼笂锛圦C 鐗堣鍙ワ級锛氬崰浣嶇 id -> pid銆� -->
+            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
             <if test="notrequiredFlag != null  and notrequiredFlag != ''">and a.notrequired_flag = #{notrequiredFlag}
             </if>
diff --git a/smartor/src/main/resources/mapper/smartor/PatHetaskRelevanceMapper.xml b/smartor/src/main/resources/mapper/smartor/PatHetaskRelevanceMapper.xml
index a0ad0f3..22d6076 100644
--- a/smartor/src/main/resources/mapper/smartor/PatHetaskRelevanceMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatHetaskRelevanceMapper.xml
@@ -24,7 +24,8 @@
         <result property="sendTime" column="send_time"/>
         <result property="operatePerson" column="operate_person"/>
         <result property="receiveTime" column="receive_time"/>
-        <result property="visitTime" column="visit_time"/>
+        <!-- 鍘熶负 property="visitTime"锛氫换鍔℃ā鍧楀寲鍚庡疄浣撳瓧娈靛彨 visittime锛堝叏灏忓啓锛屽垪浠嶆槸 visit_time锛夈�� -->
+        <result property="visittime" column="visit_time"/>
         <result property="guid" column="guid"/>
         <result property="orgid" column="orgid"/>
     </resultMap>
@@ -74,7 +75,7 @@
             <if test="icdName != null  and icdName != ''">and icd_name like concat('%', #{icdName}, '%')</if>
             <if test="sendStatus != null ">and send_status = #{sendStatus}</if>
             <if test="sendTime != null ">and send_time = #{sendTime}</if>
-            <if test="visitTime != null ">and visit_time = #{visitTime}</if>
+            <if test="visittime != null ">and visit_time = #{visittime}</if>
             <if test="receiveTime != null ">and receive_time = #{receiveTime}</if>
             <if test="operatePerson != null   and operatePerson != ''">and operate_person = #{operatePerson}</if>
     </select>
@@ -104,7 +105,7 @@
             <if test="sendStatus != null">send_status,</if>
             <if test="sendTime != null">send_time,</if>
             <if test="receiveTime != null">receive_time,</if>
-            <if test="visitTime != null">visit_time,</if>
+            <if test="visittime != null">visit_time,</if>
             <if test="operatePerson != null and operatePerson != ''">operate_person,</if>
             <if test="guid != null and guid != ''">guid,</if>
             <if test="orgid != null and orgid != ''">orgid,</if>
@@ -127,7 +128,7 @@
             <if test="sendStatus != null">#{sendStatus},</if>
             <if test="sendTime != null">#{sendTime},</if>
             <if test="receiveTime != null">#{receiveTime},</if>
-            <if test="visitTime != null">#{visitTime},</if>
+            <if test="visittime != null">#{visittime},</if>
             <if test="operatePerson != null and operatePerson != ''">#{operatePerson},</if>
             <if test="guid != null and guid != ''">#{guid},</if>
             <if test="orgid != null and orgid != ''">#{orgid},</if>
@@ -154,7 +155,7 @@
             <if test="sendStatus != null">send_status=#{sendStatus},</if>
             <if test="sendTime != null">send_time=#{sendTime},</if>
             <if test="receiveTime != null">receive_time=#{receiveTime},</if>
-            <if test="visitTime != null">visit_time=#{visitTime},</if>
+            <if test="visittime != null">visit_time=#{visittime},</if>
             <if test="operatePerson != null and operatePerson != ''">operate_person=#{operatePerson},</if>
             <if test="guid != null and guid != ''">guid=#{guid},</if>
             <if test="orgid != null and orgid != ''">orgid=#{orgid},</if>
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInspectionMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInspectionMapper.xml
index 3a660f3..4ac9912 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInspectionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInspectionMapper.xml
@@ -131,7 +131,10 @@
             <if test="partId != null">and part_id = #{partId}</if>
             <if test="partName != null">and part_name = #{partName}</if>
             <if test="typeId != null">and type_id = #{typeId}</if>
-            <if test="typeName != null">and type_name = #{type}</if>
+            <!-- 鍘熶负 `#{type}`锛氬疄浣撲笂鍙湁 typeName锛坱est 閲岀敤鐨勪篃鏄� typeName锛夛紝
+                 `type` 涓嶅瓨鍦� 鈥斺�� 璇ュ垎鏀竴璧板埌灏辨姏
+                 ReflectionException: no getter for 'type'銆� -->
+            <if test="typeName != null">and type_name = #{typeName}</if>
             <if test="filmFlag != null">and film_flag = #{filmFlag}</if>
             <if test="bedFlag != null">and bed_flag = #{bedFlag}</if>
             <if test="pushFlag != null">and push_flag = #{pushFlag}</if>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceAppointRecordMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceAppointRecordMapper.xml
index c25e92e..d424626 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceAppointRecordMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceAppointRecordMapper.xml
@@ -734,8 +734,11 @@
             <if test="registTimeRange != null">regist_time_range =
                 #{registTimeRange},
             </if>
+            <!-- 鍘熶负 `#{schedDetailSn}`锛氬疄浣撳睘鎬у彨 scheduleDetailSn锛坱est 閲岀敤鐨勪篃鏄畠锛夛紝
+                 schedDetailSn 涓嶅瓨鍦� 鈥斺�� 涓�鏃﹁蛋鍒拌繖鏉″垎鏀氨鎶�
+                 ReflectionException: no getter for 'schedDetailSn'銆� -->
             <if test="scheduleDetailSn != null">schedule_detail_sn =
-                #{schedDetailSn},
+                #{scheduleDetailSn},
             </if>
             <if test="treatDate != null">treat_date =
                 #{treatDate},

--
Gitblit v1.9.3