From db2a00f5df9990e55ebbdf16cf8c68c3d64fe09d Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 28 七月 2026 16:26:43 +0800
Subject: [PATCH] Merge branch 'master' into master-任务组

---
 smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java                       |   18 
 .idea/encodings.xml                                                                      |    3 
 smartor/pom.xml                                                                          |    6 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml            |   61 +
 ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java                          |   25 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java        |    2 
 smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml                |   45 +
 smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml                 |   52 +
 smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java               |   34 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java      |   10 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java                      |   15 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java                            |    6 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java                       |   34 +
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java                      |   16 
 smartor/src/main/java/com/smartor/domain/ServiceTaskScriptQues.java                      |    7 
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java                    |   16 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java             |   34 +
 smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml                      |   74 +-
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java                    |   16 
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml                           |   14 
 ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java                   |   20 
 ruoyi-admin/src/main/resources/application-huizhou.yml                                   |  249 +++++++
 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java             |    2 
 smartor/src/main/java/com/smartor/domain/ServiceSubtask.java                             |    2 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java                  |   20 
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java           |   26 
 smartor/src/main/java/com/smartor/service/IPatMedOuthospService.java                     |    6 
 smartor/src/main/java/com/smartor/common/DeepSeekApi.java                                |  178 +++++
 smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml                |   36 +
 smartor/src/main/java/com/smartor/domain/PatArchive.java                                 |    4 
 smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java             |    3 
 smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java              |    4 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java            |  512 +++++++++++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java    |    5 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java                          |   14 
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java                      |   16 
 smartor/src/main/java/com/smartor/service/impl/PatMedOperationServiceImpl.java           |    3 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java                    |   16 
 ruoyi-admin/pom.xml                                                                      |    7 
 smartor/src/main/java/com/smartor/service/IPatMedOperationService.java                   |    5 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java                       |   16 
 smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java                    |    2 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                       |    7 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java                     |   16 
 smartor/src/main/java/com/smartor/service/IPatMedInhospService.java                      |    2 
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                             |  149 +--
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java |   50 +
 smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml                |   29 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java     |   10 
 49 files changed, 1,676 insertions(+), 221 deletions(-)

diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index b0029eb..5eb05cb 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -39,6 +39,7 @@
     <file url="file://$PROJECT_DIR$/ruoyi-system/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/ruoyi-system/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/smartor/src/main/java" charset="UTF-8" />
+    <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/mapper/PatMedOuthospProvisionalMapper.java" charset="UTF-8" />
@@ -54,4 +55,4 @@
     <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
     <file url="PROJECT" charset="GBK" />
   </component>
-</project>
+</project>
\ No newline at end of file
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 0e049db..674fcad 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -55,6 +55,13 @@
             <version>9.2.1.jre8</version>
         </dependency>
 
+        <!-- Kingbase8 JDBC椹卞姩 -->
+        <dependency>
+            <groupId>cn.com.kingbase</groupId>
+            <artifactId>kingbase8</artifactId>
+            <version>8.6.0</version>
+        </dependency>
+
         <!-- 鏍稿績妯″潡-->
         <dependency>
             <groupId>com.ruoyi</groupId>
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
index b9a4adb..83905de 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -493,16 +493,18 @@
                         if (active.equals("sltd")) {
                             data = MessageSend.sendMsg(sendMagParam.getContent(), "6", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
                             if (StringUtils.isNotEmpty(data)) {
-                                ObjectMapper mapper = new ObjectMapper();
-                                JsonNode root = mapper.readTree(data);
-                                String status = root.get("result").get(0).get("status").asText();
-                                if (status.equals("00000")) {
-                                    s = "true";
-                                } else {
-                                    setFailPreachForm(serviceSubtask, sendPreachform, "鐭俊鍙戦�佸け璐�: " + data, "5");
-                                    throw new BaseException("鐭俊鍙戦�佸け璐�");
+                                String[] pairs = data.split("&");
+                                String resultVal = null;
+                                for (String pair : pairs) {
+                                    String[] kv = pair.split("=", 2);
+                                    if ("result".equals(kv[0])) {
+                                        resultVal = kv.length > 1 ? kv[1] : null;
+                                        break;
+                                    }
                                 }
-
+                                if ("0".equals(resultVal)) {
+                                    s = "true";
+                                }
                             } else {
                                 setFailPreachForm(serviceSubtask, sendPreachform, "鐭俊鍙戦�佸け璐�: " + data, "5");
                                 throw new BaseException("鐭俊鍙戦�佸け璐�");
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java
index 9b3667f..6e53314 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java
@@ -121,9 +121,10 @@
             serviceOutPath.setRadix(format);
             serviceOutPath.setCreateTime(new Date());
             serviceOutPath.setOrgid(vo.getOrgid());
-            iServiceOutPathService.insertServiceOutPath(serviceOutPath);
             String url = ip + ":" + req_path + "/wt?p=" + format;
             content = "鎮ㄥソ锛岄個璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + url + "濉啓銆傛劅璋㈡偍閰嶅悎锛�";
+            serviceOutPath.setUrl(url);
+            iServiceOutPathService.insertServiceOutPath(serviceOutPath);
         }
 
         if (ObjectUtils.isNotEmpty(vo.getContent())) content = vo.getContent();
@@ -216,5 +217,36 @@
         return AjaxResult.success(sendMsg);
     }
 
+    /**
+     * @param
+     * @return
+     */
+    @ApiOperation("鐢熸垚澶栭摼")
+    @PostMapping("/getUrl")
+    public AjaxResult getUrl(@RequestBody smsVO vo) throws UnsupportedEncodingException {
+        String content = "";
+        if (StringUtils.isNotEmpty(vo.getTaskId()) && StringUtils.isNotEmpty(vo.getPatId()) && StringUtils.isNotEmpty(vo.getSubId())) {
+            RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+            String taskId = rsaPublicKeyExample.encryptedData(vo.getTaskId().toString(), pub_key);
+            String patid = rsaPublicKeyExample.encryptedData(vo.getPatId().toString(), pub_key);
+            String subId = rsaPublicKeyExample.encryptedData(vo.getSubId().toString(), pub_key);
+            Integer radix = iServiceOutPathService.selectAutoId();
+            String format = String.format("%03X", radix);
+            ServiceOutPath serviceOutPath = new ServiceOutPath();
+            serviceOutPath.setParam1(taskId);
+            serviceOutPath.setParam2(patid);
+            serviceOutPath.setParam3(vo.getTaskName());
+            serviceOutPath.setParam6(subId);
+            serviceOutPath.setRadix(format);
+            serviceOutPath.setCreateTime(new Date());
+            serviceOutPath.setOrgid(vo.getOrgid());
+            String url = ip + ":" + req_path + "/wt?p=" + format;
+//            content = "鎮ㄥソ锛岄個璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + url + "濉啓銆傛劅璋㈡偍閰嶅悎锛�";
+            content = url;
+            serviceOutPath.setUrl(url);
+            iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+        }
+        return AjaxResult.success(content);
+    }
 
 }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
index 725363a..34ac743 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
@@ -53,10 +53,14 @@
     //@PreAuthorize("@ss.hasPermi('smartor:patarchive:list')")
     @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
     @PostMapping("list")
-    public TableDataInfo list(@RequestBody PatArchive patArchive) {
-        PageUtils.startPageByPost(patArchive.getPageNum(), patArchive.getPageSize());
+    public Map<String, Object> list(@RequestBody PatArchive patArchive) {
+        patArchive.setPageNum(PageUtils.getOffset(patArchive.getPageNum(), patArchive.getPageSize()));
         List<PatArchive> list = patArchiveService.selectPatArchiveList(patArchive);
-        return getDataTable(list);
+        patArchive.setPageNum(null);
+        patArchive.setPageSize(null);
+        List<PatArchive> patArchives = patArchiveService.selectPatArchiveList(patArchive);
+
+        return getDataTable3(patArchives.size(), list);
     }
 
     /**
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
index 73b9e8b..9b7d92d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -48,6 +48,8 @@
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
+import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
+
 /**
  * 鍗曚竴浠诲姟锛堥殢璁匡級Controller
  *
@@ -88,6 +90,12 @@
     @Value("${spring.profiles.active}")
     private String active;
 
+    @Value("${localIP}")
+    private String localIP;
+
+    @Value("${req_path}")
+    private String req_path;
+
     @Value("${isAdmin}")
     private List<Long> isAdmin;
 
@@ -105,6 +113,7 @@
         LoginUser loginUser = getLoginUser();
         SysUser user = loginUser.getUser();
         serviceSubtaskVO.setOrgid(user.getOrgid());
+        serviceSubtaskVO.setCampusid(user.getCampusid());
         ServiceSubtaskEntity serviceSubtaskEntity = null;
         if (serviceSubtaskVO != null) {
             serviceSubtaskEntity = DtoConversionUtils.sourceToTarget(serviceSubtaskVO, ServiceSubtaskEntity.class);
@@ -914,20 +923,39 @@
         return serviceSubtaskService.smsSubTask(subid);
     }
 
+    /**
+     * 璺宠浆涓棿椤�
+     *
+     * @param taskId
+     * @return
+     */
+    @PostMapping(value = "/goSfRelay")
+    public AjaxResult goSfRelay(@RequestParam("taskId") Long taskId, @RequestParam("deptcode") String deptcode, @RequestParam("leavehospitaldistrictcode") String leavehospitaldistrictcode) {
+        String url = localIP + ":" + req_path + "/SfRelay?taskid=" + taskId;
+        if(StringUtils.isNotEmpty(deptcode)){
+            url = url + "&deptcode=" + deptcode;
+        }
+        if(StringUtils.isNotEmpty(leavehospitaldistrictcode)){
+            url = url + "&leavehospitaldistrictcode=" + leavehospitaldistrictcode;
+        }
+        return AjaxResult.success(url);
+    }
+
+    /**
+     * 鎵爜鐢熸垚瀛愪换鍔�
+     *
+     * @param serviceTask
+     * @return
+     */
+    @PostMapping(value = "/scanGenerateSubtask")
+    public AjaxResult scanGenerateSubtask(@RequestBody ServiceTask serviceTask) {
+        return AjaxResult.success(serviceSubtaskService.scanGenerateSubtask(serviceTask));
+    }
+
 
     @PostMapping("/test")
     public void test() {
         ryTask.dealOutHospInfo();
-    }
-
-    @PostMapping("/compensateTasktest")
-    public void compensateTasktest(@RequestParam("subId") Long subId) {
-        ryTask.compensateTaskTest(subId);
-    }
-
-    @PostMapping("/longTaskSendtest")
-    public void longTaskSendtest(@RequestParam("subId") Long subId) {
-        ryTask.longTaskSendTest(subId);
     }
 
     @PostMapping("/syncMedInhospForShiyi")
@@ -945,4 +973,6 @@
         int result = ryTask.qwenLLMTest(questionText, voiceText, value, regexText);
         return result;
     }
+
+
 }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
index f8fa458..bec0e7d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
@@ -219,18 +219,21 @@
     public AjaxResult getScriptInfoByCondition(@RequestBody ServiceTaskScriptQues serviceTaskScriptQues) {
         Long tid = null;
         Long pid = null;
+        Long sid = null;
         log.info("getScriptInfoByCondition鍏ュ弬涓猴細{}", serviceTaskScriptQues);
         try {
             tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam1(), pri_key));
             if (StringUtils.isNotEmpty(serviceTaskScriptQues.getParam2()))
                 pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam2(), pri_key));
+            if (StringUtils.isNotEmpty(serviceTaskScriptQues.getParam6()))
+                sid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam6(), pri_key));
         } catch (Exception e) {
             log.error("getScriptInfoByCondition鎶ラ敊浜嗭細{}", e.getMessage());
         }
 
         log.info("tid鍜宲id鐨勫�间负锛歿},{}", tid, pid);
         if (StringUtils.isEmpty(serviceTaskScriptQues.getPatfrom())) serviceTaskScriptQues.setPatfrom("0");
-        return success(serviceTaskService.getScriptInfoByCondition(tid, pid, true, serviceTaskScriptQues.getPatfrom(), null));
+        return success(serviceTaskService.getScriptInfoByCondition(tid, pid, true, serviceTaskScriptQues.getPatfrom(), sid));
     }
 
 
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 956cdad..93158e3 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,7 +137,7 @@
             return buildRedirect(path + "/login");
         }
 
