From ccf5fc76de48e6add5b325b93f2b0ea54efbf2b8 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 23 九月 2026 18:24:26 +0800
Subject: [PATCH] 1.代码提交

---
 ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml                              |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java |   10 +-
 .idea/encodings.xml                                                                    |   10 ++
 smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml                        |    2 
 ruoyi-admin/src/main/resources/application.yml                                         |   13 +-
 ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java                        |   14 ++-
 smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java                       |    9 ++
 smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java            |   54 ++++++++++++-
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml                       |   13 +++
 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java     |   33 +++++++-
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java       |    7 +
 ruoyi-admin/ruoyi-admin.iml                                                            |    8 ++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java      |   10 --
 ruoyi-admin/src/main/resources/application-druid.yml                                   |    2 
 .idea/redisSettings.xml                                                                |   18 ++++
 15 files changed, 165 insertions(+), 40 deletions(-)

diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 5eb05cb..daa79e6 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -4,10 +4,13 @@
     <file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospProvisionalController.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskPreachformController.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskmedicalController.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/resources/logback.xml" charset="GBK" />
     <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/dx" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/dx/SmsServiceSoap.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/dx2/Hello.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/dx2/HelloResponse.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/dx2/I5GReply.java" charset="UTF-8" />
@@ -42,15 +45,22 @@
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/common/DeepSeekApi.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/PatMedOuthospProvisional.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceSubtaskPreachform.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceTaskmedical.java" charset="GBK" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/VO/ServiceTaskmedicalVO.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/mapper/PatMedOuthospProvisionalMapper.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskPreachformMapper.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/mapper/ServiceTaskmedicalMapper.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/IPatMedOuthospProvisionalService.java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/IServiceSubtaskPreachformService.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/IServiceTaskmedicalService.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospProvisionalServiceImpl.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskPreachformServiceImpl.java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceTaskmedicalServiceImpl.java" charset="GBK" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/resources/mapper/smartor/PatMedOuthospProvisionalMapper.xml" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/resources/mapper/smartor/ServiceSubtaskPreachformMapper.xml" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/smartor/src/main/resources/mapper/smartor/ServiceTaskmedicalMapper.xml" charset="GBK" />
     <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
     <file url="PROJECT" charset="GBK" />
diff --git a/.idea/redisSettings.xml b/.idea/redisSettings.xml
new file mode 100644
index 0000000..e5ab7c3
--- /dev/null
+++ b/.idea/redisSettings.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RedisConfiguration">
+    <option name="serverConfigurations">
+      <list>
+        <ServerConfiguration>
+          <option name="label" value="local" />
+          <option name="password" value="Smartor" />
+          <option name="sercurityInfo">
+            <SercurityInfo />
+          </option>
+          <option name="serverUrl" value="localhost:6020" />
+          <option name="userName" value="" />
+        </ServerConfiguration>
+      </list>
+    </option>
+  </component>
+</project>
diff --git a/ruoyi-admin/ruoyi-admin.iml b/ruoyi-admin/ruoyi-admin.iml
new file mode 100644
index 0000000..0eb5b45
--- /dev/null
+++ b/ruoyi-admin/ruoyi-admin.iml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
+    <exclude-output />
+    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java
index 0ef614f..2a63d65 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java
@@ -1,6 +1,7 @@
 package com.ruoyi.web.controller.smartor;
 
 import com.github.pagehelper.ISelect;
+import com.github.pagehelper.PageInfo;
 import com.ruoyi.common.annotation.AddOrgId;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
@@ -70,12 +71,9 @@
         SysUser user = getLoginUser().getUser();
         patMedInhosp.setOrgid(user.getOrgid());
         List<PatMedInhosp> list = patMedInhospService.selectPatMedInhospList(patMedInhosp);
