liusheng
2024-11-22 5389773b2d1ae86daec68b00f67c3682dc907e01
代码提交(长期任务电话完成)
已添加2个文件
已修改50个文件
已重命名1个文件
1574 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveOutController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid-linshi.yml 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUserRole.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/common/FtpService.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/common/SendService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplate.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateVO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchive.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveImport.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveVO.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedInhosp.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PhoneCallBackYQVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/IvrLibaScriptTargetoptionMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateTargetoptionMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatArchiveImportMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IPatArchiveImportService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IPatMedInhospService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskDetailService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 295 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskDetailServiceImpl.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/TemplateDeptServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -205,6 +205,7 @@
                                String value = redisCache.getCacheObject("cache-0");
                                ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO();
                                serviceSubtask1.setTaskid(commonTaskcallMQ.getTaskid());
                                log.error("缓存中serviceSubtask1的值为:{}", serviceSubtask1);
                                List<ServiceSubtask> selectServiceSubtaskList1 = ivrTaskcallMapper.selectServiceSubtaskList(serviceSubtask1);
                                for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) {
                                    if (StringUtils.isEmpty(value)) {
@@ -214,6 +215,7 @@
                                            value = value + "," + serviceSubtask2.getId().toString() + ",";
                                    }
                                }
                                log.error("缓存中cache-0的值为:{}", value);
                                redisCache.setCacheObject("cache-0", value);
                            } else {
                                //非立即发送
@@ -250,7 +252,7 @@
                        serviceSubtask.setResult("success");
                        serviceSubtask.setRemark("电话发送成功");
                        serviceSubtask.setGuid(uuid);
                        serviceSubtask.setSendstate(6L);
                        serviceSubtask.setSendstate(3L);
                        serviceSubtask.setFinishtime(new Date());
                        serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java
@@ -1,10 +1,14 @@
package com.ruoyi.web.controller.smartor;
import com.github.pagehelper.ISelect;
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.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.PatArchiveImport;
@@ -36,12 +40,20 @@
     * æŸ¥è¯¢Excel导入患者档案列表
     */
    @ApiOperation("查询Excel导入患者档案列表")
    //@PreAuthorize("@ss.hasPermi('smartor:import:list')")
    @GetMapping("/list")
    public TableDataInfo list(PatArchiveImport patArchiveImport) {
        startPage();
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody PatArchiveImport patArchiveImport) {
        PageUtils.startPageByPost(patArchiveImport.getPageNum(), patArchiveImport.getPageSize());
        List<PatArchiveImport> list = patArchiveImportService.selectPatArchiveImportList(patArchiveImport);
        return getDataTable(list);
        //获取total
        long total = PageUtils.count(new ISelect() {
            @Override
            public void doSelect() {
                patArchiveImport.setPageNum(null);
                patArchiveImport.setPageSize(null);
                patArchiveImportService.selectPatArchiveImportList(patArchiveImport);
            }
        });
        return getDataTable2(total, list);
    }
    /**
@@ -115,6 +127,8 @@
    //@PreAuthorize("@ss.hasPermi('smartor:import:list')")
    @PostMapping("/importPatInfo")
    public TableDataInfo importPatInfo(MultipartFile file) {
        return getDataTable(patArchiveImportService.importPatInfo(file));
        LoginUser loginUser = getLoginUser();
        SysUser user = loginUser.getUser();
        return getDataTable(patArchiveImportService.importPatInfo(file, user));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveOutController.java
@@ -1,17 +1,14 @@
package com.ruoyi.web.controller.smartor;
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.poi.ExcelUtil;
import com.smartor.domain.PatArchiveOut;
import com.smartor.service.IPatArchiveOutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java
@@ -4,12 +4,9 @@
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.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.PatMedInhosp;
import com.smartor.domain.PatMedInhospVO;
@@ -18,14 +15,11 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * æ‚£è€…住院记录Controller
@@ -110,7 +104,7 @@
     */
    @ApiOperation("获取患者住院记录详细信息")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:query')")
    @GetMapping(value = "/{inhospid}")
    @GetMapping(value = "/getInfo/{inhospid}")
    public AjaxResult getInfo(@PathVariable("inhospid") Long inhospid) {
        return success(patMedInhospService.selectPatMedInhospByInhospid(inhospid));
    }
@@ -159,4 +153,16 @@
        return getDataTable(patMedInhospService.getDeptRanking(patMedReq));
    }
    /**
     * åŒ»æŠ¤ä¸Žæ‚£è€…关联关系
     *
     * @return
     */
    @ApiOperation("医护与患者关联关系")
    @PostMapping("/getDocAndPat")
    public TableDataInfo getDocAndPat(@RequestBody PatMedInhosp patMedInhosp) {
        return getDataTable(patMedInhospService.getDocAndPat(patMedInhosp));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -14,17 +14,13 @@
import com.smartor.domain.*;
import com.smartor.service.IServiceSubtaskRecordService;
import com.smartor.service.IServiceSubtaskService;
import com.sun.org.apache.bcel.internal.generic.NEW;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -192,6 +188,7 @@
    public AjaxResult recordAccept(@RequestBody PhoneCallRecordVO phoneCallRecordVO) {
        log.error("通话记录回调(雨绮):{}", phoneCallRecordVO);
//        return toAjax(serviceSubtaskService.saveQuestionAnswerPhone(serviceSubTaskDetailReq));
        serviceSubtaskService.recordAccept(phoneCallRecordVO);
        return success();
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskDetailController.java
@@ -3,18 +3,18 @@
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.poi.ExcelUtil;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.ServiceSubtaskDetail;
import com.smartor.service.IServiceSubtaskDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * è¯­éŸ³ä»»åŠ¡ç»“æžœæ˜Žç»†Controller
@@ -22,6 +22,7 @@
 * @author smartor
 * @date 2023-03-24
 */
@Api(description = "语音任务结果明细")
@RestController
@RequestMapping("/smartor/serviceSubtaskDetail")
public class ServiceSubtaskDetailController extends BaseController {
@@ -29,28 +30,17 @@
    private IServiceSubtaskDetailService ServiceSubtaskDetailService;
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†åˆ—è¡¨
     * æŸ¥è¯¢å•个人的语音信息
     */
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceSubtaskDetail:list')")
    @ApiOperation("查询任务结果明细列表")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody ServiceSubtaskDetail serviceSubtaskDetail) {
        startPage();
        List<ServiceSubtaskDetail> list = ServiceSubtaskDetailService.selectServiceSubtaskDetailList(serviceSubtaskDetail);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºè¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†åˆ—è¡¨
     */
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceSubtaskDetail:export')")
    @Log(title = "语音任务呼叫明细", businessType = BusinessType.EXPORT)
    @ApiOperation("导出任务结果明细列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceSubtaskDetail serviceSubtaskDetail) {
        List<ServiceSubtaskDetail> list = ServiceSubtaskDetailService.selectServiceSubtaskDetailList(serviceSubtaskDetail);
        ExcelUtil<ServiceSubtaskDetail> util = new ExcelUtil<ServiceSubtaskDetail>(ServiceSubtaskDetail.class);
        util.exportExcel(response, list, "语音任务呼叫明细数据");
    @ApiOperation("查询单个人的语音信息通过子任务ID")
    @PostMapping("/getPersonVoice")
    public Map<String, Object> getPersonVoice(@RequestBody ServiceSubtaskDetail serviceSubtaskDetail) {
        Map<String, Object> map = new HashMap<>();
        if (serviceSubtaskDetail.getSubId() == null) {
            map.put("code", 500);
            map.put("msg", "查询失败,请查检入参");
        } else map = ServiceSubtaskDetailService.selectServiceSubtaskDetailList(serviceSubtaskDetail);
        return map;
    }
    /**
@@ -85,6 +75,21 @@
        return toAjax(ServiceSubtaskDetailService.updateServiceSubtaskDetail(serviceSubtaskDetail));
    }
    /**
     * ä¿®æ”¹è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†
     */
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceSubtaskDetail:edit')")
    @Log(title = "语音任务呼叫明细", businessType = BusinessType.UPDATE)
    @ApiOperation("修改任务结果明细")
    @PostMapping("/batchEdit")
    public AjaxResult edit(@RequestBody List<ServiceSubtaskDetail> serviceSubtaskDetails) {
        for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubtaskDetails) {
            ServiceSubtaskDetailService.updateServiceSubtaskDetail(serviceSubtaskDetail);
        }
        return toAjax(1);
    }
    @ApiOperation("修改任务结果明细通过条件")
    @PostMapping("/editByCondition")
    public AjaxResult updateSSDByCondition(@RequestBody ServiceSubtaskDetail serviceSubtaskDetail) {
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -2,14 +2,13 @@
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUserRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -27,7 +26,6 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.smartor.domain.ServiceSubtaskDetail;
import com.smartor.domain.ThiedInhospInfo;
import io.swagger.models.auth.In;
import org.junit.Test;
@@ -16,6 +17,9 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.eclipse.jetty.http.HttpGenerator.CHUNK_SIZE;
@@ -44,14 +48,7 @@
    @Test
    public void bb() {
//        int number = 99999; // ç¤ºä¾‹æ•°æ®
//        String format = String.format("%03X", number);
//        System.out.println(format);
//        for (int j = 0; j < 5; j++) {
//            if(j==5-1){
//                System.out.println("11111111111111111111");
//            }
//        }
    }
    public void aa(MultipartFile file) throws IOException {
ruoyi-admin/src/main/resources/application-druid-linshi.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,170 @@
# æ•°æ®æºé…ç½®
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    #    driverClassName: com.mysql.cj.jdbc.Driver
    druid:
      # ä¸»åº“数据源
      master:
        #        ä¹‰ä¹ŒäºŒé™¢
        #        url: jdbc:mysql://127.0.0.1:3306/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        #        username: root
        #        password: 123456
        #        å…¬å¸
        #        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
        url: jdbc:mysql://rm-ns02o037qh57kj7qu.mysql.rds.ops.zj.zjhealthcloud.cn:3306/smartor?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
        username: ywgl
        password: health@123
        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://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor
        username: sa
        password: sfxt#2023
        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
      # åˆå§‹è¿žæŽ¥æ•°
      initialSize: 5
      # æœ€å°è¿žæŽ¥æ± æ•°é‡
      minIdle: 10
      # æœ€å¤§è¿žæŽ¥æ± æ•°é‡
      maxActive: 20
      # é…ç½®èŽ·å–è¿žæŽ¥ç­‰å¾…è¶…æ—¶çš„æ—¶é—´
      maxWait: 60000
      # é…ç½®é—´éš”多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
      timeBetweenEvictionRunsMillis: 60000
      # é…ç½®ä¸€ä¸ªè¿žæŽ¥åœ¨æ± ä¸­æœ€å°ç”Ÿå­˜çš„æ—¶é—´ï¼Œå•位是毫秒
      minEvictableIdleTimeMillis: 300000
      # é…ç½®ä¸€ä¸ªè¿žæŽ¥åœ¨æ± ä¸­æœ€å¤§ç”Ÿå­˜çš„æ—¶é—´ï¼Œå•位是毫秒
      maxEvictableIdleTimeMillis: 900000
      # é…ç½®æ£€æµ‹è¿žæŽ¥æ˜¯å¦æœ‰æ•ˆ
      #      validationQuery: SELECT 1 FROM DUAL
      validationQuery: SELECT 1
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      webStatFilter:
        enabled: true
      statViewServlet:
        enabled: false
        # è®¾ç½®ç™½åå•,不填则允许所有访问
        allow:
        url-pattern: /druid/*
        # æŽ§åˆ¶å°ç®¡ç†ç”¨æˆ·åå’Œå¯†ç 
        login-username: lihu
        login-password: Lihu@1363419#$
      filter:
        stat:
          enabled: true
          # æ…¢SQL记录
          log-slow-sql: true
          slow-sql-millis: 1000
          merge-sql: true
        wall:
          config:
            multi-statement-allow: true
magic-api:
  web: /magic/web
  resource:
    type: database   # é…ç½®å­˜å‚¨åœ¨æ•°æ®åº“中
    tableName: magic_config  # æ•°æ®åº“中的表名
    prefix: /api
    readonly: false
  sql-column-case: camel
  show-sql: true #配置打印SQL
  page-config:
    size: size
    page: page
    default-page: 1
    default-size: 10
  #微信公众号的密钥
appid: wx1c5243d2337753f4
appSecret: 84a2186a0d175e88345267c716516cd3
#第三方微信公众号发送地址(新华医院)
thirdWXUrl: http://192.16.4.220:8103/api
#钉钉的密钥
dingAppid: dingn8iip5ubj7clrrsv
dingAppSecret: qlEK8D3oOVwGPOTiBQIBYTqQVlAfy9S_qQizEQFjJdSScwemWFryg4gbneu-NqWD
# websocket超时时间
server:
  websocket:
    timeout=60000:
accessKeyId: LTAI5tPfc1VJzz7VuhzcBwug
accessKeySecret: gG1srKxPFDBNWe2oHfqmK1qsSQkf1e
signName: æ­å·žåˆ©æ¹–科技
#智能呼叫(上海)
phoneIP: http://124.220.50.51
phonePort: 8001
#杭州
hzphoneIP: http://121.43.112.160
hzphonePort: 8088
#电话线路(1 ä¸Šæµ·ï¼Œ2 æ­å·žï¼‰
phonePath: 2
#自己的电话号码
phoneMySelf: 83234089
##授权 id(杭州)
#app_id: hzgs
##授权 key(已加密过的 key)(杭州)
#app_key: 605453540c4a0a692fe07e1cae1162f3
#授权 id(杭州)
app_id: hz_ali
#授权 key(已加密过的 key)(杭州)
app_key: a2f3b5799d635216aa280362fafd8c35
pub_key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==
#这个是后端的私钥,用不到
pri_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==
#前端私钥(用不到了)
#pri_key: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEApHTIe/StslZAT5Jzv8XClbrqox32pfaTrP5IOCRJ3FaH/UZsGgA/tsNBBEXq9eagqwPbJrjYfpdEtINcChrK4wIDAQABAkEAilDujdKshGGmlUZHs/NQRT6AOdDpsYxBiC4V76IVvQpw0IW6c4HGEvH4T+xRufika7/48L0eu0f06H+YtL5lgQIhANUd0a6oSsVxWifAjtKwMZcXD3OaIxQIQSCN4NT4VFY3AiEAxYxYrIhkIyg+UVw3WOSvBpXKxM4/WL9HRzkxDLvp2rUCIQCK23P8tgCJ5xJT5l3onw6goFDcBKkoazxsBqVgfjENPwIgWbuTd+OIYPPhwsE5ntZZrosSDO2GlsBkFzUiU59z7VUCIA0LL+9IFb+FWCl3DGTwIQ9SZYbv61T83LKjebUcSOfe
#二维码路径
qrpath: D:\qrcode
#公司内外链请求IP和端口号
#req_path: 8095
#localIP: 192.168.2.10
#新华医院外链请求IP和端口号
req_path: 8093
localIP: 218.108.11.22
#获取患者信息URL(华卓提供)
hosp_info_url: http://esb-core-rest.wowjoy.cn/esb/exchange
# 0代表走默认的上传    1 ä»£ç èµ°æ–°åŽåŒ»é™¢çš„上传
uploadSwitch: 1
#  æŒ‡å®šasr回调的url路径
ASRCallBackPath: http://192.168.2.10:8095/smartor/serviceSubtask/phoneCallBackYQ
#挂断IP
hangup: http://192.168.2.10:8091/hangup
#新华短信请求地址(这个服务是我们自己写的)
xhsmsPath: http://192.16.4.220:8092/sendSms
#帐号
xhsmsAccount: 911124
#接口密码
xhsmsPwd: zW5eXe
#虚拟接入码
xhsmsjrm: 1069055
ruoyi-admin/src/main/resources/application-druid.yml
@@ -11,12 +11,17 @@
        #        username: root
        #        password: 123456
        #        å…¬å¸
        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.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
        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
        #        å…¬å¸äº‘
      #        url: jdbc:mysql://116.62.18.175:6002/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
      #        username: hxsoft
      #        password: Hxerp2000
      #        driverClassName: com.mysql.cj.jdbc.Driver
      # ä»Žåº“数据源
      slave:
        # ä»Žæ•°æ®æºå¼€å…³/默认关闭(公司)
@@ -150,10 +155,19 @@
# 0代表走默认的上传    1 ä»£ç èµ°æ–°åŽåŒ»é™¢çš„上传
uploadSwitch: 1
#  æŒ‡å®šasr回调的url路径
ASRCallBackPath: http://192.168.2.10:8095/smartor/serviceSubtask/phoneCallBackYQ
#挂断IP
hangup: http://192.168.2.10:8091/hangup
##  æŒ‡å®šasr回调的url路径(本地)
#ASRCallBackPath: http://192.168.2.13:8095/smartor/serviceSubtask/phoneCallBackYQ
##挂断IP(本地)
#hangup: http://192.168.2.13:8091/hangup
##fs所使用的阿里的app_key(本地)
#app_key_yq: ZurNHpaQLq6P55YS
#  æŒ‡å®šasr回调的url路径(新华)
ASRCallBackPath: http://192.168.101.135:8095/smartor/serviceSubtask/phoneCallBackYQ
#挂断IP(新华)
hangup: http://192.16.4.220:8091/hangup
#fs所使用的阿里的app_key(新华)
app_key_yq: ZurNHpaQLq6P55YS
#新华短信请求地址(这个服务是我们自己写的)
@@ -164,3 +178,13 @@
xhsmsPwd: zW5eXe
#虚拟接入码
xhsmsjrm: 1069055
#新华FTP连接
FTP_SERVER: "192.16.4.220"
FTP_USERNAME: voice
FTP_PASSWORD: xh@2023
#语音地址访问前缀(新华)
voicePathPrefix: http://192.168.191.181:8095/profile/upload/vadio/
#语音地址访问前缀(公司)
#voicePathPrefix: http://192.168.2.13:8095/profile/upload/vadio/
ruoyi-admin/src/main/resources/application.yml
@@ -72,7 +72,7 @@
  # redis é…ç½®
  redis:
    #    # åœ°å€ï¼ˆä¹‰ä¹ŒäºŒé™¢ï¼‰
    host: 192.168.2.10
    host: 127.0.0.1
    port: 6020
    # åœ°å€ï¼ˆå…¬å¸ï¼‰
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -84,6 +84,13 @@
    private String phonenumber;
    /**
     * èº«ä»½è¯å·
     */
    @ApiModelProperty(value = "身份证号")
    @Excel(name = "身份证号")
    private String idCard;
    /**
     * ç”¨æˆ·æ€§åˆ«
     */
    @ApiModelProperty(value = "用户性别")
@@ -434,6 +441,14 @@
        this.depts = depts;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId()).append("deptId", getDeptId()).append("userName", getUserName()).append("nickName", getNickName()).append("email", getEmail()).append("phonenumber", getPhonenumber()).append("sex", getSex()).append("avatar", getAvatar()).append("password", getPassword()).append("status", getStatus()).append("delFlag", getDelFlag()).append("loginIp", getLoginIp()).append("loginDate", getLoginDate()).append("createBy", getCreateBy()).append("createTime", getCreateTime()).append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("remark", getRemark()).append("dept", getDept()).toString();
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUserRole.java
ÎļþÃû´Ó ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java ÐÞ¸Ä
@@ -1,4 +1,4 @@
package com.ruoyi.system.domain;
package com.ruoyi.common.core.domain.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
@@ -60,6 +60,7 @@
    <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
        <include refid="selectGenTableVo"/>
        <where>
            del_flag= 0
            <if test="tableName != null and tableName != ''">
                AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
            </if>
@@ -115,7 +116,7 @@
               c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
        FROM gen_table t
             LEFT JOIN gen_table_column c ON t.table_id = c.table_id
        where t.table_id = #{tableId} order by c.sort
        where del_flag= 0 and t.table_id = #{tableId} order by c.sort
    </select>
    
    <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
@@ -189,7 +190,7 @@
            <if test="remark != null">remark = #{remark},</if>
            update_time = sysdate()
        </set>
        where table_id = #{tableId}
        where table_id = #{tableId} and del_flag= 0
    </update>
    
    <delete id="deleteGenTableByIds" parameterType="Long">
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -18,6 +18,7 @@
import com.ruoyi.common.utils.http.HttpUtils;
import com.smartor.common.SendService;
import com.smartor.domain.*;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.mapper.ServiceTaskMapper;
import com.smartor.mapper.SysUserImportMapper;
import com.smartor.service.*;
@@ -94,7 +95,7 @@
    private ServiceTaskMapper serviceTaskMapper;
    @Autowired
    private SendService sendService;
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private RedisCache redisCache;
@@ -286,55 +287,69 @@
                ivrTaskcall.setSendstate(2L);
                List<ServiceSubtask> selectServiceSubtaskList = iServiceSubtaskService.selectServiceSubtaskList(ivrTaskcall);
                if (descByCode.equals("电话")) {
                    String value = "";
                    for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
                        ServiceTask ivrTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
                        if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) {
                            //如何任务被“暂停”或“终止”
                            break;
                        }
                        //获取到value值最少的key
                        String key = getKey();
                        if (commonTaskcallMQ.getSendType().equals("2")) {
                            //说明是立即发送
                            String value = redisCache.getCacheObject("cache-0");
                        boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
                        //说明是立即发送(先把消息放到cache-0中,   displayNo不知道怎么配置)
                        if (dateToday) {
                            try {
                            ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO();
                            serviceSubtask1.setTaskid(commonTaskcallMQ.getTaskid());
                                serviceSubtask1.setTaskid(ivrTask.getTaskid());
                            List<ServiceSubtask> selectServiceSubtaskList1 = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask1);
                            for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) {
                                if (StringUtils.isEmpty(value)) {
                                    value = "," + serviceSubtask2.getId().toString() + ",";
                                } else {
                                        if (!value.contains("," + serviceSubtask2.getId().toString()))
                                    value = value + "," + serviceSubtask2.getId().toString() + ",";
                                }
                            }
                            redisCache.setCacheObject("cache-0", value);
                        } else {
                            //非立即发送
                            String value = redisCache.getCacheObject(key);
                            ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO();
                            serviceSubtask1.setTaskid(commonTaskcallMQ.getTaskid());
                            List<ServiceSubtask> selectServiceSubtaskList1 = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask1);
                            for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) {
                                if (StringUtils.isEmpty(value)) {
                                    value = "," + serviceSubtask2.getId().toString() + ",";
                                } else {
                                    value = value + "," + serviceSubtask2.getId().toString() + ",";
                                }
                            }
                            redisCache.setCacheObject(key, value);
                            } catch (Exception e) {
                                String guid = UUID.randomUUID().toString();
                                log.error("长期任务,电话发送失败原因:{},{}", e.getMessage(), guid);
                                serviceSubtask.setResult("error");
                                serviceSubtask.setRemark("系统错误");
                                serviceSubtask.setSendstate(3L);
                                serviceSubtask.setFinishtime(new Date());
                                serviceSubtask.setGuid(guid);
                                iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                        }
                        //任务发送记录(这个代码应该写在phoneTask中,先写在这,后面再改)
                            //在子任务表里记录一下
                            String uuid = UUID.randomUUID().toString();
                            serviceSubtask.setResult("success");
                            serviceSubtask.setRemark("电话发送成功");
                            serviceSubtask.setGuid(uuid);
                            serviceSubtask.setSendstate(3L);
                            serviceSubtask.setFinishtime(new Date());
                            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                            //任务发送记录
                        ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
                        serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
                        serviceSubtaskRecord.setUuid(UUID.randomUUID().toString());
                            serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId());
                            serviceSubtaskRecord.setUuid(uuid);
                        serviceSubtaskRecord.setTasktype(serviceSubtask.getType());
                        serviceSubtaskRecord.setPreachform("3");
                        serviceSubtaskRecord.setStartTime(System.currentTimeMillis());
                            serviceSubtaskRecord.setRemark("电话发送成功");
                        serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord);
