liusheng
6 天以前 24166f2d9ae0bb72f061a38b96a113b1b6e44fbc
代码提交
已重命名1个文件
已修改31个文件
已添加6个文件
1645 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatServiceContractController.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/common/RandomStringGenerator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplate.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchive.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveOthreInfo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveOut.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveReq.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatServiceContract.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceOutPath.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskRecord.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatServiceContractMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IPatServiceContractService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetAssortServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatServiceContractServiceImpl.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 237 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatServiceContractMapper.xml 357 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -11,7 +11,7 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.quartz.util.RandomStringGenerator;
import com.smartor.common.RandomStringGenerator;
import com.smartor.common.SendService;
import com.smartor.config.RobotPhoneUtils;
import com.smartor.domain.*;
@@ -73,16 +73,10 @@
    private RedisCache redisCache;
    @Autowired
    private RobotPhoneUtils robotPhoneUtils;
    @Autowired
    private ServiceTaskMapper svyTaskMapper;
    @Autowired
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private ISvyTaskTemplateService iSvyTaskTemplateService;
    @Autowired
    private IServiceSubtaskRecordService serviceSubtaskRecordService;
@@ -194,7 +188,6 @@
                            //如果contains不为true,说明当前的患者已经发送成功,直接循环下一个人就行
                            if (!contains) continue;
                        }
                        try {
                            ServiceTask ivrTask = ivrTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
                            if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) {
@@ -291,7 +284,6 @@
                    //短信
                    //对url中两个参数加密
                    RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                    String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                    for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
                        //先判断一下,subIds是否为空,如果不为空,只执行subIds里的患者
@@ -303,74 +295,23 @@
                        }
                        try {
                            String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
                            SendMagParam sendMagParam = new SendMagParam();
                            sendMagParam.setType("4");
                            if (type == 1) {
                                //随访
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
                                //转成16进制
                                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/sf?p=" + format);
                                sendMagParam.setContent("您好,邀请您填写出院随访调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
                                log.info("888888888888:{}", sendMagParam);
                                sendMagParam.setContent("您好,邀请您填写出院随访调查表,请点击" + serviceSubtask.getOutPath() + "   å¡«å†™ã€‚感谢您配合!");
                            } else if (type == 2) {
                                //问券(问题)
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
                                sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
                                log.info("您好,邀请您填写出院调查表,请点击,{}", sendMagParam.getUrl());
                                sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + serviceSubtask.getOutPath() + "   å¡«å†™ã€‚感谢您配合!");
                            } else if (type == 3) {
                                //宣教
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/xj?p=" + format);
                                sendMagParam.setContent("您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!");
                                log.info("-----------sendMagParam的值为:{}", sendMagParam);
                                sendMagParam.setContent("您好,邀请您填写出院宣教调查表,请点击" + serviceSubtask.getOutPath() + "查看。感谢您配合!");
                            }
                            //短信还需要模板
//                            Map<String, String> req = new HashMap<>();
//                            req.put("phone", sendMagParam.getPhone());
//                            req.put("content", sendMagParam.getContent());
//                            String s = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req));
                            //send_mac:签名值,=md5(send_source+send_to_mobiles+send_text+签名编码),32位小写
                            String mac = "shuifang" + sendMagParam.getPhone() + sendMagParam.getContent() + "ShuiFang_jjty_20250106";
                            String mac = "shuifang" + serviceSubtask.getPhone() + sendMagParam.getContent() + "ShuiFang_jjty_20250106";
                            StringBuilder strb = new StringBuilder();
                            strb.append("send_source=shuifang&send_to_mobiles=" + sendMagParam.getPhone());
                            strb.append("send_source=shuifang&send_to_mobiles=" + serviceSubtask.getPhone());
                            strb.append("&send_text=" + sendMagParam.getContent());
                            strb.append("&send_mac=" + Md5Utils.hash(mac));
                            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmsszzz"); // è¾“出日期格式
@@ -414,7 +355,6 @@
                        serviceSubtask.setRemark("短信发送成功");
                        serviceSubtask.setGuid(uuid);
                        serviceSubtask.setSendstate(3L);
//                        serviceSubtask.setFinishtime(new Date());
                        serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                        //任务发送记录
@@ -455,62 +395,6 @@
                            sendMagParam.setContent(JSON.toJSONString(map));
                            sendMagParam.setOpenid(serviceSubtask.getOpenid());
                            Boolean aBoolean = sendService.sendMsg(sendMagParam);
                            String url = null;
////                            if (type == 1) {
////                                url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
////                            } else if (type == 2) {
////                                url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
////                            } else if (type == 3) {
////                                url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
////                            }
//                            if (type == 1) {
//                                //随访
//                                ServiceOutPath serviceOutPath = new ServiceOutPath();
//                                serviceOutPath.setParam1(taskId);
//                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setCreateTime(new Date());
//                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//                                String format = String.format("%03X", serviceOutPath.getId());
//                                serviceOutPath.setRadix(format);
//                                serviceOutPath.setUpdateTime(new Date());
//                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
////                                sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
//                                url = ip + ":" + req_path + "/sf?p=" + format;
//                            } else if (type == 2) {
//                                //问券
//                                ServiceOutPath serviceOutPath = new ServiceOutPath();
//                                serviceOutPath.setParam1(taskId);
//                                serviceOutPath.setParam2(patid);
////                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
//                                serviceOutPath.setParam3(ivrTask1.getTaskName());
//                                serviceOutPath.setCreateTime(new Date());
//                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//                                String format = String.format("%03X", serviceOutPath.getId());
//                                serviceOutPath.setRadix(format);
//                                serviceOutPath.setUpdateTime(new Date());
//                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
////                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
//                                url = ip + ":" + req_path + "/wt?p=" + format;
//                            } else if (type == 3) {
//                                //宣教
//                                ServiceOutPath serviceOutPath = new ServiceOutPath();
//                                serviceOutPath.setParam1(taskId);
//                                serviceOutPath.setParam2(patid);
////                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
//                                serviceOutPath.setParam3(ivrTask1.getTaskName());
//                                serviceOutPath.setCreateTime(new Date());
//                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//                                String format = String.format("%03X", serviceOutPath.getId());
//                                serviceOutPath.setRadix(format);
//                                serviceOutPath.setUpdateTime(new Date());
//                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                url = ip + ":" + req_path + "/xj?p=" + format;
//                            }
//
//                            String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "无");
//                            Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class);
//                            if (!map.isEmpty()) {
                            serviceSubtask.setResult("success");
                            serviceSubtask.setSendstate(3L);
                            if (aBoolean == false) {
@@ -526,7 +410,6 @@
                                serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord);
                                continue;
                            }
//                            }
                        } catch (Exception e) {
                            ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
                            serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
@@ -581,7 +464,6 @@
                    serviceSubtask.setRemark("发送失败");
                    serviceSubtask.setSendstate(5L);
                    serviceSubtask.setId(id);
//                    serviceSubtask.setFinishtime(new Date());
                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                }
            }
@@ -589,41 +471,6 @@
    }
    //    /**