-        long count = PageUtils.count(new ISelect() {
-            @Override
-            public void doSelect() {
-                patMedInhospService.selectPatMedInhospList(patMedInhosp);
-            }
-        });
+        // startPage 涔嬪悗 PageHelper 宸茬粡鑷姩鎵ц杩囦竴娆� count 鏌ヨ锛岀洿鎺ュ鐢� Page 閲岀殑 total锛�
+        // 閬垮厤鐢� PageUtils.count 鎶婂甫 JOIN 鐨勭粺璁¤鍙ュ啀璺戜竴閬�
+        long count = new PageInfo<>(list).getTotal();
         return getDataTable2(count, list);
     }
 
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
index d47e10f..c400e60 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -137,14 +137,6 @@
         if (StringUtils.isEmpty(systype)) path = sysConfigService.selectConfigByKey("sys.qddz");
         else path = sysConfigService.selectConfigByKey("sys.qddz.yd");
 
-        if (active.equals("nhfy")){
-            //鍗楀崕闄勪竴鐨勶紝鍏堜笉璧板厤鐧伙紝鐩存帴璺冲埌鐧婚檰椤�
-            path = sysConfigService.selectConfigByKey("sys.qddz.yd");
-            log.info("銆怤HFYSSO鐧诲綍銆戦噸瀹氬悜鍦板潃锛歿}", path);
-            return buildRedirect(path);
-        }
-            log.info("qddz鐨勬煡璇㈠�间负锛宲ath锛歿}", path);
-
         if (StringUtils.isEmpty(path)) {
             throw new BaseException("璇烽厤缃墠绔湴鍧�");
         }
@@ -155,7 +147,7 @@
             return buildRedirect(path + "/login");
         }
 
-        String redirectUrl = path + "/loginSSO?token=" + loginToken + "&orgid=" + orgid + "&campusid=" + campusid + "&orgname=null&ZuHuID=null&deptCode=null";
+        String redirectUrl = path + "/#/loginSSO?token=" + loginToken + "&orgid=" + orgid + "&campusid=" + campusid + "&orgname=null&ZuHuID=null&deptCode=null";
         log.info("銆怱SO鐧诲綍銆戦噸瀹氬悜鍦板潃锛歿}", redirectUrl);
         return buildRedirect(redirectUrl);
     }
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index 62b60b3..8f0d76d 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -34,7 +34,7 @@
         #        password: Hxerp2000
         #        driverClassName: com.mysql.cj.jdbc.Driver
         #  鍏徃鏈湴
-        url: jdbc:mysql://haiershi.a1.luyouxia.net:23844/smartor_lishui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&connectTimeout=120000&socketTimeout=240000
+        url: jdbc:mysql://haiershi.a1.luyouxia.net:23844/smartor_sltd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&connectTimeout=120000&socketTimeout=240000
         username: smartor
         password: Smartor.2023
         driverClassName: com.mysql.cj.jdbc.Driver
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 0f89dc0..dfa12b4 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -36,14 +36,14 @@
 # 鏃ュ織閰嶇疆
 logging:
   # 鏃ュ織璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/logs锛孡inux閰嶇疆 /home/ruoyi/logs,涓嶅~鍚岀骇鐩綍logs锛�
-  path: D:/ruoyi/ls/logs
+  path: D:/health/logs
   # 瀛楃缂栫爜
   charset:
     console: UTF-8
     file: UTF-8
   # 鏃ュ織鏂囦欢閰嶇疆
   file:
-    name: ${logging.path}/ruoyi.log
+    name: ${logging.path}/sys-info.log
     max-size: 100MB
     max-history: 30
   # 鏃ュ織绾у埆閰嶇疆
@@ -51,7 +51,7 @@
     com.ruoyi: info
     com.smartor: info
     org.springframework: warn
-    org.apache.ibatis: warn
+    org.apache.ibatis: debug
     # 鎺у埗鍙拌緭鍑虹骇鍒�
     root: info
   # 鏃ュ織鏍煎紡閰嶇疆
@@ -75,7 +75,7 @@
     # 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
     basename: i18n/messages
   profiles:
-    active: ls
+    active: nhfy
 
   # 鏂囦欢涓婁紶
   servlet:
@@ -174,5 +174,6 @@
 sms_appkey:
 sms_flag:
 