//                        //通过多线程的方式去打电话
                        }
//                        //通过多线程的方式去打电话(这个是上海的方法)
//                        executorService.submit(new PhoneTask(serviceSubtask, ivrTaskTemplateVO1, redisCache, sendService, phonePath, robotPhoneUtils));
                    }
                    //将要执行的放到缓存中
                    String cache0 = redisCache.getCacheObject("cache-0");
                    if (StringUtils.isNotEmpty(cache0)) {
                        redisCache.setCacheObject("cache-0", cache0 + value);
                    } else if (StringUtils.isEmpty(cache0) && StringUtils.isNotEmpty(value)) {
                        redisCache.setCacheObject("cache-0", value);
                    }
                } else if (descByCode.equals("多媒体")) {
                    //多媒体
@@ -403,7 +418,7 @@
                                iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                            } catch (Exception e) {
                                String guid = UUID.randomUUID().toString();
                                log.error("长期任务,发送失败原因:{},{}", e.getMessage(), guid);
                                log.error("长期任务,短信发送失败原因:{},{}", e.getMessage(), guid);
                                serviceSubtask.setResult("error");
                                serviceSubtask.setRemark("系统错误");
                                serviceSubtask.setSendstate(5L);
@@ -464,7 +479,7 @@
                                iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                            } catch (Exception e) {
                                String guid = UUID.randomUUID().toString();
                                log.error("长期任务,发送失败原因:{},{}", e.getMessage(), guid);
                                log.error("长期任务,公众号发送失败原因:{},{}", e.getMessage(), guid);
                                serviceSubtask.setResult("error");
                                serviceSubtask.setRemark("系统错误");
                                serviceSubtask.setSendstate(5L);
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -12,8 +12,7 @@
 * @author ruoyi
 */
@Mapper
public interface SysUserMapper
{
public interface SysUserMapper {
    /**
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢ç”¨æˆ·åˆ—表
     *
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
@@ -2,9 +2,9 @@
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysUserRole;
/**
 * ç”¨æˆ·ä¸Žè§’色关联表 æ•°æ®å±‚
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
@@ -3,7 +3,7 @@
import java.util.List;
import java.util.Set;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.common.core.domain.entity.SysUserRole;
/**
 * è§’色业务层
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
@@ -1,29 +1,26 @@
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUserRole;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysRoleDept;
import com.ruoyi.system.domain.SysRoleMenu;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysRoleDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysRoleMenuMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
 * è§’色 ä¸šåŠ¡å±‚å¤„ç†
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -2,10 +2,7 @@
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUserDept;
import com.ruoyi.common.core.domain.entity.*;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
@@ -13,7 +10,6 @@
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -21,6 +21,7 @@
        <result property="loginIp" column="login_ip"/>
        <result property="loginDate" column="login_date"/>
        <result property="createBy" column="create_by"/>
        <result property="idCard" column="id_card"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
@@ -54,6 +55,7 @@
    <sql id="selectUserVo">
        select u.user_id,
               u.dept_id,
               u.id_card,
               u.hosp_info,
               u.dept_info,
               u.searchscope,
@@ -92,7 +94,8 @@
    </sql>
    <select id="selectUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult">
        select u.user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_type, u.nick_name, u.user_name, u.email,
        select u.user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_type, u.nick_name, u.user_name,
        u.email,u.id_card,
        u.avatar,
        u.phonenumber, u.sex, u.status,
        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
@@ -110,6 +113,9 @@
        </if>
        <if test="status != null and status != ''">
            AND u.status = #{status}
        </if>
        <if test="idCard != null and idCard != ''">
            AND u.id_card = #{idCard}
        </if>
        <if test="phonenumber != null and phonenumber != ''">
            AND u.phonenumber like concat('%', #{phonenumber}, '%')
@@ -130,9 +136,10 @@
    <select id="selectAllocatedList" parameterType="com.ruoyi.common.core.domain.entity.SysUser"
            resultMap="SysUserResult">
        select distinct u.user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_name, u.user_type, u.nick_name,
        select distinct u.user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_name, u.user_type,
        u.nick_name,
        u.email,
        u.phonenumber, u.status,
        u.phonenumber, u.status,u.id_card,
        u.create_time
        from sys_user u
        left join sys_dept d on u.dept_id = d.dept_id
@@ -151,9 +158,10 @@
    <select id="selectUnallocatedList" parameterType="com.ruoyi.common.core.domain.entity.SysUser"
            resultMap="SysUserResult">
        select distinct u.user_id, u.dept_id, u.hosp_info, u.dept_info,u.searchscope, u.user_name, u.user_type, u.nick_name,
        select distinct u.user_id, u.dept_id, u.hosp_info, u.dept_info,u.searchscope, u.user_name, u.user_type,
        u.nick_name,
        u.email,
        u.phonenumber, u.status,
        u.phonenumber, u.status,u.id_card,
        u.create_time
        from sys_user u
        left join sys_dept d on u.dept_id = d.dept_id
@@ -222,6 +230,7 @@
        <if test="deptInfo != null and deptInfo != ''">dept_info,</if>
        <if test="hospInfo != null and hospInfo != ''">hosp_info,</if>
        <if test="searchscope != null and searchscope != ''">searchscope,</if>
        <if test="idCard != null and idCard != ''">id_card,</if>
        create_time
        )values(
        <if test="userId != null and userId != ''">#{userId},</if>
@@ -240,6 +249,7 @@
        <if test="deptInfo != null and deptInfo != ''">#{deptInfo},</if>
        <if test="hospInfo != null and hospInfo != ''">#{hospInfo},</if>
        <if test="searchscope != null and searchscope != ''">#{searchscope},</if>
        <if test="idCard != null and idCard != ''">#{idCard},</if>
        sysdate()
        )
    </insert>
@@ -264,6 +274,7 @@
            <if test="searchscope != null">searchscope = #{searchscope},</if>
            <if test="deptInfo != null and deptInfo != ''">dept_info=#{deptInfo},</if>
            <if test="hospInfo != null and hospInfo != ''">hosp_info=#{hospInfo},</if>
            <if test="idCard != null and idCard != ''">id_card=#{idCard},</if>
            update_time = sysdate()
        </set>
        where user_id = #{userId}
smartor/pom.xml
@@ -130,6 +130,11 @@
            <artifactId>axis-jaxrpc</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.54</version>
        </dependency>
    </dependencies>
smartor/src/main/java/com/smartor/common/FtpService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,119 @@
package com.smartor.common;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Vector;
@Slf4j
@Component
public class FtpService {
    @Value("${FTP_SERVER}")
    private String FTP_SERVER;
    @Value("${FTP_USERNAME}")
    private String FTP_USERNAME;
    @Value("${FTP_PASSWORD}")
    private String FTP_PASSWORD;
    public void downloadFolder(String remoteDir, String localDir) {
        Session session = null;
        ChannelSftp channelSftp = null;
        try {
            // 1. åˆ›å»º JSch å®žä¾‹å¹¶è®¾ç½®ä¼šè¯
            JSch jsch = new JSch();
            session = jsch.getSession(FTP_USERNAME, FTP_SERVER, 8094);
            session.setPassword(FTP_PASSWORD);
            // è·³è¿‡ä¸»æœºå¯†é’¥æ£€æŸ¥
            session.setConfig("StrictHostKeyChecking", "no");
            // 2. è¿žæŽ¥åˆ° SFTP æœåС噍
            session.connect();
            channelSftp = (ChannelSftp) session.openChannel("sftp");
            channelSftp.connect();
            // 3. å¼€å§‹é€’归下载
            downloadDirectory(channelSftp, remoteDir, localDir);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            // 4. å…³é—­è¿žæŽ¥
            if (channelSftp != null) {
                channelSftp.disconnect();
            }
            if (session != null) {
                session.disconnect();
            }
        }
    }
    /**
     * é€’归下载远程目录到本地
     *
     * @param channelSftp SFTP é€šé“
     * @param remoteDir   è¿œç¨‹ç›®å½•路径
     * @param localDir    æœ¬åœ°ç›®å½•路径
     * @throws Exception å¼‚常
     */
    private static void downloadDirectory(ChannelSftp channelSftp, String remoteDir, String localDir) throws Exception {
        // ç¡®ä¿æœ¬åœ°ç›®å½•存在
        File localDirectory = new File(localDir);
        if (!localDirectory.exists()) {
            localDirectory.mkdirs();
        }
        // åˆ—出远程目录中的所有文件和文件夹
        Vector<ChannelSftp.LsEntry> entries = channelSftp.ls(remoteDir);
        for (ChannelSftp.LsEntry entry : entries) {
            String fileName = entry.getFilename();
            // è·³è¿‡ "." å’Œ ".."
            if (".".equals(fileName) || "..".equals(fileName)) {
                continue;
            }
            String remoteFilePath = remoteDir + "/" + fileName;
            String localFilePath = localDir + File.separator + fileName;
            if (entry.getAttrs().isDir()) {
                // å¦‚果是文件夹,递归下载
                downloadDirectory(channelSftp, remoteFilePath, localFilePath);
            } else {
                // å¦‚果是文件,覆盖下载
                File localFile = new File(localFilePath);
                // å¦‚果本地文件已存在,先删除
                if (localFile.exists()) {
                    localFile.delete();
                }
                try (FileOutputStream fos = new FileOutputStream(localFile)) {
                    channelSftp.get(remoteFilePath, fos);
                    log.error("文件下载成功:{}", remoteFilePath);
                } catch (Exception e) {
                    System.err.println("文件下载失败: " + remoteFilePath);
                    e.printStackTrace();
                }
            }
        }
    }
//
//    @Test
//    public void aa() {
//        downloadFolder("/", "D:\\ruoyi\\uploadPath\\upload\\vadio\\voice");
//    }
}
smartor/src/main/java/com/smartor/common/SendService.java
@@ -1,12 +1,8 @@
package com.smartor.common;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.ruoyi.common.utils.http.HttpUtils;
import com.smartor.domain.*;
import com.smartor.mapper.PatWildcardMapper;
@@ -23,12 +19,9 @@
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * å‘送服务工具类
smartor/src/main/java/com/smartor/domain/IvrTaskTemplate.java
@@ -147,6 +147,12 @@
    private Date addTime;
    /**
     * æ˜¯å¦æ˜¯é•¿æœŸæ¨¡æ¿ï¼š  0:不是    1:是
     */
    @ApiModelProperty(value = "是否是长期模板:  0:不是    1:是")
    private String longTemp;
    /**
     * ä¿®æ”¹ç”¨æˆ·ID
     */
    @Excel(name = "修改用户ID")
@@ -382,7 +388,6 @@
     */
    @ApiModelProperty(value = "部门编码")
    private String deptCode;
    /**
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateVO.java
@@ -397,6 +397,12 @@
    @ApiModelProperty(value = "部门编码")
    private String deptCode;
    /**
     * æ˜¯å¦æ˜¯é•¿æœŸæ¨¡æ¿ï¼š  0:不是    1:是
     */
    @ApiModelProperty(value = "是否是长期模板:  0:不是    1:是")
    private String longTemp;
    /**
     * å…è®¸é‡æ‹¨æ¬¡æ•°
smartor/src/main/java/com/smartor/domain/PatArchive.java
@@ -331,4 +331,36 @@
    @Excel(name = " å‡ºé™¢æ–¹å¼åç§° ")
    private String outWayName;
    @ApiModelProperty("照护场所:1家庭   2养老机构")
    @Excel(name = " ç…§æŠ¤åœºæ‰€ï¼š1家庭   2养老机构 ")
    private String careFacilities;
    @ApiModelProperty("照护场所:1家庭   2养老机构")
    @Excel(name = " ç…§æŠ¤åœºæ‰€ï¼š1家庭   2养老机构 ")
    private String casePath;
    @ApiModelProperty("受教育程度")
    @Excel(name = "受教育程度")
    private String degreeOfEducation;
    @ApiModelProperty("婚姻状况")
    @Excel(name = "婚姻状况")
    private String maritalStatus;
    @ApiModelProperty("家庭人均收入")
    @Excel(name = "家庭人均收入")
    private String income;
    @ApiModelProperty("医保类型")
    @Excel(name = "医保类型")
    private String medicareType;
    @ApiModelProperty("主要照护人")
    @Excel(name = "主要照护人")
    private String carePerson;
    @ApiModelProperty("主要照护人年龄")
    @Excel(name = "主要照护人年龄")
    private String casePersonAge;
}
smartor/src/main/java/com/smartor/domain/PatArchiveImport.java
@@ -83,6 +83,13 @@
    @Excel(name = "年龄")
    private Long age;
    /**
     * æ˜¯å¦åˆ›å»ºå¸å·
     */
    @ApiModelProperty("是否创建帐号")
    @Excel(name = "是否创建帐号:1 åˆ›å»ºï¼ˆé»˜è®¤ï¼‰   2不创建")
    private Long account = 1L;
    /**
     * å¾®ä¿¡openid
@@ -103,5 +110,17 @@
    @ApiModelProperty("批次号")
    private String batchNo;
    /**
     * pageNum
     */
    @ApiModelProperty("pageNum")
    private Integer pageNum;
    /**
     * pageSize
     */
    @ApiModelProperty("pageSize")
    private Integer pageSize;
}
smartor/src/main/java/com/smartor/domain/PatArchiveVO.java
@@ -258,7 +258,6 @@
    @ApiModelProperty("出院病区编号")
    private String leavehospitaldistrictcode;
    /**
     * å‡ºé™¢æ–¹å¼åºå·
     */
@@ -272,6 +271,36 @@
    @ApiModelProperty("出院方式名称")
    @Excel(name = " å‡ºé™¢æ–¹å¼åç§° ")
    private String outWayName;
    @ApiModelProperty("照护场所:1家庭   2养老机构")
    @Excel(name = " ç…§æŠ¤åœºæ‰€ï¼š1家庭   2养老机构 ")
    private String careFacilities;
    @ApiModelProperty("照护场所:1家庭   2养老机构")
    @Excel(name = " ç…§æŠ¤åœºæ‰€ï¼š1家庭   2养老机构 ")
    private String casePath;
    @ApiModelProperty("受教育程度")
    @Excel(name = "受教育程度")
    private String degreeOfEducation;
    @ApiModelProperty("婚姻状况")
    @Excel(name = "婚姻状况")
    private String maritalStatus;
    @ApiModelProperty("家庭人均收入")
    @Excel(name = "家庭人均收入")
    private String income;
    @ApiModelProperty("医保类型")
    @Excel(name = "医保类型")
    private String medicareType;
    @ApiModelProperty("主要照护人")
    @Excel(name = "主要照护人")
    private String carePerson;
    @ApiModelProperty("主要照护人年龄")
    @Excel(name = "主要照护人年龄")
    private String casePersonAge;
}
smartor/src/main/java/com/smartor/domain/PatMedInhosp.java
@@ -370,4 +370,11 @@
     */
    @ApiModelProperty(value = "结束入院日期")
    private Date endInHospTime;
    @ApiModelProperty(value = "是否外部导入:0不是    1是")
    private Integer outImport = 0;
    @ApiModelProperty(value = "查询类型:1全部   2出院   3入院   4门诊   5外部患者 ")
    private Integer queryType = 1;
}
smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java
@@ -299,4 +299,10 @@
    @ApiModelProperty(value = "完成时间")
    private Date finishtime;
    /**
     * é•¿æœŸä»»åŠ¡ï¼Œç»™æ‚£è€…å‘é€çš„æ—¶é—´
     */
    @Excel(name = " é•¿æœŸä»»åŠ¡ï¼Œç»™æ‚£è€…å‘é€çš„æ—¶é—´")
    @ApiModelProperty(value = "长期任务,给患者发送的时间")
    private Date longSendTime;
}
smartor/src/main/java/com/smartor/domain/PhoneCallBackYQVO.java
@@ -16,7 +16,7 @@
     * å¯ä»¥å¯¹å½“前通道的音量进行适当调整,取值范围【-4,4】
     */
    @ApiModelProperty(value = "可以对当前通道的音量进行适当调整,取值范围【-4,4】")
    private Integer volume = 0;
    private Integer volume;
    /**
     * å¯ä»¥è°ƒæ•´å½“前通话的静默回调间隔时间,单位为毫秒,默认为3000
smartor/src/main/java/com/smartor/domain/ServiceTaskVO.java
@@ -339,4 +339,5 @@
    @ApiModelProperty(value = "补偿时间(未领取 ï¼Œå‘起补偿:从任务发送成功开始,compensate_date分钟后,患者仍未领取)单位:分钟 ")
    @Excel(name = " è¡¥å¿æ—¶é—´ï¼ˆæœªé¢†å– ï¼Œå‘起补偿:从任务发送成功开始,compensate_date分钟后,患者仍未领取)单位:分钟 ")
    private String compensateDate;
}
smartor/src/main/java/com/smartor/mapper/IvrLibaScriptTargetoptionMapper.java
@@ -44,6 +44,7 @@
     * @return ç»“æžœ
     */
    public int updateIvrLibaScriptTargetoption(IvrLibaScriptTargetoption ivrLibaScriptTargetoption);
    public int updateDynam(IvrLibaScriptTargetoption ivrLibaScriptTargetoption);
    /**
     * åˆ é™¤é—®é¢˜è¯æœ¯æŒ‡æ ‡é€‰é¡¹åº“
smartor/src/main/java/com/smartor/mapper/IvrLibaTemplateTargetoptionMapper.java
@@ -45,6 +45,8 @@
     */
    public int updateIvrLibaTemplateTargetoption(IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption);
    public int updateDynamiccruxs(IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption);
    /**
     * åˆ é™¤æ¨¡æ¿æŒ‡æ ‡é€‰é¡¹åº“
     *
smartor/src/main/java/com/smartor/mapper/PatArchiveImportMapper.java
@@ -1,6 +1,9 @@
package com.smartor.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUserRole;
import org.apache.ibatis.annotations.Mapper;
import com.smartor.domain.PatArchiveImport;
@@ -11,8 +14,7 @@
 * @date 2024-09-05
 */