//     * æœºå™¨äººç¬¬ä¸€å¥è¯è¯­éŸ³
//     * concurrency = "50"  å¹¶å‘数为50
//     */
//    @RabbitListener(queues = "ob_queue", concurrency = "50")
//    public void obVisit(String content, Message message, Channel channel) throws IOException {
//        try {
//            IvrTaskcallPhoneMQ commonTaskcallMQ = null;
//            ObjectMapper mapper = new ObjectMapper();
//            commonTaskcallMQ = mapper.readValue(content, IvrTaskcallPhoneMQ.class);
//            //判断患者是否已经接电话
//            String str = redisCache.getCacheObject(commonTaskcallMQ.getUuid() + "state_id");
//            System.out.println("-----------------" + str);
//            if (StringUtils.isNotEmpty(str) && str.equals("0")) {
//                //患者已经接听了电话
//                new PhoneUtils().ttsPlayback(commonTaskcallMQ.getScript(), commonTaskcallMQ.getUuid());
//            } else if (StringUtils.isNotEmpty(str) && str.equals("-10")) {
//                //这个说明,已经打了指定遍数还是没有人接,可以将消息从队列中移除了
//                channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
//                return;
//            } else {
//                //进行队列尾部,进行下一次校验
////                channel.basicRecover(false);
//                channel.basicReject(message.getMessageProperties().getDeliveryTag(), true);
//                System.out.println("++++++++++++++++++++++" + str);
//                return;
//            }
//            //通知 MQ æ¶ˆæ¯å·²è¢«æŽ¥æ”¶,可以ACK(从队列中删除)了   ï¼ˆè¿™ä¸ªéœ€è¦æ ¹æ®ä¸šåŠ¡å†åŽ»å¤„ç†ACK)
//            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
//        } catch (Exception e) {
//            log.error("============消费失败,尝试消息补发再次消费!==============");
//            log.error(e.getMessage());
//            channel.basicReject(message.getMessageProperties().getDeliveryTag(), true);
//        }
//    }
    private String getKey() {
        Map<String, String> map = new HashMap<>();
        for (int i = 0; i < 6; i++) {
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatServiceContractController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,113 @@
package com.ruoyi.web.controller.smartor;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.smartor.domain.PatServiceContract;
import com.smartor.service.IPatServiceContractService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
 * ã€æ‚£è€…服务签约】Controller
 *
 * @author lihu
 * @date 2025-12-08
 */
@Api("患者服务签约")
@RestController
@RequestMapping("/smartor/contract")
public class PatServiceContractController extends BaseController
{
    @Autowired
    private IPatServiceContractService patServiceContractService;
    /**
     * æŸ¥è¯¢ã€æ‚£è€…服务签约】列表
     */
    @ApiOperation("查询【患者服务签约】列表")
    //@PreAuthorize("@ss.hasPermi('smartor:contract:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody PatServiceContract patServiceContract)
    {
        startPage();
        List<PatServiceContract> list = patServiceContractService.selectPatServiceContractList(patServiceContract);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºã€æ‚£è€…服务签约】列表
     */
    @ApiOperation("导出【患者服务签约】列表")
    //@PreAuthorize("@ss.hasPermi('smartor:contract:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PatServiceContract patServiceContract)
    {
        List<PatServiceContract> list = patServiceContractService.selectPatServiceContractList(patServiceContract);
        ExcelUtil<PatServiceContract> util = new ExcelUtil<PatServiceContract>(PatServiceContract.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }
    /**
     * èŽ·å–ã€æ‚£è€…æœåŠ¡ç­¾çº¦ã€‘è¯¦ç»†ä¿¡æ¯
     */
    @ApiOperation("获取【患者服务签约】详细信息")
    //@PreAuthorize("@ss.hasPermi('smartor:contract:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(patServiceContractService.selectPatServiceContractById(id));
    }
    /**
     * æ–°å¢žã€æ‚£è€…服务签约】
     */
    @ApiOperation("新增【患者服务签约】")
    //@PreAuthorize("@ss.hasPermi('smartor:contract:add')")
    @Log(title = "【患者服务签约】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PatServiceContract patServiceContract)
    {
        return toAjax(patServiceContractService.insertPatServiceContract(patServiceContract));
    }
    /**
     * ä¿®æ”¹ã€æ‚£è€…服务签约】
     */
    @ApiOperation("修改【患者服务签约】")
    //@PreAuthorize("@ss.hasPermi('smartor:contract:edit')")
    @Log(title = "【患者服务签约】", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody PatServiceContract patServiceContract)
    {
        return toAjax(patServiceContractService.updatePatServiceContract(patServiceContract));
    }
    /**
     * åˆ é™¤ã€æ‚£è€…服务签约】
     */
    @ApiOperation("删除【患者服务签约】")
    //@PreAuthorize("@ss.hasPermi('smartor:contract:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(patServiceContractService.deletePatServiceContractByIds(ids));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -13,8 +13,8 @@
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.*;
import com.smartor.service.IServiceSubtaskRecordService;
import com.smartor.service.IServiceSubtaskService;
import com.smartor.service.*;
import com.smartor.service.impl.IvrTaskTemplateServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -23,6 +23,7 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -78,7 +79,6 @@
        return getDataTable2(total, list);
//        return getDataTable(serviceSubtaskService.patItem(ivrTaskcall));
    }
    /**
     * æŸ¥è¯¢æ‚£è€…随访信息
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
@@ -50,10 +50,10 @@
    @Test
    public void bb() {
        RSAPublicKeyExample rsaPublicKeyExample=new RSAPublicKeyExample();
//        String s1 = rsaPublicKeyExample.encryptedData("123456", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==");
        String s1 = rsaPublicKeyExample.encryptedData("123456", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==");
        String s = rsaPublicKeyExample.decryptedData("J7V6yb5WHW63bQMbMyzxeT07HGesIXJwy9w77zBa6KG4PnWe7uaZh00vX21w%2Bn5FW8%2BjUAAU1HatqRWzFp7fvA%3D%3D", "MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==");
    System.out.println(s);
//        String s = rsaPublicKeyExample.decryptedData("J7V6yb5WHW63bQMbMyzxeT07HGesIXJwy9w77zBa6KG4PnWe7uaZh00vX21w%2Bn5FW8%2BjUAAU1HatqRWzFp7fvA%3D%3D", "MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==");
    System.out.println(s1);
    }
    public void aa(MultipartFile file) throws IOException {
ruoyi-admin/src/main/resources/application-druid.yml
@@ -6,28 +6,21 @@
    druid:
      # ä¸»åº“数据源
      master:
        #        å…¬å¸
        #        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:postgresql://192.168.2.202:15400/smartorwx2
        #        username: csbsbxt
        #        password: csbsbxt@123
        #        driver-class-name: org.postgresql.Driver
        #      æœ¬åœ°é«˜æ–¯
        #        url: jdbc:postgresql://127.0.0.1:5432/postgres
        #        username: gaussdb
        #        password: Ls@123456
        #        driver-class-name: org.postgresql.Driver
        #      é«˜æ–¯æ•°æ®åº“链接
        url: jdbc:postgresql://127.0.0.1:15400/smartorwx?prepareThreshold=0
        username: shuifang
        password: Shuifang@51868
#        url: jdbc:postgresql://192.168.100.132:5432/postgres
#        username: gaussdb
#        password: Ls@123456
#        driver-class-name: org.postgresql.Driver
        #      å…¬å¸æœåŠ¡å™¨é«˜æ–¯
        url: jdbc:postgresql://haiershi.a1.luyouxia.net:26155/postgres
        username: gaussdb
        password: Gauss@123
        driver-class-name: org.postgresql.Driver
        #      é«˜æ–¯æ•°æ®åº“链接
      #        url: jdbc:postgresql://172.20.32.115:15400/smartorwx?prepareThreshold=0
      #        username: shuifang
      #        password: Shuifang@51868
      #        driver-class-name: org.postgresql.Driver
      #        å…¬å¸äº‘
      #        url: jdbc:mysql://116.62.18.175:6002/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
@@ -79,20 +72,19 @@
          # æ…¢SQL记录
          log-slow-sql: true
          slow-sql-millis: 1000
          merge-sql: false
          merge-sql: true
        wall:
          config:
            multi-statement-allow: true
  # redis é…ç½®
  redis:
    #    # åœ°å€ï¼ˆæ— é”¡äººæ°‘医院)
    host: 127.0.0.1
    port: 6020
    #    host: 127.0.0.1
    #    port: 6020
    # åœ°å€ï¼ˆå…¬å¸ï¼‰
    #    host: 116.62.18.175
    #    host: 192.168.1.10
    #    port: 6020
    host: 127.0.0.1
    port: 6020
    # æ•°æ®åº“索引
    database: 0
    # å¯†ç 
@@ -125,7 +117,7 @@
    prefix: /api
    readonly: false
  sql-column-case: camel
  show-sql: false #配置打印SQL
  show-sql: true #配置打印SQL
  page-config:
    size: size
    page: page
@@ -182,8 +174,8 @@
qrpath: D:\qrcode
#无锡内外链请求IP和端口号
req_path: 8092/wxsf
localIP: http://www.wxchildren.com
req_path: 8093
localIP: 127.0.0.1
#req_path: 8092
#localIP: http://61.160.111.174
ruoyi-admin/src/main/resources/application.yml
@@ -75,7 +75,7 @@
    # å›½é™…化资源文件路径
    basename: i18n/messages
  profiles:
    active: local
    active: druid
  # æ–‡ä»¶ä¸Šä¼ 
  servlet:
    multipart:
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -1,8 +1,6 @@
package com.ruoyi.quartz.task;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.reflect.TypeToken;
@@ -11,14 +9,12 @@
import com.google.gson.JsonObject;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.HttpUtil;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.quartz.util.RandomStringGenerator;
import com.smartor.common.SendService;
import com.smartor.common.RandomStringGenerator;
import com.smartor.domain.*;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.mapper.ServiceTaskMapper;
@@ -26,7 +22,6 @@
import com.smartor.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -36,7 +31,6 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@@ -44,9 +38,7 @@
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -387,8 +379,7 @@
                    }
                } else if (descByCode.equals("短信")) {
                    RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                    String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                    for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
                        log.error("短信长期任务发送---------进来了吗?{}", serviceSubtask);
                        boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
@@ -401,33 +392,19 @@
                                    serviceSubtask.setResult("error");
                                    serviceSubtask.setRemark(patArchive.getNotrequiredreason());
                                    serviceSubtask.setSendstate(4L);
//                                    serviceSubtask.setFinishtime(new Date());
                                    iServiceSubtaskService.insertServiceSubtask(serviceSubtask);
                                    continue;
                                }
                                String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
                                SendMagParam sendMagParam = new SendMagParam();
                                sendMagParam.setType("4");
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                //十六进制,再加小时数
                                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
                                sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
                                sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + serviceSubtask.getOutPath() + "   å¡«å†™ã€‚感谢您配合!");
                                //send_mac:签名值,=md5(send_source+send_to_mobiles+send_text+签名编码),32位小写
                                String mac = "shuifang" + sendMagParam.getPhone() + sendMagParam.getContent() + "ShuiFang_jjty_20250106";
                                String mac = "shuifang" + serviceSubtask.getPhone() + sendMagParam.getContent() + "ShuiFang_jjty_20250106";
                                StringBuilder strb = new StringBuilder();
                                strb.append("send_source=shuifang&send_to_mobiles=" + sendMagParam.getPhone());
                                strb.append("send_source=shuifang&send_to_mobiles=" + serviceSubtask.getPhone());
                                strb.append("&send_text=" + sendMagParam.getContent());
                                strb.append("&send_mac=" + Md5Utils.hash(mac));
                                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmsszzz"); // è¾“出日期格式
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.*;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
@@ -100,7 +101,7 @@
    /**
     * é€šè¿‡ç”¨æˆ·åæŸ¥è¯¢ç”¨æˆ·
     *
     * @param userName ç”¨æˆ·å
     * @param phone ç”¨æˆ·å
     * @return ç”¨æˆ·å¯¹è±¡ä¿¡æ¯
     */
    @Override
@@ -133,6 +134,39 @@
            sysUserDept.setDeptType("2");
            sysUserDeptBQs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept);
        }
        if (StringUtils.isNotEmpty(userName) && userName.equals("admin")) {
            //如果是admin,只能去sys_dept去取数据
            SysDept dept = new SysDept();
            dept.setDeptType("1");
            sysDepts = sysDeptMapper.selectDeptList(dept);
            sysUserDeptKSs = DtoConversionUtils.sourceToTarget(sysDepts, SysUserDept.class);
            dept.setDeptType("2");
            sysDepts = sysDeptMapper.selectDeptList(dept);
            sysUserDeptBQs = DtoConversionUtils.sourceToTarget(sysDepts, SysUserDept.class);
            List<SysUserDept> distinctUserDepts = new ArrayList<>();
            Set<String> uniqueDeptCodes = new HashSet<>();
            for (SysUserDept userDept : sysUserDeptKSs) {
                String deptCode = userDept.getDeptCode();
                if (StringUtils.isNotEmpty(deptCode) && !uniqueDeptCodes.contains(deptCode)) {
                    distinctUserDepts.add(userDept);
                    uniqueDeptCodes.add(deptCode);
                }
            }
            List<SysUserDept> distinctUserBQs = new ArrayList<>();
            Set<String> uniqueBQCodes = new HashSet<>();
            for (SysUserDept userDept : sysUserDeptBQs) {
                String deptCode = userDept.getDeptCode();
                if (StringUtils.isNotEmpty(deptCode) && !uniqueBQCodes.contains(deptCode)) {
                    distinctUserBQs.add(userDept);
                    uniqueBQCodes.add(deptCode);
                }
            }
            sysUserDeptKSs = distinctUserDepts;
            sysUserDeptBQs = distinctUserBQs;
        }
        sysUser.setDepts(deptIds);
        if (!CollectionUtils.isEmpty(sysUserDeptBQs)) {
smartor/src/main/java/com/smartor/common/RandomStringGenerator.java
ÎļþÃû´Ó ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/RandomStringGenerator.java ÐÞ¸Ä
@@ -1,4 +1,4 @@
package com.ruoyi.quartz.util;
package com.smartor.common;
import java.util.Random;
smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java
@@ -44,6 +44,9 @@
//    @ApiModelProperty(value = "指标名")
//    private String targetname;
    @ApiModelProperty(value = "分值类型:1:数字,2:等级")
    private String scoreType;
    /**
     * æ¨¡æ¿å
     */
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java
@@ -29,6 +29,9 @@
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "分值类型:1:数字,2:等级")
    private String scoreType;
    /**
     * æ¨¡æ¿ID
     */
smartor/src/main/java/com/smartor/domain/IvrTaskTemplate.java
@@ -396,5 +396,6 @@
    @ApiModelProperty(value = "出院天数(长期任务,出安院后,第几天发送信息)")
    private Integer sendDay;
    @ApiModelProperty(value = "分值类型:1:数字,2:等级")
    private String scoreType;
}
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateVO.java
@@ -28,6 +28,9 @@
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "分值类型:1:数字,2:等级")
    private String scoreType;
    /**
     * ä»»åŠ¡id
     */