-shurl:
-shversion:
\ No newline at end of file
+#涓夋眹鐢佃瘽鍦板潃
+shurl: http://192.168.99.224:8098/
+shversion: 6.1.x
diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
index f97eebc..e4ac783 100644
--- a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
+++ b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
@@ -12,7 +12,7 @@
         <!-- 閰嶇疆榛樿鐨勬墽琛屽櫒.SIMPLE灏辨槸鏅�氭墽琛屽櫒;REUSE鎵ц鍣ㄤ細閲嶇敤棰勫鐞嗚鍙�(prepared statements);BATCH鎵ц鍣ㄥ皢閲嶇敤璇彞骞舵墽琛屾壒閲忔洿鏂� -->
         <setting name="defaultExecutorType" value="SIMPLE"/>
         <!-- 鎸囧畾 MyBatis 鎵�鐢ㄦ棩蹇楃殑鍏蜂綋瀹炵幇(鏄惁鎵撳嵃SQL) -->
-<!--        <setting name="logImpl" value="STDOUT_LOGGING"/>-->
+        <setting name="logImpl" value="STDOUT_LOGGING"/>
         <!-- 浣跨敤椹煎嘲鍛藉悕娉曡浆鎹㈠瓧娈� -->
         <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
     </settings>
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
index 0310368..971ef13 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
@@ -395,14 +395,18 @@
 
             // 鑾峰彇鍝嶅簲鐮�
             int responseCode = connection.getResponseCode();
+            log.info("postFormRequest 鍝嶅簲鐮侊細{}锛寀rl锛歿}", responseCode, fullUrl);
 
-            // 璇诲彇鍝嶅簲
+            // 璇诲彇鍝嶅簲锛堥潪200鏃秂rrorStream鍙兘涓簄ull锛岄伩鍏峃PE锛�
             StringBuilder response = new StringBuilder();