@Mapper
public interface PatArchiveImportMapper
{
public interface PatArchiveImportMapper {
    /**
     * æŸ¥è¯¢Excel导入患者档案
     *
@@ -60,4 +62,28 @@
     * @return ç»“æžœ
     */
    public int deletePatArchiveImportByIds(Long[] ids);
    /**
     * æ ¡éªŒç”¨æˆ·åç§°æ˜¯å¦å”¯ä¸€
     *
     * @param idCard ç”¨æˆ·åç§°
     * @return ç»“æžœ
     */
    public SysUser checkUserExist(String idCard);
    /**
     * æ–°å¢žç”¨æˆ·ä¿¡æ¯
     *
     * @param user ç”¨æˆ·ä¿¡æ¯
     * @return ç»“æžœ
     */
    public int insertUser(SysUser user);
    /**
     * è§’色新增
     * @param sysUserRole
     * @return
     */
    public int insertUserRole(SysUserRole sysUserRole);
}
smartor/src/main/java/com/smartor/service/IPatArchiveImportService.java
@@ -2,6 +2,7 @@
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.smartor.domain.PatArchiveImport;
import org.springframework.web.multipart.MultipartFile;
@@ -60,5 +61,5 @@
     */
    public int deletePatArchiveImportById(Long id);
    public List<PatArchiveImport> importPatInfo(MultipartFile multipartFile);
    public List<PatArchiveImport> importPatInfo(MultipartFile multipartFile,SysUser user);
}
smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
@@ -1,10 +1,12 @@
package com.smartor.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.smartor.domain.PatMedInhosp;
import com.smartor.domain.PatMedInhospVO;
import com.smartor.domain.PatMedReq;
import com.smartor.domain.PatMedRes;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
@@ -93,4 +95,11 @@
     * @return
     */
    public List<PatMedRes> getDeptRanking(PatMedReq patMedReq);
    /**
     * åŒ»æŠ¤ä¸Žæ‚£è€…关联关系
     * @param patMedInhosp
     * @return
     */
    public List<PatMedInhosp> getDocAndPat(PatMedInhosp patMedInhosp);
}
smartor/src/main/java/com/smartor/service/IServiceSubtaskDetailService.java
@@ -3,6 +3,7 @@
import com.smartor.domain.ServiceSubtaskDetail;
import java.util.List;
import java.util.Map;
/**
 * è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†Service接口
@@ -25,7 +26,7 @@
     * @param serviceSubtaskDetail è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†
     * @return è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†é›†åˆ
     */
    public List<ServiceSubtaskDetail> selectServiceSubtaskDetailList( ServiceSubtaskDetail serviceSubtaskDetail);
    public Map<String, Object> selectServiceSubtaskDetailList(ServiceSubtaskDetail serviceSubtaskDetail);
    /**
     * æ–°å¢žè¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -1,7 +1,9 @@
package com.smartor.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.smartor.domain.*;
import com.smartor.domain.ServiceSubtask;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
@@ -103,6 +105,8 @@
    public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq);
    public Integer recordAccept(PhoneCallRecordVO phoneCallRecordVO);
    /**
     * èŽ·å–éšè®¿ã€å¤è¯Šé‡
     *
smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java
@@ -156,6 +156,16 @@
                    //修改
                    ivrLibaScriptTargetoption.setScriptid(ivrLibaScript.getId());
                    ivrLibaScriptTargetoptionMapper.updateIvrLibaScriptTargetoption(ivrLibaScriptTargetoption);
                    //如果要给正则置空,则需要单独调修改方法
                    if (CollectionUtils.isEmpty(ivrLibaScriptTargetoption.getNodynamiccruxs())) {
                        ivrLibaScriptTargetoption.setNodynamiccruxsJson(null);
                        ivrLibaScriptTargetoptionMapper.updateDynam(ivrLibaScriptTargetoption);
                    }
                    if (CollectionUtils.isEmpty(ivrLibaScriptTargetoption.getDynamiccruxs())) {
                        ivrLibaScriptTargetoption.setDynamiccruxsJson(null);
                        ivrLibaScriptTargetoptionMapper.updateDynam(ivrLibaScriptTargetoption);
                    }
                }
                if (ivrLibaScriptTargetoption.getIsoperation() != null && ivrLibaScriptTargetoption.getIsoperation() == 3) {
                    //删除
smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java
@@ -258,6 +258,16 @@
                    if (CollectionUtils.isNotEmpty(ivrLibaTemplateTargetoption.getNodynamiccruxs()))
                        ivrLibaTemplateTargetoption.setNodynamiccruxsJson(JSON.toJSONString(ivrLibaTemplateTargetoption.getNodynamiccruxs()));
                    ivrLibaTemplateTargetOptionMapper.updateIvrLibaTemplateTargetoption(ivrLibaTemplateTargetoption);
                    if (CollectionUtils.isEmpty(ivrLibaTemplateTargetoption.getDynamiccruxs())) {
                        ivrLibaTemplateTargetoption.setDynamiccruxsJson(null);
                        ivrLibaTemplateTargetOptionMapper.updateDynamiccruxs(ivrLibaTemplateTargetoption);
                    }
                    if (CollectionUtils.isEmpty(ivrLibaTemplateTargetoption.getNodynamiccruxs())) {
                        ivrLibaTemplateTargetoption.setNodynamiccruxsJson(null);
                        ivrLibaTemplateTargetOptionMapper.updateDynamiccruxs(ivrLibaTemplateTargetoption);
                    }
                } else if (isoperation == 3) {
                    //删除
                    if (ivrLibaTemplateTargetoption.getId() == null) {
smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
@@ -78,11 +78,12 @@
    public int saveOrUpdateTempScript(IvrTaskTemplateVO ivrTaskTemplateVO) {
        Integer i = null;
        IvrTaskTemplate ivrTaskTemplate = DtoConversionUtils.sourceToTarget(ivrTaskTemplateVO, IvrTaskTemplate.class);
        if (ivrTaskTemplateVO.getIsoperation() != null && ivrTaskTemplateVO.getIsoperation() == 1) {
        //传过来的静默时间是秒,需要改成毫秒
        if (ivrTaskTemplate.getSilencetime() != null)
            ivrTaskTemplate.setSilencetime(ivrTaskTemplate.getSilencetime() * 1000);
        if (ivrTaskTemplateVO.getIsoperation() != null && ivrTaskTemplateVO.getIsoperation() == 1) {
            //新增
            ivrTaskTemplate.setCreateTime(new Date());
            insertIvrTaskTemplate(ivrTaskTemplate);
smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java
@@ -1,16 +1,21 @@
package com.smartor.service.impl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.domain.entity.SysUserRole;
import com.smartor.domain.PatArchiveImport;
import com.smartor.mapper.PatArchiveImportMapper;
import com.smartor.service.IPatArchiveImportService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.usermodel.*;
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;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.text.DecimalFormat;
@@ -30,6 +35,7 @@
public class PatArchiveImportServiceImpl implements IPatArchiveImportService {
    @Autowired
    private PatArchiveImportMapper patArchiveImportMapper;
    /**
     * æŸ¥è¯¢Excel导入患者档案
@@ -100,7 +106,7 @@
    }
    @Override
    public List<PatArchiveImport> importPatInfo(MultipartFile multipartFile) {
    public List<PatArchiveImport> importPatInfo(MultipartFile multipartFile, SysUser user) {
        //用于返回
        List<PatArchiveImport> patArchiveImports = new ArrayList<>();
@@ -144,7 +150,11 @@
                    }
                    boolean contains = qc.contains(row.getCell(1).toString());
                    if (contains) continue;
                    PatArchiveImport pt = new PatArchiveImport();
                    pt.setIdcardno(patArchiveImport.getIdcardno());
                    pt.setDelFlag("0");
                    List<PatArchiveImport> patArchiveImports1 = patArchiveImportMapper.selectPatArchiveImportList(pt);
                    if (contains || CollectionUtils.isNotEmpty(patArchiveImports1)) continue;
                }
                if (ObjectUtils.isNotEmpty(row.getCell(2)) && StringUtils.isNotEmpty(row.getCell(2) + "")) {
@@ -171,11 +181,42 @@
                    patArchiveImport.setAge(Long.valueOf(row.getCell(7).toString()));
                }
                patArchiveImport.setCreateTime(new Date());
                patArchiveImport.setUpdateTime(new Date());
                //批量号(当前时间)
                patArchiveImport.setBatchNo(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
                patArchiveImport.setCreateBy(user.getNickName());
                insertPatArchiveImport(patArchiveImport);
                //给当前导入患者,注册帐号  sys_user  sys_user_role
                if (patArchiveImport.getAccount() == 1) {
                    //查询一下,该患者是否已经在表里创建了帐号
                    SysUser sysUser = patArchiveImportMapper.checkUserExist(patArchiveImport.getIdcardno());
                    if (ObjectUtils.isEmpty(sysUser)) {
                        sysUser = new SysUser();
                        //如果为空,则进行新增sys_user   sys_role
                        sysUser.setIdCard(patArchiveImport.getIdcardno());
                        int start = patArchiveImport.getIdcardno().length() - 6;
                        String lastSixDigits = patArchiveImport.getIdcardno().substring(start, start + 6);
                        sysUser.setUserName(lastSixDigits);
                        //密码:xh@123456
                        sysUser.setPassword("$2a$10$zja67LEWTESHutljd8bqEeRy.VgWb./8iJPpFR6VjTUa7ZYNfRRrO");
                        sysUser.setPhonenumber(patArchiveImport.getTelcode());
                        sysUser.setUserType("患者");
                        sysUser.setDeptId(395L);
                        sysUser.setNickName(patArchiveImport.getName());
                        sysUser.setCreateTime(new Date());
                        sysUser.setCreateBy(user.getNickName());
                        sysUser.setUpdateTime(new Date());
                        sysUser.setUpdateBy(user.getNickName());
                        patArchiveImportMapper.insertUser(sysUser);
                        //将患者与角色绑定
                        SysUserRole sysUserRole = new SysUserRole();
                        sysUserRole.setUserId(sysUser.getUserId());
                        sysUserRole.setRoleId(6L);
                        patArchiveImportMapper.insertUserRole(sysUserRole);
                    }
                }
                patArchiveImports.add(patArchiveImport);
            }
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -41,13 +41,15 @@
    private TemplateDeptMapper templateDeptMapper;
    @Autowired
    private IvrTaskTemplateMapper ivrTaskTemplateMapper;
    private PatArchiveImportMapper patArchiveImportMapper;
    @Autowired
    private Icd10AssociationMapper icd10AssociationMapper;
    @Autowired
    private SvyTaskTemplateMapper svyTaskTemplateMapper;
    @Autowired
    private IvrTaskTemplateMapper ivrTaskTemplateMappte;
    @Autowired
    private ServiceTaskMapper serviceTaskMapper;
@@ -211,18 +213,18 @@
            TemplateDept templateDept = new TemplateDept();
            templateDept.setDeptCode(patMedInhosp1.getLeaveldeptcode());
            templateDept.setLongTemp(1);
            templateDept.setType(11L);
            templateDept.setType(21L);
            List<TemplateDept> templateDepts = templateDeptMapper.selectTemplateDeptList(templateDept);
            //根据获取的长期任务模板ID,获取任务模板详情
            List<SvyTaskTemplate> svyTaskTemplates = new ArrayList<>();
            List<IvrTaskTemplate> ivrTaskTemplates = new ArrayList<>();
            if (CollectionUtils.isNotEmpty(templateDepts)) {
                for (TemplateDept templateDept1 : templateDepts) {
                    SvyTaskTemplate svyTaskTemplate = svyTaskTemplateMapper.selectSvyTaskTemplateBySvyid(templateDept1.getTempid());
                    if (ObjectUtils.isNotEmpty(svyTaskTemplate)) svyTaskTemplates.add(svyTaskTemplate);
                    IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateMappte.selectIvrTaskTemplateByID(templateDept1.getTempid());
                    if (ObjectUtils.isNotEmpty(ivrTaskTemplate)) ivrTaskTemplates.add(ivrTaskTemplate);
                }
            }
            //如果部门模板为空(暂定,将出入院表的check_flag设置为2  ï¼Œlong_task_reason è®°å½•原因)
            if (CollectionUtils.isEmpty(svyTaskTemplates) || svyTaskTemplates.size() == 0) {
            if (CollectionUtils.isEmpty(ivrTaskTemplates) || ivrTaskTemplates.size() == 0) {
                patMedInhosp1.setCheckFlag("2");
                patMedInhosp1.setLongTaskReason("该患者所在科室,未配置任务模板");
                patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
@@ -234,31 +236,31 @@
            //给个remark(用来做是否要给发送时间标识)
            String remark = null;
            //定义一个模板变量,用与临时保存一下找出来的模板
            SvyTaskTemplate stt = null;
            if (CollectionUtils.isNotEmpty(svyTaskTemplates) && svyTaskTemplates.size() == 1) {
                stt = svyTaskTemplates.get(0);
                taskid = svyTaskTemplates.get(0).getTaskid();
            IvrTaskTemplate stt = null;
            if (CollectionUtils.isNotEmpty(ivrTaskTemplates) && ivrTaskTemplates.size() == 1) {
                stt = ivrTaskTemplates.get(0);
                taskid = ivrTaskTemplates.get(0).getTaskid();
            } else if (CollectionUtils.isNotEmpty(svyTaskTemplates) && svyTaskTemplates.size() > 1) {
            } else if (CollectionUtils.isNotEmpty(ivrTaskTemplates) && ivrTaskTemplates.size() > 1) {
                //通过患者的疾病去找模板
                if (StringUtils.isNotEmpty(patMedInhosp1.getIcd10code())) {
                    aa:
                    for (SvyTaskTemplate svyTaskTemplate1 : svyTaskTemplates) {
                    for (IvrTaskTemplate ivrTaskTemplate1 : ivrTaskTemplates) {
                        //通过基础模板ID获取关联的疾病code
                        Icd10Association icd10Association = new Icd10Association();
                        icd10Association.setType(5L);
                        icd10Association.setOutid(svyTaskTemplate1.getTemplateid());
                        icd10Association.setOutid(ivrTaskTemplate1.getId());
                        List<Icd10Association> icd10Associations = icd10AssociationMapper.selectIcd10AssociationList(icd10Association);
                        if (CollectionUtils.isEmpty(icd10Associations)) {
                            //如能模板的疾病为空,则是本科室的通用默认模板
                            stt = svyTaskTemplate1;
                            stt = ivrTaskTemplate1;
                            taskid = stt.getTaskid();
                            continue;
                        } else {
                            //如能模板的疾病不为空,则是用匹配到疾病的模板(如果匹配出来多个模板,只用第一个)
                            for (Icd10Association icd10Association1 : icd10Associations) {
                                if (patMedInhosp1.getIcd10code().equals(icd10Association1.getIcd10code())) {
                                    stt = svyTaskTemplate1;
                                    stt = ivrTaskTemplate1;
                                    taskid = stt.getTaskid();
                                    break aa;
                                }
@@ -275,15 +277,15 @@
                    }
                } else {
                    //为空的话,直接用科室的通用模板的任务ID,该患者直接往子任务表里插入,但不要执行,需要人工干(将不能执行的原因备注好)
                    for (SvyTaskTemplate svyTaskTemplate1 : svyTaskTemplates) {
                    for (IvrTaskTemplate ivrTaskTemplate1 : ivrTaskTemplates) {
                        //通过基础模板ID获取关联的疾病code
                        Icd10Association icd10Association = new Icd10Association();
                        icd10Association.setType(5L);
                        icd10Association.setOutid(svyTaskTemplate1.getTemplateid());
                        icd10Association.setOutid(ivrTaskTemplate1.getId());
                        //找出该科室的通用模板
                        List<Icd10Association> icd10Associations = icd10AssociationMapper.selectIcd10AssociationList(icd10Association);
                        if (CollectionUtils.isEmpty(icd10Associations)) {
                            stt = svyTaskTemplate1;
                            stt = ivrTaskTemplate1;
                            //不配置发送时间
                            remark = "患者入院疾病为空";
                            //在出入院表记录一下该患者状态(该科室是有疾病为空的模板,所以可以在子任务里生成任务,所以任务是成功的,chect_flag=1)
@@ -306,14 +308,15 @@
            ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(taskid);
            ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
            serviceSubtask.setTaskid(serviceTask.getTaskid());
            serviceSubtask.setLibtemplateid(stt.getTemplateid());
            if (StringUtils.isNotEmpty(stt.getLibtemplateid()))
                serviceSubtask.setLibtemplateid(Long.valueOf(stt.getLibtemplateid()));
            serviceSubtask.setNurseId(patMedInhosp1.getNurseId());
            serviceSubtask.setNurseName(patMedInhosp1.getNurseName());
            serviceSubtask.setDrcode(patMedInhosp1.getDrcode());
            serviceSubtask.setDrname(patMedInhosp1.getDrname());
            serviceSubtask.setDeptname(patMedInhosp1.getLeaveldeptname());
            serviceSubtask.setTemplateid(stt.getId());
            serviceSubtask.setTemplatename(stt.getSvyname());
            serviceSubtask.setTemplatename(stt.getTemplateName());
            serviceSubtask.setPatid(patArchive.getId());
            serviceSubtask.setSendname(patArchive.getName());
            serviceSubtask.setSfzh(patArchive.getIdcardno());
@@ -417,6 +420,228 @@
        return 1;
    }
//问卷
//    @Override
//    public int dealOutHospInfo() {
//        PatMedInhosp patMedInhosp = new PatMedInhosp();
//        //获取未处理的数据
//        patMedInhosp.setCheckFlag("0");
//        patMedInhosp.setInhospstate("1");
//        List<PatMedInhosp> patMedInhosps = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
//
//        for (PatMedInhosp patMedInhosp1 : patMedInhosps) {
//            //根据患者所在科室,获取该科室的长期任务模板
//            Long taskid = null;
//            //通过deptCode获取关联的长期任务模板
//            TemplateDept templateDept = new TemplateDept();
//            templateDept.setDeptCode(patMedInhosp1.getLeaveldeptcode());
//            templateDept.setLongTemp(1);
//            templateDept.setType(11L);
//            List<TemplateDept> templateDepts = templateDeptMapper.selectTemplateDeptList(templateDept);
//            //根据获取的长期任务模板ID,获取任务模板详情
//            List<SvyTaskTemplate> svyTaskTemplates = new ArrayList<>();
//            if (CollectionUtils.isNotEmpty(templateDepts)) {
//                for (TemplateDept templateDept1 : templateDepts) {
//                    SvyTaskTemplate svyTaskTemplate = svyTaskTemplateMapper.selectSvyTaskTemplateBySvyid(templateDept1.getTempid());
//                    if (ObjectUtils.isNotEmpty(svyTaskTemplate)) svyTaskTemplates.add(svyTaskTemplate);
//                }
//            }
//            //如果部门模板为空(暂定,将出入院表的check_flag设置为2  ï¼Œlong_task_reason è®°å½•原因)
//            if (CollectionUtils.isEmpty(svyTaskTemplates) || svyTaskTemplates.size() == 0) {
//                patMedInhosp1.setCheckFlag("2");
//                patMedInhosp1.setLongTaskReason("该患者所在科室,未配置任务模板");
//                patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
//                continue;
//            }
//
//            //获取患者信息
//            PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp1.getPatid());
//            //给个remark(用来做是否要给发送时间标识)
//            String remark = null;
//            //定义一个模板变量,用与临时保存一下找出来的模板
//            SvyTaskTemplate stt = null;
//            if (CollectionUtils.isNotEmpty(svyTaskTemplates) && svyTaskTemplates.size() == 1) {
//                stt = svyTaskTemplates.get(0);
//                taskid = svyTaskTemplates.get(0).getTaskid();
//
//            } else if (CollectionUtils.isNotEmpty(svyTaskTemplates) && svyTaskTemplates.size() > 1) {
//                //通过患者的疾病去找模板
//                if (StringUtils.isNotEmpty(patMedInhosp1.getIcd10code())) {
//                    aa:
//                    for (SvyTaskTemplate svyTaskTemplate1 : svyTaskTemplates) {
//                        //通过基础模板ID获取关联的疾病code
//                        Icd10Association icd10Association = new Icd10Association();
//                        icd10Association.setType(5L);
//                        icd10Association.setOutid(svyTaskTemplate1.getTemplateid());
//                        List<Icd10Association> icd10Associations = icd10AssociationMapper.selectIcd10AssociationList(icd10Association);
//                        if (CollectionUtils.isEmpty(icd10Associations)) {
//                            //如能模板的疾病为空,则是本科室的通用默认模板
//                            stt = svyTaskTemplate1;
//                            taskid = stt.getTaskid();
//                            continue;
//                        } else {
//                            //如能模板的疾病不为空,则是用匹配到疾病的模板(如果匹配出来多个模板,只用第一个)
//                            for (Icd10Association icd10Association1 : icd10Associations) {
//                                if (patMedInhosp1.getIcd10code().equals(icd10Association1.getIcd10code())) {
//                                    stt = svyTaskTemplate1;
//                                    taskid = stt.getTaskid();
//                                    break aa;
//                                }
//                            }
//                        }
//                    }
//                    //如果循环完,stt还是为空,则该科室没有默认模板
//                    if (Objects.isNull(stt)) {
//                        //在出入院表记录一下该患者状态(该科室没有模板,所以无法在子任务里生成任务,所以任务是失败是的,chect_flag=2)
//                        patMedInhosp1.setCheckFlag("2");
//                        patMedInhosp1.setLongTaskReason("无法匹配到该科室模板,该科室也无默认模板");
//                        patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
//                        continue;
//                    }
//                } else {
//                    //为空的话,直接用科室的通用模板的任务ID,该患者直接往子任务表里插入,但不要执行,需要人工干(将不能执行的原因备注好)
//                    for (SvyTaskTemplate svyTaskTemplate1 : svyTaskTemplates) {
//                        //通过基础模板ID获取关联的疾病code
//                        Icd10Association icd10Association = new Icd10Association();
//                        icd10Association.setType(5L);
//                        icd10Association.setOutid(svyTaskTemplate1.getTemplateid());
//                        //找出该科室的通用模板
//                        List<Icd10Association> icd10Associations = icd10AssociationMapper.selectIcd10AssociationList(icd10Association);
//                        if (CollectionUtils.isEmpty(icd10Associations)) {
//                            stt = svyTaskTemplate1;
//                            //不配置发送时间
//                            remark = "患者入院疾病为空";
//                            //在出入院表记录一下该患者状态(该科室是有疾病为空的模板,所以可以在子任务里生成任务,所以任务是成功的,chect_flag=1)
//                            patMedInhosp1.setCheckFlag("1");
//                            patMedInhosp1.setLongTaskReason("患者入院疾病为空,已找到科室模板");
//                            patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
//                            continue;
//                        }
//                    }
//                    if (Objects.isNull(stt)) {
//                        //在出入院表记录一下该患者状态(该科室没有模板,所以无法在子任务里生成任务,所以任务是失败是的,chect_flag=2)
//                        patMedInhosp1.setCheckFlag("2");
//                        patMedInhosp1.setLongTaskReason("患者入院疾病为空,未找到科室模板");
//                        patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
//                        continue;
//                    }
//                }
//            }
//
//            ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(taskid);
//            ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
//            serviceSubtask.setTaskid(serviceTask.getTaskid());
//            serviceSubtask.setLibtemplateid(stt.getTemplateid());
//            serviceSubtask.setNurseId(patMedInhosp1.getNurseId());
//            serviceSubtask.setNurseName(patMedInhosp1.getNurseName());
//            serviceSubtask.setDrcode(patMedInhosp1.getDrcode());
//            serviceSubtask.setDrname(patMedInhosp1.getDrname());
//            serviceSubtask.setDeptname(patMedInhosp1.getLeaveldeptname());
//            serviceSubtask.setTemplateid(stt.getId());
//            serviceSubtask.setTemplatename(stt.getSvyname());
//            serviceSubtask.setPatid(patArchive.getId());
//            serviceSubtask.setSendname(patArchive.getName());
//            serviceSubtask.setSfzh(patArchive.getIdcardno());
//            serviceSubtask.setPhone(patArchive.getTelcode());
//            serviceSubtask.setSex(patArchive.getSex());
//            serviceSubtask.setAge(patArchive.getAge());
//            serviceSubtask.setSendstate(2L);
//            serviceSubtask.setStarttime(patMedInhosp1.getStarttime());
//            serviceSubtask.setEndtime(patMedInhosp1.getEndtime());
//            serviceSubtask.setServiceType("2");
//            serviceSubtask.setPreachform(serviceTask.getPreachform());
//            serviceSubtask.setHospType("2");
//            serviceSubtask.setCreateTime(new Date());
//            serviceSubtask.setUpdateTime(new Date());
//            serviceSubtask.setCreateBy(patMedInhosp1.getNurseName());
//            serviceSubtask.setLeavehospitaldistrictcode(patMedInhosp1.getLeavehospitaldistrictcode());
//            serviceSubtask.setLeavehospitaldistrictname(patMedInhosp1.getLeavehospitaldistrictname());
//            //设置发送时间
//            Date newDate = addDays(patMedInhosp1.getEndtime(), stt.getSendDay());
//            serviceSubtask.setLongSendTime(newDate);
//            //患者发送时间
//            if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) {
//                remark = patArchive.getNotrequiredreason();
//                serviceSubtask.setRemark(remark);
//                serviceSubtask.setResult("error");
//                serviceSubtask.setFinishtime(new Date());
//                //不执行
//                serviceSubtask.setSendstate(4L);
//            }
//
//            //在新增之前,先通过患者ID,sendstate=2查询一下,在所有长期任务中,是不是还有该患者待执行的任务,有的话,比较之前的endtime是否小于当前的endtaime,如果之前的小于现在的,则直接将之前的停掉(原因再入院)
//            ServiceSubtaskVO subtask = new ServiceSubtaskVO();
//            subtask.setPatid(patArchive.getId());
//            subtask.setSendstate(2L);
//            List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(subtask);
//            log.error("该患者待执行的任务:{}", selectServiceSubtaskList);
//            if (CollectionUtils.isNotEmpty(selectServiceSubtaskList) && selectServiceSubtaskList.size() > 0) {
//                for (ServiceSubtask serviceSubtask1 : selectServiceSubtaskList) {
//                    if (Objects.isNull(serviceSubtask1.getLongSendTime())) {
//                        //不是长期任务,不处理
//                        continue;
//                    }
//                    if (serviceSubtask1.getEndtime().before(serviceSubtask.getEndtime())) {
//                        //如果当前循环的子任务的出院时间在“准备新增的子任务”的出院时间之前,则将循环的子任务停掉
//                        serviceSubtask1.setSendstate(4L);
//                        serviceSubtask1.setRemark("患者再入院");
//                        serviceSubtask1.setResult("error");
//                        serviceSubtask1.setFinishtime(new Date());
//                        serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
//                    } else {
//                        //相反,则将当有的数据停掉
//                        serviceSubtask.setResult("error");
//                        serviceSubtask.setFinishtime(new Date());
//                        serviceSubtask.setSendstate(4L);
//                        serviceSubtask.setRemark("患者再入院");
//                    }
//                }
//            }
//
//            serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
//            //将check_flag改成1(已处理)
//            PatMedInhosp patMedInhosp2 = new PatMedInhosp();
//            patMedInhosp2.setInhospid(patMedInhosp1.getInhospid());
//            patMedInhosp2.setCheckFlag("1");
//            patMedInhospMapper.updatePatMedInhosp(patMedInhosp2);
//        }
//
//        //获取未处理在院的数据(如果刚刚出院的患者数据的出院时间,在下面查询出的入院时间之前,那之前的出院患者的数据,也得停掉,因为又入院了)
//        patMedInhosp.setCheckFlag("0");
//        patMedInhosp.setInhospstate("0");
//        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
//        if (CollectionUtils.isNotEmpty(patMedInhospList) && patMedInhospList.size() > 0) {
//            for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
//                //获取当前入院患者的待执行的出院子任务随访信息
//                ServiceSubtaskVO subtask = new ServiceSubtaskVO();
//                subtask.setPatid(patMedInhosp1.getPatid());
//                subtask.setSendstate(2L);
//                List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(subtask);
//                log.error("入院的患者待执行的任务:{}", selectServiceSubtaskList);
//                if (CollectionUtils.isNotEmpty(selectServiceSubtaskList) && selectServiceSubtaskList.size() > 0) {
//                    for (ServiceSubtask serviceSubtask1 : selectServiceSubtaskList) {
//                        if (Objects.isNull(serviceSubtask1.getLongSendTime())) {
//                            //不是长期任务,不处理
//                            continue;
//                        }
//                        if (serviceSubtask1.getEndtime().before(patMedInhosp1.getStarttime())) {
//                            //如果当前循环的子任务的出院时间在“准备新增的子任务”的出院时间之前,则将循环的子任务停掉
//                            serviceSubtask1.setSendstate(4L);
//                            serviceSubtask1.setRemark("患者再入院");
//                            serviceSubtask1.setResult("error");
//                            serviceSubtask1.setFinishtime(new Date());
//                            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
//                        }
//                    }
//                }
//                //将患入的入院数据设置为已处理
//                patMedInhosp1.setCheckFlag("1");
//                patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
//            }
//        }
//
//        return 1;
//    }
    /**
     * èŽ·å–å‡ºé™¢ï¼Œä½é™¢ï¼Œé—¨è¯ŠæœåŠ¡äººæ¬¡
@@ -430,6 +655,36 @@
        return patMedInhospMapper.getDeptRanking(patMedReq);
    }
    @Override
    public List<PatMedInhosp> getDocAndPat(PatMedInhosp patMedInhosp) {
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        if (StringUtils.isNotEmpty(patMedInhosp.getPatname()) || StringUtils.isNotEmpty(patMedInhosp.getNurseName()) || StringUtils.isNotEmpty(patMedInhosp.getDrname())) {
            //获取外部导入信息,并将外部患者放到patMedInhospList中
            PatArchiveImport patArchiveImport = new PatArchiveImport();
            if (StringUtils.isNotEmpty(patMedInhosp.getPatname())) {
                patArchiveImport.setName(patMedInhosp.getPatname());
            }
            if (StringUtils.isNotEmpty(patMedInhosp.getNurseName()))
                patArchiveImport.setCreateBy(patMedInhosp.getNurseName());
            if (StringUtils.isNotEmpty(patMedInhosp.getDrname()))
                patArchiveImport.setCreateBy(patMedInhosp.getDrname());
            List<PatArchiveImport> patArchiveImports = patArchiveImportMapper.selectPatArchiveImportList(patArchiveImport);
            if (CollectionUtils.isNotEmpty(patArchiveImports)) {
                for (PatArchiveImport patArchiveImport1 : patArchiveImports) {
                    PatMedInhosp patMedInhosp1 = new PatMedInhosp();
                    patMedInhosp1.setPatname(patArchiveImport1.getName());
                    patMedInhosp1.setSex(patArchiveImport1.getSex());
                    patMedInhosp1.setNurseName(patArchiveImport1.getCreateBy());
                    patMedInhosp1.setOutImport(1);
                    patMedInhosp1.setTelcode(patArchiveImport1.getTelcode());
                    patMedInhospList.add(patMedInhosp1);
                }
            }
        }
        return patMedInhospList;
    }
    private Date addDays(Date date, Integer days) {
        if (days == null) {
            days = 1;
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskDetailServiceImpl.java
@@ -1,16 +1,24 @@
package com.smartor.service.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.ServiceSubtask;
import com.smartor.domain.ServiceSubtaskDetail;
import com.smartor.domain.ServiceSubtaskDetail;
import com.smartor.domain.ServiceTask;
import com.smartor.mapper.ServiceSubtaskDetailMapper;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.service.IServiceSubtaskDetailService;
import com.smartor.service.IServiceTaskService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
 * è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†Service业务层处理
@@ -25,8 +33,10 @@
    private ServiceSubtaskDetailMapper ServiceSubtaskDetailMapper;
    @Autowired
    private ServiceSubtaskMapper ivrTaskSingleMapper;
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private IServiceTaskService serviceTaskService;
    /**
@@ -47,8 +57,73 @@
     * @return è¯­éŸ³ä»»åŠ¡å‘¼å«æ˜Žç»†
     */
    @Override
    public List<ServiceSubtaskDetail> selectServiceSubtaskDetailList(ServiceSubtaskDetail serviceSubtaskDetail) {
        return ServiceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
    public Map<String, Object> selectServiceSubtaskDetailList(ServiceSubtaskDetail serviceSubtaskDetail) {
        List<ServiceSubtaskDetail> serviceSubtaskDetails = ServiceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
        if (CollectionUtils.isNotEmpty(serviceSubtaskDetails)) {
            //处理一下通配符
            for (ServiceSubtaskDetail serviceSubtaskDetail1 : serviceSubtaskDetails) {
                ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(serviceSubtaskDetail1.getSubId());
                serviceSubtaskDetail1.setQuestiontext(getObject(serviceSubtask, serviceSubtaskDetail1.getQuestiontext()));
            }
        }
        //获取最后的总录音地址
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "查询成功");
        Map<String, Object> map1 = new HashMap<>();
        map1.put("serviceSubtaskDetails", serviceSubtaskDetails);
        map1.put("filteredDetails", null);
        //用于存储去重的数据
        List<ServiceSubtaskDetail> serviceSubtaskDetailSET = new ArrayList<>();
        Boolean flag = false;
        if (CollectionUtils.isNotEmpty(serviceSubtaskDetails)) {
            for (ServiceSubtaskDetail serviceSubtaskDetail1 : serviceSubtaskDetails) {
                if (serviceSubtaskDetailSET.size() == 0) {
                    serviceSubtaskDetailSET.add(serviceSubtaskDetail1);
                } else {
//                    for (ServiceSubtaskDetail subtaskDetail : serviceSubtaskDetailSET)
                    for (int i = 0; i < serviceSubtaskDetailSET.size(); i++) {
                        ServiceSubtaskDetail subtaskDetail = serviceSubtaskDetailSET.get(i);
                        if (subtaskDetail.getPatid().equals(serviceSubtaskDetail1.getPatid()) && subtaskDetail.getSubId().equals(serviceSubtaskDetail1.getSubId()) && subtaskDetail.getTaskid().equals(serviceSubtaskDetail1.getTaskid()) && subtaskDetail.getQuestiontext().equals(serviceSubtaskDetail1.getQuestiontext())) {
                            if (StringUtils.isNotEmpty(serviceSubtaskDetail1.getMatchedtext())) {
                                serviceSubtaskDetailSET.set(i, serviceSubtaskDetail1);
                            }
                            //匹配到这个数据,将flag改成false
                            if (flag == true) flag = false;
                        } else if ((subtaskDetail.getPatid().equals(serviceSubtaskDetail1.getPatid()) && subtaskDetail.getSubId().equals(serviceSubtaskDetail1.getSubId()) && subtaskDetail.getTaskid().equals(serviceSubtaskDetail1.getTaskid()) && !subtaskDetail.getQuestiontext().equals(serviceSubtaskDetail1.getQuestiontext()))) {
                            //标识一下,暂时没有匹配到这个数据
                            flag = true;
                        } else if ((subtaskDetail.getPatid() == serviceSubtaskDetail1.getPatid() && subtaskDetail.getSubId() != serviceSubtaskDetail1.getSubId() && subtaskDetail.getTaskid() == serviceSubtaskDetail1.getTaskid())) {
                            //标识一下,暂时没有匹配到这个数据
                            flag = true;
                        }
                    }
                    if (flag == true) {
                        //如果去重循环都结束了,还没有匹配到这个数据,则往去重对象里新增一个
                        serviceSubtaskDetailSET.add(serviceSubtaskDetail1);
                        flag = false;
                    }
                }
            }
        }
        Collections.sort(serviceSubtaskDetailSET, Comparator.comparingLong(ServiceSubtaskDetail::getTemplatequestionnum));
        map1.put("filteredDetails", serviceSubtaskDetailSET);
        map1.put("voice", "");
        if (CollectionUtils.isNotEmpty(serviceSubtaskDetails) && StringUtils.isNotEmpty(serviceSubtaskDetails.get(0).getQuestionvoice())) {
            //获取完整语音
            String filePath = serviceSubtaskDetails.get(0).getQuestionvoice();
            int lastIndex = filePath.lastIndexOf('.');
            if (lastIndex != -1) {
                int secondLastIndex = filePath.lastIndexOf('.', lastIndex - 1);
                if (secondLastIndex != -1) {
                    String voicePath = filePath.substring(0, secondLastIndex) + filePath.substring(lastIndex);
                    map1.put("voice", voicePath);
                }
            }
        }
        map.put("data", map1);
        return map;
    }
    /**
@@ -103,4 +178,37 @@
        return ServiceSubtaskDetailMapper.deleteServiceSubtaskDetailByCalldetailid(calldetailid);
    }
    private String getObject(ServiceSubtask serviceSubtask, String scriptContent) {
        Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid());
        for (Map<String, String> map : param.values()) {
            for (String key : map.keySet()) {
                scriptContent = scriptContent.replace(key, org.apache.commons.lang3.StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "");
            }
        }
        scriptContent = scriptContent.replace("${name}", org.apache.commons.lang3.StringUtils.isNotEmpty(serviceSubtask.getSendname()) ? serviceSubtask.getSendname() : "");
        scriptContent = scriptContent.replace("${dzz}", org.apache.commons.lang3.StringUtils.isNotEmpty(serviceSubtask.getAddr()) ? serviceSubtask.getAddr() : "");
        scriptContent = scriptContent.replace("${phone}", org.apache.commons.lang3.StringUtils.isNotEmpty(serviceSubtask.getTelcode()) ? serviceSubtask.getTelcode() : "");
        return scriptContent;
    }
    /**
     * èŽ·å–ä»»åŠ¡é‡Œçš„é€šé…ç¬¦
     *
     * @param taskId
     * @return
     */
    private Map<String, Map<String, String>> getParam(Long taskId) {
        ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(taskId);
        ObjectMapper objectMapper = new ObjectMapper();
        Map<String, Map<String, String>> serviceTaskMap = null;
        try {
            serviceTaskMap = objectMapper.readValue(serviceTask.getTextParam(), Map.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return serviceTaskMap;
    }
}
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -1,6 +1,5 @@
package com.smartor.service.impl;
import afu.org.checkerframework.checker.oigj.qual.O;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -8,26 +7,21 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpUtils;
import com.smartor.common.FtpService;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.IIvrTaskTemplateScriptService;
import com.smartor.service.IIvrTaskTemplateService;
import com.smartor.service.IServiceSubtaskService;
import com.smartor.service.IServiceTaskService;
import com.smartor.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
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;
import java.math.BigDecimal;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalTime;
@@ -71,8 +65,15 @@
    @Autowired
    private IIvrTaskTemplateService ivrTaskTemplateService;
    @Autowired
    private ISvyTaskTemplateService svyTaskTemplateService;
    @Autowired
    private IIvrTaskTemplateScriptService iIvrTaskTemplateScriptService;
    @Autowired
    private FtpService ftpService;
    @Value("${pri_key}")
    private String pri_key;
@@ -82,6 +83,15 @@
    @Value("${hangup}")
    private String hangup;
    @Value("${app_key_yq}")
    private String app_key_yq;
    @Value("${ruoyi.profile}")
    private String profile;
    @Value("${voicePathPrefix}")
    private String voicePathPrefix;
    /**
@@ -312,7 +322,19 @@
            serviceTask.setLeavehospitaldistrictcode(serviceTask.getLeavehospitaldistrictcode());
            serviceTaskService.insertServiceTask(serviceTask);
            if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1) {
                //这里需要将任务id与任务模板ID,在任务模板中绑定
                Map<String, Integer> map = new HashMap<>();
                if (StringUtils.isNotEmpty(serviceTaskVO.getType()) && serviceTaskVO.getType().equals("1")) {
                    IvrTaskTemplate ivrTaskTemplate = new IvrTaskTemplate();
                    ivrTaskTemplate.setTaskid(serviceTask.getTaskid());
                    ivrTaskTemplate.setId(serviceTaskVO.getTemplateid());
                    ivrTaskTemplateService.updateIvrTaskTemplate(ivrTaskTemplate);
                } else if (StringUtils.isNotEmpty(serviceTaskVO.getType()) && serviceTaskVO.getType().equals("2")) {
                    SvyTaskTemplate svyTaskTemplate = new SvyTaskTemplate();
                    svyTaskTemplate.setTaskid(serviceTask.getTaskid());
                    svyTaskTemplate.setId(serviceTaskVO.getTemplateid());
                    svyTaskTemplateService.updateSvyTaskTemplate(svyTaskTemplate);
                }
                map.put("subTaskId", null);
                map.put("taskId", serviceTask.getTaskid().intValue());
                return map;
@@ -334,6 +356,7 @@
                    serviceSubtask.setPatid(patTaskRelevance.getPatid());
                    serviceSubtask.setCreateTime(DateUtils.getNowDate());
                    serviceSubtask.setSendstate(1L);
                    if (serviceTaskVO.getLongTask() == 1) serviceSubtask.setSendstate(2L);
                    serviceSubtask.setDeptcode(patTaskRelevance.getDeptCode());
                    serviceSubtask.setDeptname(patTaskRelevance.getDeptName());
                    serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode());
@@ -347,6 +370,8 @@
                    serviceSubtask.setEndtime(patTaskRelevance.getEndtime());
                    serviceSubtask.setNurseId(patTaskRelevance.getNurseId());
                    serviceSubtask.setNurseName(patTaskRelevance.getNurseName());
                    if (serviceTaskVO.getLongTask() == 1)
                        serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime());
                    serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
                    integer = serviceSubtask.getId().intValue();
                }
@@ -363,7 +388,26 @@
            if (serviceTaskVO.getLibtemplateid() != null)
                serviceTask.setLibtemplateid(serviceTaskVO.getLibtemplateid().toString());
            serviceTask.setTemplateid(serviceTaskVO.getTemplateid());
            serviceTask.setLongTask(serviceTaskVO.getLongTask());
            serviceTaskService.updateServiceTask(serviceTask);
            if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1) {
                //这里需要将任务id与任务模板ID,在任务模板中绑定
                Map<String, Integer> map = new HashMap<>();
                if (StringUtils.isNotEmpty(serviceTaskVO.getType()) && serviceTaskVO.getType().equals("1")) {
                    IvrTaskTemplate ivrTaskTemplate = new IvrTaskTemplate();
                    ivrTaskTemplate.setTaskid(serviceTask.getTaskid());
                    ivrTaskTemplate.setId(serviceTaskVO.getTemplateid());
                    ivrTaskTemplateService.updateIvrTaskTemplate(ivrTaskTemplate);
                } else if (StringUtils.isNotEmpty(serviceTaskVO.getType()) && serviceTaskVO.getType().equals("2")) {
                    SvyTaskTemplate svyTaskTemplate = new SvyTaskTemplate();
                    svyTaskTemplate.setTaskid(serviceTask.getTaskid());
                    svyTaskTemplate.setId(serviceTaskVO.getTemplateid());
                    svyTaskTemplateService.updateSvyTaskTemplate(svyTaskTemplate);
                }
                map.put("subTaskId", null);
                map.put("taskId", serviceTask.getTaskid().intValue());
                return map;
            }
            if (CollectionUtils.isNotEmpty(serviceTaskVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : serviceTaskVO.getPatTaskRelevances()) {
                    ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
@@ -869,7 +913,17 @@
                        ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
                        List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
                        ivrTaskTemplateScriptVO.setQuestionResult(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getOptiondesc());
                        serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
                        ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
                        //修改一下语音路径(改成前端可以访问的,存到数据库中)
                        if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
                            String questionvoice = serviceSubtaskDetail.getQuestionvoice();
                            String[] split = questionvoice.split("\\\\");
                            if (split.length > 0) {
                                String lastPart = split[split.length - 1];
                                serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
                            }
                        }
                        serviceSubtaskDetailList.add(serviceSubtaskDetail);
                        serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
                        saveQuestionAnswerPhone(serviceSubTaskDetailReq);
                        //判断一下,这个选项结果是不是还有继续问下去的必要,例如选项结果是别人不想继续回答问题,就要结束掉
@@ -954,11 +1008,23 @@
                        if (j == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
                            ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
                            List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
                            serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
                            ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
                            //修改一下语音路径(改成前端可以访问的,存到数据库中)
                            if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
                                String questionvoice = serviceSubtaskDetail.getQuestionvoice();
                                String[] split = questionvoice.split("\\\\");
                                if (split.length > 0) {
                                    String lastPart = split[split.length - 1];
                                    serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
                                }
                            }
                            serviceSubtaskDetailList.add(serviceSubtaskDetail);
                            //如果没有 åŒ¹é…ä¸Šï¼Œè¿™ä¸ªå¿…须为null
                            serviceSubtaskDetailList.get(0).setMatchedtext("");
                            serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
                            saveQuestionAnswerPhone(serviceSubTaskDetailReq);
                            continue;
                        }
                        continue;
                    }
                }
                //都没有匹配到
@@ -1031,7 +1097,17 @@
                //不是选择题,直接记录答案,将结果写到detail中
                ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
                List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
                serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
                ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
                //修改一下语音路径(改成前端可以访问的,存到数据库中)
                if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
                    String questionvoice = serviceSubtaskDetail.getQuestionvoice();
                    String[] split = questionvoice.split("\\\\");
                    if (split.length > 0) {
                        String lastPart = split[split.length - 1];
                        serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
                    }
                }
                serviceSubtaskDetailList.add(serviceSubtaskDetail);
                serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
                saveQuestionAnswerPhone(serviceSubTaskDetailReq);
                //    String xh = idSort.split("-")[1];
@@ -1163,6 +1239,7 @@
        //pullTaskVOList用于数据返回
        List<PullTaskVO> pullTaskVOList = new ArrayList<>();
        String value0 = redisCache.getCacheObject("cache-0");
        log.error("任务拉取value0的值是多少:{}", value0);
        //  cache-0为立即发起的,其它的先推迟
        if (!StringUtils.isEmpty(value0)) {
            pullTaskVOList = getPullTaskList(value0, "cache-0");
@@ -1200,6 +1277,7 @@
    private List<PullTaskVO> getPullTaskList(String subIds, String cacheName) {
        log.error("任务拉取subIds的值是多少:{}", subIds);
        //pullTaskVOList用于数据返回
        List<PullTaskVO> pullTaskVOList = new ArrayList<>();
        //newValue0用于保存没有处理的子 ä»»åŠ¡
@@ -1210,7 +1288,6 @@
            if (cacheName.equals("cache-0") && i < 5 || !cacheName.equals("cache-0") && i < 1) {
                PullTaskVO pullTaskVO = new PullTaskVO();
                String subId = split[i].trim().replace(",", "");
                ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(subId));
                ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
                IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
@@ -1237,14 +1314,14 @@
                //封装返回数据
                //taskId = å­ä»»åŠ¡ID + é—®é¢˜ID +问题序号
                pullTaskVO.setTaskid(subId);
                pullTaskVO.setAppkey("ZurNHpaQLq6P55YS");
                pullTaskVO.setAppkey(app_key_yq);
                pullTaskVO.setSections(LocalTime.now().format(DateTimeFormatter.ofPattern("hh:mm")) + "-" + LocalTime.now().plusMinutes(1).format(DateTimeFormatter.ofPattern("hh:mm")));
                pullTaskVO.setPhones(serviceSubtask.getPhone());
                pullTaskVO.setPrologue(kcb);
                if (cacheName.equals("cache-0")) pullTaskVO.setDisplayNo("2");
                else pullTaskVO.setDisplayNo("2");
                pullTaskVOList.add(pullTaskVO);
                redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString());
                redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString(), 120, TimeUnit.MINUTES);
//                redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
            } else {
                if (StringUtils.isEmpty(newValue0)) {
@@ -1520,10 +1597,35 @@
        } else {
            for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubTaskDetailReq.getServiceSubtaskDetailList()) {
                serviceSubtaskDetail.setCreateTime(new Date());
                //先根据子任务id,任务ID和问题序号查询一下,该问题是否已经有值,如果有值,直接修改,如果为空,直接插入
                ServiceSubtaskDetail ssd = new ServiceSubtaskDetail();
                ssd.setSubId(serviceSubtaskDetail.getSubId());
                ssd.setTaskid(serviceSubtaskDetail.getTaskid());
                ssd.setTemplatequestionnum(serviceSubtaskDetail.getTemplatequestionnum());
                List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(ssd);
                if (CollectionUtils.isNotEmpty(serviceSubtaskDetails) && StringUtils.isNotEmpty(serviceSubtaskDetails.get(0).getMatchedtext())) {
                    serviceSubtaskDetail.setId(serviceSubtaskDetails.get(0).getId());
                    serviceSubtaskDetailMapper.updateServiceSubtaskDetail(serviceSubtaskDetail);
                } else {
                i = serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
            }
        }
        }
        return i;
    }
    @Override
    public Integer recordAccept(PhoneCallRecordVO phoneCallRecordVO) {
        if (phoneCallRecordVO.getAnswered() != null && phoneCallRecordVO.getAnswered() == true) {
            log.error("有人接电话了,并且完了");
            //说明有人接了
            int startIndex = phoneCallRecordVO.getRecord_path().indexOf("voice") + "voice".length() + 1;  // åŠ 1是跳过/符号
            int endIndex = phoneCallRecordVO.getRecord_path().lastIndexOf("/");
            String result = phoneCallRecordVO.getRecord_path().substring(startIndex, endIndex);
            //下载文件
            ftpService.downloadFolder("/" + LocalDate.now().toString(), profile + "/upload/vadio/voice/" + LocalDate.now().toString());
        }
        return 1;
    }
    @Override
@@ -1572,6 +1674,11 @@
    private ServiceSubtaskDetail getServiceSubtaskDetail(PhoneCallReqYQVO phoneCallReqYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate) {
        ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
        serviceSubtaskDetail.setSubId(Long.valueOf(phoneCallReqYQVO.getTaskid()));
        ServiceSubtask serviceSubtask1 = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(phoneCallReqYQVO.getTaskid()));
        if (serviceSubtask1 != null) {
            serviceSubtaskDetail.setTaskid(serviceSubtask1.getTaskid());
            serviceSubtaskDetail.setPatid(serviceSubtask1.getPatid());
        }
        serviceSubtaskDetail.setUuid(phoneCallReqYQVO.getUuid());
        serviceSubtaskDetail.setPhone(phoneCallReqYQVO.getPhone());
        serviceSubtaskDetail.setOperate(serviceSubtask.getCreateBy());
@@ -1598,7 +1705,7 @@
            if (ivrTaskTemplateTargetoption.getIsUserOperation() == 1) {
                serviceSubtaskDetail.setMatchedtext(ivrTaskTemplateTargetoption.getTargetvalue());
            }
            serviceSubtaskDetail.setTargetvalue(StringUtils.isEmpty(serviceSubtaskDetail.getTargetvalue()) ? i + ivrTaskTemplateTargetoption.getTargetvalue() : serviceSubtaskDetail.getTargetvalue() + "  " + (i + 1) + ivrTaskTemplateTargetoption.getTargetvalue());
            serviceSubtaskDetail.setTargetvalue(StringUtils.isEmpty(serviceSubtaskDetail.getTargetvalue()) ? ivrTaskTemplateTargetoption.getTargetvalue() : serviceSubtaskDetail.getTargetvalue() + "&" + ivrTaskTemplateTargetoption.getTargetvalue());
        }
        serviceSubtaskDetail.setAddtime(new Date());
smartor/src/main/java/com/smartor/service/impl/TemplateDeptServiceImpl.java
@@ -45,7 +45,7 @@
    /**
     * æ–°å¢žæ¨¡æ¿ç§‘室关联
     *
     * @param templateDept æ¨¡æ¿ç§‘室关联
     * @param templateDepts æ¨¡æ¿ç§‘室关联
     * @return ç»“æžœ
     */
    @Override
smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml
@@ -211,6 +211,15 @@
        where id = #{id}
    </update>
    <update id="updateDynam" parameterType="com.smartor.domain.IvrLibaScriptTargetoption">
        update ivr_liba_script_targetoption
        <trim prefix="SET" suffixOverrides=",">
            <if test="nodynamiccruxsJson == null ">nodynamiccruxs = "",</if>
            <if test="dynamiccruxsJson == null ">dynamiccruxs = "",</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteIvrLibaScriptTargetoptionByTargetoptionid" parameterType="Long">
        update ivr_liba_script_targetoption
        <trim prefix="SET" suffixOverrides=",">
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
@@ -219,6 +219,17 @@
        where id = #{id}
    </update>
    <update id="updateDynamiccruxs" parameterType="com.smartor.domain.IvrLibaTemplateTargetoption">
        update ivr_liba_template_targetoption
        <trim prefix="SET" suffixOverrides=",">
            <if test="nodynamiccruxsJson == null ">nodynamiccruxs = #{nodynamiccruxsJson},</if>
            <if test="dynamiccruxsJson == null ">dynamiccruxs = #{dynamiccruxsJson},</if>
        </trim>
        where id = #{id}
    </update>
    <update id="deleteIvrLibaTemplateTargetoptionById" parameterType="Long">
        update ivr_liba_template_targetoption
        <trim prefix="SET" suffixOverrides=",">
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateMapper.xml
@@ -62,12 +62,14 @@
        <result property="instruction" column="instruction"/>
        <result property="sendDay" column="send_day"/>
        <result property="deptCode" column="dept_code"/>
        <result property="longTemp" column="long_temp"/>
    </resultMap>
    <sql id="selectIvrTaskTemplateVo">
        select id,
               taskid,
               long_temp,
               send_day,
               recallcount,
               instruction,
@@ -90,6 +92,7 @@
            resultMap="IvrTaskTemplateResult">
        <include refid="selectIvrTaskTemplateVo"/>
        <where>
            del_flat=0
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="sendDay != null ">and send_day = #{sendDay}</if>
            <if test="id != null ">and id = #{id}</if>
@@ -146,12 +149,13 @@
            <if test="noVoiceNum != null ">and no_voice_num = #{noVoiceNum}</if>
            <if test="recallcount != null">and recallcount = #{prologrecallcountue}</if>
            <if test="deptCode != null">and dept_code = #{deptCode}</if>
            <if test="longTemp != null">and long_temp = #{longTemp}</if>
        </where>
    </select>
    <select id="selectIvrTaskTemplateByID" parameterType="Long" resultMap="IvrTaskTemplateResult">
        <include refid="selectIvrTaskTemplateVo"/>
        where id = #{id}
        where id = #{id} and del_flag=0
    </select>
    <insert id="insertIvrTaskTemplate" parameterType="com.smartor.domain.IvrTaskTemplate" useGeneratedKeys="true"
@@ -214,6 +218,7 @@
            <if test="instruction != null ">instruction,</if>
            <if test="sendDay != null ">send_day,</if>
            <if test="deptCode != null">dept_code,</if>
            <if test="longTemp != null">long_temp,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -272,6 +277,7 @@
            <if test="instruction != null ">#{instruction},</if>
            <if test="sendDay != null ">#{sendDay},</if>
            <if test="deptCode != null">#{deptCode},</if>
            <if test="longTemp != null">#{longTemp},</if>
        </trim>
    </insert>
@@ -334,20 +340,22 @@
            <if test="instruction != null ">instruction = #{instruction},</if>
            <if test="sendDay != null ">send_day = #{sendDay},</if>
            <if test="deptCode != null">dept_code = #{deptCode},</if>
            <if test="longTemp != null">long_temp = #{longTemp},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteIvrTaskTemplateByID" parameterType="Long">
        delete
        from ivr_task_template
    <update id="deleteIvrTaskTemplateByID" parameterType="Long">
        update ivr_task_template
        set del_flag=1
        where id = #{id}
    </delete>
    </update>
    <delete id="deleteIvrTaskTemplateByIDs" parameterType="String">
        delete from ivr_task_template where id in
    <update id="deleteIvrTaskTemplateByIDs" parameterType="String">
        update ivr_task_template
        set del_flag=1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    </update>
</mapper>
smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml
@@ -22,6 +22,10 @@
        <result property="batchName" column="batch_name"/>
        <result property="batchNo" column="batch_no"/>
    </resultMap>
    <resultMap type="com.ruoyi.common.core.domain.entity.SysUser" id="SysUserResult">
        <id property="userId" column="user_id"/>
        <result property="userName" column="user_name"/>
    </resultMap>
    <sql id="selectPatArchiveImportVo">
        select id,
@@ -47,6 +51,7 @@
            resultMap="PatArchiveImportResult">
        <include refid="selectPatArchiveImportVo"/>
        <where>
            del_flag=0
            <if test="patientno != null  and patientno != ''">
                and patientno = #{patientno}
            </if>
@@ -78,6 +83,7 @@
                and batch_no = #{batchNo}
            </if>
        </where>
        ORDER BY create_time desc
    </select>
    <select id="selectPatArchiveImportById" parameterType="Long"
@@ -226,5 +232,64 @@
        </foreach>
    </update>
    <select id="checkUserExist" parameterType="String" resultMap="SysUserResult">
        select user_id, user_name
        from sys_user
        where id_card = #{idCard}
          and del_flag = '0'
    </select>
    <insert id="insertUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser" useGeneratedKeys="true"
            keyProperty="userId">
        insert into sys_user(
        <if test="userId != null and userId != 0">user_id,</if>
        <if test="deptId != null and deptId != 0">dept_id,</if>
        <if test="userName != null and userName != ''">user_name,</if>
        <if test="nickName != null and nickName != ''">nick_name,</if>
        <if test="email != null and email != ''">email,</if>
        <if test="avatar != null and avatar != ''">avatar,</if>
        <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
        <if test="sex != null and sex != ''">sex,</if>
        <if test="password != null and password != ''">password,</if>
        <if test="status != null and status != ''">status,</if>
        <if test="createBy != null and createBy != ''">create_by,</if>
        <if test="remark != null and remark != ''">remark,</if>
        <if test="userType != null and userType != ''">user_type,</if>
        <if test="deptInfo != null and deptInfo != ''">dept_info,</if>
        <if test="hospInfo != null and hospInfo != ''">hosp_info,</if>
        <if test="searchscope != null and searchscope != ''">searchscope,</if>
        <if test="idCard != null and idCard != ''">id_card,</if>
        create_time
        )values(
        <if test="userId != null and userId != ''">#{userId},</if>
        <if test="deptId != null and deptId != ''">#{deptId},</if>
        <if test="userName != null and userName != ''">#{userName},</if>
        <if test="nickName != null and nickName != ''">#{nickName},</if>
        <if test="email != null and email != ''">#{email},</if>
        <if test="avatar != null and avatar != ''">#{avatar},</if>
        <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
        <if test="sex != null and sex != ''">#{sex},</if>
        <if test="password != null and password != ''">#{password},</if>
        <if test="status != null and status != ''">#{status},</if>
        <if test="createBy != null and createBy != ''">#{createBy},</if>
        <if test="remark != null and remark != ''">#{remark},</if>
        <if test="userType != null and userType != ''">#{userType},</if>
        <if test="deptInfo != null and deptInfo != ''">#{deptInfo},</if>
        <if test="hospInfo != null and hospInfo != ''">#{hospInfo},</if>
        <if test="searchscope != null and searchscope != ''">#{searchscope},</if>
        <if test="idCard != null and idCard != ''">#{idCard},</if>
        sysdate()
        )
    </insert>
    <insert id="insertUserRole" parameterType="com.ruoyi.common.core.domain.entity.SysUserRole">
        insert into sys_user_role(
        <if test="roleId != null ">role_id,</if>
        <if test="userId != null ">user_id</if>
        )values(
        <if test="roleId != null ">#{roleId},</if>
        <if test="userId != null">#{userId}</if>
        )
    </insert>
</mapper>
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -49,6 +49,14 @@
        <result property="ageUnit" column="age_unit"/>
        <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
        <result property="careFacilities" column="care_facilities"/>
        <result property="casePath" column="case_path"/>
        <result property="degreeOfEducation" column="degree_of_education"/>
        <result property="maritalStatus" column="marital_status"/>
        <result property="income" column="income"/>
        <result property="medicareType" column="medicare_type"/>
        <result property="carePerson" column="care_person"/>
        <result property="casePersonAge" column="case_person_age"/>
    </resultMap>
@@ -138,7 +146,15 @@
               isupload,
               pattype,
               viptype,
               upload_time
               upload_time,
               care_facilities,
               case_path,
               degree_of_education,
               marital_status,
               income,
               medicare_type,
               care_person,
               case_person_age
        from pat_archive
    </sql>
@@ -162,6 +178,14 @@
            <if test="ageUnit != null ">and age_unit = #{ageUnit}</if>
            <if test="notrequiredFlag != null ">and notrequired_flag = #{notrequiredFlag}</if>
            <if test="notrequiredreason != null ">and notrequiredreason = #{notrequiredreason}</if>
            <if test="careFacilities != null ">and care_facilities = #{careFacilities}</if>
            <if test="casePath != null ">and case_path = #{casePath}</if>
            <if test="degreeOfEducation != null ">and degree_of_education = #{degreeOfEducation}</if>
            <if test="maritalStatus != null ">and marital_status = #{maritalStatus}</if>
            <if test="income != null ">and income = #{income}</if>
            <if test="medicareType != null ">and medicare_type = #{medicareType}</if>
            <if test="carePerson != null ">and care_person = #{carePerson}</if>
            <if test="casePersonAge != null ">and case_person_age = #{casePersonAge}</if>
        </where>
    </select>
@@ -185,7 +209,15 @@
        a.create_time,
        a.update_time,
        a.viptype,
        a.birthdate
        a.birthdate,
        a.care_facilities,
        a.case_path,
        a.degree_of_education,
        a.marital_status,
        a.income,
        a.medicare_type,
        a.care_person,
        a.case_person_age
        from pat_archive a,pat_archivetag b ,base_tag c
        <where>
            a.del_flag=0 and
@@ -245,6 +277,14 @@
            <if test="ageUnit != null">age_unit,</if>
            <if test="notrequiredFlag != null ">notrequired_flag,</if>
            <if test="notrequiredreason != null ">notrequiredreason,</if>
            <if test="careFacilities != null ">care_facilities,</if>
            <if test="casePath != null ">case_path,</if>
            <if test="degreeOfEducation != null ">degree_of_education,</if>
            <if test="maritalStatus != null ">marital_status,</if>
            <if test="income != null ">income,</if>
            <if test="medicareType != null ">medicare_type,</if>
            <if test="carePerson != null ">care_person,</if>
            <if test="casePersonAge != null ">case_person_age,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="patientno != null">#{patientno},</if>
@@ -282,18 +322,29 @@
            <if test="ageUnit != null">#{ageUnit},</if>
            <if test="notrequiredFlag != null ">#{notrequiredFlag},</if>
            <if test="notrequiredreason != null ">#{notrequiredreason},</if>
            <if test="careFacilities != null ">#{careFacilities},</if>
            <if test="casePath != null ">#{casePath},</if>
            <if test="degreeOfEducation != null ">#{degreeOfEducation},</if>
            <if test="maritalStatus != null ">#{maritalStatus},</if>
            <if test="income != null ">#{income},</if>
            <if test="medicareType != null ">#{medicareType},</if>
            <if test="carePerson != null ">#{carePerson},</if>
            <if test="casePersonAge != null ">#{casePersonAge},</if>
        </trim>
    </insert>
    <insert id="insertPatArchive">
        insert into
        pat_archive(name,viptype,sex,idcardno,birthdate,place_of_residence,age,sourcefrom,archivetime,archiveby,telcode,relativetelcode,idcardtype,orgid,openid,dduserid,update_by,update_time
        ,create_by,create_time,isupload,upload_time,pattype,nation,birthplace,native_place,patientno,patid_his,sd_flag,age_unit,notrequired_flag,notrequiredreason)
        ,create_by,create_time,isupload,upload_time,pattype,nation,birthplace,native_place,patientno,patid_his,sd_flag,age_unit,notrequired_flag,notrequiredreason,care_facilities,case_path,
        degree_of_education,marital_status,income,medicare_type,care_person,case_person_age)
        values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.name},#{item.viptype},#{item.sex},#{item.idcardno},#{item.birthdate},#{item.placeOfResidence},#{item.age},#{item.sourcefrom},#{item.archivetime},#{item.archiveby}
            ,#{item.telcode},#{item.archiveby},#{item.idcardtype},#{item.orgid},#{item.openid},#{item.dduserid},#{item.updateBy},
            #{item.updateTime},#{item.createBy},#{item.createTime},#{item.isupload},#{item.uploadTime},#{item.pattype},#{item.nation},#{item.birthplace},#{item.nativePlace},#{item.patientno},#{item.patidHis},#{item.sdFlag},#{item.ageUnit},#{item.notrequiredFlag},#{item.notrequiredreason}
            #{item.updateTime},#{item.createBy},#{item.createTime},#{item.isupload},#{item.uploadTime},#{item.pattype},#{item.nation},#{item.birthplace},#{item.nativePlace},#{item.patientno},
            #{item.patidHis},#{item.sdFlag},#{item.ageUnit},#{item.notrequiredFlag},#{item.notrequiredreason}
            ,#{item.careFacilities},#{item.casePath},#{item.degreeOfEducation},#{item.maritalStatus},#{item.income},#{item.medicareType},#{item.carePerson},#{item.casePersonAge})
        </foreach>
    </insert>
@@ -329,6 +380,14 @@
            <if test="ageUnit != null">age_unit = #{ageUnit},</if>
            <if test="notrequiredFlag != null ">notrequired_flag = #{notrequiredFlag},</if>
            <if test="notrequiredreason != null ">notrequiredreason = #{notrequiredreason},</if>
            <if test="careFacilities != null ">care_facilities = #{careFacilities},</if>
            <if test="casePath != null ">case_path = #{casePath},</if>
            <if test="degreeOfEducation != null ">degree_of_education = #{degreeOfEducation},</if>
            <if test="maritalStatus != null ">marital_status = #{maritalStatus},</if>
            <if test="income != null ">income = #{income},</if>
            <if test="medicareType != null ">medicare_type = #{medicareType},</if>
            <if test="carePerson != null ">care_person = #{carePerson},</if>
            <if test="casePersonAge != null ">case_person_age = #{casePersonAge},</if>
        </trim>
        where id = #{id}
    </update>