From e180e3a496d6f29d3a3b34016400de9d997c6bd9 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 07 四月 2026 14:42:23 +0800
Subject: [PATCH] 省立同德满意度功能提交

---
 smartor/src/main/java/com/smartor/domain/VisitPlan.java                                             |   20 
 smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java                                  |   69 
 smartor/src/main/java/com/smartor/service/impl/SvyLibTemplateServiceImpl.java                       |    9 
 smartor/src/main/java/com/smartor/domain/DTO/DetailTraceDealDTO.java                                |   85 +
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java      |    7 
 smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionReqVO.java                               |   88 +
 smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskSatisfactionEntity.java               |   65 
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java                           |   13 
 smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java                            |   10 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml                       |  653 ++++++++
 smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionResVO.java                               |   44 
 smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml                           |  154 +
 smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml                            |  132 +
 smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java                      |    7 
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java                         |   19 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java                                |   10 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java                           |    7 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml                            |  134 +
 smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java                         |    2 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java                 |  311 +++
 smartor/src/main/java/com/smartor/common/PinYinUtil.java                                            |   65 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java                                 |   22 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskPreachform.java                              |    2 
 smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateScriptMapper.java                           |    9 
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml                                   |    8 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailTraceController.java |  145 +
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java                                 |   40 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java                            |   10 
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java                               |   36 
 ruoyi-admin/src/main/resources/banner.txt                                                           |   30 
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java                               |   33 
 smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml                     |    6 
 smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailTraceMapper.java                       |   67 
 ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java                              |   15 
 smartor/src/main/java/com/smartor/domain/SvyLibScriptCategory.java                                  |    7 
 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java                        |    5 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateScriptController.java      |   37 
 smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml                       |    6 
 smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java                      |  391 +++++
 smartor/src/main/java/com/smartor/domain/ServiceSubtask.java                                        |    2 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java                             |  345 ++++
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java                           |   19 
 smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml                              |    6 
 smartor/src/main/java/com/smartor/domain/DTO/ServiceSubtaskDetailDTO.java                           |   41 
 smartor/src/main/resources/mapper/smartor/IvrLibaScriptAssortMapper.xml                             |   34 
 smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml                           |  148 +
 smartor/src/main/java/com/smartor/service/IPatSatisfactionService.java                              |   37 
 smartor/src/main/java/com/smartor/domain/SysUserOrg.java                                            |    6 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java                       |  104 +
 smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java                 |   31 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatSatisfactionController.java           |   29 
 smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java                                |    1 
 smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java                                  |   32 
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java                                 |   43 
 smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml                     |    6 
 smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java                                      |    2 
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java                               |   16 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java      |    1 
 smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java                             |   13 
 smartor/src/main/java/com/smartor/mapper/SvyLibTemplateScriptMapper.java                            |    7 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskDetailTraceServiceImpl.java            |  278 +++
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java                                  |   33 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                                  |  171 +
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java                                |   30 
 smartor/src/main/java/com/smartor/domain/VO/SatisfactionExceptConfigQuestionReqVO.java              |   60 
 smartor/src/main/java/com/smartor/domain/SvyLibScriptCategoryVO.java                                |   20 
 smartor/src/main/java/com/smartor/domain/IvrLibaScriptAssort.java                                   |    7 
 smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java                                    |   10 
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                                        |    2 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java                    |   46 
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java                                  |   12 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java            |    1 
 smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml                      |    1 
 smartor/src/main/java/com/smartor/service/IServiceSubtaskDetailTraceService.java                    |   81 +
 ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java                     |   14 
 smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptAssortServiceImpl.java                  |    7 
 smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml                           |   33 
 ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml                              |    2 
 smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java                    |   76 
 smartor/src/main/resources/mapper/smartor/SvyLibTopicCategoryMapper.xml                             |    8 
 80 files changed, 4,100 insertions(+), 488 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
index 5feda84..7324a94 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -118,9 +118,6 @@
     @Autowired
     private ISysConfigService configService;
 
-    // 鍒涘缓鍥哄畾澶у皬鐨勭嚎绋嬫睜
-    private static final ExecutorService executorService = Executors.newFixedThreadPool(10);
-
     public RedisMqReceiver(RedisMessageListenerContainer listenerContainer) {
         super(listenerContainer);
     }
@@ -152,12 +149,12 @@
             ServiceTask serviceTask = new ServiceTask();
             serviceTask.setTaskid(Long.valueOf(commonTaskcallMQ.getTaskid()));
 
-            //鍦ㄩ棶鍗蜂腑锛岄�変腑鏌愪釜閫夐」瑕佽繘琛屾湇鍔¤ˉ鍋挎椂锛屽彧鏄�熺敤璇ユ湇鍔$殑澶栧3锛屼笉瀵硅鏈嶅姟鏈変换鍔″奖鍝�
-            if (commonTaskcallMQ.getUpdateSendstate() == null || commonTaskcallMQ.getUpdateSendstate() == 1) {
-                serviceTask.setSendState(5L);
-                serviceTask.setFail(1L);
-                serviceTaskMapper.updateServiceTask(serviceTask);
-            }
+//            //鍦ㄩ棶鍗蜂腑锛岄�変腑鏌愪釜閫夐」瑕佽繘琛屾湇鍔¤ˉ鍋挎椂锛屽彧鏄�熺敤璇ユ湇鍔$殑澶栧3锛屼笉瀵硅鏈嶅姟鏈変换鍔″奖鍝�
+//            if (commonTaskcallMQ.getUpdateSendstate() == null || commonTaskcallMQ.getUpdateSendstate() == 1) {
+//                serviceTask.setSendState(5L);
+//                serviceTask.setFail(1L);
+//                serviceTaskMapper.updateServiceTask(serviceTask);
+//            }
         } catch (Exception e) {
             Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString());
             if (integer != null && integer == 3) {
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatSatisfactionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatSatisfactionController.java
index 33becc0..467b46c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatSatisfactionController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatSatisfactionController.java
@@ -1,23 +1,24 @@
 package com.ruoyi.web.controller.smartor;
 
 import java.util.List;
+import java.util.Map;
 
 import com.github.pagehelper.ISelect;
 import com.ruoyi.common.annotation.AddOrgId;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.PageUtils;
+import com.smartor.domain.VO.PatSatisfactionReqVO;
+import com.smartor.domain.VO.PatSatisfactionResVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.springframework.security.access.prepost.PreAuthorize;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -155,4 +156,26 @@
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(patSatisfactionService.deletePatSatisfactionByIds(ids));
     }
+
+    /**
+     * 鎮h�呮弧鎰忓害缁熻
+     */
+    @ApiOperation("鎮h�呮弧鎰忓害缁熻")
+    @PostMapping("/statistics")
+    public Map<String, Object> statistics(@RequestBody PatSatisfactionReqVO patSatisfactionReqVO) {
+        //鍚庣涓嶅仛鍒嗛〉浜嗭紝鐢卞墠绔仛
+        PatSatisfactionResVO statistics = patSatisfactionService.statistics(patSatisfactionReqVO);
+        return getDataTable3(CollectionUtils.isNotEmpty(statistics.getPatSatisfactionDetailEntities()) ? statistics.getPatSatisfactionDetailEntities().size() : 0, statistics);
+    }
+    /**
+     * 鎮h�呮弧鎰忓害鏌辩姸鍥句俊鎭�
+     */
+    @ApiOperation("鎮h�呮弧鎰忓害鏌辩姸鍥句俊鎭�")
+    @PostMapping("/satisfactionGraph")
+    public Map<String, Object> satisfactionGraph(@RequestBody PatSatisfactionReqVO patSatisfactionReqVO) {
+        Map<String, Object> patSatisfactionGraphResVOS = patSatisfactionService.satisfactionGraph(patSatisfactionReqVO);
+        return getDataTable3(0, patSatisfactionGraphResVOS);
+    }
+
+
 }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java
index 659e6b2..a2b1269 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java
@@ -129,6 +129,13 @@
         return toAjax(serviceSubtaskAnswerService.saveQuestionCache(serviceSubTaskCacheReq, 1L));
     }
 
+    @ApiOperation("鎮h�呴棶棰樼粨鏋滀繚瀛�")
+    @PostMapping("/savequestiondetail")
+    public AjaxResult saveQuestionDetail(@RequestBody ServiceSubTaskCacheReq serviceSubTaskCacheReq) {
+        log.info("銆恠aveQuestionDetail-----saveQuestionCache銆戠殑prarm1锛歿},prarm2锛歿},type锛歿},prarm6:{}", serviceSubTaskCacheReq.getParam1(), serviceSubTaskCacheReq.getParam2(), serviceSubTaskCacheReq.getType(), serviceSubTaskCacheReq.getParam6());
+        return toAjax(serviceSubtaskAnswerService.saveQuestionDetail(serviceSubTaskCacheReq, 0L));
+    }
+
 
     @ApiOperation("鎮h�呴棶棰樼粨鏋滆褰�(灏忕▼鍏呭閾�)")
     @PostMapping("/saveQuestionAnswerXCH")
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java
index 5bb9050..2379e43 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java
@@ -6,6 +6,7 @@
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringUtils;
+import com.smartor.domain.ServiceSubTaskCacheReq;
 import com.smartor.domain.ServiceSubTaskDetailReq;
 import com.smartor.domain.ServiceSubtask;
 import com.smartor.domain.ServiceSubtaskDetail;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailTraceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailTraceController.java