-        String redirectUrl = path + "/loginSSO?token=" + loginToken + "&orgid=" + orgid + "&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-huizhou.yml b/ruoyi-admin/src/main/resources/application-huizhou.yml
new file mode 100644
index 0000000..237f1a3
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/application-huizhou.yml
@@ -0,0 +1,249 @@
+# 鏁版嵁婧愰厤缃�
+spring:
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    #    driverClassName: com.mysql.cj.jdbc.Driver
+    druid:
+      # 涓诲簱鏁版嵁婧�
+      master:
+        url: jdbc:kingbase8://10.100.1.23:54321/smartor-huizhou?currentSchema=smartor,sys_catalog&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&connectTimeout=60000&socketTimeout=120000
+        username: smartor
+        password: smartor.2025
+        driverClassName: com.kingbase8.Driver
+
+      # 浠庡簱鏁版嵁婧�
+      slave:
+      # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(鍏徃)
+      # enabled: true
+      # url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor
+      # username: sa
+      # password: Hxerp2000
+      # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
+
+      # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(涔変箤浜岄櫌)
+      # enabled: true
+      # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor
+      # username: sa
+      # password: sfxt#2023
+      # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
+
+      # 鍒濆杩炴帴鏁�
+      initialSize: 5
+      # 鏈�灏忚繛鎺ユ睜鏁伴噺
+      minIdle: 10
+      # 鏈�澶ц繛鎺ユ睜鏁伴噺
+      maxActive: 20
+      # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+      maxWait: 60000
+      # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
+      timeBetweenEvictionRunsMillis: 60000
+      # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+      minEvictableIdleTimeMillis: 300000
+      # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
+      maxEvictableIdleTimeMillis: 900000
+      # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
+      #      validationQuery: SELECT 1 FROM DUAL
+      validationQuery: SELECT 1
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      webStatFilter:
+        enabled: true
+      statViewServlet:
+        enabled: false
+        # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
+        allow:
+        url-pattern: /druid/*
+        # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
+        login-username: lihu
+        login-password: Lihu@1363419#$
+      filter:
+        stat:
+          enabled: false
+          # 鎱QL璁板綍
+          log-slow-sql: false
+          slow-sql-millis: 1000
+          merge-sql: true
+        wall:
+          config:
+            multi-statement-allow: true
+  # redis 閰嶇疆
+  redis:
+    host: 127.0.0.1
+    port: 6379
+
+    # 鏁版嵁搴撶储寮�
+    database: 0
+    # 瀵嗙爜
+    password: Smartor
+    # 杩炴帴瓒呮椂鏃堕棿
+    timeout: 30s
+    lettuce:
+      pool:
+        # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
+        min-idle: 0
+        # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
+        max-idle: 8
+        # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
+        max-active: 8
+        # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
+        max-wait: -1ms
+
+# Swagger閰嶇疆
+swagger:
+  # 鏄惁寮�鍚痵wagger
+  enabled: false
+  # 璇锋眰鍓嶇紑
+  pathMapping: /dev-api
+
+# PageHelper鍒嗛〉鎻掍欢
+#pagehelper:
+#  helperDialect: mysql
+#  supportMethodsArguments: true
+##  params: countSql;pageSizeZero=true
+
+magic-api:
+  web: /magic/web
+  resource:
+    type: database   # 閰嶇疆瀛樺偍鍦ㄦ暟鎹簱涓�
+    tableName: magic_config  # 鏁版嵁搴撲腑鐨勮〃鍚�
+    prefix: /api
+    readonly: false
+  sql-column-case: camel
+  show-sql: true #閰嶇疆鎵撳嵃SQL
+  page-config:
+    size: size
+    page: page
+    default-page: 1
+    default-size: 10
+
+
+
+#閽夐拤鐨勫瘑閽�
+dingAppid: dingn8iip5ubj7clrrsv
+dingAppSecret: qlEK8D3oOVwGPOTiBQIBYTqQVlAfy9S_qQizEQFjJdSScwemWFryg4gbneu-NqWD
+
+# websocket瓒呮椂鏃堕棿
+server:
+websocket:
+timeout=60000:
+
+
+accessKeyId: LTAI5tPfc1VJzz7VuhzcBwug
+accessKeySecret: gG1srKxPFDBNWe2oHfqmK1qsSQkf1e
+signName: 鏉窞鍒╂箹绉戞妧
+
+#鏅鸿兘鍛煎彨(涓婃捣)
+phoneIP: http://124.220.50.51
+phonePort: 8001
+#鏉窞
+hzphoneIP: http://121.43.112.160
+hzphonePort: 8088
+#鐢佃瘽绾胯矾锛�1 涓婃捣锛�2 鏉窞锛�
+phonePath: 2
+#鑷繁鐨勭數璇濆彿鐮�
+phoneMySelf: 83234089
+##鎺堟潈 id(鏉窞)
+#app_id: hzgs
+##鎺堟潈 key(宸插姞瀵嗚繃鐨� key)(鏉窞)
+#app_key: 605453540c4a0a692fe07e1cae1162f3
+#鎺堟潈 id(鏉窞)
+app_id: hz_ali
+#鎺堟潈 key(宸插姞瀵嗚繃鐨� key)(鏉窞)
+app_key: a2f3b5799d635216aa280362fafd8c35
+
+
+pub_key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==
+#杩欎釜鏄悗绔殑绉侀挜锛岀敤涓嶅埌
+pri_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==
+#鍓嶇绉侀挜锛堢敤涓嶅埌浜嗭級
+#pri_key: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEApHTIe/StslZAT5Jzv8XClbrqox32pfaTrP5IOCRJ3FaH/UZsGgA/tsNBBEXq9eagqwPbJrjYfpdEtINcChrK4wIDAQABAkEAilDujdKshGGmlUZHs/NQRT6AOdDpsYxBiC4V76IVvQpw0IW6c4HGEvH4T+xRufika7/48L0eu0f06H+YtL5lgQIhANUd0a6oSsVxWifAjtKwMZcXD3OaIxQIQSCN4NT4VFY3AiEAxYxYrIhkIyg+UVw3WOSvBpXKxM4/WL9HRzkxDLvp2rUCIQCK23P8tgCJ5xJT5l3onw6goFDcBKkoazxsBqVgfjENPwIgWbuTd+OIYPPhwsE5ntZZrosSDO2GlsBkFzUiU59z7VUCIA0LL+9IFb+FWCl3DGTwIQ9SZYbv61T83LKjebUcSOfe
+
+#浜岀淮鐮佽矾寰�
+qrpath: D:\qrcode
+
+#鍏徃鍐呭閾捐姹侷P鍜岀鍙e彿
+#req_path: 8095
+#localIP: 192.168.2.13
+
+#鏂板崕鍖婚櫌澶栭摼璇锋眰IP鍜岀鍙e彿
+req_path: 8093
+#localIP: https://wx.lihusmart.com
+#涓芥按澶栭摼璇锋眰IP鍜岀鍙e彿
+localIP: https://lishuisf.health-y.cn
+
+#鑾峰彇鎮h�呬俊鎭疷RL(鍗庡崜鎻愪緵)
+hosp_info_url: http://esb-core-rest.wowjoy.cn/esb/exchange
+
+# 0浠h〃璧伴粯璁ょ殑涓婁紶    1 浠g爜璧版柊鍗庡尰闄㈢殑涓婁紶
+uploadSwitch: 1
+
+##  鎸囧畾asr鍥炶皟鐨剈rl璺緞(鏈湴)
+#ASRCallBackPath: http://192.168.2.13:8095/smartor/serviceSubtask/phoneCallBackYQ
+##鎸傛柇IP(鏈湴)
+#hangup: http://192.168.2.13:8091/hangup
+##fs鎵�浣跨敤鐨勯樋閲岀殑app_key(鏈湴)
+#app_key_yq: ZurNHpaQLq6P55YS
+
+#  鎸囧畾asr鍥炶皟鐨剈rl璺緞(鏂板崕)
+ASRCallBackPath: http://192.168.101.135:8095/smartor/serviceSubtask/phoneCallBackYQ
+#鎸傛柇IP(鏂板崕)
+hangup: http://192.16.4.220:8091/hangup
+#fs鎵�浣跨敤鐨勯樋閲岀殑app_key(鏂板崕)
+app_key_yq: ZurNHpaQLq6P55YS
+
+#鏈� 鍦� 鐭俊璇锋眰鍦板潃(杩欎釜鏈嶅姟鏄垜浠嚜宸卞啓鐨�)
+#xhsmsPath: http://192.168.2.13:8092/sendSms
+#鏂板崕鐭俊璇锋眰鍦板潃(杩欎釜鏈嶅姟鏄垜浠嚜宸卞啓鐨�)
+xhsmsPath: http://192.16.4.220:8092/sendSms
+#甯愬彿
+xhsmsAccount: 911124
+#鎺ュ彛瀵嗙爜
+xhsmsPwd: zW5eXe
+#铏氭嫙鎺ュ叆鐮�
+xhsmsjrm: 1069055
+
+##鏈湴FTP杩炴帴
+#FTP_SERVER: "192.168.2.13"
+#FTP_USERNAME: voice
+#FTP_PASSWORD: xh@2023
+
+#鏂板崕FTP杩炴帴
+FTP_SERVER: "192.16.4.220"
+FTP_USERNAME: voice
+FTP_PASSWORD: xh@2023
+
+#璇煶鍦板潃璁块棶鍓嶇紑(鏂板崕)
+voicePathPrefix: http://192.168.191.181:8095/profile/upload/vadio/
+#璇煶鍦板潃璁块棶鍓嶇紑(鍏徃)
+#voicePathPrefix: http://192.168.2.13:8095/profile/upload/vadio/
+
+#绗釜灏忔椂鐢佃瘽鎷ㄦ墦鐨勪笂闄�
+phoneUpEveryHour: 12
+#鐢佃瘽姣忓ぉ缁撴潫鏃堕棿
+phoneEndHour: 20
+
+#鏂板憳宸ラ粯璁ゅ瘑鐮�
+defaultPwd: 123456
+
+#鏄惁闇�瑕佹牴鎹柧鐥呭缓绔嬪嚭闄㈡偅鑰呴殢璁�
+createIcd10Visit: false
+
+#admin绠$悊鍛榰serId
+isAdmin: 1,2,3,4,5,6,7,8,9,10,11,12,13
+
+#澶勭悊鎶曡瘔寤鸿鐨勯儴闂ㄧ紪鐮�
+dealDeptCode:
+
+#鏄惁鍔犲瘑  0涓嶅姞   1鍔犲瘑
+isEncryp: 0
+
+#鏂囦欢涓婁紶鍦板潃
+fileUpload:
+profile:
+
+# PageHelper鍒嗛〉鎻掍欢
+pagehelper:
+  helperDialect: mysql
+  supportMethodsArguments: true
+  params: count=countSql
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java b/ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java
index 06d48f6..eb3e8dc 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java
@@ -1,6 +1,5 @@
 package com.ruoyi.common.dx;
 
-import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.utils.uuid.UUID;
 import lombok.extern.slf4j.Slf4j;
 
@@ -15,17 +14,33 @@
      * //     * @param sOrderNo        鎮h�呭敮涓�鍙风爜
      * //     * @param sMessageContent 鐭俊鍐呭
      *
-     * @param sMessageType  鐭俊绫诲瀷   1=楠岃瘉鐮併��2=閫氱煡銆�3=骞垮憡
+     * @param sMessageType  鐭俊绫诲瀷   1=楠岃瘉鐮併��2=閫氱煡銆�3=骞垮憡 6=鍐呭鏈夐摼鎺ュ拰鐢佃瘽锛�7=閽夐拤娑堟伅
      * @param sUserNumber   鎵嬫満鍙风爜
      * @param sScheduleTime 棰勭害鍙戦�佹椂闂�
      * @return
      */
     public static String sendMsg(String sMessageContent, String sMessageType, String sUserNumber, String sScheduleTime) {
-        log.info("--sMessageContent鐨勫�间负锛歿}   ,--sMessageType鐨勫�间负锛歿},   --sUserNumber鐨勫�间负锛歿},   --sScheduleTime鐨勫�间负锛歿}", sMessageContent, sMessageType, sUserNumber, sScheduleTime);
+        log.info("--sMessageContent 鐨勫�间负锛歿}   ,--sMessageType 鐨勫�间负锛歿},   --sUserNumber 鐨勫�间负锛歿},   --sScheduleTime 鐨勫�间负:{}", sMessageContent, sMessageType, sUserNumber, sScheduleTime);
+
         com.ruoyi.common.dx.SmsService service = new SmsService();
         SmsServiceSoap soap = service.getSmsServiceSoap();
-        String result = soap.i5GSend("202508291634227086", "T202508291635259440", UUID.randomUUID().toString(), sMessageContent, sMessageType, sUserNumber, sScheduleTime);
-        log.info("----鐭俊杩斿洖鐨勬暟鎹负锛歿},    ----sMessageContent鐨勫�间负:{},", result, sMessageContent);
+        String result = null;
+
+        try {
+            if ("6".equals(sMessageType)) {
+                result = soap.i5GSend("202508291634227086", "T202508291635259440", UUID.randomUUID().toString(), sMessageContent, sMessageType, sUserNumber, sScheduleTime);
+                log.info("----鐭俊杩斿洖鐨勬暟鎹负锛歿},    ----sMessageContent 鐨勫�间负:{}", UUID.randomUUID().toString());
+            } else if ("7".equals(sMessageType)) {
+                result = soap.i5GSend("202508291634227086", "T202607211306131891", UUID.randomUUID().toString(), sMessageContent, sMessageType, sUserNumber, sScheduleTime);
+                log.info("----閽夐拤杩斿洖鐨勫師濮嬫暟鎹负锛歿}", result);
+
+            } else {
+                log.warn("涓嶆敮鎸佺殑鐭俊绫诲瀷锛歿}", sMessageType);
+            }
+        } catch (Exception e) {
+            log.error("瀹屾暣閿欒淇℃伅锛歿}", e.getCause().getMessage());
+        }
+
         return result;
     }
 }
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index a789b78..b5e2021 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,7 +108,7 @@
                 // 杩囨护璇锋眰
                 .authorizeRequests()
                 // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶
