From 37f2e4e68c0d55e094981fa478fc198b907f87dc Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期六, 20 七月 2024 16:30:13 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java                      |    7 
 smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java                   |    7 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java |   15 +
 ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java                         |    9 
 smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java                      |   14 
 smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java                 |    4 
 smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml                      |   27 +
 smartor/src/main/java/com/smartor/domain/PatArchive.java                                       |    6 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java                  |    2 
 smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml                      |   17 +
 smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml                       |   15 +
 smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java                 |    4 
 smartor/src/main/java/com/smartor/domain/IvrLibaScriptVO.java                                  |   14 +
 smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java                           |   31 ++
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java                            |   14 +
 smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java                    |   23 +
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java            |  183 +++++++++++++++-
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java                          |   16 +
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java                            |   16 +
 smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java                            |   17 +
 smartor/src/main/java/com/smartor/domain/ServiceSubTaskAnswerReq.java                          |   28 ++
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java                             |   14 +
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java                       |    7 
 smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java                          |    2 
 smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java                           |   16 +
 smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java                          |   20 +
 smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml                |    6 
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml                                 |   52 ++--
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                                   |   10 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java       |    9 
 smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml                 |    6 
 smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml                      |   33 ++
 smartor/src/main/java/com/smartor/service/IServiceTaskService.java                             |    6 
 33 files changed, 560 insertions(+), 90 deletions(-)

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 f1b5122..abf1f27 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
@@ -6,6 +6,9 @@
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.smartor.domain.ServiceSubTaskAnswerReq;
+import com.smartor.domain.ServiceSubTaskCacheReq;
+import com.smartor.domain.ServiceSubTaskDetailReq;
 import com.smartor.domain.ServiceSubtaskAnswer;
 import com.smartor.service.IServiceSubtaskAnswerService;
 import io.swagger.annotations.Api;
@@ -99,4 +102,16 @@
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(serviceSubtaskAnswerService.deleteServiceSubtaskAnswerByIds(ids));
     }
+
+    @ApiOperation("鎮h�呴棶棰樼粨鏋滆褰�(澶栭摼)")
+    @PostMapping("/saveQuestionAnswer")
+    public AjaxResult saveQuestionAnswer(@RequestBody ServiceSubTaskAnswerReq serviceSubTaskAnswerReq) {
+        return toAjax(serviceSubtaskAnswerService.saveQuestionAnswer(serviceSubTaskAnswerReq));
+    }
+
+    @ApiOperation("鎮h�呴棶棰樼粨鏋滆褰曠紦瀛�(澶栭摼)")
+    @PostMapping("/saveQuestionCache")
+    public AjaxResult saveQuestionCache(@RequestBody ServiceSubTaskCacheReq serviceSubTaskCacheReq) {
+        return toAjax(serviceSubtaskAnswerService.saveQuestionCache(serviceSubTaskCacheReq));
+    }
 }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
index ae992bf..b4a6887 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -105,13 +105,14 @@
         serviceSubtaskService.phoneCallBack(phoneCallBackVO);
         return success();
     }
+
     /**
      * 鎮h�呴棶棰樼粨鏋滆褰�
      */
-    @ApiOperation("鎮h�呴棶棰樼粨鏋滆褰�")
-    @PostMapping("/saveQuestionAnswer")
-    public AjaxResult saveQuestionAnswer(@RequestBody ServiceSubTaskDetailReq serviceSubTaskDetailReq) {
-        return toAjax(serviceSubtaskService.saveQuestionAnswer(serviceSubTaskDetailReq));
+    @ApiOperation("鎮h�呴棶棰樼粨鏋滆褰曪紙鐢佃瘽锛�")
+    @PostMapping("/saveQuestionAnswerPhone")
+    public AjaxResult saveQuestionAnswerPhone(@RequestBody ServiceSubTaskDetailReq serviceSubTaskDetailReq) {
+        return toAjax(serviceSubtaskService.saveQuestionAnswerPhone(serviceSubTaskDetailReq));
     }
 
 }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
index bd8c5e1..c1d3828 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
@@ -181,6 +181,15 @@
     }
 
     /**
+     * 鑾峰彇鎵�鏈塳ey
+     *
+     * @return
+     */
+    public Set<String> getAllKeys() {
+        return redisTemplate.keys("*");
+    }
+
+    /**
      * 鑾峰緱缂撳瓨鐨凪ap
      *
      * @param key
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 a13e7e3..4179ed5 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
@@ -1,6 +1,7 @@
 package com.ruoyi.quartz.task;
 
 import com.smartor.domain.ServiceThirdData;
+import com.smartor.service.IServiceSubtaskAnswerService;
 import com.smartor.service.IServiceThirdDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -17,6 +18,8 @@
 public class RyTask {
     @Autowired
     private IServiceThirdDataService iServiceThirdDataService;
+    @Autowired
+    private IServiceSubtaskAnswerService serviceSubtaskAnswerService;
 
     public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
         System.out.println(StringUtils.format("鎵ц澶氬弬鏂规硶锛� 瀛楃涓茬被鍨媨}锛屽竷灏旂被鍨媨}锛岄暱鏁村瀷{}锛屾诞鐐瑰瀷{}锛屾暣褰}", s, b, l, d, i));
@@ -40,4 +43,11 @@
         iServiceThirdDataService.queryList(serviceThirdData);
 
     }
+
+    /**
+     * 瀹氭椂澶勭悊澶栭摼鐨勬暟鎹�
+     */
+    public void runServiceSubTaskAnswer() {
+        serviceSubtaskAnswerService.saveQuestionAnswer(null);
+    }
 }
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptVO.java
index f6a03ba..edb5dae 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptVO.java
@@ -328,4 +328,18 @@
     @Excel(name = "鏍囩")
     @ApiModelProperty(value = "鏍囩")
     private String tag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
 }
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
index 9c216e2..5da51d2 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -36,6 +36,20 @@
     private Long scriptno;
 
     /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
+    /**
      * 妯℃澘ID
      */
     @Excel(name = "妯℃澘ID")
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
index 3106441..7e0593b 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -176,8 +176,24 @@
     /**
      * 闂绫诲瀷
      */
-    @ApiModelProperty(value = "闂绫诲瀷")
+    @ApiModelProperty(value = "閫傜敤棰樺瀷锛�1.鍗曢�� 2澶氶�� 3濉┖ 4鍏跺畠锛�")
     private String scriptType;
+
+
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
 
     /**
      * 涓婁紶鏍囪
@@ -251,7 +267,7 @@
      * 涓嬩竴棰�
      */
     @ApiModelProperty(value = "涓嬩竴棰�")