smartor/src/main/java/com/smartor/domain/PatArchive.java
@@ -383,6 +383,10 @@
    @ApiModelProperty("主要照护人年龄")
    @Excel(name = "主要照护人年龄")
    private String casePersonAge;
    @ApiModelProperty("病人摘要")
    @Excel(name = "病人摘要")
    private String patientOverview;
    /**
     * pageNum
     */
smartor/src/main/java/com/smartor/domain/PatArchiveOthreInfo.java
@@ -27,6 +27,9 @@
    @ApiModelProperty("自增ID")
    private Long id;
    @ApiModelProperty("病人摘要")
    @Excel(name = "病人摘要")
    private String patientOverview;
    /**
     * æœåŠ¡æ ‡è¯†ï¼š1,需要,0,不需要
smartor/src/main/java/com/smartor/domain/PatArchiveOut.java
@@ -29,6 +29,10 @@
    @ApiModelProperty("问题话术id(主键)")
    private Long patid;
    @ApiModelProperty("病人摘要")
    @Excel(name = "病人摘要")
    private String patientOverview;
    /**
     * æ‚£è€…编号
     */
smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
@@ -28,6 +28,10 @@
    @Excel(name = " æ‚£è€…id ")
    private String patid;
    @ApiModelProperty("病人摘要")
    @Excel(name = "病人摘要")
    private String patientOverview;
    /**
     * å§“名
     */
smartor/src/main/java/com/smartor/domain/PatArchiveVO.java
@@ -29,6 +29,10 @@
    @ApiModelProperty("自增ID")
    private Long id;
    @ApiModelProperty("病人摘要")
    @Excel(name = "病人摘要")
    private String patientOverview;
    /**
     * å§“名
     */
smartor/src/main/java/com/smartor/domain/PatServiceContract.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,143 @@
package com.smartor.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘å¯¹è±¡ pat_service_contract
 *
 * @author lihu
 * @date 2025-12-08
 */