-                .antMatchers("/login","/test/**", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer").permitAll()
+                .antMatchers("/login","/test/**", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer","smartor/serviceSubtask/goSfRelay","/smartor/serviceSubtask/scanGenerateSubtask").permitAll()
                 // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂�
 //                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**","/system/dict/data/typeout/*").permitAll().antMatchers( "/druid/**").permitAll()
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 941b96f..befb224 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
@@ -25,6 +25,7 @@
 import com.smartor.common.MtSubmitSmUtil;
 import com.smartor.common.QwenLLMUtil;
 import com.smartor.domain.*;
+import com.smartor.domain.VO.ServiceSubtaskDetailTraceVO;
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import com.smartor.mapper.*;
 import com.smartor.service.*;
@@ -146,6 +147,9 @@
     ISysDeptService sysDeptService;
 
     @Autowired
+    IServiceSubtaskDetailTraceService serviceSubtaskDetailTraceService;
+
+    @Autowired
     IPatMedOuthospService patMedOuthospService;
 
     @Autowired
@@ -232,6 +236,38 @@
         serviceThirdData.setCreateTime(new Date());
         iServiceThirdDataService.queryList(serviceThirdData);
     }
+
+    /**
+     * 瀹氭椂鍙戦�丼LTD婊℃剰搴﹀紓甯镐俊鎭�
+     */
+    public void sendSLTDMYDExceptInfo() {
+        //1.鑾峰彇鍙戦�佷汉宸ュ彿
+        ServiceSubtaskDetailTraceVO subtaskDetailTraceVO = new ServiceSubtaskDetailTraceVO();
+        subtaskDetailTraceVO.setHandleFlag("0");
+        List<ServiceSubtaskDetailTrace> serviceSubtaskDetailTraces = serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceList(subtaskDetailTraceVO);
+        // 鎶� dutyDeptPersonCode 鏁寸悊鍒� list 涓紙濡傛灉澶氫釜浜虹敤閫楀彿鍒嗗壊锛屽垯灞曞紑骞跺幓閲嶏級
+        List<String> dutyDeptPersonCodeList = serviceSubtaskDetailTraces.stream().map(ServiceSubtaskDetailTrace::getDutyDeptPersonCode).filter(StringUtils::isNotBlank).flatMap(code -> Arrays.stream(code.split(","))).map(String::trim).filter(StringUtils::isNotBlank).distinct()  // 鍘婚噸
+                .collect(Collectors.toList());
+        // 鑾峰彇鈥滅渷绔嬪悓寰锋弧鎰忓害寮傚父鍐呭鎻愰啋"
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("sltd.myd.send.except.contont");
+        String exceptContent = sysConfig.getConfigValue();
+
+        // 鑾峰彇鈥滅渷绔嬪悓寰锋弧鎰忓害寮傚父鍐呭鎻愰啋娴嬭瘯浜哄伐鍙封��
+        String testPerson = sysConfigMapper.checkConfigKeyUnique("sltd.myd.send.test.person").getConfigValue();
+        if (StringUtils.isNotBlank(testPerson)) {
+            String[] split = testPerson.split(",");
+            if (CollectionUtils.isEmpty(dutyDeptPersonCodeList)) dutyDeptPersonCodeList = Arrays.asList(split);
+            else dutyDeptPersonCodeList.addAll(Arrays.asList(split));
+        }
+
+        if (CollectionUtils.isNotEmpty(dutyDeptPersonCodeList)) {
+            for (String dutyDeptPersonCode : dutyDeptPersonCodeList) {
+                log.info("銆恠endSLTDMYDExceptInfo銆戝彂閫佷汉宸ュ彿锛歿}", dutyDeptPersonCode);
+                String data = MessageSend.sendMsg(exceptContent, "7", dutyDeptPersonCode, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+            }
+        }
+    }
+
 
     /**
      * 瀹氭椂澶勭悊澶栭摼鐨勬暟鎹�
@@ -603,7 +639,7 @@
             serviceSLTDInhospReqVO.setCurrent(outpPage);
             serviceSLTDInhospReqVO.setSize(OUTP_PAGE_SIZE);
             log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滆嵂鍝佹暟鎹�濋噰闆嗙{}椤垫暟鎹�", outpPage);
-           Boolean b = serviceSLTDHealthcareRecordService.queryMedicationItemList(serviceSLTDInhospReqVO);
+            Boolean b = serviceSLTDHealthcareRecordService.queryMedicationItemList(serviceSLTDInhospReqVO);
             log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滆嵂鍝佹暟鎹�濋噰闆嗙粨鏋滐細{}", b);
             outpPage++;
         }
@@ -762,91 +798,16 @@
      * 澶勭悊琛ュ伩浠诲姟
      */
     public void compensateTask() {
-        //鑾峰彇鍒皊endstate=3 骞朵笖 visit_time涓哄皬浜庣瓑浜庝粖澶╃殑subtask
+        //鑾峰彇鍒皊endstate=3銆�1 骞朵笖 visit_time涓哄皬浜庣瓑浜庝粖澶╃殑subtask
+        List<Long> list = Arrays.asList(3L, 1L);
         ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
-        serviceSubtaskVO.setSendstate(3L);
-        serviceSubtaskVO.setVisitTime(new Date());
-        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.getCompensateServiceSubtaskList(serviceSubtaskVO);
-        for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
-            //鏍规嵁褰撳墠鐨勬墽琛屾柟寮忥紝鑾峰彇涓嬩竴绉嶆墽琛屾柟寮�
-            ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
-            serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
-            serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
-            serviceSubtaskPreachform.setOrgid(serviceSubtask.getOrgid());
-            List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
-            //鑾峰彇褰撳墠鎵ц鏂瑰紡鐨勫簭鍙�
-            Optional<Long> currentSort = serviceSubtaskPreachforms.stream().filter(item -> serviceSubtask.getCurrentPreachform().equals(item.getPreachform())).map(ServiceSubtaskPreachform::getSort).findFirst();
-            Optional<Long> id = serviceSubtaskPreachforms.stream().filter(item -> serviceSubtask.getCurrentPreachform().equals(item.getPreachform())).map(ServiceSubtaskPreachform::getId).findFirst();
-            if (currentSort.isPresent()) {
-                //1鍏堟鏌ヤ竴涓嬶紝鏄笉鏄湁鎵ц鐘舵�佹槸瀹屾垚鐨勶紙鎬曚箣鍓嶅凡缁忔湁瀹岀殑浜嗭紝娌℃湁灏唖ervuce_subtask鐨勭姸鎬佹敼鎴愬姛锛岃繖閲屽啀妫�鏌ヤ竴涓嬶級
-                boolean finishState = serviceSubtaskPreachforms.stream().allMatch(item -> item.getSendstate().equals("9"));
-                if (finishState) {
-                    serviceSubtask.setSendstate(6L);
-                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
-                    continue;
-                }
-
-                //2鍒ゆ柇涓�涓嬶紝褰撳墠鐨剆ort鏄笉鏄瓑浜庨渶瑕佹墽琛岀殑鎬讳釜鏁帮紝濡傛灉绛変簬鐨勮瘽锛岃鏄庢槸鏈�鍚庝竴涓紝鐩存帴灏唖ervuce_subtask鐨勭姸鎬佹敼鎴�5锛屾墽琛屽け璐ュ氨琛屼簡
-                Long cs = currentSort.get();
-                if (cs.equals(serviceSubtaskPreachforms.size())) {
-                    serviceSubtask.setSendstate(7L);
-                    serviceSubtask.setRemark("澶勭悊琛ュ伩浠诲姟,褰撳墠澶勭悊鏈�鍚庤ˉ鍋匡紝鍏ㄩ儴鎵ц澶辫触锛堣秴鏃讹級");
-
-                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
-                    //淇敼鍙戦�佹柟寮忕殑鐘舵�佷负澶辫触
-                    serviceSubtaskPreachform.setSendstate("5");
-                    serviceSubtaskPreachform.setId(id.get());
-
-                    serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(serviceSubtaskPreachform);
-                    continue;
-                }
-
-                //3.涓嶆槸鏈�鍚庝竴涓紝鑾峰彇鍒颁笅涓�涓墽琛屾柟寮�(鍥犱负閮芥槸鍦ㄤ粖澶╂墽琛岋紝閭e氨鐩存帴鍙戝嚭鍘诲氨瀹屼簡)
-                sfHandlle(serviceSubtask);
-            }
-        }
-    }
-
-    /**
-     * 闀挎湡浠诲姟鍙戦��
-     */
-    public void longTaskSendTest(Long subId) {
-        //鑾峰彇浠诲姟淇℃伅
-        ServiceTask st = new ServiceTask();
-        st.setDelFlag("0");
-        st.setLongTask(1);
-        List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st);
-        log.info("銆恖ongTaskSend銆戣幏鍙栧埌{}涓暱鏈熶换鍔�", serviceTasks.size());
-        for (ServiceTask serviceTask : serviceTasks) {
-            CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ();
-            commonTaskcallMQ.setTaskid(serviceTask.getTaskid());
-            commonTaskcallMQ.setPreachform(serviceTask.getPreachform());
-            commonTaskcallMQ.setSendType("2");
-
-            //閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭�,骞朵笖闅忚鏃堕棿寰楁槸浠婂ぉ涔嬪墠鐨�
-            ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
-            serviceSubtaskVO.setTaskid(commonTaskcallMQ.getTaskid());
-            serviceSubtaskVO.setSendstate(2L);
-            serviceSubtaskVO.setIsVisitAgain(1);
-            serviceSubtaskVO.setSubId(subId);
+        List<ServiceSubtask> serviceSubtaskList = new ArrayList<>();
+        for (Long sendstate : list) {
+            serviceSubtaskVO.setSendstate(sendstate);
             serviceSubtaskVO.setVisitTime(new Date());
-            List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.queryServiceSubtaskList(serviceSubtaskVO);
-            for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
-                sfHandlle(serviceSubtask);
-            }
+            List<ServiceSubtask> compensateServiceSubtaskList = serviceSubtaskMapper.getCompensateServiceSubtaskList(serviceSubtaskVO);
+            serviceSubtaskList.addAll(compensateServiceSubtaskList);
         }
-    }
-
-    /**
-     * 澶勭悊琛ュ伩浠诲姟
-     */
-    public void compensateTaskTest(Long subId) {
-        //鑾峰彇鍒皊endstate=3 骞朵笖 visit_time涓哄皬浜庣瓑浜庝粖澶╃殑subtask
-        ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
-        serviceSubtaskVO.setSendstate(3L);
-        serviceSubtaskVO.setSubId(subId);
-        serviceSubtaskVO.setVisitTime(new Date());
-        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.getCompensateServiceSubtaskList(serviceSubtaskVO);
         for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
             //鏍规嵁褰撳墠鐨勬墽琛屾柟寮忥紝鑾峰彇涓嬩竴绉嶆墽琛屾柟寮�
             ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
@@ -1146,10 +1107,18 @@
                             //鐪佺珛鍚屽痉鐨勭煭淇″彂閫佹柟寮�
                             String data = MessageSend.sendMsg(sendMagParam.getContent(), "6", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
                             if (StringUtils.isNotEmpty(data)) {
-                                ObjectMapper mapper = new ObjectMapper();
-                                JsonNode root = mapper.readTree(data);
-                                String status = root.get("result").get(0).get("status").asText();
-                                if (status.equals("00000")) {
+                                // 瑙f瀽 result=0&description=鎴愬姛&faillist= 鏍煎紡锛坮esult=0鎴愬姛锛�1澶辫触锛�
+                                log.info("銆恠fHandlle銆戠渷绔嬪悓寰风煭淇″彂閫佽繑鍥烇細{}", data);
+                                String[] pairs = data.split("&");
+                                String resultVal = null;
+                                for (String pair : pairs) {
+                                    String[] kv = pair.split("=", 2);
+                                    if ("result".equals(kv[0])) {
+                                        resultVal = kv.length > 1 ? kv[1] : null;
+                                        break;
+                                    }
+                                }
+                                if ("0".equals(resultVal)) {
                                     isSuccess = "true";
                                 }
                             }
@@ -1234,11 +1203,7 @@
                     String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
                     String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
                     String url = null;
-                    url = localIP + ":" + req_path + "/outsideChainwt?param1=" + taskId +
-                            "&param2=" +  patid +
-                            "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) +
-                            "&param5=false" +
-                            "$param6=" + subId;
+                    url = localIP + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false" + "$param6=" + subId;
 
                     ServiceOutPath serviceOutPath = new ServiceOutPath();
                     serviceOutPath.setParam1(taskId);
diff --git a/smartor/pom.xml b/smartor/pom.xml
index ab654ed..f257b5e 100644
--- a/smartor/pom.xml
+++ b/smartor/pom.xml
@@ -145,6 +145,12 @@
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
+        <!-- Kingbase8 JDBC椹卞姩 -->
+        <dependency>
+            <groupId>cn.com.kingbase</groupId>
+            <artifactId>kingbase8</artifactId>
+            <version>8.6.0</version>
+        </dependency>
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-system</artifactId>
diff --git a/smartor/src/main/java/com/smartor/common/DeepSeekApi.java b/smartor/src/main/java/com/smartor/common/DeepSeekApi.java
new file mode 100644
index 0000000..aafd84f
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/common/DeepSeekApi.java
@@ -0,0 +1,178 @@
+package com.smartor.common;
+
+;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.util.*;
+
+@Slf4j
+public class DeepSeekApi {
+    // 鏇挎崲涓轰綘鑷繁鐨刱ey
+    private static final String API_KEY = "sk-4e489637e105411596be6c72e2dacdbd";
+    private static final String API_URL = "https://api.deepseek.com/v1/chat/completions";
+
+    public static void main(String[] args) {
+        String questionText = "鎮ㄥソ,璇烽棶鎮ㄦ槸鎮h�呮湰浜鸿繕鏄灞烇紵\n";
+        String voiceText = "鎴戣嚜宸�";
+//        List<String> options = new ArrayList<>(Arrays.asList("鏈汉","浜插睘","鍏朵粬"));
+        String optionText = "浜插睘";
+        Integer resp = matchQuestionAnswer(questionText, voiceText, optionText);
+        System.out.println("DeepSeek杩斿洖缁撴灉锛歕n" + resp);
+    }
+
+    public static String chatCompletion(String systemPrompt, String userPrompt) {
+        OkHttpClient client = new OkHttpClient();
+
+        // 1. 缁勮娑堟伅浣�
+        List<Map<String, String>> messages = new ArrayList<>();
+        // 绯荤粺瑙掕壊锛堝彲閫夛紝鐢ㄤ簬璁惧畾AI韬唤锛�
+        Map<String, String> sysMsg = new HashMap<>();
+        sysMsg.put("role", "system");
+        sysMsg.put("content", systemPrompt);
+        messages.add(sysMsg);
+        // 鐢ㄦ埛鎻愰棶
+        Map<String, String> userMsg = new HashMap<>();
+        userMsg.put("role", "user");
+        userMsg.put("content", userPrompt);
+        messages.add(userMsg);
+
+        // 2. 璇锋眰鍙傛暟
+        Map<String, Object> requestBody = new HashMap<>();
+        requestBody.put("model", "deepseek-chat");
+        requestBody.put("messages", messages);
+        requestBody.put("temperature", 0.7); // 闅忔満鎬�0~1锛岃秺浣庤秺涓ヨ皑
+        requestBody.put("max_tokens", 1024);
+
+        // 3. 鏋勫缓璇锋眰
+        String jsonBody = JSON.toJSONString(requestBody);
+        RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonBody);
+
+        Request request = new Request.Builder()
+                .url(API_URL)
+                .header("Authorization", "Bearer " + API_KEY)
+                .header("Content-Type", "application/json")
+                .post(body)
+                .build();
+
+        // 4. 鍙戦�佽姹�
+        try (Response response = client.newCall(request).execute()) {
+            if (!response.isSuccessful()) {
+                return "璇锋眰澶辫触锛岀姸鎬佺爜锛�" + response.code() + "锛岄敊璇俊鎭細" + response.body().string();
+            }
+            String resJson = response.body().string();
+            JSONObject jsonObj = JSON.parseObject(resJson);
+            // 鎻愬彇AI鍥炵瓟鍐呭
+            return jsonObj.getJSONArray("choices")
+                    .getJSONObject(0)
+                    .getJSONObject("message")
+                    .getString("content");
+        } catch (IOException e) {
+            e.printStackTrace();
+            return "鎺ュ彛璋冪敤寮傚父锛�" + e.getMessage();
+        }
+    }
+
+    /**
+     * 鍒ゆ柇璇煶鏂囨湰鏈�鎺ヨ繎鍝釜閫夐」锛岃繑鍥為�夐」鍦ㄥ垪琛ㄤ腑鐨勪笅鏍囥��
+     *
+     * @param voiceText 璇煶璇嗗埆寰楀埌鐨勬枃鏈�
+     * @param options   鍊欓�夐�夐」鍒楄〃
+     * @return 鍛戒腑閫夐」鐨勪笅鏍囷紙浠� 0 寮�濮嬶級锛涙棤娉曞尮閰嶄换涓�閫夐」鏃惰繑鍥� {@code -1}
+     */
+    public static int matchOptionIndex(String questionText, String voiceText, List<String> options) {
+        if (StringUtils.isBlank(voiceText) || options == null || options.isEmpty()) {
+            return -1;
+        }
+        // 鍙湁涓�涓�夐」鏃舵棤闇�璋冪敤妯″瀷
+        if (options.size() == 1) {
+            return 0;
+        }
+
+        StringBuilder optionText = new StringBuilder();
+        for (int i = 0; i < options.size(); i++) {
+            optionText.append(i + 1).append(". ").append(options.get(i)).append('\n');
+        }
+
+        String systemPrompt = "\"浣犳槸涓�涓笓涓氱殑璇煶璇嗗埆鏂囨湰璇箟鍖归厤鍔╂墜銆備綘鐨勪换鍔℃槸鍒ゆ柇鐢ㄦ埛鐨勮闊虫枃鏈湪璇箟涓婃渶绗﹀悎鐨勯�夐」銆傜敤鎴蜂細缁欏嚭涓�娈佃闊宠瘑鍒枃鏈拰鑻ュ共涓甫缂栧彿鐨勯�夐」锛�"
+                + "璇峰垽鏂繖娈垫枃鏈湪璇箟涓婃渶鎺ヨ繎鍝竴涓�夐」銆傚彧鍏佽浠庣粰瀹氶�夐」涓�夋嫨锛�"
+                + "涓嶈鍋氫换浣曡В閲娿�傜洿鎺ヨ緭鍑烘渶鍖归厤閫夐」鐨勭紪鍙锋暟瀛楋紱鑻ユ病鏈変换浣曢�夐」涓庢枃鏈浉鍏筹紝鍒欒緭鍑� 0銆�";
+        String userPrompt = "璇锋牴鎹互涓嬩俊鎭繘琛岃涔夊尮閰嶅垽鏂細\n" +
+                "- 闂鏂囨湰锛�" + questionText + "\n\n"
+                + "- 璇煶璇嗗埆鏂囨湰锛�" + voiceText + "\n\n"
+                + "- 閫夐」锛歕n" + optionText
+                + "\n璇峰彧杈撳嚭涓�涓暟瀛楋紙鏈�鍖归厤閫夐」鐨勭紪鍙凤紝娌℃湁鍖归厤鍒欒緭鍑� 0锛夈��";
+
+        String content = chatCompletion(systemPrompt, userPrompt);
+        if (StringUtils.isBlank(content)) {
+            return -1;
+        }
+
+        Integer number = extractFirstNumber(content);
+        if (number == null || number <= 0 || number > options.size()) {
+            log.warn("DeepSeek 閫夐」鍖归厤鏈懡涓紝voiceText={}, options={}, modelReturn={}", voiceText, options, content);
+            return -1;
+        }
+        return number - 1;
+    }
+
+    /**
+     * 鍒ゆ柇璇煶鏂囨湰鏈�鎺ヨ繎鍝釜閫夐」锛岃繑鍥為�夐」鍦ㄥ垪琛ㄤ腑鐨勪笅鏍囥��
+     *
+     * @param questionText 璇煶璇嗗埆寰楀埌鐨勬枃鏈�
+     * @param answerText   绛旀鏂囨湰
+     * @param optionText   閫夐」鏂囨湰
+     * @return 鍛戒腑閫夐」鐨勪笅鏍囷紙浠� 0 寮�濮嬶級锛涙棤娉曞尮閰嶄换涓�閫夐」鏃惰繑鍥� {@code -1}
+     */
+    public static int matchQuestionAnswer(String questionText, String answerText, String optionText) {
+        if (StringUtils.isBlank(questionText) || StringUtils.isBlank(answerText) || StringUtils.isBlank(optionText)) {
+            return -1;
+        }
+
+        String systemPrompt = "\"浣犳槸涓�涓笓涓氱殑璇煶璇嗗埆鏂囨湰璇箟鍖归厤鍔╂墜銆備綘鐨勪换鍔℃槸鍒ゆ柇鐢ㄦ埛鐨勮闊虫枃鏈湪璇箟涓婃渶绗﹀悎鐨勯�夐」銆傜敤鎴蜂細缁欏嚭涓�娈佃闊宠瘑鍒枃鏈拰閫夐」鏂囨湰锛�"
+                + "璇峰垽鏂繖娈垫枃鏈湪璇箟涓婃槸鍚﹀尮閰嶉�夐」, 鍖归厤鍒欒緭鍑� 1锛屾病鏈夊尮閰嶅垯杈撳嚭 0, 鍙厑璁歌緭鍑�1鎴栬��0锛�"
+                + "涓嶈鍋氫换浣曡В閲娿�傜洿鎺ヨ緭鍑烘渶鍖归厤閫夐」鐨勭紪鍙锋暟瀛楋紱鑻ユ病鏈変换浣曢�夐」涓庢枃鏈浉鍏筹紝鍒欒緭鍑� 0銆�";
+        String userPrompt = "璇锋牴鎹互涓嬩俊鎭繘琛岃涔夊尮閰嶅垽鏂細\n" +
+                "- 闂鏂囨湰锛�" + questionText + "\n\n"
+                + "- 璇█璇嗗埆鏂囨湰锛�" + answerText + "\n\n"
+                + "- 閫夐」鏂囨湰锛�" + optionText + "\n\n"
+                + "\n璇峰彧杈撳嚭涓�涓暟瀛楋紙鍖归厤鍒欒緭鍑� 1锛屾病鏈夊尮閰嶅垯杈撳嚭 0,鍙厑璁歌緭鍑�1鎴栬��0锛夈��";
+
+        String content = chatCompletion(systemPrompt, userPrompt);
+        if (StringUtils.isBlank(content)) {
+            return -1;
+        }
+        return extractFirstNumber(content);
+    }
+
+    /**
+     * 浠庢ā鍨嬪洖澶嶄腑鎻愬彇绗竴涓暣鏁般�傛ā鍨嬪伓灏斾細鍥炲 鈥滈�夐」2鈥� 鈥�2銆傗�� 涔嬬被锛屽仛涓�娆″厹搴曡В鏋愩��
+     */
+    private static Integer extractFirstNumber(String text) {
+        List<Character> digits = new ArrayList<>();
+        for (int i = 0; i < text.length(); i++) {
+            char c = text.charAt(i);
+            if (c >= '0' && c <= '9') {
+                digits.add(c);
+            } else if (!digits.isEmpty()) {
+                break;
+            }
+        }
+        if (digits.isEmpty()) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        for (char c : digits) {
+            sb.append(c);
+        }
+        try {
+            return Integer.parseInt(sb.toString());
+        } catch (NumberFormatException e) {
+            return null;
+        }
+    }
+}
\ No newline at end of file
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
index 6b4b2e9..7f67449 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -356,6 +356,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
 //    /**
 //     * 闂缁撴灉锛堢粰鈥滃�肩被鍨嬧�濇槸鏂囨湰鎴栬�呮暟鍊肩敤鐨勶級
 //     */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
index 2cc953e..d5aa4d4 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -388,6 +388,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
     /**
      * 璇濇湳閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
index eaa12ed..7188978 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
@@ -343,6 +343,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
     /**
      * 闂閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
index 130b4d8..cb40160 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
@@ -375,6 +375,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
     /**
      * 璇濇湳閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/PatArchive.java b/smartor/src/main/java/com/smartor/domain/PatArchive.java
index 5733dd8..51e63c5 100644
--- a/smartor/src/main/java/com/smartor/domain/PatArchive.java
+++ b/smartor/src/main/java/com/smartor/domain/PatArchive.java
@@ -336,8 +336,8 @@
     /**
      * 浼氬憳灞炴��:0闈炰細鍛橈紝1涓�鑸細鍛樸��2閲嶈浼氬憳
      */
-    @ApiModelProperty("浼氬憳灞炴��:0闈炰細鍛橈紝1涓�鑸細鍛樸��2閲嶈浼氬憳")
-    @Excel(name = " 浼氬憳灞炴��:0闈炰細鍛橈紝1涓�鑸細鍛樸��2閲嶈浼氬憳 ")
+    @ApiModelProperty("浼氬憳灞炴��:0闈炰細鍛橈紝1涓�鑸細鍛樸��2閲嶈浼氬憳 -1铏氭嫙鎮h��")
+    @Excel(name = " 浼氬憳灞炴��:0闈炰細鍛橈紝1涓�鑸細鍛樸��2閲嶈浼氬憳 -1铏氭嫙鎮h��")
     private String viptype;
 
     @ApiModelProperty("鍑洪櫌鐥呭尯鍚嶇О")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
index 7e494bd..7d7024d 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -451,7 +451,7 @@
      * 灏辫瘖绫诲瀷锛�1闂ㄨ瘖  2鍑洪櫌锛�
      */
     @Excel(name = "  灏辫瘖绫诲瀷锛�1闂ㄨ瘖  2鍑洪櫌锛�")
-    @ApiModelProperty(value = "灏辫瘖绫诲瀷锛�1闂ㄨ瘖  2鍑洪櫌 3.涓撶梾 4.澶栭儴瀵煎叆 5鎬ヨ瘖銆�6浣忛櫌銆�7浣撴锛�")
+    @ApiModelProperty(value = "灏辫瘖绫诲瀷锛�1闂ㄨ瘖  2鍑洪櫌 3.涓撶梾 4.澶栭儴瀵煎叆 5鎬ヨ瘖銆�6浣忛櫌銆�7浣撴銆�8鎵爜锛�")
     private String hospType;
 
 
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java
index 8eb08ed..1f1ae20 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java
@@ -246,7 +246,7 @@
      * 澶勭悊璇︾粏璇存槑锛堝鐞嗙瀹わ級
      */
     @ApiModelProperty("澶勭悊璇︾粏璇存槑锛堝鐞嗙瀹わ級")
-    @Excel(name = "澶勭悊璇︾粏璇存槑", readConverterExp = "澶�=鐞嗙瀹�")
+    @Excel(name = "澶勭悊璇︾粏璇存槑", readConverterExp = "澶勭悊绉戝")
     private String handledesc;
 
     /**
@@ -360,5 +360,23 @@
     @ApiModelProperty("闂缁村害")
     private String dimension;
 
+
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
+
 }
 
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java
index 851d764..7123091 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java
@@ -35,6 +35,40 @@
     private String sendname;
 
     /**
+     * 骞撮緞
+     */
+    @Excel(name = "骞撮緞 ")
+    @ApiModelProperty(value = "骞撮緞")
+    private Long age;
+
+    /**
+     * 鎬у埆
+     */
+    @ApiModelProperty(value = "鎬у埆")
+    private Long sex;
+
+    /**
+     * 鎬у埆
+     */
+    @Excel(name = "鎬у埆")
+    @ApiModelProperty(value = "鎬у埆")
+    private String sexName;
+
+    /**
+     * 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛�
+     */
+//    @Excel(name = "灏辫瘖缂栧彿")
+    @ApiModelProperty(value = "灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛�")
+    private String hospno;
+
+    /**
+     * 鐥呭巻鍙�
+     */
+    @Excel(name = "鐥呭巻鍙�")
+    @ApiModelProperty(value = "鎮h�呯紪鍙凤紙鐥呭巻鍙凤級")
+    private String patno;
+
+    /**
      * 鍑洪櫌鏃堕棿
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java
index fccb2d8..d49a646 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java
@@ -121,6 +121,13 @@
     private Long sex;
 
     /**
+     * 鎬у埆
+     */
+    @Excel(name = " 鎬у埆鍚嶇О")
+    @ApiModelProperty(value = "鎬у埆鍚嶇О")
+    private String sexName;
+
+    /**
      * 骞撮緞
      */
     @Excel(name = " 骞撮緞 ")
@@ -447,6 +454,13 @@
     private String hospno;
 
     /**
+     * 鎮h�呯紪鍙�
+     */
+    @Excel(name = "鎮h�呯紪鍙凤紙鐥呭巻鍙凤級")
+    @ApiModelProperty(value = "鎮h�呯紪鍙凤紙鐥呭巻鍙凤級")
+    private String patno;
+
+    /**
      * 灏辫瘖绫诲瀷锛�1闂ㄨ瘖  2鍑洪櫌锛�
      */
     @Excel(name = "  灏辫瘖绫诲瀷锛�1闂ㄨ瘖  2鍑洪櫌锛�")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceTaskScriptQues.java b/smartor/src/main/java/com/smartor/domain/ServiceTaskScriptQues.java
index 5a19c92..ec8d820 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceTaskScriptQues.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceTaskScriptQues.java
@@ -46,6 +46,13 @@
     private String param4;
 
     /**
+     * 瀛愪换鍔D subId
+     */
+    @Excel(name = "瀛愪换鍔D subId ")
+    @ApiModelProperty(value = "瀛愪换鍔D subId")
+    private String param6;
+
+    /**
      * 鎮h�呮潵婧�
      */
     @Excel(name = "patfrom  ")
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
index f36a2e1..4648c7a 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
@@ -298,6 +298,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
     /**
      * 闂埜棰樼洰鍒嗙被ID闆嗗悎
      */
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
index e1448e7..6983921 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
@@ -315,6 +315,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
     @Excel(name = "鍒嗙被ID闆嗗悎")
     @ApiModelProperty(value = "鍒嗙被ID闆嗗悎")
     private List<Long> categoryids;
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
index c0b0550..e774b24 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
@@ -63,10 +63,10 @@
     private String description;
 
     /**
-     * 闂嵎浠嬬粛
+     * 闂嵎浠嬬粛锛堝綋澶囨敞鐢級
      */
-    @Excel(name = " 闂嵎浠嬬粛 ")
-    @ApiModelProperty(value = "闂嵎浠嬬粛")
+    @Excel(name = " 闂嵎浠嬬粛锛堝綋澶囨敞鐢級 ")
+    @ApiModelProperty(value = "闂嵎浠嬬粛锛堝綋澶囨敞鐢級")
     private String introduce;
 
     /**
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
index 9ebffa6..e0724c2 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
@@ -262,6 +262,21 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
 
     /**
      * 闂埜棰樼洰鍒嗙被ID闆嗗悎
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
index bd10356..924ceb9 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
@@ -351,6 +351,22 @@
     @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
     private String reportDeptCode;
 
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
+
     /**
      * 闂埜棰樼洰鍒嗙被ID闆嗗悎
      */
diff --git a/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java b/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java
index f1dda53..98ab898 100644
--- a/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java
+++ b/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java
@@ -34,7 +34,7 @@
     @ApiModelProperty("澶勭悊绉戝鍚嶇О")
     @Excel(name = "澶勭悊绉戝鍚嶇О")
     private String todeptname;
-    
+
     /**
      * 闂绫诲瀷:璇煶銆侀棶鍗�
      */
@@ -83,5 +83,21 @@
      */
     @ApiModelProperty("闂缁村害")
     private String dimension;
+
+    @Excel(name = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonName;
+
+    @Excel(name = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String dutyDeptPersonCode;
+
+    @Excel(name = "鎶ュ绉戝璐d换浜哄悕绉帮紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptPersonName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝璐d换浜虹紪鐮侊紙濡傛灉澶氫釜绉戝鐢ㄩ�楀彿鍒嗗壊锛�")
+    private String reportDeptPersonCode;
 }
 
diff --git a/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java b/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
index 6da61db..6711c30 100644
--- a/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
+++ b/smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
@@ -123,4 +123,6 @@
      * @return 缁撴灉
      */
     public void addOperationSubTask(String config);
+
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatArchive patArchive, String config, Integer type);
 }
diff --git a/smartor/src/main/java/com/smartor/service/IPatMedOperationService.java b/smartor/src/main/java/com/smartor/service/IPatMedOperationService.java
index ea0f8cb..6a4ab83 100644
--- a/smartor/src/main/java/com/smartor/service/IPatMedOperationService.java
+++ b/smartor/src/main/java/com/smartor/service/IPatMedOperationService.java
@@ -1,6 +1,9 @@
 package com.smartor.service;
 
+import com.smartor.domain.PatArchive;
 import com.smartor.domain.PatMedOperation;
+import com.smartor.domain.ServiceSubtask;
+import com.smartor.domain.ServiceTask;
 
 import java.util.List;
 
@@ -65,4 +68,6 @@
      * @return
      */
     public int dealOperationInfo();
+
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedOperation patMedOperation1, PatArchive patArchive);
 }