new file mode 100644
index 0000000..c8b026b
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailTraceController.java
@@ -0,0 +1,145 @@
+package com.ruoyi.web.controller.smartor;
+
+import com.ruoyi.common.annotation.AddOrgId;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+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.DTO.DetailTraceDealDTO;
+import com.smartor.domain.ServiceSubtaskDetailTrace;
+import com.smartor.domain.VO.DetailTraceDealVO;
+import com.smartor.domain.VO.SatisfactionExceptConfigQuestionReqVO;
+import com.smartor.service.IServiceSubtaskDetailTraceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 闅忚浠诲姟寮傚父璁板綍璺熻釜Controller
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+@Slf4j
+@Api("闅忚浠诲姟寮傚父璁板綍璺熻釜")
+@RestController
+@RequestMapping("/smartor/trace")
+public class ServiceSubtaskDetailTraceController extends BaseController {
+    @Autowired
+    private IServiceSubtaskDetailTraceService serviceSubtaskDetailTraceService;
+
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃
+     */
+    @ApiOperation("鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:list')")
+    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+    @PostMapping("/list")
+    public Map<String, Object> list(@RequestBody ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        Integer offset = PageUtils.getOffset(serviceSubtaskDetailTrace.getPageNum(), serviceSubtaskDetailTrace.getPageSize());
+        serviceSubtaskDetailTrace.setPageNum(offset);
+        List<ServiceSubtaskDetailTrace> list = serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceList(serviceSubtaskDetailTrace);
+
+        serviceSubtaskDetailTrace.setPageNum(null);
+        serviceSubtaskDetailTrace.setPageSize(null);
+        List<ServiceSubtaskDetailTrace> total = serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceList(serviceSubtaskDetailTrace);
+
+        return getDataTable3(CollectionUtils.isNotEmpty(total) ? total.size() : 0, list);
+    }
+
+
+    @ApiOperation("寮傚父闂澶勭悊鎯呭喌鏌ヨ")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:list')")
+    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+    @PostMapping("/tracedeallist")
+    public Map<String, Object> tracedeallist(@RequestBody DetailTraceDealVO detailTraceDealVO) {
+        Integer offset = PageUtils.getOffset(detailTraceDealVO.getPageNum(), detailTraceDealVO.getPageSize());
+        detailTraceDealVO.setPageNum(offset);
+        List<DetailTraceDealDTO> list = serviceSubtaskDetailTraceService.tracedeallist(detailTraceDealVO);
+
+        detailTraceDealVO.setPageNum(null);
+        detailTraceDealVO.setPageSize(null);
+        List<DetailTraceDealDTO> total = serviceSubtaskDetailTraceService.tracedeallist(detailTraceDealVO);
+
+        return getDataTable3(CollectionUtils.isNotEmpty(total) ? total.size() : 0, list);
+    }
+
+    /**
+     * 鑾峰彇婊℃剰搴﹀紓甯搁厤缃鐩�
+     */
+    @ApiOperation("鑾峰彇婊℃剰搴﹀紓甯搁厤缃鐩�")
+    @PostMapping("/getSatisfactionExceptConfigQuestion")
+    public Map<String, Object> getSatisfactionExceptConfigQuestion(@RequestBody SatisfactionExceptConfigQuestionReqVO questionReqVO) {
+        log.info("鑾峰彇婊℃剰搴﹀紓甯搁厤缃鐩殑鍏ュ弬: {}", questionReqVO);
+        Map<String, Object> satisfactionExceptConfigQuestion = serviceSubtaskDetailTraceService.getSatisfactionExceptConfigQuestion(questionReqVO);
+        return satisfactionExceptConfigQuestion;
+    }
+
+    /**
+     * 瀵煎嚭闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃
+     */
+    @ApiOperation("瀵煎嚭闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:export')")
+    @Log(title = "闅忚浠诲姟寮傚父璁板綍璺熻釜", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        List<ServiceSubtaskDetailTrace> list = serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceList(serviceSubtaskDetailTrace);
+        ExcelUtil<ServiceSubtaskDetailTrace> util = new ExcelUtil<ServiceSubtaskDetailTrace>(ServiceSubtaskDetailTrace.class);
+        util.exportExcel(response, list, "闅忚浠诲姟寮傚父璁板綍璺熻釜鏁版嵁");
+    }
+
+    /**
+     * 鑾峰彇闅忚浠诲姟寮傚父璁板綍璺熻釜璇︾粏淇℃伅
+     */
+    @ApiOperation("鑾峰彇闅忚浠诲姟寮傚父璁板綍璺熻釜璇︾粏淇℃伅")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:query')")
+    @GetMapping(value = "/getInfo/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceById(id));
+    }
+
+    /**
+     * 鏂板闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    @ApiOperation("鏂板闅忚浠诲姟寮傚父璁板綍璺熻釜")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:add')")
+    @Log(title = "闅忚浠诲姟寮傚父璁板綍璺熻釜", businessType = BusinessType.INSERT)
+    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+    @PostMapping("/add")
+    public AjaxResult add(@RequestBody ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        return toAjax(serviceSubtaskDetailTraceService.insertServiceSubtaskDetailTtrace(serviceSubtaskDetailTrace));
+    }
+
+    /**
+     * 淇敼闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    @ApiOperation("淇敼闅忚浠诲姟寮傚父璁板綍璺熻釜")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:edit')")
+    @Log(title = "闅忚浠诲姟寮傚父璁板綍璺熻釜", businessType = BusinessType.UPDATE)
+    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
+    @PostMapping("/edit")
+    public AjaxResult edit(@RequestBody ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        return toAjax(serviceSubtaskDetailTraceService.updateServiceSubtaskDetailTtrace(serviceSubtaskDetailTrace));
+    }
+
+    /**
+     * 鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    @ApiOperation("鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜")
+    //@PreAuthorize("@ss.hasPermi('smartor:ltrace:remove')")
+    @Log(title = "闅忚浠诲姟寮傚父璁板綍璺熻釜", businessType = BusinessType.DELETE)
+    @GetMapping("/remove/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(serviceSubtaskDetailTraceService.deleteServiceSubtaskDetailTtraceByIds(ids));
+    }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java
index 02f63c2..55b67de 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java
@@ -27,6 +27,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 闂嵎妯℃澘Controller
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateScriptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateScriptController.java
index b6a6aaf..804392c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateScriptController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateScriptController.java
@@ -7,17 +7,20 @@
 import com.ruoyi.common.core.domain.entity.SysUser;
 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.ServiceSubtaskCountReq;
 import com.smartor.domain.SvyLibTemplateScript;
 import com.smartor.service.ISvyLibTemplateScriptService;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 妯℃澘闂嵎棰樼洰Controller
@@ -27,8 +30,7 @@
  */
 @RestController
 @RequestMapping("/smartor/svytemplatescript")
-public class SvyLibTemplateScriptController extends BaseController
-{
+public class SvyLibTemplateScriptController extends BaseController {
     @Autowired
     private ISvyLibTemplateScriptService svyLibTemplateScriptService;
 
@@ -36,12 +38,16 @@
      * 鏌ヨ妯℃澘闂嵎棰樼洰鍒楄〃
      */
     //@PreAuthorize("@ss.hasPermi('system:script:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(SvyLibTemplateScript svyLibTemplateScript)
-    {
-        startPage();
+    @PostMapping("/list")
+    public Map<String, Object> list(SvyLibTemplateScript svyLibTemplateScript) {
+        Integer offset = PageUtils.getOffset(svyLibTemplateScript.getPageNum(), svyLibTemplateScript.getPageSize());
+        svyLibTemplateScript.setPageNum(offset);
         List<SvyLibTemplateScript> list = svyLibTemplateScriptService.selectSvyLibTemplateScriptList(svyLibTemplateScript);
-        return getDataTable(list);
+
+        svyLibTemplateScript.setPageNum(null);
+        svyLibTemplateScript.setPageSize(null);
+        List<SvyLibTemplateScript> count = svyLibTemplateScriptService.selectSvyLibTemplateScriptList(svyLibTemplateScript);
+        return getDataTable3(CollectionUtils.isNotEmpty(count) ? Long.valueOf(count.size()) : 0L, list);
     }
 
     /**
@@ -50,8 +56,7 @@
     //@PreAuthorize("@ss.hasPermi('system:script:export')")
     @Log(title = "妯℃澘闂嵎棰樼洰", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SvyLibTemplateScript svyLibTemplateScript)
-    {
+    public void export(HttpServletResponse response, SvyLibTemplateScript svyLibTemplateScript) {
         List<SvyLibTemplateScript> list = svyLibTemplateScriptService.selectSvyLibTemplateScriptList(svyLibTemplateScript);
         ExcelUtil<SvyLibTemplateScript> util = new ExcelUtil<SvyLibTemplateScript>(SvyLibTemplateScript.class);
         util.exportExcel(response, list, "妯℃澘闂嵎棰樼洰鏁版嵁");
@@ -62,8 +67,7 @@
      */
     //@PreAuthorize("@ss.hasPermi('system:script:query')")
     @GetMapping(value = "/{topicid}")
-    public AjaxResult getInfo(@PathVariable("topicid") Long topicid)
-    {
+    public AjaxResult getInfo(@PathVariable("topicid") Long topicid) {
         return success(svyLibTemplateScriptService.selectSvyLibTemplateScriptByTopicid(topicid));
     }
 
@@ -74,8 +78,7 @@
     @Log(title = "妯℃澘闂嵎棰樼洰", businessType = BusinessType.INSERT)
     @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
     @PostMapping("/add")
-    public AjaxResult add(@RequestBody SvyLibTemplateScript svyLibTemplateScript)
-    {
+    public AjaxResult add(@RequestBody SvyLibTemplateScript svyLibTemplateScript) {
         SysUser user = getLoginUser().getUser();
         svyLibTemplateScript.setOrgid(user.getOrgid());
         return toAjax(svyLibTemplateScriptService.insertSvyLibTemplateScript(svyLibTemplateScript));
@@ -88,8 +91,7 @@
     @Log(title = "妯℃澘闂嵎棰樼洰", businessType = BusinessType.UPDATE)
     @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
     @PostMapping("/edit")
-    public AjaxResult edit(@RequestBody SvyLibTemplateScript svyLibTemplateScript)
-    {
+    public AjaxResult edit(@RequestBody SvyLibTemplateScript svyLibTemplateScript) {
         return toAjax(svyLibTemplateScriptService.updateSvyLibTemplateScript(svyLibTemplateScript));
     }
 
@@ -98,9 +100,8 @@
      */
     //@PreAuthorize("@ss.hasPermi('system:script:remove')")
     @Log(title = "妯℃澘闂嵎棰樼洰", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{topicids}")
-    public AjaxResult remove(@PathVariable Long[] topicids)
-    {
+    @DeleteMapping("/{topicids}")
+    public AjaxResult remove(@PathVariable Long[] topicids) {
         return toAjax(svyLibTemplateScriptService.deleteSvyLibTemplateScriptByTopicids(topicids));
     }
 
diff --git a/ruoyi-admin/src/main/resources/banner.txt b/ruoyi-admin/src/main/resources/banner.txt
index 0931cb8..f1c134b 100644
--- a/ruoyi-admin/src/main/resources/banner.txt
+++ b/ruoyi-admin/src/main/resources/banner.txt
@@ -1,24 +1,10 @@
 Application Version: ${ruoyi.version}
 Spring Boot Version: ${spring-boot.version}
-////////////////////////////////////////////////////////////////////
-//                          _ooOoo_                               //
-//                         o8888888o                              //
-//                         88" . "88                              //
-//                         (| ^_^ |)                              //
-//                         O\  =  /O                              //
-//                      ____/`---'\____                           //
-//                    .'  \\|     |//  `.                         //
-//                   /  \\|||  :  |||//  \                        //
-//                  /  _||||| -:- |||||-  \                       //
-//                  |   | \\\  -  /// |   |                       //
-//                  | \_|  ''\---/''  |   |                       //
-//                  \  .-\__  `-`  ___/-. /                       //
-//                ___`. .'  /--.--\  `. . ___                     //
-//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
-//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
-//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
-//      ========`-.____`-.___\_____/___.-`____.-'========         //
-//                           `=---='                              //
-//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
-//             浣涚淇濅綉       姘镐笉瀹曟満      姘告棤BUG               //
-////////////////////////////////////////////////////////////////////
\ No newline at end of file
+
+         鈻堚枅鈺�  鈻堚枅鈺�   鈻堚枅鈻堚枅鈻堚枅鈺�    鈻堚枅鈻堚枅鈻堚枅鈺�
+         鈻堚枅鈺�  鈻堚枅鈺�   鈻堚枅鈺斺晲鈺愨枅鈻堚晽   鈻堚枅鈺斺晲鈺愨晲鈺愨暆
+         鈻堚枅鈻堚枅鈻堚枅鈻堚晳   鈻堚枅鈻堚枅鈻堚枅鈺斺暆   鈻堚枅鈻堚枅鈻堚晽
+         鈻堚枅鈺斺晲鈺愨枅鈻堚晳   鈻堚枅鈺斺晲鈺愨枅鈻堚晽   鈺氣晲鈺愨晲鈺愨枅鈻堚晽
+         鈻堚枅鈺�  鈻堚枅鈺�   鈻堚枅鈺�  鈻堚枅鈺�   鈻堚枅鈻堚枅鈻堚枅鈺斺暆
+         鈺氣晲鈺�  鈺氣晲鈺�   鈺氣晲鈺�  鈺氣晲鈺�   鈺氣晲鈺愨晲鈺愨晲鈺�
+           浜�          灏�          鏃�
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
index 9a82487..b94b50f 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
@@ -96,12 +96,13 @@
         rspData.setTotal(total);
         return rspData;
     }
-    protected Map<String,Object> getDataTable3(long total, List<?> list) {
-        Map<String,Object> rspData = new TreeMap<>();
-        rspData.put("code",HttpStatus.SUCCESS);
-        rspData.put("msg","鏌ヨ鎴愬姛");
-        rspData.put("rows",list);
-        rspData.put("total",total);
+
+    protected Map<String, Object> getDataTable3(long total, Object object) {
+        Map<String, Object> rspData = new TreeMap<>();
+        rspData.put("code", HttpStatus.SUCCESS);
+        rspData.put("msg", "鏌ヨ鎴愬姛");
+        rspData.put("rows", object);
+        rspData.put("total", total);
         return rspData;
     }
 
@@ -201,6 +202,7 @@
     public String getUsername() {
         return getLoginUser().getUsername();
     }
+
     /**
      * 鑾峰彇鏈烘瀯ID
      */
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
index 63b14d3..e06e99f 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -17,10 +17,7 @@
 import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 鐢ㄦ埛瀵硅薄 sys_user
@@ -255,11 +252,25 @@
     @ApiModelProperty("绉戝闆嗗悎")
     private List<Map<String, Object>> belongDepts = new ArrayList();
 
+    /**
+     * 婊℃剰搴﹀垎绫�
+     */
+    @ApiModelProperty("婊℃剰搴﹀垎绫伙紙闂嵎/璇煶锛�")
+    private Map<String, Object> satisfactionCategories = new HashMap<>();
+
 
     public SysUser() {
 
     }
 
+    public Map<String, Object> getSatisfactionCategories() {
+        return satisfactionCategories;
+    }
+
+    public void setSatisfactionCategories(Map<String, Object> satisfactionCategories) {
+        this.satisfactionCategories = satisfactionCategories;
+    }
+
     public List<Map<String, Object>> getBelongWards() {
         return this.belongWards;
     }
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index 13a880b..9e4d4f0 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,9 +108,10 @@
                 // 杩囨护璇锋眰
                 .authorizeRequests()
                 // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶
-                .antMatchers("/login","/test", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer").permitAll()
+                .antMatchers("/login","/test/**", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer").permitAll()
                 // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂�
-                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
+//                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
+                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**").permitAll().antMatchers( "/druid/**").permitAll()
                 .antMatchers("/smartor/organization/list").permitAll()
                 // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇�
                 .anyRequest().authenticated().and().headers().frameOptions().disable();
diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
index 94b2e4a..f85de21 100644
--- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
+++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
@@ -59,7 +59,7 @@
 
     <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
 		<include refid="selectGenTableVo"/>
-		where 1=1
+		where
 		<if test="orgid != null and orgid != ''">
 			AND orgid = #{orgid}
 		</if>
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 78612b7..ddb0a57 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
@@ -1045,10 +1045,8 @@
                 serviceSubtaskPreachform.setPreachform(nextPreachform);
                 serviceSubtaskPreachformMapper.updateSSPByCondition(serviceSubtaskPreachform);
             }
-
             return nextPreachform;
         }
-
         return null;
     }
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 3441d8d..f0d170c 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -14,8 +14,12 @@
 import com.ruoyi.system.mapper.*;
 import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.system.service.ISysUserService;
+import com.smartor.domain.IvrLibaScriptAssort;
+import com.smartor.domain.SvyLibScriptCategory;
 import com.smartor.domain.SvyTaskVO;
 import com.smartor.domain.SysUserOrg;
+import com.smartor.mapper.IvrLibaScriptAssortMapper;
+import com.smartor.mapper.SvyLibScriptCategoryMapper;
 import com.smartor.mapper.SysUserDeptMapper;
 import com.smartor.mapper.SysUserOrgMapper;
 import org.slf4j.Logger;
@@ -51,6 +55,12 @@
 
     @Autowired
     private SysUserDeptMapper sysUserDeptMapper;
+
+    @Autowired
+    private IvrLibaScriptAssortMapper ivrLibaScriptAssortMapper;
+
+    @Autowired
+    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
 
     @Autowired
     private SysRoleMapper roleMapper;
@@ -287,7 +297,43 @@
                 if (StringUtils.isNotEmpty(sud.getDeptName())) map.put("deptName", sud.getDeptName());
                 list.add(map);
             }
+            //鑾峰彇褰撳墠鏈烘瀯鐨勬弧鎰忓害闂鍒嗙被
             sysUser.setBelongDepts(list);
+            Map<String, Object> satisfactionCategories = new HashMap<>();
+            //鑾峰彇璇煶闂鍒嗙被
+            IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort();
+            ivrLibaScriptAssort.setOrgid(sysUser.getOrgid());
+            ivrLibaScriptAssort.setType("myd");
+            List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort);
+            List<Map<String, Object>> categoryList = new ArrayList<>();
+            if (!CollectionUtils.isEmpty(ivrLibaScriptAssorts)) {
+                for (IvrLibaScriptAssort assort : ivrLibaScriptAssorts) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("categoryid", assort.getId());
+                    map.put("categoryName", assort.getIndexAssortName());
+                    categoryList.add(map);
+                }
+            }
+            satisfactionCategories.put("voiceCategories", categoryList);
+
+            //鑾峰彇闂嵎闂鍒嗙被
+            SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory();
+            svyLibScriptCategory.setOrgid(sysUser.getOrgid());
+            svyLibScriptCategory.setType("myd");
+            List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory);
+            List<Map<String, Object>> questionnaireCategorys = new ArrayList<>();
+            if (!CollectionUtils.isEmpty(svyLibScriptCategories)) {
+                for (SvyLibScriptCategory scriptCategory : svyLibScriptCategories) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("categoryid", scriptCategory.getId());
+                    map.put("categoryName", scriptCategory.getName());
+                    questionnaireCategorys.add(map);
+                }
+            }
+            satisfactionCategories.put("questionnaireCategorys", CollectionUtils.isEmpty(questionnaireCategorys) ? null : questionnaireCategorys);
+
+            //璁剧疆褰撳墠鐢ㄦ埛鐨勫0闊抽棶棰樺垎绫诲拰闂嵎闂鍒嗙被
+            sysUser.setSatisfactionCategories(satisfactionCategories);
         }
         return sysUser;
     }
diff --git a/smartor/src/main/java/com/smartor/common/PinYinUtil.java b/smartor/src/main/java/com/smartor/common/PinYinUtil.java
new file mode 100644
index 0000000..b1285c6
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/common/PinYinUtil.java
@@ -0,0 +1,65 @@
+package com.smartor.common;
+
+/**
+ * @author ls
+ * @content
+ * @date 2026/4/1
+ */
+public class PinYinUtil {
+    /**
+     * 鑾峰彇鎷奸煶
+     * @param name
+     * @return
+     */
+    public static String getpy(String name) {
+        if (name == null || name.isEmpty()) return "";
+        StringBuilder sb = new StringBuilder();
+        for (char c : name.toCharArray()) {
+            if (c >= '\u4e00' && c <= '\u9fa5') {
+                sb.append(getFirstPinyinLetter(c));
+            } else if (Character.isLetter(c)) {
+                sb.append(Character.toLowerCase(c));
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 鏍规嵁姹夊瓧 GBK 缂栫爜鍖洪棿杩斿洖瀵瑰簲鎷奸煶棣栧瓧姣嶏紙甯哥敤姹夊瓧瑕嗙洊鐜� > 99%锛�
+     */
+    private static char getFirstPinyinLetter(char c) {
+        try {
+            byte[] bytes = String.valueOf(c).getBytes("GBK");
+            if (bytes.length == 2) {
+                int hb = bytes[0] & 0xFF;
+                int lb = bytes[1] & 0xFF;
+                int gbk = (hb << 8) | lb;
+                if (gbk >= 0xB0A1 && gbk <= 0xB0C4) return 'a';
+                if (gbk >= 0xB0C5 && gbk <= 0xB2C0) return 'b';
+                if (gbk >= 0xB2C1 && gbk <= 0xB4ED) return 'c';
+                if (gbk >= 0xB4EE && gbk <= 0xB6E9) return 'd';
+                if (gbk >= 0xB6EA && gbk <= 0xB7A1) return 'e';
+                if (gbk >= 0xB7A2 && gbk <= 0xB8C0) return 'f';
+                if (gbk >= 0xB8C1 && gbk <= 0xB9FD) return 'g';
+                if (gbk >= 0xB9FE && gbk <= 0xBBF6) return 'h';
+                if (gbk >= 0xBBF7 && gbk <= 0xBFA5) return 'j';
+                if (gbk >= 0xBFA6 && gbk <= 0xC0AB) return 'k';
+                if (gbk >= 0xC0AC && gbk <= 0xC2E7) return 'l';
+                if (gbk >= 0xC2E8 && gbk <= 0xC4C2) return 'm';
+                if (gbk >= 0xC4C3 && gbk <= 0xC5B5) return 'n';
+                if (gbk >= 0xC5B6 && gbk <= 0xC5BD) return 'o';
+                if (gbk >= 0xC5BE && gbk <= 0xC6D9) return 'p';
+                if (gbk >= 0xC6DA && gbk <= 0xC8BA) return 'q';
+                if (gbk >= 0xC8BB && gbk <= 0xC8F5) return 'r';
+                if (gbk >= 0xC8F6 && gbk <= 0xCBF0) return 's';
+                if (gbk >= 0xCBFA && gbk <= 0xCDD9) return 't';
+                if (gbk >= 0xCDDA && gbk <= 0xCEF3) return 'w';
+                if (gbk >= 0xCEF4 && gbk <= 0xD188) return 'x';
+                if (gbk >= 0xD1B9 && gbk <= 0xD4D0) return 'y';
+                if (gbk >= 0xD4D1 && gbk <= 0xD7F9) return 'z';
+            }
+        } catch (Exception ignored) {
+        }
+        return c;
+    }
+}
diff --git a/smartor/src/main/java/com/smartor/domain/DTO/DetailTraceDealDTO.java b/smartor/src/main/java/com/smartor/domain/DTO/DetailTraceDealDTO.java
new file mode 100644
index 0000000..160e1b9
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/DTO/DetailTraceDealDTO.java
@@ -0,0 +1,85 @@
+package com.smartor.domain.DTO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 婊℃剰搴﹀紓甯稿鐞嗘儏鍐佃姹傚璞�
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+@Data
+@ApiModel("婊℃剰搴﹀紓甯稿鐞嗘儏鍐靛搷搴斿璞�")
+public class DetailTraceDealDTO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 闂鍐呭
+     */
+    @ApiModelProperty("闂鍐呭")
+    @Excel(name = "闂鍐呭")
+    private String questiontext;
+
+    /**
+     * [{
+     *        "deptName": "绉戝鍚嶇О",
+     *        "deptCode": "绉戝缂栧彿"
+     *     },
+     * {
+     *       "deptName": "绉戝鍚嶇О",
+     *       "deptCode": "绉戝缂栧彿"
+     *     }
+     * ]
+     */
+    @ApiModelProperty("璐熻矗绉戝")
+    @Excel(name = "璐熻矗绉戝")
+    private List<Map<String, Object>> responsibleDept;
+
+    /**
+     * {
+     *        "effectiveFillNum": "鏈夋晥濉啓",
+     *       "exceptionFillNum": "寮傚父濉啓"
+     *     }
+     */
+    @ApiModelProperty("濉啓鎯呭喌")
+    @Excel(name = "濉啓鎯呭喌")
+    private Map<String, Object> fillSituation;
+
+
+    /**
+     * {
+     *        "yesDeal": "宸插鐞嗗紓甯告暟鎹噺",
+     *        "noDeal": "鏈鐞嗗紓甯告暟鎹噺"
+     *        "all": "鎬诲紓甯告暟鎹噺"
+     *     }
+     */
+    @ApiModelProperty("寮傚父闂澶勭悊鏁伴噺")
+    @Excel(name = "寮傚父闂澶勭悊鏁伴噺")
+    private Map<String, Object> exceptionQuesNum;
+
+    /**
+     * 澶勭悊浜�
+     */
+    @ApiModelProperty("鏈�鏂板鐞嗕汉")
+    @Excel(name = "澶勭悊浜�")
+    private String handleBy;
+
+    /**
+     * 澶勭悊鏃堕棿
+     */
+    @ApiModelProperty("鏈�鏂板鐞嗘椂闂�")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "澶勭悊鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date handleTime;
+
+}
+
diff --git a/smartor/src/main/java/com/smartor/domain/DTO/ServiceSubtaskDetailDTO.java b/smartor/src/main/java/com/smartor/domain/DTO/ServiceSubtaskDetailDTO.java
new file mode 100644
index 0000000..62b38ed
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/DTO/ServiceSubtaskDetailDTO.java
@@ -0,0 +1,41 @@
+package com.smartor.domain.DTO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 璇煶浠诲姟鍛煎彨鏄庣粏瀵硅薄 ivr_taskcalldetail
+ *
+ * @author smartor
+ * @date 2023-03-24
+ */
+@Data
+@ApiModel(value = "ServiceSubtaskDetailDTO", description = "闂鍥炵瓟鏄庣粏")
+public class ServiceSubtaskDetailDTO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "涓婚敭")
+    private Long id;
+
+    @ApiModelProperty(value = "闂鏂囨湰")
+    private String questiontext;
+
+    @ApiModelProperty(value = "閫氳繃姝e垯瑙f瀽鐨勫��")
+    private String matchedtext;
+
+    @ApiModelProperty(value = "闂id")
+    private Long scriptid;
+
+    @ApiModelProperty(value = "鎸囨爣鍊�(璇ラ棶棰樼殑鎵�鏈夐�夐」鍐呭鐢ㄢ��&鈥滃垎鍓�)")
+    private String targetvalue;
+
+    @ApiModelProperty(value = "鍒嗘暟")
+    private String score;
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptAssort.java b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptAssort.java
index a100a7b..e0d5e84 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptAssort.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptAssort.java
@@ -52,6 +52,13 @@
     @ApiModelProperty("搴忓彿")
     @Excel(name = "搴忓彿")
     private Integer seqno;
+    
+    /**
+     * 闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...
+     */
+    @ApiModelProperty("闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...")
+    @Excel(name = "闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...")
+    private String type;
 
 
 }
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
index a5f827a..ab03e8d 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
@@ -134,10 +134,10 @@
     private String groupid;
 
     /**
-     * 鏄惁寮傚父鏍囪瘑
+     * 鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡
      */
-    @ApiModelProperty("鏄惁寮傚父鏍囪瘑")
-    @Excel(name = "鏄惁寮傚父鏍囪瘑")
+    @ApiModelProperty("鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
+    @Excel(name = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
     private Long isabnormal;
 
     /**
@@ -218,4 +218,11 @@
     @ApiModelProperty(value = "鏄惁缁撴潫 0锛氫笉缁撴潫   1锛氱粨鏉�")
     private Integer isEnd;
 
+    /**
+     * 闂id
+     */
+    @Excel(name = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    @ApiModelProperty(value = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    private Long isException;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
index fb596fc..f1e6a88 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -37,11 +37,18 @@
     private Long scriptno;
 
     /**
-     * 绫诲埆ID
+     * 璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
      */
-    @Excel(name = "绫诲埆ID")
-    @ApiModelProperty(value = "绫诲埆ID")
-    private Long assortid;
+    @Excel(name = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private Long scriptAssortid;
+
+    /**
+     * 璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
+     */
+    @Excel(name = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private String scriptAssortname;
 
     /**
      * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
@@ -87,8 +94,8 @@
     /**
      * 闂绫诲瀷
      */
-    @Excel(name = "闂绫诲瀷")
-    @ApiModelProperty(value = "闂绫诲瀷")
+    @Excel(name = "闂绫诲瀷锛�1.鍗曢�� 2澶氶�� 3濉┖ 4鍏跺畠锛�")
+    @ApiModelProperty(value = "闂绫诲瀷锛�1.鍗曢�� 2澶氶�� 3濉┖ 4鍏跺畠锛�")
     private String scriptType;
 
     /**
@@ -175,12 +182,8 @@
     @ApiModelProperty(value = "鍚笉娓呰瘽鏈闊�")
     private String noClearlyVoice;
 
-    /**
-     * 绫诲埆鍚�
-     */
-    @Excel(name = "绫诲埆鍚�")
-    @ApiModelProperty(value = "绫诲埆鍚�")
-    private String categoryName;
+
+
 
 //    /**
 //     * 鎸囨爣閫夐」
@@ -317,6 +320,22 @@
     @ApiModelProperty(value = "缁勫埆")
     private String groupName;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
 //    /**
 //     * 闂缁撴灉锛堢粰鈥滃�肩被鍨嬧�濇槸鏂囨湰鎴栬�呮暟鍊肩敤鐨勶級
 //     */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
index 1d4423f..7c0c505 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -183,11 +183,20 @@
     private String categoryName;
 
     /**
-     * 绫诲埆ID
+     * 璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
      */
-    @Excel(name = "绫诲埆ID")
-    @ApiModelProperty(value = "绫诲埆ID")
-    private Long assortid;
+    @Excel(name = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private Long scriptAssortid;
+
+
+    /**
+     * 璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
+     */
+    @Excel(name = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private String scriptAssortname;
+
 
 //    /**
 //     * 鎸囨爣閫夐」
@@ -350,6 +359,22 @@
     @ApiModelProperty(value = "閫氱敤搴撳尮閰嶇殑鍊�")
     private String commonValue = "";
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
     /**
      * 璇濇湳閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
index 4a39193..aae705a 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
@@ -142,17 +142,17 @@
     private String groupid;
 
     /**
-     * 鏄惁寮傚父鏍囪瘑
+     * 鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡
      */
-    @Excel(name = "鏄惁寮傚父鏍囪瘑")
-    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑")
+    @Excel(name = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
+    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
     private Long isabnormal;
 
     /**
-     * 鏄惁寮傚父鏍囪瘑
+     * 閫夐」鍒嗘暟
      */
-    @Excel(name = "鏄惁寮傚父鏍囪瘑")
-    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑")
+    @Excel(name = "閫夐」鍒嗘暟")
+    @ApiModelProperty(value = "閫夐」鍒嗘暟")
     private BigDecimal score;
 
 //    /**
@@ -256,4 +256,11 @@
      */
     @ApiModelProperty(value = "鏈嶅姟鐨勫悕绉�")
     private String sendTaskname;
+
+    /**
+     * 闂id
+     */
+    @Excel(name = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    @ApiModelProperty(value = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    private Long isException;
 }
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
index 3c20b85..d23b725 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
@@ -143,19 +143,23 @@
     @ApiModelProperty(value = "鍚笉娓呰瘽鏈闊�")
     private String noClearlyVoice;
 
-    /**
-     * 绫诲埆鍚�
-     */
-    @Excel(name = "绫诲埆鍚�")
-    @ApiModelProperty(value = "绫诲埆鍚�")
-    private String categoryName;
 
     /**
-     * 绫诲埆ID
+     * 璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
      */
-    @Excel(name = "绫诲埆ID")
-    @ApiModelProperty(value = "绫诲埆ID")
-    private Long assortid;
+    @Excel(name = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private String scriptAssortname;
+
+
+    /**
+     * 璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
+     */
+    @Excel(name = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private Long scriptAssortid;
+
+
 
     /**
      * 鎸囨爣閫夐」
@@ -311,6 +315,22 @@
     @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
     private Long nextScriptno;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
     /**
      * 闂閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
index b47a625..bd70037 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
@@ -173,18 +173,18 @@
     private String groupName;
 
     /**
-     * 绫诲埆鍚�
+     * 璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
      */
-    @Excel(name = "绫诲埆鍚�")
-    @ApiModelProperty(value = "绫诲埆鍚�")
-    private String categoryName;
+    @Excel(name = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆鍚嶇О锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private String scriptAssortname;
 
     /**
-     * 绫诲埆ID
+     * 璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�
      */
-    @Excel(name = "绫诲埆ID")
-    @ApiModelProperty(value = "绫诲埆ID")
-    private Long assortid;
+    @Excel(name = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    @ApiModelProperty(value = "璇煶闂绫诲埆ID锛堝搴旂殑鏄痠vr_liba_script_ssort锛�")
+    private Long scriptAssortid;
     /**
      * 鎸囨爣閫夐」
      */
@@ -341,13 +341,29 @@
     private Integer sort;
 
     /**
-     * 寮傚父棰勮锛�0缁胯壊锛�1绾㈣壊锛�2榛勮壊
+     * 寮傚父棰勮锛�0缁胯壊锛� 1绾㈣壊  2榛勮壊锛�
      */
-    @ApiModelProperty(value = "寮傚父棰勮锛�0缁胯壊锛�1绾㈣壊锛�2榛勮壊")
+    @ApiModelProperty(value = "寮傚父棰勮锛�0缁胯壊锛� 1绾㈣壊  2榛勮壊锛�")
     private Long isabnormal;
 
     private List<Integer> sendTaskids;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
     /**
      * 璇濇湳閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
index 3c865b3..2202367 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
@@ -145,10 +145,10 @@
     private String groupid;
 
     /**
-     * 鏄惁寮傚父鏍囪瘑
+     * 鏄惁棰勮鏍囪瘑
      */
-    @Excel(name = "鏄惁寮傚父鏍囪瘑")
-    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑")
+    @Excel(name = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
+    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
     private Long isabnormal;
 
     /**
@@ -215,6 +215,13 @@
     private Long scriptid;
 
     /**
+     * 闂id
+     */
+    @Excel(name = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    @ApiModelProperty(value = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    private Long isException;
+
+    /**
      * 姝e垯鍏抽敭瀛�(鍚�)
      */
     @Excel(name = "姝e垯鍏抽敭瀛�(鍚�)")
diff --git a/smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java b/smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java
index 2d714c2..13e29c5 100644
--- a/smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java
+++ b/smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java
@@ -144,7 +144,7 @@
      */
     @Excel(name = "绉戝缂栫爜")
     @ApiModelProperty("绉戝缂栫爜")
-    private String deptCode;
+    private String deptcode;
 
     /**
      * 绉戝
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java b/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java
index ea23c40..3409105 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java
@@ -34,5 +34,4 @@
     @ApiModelProperty(value = "璇曞嵎绫诲瀷:1 闅忚   2 闂嵎")
     private Integer type;
 
-
 }
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
index 17b297f..0ac375c 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -152,7 +152,7 @@
      * 浠诲姟绫诲瀷(闂ㄨ瘖锛屼綇闄紝澶嶈瘖鈥�)
      */
     @Excel(name = "浠诲姟绫诲瀷锛�1锛屾満鍣ㄤ汉璇煶锛堥殢璁匡級  2锛岄棶鍗凤紱3锛岄�氱煡锛堝鏁欙級")
-    @ApiModelProperty(value = "浠诲姟绫诲瀷锛�1锛屾満鍣ㄤ汉璇煶锛堥殢璁匡級  2锛岄棶鍗凤紱3锛屽鏁欙紱 4.閫氱煡)")
+    @ApiModelProperty(value = "浠诲姟绫诲瀷锛�1锛岃闊筹紙闅忚锛�  2锛岄棶鍗凤紱3锛屽鏁欙紱 4.閫氱煡)")
     private String type;
 
     /**
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java
index afcde78..d0b2a9b 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java
@@ -37,6 +37,9 @@
     @ApiModelProperty(value = "鐢佃瘽鍙风爜")
     private String phone;
 
+    @ApiModelProperty(value = "鍒嗘暟")
+    private String score;
+
     @ApiModelProperty(value = "鎿嶄綔浜� ")
     private String operate;
 
@@ -58,7 +61,7 @@
     @ApiModelProperty(value = "鍥炵瓟鏃堕棿")
     private Long answertime;
 
-    @ApiModelProperty(value = "")
+    @ApiModelProperty(value = "鎮h�呬笉鍝嶅簲锛堟棤鍝嶅簲锛夛細1鍚�   2鏄�")
     private Long silent;
 
     @ApiModelProperty(value = "")
@@ -97,6 +100,11 @@
     @ApiModelProperty(value = "妯℃澘闂缂栧彿")
     private Long templatequestionnum;
 
+    @ApiModelProperty(value = "妯℃澘绫诲瀷锛�1.璇煶 2.闂嵎")
+    private Integer templateType;
+
+    @ApiModelProperty(value = "鍩虹妯℃澘ID")
+    private Integer libTemplateid;
 
     @ApiModelProperty(value = "浜ゆ崲鏈篒D")
     private Long switchid;
@@ -157,7 +165,7 @@
     @ApiModelProperty(value = "鍒犻櫎鏍囪")
     private String delFlag;
 
-    @ApiModelProperty(value = "闂绫诲瀷")
+    @ApiModelProperty(value = "闂绫诲瀷锛�1.鍗曢�� 2澶氶�� 3闂瓟 4濉┖  5鍏跺畠锛�")
     private String valueType;
 
 
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java
new file mode 100644
index 0000000..176d723
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailTrace.java
@@ -0,0 +1,345 @@
+package com.smartor.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 闅忚浠诲姟寮傚父璁板綍璺熻釜瀵硅薄 service_subtask_detail_trace
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+@Data
+@ApiModel("闅忚浠诲姟寮傚父璁板綍璺熻釜")
+public class ServiceSubtaskDetailTrace extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 涓婚敭
+     */
+    @ApiModelProperty("涓婚敭")
+    //鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 鏄庣粏id
+     */
+    @ApiModelProperty("鏄庣粏id")
+    @Excel(name = "鏄庣粏id")
+    private Long detailId;
+
+    /**
+     * 瀛愪换鍔D
+     */
+    @ApiModelProperty("瀛愪换鍔D")
+    @Excel(name = "瀛愪换鍔D")
+    private Long subId;
+
+    /**
+     * 浠诲姟ID
+     */
+    @ApiModelProperty("浠诲姟ID")
+    @Excel(name = "浠诲姟ID")
+    private Long taskid;
+
+    /**
+     * 浠诲姟妯℃澘ID
+     */
+    @ApiModelProperty("浠诲姟妯℃澘ID")
+    @Excel(name = "浠诲姟妯℃澘ID")
+    private Long templateid;
+
+    /**
+     * 浠诲姟妯℃澘闂棰樺彿
+     */
+    @ApiModelProperty("浠诲姟妯℃澘闂棰樺彿")
+    @Excel(name = "浠诲姟妯℃澘闂棰樺彿")
+    private Long templatequestionnum;
+
+    /**
+     * 闂閫夐」id
+     */
+    @ApiModelProperty("闂閫夐」id")
+    @Excel(name = "闂閫夐」id")
+    private Long switchid;
+
+    /**
+     * 闂鏂囨湰
+     */
+    @ApiModelProperty("闂鏂囨湰  ")
+    @Excel(name = "闂鏂囨湰  ")
+    private String questiontext;
+
+    /**
+     * 闂璇煶
+     */
+    @ApiModelProperty("闂璇煶  ")
+    @Excel(name = "闂璇煶  ")
+    private String questionvoice;
+
+    /**
+     * 绫诲埆
+     */
+    @ApiModelProperty("绫诲埆")
+    @Excel(name = "绫诲埆")
+    private String categoryname;
+
+//    /** 鎸囨爣閫夐」 */
+//    @ApiModelProperty("鎸囨爣閫夐」")
+//     @Excel(name = "鎸囨爣閫夐」")
+//    private String targetoptions;
+
+    /**
+     * 鎸囨爣id
+     */
+    @ApiModelProperty("鎸囨爣id")
+    @Excel(name = "鎸囨爣id")
+    private Long targetid;
+
+    /**
+     * 鎸囨爣閫夐」鍊硷紙姝e垯鍖归厤鐨勯�夐」鍊硷級
+     */
+    @ApiModelProperty("鎸囨爣閫夐」鍊硷紙姝e垯鍖归厤鐨勯�夐」鍊硷級")
+    @Excel(name = "鎸囨爣閫夐」鍊�", readConverterExp = "姝�=鍒欏尮閰嶇殑閫夐」鍊�")
+    private String targetvalue;
+
+    /**
+     * 閫氳繃姝e垯瑙f瀽鐨勫��
+     */
+    @ApiModelProperty("閫氳繃姝e垯瑙f瀽鐨勫��")
+    @Excel(name = "閫氳繃姝e垯瑙f瀽鐨勫��")
+    private String matchedtext;
+
+    /**
+     * 鎷ㄥ彿uuid
+     */
+    @ApiModelProperty("鎷ㄥ彿uuid")
+    @Excel(name = "鎷ㄥ彿uuid")
+    private String uuid;
+
+    /**
+     * GUID
+     */
+    @ApiModelProperty("GUID")
+    @Excel(name = "GUID")
+    private String guid;
+
+    /**
+     * 闂绫诲瀷:璇煶銆侀棶鍗�
+     */
+    @ApiModelProperty("闂绫诲瀷:璇煶銆侀棶鍗�")
+    @Excel(name = "闂绫诲瀷:锛�1.鍗曢�� 2澶氶�� 3闂瓟 4濉┖  5鍏跺畠锛�")
+    private String valueType;
+
+    /**
+     * 闂绫诲瀷:璇煶銆侀棶鍗�
+     */
+    @ApiModelProperty("闂绫诲瀷:璇煶銆侀棶鍗�")
+    @Excel(name = "妯℃澘绫诲瀷锛�1.璇煶 2.闂嵎")
+    private Integer templateType;
+
+    /**
+     * 闂绫诲瀷
+     */
+    @ApiModelProperty("闂鍒嗙被锛氾紙渚嬪,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    @Excel(name = "闂鍒嗙被:锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    private String type;
+
+    /**
+     * 闂ID
+     */
+    @ApiModelProperty("闂ID")
+    @Excel(name = "闂ID")
+    private Long scriptid;
+
+    /**
+     * 閫夐」绛旀鐨勯檮鍔犱俊鎭�
+     */
+    @ApiModelProperty("閫夐」绛旀鐨勯檮鍔犱俊鎭�")
+    @Excel(name = "閫夐」绛旀鐨勯檮鍔犱俊鎭�")
+    private String answerps;
+
+    /**
+     * 瀵圭瓟妗堢殑璇勮
+     */
+    @ApiModelProperty("瀵圭瓟妗堢殑璇勮")
+    @Excel(name = "瀵圭瓟妗堢殑璇勮")
+    private String comment;
+
+    /**
+     * 鍥炵瓟缁撴灉
+     */
+    @ApiModelProperty("鍥炵瓟缁撴灉")
+    @Excel(name = "鍥炵瓟缁撴灉")
+    private String asrtext;
+
+    /**
+     * 褰曢煶鍦板潃
+     */
+    @ApiModelProperty("褰曢煶鍦板潃")
+    @Excel(name = "褰曢煶鍦板潃")
+    private String recordpath;
+
+    /**
+     * 褰曢煶URL
+     */
+    @ApiModelProperty("褰曢煶URL")
+    @Excel(name = "褰曢煶URL")
+    private String recordurl;
+
+    /**
+     * 鎮h�匢D
+     */
+    @ApiModelProperty("鎮h�匢D")
+    @Excel(name = "鎮h�匢D")
+    private Long patid;
+
+    /**
+     * 鍖呭惈鎮h�呭鍚嶃�佹偅鑰呯數璇濄�佸氨璇婄瀹ょ瓑
+     */
+    @ApiModelProperty("鍖呭惈鎮h�呭鍚嶃�佹偅鑰呯數璇濄�佸氨璇婄瀹ょ瓑")
+    @Excel(name = "鍖呭惈鎮h�呭鍚嶃�佹偅鑰呯數璇濄�佸氨璇婄瀹ょ瓑")
+    private String patdesc;
+
+    /**
+     * 澶勭悊绉戝id
+     */
+    @ApiModelProperty("澶勭悊绉戝id")
+    @Excel(name = "澶勭悊绉戝id")
+    private Long todeptid;
+
+    /**
+     * 澶勭悊绉戝缂栧彿
+     */
+    @ApiModelProperty("澶勭悊绉戝缂栧彿")
+    @Excel(name = "澶勭悊绉戝缂栧彿")
+    private String todeptcode;
+
+    /**
+     * 澶勭悊绉戝鍚嶇О
+     */
+    @ApiModelProperty("澶勭悊绉戝鍚嶇О")
+    @Excel(name = "澶勭悊绉戝鍚嶇О")
+    private String todeptname;
+
+    /**
+     * 澶勭悊缁撴灉锛堝鐞嗙瀹わ級
+     */
+    @ApiModelProperty("澶勭悊缁撴灉锛堝鐞嗙瀹わ級")
+    @Excel(name = "澶勭悊缁撴灉", readConverterExp = "澶�=鐞嗙瀹�")
+    private String handleresult;
+
+    /**
+     * 澶勭悊璇︾粏璇存槑锛堝鐞嗙瀹わ級
+     */
+    @ApiModelProperty("澶勭悊璇︾粏璇存槑锛堝鐞嗙瀹わ級")
+    @Excel(name = "澶勭悊璇︾粏璇存槑", readConverterExp = "澶�=鐞嗙瀹�")
+    private String handledesc;
+
+    /**
+     * 澶勭悊鏍囪锛�0鏈鐞嗭紝1宸插鐞�
+     */
+    @ApiModelProperty("澶勭悊鏍囪锛�0鏈鐞嗭紝1宸插鐞�")
+    @Excel(name = "澶勭悊鏍囪锛�0鏈鐞嗭紝1宸插鐞�")
+    private String handleFlag;
+
+    /**
+     * 澶勭悊浜�
+     */
+    @ApiModelProperty("澶勭悊浜�")
+    @Excel(name = "澶勭悊浜�")
+    private String handleBy;
+
+    /**
+     * 澶勭悊鏃堕棿
+     */
+    @ApiModelProperty("澶勭悊鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "澶勭悊鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date handleTime;
+
+    /**
+     * 鎶勯�佺瀹わ紝澶氫釜绉戝
+     */
+    @ApiModelProperty("鎶勯�佺瀹わ紝澶氫釜绉戝")
+    @Excel(name = "鎶勯�佺瀹わ紝澶氫釜绉戝")
+    private String ccdepts;
+
+    /**
+     * 鏈�缁堬紙璐ㄧ閮ㄩ棬锛夋剰瑙�
+     */
+    @ApiModelProperty("鏈�缁堬紙璐ㄧ閮ㄩ棬锛夋剰瑙�")
+    @Excel(name = "鏈�缁�", readConverterExp = "璐�=绠¢儴闂�")
+    private String finaloption;
+
+    /**
+     * 鏈�缁堬紙璐ㄧ閮ㄩ棬锛夋剰瑙佹椂闂�
+     */
+    @ApiModelProperty("鏈�缁堬紙璐ㄧ閮ㄩ棬锛夋剰瑙佹椂闂�")
+    @Excel(name = "鏈�缁�", readConverterExp = "璐�=绠¢儴闂�")
+    private Date finaltime;
+
+    /**
+     * 鎿嶄綔浜�
+     */
+    @ApiModelProperty("鎿嶄綔浜� ")
+    @Excel(name = "鎿嶄綔浜� ")
+    private String operate;
+
+    /**
+     * 鍖婚櫌鏈烘瀯ID
+     */
+    @ApiModelProperty("鍖婚櫌鏈烘瀯ID")
+    @Excel(name = "鍖婚櫌鏈烘瀯ID")
+    private String orgid;
+
+    /**
+     * 涓婁紶鏍囧織锛�0锛氭湭涓婁紶 1锛氬凡涓婁紶锛�
+     */
+    @ApiModelProperty("涓婁紶鏍囧織锛�0锛氭湭涓婁紶 1锛氬凡涓婁紶锛�")
+    @Excel(name = "涓婁紶鏍囧織", readConverterExp = "0=锛氭湭涓婁紶,1=锛氬凡涓婁紶")
+    private Long isupload;
+
+    /**
+     * 涓婁紶鏃堕棿
+     */
+    @ApiModelProperty("涓婁紶鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "涓婁紶鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date uploadTime;
+
+    /**
+     * 鍒犻櫎鏍囧織锛�0锛氭湭鍒犻櫎 1锛氬凡鍒犻櫎锛�
+     */
+    @ApiModelProperty("鍒犻櫎鏍囧織锛�0锛氭湭鍒犻櫎 1锛氬凡鍒犻櫎锛�")
+    private String delFlag;
+
+    /**
+     * 鐖禛UID
+     */
+    @ApiModelProperty("鐖禛UID")
+    @Excel(name = "鐖禛UID")
+    private String pguid;
+
+    /**
+     * 鐖禝D
+     */
+    @ApiModelProperty("鐖禝D")
+    @Excel(name = "鐖禝D")
+    private Integer pid;
+
+    /**
+     * 绫诲埆ID
+     */
+    @ApiModelProperty("绫诲埆ID")
+    @Excel(name = "绫诲埆ID")
+    private Long categoryid;
+
+}
+
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java
index 5a4029c..46f3fd7 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java
@@ -96,6 +96,12 @@
     @ApiModelProperty(value = "妯℃澘闂缂栧彿")
     private Long templatequestionnum;
 
+    @ApiModelProperty(value = "鍩虹妯℃澘ID")
+    private Integer libTemplateid;
+
+    @ApiModelProperty(value = "妯℃澘绫诲瀷锛�1.璇煶 2.闂嵎")
+    private Integer templateType;
+
 
     @ApiModelProperty(value = "浜ゆ崲鏈篒D")
     private Long switchid;
@@ -103,6 +109,8 @@
     @ApiModelProperty(value = "闂鏂囨湰")
     private String questiontext;
 
+    @ApiModelProperty(value = "鍒嗘暟")
+    private String score;
 
     @ApiModelProperty(value = "闂璇煶")
     private String questionvoice;
@@ -152,7 +160,7 @@
     private String valueType;
 
 
-    @ApiModelProperty(value = "闂id")
+    @ApiModelProperty(value = "闂id锛氬搴旂殑taskTemplateScript鐨処D")
     private Long scriptid;
 
     @ApiModelProperty(value = "閫夐」绛旀鐨勯檮鍔犱俊鎭�")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskPreachform.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskPreachform.java
index f060290..d37d1b0 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskPreachform.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskPreachform.java
@@ -56,7 +56,7 @@
      * <p>
      * 浜哄伐闅忚鐘舵�侊細1鏈墽琛�   2寰呬汉宸ョ‘璁�  3鎷掓帴鎷掕  4鍙风爜閿欒   5鎵ц澶辫触   6涓嶆墽琛�  7 瓒呮椂     9瀹屾垚
      * <p>
-     * 闈㈣鐘舵�侊細1鏈墽琛�   9瀹屾垚
+     *
      */
     @ApiModelProperty("鍙戦�佺姸鎬�")
     private String sendstate;
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategory.java b/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategory.java
index 78e4280..744977c 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategory.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategory.java
@@ -75,4 +75,11 @@
     @ApiModelProperty("搴忓彿")
     private Integer seqno;
 
+    /**
+     * 闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�
+     */
+    @Excel(name = "闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    @ApiModelProperty("闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    private String type;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategoryVO.java b/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategoryVO.java
index 8bccb60..b0c5792 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategoryVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibScriptCategoryVO.java
@@ -41,6 +41,20 @@
     @ApiModelProperty("闂嵎棰樼洰id")
     private Long topicid;
 
+
+    /**
+     * 闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�
+     */
+    @Excel(name = "闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    @ApiModelProperty("闂绫诲瀷锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    private String type;
+
+    /**
+     * 瀛愬璞�
+     */
+    @ApiModelProperty("瀛愬璞¢泦")
+    private List<SvyLibScriptCategory> svyLibScriptCategoryList = new ArrayList<>();
+
     /**
      * 鐖禝D
      */
@@ -67,11 +81,5 @@
     @Excel(name = "鍖婚櫌鏈烘瀯id")
     @ApiModelProperty("鍖婚櫌鏈烘瀯id")
     private String orgid;
-
-    /**
-     * 瀛愬璞�
-     */
-    @ApiModelProperty("瀛愬璞¢泦")
-    private List<SvyLibScriptCategory> svyLibScriptCategoryList = new ArrayList<>();
 
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java b/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
index d6486c9..0bb54b5 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
@@ -76,9 +76,9 @@
     private Long detailismandatory;
 
     /**
-     * 鏄惁寮傚父椤圭洰
+     * 鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡
      */
-    @ApiModelProperty(value = "鏄惁寮傚父椤圭洰")
+    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
     private Long isabnormal;
 
     /**
@@ -202,5 +202,11 @@
     @ApiModelProperty(value = "闄勪欢淇℃伅")
     private String appenddesc;
 
+    /**
+     * 寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�
+     */
+    @ApiModelProperty(value = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+    private Integer isException;
+
 }
 
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
index 4e50611..da4eda0 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
@@ -135,7 +135,6 @@
     @ApiModelProperty("涓婁紶鏃堕棿")
     private Date uploadTime;
 
-
     /**
      * 鐖禝D
      */
@@ -151,11 +150,18 @@
     private String guid;
 
     /**
-     * 鍒嗙被id
+     * 瀵瑰簲鐨勬槸svy_lib_script_category鐨勪富閿�
      */
-    @Excel(name = "鍒嗙被id")
-    @ApiModelProperty("鍒嗙被id")
+    @Excel(name = "瀵瑰簲鐨勬槸svy_lib_script_category鐨勪富閿�")
+    @ApiModelProperty("瀵瑰簲鐨勬槸svy_lib_script_category鐨勪富閿�")
     private Long categoryid;
+
+    /**
+     * 绫诲埆鍚�
+     */
+    @ApiModelProperty(value = "瀵瑰簲鐨勬槸svy_lib_script_category鐨勭被鍒悕")
+    private String categoryName;
+
     /**
      * 棰樼洰鍐呭
      */
@@ -276,4 +282,23 @@
     @ApiModelProperty(value = "缁勫埆")
     private String groupName;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
+    @Excel(name = "鍒嗙被ID闆嗗悎")
+    @ApiModelProperty(value = "鍒嗙被ID闆嗗悎")
+    private List<Long> categoryids;
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
index 8e8203e..2627598 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
@@ -170,9 +170,16 @@
     /**
      * 鍒嗙被id
      */
-    @Excel(name = "鍒嗙被id")
-    @ApiModelProperty("鍒嗙被id")
+    @Excel(name = "瀵瑰簲鐨勬槸svy_lib_script_category鐨刬d")
+    @ApiModelProperty("瀵瑰簲鐨勬槸svy_lib_script_category鐨刬d")
     private Long categoryid;
+
+
+    /**
+     * 绫诲埆鍚�
+     */
+    @ApiModelProperty(value = "瀵瑰簲鐨勬槸svy_lib_script_category鐨勭被鍒悕")
+    private String categoryName;
 
     /**
      * 棰樼洰鍐呭
@@ -274,4 +281,23 @@
     @ApiModelProperty("閫夐」绛旀鐨勯檮鍔犱俊鎭�")
     private String answerps;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
+    @Excel(name = "鍒嗙被ID闆嗗悎")
+    @ApiModelProperty(value = "鍒嗙被ID闆嗗悎")
+    private List<Long> categoryids;
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
index 601bfed..2e4ae8b 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
@@ -166,8 +166,8 @@
     /**
      * 鏄惁寮傚父鏍囪瘑
      */
-    @Excel(name = "鏄惁寮傚父鏍囪瘑")
-    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑")
+    @Excel(name = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
+    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
     private Long isabnormal;
 
 //    /**
@@ -277,4 +277,10 @@
      */
     @ApiModelProperty(value = "鏈嶅姟鐨勫悕绉�")
     private String sendTaskname;
+//
+//    /**
+//     * 寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�
+//     */
+//    @ApiModelProperty(value = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+//    private Integer isException;
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
index f3aef10..33ea456 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
@@ -85,14 +85,14 @@
     /**
      * 绫诲埆鍚�
      */
-    @ApiModelProperty(value = "绫诲埆鍚�")
+    @ApiModelProperty(value = "瀵瑰簲鐨勬槸svy_lib_script_category鐨勭被鍒悕")
     private String categoryName;
 
     /**
      * 绫诲埆ID
      */
-    @Excel(name = "绫诲埆ID")
-    @ApiModelProperty(value = "绫诲埆ID")
+    @Excel(name = "瀵瑰簲鐨勬槸svy_lib_script_category鐨勭被鍒獻D")
+    @ApiModelProperty(value = "瀵瑰簲鐨勬槸svy_lib_script_category鐨勭被鍒獻D")
     private Long categoryid;
     /**
      * 璇濇湳鍐呭
@@ -246,4 +246,20 @@
     @ApiModelProperty(value = "缁勫埆")
     private String groupName;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
index 73578d3..49154a2 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
@@ -335,6 +335,22 @@
     @ApiModelProperty(value = "閫変腑璇ラ�夐」鍚庯紝闇�瑕佺粰褰撳墠鎮h�呯珛鍗冲彂閫佺殑鏈嶅姟鐨刬d闆嗗悎")
     private List<Integer> sendTaskids;
 
+    @Excel(name = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptName;
+
+    @Excel(name = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "璐d换绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String dutyDeptCode;
+
+    @Excel(name = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝鍚嶇О锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptName;
+
+    @Excel(name = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    @ApiModelProperty(value = "鎶ュ绉戝缂栫爜锛堝鏋滃涓瀹ょ敤閫楀彿鍒嗗壊锛�")
+    private String reportDeptCode;
+
     /**
      * 璇濇湳閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
index 2cf154d..c8063c3 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
@@ -116,7 +116,7 @@
     /**
      * 鏄惁寮傚父鏍囪瘑
      */
-    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑")
+    @ApiModelProperty(value = "鏄惁寮傚父鏍囪瘑锛�0姝e父  1寮傚父  2璀﹀憡")
     private Long isabnormal;
 
     /**
@@ -259,4 +259,9 @@
     @ApiModelProperty(value = "鏄惁鏄敤鎴烽�夋嫨鐨勯�夐」")
     private Boolean isUserOperation = false;
 
+//    /**
+//     * 寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�
+//     */
+//    @ApiModelProperty(value = "寮傚父閫夐」锛�1鍚︼紙榛樿锛�    2鏄�")
+//    private Integer isException;
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SysUserOrg.java b/smartor/src/main/java/com/smartor/domain/SysUserOrg.java
index 09eeff8..70f422d 100644
--- a/smartor/src/main/java/com/smartor/domain/SysUserOrg.java
+++ b/smartor/src/main/java/com/smartor/domain/SysUserOrg.java
@@ -25,17 +25,17 @@
 
     /** 鐢ㄦ埛ID */
     @ApiModelProperty("鐢ㄦ埛ID")
-            @Excel(name = "鐢ㄦ埛ID")
+    @Excel(name = "鐢ㄦ埛ID")
     private String userId;
 
     /** 闄㈠尯ID */
     @ApiModelProperty("闄㈠尯ID")
-            @Excel(name = "闄㈠尯ID")
+    @Excel(name = "闄㈠尯ID")
     private String campusid;
 
     /** 鏈烘瀯ID */
     @ApiModelProperty("鏈烘瀯ID")
-            @Excel(name = "鏈烘瀯ID")
+    @Excel(name = "鏈烘瀯ID")
     private String orgid;
 
     /** 鍒犻櫎鏍囧織锛�0锛氭湭鍒犻櫎 1锛氬凡鍒犻櫎锛� */
diff --git a/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java b/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java
new file mode 100644
index 0000000..7298a7f
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/VO/DetailTraceDealVO.java
@@ -0,0 +1,69 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 婊℃剰搴﹀紓甯稿鐞嗘儏鍐佃姹傚璞�
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+@Data
+@ApiModel("婊℃剰搴﹀紓甯稿鐞嗘儏鍐佃姹傚璞�")
+public class DetailTraceDealVO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * 澶勭悊绉戝缂栧彿
+     */
+    @ApiModelProperty("澶勭悊绉戝缂栧彿")
+    @Excel(name = "澶勭悊绉戝缂栧彿")
+    private String todeptcode;
+
+    /**
+     * 澶勭悊绉戝鍚嶇О
+     */
+    @ApiModelProperty("澶勭悊绉戝鍚嶇О")
+    @Excel(name = "澶勭悊绉戝鍚嶇О")
+    private String todeptname;
+
+
+    /**
+     * 浠诲姟妯℃澘ID
+     */
+    @ApiModelProperty("浠诲姟妯℃澘ID")
+    @Excel(name = "浠诲姟妯℃澘ID")
+    private Long templateid;
+
+    /**
+     * 澶勭悊鏃堕棿
+     */
+    @ApiModelProperty("澶勭悊寮�濮嬫椂闂�")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "澶勭悊鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date handleStartTime;
+    /**
+     * 澶勭悊鏃堕棿
+     */
+    @ApiModelProperty("澶勭悊缁撴潫鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "澶勭悊鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date handleEndTime;
+
+    /**
+     * 闂绫诲瀷
+     */
+    @ApiModelProperty("闂鍒嗙被锛氾紙渚嬪,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    @Excel(name = "闂鍒嗙被:锛堜緥濡�,闂ㄨ瘖婊℃剰搴︼細mzmyd     浣忛櫌婊℃剰搴︼細zymyd  ...锛�")
+    private String type;
+
+}
+
diff --git a/smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionReqVO.java b/smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionReqVO.java
new file mode 100644
index 0000000..ddd6d05
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionReqVO.java
@@ -0,0 +1,88 @@
+package com.smartor.domain.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.smartor.domain.entity.PatSatisfactionDetailEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.*;
+
+/**
+ * 鎮h�呮弧鎰忓害缁熻璇锋眰鍏ュ弬
+ *
+ * @author ls
+ * @date 2026-03-27
+ */
+
+@ApiModel(value = "PatSatisfactionReqVO", description = "鎮h�呮弧鎰忓害缁熻璇锋眰鍏ュ弬")
+@Data
+public class PatSatisfactionReqVO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+//    /**
+//     * 涓婚敭id闆嗗悎
+//     */
+//    @ApiModelProperty(value = "鍩虹妯℃澘闂id闆嗗悎")
+//    private List<Long> scriptids;
+
+    /**
+     * 妯℃澘ID
+     */
+    @ApiModelProperty(value = "妯℃澘ID")
+    private Integer templateid;
+
+    /**
+     * scriptids閲岀殑闂id鍙兘鏄竴涓被鍨嬶紝涓嶈兘鏄贩鍚堢被鍨�
+     * 妯℃澘绫诲瀷锛�1.璇煶 2.闂嵎
+     */
+    @NotNull(message = "妯℃澘绫诲瀷涓嶈兘涓虹┖")
+    @ApiModelProperty(value = "妯℃澘绫诲瀷锛坰criptids閲岀殑闂id鍙兘鏄竴涓被鍨嬶紝涓嶈兘鏄贩鍚堢被鍨嬶級锛�1.璇煶 2.闂嵎")
+    private Integer type;
+
+    /**
+     * 鏌ヨ寮�濮嬫椂闂�
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @NotNull(message = "鏌ヨ寮�濮嬫椂闂�")
+    @ApiModelProperty(value = "鏌ヨ寮�濮嬫椂闂�")
+    private Date startTime;
+
+    /**
+     * 鏌ヨ缁撴潫鏃堕棿
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @NotNull(message = "鏌ヨ缁撴潫鏃堕棿")
+    @ApiModelProperty(value = "鏌ヨ缁撴潫鏃堕棿")
+    private Date endTime;
+
+    /**
+     * 閮ㄩ棬闆嗗悎
+     */
+    @NotNull(message = "閮ㄩ棬闆嗗悎")
+    @ApiModelProperty(value = "閮ㄩ棬闆嗗悎")
+    private List<String> deptcodes;
+
+    /**
+     * 閮ㄩ棬闆嗗悎
+     */
+    @NotNull(message = "闂嵎绫诲瀷锛�1璇煶   2闂埜")
+    @ApiModelProperty(value = "闂嵎绫诲瀷锛�1璇煶   2闂埜")
+    private Integer questionType;
+
+
+    /**
+     * 鎮h�呮湇鍔$被鍨嬶細6銆佸嚭闄㈡弧鎰忓害璋冩煡    14浣忛櫌婊℃剰搴�   15闂ㄨ瘖婊℃剰搴�  16甯哥敤婊℃剰搴�
+     */
+    @ApiModelProperty(value = "鎮h�呮湇鍔$被鍨嬶細6銆佸嚭闄㈡弧鎰忓害璋冩煡    14浣忛櫌婊℃剰搴�   15闂ㄨ瘖婊℃剰搴�  16甯哥敤婊℃剰搴�    (榛樿鏌ュ叏閮�)")
+    private List<String> serviceTypes = new ArrayList<>(Arrays.asList("6", "14", "15", "16"));
+
+    /**
+     * 鐥呭尯缂栧彿
+     */
+    @ApiModelProperty(value = "鐥呭尯闆嗗悎")
+    private List<String> hospitaldistrictcodes;
+
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionResVO.java b/smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionResVO.java
new file mode 100644
index 0000000..e985f8a
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionResVO.java
@@ -0,0 +1,44 @@
+package com.smartor.domain.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.smartor.domain.entity.PatSatisfactionDetailEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 鎮h�呮弧鎰忓害缁熻杩斿弬
+ *
+ * @author ls
+ * @date 2026-03-30
+ */
+
+@ApiModel(value = "PatSatisfactionReqVO", description = "鎮h�呮弧鎰忓害缁熻杩斿弬")
+@Data
+public class PatSatisfactionResVO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 涓婚敭id闆嗗悎
+     */
+    @ApiModelProperty(value = "绛旈鎬讳汉鏁�(宸茬粡鍥炵瓟闂鐨�)")
+    private Integer totalPerson;
+
+    /**
+     * 鎬荤瓟棰樼巼
+     */
+    @ApiModelProperty(value = "鎬荤瓟棰樼巼")
+    private Double totalAnswerRate;
+
+    /**
+     * 鐥呭尯缂栧彿
+     */
+    @ApiModelProperty(value = "棰樼洰鏄庣粏缁熻闆嗗悎")
+    private List<PatSatisfactionDetailEntity> patSatisfactionDetailEntities;
+}
diff --git a/smartor/src/main/java/com/smartor/domain/VO/SatisfactionExceptConfigQuestionReqVO.java b/smartor/src/main/java/com/smartor/domain/VO/SatisfactionExceptConfigQuestionReqVO.java
new file mode 100644
index 0000000..a809375
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/VO/SatisfactionExceptConfigQuestionReqVO.java
@@ -0,0 +1,60 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 婊℃剰搴﹀紓甯搁厤缃鐩姹備俊鎭�
+ *
+ * @author lihu
+ * @date 2026-03-31
+ */
+@Data
+@ApiModel("婊℃剰搴﹀紓甯搁厤缃鐩姹備俊鎭�")
+public class SatisfactionExceptConfigQuestionReqVO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 浠诲姟绫诲瀷(闂ㄨ瘖锛屼綇闄紝澶嶈瘖鈥�)
+     */
+    @Excel(name = "浠诲姟绫诲瀷锛�1 璇煶  2 闂嵎锛�")
+    @ApiModelProperty(value = "浠诲姟绫诲瀷锛�1.璇煶  2.闂嵎")
+    private String scriptType;
+
+    /**
+     * 棰樼洰涓婚
+     */
+    @ApiModelProperty("棰樼洰涓婚")
+    @Excel(name = "棰樼洰涓婚")
+    private String questionTopic;
+
+    /**
+     * 棰樼洰鍐呭
+     */
+    @ApiModelProperty("棰樼洰鍐呭")
+    @Excel(name = "棰樼洰鍐呭")
+    private String questionContent;
+
+    /**
+     * 鏄惁鍙敤 0鍙敤  1涓嶅彲鐢�
+     */
+    @ApiModelProperty("鏄惁鍙敤 0鍙敤  1涓嶅彲鐢�")
+    @Excel(name = "鏄惁鍙敤 0鍙敤  1涓嶅彲鐢�")
+    private String isavailable;
+
+    /**
+     * 鏄惁鍙敤 0鍙敤  1涓嶅彲鐢�
+     */
+    @ApiModelProperty("鏄惁鍙敤 0鍙敤  1涓嶅彲鐢�")
+    @Excel(name = "婊℃剰搴︾被鍨嬶紙渚嬪锛歮zmyd銆� zymyd銆� cymyd 锛�")
+    private String type;
+
+
+}
+
diff --git a/smartor/src/main/java/com/smartor/domain/VisitPlan.java b/smartor/src/main/java/com/smartor/domain/VisitPlan.java
index 92ac27a..835201d 100644
--- a/smartor/src/main/java/com/smartor/domain/VisitPlan.java
+++ b/smartor/src/main/java/com/smartor/domain/VisitPlan.java
@@ -29,53 +29,53 @@
     /** 鍑洪櫌鏃ユ湡 */
     @ApiModelProperty("鍑洪櫌鏃ユ湡")
             @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-            @Excel(name = "鍑洪櫌鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+     @Excel(name = "鍑洪櫌鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date outHospDate;
 
     /** 璁″垝闅忚鏃ユ湡 */
     @ApiModelProperty("璁″垝闅忚鏃ユ湡")
             @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-            @Excel(name = "璁″垝闅忚鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+     @Excel(name = "璁″垝闅忚鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date planVisitDate;
 
     /** 璇煶鍩虹妯℃澘ID锛堝晢璁殑鍥哄畾妯℃澘鏀捐繖涓〃閲岋級 */
     @ApiModelProperty("璇煶鍩虹妯℃澘ID锛堝晢璁殑鍥哄畾妯℃澘鏀捐繖涓〃閲岋級")
-            @Excel(name = "璇煶鍩虹妯℃澘ID", readConverterExp = "鍟�=璁殑鍥哄畾妯℃澘鏀捐繖涓〃閲�")
+     @Excel(name = "璇煶鍩虹妯℃澘ID", readConverterExp = "鍟�=璁殑鍥哄畾妯℃澘鏀捐繖涓〃閲�")
     private Long ivrLibaTemplateId;
 
     /** 鎮h�匢D */
     @ApiModelProperty("鎮h�匢D")
-            @Excel(name = "鎮h�匢D")
+     @Excel(name = "鎮h�匢D")
     private Long patid;
 
     /** 鎮h�呮墜鏈哄彿 */
     @ApiModelProperty("鎮h�呮墜鏈哄彿")
-            @Excel(name = "鎮h�呮墜鏈哄彿")
+     @Excel(name = "鎮h�呮墜鏈哄彿")
     private String phone;
 
     /** service_task涓婚敭 */
     @ApiModelProperty("service_task涓婚敭")
-            @Excel(name = "service_task涓婚敭")
+     @Excel(name = "service_task涓婚敭")
     private Long taskId;
 
     /** 瀛愪换鍔D */
     @ApiModelProperty("瀛愪换鍔D")
-            @Excel(name = "瀛愪换鍔D")
+     @Excel(name = "瀛愪换鍔D")
     private Long subTaskId;
 
     /** 浠诲姟妯℃澘ID */
     @ApiModelProperty("浠诲姟妯℃澘ID")
-            @Excel(name = "浠诲姟妯℃澘ID")
+     @Excel(name = "浠诲姟妯℃澘ID")
     private Long taskTemplateId;
 
     /** 0 鏈墽琛�    1宸叉墽琛� */
     @ApiModelProperty("0 鏈墽琛�    1宸叉墽琛�")
-            @Excel(name = "0 鏈墽琛�    1宸叉墽琛�")
+     @Excel(name = "0 鏈墽琛�    1宸叉墽琛�")
     private Long isExecute;
 
     /** 鍏紬鍙稩D */
     @ApiModelProperty("鍏紬鍙稩D")
-            @Excel(name = "鍏紬鍙稩D")
+     @Excel(name = "鍏紬鍙稩D")
     private String openid;
 
         }
diff --git a/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java b/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java
new file mode 100644
index 0000000..5c72f8d
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java
@@ -0,0 +1,76 @@
+package com.smartor.domain.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鎮h�呮弧鎰忓害缁熻鎯�
+ *
+ * @author ls
+ * @date 2026-03-30
+ */
+
+@ApiModel(value = "PatSatisfactionDetailEntity", description = "鎮h�呮弧鎰忓害缁熻鎯�")
+@Data
+public class PatSatisfactionDetailEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 闂鍐呭
+     */
+    @ApiModelProperty(value = "闂鍐呭")
+    private String scriptContent;
+
+    /**
+     * 绛旈浜烘暟
+     */
+    @ApiModelProperty(value = "绛旈浜烘暟")
+    private Integer answerPerson;
+
+    /**
+     * 绛旈浜烘暟
+     */
+    @ApiModelProperty(value = "鏈瓟棰樹汉鏁�")
+    private Integer noAnswerPerson;
+
+    /**
+     * 骞冲潎鍒�
+     */
+    @ApiModelProperty(value = "骞冲潎鍒�")
+    private Double averageScore;
+
+    /**
+     * 鏈�楂樺垎
+     */
+    @ApiModelProperty(value = "鏈�楂樺垎")
+    private Double maxScore;
+
+    /**
+     * 鏈�浣庡垎
+     */
+    @ApiModelProperty(value = "鏈�浣庡垎")
+    private Double minScore;
+
+    /**
+     * 绛旈鐜�
+     */
+    @ApiModelProperty(value = "绛旈鐜�")
+    private Double answerRate;
+
+    /**
+     * 鍚勯�夐」锛坢atchedtext锛夋暟閲忓強鍗犳瘮
+     * key=matchedtext锛寁alue={count: 鏁伴噺, ratio: 鍗犳瘮}
+     */
+    @ApiModelProperty(value = "鍚勯�夐」鏁伴噺鍙婂崰姣�")
+    private Map<String, Map<String, Object>> matchedtextStats;
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskSatisfactionEntity.java b/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskSatisfactionEntity.java
new file mode 100644
index 0000000..5a713e7
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskSatisfactionEntity.java
@@ -0,0 +1,65 @@
+package com.smartor.domain.entity;
+
+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 javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鎮h�呮弧鎰忓害鍙戦�佷汉鏁扮粺璁�
+ *
+ * @author ls
+ * @date 2026-03-27
+ */
+
+@ApiModel(value = "ServiceSubtaskSatisfactionEntity", description = "鍗曚竴闅忚浠诲姟鍏ュ弬")
+@Data
+public class ServiceSubtaskSatisfactionEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "浠诲姟绫诲瀷(1銆佽闊筹紱2銆侀棶鍗疯〃锛�)")
+    private Integer type;
+
+    /**
+     * 鍩虹妯℃澘Ids
+     */
+    @ApiModelProperty(value = "鍩虹妯℃澘Ids")
+    private List<Long> libTemplateIds;
+
+    /**
+     * 鏌ヨ寮�濮嬫椂闂�
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @NotNull(message = "鏌ヨ寮�濮嬫椂闂�")
+    @ApiModelProperty(value = "鏌ヨ寮�濮嬫椂闂�")
+    private Date startTime;
+
+    /**
+     * 鏌ヨ缁撴潫鏃堕棿
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @NotNull(message = "鏌ヨ缁撴潫鏃堕棿")
+    @ApiModelProperty(value = "鏌ヨ缁撴潫鏃堕棿")
+    private Date endTime;
+
+    /**
+     * 閮ㄩ棬闆嗗悎
+     */
+    @NotNull(message = "閮ㄩ棬闆嗗悎")
+    @ApiModelProperty(value = "閮ㄩ棬闆嗗悎")
+    private List<String> deptcodes;
+
+    /**
+     * 鐥呭尯缂栧彿
+     */
+    @ApiModelProperty(value = "鐥呭尯闆嗗悎")
+    private List<String> hospitaldistrictcodes;
+}
diff --git a/smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateScriptMapper.java b/smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateScriptMapper.java
index 2af6fcf..b90c2dd 100644
--- a/smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateScriptMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateScriptMapper.java
@@ -1,9 +1,13 @@
 package com.smartor.mapper;
 
 import com.smartor.domain.IvrLibaTemplateScript;
+import com.smartor.domain.VO.PatSatisfactionReqVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 妯$増闂璇濇湳搴揗apper鎺ュ彛
@@ -12,8 +16,7 @@
  * @date 2023-12-23
  */
 @Mapper
-public interface IvrLibaTemplateScriptMapper
-{
+public interface IvrLibaTemplateScriptMapper {
     /**
      * 鏌ヨ妯$増闂璇濇湳搴�
      *
@@ -61,4 +64,6 @@
      * @return 缁撴灉
      */
     public int deleteIvrLibaTemplateScriptByIDs(Long[] IDs);
+
+    public List<IvrLibaTemplateScript> queryLibTemplateIds(@Param("scriptAssortids") List<Long> scriptAssortids);
 }
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java
index f96af96..8814884 100644
--- a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailMapper.java
@@ -1,8 +1,10 @@
 package com.smartor.mapper;
 
+import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
 import com.smartor.domain.ServiceSubtaskDetail;
 import com.smartor.domain.ServiceSubtaskDetailTarget;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -13,8 +15,7 @@
  * @date 2023-03-24
  */
 @Mapper
-public interface ServiceSubtaskDetailMapper
-{
+public interface ServiceSubtaskDetailMapper {
     /**
      * 鏌ヨ璇煶浠诲姟鍛煎彨鏄庣粏
      *
@@ -22,6 +23,10 @@
      * @return 璇煶浠诲姟鍛煎彨鏄庣粏
      */
     public ServiceSubtaskDetail selectServiceSubtaskDetailByCalldetailid(String calldetailid);
+
+    public List<ServiceSubtaskDetailDTO> queryFillCount(@Param("subids") List<Long> subids, @Param("questiontext") String questiontext);
+
+    public ServiceSubtaskDetailDTO isExistServiceSubtaskDetail(@Param("subid") Long subid, @Param("scriptid") Long scriptid);
 
     /**
      * 鏌ヨ璇煶浠诲姟鍛煎彨鏄庣粏鍒楄〃
@@ -46,6 +51,7 @@
      * @return 缁撴灉
      */
     public int updateServiceSubtaskDetail(ServiceSubtaskDetail serviceSubtaskDetail);
+
     public int updateSSDByCondition(ServiceSubtaskDetail serviceSubtaskDetail);
 
     /**
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailTraceMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailTraceMapper.java
new file mode 100644
index 0000000..56d61b1
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskDetailTraceMapper.java
@@ -0,0 +1,67 @@
+package com.smartor.mapper;
+
+import java.util.List;
+
+import com.smartor.domain.VO.DetailTraceDealVO;
+import org.apache.ibatis.annotations.Mapper;
+import com.smartor.domain.ServiceSubtaskDetailTrace;
+
+/**
+ * 闅忚浠诲姟寮傚父璁板綍璺熻釜Mapper鎺ュ彛
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+@Mapper
+public interface ServiceSubtaskDetailTraceMapper {
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param id 闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    public ServiceSubtaskDetailTrace selectServiceSubtaskDetailTtraceById(Long id);
+
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃
+     *
+     * @param ServiceSubtaskDetailTtrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 闅忚浠诲姟寮傚父璁板綍璺熻釜闆嗗悎
+     */
+    public List<ServiceSubtaskDetailTrace> selectServiceSubtaskDetailTtraceList(ServiceSubtaskDetailTrace ServiceSubtaskDetailTtrace);
+
+
+    public List<ServiceSubtaskDetailTrace> tracedeallist(DetailTraceDealVO detailTraceDealVO);
+
+    /**
+     * 鏂板闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param ServiceSubtaskDetailTtrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 缁撴灉
+     */
+    public int insertServiceSubtaskDetailTtrace(ServiceSubtaskDetailTrace ServiceSubtaskDetailTtrace);
+
+    /**
+     * 淇敼闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param ServiceSubtaskDetailTtrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 缁撴灉
+     */
+    public int updateServiceSubtaskDetailTtrace(ServiceSubtaskDetailTrace ServiceSubtaskDetailTtrace);
+
+    /**
+     * 鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param id 闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteServiceSubtaskDetailTtraceById(Long id);
+
+    /**
+     * 鎵归噺鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteServiceSubtaskDetailTtraceByIds(Long[] ids);
+}
diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
index be736ac..38234c8 100644
--- a/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -1,7 +1,9 @@
 package com.smartor.mapper;
 
 import com.smartor.domain.*;
+import com.smartor.domain.VO.PatSatisfactionReqVO;
 import com.smartor.domain.entity.ServiceSubtaskEntity;
+import com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity;
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -33,10 +35,12 @@
      */
     public List<ServiceSubtask> selectServiceSubtaskList(ServiceSubtaskEntity serviceSubtaskVO);
 
+    public List<ServiceSubtask> selectSatisfactionSubtaskList(PatSatisfactionReqVO serviceSubtaskVO);
+
     /**
      * 鐢ㄤ簬琛ュ伩鏌ヨ
      *
-     * @param ServiceSubtaskEntity
+     * @param serviceSubtaskVO
      * @return
      */
     public List<ServiceSubtask> getCompensateServiceSubtaskList(ServiceSubtaskEntity serviceSubtaskVO);
@@ -158,26 +162,28 @@
      *
      * @param serviceSubtaskVO 鏌ヨ鏉′欢
      * @return Map<String, Object> 鍖呭惈鍚勭姸鎬佺粺璁℃暟鎹�
-     *         wzx: 鏈墽琛屾暟閲�
-     *         ysf: 宸查殢璁挎暟閲�
-     *         fssb: 鍙戦�佸け璐ユ暟閲�
-     *         yfs: 宸插彂閫佹暟閲�
-     *         dsf: 寰呴殢璁挎暟閲�
-     *         blq: 涓嶇悊鐫暟閲�
-     *         yc: 寮傚父鏁伴噺
+     * wzx: 鏈墽琛屾暟閲�
+     * ysf: 宸查殢璁挎暟閲�
+     * fssb: 鍙戦�佸け璐ユ暟閲�
+     * yfs: 宸插彂閫佹暟閲�
+     * dsf: 寰呴殢璁挎暟閲�
+     * blq: 涓嶇悊鐫暟閲�
+     * yc: 寮傚父鏁伴噺
      */
     public Map<String, Object> countByCondition(ServiceSubtaskEntity serviceSubtaskVO);
 
     /**
      * 缁熻浠诲姟鍚勭鐘舵�佺殑鏁伴噺锛堜紭鍖栫増锛�
+     *
      * @param serviceSubtaskVO 鏌ヨ鏉′欢
      * @return Map<String, Object> 鍖呭惈鍚勭姸鎬佺粺璁℃暟鎹�
-     *         pendingVisitCount: 褰撳墠鐧诲綍浜烘埅姝粖鏃ュ緟闅忚鎬婚噺
-     *         failedVisitCount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔″け璐ユ�婚噺
-     *         abnormalVisitVount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔″紓甯告�婚噺
-     *         allVisitCount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔℃�婚噺
+     * pendingVisitCount: 褰撳墠鐧诲綍浜烘埅姝粖鏃ュ緟闅忚鎬婚噺
+     * failedVisitCount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔″け璐ユ�婚噺
+     * abnormalVisitVount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔″紓甯告�婚噺
+     * allVisitCount: 褰撳墠鐧诲綍浜洪殢璁夸换鍔℃�婚噺
      */
     public Map<String, Object> getCurrentUserServiceSubtaskCount(ServiceSubtaskEntity serviceSubtaskVO);
+
     /**
      * 鑾峰彇闂ㄨ瘖闅忚浜烘暟
      *
@@ -186,4 +192,6 @@
      */
     PatMedRes selectVisitCount(PatMedReq patMedReq);
 
+    List<Long> querySendCount(ServiceSubtaskSatisfactionEntity serviceSubtaskSatisfactionEntity);
+
 }
diff --git a/smartor/src/main/java/com/smartor/mapper/SvyLibTemplateScriptMapper.java b/smartor/src/main/java/com/smartor/mapper/SvyLibTemplateScriptMapper.java
index 461dc15..332f248 100644
--- a/smartor/src/main/java/com/smartor/mapper/SvyLibTemplateScriptMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/SvyLibTemplateScriptMapper.java
@@ -1,7 +1,9 @@
 package com.smartor.mapper;
 
+import com.smartor.domain.IvrLibaTemplateScript;
 import com.smartor.domain.SvyLibTemplateScript;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -60,4 +62,9 @@
      * @return 缁撴灉
      */
     public int deleteSvyLibTemplateScriptByTopicids(Long[] topicids);
+
+
+    public List<SvyLibTemplateScript> querySvyLibTemplateIds(@Param("scriptCategoryids") List<Long> scriptCategoryids);
+
+
 }
diff --git a/smartor/src/main/java/com/smartor/service/IPatSatisfactionService.java b/smartor/src/main/java/com/smartor/service/IPatSatisfactionService.java
index cced720..97a8c1a 100644
--- a/smartor/src/main/java/com/smartor/service/IPatSatisfactionService.java
+++ b/smartor/src/main/java/com/smartor/service/IPatSatisfactionService.java
@@ -1,19 +1,23 @@
 package com.smartor.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.smartor.domain.PatSatisfaction;
+import com.smartor.domain.VO.PatSatisfactionReqVO;
+import com.smartor.domain.VO.PatSatisfactionResVO;
 
 /**
  * 鎮h�呮弧鎰忓害Service鎺ュ彛
- * 
+ *
  * @author lihu
  * @date 2025-06-30
  */
-public interface IPatSatisfactionService 
+public interface IPatSatisfactionService
 {
     /**
      * 鏌ヨ鎮h�呮弧鎰忓害
-     * 
+     *
      * @param id 鎮h�呮弧鎰忓害涓婚敭
      * @return 鎮h�呮弧鎰忓害
      */
@@ -21,7 +25,7 @@
 
     /**
      * 鏌ヨ鎮h�呮弧鎰忓害鍒楄〃
-     * 
+     *
      * @param patSatisfaction 鎮h�呮弧鎰忓害
      * @return 鎮h�呮弧鎰忓害闆嗗悎
      */
@@ -29,7 +33,7 @@
 
     /**
      * 鏂板鎮h�呮弧鎰忓害
-     * 
+     *
      * @param patSatisfaction 鎮h�呮弧鎰忓害
      * @return 缁撴灉
      */
@@ -37,7 +41,7 @@
 
     /**
      * 淇敼鎮h�呮弧鎰忓害
-     * 
+     *
      * @param patSatisfaction 鎮h�呮弧鎰忓害
      * @return 缁撴灉
      */
@@ -45,7 +49,7 @@
 
     /**
      * 鎵归噺鍒犻櫎鎮h�呮弧鎰忓害
-     * 
+     *
      * @param ids 闇�瑕佸垹闄ょ殑鎮h�呮弧鎰忓害涓婚敭闆嗗悎
      * @return 缁撴灉
      */
@@ -53,9 +57,26 @@
 
     /**
      * 鍒犻櫎鎮h�呮弧鎰忓害淇℃伅
-     * 
+     *
      * @param id 鎮h�呮弧鎰忓害涓婚敭
      * @return 缁撴灉
      */
     public int deletePatSatisfactionById(Long id);
+
+    /**
+     * 鎮h�呮弧鎰忓害缁熻
+     *
+     * @param patSatisfactionReqVO 鎮h�呮弧鎰忓害缁熻鏉′欢
+     * @return 鎮h�呮弧鎰忓害缁熻缁撴灉
+     */
+    public PatSatisfactionResVO statistics( PatSatisfactionReqVO patSatisfactionReqVO);
+
+
+    /**
+     * 鎮h�呮弧鎰忓害鏌辩姸鍥句俊鎭�
+     *
+     * @param patSatisfactionReqVO 鎮h�呮弧鎰忓害鏌辩姸鍥句俊鎭�
+     * @return 鎮h�呮弧鎰忓害鏌辩姸鍥句俊鎭�
+     */
+    public Map<String, Object> satisfactionGraph(PatSatisfactionReqVO patSatisfactionReqVO);
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java
index 5a3dfa9..d3ba0c8 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java
@@ -70,6 +70,8 @@
      */
     public Integer saveQuestionAnswer(ServiceSubTaskAnswerReq serviceSubTaskAnswerReq,Long flag);
 
+    public Integer saveQuestionDetail(ServiceSubTaskCacheReq serviceSubTaskCacheReq,Long flag);
+
     public Boolean saveMYDQuestionAnswer(ServiceSubTaskMYDAnswerReq serviceSubTaskMYDAnswerReq);
 
     /**
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskDetailTraceService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskDetailTraceService.java
new file mode 100644
index 0000000..9e76f15
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskDetailTraceService.java
@@ -0,0 +1,81 @@
+package com.smartor.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.smartor.domain.DTO.DetailTraceDealDTO;
+import com.smartor.domain.ServiceSubtaskDetailTrace;
+import com.smartor.domain.VO.DetailTraceDealVO;
+import com.smartor.domain.VO.SatisfactionExceptConfigQuestionReqVO;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * 闅忚浠诲姟寮傚父璁板綍璺熻釜Service鎺ュ彛
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+public interface IServiceSubtaskDetailTraceService
+{
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param id 闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    public ServiceSubtaskDetailTrace selectServiceSubtaskDetailTtraceById(Long id);
+
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃
+     *
+     * @param serviceSubtaskDetailTtrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 闅忚浠诲姟寮傚父璁板綍璺熻釜闆嗗悎
+     */
+    public List<ServiceSubtaskDetailTrace> selectServiceSubtaskDetailTtraceList(ServiceSubtaskDetailTrace serviceSubtaskDetailTtrace);
+
+    /**
+     * 寮傚父闂澶勭悊鎯呭喌鏌ヨ
+     * @param detailTraceDealVO
+     * @return
+     */
+    public List<DetailTraceDealDTO> tracedeallist(DetailTraceDealVO detailTraceDealVO);
+
+    /**
+     * 鏂板闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param serviceSubtaskDetailTtrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 缁撴灉
+     */
+    public int insertServiceSubtaskDetailTtrace(ServiceSubtaskDetailTrace serviceSubtaskDetailTtrace);
+
+    /**
+     * 淇敼闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param serviceSubtaskDetailTtrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 缁撴灉
+     */
+    public int updateServiceSubtaskDetailTtrace(ServiceSubtaskDetailTrace serviceSubtaskDetailTtrace);
+
+    /**
+     * 鎵归噺鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteServiceSubtaskDetailTtraceByIds(Long[] ids);
+
+    /**
+     * 鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜淇℃伅
+     *
+     * @param id 闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteServiceSubtaskDetailTtraceById(Long id);
+
+    /**
+     * 鑾峰彇婊℃剰搴﹀紓甯搁厤缃鐩�
+     * @param questionReqVO
+     * @return
+     */
+    public Map<String, Object> getSatisfactionExceptConfigQuestion(SatisfactionExceptConfigQuestionReqVO questionReqVO);
+}
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptAssortServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptAssortServiceImpl.java
index d5fe7c8..a527db5 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptAssortServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptAssortServiceImpl.java
@@ -3,6 +3,7 @@
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DtoConversionUtils;
+import com.smartor.common.PinYinUtil;
 import com.smartor.domain.*;
 import com.smartor.mapper.IvrLibaScriptAssortMapper;
 import com.smartor.service.IIvrLibaScriptAssortService;
@@ -88,6 +89,9 @@
         } else {
             ivrLibaScriptAssort.setSeqno(seqMax + 1);
         }
+        if (ivrLibaScriptAssort.getIndexAssortName() != null && ivrLibaScriptAssort.getIndexAssortName().contains("婊℃剰搴�") && ivrLibaScriptAssort.getPid() != -1) {
+            ivrLibaScriptAssort.setType(PinYinUtil.getpy(ivrLibaScriptAssort.getIndexAssortName()));
+        }
         i = ivrLibaScriptAssortMapper.insertIvrLibaScriptAssort(ivrLibaScriptAssort);
         log.info("闂璇濇湳鍒嗙被搴撲竴绾ф爲鐨勪富閿�:{}", ivrLibaScriptAssort.getId());
 
@@ -125,6 +129,9 @@
     @Override
     public int updateIvrLibaScriptAssort(IvrLibaScriptAssort ivrLibaScriptAssort) {
         ivrLibaScriptAssort.setUpdateTime(DateUtils.getNowDate());
+        if (ivrLibaScriptAssort.getIndexAssortName() != null && ivrLibaScriptAssort.getIndexAssortName().contains("婊℃剰搴�") && ivrLibaScriptAssort.getPid() != -1) {
+            ivrLibaScriptAssort.setType(PinYinUtil.getpy(ivrLibaScriptAssort.getIndexAssortName()));
+        }
         return ivrLibaScriptAssortMapper.updateIvrLibaScriptAssort(ivrLibaScriptAssort);
     }
 
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
index 29dbaf2..2f125f3 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
@@ -218,11 +218,6 @@
         log.info("ivrTaskTemplates鐨勬煡璇㈢粨鏋滀负:{},鏁伴噺涓� : {}", ivrTaskTemplates.get(0), ivrTaskTemplates.size());
         //瀹氫箟IvrLibaTemplateVO 鐢ㄤ簬杩斿弬
         IvrTaskTemplateVO templateVO = DtoConversionUtils.sourceToTarget(ivrTaskTemplates.get(0), IvrTaskTemplateVO.class);
-//
-//        //鑾峰彇tag淇℃伅
-//        IvrLibaTemplateTag ivrLibaTemplateTag = new IvrLibaTemplateTag();
-//        ivrLibaTemplateTag.setTemplateid(ivrTaskTemplates.get(0).getID());
-//        List<IvrLibaTemplateTag> ivrLibaTemplateTags = ivrLibaTemplateTagMapper.selectIvrLibaTemplateTagList(ivrLibaTemplateTag);
 
         //鏌ヨ璇濇湳
         IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
@@ -257,7 +252,7 @@
             }
             ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions);
         }
-        Collections.sort(ivrTaskTemplateScriptVOS, Comparator.comparing(IvrTaskTemplateScriptVO::getTargetid));
+        Collections.sort(ivrTaskTemplateScriptVOS, Comparator.comparing(IvrTaskTemplateScriptVO::getSort));
         //鏁版嵁缁勮
 //        templateVO.setIvrTaskTemplateTagList(ivrLibaTemplateTags);
         templateVO.setIvrTaskTemplateScriptVOList(ivrTaskTemplateScriptVOS);
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 918caac..46c43db 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java
@@ -1,13 +1,23 @@
 package com.smartor.service.impl;
 
-import java.util.List;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.stream.Collectors;
 
+import com.ruoyi.common.utils.Arith;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.DtoConversionUtils;
+import com.smartor.domain.*;
+import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
+import com.smartor.domain.VO.PatSatisfactionReqVO;
+import com.smartor.domain.VO.PatSatisfactionResVO;
+import com.smartor.domain.entity.PatSatisfactionDetailEntity;
+import com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity;
+import com.smartor.mapper.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.smartor.mapper.PatSatisfactionMapper;
-import com.smartor.domain.PatSatisfaction;
 import com.smartor.service.IPatSatisfactionService;
 
 /**
@@ -20,6 +30,30 @@
 public class PatSatisfactionServiceImpl implements IPatSatisfactionService {
     @Autowired
     private PatSatisfactionMapper patSatisfactionMapper;
+
+    @Autowired
+    private ServiceSubtaskMapper serviceSubtaskMapper;
+
+    @Autowired
+    private ServiceSubtaskDetailMapper serviceSubtaskDetailMapper;
+
+    @Autowired
+    private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper;
+
+    @Autowired
+    private IvrLibaScriptAssortMapper ivrLibaScriptAssortMapper;
+
+    @Autowired
+    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
+
+    @Autowired
+    private IvrLibaTemplateTargetoptionMapper ivrLibaTemplateTargetoptionMapper;
+
+    @Autowired
+    private SvyLibTemplateTargetoptionMapper svyLibTemplateTargetoptionMapper;
+
+    @Autowired
+    private SvyLibTemplateScriptMapper svyLibTemplateScriptMapper;
 
     /**
      * 鏌ヨ鎮h�呮弧鎰忓害
@@ -99,4 +133,355 @@
     public int deletePatSatisfactionById(Long id) {
         return patSatisfactionMapper.deletePatSatisfactionById(id);
     }
+
+    /**
+     * 鎮h�呮弧鎰忓害缁熻
+     *
+     * @param patSatisfactionReqVO 鎮h�呮弧鎰忓害缁熻鏉′欢
+     * @return 鎮h�呮弧鎰忓害缁熻缁撴灉
+     */
+    @Override
+    public PatSatisfactionResVO statistics(PatSatisfactionReqVO patSatisfactionReqVO) {
+        //瀹氫箟杩斿弬
+        PatSatisfactionResVO result = new PatSatisfactionResVO();
+        //绛旈鎬讳汉鏁�(宸茬粡鍥炵瓟闂鐨�)
+        int totalPerson = 0;
+        // 鎬讳汉鏁帮紙鍖呭惈鏈洖绛旂殑锛�
+        int allPerson = 0;
+        //鎮h�呮弧鎰忓害缁熻鎯�
+        List<PatSatisfactionDetailEntity> patSatisfactionDetailEntities = new ArrayList<>();
+
+        List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectSatisfactionSubtaskList(patSatisfactionReqVO);
+        // 鎸塼ype鍒嗙粍锛�1-璇煶锛�2-闂嵎
+        Map<String, List<ServiceSubtask>> groupByType = serviceSubtasks.stream().filter(s -> s.getType() != null).collect(Collectors.groupingBy(ServiceSubtask::getType));
+        List<ServiceSubtask> voiceList = groupByType.getOrDefault("1", Collections.emptyList());
+        List<ServiceSubtask> questionnaireList = groupByType.getOrDefault("2", Collections.emptyList());
+
+        if (CollectionUtils.isNotEmpty(voiceList)) {
+            //1. 鍏堣幏鍙杋vr_liba_script_assort鐨勬弧鎰忓害鍒嗙被ID
+            IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort();
+            ivrLibaScriptAssort.setOrgid(patSatisfactionReqVO.getOrgid());
+            List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort);
+
+            List<Long> mydIdList = ivrLibaScriptAssorts.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(IvrLibaScriptAssort::getId).collect(Collectors.toList());
+
+            //2 鍐嶈幏鍙栬闂婊℃剰搴﹀垎绫讳笅鐨処vrLibaTemplateScript鐨勯泦鍚�
+            List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.queryLibTemplateIds(mydIdList);
+
+            //3 鍐嶉�氳繃鍗曚釜ivr_liba_template鑾峰彇鍒版墍鏈夌殑婊℃剰搴﹂棶棰� 鍜� 浣跨敤璇ユā鏉跨殑subTask浜烘暟
+            for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScripts) {
+                //璁板綍鍗曚釜鏄庣粏淇℃伅
+                PatSatisfactionDetailEntity patSatisfactionDetailEntity = new PatSatisfactionDetailEntity();
+
+                //閫氳繃闂ID锛岃幏鍙栭棶棰橀�夐」(涓轰簡鑾峰彇閫夐」涓婄殑鏈�楂樺垎鏈�浣庡垎)
+                IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption();
+                ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScript.getScriptid());
+                List<IvrLibaTemplateTargetoption> ivrLibaTemplateTargetoptions = ivrLibaTemplateTargetoptionMapper.selectIvrLibaTemplateTargetoptionList(ivrLibaTemplateTargetoption);
+
+                //鑾峰彇libTemplateId
+                List<Long> libTemplateIds = new ArrayList<>();
+                libTemplateIds.add(ivrLibaTemplateScript.getTemplateid());
+
+                // 鍐嶉�氳繃妯℃澘id鑾峰彇闂鍙戦�佹�婚噺
+                ServiceSubtaskSatisfactionEntity serviceSubtaskSatisfactionEntity = DtoConversionUtils.sourceToTarget(patSatisfactionReqVO, ServiceSubtaskSatisfactionEntity.class);
+                serviceSubtaskSatisfactionEntity.setLibTemplateIds(libTemplateIds);
+                serviceSubtaskSatisfactionEntity.setType(1);
+                List<Long> subids = serviceSubtaskMapper.querySendCount(serviceSubtaskSatisfactionEntity);
+
+                //鑾峰彇濉姤鏁伴噺
+                List<ServiceSubtaskDetailDTO> fillCount = null;
+                if (CollectionUtils.isNotEmpty(subids))
+                    fillCount = serviceSubtaskDetailMapper.queryFillCount(subids, ivrLibaTemplateScript.getScriptContent());
+
+                // 鏍规嵁matchedtext鍒嗙粍锛岀粺璁″悇閫夐」鏁伴噺鍙婂崰姣�
+                Map<String, Map<String, Object>> matchedtextStats = new HashMap<>();
+                if (CollectionUtils.isNotEmpty(fillCount)) {
+                    int totalFill = fillCount.size();
+                    fillCount.stream().filter(dto -> dto.getMatchedtext() != null).collect(Collectors.groupingBy(ServiceSubtaskDetailDTO::getMatchedtext, Collectors.counting())).forEach((matchedtext, count) -> {
+                        Map<String, Object> stat = new HashMap<>();
+                        stat.put("count", count);
+                        stat.put("ratio", new BigDecimal((double) count / totalFill * 100).setScale(1, RoundingMode.HALF_UP).doubleValue());
+                        matchedtextStats.put(matchedtext, stat);
+                    });
+                    // 浠巉illCount涓彇targetvalue锛�&鍒嗛殧鐨勫綋鍓嶉棶棰樼殑鎵�鏈夐�夐」锛夛紝琛ュ叏鏈嚭鐜扮殑閫夐」锛宑ount鍜宺atio鍧囦负0
+                    fillCount.stream().filter(dto -> dto.getTargetvalue() != null).findFirst().ifPresent(dto -> {
+                        for (String option : dto.getTargetvalue().split("&")) {
+                            String optionTrim = option.trim();
+                            if (!matchedtextStats.containsKey(optionTrim)) {
+                                Map<String, Object> emptyStat = new HashMap<>();
+                                emptyStat.put("count", 0L);
+                                emptyStat.put("ratio", 0.0);
+                                matchedtextStats.put(optionTrim, emptyStat);
+                            }
+                        }
+                    });
+                }
+
+                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.setAnswerRate(CollectionUtils.isEmpty(subids) ? 0 : CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size() * 1.0 / subids.size());
+                patSatisfactionDetailEntity.setMatchedtextStats(matchedtextStats);
+                patSatisfactionDetailEntities.add(patSatisfactionDetailEntity);
+
+                totalPerson += CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size();
+                allPerson += subids.size();
+            }
+        }
+
+        if (CollectionUtils.isNotEmpty(questionnaireList)) {
+            //1. 鍏堣幏鍙杝vy_lib_script_category鐨勬弧鎰忓害鍒嗙被ID
+            SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory();
+            svyLibScriptCategory.setOrgid(patSatisfactionReqVO.getOrgid());
+            List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory);
+            List<Long> mydIdList = svyLibScriptCategories.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SvyLibScriptCategory::getId).collect(Collectors.toList());
+
+            //2 鍐嶈幏鍙栬闂婊℃剰搴﹀垎绫讳笅鐨処vrLibaTemplateScript鐨勯泦鍚�
+            List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.querySvyLibTemplateIds(mydIdList);
+
+            for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScripts) {
+                //璁板綍鍗曚釜鏄庣粏淇℃伅
+                PatSatisfactionDetailEntity patSatisfactionDetailEntity = new PatSatisfactionDetailEntity();
+
+                //閫氳繃闂ID锛岃幏鍙栭棶棰橀�夐」(涓轰簡鑾峰彇閫夐」涓婄殑鏈�楂樺垎鏈�浣庡垎)
+                SvyLibTemplateTargetoption svyLibTemplateTargetoption = new SvyLibTemplateTargetoption();
+                svyLibTemplateTargetoption.setScriptid(svyLibTemplateScript.getId());
+                List<SvyLibTemplateTargetoption> svyLibTemplateTargetoptions = svyLibTemplateTargetoptionMapper.selectSvyLibTemplateTargetoptionList(svyLibTemplateTargetoption);
+
+                //鑾峰彇libTemplateId
+                List<Long> libTemplateIds = new ArrayList<>();
+                libTemplateIds.add(svyLibTemplateScript.getSvyid());
+
+                // 鍐嶉�氳繃妯℃澘id鑾峰彇闂鍙戦�佹�婚噺
+                ServiceSubtaskSatisfactionEntity serviceSubtaskSatisfactionEntity = DtoConversionUtils.sourceToTarget(patSatisfactionReqVO, ServiceSubtaskSatisfactionEntity.class);
+                serviceSubtaskSatisfactionEntity.setLibTemplateIds(libTemplateIds);
+                serviceSubtaskSatisfactionEntity.setType(2);
+                List<Long> subids = serviceSubtaskMapper.querySendCount(serviceSubtaskSatisfactionEntity);
+
+                //鑾峰彇濉姤鏁伴噺
+                List<ServiceSubtaskDetailDTO> fillCount = null;
+                if (CollectionUtils.isNotEmpty(subids))
+                    fillCount = serviceSubtaskDetailMapper.queryFillCount(subids, svyLibTemplateScript.getScriptContent());
+
+                // 鏍规嵁matchedtext鍒嗙粍锛岀粺璁″悇閫夐」鏁伴噺鍙婂崰姣�
+                Map<String, Map<String, Object>> matchedtextStats = new HashMap<>();
+                if (CollectionUtils.isNotEmpty(fillCount)) {
+                    int totalFill = fillCount.size();
+                    fillCount.stream().filter(dto -> dto.getMatchedtext() != null).collect(Collectors.groupingBy(ServiceSubtaskDetailDTO::getMatchedtext, Collectors.counting())).forEach((matchedtext, count) -> {
+                        Map<String, Object> stat = new HashMap<>();
+                        stat.put("count", count);
+                        stat.put("ratio", new BigDecimal((double) count / totalFill * 100).setScale(1, RoundingMode.HALF_UP).doubleValue());
+                        matchedtextStats.put(matchedtext, stat);
+                    });
+                    // 浠巉illCount涓彇targetvalue锛�&鍒嗛殧鐨勫綋鍓嶉棶棰樼殑鎵�鏈夐�夐」锛夛紝琛ュ叏鏈嚭鐜扮殑閫夐」锛宑ount鍜宺atio鍧囦负0
+                    fillCount.stream().filter(dto -> dto.getTargetvalue() != null).findFirst().ifPresent(dto -> {
+                        for (String option : dto.getTargetvalue().split("&")) {
+                            String optionTrim = option.trim();
+                            if (!matchedtextStats.containsKey(optionTrim)) {
+                                Map<String, Object> emptyStat = new HashMap<>();
+                                emptyStat.put("count", 0L);
+                                emptyStat.put("ratio", 0.0);
+                                matchedtextStats.put(optionTrim, emptyStat);
+                            }
+                        }
+                    });
+                }
+                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.setAnswerRate(CollectionUtils.isEmpty(subids) ? 0 : CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size() * 1.0 / subids.size());
+                patSatisfactionDetailEntity.setMatchedtextStats(matchedtextStats);
+                patSatisfactionDetailEntities.add(patSatisfactionDetailEntity);
+
+                totalPerson += CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size();
+                allPerson += subids.size();
+            }
+        }
+        result.setTotalAnswerRate(Arith.div(totalPerson, allPerson));
+        result.setPatSatisfactionDetailEntities(patSatisfactionDetailEntities);
+        result.setTotalPerson(totalPerson);
+
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> satisfactionGraph(PatSatisfactionReqVO patSatisfactionReqVO) {
+        //鐢ㄦ潵璁板綍鏌辩姸鍥句俊鎭紙key=婊℃剰搴﹀垎绫诲悕绉帮紝value=婊℃剰搴﹀垎绫讳笅鐨勬�讳汉鏁板拰濉姤浜烘暟锛�
+        Map<String, Object> zzt = new HashMap<>();
+
+        // 璁板綍涓�涓嬫瘡绉嶅垎绫荤殑濉姤鎯呭喌
+        Map<String, List<ServiceSubtaskDetailDTO>> assortNameFillCountMap = new HashMap<>();
+
+        if (patSatisfactionReqVO.getType() == null || patSatisfactionReqVO.getType() == 1) {
+            //1. 鍏堣幏鍙杋vr_liba_script_assort鐨勬弧鎰忓害鍒嗙被ID
+            IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort();
+            ivrLibaScriptAssort.setOrgid(patSatisfactionReqVO.getOrgid());
+            List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort);
+            List<Long> mydIdList = ivrLibaScriptAssorts.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(IvrLibaScriptAssort::getId).collect(Collectors.toList());
+
+            //2 鍐嶈幏鍙栬闂婊℃剰搴﹀垎绫讳笅鐨処vrLibaTemplateScript鐨勯泦鍚�
+            List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.queryLibTemplateIds(mydIdList);
+
+
+            //3 鎸塻criptAssortname鍒嗙粍,骞惰幏鍙栨瘡涓泦鍚堣繘琛岄亶鍘嗭紝璁$畻姣忎釜鍒嗙被鐨勬�讳汉鏁板拰濉姤浜烘暟
+            Map<String, List<IvrLibaTemplateScript>> scriptGroupByAssortName = ivrLibaTemplateScripts.stream().filter(item -> item.getScriptAssortname() != null).collect(Collectors.groupingBy(IvrLibaTemplateScript::getScriptAssortname));
+            if (scriptGroupByAssortName != null && !scriptGroupByAssortName.isEmpty()) {
+                for (String assortNameKey : scriptGroupByAssortName.keySet()) {
+                    //璁板綍鎬讳汉鏁�
+                    Double subidAll = 0.0;
+                    //璁板綍鎬荤殑濉姤浜烘暟
+                    Double fillCountAll = 0.0;
+                    //鑾峰彇璇ュ垎绫荤殑濉姤鎬绘暟閲�
+                    List<ServiceSubtaskDetailDTO> allFillCountList = new ArrayList<>();
+
+                    List<IvrLibaTemplateScript> ivrLibaTemplateScriptList = scriptGroupByAssortName.get(assortNameKey);
+                    for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScriptList) {
+                        //鑾峰彇libTemplateId
+                        List<Long> libTemplateIds = new ArrayList<>();
+                        libTemplateIds.add(ivrLibaTemplateScript.getTemplateid());
+                        // 鍐嶉�氳繃妯℃澘id鑾峰彇闂鍙戦�佹�婚噺
+                        ServiceSubtaskSatisfactionEntity serviceSubtaskSatisfactionEntity = DtoConversionUtils.sourceToTarget(patSatisfactionReqVO, ServiceSubtaskSatisfactionEntity.class);
+                        serviceSubtaskSatisfactionEntity.setLibTemplateIds(libTemplateIds);
+                        serviceSubtaskSatisfactionEntity.setType(1);
+                        List<Long> subids = serviceSubtaskMapper.querySendCount(serviceSubtaskSatisfactionEntity);
+
+                        //鑾峰彇濉姤鏁伴噺
+                        List<ServiceSubtaskDetailDTO> fillCount = null;
+                        if (CollectionUtils.isNotEmpty(subids)) {
+                            fillCount = serviceSubtaskDetailMapper.queryFillCount(subids, ivrLibaTemplateScript.getScriptContent());
+                            if (CollectionUtils.isNotEmpty(fillCount)) allFillCountList.addAll(fillCount);
+                        }
+                        subidAll += subids.size();
+                        fillCountAll += CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size();
+                    }
+
+                    // 杩欓噷鍏堣褰曚竴涓嬫瘡涓垎绫荤殑鎬讳汉鏁板拰濉姤浜烘暟
+                    Map<String, Object> personCount = new HashMap<>();
+                    personCount.put("fillCountAll", fillCountAll);
+                    personCount.put("subidAll", subidAll);
+                    personCount.put("receiveRate", Arith.div(fillCountAll, subidAll));
+                    personCount.put("averageScore", averageScore(allFillCountList));
+                    zzt.put(assortNameKey, personCount);
+                    assortNameFillCountMap.put(assortNameKey, allFillCountList);
+                }
+            }
+        }
+
+        if (patSatisfactionReqVO.getType() == null || patSatisfactionReqVO.getType() == 2) {
+            //1. 鍏堣幏鍙杝vy_lib_script_category鐨勬弧鎰忓害鍒嗙被ID
+            SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory();
+            svyLibScriptCategory.setOrgid(patSatisfactionReqVO.getOrgid());
+            List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory);
+            List<Long> mydIdList = svyLibScriptCategories.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SvyLibScriptCategory::getId).collect(Collectors.toList());
+
+            //2 鍐嶈幏鍙栬闂婊℃剰搴﹀垎绫讳笅鐨処vrLibaTemplateScript鐨勯泦鍚�
+            List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.querySvyLibTemplateIds(mydIdList);
+
+            //3 鎸塻criptAssortname鍒嗙粍,骞惰幏鍙栨瘡涓泦鍚堣繘琛岄亶鍘嗭紝璁$畻姣忎釜鍒嗙被鐨勬�讳汉鏁板拰濉姤浜烘暟
+            Map<String, List<SvyLibTemplateScript>> scriptGroupByatCegoryName = svyLibTemplateScripts.stream().filter(item -> item.getCategoryName() != null).collect(Collectors.groupingBy(SvyLibTemplateScript::getCategoryName));
+            if (scriptGroupByatCegoryName != null && !scriptGroupByatCegoryName.isEmpty()) {
+                for (String categoryNameKey : scriptGroupByatCegoryName.keySet()) {
+                    //璁板綍鎬讳汉鏁�
+                    Double subidAll = 0.0;
+                    //璁板綍鎬荤殑濉姤浜烘暟
+                    Double fillCountAll = 0.0;
+                    //鑾峰彇璇ュ垎绫荤殑濉姤鎬绘暟閲�
+                    List<ServiceSubtaskDetailDTO> allFillCountList = new ArrayList<>();
+
+                    List<SvyLibTemplateScript> svyLibTemplateScriptList = scriptGroupByatCegoryName.get(categoryNameKey);
+                    for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScriptList) {
+                        //鑾峰彇libTemplateId
+                        List<Long> libTemplateIds = new ArrayList<>();
+                        libTemplateIds.add(svyLibTemplateScript.getSvyid());
+                        // 鍐嶉�氳繃妯℃澘id鑾峰彇闂鍙戦�佹�婚噺
+                        ServiceSubtaskSatisfactionEntity serviceSubtaskSatisfactionEntity = DtoConversionUtils.sourceToTarget(patSatisfactionReqVO, ServiceSubtaskSatisfactionEntity.class);
+                        serviceSubtaskSatisfactionEntity.setLibTemplateIds(libTemplateIds);
+                        serviceSubtaskSatisfactionEntity.setType(2);
+                        List<Long> subids = serviceSubtaskMapper.querySendCount(serviceSubtaskSatisfactionEntity);
+
+                        //鑾峰彇濉姤鏁伴噺
+                        List<ServiceSubtaskDetailDTO> fillCount = null;
+                        if (CollectionUtils.isNotEmpty(subids)) {
+                            fillCount = serviceSubtaskDetailMapper.queryFillCount(subids, svyLibTemplateScript.getScriptContent());
+                            if (CollectionUtils.isNotEmpty(fillCount)) allFillCountList.addAll(fillCount);
+                        }
+                        subidAll += subids.size();
+                        fillCountAll += CollectionUtils.isEmpty(fillCount) ? 0 : fillCount.size();
+                    }
+
+
+                    // 杩欓噷鍏堣褰曚竴涓嬫瘡涓垎绫荤殑鎬讳汉鏁板拰濉姤浜烘暟
+                    Map<String, Object> personCount = (Map<String, Object>) zzt.get(categoryNameKey);
+                    if (!Objects.isNull(personCount)) {
+                        Double fillCountAll2 = (Double) personCount.get("fillCountAll");
+                        Double subidAll2 = (Double) personCount.get("subidAll");
+                        personCount.put("fillCountAll", fillCountAll2 + fillCountAll);
+                        personCount.put("subidAll", subidAll2 + subidAll);
+                        personCount.put("receiveRate", Arith.div((Double) personCount.get("fillCountAll"), (Double) personCount.get("subidAll")));
+
+                        //鐪嬩竴涓嬩箣鍓嶆湁娌℃湁璇ュ垎绫荤殑濉姤閲�
+                        List<ServiceSubtaskDetailDTO> serviceSubtaskDetailDTOS = assortNameFillCountMap.get(categoryNameKey);
+                        if (CollectionUtils.isNotEmpty(serviceSubtaskDetailDTOS))
+                            allFillCountList.addAll(serviceSubtaskDetailDTOS);
+                        personCount.put("averageScore", averageScore(allFillCountList));
+                    } else {
+                        personCount = new HashMap<>();
+                        personCount.put("fillCountAll", fillCountAll);
+                        personCount.put("subidAll", subidAll);
+                        personCount.put("receiveRate", Arith.div(fillCountAll, subidAll));
+                        personCount.put("averageScore", averageScore(allFillCountList));
+                        zzt.put(categoryNameKey, personCount);
+                    }
+                }
+            }
+        }
+        return zzt;
+    }
+
+    /**
+     * 鑾峰彇鏈�楂樺垎
+     *
+     * @param options
+     * @return
+     */
+    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;
+    }
+
+    /**
+     * 鑾峰彇鏈�浣庡垎
+     *
+     * @param options
+     * @return
+     */
+    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;
+    }
+
+    /**
+     * 鑾峰彇骞冲潎鍒�
+     *
+     * @param fillCount
+     * @return
+     */
+    private Double averageScore(List<ServiceSubtaskDetailDTO> fillCount) {
+        if (CollectionUtils.isEmpty(fillCount)) return 0.0;
+        double sum = fillCount.stream().filter(dto -> dto.getScore() != null && !dto.getScore().isEmpty()).mapToDouble(dto -> Double.parseDouble(dto.getScore())).sum();
+        return new BigDecimal(sum / fillCount.size()).setScale(1, RoundingMode.HALF_UP).doubleValue();
+    }
 }
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 e050f00..0fd2033 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -9,10 +9,13 @@
 import com.ruoyi.common.utils.RSAPublicKeyExample;
 import com.ruoyi.common.utils.StringUtils;
 import com.smartor.domain.*;
+import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import com.smartor.mapper.*;
 import com.smartor.service.IServiceSubtaskAnswerService;
+import com.smartor.service.IServiceSubtaskDetailTraceService;
 import com.smartor.service.IServiceTaskService;
+import com.sun.org.apache.bcel.internal.generic.NEW;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
@@ -23,6 +26,7 @@
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 /**
  * 浠诲姟闂嵎闂閫夐」Service涓氬姟灞傚鐞�
@@ -49,6 +53,12 @@
     private ServiceSubtaskDetailMapper serviceSubtaskDetailMapper;
 
     @Autowired
+    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
+
+    @Autowired
+    private IvrLibaScriptAssortMapper ivrLibaScriptAssortMapper;
+
+    @Autowired
     private IServiceTaskService serviceTaskService;
 
     @Autowired
@@ -60,6 +70,9 @@
 
     @Autowired
     private PatMedOuthospMapper patMedOuthospMapper;
+
+    @Autowired
+    private IServiceSubtaskDetailTraceService traceService;
 
     @Value("${pri_key}")
     private String pri_key;
@@ -185,9 +198,7 @@
                         for (SvyTaskTemplateScriptVO svyTaskTemplateScriptVO : cacheList) {
                             if (svyTaskTemplateScriptVO.getSort() == 1L) {
                                 //璇存槑鏄涓�棰�
-//                                SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = DtoConversionUtils.sourceToTarget(cacheList.get(0), SvyTaskTemplateScriptVO.class);
                                 List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(0).getSvyTaskTemplateTargetoptions();
-//                                List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = DtoConversionUtils.sourceToTarget(svyTaskTemplateTargetoptions, SvyTaskTemplateTargetoption.class);
                                 svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions);
                                 Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, tid, pid);
                                 if (map == null) continue aa;
@@ -307,6 +318,141 @@
         }
         return 1;
     }
+
+    @Override
+    public Integer saveQuestionDetail(ServiceSubTaskCacheReq serviceSubTaskCacheReq, Long flag) {
+        Long tid = Long.valueOf(serviceSubTaskCacheReq.getParam1());
+        Long pid = Long.valueOf(serviceSubTaskCacheReq.getParam2());
+        Double score = null;
+        if (ObjectUtils.isNotEmpty(serviceSubTaskCacheReq)) {
+            Long nextScriptno = null;
+            String isabnormalFlag = "0";
+            if (serviceSubTaskCacheReq.getType() == 2) {
+                List<SvyTaskTemplateScriptVO> cacheList = serviceSubTaskCacheReq.getSvyTaskTemplateScriptVOS();
+                cacheList.sort(Comparator.comparingLong(SvyTaskTemplateScriptVO::getSort));
+                log.info("闂嵎鍥炵瓟缁撴灉锛歿}", cacheList);
+                for (int i = 0; i < cacheList.size(); i++) {
+                    if (i == 0) {
+                        //杩欎釜鏃堕棿瑕佹壘鍒扮涓�棰�
+                        for (SvyTaskTemplateScriptVO svyTaskTemplateScriptVO : cacheList) {
+                            if (svyTaskTemplateScriptVO.getSort() == 1L) {
+                                //璇存槑鏄涓�棰�
+                                List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(0).getSvyTaskTemplateTargetoptions();
+                                svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions);
+                                Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, tid, pid);
+                                if (map == null) continue;
+                                if (!Objects.isNull(map.get("nextScriptNo")))
+                                    nextScriptno = Long.valueOf(map.get("nextScriptNo"));
+                                if (score == null) {
+                                    score = Double.valueOf(map.get("score"));
+                                } else {
+                                    score = score + Double.valueOf(map.get("score"));
+                                }
+                                isabnormalFlag = map.get("isabnormal");
+                            }
+                        }
+
+                    } else {
+                        SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = cacheList.get(i);
+                        log.info("svyTaskTemplateScriptVO鐨勪俊鎭负锛歿}锛宨鐨勫�间负锛歿}", svyTaskTemplateScriptVO.getScriptno(), i);
+                        List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(i).getSvyTaskTemplateTargetoptions();
+                        svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions);
+
+                        if (svyTaskTemplateScriptVO.getSort() != null && svyTaskTemplateScriptVO.getSort().equals(nextScriptno)) {
+                            Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, tid, pid);
+                            log.error("nextScriptNo鐨勪俊鎭负锛歿}", map.get("nextScriptNo"));
+                            if (!Objects.isNull(map.get("nextScriptNo")))
+                                nextScriptno = Long.valueOf(map.get("nextScriptNo"));
+                            if (score == null) {
+                                score = Double.valueOf(map.get("score"));
+                            } else {
+                                score = score + Double.valueOf(map.get("score"));
+                            }
+                            isabnormalFlag = map.get("isabnormal");
+                        }
+                    }
+                }
+            } else if (serviceSubTaskCacheReq.getType() == 1) {
+                List<IvrTaskTemplateScriptVO> cacheList = serviceSubTaskCacheReq.getIvrTaskTemplateScriptVOList();
+                cacheList.sort(Comparator.comparingLong(IvrTaskTemplateScriptVO::getSort));
+                log.error("鐢佃瘽闅忚闂嵎鍥炵瓟缁撴灉锛歿}", cacheList.size());
+                for (int i = 0; i < cacheList.size(); i++) {
+                    if (i == 0) {
+                        //杩欎釜鏃堕棿瑕佹壘鍒扮涓�棰�
+                        for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : cacheList) {
+                            if (ivrTaskTemplateScriptVO.getSort() == 1L) {
+                                //璇存槑鏄涓�棰�
+                                List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = cacheList.get(0).getIvrTaskScriptTargetoptionList();
+                                ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions);
+                                //瀹冧咯閮芥槸ivr_task_templatescript_id,鎵�浠ヨ繖閲岄渶瑕佽缃竴涓�
+                                ivrTaskTemplateScriptVO.setId(ivrTaskTemplateScriptVO.getScriptID());
+                                Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, tid, pid);
+                                if (!Objects.isNull(map.get("nextScriptNo")))
+                                    nextScriptno = Long.valueOf(map.get("nextScriptNo"));
+                                if (score == null) {
+                                    score = Double.valueOf(map.get("score"));
+                                } else {
+                                    score = score + Double.valueOf(map.get("score"));
+                                }
+                                isabnormalFlag = map.get("isabnormal");
+                            }
+                        }
+
+                    } else {
+                        IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = DtoConversionUtils.sourceToTarget(cacheList.get(i), IvrTaskTemplateScriptVO.class);
+                        List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = DtoConversionUtils.sourceToTarget(cacheList.get(i).getIvrTaskScriptTargetoptionList(), IvrTaskTemplateTargetoption.class);
+                        ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions);
+
+                        if (ivrTaskTemplateScriptVO.getSort() != null && Long.valueOf(ivrTaskTemplateScriptVO.getSort()).equals(nextScriptno)) {
+                            Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, tid, pid);
+                            log.error("----nextScriptNo2鐨勪俊鎭负锛歿}", map.get("nextScriptNo"));
+                            if (!Objects.isNull(map.get("nextScriptNo")))
+                                nextScriptno = Long.valueOf(map.get("nextScriptNo"));
+                            if (score == null) {
+                                score = Double.valueOf(map.get("score"));
+                            } else {
+                                score = score + Double.valueOf(map.get("score"));
+                            }
+                            isabnormalFlag = map.get("isabnormal");
+                        }
+                    }
+                }
+            }
+
+            //鏌ヨ鍑鸿浠诲姟涓鍦ㄦ墽琛岀殑鎮h�呬俊鎭�
+            ServiceSubtaskEntity ssVO = new ServiceSubtaskEntity();
+            ssVO.setTaskid(tid);
+            ssVO.setPatid(pid);
+            List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(ssVO);
+
+            ServiceSubtask serviceSubtask = new ServiceSubtask();
+            serviceSubtask.setTaskid(tid);
+            serviceSubtask.setPatid(pid);
+            serviceSubtask.setSubmit(1L);
+            serviceSubtask.setIsabnormal(Integer.valueOf(isabnormalFlag));
+            serviceSubtask.setSendstate(6L);
+            serviceSubtask.setExcep(isabnormalFlag);
+            serviceSubtask.setFinishtime(new Date());
+            serviceSubtask.setUpdateTime(new Date());
+            if (score != null) serviceSubtask.setScore(BigDecimal.valueOf(score));
+            serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
+
+            //灏嗗綋鍓嶅彂閫佺姸鎬佹敼鎴�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);
+            }
+        }
+
+        return 1;
+    }
+
 
     @Override
     public Boolean saveMYDQuestionAnswer(ServiceSubTaskMYDAnswerReq serviceSubTaskMYDAnswerReq) {
@@ -672,6 +818,7 @@
             }
             serviceSubtaskDetailVO.setAsrtext(StringUtils.isEmpty(svyTaskTemplateScriptVO.getScriptResult()) ? "" : svyTaskTemplateScriptVO.getScriptResult().replaceAll("^\"|\"$", ""));
             serviceSubtaskDetailVO.setMatchedtext(StringUtils.isEmpty(svyTaskTemplateScriptVO.getScriptResult()) ? "" : svyTaskTemplateScriptVO.getScriptResult().replaceAll("^\"|\"$", ""));
+            serviceSubtaskDetailVO.setScore(svyTaskTemplateScriptVO.getScore() != null ? svyTaskTemplateScriptVO.getScore().toString() : "0");
         } else {
             //闈炲崟澶氶��
             if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getScriptResult())) {
@@ -694,6 +841,8 @@
         serviceSubtaskDetailVO.setComment(null);
         serviceSubtaskDetailVO.setCreateTime(new Date());
         serviceSubtaskDetailVO.setUpdateTime(new Date());
+        serviceSubtaskDetailVO.setTemplateType(2);
+        serviceSubtaskDetailVO.setLibTemplateid(CollectionUtils.isNotEmpty(selectServiceSubtaskList) ? selectServiceSubtaskList.get(0).getLibtemplateid().intValue() : null);
         if (ObjectUtils.isNotEmpty(serviceTask)) {
             serviceSubtaskDetailVO.setGuid(serviceTask.getGuid());
             serviceSubtaskDetailVO.setOrgid(serviceTask.getOrgid());
@@ -701,7 +850,74 @@
         serviceSubtaskDetailVO.setSubId(CollectionUtils.isNotEmpty(selectServiceSubtaskList) ? selectServiceSubtaskList.get(0).getId() : null);
         serviceSubtaskDetailVO.setTemplatequestionnum(svyTaskTemplateScriptVO.getId());
         ServiceSubtaskDetail serviceSubtaskDetail = DtoConversionUtils.sourceToTarget(serviceSubtaskDetailVO, ServiceSubtaskDetail.class);
-        serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
+
+        //鍏堢敤subid鍜宻criptid鏌ヨ涓�涓嬫槸鍚﹀瓨鍦紝濡傛灉瀛樺湪鍒欐洿鏂帮紝涓嶅瓨鍦ㄥ垯鎻掑叆
+        ServiceSubtaskDetailDTO existServiceSubtaskDetail = serviceSubtaskDetailMapper.isExistServiceSubtaskDetail(serviceSubtaskDetailVO.getSubId(), serviceSubtaskDetailVO.getScriptid());
+        if (ObjectUtils.isNotEmpty(existServiceSubtaskDetail)) {
+            serviceSubtaskDetail.setId(existServiceSubtaskDetail.getId());
+            serviceSubtaskDetail.setUpdateTime(new Date());
+            serviceSubtaskDetailMapper.updateServiceSubtaskDetail(serviceSubtaskDetail);
+        } else {
+            serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
+        }
+
+        //鑾峰彇涓�涓嬮棶棰橀�夐」
+        SvyTaskTemplateTargetoption stt = null;
+        Long isabnormalFlag = 0L;
+        for (SvyTaskTemplateTargetoption svyTaskTemplateTargetoption : svyTaskTemplateScriptVO.getSvyTaskTemplateTargetoptions()) {
+            if (svyTaskTemplateTargetoption.getOptioncontent().trim().equals(svyTaskTemplateScriptVO.getScriptResult()))
+                stt = svyTaskTemplateTargetoption;
+        }
+
+        //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+        if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && 1 == stt.getIsabnormal()) {
+            isabnormalFlag = 1L;
+            ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+            subtaskDetailTrace.setDetailId(serviceSubtaskDetail.getId());
+            subtaskDetailTrace.setSubId(serviceSubtaskDetailVO.getSubId());
+            subtaskDetailTrace.setTaskid(serviceSubtaskDetailVO.getTaskid());
+            subtaskDetailTrace.setTemplateid(StringUtils.isNotEmpty(serviceSubtaskDetailVO.getTemplateid()) ? Long.valueOf(serviceSubtaskDetailVO.getTemplateid()) : null);
+            subtaskDetailTrace.setTemplatequestionnum(svyTaskTemplateScriptVO.getScriptid());
+            subtaskDetailTrace.setSwitchid(stt.getId());
+            subtaskDetailTrace.setQuestiontext(svyTaskTemplateScriptVO.getScriptContent());
+            subtaskDetailTrace.setQuestionvoice(null);
+            subtaskDetailTrace.setCategoryname(svyTaskTemplateScriptVO.getCategoryName());
+            subtaskDetailTrace.setCategoryid(svyTaskTemplateScriptVO.getCategoryid());
+            //鑾峰彇鎵�鏈夐�夐」
+            subtaskDetailTrace.setTargetid(stt.getId());
+            subtaskDetailTrace.setTargetvalue(serviceSubtaskDetailVO.getTargetvalue());
+            subtaskDetailTrace.setMatchedtext(stt.getOptioncontent());
+            subtaskDetailTrace.setGuid(svyTaskTemplateScriptVO.getGuid());
+            subtaskDetailTrace.setValueType(serviceSubtaskDetail.getValueType());
+            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.setRecordpath(null);
+            subtaskDetailTrace.setPatid(selectServiceSubtaskList.get(0).getPatid());
+            subtaskDetailTrace.setPatdesc(selectServiceSubtaskList.get(0).getSendname() + "," + selectServiceSubtaskList.get(0).getPhone() + "," + selectServiceSubtaskList.get(0).getDeptname());
+            subtaskDetailTrace.setTodeptcode(svyTaskTemplateScriptVO.getDutyDeptCode());
+            subtaskDetailTrace.setTodeptname(svyTaskTemplateScriptVO.getDutyDeptName());
+            subtaskDetailTrace.setOrgid(selectServiceSubtaskList.get(0).getOrgid());
+            subtaskDetailTrace.setHandleFlag("0");
+            subtaskDetailTrace.setCreateTime(new Date());
+            subtaskDetailTrace.setUpdateTime(new Date());
+            subtaskDetailTrace.setOrgid(selectServiceSubtaskList.get(0).getOrgid());
+            traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
+        } else if (ObjectUtils.isNotEmpty(stt) && stt.getIsabnormal() == 1L) {
+            //杩欓噷涓昏鏄�曞尰鎶や汉鍛樻妸寮傚父閫夐」鏀规垚浜嗛潪寮傚父鐨勶紝杩欓噷灏遍渶瑕佹煡涓�涓嬭繖鏉℃暟鎹槸涓嶆槸鍦ㄦ弧鎰忓害寮傚父琛紝濡傛灉鍦紝鍒欒鍒犻櫎
+            ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+            subtaskDetailTrace.setSubId(serviceSubtaskDetailVO.getSubId());
+            subtaskDetailTrace.setScriptid(svyTaskTemplateScriptVO.getId());
+            List<ServiceSubtaskDetailTrace> serviceSubtaskDetailTraces = traceService.selectServiceSubtaskDetailTtraceList(subtaskDetailTrace);
+            if (CollectionUtils.isNotEmpty(serviceSubtaskDetailTraces)) {
+                traceService.deleteServiceSubtaskDetailTtraceById(serviceSubtaskDetailTraces.get(0).getId());
+            }
+        }
+
 
         //濡備綍杩欓渶瑕佹湇鍔¤ˉ鍋跨殑鏈嶅姟ID涓嶄负绌虹殑璇濓紝鍒欒繘琛岀珛鍗冲彂閫�
         log.error("------svyTaskTemplateScriptVO.getSendTaskids()鐨勫�间负锛歿},selectServiceSubtaskList鐨勫�间负锛歿}", svyTaskTemplateScriptVO.getSendTaskids(), selectServiceSubtaskList.size());
@@ -713,6 +929,7 @@
         map.put("nextScriptNo", nextScriptNo);
         map.put("score", score);
         map.put("id", "" + serviceSubtaskDetail.getId());
+        map.put("isabnormal", isabnormalFlag.toString());
         return map;
     }
 
@@ -809,7 +1026,7 @@
         //涓嬮璺宠浆
         String nextScriptNo = null;
         ServiceSubtaskDetailVO serviceSubtaskDetailVO = new ServiceSubtaskDetailVO();
-        List<ServiceSubtaskOptionAnswer> answerList = new ArrayList<>();
+        String isabnormalFlag = "0";
         if (ivrTaskTemplateScriptVO.getScriptType().equals("1") || ivrTaskTemplateScriptVO.getScriptType().equals("2")) {
             //1銆�2涓哄崟閫夋垨澶氶��
             for (IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption : ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()) {
@@ -821,20 +1038,25 @@
                 }
 
             }
-            nextScriptNo = ivrTaskTemplateScriptVO.getNextScriptno().toString();
+            nextScriptNo = ivrTaskTemplateScriptVO.getNextScriptno() == null ? null : ivrTaskTemplateScriptVO.getNextScriptno().toString();
             if (ivrTaskTemplateScriptVO.getScore() != null) {
                 score = String.valueOf(ivrTaskTemplateScriptVO.getScore());
             }
             if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getQuestionResult())) {
                 serviceSubtaskDetailVO.setAsrtext(ivrTaskTemplateScriptVO.getQuestionResult().replaceAll("^\"|\"$", ""));
                 serviceSubtaskDetailVO.setMatchedtext(ivrTaskTemplateScriptVO.getQuestionResult().replaceAll("^\"|\"$", ""));
+            } else {
+                //鍖荤敓鎵嬪姩濉姤鏃讹紝鍊兼槸鍦╥vrtext涓�
+                serviceSubtaskDetailVO.setAsrtext(ivrTaskTemplateScriptVO.getIvrtext());
+                serviceSubtaskDetailVO.setMatchedtext(ivrTaskTemplateScriptVO.getIvrtext());
             }
         } else {
             //闈炲崟澶氶��
             if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getQuestionResult())) {
                 serviceSubtaskDetailVO.setAsrtext(ivrTaskTemplateScriptVO.getQuestionResult().replaceAll("^\"|\"$", ""));
                 serviceSubtaskDetailVO.setMatchedtext(ivrTaskTemplateScriptVO.getQuestionResult().replaceAll("^\"|\"$", ""));
-                nextScriptNo = ivrTaskTemplateScriptVO.getNextScriptno().toString();
+                serviceSubtaskDetailVO.setScore(ivrTaskTemplateScriptVO.getScore() != null ? ivrTaskTemplateScriptVO.getScore().toString() : "0");
+                nextScriptNo = ivrTaskTemplateScriptVO.getNextScriptno() == null ? null : ivrTaskTemplateScriptVO.getNextScriptno().toString();
                 if (ivrTaskTemplateScriptVO.getScore() != null) {
                     score = String.valueOf(ivrTaskTemplateScriptVO.getScore());
                 }
@@ -844,7 +1066,7 @@
         serviceSubtaskDetailVO.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
         serviceSubtaskDetailVO.setTaskid(Long.valueOf(taskid));
         serviceSubtaskDetailVO.setPatid(Long.valueOf(patid));
-        serviceSubtaskDetailVO.setScriptid(ivrTaskTemplateScriptVO.getScriptID());
+        serviceSubtaskDetailVO.setScriptid(ivrTaskTemplateScriptVO.getScriptID() == null ? ivrTaskTemplateScriptVO.getId() : ivrTaskTemplateScriptVO.getScriptID());
         serviceSubtaskDetailVO.setTemplatequestionnum(ivrTaskTemplateScriptVO.getId());
         serviceSubtaskDetailVO.setValueType(ivrTaskTemplateScriptVO.getScriptType());
         serviceSubtaskDetailVO.setComment(null);
@@ -854,8 +1076,80 @@
         serviceSubtaskDetailVO.setUpdateTime(new Date());
         serviceSubtaskDetailVO.setSubId(selectServiceSubtaskList.get(0).getId());
         serviceSubtaskDetailVO.setTemplatequestionnum(ivrTaskTemplateScriptVO.getId());
+        serviceSubtaskDetailVO.setTemplateType(1);
+        serviceSubtaskDetailVO.setTemplateid(ivrTaskTemplateScriptVO.getTemplateID() == null ? null : ivrTaskTemplateScriptVO.getTemplateID().toString());
+        serviceSubtaskDetailVO.setLibTemplateid(selectServiceSubtaskList.get(0).getLibtemplateid() != null ? selectServiceSubtaskList.get(0).getLibtemplateid().intValue() : null);
         ServiceSubtaskDetail serviceSubtaskDetail = DtoConversionUtils.sourceToTarget(serviceSubtaskDetailVO, ServiceSubtaskDetail.class);
-        serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
+        //鍏堢敤subid鍜宻criptid鏌ヨ涓�涓嬫槸鍚﹀瓨鍦紝濡傛灉瀛樺湪鍒欐洿鏂帮紝涓嶅瓨鍦ㄥ垯鎻掑叆
+        ServiceSubtaskDetailDTO existServiceSubtaskDetail = serviceSubtaskDetailMapper.isExistServiceSubtaskDetail(serviceSubtaskDetailVO.getSubId(), serviceSubtaskDetailVO.getScriptid());
+        if (ObjectUtils.isNotEmpty(existServiceSubtaskDetail)) {
+            serviceSubtaskDetail.setId(existServiceSubtaskDetail.getId());
+            serviceSubtaskDetail.setUpdateTime(new Date());
+            serviceSubtaskDetailMapper.updateServiceSubtaskDetail(serviceSubtaskDetail);
+        } else {
+            serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
+        }
+        IvrTaskTemplateTargetoption stt = null;
+        for (IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption : ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()) {
+            if (ivrTaskTemplateTargetoption.getTargetvalue().trim().equals(ivrTaskTemplateScriptVO.getIvrtext()))
+                stt = ivrTaskTemplateTargetoption;
+        }
+
+
+        //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == stt.getIsabnormal()) {
+            isabnormalFlag = "1";
+            ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+            subtaskDetailTrace.setDetailId(serviceSubtaskDetail.getId());
+            subtaskDetailTrace.setSubId(serviceSubtaskDetailVO.getSubId());
+            subtaskDetailTrace.setTaskid(serviceSubtaskDetailVO.getTaskid());
+            subtaskDetailTrace.setTemplateid(ivrTaskTemplateScriptVO.getTemplateID()!=null ? Long.valueOf(ivrTaskTemplateScriptVO.getTemplateID()) : null);
+            subtaskDetailTrace.setTemplatequestionnum(ivrTaskTemplateScriptVO.getSort() == null ? null : Long.valueOf(ivrTaskTemplateScriptVO.getSort()));
+
+            //鑾峰彇鍒嗙被淇℃伅
+            IvrLibaScriptAssort ivrLibaScriptAssort = null;
+            if (ivrTaskTemplateScriptVO.getScriptAssortid() != null)
+                ivrLibaScriptAssort = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortById(ivrTaskTemplateScriptVO.getScriptAssortid());
+
+            //鑾峰彇鐢ㄦ埛閫夊嚭鐨勯�夐」鐨処D
+            subtaskDetailTrace.setSwitchid(stt.getId());
+            subtaskDetailTrace.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
+            subtaskDetailTrace.setQuestionvoice(null);
+            subtaskDetailTrace.setCategoryname(StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getScriptAssortname()) ? ivrTaskTemplateScriptVO.getScriptAssortname() : (ivrLibaScriptAssort != null ? ivrLibaScriptAssort.getIndexAssortName() : ""));
+            subtaskDetailTrace.setCategoryid(ivrTaskTemplateScriptVO.getScriptAssortid());
+            //鑾峰彇鎵�鏈夐�夐」
+            subtaskDetailTrace.setTargetid(null);
+            subtaskDetailTrace.setTargetvalue(serviceSubtaskDetailVO.getTargetvalue());
+            subtaskDetailTrace.setMatchedtext(ivrTaskTemplateScriptVO.getIvrtext());
+            subtaskDetailTrace.setGuid(ivrTaskTemplateScriptVO.getGuid());
+            subtaskDetailTrace.setValueType(serviceSubtaskDetail.getValueType());
+            subtaskDetailTrace.setTemplateType(1);
+
+            subtaskDetailTrace.setType(ivrLibaScriptAssort != null ? ivrLibaScriptAssort.getType() : null);
+
+            subtaskDetailTrace.setScriptid(ivrTaskTemplateScriptVO.getId() == null ? ivrTaskTemplateScriptVO.getScriptID() : ivrTaskTemplateScriptVO.getId());
+            subtaskDetailTrace.setAsrtext(ivrTaskTemplateScriptVO.getIvrtext());
+            subtaskDetailTrace.setRecordpath(null);
+            subtaskDetailTrace.setPatid(selectServiceSubtaskList.get(0).getPatid());
+            subtaskDetailTrace.setPatdesc(selectServiceSubtaskList.get(0).getSendname() + "," + selectServiceSubtaskList.get(0).getPhone() + "," + selectServiceSubtaskList.get(0).getDeptname());
+            subtaskDetailTrace.setTodeptcode(ivrTaskTemplateScriptVO.getDutyDeptCode());
+            subtaskDetailTrace.setTodeptname(ivrTaskTemplateScriptVO.getDutyDeptName());
+            subtaskDetailTrace.setOrgid(selectServiceSubtaskList.get(0).getOrgid());
+            subtaskDetailTrace.setHandleFlag("0");
+            subtaskDetailTrace.setCreateTime(new Date());
+            subtaskDetailTrace.setUpdateTime(new Date());
+            subtaskDetailTrace.setOrgid(selectServiceSubtaskList.get(0).getOrgid());
+            traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
+        } else if (stt.getIsabnormal() != null && stt.getIsabnormal() != 1L) {
+            //杩欓噷涓昏鏄�曞尰鎶や汉鍛樻妸寮傚父閫夐」鏀规垚浜嗛潪寮傚父鐨勶紝杩欓噷灏遍渶瑕佹煡涓�涓嬭繖鏉℃暟鎹槸涓嶆槸鍦ㄦ弧鎰忓害寮傚父琛紝濡傛灉鍦紝鍒欒鍒犻櫎
+            ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+            subtaskDetailTrace.setSubId(serviceSubtaskDetailVO.getSubId());
+            subtaskDetailTrace.setScriptid(ivrTaskTemplateScriptVO.getScriptID() == null ? ivrTaskTemplateScriptVO.getId() : ivrTaskTemplateScriptVO.getScriptID());
+            List<ServiceSubtaskDetailTrace> serviceSubtaskDetailTraces = traceService.selectServiceSubtaskDetailTtraceList(subtaskDetailTrace);
+            if (CollectionUtils.isNotEmpty(serviceSubtaskDetailTraces)) {
+                traceService.deleteServiceSubtaskDetailTtraceById(serviceSubtaskDetailTraces.get(0).getId());
+            }
+        }
 
         //濡備綍杩欓渶瑕佹湇鍔¤ˉ鍋跨殑鏈嶅姟ID涓嶄负绌虹殑璇濓紝鍒欒繘琛岀珛鍗冲彂閫�
         if (CollectionUtils.isNotEmpty(ivrTaskTemplateScriptVO.getSendTaskids()) && CollectionUtils.isNotEmpty(selectServiceSubtaskList)) {
@@ -866,6 +1160,7 @@
         Map<String, String> map = new HashMap<>();
         map.put("nextScriptNo", nextScriptNo);
         map.put("score", score);
+        map.put("isabnormal", isabnormalFlag);
         return map;
     }
 }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskDetailTraceServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskDetailTraceServiceImpl.java
new file mode 100644
index 0000000..6c0f49a
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskDetailTraceServiceImpl.java
@@ -0,0 +1,278 @@
+package com.smartor.service.impl;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+import com.github.pagehelper.util.StringUtil;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.smartor.domain.*;
+import com.smartor.domain.DTO.DetailTraceDealDTO;
+import com.smartor.domain.VO.DetailTraceDealVO;
+import com.smartor.domain.VO.SatisfactionExceptConfigQuestionReqVO;
+import com.smartor.mapper.ServiceSubtaskDetailMapper;
+import com.smartor.mapper.ServiceSubtaskDetailTraceMapper;
+import com.smartor.mapper.SvyLibScriptCategoryMapper;
+import com.smartor.mapper.SvyLibTemplateScriptMapper;
+import com.smartor.service.*;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 闅忚浠诲姟寮傚父璁板綍璺熻釜Service涓氬姟灞傚鐞�
+ *
+ * @author lihu
+ * @date 2026-03-24
+ */
+@Service
+public class ServiceSubtaskDetailTraceServiceImpl implements IServiceSubtaskDetailTraceService {
+    @Autowired
+    private ServiceSubtaskDetailTraceMapper serviceSubtaskDetailTraceMapper;
+
+    @Autowired
+    private ServiceSubtaskDetailMapper serviceSubtaskDetailMapper;
+
+    @Autowired
+    private ISvyLibScriptCategoryService iSvyLibScriptCategoryService;
+
+    @Autowired
+    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
+
+    @Autowired
+    private ISvyLibTemplateScriptService isvyLibTemplateScriptService;
+
+    @Autowired
+    private IIvrLibaScriptAssortService iIvrLibaScriptAssortService;
+
+    @Autowired
+    private IIvrLibaTemplateScriptService iIvrLibaTemplateScriptService;
+
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param id 闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    @Override
+    public ServiceSubtaskDetailTrace selectServiceSubtaskDetailTtraceById(Long id) {
+        return serviceSubtaskDetailTraceMapper.selectServiceSubtaskDetailTtraceById(id);
+    }
+
+    /**
+     * 鏌ヨ闅忚浠诲姟寮傚父璁板綍璺熻釜鍒楄〃
+     *
+     * @param serviceSubtaskDetailTrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     */
+    @Override
+    public List<ServiceSubtaskDetailTrace> selectServiceSubtaskDetailTtraceList(ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        return serviceSubtaskDetailTraceMapper.selectServiceSubtaskDetailTtraceList(serviceSubtaskDetailTrace);
+    }
+
+    @Override
+    public List<DetailTraceDealDTO> tracedeallist(DetailTraceDealVO detailTraceDealVO) {
+        // 鑾峰彇鎵�鏈夐渶瑕佸鐞嗙殑璁板綍
+        List<ServiceSubtaskDetailTrace> tracedeallist = serviceSubtaskDetailTraceMapper.tracedeallist(detailTraceDealVO);
+
+        // 鎸� questiontext 鍒嗙粍
+        Map<String, List<ServiceSubtaskDetailTrace>> groupByQuestion = tracedeallist.stream()
+                .filter(t -> t.getQuestiontext() != null)
+                .collect(Collectors.groupingBy(ServiceSubtaskDetailTrace::getQuestiontext));
+
+        List<DetailTraceDealDTO> detailTraceDealDTOList = new ArrayList<>();
+        for (Map.Entry<String, List<ServiceSubtaskDetailTrace>> entry : groupByQuestion.entrySet()) {
+            List<ServiceSubtaskDetailTrace> group = entry.getValue();
+            DetailTraceDealDTO dto = new DetailTraceDealDTO();
+
+            // 闂鍐呭
+            dto.setQuestiontext(entry.getKey());
+
+            // 璐熻矗绉戝锛堝幓閲嶏級
+            List<Map<String, Object>> responsibleDept = group.stream()
+                    .filter(t -> t.getTodeptcode() != null)
+                    .collect(Collectors.collectingAndThen(
+                            Collectors.toMap(
+                                    ServiceSubtaskDetailTrace::getTodeptcode,
+                                    t -> {
+                                        Map<String, Object> deptMap = new HashMap<>();
+                                        deptMap.put("deptName", t.getTodeptname());
+                                        deptMap.put("deptCode", t.getTodeptcode());
+                                        return deptMap;
+                                    },
+                                    (existing, replacement) -> existing
+                            ),
+                            map -> new ArrayList<>(map.values())
+                    ));
+            dto.setResponsibleDept(responsibleDept);
+
+            // 鏈夋晥濉啓鏁帮細閫氳繃缁勫唴鐨� scriptid 鍘� service_subtask_detail 琛ㄦ煡璇�
+            List<Long> scriptIds = group.stream()
+                    .map(ServiceSubtaskDetailTrace::getScriptid)
+                    .filter(Objects::nonNull)
+                    .distinct()
+                    .collect(Collectors.toList());
+            long effectiveFillNum = 0L;
+            if (CollectionUtils.isNotEmpty(scriptIds)) {
+                ServiceSubtaskDetail query = new ServiceSubtaskDetail();
+                query.setDelFlag("0");
+                for (Long scriptId : scriptIds) {
+                    query.setScriptid(scriptId);
+                    List<ServiceSubtaskDetail> details = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(query);
+                    effectiveFillNum += CollectionUtils.isEmpty(details) ? 0 : details.size();
+                }
+            }
+
+            // 寮傚父濉啓鏁� = 褰撳墠鍒嗙粍鐨� List 鏁伴噺
+            long exceptionFillNum = group.size();
+
+            Map<String, Object> fillSituation = new HashMap<>();
+            fillSituation.put("effectiveFillNum", effectiveFillNum);
+            fillSituation.put("exceptionFillNum", exceptionFillNum);
+            dto.setFillSituation(fillSituation);
+
+            // 寮傚父闂澶勭悊鏁伴噺锛氫粠 handleFlag 缁熻
+            long yesDeal = group.stream().filter(t -> "1".equals(t.getHandleFlag())).count();
+            long noDeal = group.stream().filter(t -> !"1".equals(t.getHandleFlag())).count();
+            Map<String, Object> exceptionQuesNum = new HashMap<>();
+            exceptionQuesNum.put("yesDeal", yesDeal);
+            exceptionQuesNum.put("noDeal", noDeal);
+            exceptionQuesNum.put("all", exceptionFillNum);
+            dto.setExceptionQuesNum(exceptionQuesNum);
+
+            // 鏈�鏂板鐞嗕汉鍜屽鐞嗘椂闂达紙鍙� handleTime 鏈�鏂扮殑涓�鏉★級
+            group.stream()
+                    .filter(t -> t.getHandleTime() != null)
+                    .max(Comparator.comparing(ServiceSubtaskDetailTrace::getHandleTime))
+                    .ifPresent(latest -> {
+                        dto.setHandleBy(latest.getHandleBy());
+                        dto.setHandleTime(latest.getHandleTime());
+                    });
+
+            detailTraceDealDTOList.add(dto);
+        }
+
+        return detailTraceDealDTOList;
+    }
+
+    /**
+     * 鏂板闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param serviceSubtaskDetailTrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertServiceSubtaskDetailTtrace(ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        serviceSubtaskDetailTrace.setCreateTime(DateUtils.getNowDate());
+        return serviceSubtaskDetailTraceMapper.insertServiceSubtaskDetailTtrace(serviceSubtaskDetailTrace);
+    }
+
+    /**
+     * 淇敼闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param serviceSubtaskDetailTrace 闅忚浠诲姟寮傚父璁板綍璺熻釜
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateServiceSubtaskDetailTtrace(ServiceSubtaskDetailTrace serviceSubtaskDetailTrace) {
+        serviceSubtaskDetailTrace.setUpdateTime(DateUtils.getNowDate());
+        return serviceSubtaskDetailTraceMapper.updateServiceSubtaskDetailTtrace(serviceSubtaskDetailTrace);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteServiceSubtaskDetailTtraceByIds(Long[] ids) {
+        return serviceSubtaskDetailTraceMapper.deleteServiceSubtaskDetailTtraceByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎闅忚浠诲姟寮傚父璁板綍璺熻釜淇℃伅
+     *
+     * @param id 闅忚浠诲姟寮傚父璁板綍璺熻釜涓婚敭
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteServiceSubtaskDetailTtraceById(Long id) {
+        return serviceSubtaskDetailTraceMapper.deleteServiceSubtaskDetailTtraceById(id);
+    }
+
+    @Override
+    public Map<String, Object> getSatisfactionExceptConfigQuestion(SatisfactionExceptConfigQuestionReqVO questionReqVO) {
+        // 鍒濆鍖栫粨鏋滈泦
+        Map<String, Object> result = new HashMap<>();
+
+        if (StringUtils.isEmpty(questionReqVO.getScriptType()) || questionReqVO.getScriptType().equals("1")) {
+            List<Map<String, Object>> voicetDataList = new ArrayList<>();
+            //鑾峰彇婊℃剰搴︾殑鍒嗙被
+            IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort();
+            ivrLibaScriptAssort.setType("myd");
+            if (!StringUtils.isEmpty(questionReqVO.getType())) ivrLibaScriptAssort.setType(questionReqVO.getType());
+            List<IvrLibaScriptAssortVO> ivrLibaScriptAssortVOS = iIvrLibaScriptAssortService.selectIvrLibaScriptAssortList(ivrLibaScriptAssort);
+            List<Long> assortIdList = Optional.ofNullable(ivrLibaScriptAssortVOS).filter(list -> !list.isEmpty()).map(list -> list.stream().map(IvrLibaScriptAssortVO::getId).collect(Collectors.toList())).orElse(Collections.emptyList());
+
+            //鐢ㄦ潵璁板綍婊℃剰搴︾殑鎵�鏈夐棶棰�
+            List<IvrLibaTemplateScript> ivrLibaTemplateScriptList = new ArrayList<>();
+            if (CollectionUtils.isNotEmpty(assortIdList)) {
+                for (Long assortId : assortIdList) {
+                    IvrLibaTemplateScript ivrLibaTemplateScript = new IvrLibaTemplateScript();
+                    ivrLibaTemplateScript.setScriptAssortid(assortId);
+                    List<IvrLibaTemplateScript> ivrLibaTemplateScripts = iIvrLibaTemplateScriptService.selectIvrLibaTemplateScriptList(ivrLibaTemplateScript);
+                    ivrLibaTemplateScriptList.addAll(ivrLibaTemplateScripts);
+                }
+                for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScriptList) {
+                    Map<String, Object> voicetData = new HashMap<>();
+                    voicetData.put("questionId", ivrLibaTemplateScript.getId());
+                    voicetData.put("libtemplateid", ivrLibaTemplateScript.getTemplateid());
+                    voicetData.put("questionContent", ivrLibaTemplateScript.getScriptContent());
+                    voicetData.put("questionTopic", ivrLibaTemplateScript.getScriptTopic());
+                    voicetData.put("questionType", ivrLibaTemplateScript.getScriptType());
+                    voicetData.put("categoryName", ivrLibaTemplateScript.getScriptAssortname());
+                    voicetData.put("categoryId", ivrLibaTemplateScript.getScriptAssortid());
+                    voicetDataList.add(voicetData);
+                }
+            }
+            //璇煶鏁版嵁杩斿洖闆嗗悎
+            result.put("voiceDataList", voicetDataList);
+        }
+
+        if (StringUtils.isEmpty(questionReqVO.getScriptType()) || questionReqVO.getScriptType().equals("2")) {
+            List<Map<String, Object>> questionnaireDataList = new ArrayList<>();
+            //鑾峰彇婊℃剰搴︾殑鍒嗙被
+            SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory();
+            svyLibScriptCategory.setType("myd");
+            if (!StringUtils.isEmpty(questionReqVO.getType())) svyLibScriptCategory.setType(questionReqVO.getType());
+            List<SvyLibScriptCategory> svyLibScriptCategoryVOS = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory);
+            List<Long> assortIdList = Optional.ofNullable(svyLibScriptCategoryVOS).filter(list -> !list.isEmpty()).map(list -> list.stream().map(SvyLibScriptCategory::getId).collect(Collectors.toList())).orElse(Collections.emptyList());
+
+            //鐢ㄦ潵璁板綍婊℃剰搴︾殑鎵�鏈夐棶棰�
+            List<SvyLibTemplateScript> svyLibTemplateScriptList = new ArrayList<>();
+            if (CollectionUtils.isNotEmpty(assortIdList)) {
+                for (Long categoryid : assortIdList) {
+                    SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript();
+                    svyLibTemplateScript.setCategoryid(categoryid);
+                    List<SvyLibTemplateScript> svyLibTemplateScripts = isvyLibTemplateScriptService.selectSvyLibTemplateScriptList(svyLibTemplateScript);
+                    svyLibTemplateScriptList.addAll(svyLibTemplateScripts);
+                }
+                for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScriptList) {
+                    Map<String, Object> voicetData = new HashMap<>();
+                    voicetData.put("questionId", svyLibTemplateScript.getId());
+                    voicetData.put("libtemplateid", svyLibTemplateScript.getSvyid());
+                    voicetData.put("questionContent", svyLibTemplateScript.getScriptContent());
+                    voicetData.put("questionTopic", svyLibTemplateScript.getScriptTopic());
+                    voicetData.put("questionType", svyLibTemplateScript.getScriptType());
+                    voicetData.put("categoryName", svyLibTemplateScript.getCategoryName());
+                    voicetData.put("categoryId", svyLibTemplateScript.getCategoryid());
+                    questionnaireDataList.add(voicetData);
+                }
+            }
+            //闂嵎鏁版嵁杩斿洖闆嗗悎
+            result.put("questionnaireDataList", questionnaireDataList);
+        }
+        return result;
+    }
+}
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 80727d1..650928f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -1,6 +1,5 @@
 package com.smartor.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson2.JSON;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
@@ -16,11 +15,8 @@
 import com.smartor.domain.entity.ServiceSubtaskEntity;
 import com.smartor.mapper.*;
 import com.smartor.service.*;
-import com.sun.org.apache.bcel.internal.generic.NEW;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.ListUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -104,7 +100,7 @@
     private IServiceOutPathService iServiceOutPathService;
 
     @Autowired
-    private IPatMedOuthospService iPatMedOuthospService;
+    private IServiceSubtaskDetailTraceService traceService;
 
     @Autowired
     private FtpService ftpService;
@@ -117,6 +113,9 @@
 
     @Autowired
     private PatArchiveMapper patArchiveMapper;
+
+    @Autowired
+    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
 
     @Value("${pri_key}")
     private String pri_key;
@@ -205,12 +204,12 @@
             try {
                 List<Map<String, Object>> mapList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class);
                 serviceTaskVO.setPreachformList(mapList);
-                if(ObjectUtils.isNotEmpty(serviceTask.getTaskid())){
+                if (ObjectUtils.isNotEmpty(serviceTask.getTaskid())) {
                     ServiceTaskoper operVo = new ServiceTaskoper();
                     operVo.setTaskId(serviceTask.getTaskid());
                     operVo.setOrgid(serviceTask.getOrgid());
                     List<ServiceTaskoper> serviceTaskopers = serviceTaskoperService.selectServiceTaskoperList(operVo);
-                    if(ObjectUtils.isNotEmpty(serviceTaskopers)){
+                    if (ObjectUtils.isNotEmpty(serviceTaskopers)) {
                         serviceTaskVO.setOplevelcode(serviceTaskopers.get(0).getOplevelcode());
                     }
                 }
@@ -231,12 +230,12 @@
         serviceTaskVO.setShowTimeNoon(serviceTask.getShowTimeNoon());
         serviceTaskVO.setShowTimeNight(serviceTask.getShowTimeNight());
         serviceTaskVO.setPreachform(serviceTask.getPreachform());
-        if(ObjectUtils.isNotEmpty(serviceTask.getTaskid())){
+        if (ObjectUtils.isNotEmpty(serviceTask.getTaskid())) {
             ServiceTaskoper operVo = new ServiceTaskoper();
             operVo.setTaskId(serviceTask.getTaskid());
             operVo.setOrgid(serviceTask.getOrgid());
             List<ServiceTaskoper> serviceTaskopers = serviceTaskoperService.selectServiceTaskoperList(operVo);
-            if(ObjectUtils.isNotEmpty(serviceTaskopers)){
+            if (ObjectUtils.isNotEmpty(serviceTaskopers)) {
                 serviceTaskVO.setOplevelcode(serviceTaskopers.get(0).getOplevelcode());
             }
         }
@@ -273,7 +272,7 @@
                 patTaskRelevance.setDiagname(serviceSubtask1.getLeavediagname());
                 patTaskRelevance.setPatid(serviceSubtask1.getPatid());
                 patTaskRelevance.setSendStatus(serviceSubtask1.getSendstate());
-                patTaskRelevance.setDeptCode(serviceSubtask1.getDeptcode());
+                patTaskRelevance.setDeptcode(serviceSubtask1.getDeptcode());
                 patTaskRelevance.setDeptName(serviceSubtask1.getDeptname());
                 patTaskRelevance.setLeavehospitaldistrictcode(serviceSubtask1.getLeavehospitaldistrictcode());
                 patTaskRelevance.setLeavehospitaldistrictname(serviceSubtask1.getLeavehospitaldistrictname());
@@ -295,7 +294,7 @@
                 patTaskRelevance.setFinishtime(serviceSubtask1.getFinishtime());
                 patTaskRelevance.setAddr(serviceSubtask1.getAddr());
                 patTaskRelevance.setDeptName(serviceSubtask1.getDeptname());
-                patTaskRelevance.setDeptCode(serviceSubtask1.getDeptcode());
+                patTaskRelevance.setDeptcode(serviceSubtask1.getDeptcode());
                 patTaskRelevance.setBedNo(serviceSubtask1.getBedNo());
                 patTaskRelevance.setDiagname(serviceSubtask1.getLeavediagname());
                 patTaskRelevance.setPatid(serviceSubtask1.getPatid());
@@ -577,6 +576,15 @@
             if (StringUtils.isNotEmpty(serviceTaskVO.getLibtemplateid())) {
                 serviceTask.setLibtemplateid(serviceTaskVO.getLibtemplateid());
                 serviceTask.setLibtemplatename(serviceTaskVO.getLibtemplatename());
+            }else {
+                if (ObjectUtils.isNotEmpty(serviceTaskVO.getSvyTaskTemplateVO())) {
+                    serviceTask.setLibtemplateid(""+serviceTaskVO.getSvyTaskTemplateVO().getTemplateid());
+                    serviceTask.setLibtemplatename(""+serviceTaskVO.getLibtemplatename());
+                }
+                if (ObjectUtils.isNotEmpty(serviceTaskVO.getIvrTaskTemplateVO())) {
+                    serviceTask.setLibtemplateid(""+serviceTaskVO.getIvrTaskTemplateVO().getLibtemplateid());
+                    serviceTask.setLibtemplatename(""+serviceTaskVO.getIvrTaskTemplateVO().getLibtemplatename());
+                }
             }
             if (serviceTaskVO.getTemplateid() != null) {
                 serviceTask.setTemplateid(serviceTaskVO.getTemplateid());
@@ -672,8 +680,8 @@
             serviceSubtask.setTaskid(serviceTask.getTaskid().longValue());
             serviceSubtask.setTemplatename(tempName);
             serviceSubtask.setTemplateid(tempid);
-            serviceSubtask.setLibtemplateid(ObjectUtils.isEmpty(serviceTaskVO.getLibtemplateid()) ? null : Long.valueOf(serviceTaskVO.getLibtemplateid()));
-            serviceSubtask.setLibtemplatename(serviceTaskVO.getLibtemplatename());
+            serviceSubtask.setLibtemplateid(ObjectUtils.isEmpty(serviceTask.getLibtemplateid()) ? null : Long.valueOf(serviceTask.getLibtemplateid()));
+            serviceSubtask.setLibtemplatename(serviceTask.getLibtemplatename());
             //鏂板
             if (CollectionUtils.isNotEmpty(serviceTaskVO.getPatTaskRelevances())) {
                 for (PatTaskRelevance patTaskRelevance : serviceTaskVO.getPatTaskRelevances()) {
@@ -690,7 +698,7 @@
                     serviceSubtask.setSendstate(1L);
                     if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
                         serviceSubtask.setSendstate(2L);
-                    serviceSubtask.setDeptcode(patTaskRelevance.getDeptCode());
+                    serviceSubtask.setDeptcode(patTaskRelevance.getDeptcode());
                     serviceSubtask.setDeptname(patTaskRelevance.getDeptName());
                     serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode());
                     serviceSubtask.setLeavehospitaldistrictname(patTaskRelevance.getLeavehospitaldistrictname());
@@ -930,7 +938,7 @@
                     serviceSubtask.setAddr(patTaskRelevance.getAddr());
                     serviceSubtask.setPatid(patTaskRelevance.getPatid());
                     serviceSubtask.setOpenid(patTaskRelevance.getOpenid());
-                    serviceSubtask.setDeptcode(patTaskRelevance.getDeptCode());
+                    serviceSubtask.setDeptcode(patTaskRelevance.getDeptcode());
                     serviceSubtask.setLeavehospitaldistrictname(patTaskRelevance.getLeavehospitaldistrictname());
                     serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode());
                     serviceSubtask.setDeptname(patTaskRelevance.getDeptName());
@@ -1332,7 +1340,7 @@
                     ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(phoneCallReqYQVO.getTaskid()));
                     //璁板綍鐢佃瘽鍙戦�佺姸鎬�
                     setFailPreachForm(serviceSubtask, "3", "閫氳瘽姝e父缁撴潫", "9");
-                    //鍒犻櫎缁撴潫璇殑鎮e瓨
+                    //鍒犻櫎缁撴潫璇殑缂撳瓨
                     redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "- jsy");
                 } else {
                     redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", true, 120, TimeUnit.MINUTES);
@@ -1548,6 +1556,53 @@
                         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());
+                            subtaskDetailTrace.setPatdesc(serviceSubtask.getSendname() + "," + serviceSubtask.getPhone() + "," + serviceSubtask.getDeptname());
+                            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());
@@ -2070,7 +2125,7 @@
                     //璁剧疆涓�涓嬮棶棰樺垎绫�
                     IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
                     if (ivrTaskTemplateScript != null)
-                        serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getAssortid());
+                        serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getScriptAssortid());
                 }
 
                 serviceSubtaskDetail.setSubId(selectServiceSubtaskList.get(0).getId());
@@ -2088,7 +2143,7 @@
                         //璁剧疆涓�涓嬮棶棰樺垎绫�
                         IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
                         if (ivrTaskTemplateScript != null)
-                            serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getAssortid());
+                            serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getScriptAssortid());
                     }
                     serviceSubtaskDetail.setCreateTime(new Date());
                     serviceSubtaskDetail.setGuid(serviceSubTaskDetailReq.getGuid());
@@ -2539,7 +2594,7 @@
                     ivrTaskTemplateScript.setTemplateID(templateid);
                     ivrTaskTemplateScript.setOrgid(serviceTask.getOrgid());
                     //鍏堥粯璁や负1鍚э紝assortid=1  浠h〃鏄弧鎰忓害
-                    ivrTaskTemplateScript.setAssortid(ivrCategoryid);
+                    ivrTaskTemplateScript.setScriptAssortid(ivrCategoryid);
                     List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
                     if (CollectionUtils.isNotEmpty(ivrTaskTemplateScripts)) {
                         //闇�瑕佸厛璁$畻鍑哄彂閫侀噺锛屽啀涔樹互鍗曚釜闂埜婊℃剰搴﹂鐩暟閲忥紝寰楀埌婊℃剰搴﹂鐩�婚噺锛堝寘鍚簡鏈仛鐨勶級
@@ -3231,7 +3286,7 @@
                 if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6)) {
                     serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
                 }
-                if (serviceSubtask.getSendstate() != null &&  (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
+                if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
                     serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
                 }
                 if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
@@ -3349,7 +3404,7 @@
                 if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6)) {
                     serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
                 }
-                if (serviceSubtask.getSendstate() != null &&  (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
+                if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
                     serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
                 }
                 if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
@@ -3438,7 +3493,7 @@
         serviceSubtaskDetail.setAssigntime(System.currentTimeMillis());
         serviceSubtaskDetail.setStarttime(System.currentTimeMillis());
         serviceSubtaskDetail.setAnswertime(System.currentTimeMillis());
-        serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScriptVO.getAssortid());
+        serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScriptVO.getScriptAssortid());
         serviceSubtaskDetail.setAsrtext("鏃犲簲绛�");
         if (StringUtils.isNotEmpty(phoneCallReqYQVO.getAsrtext()))
             serviceSubtaskDetail.setAsrtext(phoneCallReqYQVO.getAsrtext());
@@ -3453,11 +3508,13 @@
         serviceSubtaskDetail.setTargetoptions(ivrTaskTemplateScriptVO.getTargetOptions());
         serviceSubtaskDetail.setExtemplateText(ivrTaskTemplateScriptVO.getExtemplateText());
         serviceSubtaskDetail.setScriptid(ivrTaskTemplateScriptVO.getId());
+        serviceSubtaskDetail.setLibTemplateid(serviceSubtask.getLibtemplateid() != null ? serviceSubtask.getLibtemplateid().intValue() : null);
 
         int i = 1;
         for (IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption : ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()) {
             if (ivrTaskTemplateTargetoption.getIsUserOperation() == 1) {
                 serviceSubtaskDetail.setMatchedtext(ivrTaskTemplateTargetoption.getTargetvalue());
+                serviceSubtaskDetail.setScore(ivrTaskTemplateTargetoption.getScore() != null ? ivrTaskTemplateTargetoption.getScore().toString() : "0");
             }
             serviceSubtaskDetail.setTargetvalue(StringUtils.isEmpty(serviceSubtaskDetail.getTargetvalue()) ? ivrTaskTemplateTargetoption.getTargetvalue() : serviceSubtaskDetail.getTargetvalue() + "&" + ivrTaskTemplateTargetoption.getTargetvalue());
         }
@@ -3788,6 +3845,7 @@
             }
         }
 
+        //灏界澶辫触锛岃繖閲屼篃灏嗗綋鍓嶅彂閫佹柟寮忕户缁缃垚鈥滅數璇濃�濓紝sendstate璁剧疆鎴�3锛涘洜涓簉yTask閲岀殑琛ュ伩鐨勫畾鏃朵换鍔¤繍琛屾椂锛屼細鎵惧埌杩欐潯subtask锛屽苟杩涜澶勭悊
         serviceSubtask.setCurrentPreachform(preachform);
         serviceSubtask.setSendstate(3L);
         //濡傛灉绛変簬9锛屽垯璇存槑鐢佃瘽姝e父缁撴潫浜�
@@ -3948,7 +4006,7 @@
         }).collect(Collectors.toList());
     }
 
-    public Map<String, Object> getCurrentUserServiceSubtaskCount(ServiceSubtaskEntity entity){
+    public Map<String, Object> getCurrentUserServiceSubtaskCount(ServiceSubtaskEntity entity) {
         return serviceSubtaskMapper.getCurrentUserServiceSubtaskCount(entity);
     }
 }
diff --git a/smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java
index 1fab7ca..6f5ee13 100644
--- a/smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java
@@ -3,6 +3,7 @@
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DtoConversionUtils;
+import com.smartor.common.PinYinUtil;
 import com.smartor.domain.IvrLibaTargetAssort;
 import com.smartor.domain.SvyLibScriptCategory;
 import com.smartor.domain.SvyLibScriptCategoryVO;
@@ -50,23 +51,7 @@
     @Override
     public List<SvyLibScriptCategoryVO> selectSvyLibScriptCategoryList(SvyLibScriptCategory svyLibScriptCategory) {
         List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory);
-////        //灏唒id涓虹┖鐨勶紝杩囨护鎺�
-//        svyLibScriptCategories = svyLibScriptCategories.stream().filter(assort -> assort.getPid() == null).collect(Collectors.toList());
-//
-//        List<SvyLibScriptCategoryVO> SvyLibScriptCategoryVO = DtoConversionUtils.sourceToTarget(svyLibScriptCategories, SvyLibScriptCategoryVO.class);
-//        //閬嶅巻鏌ュ嚭鏉ョ殑鏁版嵁锛岄�氳繃 id=pid 鑾峰彇浠栦滑鐨勫瓙鏁版嵁
-//        for (SvyLibScriptCategoryVO svyLibScriptCategoryVO : SvyLibScriptCategoryVO) {
-//            if (svyLibScriptCategoryVO.getPid() != null) {
-//                continue;
-//            }
-//            SvyLibScriptCategory svyLibScriptCategory1 = new SvyLibScriptCategory();
-//            svyLibScriptCategory1.setPid(svyLibScriptCategoryVO.getId());
-//            List<SvyLibScriptCategory> svyLibScriptCategories1 = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory1);
-//            if (!Collections.isEmpty(svyLibScriptCategories1)) {
-//                svyLibScriptCategoryVO.setSvyLibScriptCategoryList(svyLibScriptCategories1);
-//            }
-//        }
-  List<SvyLibScriptCategoryVO> svyLibScriptCategoryVOS = DtoConversionUtils.sourceToTarget(svyLibScriptCategories, SvyLibScriptCategoryVO.class);
+        List<SvyLibScriptCategoryVO> svyLibScriptCategoryVOS = DtoConversionUtils.sourceToTarget(svyLibScriptCategories, SvyLibScriptCategoryVO.class);
 
         List<SvyLibScriptCategoryVO> rootList = new ArrayList<>();
         Map<Long, SvyLibScriptCategoryVO> categoryMap = new HashMap<>();
@@ -76,7 +61,7 @@
             categoryMap.put(category.getId(), category);
         }
 
-            for (SvyLibScriptCategoryVO category : svyLibScriptCategoryVOS) {
+        for (SvyLibScriptCategoryVO category : svyLibScriptCategoryVOS) {
             if (category.getPid() == null || category.getPid() == -1) {
                 // 椤跺眰鑺傜偣
                 rootList.add(category);
@@ -113,6 +98,9 @@
     @Override
     public int updateSvyLibScriptCategory(SvyLibScriptCategory svyLibScriptCategory) {
         svyLibScriptCategory.setUpdateTime(DateUtils.getNowDate());
+        if (svyLibScriptCategory.getName() != null && svyLibScriptCategory.getName().contains("婊℃剰搴�") && svyLibScriptCategory.getPid() != -1) {
+            svyLibScriptCategory.setType(PinYinUtil.getpy(svyLibScriptCategory.getName()));
+        }
         return svyLibScriptCategoryMapper.updateSvyLibScriptCategory(svyLibScriptCategory);
     }
 
@@ -165,6 +153,9 @@
         svyLibScriptCategory.setUpdateTime(new Date());
         svyLibScriptCategory.setCreateTime(new Date());
         if (svyLibScriptCategory.getPid() == null) svyLibScriptCategory.setPid((long) -1);
+        if (svyLibScriptCategory.getName() != null && svyLibScriptCategory.getName().contains("婊℃剰搴�") && svyLibScriptCategory.getPid() != -1) {
+            svyLibScriptCategory.setType(PinYinUtil.getpy(svyLibScriptCategory.getName()));
+        }
         i = svyLibScriptCategoryMapper.insertSvyLibScriptCategory(svyLibScriptCategory);
         log.info("闂璇濇湳鍒嗙被搴撲竴绾ф爲鐨勪富閿�:{}", svyLibScriptCategory.getId());
 
@@ -182,6 +173,10 @@
                 if (seqMax1 != null) {
                     svyLibScriptCategory1.setSeqno(seqMax1 + 1);
                 }
+                if (svyLibScriptCategory1.getName() != null && svyLibScriptCategory1.getName().contains("婊℃剰搴�")) {
+                    svyLibScriptCategory1.setType(PinYinUtil.getpy(svyLibScriptCategory1.getName()));
+                }
+
                 svyLibScriptCategory1.setGuid(svyLibScriptCategoryVO.getGuid());
                 svyLibScriptCategory1.setOrgid(svyLibScriptCategoryVO.getOrgid());
                 svyLibScriptCategoryMapper.insertSvyLibScriptCategory(svyLibScriptCategory1);
diff --git a/smartor/src/main/java/com/smartor/service/impl/SvyLibTemplateServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/SvyLibTemplateServiceImpl.java
index 947dac7..4dee0f7 100644
--- a/smartor/src/main/java/com/smartor/service/impl/SvyLibTemplateServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/SvyLibTemplateServiceImpl.java
@@ -35,6 +35,8 @@
     @Autowired
     private SvyLibTemplateTagMapper svyLibTemplateTagMapper;
     @Autowired
+    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
+    @Autowired
     private Icd10AssociationMapper icd10AssociationMapper;
 
     /**
@@ -182,6 +184,13 @@
             for (SvyLibTemplateScript svyLibScript : svyLibTemplate.getSvyTemplateLibScripts()) {
                 svyLibScript.setGuid(svyLibTemplateVO.getGuid());
                 svyLibScript.setOrgid(svyLibTemplateVO.getOrgid());
+                //鑾峰彇涓�涓嬪垎绫诲悕绉�
+                if(StringUtils.isEmpty(svyLibScript.getCategoryName())){
+                    SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(svyLibScript.getCategoryid());
+                    if(svyLibScriptCategory != null) svyLibScript.setCategoryName(svyLibScriptCategory.getName());
+                }
+
+
                 //瀵归鐩繘琛屽鐞�
                 if (svyLibScript.getIsoperation() != null) {
                     //闂鐨勬搷浣滀笉涓虹┖
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaScriptAssortMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaScriptAssortMapper.xml
index 1cf778f..26955c1 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaScriptAssortMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaScriptAssortMapper.xml
@@ -14,23 +14,36 @@
         <result property="seqno" column="seqno"/>
         <result property="guid" column="guid"/>
         <result property="orgid" column="orgid"/>
+        <result property="type" column="type"/>
     </resultMap>
 
     <sql id="selectIvrLibaScriptAssortVo">
-        select id, index_assort_name, guid, orgid,del_flag, create_time, update_time, pid, seqno
+        select id,
+               index_assort_name,
+               guid,
+               orgid,
+               del_flag,
+               create_time,
+               update_time,
+               pid,
+               seqno,
+               type
         from ivr_liba_script_assort
     </sql>
 
     <select id="selectIvrLibaScriptAssortList" parameterType="com.smartor.domain.IvrLibaScriptAssort"
             resultMap="IvrLibaScriptAssortResult">
         <include refid="selectIvrLibaScriptAssortVo"/>
-        where 1=1
-            <if test="indexAssortName != null  and indexAssortName != ''">and index_assort_name like concat('%',
-                #{indexAssortName}, '%')
-            </if>
-            <if test="pid != null ">and pid = #{pid}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            and del_flag=0
+        where del_flag=0
+        <if test="indexAssortName != null  and indexAssortName != ''">and index_assort_name like concat('%',
+            #{indexAssortName}, '%')
+        </if>
+        <if test="type != null  and type != ''">and type like concat('%',
+            #{type}, '%')
+        </if>
+        <if test="pid != null ">and pid = #{pid}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        and del_flag=0
         order by seqno asc
     </select>
 
@@ -57,6 +70,7 @@
             <if test="seqno != null">seqno,</if>
             <if test="guid != null">guid,</if>
             <if test="orgid != null">orgid,</if>
+            <if test="type != null">type,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="indexAssortName != null and indexAssortName != ''">#{indexAssortName},</if>
@@ -67,6 +81,7 @@
             <if test="seqno != null">#{seqno},</if>
             <if test="guid != null">#{guid},</if>
             <if test="orgid != null">#{orgid},</if>
+            <if test="type != null">#{type},</if>
         </trim>
     </insert>
 
@@ -81,6 +96,7 @@
             <if test="seqno != null">seqno = #{seqno},</if>
             <if test="guid != null">guid = #{guid},</if>
             <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="type != null">type = #{type},</if>
         </trim>
         where id = #{id}
     </update>
@@ -88,7 +104,7 @@
     <update id="deleteIvrLibaScriptAssortById" parameterType="Long">
         update ivr_liba_script_assort
         <trim prefix="SET" suffixOverrides=",">
-           del_flag = 1
+            del_flag = 1
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml
index 7878f0a..20de24c 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml
@@ -37,12 +37,14 @@
         <result property="appenddesc" column="appenddesc"/>
         <result property="picturePath" column="picture_path"/>
         <result property="isEnd" column="is_end"/>
+        <result property="isException" column="is_exception"/>
     </resultMap>
 
     <sql id="selectIvrLibaScriptTargetoptionVo">
         select id,
                targetid,
                is_end,
+               is_exception,
                picture_path,
                targetname,
                appendflag,
@@ -92,6 +94,7 @@
             <if test="appendflag != null">and appendflag = #{appendflag}</if>
             <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
             <if test="picturePath != null">and picture_path = #{picturePath}</if>
+            <if test="isException != null">and is_exception = #{isException}</if>
     </select>
 
     <select id="selectIvrLibaScriptTargetoptionByTargetoptionid" parameterType="String"
@@ -135,6 +138,7 @@
             <if test="appenddesc != null">appenddesc,</if>
             <if test="picturePath != null">picture_path,</if>
             <if test="isEnd != null ">is_end,</if>
+            <if test="isException != null ">is_exception,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -169,6 +173,7 @@
             <if test="appenddesc != null">#{appenddesc},</if>
             <if test="picturePath != null">#{picturePath},</if>
             <if test="isEnd != null ">#{isEnd},</if>
+            <if test="isException != null ">#{isException},</if>
         </trim>
     </insert>
 
@@ -206,6 +211,7 @@
             <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
             <if test="picturePath != null">picture_path = #{picturePath},</if>
             <if test="isEnd != null ">is_end = #{isEnd},</if>
+            <if test="isException != null ">is_exception = #{isException},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
index b7163f5..0231b76 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
@@ -22,7 +22,7 @@
         <result property="submoduleVoice" column="submoduleVoice"/>
         <result property="noClearlyText" column="noClearlyText"/>
         <result property="noClearlyVoice" column="noClearlyVoice"/>
-        <result property="categoryName" column="categoryName"/>
+        <result property="scriptAssortname" column="script_assortname"/>
         <result property="playWavOnly" column="playWavOnly"/>
         <result property="valueType" column="value_type"/>
         <result property="delFlag" column="del_flag"/>
@@ -48,14 +48,23 @@
         <result property="sort" column="sort"/>
         <result property="score" column="score"/>
         <result property="groupName" column="group_name"/>
-        <result property="assortid" column="assortid"/>
+        <result property="scriptAssortid" column="script_assortid"/>
+        <result property="dutyDeptName" column="duty_dept_name"/>
+        <result property="dutyDeptCode" column="duty_dept_code"/>
+        <result property="reportDeptCode" column="report_dept_name"/>
+        <result property="reportDeptName" column="report_dept_code"/>
     </resultMap>
 
     <sql id="selectIvrLibaTemplateScriptVo">
         select id,
                scriptno,
                sort,
-               assortid,
+               script_assortname,
+               duty_dept_name,
+               duty_dept_code,
+               report_dept_name,
+               report_dept_code,
+               script_assortid,
                group_name,
                branch_flag,
                branch_nextscriptno,
@@ -75,7 +84,6 @@
                submoduleVoice,
                noClearlyText,
                noClearlyVoice,
-               categoryName,
                targetid,
                value_type,
                targetvalue,
@@ -101,50 +109,64 @@
     <select id="selectIvrLibaTemplateScriptList" parameterType="com.smartor.domain.IvrLibaTemplateScript"
             resultMap="IvrLibaTemplateScriptResult">
         <include refid="selectIvrLibaTemplateScriptVo"/>
-        where 1=1
-            and del_flag = 0
-            <if test="scriptno != null ">and scriptno = #{scriptno}</if>
-            <if test="assortid != null ">and assortid = #{assortid}</if>
-            <if test="groupName != null ">and group_name = #{groupName}</if>
-            <if test="scriptDesc != null ">and script_desc = #{scriptDesc}</if>
-            <if test="templateid != null ">and templateid = #{templateid}</if>
-            <if test="scriptPoint != null  and scriptPoint != ''">and script_point = #{scriptPoint}</if>
-            <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
-            <if test="ivrVoice != null  and ivrVoice != ''">and ivr_voice = #{ivrVoice}</if>
-            <if test="ivrtext != null  and ivrtext != ''">and ivrtext = #{ivrtext}</if>
-            <if test="noMatchText != null  and noMatchText != ''">and noMatchText = #{noMatchText}</if>
-            <if test="noMatchVoice != null  and noMatchVoice != ''">and noMatchVoice = #{noMatchVoice}</if>
-            <if test="slienceText != null  and slienceText != ''">and slienceText = #{slienceText}</if>
-            <if test="slienceVoice != null  and slienceVoice != ''">and slienceVoice = #{slienceVoice}</if>
-            <if test="submoduleText != null  and submoduleText != ''">and submoduleText = #{submoduleText}</if>
-            <if test="submoduleVoice != null  and submoduleVoice != ''">and submoduleVoice = #{submoduleVoice}</if>
-            <if test="noClearlyText != null  and noClearlyText != ''">and noClearlyText = #{noClearlyText}</if>
-            <if test="noClearlyVoice != null  and noClearlyVoice != ''">and noClearlyVoice = #{noClearlyVoice}</if>
-            <if test="nextScriptno != null  and nextScriptno != ''">and next_scriptno = #{nextScriptno}</if>
-            <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
-            <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
-                #{branchNextscriptno}
-            </if>
-            <if test="categoryName != null  and categoryName != ''">and categoryName like concat('%', #{categoryName},
-                '%')
-            </if>
-            <if test="scriptTopic != null  and scriptTopic != ''">and script_topic like concat('%',
-                #{scriptTopic},
-                '%')
-            </if>
-            <if test="playWavOnly != null ">and playWavOnly = #{playWavOnly}</if>
-            <if test="valueType != null ">and value_type = #{valueType}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="pid != null ">and pid = #{pid}</if>
-            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
-            <if test="targetid != null ">and targetid = #{targetid}</if>
-            <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
-            <if test="isMust != null  and isMust != ''">and is_must = #{isMust}</if>
-            <if test="scriptType != null">and script_type = #{scriptType}</if>
-            <if test="sort != null">and sort = #{sort}</if>
-            <if test="score != null">and score = #{score}</if>
+        where del_flag = 0
+        <if test="scriptno != null ">and scriptno = #{scriptno}</if>
+        <if test="scriptAssortid != null ">and script_assortid = #{scriptAssortid}</if>
+        <if test="groupName != null ">and group_name = #{groupName}</if>
+        <if test="scriptDesc != null ">and script_desc = #{scriptDesc}</if>
+        <if test="templateid != null ">and templateid = #{templateid}</if>
+        <if test="scriptPoint != null  and scriptPoint != ''">and script_point = #{scriptPoint}</if>
+        <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
+        <if test="ivrVoice != null  and ivrVoice != ''">and ivr_voice = #{ivrVoice}</if>
+        <if test="ivrtext != null  and ivrtext != ''">and ivrtext = #{ivrtext}</if>
+        <if test="noMatchText != null  and noMatchText != ''">and noMatchText = #{noMatchText}</if>
+        <if test="noMatchVoice != null  and noMatchVoice != ''">and noMatchVoice = #{noMatchVoice}</if>
+        <if test="slienceText != null  and slienceText != ''">and slienceText = #{slienceText}</if>
+        <if test="slienceVoice != null  and slienceVoice != ''">and slienceVoice = #{slienceVoice}</if>
+        <if test="submoduleText != null  and submoduleText != ''">and submoduleText = #{submoduleText}</if>
+        <if test="submoduleVoice != null  and submoduleVoice != ''">and submoduleVoice = #{submoduleVoice}</if>
+        <if test="noClearlyText != null  and noClearlyText != ''">and noClearlyText = #{noClearlyText}</if>
+        <if test="noClearlyVoice != null  and noClearlyVoice != ''">and noClearlyVoice = #{noClearlyVoice}</if>
+        <if test="nextScriptno != null  and nextScriptno != ''">and next_scriptno = #{nextScriptno}</if>
+        <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
+        <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
+            #{branchNextscriptno}
+        </if>
+        <if test="scriptAssortname != null  and scriptAssortname != ''">and script_assortname like concat('%',
+            #{scriptAssortname},
+            '%')
+        </if>
+        <if test="dutyDeptName != null  and dutyDeptName != ''">and duty_dept_name like concat('%', #{dutyDeptName},
+            '%')
+        </if>
+        <if test="dutyDeptCode != null  and dutyDeptCode != ''">and duty_dept_code like concat('%', #{dutyDeptCode},
+            '%')
+        </if>
+        <if test="reportDeptName != null  and reportDeptName != ''">and report_dept_name like concat('%',
+            #{reportDeptName},
+            '%')
+        </if>
+        <if test="reportDeptCode != null  and reportDeptCode != ''">and report_dept_code like concat('%',
+            #{reportDeptCode},
+            '%')
+        </if>
+        <if test="scriptTopic != null  and scriptTopic != ''">and script_topic like concat('%',
+            #{scriptTopic},
+            '%')
+        </if>
+        <if test="playWavOnly != null ">and playWavOnly = #{playWavOnly}</if>
+        <if test="valueType != null ">and value_type = #{valueType}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="pid != null ">and pid = #{pid}</if>
+        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
+        <if test="targetid != null ">and targetid = #{targetid}</if>
+        <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
+        <if test="isMust != null  and isMust != ''">and is_must = #{isMust}</if>
+        <if test="scriptType != null">and script_type = #{scriptType}</if>
+        <if test="sort != null">and sort = #{sort}</if>
+        <if test="score != null">and score = #{score}</if>
     </select>
 
     <select id="selectIvrLibaTemplateScriptByID" parameterType="Long" resultMap="IvrLibaTemplateScriptResult">
@@ -171,7 +193,7 @@
             <if test="submoduleVoice != null">submoduleVoice,</if>
             <if test="noClearlyText != null">noClearlyText,</if>
             <if test="noClearlyVoice != null">noClearlyVoice,</if>
-            <if test="categoryName != null">categoryName,</if>
+            <if test="scriptAssortname != null">script_assortname,</if>
             <if test="playWavOnly != null">playWavOnly,</if>
             <if test="valueType != null">value_type,</if>
             <if test="delFlag != null and delFlag != ''">del_flag,</if>
@@ -198,7 +220,11 @@
             <if test="score != null ">score,</if>
             <if test="ivrtext != null ">ivrtext,</if>
             <if test="groupName != null ">group_name,</if>
-            <if test="assortid != null ">assortid,</if>
+            <if test="scriptAssortid != null ">script_assortid,</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name,</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code,</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name,</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="scriptno != null">#{scriptno},</if>
@@ -215,7 +241,7 @@
             <if test="submoduleVoice != null">#{submoduleVoice},</if>
             <if test="noClearlyText != null">#{noClearlyText},</if>
             <if test="noClearlyVoice != null">#{noClearlyVoice},</if>
-            <if test="categoryName != null">#{categoryName},</if>
+            <if test="scriptAssortname != null">#{scriptAssortname},</if>
             <if test="playWavOnly != null">#{playWavOnly},</if>
             <if test="valueType != null">#{valueType},</if>
             <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
@@ -242,7 +268,11 @@
             <if test="score != null ">#{score},</if>
             <if test="ivrtext != null ">#{ivrtext},</if>
             <if test="groupName != null ">#{groupName},</if>
-            <if test="assortid != null ">#{assortid},</if>
+            <if test="scriptAssortid != null ">#{scriptAssortid},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">#{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">#{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">#{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
         </trim>
     </insert>
 
@@ -263,7 +293,7 @@
             <if test="submoduleVoice != null">submoduleVoice = #{submoduleVoice},</if>
             <if test="noClearlyText != null">noClearlyText = #{noClearlyText},</if>
             <if test="noClearlyVoice != null">noClearlyVoice = #{noClearlyVoice},</if>
-            <if test="categoryName != null">categoryName = #{categoryName},</if>
+            <if test="scriptAssortname != null">script_assortname = #{scriptAssortname},</if>
             <if test="playWavOnly != null">playWavOnly = #{playWavOnly},</if>
             <if test="valueType != null">value_type = #{valueType},</if>
             <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
@@ -288,10 +318,14 @@
             <if test="branchFlag != null  and branchFlag != ''">branch_flag = #{branchFlag},</if>
             <if test="score != null ">score = #{score},</if>
             <if test="groupName != null ">group_name = #{groupName},</if>
-            <if test="assortid != null ">assortid = #{assortid},</if>
+            <if test="scriptAssortid != null ">script_assortid = #{scriptAssortid},</if>
             <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno =
                 #{branchNextscriptno},
             </if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name = #{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code = #{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name = #{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code = #{reportDeptCode},</if>
         </trim>
         where id = #{id}
     </update>
@@ -309,5 +343,17 @@
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
+
     </delete>
+
+    <select id="queryLibTemplateIds" resultMap="IvrLibaTemplateScriptResult">
+        <include refid="selectIvrLibaTemplateScriptVo"/>
+        where del_flag=0
+        <if test="scriptAssortids != null and scriptAssortids.size > 0">
+        and script_assortid in
+        <foreach item="scriptAssortid" collection="scriptAssortids" open="(" separator="," close=")">
+            #{scriptAssortid}
+        </foreach>
+        </if>
+    </select>
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
index 38d04c6..caef2dd 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
@@ -41,11 +41,13 @@
         <result property="isEnd" column="is_end"/>
         <result property="sendTaskid" column="send_taskid"/>
         <result property="sendTaskname" column="send_taskname"/>
+        <result property="isException" column="is_exception"/>
     </resultMap>
 
     <sql id="selectIvrLibaTemplateTargetoptionVo">
         select id,
                targetid,
+               is_exception,
                send_taskid,
                send_taskname,
                is_end,
@@ -75,6 +77,7 @@
         where 1=1
             and del_flag = 0
             <if test="targetid != null ">and targetid = #{targetid}</if>
+            <if test="isException != null ">and is_exception = #{isException}</if>
             <if test="isEnd != null ">and is_end = #{isEnd}</if>
             <if test="score != null ">and score = #{score}</if>
             <if test="targetname != null ">and targetname = #{targetname}</if>
@@ -150,6 +153,7 @@
             <if test="isEnd != null ">is_end,</if>
             <if test="sendTaskid != null">send_taskid,</if>
             <if test="sendTaskname != null">send_taskname,</if>
+            <if test="isException != null">is_exception,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="targetid != null">#{targetid},</if>
@@ -186,6 +190,7 @@
             <if test="isEnd != null ">#{isEnd},</if>
             <if test="sendTaskid != null">#{sendTaskid},</if>
             <if test="sendTaskname != null">#{sendTaskname},</if>
+            <if test="isException != null">#{isException},</if>
         </trim>
     </insert>
 
@@ -226,6 +231,7 @@
             <if test="isEnd != null ">is_end = #{isEnd},</if>
             <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
             <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
+            <if test="isException != null">is_exception = #{isException},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
index e55dd25..f84aca6 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
@@ -17,7 +17,7 @@
         <result property="submoduleVoice" column="submoduleVoice"/>
         <result property="noClearlyText" column="noClearlyText"/>
         <result property="noClearlyVoice" column="noClearlyVoice"/>
-        <result property="categoryName" column="categoryName"/>
+        <result property="scriptAssortname" column="script_assortname"/>
         <result property="targetOptions" column="targetOptions"/>
         <result property="language" column="language"/>
         <result property="playWavOnly" column="playWavOnly"/>
@@ -48,13 +48,21 @@
         <result property="ivrtext" column="ivrtext"/>
         <result property="groupName" column="group_name"/>
         <result property="scriptTopic" column="script_topic"/>
-        <result property="assortid" column="assortid"/>
+        <result property="scriptAssortid" column="script_assortid"/>
+        <result property="dutyDeptName" column="duty_dept_name"/>
+        <result property="dutyDeptCode" column="duty_dept_code"/>
+        <result property="reportDeptCode" column="report_dept_name"/>
+        <result property="reportDeptName" column="report_dept_code"/>
     </resultMap>
 
     <sql id="selectIvrTaskTemplateScriptVo">
         select id,
                taskid,
-               assortid,
+               duty_dept_name,
+               duty_dept_code,
+               report_dept_name,
+               report_dept_code,
+               script_assortid,
                sort,
                ivrtext,
                script_type,
@@ -74,7 +82,7 @@
                submoduleVoice,
                noClearlyText,
                noClearlyVoice,
-               categoryName,
+               script_assortname,
                targetOptions, language, playWavOnly, value_type, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, targettype, targetid, targetvalue, otherdata, is_must, question_result
         from ivr_task_template_script
     </sql>
@@ -83,48 +91,63 @@
             resultMap="IvrTaskTemplateScriptResult">
         <include refid="selectIvrTaskTemplateScriptVo"/>
         where 1=1
-            and del_flag = 0
-            <if test="taskid != null ">and taskid = #{taskid}</if>
-            <if test="assortid != null ">and assortid = #{assortid}</if>
-            <if test="score != null ">and score = #{score}</if>
-            <if test="scriptTopic != null ">and script_topic = #{scriptTopic}</if>
-            <if test="ivrtext != null ">and ivrtext = #{ivrtext}</if>
-            <if test="sort != null ">and sort = #{sort}</if>
-            <if test="templateID != null ">and templateID = #{templateID}</if>
-            <if test="questionPoint != null  and questionPoint != ''">and questionPoint = #{questionPoint}</if>
-            <if test="noMatchText != null  and noMatchText != ''">and noMatchText = #{noMatchText}</if>
-            <if test="noMatchVoice != null  and noMatchVoice != ''">and noMatchVoice = #{noMatchVoice}</if>
-            <if test="slienceText != null  and slienceText != ''">and slienceText = #{slienceText}</if>
-            <if test="slienceVoice != null  and slienceVoice != ''">and slienceVoice = #{slienceVoice}</if>
-            <if test="submoduleText != null  and submoduleText != ''">and submoduleText = #{submoduleText}</if>
-            <if test="submoduleVoice != null  and submoduleVoice != ''">and submoduleVoice = #{submoduleVoice}</if>
-            <if test="noClearlyText != null  and noClearlyText != ''">and noClearlyText = #{noClearlyText}</if>
-            <if test="noClearlyVoice != null  and noClearlyVoice != ''">and noClearlyVoice = #{noClearlyVoice}</if>
-            <if test="categoryName != null  and categoryName != ''">and categoryName like concat('%', #{categoryName},
-                '%')
-            </if>
-            <if test="targetOptions != null  and targetOptions != ''">and targetOptions = #{targetOptions}</if>
-            <if test="language != null  and language != ''">and language = #{language}</if>
-            <if test="playWavOnly != null ">and playWavOnly = #{playWavOnly}</if>
-            <if test="valueType != null ">and value_type = #{valueType}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="pid != null ">and pid = #{pid}</if>
-            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
-            <if test="targettype != null  and targettype != ''">and targettype = #{targettype}</if>
-            <if test="targetid != null ">and targetid = #{targetid}</if>
-            <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
-            <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
-            <if test="isMust != null  and isMust != ''">and is_must = #{isMust}</if>
-            <if test="questionResult != null  and questionResult != ''">and question_result = #{questionResult}</if>
-            <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
-            <if test="scriptType != null  and scriptType != ''">and script_type = #{scriptType}</if>
-            <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
-            <if test="nextScriptno != null  and nextScriptno != ''">and next_scriptno = #{nextScriptno}</if>
-            <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
-                #{branchNextscriptno}
-            </if>
+        and del_flag = 0
+        <if test="taskid != null ">and taskid = #{taskid}</if>
+        <if test="scriptAssortid != null ">and script_assortid = #{scriptAssortid}</if>
+        <if test="score != null ">and score = #{score}</if>
+        <if test="scriptTopic != null ">and script_topic = #{scriptTopic}</if>
+        <if test="ivrtext != null ">and ivrtext = #{ivrtext}</if>
+        <if test="sort != null ">and sort = #{sort}</if>
+        <if test="templateID != null ">and templateID = #{templateID}</if>
+        <if test="questionPoint != null  and questionPoint != ''">and questionPoint = #{questionPoint}</if>
+        <if test="noMatchText != null  and noMatchText != ''">and noMatchText = #{noMatchText}</if>
+        <if test="noMatchVoice != null  and noMatchVoice != ''">and noMatchVoice = #{noMatchVoice}</if>
+        <if test="slienceText != null  and slienceText != ''">and slienceText = #{slienceText}</if>
+        <if test="slienceVoice != null  and slienceVoice != ''">and slienceVoice = #{slienceVoice}</if>
+        <if test="submoduleText != null  and submoduleText != ''">and submoduleText = #{submoduleText}</if>
+        <if test="submoduleVoice != null  and submoduleVoice != ''">and submoduleVoice = #{submoduleVoice}</if>
+        <if test="noClearlyText != null  and noClearlyText != ''">and noClearlyText = #{noClearlyText}</if>
+        <if test="noClearlyVoice != null  and noClearlyVoice != ''">and noClearlyVoice = #{noClearlyVoice}</if>
+        <if test="scriptAssortname != null  and scriptAssortname != ''">and script_assortname like concat('%',
+            #{scriptAssortname},
+            '%')
+        </if>
+        <if test="dutyDeptName != null  and dutyDeptName != ''">and duty_dept_name like concat('%', #{dutyDeptName},
+            '%')
+        </if>
+        <if test="dutyDeptCode != null  and dutyDeptCode != ''">and duty_dept_code like concat('%', #{dutyDeptCode},
+            '%')
+        </if>
+        <if test="reportDeptName != null  and reportDeptName != ''">and report_dept_name like concat('%',
+            #{reportDeptName},
+            '%')
+        </if>
+        <if test="reportDeptCode != null  and reportDeptCode != ''">and report_dept_code like concat('%',
+            #{reportDeptCode},
+            '%')
+        </if>
+        <if test="targetOptions != null  and targetOptions != ''">and targetOptions = #{targetOptions}</if>
+        <if test="language != null  and language != ''">and language = #{language}</if>
+        <if test="playWavOnly != null ">and playWavOnly = #{playWavOnly}</if>
+        <if test="valueType != null ">and value_type = #{valueType}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="pid != null ">and pid = #{pid}</if>
+        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
+        <if test="targettype != null  and targettype != ''">and targettype = #{targettype}</if>
+        <if test="targetid != null ">and targetid = #{targetid}</if>
+        <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
+        <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
+        <if test="isMust != null  and isMust != ''">and is_must = #{isMust}</if>
+        <if test="questionResult != null  and questionResult != ''">and question_result = #{questionResult}</if>
+        <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
+        <if test="scriptType != null  and scriptType != ''">and script_type = #{scriptType}</if>
+        <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
+        <if test="nextScriptno != null  and nextScriptno != ''">and next_scriptno = #{nextScriptno}</if>
+        <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
+            #{branchNextscriptno}
+        </if>
     </select>
 
     <select id="selectIvrTaskTemplateScriptByID" parameterType="Long" resultMap="IvrTaskTemplateScriptResult">
@@ -147,7 +170,7 @@
             <if test="submoduleVoice != null">submoduleVoice,</if>
             <if test="noClearlyText != null">noClearlyText,</if>
             <if test="noClearlyVoice != null">noClearlyVoice,</if>
-            <if test="categoryName != null">categoryName,</if>
+            <if test="scriptAssortname != null">script_assortname,</if>
             <if test="targetOptions != null">targetOptions,</if>
             <if test="language != null">language,</if>
             <if test="playWavOnly != null">playWavOnly,</if>
@@ -173,11 +196,15 @@
             <if test="scriptType != null  and scriptType != ''">script_type,</if>
             <if test="scriptContent != null  and scriptContent != ''">script_content,</if>
             <if test="sort != null ">sort,</if>
-            <if test="nextScriptno != null  and nextScriptno != ''">next_scriptno,</if>
+            <if test="nextScriptno != null ">next_scriptno,</if>
             <if test="score != null ">score,</if>
             <if test="ivrtext != null ">ivrtext,</if>
             <if test="scriptTopic != null ">script_topic,</if>
-            <if test="assortid != null ">assortid,</if>
+            <if test="scriptAssortid != null ">script_assortid,</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name,</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code,</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name,</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -191,7 +218,7 @@
             <if test="submoduleVoice != null">#{submoduleVoice},</if>
             <if test="noClearlyText != null">#{noClearlyText},</if>
             <if test="noClearlyVoice != null">#{noClearlyVoice},</if>
-            <if test="categoryName != null">#{categoryName},</if>
+            <if test="scriptAssortname != null">#{scriptAssortname},</if>
             <if test="targetOptions != null">#{targetOptions},</if>
             <if test="language != null">#{language},</if>
             <if test="playWavOnly != null">#{playWavOnly},</if>
@@ -217,11 +244,15 @@
             <if test="scriptType != null  and scriptType != ''">#{scriptType},</if>
             <if test="scriptContent != null  and scriptContent != ''">#{scriptContent},</if>
             <if test="sort != null">#{sort},</if>
-            <if test="nextScriptno != null  and nextScriptno != ''">#{nextScriptno},</if>
+            <if test="nextScriptno != null">#{nextScriptno},</if>
             <if test="score != null ">#{score},</if>
             <if test="ivrtext != null ">#{ivrtext},</if>
             <if test="scriptTopic != null ">#{scriptTopic},</if>
-            <if test="assortid != null ">#{assortid},</if>
+            <if test="scriptAssortid != null ">#{scriptAssortid},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">#{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">#{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">#{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
         </trim>
     </insert>
 
@@ -239,7 +270,7 @@
             <if test="submoduleVoice != null">submoduleVoice = #{submoduleVoice},</if>
             <if test="noClearlyText != null">noClearlyText = #{noClearlyText},</if>
             <if test="noClearlyVoice != null">noClearlyVoice = #{noClearlyVoice},</if>
-            <if test="categoryName != null">categoryName = #{categoryName},</if>
+            <if test="scriptAssortname != null">script_assortname = #{scriptAssortname},</if>
             <if test="targetOptions != null">targetOptions = #{targetOptions},</if>
             <if test="language != null">language = #{language},</if>
             <if test="playWavOnly != null">playWavOnly = #{playWavOnly},</if>
@@ -267,17 +298,22 @@
             <if test="scriptType != null  and scriptType != ''">script_type = #{scriptType},</if>
             <if test="scriptContent != null  and scriptContent != ''">script_content = #{scriptContent},</if>
             <if test="sort != null">sort = #{sort},</if>
-            <if test="nextScriptno != null  and nextScriptno != ''">next_scriptno = #{nextScriptno},</if>
+            <if test="nextScriptno != null ">next_scriptno = #{nextScriptno},</if>
             <if test="score != null">score = #{score},</if>
             <if test="ivrtext != null">ivrtext = #{ivrtext},</if>
             <if test="scriptTopic != null ">script_topic = #{scriptTopic},</if>
-            <if test="assortid != null ">assortid = #{assortid},</if>
+            <if test="scriptAssortid != null ">script_assortid = #{scriptAssortid},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name = #{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code = #{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name = #{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code = #{reportDeptCode},</if>
         </trim>
         where id = #{id}
     </update>
 
     <delete id="deleteIvrTaskTemplateScriptByID" parameterType="Long">
-        update  ivr_task_template_script set del_flag=1
+        update ivr_task_template_script
+        set del_flag=1
         where ID = #{ID}
     </delete>
 
diff --git a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml
index f89d0a0..e486e3e 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml
@@ -44,11 +44,13 @@
         <result property="isEnd" column="is_end"/>
         <result property="sendTaskid" column="send_taskid"/>
         <result property="sendTaskname" column="send_taskname"/>
+        <result property="isException" column="is_exception"/>
     </resultMap>
 
     <sql id="selectIvrTaskTemplateTargetoptionVo">
         select id,
                taskid,
+               is_exception,
                send_taskid,
                send_taskname,
                is_end,
@@ -73,6 +75,7 @@
         <include refid="selectIvrTaskTemplateTargetoptionVo"/>
         where 1=1
             <if test="taskid != null ">and taskid = #{taskid}</if>
+            <if test="isException != null ">and is_exception = #{isException}</if>
             <if test="isEnd != null ">and is_end = #{isEnd}</if>
             <if test="templateID != null ">and templateID = #{templateID}</if>
             <if test="targetid != null ">and targetid = #{targetid}</if>
@@ -157,6 +160,7 @@
             <if test="isEnd != null ">is_end,</if>
             <if test="sendTaskid != null">send_taskid,</if>
             <if test="sendTaskname != null">send_taskname,</if>
+            <if test="isException != null ">is_exception,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -196,6 +200,7 @@
             <if test="isEnd != null ">#{isEnd},</if>
             <if test="sendTaskid != null">#{sendTaskid},</if>
             <if test="sendTaskname != null">#{sendTaskname},</if>
+            <if test="isException != null ">#{isException},</if>
         </trim>
     </insert>
 
@@ -239,6 +244,7 @@
             <if test="isEnd != null ">is_end = #{isEnd},</if>
             <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
             <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
+            <if test="isException != null ">is_exception = #{isException},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 39864b7..36d7089 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -370,14 +370,14 @@
         {CALL sp_query_outhosp(
                 #{outhospno,     jdbcType=VARCHAR,  mode=IN},
                 #{serialnum,     jdbcType=VARCHAR,  mode=IN},
-                #{patid,         jdbcType=BIGINT,   mode=IN},
+                #{patid,         jdbcType=INTEGER,   mode=IN},
                 #{patname,       jdbcType=VARCHAR,  mode=IN},
                 #{patno,        jdbcType=VARCHAR,  mode=IN},
                 #{hospitalname,  jdbcType=VARCHAR,  mode=IN},
                 #{hospitalcode,  jdbcType=VARCHAR,  mode=IN},
                 #{icd10code,     jdbcType=VARCHAR,  mode=IN},
                 #{diagname,      jdbcType=VARCHAR,  mode=IN},
-                #{deptid,        jdbcType=BIGINT,   mode=IN},
+                #{deptid,        jdbcType=INTEGER,   mode=IN},
                 #{deptcode,      jdbcType=VARCHAR,  mode=IN},
                 #{deptname,      jdbcType=VARCHAR,  mode=IN},
                 #{drcode,        jdbcType=VARCHAR,  mode=IN},
@@ -385,8 +385,8 @@
                 #{beginAdmitdate,jdbcType=DATE,     mode=IN},
                 #{endAdmitdate,  jdbcType=DATE,     mode=IN},
                 #{orgid,         jdbcType=VARCHAR,  mode=IN},
-                #{isupload,      jdbcType=BIGINT,   mode=IN},
-                #{schemestatus,  jdbcType=BIGINT,   mode=IN},
+                #{isupload,      jdbcType=INTEGER,   mode=IN},
+                #{schemestatus,  jdbcType=INTEGER,   mode=IN},
                 #{hpi,         jdbcType=VARCHAR,  mode=IN},
                 #{mainsuit,         jdbcType=VARCHAR,  mode=IN},
                 #{pid,   jdbcType=INTEGER,  mode=IN},
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
index c2717fc..1a09422 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -18,6 +18,7 @@
         <result property="assigntime" column="assigntime"/>
         <result property="starttime" column="starttime"/>
         <result property="answertime" column="answertime"/>
+
         <result property="silent" column="silent"/>
         <result property="dtmfKey" column="dtmf_key"/>
         <result property="musicpath" column="musicpath"/>
@@ -55,6 +56,9 @@
         <result property="patid" column="patid"/>
         <result property="guid" column="guid"/>
         <result property="extemplateText" column="extemplate_text"/>
+        <result property="templateType" column="template_type"/>
+        <result property="libTemplateid" column="lib_templateid"/>
+        <result property="score" column="score"/>
     </resultMap>
     <resultMap type="com.smartor.domain.ServiceSubtaskDetailTarget" id="ServiceSubtaskDetailTargetResult">
         <result property="targetid" column="targetid"/>
@@ -66,6 +70,7 @@
     <sql id="selectServiceSubtaskDetailVo">
         select id,
                sub_id,
+               lib_templateid,
                targetid,
                answerps,
                scriptid,
@@ -113,6 +118,8 @@
                update_by,
                update_time,
                value_type,
+               template_type,
+               score,
                create_by
         from service_subtask_detail
     </sql>
@@ -121,56 +128,79 @@
             resultMap="ServiceSubtaskDetailResult">
         <include refid="selectServiceSubtaskDetailVo"/>
         where 1=1
-            <if test="subId != null">and sub_id = #{subId}</if>
-            <if test="targetid != null">and targetid = #{targetid}</if>
-            <if test="extemplateText != null">and extemplate_text = #{extemplateText}</if>
-            <if test="taskid != null">and taskid = #{taskid}</if>
-            <if test="uuid != null  and uuid != ''">and uuid = #{uuid}</if>
-            <if test="phone != null  and phone != ''">and phone = #{phone}</if>
-            <if test="operate != null  and operate != ''">and operate = #{operate}</if>
-            <if test="displayno != null  and displayno != ''">and displayno = #{displayno}</if>
-            <if test="inbound != null ">and inbound = #{inbound}</if>
-            <if test="incoming != null ">and incoming = #{incoming}</if>
-            <if test="assigntime != null ">and assigntime = #{assigntime}</if>
-            <if test="starttime != null ">and starttime = #{starttime}</if>
-            <if test="answertime != null ">and answertime = #{answertime}</if>
-            <if test="silent != null ">and silent = #{silent}</if>
-            <if test="dtmfKey != null  and dtmfKey != ''">and dtmf_key = #{dtmfKey}</if>
-            <if test="musicpath != null  and musicpath != ''">and musicpath = #{musicpath}</if>
-            <if test="sentIndex != null ">and sent_index = #{sentIndex}</if>
-            <if test="sentBegin != null ">and sent_begin = #{sentBegin}</if>
-            <if test="asrtext != null  and asrtext != ''">and asrtext = #{asrtext}</if>
-            <if test="beginTime != null ">and begin_time = #{beginTime}</if>
-            <if test="endTime != null ">and end_time = #{endTime}</if>
-            <if test="sentEnd != null ">and sent_end = #{sentEnd}</if>
-            <if test="recordpath != null  and recordpath != ''">and recordpath = #{recordpath}</if>
-            <if test="recordurl != null  and recordurl != ''">and recordurl = #{recordurl}</if>
-            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
-            <if test="templatequestionnum != null ">and templatequestionnum = #{templatequestionnum}</if>
-            <if test="switchid != null ">and switchid = #{switchid}</if>
-            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
-            <if test="questiontext != null  and questiontext != ''">and questiontext = #{questiontext}</if>
-            <if test="questionvoice != null  and questionvoice != ''">and questionvoice = #{questionvoice}</if>
-            <if test="categoryname != null  and categoryname != ''">and categoryname like concat('%', #{categoryname},
-                '%')
-            </if>
-            <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
-            <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
-            <if test="matchedtext != null  and matchedtext != ''">and matchedtext = #{matchedtext}</if>
-            <if test="addtime != null ">and addtime = #{addtime}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
-            <if test="answerps != null  and answerps != ''">and answerps = #{answerps}</if>
-            <if test="comment != null  and comment != ''">and comment = #{comment}</if>
-            <if test="scriptid != null ">and scriptid = #{scriptid}</if>
-            <if test=" patid != null">and patid = #{patid}</if>
+        <if test="subId != null">and sub_id = #{subId}</if>
+        <if test="templateType != null">and template_type = #{templateType}</if>
+        <if test="libTemplateid != null">and lib_templateid = #{libTemplateid}</if>
+        <if test="targetid != null">and targetid = #{targetid}</if>
+        <if test="extemplateText != null">and extemplate_text = #{extemplateText}</if>
+        <if test="taskid != null">and taskid = #{taskid}</if>
+        <if test="uuid != null  and uuid != ''">and uuid = #{uuid}</if>
+        <if test="phone != null  and phone != ''">and phone = #{phone}</if>
+        <if test="operate != null  and operate != ''">and operate = #{operate}</if>
+        <if test="displayno != null  and displayno != ''">and displayno = #{displayno}</if>
+        <if test="inbound != null ">and inbound = #{inbound}</if>
+        <if test="incoming != null ">and incoming = #{incoming}</if>
+        <if test="assigntime != null ">and assigntime = #{assigntime}</if>
+        <if test="starttime != null ">and starttime = #{starttime}</if>
+        <if test="answertime != null ">and answertime = #{answertime}</if>
+        <if test="silent != null ">and silent = #{silent}</if>
+        <if test="dtmfKey != null  and dtmfKey != ''">and dtmf_key = #{dtmfKey}</if>
+        <if test="musicpath != null  and musicpath != ''">and musicpath = #{musicpath}</if>
+        <if test="sentIndex != null ">and sent_index = #{sentIndex}</if>
+        <if test="sentBegin != null ">and sent_begin = #{sentBegin}</if>
+        <if test="asrtext != null  and asrtext != ''">and asrtext = #{asrtext}</if>
+        <if test="beginTime != null ">and begin_time = #{beginTime}</if>
+        <if test="endTime != null ">and end_time = #{endTime}</if>
+        <if test="sentEnd != null ">and sent_end = #{sentEnd}</if>
+        <if test="recordpath != null  and recordpath != ''">and recordpath = #{recordpath}</if>
+        <if test="recordurl != null  and recordurl != ''">and recordurl = #{recordurl}</if>
+        <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
+        <if test="templatequestionnum != null ">and templatequestionnum = #{templatequestionnum}</if>
+        <if test="switchid != null ">and switchid = #{switchid}</if>
+        <if test="categoryid != null ">and categoryid = #{categoryid}</if>
+        <if test="questiontext != null  and questiontext != ''">and questiontext = #{questiontext}</if>
+        <if test="questionvoice != null  and questionvoice != ''">and questionvoice = #{questionvoice}</if>
+        <if test="categoryname != null  and categoryname != ''">and categoryname like concat('%', #{categoryname},
+            '%')
+        </if>
+        <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
+        <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
+        <if test="matchedtext != null  and matchedtext != ''">and matchedtext = #{matchedtext}</if>
+        <if test="addtime != null ">and addtime = #{addtime}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
+        <if test="answerps != null  and answerps != ''">and answerps = #{answerps}</if>
+        <if test="comment != null  and comment != ''">and comment = #{comment}</if>
+        <if test="scriptid != null ">and scriptid = #{scriptid}</if>
+        <if test="patid != null">and patid = #{patid}</if>
+        <if test="score != null">and score = #{score}</if>
+
     </select>
 
     <select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult">
         <include refid="selectServiceSubtaskDetailVo"/>
         where id = #{id}
+    </select>
+
+    <select id="queryFillCount" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO">
+        select id,questiontext,matchedtext,targetvalue,score
+        from service_subtask_detail
+        where del_flag = 0
+        and sub_id in
+        <foreach item="subid" collection="subids" open="(" separator="," close=")">
+            #{subid}
+        </foreach>
+        <if test="questiontext != null">and questiontext = #{questiontext}</if>
+    </select>
+
+    <select id="isExistServiceSubtaskDetail" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO">
+        select id, questiontext, matchedtext, score
+        from service_subtask_detail
+        where del_flag = 0
+        <if test="subid != null ">and sub_id = #{subid}</if>
+        <if test="scriptid != null">and scriptid = #{scriptid}</if>
     </select>
 
     <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail"
@@ -228,6 +258,9 @@
             <if test=" extemplateText != null">extemplate_text,</if>
             <if test=" guid != null">guid,</if>
             <if test=" categoryid != null">categoryid,</if>
+            <if test="templateType != null">template_type,</if>
+            <if test="libTemplateid != null">lib_templateid,</if>
+            <if test="score != null">score,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -280,6 +313,9 @@
             <if test="extemplateText != null">#{extemplateText},</if>
             <if test="guid != null">#{guid},</if>
             <if test="categoryid != null">#{categoryid},</if>
+            <if test="templateType != null">#{templateType},</if>
+            <if test="libTemplateid != null">#{libTemplateid},</if>
+            <if test="score != null">#{score},</if>
         </trim>
     </insert>
 
@@ -333,8 +369,11 @@
             <if test="scriptid != null ">scriptid = #{scriptid},</if>
             <if test=" patid != null">patid = #{patid},</if>
             <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
+            <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
             <if test=" guid != null">guid = #{guid},</if>
             <if test=" categoryid != null">categoryid = #{categoryid},</if>
+            <if test="templateType != null">template_type = #{templateType},</if>
+            <if test="score != null">score = #{score},</if>
         </trim>
         where id = #{id}
     </update>
@@ -392,6 +431,9 @@
             <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
             <if test=" guid != null">guid = #{guid},</if>
             <if test=" categoryid != null">categoryid = #{categoryid},</if>
+            <if test="templateType != null">template_type = #{templateType},</if>
+            <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
+            <if test="score != null">score = #{score},</if>
         </trim>
         where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
     </update>
@@ -418,7 +460,7 @@
         FROM service_subtask_detail
             JOIN service_task
         ON service_task.taskid = service_subtask_detail.taskid
-        JOIN ivr_liba_target ON ivr_liba_target.id = service_subtask_detail.targetid
+            JOIN ivr_liba_target ON ivr_liba_target.id = service_subtask_detail.targetid
         WHERE
             targetid = #{targetid}
         GROUP BY service_task.taskid,
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml
new file mode 100644
index 0000000..3d10b0a
--- /dev/null
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailTraceMapper.xml
@@ -0,0 +1,653 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.smartor.mapper.ServiceSubtaskDetailTraceMapper">
+
+    <resultMap type="com.smartor.domain.ServiceSubtaskDetailTrace" id="ServiceSubtaskDetailTtraceResult">
+        <result property="id" column="id"/>
+        <result property="detailId" column="detail_id"/>
+        <result property="subId" column="sub_id"/>
+        <result property="taskid" column="taskid"/>
+        <result property="templateid" column="templateid"/>
+        <result property="templatequestionnum" column="templatequestionnum"/>
+        <result property="switchid" column="switchid"/>
+        <result property="questiontext" column="questiontext"/>
+        <result property="questionvoice" column="questionvoice"/>
+        <result property="categoryname" column="categoryname"/>
+        <result property="targetid" column="targetid"/>
+        <result property="targetvalue" column="targetvalue"/>
+        <result property="matchedtext" column="matchedtext"/>
+        <result property="uuid" column="uuid"/>
+        <result property="guid" column="guid"/>
+        <result property="valueType" column="value_type"/>
+        <result property="scriptid" column="scriptid"/>
+        <result property="answerps" column="answerps"/>
+        <result property="comment" column="comment"/>
+        <result property="asrtext" column="asrtext"/>
+        <result property="recordpath" column="recordpath"/>
+        <result property="recordurl" column="recordurl"/>
+        <result property="patid" column="patid"/>
+        <result property="patdesc" column="patdesc"/>
+        <result property="todeptid" column="todeptid"/>
+        <result property="todeptcode" column="todeptcode"/>
+        <result property="todeptname" column="todeptname"/>
+        <result property="handleresult" column="handleresult"/>
+        <result property="handledesc" column="handledesc"/>
+        <result property="handleFlag" column="handle_flag"/>
+        <result property="handleBy" column="handle_by"/>
+        <result property="handleTime" column="handle_time"/>
+        <result property="ccdepts" column="ccdepts"/>
+        <result property="finaloption" column="finaloption"/>
+        <result property="finaltime" column="finaltime"/>
+        <result property="operate" column="operate"/>
+        <result property="orgid" column="orgid"/>
+        <result property="isupload" column="isupload"/>
+        <result property="uploadTime" column="upload_time"/>
+        <result property="createTime" column="create_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="pguid" column="pguid"/>
+        <result property="pid" column="pid"/>
+        <result property="categoryid" column="categoryid"/>
+        <result property="templateType" column="template_type"/>
+    </resultMap>
+
+    <sql id="selectServiceSubtaskDetailTtraceVo">
+        select id,
+               detail_id,
+               template_type,
+               sub_id,
+               taskid,
+               templateid,
+               templatequestionnum,
+               switchid,
+               questiontext,
+               questionvoice,
+               categoryname,
+               targetid,
+               targetvalue,
+               matchedtext,
+               uuid,
+               guid,
+               value_type,
+               scriptid,
+               answerps,
+               comment,
+               asrtext,
+               recordpath,
+               recordurl,
+               patid,
+               patdesc,
+               todeptid,
+               todeptcode,
+               todeptname,
+               handleresult,
+               handledesc,
+               handle_flag,
+               handle_by,
+               handle_time,
+               ccdepts,
+               finaloption,
+               finaltime,
+               operate,
+               orgid,
+               isupload,
+               upload_time,
+               create_time,
+               del_flag,
+               update_by,
+               update_time,
+               create_by,
+               pguid,
+               type,
+               pid,
+               categoryid
+        from service_subtask_detail_trace
+    </sql>
+
+    <select id="selectServiceSubtaskDetailTtraceList" parameterType="com.smartor.domain.ServiceSubtaskDetailTrace"
+            resultMap="ServiceSubtaskDetailTtraceResult">
+        <include refid="selectServiceSubtaskDetailTtraceVo"/>
+        where del_flag=0
+        <if test="detailId != null ">
+            and detail_id = #{detailId}
+        </if>
+        <if test="templateType != null ">
+            and template_type = #{templateType}
+        </if>
+        <if test="subId != null ">
+            and sub_id = #{subId}
+        </if>
+        <if test="taskid != null ">
+            and taskid = #{taskid}
+        </if>
+        <if test="templateid != null  and templateid != ''">
+            and templateid = #{templateid}
+        </if>
+        <if test="templatequestionnum != null ">
+            and templatequestionnum = #{templatequestionnum}
+        </if>
+        <if test="switchid != null ">
+            and switchid = #{switchid}
+        </if>
+        <if test="questiontext != null  and questiontext != ''">
+            and questiontext = #{questiontext}
+        </if>
+        <if test="questionvoice != null  and questionvoice != ''">
+            and questionvoice = #{questionvoice}
+        </if>
+        <if test="categoryname != null  and categoryname != ''">
+            and categoryname like concat('%', #{categoryname}, '%')
+        </if>
+        <if test="targetid != null ">
+            and targetid = #{targetid}
+        </if>
+        <if test="targetvalue != null  and targetvalue != ''">
+            and targetvalue = #{targetvalue}
+        </if>
+        <if test="matchedtext != null  and matchedtext != ''">
+            and matchedtext = #{matchedtext}
+        </if>
+        <if test="uuid != null  and uuid != ''">
+            and uuid = #{uuid}
+        </if>
+        <if test="guid != null  and guid != ''">
+            and guid = #{guid}
+        </if>
+        <if test="valueType != null  and valueType != ''">
+            and value_type = #{valueType}
+        </if>
+        <if test="scriptid != null ">
+            and scriptid = #{scriptid}
+        </if>
+        <if test="answerps != null  and answerps != ''">
+            and answerps = #{answerps}
+        </if>
+        <if test="comment != null  and comment != ''">
+            and comment = #{comment}
+        </if>
+        <if test="asrtext != null  and asrtext != ''">
+            and asrtext = #{asrtext}
+        </if>
+        <if test="recordpath != null  and recordpath != ''">
+            and recordpath = #{recordpath}
+        </if>
+        <if test="recordurl != null  and recordurl != ''">
+            and recordurl = #{recordurl}
+        </if>
+        <if test="patid != null ">
+            and patid = #{patid}
+        </if>
+        <if test="patdesc != null  and patdesc != ''">
+            and patdesc = #{patdesc}
+        </if>
+        <if test="todeptid != null ">
+            and todeptid = #{todeptid}
+        </if>
+        <if test="todeptcode != null  and todeptcode != ''">
+            and todeptcode = #{todeptcode}
+        </if>
+        <if test="todeptname != null  and todeptname != ''">
+            and todeptname like concat('%', #{todeptname}, '%')
+        </if>
+        <if test="handleresult != null  and handleresult != ''">
+            and handleresult = #{handleresult}
+        </if>
+        <if test="handledesc != null  and handledesc != ''">
+            and handledesc = #{handledesc}
+        </if>
+        <if test="handleFlag != null  and handleFlag != ''">
+            and handle_flag = #{handleFlag}
+        </if>
+        <if test="handleBy != null  and handleBy != ''">
+            and handle_by = #{handleBy}
+        </if>
+        <if test="handleTime != null ">
+            and handle_time = #{handleTime}
+        </if>
+        <if test="ccdepts != null  and ccdepts != ''">
+            and ccdepts = #{ccdepts}
+        </if>
+        <if test="finaloption != null  and finaloption != ''">
+            and finaloption = #{finaloption}
+        </if>
+        <if test="finaltime != null ">
+            and finaltime = #{finaltime}
+        </if>
+        <if test="operate != null  and operate != ''">
+            and operate = #{operate}
+        </if>
+        <if test="orgid != null  and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        <if test="isupload != null ">
+            and isupload = #{isupload}
+        </if>
+        <if test="uploadTime != null ">
+            and upload_time = #{uploadTime}
+        </if>
+        <if test="pguid != null  and pguid != ''">
+            and pguid = #{pguid}
+        </if>
+        <if test="pid != null ">
+            and pid = #{pid}
+        </if>
+        <if test="categoryid != null ">
+            and categoryid = #{categoryid}
+        </if>
+        <if test="type != null  and type != ''">
+            and type = #{type}
+        </if>
+    </select>
+
+    <select id="tracedeallist" parameterType="com.smartor.domain.VO.DetailTraceDealVO"
+            resultMap="ServiceSubtaskDetailTtraceResult">
+        <include refid="selectServiceSubtaskDetailTtraceVo"/>
+        where del_flag=0
+
+        <if test="templateid != null  and templateid != ''">
+            and templateid = #{templateid}
+        </if>
+        <if test="todeptcode != null  and todeptcode != ''">
+            and FIND_IN_SET(#{todeptcode}, todeptcode)
+        </if>
+        <if test="todeptname != null  and todeptname != ''">
+            and todeptname like concat('%', #{todeptname}, '%')
+        </if>
+        <if test="handleStartTime != null and handleEndTime != null">
+            and handle_time between #{handleStartTime} and #{handleEndTime}
+        </if>
+
+        <if test="orgid != null  and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+
+        <if test="type != null  and type != ''">
+            and type = #{type}
+        </if>
+    </select>
+
+
+
+
+    <select id="selectServiceSubtaskDetailTtraceById" parameterType="Long"
+            resultMap="ServiceSubtaskDetailTtraceResult">
+        <include refid="selectServiceSubtaskDetailTtraceVo"/>
+        where del_flag=0 and id = #{id}
+    </select>
+
+    <insert id="insertServiceSubtaskDetailTtrace" parameterType="com.smartor.domain.ServiceSubtaskDetailTrace"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into service_subtask_detail_trace
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="detailId != null">detail_id,
+            </if>
+            <if test="subId != null">sub_id,
+            </if>
+            <if test="taskid != null">taskid,
+            </if>
+            <if test="templateid != null">templateid,
+            </if>
+            <if test="templatequestionnum != null">templatequestionnum,
+            </if>
+            <if test="switchid != null">switchid,
+            </if>
+            <if test="questiontext != null">questiontext,
+            </if>
+            <if test="questionvoice != null">questionvoice,
+            </if>
+            <if test="categoryname != null">categoryname,
+            </if>
+            <if test="targetid != null">targetid,
+            </if>
+            <if test="targetvalue != null">targetvalue,
+            </if>
+            <if test="matchedtext != null">matchedtext,
+            </if>
+            <if test="uuid != null">uuid,
+            </if>
+            <if test="guid != null">guid,
+            </if>
+            <if test="valueType != null">value_type,
+            </if>
+            <if test="scriptid != null">scriptid,
+            </if>
+            <if test="answerps != null">answerps,
+            </if>
+            <if test="comment != null">comment,
+            </if>
+            <if test="asrtext != null">asrtext,
+            </if>
+            <if test="recordpath != null">recordpath,
+            </if>
+            <if test="recordurl != null">recordurl,
+            </if>
+            <if test="patid != null">patid,
+            </if>
+            <if test="patdesc != null">patdesc,
+            </if>
+            <if test="todeptid != null">todeptid,
+            </if>
+            <if test="todeptcode != null">todeptcode,
+            </if>
+            <if test="todeptname != null">todeptname,
+            </if>
+            <if test="handleresult != null">handleresult,
+            </if>
+            <if test="handledesc != null">handledesc,
+            </if>
+            <if test="handleFlag != null">handle_flag,
+            </if>
+            <if test="handleBy != null">handle_by,
+            </if>
+            <if test="handleTime != null">handle_time,
+            </if>
+            <if test="ccdepts != null">ccdepts,
+            </if>
+            <if test="finaloption != null">finaloption,
+            </if>
+            <if test="finaltime != null">finaltime,
+            </if>
+            <if test="operate != null">operate,
+            </if>
+            <if test="orgid != null">orgid,
+            </if>
+            <if test="isupload != null">isupload,
+            </if>
+            <if test="uploadTime != null">upload_time,
+            </if>
+            <if test="createTime != null">create_time,
+            </if>
+            <if test="delFlag != null">del_flag,
+            </if>
+            <if test="updateBy != null">update_by,
+            </if>
+            <if test="updateTime != null">update_time,
+            </if>
+            <if test="createBy != null">create_by,
+            </if>
+            <if test="pguid != null">pguid,
+            </if>
+            <if test="pid != null">pid,
+            </if>
+            <if test="categoryid != null">categoryid,
+            </if>
+            <if test="type != null">type,
+            </if>
+            <if test="templateType != null">template_type,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="detailId != null">#{detailId},
+            </if>
+            <if test="subId != null">#{subId},
+            </if>
+            <if test="taskid != null">#{taskid},
+            </if>
+            <if test="templateid != null">#{templateid},
+            </if>
+            <if test="templatequestionnum != null">#{templatequestionnum},
+            </if>
+            <if test="switchid != null">#{switchid},
+            </if>
+            <if test="questiontext != null">#{questiontext},
+            </if>
+            <if test="questionvoice != null">#{questionvoice},
+            </if>
+            <if test="categoryname != null">#{categoryname},
+            </if>
+            <if test="targetid != null">#{targetid},
+            </if>
+            <if test="targetvalue != null">#{targetvalue},
+            </if>
+            <if test="matchedtext != null">#{matchedtext},
+            </if>
+            <if test="uuid != null">#{uuid},
+            </if>
+            <if test="guid != null">#{guid},
+            </if>
+            <if test="valueType != null">#{valueType},
+            </if>
+            <if test="scriptid != null">#{scriptid},
+            </if>
+            <if test="answerps != null">#{answerps},
+            </if>
+            <if test="comment != null">#{comment},
+            </if>
+            <if test="asrtext != null">#{asrtext},
+            </if>
+            <if test="recordpath != null">#{recordpath},
+            </if>
+            <if test="recordurl != null">#{recordurl},
+            </if>
+            <if test="patid != null">#{patid},
+            </if>
+            <if test="patdesc != null">#{patdesc},
+            </if>
+            <if test="todeptid != null">#{todeptid},
+            </if>
+            <if test="todeptcode != null">#{todeptcode},
+            </if>
+            <if test="todeptname != null">#{todeptname},
+            </if>
+            <if test="handleresult != null">#{handleresult},
+            </if>
+            <if test="handledesc != null">#{handledesc},
+            </if>
+            <if test="handleFlag != null">#{handleFlag},
+            </if>
+            <if test="handleBy != null">#{handleBy},
+            </if>
+            <if test="handleTime != null">#{handleTime},
+            </if>
+            <if test="ccdepts != null">#{ccdepts},
+            </if>
+            <if test="finaloption != null">#{finaloption},
+            </if>
+            <if test="finaltime != null">#{finaltime},
+            </if>
+            <if test="operate != null">#{operate},
+            </if>
+            <if test="orgid != null">#{orgid},
+            </if>
+            <if test="isupload != null">#{isupload},
+            </if>
+            <if test="uploadTime != null">#{uploadTime},
+            </if>
+            <if test="createTime != null">#{createTime},
+            </if>
+            <if test="delFlag != null">#{delFlag},
+            </if>
+            <if test="updateBy != null">#{updateBy},
+            </if>
+            <if test="updateTime != null">#{updateTime},
+            </if>
+            <if test="createBy != null">#{createBy},
+            </if>
+            <if test="pguid != null">#{pguid},
+            </if>
+            <if test="pid != null">#{pid},
+            </if>
+            <if test="categoryid != null">#{categoryid},
+            </if>
+            <if test="type != null">#{type},
+            </if>
+            <if test="templateType != null">#{templateType},
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateServiceSubtaskDetailTtrace" parameterType="com.smartor.domain.ServiceSubtaskDetailTrace">
+        update service_subtask_detail_trace
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="detailId != null">detail_id =
+                #{detailId},
+            </if>
+            <if test="subId != null">sub_id =
+                #{subId},
+            </if>
+            <if test="taskid != null">taskid =
+                #{taskid},
+            </if>
+            <if test="templateid != null">templateid =
+                #{templateid},
+            </if>
+            <if test="templatequestionnum != null">templatequestionnum =
+                #{templatequestionnum},
+            </if>
+            <if test="switchid != null">switchid =
+                #{switchid},
+            </if>
+            <if test="questiontext != null">questiontext =
+                #{questiontext},
+            </if>
+            <if test="questionvoice != null">questionvoice =
+                #{questionvoice},
+            </if>
+            <if test="categoryname != null">categoryname =
+                #{categoryname},
+            </if>
+            <if test="targetid != null">targetid =
+                #{targetid},
+            </if>
+            <if test="targetvalue != null">targetvalue =
+                #{targetvalue},
+            </if>
+            <if test="matchedtext != null">matchedtext =
+                #{matchedtext},
+            </if>
+            <if test="uuid != null">uuid =
+                #{uuid},
+            </if>
+            <if test="guid != null">guid =
+                #{guid},
+            </if>
+            <if test="valueType != null">value_type =
+                #{valueType},
+            </if>
+            <if test="scriptid != null">scriptid =
+                #{scriptid},
+            </if>
+            <if test="answerps != null">answerps =
+                #{answerps},
+            </if>
+            <if test="comment != null">comment =
+                #{comment},
+            </if>
+            <if test="asrtext != null">asrtext =
+                #{asrtext},
+            </if>
+            <if test="recordpath != null">recordpath =
+                #{recordpath},
+            </if>
+            <if test="recordurl != null">recordurl =
+                #{recordurl},
+            </if>
+            <if test="patid != null">patid =
+                #{patid},
+            </if>
+            <if test="patdesc != null">patdesc =
+                #{patdesc},
+            </if>
+            <if test="todeptid != null">todeptid =
+                #{todeptid},
+            </if>
+            <if test="todeptcode != null">todeptcode =
+                #{todeptcode},
+            </if>
+            <if test="todeptname != null">todeptname =
+                #{todeptname},
+            </if>
+            <if test="handleresult != null">handleresult =
+                #{handleresult},
+            </if>
+            <if test="handledesc != null">handledesc =
+                #{handledesc},
+            </if>
+            <if test="handleFlag != null">handle_flag =
+                #{handleFlag},
+            </if>
+            <if test="handleBy != null">handle_by =
+                #{handleBy},
+            </if>
+            <if test="handleTime != null">handle_time =
+                #{handleTime},
+            </if>
+            <if test="ccdepts != null">ccdepts =
+                #{ccdepts},
+            </if>
+            <if test="finaloption != null">finaloption =
+                #{finaloption},
+            </if>
+            <if test="finaltime != null">finaltime =
+                #{finaltime},
+            </if>
+            <if test="operate != null">operate =
+                #{operate},
+            </if>
+            <if test="orgid != null">orgid =
+                #{orgid},
+            </if>
+            <if test="isupload != null">isupload =
+                #{isupload},
+            </if>
+            <if test="uploadTime != null">upload_time =
+                #{uploadTime},
+            </if>
+            <if test="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="delFlag != null">del_flag =
+                #{delFlag},
+            </if>
+            <if test="updateBy != null">update_by =
+                #{updateBy},
+            </if>
+            <if test="updateTime != null">update_time =
+                #{updateTime},
+            </if>
+            <if test="createBy != null">create_by =
+                #{createBy},
+            </if>
+            <if test="pguid != null">pguid =
+                #{pguid},
+            </if>
+            <if test="pid != null">pid =
+                #{pid},
+            </if>
+            <if test="categoryid != null">categoryid =
+                #{categoryid},
+            </if>
+            <if test="type != null">type =
+                #{type},
+            </if>
+            <if test="templateType != null">template_type =
+                #{templateType},
+            </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteServiceSubtaskDetailTtraceById" parameterType="Long">
+        update service_subtask_detail_trace
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteServiceSubtaskDetailTtraceByIds" parameterType="String">
+        update service_subtask_detail_trace
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1
+        </trim>
+        where id in
+        <foreach item="id" collection="array" 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 c2d5882..6f1c4e8 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -469,6 +469,41 @@
         <if test="sort != null  and sort==9">order by sendname asc</if>
         <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
+
+    <select id="selectSatisfactionSubtaskList" parameterType="com.smartor.domain.VO.PatSatisfactionReqVO"
+            resultMap="ServiceSubtaskResult">
+        <include refid="selectServiceSubtaskVo"/>
+        where 1=1
+        and del_flag = 0
+        <if test="questionType != null">and type = #{questionType}</if>
+
+        <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+            AND leavehospitaldistrictcode IN
+            <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator=","
+                     close=")">
+                #{hospitaldistrictcode}
+            </foreach>
+        </if>
+        <if test="deptcodes != null and deptcodes.size() > 0">
+            AND deptcode IN
+            <foreach collection="deptcodes" item="deptcode" open="(" separator=","
+                     close=")">
+                #{deptcode}
+            </foreach>
+        </if>
+        <if test="serviceTypes != null and serviceTypes.size() > 0">
+            AND service_type IN
+            <foreach collection="serviceTypes" item="serviceType" open="(" separator=","
+                     close=")">
+                #{serviceType}
+            </foreach>
+        </if>
+
+        <if test="startTime != null and endTime != null">
+            AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
+            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+        </if>
+    </select>
     <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
@@ -1910,10 +1945,10 @@
 
     <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
         SELECT deptname,
-               count(1) AS rc
+        count(1) AS rc
         FROM service_subtask
         WHERE DATE_FORMAT(finishtime, '%Y-%m-%d') >= #{startDate}
-          AND DATE_FORMAT(finishtime, '%Y-%m-%d') &lt;= #{endDate}
+        AND DATE_FORMAT(finishtime, '%Y-%m-%d') &lt;= #{endDate}
         <if test="orgid != null">
             AND orgid = #{orgid}
         </if>
@@ -2036,47 +2071,47 @@
             </foreach>
         </if>
 
-<!--        UNION ALL-->
+        <!--        UNION ALL-->
 
-<!--        &#45;&#45; 闂ㄨ瘖浜烘鏁版嵁-->
-<!--        SELECT-->
-<!--        <choose>-->
-<!--            <when test="timeType == 'day'">-->
-<!--                DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
-<!--            </when>-->
-<!--            <when test="timeType == 'month'">-->
-<!--                DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,-->
-<!--            </when>-->
-<!--            <when test="timeType == 'year'">-->
-<!--                DATE_FORMAT(admitdate, '%Y') AS timePeriod,-->
-<!--            </when>-->
-<!--            <when test="timeType == 'week'">-->
-<!--                CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,-->
-<!--            </when>-->
-<!--            <otherwise>-->
-<!--                DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
-<!--            </otherwise>-->
-<!--        </choose>-->
-<!--        0 AS dischargeFollowCount,-->
-<!--        0 AS outpatientFollowCount,-->
-<!--        0 AS pmiCount,-->
-<!--        1 AS pmoCount-->
-<!--        FROM pat_med_outhosp-->
-<!--        WHERE del_flag = '0'-->
-<!--        <if test="startDate != null and endDate != null">-->
-<!--            AND admitdate >= #{startDate}-->
-<!--            AND admitdate &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
-<!--        </if>-->
-<!--        <if test="orgid != null">-->
-<!--            AND orgid = #{orgid}-->
-<!--        </if>-->
+        <!--        &#45;&#45; 闂ㄨ瘖浜烘鏁版嵁-->
+        <!--        SELECT-->
+        <!--        <choose>-->
+        <!--            <when test="timeType == 'day'">-->
+        <!--                DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
+        <!--            </when>-->
+        <!--            <when test="timeType == 'month'">-->
+        <!--                DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,-->
+        <!--            </when>-->
+        <!--            <when test="timeType == 'year'">-->
+        <!--                DATE_FORMAT(admitdate, '%Y') AS timePeriod,-->
+        <!--            </when>-->
+        <!--            <when test="timeType == 'week'">-->
+        <!--                CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,-->
+        <!--            </when>-->
+        <!--            <otherwise>-->
+        <!--                DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
+        <!--            </otherwise>-->
+        <!--        </choose>-->
+        <!--        0 AS dischargeFollowCount,-->
+        <!--        0 AS outpatientFollowCount,-->
+        <!--        0 AS pmiCount,-->
+        <!--        1 AS pmoCount-->
+        <!--        FROM pat_med_outhosp-->
+        <!--        WHERE del_flag = '0'-->
+        <!--        <if test="startDate != null and endDate != null">-->
+        <!--            AND admitdate >= #{startDate}-->
+        <!--            AND admitdate &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
+        <!--        </if>-->
+        <!--        <if test="orgid != null">-->
+        <!--            AND orgid = #{orgid}-->
+        <!--        </if>-->
 
-<!--        <if test="deptcodes != null and deptcodes.size() > 0">-->
-<!--            AND deptcode IN-->
-<!--            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">-->
-<!--                #{deptcode}-->
-<!--            </foreach>-->
-<!--        </if>-->
+        <!--        <if test="deptcodes != null and deptcodes.size() > 0">-->
+        <!--            AND deptcode IN-->
+        <!--            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">-->
+        <!--                #{deptcode}-->
+        <!--            </foreach>-->
+        <!--        </if>-->
 
         ) AS combined_data
         GROUP BY timePeriod
@@ -2298,9 +2333,11 @@
         </if>
     </select>
 
-    <select id="getCurrentUserServiceSubtaskCount" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" resultType="map">
+    <select id="getCurrentUserServiceSubtaskCount" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
+            resultType="map">
         SELECT
-        COUNT(CASE WHEN sendstate = 2 AND date_format(visit_time,'%y%m%d') &lt;= date_format(CURDATE(),'%y%m%d') THEN 1 END) AS pendingVisitCount,
+        COUNT(CASE WHEN sendstate = 2 AND date_format(visit_time,'%y%m%d') &lt;= date_format(CURDATE(),'%y%m%d') THEN 1
+        END) AS pendingVisitCount,
         COUNT(CASE WHEN sendstate = 5 THEN 1 END) AS failedVisitCount,
         SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS abnormalVisitCount,
         SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS warnningVisitCount,
@@ -2329,4 +2366,52 @@
         </if>
     </select>
 
+    <select id="querySendCount" parameterType="com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity"
+            resultType="Long">
+        select distinct id from service_subtask
+        where del_flag = 0
+        <if test="orgid != null and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        <if test="campusid != null and campusid != ''">
+            and campusid = #{campusid}
+        </if>
+        <if test="type != null ">and type = #{type}</if>
+        <if test="startTime != null">
+            AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
+        </if>
+        <if test="endTime != null">
+            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+        </if>
+        <if test=" libTemplateIds != null and libTemplateIds.size()>0">
+            AND libtemplateid IN
+            <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator=","
+                     close=")">
+                #{libTemplateId}
+            </foreach>
+        </if>
+        <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)">
+            AND (
+            <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+                leavehospitaldistrictcode IN
+                <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="("
+                         separator=","
+                         close=")">
+                    #{hospitaldistrictcode}
+                </foreach>
+            </if>
+            <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0">
+                OR
+            </if>
+            <if test="deptcodes != null and deptcodes.size() > 0">
+                deptcode IN
+                <foreach collection="deptcodes" item="deptcode" open="(" separator=","
+                         close=")">
+                    #{deptcode}
+                </foreach>
+            </if>
+            )
+        </if>
+    </select>
+
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml
index 5e567db..70fd431 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml
@@ -35,6 +35,7 @@
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
+        <result property="isException" column="is_exception"/>
         <result property="isupload" column="isupload"/>
         <result property="uploadTime" column="upload_time"/>
         <result property="appendflag" column="appendflag"/>
@@ -77,6 +78,7 @@
                update_by,
                update_time,
                isupload,
+               is_exception,
                upload_time
         from svy_lib_scriptoption
     </sql>
@@ -114,6 +116,7 @@
             <if test="appendflag != null">and appendflag = #{appendflag}</if>
             <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
             <if test="picturePath != null">and picture_path = #{picturePath}</if>
+            <if test="isException != null">and is_exception = #{isException}</if>
     </select>
 
     <select id="selectSvyLibScriptOptionByOptionid" parameterType="Long" resultMap="SvyLibScriptOptionResult">
@@ -159,6 +162,7 @@
             <if test="appenddesc != null">appenddesc,</if>
             <if test="picturePath != null">picture_path,</if>
             <if test="guid != null">guid,</if>
+            <if test="isException != null">is_exception,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="topicid != null">#{topicid},</if>
@@ -195,6 +199,7 @@
             <if test="appenddesc != null">#{appenddesc},</if>
             <if test="picturePath != null">#{picturePath},</if>
             <if test="guid != null">#{guid},</if>
+            <if test="isException != null">#{isException},</if>
         </trim>
     </insert>
 
@@ -234,6 +239,7 @@
             <if test="appendflag != null">appendflag = #{appendflag},</if>
             <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
             <if test="picturePath != null">picture_path = #{picturePath},</if>
+            <if test="isException != null">is_exception = #{isException},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
index e3931d9..f22a134 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
@@ -46,11 +46,19 @@
         <result property="targetoptions" column="targetoptions"/>
         <result property="prompt" column="prompt"/>
         <result property="groupName" column="group_name"/>
+        <result property="dutyDeptName" column="duty_dept_name"/>
+        <result property="dutyDeptCode" column="duty_dept_code"/>
+        <result property="reportDeptCode" column="report_dept_name"/>
+        <result property="reportDeptName" column="report_dept_code"/>
     </resultMap>
 
     <sql id="selectSvyLibTemplateScriptVo">
         select id,
                script_type,
+               duty_dept_name,
+               duty_dept_code,
+               report_dept_name,
+               report_dept_code,
                targetid,
                group_name,
                targetname,
@@ -81,6 +89,7 @@
                pid,
                guid,
                categoryid,
+               categoryName,
                script_content,
                suitway,
                script_picture,
@@ -93,43 +102,66 @@
             resultMap="SvyLibTemplateScriptResult">
         <include refid="selectSvyLibTemplateScriptVo"/>
         where 1=1
-            and del_flag = 0
-            <if test="nextScriptno != null ">and next_scriptno = #{nextScriptno}</if>
-            <if test="scriptType != null  and scriptType != ''">and script_type = #{scriptType}</if>
-            <if test="scriptno != null  and scriptno != ''">and scriptno = #{scriptno}</if>
-            <if test="scriptid != null">and scriptid = #{scriptid}</if>
-            <if test="scriptDesc != null  and scriptDesc != ''">and script_desc = #{scriptDesc}</if>
-            <if test="tag != null  and tag != ''">and tag = #{tag}</if>
-            <if test="sort != null ">and sort = #{sort}</if>
-            <if test="ismandatory != null  and ismandatory != ''">and ismandatory = #{ismandatory}</if>
-            <if test="ishide != null ">and ishide = #{ishide}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="pid != null ">and pid = #{pid}</if>
-            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
-            <if test="prompt != null  and prompt != ''">and prompt = #{prompt}</if>
-            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
-            <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
-            <if test="suitway != null  and suitway != ''">and suitway = #{suitway}</if>
-            <if test="isavailable != null  and isavailable != ''">and isavailable = #{isavailable}</if>
-            <if test="language != null  and language != ''">and language = #{language}</if>
-            <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
-            <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
-            <if test="reply != null  and reply != ''">and reply = #{reply}</if>
-            <if test="scoretype != null  and scoretype != ''">and scoretype = #{scoretype}</if>
-            <if test="scriptTopic != null  and scriptTopic != ''">and script_topic = #{scriptTopic}</if>
-            <if test="svyid != null  ">and svyid = #{svyid}</if>
-            <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
-            <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
-                #{branchNextscriptno}
-            </if>
-            <if test="targetid != null ">and targetid = #{targetid}</if>
-            <if test="targetname != null  and targetname != ''">and targetname = #{targetname}</if>
-            <if test="targettype != null  and targettype != ''">and targettype = #{targettype}</if>
-            <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
-            <if test="score != null">and score = #{score}</if>
-            <if test="groupName != null">and group_name = #{groupName}</if>
+        and del_flag = 0
+        <if test="nextScriptno != null ">and next_scriptno = #{nextScriptno}</if>
+        <if test="scriptType != null  and scriptType != ''">and script_type = #{scriptType}</if>
+        <if test="scriptno != null  and scriptno != ''">and scriptno = #{scriptno}</if>
+        <if test="scriptid != null">and scriptid = #{scriptid}</if>
+        <if test="scriptDesc != null  and scriptDesc != ''">and script_desc = #{scriptDesc}</if>
+        <if test="tag != null  and tag != ''">and tag = #{tag}</if>
+        <if test="sort != null ">and sort = #{sort}</if>
+        <if test="ismandatory != null  and ismandatory != ''">and ismandatory = #{ismandatory}</if>
+        <if test="ishide != null ">and ishide = #{ishide}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="pid != null ">and pid = #{pid}</if>
+        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
+        <if test="prompt != null  and prompt != ''">and prompt = #{prompt}</if>
+        <if test="categoryid != null ">and categoryid = #{categoryid}</if>
+        <if test="categoryName != null ">and categoryName = #{categoryName}</if>
+        <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
+        <if test="suitway != null  and suitway != ''">and suitway = #{suitway}</if>
+        <if test="isavailable != null  and isavailable != ''">and isavailable = #{isavailable}</if>
+        <if test="language != null  and language != ''">and language = #{language}</if>
+        <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
+        <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
+        <if test="reply != null  and reply != ''">and reply = #{reply}</if>
+        <if test="scoretype != null  and scoretype != ''">and scoretype = #{scoretype}</if>
+        <if test="scriptTopic != null  and scriptTopic != ''">and script_topic = #{scriptTopic}</if>
+        <if test="svyid != null  ">and svyid = #{svyid}</if>
+        <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
+        <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
+            #{branchNextscriptno}
+        </if>
+        <if test="targetid != null ">and targetid = #{targetid}</if>
+        <if test="targetname != null  and targetname != ''">and targetname = #{targetname}</if>
+        <if test="targettype != null  and targettype != ''">and targettype = #{targettype}</if>
+        <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
+        <if test="score != null">and score = #{score}</if>
+        <if test="groupName != null">and group_name = #{groupName}</if>
+        <if test="dutyDeptName != null  and dutyDeptName != ''">and duty_dept_name like concat('%', #{dutyDeptName},
+            '%')
+        </if>
+        <if test="dutyDeptCode != null  and dutyDeptCode != ''">and duty_dept_code like concat('%', #{dutyDeptCode},
+            '%')
+        </if>
+        <if test="reportDeptName != null  and reportDeptName != ''">and report_dept_name like concat('%',
+            #{reportDeptName},
+            '%')
+        </if>
+        <if test="reportDeptCode != null  and reportDeptCode != ''">and report_dept_code like concat('%',
+            #{reportDeptCode},
+            '%')
+        </if>
+        <if test="categoryids != null">
+            and categoryid in
+            <foreach collection="categoryids" item="categoryid" open="(" separator=","
+                     close=")">
+                #{categoryid}
+            </foreach>
+        </if>
+        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 
     <select id="selectSvyLibTemplateScriptByTopicid" parameterType="Long" resultMap="SvyLibTemplateScriptResult">
@@ -181,6 +213,11 @@
             <if test="targetoptions != null  and targetoptions != ''">targetoptions,</if>
             <if test="prompt != null  and prompt != ''">prompt,</if>
             <if test="groupName != null  and groupName != ''">group_name,</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name,</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code,</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name,</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code,</if>
+            <if test="categoryName != null  and categoryName != ''">categoryName,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="nextScriptno != null">#{nextScriptno},</if>
@@ -223,6 +260,11 @@
             <if test="targetoptions != null  and targetoptions != ''">#{targetoptions},</if>
             <if test="prompt != null  and prompt != ''">#{prompt},</if>
             <if test="groupName != null  and groupName != ''">#{groupName},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">#{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">#{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">#{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
+            <if test="categoryName != null  and categoryName != ''">#{categoryName},</if>
         </trim>
     </insert>
 
@@ -271,6 +313,11 @@
             <if test="targetoptions != null  and targetoptions != ''">targetoptions = #{targetoptions},</if>
             <if test="prompt != null  and prompt != ''">prompt = #{prompt},</if>
             <if test="groupName != null  and groupName != ''">group_name = #{groupName},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name = #{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code = #{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name = #{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code = #{reportDeptCode},</if>
+            <if test="categoryName != null  and categoryName != ''">categoryName = #{categoryName},</if>
         </trim>
         where id = #{id}
     </update>
@@ -287,4 +334,15 @@
             #{id}
         </foreach>
     </delete>
+
+    <select id="querySvyLibTemplateIds"  resultMap="SvyLibTemplateScriptResult">
+        <include refid="selectSvyLibTemplateScriptVo"/>
+        where del_flag=0
+        <if test="scriptCategoryids != null and scriptCategoryids.size > 0">
+        and categoryid in
+        <foreach item="scriptCategoryid" collection="scriptCategoryids" open="(" separator="," close=")">
+            #{scriptCategoryid}
+        </foreach>
+        </if>
+    </select>
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
index ee9f1d2..6ded1c2 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
@@ -48,6 +48,7 @@
     <sql id="selectSvyLibTemplateTargetoptionVo">
         select id,
                groupid,
+--                is_exception,
                send_taskid,
                send_taskname,
                score,
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibTopicCategoryMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibTopicCategoryMapper.xml
index 3c5af8b..a7824f8 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibTopicCategoryMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibTopicCategoryMapper.xml
@@ -17,6 +17,7 @@
         <result property="updateTime" column="update_time"/>
         <result property="orgid" column="orgid"/>
         <result property="seqno" column="seqno"/>
+        <result property="type" column="type"/>
     </resultMap>
 
     <sql id="selectSvyLibScriptCategoryVo">
@@ -31,6 +32,7 @@
                update_by,
                update_time,
                seqno,
+               type,
                orgid
         from svy_lib_script_category
     </sql>
@@ -46,6 +48,7 @@
             <if test="guid != null  and guid != ''">and guid = #{guid}</if>
             <if test="orgid != null ">and orgid = #{orgid}</if>
             <if test="seqno != null ">and seqno = #{seqno}</if>
+            <if test="type != null  and type != ''">and type like concat('%', #{type}, '%')</if>
         order by seqno asc
     </select>
 
@@ -69,6 +72,7 @@
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="orgid != null">orgid,</if>
+            <if test="type != null">type,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null">#{name},</if>
@@ -82,6 +86,7 @@
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="orgid != null">#{orgid},</if>
+            <if test="type != null">#{type},</if>
         </trim>
     </insert>
 
@@ -99,6 +104,7 @@
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="type != null">type = #{type},</if>
         </trim>
         where id = #{id}
     </update>
@@ -120,7 +126,7 @@
 
     <select id="selectSeqMax" resultType="integer">
         select max(seqno) seqno
-        from ivr_liba_template_assort
+        from svy_lib_script_category
 
     </select>
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
index 57dba35..81f1d55 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
@@ -45,12 +45,19 @@
         <result property="prompt" column="prompt"/>
         <result property="groupName" column="group_name"/>
         <result property="categoryid" column="categoryid"/>
-
+        <result property="dutyDeptName" column="duty_dept_name"/>
+        <result property="dutyDeptCode" column="duty_dept_code"/>
+        <result property="reportDeptCode" column="report_dept_name"/>
+        <result property="reportDeptName" column="report_dept_code"/>
     </resultMap>
 
     <sql id="selectSvyTaskTemplateScriptVo">
         select id,
                sort,
+               duty_dept_name,
+               duty_dept_code,
+               report_dept_name,
+               report_dept_code,
                ishide,
                prompt,
                categoryid,
@@ -82,6 +89,18 @@
             <if test="scriptDesc != null  and scriptDesc != ''">and script_desc = #{scriptDesc}</if>
             <if test="language != null  and language != ''">and language = #{language}</if>
             <if test="categoryName != null  and categoryName != ''">and categoryName like concat('%', #{categoryName},
+                '%')
+            </if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">and duty_dept_name like concat('%', #{dutyDeptName},
+                '%')
+            </if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">and duty_dept_code like concat('%', #{dutyDeptCode},
+                '%')
+            </if>
+            <if test="reportDeptName != null  and reportDeptName != ''">and report_dept_name like concat('%', #{reportDeptName},
+                '%')
+            </if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">and report_dept_code like concat('%', #{reportDeptCode},
                 '%')
             </if>
             <if test="scriptContent != null  and scriptContent != ''">and script_content = #{scriptContent}</if>
@@ -160,6 +179,10 @@
             <if test="groupName != null ">group_name,</if>
             <if test="ishide != null ">ishide,</if>
             <if test="categoryid != null ">categoryid,</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name,</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">duty_dept_code,</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name,</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''"> report_dept_code,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -201,6 +224,10 @@
             <if test="groupName != null ">#{groupName},</if>
             <if test="ishide != null ">#{ishide},</if>
             <if test="categoryid != null ">#{categoryid},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">#{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''">#{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">#{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">#{reportDeptCode},</if>
         </trim>
     </insert>
 
@@ -248,6 +275,10 @@
             <if test="groupName != null ">group_name = #{groupName},</if>
             <if test="ishide != null ">ishide = #{ishide},</if>
             <if test="categoryid != null ">categoryid = #{categoryid},</if>
+            <if test="dutyDeptName != null  and dutyDeptName != ''">duty_dept_name = #{dutyDeptName},</if>
+            <if test="dutyDeptCode != null  and dutyDeptCode != ''"> duty_dept_code = #{dutyDeptCode},</if>
+            <if test="reportDeptName != null  and reportDeptName != ''">report_dept_name = #{reportDeptName},</if>
+            <if test="reportDeptCode != null  and reportDeptCode != ''">report_dept_code = #{reportDeptCode},</if>
         </trim>
         where id = #{d}
     </update>

--
Gitblit v1.9.3