@Data
@ApiModel("【请填写功能名称】")
public class PatServiceContract extends BaseEntity
        {
private static final long serialVersionUID = 1L;
    /** $column.columnComment */
    @ApiModelProperty("$column.columnComment")
    private Long id;
    /** åˆåŒç¼–号(规则:HSP-YYYYMMDD-序号) */
    @ApiModelProperty("合同编号(规则:HSP-YYYYMMDD-序号)")
            @Excel(name = "合同编号", readConverterExp = "规=则:HSP-YYYYMMDD-序号")
    private String contractNo;
    /** $column.columnComment */
    @ApiModelProperty("$column.columnComment")
            @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Long patId;
    /** åˆåŒåˆ†ç±» */
    @ApiModelProperty("合同分类")
            @Excel(name = "合同分类")
    private String contractType;
    /** é”€å”®æ¸ é“(线下、官网、APP、医生推荐) */
    @ApiModelProperty("销售渠道(线下、官网、APP、医生推荐)")
            @Excel(name = "销售渠道", readConverterExp = "线=下、官网、APP、医生推荐")
    private String salesChannel;
    /** ç­¾çº¦é‡‘额 */
    @ApiModelProperty("签约金额")
            @Excel(name = "签约金额")
    private String contractAmount;
    /** æ”¯ä»˜çŠ¶æ€ï¼ˆ1:未支付, 2:部分支付, 3:已支付, 4:退款中, 5:已退款) */
    @ApiModelProperty("支付状态(1:未支付, 2:部分支付, 3:已支付, 4:退款中, 5:已退款)")
            @Excel(name = "支付状态", readConverterExp = "1=:未支付,,2=:部分支付,,3=:已支付,,4=:退款中,,5=:已退款")
    private String paymentStatus;
    /** åˆåŒçŠ¶æ€ï¼ˆ1:待生效, 2:生效中, 3:已暂停, 4:已到期, 5:提前终止) */
    @ApiModelProperty("合同状态(1:待生效, 2:生效中, 3:已暂停, 4:已到期, 5:提前终止)")
            @Excel(name = "合同状态", readConverterExp = "1=:待生效,,2=:生效中,,3=:已暂停,,4=:已到期,,5=:提前终止")
    private String contractStatus;
    /** æœåŠ¡å¼€å§‹æ—¥æœŸ */
    @ApiModelProperty("服务开始日期")
            @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
            @Excel(name = "服务开始日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date startDate;
    /** æœåŠ¡ç»“æŸæ—¥æœŸ */
    @ApiModelProperty("服务结束日期")
            @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
            @Excel(name = "服务结束日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date endDate;
    /** å®žé™…终止日期 */
    @ApiModelProperty("实际终止日期")
            @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
            @Excel(name = "实际终止日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date actualEndDate;
    /** çˆ¶ID */
    @ApiModelProperty("父ID")
            @Excel(name = "父ID")
    private Long pid;
    /** guid */
    @ApiModelProperty("guid")
            @Excel(name = "guid")
    private String guid;
    /** åˆ é™¤æ ‡å¿—(0:未删除 1:已删除) */
    @ApiModelProperty("删除标志(0:未删除 1:已删除)")
    private Long delFlag;
    /** åŒ»é™¢æœºæž„id */
    @ApiModelProperty("医院机构id")
            @Excel(name = "医院机构id")
    private String orgid;
    /** æ˜¯å¦è‡ªåŠ¨ç»­çº¦ */
    @ApiModelProperty("是否自动续约")
            @Excel(name = "是否自动续约")
    private String autoRenew;
    /** ç»­çº¦æé†’提前天数 */
    @ApiModelProperty("续约提醒提前天数")
            @Excel(name = "续约提醒提前天数")
    private Long renewalReminderDays;
    /** ç‰¹æ®Šæ¡æ¬¾å¤‡æ³¨ */
    @ApiModelProperty("特殊条款备注")
            @Excel(name = "特殊条款备注")
    private String specialTerms;
    /** ç­¾çº¦æ—¶é—´ */
    @ApiModelProperty("签约时间")
            @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
            @Excel(name = "签约时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date signedAt;
    /** æ‚£è€…是否已电子签约 */
    @ApiModelProperty("患者是否已电子签约")
            @Excel(name = "患者是否已电子签约")
    private String signedByPatient;
    /** åŒ»é™¢æ˜¯å¦å·²ç¡®è®¤ */
    @ApiModelProperty("医院是否已确认")
            @Excel(name = "医院是否已确认")
    private String signedByHospital;
    /** æå‰ç»ˆæ­¢åŽŸå›  */
    @ApiModelProperty("提前终止原因")
            @Excel(name = "提前终止原因")
    private String cancellationReason;
    /** ç»ˆæ­¢æ—¶é—´ */
    @ApiModelProperty("终止时间")
            @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
            @Excel(name = "终止时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date cancelledAt;
        }
smartor/src/main/java/com/smartor/domain/ServiceOutPath.java
@@ -61,6 +61,9 @@
    @ApiModelProperty(value = "进制")
    private String radix;
    @ApiModelProperty(value = "  ivr   è¿˜æ˜¯   svy的问卷随访,   1:ivr     2:svy     3:宣教")
    private Integer type;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -520,6 +520,13 @@
    private String tagname;
    /**
     * å¤–链地址
     */
    @ApiModelProperty(value = "外链地址")
    @Excel(name = " å¤–链地址 ")
    private String outPath;
    /**
     * å‡ºé™¢ç—…区编号
     */
    @ApiModelProperty(value = "出院病区编号集合")
smartor/src/main/java/com/smartor/domain/ServiceSubtaskRecord.java
@@ -138,5 +138,12 @@
    @ApiModelProperty(value = "备注")
    private String remark;
    /**
     * å¤–链地址
     */
    @ApiModelProperty(value = "外链地址")
    @Excel(name = " å¤–链地址 ")
    private String outPath;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
@@ -92,4 +92,11 @@
    @ApiModelProperty(value = "回复异常数")
    private Long hfycs = 0L;
    /**
     * å¤–链地址
     */
    @ApiModelProperty(value = "外链地址")
    @Excel(name = " å¤–链地址 ")
    private String outPath;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
@@ -25,7 +25,15 @@
     *
     */
    @ApiModelProperty(value = "主键id")
    private Long subId;
    private Long subid;
    /**
     * å¤–链地址
     */
    @ApiModelProperty(value = "外链地址")
    @Excel(name = " å¤–链地址 ")
    private String outPath;
    /**
@@ -271,6 +279,14 @@
    @Excel(name = " å‘送状态 ")
    @ApiModelProperty(value = "发送状态 : 1新建 2执行中 3暂停 4终止 5完成")
    private Long sendstate;
    /**
     * è¯¦æƒ…结果(测试用,后面删除)
     */
    @Excel(name = " è¯¦æƒ…结果(测试用,后面删除) ")
    @ApiModelProperty(value = "详情结果(测试用,后面删除)")
    private String detailResult;
    /**
@@ -545,6 +561,20 @@
    @ApiModelProperty(value = "总分")
    private Long score;
    /**
     * å¼€å§‹åˆ†
     */
    @Excel(name = "开始分")
    @ApiModelProperty(value = "开始分")
    private Long scoreStart;
    /**
     * ç»“束分
     */
    @Excel(name = "结束分")
    @ApiModelProperty(value = "结束分")
    private Long scoreEnd;
    /**
     * æ˜¯å¦æäº¤
smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
@@ -240,4 +240,7 @@
    @ApiModelProperty(value = "部门编码")
    private String deptCode;
    @ApiModelProperty(value = "分值类型:1:数字,2:等级")
    private String scoreType;
}
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateVO.java
@@ -32,6 +32,9 @@
    @ApiModelProperty(value = "是否是长期模板:  0:不是    1:是")
    private Integer longTemp;
    @ApiModelProperty(value = "分值类型:1:数字,2:等级")
    private String scoreType;
    /**
     * æ¨¡æ¿é—®å·ID
     */
smartor/src/main/java/com/smartor/mapper/PatServiceContractMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.smartor.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.smartor.domain.PatServiceContract;
/**
 * ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘Mapper接口
 *
 * @author lihu
 * @date 2025-12-08
 */
@Mapper
public interface PatServiceContractMapper
{
    /**
     * æŸ¥è¯¢ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param id ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¸»é”®
     * @return ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     */
    public PatServiceContract selectPatServiceContractById(Long id);
    /**
     * æŸ¥è¯¢ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘åˆ—è¡¨
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘é›†åˆ
     */
    public List<PatServiceContract> selectPatServiceContractList(PatServiceContract patServiceContract);
    /**
     * æ–°å¢žã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ç»“æžœ
     */
    public int insertPatServiceContract(PatServiceContract patServiceContract);
    /**
     * ä¿®æ”¹ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ç»“æžœ
     */
    public int updatePatServiceContract(PatServiceContract patServiceContract);
    /**
     * åˆ é™¤ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param id ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¸»é”®
     * @return ç»“æžœ
     */
    public int deletePatServiceContractById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
    public int deletePatServiceContractByIds(Long[] ids);
}
smartor/src/main/java/com/smartor/service/IPatServiceContractService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
package com.smartor.service;
import java.util.List;
import com.smartor.domain.PatServiceContract;
/**
 * ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘Service接口
 *
 * @author lihu
 * @date 2025-12-08
 */
public interface IPatServiceContractService
{
    /**
     * æŸ¥è¯¢ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param id ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¸»é”®
     * @return ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     */
    public PatServiceContract selectPatServiceContractById(Long id);
    /**
     * æŸ¥è¯¢ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘åˆ—è¡¨
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘é›†åˆ
     */
    public List<PatServiceContract> selectPatServiceContractList(PatServiceContract patServiceContract);
    /**
     * æ–°å¢žã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ç»“æžœ
     */
    public int insertPatServiceContract(PatServiceContract patServiceContract);
    /**
     * ä¿®æ”¹ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ç»“æžœ
     */
    public int updatePatServiceContract(PatServiceContract patServiceContract);
    /**
     * æ‰¹é‡åˆ é™¤ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param ids éœ€è¦åˆ é™¤çš„【请填写功能名称】主键集合
     * @return ç»“æžœ
     */
    public int deletePatServiceContractByIds(Long[] ids);
    /**
     * åˆ é™¤ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¿¡æ¯
     *
     * @param id ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¸»é”®
     * @return ç»“æžœ
     */
    public int deletePatServiceContractById(Long id);
}
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetAssortServiceImpl.java
@@ -99,7 +99,7 @@
            ivrLibaTargetAssort.setSeqno(seqMax + 1);
        }
        //-1代表主树
        if (ivrLibaTargetAssort.getPid() == null) ivrLibaTargetAssort.setPid((long) -1);
//        if (ivrLibaTargetAssort.getPid() == null) ivrLibaTargetAssort.setPid((long) -1);
        i = ivrLibaTargetAssortMapper.insertIvrLibaTargetAssort(ivrLibaTargetAssort);
        log.info("指标分类一级树的主键:{}", ivrLibaTargetAssort.getId());
@@ -114,6 +114,7 @@
                    seqMax1 = 0;
                }
                ivrLibaTargetAssort1.setPid(ivrLibaTargetAssort.getId());
                if (ivrLibaTargetAssort.getId() == null) ivrLibaTargetAssort1.setPid((long) -1);
                ivrLibaTargetAssort1.setSeqno(1);
                if (seqMax != null) {
                    ivrLibaTargetAssort1.setSeqno(seqMax1 + 1);
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -8,12 +8,11 @@
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.*;
import com.smartor.common.RandomStringGenerator;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.IServiceOutPathService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -49,11 +48,21 @@
    @Autowired
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private SysUserDeptMapper sysUserDeptMapper;
    private IServiceOutPathService iServiceOutPathService;
    @Value("${createTaskServiceType}")
    private List<String> createTaskServiceType;
    @Value("${localIP}")
    private String localIP;
    @Value("${req_path}")
    private String req_path;
    @Value("${pub_key}")
    private String pub_key;
    //记录长期任务基础信息
    List<IvrLibaTemplate> libaTemplates = new ArrayList<>();
@@ -352,7 +361,6 @@
                        serviceSubtask1.setSendstate(4L);
                        serviceSubtask1.setRemark("患者再入院");
                        serviceSubtask1.setResult("error");
//                        serviceSubtask1.setFinishtime(new Date());
                        Boolean aBoolean = serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
                        if (aBoolean) i = 1;
                    } else {
@@ -364,6 +372,16 @@
                    }
                }
            }
            //生成外链地址
            String outPath = null;
            if (serviceTask.getType().equals("1"))
                outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 1);
            else if (serviceTask.getType().equals("2"))
                outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 2);
            else if (serviceTask.getType().equals("3"))
                outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 3);
            serviceSubtask.setOutPath(outPath);
            i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
            if (i == 1) {
                //将check_flag改成1(已处理)
@@ -479,4 +497,76 @@
        return calendar.getTime();
    }
    private String getOutPath(String phone, Long tid, String taskName, Long pId, Integer type) {
        //对url中两个参数加密
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String taskId = rsaPublicKeyExample.encryptedData(tid.toString(), pub_key);
        String outpath = null;
        try {
            String patid = rsaPublicKeyExample.encryptedData(pId.toString(), pub_key);
            SendMagParam sendMagParam = new SendMagParam();
            sendMagParam.setType("4");
            if (type == 1) {
                //随访
                ServiceOutPath serviceOutPath = new ServiceOutPath();
                serviceOutPath.setParam1(taskId);
                serviceOutPath.setParam2(patid);
                serviceOutPath.setCreateTime(new Date());
                serviceOutPath.setType(1);
                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                //转成16进制
                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                serviceOutPath.setRadix(format);
                outpath = localIP + ":" + req_path + "/sf?p=" + format;
                serviceOutPath.setUpdateTime(new Date());
                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                sendMagParam.setPhone(phone);
                sendMagParam.setUrl(outpath);
                sendMagParam.setContent("您好,邀请您填写出院随访调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
            } else if (type == 2) {
                //问券(问题)
                ServiceOutPath serviceOutPath = new ServiceOutPath();
                serviceOutPath.setParam1(taskId);
                serviceOutPath.setParam2(patid);
                serviceOutPath.setParam3(taskName);
                serviceOutPath.setCreateTime(new Date());
                serviceOutPath.setType(2);
                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                serviceOutPath.setRadix(format);
                serviceOutPath.setUpdateTime(new Date());
                outpath = localIP + ":" + req_path + "/wt?p=" + format;
                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                sendMagParam.setPhone(phone);
                sendMagParam.setUrl(outpath);
                sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
                log.info("您好,邀请您填写出院调查表,请点击,{}", sendMagParam.getUrl());
            } else if (type == 3) {
                //宣教
                ServiceOutPath serviceOutPath = new ServiceOutPath();
                serviceOutPath.setParam1(taskId);
                serviceOutPath.setParam2(patid);
                serviceOutPath.setParam3(taskName);
                serviceOutPath.setCreateTime(new Date());
                serviceOutPath.setType(3);
                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                serviceOutPath.setRadix(format);
                serviceOutPath.setUpdateTime(new Date());
                outpath = localIP + ":" + req_path + "/xj?p=" + format;
                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                sendMagParam.setPhone(phone);
                sendMagParam.setUrl(outpath);
                sendMagParam.setContent("您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!");
                log.info("-----------sendMagParam的值为:{}", sendMagParam);
            }
        } catch (Exception e) {
            log.error("生成失败了:{}", e.getMessage());
        }
        return outpath;
    }
}
smartor/src/main/java/com/smartor/service/impl/PatServiceContractServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,95 @@
package com.smartor.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smartor.mapper.PatServiceContractMapper;
import com.smartor.domain.PatServiceContract;
import com.smartor.service.IPatServiceContractService;
/**
 * ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘Service业务层处理
 *
 * @author lihu
 * @date 2025-12-08
 */