diff --git a/smartor/src/main/java/com/smartor/service/IPatMedOuthospService.java b/smartor/src/main/java/com/smartor/service/IPatMedOuthospService.java
index 2c9bc1a..2535163 100644
--- a/smartor/src/main/java/com/smartor/service/IPatMedOuthospService.java
+++ b/smartor/src/main/java/com/smartor/service/IPatMedOuthospService.java
@@ -3,9 +3,7 @@
 import java.util.List;
 
 import com.ruoyi.common.core.page.TableDataInfo;
-import com.smartor.domain.PatMedOuthosp;
-import com.smartor.domain.PatMedReq;
-import com.smartor.domain.PatMedRes;
+import com.smartor.domain.*;
 import org.springframework.web.bind.annotation.RequestBody;
 
 /**
@@ -69,4 +67,6 @@
     public PatMedOuthosp getDeptCodeByPatId(PatMedOuthosp patMedOuthosp);
 
     public Integer dealOutpatientInfo();
+
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedOuthosp patMedOuthosp, PatArchive patArchive);
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
index 7239987..2134e3d 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -198,4 +198,6 @@
      * @return
      */
     public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startOutHospTime, Date endOutHospTime);
+
+    public String scanGenerateSubtask(ServiceTask serviceTaskVo);
 }
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 e307373..b95eaa1 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -956,7 +956,8 @@
 
 
     //灏佽serviceSubtask
-    private ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatArchive patArchive, String config, Integer type) {
+    @Override
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatArchive patArchive, String config, Integer type) {
         //澧炲姞serviceTask鍒ょ┖
 //        if(Objects.isNull(serviceTask)){
 //            return null;
@@ -994,6 +995,7 @@
         serviceSubtask.setSex(patArchive.getSex());
         serviceSubtask.setAge(patArchive.getAge());
         serviceSubtask.setSendstate(2L);
+        serviceSubtask.setCampusid(patMedInhosp1.getCampusid());
         serviceSubtask.setManagementDoctor(patMedInhosp1.getManagementDoctor());
         serviceSubtask.setManagementDoctorCode(patMedInhosp1.getManagementDoctorCode());
         serviceSubtask.setStarttime(patMedInhosp1.getStarttime());
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedOperationServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedOperationServiceImpl.java
index 298bf62..d16c37d 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedOperationServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedOperationServiceImpl.java
@@ -185,7 +185,8 @@
     }
 
     //灏佽serviceSubtask
-    private ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedOperation patMedOperation1, PatArchive patArchive) {
+    @Override
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedOperation patMedOperation1, PatArchive patArchive) {
         ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
         serviceSubtask.setTaskid(serviceTask.getTaskid());
         if (StringUtils.isNotEmpty(serviceTask.getLibtemplateid()))
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
index 97496b2..bf908b7 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
@@ -475,7 +475,8 @@
     }
 
     //灏佽serviceSubtask