-            if (responseCode == HttpURLConnection.HTTP_OK) {
-                reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
-            } else {
-                reader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
+            InputStream respStream = responseCode == HttpURLConnection.HTTP_OK
+                    ? connection.getInputStream()
+                    : connection.getErrorStream();
+            if (respStream == null) {
+                log.warn("postFormRequest 鍝嶅簲浣撲负绌猴紝鍝嶅簲鐮侊細{}锛寀rl锛歿}", responseCode, fullUrl);
+                return "";
             }
+            reader = new BufferedReader(new InputStreamReader(respStream));
 
             String line;
             while ((line = reader.readLine()) != null) {
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index 1ac77fb..fe60cf0 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -175,7 +175,12 @@
         headers.put("app-key", APP_KEY);
         Map<String, String> requestParams = new HashMap<>();
         requestParams.put("token", token);
-        String reqData = HttpUtil.postFormRequest(sltdPubPath + "/checkSsoTokenId", requestParams, headers, null);
+        String url = active != null && active.contains("nhfy")
+                ? sltdPubPath + "/hbos-thirdparty-integration/standard/ih/getHisLoginUserInfo"
+                : sltdPubPath + "/checkSsoTokenId";
+        log.info("銆怱LTD token 楠岃瘉銆戣姹傚湴鍧�锛歿}锛宼oken闀垮害锛歿}锛宼oken缁撳熬锛歿}", url, token.length(),
+                token.length() > 4 ? token.substring(token.length() - 4) : token);
+        String reqData = HttpUtil.postFormRequest(url, requestParams, headers, null);
         log.info("銆怱LTD token 楠岃瘉銆戝搷搴旂粨鏋滐細{}", reqData);
 
         if (StringUtils.isEmpty(reqData)) {
@@ -184,13 +189,31 @@
         }
 
         Map<String, Object> map = JSONObject.parseObject(reqData, Map.class);
-        if (ObjectUtils.isEmpty(map) || (Integer) map.get("code") != 200) {
-            log.error("銆怱LTD token 楠岃瘉銆戝搷搴旂爜寮傚父锛岄獙璇佸け璐�");
+        if (ObjectUtils.isEmpty(map)) {
+            log.error("銆怱LTD token 楠岃瘉銆戝搷搴旇В鏋愪负绌猴紝楠岃瘉澶辫触锛屽搷搴斿唴瀹癸細{}", reqData);
             return null;
         }
 
-        Map<String, Object> data = (Map<String, Object>) map.get("data");
-        return (String) data.get("accountNo");
+        Object codeObj = map.get("code");
+        int code = codeObj instanceof Number ? ((Number) codeObj).intValue() : -1;
+        if (code != 200) {
+            log.error("銆怱LTD token 楠岃瘉銆戝搷搴旂爜寮傚父锛岄獙璇佸け璐ワ紝code={}, message={}, 鍝嶅簲鍐呭锛歿}",
+                    code, map.get("message"), reqData);
+            return null;
+        }
+
+        Object dataObj = map.get("data");
+        if (!(dataObj instanceof Map)) {
+            log.error("銆怱LTD token 楠岃瘉銆戝搷搴旂己灏慸ata鑺傜偣锛岄獙璇佸け璐ワ紝data={}", dataObj);
+            return null;
+        }
+
+        Object accountNo = ((Map<?, ?>) dataObj).get("accountNo");
+        if (accountNo == null || StringUtils.isEmpty(String.valueOf(accountNo))) {
+            log.error("銆怱LTD token 楠岃瘉銆戝搷搴攄ata涓病鏈塧ccountNo锛岄獙璇佸け璐ワ紝data={}", dataObj);
+            return null;
+        }
+        return String.valueOf(accountNo);
     }
 
     public String loginByUserName(String userName) {
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index dbb20cd..8a64f61 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -75,6 +75,10 @@
     @Value("${isAdmin}")
     private List<Long> isAdmin;
 
+
+    @Value("${spring.profiles.active}")
+    private String active;
+
     /**
      * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃
      *
@@ -337,7 +341,8 @@
     @Override
     public SysUser selectUserByUserNameAndDeptId(String userName) {
         String[] split = userName.split("&");
-        if (split[2].contains("null")) {
+        //鍗楀崕闄勪竴涔熶笉楠岃瘉dept_id浜�
+        if (split[2].contains("null") || active.equals("nhfy")) {
             split[2] = null;
         }
         SysUser sysUser = userMapper.selectUserByUserNameByCondition(split[0], split[1], split[2]);
diff --git a/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java b/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
index 52a80b7..aab7663 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
@@ -1,6 +1,7 @@
 package com.smartor.mapper;
 
 import java.util.List;
+import java.util.Map;
 
 import com.smartor.domain.PatMedInhosp;
 import com.smartor.domain.PatMedInhospVO;
@@ -30,6 +31,14 @@
     public String getTagnameBypatid(Long patid);
 
     /**
+     * 鎵归噺鏌ヨ鎮h�呮爣绛撅紙GROUP_CONCAT 鎷兼帴鍚庣殑鏍囩涓诧級
+     *
+     * @param patids 鎮h�呮。妗坕d闆嗗悎锛岃皟鐢ㄦ柟椤讳繚璇侀潪绌轰笖宸插幓閲�
+     * @return 姣忚鍚� patid銆乼agname 涓や釜 key
+     */
+    public List<Map<String, Object>> getTagnameByPatids(@Param("patids") List<Long> patids);
+
+    /**
      * 鏌ヨ鎮h�呬綇闄㈣褰曞垪琛�
      *
      * @param patMedInhosp 鎮h�呬綇闄㈣褰�
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
index 5d469aa..0fa8172 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -116,14 +116,60 @@
         }
 
         List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
-        for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
-            String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
-            patMedInhosp1.setTagname(tagname);
-        }
+        fillTagname(patMedInhospList);
         return patMedInhospList;
     }
 
     /**
+     * 鎵归噺濉厖鎮h�呮爣绛�
+     * <p>
+     * 鍘熷疄鐜版槸姣忚璋冧竴娆� getTagnameBypatid锛孲QL 寰�杩旀鏁伴殢 pageSize 绾挎�у闀匡紱
+     * 杩欓噷鎸� patid 鍘婚噸鍚庡垎鎵逛竴娆℃煡鍥烇紝缁撴灉涓庨�愯鏌ヨ瀹屽叏涓�鑷达紙鎮h�呮棤鏍囩鏃朵粛涓� null锛夈��
+     *
+     * @param patMedInhospList 寰呭~鍏呯殑浣忛櫌璁板綍锛屽厑璁镐负绌�
+     */
+    private void fillTagname(List<PatMedInhosp> patMedInhospList) {
+        if (CollectionUtils.isEmpty(patMedInhospList)) {
+            return;
+        }
+        // LinkedHashSet 鍘婚噸鍚屾椂淇濇寔椤哄簭锛岄伩鍏� IN 鍒楄〃鍑虹幇閲嶅 patid
+        Set<Long> patids = new LinkedHashSet<>();
+        for (PatMedInhosp patMedInhosp : patMedInhospList) {
+            if (patMedInhosp.getPatid() != null) {
+                patids.add(patMedInhosp.getPatid());
+            }
+        }
+        if (patids.isEmpty()) {
+            return;
+        }
+
+        Map<Long, String> tagnameMap = new HashMap<>();
+        List<Long> patidList = new ArrayList<>(patids);
+        // 鍒嗙墖锛岄槻姝� IN 鍙傛暟杩囧
+        int batchSize = 1000;
+        for (int i = 0; i < patidList.size(); i += batchSize) {
+            List<Long> batch = patidList.subList(i, Math.min(i + batchSize, patidList.size()));
+            List<Map<String, Object>> rows = patMedInhospMapper.getTagnameByPatids(batch);
+            if (CollectionUtils.isEmpty(rows)) {
+                continue;
+            }
+            for (Map<String, Object> row : rows) {
+                Object patid = row.get("patid");
+                Object tagname = row.get("tagname");
+                if (patid != null) {
+                    tagnameMap.put(((Number) patid).longValue(), tagname == null ? null : tagname.toString());
+                }
+            }
+        }
+
+        for (PatMedInhosp patMedInhosp : patMedInhospList) {
+            if (patMedInhosp.getPatid() != null) {
+                patMedInhosp.setTagname(tagnameMap.get(patMedInhosp.getPatid()));
+            }
+        }
+    }
+
+    /**
      * 褰掍竴鍖栧叆闄㈠簥浣嶆帓搴忓弬鏁�
      * <p>
      * asc / 1 -> asc锛堝簥浣嶆搴忥級锛宒esc / 2 -> desc锛堝簥浣嶅�掑簭锛夛紝鍏朵綑锛堝惈涓嶄紶锛�-> null锛堜笉鎺掑簭锛夈��
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 9a47f1f..757dddc 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -661,6 +661,19 @@
           AND d.del_flag = 0
     </select>
 
+    <!-- 鎵归噺鍙栨偅鑰呮爣绛撅紝鏇夸唬閫愯璋冪敤 getTagnameBypatid锛涙瘡琛屽惈 patid銆乼agname 涓や釜 key -->
+    <select id="getTagnameByPatids" resultType="java.util.HashMap">
+        SELECT d.patid                     AS patid,
+               GROUP_CONCAT(d.tagname, ', ') AS tagname
+        FROM pat_archivetag d
+        WHERE d.del_flag = 0
+          AND d.patid IN
+        <foreach collection="patids" item="patid" open="(" separator="," close=")">
+            #{patid}
+        </foreach>
+        GROUP BY d.patid
+    </select>
+
 
     <select id="selectPatMedInhospByInhospid" parameterType="Long" resultMap="PatMedInhospResult">
         <include refid="selectPatMedInhospVo"/>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
index a0b670f..4d7d2ca 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
@@ -315,7 +315,6 @@
         </if>
         <if test="templateid != null  and templateid != ''">and service_task.templateid = #{templateid}</if>
         <if test="longTask != null  and longTask != ''">and service_task.long_task = #{longTask}</if>
-        <if test="serviceType != null  and serviceType != ''">and service_task.service_type = #{serviceType}</if>
         <if test="templatename != null  and templatename != ''">and service_task.templatename like concat('%',
             #{templatename},
             '%')
@@ -331,7 +330,6 @@
         </if>
         <if test="checktime != null ">and service_task.checktime = #{checktime}</if>
         <if test="sendDay != null ">and service_task.send_day = #{sendDay}</if>
-        <if test="type != null  and type != ''">and service_task.type = #{type}</if>
         <if test="typename != null  and typename != ''">and service_task.typename like concat('%', #{typename},
             '%')
         </if>

--
Gitblit v1.9.3