From 569e8be78cc357147a403daa1af8dfe6dd7d5308 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 18 八月 2026 18:22:10 +0800
Subject: [PATCH] 1.处理药品宣教的问题 2.处理南华满意度的功能 3.处理随访导出的问题 4.处理南华短信的问题

---
 smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java   |   38 
 smartor/src/main/java/com/smartor/domain/SvyTopicoption.java                                 |    2 
 smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java                                  |    2 
 smartor/src/main/resources/mapper/smartor/ServiceTaskmedicalMapper.xml                       |   13 
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java                    |    2 
 smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java                     |   16 
 smartor/src/main/java/com/smartor/domain/SvyLibScript.java                                   |    2 
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml                             |   42 +
 ruoyi-common/src/main/java/com/ruoyi/common/dx/MessageSend.java                              |    2 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskExportVO.java                         |    2 
 smartor/src/main/java/com/smartor/domain/SvyLibResult.java                                   |  160 +---
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java                    |    4 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml                     |   30 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java          |  212 ++++--
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java                          |    2 
 smartor/src/main/java/com/smartor/domain/VO/ServiceTaskmedicalVO.java                        |   34 +
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java                          |    2 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java                     |    2 
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java                        |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java                 |    6 
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java                        |    2 
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml                               |    5 
 smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java                |    7 
 smartor/src/main/java/com/smartor/service/impl/ServiceTaskmedicalServiceImpl.java            |   37 
 smartor/src/main/java/com/smartor/domain/SvyFinishoption.java                                |  126 ---
 smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java               |   74 +
 smartor/src/main/java/com/smartor/domain/ServiceSubtask.java                                 |    2 
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java                    |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/MedicationItemController.java     |   11 
 smartor/src/main/java/com/smartor/mapper/ServiceTaskmedicalMapper.java                       |    3 
 smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java                  |   94 +-
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java                |  571 +++++++++--------
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java                              |    2 
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java                          |    2 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java                        |    6 
 smartor/src/main/java/com/smartor/domain/VO/TransferDeptVO.java                              |   61 +
 smartor/src/main/java/com/smartor/domain/SvyFinishtopic.java                                 |  106 ---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskmedicalController.java |   18 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java                           |    2 
 smartor/src/main/java/com/smartor/domain/SvyFinish.java                                      |  169 ----
 smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java                        |    8 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                           |   23 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java                         |    2 
 smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java                            |    2 
 smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java                             |    2 
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                                 |   21 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java     |   13 
 smartor/src/main/java/com/smartor/domain/PatMedInhosp.java                                   |   10 
 smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java                    |    2 
 smartor/src/main/java/com/smartor/service/IServiceTaskmedicalService.java                    |    8 
 smartor/src/main/java/com/smartor/domain/SvyTaskScriptoption.java                            |    2 
 smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java             |    6 
 52 files changed, 958 insertions(+), 1,016 deletions(-)

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 6a16085..fbbb261 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
@@ -127,7 +127,7 @@
             serviceOutPath.setRadix(format);
             serviceOutPath.setCreateTime(new Date());
             serviceOutPath.setOrgid(vo.getOrgid());
-            String url = ip + ":" + req_path + "/wt?p=" + format;
+            String url = StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format;
             content = "鎮ㄥソ锛岄個璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + url + "濉啓銆傛劅璋㈡偍閰嶅悎锛�";
             serviceOutPath.setUrl(url);
             iServiceOutPathService.insertServiceOutPath(serviceOutPath);
@@ -222,7 +222,7 @@
             serviceOutPath.setCreateTime(new Date());
             serviceOutPath.setOrgid(vo.getOrgid());
             iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-            String url = ip + ":" + req_path + "/wt?p=" + format;
+            String url = StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format;
             sendMsg = smsUtils.sendChat(url, vo.getPhone(), vo.getIdCard());
         }
         return AjaxResult.success(sendMsg);
@@ -251,7 +251,7 @@
             serviceOutPath.setRadix(format);
             serviceOutPath.setCreateTime(new Date());
             serviceOutPath.setOrgid(vo.getOrgid());
-            String url = ip + ":" + req_path + "/wt?p=" + format;
+            String url = StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format;
 //            content = "鎮ㄥソ锛岄個璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + url + "濉啓銆傛劅璋㈡偍閰嶅悎锛�";
             content = url;
             serviceOutPath.setUrl(url);
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/MedicationItemController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/MedicationItemController.java
index 6d90b67..594e89e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/MedicationItemController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/MedicationItemController.java
@@ -6,6 +6,7 @@
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.smartor.domain.MedicationItem;
 import com.smartor.service.IMedicationItemService;
@@ -16,6 +17,7 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 鑽搧淇℃伅Controller
@@ -37,10 +39,13 @@
     //@PreAuthorize("@ss.hasPermi('smartor:item:list')")
     @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
     @PostMapping("/list")