-    private ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedOuthosp patMedOuthosp, PatArchive patArchive) {
+    @Override
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedOuthosp patMedOuthosp, PatArchive patArchive) {
         ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
         serviceSubtask.setTaskid(serviceTask.getTaskid());
         if (StringUtils.isNotEmpty(serviceTask.getLibtemplateid()))
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index 0e8068a..66d22d4 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1,8 +1,6 @@
 package com.smartor.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.json.JSON;
-import cn.hutool.json.JSONUtil;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -10,8 +8,6 @@
 import com.ruoyi.common.core.domain.entity.SysUserDept;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.common.utils.AesUtils;
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DtoConversionUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.http.HttpUtils;
@@ -21,7 +17,6 @@
 import com.smartor.service.IPatMedOuthospService;
 import com.smartor.service.IServiceExternalService;
 import lombok.extern.slf4j.Slf4j;
-import netscape.javascript.JSObject;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,8 +25,6 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -435,6 +428,7 @@
         Map yeWuXX = (Map) dataMap.get("YeWuXX");
         Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
         Map<String, Object> RuKeXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("RuKeXX") : null;
+        Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
 
         List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null;
 
@@ -445,8 +439,6 @@
         externalInHospPatientInfo.setZhuZhiYSID(externalInDeptPatientInfo.getZhuZhiYSID());
         externalInHospPatientInfo.setZhuZhiYSXM(externalInDeptPatientInfo.getZhuZhiYSXM());
         externalInHospPatientInfo.setRuYuanSJ(externalInDeptPatientInfo.getRuYuanSJ());
-        externalInHospPatientInfo.setJingGuanYSID(externalInDeptPatientInfo.getJingGuanYSID());
-        externalInHospPatientInfo.setJingGuanYSXM(externalInDeptPatientInfo.getJingGuanYSXM());
         externalInHospPatientInfo.setLianXiDH(ObjectUtils.isNotEmpty(BingRenXX.get("LianXiDH")) ? BingRenXX.get("LianXiDH").toString() : null);
         externalInHospPatientInfo.setDangQianCWID(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWID")) ? BingRenXX.get("DangQianCWID").toString() : null);
         externalInHospPatientInfo.setDangQianCWMC(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianCWMC")) ? BingRenXX.get("DangQianCWMC").toString() : null);
@@ -517,13 +509,20 @@
         Map yeWuXX = (Map) dataMap.get("YeWuXX");
         Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
         Map<String, Object> ChuYuanJL = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ChuYuanJL") : null;
+        Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
         List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(BingRenXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null;
         List<HashMap<String, Object>> epli = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList") : null;
         Map<String, Object> SuiFangJH = ObjectUtils.isNotEmpty(ChuYuanJL) ? (Map<String, Object>) ChuYuanJL.get("SuiFangJH") : null;
-
         ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
         ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null;
         ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null;
+
+        //灏辫瘖淇℃伅
+        ExternalInDeptPatientInfo externalJZInfo = BeanUtil.mapToBean(JiuZhenXX, ExternalInDeptPatientInfo.class, true);
+        if(ObjectUtils.isNotEmpty(externalJZInfo)){
+            externalInHospPatientInfo.setJingGuanYSID(externalJZInfo.getJingGuanYSID());
+            externalInHospPatientInfo.setJingGuanYSXM(externalJZInfo.getJingGuanYSXM());
+        }
         List<ExternalInHospPatientAddrInfo> epai2 = null;
         //姝讳骸鏍囪
         Boolean deathFlag = false;
@@ -582,7 +581,6 @@
             String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
             patMedInhosp1.setTagname(tagname);
         }
-        Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
         PatMedInhosp patMedInhosp1 = new PatMedInhosp();
         if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0);
         patMedInhosp1.setSchemestatus(2L);
@@ -599,6 +597,9 @@
             patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null);
             patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null);
             patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null);
+
+            patMedInhosp1.setManagementDoctorCode(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSID")) ? JiuZhenXX.get("JingGuanYSID").toString() : null);
+            patMedInhosp1.setManagementDoctor(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSXM")) ? JiuZhenXX.get("JingGuanYSXM").toString() : null);
 
             //绂婚櫌鏂瑰紡浠g爜 1-鍖荤灘绂婚櫌 2-鍖诲槺杞櫌 3-鍖诲槺杞ぞ鍖哄崼鐢熸湇鍔℃満鏋�/涔¢晣鍗敓闄�
             // 4-闈炲尰鍢辩闄� 5-姝讳骸 9-鍏朵粬 10-浠嬪叆瀹� 20-鎵嬫湳瀹�
@@ -982,6 +983,9 @@
             patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null);
             patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null);
             patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null);
+
+            patMedInhosp1.setManagementDoctorCode(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSID")) ? JiuZhenXX.get("JingGuanYSID").toString() : null);
+            patMedInhosp1.setManagementDoctor(ObjectUtils.isNotEmpty(JiuZhenXX.get("JingGuanYSXM")) ? JiuZhenXX.get("JingGuanYSXM").toString() : null);
         }
         patMedInhosp1.setUpdateTime(new Date());
         patMedInhosp1.setTelcode(patArchive.getTelcode());
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
index a5071d0..7699e68 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -15,7 +15,6 @@
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import com.smartor.mapper.*;
 import com.smartor.service.*;
-import com.sun.org.apache.bcel.internal.generic.NEW;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
@@ -1020,6 +1019,10 @@
             subtaskDetailTrace.setCreateTime(new Date());
             subtaskDetailTrace.setUpdateTime(new Date());
             subtaskDetailTrace.setOrgid(selectServiceSubtaskList.get(0).getOrgid());
+            subtaskDetailTrace.setDutyDeptPersonCode(svyTaskTemplateScriptVO.getDutyDeptPersonCode());
+            subtaskDetailTrace.setDutyDeptPersonName(svyTaskTemplateScriptVO.getDutyDeptPersonName());
+            subtaskDetailTrace.setReportDeptPersonCode(svyTaskTemplateScriptVO.getReportDeptPersonCode());
+            subtaskDetailTrace.setReportDeptPersonName(svyTaskTemplateScriptVO.getReportDeptPersonName());
 
             Long existTraceId = existingTraceIdMap.get(subtaskDetailTrace.getScriptid());
             if (existTraceId != null) {
@@ -1293,6 +1296,10 @@
             subtaskDetailTrace.setCreateTime(new Date());
             subtaskDetailTrace.setUpdateTime(new Date());
             subtaskDetailTrace.setOrgid(selectServiceSubtaskList.get(0).getOrgid());
+            subtaskDetailTrace.setDutyDeptPersonCode(ivrTaskTemplateScriptVO.getDutyDeptPersonCode());
+            subtaskDetailTrace.setDutyDeptPersonName(ivrTaskTemplateScriptVO.getDutyDeptPersonName());
+            subtaskDetailTrace.setReportDeptPersonCode(ivrTaskTemplateScriptVO.getReportDeptPersonCode());
+            subtaskDetailTrace.setReportDeptPersonName(ivrTaskTemplateScriptVO.getReportDeptPersonName());
 
             ServiceSubtaskDetailTraceVO ssdt = new ServiceSubtaskDetailTraceVO();
             ssdt.setSubId(subtaskDetailTrace.getSubId());
@@ -1303,6 +1310,7 @@
                 subtaskDetailTrace.setId(serviceSubtaskDetailTraces.get(0).getId());
                 traceService.updateServiceSubtaskDetailTtrace(subtaskDetailTrace);
             } else traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
+
         } else if (stt != null && stt.getIsabnormal() != null && stt.getIsabnormal() != 1L) {
             //杩欓噷涓昏鏄�曞尰鎶や汉鍛樻妸寮傚父閫夐」鏀规垚浜嗛潪寮傚父鐨勶紝杩欓噷灏遍渶瑕佹煡涓�涓嬭繖鏉℃暟鎹槸涓嶆槸鍦ㄦ弧鎰忓害寮傚父琛紝濡傛灉鍦紝鍒欒鍒犻櫎
             ServiceSubtaskDetailTraceVO subtaskDetailTraceVO = new ServiceSubtaskDetailTraceVO();
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index a0c8a9a..57f6c79 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -6,15 +6,19 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.dx.MessageSend;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.*;
 import com.ruoyi.common.core.service.IConfigService;
+import com.ruoyi.common.utils.http.HttpUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.service.ISysConfigService;
+import com.smartor.common.DeepSeekApi;
 import com.smartor.common.FtpService;
 import com.smartor.common.MtSubmitSmUtil;
 import com.smartor.common.ScheduleSubtaskBuilder;
@@ -31,6 +35,7 @@
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.ibatis.annotations.Param;
+import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.Cacheable;
@@ -38,17 +43,17 @@
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
@@ -139,6 +144,9 @@
     @Autowired
     private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
 
+    @Autowired
+    private IPatMedInhospService patMedInhospService;
+
     @Value("${pri_key}")
     private String pri_key;
 
@@ -147,6 +155,9 @@
 
     @Value("${ASRCallBackPath}")
     private String ASRCallBackPath;
+
+    @Autowired
+    private ISysConfigService configService;
 
     @Autowired
     private MtSubmitSmUtil mtSubmitSmUtil;
@@ -420,9 +431,74 @@
                     serviceSubtaskRes.setCurrentPreachform(serviceSubtask.getPreachform().split(",")[0]);
                 }
             }
+            PatMedInhosp inhosp = patMedInhospMapper.selectPatMedInhospByInhospid(serviceSubtask.getInhospid());
+            if (ObjectUtils.isNotEmpty(inhosp)) {
+                PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(inhosp.getPatid());
+                if (ObjectUtils.isNotEmpty(patArchive)) {
+                    Map<String, String> stringStringMap = calculateAge(patArchive.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now());
+                    serviceSubtaskRes.setAge(StringUtils.isNotEmpty(stringStringMap.get("age")) ? Long.valueOf(stringStringMap.get("age")) : null);
+                    serviceSubtaskRes.setSex(patArchive.getSex());
+                    serviceSubtaskRes.setSexName(patArchive.getSex() != null ? (patArchive.getSex() == 1 ? "鐢�" : "濂�") : null);
+                }
+                serviceSubtaskRes.setHospno(inhosp.getInhospno());
+                serviceSubtaskRes.setPatno(inhosp.getPatno());
+            }
+
             serviceSubtaskResList.add(serviceSubtaskRes);
         }
         return serviceSubtaskResList;
+    }
+
+    public Map<String, String> calculateAge(LocalDate birthdate, LocalDate today) {
+        if (birthdate == null || today.isBefore(birthdate)) {
+            return null;
+        }
+        Map<String, String> ageMap = new HashMap<>();
+
+        Period period = Period.between(birthdate, today);
+        long totalDays = ChronoUnit.DAYS.between(birthdate, today);
+        long totalMonths = ChronoUnit.MONTHS.between(birthdate, today);
+
+        int years = period.getYears();
+        int months = period.getMonths();
+        int days = period.getDays();
+
+        String ageUnit;
+        Integer age;
+        String ageUnit2 = null;
+        Integer age2 = null;
+
+        if (totalDays < 90) {
+            // 灏忎簬 1 涓湀锛屾寜澶╄绠�
+            ageUnit = "澶�";
+            age = (int) totalDays;
+            ageMap.put("age", age != null ? age.toString() : null);
+            ageMap.put("ageUnit", ageUnit);
+            ageMap.put("age2", null);
+            ageMap.put("ageUnit2", null);
+        } else if (totalMonths < 36) {
+            // 灏忎簬 1 骞达紝鎸夋湀 + 澶╄绠�
+            ageUnit = "鏈�";
+            age = (int) totalMonths;
+            ageUnit2 = "澶�";
+            age2 = days;
+            ageMap.put("age", age != null ? age.toString() : null);
+            ageMap.put("ageUnit", ageUnit);
+            ageMap.put("age2", age2 != null ? age2.toString() : null);
+            ageMap.put("ageUnit2", ageUnit2);
+        } else {
+            // 澶т簬 1 骞达紝鎸夊勾 + 鏈堣绠�
+            ageUnit = "宀�";
+            age = years;
+            ageUnit2 = "鏈�";
+            age2 = months;
+            ageMap.put("age", age != null ? age.toString() : null);
+            ageMap.put("ageUnit", ageUnit);
+            ageMap.put("age2", age2 != null ? age2.toString() : null);
+            ageMap.put("ageUnit2", ageUnit2);
+        }
+
+        return ageMap;
     }
 
     @Override
@@ -594,9 +670,16 @@
         ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(serviceSubtaskTemplateVO.getSubId());
         if (serviceSubtask == null || serviceSubtask.getSendstate() != 2L)
             throw new BaseException("璇ヤ换鍔″凡鍙戦�佺粰鎮h�咃紝涓嶈兘鍐嶈繘琛屼慨鏀规ā鏉�");
-
+        serviceSubtaskTemplateVO.getSvyTaskTemplateVO().setIntroduce("璇ラ棶鍗锋槸鏇挎崲鍚庣殑闂锛屾浛鎹㈠墠鐨勯棶棰樻槸锛�" + serviceSubtask.getTemplateid());
         Integer taskTempid = svyTaskTemplateService.saveOrUpdateTemplate(serviceSubtaskTemplateVO.getSvyTaskTemplateVO());
         if (taskTempid == null) return false;
+
+        //姣忔閮芥柊寤轰竴涓篃鍙互锛屼絾鏂板缓涔嬪悗瑕佹妸涔嬪墠鐨勫垹闄�
+        if (serviceSubtask.getType().equals("2")) {
+            svyTaskTemplateService.deleteSvyTaskTemplateBySvyid(serviceSubtask.getTemplateid());
+        } else if (serviceSubtask.getType().equals("1"))
+            ivrTaskTemplateService.deleteIvrTaskTemplateByID(serviceSubtask.getTemplateid());
+
 
         String tempName = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(Long.valueOf(taskTempid)).getSvyname();
         serviceSubtask.setTemplateid(taskTempid.longValue());
@@ -1731,12 +1814,28 @@
             if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
                 //鐢ㄦ潵鏍囪锛屾槸鍚︽湁鍖归厤涓婄殑
                 Integer flag = 0;
+                //1-AI璇嗗埆
+                SysConfig configVoiceMatchAi = new SysConfig();
+                configVoiceMatchAi.setOrgid(phoneCallReqYQVO.getOrgid());
+                configVoiceMatchAi.setConfigKey("sys.voice.match.ai");
+                SysConfig matchAi = sysConfigMapper.selectConfig(configVoiceMatchAi);
+
+//            if (ObjectUtils.isNotEmpty(matchAi) && StringUtils.isNotEmpty(matchAi.getConfigValue())
+//                    && matchAi.getConfigValue().equals("1")) {
+//                PhoneCallBackYQVO aiMatchResult = AiMatch(phoneCallReqYQVO, phoneCallBackYQVO,
+//                        ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate,
+//                        ivrTaskTemplateScripts, scriptId, flag);
+//                if(aiMatchResult != null){
+//                    return aiMatchResult;
+//                }
+//            } else {
                 //鏄�夋嫨棰�
                 for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
                     log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
                     if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) {
                         continue;
                     }
+                    boolean matchedFlag = false;
                     //鍖呭惈
                     Matcher matcher = null;
                     if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
@@ -1749,8 +1848,12 @@
                         Pattern pattern2 = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
                         matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
                     }
+
                     if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) {
-                        //璇存槑鍖归厤姝g‘浜�
+                        matchedFlag = true;
+                    }
+                    //璇存槑鍖归厤姝g‘浜�
+                    if(matchedFlag){
                         //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
                         log.info("鍖归厤姝g‘浜嗗悧--------------");
                         ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(1);
@@ -1967,6 +2070,7 @@
                         continue;
                     }
                 }