-    private Integer nextScriptno;
+    private Long nextScriptno;
 
     /**
      * 鏍囩
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
index 717b571..224d36b 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
@@ -190,6 +190,13 @@
     private Long pid;
 
     /**
+     * 閫夐」缁彿
+     */
+    @Excel(name = "閫夐」缁彿")
+    @ApiModelProperty(value = "閫夐」缁彿")
+    private Long optionNo;
+
+    /**
      * GUID
      */
     @Excel(name = "GUID")
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
index 388611e..2aad1be 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
@@ -25,7 +25,7 @@
      * 涓婚敭ID
      */
     @ApiModelProperty(value = "涓婚敭")
-    private Long ID;
+    private Long id;
 
     /**
      * 浠诲姟id
@@ -232,4 +232,19 @@
     @ApiModelProperty(value = "鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎")
     private Integer isoperation;
 
+
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/PatArchive.java b/smartor/src/main/java/com/smartor/domain/PatArchive.java
index 1a2d714..31860dc 100644
--- a/smartor/src/main/java/com/smartor/domain/PatArchive.java
+++ b/smartor/src/main/java/com/smartor/domain/PatArchive.java
@@ -28,7 +28,7 @@
      * 鑷ID
      */
     @ApiModelProperty("鑷ID")
-    private Long patid;
+    private Long id;
 
     /**
      * 濮撳悕
@@ -235,8 +235,4 @@
     @Excel(name = " 浼氬憳灞炴��:0闈炰細鍛橈紝1涓�鑸細鍛樸��2閲嶈浼氬憳 ")
     private String viptype;
 
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("patid", getPatid()).append("name", getName()).append("sex", getSex()).append("idcardno", getIdcardno()).append("birthdate", getBirthdate()).append("age", getAge()).append("sourcefrom", getSourcefrom()).append("archivetime", getArchivetime()).append("archiveby", getArchiveby()).append("telcode", getTelcode()).append("relativetelcode", getRelativetelcode()).append("idcardtype", getIdcardtype()).append("orgid", getOrgid()).append("openid", getOpenid()).append("delFlag", getDelFlag()).append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("createBy", getCreateBy()).append("createTime", getCreateTime()).append("isupload", getIsupload()).append("uploadTime", getUploadTime()).toString();
-    }
 }
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubTaskAnswerReq.java b/smartor/src/main/java/com/smartor/domain/ServiceSubTaskAnswerReq.java
new file mode 100644
index 0000000..c141506
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubTaskAnswerReq.java
@@ -0,0 +1,28 @@
+package com.smartor.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 鐢佃瘽闂鍥炵瓟鏄庣粏
+ *
+ * @author ls
+ * @date 2023-06-05
+ */
+@ApiModel(value = "ServiceSubTaskDetailReq", description = "闂鍥炵瓟鏄庣粏")
+@Data
+public class ServiceSubTaskAnswerReq {
+
+    @ApiModelProperty(value = "浠诲姟ID")
+    private String param1;
+
+    @ApiModelProperty(value = "鎮h�匢D")
+    private String param2;
+
+    @ApiModelProperty(value = "璇曞嵎绫诲瀷:1 闅忚   2 闂嵎")
+    private Integer type;
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java b/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java
new file mode 100644
index 0000000..fb719ba
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubTaskCacheReq.java
@@ -0,0 +1,31 @@
+package com.smartor.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 鐢佃瘽闂鍥炵瓟鏄庣粏
+ *
+ * @author ls
+ * @date 2023-06-05
+ */
+@ApiModel(value = "ServiceSubTaskDetailReq", description = "闂鍥炵瓟鏄庣粏")
+@Data
+public class ServiceSubTaskCacheReq {
+
+    @ApiModelProperty(value = "浠诲姟ID")
+    private String param1;
+
+    @ApiModelProperty(value = "鎮h�匢D")
+    private String param2;
+
+    @ApiModelProperty(value = "闂鍥炵瓟鏄庣粏")
+    private List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList;
+
+    @ApiModelProperty(value = "闂鍥炵瓟鏄庣粏")
+    List<SvyLibTemplateScriptVO> svyLibTemplateScriptVOList;
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
index 3f3bfce..412099b 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
@@ -241,4 +241,18 @@
     @ApiModelProperty("svy_lib_script棰樼洰id")
     private Long scriptid;
 
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
index 8bbd5fa..8fdb17d 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateScriptVO.java
@@ -28,6 +28,22 @@
     @ApiModelProperty("鑷ID")
     private Long id;
 
+
+
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
     /**
      * 涓嬩竴涓棶棰樼紪鍙�
      */
diff --git a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
index 1910bd6..6e1845a 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
@@ -57,6 +57,13 @@
     private Long templateID;
 
     /**
+     * 閫夐」缂栧彿
+     */
+    @Excel(name = "閫夐」缂栧彿")
+    @ApiModelProperty(value = "閫夐」缂栧彿")
+    private Long optionNo;
+
+    /**
      * 璇濇湳ID
      */
     @Excel(name = "璇濇湳ID")
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
index 2a1635f..ee77211 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
@@ -23,7 +23,7 @@
     /**
      * 涓婚敭ID
      */
-    private Long ID;
+    private Long id;
 
     /**
      * 浠诲姟id
@@ -189,4 +189,18 @@
     @ApiModelProperty("棰樼洰涓婚")
     private String scriptTopic;
 
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
index d470d0b..9b01476 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
@@ -187,6 +187,22 @@
     @ApiModelProperty(value = "鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎")
     private Integer isoperation;
 
+
+    /**
+     * 閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)
+     */
+    @Excel(name = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鏍囪瘑(0:鏃犲垎鏀�1:鏈夊垎鏀�)")
+    private String branchFlag;
+
+    /**
+     * 閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�
+     */
+    @Excel(name = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    @ApiModelProperty(value = "閫夐」鍒嗘敮鐨勪笅涓�涓瘽鏈紪鍙�")
+    private String branchNextscriptno;
+
+
     /**
      * 璇濇湳閫夐」
      */
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java
index a2e78ef..8d4a4a2 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskAnswerService.java
@@ -1,5 +1,8 @@
 package com.smartor.service;
 
+import com.smartor.domain.ServiceSubTaskAnswerReq;
+import com.smartor.domain.ServiceSubTaskCacheReq;
+import com.smartor.domain.ServiceSubTaskDetailReq;
 import com.smartor.domain.ServiceSubtaskAnswer;
 
 import java.util.List;
@@ -10,8 +13,7 @@
  * @author ruoyi
  * @date 2024-07-18
  */
-public interface IServiceSubtaskAnswerService
-{
+public interface IServiceSubtaskAnswerService {
     /**
      * 鏌ヨ浠诲姟闂嵎闂閫夐」
      *
@@ -59,4 +61,21 @@
      * @return 缁撴灉
      */
     public int deleteServiceSubtaskAnswerById(Long id);
+
+    /**
+     * 灏嗙紦瀛樼殑鏁版嵁淇濆瓨鍒版暟鎹簱
+     *
+     * @param serviceSubTaskAnswerReq
+     * @return
+     */
+    public Integer saveQuestionAnswer(ServiceSubTaskAnswerReq serviceSubTaskAnswerReq);
+
+    /**
+     * 灏嗛棶棰樹繚瀛樺埌缂撳瓨
+     *
+     * @param serviceSubTaskCacheReq
+     * @return
+     */
+    public Integer saveQuestionCache(ServiceSubTaskCacheReq serviceSubTaskCacheReq);
+
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
index 8fb4c45..b4d51d0 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -82,6 +82,6 @@
      */
     public void phoneCallBack(PhoneCallBackVO phoneCallBackVO);
 
-    public Integer saveQuestionAnswer(ServiceSubTaskDetailReq serviceSubTaskDetailReq);
+    public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq);
 
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceTaskService.java b/smartor/src/main/java/com/smartor/service/IServiceTaskService.java
index 1379dc5..b3cec3f 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceTaskService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceTaskService.java
@@ -61,6 +61,12 @@
      */
     public Boolean deleteServiceTaskByTaskid(Long taskid);
 
+    /**
+     *
+     * @param taskid
+     * @param patid
+     * @return
+     */
     public List getScriptInfoByCondition(Long taskid, Long patid);
 
 
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 cd8a0e8..a6da642 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
@@ -248,7 +248,7 @@
                 if (isoperation == 1) {
                     //鏂板
                     ivrTaskTemplateTargetoption.setTemplateID(tmpID);
-                    ivrTaskTemplateTargetoption.setScriptid(ivrTaskTemplateScript.getID());
+                    ivrTaskTemplateTargetoption.setScriptid(ivrTaskTemplateScript.getId());
                     if (CollectionUtils.isNotEmpty(ivrTaskTemplateTargetoption.getDynamiccruxs()))
                         ivrTaskTemplateTargetoption.setDynamiccruxsJson(JSON.toJSONString(ivrTaskTemplateTargetoption.getDynamiccruxs()));
                     if (CollectionUtils.isNotEmpty(ivrTaskTemplateTargetoption.getNodynamiccruxs()))
@@ -257,7 +257,7 @@
                 } else if (isoperation == 2) {
                     //淇敼
                     ivrTaskTemplateTargetoption.setTemplateID(tmpID);
-                    ivrTaskTemplateTargetoption.setScriptid(ivrTaskTemplateScript.getID());
+                    ivrTaskTemplateTargetoption.setScriptid(ivrTaskTemplateScript.getId());
                     if (CollectionUtils.isNotEmpty(ivrTaskTemplateTargetoption.getDynamiccruxs()))
                         ivrTaskTemplateTargetoption.setDynamiccruxsJson(JSON.toJSONString(ivrTaskTemplateTargetoption.getDynamiccruxs()));
                     if (CollectionUtils.isNotEmpty(ivrTaskTemplateTargetoption.getNodynamiccruxs()))
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
index 3a87814..0ce2b89 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -100,9 +100,9 @@
         patArchives.add(patArchive);
         patArchiveMapper.insertPatArchive(patArchives);
         if (CollectionUtils.isNotEmpty(patArchives)) {
-            patArchives.get(0).getPatid();
-            log.info("鎮h�卛d涓�: {}", patArchives.get(0).getPatid());
-            return patArchives.get(0).getPatid().intValue();
+            patArchives.get(0).getId();
+            log.info("鎮h�卛d涓�: {}", patArchives.get(0).getId());
+            return patArchives.get(0).getId().intValue();
         }
         return null;
     }
@@ -137,7 +137,7 @@
                     //鏂板
                     patArchivetag.setUpdateBy(null);
                     patArchivetag.setCreateTime(new Date());
-                    patArchivetag.setPatid(patArchive.getPatid());
+                    patArchivetag.setPatid(patArchive.getId());
                     patArchivetagMapper.insertPatArchivetag(patArchivetag);
                 } else if (patArchivetag.getIsoperation() != null && patArchivetag.getIsoperation() == 3 || patArchivetag.getIsoperation() == null && patArchiveVO.getIsoperation() == 3) {
                     patArchivetag.setDelFlag("1");
@@ -478,7 +478,7 @@
 
 
         //鏍规嵁鎮h�匢D杩涜鍒嗙粍
-        Map<Long, List<PatArchive>> listMap = patArchiveList.stream().collect(Collectors.groupingBy(PatArchive::getPatid));
+        Map<Long, List<PatArchive>> listMap = patArchiveList.stream().collect(Collectors.groupingBy(PatArchive::getId));
 
         //瀵规暟鎹繘琛屽皝瑁�
         for (List<PatArchive> list : listMap.values()) {
@@ -515,7 +515,7 @@
                 for (int j = 0; j < patArchivetags1.size(); j++) {
                     PatArchivetagAndPatientInfo patArchivetagAndPatientInfo = DtoConversionUtils.sourceToTarget(patArchivetags1.get(j), PatArchivetagAndPatientInfo.class);
                     PatArchive patArchive = new PatArchive();
-                    patArchive.setPatid(patArchivetagAndPatientInfo.getPatid());
+                    patArchive.setId(patArchivetagAndPatientInfo.getPatid());
                     List<PatArchive> patArchiveList = patArchiveMapper.selectPatArchiveList(patArchive);
                     patArchivetagAndPatientInfo.setPatNum(patArchiveList.size());
                     // patArchivetagAndPatientInfo.setPatArchives(patArchiveList);
@@ -529,7 +529,7 @@
             for (int j = 0; j < patArchivetags1.size(); j++) {
                 PatArchivetagAndPatientInfo patArchivetagAndPatientInfo = DtoConversionUtils.sourceToTarget(patArchivetags1.get(j), PatArchivetagAndPatientInfo.class);
                 PatArchive patArchive = new PatArchive();
-                patArchive.setPatid(patArchivetagAndPatientInfo.getPatid());
+                patArchive.setId(patArchivetagAndPatientInfo.getPatid());
                 List<PatArchive> patArchiveList = patArchiveMapper.selectPatArchiveList(patArchive);
                 //  patArchivetagAndPatientInfo.setPatArchives(patArchiveList);
                 patArchivetagAndPatientInfo.setPatNum(patArchiveList.size());
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java
index f11a3e5..c1b8d8d 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java
@@ -1,17 +1,14 @@
 package com.smartor.service.impl;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import com.ruoyi.common.utils.DateUtils;
 import com.smartor.domain.PatArchivetag;
-import com.smartor.domain.PatArchivetagAndPatientInfo;
-import com.smartor.mapper.PatArchiveMapper;
 import com.smartor.mapper.PatArchivetagMapper;
 import com.smartor.service.IPatArchivetagService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 鎮h�呮。妗堟爣绛維ervice涓氬姟灞傚鐞�
  *
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 cc6b26f..bf0c347 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -1,13 +1,24 @@
 package com.smartor.service.impl;
 
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
-import com.smartor.domain.ServiceSubtaskAnswer;
+import com.ruoyi.common.utils.RSAPublicKeyExample;
+import com.ruoyi.common.utils.StringUtils;
+import com.smartor.domain.*;
 import com.smartor.mapper.ServiceSubtaskAnswerMapper;
+import com.smartor.mapper.ServiceSubtaskMapper;
 import com.smartor.service.IServiceSubtaskAnswerService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * 浠诲姟闂嵎闂閫夐」Service涓氬姟灞傚鐞�
@@ -15,11 +26,20 @@
  * @author ruoyi
  * @date 2024-07-18
  */
+@Slf4j
 @Service
-public class ServiceSubtaskAnswerServiceImpl implements IServiceSubtaskAnswerService
-{
+public class ServiceSubtaskAnswerServiceImpl implements IServiceSubtaskAnswerService {
     @Autowired
     private ServiceSubtaskAnswerMapper serviceSubtaskAnswerMapper;
+
+    @Autowired
+    private ServiceSubtaskMapper serviceSubtaskMapper;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    @Value("${pri_key}")
+    private String pri_key;
 
     /**
      * 鏌ヨ浠诲姟闂嵎闂閫夐」
@@ -28,8 +48,7 @@
      * @return 浠诲姟闂嵎闂閫夐」
      */
     @Override
-    public ServiceSubtaskAnswer selectServiceSubtaskAnswerById(Long id)
-    {
+    public ServiceSubtaskAnswer selectServiceSubtaskAnswerById(Long id) {
         return serviceSubtaskAnswerMapper.selectServiceSubtaskAnswerById(id);
     }
 
@@ -40,8 +59,7 @@
      * @return 浠诲姟闂嵎闂閫夐」
      */
     @Override
-    public List<ServiceSubtaskAnswer> selectServiceSubtaskAnswerList(ServiceSubtaskAnswer serviceSubtaskAnswer)
-    {
+    public List<ServiceSubtaskAnswer> selectServiceSubtaskAnswerList(ServiceSubtaskAnswer serviceSubtaskAnswer) {
         return serviceSubtaskAnswerMapper.selectServiceSubtaskAnswerList(serviceSubtaskAnswer);
     }
 
@@ -52,8 +70,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int insertServiceSubtaskAnswer(ServiceSubtaskAnswer serviceSubtaskAnswer)
-    {
+    public int insertServiceSubtaskAnswer(ServiceSubtaskAnswer serviceSubtaskAnswer) {
         serviceSubtaskAnswer.setCreateTime(DateUtils.getNowDate());
         return serviceSubtaskAnswerMapper.insertServiceSubtaskAnswer(serviceSubtaskAnswer);
     }
@@ -65,8 +82,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int updateServiceSubtaskAnswer(ServiceSubtaskAnswer serviceSubtaskAnswer)
-    {
+    public int updateServiceSubtaskAnswer(ServiceSubtaskAnswer serviceSubtaskAnswer) {
         serviceSubtaskAnswer.setUpdateTime(DateUtils.getNowDate());
         return serviceSubtaskAnswerMapper.updateServiceSubtaskAnswer(serviceSubtaskAnswer);
     }
@@ -78,8 +94,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int deleteServiceSubtaskAnswerByIds(Long[] ids)
-    {
+    public int deleteServiceSubtaskAnswerByIds(Long[] ids) {
         return serviceSubtaskAnswerMapper.deleteServiceSubtaskAnswerByIds(ids);
     }
 
@@ -90,8 +105,146 @@
      * @return 缁撴灉
      */
     @Override
-    public int deleteServiceSubtaskAnswerById(Long id)
-    {
+    public int deleteServiceSubtaskAnswerById(Long id) {
         return serviceSubtaskAnswerMapper.deleteServiceSubtaskAnswerById(id);
     }
+
+    @Override
+    public Integer saveQuestionAnswer(ServiceSubTaskAnswerReq serviceSubTaskAnswerReq) {
+        Set<String> allKeys = redisCache.getAllKeys();
+        if (ObjectUtils.isNotEmpty(serviceSubTaskAnswerReq)) {
+            //闇�瑕佺珛鍗虫墽琛�
+            RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+            Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam1(), pri_key));
+            Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam2(), pri_key));
+            allKeys = new HashSet<>();
+            if (serviceSubTaskAnswerReq.getType() == 1) {
+                allKeys.add(redisCache.getCacheObject(pid + "-" + tid + "-SFscriptCache"));
+            } else if (serviceSubTaskAnswerReq.getType() == 2) {
+                allKeys.add(redisCache.getCacheObject(pid + "-" + tid + "-WJscriptCache"));
+            }
+        }
+
+        Long nextScriptno = null;
+        for (String key : allKeys) {
+            String[] split = key.split("-");
+            if (key.contains("-SFscriptCache")) {
+                //鍖呭惈浜�,璇存槑浜嗘槸闅忚闂
+                List<IvrLibaTemplateScriptVO> cacheList = redisCache.getCacheList(key);
+                for (int i = 0; i < cacheList.size(); i++) {
+                    if (i == 0) {
+                        // 璇存槑鏄涓�棰�
+                        IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO = cacheList.get(0);
+                        //灏嗙涓�棰樼殑淇℃伅鏀惧埌琛ㄤ腑
+                        setSFInfo(ivrLibaTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]));
+                        nextScriptno = cacheList.get(0).getNextScriptno();
+                    } else {
+                        //涓嶆槸绗� 涓� 棰�
+                        for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : cacheList) {
+                            if (ivrLibaTemplateScriptVO.getId() == nextScriptno) {
+                                setSFInfo(ivrLibaTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]));
+                                nextScriptno = ivrLibaTemplateScriptVO.getNextScriptno();
+                            }
+                        }
+                    }
+                }
+            } else if (key.contains("-WJscriptCache")) {
+                List<SvyLibTemplateScriptVO> cacheList = redisCache.getCacheList(key);
+                for (int i = 0; i < cacheList.size(); i++) {
+                    if (i == 0) {
+                        // 璇存槑鏄涓�棰�
+                        //灏嗙涓�棰樼殑淇℃伅鏀惧埌琛ㄤ腑
+                        setWJInfo(cacheList.get(0), Long.valueOf(split[1]), Long.valueOf(split[0]));
+                        nextScriptno = Long.valueOf(cacheList.get(0).getNextScriptno());
+                    } else {
+                        for (SvyLibTemplateScriptVO svyLibTemplateScriptVO : cacheList) {
+                            if (svyLibTemplateScriptVO.getId() == nextScriptno) {
+                                //灏嗙涓�棰樼殑淇℃伅鏀惧埌琛ㄤ腑
+                                setWJInfo(svyLibTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]));
+                                nextScriptno = Long.valueOf(cacheList.get(0).getNextScriptno());
+                            }
+
+                        }
+                    }
+                }
+            }
+            //灏嗚key鍜寁alue浠巖edis涓紝鍒犻櫎
+            redisCache.deleteObject(key);
+        }
+        return 1;
+    }
+
+    /**
+     * 灏嗛棶棰樹繚瀛樺埌缂撳瓨涓�
+     *
+     * @param serviceSubTaskCacheReq
+     * @return
+     */
+    @Override
+    public Integer saveQuestionCache(ServiceSubTaskCacheReq serviceSubTaskCacheReq) {
+        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+        Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskCacheReq.getParam1(), pri_key));
+        Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskCacheReq.getParam2(), pri_key));
+        if (CollectionUtils.isNotEmpty(serviceSubTaskCacheReq.getIvrLibaTemplateScriptVOList())) {
+            //闅忚
+            redisCache.setCacheObject(pid + "-" + tid + "-SFscriptCache", serviceSubTaskCacheReq.getIvrLibaTemplateScriptVOList());
+        } else if (CollectionUtils.isNotEmpty(serviceSubTaskCacheReq.getSvyLibTemplateScriptVOList())) {
+            //闂嵎
+            redisCache.setCacheObject(pid + "-" + tid + "-WJscriptCache", serviceSubTaskCacheReq.getSvyLibTemplateScriptVOList());
+        }
+        return 1;
+    }
+
+
+    private void setSFInfo(IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO, Long taskid, Long patid) {
+        ServiceSubtaskAnswer serviceSubtaskAnswer = null;
+        String dx = "";
+        if (ivrLibaTemplateScriptVO.getScriptType().equals("1") || ivrLibaTemplateScriptVO.getScriptType().equals("2")) {
+            //1銆�2涓哄崟閫夋垨澶氶��
+            for (IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption : ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList()) {
+                //鑾峰彇鐢ㄦ埛閫変腑鐨勯�夐」鍙�
+                dx = dx + "," + ivrLibaTemplateTargetoption.getOptionNo().toString();
+            }
+        } else {
+            //闈炲崟澶氶��
+            if (CollectionUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList())) {
+                dx = ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(0).getAppenddesc();
+            }
+        }
+        serviceSubtaskAnswer.setTaskid(Long.valueOf(taskid));
+        serviceSubtaskAnswer.setPatId(Long.valueOf(patid));
+        serviceSubtaskAnswer.setScriptid(ivrLibaTemplateScriptVO.getId());
+        serviceSubtaskAnswer.setScriptType(Long.valueOf(ivrLibaTemplateScriptVO.getScriptType()));
+        serviceSubtaskAnswer.setAnswer(dx.substring(1));
+        serviceSubtaskAnswer.setComment(null);
+        serviceSubtaskAnswer.setCreateTime(new Date());
+        serviceSubtaskAnswer.setUpdateTime(new Date());
+        serviceSubtaskAnswerMapper.insertServiceSubtaskAnswer(serviceSubtaskAnswer);
+    }
+
+    private void setWJInfo(SvyLibTemplateScriptVO svyLibTemplateScriptVO, Long taskid, Long patid) {
+        ServiceSubtaskAnswer serviceSubtaskAnswer = null;
+        String dx = "";
+        if (svyLibTemplateScriptVO.getScriptType().equals("1") || svyLibTemplateScriptVO.getScriptType().equals("2")) {
+            //1銆�2涓哄崟閫夋垨澶氶��
+            for (SvyLibTemplateTargetoption svyLibTemplateTargetoption : svyLibTemplateScriptVO.getSvyLibTemplateTargetoptions()) {
+                //鑾峰彇鐢ㄦ埛閫変腑鐨勯�夐」鍙�
+                dx = dx + "," + svyLibTemplateTargetoption.getOptionNo().toString();
+            }
+        } else {
+            //闈炲崟澶氶��
+            if (CollectionUtils.isNotEmpty(svyLibTemplateScriptVO.getSvyLibTemplateTargetoptions())) {
+                dx = svyLibTemplateScriptVO.getSvyLibTemplateTargetoptions().get(0).getAppenddesc();
+            }
+        }
+        serviceSubtaskAnswer.setTaskid(Long.valueOf(taskid));
+        serviceSubtaskAnswer.setPatId(Long.valueOf(patid));
+        serviceSubtaskAnswer.setScriptid(svyLibTemplateScriptVO.getId());
+        serviceSubtaskAnswer.setScriptType(Long.valueOf(svyLibTemplateScriptVO.getScriptType()));
+        serviceSubtaskAnswer.setAnswer(dx.substring(1));
+        serviceSubtaskAnswer.setComment(null);
+        serviceSubtaskAnswer.setCreateTime(new Date());
+        serviceSubtaskAnswer.setUpdateTime(new Date());
+        serviceSubtaskAnswerMapper.insertServiceSubtaskAnswer(serviceSubtaskAnswer);
+    }
 }
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 dc3c9ec..8247b8a 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -759,7 +759,7 @@
 //    }
 
     @Override
