From 723d38375c45d24737bfef6f33a9686254abf99b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 17 十月 2024 13:42:27 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml                       |  336 +++++++++++++++--------------
 ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java                                  |    2 
 smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java                             |   30 ++
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java              |  132 +++++++++--
 ruoyi-admin/src/main/resources/application-druid.yml                                       |   45 ++-
 smartor/src/main/java/com/smartor/domain/PullTaskVO.java                                   |    4 
 smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java                 |    3 
 smartor/src/main/java/com/smartor/domain/PatArchiveImport.java                             |    4 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java |   42 +--
 smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java            |   19 +
 smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java                      |    1 
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                         |    7 
 12 files changed, 379 insertions(+), 246 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
index 3ede9ae..e0ab472 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -6,6 +6,7 @@
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
+import org.springframework.scheduling.annotation.EnableAsync;
 
 /**
  * 鍚姩绋嬪簭
@@ -14,6 +15,7 @@
  */
 //@SpringBootApplication(scanBasePackages="com.smartor",exclude = { DataSourceAutoConfiguration.class })
 @SpringBootApplication(scanBasePackages = {"com.ruoyi", "com.smartor"}, exclude = {DataSourceAutoConfiguration.class, MultipartAutoConfiguration.class})
+@EnableAsync
 @MapperScan(value = "com.smartor.mapper")
 public class RuoYiApplication {
     public static void main(String[] args) {
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java
index 98a636d..c7c282c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java
@@ -1,37 +1,23 @@
 package com.ruoyi.web.controller.smartor;
 
-import java.util.List;
-
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUtils;
-import com.smartor.domain.SvyLibScriptRes;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
-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;
-import org.springframework.web.bind.annotation.RestController;
 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.file.FileUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.smartor.domain.PatArchiveImport;
 import com.smartor.service.IPatArchiveImportService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * Excel瀵煎叆鎮h�呮。妗圕ontroller
@@ -106,7 +92,7 @@
      * @param response
      */
     @ApiOperation("鑾峰彇瀵煎叆鎮h�呮ā鏉�")
-    @GetMapping("/getImportPatTemplate")
+    @PostMapping("/getImportPatTemplate")
     public void getImportPatTemplate(HttpServletResponse response) {
         ExcelUtil<PatArchiveImport> util = new ExcelUtil<PatArchiveImport>(PatArchiveImport.class);
         util.importTemplateExcel(response, "瀵煎叆鎮h��");
@@ -128,7 +114,7 @@
     @ApiOperation("瀵煎叆Excel鎮h�呬俊鎭�")
     //@PreAuthorize("@ss.hasPermi('smartor:import:list')")
     @PostMapping("/importPatInfo")
-    public TableDataInfo importPatInfo(MultipartFile multipartFile) {
-        return getDataTable(patArchiveImportService.importPatInfo(multipartFile));
+    public TableDataInfo importPatInfo(MultipartFile file) {
+        return getDataTable(patArchiveImportService.importPatInfo(file));
     }
 }
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index ef8d07c..c588888 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -11,28 +11,26 @@
         #        username: root
         #        password: 123456
         #        鍏徃
-#        url: jdbc:mysql://450scrp46939.vicp.fun:59876/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-#        url: jdbc:mysql://192.168.1.16:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        ##        url: jdbc:mysql://450scrp46939.vicp.fun:59876/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://192.168.2.9:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        #        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
         username: smartor
         password: Smartor.2023
         driverClassName: com.mysql.cj.jdbc.Driver
       # 浠庡簱鏁版嵁婧�
       slave:
         # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(鍏徃)
-        enabled: true
-        url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor
-        username: sa
-        password: Hxerp2000
-        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
-
-
+        #        enabled: true
+        #        url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor
+        #        username: sa
+        #        password: Hxerp2000
+        #        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
         # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(涔変箤浜岄櫌)
-      #        enabled: true
-      #        url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor
-      #        username: sa
-      #        password: sfxt#2023
-      #        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
+        enabled: true
+        url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor
+        username: sa
+        password: sfxt#2023
+        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
       # 鍒濆杩炴帴鏁�
       initialSize: 5
       # 鏈�灏忚繛鎺ユ睜鏁伴噺
@@ -138,16 +136,21 @@
 #浜岀淮鐮佽矾寰�
 qrpath: D:\qrcode
 
-##鍏徃鍐呭閾捐姹侷P鍜岀鍙e彿
-#req_path: 8096
-#localIP: 192.168.1.10
+#鍏徃鍐呭閾捐姹侷P鍜岀鍙e彿
+req_path: 8095
+localIP: 192.168.2.10
 
-#鏂板崕鍖婚櫌澶栭摼璇锋眰IP鍜岀鍙e彿
-req_path: 8093
-localIP: 218.108.11.22
+##鏂板崕鍖婚櫌澶栭摼璇锋眰IP鍜岀鍙e彿
+#req_path: 8093
+#localIP: 218.108.11.22
 
 #鑾峰彇鎮h�呬俊鎭疷RL(鍗庡崜鎻愪緵)
 hosp_info_url: http://esb-core-rest.wowjoy.cn/esb/exchange
 
 # 0浠h〃璧伴粯璁ょ殑涓婁紶    1 浠g爜璧版柊鍗庡尰闄㈢殑涓婁紶
 uploadSwitch: 1
+
+#  鎸囧畾asr鍥炶皟鐨剈rl璺緞
+ASRCallBackPath: http://192.168.2.10:8095/smartor/serviceSubtask/phoneCallBackYQ
+#鎸傛柇IP
+hangup: http://192.168.2.10:8091/hangup
diff --git a/smartor/src/main/java/com/smartor/domain/PatArchiveImport.java b/smartor/src/main/java/com/smartor/domain/PatArchiveImport.java
index 2e4d0a2..8c9203f 100644
--- a/smartor/src/main/java/com/smartor/domain/PatArchiveImport.java
+++ b/smartor/src/main/java/com/smartor/domain/PatArchiveImport.java
@@ -35,7 +35,7 @@
      * 璇佷欢鍙风爜
      */
     @ApiModelProperty("璇佷欢鍙风爜")
-    @Excel(name = "璇佷欢鍙风爜(蹇呭~)",cellType = Excel.ColumnType.NUMERIC)
+    @Excel(name = "璇佷欢鍙风爜(蹇呭~)",cellType = Excel.ColumnType.STRING)
     private String idcardno;
 
     /**
@@ -49,7 +49,7 @@
      * 鎵规鍚嶇О
      */
     @ApiModelProperty("鎵规鍚嶇О")
-    @Excel(name = "鎵规鍚嶇О锛堝繀濉級",cellType = Excel.ColumnType.STRING)
+    @Excel(name = "鎵规鍚嶇О",cellType = Excel.ColumnType.STRING)
     private String batchName;
 
 
diff --git a/smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java b/smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java
index f1fab10..12da5cb 100644
--- a/smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java
+++ b/smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java
@@ -128,4 +128,34 @@
     @ApiModelProperty(value = "褰撳墠鍙ュ瓙鐨勫綍闊虫枃浠惰矾寰勶紝鍙ュ瓙鏈粨鏉熸椂涓虹┖")
     private String recordpath;
 
+    /**
+     * 鏀鹃煶鐨勮矾寰�
+     */
+    @ApiModelProperty(value = "鏀鹃煶鐨勮矾寰�")
+    private String path;
+
+    /**
+     * 鏀鹃煶浜嬩欢鍚嶇О锛孭LAYBACK_START 鎴� PLAYBACK_STOP
+     */
+    @ApiModelProperty(value = "鏀鹃煶浜嬩欢鍚嶇О锛孭LAYBACK_START 鎴� PLAYBACK_STOP")
+    private String evName;
+
+    /**
+     * 鎾斁寮�濮�
+     */
+    @ApiModelProperty(value = "鎾斁寮�濮�")
+    private Boolean playstart;
+
+    /**
+     * 鎾斁缁撴潫
+     */
+    @ApiModelProperty(value = "鎾斁缁撴潫")
+    private Boolean playstop = false;
+
+    /**
+     * 鏀鹃煶鐨勫師濮嬫枃鏈唴瀹�
+     */
+    @ApiModelProperty(value = "鏀鹃煶鐨勫師濮嬫枃鏈唴瀹�")
+    private String origin;
+
 }
diff --git a/smartor/src/main/java/com/smartor/domain/PullTaskVO.java b/smartor/src/main/java/com/smartor/domain/PullTaskVO.java
index 59b642b..a26068b 100644
--- a/smartor/src/main/java/com/smartor/domain/PullTaskVO.java
+++ b/smartor/src/main/java/com/smartor/domain/PullTaskVO.java
@@ -18,7 +18,7 @@
  * @date 2024-08-07
  */
 @Data
-@ApiModel(value = "PullTaskVO" , description = "闆ㄧ划鐢佃瘽浠诲姟鎷夊彇")
+@ApiModel(value = "PullTaskVO", description = "闆ㄧ划鐢佃瘽浠诲姟鎷夊彇")
 public class PullTaskVO {
 
     /**
@@ -67,5 +67,5 @@
      * 鎸囧畾asr鐨剈rl璺緞锛堣繖涓矾寰勯渶瑕佹垜浠繖杈规彁渚涳紝鍏ュ弬鍙互鍙傝�冩枃妗o級
      */
     @ApiModelProperty(value = " 鎸囧畾asr鐨剈rl璺緞锛堣繖涓矾寰勯渶瑕佹垜浠繖杈规彁渚涳紝鍏ュ弬鍙互鍙傝�冩枃妗o級")
-    private String asrcallback = "http://192.168.2.2:8095/smartor/serviceSubtask/phoneCallBackYQ";
+    private String asrcallback;
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
index a244e8d..4641b5f 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -100,6 +100,7 @@
      */
     public List<PullTaskVO> taskPull();
 
+
     public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq);
 
     /**
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java
index c5ea8c6..a40ee8c 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java
@@ -6,6 +6,7 @@
 import com.smartor.mapper.PatArchiveImportMapper;
 import com.smartor.service.IPatArchiveImportService;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -15,6 +16,7 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -103,11 +105,14 @@
     public List<PatArchiveImport> importPatInfo(MultipartFile multipartFile) {
         //鐢ㄤ簬杩斿洖
         List<PatArchiveImport> patArchiveImports = new ArrayList<>();
+
+        //鍘婚噸
+        List<String> qc = new ArrayList<>();
         try {
             Workbook workbook = new XSSFWorkbook(multipartFile.getInputStream());
             Sheet sheet = workbook.getSheetAt(0);
 
-            for (int i = sheet.getFirstRowNum() + 1; i < sheet.getLastRowNum(); i++) {
+            for (int i = sheet.getFirstRowNum() + 1; i <= sheet.getLastRowNum(); i++) {
                 //瀵煎叆鎮h�呭璞�
                 PatArchiveImport patArchiveImport = new PatArchiveImport();
                 Row row = sheet.getRow(i);
@@ -123,10 +128,16 @@
                 }
                 if (ObjectUtils.isNotEmpty(row.getCell(1))) {
                     patArchiveImport.setIdcardno(row.getCell(1).toString());
+                    boolean contains = qc.contains(row.getCell(1).toString());
+                    if (contains) continue;
                 }
 
                 if (ObjectUtils.isNotEmpty(row.getCell(2))) {
-                    patArchiveImport.setTelcode(row.getCell(2).toString());
+                    Cell cell = row.getCell(2);
+                    double numericCellValue = cell.getNumericCellValue();
+                    DecimalFormat decimalFormat = new DecimalFormat("#");
+                    String formattedValue = decimalFormat.format(numericCellValue);
+                    patArchiveImport.setTelcode(formattedValue);
                 }
                 if (ObjectUtils.isNotEmpty(row.getCell(3))) {
                     patArchiveImport.setBatchName(row.getCell(3).toString());
@@ -145,13 +156,13 @@
                     patArchiveImport.setAge(Long.valueOf(row.getCell(7).toString()));
                 }
 
-                patArchiveImports.add(patArchiveImport);
-
                 patArchiveImport.setCreateTime(new Date());
                 patArchiveImport.setUpdateTime(new Date());
                 //鎵归噺鍙凤紙褰撳墠鏃堕棿锛�
                 patArchiveImport.setBatchNo(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
                 insertPatArchiveImport(patArchiveImport);
+
+                patArchiveImports.add(patArchiveImport);
             }
 
         } catch (Exception e) {
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 fa93511..100d45c 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -7,10 +7,8 @@
 import com.google.gson.Gson;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.DtoConversionUtils;
-import com.ruoyi.common.utils.RSAPublicKeyExample;
-import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.*;
+import com.ruoyi.common.utils.http.HttpUtils;
 import com.smartor.config.PhoneUtils;
 import com.smartor.domain.*;
 import com.smartor.mapper.*;
@@ -24,6 +22,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -76,6 +75,12 @@
 
     @Value("${pri_key}")
     private String pri_key;
+
+    @Value("${ASRCallBackPath}")
+    private String ASRCallBackPath;
+
+    @Value("${hangup}")
+    private String hangup;
 
 
     /**
@@ -200,8 +205,8 @@
     public List<ServiceSubtask> patItem(ServiceSubtaskVO serviceSubtaskVO) {
         List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO);
         //鏍规嵁鍑洪櫌 鏃堕棿鍊掑簭
-        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime).reversed()).collect(Collectors.toList());
-        return sortedServiceSubtaskList;
+//        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime).reversed()).collect(Collectors.toList());
+        return selectServiceSubtaskList;
     }
 
     @Override
@@ -642,12 +647,43 @@
     public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO) {
         //瀹氫箟涓�涓垎鏁扮殑鍙橀噺
         Boolean aBoolean1 = redisCache.hasKey(phoneCallReqYQVO.getUuid() + "SCORE");
-        if (!aBoolean1) redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", 0);
+        if (!aBoolean1) redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", 0.0, 120, TimeUnit.MINUTES);
         PhoneCallBackYQVO phoneCallBackYQVO = new PhoneCallBackYQVO();
         //channel_create 閫氶亾鍒涘缓鐨勬椂鍊欙紝鍙互鎵ц涓�浜涘叾瀹冩搷浣滐紝璀鍙戜釜鐭俊涔嬬被鐨�;  鎴戜滑鐨勪笟鍔″彲浠ヤ笉鐢ㄧ    PlayEventCallback 杩欎釜鏄挱鏀捐闊崇殑,鏆傛椂鐢ㄤ笉鍒�     End_time()= -1鎴杗ull琛ㄧず褰撳墠鐨刟srtext涓嶆槸涓�鍙ュ畬鏁寸殑璇�
-        if (phoneCallReqYQVO.getOperate().equals("channel_create") || phoneCallReqYQVO.getOperate().equals("PlayEventCallback") || phoneCallReqYQVO.getEnd_time() == null || phoneCallReqYQVO.getEnd_time() == -1) {
+        if (phoneCallReqYQVO.getOperate().equals("channel_create")) {
             return phoneCallBackYQVO;
         }
+        //PlayEventCallback 杩欎釜鏄挱鏀捐闊崇殑    playstart锛氭斁闊冲紑濮嬶紙闂鎾姤寮�濮嬶級    playstop锛� 鏀鹃煶缁撴潫锛堥棶棰樻挱鎶ョ粨鏉燂級
+        if (phoneCallReqYQVO.getOperate().equals("PlayEventCallback")) {
+            String cacheJSY = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "- jsy");
+            if (phoneCallReqYQVO.getOperate().equals("PlayEventCallback") && phoneCallReqYQVO.getPlaystop() == false) {
+                //鍒ゆ柇redis涓槸鍚︽湁缁撴潫璇�
+                if (StringUtils.isEmpty(cacheJSY)) {
+                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", false, 120, TimeUnit.MINUTES);
+                    log.error("PlayEventCallbackPlaystop鐨勫�间负-------锛歿}", false);
+                }
+            } else {
+                //濡傛灉缁撴潫璇笉涓虹┖锛屽垯瑕佹寕鐢佃瘽浜�
+                if (StringUtils.isNotEmpty(cacheJSY)) {
+                    Map<String, String> req = new HashMap<>();
+                    req.put("uuid", phoneCallReqYQVO.getUuid());
+                    req.put("caller", phoneCallReqYQVO.getPhone());
+                    HttpUtils.sendPost(hangup, new Gson().toJson(req));
+                    //鍒犻櫎缁撴潫璇殑鎮e瓨
+                    redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "- jsy");
+                } else {
+                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", true, 120, TimeUnit.MINUTES);
+                    log.error("-------PlayEventCallbackPlaystop鐨勫�间负锛歿}", true);
+                }
+            }
+            return phoneCallBackYQVO;
+        }
+        //鑾峰彇鏀鹃煶鏄惁缁撴潫
+        boolean isPlayEventOver = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+        if (!isPlayEventOver) {
+            return phoneCallBackYQVO;
+        }
+
         //閫氳繃瀛愪换鍔D鑾峰彇鍒版ā鏉夸俊鎭�
         ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(phoneCallReqYQVO.getTaskid()));
         IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
@@ -678,14 +714,16 @@
                 phoneCallBackYQVO.setType("text");
                 phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                 String scriptContent = ivrTaskTemplateScriptVO.getScriptContent();
+                log.error("SilentCallback鐨勯棶棰樺唴瀹箂criptContent锛歿}", scriptContent);
                 phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
                 //灏嗛潤榛樻鏁板姞1
                 Integer noVoiceNum = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "noVoice");
                 redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "noVoice", noVoiceNum + 1, 120, TimeUnit.MINUTES);
+                return phoneCallBackYQVO;
             } else {
                 log.error("闈欓粯娆℃暟杈惧埌,鎸傛帀鐢佃瘽锛歿}", num);
                 //澶т笌绛変簬鐨勮瘽,鐩存帴鎸傛柇
-                phoneCallBackYQVO.setType("hangup");
+                phoneCallBackYQVO.setType("text");
                 phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                 phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
                 //灏嗙粨鏋滃啓鍒癲etail涓�
@@ -705,9 +743,28 @@
                 redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
                 redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
                 redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+                //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
             }
             return phoneCallBackYQVO;
-        } else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate())) {
+        } else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
+            //鎾姤绗竴棰�
+            Integer integer = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort");
+//            if(integer==0){
+//                //integer==0,琛ㄧず寮�鍦虹櫧鍒氭挱鎶ュ畬锛岄渶瑕佸仠椤夸竴涓嬶紝绛夋偅鑰呰璇�
+//                redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
+//                return phoneCallBackYQVO;
+//            }
+            if (ivrTaskTemplateScriptVO.getSort() == 1 && integer == 1) {
+                phoneCallBackYQVO.setType("text");
+                phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+                String scriptContent = ivrTaskTemplateScriptVO.getScriptContent();
+                phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
+                redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort", 2, 120, TimeUnit.MINUTES);
+                return phoneCallBackYQVO;
+            }
+
             //濡傛灉鏄枃鏈洖璋�
             //鏍规嵁闂ID鑾峰彇璇ラ棶棰樼殑绫诲瀷
             if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
@@ -742,9 +799,11 @@
                         serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
                         serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
                         saveQuestionAnswerPhone(serviceSubTaskDetailReq);
-//
+                        //灏嗗綋鍓嶅墠鐨勬挱鎶ョ姸鎬佸垹闄わ紝缁欎笅涓�棰樿浣�
+                        redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
 //                        //鑾峰彇涓嬩竴棰�
-                        if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
+                        log.error("鑾峰彇涓嬩竴棰樼殑淇℃伅锛歿}", ivrTaskTemplateScriptVO);
+                        if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
                             Long nextQuestion = null;
                             if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
                                 nextQuestion = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
@@ -755,7 +814,8 @@
                             } else {
                                 nextQuestion = ivrTaskTemplateScriptVO.getNextScriptno();
                                 //鏇存柊鍒嗘暟
-                                double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                                Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                                Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
                                 score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore()).doubleValue();
                                 redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score);
                             }
@@ -765,6 +825,7 @@
                                     phoneCallBackYQVO.setType("text");
                                     phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                                     String scriptContent = script.getScriptContent();
+                                    log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
                                     phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
                                     //灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
                                     redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
@@ -773,8 +834,8 @@
                                 }
                             }
                         } else if (ivrTaskTemplateScriptVO.getBranchFlag().equals("0")) {
-                            if (ivrTaskTemplateScriptVO.getNextScriptno() == 0 || ivrTaskTemplateScriptVO.getNextScriptno() == null) {
-                                phoneCallBackYQVO.setType("hangup");
+                            if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
+                                phoneCallBackYQVO.setType("text");
                                 phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                                 //鏇存柊涓�涓嬪垎鏁�
                                 double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
@@ -789,6 +850,9 @@
                                 redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
                                 redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
                                 redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+                                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+                                //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
 //                                return phoneCallBackYQVO;
                             }
                         }
@@ -803,7 +867,7 @@
                         //濡傛灉count宸茬粡澶т簬鎴栫瓑浜庢病鏈夊尮閰嶆鏁�
                         if (ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() == 0 || ivrTaskTemplateScriptVO.getBranchFlag().equals("1") && ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getBranchFlag().equals("1") && ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
                             //濡傛灉鏄渶鍚庝竴閬撻锛屾垨鑰呮病鏈変笅涓�棰樹簡锛屽氨鐩存帴鎸傛満
-                            phoneCallBackYQVO.setType("hangup");
+                            phoneCallBackYQVO.setType("text");
                             phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                             if (StringUtils.isNotEmpty(phoneCallBackYQVO.getValue()))
                                 phoneCallBackYQVO.setValue(phoneCallBackYQVO.getValue() + ivrTaskTemplate.getRevisitAfter());
@@ -815,6 +879,8 @@
                             serviceSubtask.setFinishtime(new Date());
                             serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
 
+                            //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                            redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
                             //鍘籸edis涓紝鎶婅瀛愪换鍔D鍒犻櫎
                             Long id = serviceSubtask.getId();
                             Map<String, String> map = delRedisValue(null, id.toString());
@@ -863,7 +929,7 @@
 
                 //濡傛灉閫夐」鍒嗘敮涓�1鐨勮瘽锛屽垯闇�瑕佹牴鎹棶棰樹笂鐨刵extScriptno杩涜璺宠浆
                 //闂瓟棰樻病鏈夎烦杞�
-                if (ivrTaskTemplateScriptVO.getNextScriptno() != null || ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
+                if (ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
                     for (IvrTaskTemplateScript ivrTaskTemplateScript1 : ivrTaskTemplateScripts) {
                         if (ivrTaskTemplateScriptVO.getNextScriptno().intValue() == ivrTaskTemplateScript1.getSort()) {
                             phoneCallBackYQVO.setType("text");
@@ -881,9 +947,9 @@
 //                            return phoneCallBackYQVO;
                         }
                     }
-                } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null) {
+                } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
                     //娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�
-                    phoneCallBackYQVO.setType("hangup");
+                    phoneCallBackYQVO.setType("text");
                     phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                     phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
 
@@ -897,16 +963,18 @@
                     Long id = serviceSubtask.getId();
                     Map<String, String> map = delRedisValue(null, id.toString());
                     redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
+                    //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
                     redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
                     redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
                 }
 
                 //閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆�
                 String extemplateID = ivrTaskTemplate.getSubmoduleID();
-                String[] split = extemplateID.split(",");
-                List<String> list = Arrays.asList(split);
-                List<Long> list1 = new ArrayList<>();
                 if (StringUtils.isNotEmpty(extemplateID)) {
+                    String[] split = extemplateID.split(",");
+                    List<String> list = Arrays.asList(split);
+                    List<Long> list1 = new ArrayList<>();
                     for (String str : list) {
                         list1.add(Long.valueOf(str));
                     }
@@ -934,6 +1002,7 @@
         }
         return phoneCallBackYQVO;
     }
+
 
     private String getObject(ServiceSubtask serviceSubtask, String scriptContent) {
         Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid());
@@ -1014,9 +1083,11 @@
         if (!StringUtils.isEmpty(value0)) {
             pullTaskVOList = getPullTaskList(value0, "cache-0");
             //灏哻ache-0鐨勬暟鎹紝杞Щ涓嶅鍔瞔ache-00涓�
+            redisCache.deleteObject("cache-00");
             String cache00 = redisCache.getCacheObject("cache-00");
-            if (!StringUtils.isEmpty(cache00)) redisCache.setCacheObject("cache-00", cache00 + "," + value0);
-            else redisCache.setCacheObject("cache-00", value0);
+            if (!StringUtils.isEmpty(cache00))
+                redisCache.setCacheObject("cache-00", cache00 + "," + value0, 120, TimeUnit.MINUTES);
+            else redisCache.setCacheObject("cache-00", value0, 120, TimeUnit.MINUTES);
             redisCache.deleteObject("cache-0");
         } else {
             for (int i = 1; i < 6; i++) {
@@ -1034,7 +1105,12 @@
                 redisCache.deleteObject("cache-" + i);
             }
         }
-
+        if (CollectionUtils.isNotEmpty(pullTaskVOList)) {
+            //缁欏洖璋冨弬鏁拌祴鍊�
+            for (PullTaskVO pullTaskVO : pullTaskVOList) {
+                pullTaskVO.setAsrcallback(ASRCallBackPath);
+            }
+        }
         return pullTaskVOList;
     }
 
@@ -1068,8 +1144,9 @@
                 //濡傛灉ivrTaskTemplateScript涓虹┖锛屼篃灏辨病鏈夊線涓嬫墽琛岀殑蹇呰浜�
                 if (ObjectUtils.isEmpty(ivrTaskTemplateScript)) return null;
                 //鑾峰彇閫氶厤绗﹀尮閰嶈繃鍚庣殑闂
-                String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
-                String kcb = ivrTaskTemplate.getRevisitBefore() + "," + scrContent;
+//                String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
+//                String kcb = ivrTaskTemplate.getRevisitBefore() + "," + scrContent;
+                String kcb = ivrTaskTemplate.getRevisitBefore();
 
                 //灏佽杩斿洖鏁版嵁
                 //taskId = 瀛愪换鍔D + 闂ID +闂搴忓彿
@@ -1081,6 +1158,7 @@
                 pullTaskVO.setDisplayNo("85129866");
                 pullTaskVOList.add(pullTaskVO);
                 redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString());
+                redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
             } else {
                 if (StringUtils.isEmpty(newValue0)) {
                     newValue0 = "," + split[i].trim() + ",";
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
index ce70d11..0773844 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -4,16 +4,19 @@
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DtoConversionUtils;
+import com.ruoyi.common.utils.http.HttpUtils;
 import org.apache.commons.lang3.StringUtils;
 import com.smartor.domain.*;
 import com.smartor.mapper.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.smartor.service.IServiceTaskService;
 import org.springframework.transaction.annotation.Transactional;
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml
index 4acaa9c..df9a877 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml
@@ -5,26 +5,41 @@
 <mapper namespace="com.smartor.mapper.PatArchiveImportMapper">
 
     <resultMap type="com.smartor.domain.PatArchiveImport" id="PatArchiveImportResult">
-            <result property="id" column="id"/>
-            <result property="patientno" column="patientno"/>
-            <result property="pattype" column="pattype"/>
-            <result property="name" column="name"/>
-            <result property="sex" column="sex"/>
-            <result property="idcardno" column="idcardno"/>
-            <result property="age" column="age"/>
-            <result property="telcode" column="telcode"/>
-            <result property="openid" column="openid"/>
-            <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="createTime" column="create_time"/>
-            <result property="batchName" column="batch_name"/>
-            <result property="batchNo" column="batch_no"/>
+        <result property="id" column="id"/>
+        <result property="patientno" column="patientno"/>
+        <result property="pattype" column="pattype"/>
+        <result property="name" column="name"/>
+        <result property="sex" column="sex"/>
+        <result property="idcardno" column="idcardno"/>
+        <result property="age" column="age"/>
+        <result property="telcode" column="telcode"/>
+        <result property="openid" column="openid"/>
+        <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="createTime" column="create_time"/>
+        <result property="batchName" column="batch_name"/>
+        <result property="batchNo" column="batch_no"/>
     </resultMap>
 
     <sql id="selectPatArchiveImportVo">
-        select id, patientno, pattype, name, sex, idcardno, age, telcode, openid, del_flag, update_by, update_time, create_by, create_time, batch_name, batch_no
+        select id,
+               patientno,
+               pattype,
+               name,
+               sex,
+               idcardno,
+               age,
+               telcode,
+               openid,
+               del_flag,
+               update_by,
+               update_time,
+               create_by,
+               create_time,
+               batch_name,
+               batch_no
         from pat_archive_import
     </sql>
 
@@ -32,175 +47,176 @@
             resultMap="PatArchiveImportResult">
         <include refid="selectPatArchiveImportVo"/>
         <where>
-                        <if test="patientno != null  and patientno != ''">
-                            and patientno = #{patientno}
-                        </if>
-                        <if test="pattype != null  and pattype != ''">
-                            and pattype = #{pattype}
-                        </if>
-                        <if test="name != null  and name != ''">
-                            and name like concat('%', #{name}, '%')
-                        </if>
-                        <if test="sex != null ">
-                            and sex = #{sex}
-                        </if>
-                        <if test="idcardno != null  and idcardno != ''">
-                            and idcardno = #{idcardno}
-                        </if>
-                        <if test="age != null ">
-                            and age = #{age}
-                        </if>
-                        <if test="telcode != null  and telcode != ''">
-                            and telcode = #{telcode}
-                        </if>
-                        <if test="openid != null  and openid != ''">
-                            and openid = #{openid}
-                        </if>
-                        <if test="batchName != null  and batchName != ''">
-                            and batch_name like concat('%', #{batchName}, '%')
-                        </if>
-                        <if test="batchNo != null  and batchNo != ''">
-                            and batch_no = #{batchNo}
-                        </if>
+            <if test="patientno != null  and patientno != ''">
+                and patientno = #{patientno}
+            </if>
+            <if test="pattype != null  and pattype != ''">
+                and pattype = #{pattype}
+            </if>
+            <if test="name != null  and name != ''">
+                and name like concat('%', #{name}, '%')
+            </if>
+            <if test="sex != null ">
+                and sex = #{sex}
+            </if>
+            <if test="idcardno != null  and idcardno != ''">
+                and idcardno = #{idcardno}
+            </if>
+            <if test="age != null ">
+                and age = #{age}
+            </if>
+            <if test="telcode != null  and telcode != ''">
+                and telcode = #{telcode}
+            </if>
+            <if test="openid != null  and openid != ''">
+                and openid = #{openid}
+            </if>
+            <if test="batchName != null  and batchName != ''">
+                and batch_name like concat('%', #{batchName}, '%')
+            </if>
+            <if test="batchNo != null  and batchNo != ''">
+                and batch_no = #{batchNo}
+            </if>
         </where>
     </select>
 
     <select id="selectPatArchiveImportById" parameterType="Long"
             resultMap="PatArchiveImportResult">
-            <include refid="selectPatArchiveImportVo"/>
-            where id = #{id}
+        <include refid="selectPatArchiveImportVo"/>
+        where id = #{id}
     </select>
 
-    <insert id="insertPatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport"            useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertPatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport" useGeneratedKeys="true"
+            keyProperty="id">
         insert into pat_archive_import
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                    <if test="patientno != null">patientno,
-                    </if>
-                    <if test="pattype != null">pattype,
-                    </if>
-                    <if test="name != null">name,
-                    </if>
-                    <if test="sex != null">sex,
-                    </if>
-                    <if test="idcardno != null">idcardno,
-                    </if>
-                    <if test="age != null">age,
-                    </if>
-                    <if test="telcode != null">telcode,
-                    </if>
-                    <if test="openid != null">openid,
-                    </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="createTime != null">create_time,
-                    </if>
-                    <if test="batchName != null">batch_name,
-                    </if>
-                    <if test="batchNo != null">batch_no,
-                    </if>
+            <if test="patientno != null">patientno,
+            </if>
+            <if test="pattype != null">pattype,
+            </if>
+            <if test="name != null">name,
+            </if>
+            <if test="sex != null">sex,
+            </if>
+            <if test="idcardno != null">idcardno,
+            </if>
+            <if test="age != null">age,
+            </if>
+            <if test="telcode != null">telcode,
+            </if>
+            <if test="openid != null">openid,
+            </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="createTime != null">create_time,
+            </if>
+            <if test="batchName != null">batch_name,
+            </if>
+            <if test="batchNo != null">batch_no,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                    <if test="patientno != null">#{patientno},
-                    </if>
-                    <if test="pattype != null">#{pattype},
-                    </if>
-                    <if test="name != null">#{name},
-                    </if>
-                    <if test="sex != null">#{sex},
-                    </if>
-                    <if test="idcardno != null">#{idcardno},
-                    </if>
-                    <if test="age != null">#{age},
-                    </if>
-                    <if test="telcode != null">#{telcode},
-                    </if>
-                    <if test="openid != null">#{openid},
-                    </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="createTime != null">#{createTime},
-                    </if>
-                    <if test="batchName != null">#{batchName},
-                    </if>
-                    <if test="batchNo != null">#{batchNo},
-                    </if>
+            <if test="patientno != null">#{patientno},
+            </if>
+            <if test="pattype != null">#{pattype},
+            </if>
+            <if test="name != null">#{name},
+            </if>
+            <if test="sex != null">#{sex},
+            </if>
+            <if test="idcardno != null">#{idcardno},
+            </if>
+            <if test="age != null">#{age},
+            </if>
+            <if test="telcode != null">#{telcode},
+            </if>
+            <if test="openid != null">#{openid},
+            </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="createTime != null">#{createTime},
+            </if>
+            <if test="batchName != null">#{batchName},
+            </if>
+            <if test="batchNo != null">#{batchNo},
+            </if>
         </trim>
     </insert>
 
     <update id="updatePatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport">
         update pat_archive_import
         <trim prefix="SET" suffixOverrides=",">
-                    <if test="patientno != null">patientno =
-                        #{patientno},
-                    </if>
-                    <if test="pattype != null">pattype =
-                        #{pattype},
-                    </if>
-                    <if test="name != null">name =
-                        #{name},
-                    </if>
-                    <if test="sex != null">sex =
-                        #{sex},
-                    </if>
-                    <if test="idcardno != null">idcardno =
-                        #{idcardno},
-                    </if>
-                    <if test="age != null">age =
-                        #{age},
-                    </if>
-                    <if test="telcode != null">telcode =
-                        #{telcode},
-                    </if>
-                    <if test="openid != null">openid =
-                        #{openid},
-                    </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="createTime != null">create_time =
-                        #{createTime},
-                    </if>
-                    <if test="batchName != null">batch_name =
-                        #{batchName},
-                    </if>
-                    <if test="batchNo != null">batch_no =
-                        #{batchNo},
-                    </if>
+            <if test="patientno != null">patientno =
+                #{patientno},
+            </if>
+            <if test="pattype != null">pattype =
+                #{pattype},
+            </if>
+            <if test="name != null">name =
+                #{name},
+            </if>
+            <if test="sex != null">sex =
+                #{sex},
+            </if>
+            <if test="idcardno != null">idcardno =
+                #{idcardno},
+            </if>
+            <if test="age != null">age =
+                #{age},
+            </if>
+            <if test="telcode != null">telcode =
+                #{telcode},
+            </if>
+            <if test="openid != null">openid =
+                #{openid},
+            </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="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="batchName != null">batch_name =
+                #{batchName},
+            </if>
+            <if test="batchNo != null">batch_no =
+                #{batchNo},
+            </if>
         </trim>
         where id = #{id}
     </update>
 
-                <update id="deletePatArchiveImportById" parameterType="Long">
+    <update id="deletePatArchiveImportById" parameterType="Long">
         update pat_archive_import
         <trim prefix="SET" suffixOverrides=",">
             del_flag =1
         </trim>
-        where  id = #{id}
+        where id = #{id}
     </update>
 
-                            <update id="deletePatArchiveImportByIds" parameterType="String">
-        update  pat_archive_import
+    <update id="deletePatArchiveImportByIds" parameterType="String">
+        update pat_archive_import
         <trim prefix="SET" suffixOverrides=",">
             del_flag =1
         </trim>
@@ -209,8 +225,6 @@
             #{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 0019030..ba421b1 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -238,7 +238,12 @@
             <if test="remark != null">and remark = #{remark}</if>
             <if test="suggest != null">and suggest = #{suggest}</if>
         </where>
-        order by update_time desc,id desc
+        <if test="serviceType != null  and serviceType != ''and serviceType != '2'and serviceType != '3'">order by
+            long_send_time desc
+        </if>
+        <if test="serviceType != null  and serviceType != ''and serviceType == '2'">order by endtime desc</if>
+        <if test="serviceType != null  and serviceType != ''and serviceType == '3'">order by admindate desc</if>
+        -- order by update_time desc,id desc
     </select>
 
     <select id="selectServiceSubtaskById" parameterType="Long" resultMap="ServiceSubtaskResult">

--
Gitblit v1.9.3