+//            }
                 //閮芥病鏈夊尮閰嶅埌
                 if (StringUtils.isEmpty(phoneCallBackYQVO.getValue())) {
                     log.info("閮芥病鏈夊尮閰嶅埌-------------------------");
@@ -4615,9 +4719,9 @@
     }
 
     @Override
-    public List<ServiceSubtask> gethelibraryCountHyperlink(HeLibraryCountVO heLibraryCountVO){
+    public List<ServiceSubtask> gethelibraryCountHyperlink(HeLibraryCountVO heLibraryCountVO) {
         String hyperLinkInfoType = heLibraryCountVO.getHyperLinkInfoType();
-        if(StringUtils.isNotEmpty(hyperLinkInfoType)){
+        if (StringUtils.isNotEmpty(hyperLinkInfoType)) {
             heLibraryCountVO.setSendstate(null);
             heLibraryCountVO.setIsFinished(null);
             switch (hyperLinkInfoType) {
@@ -4840,4 +4944,396 @@
         }
     }
 
+    public String scanGenerateSubtask(ServiceTask serviceTaskVo) {
+        String content = "";
+        String ip = localIP;
+        ServiceTask serviceTask = new ServiceTask();
+        serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceTaskVo.getTaskid());
+        if (ObjectUtils.isNotEmpty(serviceTask)) {
+            try {
+                ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
+                if (ObjectUtils.isNotEmpty(serviceTaskVo.getDeptcode())) {
+                    serviceTaskdept.setDeptType("1");
+                    serviceTaskdept.setDeptCode(serviceTaskVo.getDeptcode());
+                }
+                if (ObjectUtils.isNotEmpty(serviceTaskVo.getLeavehospitaldistrictcode())) {
+                    serviceTaskdept.setDeptType("2");
+                    serviceTaskdept.setDeptCode(serviceTaskVo.getLeavehospitaldistrictcode());
+                }
+                serviceTaskdept.setServiceType(serviceTask.getServiceType());
+                serviceTaskdept.setOrgid(serviceTask.getOrgid());
+                serviceTaskdept.setTaskId(serviceTaskVo.getTaskid());
+                List<ServiceTaskdept> serviceTaskdepts = serviceTaskdeptService.selectServiceTaskdeptList(serviceTaskdept);
+
+                if (!CollectionUtils.isEmpty(serviceTaskdepts)) {
+                    PatArchive patArchive = new PatArchive();
+                    patArchive.setId(999999999L);
+                    patArchive.setName("铏氭嫙鎮h��");
+                    //灏佽serviceSubtask
+                    ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, serviceTaskdepts.get(0), patArchive);
+                    int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
+                    //鏍规嵁鐢熸垚澶栭摼
+                    if (ObjectUtils.isNotEmpty(serviceSubtask.getTaskid()) && ObjectUtils.isNotEmpty(serviceSubtask.getPatid()) && ObjectUtils.isNotEmpty(serviceSubtask.getId())) {
+                        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+                        String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+                        String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+                        String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
+                        ServiceOutPath serviceOutPath = new ServiceOutPath();
+                        serviceOutPath.setParam1(taskId);
+                        serviceOutPath.setParam2(patid);
+                        serviceOutPath.setParam3(serviceTask.getTaskName());
+                        serviceOutPath.setParam6(subId);
+                        serviceOutPath.setCreateTime(new Date());
+                        serviceOutPath.setOrgid(serviceTask.getOrgid());
+                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+                        String format = String.format("%03X", serviceOutPath.getId());
+                        serviceOutPath.setRadix(format);
+                        serviceOutPath.setUpdateTime(new Date());
+                        String url = ip + ":" + req_path + "/wt?p=" + format;
+                        content = url;
+                        serviceOutPath.setUrl(url);
+                        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("銆愭壂鐮佺敓鎴愪换鍔°�戝鐞嗗紓甯革細{}", e.getMessage());
+            }
+        }
+        return content;
+    }
+
+    public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, ServiceTaskdept serviceTaskdept, PatArchive patArchive) {
+        ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
+        serviceSubtask.setTaskid(serviceTask.getTaskid());
+        if (StringUtils.isNotEmpty(serviceTask.getLibtemplateid()))
+            serviceSubtask.setLibtemplateid(Long.valueOf(serviceTask.getLibtemplateid()));
+//        serviceSubtask.setNurseId(patMedInhosp1.getNurseId());
+//        serviceSubtask.setNurseName(patMedInhosp1.getNurseName());
+//        serviceSubtask.setDrcode(patMedInhosp1.getDrcode());
+//        serviceSubtask.setDrname(patMedInhosp1.getDrname());
+        if(StringUtils.isNotEmpty(serviceTaskdept.getDeptType()) && serviceTaskdept.getDeptType().equals("1")){
+            serviceSubtask.setDeptcode(serviceTaskdept.getDeptCode());
+            serviceSubtask.setDeptname(serviceTaskdept.getDeptName());
+        }else {
+            serviceSubtask.setLeavehospitaldistrictcode(serviceTaskdept.getDeptCode());
+            serviceSubtask.setLeavehospitaldistrictname(serviceTaskdept.getDeptName());
+        }
+        serviceSubtask.setTemplateid(serviceTask.getTemplateid());
+        serviceSubtask.setTemplatename(serviceTask.getTemplatename());
+        serviceSubtask.setPatid(patArchive.getId());
+        serviceSubtask.setSendname(patArchive.getName());
+        serviceSubtask.setSfzh(patArchive.getIdcardno());
+        serviceSubtask.setPhone(patArchive.getTelcode());
+        if (StringUtils.isBlank(patArchive.getTelcode())) serviceSubtask.setPhone(patArchive.getRelativetelcode());
+        serviceSubtask.setSex(patArchive.getSex());
+        serviceSubtask.setAge(patArchive.getAge());
+        serviceSubtask.setSendstate(3L);
+//        serviceSubtask.setManagementDoctor(patMedInhosp1.getManagementDoctor());
+//        serviceSubtask.setManagementDoctorCode(patMedInhosp1.getManagementDoctorCode());
+        serviceSubtask.setServiceType(serviceTask.getServiceType());
+        serviceSubtask.setPreachform(serviceTask.getPreachform());
+        serviceSubtask.setHospType("8");
+        serviceSubtask.setCreateTime(new Date());
+        serviceSubtask.setUpdateTime(new Date());
+//        serviceSubtask.setCreateBy(patMedInhosp1.getNurseName());
+//        serviceSubtask.setLeavehospitaldistrictcode(patMedInhosp1.getLeavehospitaldistrictcode());
+//        serviceSubtask.setLeavehospitaldistrictname(patMedInhosp1.getLeavehospitaldistrictname());
+        serviceSubtask.setUpdateBy(serviceTask.getUpdateBy());
+        serviceSubtask.setUpdateTime(new Date());
+        serviceTask.setSendDay(1L);
+        Date newDate = new Date();
+        serviceSubtask.setLongSendTime(newDate);
+        serviceSubtask.setVisitTime(newDate);
+        return serviceSubtask;
+    }
+
+    /**
+     * Ai 鍖归厤閫夐」
+     * @param questionText
+     * @param voiceText
+     * @param options
+     * @return
+     */
+    public Integer matchOptionIndex(String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options){
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("userQuestion",questionText);
+        jsonObject.put("userAnswer",voiceText);
+        jsonObject.put("options", options);
+        String jsonString = jsonObject.toJSONString();
+        String result = null;
+
+        String url = "http://localhost:8099/matchOptionIndex";
+//        String url = configService.selectConfigByKey("sys.voice.match.ai.url");
+        if(StringUtils.isNotEmpty(url)){
+            try {
+                Map<String, String> headers = new HashMap<>();
+                headers.put("Content-Type", "application/json");
+
+                result = HttpUtils.sendPostByHeader(url, jsonString, headers);
+            } catch (Exception e) {
+                log.error("AI璇嗗埆澶辫触", e);
+            }
+        }
+        if(StringUtils.isNotEmpty(result) && result.matches("^-?\\d+$")){
+            return Integer.parseInt(result);
+        }else {
+            return -1;
+        }
+    }
+
+    public PhoneCallBackYQVO AiMatch(PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO,
+                        IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate,
+                        List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag){
+        PhoneCallBackYQVO back = null;
+        List<IvrTaskTemplateTargetoption> options = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
+        String voiceText = phoneCallReqYQVO.getAsrtext();
+        String questionText = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent();
+        Integer matched = -1;
+        matched = matchOptionIndex(questionText, voiceText, options);
+        //璇存槑鍖归厤姝g‘浜�
+        if(matched != null && matched >= 0){
+            IvrTaskTemplateTargetoption chosenOption = options.get(matched);
+            //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
+            log.info("鍖归厤姝g‘浜嗗悧--------------");
+            chosenOption.setIsUserOperation(1);
+            serviceTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(chosenOption);
+
+            //灏嗘偅鑰呯殑鍥炵鍐欒繘service_subtask_detail涓�
+            ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+            List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+            ivrTaskTemplateScriptVO.setQuestionResult(chosenOption.getOptiondesc());
+            ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+            //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+            if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+                String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+                String[] split = questionvoice.split("\\\\");
+                if (split.length > 0) {
+                    String lastPart = split[split.length - 1];
+                    serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+                }
+            }
+            serviceSubtaskDetailList.add(serviceSubtaskDetail);
+            serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+            serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
+            serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
+            saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+
+            //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+            if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == chosenOption.getIsabnormal()) {
+                ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+                //鐢╰askid銆乻ubid鍜宻criptid鍘昏幏鍙杁etailid
+                ServiceSubtaskDetail ssd = new ServiceSubtaskDetail();
+                ssd.setSubId(serviceSubtask.getId());
+                ssd.setTaskid(serviceSubtask.getTaskid());
+                ssd.setScriptid(StringUtils.isNotEmpty(scriptId) ? Long.valueOf(scriptId) : null);
+                List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(ssd);
+                subtaskDetailTrace.setDetailId(CollectionUtils.isNotEmpty(serviceSubtaskDetails) ? serviceSubtaskDetails.get(0).getId() : null);
+
+                subtaskDetailTrace.setSubId(serviceSubtask.getId());
+                subtaskDetailTrace.setTaskid(serviceSubtask.getTaskid());
+                subtaskDetailTrace.setTemplateid(ivrTaskTemplateScriptVO.getId());
+                subtaskDetailTrace.setTemplatequestionnum(ivrTaskTemplateScriptVO.getScriptno());
+                subtaskDetailTrace.setSwitchid(chosenOption.getId());
+                subtaskDetailTrace.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
+                subtaskDetailTrace.setQuestionvoice(null);
+                subtaskDetailTrace.setCategoryname(ivrTaskTemplateScriptVO.getScriptAssortname());
+                subtaskDetailTrace.setCategoryid(ivrTaskTemplateScriptVO.getScriptAssortid());
+                //鑾峰彇鎵�鏈夐�夐」
+                String optionDescStr = Optional.ofNullable(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()).filter(list -> !list.isEmpty()).map(list -> list.stream().map(IvrTaskTemplateTargetoption::getOptiondesc).filter(Objects::nonNull).collect(Collectors.joining("&"))).orElse("");
+                subtaskDetailTrace.setTargetid(chosenOption.getId());
+                subtaskDetailTrace.setTargetvalue(optionDescStr);
+                subtaskDetailTrace.setMatchedtext(chosenOption.getOptiondesc());
+                subtaskDetailTrace.setValueType(serviceSubtaskDetails.get(0).getValueType());
+                subtaskDetailTrace.setTemplateType(1);
+
+                SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(ivrTaskTemplateScriptVO.getScriptAssortid());
+                subtaskDetailTrace.setType(svyLibScriptCategory.getType());
+                subtaskDetailTrace.setScriptid(ivrTaskTemplateScriptVO.getId());
+                subtaskDetailTrace.setAsrtext(phoneCallReqYQVO.getAsrtext());
+                subtaskDetailTrace.setRecordpath(phoneCallReqYQVO.getRecordpath());
+                subtaskDetailTrace.setPatid(serviceSubtask.getPatid());
+                JSONObject patdescJson = new JSONObject();
+                patdescJson.put("sendname", serviceSubtask.getSendname());
+                patdescJson.put("phone", serviceSubtask.getPhone());
+                patdescJson.put("age", serviceSubtask.getAge());
+                patdescJson.put("sex", serviceSubtask.getSex() != null ? serviceSubtask.getSex() == 1 ? "鐢�" : "濂�" : null);
+                subtaskDetailTrace.setPatdesc(patdescJson.toJSONString());
+                subtaskDetailTrace.setTodeptcode(ivrTaskTemplateScriptVO.getDutyDeptCode());
+                subtaskDetailTrace.setTodeptname(ivrTaskTemplateScriptVO.getDutyDeptName());
+                subtaskDetailTrace.setOrgid(serviceSubtask.getOrgid());
+                subtaskDetailTrace.setHandleFlag("0");
+                subtaskDetailTrace.setGuid(phoneCallReqYQVO.getGuid());
+                subtaskDetailTrace.setCreateTime(new Date());
+                subtaskDetailTrace.setUpdateTime(new Date());
+                subtaskDetailTrace.setOrgid(phoneCallReqYQVO.getOrgid());
+                traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
+            }
+
+            //鍒ゆ柇涓�涓嬶紝杩欎釜閫夐」缁撴灉鏄笉鏄繕鏈夌户缁棶涓嬪幓鐨勫繀瑕侊紝渚嬪閫夐」缁撴灉鏄埆浜轰笉鎯崇户缁洖绛旈棶棰橈紝灏辫缁撴潫鎺�
+            if (chosenOption.getIsEnd() == 1) {
+                redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+                //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+                phoneCallBackYQVO.setType("text");
+                phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+                //璁板綍鐘舵��
+                setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+                return phoneCallBackYQVO;
+            }
+
+            flag = 1;
+            //灏嗗綋鍓嶅墠鐨勬挱鎶ョ姸鎬佸垹闄わ紝缁欎笅涓�棰樿浣�
+            redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+//                        //鑾峰彇涓嬩竴棰�
+            log.error("鑾峰彇涓嬩竴棰樼殑淇℃伅锛歿}", ivrTaskTemplateScriptVO);
+            if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
+                Long nextQuestion = null;
+                if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
+                    nextQuestion = chosenOption.getNextQuestion();
+                    //鏇存柊鍒嗘暟
+                    double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                    score = BigDecimal.valueOf(score).add(chosenOption.getScore()).doubleValue();
+                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score);
+                } else {
+                    nextQuestion = ivrTaskTemplateScriptVO.getNextScriptno();
+                    //鏇存柊鍒嗘暟
+                    Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                    Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
+                    score = BigDecimal.valueOf(score).add(chosenOption.getScore()).doubleValue();
+                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
+                }
+                if (nextQuestion == null || nextQuestion == 0L) {
+                    //濡傛灉涓嬩竴棰樹负绌猴紝鎴栬�呬负0锛屽垯鎸傛満
+                    ServiceSubtask ss = new ServiceSubtask();
+                    ss.setId(serviceSubtask.getId());
+                    ss.setSendstate(6L);
+                    ss.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+                    serviceSubtaskMapper.updateServiceSubtask(ss);
+                    //璁板綍鐘舵��
+                    setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+
+                    redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+                    redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                    redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+                    redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+                    //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                    ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+                    phoneCallBackYQVO.setType("text");
+                    phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+                    //灏嗙粨鏋滃啓杩沝etail琛�
+                    ServiceSubTaskDetailReq ssdReq = new ServiceSubTaskDetailReq();
+                    List<ServiceSubtaskDetail> serviceSubtaskDetailList2 = new ArrayList<>();
+                    serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
+                    serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList2);
+                    ssdReq.setGuid(phoneCallReqYQVO.getGuid());
+                    ssdReq.setOrgid(phoneCallReqYQVO.getOrgid());
+                    saveQuestionAnswerPhone(ssdReq);
+                    return phoneCallBackYQVO;
+                }
+
+                for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
+                    if (script.getSort() == nextQuestion.intValue()) {
+                        phoneCallBackYQVO.setType("text");
+                        phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+                        String scriptContent = StringUtils.isNotEmpty(script.getIvrtext()) ? script.getIvrtext() : script.getScriptContent();
+                        log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
+                        log.error("涓嬩竴棰樼殑瀛愪换鍔℃槸锛歿}", serviceSubtask);
+                        phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
+                        //灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
+                        redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
+                        //鍒犻櫎鏃犲搷搴�
+                        redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+                    }
+                }
+            } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
+                ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+                phoneCallBackYQVO.setType("text");
+                phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+                //鏇存柊涓�涓嬪垎鏁�
+                double score = 0.0;
+                Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                if (ObjectUtils.isNotEmpty(scoreObj)) score = (double) scoreObj;
+                serviceSubtask.setScore(BigDecimal.valueOf(score));
+                serviceSubtask.setFinishtime(new Date());
+                serviceSubtask.setSendstate(6L);
+                serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+                serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+                //璁板綍鐘舵��
+                setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+                //璁剧疆缁撴潫璇�
+                phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
+                Long id = serviceSubtask.getId();
+                Map<String, String> map = delRedisValue(null, id.toString());
+                log.error("map鐨勫�间负锛歿}", map);
+                if (ObjectUtils.isNotEmpty(map))
+                    redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
+                redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+                redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+                //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+//                                return phoneCallBackYQVO;
+
+            }
+        } else {
+            log.info("娌℃湁鍖归厤涓�----------------------------");
+            //flag=0,璇存槑娌� 鍖归厤涓婏紝涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵
+            if (matched == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
+                ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+                List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+                ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+                //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+                if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+                    String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+                    String[] split = questionvoice.split("\\\\");
+                    if (split.length > 0) {
+                        String lastPart = split[split.length - 1];
+                        serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+                    }
+                }
+                serviceSubtaskDetailList.add(serviceSubtaskDetail);
+                //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
+                serviceSubtaskDetailList.get(0).setMatchedtext("");
+                serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+                serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
+                serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
+                saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+            }
+        }
+        return back;
+    }
+
+    @Test
+    public void TestMatch(){
+        String questionText = "鎮ㄥソ,璇烽棶鎮ㄦ槸鎮h�呮湰浜鸿繕鏄灞烇紵\n";
+        String voiceText = "鎴戣嚜宸�";
+        String matchedText = "";
+        List<IvrTaskTemplateTargetoption> options = new ArrayList<>();
+        IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption1 = new IvrTaskTemplateTargetoption();
+        ivrTaskTemplateTargetoption1.setTargetvalue("鏈汉");
+        options.add(ivrTaskTemplateTargetoption1);
+        IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption2 = new IvrTaskTemplateTargetoption();
+        ivrTaskTemplateTargetoption2.setTargetvalue("瀹跺睘");
+        options.add(ivrTaskTemplateTargetoption2);
+        IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption3 = new IvrTaskTemplateTargetoption();
+        ivrTaskTemplateTargetoption3.setTargetvalue("鍏朵粬");
+        options.add(ivrTaskTemplateTargetoption3);
+
+        Integer matched = matchOptionIndex(questionText,voiceText,options);
+        if(ObjectUtils.isNotEmpty(matched)){
+            if(matched >= 0){
+                matchedText = options.get(matched).getTargetvalue();
+            }
+        }
+        log.info("ai鍖归厤鎴愬姛锛屽尮閰嶇粨鏋滄槸:" + matchedText);
+    }
 }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