@Service
public class PatServiceContractServiceImpl implements IPatServiceContractService
{
    @Autowired
    private PatServiceContractMapper patServiceContractMapper;
    /**
     * æŸ¥è¯¢ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param id ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¸»é”®
     * @return ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     */
    @Override
    public PatServiceContract selectPatServiceContractById(Long id)
    {
        return patServiceContractMapper.selectPatServiceContractById(id);
    }
    /**
     * æŸ¥è¯¢ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘åˆ—è¡¨
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     */
    @Override
    public List<PatServiceContract> selectPatServiceContractList(PatServiceContract patServiceContract)
    {
        return patServiceContractMapper.selectPatServiceContractList(patServiceContract);
    }
    /**
     * æ–°å¢žã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ç»“æžœ
     */
    @Override
    public int insertPatServiceContract(PatServiceContract patServiceContract)
    {
        return patServiceContractMapper.insertPatServiceContract(patServiceContract);
    }
    /**
     * ä¿®æ”¹ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param patServiceContract ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     * @return ç»“æžœ
     */
    @Override
    public int updatePatServiceContract(PatServiceContract patServiceContract)
    {
        patServiceContract.setUpdateTime(DateUtils.getNowDate());
        return patServiceContractMapper.updatePatServiceContract(patServiceContract);
    }
    /**
     * æ‰¹é‡åˆ é™¤ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘
     *
     * @param ids éœ€è¦åˆ é™¤çš„【请填写功能名称】主键
     * @return ç»“æžœ
     */
    @Override
    public int deletePatServiceContractByIds(Long[] ids)
    {
        return patServiceContractMapper.deletePatServiceContractByIds(ids);
    }
    /**
     * åˆ é™¤ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¿¡æ¯
     *
     * @param id ã€è¯·å¡«å†™åŠŸèƒ½åç§°ã€‘ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int deletePatServiceContractById(Long id)
    {
        return patServiceContractMapper.deletePatServiceContractById(id);
    }
}
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -9,6 +9,7 @@
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.smartor.common.FtpService;
import com.smartor.common.RandomStringGenerator;
import com.smartor.common.SendService;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.*;
@@ -58,9 +59,6 @@
    private IServiceTaskService serviceTaskService;
    @Autowired
    private IvrTaskTemplateTargetoptionMapper serviceTaskScriptTargetoptionMapper;
    @Autowired
    private IvrTaskVisitResultMapper serviceTaskVisitResultMapper;
    @Autowired
@@ -74,12 +72,18 @@
    @Autowired
    private IIvrTaskTemplateService ivrTaskTemplateService;
    @Autowired
    private IIvrTaskTemplateScriptService iIvrTaskTemplateScriptService;
    @Autowired
    private IvrTaskTemplateTargetoptionMapper serviceTaskScriptTargetoptionMapper;
    @Autowired
    private ISvyTaskTemplateService svyTaskTemplateService;
    @Autowired
    private IIvrTaskTemplateScriptService iIvrTaskTemplateScriptService;
    private ISvyLibTemplateScriptService svyLibTemplateScriptService;
    @Autowired
    private ISvyLibTemplateTargetoptionService svyLibTemplateTargetoptionService;
    @Autowired
    private IServiceOutPathService iServiceOutPathService;
@@ -98,9 +102,6 @@
    @Value("${ASRCallBackPath}")
    private String ASRCallBackPath;
    @Autowired
    private SendService sendService;
    @Value("${hangup}")
    private String hangup;
@@ -125,6 +126,7 @@
    @Value("${phoneUpEveryHour}")
    private Integer phoneUpEveryHour;
    @Value("${phoneEndHour}")
    private Integer phoneEndHour;
@@ -251,7 +253,36 @@
    @Override
    public List<ServiceSubtask> patItem(ServiceSubtaskVO serviceSubtaskVO) {
        List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO);
        return selectServiceSubtaskList;
        List<ServiceSubtask> serviceSubtaskList = new ArrayList<>();
        //获取分数
        for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
            //计算患者的分数
            if (serviceSubtask.getScore() == null || BigDecimal.ZERO.equals(serviceSubtask.getScore())) {
                //如果为空的话,去detail里拿到每个题的选项分,如果是作答题,直接拿题目分(前题,该模板是分数类型)
                Map<String, Object> map = getScore(serviceSubtask, serviceSubtaskVO.getDetailResult());
                serviceSubtask.setScore((BigDecimal) map.get("score"));
                serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                if ((Boolean) map.get("isExist") == true) {
                    //测试完删除(应付测试用的)
                    serviceSubtaskList.add(serviceSubtask);
                }
            } else {
                //测试完删除(应付测试用的)
                if (!StringUtils.isEmpty(serviceSubtaskVO.getDetailResult())) {
                    ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
                    serviceSubtaskDetail.setSubId(serviceSubtask.getId());
                    List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
                    for (ServiceSubtaskDetail ssd : serviceSubtaskDetails) {
                        if (ssd.getAsrtext().equals(serviceSubtaskVO.getDetailResult())) {
                            serviceSubtaskList.add(serviceSubtask);
                        }
                    }
                }else {
                    serviceSubtaskList.add(serviceSubtask);
                }
            }
        }
        return serviceSubtaskList;
    }
    @Override
@@ -490,6 +521,16 @@
                    }
                    if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
                        serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime());
                    //生成外链地址
                    String outPath = null;
                    if (serviceTaskVO.getType().equals("1"))
                        outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 1);
                    else if (serviceTaskVO.getType().equals("2"))
                        outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 2);
                    else if (serviceTaskVO.getType().equals("3"))
                        outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 3);
                    serviceSubtask.setOutPath(outPath);
                    serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
                    serviceSubtask.getId().intValue();
                }
@@ -604,6 +645,15 @@
                    serviceSubtask.setNurseName(patTaskRelevance.getNurseName());
                    serviceSubtask.setVisitTime(patTaskRelevance.getVisitTime());
                    serviceSubtask.setTextParam(new Gson().toJson(serviceTaskVO.getTextParam()));
                    //生成外链地址
                    String outPath = null;
                    if (serviceTaskVO.getType().equals("1"))
                        outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 1);
                    else if (serviceTaskVO.getType().equals("2"))
                        outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 2);
                    else if (serviceTaskVO.getType().equals("3"))
                        outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 3);
                    if (patTaskRelevance.getIsoperation() != null) {
                        if (patTaskRelevance.getIsoperation() == 2) serviceSubtask.setUpdateTime(new Date());
                        serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
@@ -2009,7 +2059,6 @@
    }
    private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList) {
        log.error("-------------serviceSubtaskList的值为:{}", serviceSubtaskList);
        ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
@@ -2173,4 +2222,172 @@
        int remainingCalls = (int) (remainingHours * phoneUpEveryHour);
        return remainingCalls;
    }
    private String getOutPath(String phone, Long tid, String taskName, Long pId, Integer type) {
        //对url中两个参数加密
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String taskId = rsaPublicKeyExample.encryptedData(tid.toString(), pub_key);
        String outpath = null;
        try {
            String patid = rsaPublicKeyExample.encryptedData(pId.toString(), pub_key);
            SendMagParam sendMagParam = new SendMagParam();
            sendMagParam.setType("4");
            if (type == 1) {
                //随访
                ServiceOutPath serviceOutPath = new ServiceOutPath();
                serviceOutPath.setParam1(taskId);
                serviceOutPath.setParam2(patid);
                serviceOutPath.setCreateTime(new Date());
                serviceOutPath.setType(1);
                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                //转成16进制
                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                serviceOutPath.setRadix(format);
                outpath = localIP + ":" + req_path + "/sf?p=" + format;
                serviceOutPath.setUpdateTime(new Date());
                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                sendMagParam.setPhone(phone);
                sendMagParam.setUrl(outpath);
                sendMagParam.setContent("您好,邀请您填写出院随访调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
            } else if (type == 2) {
                //问券(问题)
                ServiceOutPath serviceOutPath = new ServiceOutPath();
                serviceOutPath.setParam1(taskId);
                serviceOutPath.setParam2(patid);
                serviceOutPath.setParam3(taskName);
                serviceOutPath.setCreateTime(new Date());
                serviceOutPath.setType(2);
                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                serviceOutPath.setRadix(format);
                serviceOutPath.setUpdateTime(new Date());
                outpath = localIP + ":" + req_path + "/wt?p=" + format;
                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                sendMagParam.setPhone(phone);
                sendMagParam.setUrl(outpath);
                sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "   å¡«å†™ã€‚感谢您配合!");
                log.info("您好,邀请您填写出院调查表,请点击,{}", sendMagParam.getUrl());
            } else if (type == 3) {
                //宣教
                ServiceOutPath serviceOutPath = new ServiceOutPath();
                serviceOutPath.setParam1(taskId);
                serviceOutPath.setParam2(patid);
                serviceOutPath.setParam3(taskName);
                serviceOutPath.setCreateTime(new Date());
                serviceOutPath.setType(3);
                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString();
                serviceOutPath.setRadix(format);
                serviceOutPath.setUpdateTime(new Date());
                outpath = localIP + ":" + req_path + "/xj?p=" + format;
                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                sendMagParam.setPhone(phone);
                sendMagParam.setUrl(outpath);
                sendMagParam.setContent("您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!");
                log.info("-----------sendMagParam的值为:{}", sendMagParam);
            }
        } catch (Exception e) {
            log.error("生成失败了:{}", e.getMessage());
        }
        return outpath;
    }
    private Map<String, Object> getScore(ServiceSubtask serviceSubtask, String detailResult) {
        Map<String, Object> map = new HashMap<>();
        Boolean isExist = false;
        //统计总分
        BigDecimal bigDecimal = BigDecimal.ZERO;
        if (serviceSubtask.getScore() != null && !BigDecimal.ZERO.equals(serviceSubtask.getScore())) {
            //如果有分数,直接返回
            map.put("score", serviceSubtask.getScore());
            //isExist应付测试用的,测试完后删除
            map.put("isExist", true);
            return map;
        }
        if (serviceSubtask.getScore() == null || BigDecimal.ZERO.equals(serviceSubtask.getScore())) {
            //如果为空的话,去detail里拿到每个题的选项分,如果是作答题,直接拿题目分(前题,该模板是分数类型)
            ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
            if (serviceTask.getType().equals("1")) {
                //如果是机器人语音
                IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceTask.getTemplateid());
                //判断是不是评分
                if (StringUtils.isNotEmpty(ivrTaskTemplate.getScoreType()) && ivrTaskTemplate.getScoreType().equals("1")) {
                    ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
                    serviceSubtaskDetail.setSubId(serviceSubtask.getId());
                    List<ServiceSubtaskDetail> serviceSubtaskDetailList = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
                    for (ServiceSubtaskDetail serviceSubtaskDetail1 : serviceSubtaskDetailList) {
                        Long scriptid = serviceSubtaskDetail1.getScriptid();
                        IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(scriptid);
                        if (StringUtils.isNotEmpty(ivrTaskTemplateScript.getScriptType())) {
                            if (ivrTaskTemplateScript.getScriptType().equals("3") || ivrTaskTemplateScript.getScriptType().equals("4")) {
                                if (StringUtils.isNotEmpty(serviceSubtaskDetail1.getAsrtext())) {
                                    //不是选择题,直接拿题目分
                                    bigDecimal = bigDecimal.add(ivrTaskTemplateScript.getScore());
                                }
                            } else if (ivrTaskTemplateScript.getScriptType().equals("1") || ivrTaskTemplateScript.getScriptType().equals("2")) {
                                IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption = new IvrTaskTemplateTargetoption();
                                ivrTaskTemplateTargetoption.setScriptid(scriptid);
                                List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = serviceTaskScriptTargetoptionMapper.selectIvrTaskTemplateTargetoptionList(ivrTaskTemplateTargetoption);
                                //获取选项,用选中的值去选项里匹配,拿到选项分
                                for (IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption1 : ivrTaskTemplateTargetoptions) {
                                    if (ivrTaskTemplateTargetoption1.getTargetvalue().equals(serviceSubtaskDetail1.getMatchedtext())) {
                                        bigDecimal = bigDecimal.add(ivrTaskTemplateTargetoption1.getScore());
                                        //测试完删除
                                        if (StringUtils.isEmpty(detailResult) || ivrTaskTemplateTargetoption1.getTargetvalue().equals(detailResult)) {
                                            isExist = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (serviceTask.getType().equals("2")) {
                //如果是问卷
                SvyTaskTemplate svyTaskTemplate = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(serviceTask.getTemplateid());
                //判断是不是评分
                if (StringUtils.isNotEmpty(svyTaskTemplate.getScoreType()) && svyTaskTemplate.getScoreType().equals("1")) {
                    ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
                    serviceSubtaskDetail.setSubId(serviceSubtask.getId());
                    List<ServiceSubtaskDetail> serviceSubtaskDetailList = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
                    for (ServiceSubtaskDetail serviceSubtaskDetail1 : serviceSubtaskDetailList) {
                        Long scriptid = serviceSubtaskDetail1.getScriptid();
                        SvyLibTemplateScript svyLibTemplateScript = svyLibTemplateScriptService.selectSvyLibTemplateScriptByTopicid(scriptid);
                        if (StringUtils.isNotEmpty(svyLibTemplateScript.getScriptType())) {
                            if (svyLibTemplateScript.getScriptType().equals("3") || svyLibTemplateScript.getScriptType().equals("4")) {
                                if (StringUtils.isNotEmpty(serviceSubtaskDetail1.getAsrtext())) {
                                    //不是选择题,直接拿题目分
                                    bigDecimal = bigDecimal.add(svyLibTemplateScript.getScore());
                                }
                            } else if (svyLibTemplateScript.getScriptType().equals("1") || svyLibTemplateScript.getScriptType().equals("2")) {
                                SvyLibTemplateTargetoption svyLibTemplateTargetoption = new SvyLibTemplateTargetoption();
                                svyLibTemplateTargetoption.setScriptid(scriptid);
                                List<SvyLibTemplateTargetoption> svyLibTemplateTargetoptions = svyLibTemplateTargetoptionService.selectSvyLibTemplateTargetoptionList(svyLibTemplateTargetoption);
                                //获取选项,用选中的值去选项里匹配,拿到选项分
                                for (SvyLibTemplateTargetoption svyLibTemplateTargetoption1 : svyLibTemplateTargetoptions) {
                                    if (svyLibTemplateTargetoption1.getOptioncontent().equals(serviceSubtaskDetail1.getAsrtext())) {
                                        bigDecimal = bigDecimal.add(svyLibTemplateTargetoption1.getScore());
                                        //测试完删除
                                        if (StringUtils.isEmpty(detailResult) || svyLibTemplateTargetoption1.getOptioncontent().equals(detailResult)) {
                                            isExist = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        map.put("score", bigDecimal);
        map.put("isExist", isExist);
        return map;
    }
}
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml
@@ -44,12 +44,14 @@
        <result property="sendDay" column="send_day"/>
        <result property="longTemp" column="long_temp"/>
        <result property="deptCode" column="dept_code"/>
        <result property="scoreType" column="score_type"/>
    </resultMap>
    <sql id="selectIvrLibaTemplateVo">
        select id,
               revisit_before,
               revisit_after,
               score_type,
               send_day,
               dept_code,
               long_temp,
@@ -74,6 +76,7 @@
        a.revisit_before,
        a.revisit_after,
        a.send_day,
        a.score_type,
        a.dept_code,
        a.long_temp,
        a.templateName,
@@ -104,6 +107,7 @@
                '%')
            </if>
            <if test="id != null ">and a.id = #{id}</if>
            <if test="scoreType != null ">and a.score_type = #{scoreType}</if>
            <if test="tag != null ">and b.tag_name = #{tag}</if>
            <if test="sendDay != null ">and a.send_day = #{sendDay}</if>
            <if test="longTemp != null ">and a.long_temp = #{longTemp}</if>
@@ -153,6 +157,7 @@
        a.isenable,
        a.campus,
        a.suitway,
        a.score_type,
        a.mate_num,
        a.no_voice_num,
        a.submodule, a.language, a.note,
@@ -209,6 +214,7 @@
            <if test="sendDay != null ">send_day,</if>
            <if test="longTemp != null ">long_temp,</if>
            <if test="deptCode != null">dept_code,</if>
            <if test="scoreType != null">score_type,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="templateName != null and templateName != ''">#{templateName},</if>
@@ -249,6 +255,7 @@
            <if test="sendDay != null ">#{sendDay},</if>
            <if test="longTemp != null ">#{longTemp},</if>
            <if test="deptCode != null">#{deptCode},</if>
            <if test="scoreType != null">#{scoreType},</if>
        </trim>
    </insert>
@@ -294,6 +301,7 @@
            <if test="sendDay != null ">send_day = #{sendDay},</if>
            <if test="longTemp != null ">long_temp = #{longTemp},</if>
            <if test="deptCode != null">dept_code = #{deptCode},</if>
            <if test="scoreType != null">score_type = #{scoreType},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateMapper.xml
@@ -63,12 +63,14 @@
        <result property="sendDay" column="send_day"/>
        <result property="deptCode" column="dept_code"/>
        <result property="longTemp" column="long_temp"/>
        <result property="scoreType" column="score_type"/>
    </resultMap>
    <sql id="selectIvrTaskTemplateVo">
        select id,
               taskid,
               score_type,
               long_temp,
               send_day,
               recallcount,
@@ -150,6 +152,7 @@
            <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>
            <if test="scoreType != null ">and score_type = #{scoreType}</if>
        </where>
    </select>
@@ -219,6 +222,7 @@
            <if test="sendDay != null ">send_day,</if>
            <if test="deptCode != null">dept_code,</if>
            <if test="longTemp != null">long_temp,</if>
            <if test="scoreType != null ">score_type,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -278,6 +282,8 @@
            <if test="sendDay != null ">#{sendDay},</if>
            <if test="deptCode != null">#{deptCode},</if>
            <if test="longTemp != null">#{longTemp},</if>
            <if test="scoreType != null ">#{scoreType},</if>
        </trim>
    </insert>
@@ -341,6 +347,8 @@
            <if test="sendDay != null ">send_day = #{sendDay},</if>
            <if test="deptCode != null">dept_code = #{deptCode},</if>
            <if test="longTemp != null">long_temp = #{longTemp},</if>
            <if test="scoreType != null ">score_type = #{scoreType},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -60,6 +60,7 @@
        <result property="carePerson" column="care_person"/>
        <result property="casePersonAge" column="case_person_age"/>
        <result property="reservedPhone" column="reserved_phone"/>
        <result property="patientOverview" column="patient_overview"/>
    </resultMap>
@@ -119,12 +120,14 @@
        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
        <result property="admitdate" column="admitdate"/>
        <result property="reservedPhone" column="reserved_phone"/>
        <result property="patientOverview" column="patient_overview"/>
    </resultMap>
    <sql id="selectPatArchiveVo">
        select id,
               notrequired_flag,
               notrequiredreason,
               patientOverview,
               patientno,
               patid_his,
               age_unit,
@@ -177,6 +180,7 @@
            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
            <if test="sourcefrom != null ">and sourcefrom = #{sourcefrom}</if>
            <if test="patientOverview != null ">and patient_overview = #{patientOverview}</if>
            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="id != null  and id != ''">and id = #{id}</if>
@@ -210,6 +214,7 @@
        select
        a.id,
        a.age_unit,
        a.patient_overview,
        a.notrequired_flag,
        a.notrequiredreason,
        a.patientno,
@@ -309,6 +314,7 @@
            <if test="carePerson != null ">care_person,</if>
            <if test="casePersonAge != null ">case_person_age,</if>
            <if test="reservedPhone != null ">reserved_phone,</if>
            <if test="patientOverview != null ">patient_overview,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="patientno != null">#{patientno},</if>
@@ -357,6 +363,7 @@
            <if test="carePerson != null ">#{carePerson},</if>
            <if test="casePersonAge != null ">#{casePersonAge},</if>
            <if test="reservedPhone != null ">#{reservedPhone},</if>
            <if test="patientOverview != null ">#{patientOverview},</if>
        </trim>
    </insert>
@@ -364,14 +371,14 @@
        insert into
        pat_archive(name,viptype,sex,idcardno,birthdate,place_of_residence,age,age2,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,age_unit2,notrequired_flag,notrequiredreason,care_facilities,case_path,
        degree_of_education,marital_status,income,medicare_type,care_person,case_person_age,reserved_phone)
        degree_of_education,marital_status,income,medicare_type,care_person,case_person_age,reserved_phone,patient_overview)
        values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.name},#{item.viptype},#{item.sex},#{item.idcardno},#{item.birthdate},#{item.placeOfResidence},#{item.age},#{item.age2},#{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.ageUnit2},#{item.notrequiredFlag},#{item.notrequiredreason}
            ,#{item.careFacilities},#{item.casePath},#{item.degreeOfEducation},#{item.maritalStatus},#{item.income},#{item.medicareType},#{item.carePerson},#{item.casePersonAge},#{item.reservedPhone})
            ,#{item.careFacilities},#{item.casePath},#{item.degreeOfEducation},#{item.maritalStatus},#{item.income},#{item.medicareType},#{item.carePerson},#{item.casePersonAge},#{item.reservedPhone},#{item.patientOverview})
        </foreach>
    </insert>
@@ -418,6 +425,7 @@
            <if test="carePerson != null ">care_person = #{carePerson},</if>
            <if test="casePersonAge != null ">case_person_age = #{casePersonAge},</if>
            <if test="reservedPhone != null ">reserved_phone = #{reservedPhone},</if>
            <if test="patientOverview != null ">patient_overview = #{patientOverview},</if>
        </trim>
        where id = #{id}
    </update>
@@ -476,6 +484,7 @@
        a.viptype,
        a.pattype,
        a.reserved_phone,
        a.patient_overview,
        COALESCE((
        SELECT string_agg(d.tagname, ', ')
        FROM pat_archivetag d
@@ -553,6 +562,7 @@
        a.reserved_phone,
        a.upload_time,
        a.pattype,
        a.patient_overview,
        d.bed_no,
        d.starttime,
        d.endtime,
@@ -712,6 +722,7 @@
        a.create_time,
        a.isupload,
        a.upload_time,
        a.patient_overview,
        a.reserved_phone,
        COALESCE((
        SELECT string_agg(dd.tagname, ', ')
@@ -780,6 +791,7 @@
        a.notrequired_flag,
        a.notrequiredreason,
        a.patid_his,
        a.patient_overview,
        a.sd_flag,
        a.patientno,
        a.sex,
@@ -908,6 +920,7 @@
        a.create_time,
        a.isupload,
        a.upload_time,
        a.patient_overview,
        a.pattype,
        a.reserved_phone,
        d.bed_no,
@@ -1058,6 +1071,7 @@
        a.isupload,
        a.reserved_phone,
        a.upload_time,
        a.patient_overview,
        rt.tagname,
        ROW_NUMBER() OVER (PARTITION BY a.idcardno ORDER BY a.update_time DESC) AS rn,
        a.pattype
@@ -1170,6 +1184,7 @@
        a.isupload,
        a.upload_time,
        a.reserved_phone,
        a.patient_overview,
        COALESCE((
        SELECT string_agg(dd.tagname, ', ')
        FROM pat_archivetag dd
smartor/src/main/resources/mapper/smartor/PatServiceContractMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,357 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.PatServiceContractMapper">
    <resultMap type="com.smartor.domain.PatServiceContract" id="PatServiceContractResult">
        <result property="id" column="id"/>
        <result property="contractNo" column="contract_no"/>
        <result property="patId" column="pat_id"/>
        <result property="contractType" column="contract_type"/>
        <result property="salesChannel" column="sales_channel"/>
        <result property="contractAmount" column="contract_amount"/>
        <result property="paymentStatus" column="payment_status"/>
        <result property="contractStatus" column="contract_status"/>
        <result property="startDate" column="start_date"/>
        <result property="endDate" column="end_date"/>
        <result property="actualEndDate" column="actual_end_date"/>
        <result property="pid" column="pid"/>
        <result property="guid" column="guid"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="orgid" column="orgid"/>
        <result property="autoRenew" column="auto_renew"/>
        <result property="renewalReminderDays" column="renewal_reminder_days"/>
        <result property="specialTerms" column="special_terms"/>
        <result property="signedAt" column="signed_at"/>
        <result property="signedByPatient" column="signed_by_patient"/>
        <result property="signedByHospital" column="signed_by_hospital"/>
        <result property="cancellationReason" column="cancellation_reason"/>
        <result property="cancelledAt" column="cancelled_at"/>
    </resultMap>
    <sql id="selectPatServiceContractVo">
        select id,
               contract_no,
               pat_id,
               contract_type,
               sales_channel,
               contract_amount,
               payment_status,
               contract_status,
               start_date,
               end_date,
               actual_end_date,
               pid,
               guid,
               del_flag,
               create_by,
               update_by,
               update_time,
               orgid,
               auto_renew,
               renewal_reminder_days,
               special_terms,
               signed_at,
               signed_by_patient,
               signed_by_hospital,
               cancellation_reason,
               cancelled_at
        from pat_service_contract
    </sql>
    <select id="selectPatServiceContractList" parameterType="com.smartor.domain.PatServiceContract"
            resultMap="PatServiceContractResult">
        <include refid="selectPatServiceContractVo"/>
        <where>
            del_flag=0
            <if test="contractNo != null  and contractNo != ''">
                and contract_no = #{contractNo}
            </if>
            <if test="patId != null ">
                and pat_id = #{patId}
            </if>
            <if test="contractType != null  and contractType != ''">
                and contract_type = #{contractType}
            </if>
            <if test="salesChannel != null  and salesChannel != ''">
                and sales_channel = #{salesChannel}
            </if>
            <if test="contractAmount != null  and contractAmount != ''">
                and contract_amount = #{contractAmount}
            </if>
            <if test="paymentStatus != null  and paymentStatus != ''">
                and payment_status = #{paymentStatus}
            </if>
            <if test="contractStatus != null  and contractStatus != ''">
                and contract_status = #{contractStatus}
            </if>
            <if test="startDate != null ">
                and start_date = #{startDate}
            </if>
            <if test="endDate != null ">
                and end_date = #{endDate}
            </if>
            <if test="actualEndDate != null ">
                and actual_end_date = #{actualEndDate}
            </if>
            <if test="pid != null ">
                and pid = #{pid}
            </if>
            <if test="guid != null  and guid != ''">
                and guid = #{guid}
            </if>
            <if test="orgid != null  and orgid != ''">
                and orgid = #{orgid}
            </if>
            <if test="autoRenew != null  and autoRenew != ''">
                and auto_renew = #{autoRenew}
            </if>
            <if test="renewalReminderDays != null ">
                and renewal_reminder_days = #{renewalReminderDays}
            </if>
            <if test="specialTerms != null  and specialTerms != ''">
                and special_terms = #{specialTerms}
            </if>
            <if test="signedAt != null ">
                and signed_at = #{signedAt}
            </if>
            <if test="signedByPatient != null  and signedByPatient != ''">
                and signed_by_patient = #{signedByPatient}
            </if>
            <if test="signedByHospital != null  and signedByHospital != ''">
                and signed_by_hospital = #{signedByHospital}
            </if>
            <if test="cancellationReason != null  and cancellationReason != ''">
                and cancellation_reason = #{cancellationReason}
            </if>
            <if test="cancelledAt != null ">
                and cancelled_at = #{cancelledAt}
            </if>
        </where>
    </select>
    <select id="selectPatServiceContractById" parameterType="Long"
            resultMap="PatServiceContractResult">
        <include refid="selectPatServiceContractVo"/>
        where id = #{id}
    </select>
    <insert id="insertPatServiceContract" parameterType="com.smartor.domain.PatServiceContract">
        insert into pat_service_contract
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,
            </if>
            <if test="contractNo != null">contract_no,
            </if>
            <if test="patId != null">pat_id,
            </if>
            <if test="contractType != null">contract_type,
            </if>
            <if test="salesChannel != null">sales_channel,
            </if>
            <if test="contractAmount != null">contract_amount,
            </if>
            <if test="paymentStatus != null">payment_status,
            </if>
            <if test="contractStatus != null">contract_status,
            </if>
            <if test="startDate != null">start_date,
            </if>
            <if test="endDate != null">end_date,
            </if>
            <if test="actualEndDate != null">actual_end_date,
            </if>
            <if test="pid != null">pid,
            </if>
            <if test="guid != null">guid,
            </if>
            <if test="delFlag != null">del_flag,
            </if>
            <if test="createBy != null">create_by,
            </if>
            <if test="updateBy != null">update_by,
            </if>
            <if test="updateTime != null">update_time,
            </if>
            <if test="orgid != null">orgid,
            </if>
            <if test="autoRenew != null">auto_renew,
            </if>
            <if test="renewalReminderDays != null">renewal_reminder_days,
            </if>
            <if test="specialTerms != null">special_terms,
            </if>
            <if test="signedAt != null">signed_at,
            </if>
            <if test="signedByPatient != null">signed_by_patient,
            </if>
            <if test="signedByHospital != null">signed_by_hospital,
            </if>
            <if test="cancellationReason != null">cancellation_reason,
            </if>
            <if test="cancelledAt != null">cancelled_at,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},
            </if>
            <if test="contractNo != null">#{contractNo},
            </if>
            <if test="patId != null">#{patId},
            </if>
            <if test="contractType != null">#{contractType},
            </if>
            <if test="salesChannel != null">#{salesChannel},
            </if>
            <if test="contractAmount != null">#{contractAmount},
            </if>
            <if test="paymentStatus != null">#{paymentStatus},
            </if>
            <if test="contractStatus != null">#{contractStatus},
            </if>
            <if test="startDate != null">#{startDate},
            </if>
            <if test="endDate != null">#{endDate},
            </if>
            <if test="actualEndDate != null">#{actualEndDate},
            </if>
            <if test="pid != null">#{pid},
            </if>
            <if test="guid != null">#{guid},
            </if>
            <if test="delFlag != null">#{delFlag},
            </if>
            <if test="createBy != null">#{createBy},
            </if>
            <if test="updateBy != null">#{updateBy},
            </if>
            <if test="updateTime != null">#{updateTime},
            </if>
            <if test="orgid != null">#{orgid},
            </if>
            <if test="autoRenew != null">#{autoRenew},
            </if>
            <if test="renewalReminderDays != null">#{renewalReminderDays},
            </if>
            <if test="specialTerms != null">#{specialTerms},
            </if>
            <if test="signedAt != null">#{signedAt},
            </if>
            <if test="signedByPatient != null">#{signedByPatient},
            </if>
            <if test="signedByHospital != null">#{signedByHospital},
            </if>
            <if test="cancellationReason != null">#{cancellationReason},
            </if>
            <if test="cancelledAt != null">#{cancelledAt},
            </if>
        </trim>
    </insert>
    <update id="updatePatServiceContract" parameterType="com.smartor.domain.PatServiceContract">
        update pat_service_contract
        <trim prefix="SET" suffixOverrides=",">
            <if test="contractNo != null">contract_no =
                #{contractNo},
            </if>
            <if test="patId != null">pat_id =
                #{patId},
            </if>
            <if test="contractType != null">contract_type =
                #{contractType},
            </if>
            <if test="salesChannel != null">sales_channel =
                #{salesChannel},
            </if>
            <if test="contractAmount != null">contract_amount =
                #{contractAmount},
            </if>
            <if test="paymentStatus != null">payment_status =
                #{paymentStatus},
            </if>
            <if test="contractStatus != null">contract_status =
                #{contractStatus},
            </if>
            <if test="startDate != null">start_date =
                #{startDate},
            </if>
            <if test="endDate != null">end_date =
                #{endDate},
            </if>
            <if test="actualEndDate != null">actual_end_date =
                #{actualEndDate},
            </if>
            <if test="pid != null">pid =
                #{pid},
            </if>
            <if test="guid != null">guid =
                #{guid},
            </if>
            <if test="delFlag != null">del_flag =
                #{delFlag},
            </if>
            <if test="createBy != null">create_by =
                #{createBy},
            </if>
            <if test="updateBy != null">update_by =
                #{updateBy},
            </if>
            <if test="updateTime != null">update_time =
                #{updateTime},
            </if>
            <if test="orgid != null">orgid =
                #{orgid},
            </if>
            <if test="autoRenew != null">auto_renew =
                #{autoRenew},
            </if>
            <if test="renewalReminderDays != null">renewal_reminder_days =
                #{renewalReminderDays},
            </if>
            <if test="specialTerms != null">special_terms =
                #{specialTerms},
            </if>
            <if test="signedAt != null">signed_at =
                #{signedAt},
            </if>
            <if test="signedByPatient != null">signed_by_patient =
                #{signedByPatient},
            </if>
            <if test="signedByHospital != null">signed_by_hospital =
                #{signedByHospital},
            </if>
            <if test="cancellationReason != null">cancellation_reason =
                #{cancellationReason},
            </if>
            <if test="cancelledAt != null">cancelled_at =
                #{cancelledAt},
            </if>
        </trim>
        where id = #{id}
    </update>
    <update id="deletePatServiceContractById" parameterType="Long">
        update pat_service_contract
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id = #{id}
    </update>
    <update id="deletePatServiceContractByIds" parameterType="String">
        update pat_service_contract
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
</mapper>
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -75,6 +75,7 @@
        <result property="tagname" column="tagname"/>
        <result property="visitTime" column="visit_time"/>
        <result property="leavediagname" column="leavediagname"/>
        <result property="outPath" column="out_path"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
@@ -87,6 +88,7 @@
    <sql id="selectServiceSubtaskVo">
        select id,
               hosp_type,
               out_path,
               suggest,
               sendstate,
               endtime,
@@ -165,6 +167,7 @@
            del_flag=0
            <if test="sendname != null  and sendname != ''">and sendname like concat('%', #{sendname}, '%')</if>
            <if test="phone != null  and phone != ''">and phone = #{phone}</if>
            <if test="outPath != null  and outPath != ''">and out_path = #{outPath}</if>
            <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">and
                leavehospitaldistrictcode = #{leavehospitaldistrictcode}
            </if>
@@ -177,7 +180,7 @@
            <if test="sex != null  and sex != ''">and sex = #{sex}</if>
            <if test="age != null ">and age = #{age}</if>
            <if test="patguid != null ">and patguid = #{patguid}</if>
            <if test="subId != null ">and id = #{subId}</if>
            <if test="subid != null ">and id = #{subid}</if>
            <if test="inhospid != null ">and inhospid = #{inhospid}</if>
            <if test="submit != null ">and submit = #{submit}</if>
            <if test="upid != null ">and upid = #{upid}</if>
@@ -279,7 +282,8 @@
            <if test="endtime != null ">and endtime = #{endtime}</if>
            <if test="excep != null ">and excep = #{excep}</if>
            <if test="nurseName != null ">and nurse_name = #{nurseName}</if>
            <if test="score != null">and score = #{score}</if>
            <if test="scoreStart != null">and score &gt;= #{scoreStart}</if>
            <if test="scoreEnd != null">and score &lt;= #{scoreEnd}</if>
            <!--            <if test="visitCount != null">and visit_count = #{visitCount}</if>-->
            <if test="visitCount != null and visitCount == 1">
                AND visit_count = 1
@@ -293,8 +297,6 @@
            <if test="taskGuid != null">and task_guid = #{taskGuid}</if>
            <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
            <if test="visitTime != null">and visit_time = #{visitTime}</if>
            <!--<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>-->
            <if test="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0">
                AND visit_dept_code IN
                <foreach collection="visitDeptCodes" item="visitDeptCodes" open="("
@@ -404,6 +406,8 @@
            <if test="inhospid != null ">inhospid,</if>
            <if test="visitTime != null ">visit_time,</if>
            <if test="leavediagname != null ">leavediagname,</if>
            <if test="outPath != null">out_path,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -477,6 +481,8 @@
            <if test="inhospid != null ">#{inhospid},</if>
            <if test="visitTime != null ">#{visitTime},</if>
            <if test="leavediagname != null ">#{leavediagname},</if>
            <if test="outPath != null">#{outPath},</if>
        </trim>
    </insert>
@@ -554,6 +560,7 @@
            <if test="inhospid != null ">inhospid=#{inhospid},</if>
            <if test="visitTime != null ">visit_time=#{visitTime},</if>
            <if test="leavediagname != null ">leavediagname=#{leavediagname},</if>
            <if test="outPath != null">out_path = #{outPath},</if>
        </trim>
        where id = #{id}
    </update>
@@ -632,11 +639,13 @@
            <if test="inhospid != null ">inhospid=#{inhospid},</if>
            <if test="visitTime != null ">visitTime=#{visitTime},</if>
            <if test="delFlag != null ">del_flag=#{delFlag},</if>
            <if test="outPath != null ">out_path = #{outPath},</if>
        </trim>
        <where>
            <if test="patid != null ">patid=#{patid}</if>
            <if test="taskid != null ">and taskid=#{taskid}</if>
            <if test="leavediagname != null ">and leavediagname=#{leavediagname}</if>
            <if test="outPath != null  and outPath != ''">and out_path = #{outPath}</if>
        </where>
    </update>
@@ -714,6 +723,7 @@
            <if test="inhospid != null ">inhospid=#{inhospid},</if>
            <if test="visitTime != null ">visit_time=#{visitTime},</if>
            <if test="leavediagname != null ">leavediagname=#{leavediagname},</if>
            <if test="outPath != null">out_path = #{outPath},</if>
        </trim>
        where patid = #{patid} and taskid = #{taskid}
    </update>
@@ -826,6 +836,7 @@
               remark,
               visit_time,
               leavediagname,
               out_path,
               diagname
        FROM service_subtask,
             JSON_TABLE(send_time_slot, '$[*]' COLUMNS (
@@ -900,8 +911,8 @@
        WHERE
        del_flag = '0'
        <if test="startDate != null and endDate != null">
            AND  visit_time  &gt;=  #{startDate}
            AND  visit_time  &lt;=  #{endDate}
            AND visit_time &gt;= #{startDate}
            AND visit_time &lt;= #{endDate}
        </if>
        <if test="orgid != null">
@@ -976,8 +987,8 @@
        FROM pat_med_inhosp
        WHERE del_flag = '0'
        <if test="startDate != null and endDate != null">
            AND endtime  &gt;=  #{startDate}
            AND  endtime  &lt;=  #{endDate}
            AND endtime &gt;= #{startDate}
            AND endtime &lt;= #{endDate}
        </if>
        AND inhospstate=1
@@ -1082,6 +1093,5 @@
        GROUP BY timePeriod
        ORDER BY timePeriod DESC
    </select>
</mapper>
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
@@ -44,12 +44,14 @@
        <result property="deptCode" column="dept_code"/>
        <result property="longTemp" column="long_temp"/>
        <result property="sendDay" column="send_day"/>
        <result property="scoreType" column="score_type"/>
    </resultMap>
    <sql id="selectSvyTaskTemplateVo">
        select id,
               templateid,
               prologue,
               score_type,
               dept_code,
               long_temp,
               send_day,
@@ -95,6 +97,7 @@
        <where>
            del_flag=0
            <if test="templateid != null ">and templateid = #{templateid}</if>
            <if test="scoreType != null ">and score_type = #{scoreType}</if>
            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
            <if test="svycode != null  and svycode != ''">and svycode = #{svycode}</if>
            <if test="svyname != null  and svyname != ''">and svyname like concat('%', #{svyname}, '%')</if>
@@ -131,7 +134,7 @@
    <select id="selectSvyTaskTemplateBySvyid" parameterType="Long" resultMap="SvyTaskTemplateResult">
        <include refid="selectSvyTaskTemplateVo"/>
        where del_flag=0 and  id = #{id}
        where del_flag=0 and id = #{id}
    </select>
    <insert id="insertSvyTaskTemplate" parameterType="com.smartor.domain.SvyTaskTemplate" useGeneratedKeys="true"
@@ -176,6 +179,8 @@
            <if test="deptCode != null ">dept_code,</if>
            <if test="longTemp != null ">long_temp,</if>
            <if test="sendDay != null ">send_day,</if>
            <if test="scoreType != null ">score_type,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="templateid != null">#{templateid},</if>
@@ -216,6 +221,8 @@
            <if test="deptCode != null ">#{deptCode},</if>
            <if test="longTemp != null ">#{longTemp},</if>
            <if test="sendDay != null ">#{sendDay},</if>
            <if test="scoreType != null ">#{scoreType},</if>
        </trim>
    </insert>
@@ -260,6 +267,8 @@
            <if test="deptCode != null ">dept_code = #{deptCode},</if>
            <if test="longTemp != null ">long_temp = #{longTemp},</if>
            <if test="sendDay != null ">send_day = #{sendDay},</if>
            <if test="scoreType != null ">,score_type = #{scoreType},</if>
        </trim>
        where id = #{id}
    </update>