-    public TableDataInfo list(@RequestBody MedicationItem medicationItem) {
-        startPage();
+    public Map<String, Object> list(@RequestBody MedicationItem medicationItem) {
+        medicationItem.setPageNum(PageUtils.getOffset(medicationItem.getPageNum(), medicationItem.getPageSize()));
         List<MedicationItem> list = medicationItemService.selectMedicationItemList(medicationItem);
-        return getDataTable(list);
+        medicationItem.setPageNum(null);
+        medicationItem.setPageSize(null);
+        List<MedicationItem> total = medicationItemService.selectMedicationItemList(medicationItem);
+        return getDataTable3(total.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 c933413..a680ce2 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
@@ -27,6 +27,7 @@
 import com.smartor.domain.VO.HeLibraryCountVO;
 import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
 import com.smartor.domain.VO.ServiceSubtaskVO;
+import com.smartor.domain.VO.TransferDeptVO;
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import com.smartor.service.IServiceSubtaskRecordService;
 import com.smartor.service.IServiceSubtaskService;
@@ -102,6 +103,18 @@
     @Autowired
     private RedisCache redisCache;
 
+
+    /**
+     * 杞Щ绉戝鐥呭尯
+     */
+    @ApiOperation("杞Щ绉戝鐥呭尯")
+    @PostMapping("/transferDept")
+    public Map<String, Object> transferDept(@RequestBody TransferDeptVO transferDeptVO) {
+        Integer i = serviceSubtaskService.transferDept(transferDeptVO);
+        return success(i == 1 ? true : false);
+    }
+
+
     /**
      * 鏌ヨ鎮h�呴殢璁夸俊鎭�
      */
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskmedicalController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskmedicalController.java
index c0411b5..ce1e181 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskmedicalController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskmedicalController.java
@@ -8,6 +8,7 @@
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.smartor.domain.ServiceTaskmedical;
+import com.smartor.domain.VO.ServiceTaskmedicalVO;
 import com.smartor.service.IServiceTaskmedicalService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -91,13 +92,24 @@
     }
 
     /**
-     * 鍒犻櫎浠诲姟鑽搧鍏宠仈
+     * 鍒犻櫎浠诲姟鑽搧鍏宠仈闆嗗悎
      */
-    @ApiOperation("鍒犻櫎浠诲姟鑽搧鍏宠仈")
+    @ApiOperation("鍒犻櫎浠诲姟鑽搧鍏宠仈闆嗗悎")
     //@PreAuthorize("@ss.hasPermi('smartor:taskmedical:remove')")
     @Log(title = "浠诲姟鑽搧鍏宠仈", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
+    public AjaxResult removeList(@PathVariable Long[] ids) {
         return toAjax(serviceTaskmedicalService.deleteServiceTaskmedicalByIds(ids));
     }
+
+    /**
+     * 鍒犻櫎浠诲姟鑽搧鍏宠仈
+     */
+    @ApiOperation("鍒犻櫎妯℃澘绉戝鍏宠仈")
+    //@PreAuthorize("@ss.hasPermi('smartor:taskdiag:remove')")
+    @Log(title = "鍒犻櫎妯℃澘绉戝鍏宠仈", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    public AjaxResult remove(@RequestBody ServiceTaskmedicalVO serviceTaskmedicalReq) {
+        return toAjax(serviceTaskmedicalService.deleteServiceTaskmedical(serviceTaskmedicalReq));
+    }
 }
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 eb3e8dc..fb3a9f5 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
@@ -29,7 +29,7 @@
         try {
             if ("6".equals(sMessageType)) {
                 result = soap.i5GSend("202508291634227086", "T202508291635259440", UUID.randomUUID().toString(), sMessageContent, sMessageType, sUserNumber, sScheduleTime);
-                log.info("----鐭俊杩斿洖鐨勬暟鎹负锛歿},    ----sMessageContent 鐨勫�间负:{}", UUID.randomUUID().toString());
+                log.info("----鐭俊杩斿洖鐨勬暟鎹负锛歿},    ----sMessageContent 鐨勫�间负:{}", result,UUID.randomUUID().toString());
             } else if ("7".equals(sMessageType)) {
                 result = soap.i5GSend("202508291634227086", "T202607211306131891", UUID.randomUUID().toString(), sMessageContent, sMessageType, sUserNumber, sScheduleTime);
                 log.info("----閽夐拤杩斿洖鐨勫師濮嬫暟鎹负锛歿}", result);
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 5e4760f..8db8fb1 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
@@ -287,6 +287,17 @@
     }
 
     /**
+     * 姣忔湀15鍙峰拰鏈堝簳锛屾煡璇㈠苟澶勭悊 HIS 鏁版嵁锛堝悓寰凤紝鍗楀崕锛�
+     */
+    public void dealHisDataHalfMonth() {
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String formattedNow = now.format(formatter);
+        dealHisData(formattedNow);
+    }
+
+
+    /**
      * HIS鏁版嵁閲囬泦
      * 瀹氭椂浠诲姟锛氶噰闆嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹�
      * todayZeroStr  褰撳墠鐨勬椂闂�   渚嬪锛�2026-05-06 00:00:00
@@ -423,7 +434,7 @@
                         list.add("FH0109.23");
                         list.add("FH0109.53");
                         serviceSLTDInhospReqVO.setStatusList(list);
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
+//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
                         serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                         log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滈鍏ラ櫌鈥濈祼鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
 
@@ -441,7 +452,7 @@
                         List<String> listStr = new ArrayList<>();
                         listStr.add("FH0109.24");
                         serviceSLTDInhospReqVO.setStatusList(listStr);
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
+//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
                         serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                         log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃叆闄⑩�濈祼鏉熼噰闆嗘暟鎹紝闄㈠尯锛歿}", cid);
 
@@ -464,7 +475,7 @@
                         //棰勫嚭闄�
                         list2.add("FH0109.25");
                         serviceSLTDInhospReqVO.setStatusList(list2);
-                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
+//                        log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濋噰闆嗘暟鎹叆鍙傦細{}", serviceSLTDInhospReqVO);
                         serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                         log.info("銆恉ealHisData銆戠渷绔嬪悓寰封�滃嚭闄⑩�濇潫閲囬泦鏁版嵁锛岄櫌鍖猴細{}", cid);
                     }
@@ -485,7 +496,7 @@
      * @param endDateStr   鏃ユ湡缁撴潫 yyyy-MM-dd
      */
     private void collectSegmentData(Long cid, String startDateStr, String endDateStr) {
-        // 棰勫叆闄�
+//        // 棰勫叆闄�
         log.info("銆恉ealHisData銆戦鍏ラ櫌寮�濮嬮噰闆嗘暟鎹紝闄㈠尯锛歿}锛屾椂闂存锛歿} ~ {}", cid, startDateStr, endDateStr);
         ServiceSLTDInhospReqVO reqVO = new ServiceSLTDInhospReqVO();
         reqVO.setOrgId("20001001");
@@ -1550,7 +1561,7 @@
 //        //浜哄伐鐨勬湭鍙戦�佺姸鎬侊紝闇�瑕佹煡2
 //        if (preachform.equals("1") && StringUtils.isNotEmpty(failSendstate) && Long.valueOf(failSendstate) > 2)
 //            serviceSubtaskPreachform.setSendstate("2");
-
+        log.error("-----serviceSubtaskPreachform鐨勫叆鍙傛槸锛焮}", serviceSubtaskPreachform);
         List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
         if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) {
             ServiceSubtaskPreachform serviceSubtaskPreachform1 = serviceSubtaskPreachforms.get(0);
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
index 7f67449..8f8b80c 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -96,7 +96,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 璇濇湳ID
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
index d5aa4d4..789d515 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -74,7 +74,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private Long score;
+    private String score;
 
     /**
      * 璇濇湳鍐呭
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
index 26ea601..8012e84 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
@@ -153,7 +153,7 @@
      */
     @Excel(name = "閫夐」鍒嗘暟")
     @ApiModelProperty(value = "閫夐」鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
 //    /**
 //     * 棰勮闃�鍊间笂闄�
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
index 7188978..4681c79 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
@@ -53,7 +53,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 鏍囬
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
index cb40160..e228248 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
@@ -46,7 +46,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 浠诲姟id
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
index e67492c..b634251 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
@@ -51,7 +51,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 鎸囨爣ID
diff --git a/smartor/src/main/java/com/smartor/domain/PatMedInhosp.java b/smartor/src/main/java/com/smartor/domain/PatMedInhosp.java
index 1b59924..74f2198 100644
--- a/smartor/src/main/java/com/smartor/domain/PatMedInhosp.java
+++ b/smartor/src/main/java/com/smartor/domain/PatMedInhosp.java
@@ -327,10 +327,16 @@
     private String inDeptcheckFlag;
 
     /**
-     * 鍏ラ櫌鐥呭尯闀挎湡浠诲姟锛屾槸鍚﹀鐞嗭細0鏈鐞�   1澶勭悊
+     * 鍏ラ櫌鐥呭尯闀挎湡浠诲姟锛屾槸鍚﹀鐞嗭細0 鏈鐞�   1 澶勭悊
      */
-    @ApiModelProperty(value = "鍏ラ櫌鐥呭尯闀挎湡浠诲姟锛屾槸鍚﹀鐞嗭細0鏈鐞�   1澶勭悊鎴愬姛    2澶勭悊澶辫触 ")
+    @ApiModelProperty(value = "鍏ラ櫌鐥呭尯闀挎湡浠诲姟锛屾槸鍚﹀鐞嗭細0 鏈鐞�   1 澶勭悊鎴愬姛    2 澶勭悊澶辫触 ")
     private String inWardcheckFlag;
+    
+    /**
+     * 鑽搧瀹f暀闀挎湡浠诲姟锛屾槸鍚﹀鐞嗭細0 鏈鐞�   1 澶勭悊
+     */
+    @ApiModelProperty(value = "鑽搧瀹f暀闀挎湡浠诲姟锛屾槸鍚﹀鐞嗭細0 鏈鐞�   1 澶勭悊鎴愬姛    2 澶勭悊澶辫触 ")
+    private String medcheckFlag;
 
     /**
      * 骞撮緞
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
index 7d7024d..171780e 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -530,7 +530,7 @@
      */
     @Excel(name = "鎬诲垎")
     @ApiModelProperty(value = "鎬诲垎")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 妯℃澘搴撴ā鐗堝悕绉�
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExportVO.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExportVO.java
index cd7c88d..a889a8c 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExportVO.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskExportVO.java
@@ -466,7 +466,7 @@
      */
     @Excel(name = "鎬诲垎")
     @ApiModelProperty(value = "鎬诲垎")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 妯℃澘搴撴ā鐗堝悕绉�
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java
index d49a646..8c831fa 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskRes.java
@@ -536,7 +536,7 @@
      */
     @Excel(name = "鎬诲垎")
     @ApiModelProperty(value = "鎬诲垎")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 妯℃澘搴撴ā鐗堝悕绉�
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java b/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
index ed1cb5f..767cd72 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
@@ -458,7 +458,7 @@
      * 閫傜敤鏉′欢绫诲瀷锛�1銆佹寜绉戝銆�2銆佹寜鐥呭尯銆�3銆佹寜鐤剧梾璇婃柇銆�4銆佹寜鎵嬫湳绫诲瀷銆�5銆佹寜浠诲姟缁�
      */
     @ApiModelProperty("閫傜敤鏉′欢绫诲瀷锛�1銆佹寜绉戝銆�2銆佹寜鐥呭尯銆�3銆佹寜鐤剧梾璇婃柇銆�4銆佹寜鎵嬫湳绫诲瀷銆�5銆佹寜浠诲姟缁�  6.鎸夎嵂鍝佺紪鐮�")
-    @Excel(name = "閫傜敤鏉′欢绫诲瀷锛�1銆佹寜绉戝銆�2銆佹寜鐥呭尯銆�3銆佹寜鐤剧梾璇婃柇銆�4銆佹寜鎵嬫湳绫诲瀷銆�5銆佹寜浠诲姟缁�")
+    @Excel(name = "閫傜敤鏉′欢绫诲瀷锛�1銆佹寜绉戝銆�2銆佹寜鐥呭尯銆�3銆佹寜鐤剧梾璇婃柇銆�4銆佹寜鎵嬫湳绫诲瀷銆�5銆佹寜浠诲姟缁� 6.鎸夎嵂鍝佺紪鐮�" )
     private String appltype;
 
     @ApiModelProperty(value = "闅忚閮ㄩ棬缂栫爜")
diff --git a/smartor/src/main/java/com/smartor/domain/SvyFinish.java b/smartor/src/main/java/com/smartor/domain/SvyFinish.java
index 9287042..f362773 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyFinish.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyFinish.java
@@ -1,8 +1,8 @@
 package com.smartor.domain;
 
-import java.math.BigDecimal;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -10,10 +10,11 @@
 
 /**
  * 闂嵎鏈�缁堢粨鏋滃璞� svy_finish
- * 
+ *
  * @author ruoyi
  * @date 2023-03-03
  */
+@Data
 public class SvyFinish extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -39,7 +40,7 @@
 
     /**  鎬诲緱鍒�  */
     @Excel(name = " 鎬诲緱鍒� ")
-    private BigDecimal totalscore;
+    private String totalscore;
 
     /**  鍙嶉缁撴灉鍐呭  */
     @Excel(name = " 鍙嶉缁撴灉鍐呭 ")
@@ -51,7 +52,7 @@
 
     /**  灞曠ず寰楀垎  */
     @Excel(name = " 灞曠ず寰楀垎 ")
-    private Long isshowscore;
+    private String isshowscore;
 
     /**  璁″垝ID  */
     @Excel(name = " 璁″垝ID ")
@@ -74,164 +75,4 @@
     /**  涓婁紶鏃堕棿  */
     private Date uploadTime;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setPatid(Long patid) 
-    {
-        this.patid = patid;
-    }
-
-    public Long getPatid() 
-    {
-        return patid;
-    }
-    public void setSchemeid(Long schemeid) 
-    {
-        this.schemeid = schemeid;
-    }
-
-    public Long getSchemeid() 
-    {
-        return schemeid;
-    }
-    public void setSvytitle(String svytitle) 
-    {
-        this.svytitle = svytitle;
-    }
-
-    public String getSvytitle() 
-    {
-        return svytitle;
-    }
-    public void setSvyid(Long svyid) 
-    {
-        this.svyid = svyid;
-    }
-
-    public Long getSvyid() 
-    {
-        return svyid;
-    }
-    public void setTotalscore(BigDecimal totalscore) 
-    {
-        this.totalscore = totalscore;
-    }
-
-    public BigDecimal getTotalscore() 
-    {
-        return totalscore;
-    }
-    public void setResultcontent(String resultcontent) 
-    {
-        this.resultcontent = resultcontent;
-    }
-
-    public String getResultcontent() 
-    {
-        return resultcontent;
-    }
-    public void setOrgid(String orgid) 
-    {
-        this.orgid = orgid;
-    }
-
-    public String getOrgid() 
-    {
-        return orgid;
-    }
-    public void setIsshowscore(Long isshowscore) 
-    {
-        this.isshowscore = isshowscore;
-    }
-
-    public Long getIsshowscore() 
-    {
-        return isshowscore;
-    }
-    public void setSchemeplanid(Long schemeplanid) 
-    {
-        this.schemeplanid = schemeplanid;
-    }
-
-    public Long getSchemeplanid() 
-    {
-        return schemeplanid;
-    }
-    public void setSchemetaskid(Long schemetaskid) 
-    {
-        this.schemetaskid = schemetaskid;
-    }
-
-    public Long getSchemetaskid() 
-    {
-        return schemetaskid;
-    }
-    public void setIsabnormal(Long isabnormal) 
-    {
-        this.isabnormal = isabnormal;
-    }
-
-    public Long getIsabnormal() 
-    {
-        return isabnormal;
-    }
-    public void setDelFlag(String delFlag) 
-    {
-        this.delFlag = delFlag;
-    }
-
-    public String getDelFlag() 
-    {
-        return delFlag;
-    }
-    public void setIsupload(Long isupload) 
-    {
-        this.isupload = isupload;
-    }
-
-    public Long getIsupload() 
-    {
-        return isupload;
-    }
-    public void setUploadTime(Date uploadTime) 
-    {
-        this.uploadTime = uploadTime;
-    }
-
-    public Date getUploadTime() 
-    {
-        return uploadTime;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("patid", getPatid())
-            .append("schemeid", getSchemeid())
-            .append("svytitle", getSvytitle())
-            .append("svyid", getSvyid())
-            .append("totalscore", getTotalscore())
-            .append("resultcontent", getResultcontent())
-            .append("orgid", getOrgid())
-            .append("isshowscore", getIsshowscore())
-            .append("schemeplanid", getSchemeplanid())
-            .append("schemetaskid", getSchemetaskid())
-            .append("isabnormal", getIsabnormal())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("isupload", getIsupload())
-            .append("uploadTime", getUploadTime())
-            .toString();
-    }
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyFinishoption.java b/smartor/src/main/java/com/smartor/domain/SvyFinishoption.java
index bcf7318..97a9b35 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyFinishoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyFinishoption.java
@@ -3,6 +3,7 @@
 import java.math.BigDecimal;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -10,10 +11,11 @@
 
 /**
  * 闂嵎鏈�缁堢粨鏋滈�夐」璇︽儏瀵硅薄 svy_finishoption
- * 
+ *
  * @author ruoyi
  * @date 2023-03-03
  */
+@Data
 public class SvyFinishoption extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -35,7 +37,7 @@
 
     /**  褰撳墠閫夐」寰楀垎  */
     @Excel(name = " 褰撳墠閫夐」寰楀垎 ")
-    private BigDecimal score;
+    private String score;
 
     /**  鏈烘瀯ID  */
     @Excel(name = " 鏈烘瀯ID ")
@@ -57,124 +59,4 @@
     @Excel(name = " 鏈哄櫒浜洪�夋嫨鏍囪 ")
     private Long isrobot;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setFinshresultdetailid(Long finshresultdetailid) 
-    {
-        this.finshresultdetailid = finshresultdetailid;
-    }
-
-    public Long getFinshresultdetailid() 
-    {
-        return finshresultdetailid;
-    }
-    public void setPsqoptionid(Long psqoptionid) 
-    {
-        this.psqoptionid = psqoptionid;
-    }
-
-    public Long getPsqoptionid() 
-    {
-        return psqoptionid;
-    }
-    public void setContent(String content) 
-    {
-        this.content = content;
-    }
-
-    public String getContent() 
-    {
-        return content;
-    }
-    public void setScore(BigDecimal score) 
-    {
-        this.score = score;
-    }
-
-    public BigDecimal getScore() 
-    {
-        return score;
-    }
-    public void setOrgid(String orgid) 
-    {
-        this.orgid = orgid;
-    }
-
-    public String getOrgid() 
-    {
-        return orgid;
-    }
-    public void setDelFlag(String delFlag) 
-    {
-        this.delFlag = delFlag;
-    }
-
-    public String getDelFlag() 
-    {
-        return delFlag;
-    }
-    public void setIsupload(Long isupload) 
-    {
-        this.isupload = isupload;
-    }
-
-    public Long getIsupload() 
-    {
-        return isupload;
-    }
-    public void setUploadTime(Date uploadTime) 
-    {
-        this.uploadTime = uploadTime;
-    }
-
-    public Date getUploadTime() 
-    {
-        return uploadTime;
-    }
-    public void setIsabnormal(Long isabnormal) 
-    {
-        this.isabnormal = isabnormal;
-    }
-
-    public Long getIsabnormal() 
-    {
-        return isabnormal;
-    }
-    public void setIsrobot(Long isrobot) 
-    {
-        this.isrobot = isrobot;
-    }
-
-    public Long getIsrobot() 
-    {
-        return isrobot;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("finshresultdetailid", getFinshresultdetailid())
-            .append("psqoptionid", getPsqoptionid())
-            .append("content", getContent())
-            .append("score", getScore())
-            .append("orgid", getOrgid())
-            .append("delFlag", getDelFlag())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("isupload", getIsupload())
-            .append("uploadTime", getUploadTime())
-            .append("isabnormal", getIsabnormal())
-            .append("isrobot", getIsrobot())
-            .toString();
-    }
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyFinishtopic.java b/smartor/src/main/java/com/smartor/domain/SvyFinishtopic.java
index c5f6b37..7d1660c 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyFinishtopic.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyFinishtopic.java
@@ -3,6 +3,7 @@
 import java.math.BigDecimal;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -10,10 +11,11 @@
 
 /**
  * 闂嵎璋冩煡缁撴灉璇︽儏瀵硅薄 svy_finishtopic
- * 
+ *
  * @author ruoyi
  * @date 2023-03-03
  */
+@Data
 public class SvyFinishtopic extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -35,7 +37,7 @@
 
     /**  褰撳墠閫夐」寰楀垎  */
     @Excel(name = " 褰撳墠閫夐」寰楀垎 ")
-    private BigDecimal score;
+    private String score;
 
     /**  鏈烘瀯ID  */
     @Excel(name = " 鏈烘瀯ID ")
@@ -53,104 +55,4 @@
     @Excel(name = " 涓婁紶鏃堕棿 ", width = 30, dateFormat = "yyyy-MM-dd")
     private Date uploadTime;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setPsqid(Long psqid) 
-    {
-        this.psqid = psqid;
-    }
-
-    public Long getPsqid() 
-    {
-        return psqid;
-    }
-    public void setResultid(Long resultid) 
-    {
-        this.resultid = resultid;
-    }
-
-    public Long getResultid() 
-    {
-        return resultid;
-    }
-    public void setTopicid(Long topicid) 
-    {
-        this.topicid = topicid;
-    }
-
-    public Long getTopicid() 
-    {
-        return topicid;
-    }
-    public void setScore(BigDecimal score) 
-    {
-        this.score = score;
-    }
-
-    public BigDecimal getScore() 
-    {
-        return score;
-    }
-    public void setOrgid(String orgid) 
-    {
-        this.orgid = orgid;
-    }
-
-    public String getOrgid() 
-    {
-        return orgid;
-    }
-    public void setDelFlag(String delFlag) 
-    {
-        this.delFlag = delFlag;
-    }
-
-    public String getDelFlag() 
-    {
-        return delFlag;
-    }
-    public void setIsupload(Long isupload) 
-    {
-        this.isupload = isupload;
-    }
-
-    public Long getIsupload() 
-    {
-        return isupload;
-    }
-    public void setUploadTime(Date uploadTime) 
-    {
-        this.uploadTime = uploadTime;
-    }
-
-    public Date getUploadTime() 
-    {
-        return uploadTime;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("psqid", getPsqid())
-            .append("resultid", getResultid())
-            .append("topicid", getTopicid())
-            .append("score", getScore())
-            .append("orgid", getOrgid())
-            .append("delFlag", getDelFlag())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("isupload", getIsupload())
-            .append("uploadTime", getUploadTime())
-            .toString();
-    }
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibResult.java b/smartor/src/main/java/com/smartor/domain/SvyLibResult.java
index c030e18..6fe9fc5 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibResult.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibResult.java
@@ -1,7 +1,9 @@
 package com.smartor.domain;
 
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -9,161 +11,71 @@
 
 /**
  * 闂嵎缁撴灉瀵硅薄 svy_lib_result
- * 
+ *
  * @author ruoyi
  * @date 2023-03-02
  */
-public class SvyLibResult extends BaseEntity
-{
+@Data
+public class SvyLibResult extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /**  鑷ID  */
+    /**
+     * 鑷ID
+     */
     private Long resultid;
 
-    /**  闂嵎ID  */
+    /**
+     * 闂嵎ID
+     */
     @Excel(name = " 闂嵎ID ")
     private Long svyid;
 
-    /**  缁撴灉鍐呭  */
+    /**
+     * 缁撴灉鍐呭
+     */
     @Excel(name = " 缁撴灉鍐呭 ")
     private String resultcontent;
 
-    /**  鎴栦笖  */
+    /**
+     * 鎴栦笖
+     */
     @Excel(name = " 鎴栦笖 ")
     private Long orand;
 
-    /**  鏄惁鏄剧ず寰楀垎  */
+    /**
+     * 鏄惁鏄剧ず寰楀垎
+     */
     @Excel(name = " 鏄惁鏄剧ず寰楀垎 ")
-    private Long isshowscore;
+    private String isshowscore;
 
-    /**  鎺掑簭  */
+    /**
+     * 鎺掑簭
+     */
     @Excel(name = " 鎺掑簭 ")
     private Long sort;
 
-    /**  鏈烘瀯ID  */
+    /**
+     * 鏈烘瀯ID
+     */
     @Excel(name = " 鏈烘瀯ID ")
     private String orgid;
 
-    /**  鍒犻櫎鏍囪  */
+    /**
+     * 鍒犻櫎鏍囪
+     */
     private String delFlag;
 
-    /**  涓婁紶鏍囪  */
+    /**
+     * 涓婁紶鏍囪
+     */
     @Excel(name = " 涓婁紶鏍囪 ")
     private Long isupload;
 
-    /**  涓婁紶鏃堕棿  */
+    /**
+     * 涓婁紶鏃堕棿
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = " 涓婁紶鏃堕棿 ", width = 30, dateFormat = "yyyy-MM-dd")
     private Date uploadTime;
 
-    public void setResultid(Long resultid) 
-    {
-        this.resultid = resultid;
-    }
-
-    public Long getResultid() 
-    {
-        return resultid;
-    }
-    public void setSvyid(Long svyid) 
-    {
-        this.svyid = svyid;
-    }
-
-    public Long getSvyid() 
-    {
-        return svyid;
-    }
-    public void setResultcontent(String resultcontent) 
-    {
-        this.resultcontent = resultcontent;
-    }
-
-    public String getResultcontent() 
-    {
-        return resultcontent;
-    }
-    public void setOrand(Long orand) 
-    {
-        this.orand = orand;
-    }
-
-    public Long getOrand() 
-    {
-        return orand;
-    }
-    public void setIsshowscore(Long isshowscore) 
-    {
-        this.isshowscore = isshowscore;
-    }
-
-    public Long getIsshowscore() 
-    {
-        return isshowscore;
-    }
-    public void setSort(Long sort) 
-    {
-        this.sort = sort;
-    }
-
-    public Long getSort() 
-    {
-        return sort;
-    }
-    public void setOrgid(String orgid) 
-    {
-        this.orgid = orgid;
-    }
-
-    public String getOrgid() 
-    {
-        return orgid;
-    }
-    public void setDelFlag(String delFlag) 
-    {
-        this.delFlag = delFlag;
-    }
-
-    public String getDelFlag() 
-    {
-        return delFlag;
-    }
-    public void setIsupload(Long isupload) 
-    {
-        this.isupload = isupload;
-    }
-
-    public Long getIsupload() 
-    {
-        return isupload;
-    }
-    public void setUploadTime(Date uploadTime) 
-    {
-        this.uploadTime = uploadTime;
-    }
-
-    public Date getUploadTime() 
-    {
-        return uploadTime;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("resultid", getResultid())
-            .append("svyid", getSvyid())
-            .append("resultcontent", getResultcontent())
-            .append("orand", getOrand())
-            .append("isshowscore", getIsshowscore())
-            .append("sort", getSort())
-            .append("orgid", getOrgid())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("isupload", getIsupload())
-            .append("uploadTime", getUploadTime())
-            .toString();
-    }
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibScript.java b/smartor/src/main/java/com/smartor/domain/SvyLibScript.java
index 905649b..49067ae 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibScript.java
@@ -163,7 +163,7 @@
     private String scoretype;
 
     @ApiModelProperty(value = "棰樼洰鍒嗗�硷細鏁板瓧1,2绛夛紱瀛楁瘝A銆丅锛孋锛孌绛夛紱")
-    private BigDecimal score;
+    private String score;
 
     @ApiModelProperty(value = "閫傜敤鐤剧梾")
     private String icd10Name;
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java b/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
index 4c5960b..6b643fc 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
@@ -91,7 +91,7 @@
      * 鍒嗘暟
      */
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 鎻愮ず
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
index 4648c7a..8eae615 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
@@ -237,7 +237,7 @@
      */
     @Excel(name = "棰樼洰鍒嗗�硷細鏁板瓧1,2绛夛紱瀛楁瘝A銆丅锛孋锛孌绛夛紱")
     @ApiModelProperty("棰樼洰鍒嗗�硷細鏁板瓧1,2绛夛紱瀛楁瘝A銆丅锛孋锛孌绛夛紱")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 棰樼洰涓婚
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
index 6983921..34861f5 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
@@ -274,7 +274,7 @@
      */
     @Excel(name = "棰樼洰鍒嗗�硷細鏁板瓧1,2绛夛紱瀛楁瘝A銆丅锛孋锛孌绛夛紱")
     @ApiModelProperty("棰樼洰鍒嗗�硷細鏁板瓧1,2绛夛紱瀛楁瘝A銆丅锛孋锛孌绛夛紱")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 棰樼洰涓婚
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
index c4f98a4..8a5031c 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
@@ -42,7 +42,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 鎸囨爣鍚嶇О
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskScriptoption.java b/smartor/src/main/java/com/smartor/domain/SvyTaskScriptoption.java
index 61cba79..9b6fa47 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskScriptoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskScriptoption.java
@@ -108,7 +108,7 @@
      */
     @Excel(name = " 鍒嗘暟 ")
     @ApiModelProperty(value = "鍒嗘暟")
-    private Long score;
+    private String score;
 
     /**
      * 鎻愮ず
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
index e0724c2..d76921d 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
@@ -80,7 +80,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 绫诲埆鍚�
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
index 924ceb9..4fa5793 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
@@ -5,10 +5,6 @@
 import com.ruoyi.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -262,7 +258,7 @@
      */
     @Excel(name = "鍒嗘暟")
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score = BigDecimal.ZERO;
+    private String score = "0";
 
     /**
      * 閫変腑鎻愮ず
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
index 76e3cf5..b498512 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
@@ -251,14 +251,14 @@
      * 鍒嗘暟
      */
     @ApiModelProperty(value = "鍒嗘暟")
-    private BigDecimal score;
+    private String score;
 
     /**
      * 鏄惁鏄敤鎴烽�夋嫨鐨勯�夐」
      */
     @ApiModelProperty(value = "鏄惁鏄敤鎴烽�夋嫨鐨勯�夐」")
     private Boolean isUserOperation = false;
-    
+
     /**
      * 榛樿閫夐」锛�1 鍚�     2 鏄�
      */
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTopicoption.java b/smartor/src/main/java/com/smartor/domain/SvyTopicoption.java
index f77ceba..23c9895 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTopicoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTopicoption.java
@@ -85,7 +85,7 @@
      * 鍒嗘暟
      */
     @ApiModelProperty(value = "鍒嗘暟")
-    private Long score;
+    private String score;
 
     /**
      * 鎻愮ず
diff --git a/smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java b/smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java
index d485c25..1483955 100644
--- a/smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java
+++ b/smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java
@@ -554,7 +554,7 @@
      */
     @Excel(name = "鎬诲垎")
     @ApiModelProperty(value = "鎬诲垎")
-    private Long score;
+    private String score;
 
 
     /**
diff --git a/smartor/src/main/java/com/smartor/domain/VO/ServiceTaskmedicalVO.java b/smartor/src/main/java/com/smartor/domain/VO/ServiceTaskmedicalVO.java
new file mode 100644
index 0000000..30b4aec
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/VO/ServiceTaskmedicalVO.java
@@ -0,0 +1,34 @@
+package com.smartor.domain.VO;
+
+import com.ruoyi.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 浠诲姟鑽搧鍏宠仈瀵硅薄 service_taskmedical
+ *
+ * @author lihu
+ * @date 2026-07-29
+ */
+@Data
+@ApiModel("浠诲姟鑽搧鍏宠仈")
+public class ServiceTaskmedicalVO {
+
+    /**
+     * 浠诲姟id
+     */
+    @ApiModelProperty("浠诲姟id")
+    @Excel(name = "浠诲姟id")
+    private Long taskId;
+
+    /**
+     * 鑽搧缂栫爜
+     */
+    @ApiModelProperty("鑽搧缂栫爜")
+    @Excel(name = "鑽搧缂栫爜")
+    private String medicalCode;
+
+
+}
+
diff --git a/smartor/src/main/java/com/smartor/domain/VO/TransferDeptVO.java b/smartor/src/main/java/com/smartor/domain/VO/TransferDeptVO.java
new file mode 100644
index 0000000..61f3576
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/VO/TransferDeptVO.java
@@ -0,0 +1,61 @@
+package com.smartor.domain.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.smartor.domain.TaskSendTimeVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 杞Щ绉戝鐥呭尯鍏ュ弬
+ *
+ * @author ruoyi
+ * @date 2024-02-02
+ */
+
+@ApiModel(value = "TransferDeptVO", description = "杞Щ绉戝鐥呭尯鍏ュ弬")
+@Data
+public class TransferDeptVO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *
+     */
+    @ApiModelProperty(value = "涓婚敭id")
+    private Long subId;
+
+
+    /**
+     * 绂婚櫌閮ㄩ棬code
+     */
+    @Excel(name = "  绂婚櫌閮ㄩ棬code")
+    @ApiModelProperty(value = "绂婚櫌閮ㄩ棬code")
+    private String leavelDeptCode;
+
+    /**
+     * 绂婚櫌閮ㄩ棬鍚嶇О
+     */
+    @Excel(name = "  绂婚櫌閮ㄩ棬鍚嶇О")
+    @ApiModelProperty(value = "绂婚櫌閮ㄩ棬鍚嶇О")
+    private String leavelDeptName;
+
+    /**
+     * 鍑洪櫌鐥呭尯缂栧彿
+     */
+    @ApiModelProperty(value = "鍑洪櫌鐥呭尯缂栧彿")
+    private String leavehospitaldistrictcode;
+
+    /*
+     * 鍑洪櫌鐥呭尯鍚嶇О
+     */
+    @ApiModelProperty(value = "鍑洪櫌鐥呭尯鍚嶇О")
+    @Excel(name = " 鍑洪櫌鐥呭尯鍚嶇О ")
+    private String leavehospitaldistrictname;
+}
diff --git a/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java b/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java
index 5c72f8d..b0d0af0 100644
--- a/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java
+++ b/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java
@@ -46,19 +46,19 @@
      * 骞冲潎鍒�
      */
     @ApiModelProperty(value = "骞冲潎鍒�")
-    private Double averageScore;
+    private String averageScore;
 
     /**
      * 鏈�楂樺垎
      */
     @ApiModelProperty(value = "鏈�楂樺垎")
-    private Double maxScore;
+    private String maxScore;
 
     /**
      * 鏈�浣庡垎
      */
     @ApiModelProperty(value = "鏈�浣庡垎")
-    private Double minScore;
+    private String minScore;
 
     /**
      * 绛旈鐜�
diff --git a/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java b/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
index ea76a86..de813bc 100644
--- a/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
+++ b/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
@@ -569,7 +569,7 @@
      */
     @Excel(name = "鎬诲垎")
     @ApiModelProperty(value = "鎬诲垎")
-    private Long score;
+    private String score;
 
 
     /**
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java
index 5b2105d..5e3814c 100644
--- a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java
@@ -42,6 +42,7 @@
      * 鏌ヨ闅忚璇︽儏-鎸囨爣璁板綍
      */
     public List<Map<String, Object>> getServiceSubtaskDetails(ServiceSubtaskDetailVO serviceSubtaskDetailVo);
+
     /**
      * 鏂板璇煶浠诲姟鍛煎彨鏄庣粏
      *
@@ -84,4 +85,19 @@
      * @return 鎸囨爣缁熻
      */
     public List<ServiceSubtaskDetailTarget> countPatByTarget(Long targetid);
+
+    /**
+     * 鏌ヨ鍚屼釜subid閲嶅鐨刣etail鏁版嵁ID鍒楄〃
+     *
+     * @return 閲嶅璁板綍ID鍒楄〃
+     */
+    public List<Long> selectRepeatDetailIds();
+
+    /**
+     * 鏍规嵁ID鍒楄〃鎵归噺鏍囪閲嶅detail鏁版嵁涓哄垹闄�
+     *
+     * @param ids 閲嶅璁板綍ID鍒楄〃
+     * @return 鏇存柊琛屾暟
+     */
+    public Integer deleteRepeatDetailByIds(@Param("ids") List<Long> ids);
 }
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceTaskmedicalMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceTaskmedicalMapper.java
index bfe24d8..eefe2f7 100644
--- a/smartor/src/main/java/com/smartor/mapper/ServiceTaskmedicalMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceTaskmedicalMapper.java
@@ -1,6 +1,7 @@
 package com.smartor.mapper;
 
 import com.smartor.domain.ServiceTaskmedical;
+import com.smartor.domain.VO.ServiceTaskmedicalVO;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -61,4 +62,6 @@
      * @return 缁撴灉
      */
     public int deleteServiceTaskmedicalByIds(Long[] ids);
+
+    public int deleteServiceTaskmedical(ServiceTaskmedicalVO serviceTaskmedicalVO);
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
index e7f59c0..f32a5fb 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -5,6 +5,7 @@
 import com.smartor.domain.ServiceSubtask;
 import com.smartor.domain.VO.HeLibraryCountVO;
 import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
+import com.smartor.domain.VO.TransferDeptVO;
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import org.springframework.web.bind.annotation.RequestBody;
 
@@ -52,6 +53,13 @@
      */
     public List<ServiceSubtaskRes> patItem(ServiceSubtaskEntity serviceSubtaskEntity);
 
+    /**
+     * 杞Щ绉戝鐥呭尯
+     * @param transferDeptVO
+     * @return
+     */
+    public Integer transferDept(TransferDeptVO transferDeptVO);
+
     public List<ServiceSubtask> patItem2(ServiceSubtaskEntity serviceSubtaskEntity);
 
     public Map<String, Object> patItemCount(ServiceSubtaskEntity serviceSubtaskEntity);
diff --git a/smartor/src/main/java/com/smartor/service/IServiceTaskmedicalService.java b/smartor/src/main/java/com/smartor/service/IServiceTaskmedicalService.java
index e4b8852..ac71d68 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceTaskmedicalService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceTaskmedicalService.java
@@ -1,6 +1,7 @@
 package com.smartor.service;
 
 import com.smartor.domain.ServiceTaskmedical;
+import com.smartor.domain.VO.ServiceTaskmedicalVO;
 
 import java.util.List;
 
@@ -59,4 +60,11 @@
      * @return 缁撴灉
      */
     public int deleteServiceTaskmedicalById(Long id);
+    /**
+     * 鍒犻櫎浠诲姟鑽搧鍏宠仈淇℃伅
+     *
+     * @param id 浠诲姟鑽搧鍏宠仈涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteServiceTaskmedical(ServiceTaskmedicalVO serviceTaskmedicalVO);
 }
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 f72f6a8..55d97ad 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -342,38 +342,40 @@
             }
         }
 
-        //2.鑽搧瀹f暀
-        for (PatMedInhosp patMedInhosp : patMedInhosps) {
-            String medicalCode = patMedInhosp.getMedicalCode();
-            if (StringUtils.isNotEmpty(medicalCode)) {
-                String[] split = medicalCode.split(",");
-                // 闃插尽鎬х紪绋嬶細纭繚 medicalCompany 鍜� medicalName 涓嶄负 null
-                String medicalCompanyStr = patMedInhosp.getMedicalCompany() != null ? patMedInhosp.getMedicalCompany() : "";
-                String medicalNameStr = patMedInhosp.getMedicalName() != null ? patMedInhosp.getMedicalName() : "";
-                String[] medicalCompanyArray = medicalCompanyStr.split(",");
-                String[] medicalNameArray = medicalNameStr.split(",");
+        //2.鑽搧瀹f暀(鐪佺珛鍚屽痉鐨勯渶姹傦紝鍏跺畠鍦版柟娌℃彁)
+        if (active.equals("sltd")) {
+            for (PatMedInhosp patMedInhosp : patMedInhosps) {
+                String medicalCode = patMedInhosp.getMedicalCode();
+                if (StringUtils.isNotEmpty(medicalCode)) {
+                    String[] split = medicalCode.split(",");
+                    // 闃插尽鎬х紪绋嬶細纭繚 medicalCompany 鍜� medicalName 涓嶄负 null
+                    String medicalCompanyStr = patMedInhosp.getMedicalCompany() != null ? patMedInhosp.getMedicalCompany() : "";
+                    String medicalNameStr = patMedInhosp.getMedicalName() != null ? patMedInhosp.getMedicalName() : "";
+                    String[] medicalCompanyArray = medicalCompanyStr.split(",");
+                    String[] medicalNameArray = medicalNameStr.split(",");
 
-                for (int i = 0; i < split.length; i++) {
-                    ServiceTaskmedical serviceTaskmedical = new ServiceTaskmedical();
-                    //鎷胯嵂鍝佺紪鐮佸拰鍏徃鍘绘煡
-                    serviceTaskmedical.setMedicalCode(split[i]);
-                    // 闃叉涓嬫爣瓒婄晫锛氬鏋滄暟缁勯暱搴︿笉涓�鑷达紝鍙栨渶灏忛暱搴�
-                    if (i < medicalCompanyArray.length) {
-                        serviceTaskmedical.setMedicalName(medicalCompanyArray[i]);
-                    } else {
-                        log.warn("銆愯嵂鍝佸鏁欍�戣嵂鍝佺紪鐮亄}瀵瑰簲鐨勫叕鍙镐俊鎭笅鏍囪秺鐣岋紝medicalCompany 鏁扮粍闀垮害={}, 褰撳墠绱㈠紩={}", split[i], medicalCompanyArray.length, i);
-                        serviceTaskmedical.setMedicalName(""); // 瓒婄晫鏃惰缃负绌�
+                    for (int i = 0; i < split.length; i++) {
+                        ServiceTaskmedical serviceTaskmedical = new ServiceTaskmedical();
+                        //鎷胯嵂鍝佺紪鐮佸拰鍏徃鍘绘煡
+                        serviceTaskmedical.setMedicalCode(split[i]);
+                        // 闃叉涓嬫爣瓒婄晫锛氬鏋滄暟缁勯暱搴︿笉涓�鑷达紝鍙栨渶灏忛暱搴�
+                        if (i < medicalCompanyArray.length) {
+                            serviceTaskmedical.setMedicalCompany(medicalCompanyArray[i]);
+                        } else {
+                            log.warn("銆愯嵂鍝佸鏁欍�戣嵂鍝佺紪鐮亄}瀵瑰簲鐨勫叕鍙镐俊鎭笅鏍囪秺鐣岋紝medicalCompany 鏁扮粍闀垮害={}, 褰撳墠绱㈠紩={}", split[i], medicalCompanyArray.length, i);
+                            serviceTaskmedical.setMedicalName(""); // 瓒婄晫鏃惰缃负绌�
+                        }
+                        List<ServiceTaskmedical> serviceTaskmedicals = serviceTaskmedicalMapper.selectServiceTaskmedicalList(serviceTaskmedical);
+                        if (CollectionUtils.isNotEmpty(serviceTaskmedicals)) {
+                            PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp.getPatid());
+                            // check=true锛岃 writeInSubTask 鍐呴儴鍋氬幓閲嶆牎楠�
+                            writeInSubTask(serviceTaskmedicals.get(0).getTaskId(), true, patMedInhosp, patArchive, 0, config);
+                        }
+                        //鏌ヤ笉鍒扮殑鑽搧灏辨槸涓嶉渶瑕佸鏁欑殑锛屽氨涓嶇浜�
                     }
-                    List<ServiceTaskmedical> serviceTaskmedicals = serviceTaskmedicalMapper.selectServiceTaskmedicalList(serviceTaskmedical);
-                    if (CollectionUtils.isNotEmpty(serviceTaskmedicals)) {
-                        PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp.getPatid());
-                        writeInSubTask(serviceTaskmedicals.get(0).getTaskId(), false, patMedInhosp, patArchive, 0, config);
-                    }
-                    //鏌ヤ笉鍒扮殑鑽搧灏辨槸涓嶉渶瑕佸鏁欑殑锛屽氨涓嶇浜�
                 }
             }
         }
-
         //3.鍑洪櫌闅忚 - 鍩轰簬瑙勫垯鐨勪换鍔$敓鎴�
         // 鑾峰彇鎵�鏈夐渶瑕佸鐞嗙殑鍑洪櫌鎮h�咃紙绉戝缁村害鏈鐞嗭級
 
@@ -409,12 +411,12 @@
 
         if (CollectionUtils.isNotEmpty(serviceTasks)) {
             for (ServiceTask serviceTask : serviceTasks) {
-                if(!ObjectUtils.isEmpty(serviceTask.getTaskid())){
+                if (!ObjectUtils.isEmpty(serviceTask.getTaskid())) {
                     ServiceTaskSchedule serviceTaskSchedule = new ServiceTaskSchedule();
                     ServiceTaskSchedule taskSchedule = new ServiceTaskSchedule();
                     taskSchedule.setTaskid(serviceTask.getTaskid());
                     List<ServiceTaskSchedule> serviceTaskSchedules = serviceTaskScheduleMapper.selectServiceTaskScheduleList(taskSchedule);
-                    if(CollectionUtils.isNotEmpty(serviceTaskSchedules)){
+                    if (CollectionUtils.isNotEmpty(serviceTaskSchedules)) {
                         serviceTaskSchedule = serviceTaskSchedules.get(0);
                         String deptCodes = serviceTaskSchedule.getDeptCodes();
                         String wardCodes = serviceTaskSchedule.getWardCodes();
@@ -434,11 +436,11 @@
                             type = 1;
                             deptCodeList = new ArrayList<>(Arrays.asList(deptCodes.split(",")));
                         }
-                        if(StringUtils.isNotEmpty(wardCodes)) {
+                        if (StringUtils.isNotEmpty(wardCodes)) {
                             type = 2;
                             wardCodeList = new ArrayList<>(Arrays.asList(wardCodes.split(",")));
                         }
-                        if(StringUtils.isNotEmpty(icd10Codes)) {
+                        if (StringUtils.isNotEmpty(icd10Codes)) {
                             type = 3;
                             icd10CodeList = new ArrayList<>(Arrays.asList(icd10Codes.split(",")));
                         }
@@ -447,7 +449,7 @@
                             opLevelCodeList = new ArrayList<>(Arrays.asList(opLevelCodes.split(",")));
                         }
                         //闈炴墜鏈鐞嗘柟寮�
-                        if(type != 6){
+                        if (type != 6) {
                             PatMedInhosp patMedInhospVo = new PatMedInhosp();
                             patMedInhospVo.setScheduleCheckFlag("0");
                             patMedInhospVo.setInhospstate("1");
@@ -459,7 +461,7 @@
                             List<PatMedInhosp> patList = patMedInhospMapper.selectPatMedInhospList(patMedInhospVo);
                             log.info("dealOutHospInfoBySchedule 浠诲姟缁勯殢璁�, taskid = {}, 鎵弿鎮h�呬汉鏁� {}", serviceTask.getTaskid(), patList.size());
 
-                            for(PatMedInhosp patMedInhosp : patList){
+                            for (PatMedInhosp patMedInhosp : patList) {
                                 ServiceTaskScheduleDetail scheduleDetailVo = new ServiceTaskScheduleDetail();
                                 scheduleDetailVo.setTaskid(serviceTask.getTaskid());
                                 scheduleDetailVo.setScheduleid(serviceTaskSchedule.getId());
@@ -473,11 +475,11 @@
 
                                 ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, patMedInhosp, patArchive, config, type);
                                 List<Map<String, Object>> preachformList = new ArrayList<>();
-                                if(StringUtils.isNotEmpty(serviceTask.getPreachformDesc())){
+                                if (StringUtils.isNotEmpty(serviceTask.getPreachformDesc())) {
                                     try {
                                         ObjectMapper objectMapper = new ObjectMapper();
                                         preachformList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class);
-                                    }catch (Exception e){
+                                    } catch (Exception e) {
                                         log.error("浠诲姟缁刾reachformDesc瑙f瀽澶辫触,taskid={},inhospid={}", serviceTask.getTaskid(), patMedInhosp.getInhospid());
                                     }
                                 }
@@ -488,9 +490,9 @@
                                 flagUpd.setScheduleCheckFlag("1");
                                 patMedInhospMapper.updatePatMedInhosp(flagUpd);
                             }
-                        }else {
+                        } else {
                             //浠诲姟缁� - 鎵嬫湳闅忚
-                            if(CollectionUtils.isNotEmpty(opLevelCodeList)){
+                            if (CollectionUtils.isNotEmpty(opLevelCodeList)) {
                                 PatMedOperationItem pmoi = new PatMedOperationItem();
                                 //鑾峰彇闇�瑕佸嚭闄㈢柧鐥呴殢璁匡紝鏈鐞嗙殑鏁版嵁
                                 pmoi.setOpercheckFlag("0");
@@ -499,7 +501,7 @@
                                 pmoi.setWardCodes(wardCodeList);
                                 pmoi.setOpLevelCodes(opLevelCodeList);
                                 List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemList(pmoi);
-                                for(PatMedOperationItem patMedOperationItem : patMedOperationItems){
+                                for (PatMedOperationItem patMedOperationItem : patMedOperationItems) {
                                     PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOperationItem.getPatid());
                                     if (Objects.isNull(patArchive)) {
                                         continue;
@@ -510,7 +512,7 @@
                                     patMedInhospVo.setInhospstate("1");
                                     patMedInhospVo.setFuflag("1");
                                     List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhospVo);
-                                    if(CollectionUtils.isNotEmpty(patMedInhospList)){
+                                    if (CollectionUtils.isNotEmpty(patMedInhospList)) {
                                         ServiceTaskScheduleDetail scheduleDetailVo = new ServiceTaskScheduleDetail();
                                         scheduleDetailVo.setTaskid(serviceTask.getTaskid());
                                         scheduleDetailVo.setScheduleid(serviceTaskSchedule.getId());
@@ -518,11 +520,11 @@
                                         //灏佽serviceSubtask
                                         ServiceSubtask serviceSubtask = boxedServiceSubtaskForOp(serviceTask, patMedInhospList.get(0), patMedOperationItem, patArchive, config);
                                         List<Map<String, Object>> preachformList = new ArrayList<>();
-                                        if(StringUtils.isNotEmpty(serviceTask.getPreachformDesc())){
+                                        if (StringUtils.isNotEmpty(serviceTask.getPreachformDesc())) {
                                             try {
                                                 ObjectMapper objectMapper = new ObjectMapper();
                                                 preachformList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class);
-                                            }catch (Exception e){
+                                            } catch (Exception e) {
                                                 log.error("浠诲姟缁�(鎵嬫湳)preachformDesc瑙f瀽澶辫触,taskid={}", serviceTask.getTaskid());
                                             }
                                         }
@@ -619,6 +621,13 @@
         List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st);
         ServiceTask serviceTask = null;
         if (CollectionUtils.isEmpty(serviceTasks)) {
+            if (type == 0) {
+                log.info("璇ユ偅鑰呰嵂鍝佸鏁欓暱鏈熶换鍔′笉瀛樺湪,浠诲姟ID涓猴細{}", taskid);
+                patMedInhosp1.setMedcheckFlag("2");
+                patMedInhosp1.setLongTaskReason(longTaskReason + " & 璇ユ偅鑰呰嵂鍝佸鏁欓暱鏈熶换鍔′笉瀛樺湪,浠诲姟ID涓�:" + taskid);
+                patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
+                return;
+            }
             if (type == 1) {
                 log.info("璇ユ偅鑰呭嚭闄㈤殢璁块暱鏈熶换鍔′笉瀛樺湪,浠诲姟ID涓猴細{}", taskid);
                 patMedInhosp1.setDeptcheckFlag("2");
@@ -797,7 +806,7 @@
                 addServiceSubtaskPreachform(serviceSubtask, null);
             }
 
-            //灏哻heck_flag鏀规垚1锛堝凡澶勭悊锛�
+            //灏� check_flag 鏀规垚 1锛堝凡澶勭悊锛�
             if (i == 1) {
                 PatMedInhosp patMedInhosp2 = new PatMedInhosp();
                 patMedInhosp2.setInhospid(patMedInhosp1.getInhospid());
@@ -828,6 +837,7 @@
             if (type == 1) patMedInhosp2.setDeptcheckFlag("2");
             if (type == 2) patMedInhosp2.setWardcheckFlag("2");
             if (type == 3) patMedInhosp2.setDiagcheckFlag("2");
+            if (type == 0) patMedInhosp2.setMedcheckFlag("2");
             patMedInhosp2.setRemark("鐢熸垚瀛愪换鍔℃姤閿欏洖婊� " + type);
             patMedInhospMapper.updatePatMedInhosp(patMedInhosp2);
             e.printStackTrace();
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java
index f1802b9..8fd54d1 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java
@@ -220,9 +220,9 @@
                 patSatisfactionDetailEntity.setScriptContent(ivrLibaTemplateScript.getScriptContent());
                 patSatisfactionDetailEntity.setAnswerPerson(CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size());
                 patSatisfactionDetailEntity.setNoAnswerPerson(CollectionUtils.isNotEmpty(fillCount) && CollectionUtils.isNotEmpty(subids) ? (subids.size() - fillCount.size()) : CollectionUtils.isNotEmpty(subids) ? subids.size() : 0);
-                patSatisfactionDetailEntity.setAverageScore(averageScore(fillCount));
-                patSatisfactionDetailEntity.setMaxScore(maxScore(ivrLibaTemplateTargetoptions));
-                patSatisfactionDetailEntity.setMinScore(minScore(ivrLibaTemplateTargetoptions));
+                patSatisfactionDetailEntity.setAverageScore(String.valueOf(averageScore(fillCount)));
+                patSatisfactionDetailEntity.setMaxScore(String.valueOf(maxScore(ivrLibaTemplateTargetoptions)));
+                patSatisfactionDetailEntity.setMinScore(String.valueOf(minScore(ivrLibaTemplateTargetoptions)));
                 patSatisfactionDetailEntity.setAnswerRate(CollectionUtils.isEmpty(subids) ? 0 : CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size() * 1.0 / subids.size());
                 patSatisfactionDetailEntity.setMatchedtextStats(matchedtextStats);
                 patSatisfactionDetailEntities.add(patSatisfactionDetailEntity);
@@ -292,13 +292,23 @@
                 patSatisfactionDetailEntity.setScriptContent(svyLibTemplateScript.getScriptContent());
                 patSatisfactionDetailEntity.setAnswerPerson(CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size());
                 patSatisfactionDetailEntity.setNoAnswerPerson(CollectionUtils.isNotEmpty(fillCount) && CollectionUtils.isNotEmpty(subids) ? (subids.size() - fillCount.size()) : CollectionUtils.isNotEmpty(subids) ? subids.size() : 0);
-                patSatisfactionDetailEntity.setAverageScore(averageScore(fillCount));
+                patSatisfactionDetailEntity.setAverageScore(String.valueOf(averageScore(fillCount)));
 
-                OptionalDouble maxOpt = svyLibTemplateTargetoptions.stream().filter(dto -> dto.getScore() != null).mapToDouble(dto -> dto.getScore().doubleValue()).max();
-                patSatisfactionDetailEntity.setMaxScore(maxOpt.isPresent() ? new BigDecimal(maxOpt.getAsDouble()).setScale(1, RoundingMode.HALF_UP).doubleValue() : 0.0);
+                Double maxScore = svyLibTemplateTargetoptions.stream()
+                        .map(dto -> dto.getScore())
+                        .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty())
+                        .mapToDouble(Double::parseDouble)
+                        .max()
+                        .orElse(0.0);
+                patSatisfactionDetailEntity.setMaxScore(String.valueOf(maxScore));
 
-                OptionalDouble minOpt = svyLibTemplateTargetoptions.stream().filter(dto -> dto.getScore() != null).mapToDouble(dto -> dto.getScore().doubleValue()).min();
-                patSatisfactionDetailEntity.setMinScore(minOpt.isPresent() ? new BigDecimal(minOpt.getAsDouble()).setScale(1, RoundingMode.HALF_UP).doubleValue() : 0.0);
+                Double minScore = svyLibTemplateTargetoptions.stream()
+                        .map(dto -> dto.getScore())
+                        .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty())
+                        .mapToDouble(Double::parseDouble)
+                        .min()
+                        .orElse(0.0);
+                patSatisfactionDetailEntity.setMinScore(String.valueOf(minScore));
 
                 patSatisfactionDetailEntity.setAnswerRate(CollectionUtils.isEmpty(subids) ? 0 : CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size() * 1.0 / subids.size());
                 patSatisfactionDetailEntity.setMatchedtextStats(matchedtextStats);
@@ -397,9 +407,9 @@
                     patSatisfactionDetailEntity.setScriptContent(ivrLibaTemplateScript.getScriptContent());
                     patSatisfactionDetailEntity.setAnswerPerson(CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size());
                     patSatisfactionDetailEntity.setNoAnswerPerson(CollectionUtils.isNotEmpty(fillCount) && CollectionUtils.isNotEmpty(subids) ? (subids.size() - fillCount.size()) : CollectionUtils.isNotEmpty(subids) ? subids.size() : 0);
-                    patSatisfactionDetailEntity.setAverageScore(averageScore(fillCount));
-                    patSatisfactionDetailEntity.setMaxScore(maxScore(ivrLibaTemplateTargetoptions));
-                    patSatisfactionDetailEntity.setMinScore(minScore(ivrLibaTemplateTargetoptions));
+                    patSatisfactionDetailEntity.setAverageScore(String.valueOf(averageScore(fillCount)));
+                    patSatisfactionDetailEntity.setMaxScore(String.valueOf(maxScore(ivrLibaTemplateTargetoptions)));
+                    patSatisfactionDetailEntity.setMinScore(String.valueOf(minScore(ivrLibaTemplateTargetoptions)));
                     patSatisfactionDetailEntity.setAnswerRate(CollectionUtils.isEmpty(subids) ? 0 : CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size() * 1.0 / subids.size());
                     patSatisfactionDetailEntity.setMatchedtextStats(matchedtextStats);
                     patSatisfactionDetailEntities.add(patSatisfactionDetailEntity);
@@ -467,13 +477,23 @@
                     patSatisfactionDetailEntity.setScriptContent(svyLibTemplateScript.getScriptContent());
                     patSatisfactionDetailEntity.setAnswerPerson(CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size());
                     patSatisfactionDetailEntity.setNoAnswerPerson(CollectionUtils.isNotEmpty(fillCount) && CollectionUtils.isNotEmpty(subids) ? (subids.size() - fillCount.size()) : CollectionUtils.isNotEmpty(subids) ? subids.size() : 0);
-                    patSatisfactionDetailEntity.setAverageScore(averageScore(fillCount));
-
-                    OptionalDouble maxOpt = svyLibTemplateTargetoptions.stream().filter(dto -> dto.getScore() != null).mapToDouble(dto -> dto.getScore().doubleValue()).max();
-                    patSatisfactionDetailEntity.setMaxScore(maxOpt.isPresent() ? new BigDecimal(maxOpt.getAsDouble()).setScale(1, RoundingMode.HALF_UP).doubleValue() : 0.0);
-
-                    OptionalDouble minOpt = svyLibTemplateTargetoptions.stream().filter(dto -> dto.getScore() != null).mapToDouble(dto -> dto.getScore().doubleValue()).min();
-                    patSatisfactionDetailEntity.setMinScore(minOpt.isPresent() ? new BigDecimal(minOpt.getAsDouble()).setScale(1, RoundingMode.HALF_UP).doubleValue() : 0.0);
+                    patSatisfactionDetailEntity.setAverageScore(String.valueOf(averageScore(fillCount)));
+                    
+                    Double maxScore = svyLibTemplateTargetoptions.stream()
+                            .map(dto -> dto.getScore())
+                            .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty())
+                            .mapToDouble(Double::parseDouble)
+                            .max()
+                            .orElse(0.0);
+                    patSatisfactionDetailEntity.setMaxScore(String.valueOf(maxScore));
+                    
+                    Double minScore = svyLibTemplateTargetoptions.stream()
+                            .map(dto -> dto.getScore())
+                            .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty())
+                            .mapToDouble(Double::parseDouble)
+                            .min()
+                            .orElse(0.0);
+                    patSatisfactionDetailEntity.setMinScore(String.valueOf(minScore));
 
                     patSatisfactionDetailEntity.setAnswerRate(CollectionUtils.isEmpty(subids) ? 0 : CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size() * 1.0 / subids.size());
                     patSatisfactionDetailEntity.setMatchedtextStats(matchedtextStats);
@@ -766,8 +786,13 @@
      */
     private Double maxScore(List<IvrLibaTemplateTargetoption> options) {
         if (CollectionUtils.isEmpty(options)) return 0.0;
-        OptionalDouble maxOpt = options.stream().filter(dto -> dto.getScore() != null).mapToDouble(dto -> dto.getScore().doubleValue()).max();
-        return maxOpt.isPresent() ? new BigDecimal(maxOpt.getAsDouble()).setScale(1, RoundingMode.HALF_UP).doubleValue() : 0.0;
+        Double maxScore = options.stream()
+                .map(IvrLibaTemplateTargetoption::getScore)
+                .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty())
+                .mapToDouble(Double::parseDouble)
+                .max()
+                .orElse(0.0);
+        return maxScore;
     }
 
     /**
@@ -778,8 +803,13 @@
      */
     private Double minScore(List<IvrLibaTemplateTargetoption> options) {
         if (CollectionUtils.isEmpty(options)) return 0.0;
-        OptionalDouble minOpt = options.stream().filter(dto -> dto.getScore() != null).mapToDouble(dto -> dto.getScore().doubleValue()).min();
-        return minOpt.isPresent() ? new BigDecimal(minOpt.getAsDouble()).setScale(1, RoundingMode.HALF_UP).doubleValue() : 0.0;
+        Double minScore = options.stream()
+                .map(IvrLibaTemplateTargetoption::getScore)
+                .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty())
+                .mapToDouble(Double::parseDouble)
+                .min()
+                .orElse(0.0);
+        return minScore;
     }
 
     /**
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java
index dc3ff01..a020da7 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.RSAPublicKeyExample;
+import com.ruoyi.common.utils.StringUtils;
 import com.smartor.domain.ServiceOutPath;
 import com.smartor.domain.ServiceTask;
 import com.smartor.mapper.ServiceOutPathMapper;
@@ -77,8 +78,8 @@
         ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(Long.valueOf(serviceOutPath.getParam1()));
         RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
         String taskId = rsaPublicKeyExample.encryptedData(serviceOutPath.getParam1().toString(), pub_key);
-        String patid= rsaPublicKeyExample.encryptedData(serviceOutPath.getParam2().toString(), pub_key);
-        String subid= rsaPublicKeyExample.encryptedData(serviceOutPath.getParam6().toString(), pub_key);
+        String patid = rsaPublicKeyExample.encryptedData(serviceOutPath.getParam2().toString(), pub_key);
+        String subid = rsaPublicKeyExample.encryptedData(serviceOutPath.getParam6().toString(), pub_key);
         Date now = DateUtils.getNowDate();
         ServiceOutPath sop = new ServiceOutPath();
         sop.setParam1(taskId);
@@ -95,7 +96,7 @@
         serviceOutPathMapper.insertServiceOutPath(sop);
         //杞垚16杩涘埗骞跺洖鍐檙adix鍜寀pdateTime
         serviceOutPath.setRadix(String.format("%03X", sop.getId()));
-        serviceOutPath.setUrl(localIP + ":" + req_path + "/wt?p=" + sop.getRadix());
+        serviceOutPath.setUrl(StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + sop.getRadix() : localIP + "/wt?p=" + sop.getRadix());
         serviceOutPathMapper.updateServiceOutPath(serviceOutPath);
         return serviceOutPath.getUrl();
     }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
index 1ad6fc5..e54332e 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -690,7 +690,7 @@
         queryInhosp.setSerialnum(StringUtils.trim(patMedInhosp.getSerialnum()));
         queryInhosp.setOrgid(StringUtils.trim(dto.getOrgId()));
         queryInhosp.setInhospstate(cry);
-        log.info("----------------杩欓噷鐨勫叆鍙備负锛歿},{}", queryInhosp.getPatno(), queryInhosp.getSerialnum());
+//        log.info("----------------杩欓噷鐨勫叆鍙備负锛歿},{}", queryInhosp.getPatno(), queryInhosp.getSerialnum());
         List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhosp(queryInhosp);
 
         if (cry.equals("0")) {
@@ -733,7 +733,7 @@
             } else {
                 // 涓嶅瓨鍦ㄥ嚭闄㈣褰曪紝鍏堟煡棰勫叆闄紙state=3锛夛紝鍐嶆煡鍏ラ櫌锛坰tate=0锛�
                 queryInhosp.setInhospstate("3");
-                log.info("-----鏌ヨ棰勫叆闄㈣褰曪紝鍏ュ弬涓猴細{}", queryInhosp);
+//                log.info("-----鏌ヨ棰勫叆闄㈣褰曪紝鍏ュ弬涓猴細{}", queryInhosp);
                 List<PatMedInhosp> patMedInhospList = patMedInhospService.selectPatMedInhosp(queryInhosp);
                 log.info("----棰勫叆闄㈡煡璇㈢粨鏋滐細{}", CollectionUtils.isEmpty(patMedInhospList) ? "绌�" : patMedInhospList.get(0).getSerialnum());
                 if (CollectionUtils.isNotEmpty(patMedInhospList)) {
@@ -786,13 +786,14 @@
                     if (CollectionUtils.isEmpty(patMedInhospList3)) {
                         try {
                             //鑾峰彇涓�涓嬪叆闄㈢敵璇峰崟
-                            Map<String, String> headers = buildRequestHeaders();
-                            Map<String, Object> requestParams = new HashMap<>();
-                            requestParams.put("orgId", "20001001");
-                            requestParams.put("20001001", patArchive.getPatidHis());
-                            String result = HttpUtils.sendPostByHeader(sltdPubPath + "/hospitalizedApply/query", new Gson().toJson(requestParams), headers);
-
-
+                            //鏍规嵁 encounterSourceId 鑾峰彇 importanceFlagCode   emergencyLevelCode
+                            if (active.equals("sltd")) {
+                                Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId());
+                                if (ObjectUtils.isNotEmpty(applyInfo)) {
+                                    patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode"));
+                                    patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode"));
+                                }
+                            }
                             patMedInhospService.insertPatMedInhosp(patMedInhosp);
                             log.debug("鎴愬姛鎻掑叆棰勫叆闄㈣褰曪細serialnum={}", patMedInhosp.getSerialnum());
                         } catch (Exception e) {
@@ -842,7 +843,7 @@
         if ("1".equals(cry)) {
             patMedInhosp.setInhospstate("1");
             ServiceSLTDDiagnosisResDTO mainDischargeDiagnosis = dto.getMainDischargeDiagnosis();
-            log.info("-----------mainDischargeDiagnosis鐨勫�兼湁浜嗗悧?{}", mainDischargeDiagnosis);
+//            log.info("-----------mainDischargeDiagnosis鐨勫�兼湁浜嗗悧?{}", mainDischargeDiagnosis);
             if (!Objects.isNull(mainDischargeDiagnosis)) {
                 if (mainDischargeDiagnosis.getIsMainDiagnosis() == 1) {
                     patMedInhosp.setLeavediagname(StringUtils.defaultString(mainDischargeDiagnosis.getDiagnosisDictName(), ""));
@@ -871,11 +872,13 @@
         } else {
             setAdmissionInfo(patMedInhosp, dto);
             patMedInhosp.setEncounterSourceId(dto.getEncounterSourceId() == null ? "" : dto.getEncounterSourceId());
-            if (StringUtils.isNotEmpty(dto.getEncounterSourceId())) {
+            if (StringUtils.isNotEmpty(dto.getEncounterSourceId()) && active.equals("sltd")) {
                 //鏍规嵁 encounterSourceId 鑾峰彇 importanceFlagCode   emergencyLevelCode
                 Map<String, String> applyInfo = hospitalizedApply(dto.getEncounterSourceId(), dto.getOrgId());
-                patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode"));
-                patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode"));
+                if (!Objects.isNull(applyInfo)) {
+                    patMedInhosp.setImportanceFlagCode(applyInfo.get("importanceFlagCode"));
+                    patMedInhosp.setEmergencyLevelCode(applyInfo.get("emergencyLevelCode"));
+                }
             }
         }
 
@@ -903,7 +906,6 @@
                 patMedInhosp.setMedicalName(drugInfoMap.get("drugItemNames"));
                 patMedInhosp.setMedicalCode(drugInfoMap.get("drugItemIds"));
                 patMedInhosp.setMedicalCompany(drugInfoMap.get("drugManufacturerNames"));
-
                 log.info("鑾峰彇鑽搧淇℃伅鎴愬姛锛氬悕绉�={}, 缂栫爜={}, 鍘傚={}", drugInfoMap.get("drugItemNames"), drugInfoMap.get("drugItemIds"), drugInfoMap.get("drugManufacturerNames"));
             }
         }
@@ -958,7 +960,7 @@
                 String code = BigDecimal.valueOf(((Number) codeObj).longValue()).toPlainString();
                 if (!"200".equals(code)) {
                     log.error("銆恞ueryMedicalOrders銆戞帴鍙h繑鍥炲け璐ワ紝code={}, message={}", code, responseMap.get("message"));
-                    return result;
+                    return null;
                 }
             }
 
@@ -969,7 +971,7 @@
 
                 // 閬嶅巻鍖诲槺鍒楄〃锛屾彁鍙栬嵂鍝佷俊鎭�
                 Set<String> processedItemIds = new HashSet<>(); // 鐢ㄤ簬鍘婚噸锛堝彧鏍规嵁 itemId 鍘婚噸锛�
-                
+
                 for (Object item : dataList) {
                     if (item instanceof Map) {
                         Map<String, Object> itemMap = (Map<String, Object>) item;
@@ -995,7 +997,7 @@
 
                         // 鑷冲皯鏈変竴涓湁鍊硷紝澶勭悊姣忎釜瀛楁
                         String itemName = (itemNameObj != null && StringUtils.isNotEmpty(itemNameObj.toString())) ? itemNameObj.toString() : "";
-                        
+
                         // itemId 鐗规畩澶勭悊锛氶伩鍏嶇瀛﹁鏁版硶锛圙son 鍙兘灏嗘暟瀛楄В鏋愪负 Double锛�
                         String itemId = "";
                         if (itemIdObj != null && StringUtils.isNotEmpty(itemIdObj.toString())) {
@@ -1006,7 +1008,7 @@
                                 itemId = itemIdObj.toString();
                             }
                         }
-                        
+
                         String manufacturerName = (manufacturerNameObj != null && StringUtils.isNotEmpty(manufacturerNameObj.toString())) ? manufacturerNameObj.toString() : "";
 
                         // 鍙牴鎹� itemId 鍘婚噸锛堝悓涓�缂栫爜鐨勮嵂鍝佸彧淇濈暀涓�涓級
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 63a5cda..c52c87f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -165,14 +165,11 @@
 
     @Override
     public Integer saveQuestionAnswer(ServiceSubTaskAnswerReq serviceSubTaskAnswerReq, Long flag) {
+        //鍙傛暟瑙e瘑
         Long tid = null;
         Long pid = null;
         Long subid = null;
-        Double score = null;
-        Long isabno = 0L;
-        Set<String> allKeys = redisCache.getAllKeys();
         if (ObjectUtils.isNotEmpty(serviceSubTaskAnswerReq)) {
-            //闇�瑕佺珛鍗虫墽琛�
             RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
 
             if (flag == 0) {
@@ -185,18 +182,53 @@
                 pid = Long.valueOf(serviceSubTaskAnswerReq.getParam2());
                 subid = Long.valueOf(serviceSubTaskAnswerReq.getParam6());
             }
-            if (serviceSubTaskAnswerReq.getType() != null && serviceSubTaskAnswerReq.getType() == 2) {
-                allKeys = new HashSet<>();
-                allKeys.add(pid + "-" + tid + "-" + subid + "-WJscriptCache");
-            } else if (serviceSubTaskAnswerReq.getType() != null && serviceSubTaskAnswerReq.getType() == 1) {
-                allKeys = new HashSet<>();
-                allKeys.add(pid + "-" + tid + "-" + subid + "-SFscriptCache");
+        }
+
+        //鏍规嵁 PID銆乀ID銆丼UBID 鏋勫缓闇�瑕佸鐞嗙殑 cache key
+        String scriptCacheKeyPrefix = pid + "-" + tid + "-" + subid;
+        Set<String> targetKeys = new HashSet<>();
+
+        if (serviceSubTaskAnswerReq != null && serviceSubTaskAnswerReq.getType() != null) {
+            if (serviceSubTaskAnswerReq.getType() == 2) {
+                targetKeys.add(scriptCacheKeyPrefix + "-WJscriptCache");
+            } else if (serviceSubTaskAnswerReq.getType() == 1) {
+                targetKeys.add(scriptCacheKeyPrefix + "-SFscriptCache");
+            }
+        } else {
+            //濡傛灉娌℃湁 type锛屽垯閬嶅巻鎵�鏈� key锛堜繚鐣欏師鏈夊吋瀹规�э級
+            Set<String> allKeys = redisCache.getAllKeys();
+            for (String key : allKeys) {
+                try {
+                    if (key.contains(scriptCacheKeyPrefix) && (key.endsWith("-WJscriptCache") || key.endsWith("-SFscriptCache"))) {
+                        targetKeys.add(key);
+                    }
+                } catch (Exception e) {
+                    continue;
+                }
             }
         }
 
+        //鐢ㄤ簬鎵归噺鏇存柊鐨勫瓙浠诲姟鍒楄〃锛堥伩鍏嶅湪寰幆涓噸澶嶆煡璇級
+        Map<String, ServiceSubtask> subtaskCache = new HashMap<>();
+        String subtaskCacheKey = subid != null ? subid.toString() : pid + "-" + tid;
+
+        //鍏堟煡璇竴娆″瓙浠诲姟淇℃伅
+        ServiceSubtaskEntity ssVO = new ServiceSubtaskEntity();
+        if (subid != null) {
+            ssVO.setSubId(subid);
+        } else {
+            ssVO.setTaskid(tid);
+            ssVO.setPatid(pid);
+        }
+        List<ServiceSubtask> initialSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(ssVO);
+        if (CollectionUtils.isNotEmpty(initialSubtaskList)) {
+            subtaskCache.put(subtaskCacheKey, initialSubtaskList.get(0));
+        }
+
+        String score = "0";
         Long nextScriptno = null;
         aa:
-        for (String key : allKeys) {
+        for (String key : targetKeys) {
             String[] split = key.split("-");
             //鍏堝垽鏂紝鏄笉鏄綋鍓嶆彁浜や汉鐨勶紝涓嶆槸褰撳墠鎻愪氦浜虹殑锛岃烦杩�
             try {
@@ -227,10 +259,10 @@
                                 if (map == null) continue aa;
                                 if (!Objects.isNull(map.get("nextScriptNo")))
                                     nextScriptno = Long.valueOf(map.get("nextScriptNo"));
-                                if (score == null) {
-                                    score = Double.valueOf(map.get("score"));
+                                if (score == null || score.isEmpty()) {
+                                    score = map.get("score");
                                 } else {
-                                    score = score + Double.valueOf(map.get("score"));
+                                    score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                                 }
                             }
                         }
@@ -247,9 +279,9 @@
                             if (!Objects.isNull(map.get("nextScriptNo")))
                                 nextScriptno = Long.valueOf(map.get("nextScriptNo"));
                             if (score == null) {
-                                score = Double.valueOf(map.get("score"));
+                                score = map.get("score");
                             } else {
-                                score = score + Double.valueOf(map.get("score"));
+                                score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                             }
                         }
                     }
@@ -269,10 +301,10 @@
                                 Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, tid, pid, subid);
                                 if (!Objects.isNull(map.get("nextScriptNo")))
                                     nextScriptno = Long.valueOf(map.get("nextScriptNo"));
-                                if (score == null) {
-                                    score = Double.valueOf(map.get("score"));
+                                if (score == null || score.isEmpty()) {
+                                    score = map.get("score");
                                 } else {
-                                    score = score + Double.valueOf(map.get("score"));
+                                    score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                                 }
                             }
                         }
@@ -288,9 +320,9 @@
                             if (!Objects.isNull(map.get("nextScriptNo")))
                                 nextScriptno = Long.valueOf(map.get("nextScriptNo"));
                             if (score == null) {
-                                score = Double.valueOf(map.get("score"));
+                                score = map.get("score");
                             } else {
-                                score = score + Double.valueOf(map.get("score"));
+                                score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                             }
                         }
                     }
@@ -298,39 +330,74 @@
             } else {
                 continue;
             }
-            //灏嗚key鍜寁alue浠巖edis涓紝鍒犻櫎
+            //灏嗚 key 鍜� value 浠� redis 涓紝鍒犻櫎
             redisCache.deleteObject(key);
 
-            //鏌ヨ鍑鸿浠诲姟涓鍦ㄦ墽琛岀殑鎮h�呬俊鎭�
-            ServiceSubtaskEntity ssVO = new ServiceSubtaskEntity();
-            ssVO.setTaskid(tid);
-            ssVO.setPatid(pid);
-//            ssVO.setSendstate(3L);
-            List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(ssVO);
+            //鏌ヨ鍑鸿浠诲姟涓鍦ㄦ墽琛岀殑鎮h�呬俊鎭紙浣跨敤缂撳瓨锛�
+            String currentSubtaskKey = subid != null ? subid.toString() : pid + "-" + tid;
+            ServiceSubtask serviceSubtask;
 
-            ServiceSubtask serviceSubtask = new ServiceSubtask();
-            serviceSubtask.setTaskid(tid);
-            serviceSubtask.setPatid(pid);
-            serviceSubtask.setSubmit(1L);
+            if (!subtaskCache.containsKey(currentSubtaskKey)) {
+                ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity();
+                if (subid != null) {
+                    serviceSubtaskEntity.setSubId(subid);
+                } else {
+                    serviceSubtaskEntity.setTaskid(tid);
+                    serviceSubtaskEntity.setPatid(pid);
+                }
+//            ssVO.setSendstate(3L);
+                List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskEntity);
+                if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
+                    serviceSubtask = serviceSubtaskList.get(0);
+                    subtaskCache.put(currentSubtaskKey, serviceSubtask);
+                } else {
+                    continue;
+                }
+            } else {
+                serviceSubtask = subtaskCache.get(currentSubtaskKey);
+            }
+
             serviceSubtask.setIsabnormal(serviceSubTaskAnswerReq.getIsabnormal());
             serviceSubtask.setSendstate(6L);
             serviceSubtask.setExcep(serviceSubTaskAnswerReq.getExcep());
             serviceSubtask.setFinishtime(new Date());
             serviceSubtask.setUpdateTime(new Date());
             log.error("灏嗚key鍜寁alue浠巖edis涓�,serviceSubtask鐨勫�间负--------锛歿}", serviceSubtask);
-            if (score != null) serviceSubtask.setScore(BigDecimal.valueOf(score));
+            if (score != null && !score.isEmpty()) serviceSubtask.setScore(score);
             serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
+            //淇敼浣忛櫌婊℃剰搴︾姸鎬侊紙閬垮厤閲嶅鏌ヨ锛�
+            if (serviceSubtask.getServiceType() != null && "6".equals(serviceSubtask.getServiceType())) {
+                Long inhospid = serviceSubtask.getInhospid();
+                if (inhospid != null) {
+                    PatMedInhosp patMedInhosp = new PatMedInhosp();
+                    patMedInhosp.setInhospMydFlag("1");
+                    patMedInhosp.setInhospid(inhospid);
+                    patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
+                }
+            }
 
-            //灏嗗綋鍓嶅彂閫佺姸鎬佹敼鎴�9瀹屾垚
-            ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
-            serviceSubtaskPreachform.setPreachform(serviceSubtaskList.get(0).getCurrentPreachform());
-            serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
-            serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
-            List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
-            if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) {
-                ServiceSubtaskPreachform ssp = serviceSubtaskPreachforms.get(0);
-                ssp.setSendstate("9");
-                serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(ssp);
+            //灏嗗綋鍓嶅彂閫佺姸鎬佹敼鎴� 9 瀹屾垚锛堢紦瀛� preachform 鏌ヨ锛�
+            String currentPreachform = serviceSubtask.getCurrentPreachform();
+            if (StringUtils.isNotEmpty(currentPreachform)) {
+                ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
+                serviceSubtaskPreachform.setPreachform(currentPreachform);
+                if (subid != null) {
+                    serviceSubtaskPreachform.setSubid(subid);
+                } else {
+                    Long id = serviceSubtask.getId();
+                    Long tid_ = serviceSubtask.getTaskid();
+                    if (id != null) {
+                        serviceSubtaskPreachform.setSubid(id);
+                    } else if (tid_ != null) {
+                        serviceSubtaskPreachform.setTaskid(tid_);
+                    }
+                }
+                List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
+                if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) {
+                    ServiceSubtaskPreachform ssp = serviceSubtaskPreachforms.get(0);
+                    ssp.setSendstate("9");
+                    serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(ssp);
+                }
             }
 
         }
@@ -342,7 +409,7 @@
         Long tid = Long.valueOf(serviceSubTaskCacheReq.getParam1());
         Long pid = Long.valueOf(serviceSubTaskCacheReq.getParam2());
         Long subid = Long.valueOf(serviceSubTaskCacheReq.getParam6());
-        Double score = null;
+        String score = "0";
         if (ObjectUtils.isNotEmpty(serviceSubTaskCacheReq)) {
             Long nextScriptno = null;
             String isabnormalFlag = "0";
@@ -396,9 +463,9 @@
                             nextScriptno = Long.valueOf(map.get("nextScriptNo"));
 
                         if (score == null) {
-                            score = Double.valueOf(map.get("score"));
+                            score = map.get("score");
                         } else {
-                            score = score + Double.valueOf(map.get("score"));
+                            score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                         }
                         isabnormalFlag = map.get("isabnormal");
                     }
@@ -439,9 +506,9 @@
                         if (!Objects.isNull(map.get("nextScriptNo")))
                             nextScriptno = Long.valueOf(map.get("nextScriptNo"));
                         if (score == null) {
-                            score = Double.valueOf(map.get("score"));
+                            score = map.get("score");
                         } else {
-                            score = score + Double.valueOf(map.get("score"));
+                            score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                         }
                         isabnormalFlag = map.get("isabnormal");
                     }
@@ -464,7 +531,7 @@
             serviceSubtask.setExcep(isabnormalFlag);
             serviceSubtask.setFinishtime(new Date());
             serviceSubtask.setUpdateTime(new Date());
-            if (score != null) serviceSubtask.setScore(BigDecimal.valueOf(score));
+            if (score != null && !score.isEmpty()) serviceSubtask.setScore(score);
             serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
 
             //灏嗗綋鍓嶅彂閫佺姸鎬佹敼鎴�9瀹屾垚
@@ -520,7 +587,7 @@
         }
 
         if (CollectionUtils.isNotEmpty(serviceSubTaskMYDAnswerReq.getSvyTaskTemplateScriptVOS())) {
-            Double score = null;
+            String score = "0";
             List<SvyTaskTemplateScriptVO> svyTaskTemplateScriptVOS = serviceSubTaskMYDAnswerReq.getSvyTaskTemplateScriptVOS();
             Long nextScriptno = null;
 
@@ -552,13 +619,12 @@
                     if (map == null) continue;
 
                     log.error("nextScriptNo 鐨勪俊鎭负锛歿}", map.get("nextScriptNo"));
-                    if (!Objects.isNull(map.get("nextScriptNo")))
-                        nextScriptno = Long.valueOf(map.get("nextScriptNo"));
+                    if (!Objects.isNull(map.get("nextScriptNo"))) nextScriptno = Long.valueOf(map.get("nextScriptNo"));
 
-                    if (score == null) {
-                        score = Double.valueOf(map.get("score"));
+                    if (score == null || score.isEmpty()) {
+                        score = map.get("score");
                     } else {
-                        score = score + Double.valueOf(map.get("score"));
+                        score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score")));
                     }
 
                     if (!Objects.isNull(map.get("id"))) {
@@ -621,7 +687,7 @@
                 serviceSubtask.setUpdateTime(new Date());
                 serviceSubtask.setCreateTime(new Date());
                 serviceSubtask.setVisitTime(new Date());
-                if (score != null) serviceSubtask.setScore(BigDecimal.valueOf(score));
+                if (score != null && !score.isEmpty()) serviceSubtask.setScore(score);
                 serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
                 //灏嗗綋鍓嶅彂閫佺姸鎬佹敼鎴�9瀹屾垚
                 ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
@@ -982,13 +1048,23 @@
         //鑾峰彇涓�涓嬮棶棰橀�夐」
         SvyTaskTemplateTargetoption stt = null;
         Long isabnormalFlag = 0L;
+        String scriptResultRaw = svyTaskTemplateScriptVO.getScriptResult();
+        //鍘婚櫎涓枃鍙屽紩鍙峰拰鑻辨枃鍙屽紩鍙蜂互鍙婄┖鐧藉瓧绗�
+        String scriptResult = scriptResultRaw != null ? scriptResultRaw.replaceAll("^[\"\"]|[\"\"]$", "").trim() : null;
         for (SvyTaskTemplateTargetoption svyTaskTemplateTargetoption : svyTaskTemplateScriptVO.getSvyTaskTemplateTargetoptions()) {
-            if (StringUtils.isNotEmpty(svyTaskTemplateTargetoption.getOptioncontent()) && svyTaskTemplateTargetoption.getOptioncontent().trim().equals(svyTaskTemplateScriptVO.getScriptResult()))
-                stt = svyTaskTemplateTargetoption;
+            String optionContent = svyTaskTemplateTargetoption.getOptioncontent();
+            if (StringUtils.isNotEmpty(optionContent) && StringUtils.isNotEmpty(scriptResult)) {
+                //鍘婚櫎涓ょ绌虹櫧骞跺鐞嗙壒娈婂瓧绗﹁繘琛屾瘮杈�
+                if (optionContent.trim().replaceAll("\\s+", "").equals(scriptResult.replaceAll("\\s+", ""))) {
+                    stt = svyTaskTemplateTargetoption;
+                    log.error("鎵惧埌鍖归厤鐨勯�夐」");
+                    break; // 鎵惧埌鍖归厤椤瑰悗璺冲嚭寰幆
+                }
+            }
         }
 
-        //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
-        if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && stt != null && 1 == stt.getIsabnormal()) {
+        //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓� dutyDeptCode 鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+        if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && stt != null && Long.valueOf(1L).equals(stt.getIsabnormal()) || StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getIsMydException())) {
             isabnormalFlag = 1L;
             ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
             subtaskDetailTrace.setDetailId(serviceSubtaskDetail.getId());
@@ -996,24 +1072,25 @@
             subtaskDetailTrace.setTaskid(serviceSubtaskDetailVO.getTaskid());
             subtaskDetailTrace.setTemplateid(StringUtils.isNotEmpty(serviceSubtaskDetailVO.getTemplateid()) ? Long.valueOf(serviceSubtaskDetailVO.getTemplateid()) : null);
             subtaskDetailTrace.setTemplatequestionnum(svyTaskTemplateScriptVO.getScriptid());
-            subtaskDetailTrace.setSwitchid(stt.getId());
+            subtaskDetailTrace.setSwitchid(stt != null ? stt.getId() : null);
             subtaskDetailTrace.setQuestiontext(svyTaskTemplateScriptVO.getScriptContent());
             subtaskDetailTrace.setQuestionvoice(null);
             subtaskDetailTrace.setCategoryname(svyTaskTemplateScriptVO.getCategoryName());
             subtaskDetailTrace.setCategoryid(svyTaskTemplateScriptVO.getCategoryid());
             //鑾峰彇鎵�鏈夐�夐」
-            subtaskDetailTrace.setTargetid(stt.getId());
+            subtaskDetailTrace.setTargetid(stt != null ? stt.getId() : null);
             subtaskDetailTrace.setTargetvalue(serviceSubtaskDetailVO.getTargetvalue());
-            subtaskDetailTrace.setMatchedtext(stt.getOptioncontent());
+            subtaskDetailTrace.setMatchedtext(stt != null ? stt.getOptioncontent() : svyTaskTemplateScriptVO.getIsMydException());
             subtaskDetailTrace.setGuid(svyTaskTemplateScriptVO.getGuid());
             subtaskDetailTrace.setValueType(serviceSubtaskDetail.getValueType());
+            subtaskDetailTrace.setIsMydException(svyTaskTemplateScriptVO.getIsMydException());
             subtaskDetailTrace.setTemplateType(2);
 
             SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(svyTaskTemplateScriptVO.getCategoryid());
             subtaskDetailTrace.setType(svyLibScriptCategory != null ? svyLibScriptCategory.getType() : null);
 
             subtaskDetailTrace.setScriptid(svyTaskTemplateScriptVO.getId());
-            subtaskDetailTrace.setAsrtext(stt.getOptioncontent());
+            subtaskDetailTrace.setAsrtext(stt != null ? stt.getOptioncontent() : svyTaskTemplateScriptVO.getIsMydException());
             subtaskDetailTrace.setRecordpath(null);
             subtaskDetailTrace.setPatid(selectServiceSubtaskList.get(0).getPatid());
             JSONObject patdescJson1 = new JSONObject();
@@ -1039,7 +1116,7 @@
                 subtaskDetailTrace.setId(existTraceId);
                 traceService.updateServiceSubtaskDetailTtrace(subtaskDetailTrace);
             } else traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
-        } else if (ObjectUtils.isNotEmpty(stt) && stt.getIsabnormal() != 1L) {
+        } else if (ObjectUtils.isNotEmpty(stt) && !Long.valueOf(1L).equals(stt.getIsabnormal())) {
             //杩欓噷涓昏鏄�曞尰鎶や汉鍛樻妸寮傚父閫夐」鏀规垚浜嗛潪寮傚父鐨勶紝杩欓噷灏遍渶瑕佹煡涓�涓嬭繖鏉℃暟鎹槸涓嶆槸鍦ㄦ弧鎰忓害寮傚父琛紝濡傛灉鍦紝鍒欒鍒犻櫎
             Long existTraceId = existingTraceIdMap.get(svyTaskTemplateScriptVO.getId());
             if (existTraceId != null) {
@@ -1261,12 +1338,13 @@
 
 
         //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
-        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == stt.getIsabnormal()) {
+        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == stt.getIsabnormal() || StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIsMydException())) {
             isabnormalFlag = "1";
             ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
             subtaskDetailTrace.setDetailId(serviceSubtaskDetail.getId());
             subtaskDetailTrace.setSubId(serviceSubtaskDetailVO.getSubId());
             subtaskDetailTrace.setTaskid(serviceSubtaskDetailVO.getTaskid());
+            subtaskDetailTrace.setIsMydException(serviceSubtaskDetailVO.getIsMydException());
             subtaskDetailTrace.setTemplateid(ivrTaskTemplateScriptVO.getTemplateID() != null ? Long.valueOf(ivrTaskTemplateScriptVO.getTemplateID()) : null);
             subtaskDetailTrace.setTemplatequestionnum(ivrTaskTemplateScriptVO.getSort() == null ? null : Long.valueOf(ivrTaskTemplateScriptVO.getSort()));
 
@@ -1276,7 +1354,7 @@
                 ivrLibaScriptAssort = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortById(ivrTaskTemplateScriptVO.getScriptAssortid());
 
             //鑾峰彇鐢ㄦ埛閫夊嚭鐨勯�夐」鐨処D
-            subtaskDetailTrace.setSwitchid(stt.getId());
+            subtaskDetailTrace.setSwitchid(stt != null ? stt.getId() : null);
             subtaskDetailTrace.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
             subtaskDetailTrace.setQuestionvoice(null);
             subtaskDetailTrace.setCategoryname(StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getScriptAssortname()) ? ivrTaskTemplateScriptVO.getScriptAssortname() : (ivrLibaScriptAssort != null ? ivrLibaScriptAssort.getIndexAssortName() : ""));
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 8e22d35..06899f4 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -25,6 +25,7 @@
 import com.smartor.domain.*;
 import com.smartor.domain.VO.HeLibraryCountVO;
 import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
+import com.smartor.domain.VO.TransferDeptVO;
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import com.smartor.mapper.*;
 import com.smartor.service.*;
@@ -416,9 +417,9 @@
         }
         //鎮h�呰幏鍙栭殢璁夸换鍔�-闇�瑕佹煡璇㈠悓涓偅鑰咃紙韬唤璇侊級鎵�鏈夌殑浠诲姟 鏅畞
         if (StringUtils.isNotEmpty(serviceSubtaskEntity.getOrgid()) && serviceSubtaskEntity.getOrgid().equals("47255004333112711A1001")) {
-            if(ObjectUtils.isNotEmpty(serviceSubtaskEntity.getPatid())){
+            if (ObjectUtils.isNotEmpty(serviceSubtaskEntity.getPatid())) {
                 PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtaskEntity.getPatid());
-                if(ObjectUtils.isNotEmpty(patArchive) && StringUtils.isNotEmpty(patArchive.getIdcardno())){
+                if (ObjectUtils.isNotEmpty(patArchive) && StringUtils.isNotEmpty(patArchive.getIdcardno())) {
                     serviceSubtaskEntity.setPatid(null);
                     serviceSubtaskEntity.setSfzh(patArchive.getIdcardno());
                 }
@@ -460,6 +461,28 @@
             serviceSubtaskResList.add(serviceSubtaskRes);
         }
         return serviceSubtaskResList;
+    }
+
+    @Override
+    public Integer transferDept(TransferDeptVO transferDeptVO) {
+        log.info("transferDept鐨勫叆鍙備负锛歿}", transferDeptVO);
+        //鏌ヨ璇ユ偅鑰呯殑瀛愪换鍔′俊鎭�
+        ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(transferDeptVO.getSubId());
+        if (ObjectUtils.isEmpty(serviceSubtask)) throw new BaseException("杞偅鑰呭け璐ワ紝璇疯仈绯荤鐞嗗憳澶勭悊");
+        //鍒犻櫎璇ユ偅鑰呯殑淇℃伅閫氳繃subid
+        serviceSubtaskMapper.deleteServiceSubtaskById(transferDeptVO.getSubId());
+
+        //淇敼鎮h�呯殑绂婚櫌绉戝鐥呭尯閫氳繃inhospid鍜屾偅鑰呯殑浠诲姟鐢熸垚鐘舵��
+        PatMedInhosp patMedInhosp = new PatMedInhosp();
+        patMedInhosp.setInhospid(serviceSubtask.getInhospid());
+        patMedInhosp.setLeaveldeptcode(transferDeptVO.getLeavelDeptCode());
+        patMedInhosp.setLeaveldeptname(transferDeptVO.getLeavelDeptName());
+        patMedInhosp.setLeavehospitaldistrictcode(transferDeptVO.getLeavehospitaldistrictcode());
+        patMedInhosp.setLeavehospitaldistrictname(transferDeptVO.getLeavehospitaldistrictname());
+        patMedInhosp.setDeptcheckFlag("0");
+        patMedInhosp.setWardcheckFlag("0");
+        patMedInhosp.setDiagcheckFlag("0");
+        return patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
     }
 
     public Map<String, String> calculateAge(LocalDate birthdate, LocalDate today) {
@@ -625,8 +648,8 @@
         iServiceOutPathService.updateServiceOutPath(serviceOutPath);
 
         Map<String, Object> result = new HashMap<>();
-        result.put("url", localIP + ":" + req_path + "/wt?p=" + format);
-        result.put("subId",serviceSubtask.getId());
+        result.put("url", StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format);
+        result.put("subId", serviceSubtask.getId());
         return result;
     }
 
@@ -924,7 +947,7 @@
                             serviceTaskmedical.setMedicalCode(medicalNames[i]);
                             serviceTaskmedical.setMedicalName(medicalcodes[i]);
                             if (ObjectUtils.isNotEmpty(medicalCompanys))
-                                serviceTaskmedical.setMedicalCompany(medicalcodes[i]);
+                                serviceTaskmedical.setMedicalCompany(medicalCompanys[i]);
                             serviceTaskmedicalService.insertServiceTaskmedical(serviceTaskmedical);
                         }
                     }
@@ -1020,10 +1043,8 @@
                         if (schedule == null) {
                             throw new BaseException("appltype=5 浠诲姟缁勶細鏈壘鍒� taskid=" + serviceTask.getTaskid() + " 鐨勮鍒�");
                         }
-                        List<ServiceTaskScheduleDetail> detailList =
-                                serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
-                        scheduleSubtaskBuilder.buildSubtasksForPatient(
-                                serviceTask, serviceTaskVO.getPreachformList(), schedule, detailList, patTaskRelevance, serviceSubtask);
+                        List<ServiceTaskScheduleDetail> detailList = serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
+                        scheduleSubtaskBuilder.buildSubtasksForPatient(serviceTask, serviceTaskVO.getPreachformList(), schedule, detailList, patTaskRelevance, serviceSubtask);
                         continue;
                     }
 
@@ -1050,7 +1071,8 @@
                 }
             }
 
-        } else if (serviceTaskVO.getIsoperation() != null && serviceTaskVO.getIsoperation() == 2) {
+        }
+        else if (serviceTaskVO.getIsoperation() != null && serviceTaskVO.getIsoperation() == 2) {
             //浠诲姟淇敼
             if (ObjectUtils.isNotEmpty(serviceTaskVO.getSendTimeslot()))
                 serviceTask.setSendTimeSlot(JSON.toJSONString(serviceTaskVO.getSendTimeslot()));
@@ -1205,7 +1227,7 @@
                     ServiceTaskmedical serviceTaskmedical = new ServiceTaskmedical();
                     serviceTaskmedical.setTaskId(serviceTask.getTaskid());
                     serviceTaskmedical.setTaskName(serviceTask.getTaskName());
-                    if (StringUtils.isEmpty(serviceTaskVO.getIcd10code())) {
+                    if (StringUtils.isEmpty(serviceTaskVO.getMedicalCode())) {
                         throw new BaseException("鑽搧缂栫爜涓虹┖");
                     }
                     serviceTaskmedical.setLongtask(Long.valueOf(serviceTask.getLongTask()));
@@ -1221,21 +1243,24 @@
                     if (StringUtils.isNotEmpty(serviceTaskVO.getMedicalCode())) {
                         String[] medicalCodes = serviceTaskVO.getMedicalCode().split(",");
                         String[] medicalNames = serviceTaskVO.getMedicalName().split(",");
-                        String[] medicalCompany = serviceTaskVO.getMedicalCompany().split(",");
+                        String[] medicalCompanys = serviceTaskVO.getMedicalCompany().split(",");
                         if (!active.equals("nhfy") && !active.equals("druid")) {
-                            if (medicalCodes.length != medicalNames.length) {
-                                throw new BaseException("鑽搧缂栫爜鍜岃嵂鍝佸悕绉版暟閲忎笉涓�鑷�");
+                            if (medicalCodes.length != medicalNames.length && medicalNames.length != medicalCompanys.length) {
+                                throw new BaseException("鑽搧缂栫爜鍜岃嵂鍝佸悕绉版暟閲忎笉涓�鑷存垨鑰呰嵂鍝佸悕绉板拰鑽搧鍏徃鏁伴噺涓嶄竴鑷�");
                             }
                         }
+
                         for (int i = 0; i < medicalCodes.length; i++) {
                             //鍏堟煡璇竴涓嬫槸鍚﹀瓨鍦�
                             ServiceTaskmedical serviceTaskmedical1 = new ServiceTaskmedical();
                             serviceTaskmedical1.setTaskId(serviceTaskVO.getTaskid());
                             serviceTaskmedical1.setMedicalCode(medicalCodes[i]);
                             serviceTaskmedical1.setMedicalName(medicalNames[i]);
+                            serviceTaskmedical1.setMedicalCompany(medicalCompanys[i]);
                             List<ServiceTaskmedical> serviceTaskmedicals = serviceTaskmedicalService.selectServiceTaskmedicalList(serviceTaskmedical1);
                             serviceTaskmedical.setMedicalCode(medicalCodes[i]);
                             serviceTaskmedical.setMedicalName(medicalNames[i]);
+                            serviceTaskmedical.setMedicalCompany(medicalCompanys[i]);
                             log.info("----serviceTaskmedical鏇存柊鐨勫�间负锛歿}", serviceTaskmedical);
                             if (CollectionUtils.isNotEmpty(serviceTaskmedicals)) {
                                 serviceTaskmedical.setId(serviceTaskmedicals.get(0).getId());
@@ -1363,12 +1388,10 @@
                             if (schedule == null) {
                                 throw new BaseException("appltype=5 浠诲姟缁勶細鏈壘鍒� taskid=" + serviceTask.getTaskid() + " 鐨勮鍒�");
                             }
-                            List<ServiceTaskScheduleDetail> detailList =
-                                    serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
+                            List<ServiceTaskScheduleDetail> detailList = serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
                             serviceSubtask.setUpdateBy(serviceTask.getUpdateBy());
                             serviceSubtask.setCreateBy(serviceTask.getUpdateBy());
-                            scheduleSubtaskBuilder.buildSubtasksForPatient(
-                                    serviceTask, serviceTaskVO.getPreachformList(), schedule, detailList, patTaskRelevance, serviceSubtask);
+                            scheduleSubtaskBuilder.buildSubtasksForPatient(serviceTask, serviceTaskVO.getPreachformList(), schedule, detailList, patTaskRelevance, serviceSubtask);
                             continue;
                         }
                         if (patTaskRelevance.getIsoperation() == 2) {
@@ -1830,7 +1853,7 @@
                 Long id = serviceSubtask.getId();
                 //鍏堟洿鏂颁竴涓嬪垎鏁�
                 double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
-                serviceSubtask.setScore(BigDecimal.valueOf(score));
+                serviceSubtask.setScore(String.valueOf(score));
                 serviceSubtask.setFinishtime(new Date());
                 serviceSubtask.setUpdateTime(new Date());
                 log.error("鍏堟洿鏂颁竴涓嬪垎鏁�,鐢佃瘽鐨剆erviceSubtask鐨勫�间负锛歿}", serviceSubtask);
@@ -1924,236 +1947,48 @@
                 //鐢ㄦ潵鏍囪锛屾槸鍚︽湁鍖归厤涓婄殑
                 Integer flag = 0;
                 //1-AI璇嗗埆
-                String url = configService.selectConfigByKey("sys.voice.match.ai.url",phoneCallReqYQVO.getOrgid());
+                String url = configService.selectConfigByKey("sys.voice.match.ai.url", phoneCallReqYQVO.getOrgid());
 
-            if (ObjectUtils.isNotEmpty(url)) {
-                PhoneCallBackYQVO aiMatchResult = AiMatch(url, phoneCallReqYQVO, phoneCallBackYQVO,
-                        ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate,
-                        ivrTaskTemplateScripts, scriptId, flag, phoneCallReqYQVO.getUuid());
-                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;
+                if (ObjectUtils.isNotEmpty(url)) {
+                    PhoneCallBackYQVO aiMatchResult = AiMatch(url, phoneCallReqYQVO, phoneCallBackYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate, ivrTaskTemplateScripts, scriptId, flag, phoneCallReqYQVO.getUuid());
+                    if (aiMatchResult != null) {
+                        return aiMatchResult;
                     }
-                    boolean matchedFlag = false;
-                    //鍖呭惈
-                    Matcher matcher = null;
-                    if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
-                        Pattern pattern = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex());
-                        matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
-                    }
-                    //涓嶅寘鍚�
-                    Matcher matcher2 = null;
-                    if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
-                        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()) {
-                        matchedFlag = true;
-                    }
-                    //璇存槑鍖归厤姝g‘浜�
-                    if(matchedFlag){
-                        //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
-                        log.info("鍖归厤姝g‘浜嗗悧--------------");
-                        ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(1);
-                        serviceTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j));
-
-                        //灏嗘偅鑰呯殑鍥炵鍐欒繘service_subtask_detail涓�
-                        ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
-                        List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
-                        ivrTaskTemplateScriptVO.setQuestionResult(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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);
-                            }
+                } else {
+                    //鏄�夋嫨棰�
+                    for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
+                        log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
+                        if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) {
+                            continue;
                         }
-                        serviceSubtaskDetailList.add(serviceSubtaskDetail);
-                        serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
-                        serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
-                        serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
-                        saveQuestionAnswerPhone(serviceSubTaskDetailReq);
-
-                        //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
-                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getId());
-                            subtaskDetailTrace.setTargetvalue(optionDescStr);
-                            subtaskDetailTrace.setMatchedtext(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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);
+                        boolean matchedFlag = false;
+                        //鍖呭惈
+                        Matcher matcher = null;
+                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
+                            Pattern pattern = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex());
+                            matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
+                        }
+                        //涓嶅寘鍚�
+                        Matcher matcher2 = null;
+                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
+                            Pattern pattern2 = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
+                            matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
                         }
 
-                        //鍒ゆ柇涓�涓嬶紝杩欎釜閫夐」缁撴灉鏄笉鏄繕鏈夌户缁棶涓嬪幓鐨勫繀瑕侊紝渚嬪閫夐」缁撴灉鏄埆浜轰笉鎯崇户缁洖绛旈棶棰橈紝灏辫缁撴潫鎺�
-                        if (ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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;
+                        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()) {
+                            matchedFlag = true;
                         }
+                        //璇存槑鍖归厤姝g‘浜�
+                        if (matchedFlag) {
+                            //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
+                            log.info("鍖归厤姝g‘浜嗗悧--------------");
+                            ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(1);
+                            serviceTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j));
 
-                        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 = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
-                                //鏇存柊鍒嗘暟
-                                double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
-                                score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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 (j == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
+                            //灏嗘偅鑰呯殑鍥炵鍐欒繘service_subtask_detail涓�
                             ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
                             List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+                            ivrTaskTemplateScriptVO.setQuestionResult(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getOptiondesc());
                             ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
                             //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
                             if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
@@ -2165,17 +2000,203 @@
                                 }
                             }
                             serviceSubtaskDetailList.add(serviceSubtaskDetail);
-                            //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
-                            serviceSubtaskDetailList.get(0).setMatchedtext("");
                             serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
                             serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
                             serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
                             saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+
+                            //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+                            if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getId());
+                                subtaskDetailTrace.setTargetvalue(optionDescStr);
+                                subtaskDetailTrace.setMatchedtext(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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 (ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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 = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
+                                    //鏇存柊鍒嗘暟
+                                    double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                                    score = BigDecimal.valueOf(score).add(new BigDecimal(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(new BigDecimal(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).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(String.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 (j == 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);
+                            }
+                            continue;
                         }
-                        continue;
                     }
                 }
-            }
                 //閮芥病鏈夊尮閰嶅埌
                 if (StringUtils.isEmpty(phoneCallBackYQVO.getValue())) {
                     log.info("閮芥病鏈夊尮閰嶅埌-------------------------");
@@ -2197,7 +2218,7 @@
                             Double score = null;
                             Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                             if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
-                            serviceSubtask.setScore(BigDecimal.valueOf(score));
+                            serviceSubtask.setScore(String.valueOf(score));
                             serviceSubtask.setFinishtime(new Date());
                             serviceSubtask.setSendstate(6L);
                             serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
@@ -2231,7 +2252,7 @@
                                     Double score = null;
                                     Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                                     if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
-                                    score = BigDecimal.valueOf(score).add(script.getScore()).doubleValue();
+                                    score = BigDecimal.valueOf(score).add(new BigDecimal(script.getScore())).doubleValue();
 
                                     redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
                                 }
@@ -2286,7 +2307,7 @@
                             Double score = null;
                             Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                             if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
-                            score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getScore()).doubleValue();
+                            score = BigDecimal.valueOf(score).add(new BigDecimal(ivrTaskTemplateScriptVO.getScore())).doubleValue();
                             redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
 
                         }
@@ -2302,7 +2323,7 @@
                     Double score = null;
                     Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                     if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
-                    serviceSubtask.setScore(BigDecimal.valueOf(score));
+                    serviceSubtask.setScore(String.valueOf(score));
                     serviceSubtask.setFinishtime(new Date());
                     serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
                     serviceSubtask.setSendstate(6L);
@@ -2799,7 +2820,7 @@
         log.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
         String drcode = "drcode";
         //缂欎簯浜烘皯 鏍规嵁缁忕鍖荤敓鍒嗙粍
-        if(serviceSubtaskCountReq.getOrgid().equals("47246116333112211A1001")){
+        if (serviceSubtaskCountReq.getOrgid().equals("47246116333112211A1001")) {
             drcode = "management_doctor_code";
         }
         String groupKey = drcode;
@@ -4901,9 +4922,10 @@
             if (smsResult != null && smsResult.get("result") != null && smsResult.get("result").toString().equals("0")) {
                 resultMap.put("code", "200");
                 resultMap.put("msg", "鍙戦�佹垚鍔�");
-                serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";鐭俊鍙戦�佹垚鍔�" : "鐭俊鍙戦�佹垚鍔�");
+                serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";鐭俊鍙戦�佹垚鍔�(鎵嬪姩鎻愪氦)" : "鐭俊鍙戦�佹垚鍔�(鎵嬪姩鎻愪氦)");
                 log.info("鏄惁鍙戦�佹垚鍔燂細{}", serviceSubtask.getRemark());
-                updateServiceSubtask(serviceSubtask);
+                serviceSubtask.setSendstate(3L);
+                serviceSubtask.setCurrentPreachform("4");
             }
         }
         return resultMap;
@@ -4911,6 +4933,11 @@
 
     @Override
     public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startOutHospTime, Date endOutHospTime) {
+        //鍏堟竻鐞嗕竴涓嬮噸澶嶆暟鎹�
+        List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds();
+        if (!CollectionUtils.isEmpty(repeatIds)) {
+            serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds);
+        }
         return serviceSubtaskMapper.statQuestionOption(taskIds, startOutHospTime, endOutHospTime);
     }
 
@@ -5102,7 +5129,7 @@
                         String format = String.format("%03X", serviceOutPath.getId());
                         serviceOutPath.setRadix(format);
                         serviceOutPath.setUpdateTime(new Date());
-                        String url = ip + ":" + req_path + "/wt?p=" + format;
+                        String url = StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format;
                         content = url;
                         serviceOutPath.setUrl(url);
                         iServiceOutPathService.updateServiceOutPath(serviceOutPath);
@@ -5126,10 +5153,10 @@
 //        serviceSubtask.setNurseName(patMedInhosp1.getNurseName());
 //        serviceSubtask.setDrcode(patMedInhosp1.getDrcode());
 //        serviceSubtask.setDrname(patMedInhosp1.getDrname());
-        if(StringUtils.isNotEmpty(serviceTaskdept.getDeptType()) && serviceTaskdept.getDeptType().equals("1")){
+        if (StringUtils.isNotEmpty(serviceTaskdept.getDeptType()) && serviceTaskdept.getDeptType().equals("1")) {
             serviceSubtask.setDeptcode(serviceTaskdept.getDeptCode());
             serviceSubtask.setDeptname(serviceTaskdept.getDeptName());
-        }else {
+        } else {
             serviceSubtask.setLeavehospitaldistrictcode(serviceTaskdept.getDeptCode());
             serviceSubtask.setLeavehospitaldistrictname(serviceTaskdept.getDeptName());
         }
@@ -5164,22 +5191,23 @@
 
     /**
      * Ai 鍖归厤閫夐」
+     *
      * @param questionText
      * @param voiceText
      * @param options
      * @return
      */
-    public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid){
+    public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid) {
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("userQuestion",questionText);
-        jsonObject.put("userAnswer",voiceText);
+        jsonObject.put("userQuestion", questionText);
+        jsonObject.put("userAnswer", voiceText);
         jsonObject.put("options", options);
         jsonObject.put("uuid", uuid);
         String jsonString = jsonObject.toJSONString();
         String result = null;
 
 //        String url = "http://localhost:8099/matchOptionIndex";
-        if(StringUtils.isNotEmpty(url)){
+        if (StringUtils.isNotEmpty(url)) {
             try {
                 Map<String, String> headers = new HashMap<>();
                 headers.put("Content-Type", "application/json");
@@ -5189,16 +5217,14 @@
                 log.error("AI璇嗗埆澶辫触", e);
             }
         }
-        if(StringUtils.isNotEmpty(result) && result.matches("^-?\\d+$")){
+        if (StringUtils.isNotEmpty(result) && result.matches("^-?\\d+$")) {
             return Integer.parseInt(result);
-        }else {
+        } else {
             return -1;
         }
     }
 
-    public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO,
-                        IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate,
-                        List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid){
+    public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate, List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid) {
         PhoneCallBackYQVO back = null;
         List<IvrTaskTemplateTargetoption> options = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
         String voiceText = phoneCallReqYQVO.getAsrtext();
@@ -5206,7 +5232,7 @@
         Integer matched = -1;
         matched = matchOptionIndex(url, questionText, voiceText, options, uuid);
         //璇存槑鍖归厤姝g‘浜�
-        if(matched != null && matched >= 0){
+        if (matched != null && matched >= 0) {
             IvrTaskTemplateTargetoption chosenOption = options.get(matched);
             //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
             log.info("鍖归厤姝g‘浜嗗悧--------------");
@@ -5311,14 +5337,14 @@
                     nextQuestion = chosenOption.getNextQuestion();
                     //鏇存柊鍒嗘暟
                     double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
-                    score = BigDecimal.valueOf(score).add(chosenOption.getScore()).doubleValue();
+                    score = BigDecimal.valueOf(score).add(new BigDecimal(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();
+                    score = BigDecimal.valueOf(score).add(new BigDecimal(String.valueOf(chosenOption.getScore()))).doubleValue();
                     redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
                 }
                 if (nextQuestion == null || nextQuestion == 0L) {
@@ -5373,7 +5399,7 @@
                 double score = 0.0;
                 Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                 if (ObjectUtils.isNotEmpty(scoreObj)) score = (double) scoreObj;
-                serviceSubtask.setScore(BigDecimal.valueOf(score));
+                serviceSubtask.setScore(String.valueOf(score));
                 serviceSubtask.setFinishtime(new Date());
                 serviceSubtask.setSendstate(6L);
                 serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
@@ -5385,8 +5411,7 @@
                 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"));
+                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");
@@ -5441,7 +5466,7 @@
     }
 
     @Test
-    public void TestMatch(){
+    public void TestMatch() {
         String questionText = "鎮ㄥソ,璇烽棶鎮ㄦ槸鎮h�呮湰浜鸿繕鏄灞烇紵\n";
         String voiceText = "鎴戣嚜宸�";
         String matchedText = "";
@@ -5457,9 +5482,9 @@
         options.add(ivrTaskTemplateTargetoption3);
         //1-AI璇嗗埆
         String url = configService.selectConfigByKey("sys.voice.match.ai.url");
-        Integer matched = matchOptionIndex(url, questionText,voiceText,options,"1");
-        if(ObjectUtils.isNotEmpty(matched)){
-            if(matched >= 0){
+        Integer matched = matchOptionIndex(url, questionText, voiceText, options, "1");
+        if (ObjectUtils.isNotEmpty(matched)) {
+            if (matched >= 0) {
                 matchedText = options.get(matched).getTargetvalue();
             }
         }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskmedicalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskmedicalServiceImpl.java
index 42098e9..9358bf6 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskmedicalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskmedicalServiceImpl.java
@@ -1,7 +1,9 @@
 package com.smartor.service.impl;
 
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.smartor.domain.ServiceTaskmedical;
+import com.smartor.domain.VO.ServiceTaskmedicalVO;
 import com.smartor.mapper.ServiceTaskmedicalMapper;
 import com.smartor.service.IServiceTaskmedicalService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,8 +18,7 @@
  * @date 2026-07-29
  */
 @Service
-public class ServiceTaskmedicalServiceImpl implements IServiceTaskmedicalService
-{
+public class ServiceTaskmedicalServiceImpl implements IServiceTaskmedicalService {
     @Autowired
     private ServiceTaskmedicalMapper serviceTaskmedicalMapper;
 
@@ -28,8 +29,7 @@
      * @return 浠诲姟鑽搧鍏宠仈
      */
     @Override
-    public ServiceTaskmedical selectServiceTaskmedicalById(Long id)
-    {
+    public ServiceTaskmedical selectServiceTaskmedicalById(Long id) {
         return serviceTaskmedicalMapper.selectServiceTaskmedicalById(id);
     }
 
@@ -40,8 +40,7 @@
      * @return 浠诲姟鑽搧鍏宠仈
      */
     @Override
-    public List<ServiceTaskmedical> selectServiceTaskmedicalList(ServiceTaskmedical serviceTaskmedical)
-    {
+    public List<ServiceTaskmedical> selectServiceTaskmedicalList(ServiceTaskmedical serviceTaskmedical) {
         return serviceTaskmedicalMapper.selectServiceTaskmedicalList(serviceTaskmedical);
     }
 
@@ -52,8 +51,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int insertServiceTaskmedical(ServiceTaskmedical serviceTaskmedical)
-    {
+    public int insertServiceTaskmedical(ServiceTaskmedical serviceTaskmedical) {
         serviceTaskmedical.setCreateTime(DateUtils.getNowDate());
         return serviceTaskmedicalMapper.insertServiceTaskmedical(serviceTaskmedical);
     }
@@ -65,8 +63,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int updateServiceTaskmedical(ServiceTaskmedical serviceTaskmedical)
-    {
+    public int updateServiceTaskmedical(ServiceTaskmedical serviceTaskmedical) {
         serviceTaskmedical.setUpdateTime(DateUtils.getNowDate());
         return serviceTaskmedicalMapper.updateServiceTaskmedical(serviceTaskmedical);
     }
@@ -78,8 +75,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int deleteServiceTaskmedicalByIds(Long[] ids)
-    {
+    public int deleteServiceTaskmedicalByIds(Long[] ids) {
         return serviceTaskmedicalMapper.deleteServiceTaskmedicalByIds(ids);
     }
 
@@ -90,8 +86,21 @@
      * @return 缁撴灉
      */
     @Override
-    public int deleteServiceTaskmedicalById(Long id)
-    {
+    public int deleteServiceTaskmedicalById(Long id) {
         return serviceTaskmedicalMapper.deleteServiceTaskmedicalById(id);
     }
+
+    /**
+     * 鍒犻櫎浠诲姟鑽搧鍏宠仈淇℃伅
+     *
+     * @param serviceTaskmedicalVO
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteServiceTaskmedical(ServiceTaskmedicalVO serviceTaskmedicalVO) {
+        if (StringUtils.isNotEmpty(serviceTaskmedicalVO.getMedicalCode()) && serviceTaskmedicalVO.getTaskId() != null) {
+            return serviceTaskmedicalMapper.deleteServiceTaskmedical(serviceTaskmedicalVO);
+        }
+        return 0;
+    }
 }
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 903ceaa..2e203dc 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -1204,11 +1204,6 @@
         WHERE 1=1
             AND d.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>
-            <if test="pid != null  and pid != ''">AND a.id = #{id}</if>
-            <if test="telcode != null  and telcode != ''">AND a.telcode = #{telcode}</if>
-            <if test="notrequiredFlag != null  and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}</if>
             <if test="hospitalname != null and hospitalname != ''">AND d.hospitalname = #{hospitalname}</if>
             <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')</if>
             <if test="leaveicd10code != null and leaveicd10code != ''">AND d.leaveicd10code LIKE concat('%',#{leaveicd10code}, '%')</if>
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index b003d6b..5f9666b 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -80,10 +80,16 @@
         <result property="encounterSourceId" column="encounter_source_id"/>
         <result property="importanceFlagCode" column="importance_flag_code"/>
         <result property="emergencyLevelCode" column="emergency_level_code"/>
+        <result property="medicalCode" column="medical_code"/>
+        <result property="medicalName" column="medical_name"/>
+        <result property="medicalCompany" column="medical_company"/>
     </resultMap>
 
     <sql id="selectPatMedInhospVo">
         select inhospid,
+               medical_code,
+               medical_name,
+               medical_company,
                encounter_source_id,
                importance_flag_code,
                emergency_level_code,
@@ -158,7 +164,7 @@
     </sql>
 
     <select id="selectPatMedInhospList" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult">
-        select CONCAT( a.age, a.age_unit ) AS age,
+        select a.age AS age,
         a.telcode as telcode,
         a.sex,
         b.inhospid,
@@ -228,6 +234,9 @@
         b.encounter_source_id,
         b.importance_flag_code,
         b.emergency_level_code,
+        b.medical_code,
+        b.medical_name,
+        b.medical_company,
         a.idcardno
         FROM
         pat_med_inhosp b
@@ -257,6 +266,7 @@
             concat('%', #{hospitaldistrictname}, '%')
         </if>
         <if test="endtime != null ">and b.endtime = #{endtime}</if>
+        <if test="bedNo != null ">and b.bed_no = #{bedNo}</if>
         <if test="inhospMydFlag != null ">and b.inhosp_myd_flag = #{inhospMydFlag}</if>
         <if test="managementDoctor != null ">and b.management_doctor = #{managementDoctor}</if>
         <if test="managementDoctorCode != null ">and b.management_doctor_code = #{managementDoctorCode}</if>
@@ -463,6 +473,9 @@
         select CONCAT( a.age, a.age_unit ) AS age,
         a.telcode as telcode,
         b.inhospid,
+        b.medical_code,
+        b.medical_name,
+        b.medical_company,
         b.encounter_source_id,
         b.importance_flag_code,
         b.emergency_level_code,
@@ -593,6 +606,13 @@
                 #{leaveldeptcode}
             </foreach>
         </if>
+        <if test="medicalCode != null  and medicalCode != ''">and b.medical_code like concat('%'#{medicalCode}, '%')
+        </if>
+        <if test="medicalName != null  and medicalName != ''">and b.medical_name like concat('%'#{medicalName}, '%')
+        </if>
+        <if test="medicalCompany != null  and medicalCompany != ''">and b.medical_company like
+            concat('%'#{medicalCompany}, '%')
+        </if>
         order by b.inhospid desc
     </select>
 
@@ -684,6 +704,11 @@
         <if test="importanceFlagCode != null ">and importance_flag_code = #{importanceFlagCode}</if>
         <if test="emergencyLevelCode != null ">and emergency_level_code = #{emergencyLevelCode}</if>
         <if test="encounterSourceId != null ">and encounter_source_id = #{encounterSourceId}</if>
+        <if test="medicalCode != null  and medicalCode != ''">and medical_code like concat('%'#{medicalCode}, '%')</if>
+        <if test="medicalName != null  and medicalName != ''">and medical_name like concat('%'#{medicalName}, '%')</if>
+        <if test="medicalCompany != null  and medicalCompany != ''">and medical_company like
+            concat('%'#{medicalCompany}, '%')
+        </if>
     </select>
 
 
@@ -760,6 +785,9 @@
             <if test="importanceFlagCode != null ">importance_flag_code,</if>
             <if test="emergencyLevelCode != null ">emergency_level_code,</if>
             <if test="encounterSourceId != null ">encounter_source_id,</if>
+            <if test="medicalCode != null  and medicalCode != ''">medical_code,</if>
+            <if test="medicalName != null  and medicalName != ''">medical_name,</if>
+            <if test="medicalCompany != null  and medicalCompany != ''">medical_company,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serialnum != null">#{serialnum},</if>
@@ -830,6 +858,9 @@
             <if test="importanceFlagCode != null ">#{importanceFlagCode},</if>
             <if test="emergencyLevelCode != null ">#{emergencyLevelCode},</if>
             <if test="encounterSourceId != null ">#{encounterSourceId},</if>
+            <if test="medicalCode != null  and medicalCode != ''">#{medicalCode},</if>
+            <if test="medicalName != null  and medicalName != ''">#{medicalName},</if>
+            <if test="medicalCompany != null  and medicalCompany != ''">#{medicalCompany},</if>
         </trim>
     </insert>
 
@@ -848,7 +879,8 @@
         nurse_id, nurse_name, out_way_id, out_way_name, guid,
         operator, operator_id, inhospno, remark,
         fuflag, fudate, fuperiod, futypecode, futypedesc, fuadvice, fuspecialadvice, management_doctor,
-        management_doctor_doctor,campusid, inhosp_myd_flag, importance_flag_code, emergency_level_code, encounter_source_id
+        management_doctor_doctor,campusid, inhosp_myd_flag, importance_flag_code, emergency_level_code, encounter_source_id,
+        medical_code, medical_name, medical_company
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -871,7 +903,8 @@
             #{item.operator}, #{item.operatorId}, #{item.inhospno}, #{item.remark},
             #{item.fuflag}, #{item.fudate}, #{item.fuperiod}, #{item.futypecode}, #{item.futypedesc}, #{item.fuadvice},
             #{item.fuspecialadvice}, #{item.managementDoctor}, #{item.managementDoctorCode}, #{item.campusid}, #{item.inhospMydFlag},
-            #{item.importanceFlagCode}, #{item.emergencyLevelCode}, #{item.encounterSourceId}
+            #{item.importanceFlagCode}, #{item.emergencyLevelCode}, #{item.encounterSourceId},
+            #{item.medicalCode}, #{item.medicalName}, #{item.medicalCompany}
             )
         </foreach>
     </insert>
@@ -949,6 +982,9 @@
             <if test="importanceFlagCode != null ">importance_flag_code = #{importanceFlagCode},</if>
             <if test="emergencyLevelCode != null ">emergency_level_code = #{emergencyLevelCode},</if>
             <if test="encounterSourceId != null ">encounter_source_id = #{encounterSourceId},</if>
+            <if test="medicalCode != null  and medicalCode != ''">medical_code = #{medicalCode},</if>
+            <if test="medicalName != null  and medicalName != ''">medical_name = #{medicalName},</if>
+            <if test="medicalCompany != null  and medicalCompany != ''">medical_company = #{medicalCompany},</if>
         </trim>
         where inhospid = #{inhospid}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
index 1718b54..7054aae 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -546,4 +546,34 @@
             ivr_liba_target.targetname,
             service_subtask_detail.matchedtext
     </select>
+
+    <select id="selectRepeatDetailIds" resultType="Long">
+        SELECT d1.id
+        FROM service_subtask_detail d1
+        INNER JOIN (
+            SELECT sub_id, questiontext,
+                   MAX(create_time) AS max_create_time,
+                   MAX(id) AS keep_id
+            FROM service_subtask_detail
+            WHERE del_flag = 0
+            GROUP BY sub_id, questiontext
+            HAVING COUNT(*) &gt; 1
+        ) d2 ON d1.sub_id = d2.sub_id
+            AND d1.questiontext = d2.questiontext
+            AND (
+                d1.create_time &lt; d2.max_create_time
+                OR (d1.create_time = d2.max_create_time AND d1.id &lt; d2.keep_id)
+            )
+        WHERE d1.del_flag = 0
+    </select>
+
+    <update id="deleteRepeatDetailByIds">
+        UPDATE service_subtask_detail
+        SET del_flag = 1
+        WHERE del_flag = 0
+        AND id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 52eef2d..eb75f99 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1367,16 +1367,17 @@
             <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
             <if test="continueContent != null ">continue_content = #{continueContent},</if>
         </trim>
-        where
-        <if test="patid != null ">
-            patid = #{patid}
-        </if>
-        <if test="taskid != null ">
-            and taskid = #{taskid}
-        </if>
-        <if test="id != null ">
-            and id = #{id}
-        </if>
+        <where>
+            <if test="patid != null ">
+                patid = #{patid}
+            </if>
+            <if test="taskid != null ">
+                and taskid = #{taskid}
+            </if>
+            <if test="id != null ">
+                and id = #{id}
+            </if>
+        </where>
     </update>
 
     <update id="updateServiceSubtaskByTaskGuid" parameterType="com.smartor.domain.ServiceSubtask">
@@ -3057,6 +3058,7 @@
             #{taskId}
         </foreach>
         and s.sendstate=6
+        and d.del_flag=0
         GROUP BY
         t.taskid,
         d.questiontext
@@ -3066,6 +3068,7 @@
             #{taskId}
         </foreach>
         AND s.sendstate = 6
+        and d.del_flag=0
       <if test="startOutHospTime != null">
         AND date_format(s.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
     </if>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceTaskmedicalMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceTaskmedicalMapper.xml
index 15ac16e..aa68f3c 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceTaskmedicalMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceTaskmedicalMapper.xml
@@ -322,5 +322,18 @@
         </foreach>
     </update>
 
+    <update id="deleteServiceTaskmedical" parameterType="com.smartor.domain.VO.ServiceTaskmedicalVO">
+        update service_taskmedical
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1
+        </trim>
+        <where>
+            <if test="taskId != null">task_id =
+                #{taskId}
+            </if>
+            <if test="medicalCode != null">and medical_code = #{medicalCode}
+            </if>
+        </where>
+    </update>
 
 </mapper>

--
Gitblit v1.9.3