index 44f8c04..b48ce3b 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -456,6 +456,7 @@
             serviceSubtaskVO.setPatid(patid);
         }
         List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+        List<SvyTaskTemplateScriptVO> svyTaskTemplateScriptVOS = null;
         if (CollectionUtils.isNotEmpty(serviceSubtaskList) && serviceSubtaskList.size() == 1) {
             if (serviceSubtaskList.get(0).getSendstate() == 3 && isFinish == true) {
                 ServiceSubtask serviceSubtask = new ServiceSubtask();
@@ -464,22 +465,25 @@
                 serviceSubtask.setTaskid(serviceTask.getTaskid());
                 serviceSubtaskMapper.updateServiceSubtaskByPatId(serviceSubtask);
             }
-        }
-        //閫氳繃妯℃澘ID鑾峰彇闂淇℃伅
-        SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript();
-        svyTaskTemplateScript.setTemplateID(Long.valueOf(serviceTask.getTemplateid()));
-        if (serviceTask.getTemplateid() != null) svyTaskTemplateScript.setTemplateID(serviceTask.getTemplateid());
-        svyTaskTemplateScript.setDelFlag("0");
-        List<SvyTaskTemplateScript> svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
-        if (CollectionUtils.isEmpty(svyTaskTemplateScripts) || svyTaskTemplateScripts.size() == 0) {
-            insertSvyTaskTempScript(null, serviceTask);
-            svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
-            if (CollectionUtils.isEmpty(svyTaskTemplateScripts)) {
-                throw new BaseException("璇疯仈绯荤鐞嗗憳锛屾鏌ラ棶棰樻ā鏉夸俊鎭�!");
-            }
-        }
-        List<SvyTaskTemplateScriptVO> svyTaskTemplateScriptVOS = DtoConversionUtils.sourceToTarget(svyTaskTemplateScripts, SvyTaskTemplateScriptVO.class);
 
+            //閫氳繃妯℃澘ID鑾峰彇闂淇℃伅
+            SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript();
+            svyTaskTemplateScript.setTemplateID(Long.valueOf(serviceTask.getTemplateid()));
+            if (serviceSubtaskList.get(0).getTemplateid() != null)
+                svyTaskTemplateScript.setTemplateID(serviceSubtaskList.get(0).getTemplateid());
+            else if (serviceTask.getTemplateid() != null)
+                svyTaskTemplateScript.setTemplateID(serviceTask.getTemplateid());
+            svyTaskTemplateScript.setDelFlag("0");
+            List<SvyTaskTemplateScript> svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
+            if (CollectionUtils.isEmpty(svyTaskTemplateScripts) || svyTaskTemplateScripts.size() == 0) {
+                insertSvyTaskTempScript(null, serviceTask);
+                svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
+                if (CollectionUtils.isEmpty(svyTaskTemplateScripts)) {
+                    throw new BaseException("璇疯仈绯荤鐞嗗憳锛屾鏌ラ棶棰樻ā鏉夸俊鎭�!");
+                }
+            }
+            svyTaskTemplateScriptVOS = DtoConversionUtils.sourceToTarget(svyTaskTemplateScripts, SvyTaskTemplateScriptVO.class);
+        }
         //鑾峰彇鎮h�呬俊鎭�
         PatArchive patArchive = null;
         if (patfrom.equals("0")) patArchive = patArchiveMapper.selectPatArchiveByPatid(patid);
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
index 5acb4b3..7a91b76 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
@@ -55,13 +55,20 @@
         <result property="reportDeptName" column="report_dept_code"/>
         <result property="isMydException" column="is_myd_exception"/>
         <result property="dimension" column="dimension"/>
-
+        <result property="dutyDeptPersonName" column="duty_dept_person_name"/>
+        <result property="dutyDeptPersonCode" column="duty_dept_person_code"/>
+        <result property="reportDeptPersonCode" column="report_dept_person_name"/>
+        <result property="reportDeptPersonName" column="report_dept_person_code"/>
     </resultMap>
 
     <sql id="selectIvrLibaTemplateScriptVo">
         select id,
                scriptno,
                is_myd_exception,
+               duty_dept_person_name,
+               duty_dept_person_code,
+               report_dept_person_name,
+               report_dept_person_code,
                dimension,
                sort,
                script_assortname,
@@ -174,6 +181,18 @@
         <if test="scriptType != null">and script_type = #{scriptType}</if>
         <if test="sort != null">and sort = #{sort}</if>
         <if test="score != null">and score = #{score}</if>
+        <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">and duty_dept_person_name like concat('%', #{dutyDeptPersonName},
+            '%')
+        </if>
+        <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">and duty_dept_person_code like concat('%', #{dutyDeptPersonCode},
+            '%')
+        </if>
+        <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">and report_dept_person_name like concat('%', #{reportDeptPersonName},
+            '%')
+        </if>
+        <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">and report_dept_person_code like concat('%', #{reportDeptPersonCode},
+            '%')
+        </if>
     </select>
 
 
@@ -187,6 +206,18 @@
                 </foreach>
             </if>
             <if test="dimensionList == null ">and dimension IS NOT NULL </if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">and duty_dept_person_name like concat('%', #{dutyDeptPersonName},
+                '%')
+            </if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">and duty_dept_person_code like concat('%', #{dutyDeptPersonCode},
+                '%')
+            </if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">and report_dept_person_name like concat('%', #{reportDeptPersonName},
+                '%')
+            </if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">and report_dept_person_code like concat('%', #{reportDeptPersonCode},
+                '%')
+            </if>
         </where>
     </select>
 
@@ -248,6 +279,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code,</if>
             <if test="isMydException != null  and isMydException != ''">is_myd_exception,</if>
             <if test="dimension != null  and dimension != ''">dimension,</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name,</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code,</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name,</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="scriptno != null">#{scriptno},</if>
@@ -298,6 +333,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
             <if test="isMydException != null  and isMydException != ''">#{isMydException},</if>
             <if test="dimension != null  and dimension != ''">#{dimension},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">#{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">#{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">#{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">#{reportDeptPersonCode},</if>
         </trim>
     </insert>
 
@@ -331,6 +370,10 @@
             <if test="orgid != null">orgid = #{orgid},</if>
             <if test="pid != null">pid = #{pid},</if>
             <if test="guid != null">guid = #{guid},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name = #{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code = #{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name = #{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code = #{reportDeptPersonCode},</if>
             <if test="targetid != null">targetid = #{targetid},</if>
             <if test="scriptTopic != null">script_topic = #{scriptTopic},</if>
             <if test="nextScriptno != null">next_scriptno = #{nextScriptno},</if>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
index 2be2ecf..5643206 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
@@ -55,6 +55,10 @@
         <result property="reportDeptName" column="report_dept_code"/>
         <result property="dimension" column="dimension"/>
         <result property="isMydException" column="is_myd_exception"/>
+        <result property="dutyDeptPersonName" column="duty_dept_person_name"/>
+        <result property="dutyDeptPersonCode" column="duty_dept_person_code"/>
+        <result property="reportDeptPersonCode" column="report_dept_person_name"/>
+        <result property="reportDeptPersonName" column="report_dept_person_code"/>
     </resultMap>
 
     <sql id="selectIvrTaskTemplateScriptVo">
@@ -67,6 +71,10 @@
                report_dept_name,
                report_dept_code,
                script_assortid,
+               duty_dept_person_name,
+               duty_dept_person_code,
+               report_dept_person_name,
+               report_dept_person_code,
                sort,
                ivrtext,
                script_type,
@@ -154,6 +162,22 @@
         <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
             #{branchNextscriptno}
         </if>
+        <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">and duty_dept_person_name like concat('%',
+            #{dutyDeptPersonName},
+            '%')
+        </if>
+        <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">and duty_dept_person_code like concat('%',
+            #{dutyDeptPersonCode},
+            '%')
+        </if>
+        <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">and report_dept_person_name like concat('%',
+            #{reportDeptPersonName},
+            '%')
+        </if>
+        <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">and report_dept_person_code like concat('%',
+            #{reportDeptPersonCode},
+            '%')
+        </if>
     </select>
 
     <select id="selectIvrTaskTemplateScriptByID" parameterType="Long" resultMap="IvrTaskTemplateScriptResult">
@@ -213,6 +237,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code,</if>
             <if test="dimension != null  and dimension != ''">dimension,</if>
             <if test="isMydException != null  and isMydException != ''">is_myd_exception,</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name,</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code,</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name,</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -263,6 +291,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
             <if test="dimension != null  and dimension != ''">#{dimension},</if>
             <if test="isMydException != null  and isMydException != ''">#{isMydException},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">#{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">#{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">#{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">#{reportDeptPersonCode},</if>
         </trim>
     </insert>
 
@@ -319,6 +351,10 @@
             <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code = #{dutyDeptCode},</if>
             <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name = #{reportDeptName},</if>
             <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code = #{reportDeptCode},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name = #{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code = #{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name = #{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code = #{reportDeptPersonCode},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index b51c18d..903ceaa 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -189,7 +189,6 @@
             <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
             <if test="sourcefrom != null ">and sourcefrom = #{sourcefrom}</if>
             <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
             <if test="id != null  and id != ''">and id = #{id}</if>
             <if test="isupload != null ">and isupload = #{isupload}</if>
             <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
@@ -214,7 +213,7 @@
             <if test="casePersonAge != null ">and case_person_age = #{casePersonAge}</if>
             <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if>
             <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if>
-            <if test="campusid != null ">and campusid = #{campusid}</if>
+        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 
 
@@ -932,10 +931,9 @@
         d.leavehospitaldistrictcode AS leavehospitaldistrictcode
         FROM
         pat_med_inhosp d
-        JOIN pat_archive a ON a.id = d.patid
+        LEFT JOIN pat_archive a ON a.id = d.patid
         where 1=1
             and d.del_flag != 1
-            AND a.del_flag != 1
             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>
@@ -1005,7 +1003,7 @@
             </if>
 
             <if test="pids != null">
-                AND a.id NOT IN
+                AND d.patid NOT IN
                 <foreach collection="pids" item="pid" open="(" separator="," close=")">
                     #{pid}
                 </foreach>
@@ -1201,12 +1199,10 @@
 
     <!-- 浣忛櫌鎮h�呮�绘暟缁熻锛堝幓閲嶏級 -->
     <select id="countPatArchiveInfoByInhospQC" parameterType="com.smartor.domain.PatArchiveReq" resultType="long">
-        SELECT COUNT(DISTINCT a.id)
+        SELECT COUNT(DISTINCT d.patid)
         FROM pat_med_inhosp d
-        JOIN pat_archive a ON a.id = d.patid
         WHERE 1=1
             AND d.del_flag != 1
-            AND a.del_flag != 1
             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>
@@ -1250,7 +1246,7 @@
                 </foreach>
             </if>
             <if test="pids != null">
-                AND a.id NOT IN
+                AND d.patid NOT IN
                 <foreach collection="pids" item="pid" open="(" separator="," close=")">
                     #{pid}
                 </foreach>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml
index c3220e6..05dc624 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml
@@ -55,10 +55,18 @@
         <result property="templateType" column="template_type"/>
         <result property="isMydException" column="is_myd_exception"/>
         <result property="dimension" column="dimension"/>
+        <result property="dutyDeptPersonName" column="duty_dept_person_name"/>
+        <result property="dutyDeptPersonCode" column="duty_dept_person_code"/>
+        <result property="reportDeptPersonCode" column="report_dept_person_name"/>
+        <result property="reportDeptPersonName" column="report_dept_person_code"/>
     </resultMap>
 
     <sql id="selectServiceSubtaskDetailTtraceVo">
         select id,
+               duty_dept_person_name,
+               duty_dept_person_code,
+               report_dept_person_name,
+               report_dept_person_code,
                detail_id,
                is_myd_exception,
                dimension,
@@ -257,6 +265,19 @@
         <if test="isMydException != null ">
             and is_myd_exception = #{isMydException}
         </if>