-    public Integer saveQuestionAnswer(ServiceSubTaskDetailReq serviceSubTaskDetailReq) {
+    public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq) {
         RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
         Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskDetailReq.getParam1(), pri_key));
         Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskDetailReq.getParam2(), pri_key));
diff --git a/smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java
index 15cf5da..fbcb8e1 100644
--- a/smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java
@@ -246,7 +246,7 @@
                 if (isoperation == 1) {
                     //鏂板
                     svyTaskTemplateTargetoption.setTemplateID(tmpID);
-                    svyTaskTemplateTargetoption.setScriptid(svyTaskTemplateScript.getID());
+                    svyTaskTemplateTargetoption.setScriptid(svyTaskTemplateScript.getId());
                     if (CollectionUtils.isNotEmpty(svyTaskTemplateTargetoption.getDynamiccruxs()))
                         svyTaskTemplateTargetoption.setDynamiccruxsJson(JSON.toJSONString(svyTaskTemplateTargetoption.getDynamiccruxs()));
                     if (CollectionUtils.isNotEmpty(svyTaskTemplateTargetoption.getNodynamiccruxs()))
@@ -255,7 +255,7 @@
                 } else if (isoperation == 2) {
                     //淇敼
                     svyTaskTemplateTargetoption.setTemplateID(tmpID);
-                    svyTaskTemplateTargetoption.setScriptid(svyTaskTemplateScript.getID());
+                    svyTaskTemplateTargetoption.setScriptid(svyTaskTemplateScript.getId());
                     if (CollectionUtils.isNotEmpty(svyTaskTemplateTargetoption.getDynamiccruxs()))
                         svyTaskTemplateTargetoption.setDynamiccruxsJson(JSON.toJSONString(svyTaskTemplateTargetoption.getDynamiccruxs()));
                     if (CollectionUtils.isNotEmpty(svyTaskTemplateTargetoption.getNodynamiccruxs()))
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
index 68d7b34..58ddb07 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
@@ -42,11 +42,15 @@
         <result property="isMust" column="is_must"/>
         <result property="scriptDesc" column="script_desc"/>
         <result property="scriptType" column="script_type"/>
+        <result property="branchFlag" column="branch_flag"/>
+        <result property="branchNextscriptno" column="branch_nextscriptno"/>
     </resultMap>
 
     <sql id="selectIvrLibaTemplateScriptVo">
         select id,
                scriptno,
+               branch_flag,
+               branch_nextscriptno,
                templateid,
                script_type,
                scriptid,
@@ -104,6 +108,9 @@
             <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>
@@ -170,6 +177,8 @@
             <if test="isMust != null  and isMust != ''">is_must,</if>
             <if test="scriptDesc != null ">script_desc,</if>
             <if test="scriptType != null ">script_type,</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag,</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="scriptno != null">#{scriptno},</if>
@@ -207,6 +216,8 @@
             <if test="isMust != null  and isMust != ''">#{isMust},</if>
             <if test="scriptDesc != null ">#{scriptDesc},</if>
             <if test="scriptType != null ">#{scriptType},</if>
+            <if test="branchFlag != null  and branchFlag != ''">#{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">#{branchNextscriptno},</if>
         </trim>
     </insert>
 
@@ -247,8 +258,12 @@
             <if test="isMust != null  and isMust != ''">is_must = #{isMust}</if>
             <if test="scriptDesc != null ">script_desc = #{scriptDesc}</if>
             <if test="scriptType != null ">script_type = #{scriptType}</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag = #{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno =
+                #{branchNextscriptno},
+            </if>
         </trim>
-        where ID = #{ID}
+        where id = #{id}
     </update>
 
     <update id="deleteIvrLibaTemplateScriptByID" parameterType="Long">
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
index 8f8c705..491347f 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
@@ -35,6 +35,7 @@
         <result property="nextQuestion" column="next_question"/>
         <result property="appendflag" column="appendflag"/>
         <result property="appenddesc" column="appenddesc"/>
+        <result property="optionNo" column="option_no"/>
     </resultMap>
 
     <sql id="selectIvrLibaTemplateTargetoptionVo">
@@ -53,6 +54,7 @@
                nodynamiccruxs,
                dynamiccruxs,
                targetid,
+               option_no,
                next_question,
                optiondesc, language, version, groupid, isabnormal, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid
         from ivr_liba_template_targetoption
@@ -88,6 +90,7 @@
             <if test="dynamiccruxsJson != null ">and dynamiccruxs = #{dynamiccruxsJson}</if>
             <if test="appendflag != null">and appendflag = #{appendflag}</if>
             <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
+            <if test="optionNo != null">and option_no = #{optionNo}</if>
         </where>
     </select>
 
@@ -130,6 +133,7 @@
             <if test="dynamiccruxsJson != null ">dynamiccruxs,</if>
             <if test="appendflag != null">appendflag,</if>
             <if test="appenddesc != null">appenddesc,</if>
+            <if test="optionNo != null">option_no,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="targetid != null">#{targetid},</if>
@@ -161,6 +165,7 @@
             <if test="dynamiccruxsJson != null ">#{dynamiccruxsJson},</if>
             <if test="appendflag != null">#{appendflag},</if>
             <if test="appenddesc != null">#{appenddesc},</if>
+            <if test="optionNo != null">#{optionNo},</if>
         </trim>
     </insert>
 
@@ -196,6 +201,7 @@
             <if test="dynamiccruxsJson != null ">dynamiccruxs = #{dynamiccruxsJson},</if>
             <if test="appendflag != null">appendflag = #{appendflag},</if>
             <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
+            <if test="optionNo != null">option_no = #{optionNo},</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 039463b..9148cff 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
@@ -5,7 +5,7 @@
 <mapper namespace="com.smartor.mapper.IvrTaskTemplateScriptMapper">
 
     <resultMap type="com.smartor.domain.IvrTaskTemplateScript" id="IvrTaskTemplateScriptResult">
-        <result property="ID"    column="ID"    />
+        <result property="id"    column="id"    />
         <result property="taskid"    column="taskid"    />
         <result property="templateID"    column="templateID"    />
         <result property="questionPoint"    column="questionPoint"    />
@@ -38,10 +38,12 @@
         <result property="otherdata"    column="otherdata"    />
         <result property="isMust"    column="is_must"    />
         <result property="questionResult"    column="question_result"    />
+        <result property="branchFlag" column="branch_flag"/>
+        <result property="branchNextscriptno" column="branch_nextscriptno"/>
     </resultMap>
 
     <sql id="selectIvrTaskTemplateScriptVo">
-        select ID, taskid,  templateID, questionPoint,  noMatchText, noMatchVoice, slienceText, slienceVoice, submoduleText, submoduleVoice, noClearlyText, noClearlyVoice, categoryName, 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
+        select ID, taskid,branch_flag,branch_nextscriptno,  templateID, questionPoint,  noMatchText, noMatchVoice, slienceText, slienceVoice, submoduleText, submoduleVoice, noClearlyText, noClearlyVoice, categoryName, 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>
 
     <select id="selectIvrTaskTemplateScriptList" parameterType="com.smartor.domain.IvrTaskTemplateScript" resultMap="IvrTaskTemplateScriptResult">
@@ -74,12 +76,15 @@
             <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="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno = #{branchNextscriptno}
+            </if>
         </where>
     </select>
 
     <select id="selectIvrTaskTemplateScriptByID" parameterType="Long" resultMap="IvrTaskTemplateScriptResult">
         <include refid="selectIvrTaskTemplateScriptVo"/>
-        where ID = #{ID}
+        where id = #{id}
     </select>
 
     <insert id="insertIvrTaskTemplateScript" parameterType="com.smartor.domain.IvrTaskTemplateScript" useGeneratedKeys="true" keyProperty="ID">
@@ -117,6 +122,8 @@
             <if test="otherdata != null">otherdata,</if>
             <if test="isMust != null">is_must,</if>
             <if test="questionResult != null">question_result,</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag,</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -151,6 +158,8 @@
             <if test="otherdata != null">#{otherdata},</if>
             <if test="isMust != null">#{isMust},</if>
             <if test="questionResult != null">#{questionResult},</if>
+            <if test="branchFlag != null  and branchFlag != ''">#{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">#{branchNextscriptno},</if>
          </trim>
     </insert>
 
@@ -189,8 +198,12 @@
             <if test="otherdata != null">otherdata = #{otherdata},</if>
             <if test="isMust != null">is_must = #{isMust},</if>
             <if test="questionResult != null">question_result = #{questionResult},</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag = #{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno =
+                #{branchNextscriptno},
+            </if>
         </trim>
-        where ID = #{ID}
+        where id = #{id}
     </update>
 
     <delete id="deleteIvrTaskTemplateScriptByID" parameterType="Long">
@@ -198,9 +211,9 @@
     </delete>
 
     <delete id="deleteIvrTaskTemplateScriptByIDs" parameterType="String">
-        delete from ivr_task_template_script where ID in
-        <foreach item="ID" collection="array" open="(" separator="," close=")">
-            #{ID}
+        delete from ivr_task_template_script where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
         </foreach>
     </delete>
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 31d5826..f0eb828 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -5,7 +5,7 @@
 <mapper namespace="com.smartor.mapper.PatArchiveMapper">
 
     <resultMap type="com.smartor.domain.PatArchive" id="PatArchiveResult">
-        <result property="patid" column="patid"/>
+        <result property="id" column="id"/>
         <result property="name" column="name"/>
         <result property="sex" column="sex"/>
         <result property="nation" column="nation"/>
@@ -39,7 +39,7 @@
     </resultMap>
 
     <sql id="selectPatArchiveVo">
-        select patid,
+        select id,
                name,
                sex,
                idcardno,
@@ -77,7 +77,7 @@
             <if test="sourcefrom != null ">and sourcefrom = #{sourcefrom}</if>
             <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
             <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="patid != null  and patid != ''">and patid = #{patid}</if>
+            <if test="id != null  and id != ''">and id = #{id}</if>
             <if test="isupload != null ">and isupload = #{isupload}</if>
             <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
             <if test="viptype != null ">and viptype = #{viptype}</if>
@@ -87,7 +87,7 @@
 
     <select id="patInfoByContion" parameterType="com.smartor.domain.PatArchiveReq" resultMap="PatArchiveResult">
         select
-        a.patid,
+        a.id,
         a.name,
         a.sex,
         c.tagname as tag,
@@ -102,7 +102,7 @@
         from pat_archive a,pat_archivetag b ,base_tag c
         <where>
             a.del_flag=0 and
-            a.patid = b.patid and b.tagid = c.tagid
+            a.id = b.patid and b.tagid = c.tagid
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
             <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
@@ -116,7 +116,7 @@
 
     <select id="selectPatArchiveByPatid" parameterType="Long" resultMap="PatArchiveResult">
         <include refid="selectPatArchiveVo"/>
-        where patid = #{patid} and del_flag=0
+        where id = #{id} and del_flag=0
     </select>
 
     <insert id="insertPatArchive">
@@ -206,19 +206,19 @@
             <if test="uploadTime != null">upload_time = #{uploadTime},</if>
             <if test="viptype != null">viptype = #{viptype},</if>
         </trim>
-        where patid = #{patid}
+        where id = #{id}
     </update>
 
     <delete id="deletePatArchiveByPatid" parameterType="Long">
         delete
         from pat_archive
-        where patid = #{patid}
+        where id = #{id}
     </delete>
 
     <delete id="deletePatArchiveByPatids" parameterType="String">
-        delete from pat_archive where patid in
-        <foreach item="patid" collection="array" open="(" separator="," close=")">
-            #{patid}
+        delete from pat_archive where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
         </foreach>
     </delete>
 
@@ -226,7 +226,7 @@
             resultMap="PatArchiveResult">
 
         SELECT
-        a.patid,
+        a.id,
         a.NAME,
         a.sex,
         a.nation,
@@ -257,12 +257,12 @@
         b.tagid AS tagid
         FROM
         pat_archive a
-        LEFT JOIN pat_archivetag b ON a.patid = b.patid AND b.del_flag = 0
+        LEFT JOIN pat_archivetag b ON a.id = b.patid AND b.del_flag = 0
         <where>
             a.del_flag = 0
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
-            <if test="pid != null  and pid != ''">and a.patid = #{pid}</if>
+            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
             <if test="tagIds != null  and tagIds != ''">and b.tagid in
                 <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">
@@ -278,7 +278,7 @@
             resultMap="PatArchiveResult">
 
         select
-        a.patid,
+        a.id,
         a.NAME,
         d.deptname,
         a.sex,
@@ -311,13 +311,13 @@
         t.tagname
         FROM
         pat_med_inhosp d
-        JOIN pat_archive a ON a.patid = d.patid
+        JOIN pat_archive a ON a.id = d.patid
         LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
-            <if test="pid != null  and pid != ''">and a.patid = #{pid}</if>
+            <if test="pid != null  and pid != ''">and a.id = #{id}</if>
             <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
 
             <if test="hospitalname != null and hospitalname != ''">
@@ -348,7 +348,7 @@
                 AND d.deptname LIKE concat('%',#{deptname}, '%')
             </if>
             <if test="pids != null">
-                AND a.patid NOT IN
+                AND a.id NOT IN
                 <foreach collection="pids" item="pid" open="(" separator="," close=")">
                     #{pid}
                 </foreach>
@@ -362,7 +362,7 @@
             resultMap="PatArchiveResult">
 
         select
-        a.patid,
+        a.id,
         d.deptname,
         a.name,
         a.sex,
@@ -390,11 +390,11 @@
         a.isupload,
         a.upload_time,
         a.pattype
-        from pat_med_outhosp d JOIN pat_archive a ON a.patid = d.patid
+        from pat_med_outhosp d JOIN pat_archive a ON a.id = d.patid
         LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
-            <if test="pid != null  and pid != ''">and a.patid = #{pid}</if>
+            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
             <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
@@ -417,7 +417,7 @@
                 AND d.drname LIKE concat('%',#{drname}, '%')
             </if>
             <if test="pids != null">
-                AND a.patid NOT IN
+                AND a.id NOT IN
                 <foreach collection="pids" item="pid" open="(" separator="," close=")">
                     #{pid}
                 </foreach>
@@ -431,7 +431,7 @@
             resultMap="PatArchiveResult">
 
         select
-        a.patid as id,
+        a.id,
         a.name,
         a.sex,
         d.deptname,
@@ -459,11 +459,11 @@
         a.isupload,
         a.upload_time,
         a.pattype
-        from pat_med_physical d JOIN pat_archive a ON a.patid = d.patid
+        from pat_med_physical d JOIN pat_archive a ON a.id = d.patid
         LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
-            <if test="pid != null  and pid != ''">and a.patid = #{pid}</if>
+            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
             <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
@@ -487,7 +487,7 @@
                 AND d.drname LIKE concat('%',#{drname}, '%')
             </if>
             <if test="pids != null">
-                AND a.patid NOT IN
+                AND a.id NOT IN
                 <foreach collection="pids" item="pid" open="(" separator="," close=")">
                     #{pid}
                 </foreach>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
index 0cf2399..cbdcb5c 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateScriptMapper.xml
@@ -38,12 +38,16 @@
         <result property="score" column="score"/>
         <result property="scriptPicture" column="script_picture"/>
         <result property="scriptTopic" column="script_topic"/>
+        <result property="branchFlag" column="branch_flag"/>
+        <result property="branchNextscriptno" column="branch_nextscriptno"/>
     </resultMap>
 
     <sql id="selectSvyLibTemplateScriptVo">
         select id,
                script_type,
                scriptid,
+               branchFlag,
+               branchNextscriptno,
                svyid,
                scriptno,
                next_scriptno,
@@ -103,6 +107,9 @@
             <if test="score != null  and score != ''">and score = #{score}</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>
         </where>
     </select>
 
@@ -147,6 +154,8 @@
             <if test="scriptPicture != null">script_picture,</if>
             <if test="scriptTopic != null">script_topic,</if>
             <if test="svyid != null">svyid,</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag,</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="nextScriptno != null">#{nextScriptno},</if>
@@ -181,6 +190,8 @@
             <if test="scriptPicture != null">#{scriptPicture},</if>
             <if test="scriptTopic != null">#{scriptTopic},</if>
             <if test="svyid != null">#{svyid},</if>
+            <if test="branchFlag != null  and branchFlag != ''">#{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">#{branchNextscriptno},</if>
         </trim>
     </insert>
 
@@ -219,6 +230,10 @@
             <if test="scriptPicture != null">script_picture = #{scriptPicture},</if>
             <if test="scriptTopic != null">script_topic = #{scriptTopic},</if>
             <if test="svyid != null">svyid = #{svyid},</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag = #{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno =
+                #{branchNextscriptno},
+            </if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
index ef5b727..505218f 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
@@ -39,12 +39,14 @@
         <result property="score" column="score"/>
         <result property="appendflag" column="appendflag"/>
         <result property="appenddesc" column="appenddesc"/>
+        <result property="optionNo" column="option_no"/>
     </resultMap>
 
     <sql id="selectSvyLibTemplateTargetoptionVo">
         select id,
                groupid,
                score,
+               option_no,
                appendflag,
                appenddesc,
                categoryName,
@@ -103,6 +105,7 @@
             <if test="picturePath != null  and picturePath != ''">and picture_path = #{picturePath}</if>
             <if test="appendflag != null">and appendflag = #{appendflag}</if>
             <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
+            <if test="optionNo != null">and option_no = #{optionNo}</if>
         </where>
     </select>
 
@@ -148,6 +151,7 @@
             <if test="score != null">score,</if>
             <if test="appendflag != null">appendflag,</if>
             <if test="appenddesc != null">appenddesc,</if>
+            <if test="optionNo != null">option_no,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="groupid != null">#{groupid},</if>
@@ -183,6 +187,7 @@
             <if test="score != null">#{score},</if>
             <if test="appendflag != null">#{appendflag},</if>
             <if test="appenddesc != null">#{appenddesc},</if>
+            <if test="optionNo != null">#{optionNo},</if>
         </trim>
     </insert>
 
@@ -222,6 +227,7 @@
             <if test="score != null">score = #{score},</if>
             <if test="appendflag != null">appendflag = #{appendflag},</if>
             <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
+            <if test="optionNo != null">option_no = #{optionNo},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
index b209d3b..8e0262d 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
@@ -5,7 +5,7 @@
 <mapper namespace="com.smartor.mapper.SvyTaskTemplateScriptMapper">
 
     <resultMap type="com.smartor.domain.SvyTaskTemplateScript" id="SvyTaskTemplateScriptResult">
-        <result property="ID" column="ID"/>
+        <result property="id" column="id"/>
         <result property="taskid" column="taskid"/>
         <result property="scriptno" column="scriptno"/>
         <result property="templateID" column="templateID"/>
@@ -36,11 +36,16 @@
         <result property="picturePath" column="picture_path"/>
         <result property="sort" column="sort"/>
         <result property="scriptTopic" column="script_topic"/>
+        <result property="branchFlag" column="branch_flag"/>
+        <result property="branchNextscriptno" column="branch_nextscriptno"/>
+
     </resultMap>
 
     <sql id="selectSvyTaskTemplateScriptVo">
-        select ID,
+        select id,
                sort,
+               branchFlag,
+               branchNextscriptno,
                script_desc,
                taskid,
                scriptno,
@@ -80,12 +85,16 @@
             <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
             <if test="picturePath != null  and picturePath != ''">and picture_path = #{picturePath}</if>
             <if test="scriptTopic != null  and scriptTopic != ''">and script_topic = #{scriptTopic}</if>
+            <if test="branchFlag != null  and branchFlag != ''">and branch_flag = #{branchFlag}</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">and branch_nextscriptno =
+                #{branchNextscriptno}
+            </if>
         </where>
     </select>
 
     <select id="selectSvyTaskTemplateScriptByID" parameterType="Long" resultMap="SvyTaskTemplateScriptResult">
         <include refid="selectSvyTaskTemplateScriptVo"/>
-        where ID = #{ID}
+        where id = #{id}
     </select>
 
     <insert id="insertSvyTaskTemplateScript" parameterType="com.smartor.domain.SvyTaskTemplateScript"
@@ -122,6 +131,8 @@
             <if test="picturePath != null">picture_path,</if>
             <if test="sort != null">sort,</if>
             <if test="scriptTopic != null">script_topic,</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag,</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="taskid != null">#{taskid},</if>
@@ -154,6 +165,8 @@
             <if test="picturePath != null">#{picturePath},</if>
             <if test="sort != null">#{sort},</if>
             <if test="scriptTopic != null">#{scriptTopic},</if>
+            <if test="branchFlag != null  and branchFlag != ''">#{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">#{branchNextscriptno},</if>
         </trim>
     </insert>
 
@@ -190,20 +203,24 @@
             <if test="picturePath != null">picture_path = #{picturePath},</if>
             <if test="sort != null">sort = #{sort},</if>
             <if test="scriptTopic != null">script_topic = #{scriptTopic},</if>
+            <if test="branchFlag != null  and branchFlag != ''">branch_flag = #{branchFlag},</if>
+            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno =
+                #{branchNextscriptno},
+            </if>
         </trim>
-        where ID = #{ID}
+        where id = #{d}
     </update>
 
     <delete id="deleteSvyTaskTemplateScriptByID" parameterType="Long">
         delete
         from svy_task_template_script
-        where ID = #{ID}
+        where id = #{id}
     </delete>
 
     <delete id="deleteSvyTaskTemplateScriptByIDs" parameterType="String">
-        delete from svy_task_template_script where ID in
-        <foreach item="ID" collection="array" open="(" separator="," close=")">
-            #{ID}
+        delete from svy_task_template_script where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
         </foreach>
     </delete>
 </mapper>

--
Gitblit v1.9.3