+        <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">
+            and duty_dept_person_name like concat('%', #{dutyDeptPersonName}, '%')
+        </if>
+        <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">
+            and duty_dept_person_code like concat('%', #{dutyDeptPersonCode}, '%')
+        </if>
+        <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">
+            and report_dept_person_name like concat('%', #{reportDeptPersonName}, '%')
+        </if>
+        <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">
+            and report_dept_person_code like concat('%', #{reportDeptPersonCode}, '%')
+        </if>
+        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 
     <select id="tracedeallist" parameterType="com.smartor.domain.VO.DetailTraceDealVO"
@@ -292,6 +313,18 @@
         </if>
         <if test="dimension != null  and dimension != ''">
             and dimension = #{dimension}
+        </if>
+        <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">
+            and duty_dept_person_name like concat('%', #{dutyDeptPersonName}, '%')
+        </if>
+        <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">
+            and duty_dept_person_code like concat('%', #{dutyDeptPersonCode}, '%')
+        </if>
+        <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">
+            and report_dept_person_name like concat('%', #{reportDeptPersonName}, '%')
+        </if>
+        <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">
+            and report_dept_person_code like concat('%', #{reportDeptPersonCode}, '%')
         </if>
     </select>
 
@@ -406,6 +439,14 @@
             </if>
             <if test="isMydException != null">is_myd_exception,
             </if>
+            <if test="dutyDeptPersonName != null">duty_dept_person_name,
+            </if>
+            <if test="dutyDeptPersonCode != null">duty_dept_person_code,
+            </if>
+            <if test="reportDeptPersonName != null">report_dept_person_name,
+            </if>
+            <if test="reportDeptPersonCode != null">report_dept_person_code,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="detailId != null">#{detailId},
@@ -507,6 +548,14 @@
             <if test="dimension != null">#{dimension},
             </if>
             <if test="isMydException != null">#{isMydException},
+            </if>
+            <if test="dutyDeptPersonName != null">#{dutyDeptPersonName},
+            </if>
+            <if test="dutyDeptPersonCode != null">#{dutyDeptPersonCode},
+            </if>
+            <if test="reportDeptPersonName != null">#{reportDeptPersonName},
+            </if>
+            <if test="reportDeptPersonCode != null">#{reportDeptPersonCode},
             </if>
         </trim>
     </insert>
@@ -664,6 +713,18 @@
             <if test="isMydException != null">is_myd_exception =
                 #{isMydException},
             </if>
+            <if test="dutyDeptPersonName != null">duty_dept_person_name =
+                #{dutyDeptPersonName},
+            </if>
+            <if test="dutyDeptPersonCode != null">duty_dept_person_code =
+                #{dutyDeptPersonCode},
+            </if>
+            <if test="reportDeptPersonName != null">report_dept_person_name =
+                #{reportDeptPersonName},
+            </if>
+            <if test="reportDeptPersonCode != null">report_dept_person_code =
+                #{reportDeptPersonCode},
+            </if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index d19b011..f2a3b85 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -486,6 +486,7 @@
         <if test="isupload != null ">and isupload = #{isupload}</if>
         <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
         <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="campusid != null  and campusid != ''">and campusid = #{campusid}</if>
         <if test="pid != null ">and pid = #{pid}</if>
         <if test="preachform != null ">and preachform = #{preachform}</if>
         <if test="currentPreachform != null ">and current_preachform = #{currentPreachform}</if>
@@ -2525,7 +2526,8 @@
         SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq,
         SUM(CASE WHEN sendstate = 4 THEN 1 ELSE 0 END) AS wxsf,
         SUM(CASE WHEN sendstate != 4 THEN 1 ELSE 0 END) AS xsf,
-        SUM(CASE WHEN (sendstate = 1 OR sendstate = 2 OR sendstate = 3 OR sendstate = 5 OR sendstate = 7 ) THEN 1 ELSE 0 END) AS dsf,
+        SUM(CASE WHEN (sendstate = 1 OR sendstate = 2 OR sendstate = 3 OR sendstate = 5 OR sendstate = 7 ) THEN 1 ELSE 0
+        END) AS dsf,
         SUM(CASE WHEN sendstate = 6 THEN 1 ELSE 0 END) AS ywc,
         SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS yc,
         SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg,
@@ -2689,6 +2691,9 @@
         <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
         </if>
+        <if test="campusid != null and campusid != ''">
+            AND campusid = #{campusid}
+        </if>
         <if test="guid != null and guid != ''">
             AND guid = #{guid}
         </if>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
index 6b35bc6..6698f3f 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
@@ -50,6 +50,10 @@
         <result property="dutyDeptCode" column="duty_dept_code"/>
         <result property="reportDeptCode" column="report_dept_name"/>
         <result property="reportDeptName" column="report_dept_code"/>
+        <result property="dutyDeptPersonName" column="duty_dept_person_name"/>
+        <result property="dutyDeptPersonCode" column="duty_dept_person_code"/>
+        <result property="reportDeptPersonCode" column="report_dept_person_name"/>
+        <result property="reportDeptPersonName" column="report_dept_person_code"/>
         <result property="isMydException" column="is_myd_exception"/>
         <result property="dimension" column="dimension"/>
 
@@ -64,6 +68,10 @@
                duty_dept_code,
                report_dept_name,
                report_dept_code,
+               duty_dept_person_name,
+               duty_dept_person_code,
+               report_dept_person_name,
+               report_dept_person_code,
                targetid,
                group_name,
                targetname,
@@ -168,6 +176,22 @@
                 #{categoryid}
             </foreach>
         </if>
+        <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">and duty_dept_person_name like concat('%',
+            #{dutyDeptPersonName},
+            '%')
+        </if>
+        <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">and duty_dept_person_code like concat('%',
+            #{dutyDeptPersonCode},
+            '%')
+        </if>
+        <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">and report_dept_person_name like concat('%',
+            #{reportDeptPersonName},
+            '%')
+        </if>
+        <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">and report_dept_person_code like concat('%',
+            #{reportDeptPersonCode},
+            '%')
+        </if>
         <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 
@@ -179,6 +203,22 @@
                 <foreach item="dimension" collection="dimensionList" open="(" separator="," close=")">
                     #{dimension}
                 </foreach>
+            </if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">and duty_dept_person_name like concat('%',
+                #{dutyDeptPersonName},
+                '%')
+            </if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">and duty_dept_person_code like concat('%',
+                #{dutyDeptPersonCode},
+                '%')
+            </if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">and report_dept_person_name like concat('%',
+                #{reportDeptPersonName},
+                '%')
+            </if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">and report_dept_person_code like concat('%',
+                #{reportDeptPersonCode},
+                '%')
             </if>
             <if test="dimensionList == null ">and dimension IS NOT NULL </if>
         </where>
@@ -240,6 +280,10 @@
             <if test="categoryName != null  and categoryName != ''">categoryName,</if>
             <if test="isMydException != null  and isMydException != ''">is_myd_exception,</if>
             <if test="dimension != null  and dimension != ''">dimension,</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name,</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code,</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name,</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="nextScriptno != null">#{nextScriptno},</if>
@@ -289,6 +333,10 @@
             <if test="categoryName != null  and categoryName != ''">#{categoryName},</if>
             <if test="isMydException != null  and isMydException != ''">#{isMydException},</if>
             <if test="dimension != null  and dimension != ''">#{dimension},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">#{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">#{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">#{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">#{reportDeptPersonCode},</if>
         </trim>
     </insert>
 
@@ -344,6 +392,10 @@
             <if test="categoryName != null  and categoryName != ''">categoryName = #{categoryName},</if>
             <if test="isMydException != null  and isMydException != ''">is_myd_exception = #{isMydException},</if>
             <if test="dimension != null  and dimension != ''">dimension = #{dimension},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name = #{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code = #{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name = #{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code = #{reportDeptPersonCode},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
index 31eb308..73aee0e 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
@@ -93,45 +93,45 @@
             resultMap="SvyTaskTemplateResult">
         <include refid="selectSvyTaskTemplateVo"/>
         where 1=1
-            and del_flag = 0
-            <if test="templateid != null ">and templateid = #{templateid}</if>
-            <if test="id != null ">and id = #{id}</if>
-            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
-            <if test="svycode != null  and svycode != ''">and svycode = #{svycode}</if>
-            <if test="svyname != null  and svyname != ''">and svyname like concat('%', #{svyname}, '%')</if>
-            <if test="description != null  and description != ''">and description = #{description}</if>
-            <if test="introduce != null  and introduce != ''">and introduce = #{introduce}</if>
-            <if test="submitprompt != null  and submitprompt != ''">and submitprompt = #{submitprompt}</if>
-            <if test="tag != null  and tag != ''">and tag = #{tag}</if>
-            <if test="version != null ">and version = #{version}</if>
-            <if test="centerlibrarycode != null  and centerlibrarycode != ''">and centerlibrarycode =
-                #{centerlibrarycode}
-            </if>
-            <if test="centerlibraryid != null ">and centerlibraryid = #{centerlibraryid}</if>
-            <if test="islocal != null ">and islocal = #{islocal}</if>
-            <if test="isenable != null  and isenable != ''">and isenable = #{isenable}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="taskScriptId != null  and taskScriptId != ''">and task_script_id = #{taskScriptId}</if>
-            <if test="pid != null ">and pid = #{pid}</if>
-            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
-            <if test="deptNames != null  and deptNames != ''">and dept_names = #{deptNames}</if>
-            <if test="labelInfo != null  and labelInfo != ''">and label_info = #{labelInfo}</if>
-            <if test="campus != null  and campus != ''">and campus = #{campus}</if>
-            <if test="suitway != null  and suitway != ''">and suitway = #{suitway}</if>
-            <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
-            <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
-            <if test="reply != null  and reply != ''">and reply = #{reply}</if>
-            <if test="taskid != null ">and taskid = #{taskid}</if>
-            <if test="deptCode != null ">and dept_code = #{deptCode}</if>
-            <if test="longTemp != null ">and long_temp = #{longTemp}</if>
-            <if test="sendDay != null ">and send_day = #{sendDay}</if>
+        and del_flag = 0
+        <if test="templateid != null ">and templateid = #{templateid}</if>
+        <if test="id != null ">and id = #{id}</if>
+        <if test="categoryid != null ">and categoryid = #{categoryid}</if>
+        <if test="svycode != null  and svycode != ''">and svycode = #{svycode}</if>
+        <if test="svyname != null  and svyname != ''">and svyname like concat('%', #{svyname}, '%')</if>
+        <if test="description != null  and description != ''">and description = #{description}</if>
+        <if test="introduce != null  and introduce != ''">and introduce = #{introduce}</if>
+        <if test="submitprompt != null  and submitprompt != ''">and submitprompt = #{submitprompt}</if>
+        <if test="tag != null  and tag != ''">and tag = #{tag}</if>
+        <if test="version != null ">and version = #{version}</if>
+        <if test="centerlibrarycode != null  and centerlibrarycode != ''">and centerlibrarycode =
+            #{centerlibrarycode}
+        </if>
+        <if test="centerlibraryid != null ">and centerlibraryid = #{centerlibraryid}</if>
+        <if test="islocal != null ">and islocal = #{islocal}</if>
+        <if test="isenable != null  and isenable != ''">and isenable = #{isenable}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="taskScriptId != null  and taskScriptId != ''">and task_script_id = #{taskScriptId}</if>
+        <if test="pid != null ">and pid = #{pid}</if>
+        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
+        <if test="deptNames != null  and deptNames != ''">and dept_names = #{deptNames}</if>
+        <if test="labelInfo != null  and labelInfo != ''">and label_info = #{labelInfo}</if>
+        <if test="campus != null  and campus != ''">and campus = #{campus}</if>
+        <if test="suitway != null  and suitway != ''">and suitway = #{suitway}</if>
+        <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
+        <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
+        <if test="reply != null  and reply != ''">and reply = #{reply}</if>
+        <if test="taskid != null ">and taskid = #{taskid}</if>
+        <if test="deptCode != null ">and dept_code = #{deptCode}</if>
+        <if test="longTemp != null ">and long_temp = #{longTemp}</if>
+        <if test="sendDay != null ">and send_day = #{sendDay}</if>
     </select>
 
     <select id="selectSvyTaskTemplateBySvyid" parameterType="Long" resultMap="SvyTaskTemplateResult">
         <include refid="selectSvyTaskTemplateVo"/>
-        where del_flag=0 and  id = #{id}
+        where del_flag=0 and id = #{id}
     </select>
 
     <insert id="insertSvyTaskTemplate" parameterType="com.smartor.domain.SvyTaskTemplate" useGeneratedKeys="true"
@@ -265,8 +265,8 @@
     </update>
 
     <delete id="deleteSvyTaskTemplateBySvyid" parameterType="Long">
-        delete
-        from svy_task_template
+        update svy_task_template
+        set del_flag=1
         where id = #{id}
     </delete>
 
diff --git a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
index 3941b15..64ed434 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
@@ -49,6 +49,10 @@
         <result property="dutyDeptCode" column="duty_dept_code"/>
         <result property="reportDeptCode" column="report_dept_name"/>
         <result property="reportDeptName" column="report_dept_code"/>
+        <result property="dutyDeptPersonName" column="duty_dept_person_name"/>
+        <result property="dutyDeptPersonCode" column="duty_dept_person_code"/>
+        <result property="reportDeptPersonCode" column="report_dept_person_name"/>
+        <result property="reportDeptPersonName" column="report_dept_person_code"/>
         <result property="isMydException" column="is_myd_exception"/>
         <result property="dimension" column="dimension"/>
     </resultMap>
@@ -77,6 +81,7 @@
                templateID,
                scriptid,
                script_topic, language, categoryName, script_content, is_must, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, value_type, targetoptions, script_type, targetid, targetvalue, next_scriptno, script_result, otherdata, picture_path
+                , duty_dept_person_name, duty_dept_person_code, report_dept_person_name, report_dept_person_code
         from svy_task_template_script
     </sql>
 
@@ -135,6 +140,18 @@
             <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
                 #{branchNextscriptno}
             </if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">and duty_dept_person_name like concat('%', #{dutyDeptPersonName},
+                '%')
+            </if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">and duty_dept_person_code like concat('%', #{dutyDeptPersonCode},
+                '%')
+            </if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">and report_dept_person_name like concat('%', #{reportDeptPersonName},
+                '%')
+            </if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">and report_dept_person_code like concat('%', #{reportDeptPersonCode},
+                '%')
+            </if>
     </select>
 
     <select id="selectSvyTaskTemplateScriptByID" parameterType="Long" resultMap="SvyTaskTemplateScriptResult">
@@ -191,6 +208,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''"> report_dept_code,</if>
             <if test="isMydException != null ">is_myd_exception,</if>
             <if test="dimension != null ">dimension,</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name,</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code,</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name,</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -238,6 +259,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
             <if test="isMydException != null ">#{isMydException},</if>
             <if test="dimension != null ">#{dimension},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">#{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">#{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">#{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">#{reportDeptPersonCode},</if>
         </trim>
     </insert>
 
@@ -291,6 +316,10 @@
             <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code = #{reportDeptCode},</if>
             <if test="isMydException != null ">is_myd_exception = #{isMydException},</if>
             <if test="dimension != null ">dimension = #{dimension},</if>
+            <if test="dutyDeptPersonName != null  and dutyDeptPersonName != ''">duty_dept_person_name = #{dutyDeptPersonName},</if>
+            <if test="dutyDeptPersonCode != null  and dutyDeptPersonCode != ''">duty_dept_person_code = #{dutyDeptPersonCode},</if>
+            <if test="reportDeptPersonName != null  and reportDeptPersonName != ''">report_dept_person_name = #{reportDeptPersonName},</if>
+            <if test="reportDeptPersonCode != null  and reportDeptPersonCode != ''">report_dept_person_code = #{reportDeptPersonCode},</if>
         </trim>
         where id = #{d}
     </update>

--
Gitblit v1.9.3