liusheng
2025-12-11 6659135780e718758417efde4c8c351c69e3755b
代码提交
已修改67个文件
已添加1个文件
1670 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-ls.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-sltd.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-xh.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/enums/MsgLSEnum.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SmsRecordsMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SmsRecordsServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/common/LSHospTokenUtil.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedInhosp.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskDiagname.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceTaskdiag.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IPatMedInhospService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IXHGatherPatArchiveService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java 280 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 333 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibScriptMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaScriptMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateTargetoptionMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -1,6 +1,8 @@
package com.ruoyi.web.component;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -15,6 +17,7 @@
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.LSHospTokenUtil;
import com.smartor.domain.*;
@@ -79,7 +82,7 @@
    private RedisCache redisCache;
    @Autowired
    private ServiceTaskMapper svyTaskMapper;
    private ServiceTaskMapper serviceTaskMapper;
    @Autowired
    private ServiceSubtaskMapper serviceSubtaskMapper;
@@ -143,7 +146,7 @@
            if (commonTaskcallMQ.getUpdateSendstate() == null || commonTaskcallMQ.getUpdateSendstate() == 1) {
                serviceTask.setSendState(5L);
                serviceTask.setFail(1L);
                svyTaskMapper.updateServiceTask(serviceTask);
                serviceTaskMapper.updateServiceTask(serviceTask);
            }
        } catch (Exception e) {
            Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString());
@@ -152,7 +155,7 @@
                ServiceTask serviceTask = new ServiceTask();
                serviceTask.setTaskid(Long.valueOf(commonTaskcallMQ.getTaskid().toString()));
                serviceTask.setFail(0L);
                svyTaskMapper.updateServiceTask(serviceTask);
                serviceTaskMapper.updateServiceTask(serviceTask);
                //将消息从队列中删除
            } else if (integer == null) {
                redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), 1, 120, TimeUnit.MINUTES);
@@ -355,8 +358,9 @@
                            }
                        } else if (heLibrary.getHetype().equals("2")) {
                            //通知
                            String sc = getSC(serviceSubtask, heLibrary.getPreachcontent());
                            sendMagParam.setPhone(serviceSubtask.getPhone());
                            sendMagParam.setContent(heLibrary.getPreachcontent());
                            sendMagParam.setContent(sc);
                        }
                    }
@@ -367,28 +371,39 @@
                        Map<String, String> req = new HashMap<>();
                        req.put("phone", sendMagParam.getPhone());
                        req.put("content", sendMagParam.getContent());
                        log.info("content返回值的内容是:{}", sendMagParam.getContent());
                        s = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req));
                    } else if (active.equals("ls")) {
                        String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid());
                        log.info("-------00token.360的URL为:{}", url);
//                        String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid());
//                        log.info("-------00token.360的URL为:{}", url);
                        //丽水的短信发送方式
                        Map<String, String> map = MsgLSEnum.getAddressByCode(serviceSubtask.getOrgid());
                        log.info("-----------map的值为:{}", map);
                        String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), url);
                        log.info("-----------token的值为:{}", token);
                        if (ObjectUtils.isNotEmpty(map) && StringUtils.isEmpty(map.get("address"))) {
                        SysConfig config = new SysConfig();
                        config.setConfigKey("ls.msg.info");
                        config.setOrgid(serviceSubtask.getOrgid());
                        List<SysConfig> sysConfigs = configService.selectConfigList(config);
                        Map<String, String> msgInfo = new HashMap<>();
                        if (CollectionUtils.isNotEmpty(sysConfigs)) {
                            String configValue = sysConfigs.get(0).getConfigValue();
                            ObjectMapper objectMapper = new ObjectMapper();
                            if (StringUtils.isNotEmpty(configValue)) {
                                msgInfo = objectMapper.readValue(configValue, Map.class);
                            }
                        }
                        log.info("-----------map的值为:{}", msgInfo);
                        if (ObjectUtils.isNotEmpty(msgInfo) && StringUtils.isEmpty(msgInfo.get("address"))) {
                            serviceSubtask.setCurrentPreachform(sendPreachform);
                            serviceSubtask.setVisitTime(getNextVisitTime(serviceSubtask.getId(), serviceSubtask.getTaskid(), serviceSubtask.getVisitTime(), serviceSubtask.getCurrentPreachform()));
                            setFailPreachForm(serviceSubtask, descByCode, "短信发送失败,该机构没有配置短信地址", "5");
                            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                            continue;
                        }
                        log.info("---------mq丽水短信发送入参address:{},  sendMagParam:{},  orgid:{}-------", map.get("address"), sendMagParam, serviceSubtask.getOrgid());
                        String dxCode = getDXCode(map.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), map.get("sendPersonId"), map.get("sendPersonName"), MsgLSEnum.getHeaderByCode(serviceSubtask.getOrgid()), token);
                        log.info("---------丽水短信发送结果:{}-------", dxCode);
                        String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), msgInfo.get("tokenUrl"));
                        String dxCode = getDXCode(msgInfo.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), msgInfo.get("sendPersonId"), msgInfo.get("sendPersonName"), MsgLSEnum.getHeaderByCode(msgInfo), token);
                        ObjectMapper objectMapper = new ObjectMapper();
                        Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class);
                        log.info("---------丽水短信发送结果--textParam的值为:{}-------", textParam);
                        String code = textParam.get("Code").toString();
                        if (code.equals("0")) {
                            s = "true";
@@ -397,9 +412,8 @@
                            throw new BaseException("短信发送失败");
                        }
                    } else if (active.equals("sltd")) {
                        log.info("-------进来了不??");
                        //省立同德的短信发送方式
                        String data = MessageSend.sendMsg(sendMagParam.getContent(), "2", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
                        String data = MessageSend.sendMsg(sendMagParam.getContent(), "6", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
                        if (StringUtils.isNotEmpty(data) && data.contains("result=0")) {
                            s = "true";
                        } else {
@@ -493,6 +507,24 @@
                        serviceOutPath.setRadix(format);
                        serviceOutPath.setUpdateTime(new Date());
                        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                        //需要通过模板ID去判断要发的内容是宣教还是通知
//                        HeLibrary heLibrary = heLibraryMapper.selectHeLibraryById(serviceSubtask.getLibtemplateid());
//                        if (heLibrary.getHetype().equals("1")) {
//                            sendMagParam.setPhone(serviceSubtask.getPhone());
//                            sendMagParam.setUrl(ip + ":" + req_path + "/xj?p=" + format);
//                            if (active.equals("ls") || active.equals("sltd")) {
//                                sendMagParam.setContent("您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!");
//                            } else if (active.equals("xh")) {
//                                sendMagParam.setContent("【新华医院】您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!");
//                            }
//                        } else if (heLibrary.getHetype().equals("2")) {
//                            //通知
//                            String sc = getSC(serviceSubtask, heLibrary.getPreachcontent());
//                            sendMagParam.setPhone(serviceSubtask.getPhone());
//                            sendMagParam.setContent(sc);
//                        }
                        url = ip + ":" + req_path + "/xj?p=" + format;
                    }
                    if (StringUtils.isEmpty(patArchive.getPatidHis())) {
@@ -581,6 +613,32 @@
    }
    private String getSC(ServiceSubtask serviceSubtask, String scriptContent) {
        Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid());
        for (Map<String, String> map : param.values()) {
            for (String key : map.keySet()) {
                scriptContent = scriptContent.replace(key, org.apache.commons.lang3.StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "");
            }
        }
        scriptContent = scriptContent.replace("${name}", org.apache.commons.lang3.StringUtils.isNotEmpty(serviceSubtask.getSendname()) ? serviceSubtask.getSendname() : "");
        scriptContent = scriptContent.replace("${dzz}", org.apache.commons.lang3.StringUtils.isNotEmpty(serviceSubtask.getAddr()) ? serviceSubtask.getAddr() : "");
        scriptContent = scriptContent.replace("${phone}", org.apache.commons.lang3.StringUtils.isNotEmpty(serviceSubtask.getTelcode()) ? serviceSubtask.getTelcode() : "");
        return scriptContent;
    }
    private Map<String, Map<String, String>> getParam(Long taskId) {
        ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(taskId);
        ObjectMapper objectMapper = new ObjectMapper();
        Map<String, Map<String, String>> serviceTaskMap = null;
        try {
            serviceTaskMap = objectMapper.readValue(serviceTask.getTextParam(), Map.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return serviceTaskMap;
    }
    private Date getNextVisitTime(Long subid, Long taskid, Date visitTime, String currentPreachform) {
        ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
        serviceSubtaskPreachform.setSubid(subid);
@@ -604,6 +662,16 @@
    private String getSendPreachform(ServiceSubtaskPreachform serviceSubtaskPreachform, ServiceSubtask serviceSubtask) {
        log.info("-----getSendPreachform的serviceSubtaskPreachform入参:{},------serviceSubtask:{}", serviceSubtaskPreachform, serviceSubtask);
        List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
        if (CollectionUtils.isEmpty(serviceSubtaskPreachforms)) {
            //如果serviceSubtaskPreachforms为空的话,则需要进行新增一下
            List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = addServiceSubtaskPreachform(serviceSubtask, "1");
            if (CollectionUtils.isEmpty(serviceSubtaskPreachformList)) {
                log.error("发送方式失败了serviceSubtask的入参为:{}", serviceSubtask);
                return null;
            }
            serviceSubtaskPreachforms = serviceSubtaskPreachformList;
        }
        // æƒ…况1:currentPreachform为空,取sort为1的preachform
        if (StringUtils.isEmpty(serviceSubtask.getCurrentPreachform())) {
@@ -637,6 +705,35 @@
        return null;
    }
    private List<ServiceSubtaskPreachform> addServiceSubtaskPreachform(ServiceSubtask serviceSubtask, String sendstate) {
        //将preachformDesc的json对象,放到list集合中
        ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
        String preachformDesc = serviceTask.getPreachformDesc();
        List<ServiceSubtaskPreachform> sspl = null;
        ObjectMapper objectMapper = new ObjectMapper();
        if (org.apache.commons.lang3.StringUtils.isNotEmpty(preachformDesc)) {
            try {
                sspl = objectMapper.readValue(preachformDesc, new TypeReference<List<ServiceSubtaskPreachform>>() {
                });
            } catch (JsonProcessingException e) {
                log.error("mq--preachform转List<ServiceSubtaskPreachform>报错了:{}", e.getMessage());
            }
            for (ServiceSubtaskPreachform serviceSubtaskPreachform : sspl) {
                serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
                serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
                //这个sendstate需要在数据库设置一个默认值为“1”
                serviceSubtaskPreachform.setSendstate("1");
                if (StringUtils.isNotEmpty(sendstate)) serviceSubtaskPreachform.setSendstate(sendstate);
                serviceSubtaskPreachform.setOrgid(serviceSubtask.getOrgid());
                serviceSubtaskPreachformMapper.insertServiceSubtaskPreachform(serviceSubtaskPreachform);
            }
        }
        return sspl;
    }
    /**
     * @param serviceSubtask
@@ -674,8 +771,9 @@
        serviceSubtaskPreachform.setPreachform(preachform);
        //1:未发送状态
        serviceSubtaskPreachform.setSendstate("1");
        log.error("---serviceSubtaskPreachform入参为:{}", serviceSubtaskPreachform);
        log.info("---serviceSubtaskPreachform入参为:{}", serviceSubtaskPreachform);
        List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
        log.info("---serviceSubtaskPreachform返参为:{}", serviceSubtaskPreachforms);
        //电话的未发送状态,需要查2,因为,数据可能卡在队列里了(也有可能没有拉取,sendstate=1,所以如果是电话状态判断serviceSubtaskPreachforms是不是为空)
        if (preachform.equals("3") && CollectionUtils.isEmpty(serviceSubtaskPreachforms)) {
            serviceSubtaskPreachform.setSendstate("2");
@@ -814,14 +912,13 @@
        String body = new Gson().toJson(map);
//        String result = HttpUtils.sendPost(address, body);
        String result = null;
        try {
            result = OkHttpExample.sendPostRequest(address, body, token);
        } catch (IOException e) {
            e.printStackTrace();
        }
        log.error("--------result的值为:{}-----", result);
        log.info("--------result的值为:{}-----", result);
        JSONObject jsonObject = JSONObject.parseObject(result);
        String code = (String) jsonObject.toString();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
@@ -277,12 +277,6 @@
        patArchiveReq.setPageNum(null);
        List<PatArchiveOthreInfo> patientInfoQC = patArchiveService.getPatientInfoQC(patArchiveReq);
//        long count = PageUtils.count(new ISelect() {
//            @Override
//            public void doSelect() {
//                patArchiveService.getPatientInfoQC(patArchiveReq);
//            }
//        });
        return getDataTable3(patientInfoQC.size(), patientInfo);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedOuthospController.java
@@ -2,13 +2,16 @@
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.PageUtils;
import com.smartor.domain.PatArchiveOthreInfo;
import com.smartor.domain.PatMedReq;
import com.smartor.domain.PatMedRes;
import io.netty.util.internal.ObjectUtil;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -29,9 +29,12 @@
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.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -56,6 +59,9 @@
    @Autowired
    private IServiceSubtaskRecordService serviceSubtaskRecordService;
    @Value("${spring.profiles.active}")
    private String active;
    /**
     * æŸ¥è¯¢æ‚£è€…随访信息
@@ -209,6 +215,48 @@
    }
    /**
     * æ ¹æ®ç–¾ç—…模糊查询
     */
    //@PreAuthorize("@ss.hasPermi('system:taskcall:query')")
    @PostMapping(value = "/getSubtaskByDiagname")
    public Map<String, Object> getSubtaskByDiagname(@RequestBody ServiceSubtask serviceSubtask) {
        LoginUser loginUser = getLoginUser();
        SysUser user = loginUser.getUser();
        serviceSubtask.setOrgid(user.getOrgid());
        serviceSubtask.setPageNum(PageUtils.getOffset(serviceSubtask.getPageNum(), serviceSubtask.getPageSize()));
        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskService.selectServiceSubtaskByDiagname(serviceSubtask);
        Map<String, Object> rspData = new HashMap();
        rspData.put("code", HttpStatus.SUCCESS);
        rspData.put("msg", "查询成功");
        rspData.put("rows", serviceSubtaskList);
        serviceSubtask.setPageNum(null);
        serviceSubtask.setPageSize(null);
        List<ServiceSubtask> total = serviceSubtaskService.selectServiceSubtaskByDiagname(serviceSubtask);
        if (CollectionUtils.isNotEmpty(total)) rspData.put("total", total.size());
        else rspData.put("total", 0);
        return rspData;
    }
    /**
     * éšè®¿ç»Ÿè®¡å¯¼å‡º
     */
    //@PreAuthorize("@ss.hasPermi('system:taskcall:export')")
    @Log(title = "随访统计导出)", businessType = BusinessType.EXPORT)
    @PostMapping("/getSubtaskByDiagnameExport")
    public void getSubtaskByDiagnameExport(HttpServletResponse response, List<ServiceSubtaskDiagname> serviceSubtaskDiagnameList) {
        ExcelUtil<ServiceSubtaskDiagname> util = new ExcelUtil<ServiceSubtaskDiagname>(ServiceSubtaskDiagname.class);
        if (active.equals("ls") || active.equals("druid")) {
            util.exportExcel(response, serviceSubtaskDiagnameList, LocalDate.now().getMonthValue() + "随访统计导出");
        } else {
            util.exportExcel(response, serviceSubtaskDiagnameList, "随访统计导出");
        }
    }
    /**
     * æ–°å¢žæˆ–修改删除单一任务
     */
    @ApiOperation("新增或修改删除单一任务")
@@ -347,7 +395,7 @@
     */
    @ApiOperation("获取随访满意度统计")
    @PostMapping("/getSfStatisticsJoy")
    public AjaxResult getSfStatisticsJoy(@RequestBody ServiceSubtaskCountReq serviceSubtaskCountReq) {
    public Map<String, Object> getSfStatisticsJoy(@RequestBody ServiceSubtaskCountReq serviceSubtaskCountReq) {
        if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getServiceType())) {
            return error("服务类型不能为空");
        }
@@ -361,10 +409,16 @@
    @Log(title = "随访统计导出)", businessType = BusinessType.EXPORT)
    @PostMapping("/getSfStatisticsExport")
    public void export(HttpServletResponse response, ServiceSubtaskCountReq serviceSubtaskCountReq) {
        List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSfStatistics(serviceSubtaskCountReq);
        List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSfStatisticsExport(serviceSubtaskCountReq);
        ExcelUtil<ServiceSubtaskStatistic> util = new ExcelUtil<ServiceSubtaskStatistic>(ServiceSubtaskStatistic.class);
        if (active.equals("ls") || active.equals("druid")) {
            util.exportExcel(response, sfStatistics, LocalDate.now().getMonthValue() + "月出院随访统计表");
        } else {
        util.exportExcel(response, sfStatistics, "随访统计导出");
    }
    }
    /**
     * éšè®¿ç»Ÿè®¡å¯¼å‡º
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
@@ -24,6 +24,7 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -16,6 +16,7 @@
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysMenuService;
import com.smartor.mapper.SysUserDeptMapper;
import com.smartor.service.IServiceSLTDHealthcareRecordService;
import com.smartor.service.impl.ServiceSLTDHealthcareRecordServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +54,8 @@
    @Autowired
    private ISysConfigService sysConfigService;
    @Autowired
    private IServiceSLTDHealthcareRecordService iServiceSLTDHealthcareRecordService;
    @Value("${pri_key}")
@@ -87,6 +90,18 @@
        return ajax;
    }
    /**
     * ç™»å½•方法
     *
     * @param loginBody ç™»å½•信息
     * @return ç»“æžœ
     */
    @PostMapping("/test")
    public void test(@RequestBody Map<String, Object> map) {
        iServiceSLTDHealthcareRecordService.aa(map);
    }
    /**
     * å•点登录方法(需要配置IP白名单)
     * éœ€è¦åœ¨sys_config表的sys.ip.whitelis中,加入IP才能访问该方法
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -21,6 +21,7 @@
import com.ruoyi.system.service.ISysUserService;
import com.smartor.mapper.SysUserDeptMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -83,8 +84,8 @@
        user.setPageNum(null);
        user.setPageSize(null);
        List<SysUser> total = userService.getUserList(user);
        rspData.put("total", total.size());
        if (CollectionUtils.isNotEmpty(total)) rspData.put("total", total.size());
        else rspData.put("total", 0);
        return rspData;
    }
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
@@ -65,10 +65,13 @@
    @Test
    public void cc() {
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String s = rsaPublicKeyExample.encryptedData("20250815001094", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==");
        String s = rsaPublicKeyExample.encryptedData("865", "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==");
        System.out.println("加密结果为:" + s);
        String s1 = rsaPublicKeyExample.decryptedData(s, "MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==");
        System.out.println("解密结果为:"+s1);
        String format = String.format("%03X", 202);
        System.out.println("format结果为:"+format);
    }
    public void aa(MultipartFile file) throws IOException {
ruoyi-admin/src/main/resources/application-druid.yml
@@ -34,7 +34,7 @@
        #        password: Hxerp2000
        #        driverClassName: com.mysql.cj.jdbc.Driver
        #  å…¬å¸æœ¬åœ°
        url: jdbc:mysql://haiershi.a1.luyouxia.net:23844/smartor_xinhua?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        url: jdbc:mysql://haiershi.a1.luyouxia.net:23844/smartor_lishui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        username: smartor
        password: Smartor.2023
        driverClassName: com.mysql.cj.jdbc.Driver
@@ -103,9 +103,9 @@
        login-password: Lihu@1363419#$
      filter:
        stat:
          enabled: true
          enabled: false
          # æ…¢SQL记录
          log-slow-sql: true
          log-slow-sql: false
          slow-sql-millis: 1000
          merge-sql: true
        wall:
@@ -138,7 +138,7 @@
    prefix: /api
    readonly: false
  sql-column-case: camel
  show-sql: true #配置打印SQL
  show-sql: false #配置打印SQL
  page-config:
    size: size
    page: page
ruoyi-admin/src/main/resources/application-ls.yml
@@ -15,6 +15,10 @@
        username: root@sfxx#other_cluster
        password: Y5oapyS8
        driverClassName: com.mysql.cj.jdbc.Driver
      #        url: jdbc:mysql://cluster02.db.lsjky.cn:2883/smartor-lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
      #        username: root@sfxx#other_cluster02
      #        password: Y5oapyS8
      #        driverClassName: com.mysql.cj.jdbc.Driver
      #        # é«˜æ–¯æ•°æ®åº“配置
      #        url: jdbc:postgresql://127.0.0.1:5432/smartorlishui
@@ -70,9 +74,9 @@
        login-password: Lihu@1363419#$
      filter:
        stat:
          enabled: true
          enabled: false
          # æ…¢SQL记录
          log-slow-sql: true
          log-slow-sql: false
          slow-sql-millis: 1000
          merge-sql: true
        wall:
ruoyi-admin/src/main/resources/application-sltd.yml
@@ -66,9 +66,9 @@
        login-password: Lihu@1363419#$
      filter:
        stat:
          enabled: true
          enabled: false
          # æ…¢SQL记录
          log-slow-sql: true
          log-slow-sql: false
          slow-sql-millis: 1000
          merge-sql: true
        wall:
ruoyi-admin/src/main/resources/application-xh.yml
@@ -112,10 +112,10 @@
    default-size: 10
# PageHelper分页插件
pagehelper:
  helperDialect: mysql
  supportMethodsArguments: true
  params: count=countSql
##pagehelper:
#  helperDialect: mysql
#  supportMethodsArguments: true
#  params: count=countSql
#钉钉的密钥
dingAppid: dingn8iip5ubj7clrrsv
ruoyi-admin/src/main/resources/application.yml
@@ -74,7 +74,8 @@
    # å›½é™…化资源文件路径
    basename: i18n/messages
  profiles:
    active: sltd
    active: ls
  # æ–‡ä»¶ä¸Šä¼ 
  servlet:
    multipart:
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
@@ -11,7 +11,7 @@
        <setting name="useGeneratedKeys" value="true"/>
        <!-- é…ç½®é»˜è®¤çš„æ‰§è¡Œå™¨.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
        <setting name="defaultExecutorType" value="SIMPLE"/>
        <!-- æŒ‡å®š MyBatis æ‰€ç”¨æ—¥å¿—的具体实现 -->
        <!-- æŒ‡å®š MyBatis æ‰€ç”¨æ—¥å¿—的具体实现(是否打印SQL) -->
<!--        <setting name="logImpl" value="STDOUT_LOGGING"/>-->
        <!-- ä½¿ç”¨é©¼å³°å‘½åæ³•转换字段 -->
        <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
ruoyi-common/src/main/java/com/ruoyi/common/enums/MsgLSEnum.java
@@ -13,10 +13,10 @@
 * XiaoXiLX    FZ_PT_DuanXinFS
 * XiaoXiMC    çŸ­ä¿¡å‘送
 */
public enum MsgLSEnum {
    ZYY("47231022633110211A2101", "https://9.0.124.104:13011/mediinfo-grus-fuwuzxwg/api/esb/lyraAsyncRun", "1400360867068907520", "丽水市中医院", "2361", "郑珍慧"),
    JN("47255004333112711A1001", null, "1400361376454545408", "景宁畲族自治县人民医院", "", "");
public class MsgLSEnum {
    //    ZYY("47231022633110211A2101", "https://9.0.124.104:13011/mediinfo-grus-fuwuzxwg/api/esb/lyraAsyncRun", "1400360867068907520", "丽水市中医院", "2361", "郑珍慧"),
//    JN("47255004333112711A1001", "", "1400361376454545408", "景宁畲族自治县人民医院", "0073", "周美媚");
//
    private String orgid;
    private String address;
    private String ZuHuID;
@@ -33,21 +33,18 @@
        this.sendPersonName = sendPersonName;
    }
    public static Map<String, Object> getHeaderByCode(String orgid) {
    public static Map<String, Object> getHeaderByCode(Map<String, String> srmInfo) {
        Map<String, Object> map = new LinkedHashMap<>();
        MsgLSEnum[] organEnums = values();
        for (int i = 0; i < organEnums.length; i++) {
            MsgLSEnum organEnum = organEnums[i];
            //获取时间
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String formattedDate = sdf.format(new Date());
            if (organEnum.getOrgid().equals(orgid)) {
                map.put("XiaoXiID", IdUtils.simpleUUID());
                map.put("FaSongSJ", formattedDate);
                map.put("ZuHuID", organEnum.getZuHuID());
                map.put("ZuHuMC", organEnum.getZuHuMC());
                map.put("FaSongJGID", organEnum.getOrgid());
                map.put("FaSongJGMC", organEnum.getZuHuMC());
        map.put("ZuHuID", srmInfo.get("ZuHuID"));
        map.put("ZuHuMC", srmInfo.get("ZuHuMC"));
        map.put("FaSongJGID", srmInfo.get("orgid"));
        map.put("FaSongJGMC", srmInfo.get("ZuHuMC"));
                //map.put("FaSongXTJC", "随访系统");
                map.put("FaSongXTJC", "SUIFANGXT");
                map.put("FaSongXTMC", "随访系统");
@@ -55,24 +52,8 @@
                map.put("FaSongFCSJC", "ZJHES");
                map.put("XiaoXiLX", "FZ_PT_DuanXinFS");
                map.put("XiaoXiMC", "短信发送");
            }
        }
        return map;
    }
    public static Map<String, String> getAddressByCode(String orgid) {
        MsgLSEnum[] organEnums = values();
        Map<String, String> map = new HashMap<>();
        for (int i = 0; i < organEnums.length; i++) {
            MsgLSEnum organEnum = organEnums[i];
            if (organEnum.getOrgid().equals(orgid)) {
                map.put("address", organEnum.getAddress());
                map.put("sendPersonId", organEnum.getSendPersonId());
                map.put("sendPersonName", organEnum.getSendPersonName());
                return map;
            }
        }
        return null;
    }
    public String getOrgid() {
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
@@ -43,9 +43,8 @@
     * è®¡ç®—偏移量
     */
    public static Integer getOffset(Integer pageNum, Integer pageSize) {
        if (pageNum == null) pageNum = 1;
        if (pageNum == null || pageNum == 0) pageNum = 1;
        if (pageSize == null) pageSize = 10;
        return (pageNum - 1) * pageSize;
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java
@@ -4,10 +4,16 @@
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
/**
 * redis配置
@@ -16,12 +22,10 @@
 */
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport
{
public class RedisConfig extends CachingConfigurerSupport {
    @Bean
    @SuppressWarnings(value = { "unchecked", "rawtypes" })
    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
    {
    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
        RedisTemplate<Object, Object> template = new RedisTemplate<>();
        template.setConnectionFactory(connectionFactory);
@@ -40,8 +44,19 @@
    }
    @Bean
    public DefaultRedisScript<Long> limitScript()
    {
    public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {
        // é»˜è®¤ç¼“存配置(其他 cache ä½¿ç”¨ï¼‰
        RedisCacheConfiguration defaultConfig = RedisCacheConfiguration.defaultCacheConfig();
        // å•独为 sfStatistics è®¾ç½® 20 åˆ†é’Ÿ TTL
        Map<String, RedisCacheConfiguration> configMap = new HashMap<>();
        configMap.put("sfStatistics", defaultConfig.entryTtl(Duration.ofMinutes(20)));
        configMap.put("sfStatisticsJoy", defaultConfig.entryTtl(Duration.ofMinutes(20)));
        configMap.put("selectPatMedOuthospList", defaultConfig.entryTtl(Duration.ofMinutes(20)));
        return RedisCacheManager.builder(connectionFactory).cacheDefaults(defaultConfig).withInitialCacheConfigurations(configMap).build();
    }
    @Bean
    public DefaultRedisScript<Long> limitScript() {
        DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>();
        redisScript.setScriptText(limitScriptText());
        redisScript.setResultType(Long.class);
@@ -51,19 +66,7 @@
    /**
     * é™æµè„šæœ¬
     */
    private String limitScriptText()
    {
        return "local key = KEYS[1]\n" +
                "local count = tonumber(ARGV[1])\n" +
                "local time = tonumber(ARGV[2])\n" +
                "local current = redis.call('get', key);\n" +
                "if current and tonumber(current) > count then\n" +
                "    return tonumber(current);\n" +
                "end\n" +
                "current = redis.call('incr', key)\n" +
                "if tonumber(current) == 1 then\n" +
                "    redis.call('expire', key, time)\n" +
                "end\n" +
                "return tonumber(current);";
    private String limitScriptText() {
        return "local key = KEYS[1]\n" + "local count = tonumber(ARGV[1])\n" + "local time = tonumber(ARGV[2])\n" + "local current = redis.call('get', key);\n" + "if current and tonumber(current) > count then\n" + "    return tonumber(current);\n" + "end\n" + "current = redis.call('incr', key)\n" + "if tonumber(current) == 1 then\n" + "    redis.call('expire', key, time)\n" + "end\n" + "return tonumber(current);";
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,7 +108,7 @@
                // è¿‡æ»¤è¯·æ±‚
                .authorizeRequests()
                // å¯¹äºŽç™»å½•login æ³¨å†Œregister éªŒè¯ç captchaImage å…è®¸åŒ¿åè®¿é—®
                .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer").permitAll()
                .antMatchers("/login","/test", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer").permitAll()
                // é™æ€èµ„源,可匿名访问
                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                .antMatchers("/smartor/organization/list").permitAll()
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -1,6 +1,8 @@
package com.ruoyi.quartz.task;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
@@ -35,7 +37,6 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -204,14 +205,12 @@
    }
    public void analysisData() {
        System.out.println("---------------------------");
        //数据解析
        ServiceThirdData serviceThirdData = new ServiceThirdData();
        serviceThirdData.setDataType("ADT^A03");
        serviceThirdData.setIsDeal(0);
        serviceThirdData.setCreateTime(new Date());
        iServiceThirdDataService.queryList(serviceThirdData);
    }
    /**
@@ -311,46 +310,68 @@
                // çœç«‹åŒå¾·æ•°æ®é‡‡é›†
                for (Long cid : campusidList) {
                    log.info("【dealHisData】省立同德“入院”开始采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“预入院”开始采集数据,院区:{}", cid);
                    String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                    String nowTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                    ServiceSLTDInhospReqVO serviceSLTDInhospReqVO = new ServiceSLTDInhospReqVO();
                    serviceSLTDInhospReqVO.setOrgId("20001001");
                    serviceSLTDInhospReqVO.setCampusId(cid);
                    serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime);
                    serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime);
                    List<String> list = new ArrayList<>();
//                    list.add("FH0108.02");
                    list.add("FH0109.22");
                    list.add("FH0109.23");
                    list.add("FH0109.53");
                    serviceSLTDInhospReqVO.setStatusList(list);
                    log.debug("【dealHisData】省立同德“预入院”采集数据入参:{}", serviceSLTDInhospReqVO);
                    serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                    log.debug("【dealHisData】省立同德“预入院”結束采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“入院”开始采集数据,院区:{}", cid);
                    serviceSLTDInhospReqVO.setOrgId("20001001");
                    serviceSLTDInhospReqVO.setCampusId(cid);
                    serviceSLTDInhospReqVO.setEncounterTimeStart(null);
                    serviceSLTDInhospReqVO.setEncounterTimeEnd(null);
                    serviceSLTDInhospReqVO.setStartHeadTime(nowTime);
                    serviceSLTDInhospReqVO.setStartTailTime(nowTime);
                    List<String> list = new ArrayList<>();
                    list.add("FH0108.02");
                    serviceSLTDInhospReqVO.setHealthcareRecordTypeList(list);
                    log.info("【dealHisData】省立同德“入院”采集数据入参:{}", serviceSLTDInhospReqVO);
                    List<String> listStr = new ArrayList<>();
//                    list.add("FH0108.02");
                    listStr.add("FH0109.26");
                    serviceSLTDInhospReqVO.setStatusList(listStr);
                    log.debug("【dealHisData】省立同德“入院”采集数据入参:{}", serviceSLTDInhospReqVO);
                    serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                    log.info("【dealHisData】省立同德“入院”結束采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“入院”結束采集数据,院区:{}", cid);
                    log.info("【dealHisData】省立同德“门急诊”开始采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“门急诊”开始采集数据,院区:{}", cid);
                    serviceSLTDInhospReqVO.setStartHeadTime(null);
                    serviceSLTDInhospReqVO.setStartTailTime(null);
                    serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime);
                    serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime);
                    serviceSLTDInhospReqVO.setStatusList(null);
                    List<String> list1 = new ArrayList<>();
                    list1.add("FH0108.01");
                    list1.add("FH0108.03");
                    serviceSLTDInhospReqVO.setHealthcareRecordTypeList(list1);
                    log.info("【dealHisData】省立同德“门急诊”采集数据入参:{}", serviceSLTDInhospReqVO);
                    log.debug("【dealHisData】省立同德“门急诊”采集数据入参:{}", serviceSLTDInhospReqVO);
                    serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                    log.info("【dealHisData】省立同德“门急诊”束采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“门急诊”束采集数据,院区:{}", cid);
                    log.info("【dealHisData】省立同德“出院”开始采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“出院”开始采集数据,院区:{}", cid);
                    serviceSLTDInhospReqVO.setStartHeadTime(null);
                    serviceSLTDInhospReqVO.setStartTailTime(null);
                    serviceSLTDInhospReqVO.setEncounterTimeStart(null);
                    serviceSLTDInhospReqVO.setEncounterTimeEnd(null);
                    serviceSLTDInhospReqVO.setPreOutHospitalHeadDate(nowTime);
                    serviceSLTDInhospReqVO.setPreOutHospitalTailDate(nowTime);
                    serviceSLTDInhospReqVO.setHealthcareRecordTypeList(null);
                    List<String> list2 = new ArrayList<>();
                    list2.add("FH0108.02");
                    serviceSLTDInhospReqVO.setHealthcareRecordTypeList(list2);
                    log.info("【dealHisData】省立同德“出院”采集数据入参:{}", serviceSLTDInhospReqVO);
//                    list2.add("FH0108.02");
                    list2.add("FH0109.27");
                    serviceSLTDInhospReqVO.setStatusList(list2);
                    log.debug("【dealHisData】省立同德“出院”采集数据入参:{}", serviceSLTDInhospReqVO);
                    serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO);
                    log.info("【dealHisData】省立同德“出院”束采集数据,院区:{}", cid);
                    log.debug("【dealHisData】省立同德“出院”束采集数据,院区:{}", cid);
                }
//                SysConfig sysConfig = sysConfigs.get(0);
//                sysConfig.setConfigValue(nowTime);
@@ -386,11 +407,12 @@
     * å¤„理患者信息,进入子任务表
     */
    public void dealOutHospInfo() {
        String config = configService.selectConfigByKey("visit.early.day");
        if (port.equals("8095")) {
            //出院表
            iPatMedInhospService.dealOutHospInfo();
            //门诊表
            if (active.equals("xh")) {
            iPatMedInhospService.dealOutHospInfo(config);
            //门诊表(新华的暂时不做门诊随访)
            if (!active.equals("xh")) {
                iPatMedOuthospService.dealOutpatientInfo();
            }
        }
@@ -418,7 +440,7 @@
    /**
     * é•¿æœŸä»»åŠ¡æ‰§è¡Œ
     *
     */
    public void longTaskSend() {
        //获取任务信息
@@ -656,16 +678,29 @@
                        req.put("content", sendMagParam.getContent());
                        isSuccess = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req));
                    } else if (active.equals("ls")) {
                        String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid());
                        //丽水的短信发送方式
                        Map<String, String> map = MsgLSEnum.getAddressByCode(serviceSubtask.getOrgid());
                        String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), url);
                        if (ObjectUtils.isNotEmpty(map) && StringUtils.isEmpty(map.get("address"))) {
//                        String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid());
//                        //丽水的短信发送方式
//                        Map<String, String> map = MsgLSEnum.getAddressByCode(serviceSubtask.getOrgid());
                        SysConfig config = new SysConfig();
                        config.setConfigKey("ls.msg.info");
                        config.setOrgid(serviceSubtask.getOrgid());
                        List<SysConfig> sysConfigs = configService.selectConfigList(config);
                        Map<String, String> msgInfo = new HashMap<>();
                        if (CollectionUtils.isNotEmpty(sysConfigs)) {
                            String configValue = sysConfigs.get(0).getConfigValue();
                            ObjectMapper objectMapper = new ObjectMapper();
                            if (StringUtils.isNotEmpty(configValue)) {
                                msgInfo = objectMapper.readValue(configValue, Map.class);
                            }
                        }
                        log.info("-----------map的值为:{}", msgInfo);
                        String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), msgInfo.get("tokenUrl"));
                        if (ObjectUtils.isNotEmpty(msgInfo) && StringUtils.isEmpty(msgInfo.get("address"))) {
                            setSuccessPreachForm(serviceSubtask, sendPreachform, "短信发送失败,该机构没有配置短信地址", "5");
                            return;
                        }
                        log.info("【sfHandlle】丽水短信发送,地址:{},参数:{},机构ID:{}", map.get("address"), sendMagParam, serviceSubtask.getOrgid());
                        String dxCode = getDXCode(map.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), map.get("sendPersonId"), map.get("sendPersonName"), MsgLSEnum.getHeaderByCode(serviceSubtask.getOrgid()), token);
                        log.info("【sfHandlle】丽水短信发送,地址:{},参数:{},机构ID:{}", msgInfo.get("address"), sendMagParam, serviceSubtask.getOrgid());
                        String dxCode = getDXCode(msgInfo.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), msgInfo.get("sendPersonId"), msgInfo.get("sendPersonName"), MsgLSEnum.getHeaderByCode(msgInfo), token);
                        log.info("【sfHandlle】丽水短信发送结果:{}", dxCode);
                        ObjectMapper objectMapper = new ObjectMapper();
                        Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class);
@@ -676,7 +711,7 @@
                    } else if (active.equals("sltd")) {
                        log.info("sltd进来了吗?{}   ,---sendMagParam.getContent()的参数为:{}", active, sendMagParam.getContent());
                        //省立同德的短信发送方式
                        String data = MessageSend.sendMsg(sendMagParam.getContent(), "2", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
                        String data = MessageSend.sendMsg(sendMagParam.getContent(), "6", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
                        if (StringUtils.isNotEmpty(data) && data.contains("result=0")) {
                            isSuccess = "true";
                        }
@@ -804,6 +839,16 @@
    private String getSendPreachform(ServiceSubtaskPreachform serviceSubtaskPreachform, ServiceSubtask serviceSubtask) {
        List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
        if (CollectionUtils.isEmpty(serviceSubtaskPreachforms)) {
            //如果serviceSubtaskPreachforms为空的话,则需要进行新增一下
            List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = addServiceSubtaskPreachform(serviceSubtask, "1");
            if (CollectionUtils.isEmpty(serviceSubtaskPreachformList)) {
                log.error("ryTask--发送方式失败了serviceSubtask的入参为:{}", serviceSubtask);
                return null;
            }
            serviceSubtaskPreachforms = serviceSubtaskPreachformList;
        }
        // æƒ…况1:currentPreachform为空,取sort为1的preachform
        if (StringUtils.isEmpty(serviceSubtask.getCurrentPreachform())) {
            return serviceSubtaskPreachforms.stream().filter(item -> item.getSort() == 1L).map(ServiceSubtaskPreachform::getPreachform).findFirst().orElse(null);
@@ -850,6 +895,35 @@
        return null;
    }
    private List<ServiceSubtaskPreachform> addServiceSubtaskPreachform(ServiceSubtask serviceSubtask, String sendstate) {
        //将preachformDesc的json对象,放到list集合中
        ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
        String preachformDesc = serviceTask.getPreachformDesc();
        List<ServiceSubtaskPreachform> sspl = null;
        ObjectMapper objectMapper = new ObjectMapper();
        if (org.apache.commons.lang3.StringUtils.isNotEmpty(preachformDesc)) {
            try {
                sspl = objectMapper.readValue(preachformDesc, new TypeReference<List<ServiceSubtaskPreachform>>() {
                });
            } catch (JsonProcessingException e) {
                log.error("ryTask--preachform转List<ServiceSubtaskPreachform>报错了:{}", e.getMessage());
            }
            for (ServiceSubtaskPreachform serviceSubtaskPreachform : sspl) {
                serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
                serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
                //这个sendstate需要在数据库设置一个默认值为“1”
                serviceSubtaskPreachform.setSendstate("1");
                if (StringUtils.isNotEmpty(sendstate)) serviceSubtaskPreachform.setSendstate(sendstate);
                serviceSubtaskPreachform.setOrgid(serviceSubtask.getOrgid());
                serviceSubtaskPreachformMapper.insertServiceSubtaskPreachform(serviceSubtaskPreachform);
            }
        }
        return sspl;
    }
    private Integer setFail(List<ServiceSubtaskPreachform> serviceSubtaskPreachforms, ServiceSubtask serviceSubtask) {
        Optional<Long> id = serviceSubtaskPreachforms.stream().filter(item -> serviceSubtask.getCurrentPreachform().equals(item.getPreachform())).map(ServiceSubtaskPreachform::getId).findFirst();
        if (id.isPresent()) {
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.quartz.mapper.SysJobLogMapper">
    <resultMap type="SysJobLog" id="SysJobLogResult">
    <resultMap type="com.ruoyi.quartz.domain.SysJobLog" id="SysJobLogResult">
        <id     property="jobLogId"       column="job_log_id"      />
        <result property="jobName"        column="job_name"        />
        <result property="jobGroup"       column="job_group"       />
@@ -20,7 +20,7 @@
        from sys_job_log
    </sql>
    
    <select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult">
    <select id="selectJobLogList" parameterType="com.ruoyi.quartz.domain.SysJobLog" resultMap="SysJobLogResult">
        <include refid="selectJobLogVo"/>
        <where>
            <if test="jobName != null and jobName != ''">
@@ -68,7 +68,7 @@
        truncate table sys_job_log
    </update>
     
     <insert id="insertJobLog" parameterType="SysJobLog">
     <insert id="insertJobLog" parameterType="com.ruoyi.quartz.domain.SysJobLog">
         insert into sys_job_log(
             <if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
             <if test="jobName != null and jobName != ''">job_name,</if>
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SmsRecordsMapper.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.SmsRecords;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -10,8 +11,8 @@
 * @author smartor
 * @date 2023-03-06
 */
public interface SmsRecordsMapper
{
@Mapper
public interface SmsRecordsMapper {
    /**
     * æŸ¥è¯¢çŸ­ä¿¡è®°å½•
     *
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SmsRecordsServiceImpl.java
@@ -3,10 +3,7 @@
import java.io.IOException;
import java.sql.Date;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -16,11 +13,13 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.OkHttpExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.LSHospTokenUtil;
import com.smartor.domain.ServiceSubtask;
import com.smartor.mapper.ServiceSubtaskMapper;
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.stereotype.Service;
@@ -124,11 +123,25 @@
        //丽水的短信发送方式
        Boolean isSuccess = false;
        try {
            String url = configService.selectConfigByKey("token.360",orgid);
            Map<String, String> map = MsgLSEnum.getAddressByCode(orgid);
            String token = LSHospTokenUtil.getToken(orgid,url);
            log.info("【sfHandlle】丽水短信发送,地址:{},参数:{},机构ID:{}", map.get("address"), orgid);
            String dxCode = getDXCode(map.get("address"), phone, content, map.get("sendPersonId"), map.get("sendPersonName"), MsgLSEnum.getHeaderByCode(orgid), token);
            SysConfig config = new SysConfig();
            config.setConfigKey("ls.msg.info");
            config.setOrgid(orgid);
            List<SysConfig> sysConfigs = configService.selectConfigList(config);
            Map<String, String> msgInfo = new HashMap<>();
            if (CollectionUtils.isNotEmpty(sysConfigs)) {
                String configValue = sysConfigs.get(0).getConfigValue();
                ObjectMapper objectMapper = new ObjectMapper();
                if (StringUtils.isNotEmpty(configValue)) {
                    msgInfo = objectMapper.readValue(configValue, Map.class);
                }
            }
            log.info("-----------map的值为:{}", msgInfo);
//
//            String url = configService.selectConfigByKey("token.360",orgid);
//            Map<String, String> map = MsgLSEnum.getAddressByCode(orgid);
            String token = LSHospTokenUtil.getToken(orgid,msgInfo.get("tokenUrl"));
            log.info("【sfHandlle】丽水短信发送,地址:{},参数:{},机构ID:{}", msgInfo.get("address"), orgid);
            String dxCode = getDXCode(msgInfo.get("address"), phone, content, msgInfo.get("sendPersonId"), msgInfo.get("sendPersonName"), MsgLSEnum.getHeaderByCode(msgInfo), token);
            log.info("【sfHandlle】丽水短信发送结果:{}", dxCode);
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String, Object> textParam = null;
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
@@ -66,6 +66,9 @@
            <if test="configKey != null and configKey != ''">
                AND config_key like concat('%', #{configKey}, '%')
            </if>
            <if test="orgid != null and orgid != ''">
                AND orgid = #{orgid}
            </if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- å¼€å§‹æ—¶é—´æ£€ç´¢ -->
                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
smartor/src/main/java/com/smartor/common/LSHospTokenUtil.java
@@ -13,12 +13,13 @@
        if(ObjectUtils.isNotEmpty(url)){
            lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil(url, "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
            log.info("token.360调用结果"+url+";机构代码:"+orgid+"");
        }else {
            if (orgid.equals("47255004333112711A1001"))  //景宁
                lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil("https://9.0.124.104:13021/mediinfo-lyra-authserver/connect/token", "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
            if (orgid.equals("47231022633110211A2101"))  //中医院
                lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil("https://9.0.124.104:13011/mediinfo-lyra-authserver/connect/token", "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
        }
//        else {
//            if (orgid.equals("47255004333112711A1001"))  //景宁+
//                lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil("https://9.0.124.104:13021/mediinfo-lyra-authserver/connect/token", "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
//            if (orgid.equals("47231022633110211A2101"))  //中医院
//                lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil("https://9.0.124.104:13011/mediinfo-lyra-authserver/connect/token", "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
//        }
        try {
            token = lyraTokenUtil.getToken();
        } catch (IOException e) {
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -37,6 +37,13 @@
    private Long scriptno;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long assortid;
    /**
     * é€‰é¡¹åˆ†æ”¯æ ‡è¯†(0:无分支1:有分支)
     */
    @Excel(name = "选项分支标识(0:无分支1:有分支)")
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -35,6 +35,7 @@
    @ApiModelProperty(value = "模板话术编号")
    private Long scriptno;
    /**
     * æ¨¡æ¿ID
     */
@@ -181,6 +182,13 @@
    @ApiModelProperty(value = "类别名")
    private String categoryName;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long assortid;
//    /**
//     * æŒ‡æ ‡é€‰é¡¹
//     */
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScript.java
@@ -151,6 +151,13 @@
    private String categoryName;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long assortid;
    /**
     * æŒ‡æ ‡é€‰é¡¹
     */
    @Excel(name = "指标选项")
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
@@ -180,6 +180,12 @@
    private String categoryName;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long assortid;
    /**
     * æŒ‡æ ‡é€‰é¡¹
     */
    @Excel(name = "指标选项")
smartor/src/main/java/com/smartor/domain/PatMedInhosp.java
@@ -278,7 +278,7 @@
    /**
     * ä½é™¢æ ‡è¯†ï¼š 0:在院  1:出院    2:转科
     */
    @ApiModelProperty(value = "住院标识: 0:在院  1:出院    2:转科")
    @ApiModelProperty(value = "住院标识: 0:在院  1:出院    2:转科  3待入院")
    private String inhospstate;
    /**
smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java
@@ -211,6 +211,12 @@
    @ApiModelProperty(value = "疾病长期任务,是否处理:0未处理   1处理成功    2处理失败 ")
    private String diagcheckFlag;
    /**
     * éƒ¨é—¨é•¿æœŸä»»åŠ¡ï¼Œæ˜¯å¦å¤„ç†ï¼š0未处理   1处理
     */
    @ApiModelProperty(value = "部门长期任务,是否处理:0未处理   1处理成功    2处理失败 ")
    private String deptcheckFlag;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "  ", width = 30, dateFormat = "yyyy-MM-dd")
smartor/src/main/java/com/smartor/domain/PatTaskRelevance.java
@@ -234,6 +234,13 @@
    @ApiModelProperty("就诊类型(1门诊  2出院)")
    private String hospType;
    /**
     * å°±è¯Šç±»åž‹ï¼ˆ1门诊  2出院)
     */
    @Excel(name = "就诊id(1门诊  2出院)")
    @ApiModelProperty("就诊id(1门诊  2出院)")
    private Long hospid;
    /**
     * æŽ¥æ”¶æ—¶é—´
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -647,9 +647,9 @@
    @ApiModelProperty(value = "经管医生")
    private String managementDoctor;
    @ApiModelProperty(value = "随访情况:1正常语音,2患者拒接或拒访,3面访或者接诊,4微信随访,5随访电话不正确,6其他")
    @ApiModelProperty(value = "随访情况:1正常语音,2患者拒接或拒访,3面访或者接诊,4微信随访,5随访电话不正确,6被过滤,7其它")
    private Integer taskSituation;
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色; 3已处理")
    private Integer isabnormal;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -55,4 +55,11 @@
    @ApiModelProperty(value = "医生编码")
    private String drcode;
    @ApiModelProperty(value = "语音分类编码")
    private Long ivrCategoryid;
    @ApiModelProperty(value = "问卷分类编码")
    private Long svyCategoryid;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetail.java
@@ -112,6 +112,13 @@
    @ApiModelProperty(value = "类别")
    private String categoryname;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long categoryid;
    @ApiModelProperty(value = "指标ID(从问题上获取)")
    private Integer targetid;
smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailVO.java
@@ -163,6 +163,12 @@
    @ApiModelProperty(value = "患者ID")
    private Long patid;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long categoryid;
    private List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskDiagname.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
package com.smartor.domain;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * ç–¾ç—…获取患者信息
 *
 * @author ruoyi
 * @date 2024-12-11
 */
@ApiModel(value = "ServiceSubtaskDiagname", description = "")
@Data
public class ServiceSubtaskDiagname implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "服务名称")
    private String taskName;
    @ApiModelProperty(value = "患者姓名")
    private String sendname;
    @ApiModelProperty(value = "电话")
    private String phone;
    @ApiModelProperty(value = "性别")
    private String sex;
    @ApiModelProperty(value = "疾病名称")
    private String leavediagname;
    @ApiModelProperty(value = "随访状态")
    private Long sendstate;
    @ApiModelProperty(value = "入院时间")
    private Date starttime;
    @ApiModelProperty(value = "出院时间")
    private Date endtime;
    @ApiModelProperty(value = "随访时间")
    private Date visitTime;
    @ApiModelProperty(value = "护士姓名")
    private String nurseName;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
@@ -5,6 +5,9 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * å„病区随访统计比例
 *
@@ -13,7 +16,7 @@
 */
@ApiModel(value = "ServiceSubtaskStatistic", description = "各病区随访统计比例")
@Data
public class ServiceSubtaskStatistic {
public class ServiceSubtaskStatistic implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "服务总量")
@@ -90,6 +93,10 @@
    @ApiModelProperty(value = "无需随访人次")
    @Excel(name = " æ— éœ€éšè®¿äººæ¬¡ ")
    private Long nonFollowUp = 0L;
    @ApiModelProperty(value = "过滤患者")
    @Excel(name = " è¿‡æ»¤æ‚£è€… ")
    private Long filterCount = 0L;
    @ApiModelProperty(value = "应随访人次")
    @Excel(name = " åº”随访人次 ")
@@ -187,7 +194,7 @@
    private Integer joyAllCount=0;
    @ApiModelProperty(value = "满意度比例")
    private String joyTotal="";
    private Double joyTotal = 0.00;
    @ApiModelProperty(value = "随访情况:1正常语音")
    private Integer taskSituation1 = 0;
@@ -204,7 +211,10 @@
    @ApiModelProperty(value = "随访情况:5随访电话不正确")
    private Integer taskSituation5 = 0;
    @ApiModelProperty(value = "随访情况:6其他")
    @ApiModelProperty(value = "随访情况:7其他")
    private Integer taskSituation6 = 0;
    @ApiModelProperty(value = "过滤患者详情")
    private List<ServiceSubtask> filterCountList;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
@@ -729,7 +729,7 @@
    @ApiModelProperty(value = "随访部门名称")
    private String visitDeptName;
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色;3已处理")
    private Integer isabnormal;
    @ApiModelProperty(value = "随访部门编码集合")
smartor/src/main/java/com/smartor/domain/ServiceTaskdiag.java
@@ -7,20 +7,20 @@
import lombok.Data;
/**
 * æ¨¡æ¿ç§‘室关联对象 service_taskdiag
 * æ¨¡æ¿ç–¾ç—…关联对象 service_taskdiag
 *
 * @author lihu
 * @date 2025-02-24
 */
@Data
@ApiModel("模板科室关联")
@ApiModel("模板疾病关联")
public class ServiceTaskdiag extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * æ¨¡æ¿åº“和科室关联id
     */
    @ApiModelProperty("模板库和科室关联id")
    @ApiModelProperty("模板库和疾病关联id")
    //数据库自增改成@TableId(type = IdType.AUTO)
    private Long id;
smartor/src/main/java/com/smartor/domain/SvyLibTemplateScript.java
@@ -156,7 +156,6 @@
    @Excel(name = "分类id")
    @ApiModelProperty("分类id")
    private Long categoryid;
    /**
     * é¢˜ç›®å†…容
     */
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScript.java
@@ -89,6 +89,12 @@
    private String categoryName;
    /**
     * ç±»åˆ«ID
     */
    @Excel(name = "类别ID")
    @ApiModelProperty(value = "类别ID")
    private Long categoryid;
    /**
     * è¯æœ¯å†…容
     */
    @ApiModelProperty(value = "话术内容")
smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
@@ -43,6 +43,14 @@
    public int batchPatMedOuthosp(List<PatMedOuthosp> patMedOuthosps);
    /**
     * æ‰¹é‡æ’入,忽略重复(INSERT IGNORE)
     *
     * @param patMedOuthosps é—¨æ€¥è¯Šè®°å½•列表
     * @return å®žé™…插入数量
     */
    public int batchInsertIgnore(List<PatMedOuthosp> patMedOuthosps);
    /**
     * ä¿®æ”¹æ‚£è€…门诊记录
     *
     * @param patMedOuthosp æ‚£è€…门诊记录
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -31,6 +31,8 @@
     */
    public List<ServiceSubtask> selectServiceSubtaskList(ServiceSubtaskVO serviceSubtaskVO);
    public List<ServiceSubtask> selectServiceSubtaskByDiagname(ServiceSubtask serviceSubtask);
    public List<ServiceSubtask> queryServiceSubtaskList(ServiceSubtaskVO serviceSubtaskVO);
    public List<ServiceSubtask> selectServiceSubtaskBySendstate(ServiceSubtaskVO serviceSubtaskVO);
smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
@@ -90,7 +90,7 @@
     * @param
     * @return ç»“æžœ
     */
    public int dealOutHospInfo();
    public int dealOutHospInfo(String config);
    /**
     * èŽ·å–å‡ºé™¢ï¼Œä½é™¢ï¼Œé—¨è¯ŠæœåŠ¡äººæ¬¡
smartor/src/main/java/com/smartor/service/IServiceSLTDHealthcareRecordService.java
@@ -1,10 +1,12 @@
package com.smartor.service;
import afu.org.checkerframework.checker.oigj.qual.O;
import com.smartor.domain.ServiceSLTDDeptReqVO;
import com.smartor.domain.ServiceSLTDInhospReqVO;
import com.smartor.domain.ServiceSLTDInhospResDTO;
import java.util.List;
import java.util.Map;
/**
 * çœç«‹åŒå¾·å¥åº·è®°å½•查询Service接口
@@ -69,5 +71,7 @@
     */
    Boolean queryDeptWardAreaInfoList(ServiceSLTDDeptReqVO serviceSLTDDeptReqVO);
    public void aa(Map<String, Object> map);
}
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -23,6 +23,8 @@
     */
    public ServiceSubtask selectServiceSubtaskById(Long id);
    public List<ServiceSubtask> selectServiceSubtaskByDiagname(ServiceSubtask serviceSubtask);
    /**
     * æŸ¥è¯¢å•一任务(随访)列表
     *
@@ -128,6 +130,8 @@
    public List<ServiceSubtaskCount> getSfFzInfoEveryMonth(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    //导出随访
    public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtaskStatistic> getSfStatisticsJoy(ServiceSubtaskCountReq serviceSubtaskCountReq);
smartor/src/main/java/com/smartor/service/IXHGatherPatArchiveService.java
@@ -1,11 +1,6 @@
package com.smartor.service;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.smartor.domain.*;
import java.time.LocalDateTime;
import java.util.List;
/**
 * æ²³å—采集患者信息接口
smartor/src/main/java/com/smartor/service/impl/IvrTaskTemplateServiceImpl.java
@@ -139,7 +139,7 @@
        //对模板话术和选项进行处理(话术表与指标表进行合并了,)
        if (CollectionUtils.isNotEmpty(ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList())) {
            log.error("ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList()是否有数据哈:{}", ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList());
//            log.error("ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList()是否有数据哈:{}", ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList());
            for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList()) {
                ivrTaskTemplateScriptVO.setGuid(ivrTaskTemplateVO.getGuid());
                ivrTaskTemplateScriptVO.setOrgid(ivrTaskTemplateVO.getOrgid());
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -792,9 +792,9 @@
        } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 4) {
            //  æŸ¥çœ‹ä½é™¢  1  æŸ¥çœ‹é—¨è¯Š  2   æŸ¥çœ‹ä½“检  3   æŸ¥çœ‹å‡ºé™¢ 4
            patArchiveReq.setCry(1);
            log.warn("--------查看出院的入参值为:{}", patArchiveReq);
            log.info("--------查看出院的入参值为:{}", patArchiveReq);
            List<PatArchiveOthreInfo> patArchives1 = patArchiveMapper.selectPatArchiveInfoByInhospQC(patArchiveReq);
            log.warn("--------查看出院的返参值为:{}", patArchives1.size());
            log.info("--------查看出院的返参值为:{}", patArchives1.size());
            if (CollectionUtils.isNotEmpty(patArchives1)) {
                patArchiveList.addAll(patArchives1);
            }
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -33,13 +33,10 @@
public class PatMedInhospServiceImpl implements IPatMedInhospService {
    @Autowired
    private PatMedInhospMapper patMedInhospMapper;
    @Autowired
    private ServiceTaskdeptMapper serviceTaskdeptMapper;
    @Autowired
    private ServiceTaskdiagMapper serviceTaskdiagMapper;
    @Autowired
    private PatArchiveMapper patArchiveMapper;
    @Autowired
@@ -50,7 +47,6 @@
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private ServiceSubtaskPreachformMapper serviceSubtaskPreachformMapper;
    @Value("${spring.profiles.active}")
    private String active;
@@ -213,7 +209,7 @@
    }
    @Override
    public int dealOutHospInfo() {
    public int dealOutHospInfo(String config) {
        PatMedInhosp pmks = new PatMedInhosp();
        //获取需要出院部门随访,未处理的数据
@@ -253,7 +249,7 @@
                    patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
                } else {
                    for (ServiceTaskdept serviceTaskdept1 : serviceTaskdepts) {
                        writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedInhosp1, patArchive, 1);
                        writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedInhosp1, patArchive, 1, config);
                    }
                    patMedInhosp1.setDeptcheckFlag("1");
                    patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
@@ -304,7 +300,7 @@
                        patMedInhospMapper.updatePatMedInhosp(pmiBQ1);
                    } else {
                        for (ServiceTaskdept serviceTaskdept1 : serviceTaskdeptList) {
                            writeInSubTask(serviceTaskdept1.getTaskId(), true, pmiBQ1, patArchive, 2);
                            writeInSubTask(serviceTaskdept1.getTaskId(), true, pmiBQ1, patArchive, 2, config);
                        }
                        pmiBQ1.setWardcheckFlag("1");
                        patMedInhospMapper.updatePatMedInhosp(pmiBQ1);
@@ -357,7 +353,7 @@
                        patMedInhospMapper.updatePatMedInhosp(pmiJB);
                    } else {
                        for (ServiceTaskdiag serviceTaskdept1 : serviceTaskdiags) {
                            writeInSubTask(serviceTaskdept1.getTaskId(), true, pmiJB, patArchive, 3);
                            writeInSubTask(serviceTaskdept1.getTaskId(), true, pmiJB, patArchive, 3, config);
                        }
                        pmiJB.setDiagcheckFlag("1");
                        patMedInhospMapper.updatePatMedInhosp(pmiJB);
@@ -541,7 +537,7 @@
    }
    //将患者放到subtask中
    private void writeInSubTask(Long taskid, Boolean check, PatMedInhosp patMedInhosp1, PatArchive patArchive, Integer type) {
    private void writeInSubTask(Long taskid, Boolean check, PatMedInhosp patMedInhosp1, PatArchive patArchive, Integer type, String config) {
        String longTaskReason = patMedInhosp1.getLongTaskReason();
        if (StringUtils.isEmpty(longTaskReason)) longTaskReason = "";
        ServiceTask st = new ServiceTask();
@@ -571,7 +567,7 @@
            return;
        }
        //封装serviceSubtask
        ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, patMedInhosp1, patArchive);
        ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, patMedInhosp1, patArchive, config);
        if (type != 2) {
            //科室和疾病 éƒ½ç”¨ ç§‘室填充
            serviceSubtask.setVisitDeptCode(patMedInhosp1.getLeaveldeptcode());
@@ -584,7 +580,7 @@
        Integer i = 0;
        //先判断一下,是否需要校验
        if (check) {
        if (check && serviceSubtask.getTaskSituation() != 6) {
            //在新增之前,先通过患者ID,sendstate=2查询一下,在所有长期任务中,是不是还有该患者待执行的任务,有的话,比较之前的endtime是否小于当前的endtaime,如果之前的小于现在的,则直接将之前的停掉(原因再入院)
            ServiceSubtaskVO subtask = new ServiceSubtaskVO();
            subtask.setPatid(patArchive.getId());
@@ -603,7 +599,9 @@
                        if (serviceSubtask1.getEndtime().before(serviceSubtask.getEndtime()) && serviceSubtask1.getServiceType().equals("2")) {
                            //如果当前循环的子任务的出院时间在“准备新增的子任务”的出院时间之前,则将循环的子任务停掉
                            serviceSubtask1.setSendstate(4L);
                            serviceSubtask1.setRemark("患者再入院");
                            if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
                                serviceSubtask.setRemark(serviceSubtask.getRemark() + ",疾病患者再入院");
                            else serviceSubtask.setRemark("疾病患者再入院");
                            serviceSubtask1.setResult("error");
//                            serviceSubtask1.setFinishtime(new Date());
                            serviceSubtask1.setUpdateBy(serviceTask.getUpdateBy());
@@ -615,7 +613,9 @@
                            serviceSubtask.setResult("error");
//                            serviceSubtask.setFinishtime(new Date());
                            serviceSubtask.setSendstate(4L);
                            serviceSubtask.setRemark("当前患者出院时间后有待执行的出院随访长期任务");
                            if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
                                serviceSubtask.setRemark(serviceSubtask.getRemark() + ",当前患者出院时间后有待执行的出院随访长期任务");
                            else serviceSubtask.setRemark("当前患者出院时间后有待执行的出院随访长期任务");
                            serviceSubtask.setCreateBy(serviceTask.getCreateBy());
                            serviceSubtask.setCreateTime(new Date());
                            i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
@@ -624,7 +624,9 @@
                        //type=3 è¡¨ç¤ºç–¾ç—…
                        //将之前的停掉
                        serviceSubtask1.setSendstate(4L);
                        serviceSubtask1.setRemark("疾病患者再入院");
                        if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
                            serviceSubtask.setRemark(serviceSubtask.getRemark() + ",疾病患者再入院");
                        else serviceSubtask.setRemark("疾病患者再入院");
                        serviceSubtask1.setResult("error");
//                        serviceSubtask1.setFinishtime(new Date());
                        serviceSubtask1.setUpdateBy(serviceTask.getUpdateBy());
@@ -638,7 +640,9 @@
                }
            } else {
                if (StringUtils.isEmpty(serviceSubtask.getPhone())) {
                    serviceSubtask.setRemark("手机号为空");
                    if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
                        serviceSubtask.setRemark(serviceSubtask.getRemark() + ",手机号为空");
                    else serviceSubtask.setRemark("手机号为空");
                    serviceSubtask.setSendstate(4L);
                    serviceSubtask.setResult("error");
                }
@@ -647,9 +651,16 @@
                i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
                addServiceSubtaskPreachform(serviceSubtask, null);
            }
        } else if (serviceSubtask.getTaskSituation() == 6) {
            //说明该患者是被过滤的,不用再执行了
            serviceSubtask.setCreateBy(serviceTask.getCreateBy());
            serviceSubtask.setCreateTime(new Date());
            i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
        } else {
            if (StringUtils.isEmpty(serviceSubtask.getPhone())) {
                serviceSubtask.setRemark("手机号为空");
                if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
                    serviceSubtask.setRemark(serviceSubtask.getRemark() + ",手机号为空");
                else serviceSubtask.setRemark("手机号为空");
                serviceSubtask.setSendstate(4L);
                serviceSubtask.setResult("error");
            }
@@ -697,6 +708,11 @@
            for (ServiceSubtaskPreachform serviceSubtaskPreachform : serviceSubtaskPreachformList) {
                serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
                serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
                //先查询一下,是否存在,如果已经存在,就不新增了
                List<ServiceSubtaskPreachform> serviceSubtaskPreachformList1 = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
                if (CollectionUtils.isNotEmpty(serviceSubtaskPreachformList1)) continue;
                //这个sendstate需要在数据库设置一个默认值为“1”
                serviceSubtaskPreachform.setSendstate("1");
                if (StringUtils.isNotEmpty(sendstate)) serviceSubtaskPreachform.setSendstate(sendstate);
@@ -712,7 +728,7 @@
    //封装serviceSubtask
    private ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatArchive patArchive) {
    private ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatArchive patArchive, String config) {
        ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
        serviceSubtask.setTaskid(serviceTask.getTaskid());
        if (StringUtils.isNotEmpty(serviceTask.getLibtemplateid()))
@@ -761,17 +777,21 @@
        }
        serviceSubtask.setLongSendTime(newDate);
        serviceSubtask.setVisitTime(newDate);
        if (patMedInhosp1.getFudate() != null) serviceSubtask.setVisitTime(patMedInhosp1.getFudate());
        //如果是通知的话,需要提前几天将通过短信发出去(具体几天,这个可以配置在sys_conf表中)
        if ("3".equals(serviceTask.getType())) {
            serviceSubtask.setVisitTime(minusDay(newDate, 2));
            serviceSubtask.setVisitTime(minusDay(newDate, StringUtils.isNotEmpty(config) ? Integer.parseInt(config) : 0));
            //如果该出院记录有随访时间,则用他自己的随访时间
            if (patMedInhosp1.getFudate() != null)
                serviceSubtask.setVisitTime(minusDay(patMedInhosp1.getFudate(), StringUtils.isNotEmpty(config) ? Integer.parseInt(config) : 0));
        }
        //患者发送时间
        if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) {
            String remark = patArchive.getNotrequiredreason();
            serviceSubtask.setRemark(remark);
            serviceSubtask.setResult("error");
            serviceSubtask.setTaskSituation(6);
            //不执行
            serviceSubtask.setSendstate(4L);
        }
smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
@@ -17,6 +17,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.smartor.service.IPatMedOuthospService;
import org.springframework.util.CollectionUtils;
@@ -46,6 +47,9 @@
    private ServiceTaskdiagMapper serviceTaskdiagMapper;
    @Autowired
    private ServiceTaskdeptMapper serviceTaskdeptMapper;
    @Autowired
    private PatArchiveMapper patArchiveMapper;
@@ -67,6 +71,7 @@
     * @return æ‚£è€…门诊记录
     */
    @Override
    @Cacheable(value = "selectPatMedOuthospList", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#patMedOuthosp.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
    public List<PatMedOuthosp> selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) {
        List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(patMedOuthosp);
        for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
@@ -81,6 +86,16 @@
                patMedOuthosp1.setTelcode(patArchive.getTelcode());
                patMedOuthosp1.setIdcardno(patArchive.getIdcardno());
            }
            ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
            serviceSubtaskVO.setPatid(patMedOuthosp1.getPatid());
            List<Long> sendstates = new ArrayList<>();
            sendstates.add(1L);
            sendstates.add(2L);
            sendstates.add(3L);
            serviceSubtaskVO.setSendstates(sendstates);
            serviceSubtaskVO.setServiceType("3");
            List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO);
            if (!CollectionUtils.isEmpty(serviceSubtaskList)) patMedOuthosp1.setServerState("1");
        }
        return patMedOuthosps;
    }
@@ -221,21 +236,19 @@
        for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) {
            PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp1.getPatid());
            //该患者有可能提前来复诊了,那他后面的本科室的通知就可以不用再发短信了
            ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
            if (StringUtils.isNotEmpty(patMedOuthosp1.getDeptcode())) {
                serviceSubtaskVO.setDeptcode(patMedOuthosp1.getDeptcode());
                serviceSubtaskVO.setSfzh(patArchive.getIdcardno());
                serviceSubtaskVO.setType("3");
                serviceSubtaskVO.setSendstate(2L);
                serviceSubtaskVO.setPreachform("4");
                List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
                if (!CollectionUtils.isEmpty(serviceSubtaskList)) {
                    for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
                        serviceSubtask.setSendstate(6L);
                        serviceSubtask.setRemark("已回来复诊,无需再进行短信通知");
                        serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                    }
            //根据患者科室,获取该疾病的长期任务
            ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
            serviceTaskdept.setLongtask(1L);
            serviceTaskdept.setDeptCode(patMedOuthosp1.getDeptcode());
            serviceTaskdept.setServiceType("3");
            List<ServiceTaskdept> serviceTaskdeptList = serviceTaskdeptMapper.selectServiceTaskdeptList(serviceTaskdept);
            if (org.apache.commons.collections4.CollectionUtils.isEmpty(serviceTaskdeptList) || serviceTaskdeptList.size() == 0) {
                patMedOuthosp1.setDeptcheckFlag("2");
                patMedOuthosp1.setRemark("通过部门,没有找到门诊随访任务ID");
                patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
            } else {
                for (ServiceTaskdept serviceTaskdept1 : serviceTaskdeptList) {
                    writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedOuthosp1, patArchive, 1);
                }
            }
@@ -247,11 +260,11 @@
            //如果部门模板为空(将deptIsNull设置为true)
            if (org.apache.commons.collections4.CollectionUtils.isEmpty(serviceTaskdiags) || serviceTaskdiags.size() == 0) {
                patMedOuthosp1.setDiagcheckFlag("2");
                patMedOuthosp1.setRemark("通过icd10,没有找到随访任务ID");
                patMedOuthosp1.setRemark("通过icd10,没有找到门诊随访任务ID");
                patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
            } else {
                for (ServiceTaskdiag serviceTaskdept1 : serviceTaskdiags) {
                    writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedOuthosp1, patArchive);
                    writeInSubTask(serviceTaskdept1.getTaskId(), true, patMedOuthosp1, patArchive, 2);
                }
            }
@@ -259,16 +272,24 @@
        return 1;
    }
    private void writeInSubTask(Long taskid, Boolean check, PatMedOuthosp patMedOuthosp, PatArchive patArchive) {
    /**
     * @param taskid
     * @param check
     * @param patMedOuthosp
     * @param patArchive
     * @param type          1 ç§‘室 2 ç–¾ç—…
     */
    private void writeInSubTask(Long taskid, Boolean check, PatMedOuthosp patMedOuthosp, PatArchive patArchive, Integer type) {
        ServiceTask st = new ServiceTask();
        st.setTaskid(taskid);
        st.setSendState(2L);
        List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st);
        if (org.apache.commons.collections4.CollectionUtils.isEmpty(serviceTasks)) {
            log.error("该患者疾病随访长期任务不存在,任务ID为:{}", taskid);
            patMedOuthosp.setDiagcheckFlag("2");
            patMedOuthosp.setRemark("该患者疾病随访长期任务不存在,任务ID为:" + taskid);
            log.info("该患者疾病随访长期任务不存在,任务ID为:{}", taskid);
            if (type == 1) patMedOuthosp.setDiagcheckFlag("2");
            if (type == 2) patMedOuthosp.setDeptcheckFlag("2");
            patMedOuthosp.setRemark("该患者门诊随访长期任务不存在,任务ID为:" + taskid);
            patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp);
            return;
        }
@@ -284,7 +305,7 @@
            subtask.setSendstate(2L);
            subtask.setTaskid(taskid);
            List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(subtask);
            log.error("该患者待执行的任务:{}", CollectionUtils.isEmpty(selectServiceSubtaskList) ? null : selectServiceSubtaskList.size());
            log.info("该患者待执行的任务:{}", CollectionUtils.isEmpty(selectServiceSubtaskList) ? null : selectServiceSubtaskList.size());
            if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(selectServiceSubtaskList) && selectServiceSubtaskList.size() > 0) {
                for (ServiceSubtask serviceSubtask1 : selectServiceSubtaskList) {
                    if (Objects.isNull(serviceSubtask1.getLongSendTime())) {
@@ -293,15 +314,14 @@
                    }
                    //将之前的停掉
                    serviceSubtask1.setSendstate(4L);
                    serviceSubtask1.setRemark("疾病患者再入院");
                    serviceSubtask1.setResult("error");
//                    serviceSubtask1.setFinishtime(new Date());
                    serviceSubtask1.setSendstate(6L);
                    serviceSubtask1.setRemark("患者已经回院复诊");
                    serviceSubtask1.setResult("success");
                    serviceSubtask1.setFinishtime(new Date());
                    serviceSubtask1.setUpdateBy(serviceTask.getUpdateBy());
                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
                    //重新新增子任务
                    i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
                }
            } else {
                if (StringUtils.isEmpty(serviceSubtask.getPhone())) {
@@ -330,14 +350,16 @@
            //将check_flag改成1(已处理)
            PatMedOuthosp patMedOuthosp1 = new PatMedOuthosp();
            patMedOuthosp1.setId(patMedOuthosp.getId());
            patMedOuthosp1.setDiagcheckFlag("1");
            if (type == 1) patMedOuthosp1.setDiagcheckFlag("2");
            if (type == 2) patMedOuthosp1.setDeptcheckFlag("2");
            patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
        } else {
            //生成子任务失败,
            log.error("生成子任务失败serviceSubtask的taskid为:{},patid为:{}", serviceSubtask.getTaskid(), serviceSubtask.getPatid());
            log.info("生成子任务失败serviceSubtask的taskid为:{},patid为:{}", serviceSubtask.getTaskid(), serviceSubtask.getPatid());
            PatMedOuthosp pmo = new PatMedOuthosp();
            pmo.setId(patMedOuthosp.getId());
            pmo.setDiagcheckFlag("2");
            if (type == 1) pmo.setDiagcheckFlag("2");
            if (type == 2) pmo.setDeptcheckFlag("2");
            pmo.setRemark("生成子任务失败");
            patMedOuthospMapper.updatePatMedOuthosp(pmo);
        }
@@ -352,6 +374,8 @@
        serviceSubtask.setDrcode(patMedOuthosp.getDrcode());
        serviceSubtask.setDrname(patMedOuthosp.getDrname());
        serviceSubtask.setDeptcode(patMedOuthosp.getDeptcode());
        serviceSubtask.setInhospid(patMedOuthosp.getId());
        serviceSubtask.setHospno(patMedOuthosp.getOuthospno());
        serviceSubtask.setDeptname(patMedOuthosp.getDeptname());
        serviceSubtask.setTemplateid(serviceTask.getTemplateid());
        serviceSubtask.setTemplatename(serviceTask.getTemplatename());
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -1,12 +1,13 @@
package com.smartor.service.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.SysUserDept;
import com.ruoyi.common.core.domain.entity.SysUserRole;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.smartor.domain.*;
@@ -14,21 +15,21 @@
import com.smartor.service.IPatArchiveService;
import com.smartor.service.IPatMedInhospService;
import com.smartor.service.IServiceSLTDHealthcareRecordService;
import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service
@@ -58,6 +59,9 @@
    @Autowired
    private SysUserRole2Mapper sysUserRoleMapper;
    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    @Value("${sltd_pub_path}")
    private String sltdPubPath;
@@ -67,15 +71,15 @@
    @Override
    public List<ServiceSLTDInhospResDTO> queryHealthcareRecordList(ServiceSLTDInhospReqVO reqVO) {
        try {
            log.info("【queryHealthcareRecordList】开始调用省立同德健康记录查询接口,请求参数:{}", reqVO);
            Map<String, Object> requestParams = buildRequestParams(reqVO);
            Map<String, String> headers = buildRequestHeaders();
            String result = HttpUtils.sendPostByHeader(sltdPubPath + "osj/hbos-thirdparty-integration/standard/common/healthcareRecord/dtcQueryHealthcareRecordList", new Gson().toJson(requestParams), headers);
            log.info("【queryHealthcareRecordList】接口响应结果:{}", result);
            String cry = determineCry(reqVO);
            return parseResponseData(result, reqVO.getHealthcareRecordTypeList(), cry, reqVO.getCampusId());
            log.info("cry的值为:{}", cry);
            List<ServiceSLTDInhospResDTO> serviceSLTDInhospResDTOS = parseResponseData(result, CollectionUtils.isNotEmpty(reqVO.getStatusList()) ? reqVO.getStatusList() : reqVO.getHealthcareRecordTypeList(), cry, reqVO.getCampusId() != null ? reqVO.getCampusId().toString() : null);
            log.info("serviceSLTDInhospResDTOS是否返回的有值:{}", CollectionUtils.isNotEmpty(serviceSLTDInhospResDTOS) ? "有" : "没有");
            return serviceSLTDInhospResDTOS;
        } catch (Exception e) {
            log.error("【queryHealthcareRecordList】调用省立同德健康记录查询接口异常,请求参数:{}", reqVO, e);
            throw new RuntimeException("调用省立同德健康记录查询接口失败", e);
@@ -120,7 +124,7 @@
            Map<String, String> headers = buildRequestHeaders();
            String result = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/dept/queryDeptList", new Gson().toJson(params), headers);
            log.info("【queryDeptWardAreaInfoList】接口响应结果:{}", result);
            log.info("【queryDeptWardAreaInfoList】接口响应结果:{}", StringUtils.isEmpty(result) ? "空的" : "不空");
            List<Map<String, Object>> dataList = getDataList(result);
            log.info("-----------dataList接口响应结果:{}", dataList.size());
            for (Map<String, Object> dataItem : dataList) {
@@ -172,6 +176,20 @@
        return true;
    }
    @Override
    public void aa(Map<String, Object> map) {
        List<String> types = new ArrayList<>();
        types.add("FH0109.27");
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            String jsonString = objectMapper.writeValueAsString(map);
            parseResponseData(jsonString, types, "1", "20001001");
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
    }
    /**
     * é‡‡é›†åŒ»é™¢ç”¨æˆ·ä¿¡æ¯
@@ -184,7 +202,7 @@
        Map<String, Object> requestParams = buildRequestParams(reqVO);
        Map<String, String> headers = buildRequestHeaders();
        String result = HttpUtils.sendPostByHeader(sltdPubPath + "/osj/hbos-thirdparty-integration/standard/common/staff/queryStaffList", new Gson().toJson(requestParams), headers);
        log.info("【queryHealthcareRecordList】接口响应结果:{}", result);
        log.info("【queryHealthcareRecordList】接口响应结果是否有值:{}", StringUtils.isEmpty(result) ? "没值" : "有值");
        List<Map<String, Object>> dataList = getDataList(result);
        for (Map<String, Object> dataItem : dataList) {
            SysUser sysUser = new SysUser();
@@ -314,12 +332,17 @@
    }
    private String determineCry(ServiceSLTDInhospReqVO reqVO) {
        if (reqVO.getHealthcareRecordTypeList().contains("FH0108.02")) {
            if (reqVO.getStartHeadTime() != null && reqVO.getStartTailTime() != null) {
        if (CollectionUtils.isEmpty(reqVO.getStatusList())) return null;
        if (reqVO.getStatusList().contains("FH0109.26")) {
            //入院
                return "0";
            } else if (StringUtils.isNotEmpty(reqVO.getPreOutHospitalHeadDate()) && StringUtils.isNotEmpty(reqVO.getPreOutHospitalTailDate())) {
        } else if (reqVO.getStatusList().contains("FH0109.27")) {
            //出院
                return "1";
            }
        } else if (reqVO.getStatusList().contains("FH0109.22") || reqVO.getStatusList().contains("FH0109.23") || reqVO.getStatusList().contains("FH0109.53")) {
            //预入院
            return "3";
        }
        return null;
    }
@@ -353,6 +376,9 @@
        if (reqVO.getHealthcareRecordTypeList() != null && !reqVO.getHealthcareRecordTypeList().isEmpty()) {
            params.put("healthcareRecordTypeList", reqVO.getHealthcareRecordTypeList());
        }
        if (reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty()) {
            params.put("statusList", reqVO.getStatusList());
        }
        params.put("subjectCode", reqVO.getPatientName());
        params.put("healthcareRecordNo", reqVO.getHealthcareRecordNo());
        params.put("orgSubjectCode", reqVO.getIdCardNo());
@@ -361,7 +387,8 @@
        }
        params.put("serviceScopes", null);
        params.put("inpatientArea", null);
        params.put("status", reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty() ? reqVO.getStatusList().get(0) : null);
//        params.put("status", reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty() ? reqVO.getStatusList().get(0) : null);
        params.put("status", null);
        return params;
    }
@@ -372,9 +399,8 @@
        return headers;
    }
    private List<ServiceSLTDInhospResDTO> parseResponseData(String result, List<String> types, String cry, Long orgid) {
    private List<ServiceSLTDInhospResDTO> parseResponseData(String result, List<String> types, String cry, String campusId) {
        try {
            List<Map<String, Object>> dataList = getDataList(result);
            List<ServiceSLTDInhospResDTO> resultList = new ArrayList<>();
            for (Map<String, Object> dataItem : dataList) {
@@ -382,7 +408,7 @@
            }
            log.info("【parseResponseData】成功解析{}条健康记录数据", resultList.size());
            processResultList(resultList, types, cry, orgid);
            processResultList(resultList, types, cry, campusId);
            return resultList;
        } catch (Exception e) {
            log.error("【parseResponseData】解析响应数据异常,响应内容:{}", result, e);
@@ -412,48 +438,83 @@
        Type listType = new TypeToken<List<Map<String, Object>>>() {
        }.getType();
        List<Map<String, Object>> dataList = gson.fromJson(dataJson, listType);
        // ä½¿ç”¨ Set åŽ»é‡ï¼Œç¡®ä¿æ²¡æœ‰é‡å¤çš„æ•°æ®
        Set<Map<String, Object>> uniqueDataSet = new HashSet<>(dataList);
        dataList = new ArrayList<>(uniqueDataSet);
        return dataList;
    }
    private void processResultList(List<ServiceSLTDInhospResDTO> resultList, List<String> types, String cry, Long orgid) {
    private void processResultList(List<ServiceSLTDInhospResDTO> resultList, List<String> types, String cry, String campusId) {
        for (String type : types)
            switch (type) {
                case "FH0108.01":
                    log.info("【parseResponseData】解析门诊数据");
                    outHospitalDate(resultList, orgid);
                    outHospitalDate(resultList);
                    break;
                case "FH0108.02":
                case "FH0109.26":
                    log.info("【parseResponseData】解析住院数据");
                    inHospitalDate(resultList, cry, orgid);
                    inHospitalDate(resultList, cry);
                    break;
                case "FH0108.03":
                    log.info("【parseResponseData】解析急诊数据");
                    outHospitalDate(resultList, orgid);
                case "FH0109.22":
                    log.info("【parseResponseData】解析预住院数据");
                    inHospitalDate(resultList, cry);
                    break;
                case "FH0109.23":
                    log.info("【parseResponseData】解析预住院(待安床)数据");
                    inHospitalDate(resultList, cry);
                    break;
                case "FH0109.27":
                    log.info("【parseResponseData】解析出院数据");
                    inHospitalDate(resultList, cry);
                    break;
                case "FH0109.53":
                    log.info("【parseResponseData】解析预住院(其他)数据");
                    inHospitalDate(resultList, cry);
                    break;
//                case "FH0108.03":
//                    log.info("【parseResponseData】解析急诊数据");
//                    outHospitalDate(resultList);
//                    break;
                default:
                    log.warn("【parseResponseData】未知的数据类型:{}", type);
                    break;
            }
    }
    private Boolean outHospitalDate(List<ServiceSLTDInhospResDTO> resultList, Long orgid) {
        for (ServiceSLTDInhospResDTO dto : resultList) {
            if (Objects.isNull(dto)) continue;
            PatArchive patArchive = processPatientArchive(dto, orgid);
            PatMedOuthosp patMedOuthosp = buildPatMedOuthosp(dto, patArchive, orgid);
//            //查询当前新增的门急诊数据,是否在过渡表中是否存在,如果存在,就不往门急诊表里新增了(这个先不写了,抽空了再写)
//            PatMedOuthospProvisional pmop = DtoConversionUtils.sourceToTarget(patMedOuthosp, PatMedOuthospProvisional.class);
    private Boolean outHospitalDate(List<ServiceSLTDInhospResDTO> resultList) {
        List<PatMedOuthosp> batchList = new ArrayList<>();
            //先查询一下,是不是已经存在该流水号了,如果存在,就不新增了
            PatMedOuthosp pmo2 = new PatMedOuthosp();
            pmo2.setSerialnum(patMedOuthosp.getSerialnum());
            List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.selectPatMedOuthospList(pmo2);
            if (CollectionUtils.isEmpty(patMedOuthosps)) patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
        for (ServiceSLTDInhospResDTO dto : resultList) {
            if (Objects.isNull(dto)) {
                continue;
            }
            PatArchive patArchive = processPatientArchive(dto);
            PatMedOuthosp patMedOuthosp = buildPatMedOuthosp(dto, patArchive);
            batchList.add(patMedOuthosp);
        }
        // æ‰¹é‡æ’入,自动忽略重复
        if (CollectionUtils.isNotEmpty(batchList)) {
            try {
                int insertCount = patMedOuthospMapper.batchInsertIgnore(batchList);
                log.info("批量插入门急诊记录,总数:{}, å®žé™…插入:{}", batchList.size(), insertCount);
            } catch (Exception e) {
                log.error("批量插入门急诊记录失败", e);
                // é™çº§ä¸ºé€æ¡æ’å…¥
                for (PatMedOuthosp patMedOuthosp : batchList) {
                    try {
                        patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
                    } catch (Exception ex) {
                        log.warn("单条插入失败:serialnum={}", patMedOuthosp.getSerialnum());
                    }
                }
            }
        }
        return true;
    }
    private PatMedOuthosp buildPatMedOuthosp(ServiceSLTDInhospResDTO dto, PatArchive patArchive, Long orgid) {
    private PatMedOuthosp buildPatMedOuthosp(ServiceSLTDInhospResDTO dto, PatArchive patArchive) {
        PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
        patMedOuthosp.setOuthospno(dto.getHealthcareRecordNo());
        patMedOuthosp.setSerialnum(dto.getHealthcareRecordNo());
@@ -488,46 +549,134 @@
        }
    }
    private Boolean inHospitalDate(List<ServiceSLTDInhospResDTO> resultList, String cry, Long orgid) {
    private Boolean inHospitalDate(List<ServiceSLTDInhospResDTO> resultList, String cry) {
        for (ServiceSLTDInhospResDTO dto : resultList) {
            if (Objects.isNull(dto)) continue;
            PatArchive patArchive = processPatientArchive(dto, orgid);
            processPatientInhospInfo(dto, patArchive, cry, orgid);
            PatArchive patArchive = processPatientArchive(dto);
            processPatientInhospInfo(dto, patArchive, cry);
        }
        return true;
    }
    private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry, Long orgid) {
        PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry, orgid);
    private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) {
        PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry);
        PatMedInhosp queryInhosp = new PatMedInhosp();
        queryInhosp.setPatno(patArchive.getPatientno());
        queryInhosp.setSerialnum(patMedInhosp.getSerialnum());
        queryInhosp.setOrgid(dto.getOrgId());
        queryInhosp.setCampusid(dto.getCampusId());
        queryInhosp.setPatno(StringUtils.trim(patArchive.getPatientno()));
        queryInhosp.setSerialnum(StringUtils.trim(patMedInhosp.getSerialnum()));
        queryInhosp.setOrgid(StringUtils.trim(dto.getOrgId()));
        queryInhosp.setInhospstate(cry);
        log.info("----------------这里的入参为:{}", queryInhosp);
        log.info("----------------这里的入参为:{},{}", queryInhosp.getPatno(), queryInhosp.getSerialnum());
        List<PatMedInhosp> existingInhosps = patMedInhospService.selectPatMedInhosp(queryInhosp);
        if (cry.equals("0") && CollectionUtils.isNotEmpty(existingInhosps)) {
            //新增过的入院数据,不再处理
            return;
        } else if (cry.equals("1") && CollectionUtils.isNotEmpty(existingInhosps)) {
            //新增过的出院数据,也不再处理
            return;
        }
        log.info("----------------这里的返参为:{}", existingInhosps);
        if (CollectionUtils.isNotEmpty(existingInhosps)) {
            patMedInhosp.setInhospid(existingInhosps.get(0).getInhospid());
        if (cry.equals("0")) {
            //入院数据处理
            if (CollectionUtils.isEmpty(existingInhosps)) {
                //如果为空,要先判断,预入院是否有值,有值的话则更新
                queryInhosp.setInhospstate("3");
                List<PatMedInhosp> patMedInhospList = patMedInhospService.selectPatMedInhosp(queryInhosp);
                if (CollectionUtils.isNotEmpty(patMedInhospList)) {
                    //如果预入院不为空,则进行修改
            patMedInhospService.updatePatMedInhosp(patMedInhosp);
            log.debug("【processPatientInhospInfo】更新住院信息,患者编号:{},流水号:{}", patArchive.getPatientno(), patMedInhosp.getSerialnum());
        } else {
            patMedInhospService.insertPatMedInhosp(patMedInhosp);
            log.debug("【processPatientInhospInfo】新增住院信息,患者编号:{},流水号:{}", patArchive.getPatientno(), patMedInhosp.getSerialnum());
                    //如果出院不为空,则不进行处理
                    queryInhosp.setInhospstate("1");
                    patMedInhospList = patMedInhospService.selectPatMedInhosp(queryInhosp);
                    if (CollectionUtils.isNotEmpty(patMedInhospList)) {
                        return;
        }
    }
    private PatMedInhosp buildPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry, Long orgid) {
                //如果都为空,则进行新增
                if (CollectionUtils.isEmpty(patMedInhospList)) {
                    try {
                        patMedInhospService.insertPatMedInhosp(patMedInhosp);
                    } catch (org.springframework.dao.DuplicateKeyException e) {
                        log.warn("入院记录已存在,跳过:serialnum={}, orgid={}, state={}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid(), patMedInhosp.getInhospstate());
                    }
                }
            }
        } else if (cry.equals("1")) {
//           å‡ºé™¢æ•°æ®å¤„理
            if (CollectionUtils.isEmpty(existingInhosps)) {
                //如果为空,要先判断,预入院是否有值,有值的话则更新
                queryInhosp.setInhospstate("3");
                log.info("-----patMedInhospList进来了不?入参为:{}", queryInhosp);
                List<PatMedInhosp> patMedInhospList = patMedInhospService.selectPatMedInhosp(queryInhosp);
                log.info("----patMedInhospList进来了不?返参为:{}", CollectionUtils.isEmpty(patMedInhospList) ? null : patMedInhospList.get(0).getSerialnum());
                if (CollectionUtils.isNotEmpty(patMedInhospList)) {
                    //如果预入院不为空,则进行修改
                    patMedInhospService.updatePatMedInhosp(patMedInhosp);
                } else {
                    //如果入院不为空,则进行修改
                    queryInhosp.setInhospstate("0");
                    patMedInhospList = patMedInhospService.selectPatMedInhosp(queryInhosp);
                    if (CollectionUtils.isNotEmpty(patMedInhospList)) {
                        patMedInhospService.updatePatMedInhosp(patMedInhosp);
                    }
                }
                //如果都为空,则进行新增
                if (CollectionUtils.isEmpty(patMedInhospList)) {
                    //如果入院不为空,则进行修改
                    queryInhosp.setInhospstate("0");
                    log.debug("出院queryInhosp入参为:{}", queryInhosp);
                    List<PatMedInhosp> patMedInhosps = patMedInhospService.selectPatMedInhosp(queryInhosp);
                    log.debug("出院patMedInhospList返参为:{}", CollectionUtils.isEmpty(patMedInhosps) ? null : patMedInhosps.size());
                    if (CollectionUtils.isNotEmpty(patMedInhosps)) {
                        patMedInhospService.updatePatMedInhosp(patMedInhosp);
                    } else {
                        try {
                            patMedInhospService.insertPatMedInhosp(patMedInhosp);
                        } catch (org.springframework.dao.DuplicateKeyException e) {
                            log.warn("出院记录已存在,跳过:serialnum={}, orgid={}, state={}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid(), patMedInhosp.getInhospstate());
                        }
                    }
                }
            }
        } else if ("3".equals(cry)) {
            //预入院数据处理:任一状态存在则不新增;都不存在才新增
            String serialnum = patMedInhosp.getSerialnum() == null ? "" : patMedInhosp.getSerialnum().trim();
            String orgid = patMedInhosp.getOrgid() == null ? "" : patMedInhosp.getOrgid().trim();
            String state = patMedInhosp.getInhospstate() == null ? "" : patMedInhosp.getInhospstate();
            String lockKey = "inhosp:lock:" + serialnum + ":" + orgid + ":" + state;
            Boolean locked = false;
            try {
                locked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 10, TimeUnit.SECONDS);
            } catch (Exception e) {
                log.warn("Redis锁获取失败,降级为直接插入:{}", e.getMessage());
                locked = null; // æ ‡è®°Redis不可用
            }
            if (locked == null || Boolean.TRUE.equals(locked)) {
                try {
                    queryInhosp.setInhospstate(null);
                    List<PatMedInhosp> patMedInhospList3 = patMedInhospService.selectPatMedInhosp(queryInhosp);
                    if (CollectionUtils.isEmpty(patMedInhospList3)) {
                        try {
                            patMedInhospService.insertPatMedInhosp(patMedInhosp);
                            log.debug("成功插入预入院记录:serialnum={}", patMedInhosp.getSerialnum());
                        } catch (Exception e) {
                            log.warn("预入院记录插入失败(可能已存在):serialnum={}, orgid={}, state={}, é”™è¯¯ï¼š{}", patMedInhosp.getSerialnum(), patMedInhosp.getOrgid(), patMedInhosp.getInhospstate(), e.getMessage());
                        }
                    }
                } finally {
                    if (Boolean.TRUE.equals(locked)) {
                        try {
                            redisTemplate.delete(lockKey);
                        } catch (Exception e) {
                            log.warn("Redis锁释放失败:{}", e.getMessage());
                        }
                    }
                }
            } else {
                log.debug("预入院记录正在被其他线程处理,跳过:serialnum={}", patMedInhosp.getSerialnum());
            }
        }
    }
    private PatMedInhosp buildPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) {
        log.info("----------------buildPatientInhospInfo这里进来了吗?{}", cry);
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setPatid(patArchive.getId());
@@ -539,6 +688,7 @@
        patMedInhosp.setFuflag("1");
        if ("0".equals(cry)) patMedInhosp.setInhospstate("0");
        if ("1".equals(cry)) patMedInhosp.setInhospstate("1");
        if ("3".equals(cry)) patMedInhosp.setInhospstate("3");
        patMedInhosp.setHospitalcode(dto.getOrgId());
        patMedInhosp.setBedNo(dto.getBedNumber());
        patMedInhosp.setStarttime(parseDate(dto.getStartTime()));
@@ -582,12 +732,12 @@
        patMedInhosp.setHospitaldistrictname(dto.getAreaName());
    }
    private PatArchive processPatientArchive(ServiceSLTDInhospResDTO dto, Long orgid) {
    private PatArchive processPatientArchive(ServiceSLTDInhospResDTO dto) {
        PatArchive queryArchive = new PatArchive();
        queryArchive.setIdcardno(StringUtils.isEmpty(dto.getIdCardNo()) ? "" + dto.getMedicalCardId() : dto.getIdCardNo().trim());
        List<PatArchive> existingArchives = patArchiveService.selectPatArchiveList(queryArchive);
        PatArchive patArchive = buildPatientArchive(dto, orgid);
        PatArchive patArchive = buildPatientArchive(dto);
        if (CollectionUtils.isEmpty(existingArchives)) {
            patArchiveService.insertPatArchive(patArchive);
@@ -601,7 +751,7 @@
        return patArchive;
    }
    private PatArchive buildPatientArchive(ServiceSLTDInhospResDTO dto, Long orgid) {
    private PatArchive buildPatientArchive(ServiceSLTDInhospResDTO dto) {
        PatArchive patArchive = new PatArchive();
        patArchive.setPatientno("" + dto.getPatientId());
        patArchive.setIdcardno(StringUtils.isEmpty(dto.getIdCardNo()) ? "" + dto.getMedicalCardId() : dto.getIdCardNo().trim());
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -177,7 +177,7 @@
            if (key.contains("-WJscriptCache")) {
                List<SvyTaskTemplateScriptVO> cacheList = redisCache.getCacheList(key);
                cacheList.sort(Comparator.comparingLong(SvyTaskTemplateScriptVO::getSort));
                log.error("问卷回答结果:{}", cacheList);
                log.info("问卷回答结果:{}", cacheList);
                for (int i = 0; i < cacheList.size(); i++) {
                    if (i == 0) {
                        //这个时间要找到第一题
@@ -683,6 +683,7 @@
        }
        ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(taskid);
        serviceSubtaskDetailVO.setQuestiontext(svyTaskTemplateScriptVO.getScriptContent());
        serviceSubtaskDetailVO.setCategoryid(svyTaskTemplateScriptVO.getCategoryid());
        serviceSubtaskDetailVO.setTaskid(Long.valueOf(taskid));
        serviceSubtaskDetailVO.setTargetid(svyTaskTemplateScriptVO.getTargetid() != null ? svyTaskTemplateScriptVO.getTargetid().intValue() : null);
        serviceSubtaskDetailVO.setPatid(Long.valueOf(patid));
@@ -717,6 +718,8 @@
    private Boolean sendTaskIds(List<Integer> sendTaskids, ServiceSubtask serviceSubtask) {
        for (Integer taskId : sendTaskids) {
            ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(Long.valueOf(taskId));
            if (Objects.isNull(serviceTask)) return false;
            String content = sendMQContent(serviceTask, null);
            //先查询一下,该患者在该service_task中,是否已经存在,如果已经存在,则不用再保存了
            ServiceSubtask ss = new ServiceSubtask();
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -1,7 +1,6 @@
package com.smartor.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
@@ -14,20 +13,26 @@
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.*;
import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -76,6 +81,9 @@
    @Autowired
    private IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper;
    @Autowired
    private ISvyTaskTemplateScriptService svyTaskTemplateScriptService;
    @Autowired
    private IIvrTaskTemplateService ivrTaskTemplateService;
@@ -145,6 +153,11 @@
    @Override
    public ServiceSubtask selectServiceSubtaskById(Long id) {
        return serviceSubtaskMapper.selectServiceSubtaskById(id);
    }
    @Override
    public List<ServiceSubtask> selectServiceSubtaskByDiagname(ServiceSubtask serviceSubtask) {
        return serviceSubtaskMapper.selectServiceSubtaskByDiagname(serviceSubtask);
    }
    /**
@@ -369,15 +382,18 @@
        if (patMedInhospList.size() > 0) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtask1.setRemark(serviceSubtask1.getRemark()+";患者再入院了");
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "无需再次随访,患者再入院了";
        } else if (serviceSubtask1.getSendstate() == 4L) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtask1.setRemark(serviceSubtask1.getRemark()+";无需再次随访,任务被标记不在执行");
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "无需再次随访,任务被标记不在执行";
        } else if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            serviceSubtask1.setRemark(serviceSubtask1.getRemark()+";无需再次随访,患者被标记不需要被服务");
            return "无需再次随访,患者被标记不需要被服务";
        } else if (ObjectUtils.isNotEmpty(serviceSubtask1.getIsVisitAgain()) && serviceSubtask1.getIsVisitAgain() == 2) {
            return "无需再次随访,该任务已经再次随访过了";
@@ -586,6 +602,7 @@
                    serviceSubtask.setAddr(patTaskRelevance.getAddr());
                    serviceSubtask.setPatid(patTaskRelevance.getPatid());
                    serviceSubtask.setCreateTime(DateUtils.getNowDate());
                    serviceSubtask.setInhospid(patTaskRelevance.getHospid());
                    serviceSubtask.setSendstate(1L);
                    if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
                        serviceSubtask.setSendstate(2L);
@@ -654,7 +671,7 @@
                for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
                    log.error("sfSend需要移除的subId为:{}", serviceSubtask.getId().toString());
                    serviceSubtaskMapper.deleteServiceSubtaskById(serviceSubtask.getId());
                    redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString());
//                    redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-0", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-1", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-2", serviceSubtask.getId().toString());
@@ -1134,7 +1151,7 @@
    @Override
    public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO) {
        //先把该subId从cache_exist中剔除,只要有回调就剔除(目的是,尽快让cache-exist为空,去缓存下一批要打的电话;这里剔除不影响电话的正常业务)
        redisCache.removeElementFromList("cache-exist", phoneCallReqYQVO.getTaskid());
//        redisCache.removeElementFromList("cache-exist", phoneCallReqYQVO.getTaskid());
        //判断是否挂机
        String hangupState = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "- hangup");
@@ -1793,8 +1810,8 @@
        List<String> cacheList = new ArrayList<>();
        ListOperations<String, String> listOps = redisTemplate.opsForList();
        //必须等ache-exist全部打完才能拉取下一批(主要是怕所有的数据都堆在电话的缓存里,在规定的时间打不完)
        long existSize = listOps.size("cache-exist");
        if (existSize > 0) return pullTaskVOList;
//        long existSize = listOps.size("cache-exist");
//        if (existSize > 0) return pullTaskVOList;
        int count = 0;
        long size = listOps.size("cache-0");
        log.error("---------打电话之前缓存中的数据量:{}", size);
@@ -1804,17 +1821,18 @@
            count = Math.min(phoneCount(), (int) size);
            if (count != 0) {
                cacheList = listOps.range("cache-0", 0, count - 1);
            } else {
                return null;
            }
        }
        log.error("任务拉取cache-0的值是多少:{}", cacheList);
        log.info("任务拉取cache-0的值是多少:{}", cacheList);
        //  cache-0为立即发起的,其它的先推迟
        if (!CollectionUtils.isEmpty(cacheList)) {
            pullTaskVOList = getPullTaskList(cacheList, "cache-0");
            // åˆ é™¤å·²å¤„理的数据
            listOps.trim("cache-0", count, -1);
            log.error("打电话之后缓存中的数据量---------:{}", listOps.size("cache-0"));
            log.info("打电话之后缓存中的数据量---------:{}", listOps.size("cache-0"));
        } else {
            for (int i = 1; i < 6; i++) {
                //取出从cache-1 åˆ° cache-5的第一个子任务信息
@@ -1836,15 +1854,15 @@
            }
        }
        //existList用来记录接下来需要执行的子任务ID
        List<String> existList = new ArrayList<>();
//        List<String> existList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(pullTaskVOList)) {
            //给回调参数赋值
            for (PullTaskVO pullTaskVO : pullTaskVOList) {
                existList.add(pullTaskVO.getTaskid());
//                existList.add(pullTaskVO.getTaskid());
                pullTaskVO.setAsrcallback(ASRCallBackPath);
            }
        }
        if (existList.size() != 0) redisCache.setCacheListRight("cache-exist", existList);
//        if (existList.size() != 0) redisCache.setCacheListRight("cache-exist", existList);
        log.error("-----------实际拉取的电话数据量:{}", CollectionUtils.isNotEmpty(pullTaskVOList) ? pullTaskVOList.size() : null);
        return pullTaskVOList;
    }
@@ -1938,6 +1956,13 @@
            }
            //随访
            for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubTaskDetailReq.getServiceSubtaskDetailList()) {
                if (serviceSubtaskDetail.getScriptid() != null) {
                    //设置一下问题分类
                    IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
                    if (ivrTaskTemplateScript != null)
                        serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getAssortid());
                }
                serviceSubtaskDetail.setSubId(selectServiceSubtaskList.get(0).getId());
//                serviceSubtaskDetail.setId(UUID.randomUUID().toString());
                serviceSubtaskDetail.setCreateTime(new Date());
@@ -1949,6 +1974,12 @@
        } else {
            if (serviceSubTaskDetailReq != null && CollectionUtils.isNotEmpty(serviceSubTaskDetailReq.getServiceSubtaskDetailList())) {
                for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubTaskDetailReq.getServiceSubtaskDetailList()) {
                    if (serviceSubtaskDetail.getScriptid() != null) {
                        //设置一下问题分类
                        IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
                        if (ivrTaskTemplateScript != null)
                            serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getAssortid());
                    }
                    serviceSubtaskDetail.setCreateTime(new Date());
                    serviceSubtaskDetail.setGuid(serviceSubTaskDetailReq.getGuid());
                    serviceSubtaskDetail.setOrgid(serviceSubTaskDetailReq.getOrgid());
@@ -1991,7 +2022,7 @@
            //进行短信补偿
//            getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid()));
            redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
            redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
//            redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
        } else if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) {
//        if (phoneCallRecordVO.getAnswered() != null && phoneCallRecordVO.getAnswered() == true) {
            log.error("有人接电话了,并且完了");
@@ -2014,7 +2045,7 @@
        } else {
            //患者拒绝随访
            //先把该subId从cache_exist中剔除,只要有回调就剔除(目的是,尽快让cache-exist为空,去缓存下一批要打的电话;这里剔除不影响电话的正常业务)
            redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
//            redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
            ServiceSubtask serviceSubtask = new ServiceSubtask();
            serviceSubtask.setRemark("电话接通成功,患者拒绝随访");
            serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid()));
@@ -2118,7 +2149,7 @@
            stringBuilder.append(timestamp + "之前携带医保卡或电子医保卡身份证凭此条短信到1号楼3楼南入院准备中心入院登记窗口,办理正式住院手续,完成各项检查后再到相应病区护士站报到。");
            stringBuilder.append("入院准备中心电话:89975977。入院办理须知:https://mp.weixin.qq.com/s/OCkotuRyQ8Ld2owFF0YErw");
            String data = MessageSend.sendMsg(stringBuilder.toString(), "2", patArchiveSrmVO.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
            String data = MessageSend.sendMsg(stringBuilder.toString(), "6", patArchiveSrmVO.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
            if (StringUtils.isNotEmpty(data) && data.contains("result=0")) {
                sendError.add(patArchiveSrmVO);
            }
@@ -2134,8 +2165,9 @@
     * @return
     */
    @Override
    @Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
    public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
        log.error("getSfStatistics的入参为:{}", serviceSubtaskCountReq);
        log.info("getSfStatistics的入参为:{}", serviceSubtaskCountReq);
        List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
//        List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
@@ -2192,6 +2224,20 @@
        return serviceSubtaskStatistics;
    }
    @Override
    public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq) {
        List<ServiceSubtaskStatistic> sfStatistics = getSfStatistics(serviceSubtaskCountReq);
        // æ·»åŠ æ€»è®¡è¡Œ
        if (CollectionUtils.isNotEmpty(sfStatistics)) {
            ServiceSubtaskStatistic totalRow = calculateTotalRow(sfStatistics);
            totalRow.setLeavehospitaldistrictname("总计");
            totalRow.setDeptname("总计");
            sfStatistics.add(totalRow);
        }
        return sfStatistics;
    }
    /**
     * èŽ·å–éšè®¿ç»Ÿè®¡æ¯”ä¾‹
     *
@@ -2199,12 +2245,14 @@
     * @return
     */
    @Override
    @Cacheable(value = "sfStatisticsJoy", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
    public List<ServiceSubtaskStatistic> getSfStatisticsJoy(ServiceSubtaskCountReq serviceSubtaskCountReq) {
        log.error("getSfStatistics的入参为:{}", serviceSubtaskCountReq);
        List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
        // æ ¹æ®æ¡ä»¶è¿›è¡Œåˆ†ç»„
        Map<String, List<ServiceSubtask>> collect = new HashMap<>();
        String orgid = null;
        if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) {
            if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
@@ -2226,13 +2274,10 @@
                continue;
            }
            ServiceSubtaskStatistic statistic = getStatisticJoy(serviceSubtaskList, joySubCount);
            if (statistic.getJoyCount() != 0 && statistic.getJoyAllCount() != 0) {
                Double joyTotal = Double.parseDouble(statistic.getJoyCount() + "") / Double.parseDouble(statistic.getJoyAllCount() + "") * 100;
                statistic.setJoyTotal(String.format("%.2f", joyTotal) + "%");
            }
            //及时率
            ServiceSubtask ss = new ServiceSubtask();
            ss.setOrgid(serviceSubtaskList.get(0).getOrgid());
            orgid = serviceSubtaskList.get(0).getOrgid();
            ss.setOrgid(orgid);
            // å¦‚果有医生编码,设置医生编码用于及时率查询
            if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
@@ -2252,13 +2297,125 @@
            }
            Double jsRate = serviceSubtaskMapper.selectTimelyRate(ss);
            statistic.setRate(jsRate);
            if (ObjectUtils.isNotEmpty(statistic)) {
                serviceSubtaskStatistics.add(statistic);
            }
        }
        if (CollectionUtils.isNotEmpty(serviceSubtaskStatistics)) {
            for (ServiceSubtaskStatistic serviceSubtaskStatistic : serviceSubtaskStatistics) {
                //所有满意度数量
                if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) {
                    Map<String, Object> satisfactionIndex = getSatisfactionIndex("1", serviceSubtaskStatistic.getDeptcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid());
                    serviceSubtaskStatistic.setJoyAllCount(satisfactionIndex.get("mydtmzl") != null ? (Integer) satisfactionIndex.get("mydtmzl") : 0);
                    serviceSubtaskStatistic.setJoyCount(satisfactionIndex.get("mydtbl") != null ? (Integer) satisfactionIndex.get("mydtbl") : 0);
                    serviceSubtaskStatistic.setJoyTotal((Double) satisfactionIndex.get("wcbl"));
                } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) {
                    Map<String, Object> satisfactionIndex = getSatisfactionIndex("2", serviceSubtaskStatistic.getLeavehospitaldistrictcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid());
                    serviceSubtaskStatistic.setJoyAllCount(satisfactionIndex.get("mydtmzl") != null ? (Integer) satisfactionIndex.get("mydtmzl") : 0);
                    serviceSubtaskStatistic.setJoyCount(satisfactionIndex.get("mydtbl") != null ? (Integer) satisfactionIndex.get("mydtbl") : 0);
                    serviceSubtaskStatistic.setJoyTotal((Double) satisfactionIndex.get("wcbl"));
                }
            }
        }
        return serviceSubtaskStatistics;
    }
    /**
     * èŽ·å–æ»¡æ„åº¦é¢˜ç›®æ€»é‡
     * type : 1-科室   2病区
     * code: ç§‘室或病区code
     *
     * @return
     */
    private Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, Long ivrCategoryid, Long svyCategoryid) {
        Map<String, Object> map = new HashMap<>();
        List<ServiceTask> serviceTasks = null;
        if (type.equals("1")) {
            ServiceTask serviceTask = new ServiceTask();
            serviceTask.setDeptcode(code);
            serviceTask.setOrgid(orgid);
            serviceTasks = serviceTaskService.selectServiceTaskList(serviceTask);
        } else if (type.equals("2")) {
            ServiceTask serviceTask = new ServiceTask();
            serviceTask.setLeavehospitaldistrictcode(code);
            serviceTask.setOrgid(orgid);
            serviceTasks = serviceTaskService.selectServiceTaskList(serviceTask);
        }
        //获取满意度题目总量
        BigDecimal mydtmzlsum = new BigDecimal(0);
        //获取满意度题目填报量
        BigDecimal mydtblsum = new BigDecimal(0);
        if (CollectionUtils.isNotEmpty(serviceTasks)) {
            //获取满意度题目总量
            for (ServiceTask serviceTask : serviceTasks) {
                if (serviceTask.getType().equals("1")) {
                    //语音
                    Long templateid = serviceTask.getTemplateid();
                    IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
                    ivrTaskTemplateScript.setTemplateID(templateid);
                    ivrTaskTemplateScript.setOrgid(serviceTask.getOrgid());
                    //先默认为1吧,assortid=1  ä»£è¡¨æ˜¯æ»¡æ„åº¦
                    ivrTaskTemplateScript.setAssortid(ivrCategoryid);
                    List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
                    if (CollectionUtils.isNotEmpty(ivrTaskTemplateScripts)) {
                        //需要先计算出发送量,再乘以单个问券满意度题目数量,得到满意度题目总量(包含了未做的)
                        ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
                        serviceSubtaskVO.setTaskid(serviceTask.getTaskid());
                        List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L));
                        serviceSubtaskVO.setSendstates(sendstates);
                        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO);
                        if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
                            int mydtmzlCount = ivrTaskTemplateScripts.size() * serviceSubtaskList.size();
                            mydtmzlsum.add(new BigDecimal(mydtmzlCount));
                        }
                    }
                } else if (serviceTask.getType().equals("2")) {
                    //问卷
                    SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript();
                    svyTaskTemplateScript.setTemplateID(serviceTask.getTemplateid());
                    svyTaskTemplateScript.setOrgid(serviceTask.getOrgid());
                    svyTaskTemplateScript.setCategoryid(svyCategoryid);
                    List<SvyTaskTemplateScript> svyTaskTemplateScriptList = svyTaskTemplateScriptService.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
                    if (CollectionUtils.isNotEmpty(svyTaskTemplateScriptList)) {
                        ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
                        serviceSubtaskVO.setTaskid(serviceTask.getTaskid());
                        List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L));
                        serviceSubtaskVO.setSendstates(sendstates);
                        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO);
                        if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
                            int mydtmzlCount = svyTaskTemplateScriptList.size() * serviceSubtaskList.size();
                            mydtmzlsum.add(new BigDecimal(mydtmzlCount));
                        }
                    }
                }
                //获取满意度题目填报量
                ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
                serviceSubtaskDetail.setTaskid(serviceTask.getTaskid());
                if (serviceTask.getType().equals("1")) serviceSubtaskDetail.setCategoryid(ivrCategoryid);
                if (serviceTask.getType().equals("2")) serviceSubtaskDetail.setCategoryid(svyCategoryid);
                serviceSubtaskDetail.setOrgid(serviceTask.getOrgid());
                List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
                if (CollectionUtils.isNotEmpty(serviceSubtaskDetails))
                    mydtblsum.add(new BigDecimal(serviceSubtaskDetails.size()));
            }
        }
        //满意度题目总量
        map.put("mydtmzl", mydtmzlsum.intValue());
        map.put("mydtbl", mydtblsum.intValue());
        map.put("wcbl", 0.0);
        if (mydtmzlsum.intValue() != 0) {
            map.put("wcbl", mydtblsum.divide(mydtmzlsum, 2, RoundingMode.HALF_UP).doubleValue());
        }
        return map;
    }
    private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList) {
        ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
@@ -2272,10 +2429,16 @@
        serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
        //出院人次
        serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
        //记录过滤患者详情
        List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
        for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
            //无需随访人次
            if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
                serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
                if (serviceSubtask.getTaskSituation() !=null && serviceSubtask.getTaskSituation() == 6) {
                    serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
                    filterServiceSubtasks.add(serviceSubtask);
                }
            }
            //应随访人次
            if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
@@ -2363,11 +2526,11 @@
            if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 5) {
                serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1);
            }
            if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
            if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 7) {
                serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1);
            }
        }
        serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
        return serviceSubtaskStatistic;
    }
@@ -2470,9 +2633,7 @@
                }
            }
        }
        return serviceSubtaskStatistic;
    }
@@ -2506,6 +2667,7 @@
        serviceSubtaskDetail.setAssigntime(System.currentTimeMillis());
        serviceSubtaskDetail.setStarttime(System.currentTimeMillis());
        serviceSubtaskDetail.setAnswertime(System.currentTimeMillis());
        serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScriptVO.getAssortid());
        serviceSubtaskDetail.setAsrtext("无应答");
        if (StringUtils.isNotEmpty(phoneCallReqYQVO.getAsrtext()))
            serviceSubtaskDetail.setAsrtext(phoneCallReqYQVO.getAsrtext());
@@ -2608,19 +2770,24 @@
        LocalTime currentTime = LocalTime.now();
        // ç›®æ ‡æ—¶é—´ï¼ˆæ™šä¸Š 8 ç‚¹ï¼‰
        LocalTime targetTime = LocalTime.of(phoneEndHour, 0);
        // è®¡ç®—当前时间到目标时间的时长
        Duration duration = Duration.between(currentTime, targetTime);
        // èŽ·å–å‰©ä½™æ—¶é—´çš„å°æ—¶æ•°
        long remainingHours = 0;
        long remainingMinutes = duration.toMinutes();
        //如果超过8点,就设置为0
        //距离结束时间小于20分钟,就不拉取了
        if (remainingMinutes < 20) remainingHours = 0;
        else if (remainingMinutes < 60 && remainingMinutes > 20) remainingHours = 1;
        else if (remainingMinutes > 60) remainingHours = remainingMinutes / 60;
        // è®¡ç®—剩余可以打的电话数
        int remainingCalls = (int) (remainingHours * phoneUpEveryHour);
        return remainingCalls;
//        // è®¡ç®—当前时间到目标时间的时长
//        Duration duration = Duration.between(currentTime, targetTime);
//        // èŽ·å–å‰©ä½™æ—¶é—´çš„å°æ—¶æ•°
//        long remainingHours = 0;
//        long remainingMinutes = duration.toMinutes();
//        //如果超过8点,就设置为0
//        //距离结束时间小于20分钟,就不拉取了
//        if (remainingMinutes < 20) remainingHours = 0;
//        else if (remainingMinutes < 60 && remainingMinutes > 20) remainingHours = 1;
//        else if (remainingMinutes > 60) remainingHours = remainingMinutes / 60;
//        // è®¡ç®—剩余可以打的电话数
//        int remainingCalls = (int) (remainingHours * phoneUpEveryHour);
//        return remainingCalls;
        if (currentTime.isBefore(targetTime)) {
            //如果当前时间还在截止时间内,则继续发
            return phoneUpEveryHour;
        }
        return 0;
    }
    public List<ServiceSubtaskCount> getSfStatisticsJoydetails(ServiceSubtaskCountReq serviceSubtaskCountReq) {
@@ -2692,4 +2859,92 @@
        }
        return visitTime;
    }
    /**
     * è®¡ç®—总计行
     * @param statistics ç»Ÿè®¡æ•°æ®åˆ—表
     * @return æ€»è®¡è¡Œæ•°æ®
     */
    private ServiceSubtaskStatistic calculateTotalRow(List<ServiceSubtaskStatistic> statistics) {
        ServiceSubtaskStatistic total = new ServiceSubtaskStatistic();
        // åˆå§‹åŒ–数值字段
        total.setDischargeCount(0);
        total.setNonFollowUp(0L);
        total.setFilterCount(0L);
        total.setFollowUpNeeded(0L);
        total.setNeedFollowUp(0L);
        total.setPendingFollowUp(0L);
        total.setFollowUpSuccess(0L);
        total.setFollowUpFail(0L);
        total.setManual(0L);
        total.setSms(0L);
        total.setWeChat(0L);
        total.setAbnormal(0L);
        total.setNeedFollowUpAgain(0L);
        total.setPendingFollowUpAgain(0L);
        total.setFollowUpSuccessAgain(0L);
        total.setFollowUpFailAgain(0L);
        total.setManualAgain(0L);
        total.setSmsAgain(0L);
        total.setWeChatAgain(0L);
        total.setAbnormalAgain(0L);
        total.setTaskSituation1(0);
        total.setTaskSituation2(0);
        total.setTaskSituation3(0);
        total.setTaskSituation4(0);
        total.setTaskSituation5(0);
        total.setTaskSituation6(0);
        // ç´¯åŠ å„ä¸ªå­—æ®µçš„å€¼
        for (ServiceSubtaskStatistic stat : statistics) {
            if (stat.getDischargeCount() != null) {
                total.setDischargeCount(total.getDischargeCount() + stat.getDischargeCount());
            }
            total.setNonFollowUp(total.getNonFollowUp() + (stat.getNonFollowUp() != null ? stat.getNonFollowUp() : 0L));
            total.setFilterCount(total.getFilterCount() + (stat.getFilterCount() != null ? stat.getFilterCount() : 0L));
            total.setFollowUpNeeded(total.getFollowUpNeeded() + (stat.getFollowUpNeeded() != null ? stat.getFollowUpNeeded() : 0L));
            total.setNeedFollowUp(total.getNeedFollowUp() + (stat.getNeedFollowUp() != null ? stat.getNeedFollowUp() : 0L));
            total.setPendingFollowUp(total.getPendingFollowUp() + (stat.getPendingFollowUp() != null ? stat.getPendingFollowUp() : 0L));
            total.setFollowUpSuccess(total.getFollowUpSuccess() + (stat.getFollowUpSuccess() != null ? stat.getFollowUpSuccess() : 0L));
            total.setFollowUpFail(total.getFollowUpFail() + (stat.getFollowUpFail() != null ? stat.getFollowUpFail() : 0L));
            total.setManual(total.getManual() + (stat.getManual() != null ? stat.getManual() : 0L));
            total.setSms(total.getSms() + (stat.getSms() != null ? stat.getSms() : 0L));
            total.setWeChat(total.getWeChat() + (stat.getWeChat() != null ? stat.getWeChat() : 0L));
            total.setAbnormal(total.getAbnormal() + (stat.getAbnormal() != null ? stat.getAbnormal() : 0L));
            total.setNeedFollowUpAgain(total.getNeedFollowUpAgain() + (stat.getNeedFollowUpAgain() != null ? stat.getNeedFollowUpAgain() : 0L));
            total.setPendingFollowUpAgain(total.getPendingFollowUpAgain() + (stat.getPendingFollowUpAgain() != null ? stat.getPendingFollowUpAgain() : 0L));
            total.setFollowUpSuccessAgain(total.getFollowUpSuccessAgain() + (stat.getFollowUpSuccessAgain() != null ? stat.getFollowUpSuccessAgain() : 0L));
            total.setFollowUpFailAgain(total.getFollowUpFailAgain() + (stat.getFollowUpFailAgain() != null ? stat.getFollowUpFailAgain() : 0L));
            total.setManualAgain(total.getManualAgain() + (stat.getManualAgain() != null ? stat.getManualAgain() : 0L));
            total.setSmsAgain(total.getSmsAgain() + (stat.getSmsAgain() != null ? stat.getSmsAgain() : 0L));
            total.setWeChatAgain(total.getWeChatAgain() + (stat.getWeChatAgain() != null ? stat.getWeChatAgain() : 0L));
            total.setAbnormalAgain(total.getAbnormalAgain() + (stat.getAbnormalAgain() != null ? stat.getAbnormalAgain() : 0L));
            total.setTaskSituation1(total.getTaskSituation1() + (stat.getTaskSituation1() != null ? stat.getTaskSituation1() : 0));
            total.setTaskSituation2(total.getTaskSituation2() + (stat.getTaskSituation2() != null ? stat.getTaskSituation2() : 0));
            total.setTaskSituation3(total.getTaskSituation3() + (stat.getTaskSituation3() != null ? stat.getTaskSituation3() : 0));
            total.setTaskSituation4(total.getTaskSituation4() + (stat.getTaskSituation4() != null ? stat.getTaskSituation4() : 0));
            total.setTaskSituation5(total.getTaskSituation5() + (stat.getTaskSituation5() != null ? stat.getTaskSituation5() : 0));
            total.setTaskSituation6(total.getTaskSituation6() + (stat.getTaskSituation6() != null ? stat.getTaskSituation6() : 0));
        }
        // è®¡ç®—总计行的比率字段
        DecimalFormat percentFormat = new DecimalFormat("##.##%");
        if (total.getNeedFollowUp() > 0) {
            double rate = (double) (total.getFollowUpSuccess() + total.getFollowUpFail()) / total.getNeedFollowUp();
            total.setFollowUpRate(percentFormat.format(rate));
        } else {
            total.setFollowUpRate("0.00%");
        }
        if (total.getNeedFollowUpAgain() > 0) {
            double rateAgain = (double) (total.getFollowUpSuccessAgain() + total.getFollowUpFailAgain()) / total.getNeedFollowUpAgain();
            total.setFollowUpRateAgain(percentFormat.format(rateAgain));
        } else {
            total.setFollowUpRateAgain("0.00%");
        }
        return total;
    }
}
smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java
@@ -294,7 +294,7 @@
            serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
        }
        Integer integer = serviceSubtask.getId().intValue();
        log.error("插入的ID是:{}", integer);
        log.info("插入的ID是:{}", integer);
        return integer;
    }
@@ -302,21 +302,10 @@
    @Override
    public Map query360PatInfo(ServiceQueryInfo serviceQueryInfo) {
        if (ObjectUtils.isEmpty(serviceQueryInfo)) {
            log.info("360查询条件为空");
            log.error("360查询条件为空");
            throw new BaseException("360查询条件为空");
        }
        String token = LSHospTokenUtil.getToken(serviceQueryInfo.getXiaoXiTou().getFaSongJGID(),serviceQueryInfo.getUrl());
//        LyraTokenUtil lyraTokenUtil = null;
//        if (serviceQueryInfo.getXiaoXiTou().getFaSongJGID().equals("47255004333112711A1001"))  //景宁
//            lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil("https://9.0.124.104:13021/mediinfo-lyra-authserver/connect/token", "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
//        if (serviceQueryInfo.getXiaoXiTou().getFaSongJGID().equals("47231022633110211A2101"))  //中医院
//            lyraTokenUtil = LyraTokenUtil.createLyraTokenUtil("https://9.0.124.104:13011/mediinfo-lyra-authserver/connect/token", "zjhes.suifangxt", "OIjdJvx2ALjFVGZoCZO4I8O");
//
//        try {
//            token = lyraTokenUtil.getToken();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
        //用户信息,通过ZuZhiJGID去bse_organization中获取机构信息
        if (StringUtils.isBlank(serviceQueryInfo.getYeWuXX().getYongHuXX().getZuZhiJGID()))
@@ -335,14 +324,13 @@
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
        serviceQueryInfo.getXiaoXiTou().setFaSongSJ(simpleDateFormat.format(new Date()));
        log.error(new Gson().toJson(serviceQueryInfo));
        log.error("serviceQueryInfo的结果为:{}", serviceQueryInfo);
        log.info("serviceQueryInfo的结果为:{}", serviceQueryInfo);
        ObjectMapper objectMapper = new ObjectMapper();
        String result = null;
        Map map = new HashMap();
        try {
            String jsonString = objectMapper.writeValueAsString(serviceQueryInfo);
            log.error("token的值为:{}", token);
            log.info("token的值为:{}", token);
            if (serviceQueryInfo.getXiaoXiTou().getFaSongJGID().equals("47255004333112711A1001")) {  //景宁
                result = OkHttpExample.sendPostRequest("https://9.0.124.104:13021/mediinfo-grus-fuwuzxwg/api/esb/lyraSyncRun", jsonString, token);
            }else if (serviceQueryInfo.getXiaoXiTou().getFaSongJGID().equals("47231022633110211A2101")) {  //中医院
smartor/src/main/java/com/smartor/service/impl/SvyTaskTemplateServiceImpl.java
@@ -133,7 +133,7 @@
        //对模板话术和选项进行处理(话术表与指标表进行合并了,)
        if (CollectionUtils.isNotEmpty(svyTaskTemplateVO.getSvyTaskTemplateScriptVOS())) {
            log.error("ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList()是否有数据哈:{}", svyTaskTemplateVO.getSvyTaskTemplateScriptVOS());
//            log.error("ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList()是否有数据哈:{}", svyTaskTemplateVO.getSvyTaskTemplateScriptVOS());
            for (SvyTaskTemplateScriptVO svyTaskTemplateScriptVO : svyTaskTemplateVO.getSvyTaskTemplateScriptVOS()) {
                svyTaskTemplateScriptVO.setGuid(svyTaskTemplateVO.getGuid());
                svyTaskTemplateScriptVO.setOrgid(svyTaskTemplateVO.getOrgid());
@@ -179,6 +179,7 @@
            log.info("svyLibaTemplateScriptVO的主键id为:{}", svyTaskTemplateScriptVO.getId());
            SvyTaskTemplateTargetoption svyTaskTemplateTargetoption = new SvyTaskTemplateTargetoption();
            svyTaskTemplateTargetoption.setScriptid(svyTaskTemplateScriptVO.getId());
            svyTaskTemplateTargetoption.setOrgid(svyTaskTemplateScriptVO.getOrgid());
            List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = svyTaskTemplateTargetoptionMapper.selectSvyTaskTemplateTargetoptionList(svyTaskTemplateTargetoption);
            for (SvyTaskTemplateTargetoption svyTaskTemplateTargetoption1 : svyTaskTemplateTargetoptions) {
                ObjectMapper mapper = new ObjectMapper();
@@ -201,7 +202,7 @@
            }
            svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions);
        }
        Collections.sort(svyTaskTemplateScriptVOS, Comparator.comparing(SvyTaskTemplateScriptVO::getTargetid));
//        Collections.sort(svyTaskTemplateScriptVOS, Comparator.comparing(SvyTaskTemplateScriptVO::getTargetid));
        //数据组装
        templateVO.setSvyTaskTemplateScriptVOS(svyTaskTemplateScriptVOS);
        return templateVO;
smartor/src/main/resources/mapper/smartor/IvrLibScriptMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.IvrLibScriptMapper">
    <resultMap type="IvrLibScript" id="IvrLibScriptResult">
    <resultMap type="com.smartor.domain.IvrLibScript" id="IvrLibScriptResult">
        <result property="scriptid"    column="scriptid"    />
        <result property="orgid"    column="orgid"    />
        <result property="categoryid"    column="categoryid"    />
smartor/src/main/resources/mapper/smartor/IvrLibaScriptMapper.xml
@@ -6,6 +6,7 @@
    <resultMap type="com.smartor.domain.IvrLibaScript" id="IvrLibaScriptResult">
        <result property="id" column="id"/>
        <result property="assortid" column="assortid"/>
        <result property="scriptTopic" column="script_topic"/>
        <result property="scriptContent" column="script_content"/>
        <result property="ivrVoice" column="ivr_voice"/>
@@ -57,6 +58,7 @@
    <sql id="selectIvrLibaScriptVo">
        select id,
               suitway,
               assortid,
               targetdesc,
               campus,
               deptNames,
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
@@ -48,12 +48,14 @@
        <result property="sort" column="sort"/>
        <result property="score" column="score"/>
        <result property="groupName" column="group_name"/>
        <result property="assortid" column="assortid"/>
    </resultMap>
    <sql id="selectIvrLibaTemplateScriptVo">
        select id,
               scriptno,
               sort,
               assortid,
               group_name,
               branch_flag,
               branch_nextscriptno,
@@ -102,6 +104,7 @@
        <where>
            del_flag=0
            <if test="scriptno != null ">and scriptno = #{scriptno}</if>
            <if test="assortid != null ">and assortid = #{assortid}</if>
            <if test="groupName != null ">and group_name = #{groupName}</if>
            <if test="scriptDesc != null ">and script_desc = #{scriptDesc}</if>
            <if test="templateid != null ">and templateid = #{templateid}</if>
@@ -196,6 +199,7 @@
            <if test="score != null ">score,</if>
            <if test="ivrtext != null ">ivrtext,</if>
            <if test="groupName != null ">group_name,</if>
            <if test="assortid != null ">assortid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="scriptno != null">#{scriptno},</if>
@@ -239,6 +243,7 @@
            <if test="score != null ">#{score},</if>
            <if test="ivrtext != null ">#{ivrtext},</if>
            <if test="groupName != null ">#{groupName},</if>
            <if test="assortid != null ">#{assortid},</if>
        </trim>
    </insert>
@@ -284,6 +289,7 @@
            <if test="branchFlag != null  and branchFlag != ''">branch_flag = #{branchFlag},</if>
            <if test="score != null ">score = #{score},</if>
            <if test="groupName != null ">group_name = #{groupName},</if>
            <if test="assortid != null ">assortid = #{assortid},</if>
            <if test="branchNextscriptno != null  and branchNextscriptno != ''">branch_nextscriptno =
                #{branchNextscriptno},
            </if>
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateScriptMapper.xml
@@ -48,11 +48,13 @@
        <result property="ivrtext" column="ivrtext"/>
        <result property="groupName" column="group_name"/>
        <result property="scriptTopic" column="script_topic"/>
        <result property="assortid" column="assortid"/>
    </resultMap>
    <sql id="selectIvrTaskTemplateScriptVo">
        select id,
               taskid,
               assortid,
               sort,
               ivrtext,
               script_type,
@@ -83,6 +85,7 @@
        <where>
            del_flag=0
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="assortid != null ">and assortid = #{assortid}</if>
            <if test="score != null ">and score = #{score}</if>
            <if test="scriptTopic != null ">and script_topic = #{scriptTopic}</if>
            <if test="ivrtext != null ">and ivrtext = #{ivrtext}</if>
@@ -175,6 +178,7 @@
            <if test="score != null ">score,</if>
            <if test="ivrtext != null ">ivrtext,</if>
            <if test="scriptTopic != null ">script_topic,</if>
            <if test="assortid != null ">assortid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -218,6 +222,7 @@
            <if test="score != null ">#{score},</if>
            <if test="ivrtext != null ">#{ivrtext},</if>
            <if test="scriptTopic != null ">#{scriptTopic},</if>
            <if test="assortid != null ">#{assortid},</if>
        </trim>
    </insert>
@@ -267,6 +272,7 @@
            <if test="score != null">score = #{score},</if>
            <if test="ivrtext != null">ivrtext = #{ivrtext},</if>
            <if test="scriptTopic != null ">script_topic = #{scriptTopic},</if>
            <if test="assortid != null ">assortid = #{assortid},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -513,8 +513,9 @@
    <select id="selectPatMedInhosp" parameterType="Long" resultMap="PatMedInhospResult">
        <include refid="selectPatMedInhospVo"/>
        where del_flag=0
        <if test="cry != null and cry == 0 ">and endtime is null</if>
        <if test="cry != null and cry == 0 ">and inhospstate=0</if>
        <if test="cry != null and cry == 1 ">and inhospstate=1</if>
        <if test="cry != null and cry == 3 ">and inhospstate=3</if>
        <if test="serialnum != null">and serialnum = #{serialnum}</if>
        <if test="hospitalname != null">and hospitalname = #{hospitalname}</if>
        <if test="hospitalcode != null">and hospitalcode = #{hospitalcode}</if>
smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -39,6 +39,7 @@
        <result property="idcardno" column="idcardno"/>
        <result property="remark" column="remark"/>
        <result property="fudate" column="fudate"/>
        <result property="serverState" column="server_state"/>
        <result property="campusid" column="campusid"/>
    </resultMap>
@@ -46,6 +47,7 @@
        select id,
               outhospno,
               campusid,
               server_state,
               diagcheck_flag,
               patno,
               remark,
@@ -87,6 +89,7 @@
        pmo.campusid,
        pmo.remark,
        pmo.fudate,
        pmo.server_state,
        pmo.outhospno,
        pmo.diagcheck_flag,
        pmo.patno,
@@ -121,6 +124,8 @@
        <where>
            pmo.del_flag=0
            <if test="orgid != null ">and pmo.orgid = #{orgid}</if>
            <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if>
            <if test="serverState != null ">and pmo.server_state = #{serverState}</if>
            <if test="hospitalname != null  and hospitalname != ''">and pmo.hospitalname like concat('%',
                #{hospitalname},
                '%')
@@ -132,8 +137,6 @@
                    #{deptcode}
                </foreach>
            </if>
            <if test="deptname != null  and deptname != ''">and pmo.deptname like concat('%', #{deptname}, '%')</if>
            <if test="drname != null  and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>
            <if test="patname != null  and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>
@@ -196,6 +199,7 @@
            <if test="fuflag != null">fuflag,</if>
            <if test="fudate != null">fudate,</if>
            <if test="campusid != null">campusid,</if>
            <if test="serverState != null">server_state,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="serialnum != null">#{serialnum},</if>
@@ -231,6 +235,7 @@
            <if test="fuflag != null">#{fuflag},</if>
            <if test="fudate != null">#{fudate},</if>
            <if test="campusid != null">#{campusid},</if>
            <if test="serverState != null">#{serverState},</if>
        </trim>
    </insert>
@@ -269,6 +274,7 @@
        fuflag,
        fudate,
        campusid,
        server_state,
        remark)
        values
        <foreach collection="list" item="item" separator=",">
@@ -305,6 +311,85 @@
            #{item.fuflag},
            #{item.fudate},
            #{item.campusid},
            #{item.serverState},
            #{item.remark}
            )
        </foreach>
    </insert>
    <insert id="batchInsertIgnore">
        insert ignore into pat_med_outhosp
        (
        serialnum,
        patid,
        hospitalname,
        hospitalcode,
        icd10code,
        diagname,
        deptcode,
        deptname,
        drcode,
        drname,
        admitdate,
        orgid,
        del_flag,
        update_by,
        update_time,
        create_by,
        create_time,
        isupload,
        upload_time,
        schemestatus,
        deptid,
        schemetime,
        hpi,
        mainsuit,
        outhospno,
        patname,
        guid,
        patno,
        diagcheck_flag,
        fuflag,
        fudate,
        campusid,
        server_state,
        remark)
        values
        <foreach collection="list" item="item" separator=",">
            (
            #{item.serialnum},
            #{item.patid},
            #{item.hospitalname},
            #{item.hospitalcode},
            #{item.icd10code},
            #{item.diagname},
            #{item.deptcode},
            #{item.deptname},
            #{item.drcode},
            #{item.drname},
            #{item.admitdate},
            #{item.orgid},
            #{item.delFlag},
            #{item.updateBy},
            #{item.updateTime},
            #{item.createBy},
            #{item.createTime},
            #{item.isupload},
            #{item.uploadTime},
            #{item.schemestatus},
            #{item.deptid},
            #{item.schemetime},
            #{item.hpi},
            #{item.mainsuit},
            #{item.outhospno},
            #{item.patname},
            #{item.guid},
            #{item.patno},
            #{item.diagcheckFlag},
            #{item.fuflag},
            #{item.fudate},
            #{item.campusid},
            #{item.serverState},
            #{item.remark}
            )
        </foreach>
@@ -347,6 +432,7 @@
            <if test="fuflag != null">fuflag = #{fuflag},</if>
            <if test="fudate != null">fudate = #{fudate},</if>
            <if test="campusid != null">campusid = #{campusid},</if>
            <if test="serverState != null">server_state = #{serverState},</if>
        </trim>
        where id = #{id}
    </update>
@@ -421,9 +507,12 @@
        FROM pat_med_outhosp
        <where>
            del_flag=0
            <if test="inhospstate != inhospstate">
            <if test="inhospstate != null">
                and inhospstate= #{inhospstate}
            </if>
            <if test="serverState != null">
                and server_state= #{inhospstate}
            </if>
            <if test="deptcodeList != null and deptcodeList.size()>0">
                and deptcode in
                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -35,6 +35,7 @@
        <result property="questiontext" column="questiontext"/>
        <result property="questionvoice" column="questionvoice"/>
        <result property="categoryname" column="categoryname"/>
        <result property="categoryid" column="categoryid"/>
        <result property="targetoptions" column="targetoptions"/>
        <result property="targetvalue" column="targetvalue"/>
        <result property="matchedtext" column="matchedtext"/>
@@ -99,6 +100,7 @@
               questiontext,
               questionvoice,
               categoryname,
               categoryid,
               targetoptions,
               targetvalue,
               matchedtext,
@@ -146,6 +148,7 @@
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
            <if test="templatequestionnum != null ">and templatequestionnum = #{templatequestionnum}</if>
            <if test="switchid != null ">and switchid = #{switchid}</if>
            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
            <if test="questiontext != null  and questiontext != ''">and questiontext = #{questiontext}</if>
            <if test="questionvoice != null  and questionvoice != ''">and questionvoice = #{questionvoice}</if>
            <if test="categoryname != null  and categoryname != ''">and categoryname like concat('%', #{categoryname},
@@ -225,6 +228,7 @@
            <if test=" patid != null">patid,</if>
            <if test=" extemplateText != null">extemplate_text,</if>
            <if test=" guid != null">guid,</if>
            <if test=" categoryid != null">categoryid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
@@ -276,6 +280,7 @@
            <if test="patid != null">#{patid},</if>
            <if test="extemplateText != null">#{extemplateText},</if>
            <if test="guid != null">#{guid},</if>
            <if test="categoryid != null">#{categoryid},</if>
        </trim>
    </insert>
@@ -330,6 +335,7 @@
            <if test=" patid != null">patid = #{patid},</if>
            <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
            <if test=" guid != null">guid = #{guid},</if>
            <if test=" categoryid != null">categoryid = #{categoryid},</if>
        </trim>
        where id = #{id}
    </update>
@@ -386,6 +392,7 @@
            <if test=" patid != null">patid = #{patid},</if>
            <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
            <if test=" guid != null">guid = #{guid},</if>
            <if test=" categoryid != null">categoryid = #{categoryid},</if>
        </trim>
        where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
    </update>
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -197,12 +197,16 @@
        <include refid="selectServiceSubtaskVo"/>
        <where>
            del_flag=0
            and taskid = #{taskid}
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="serviceType != null ">and service_type = #{serviceType}</if>
            <if test="patid != null ">and patid = #{patid}</if>
            <if test="sendstates!=null">
            AND sendstate IN
            <foreach collection="sendstates" item="sendstate" open="(" separator=","
                     close=")">
                #{sendstate}
            </foreach>
            </if>
        </where>
    </select>
@@ -552,6 +556,20 @@
        where id = #{id}
    </select>
    <select id="selectServiceSubtaskByDiagname" parameterType="com.smartor.domain.ServiceSubtask"
            resultMap="ServiceSubtaskResult">
        select sendstate,starttime,endtime,nurse_name,phone,sex,task_name,sendname,leavediagname,visit_time FROM
        service_subtask WHERE del_flag=0
        <if test="leavediagname != null">and leavediagname like concat('%',#{leavediagname}, '%')</if>
        <if test="sendname != null">and sendname like concat('%',#{sendname}, '%')</if>
        <if test="taskName != null">and task_name like concat('%',#{taskName}, '%')</if>
        <if test="sendstate != null">and sendstate = #{sendstate}</if>
        <if test="orgid != null">and orgid =#{orgid}</if>
        GROUP BY sendname,sendstate,starttime,endtime,nurse_name,phone,sex,task_name,leavediagname,visit_time ORDER BY
        visit_time
        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
    </select>
    <insert id="insertServiceSubtask" parameterType="com.smartor.domain.ServiceSubtask" useGeneratedKeys="true"
            keyProperty="id">
        insert into service_subtask
smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
@@ -152,8 +152,9 @@
            </if>
            <if test="endTime != null ">and date_format(update_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
            </if>
            <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
            <if test="deptcode != null  and deptcode != ''">
                and deptcode REGEXP CONCAT('(^|,)', #{deptcode}, '(,|$)')
            </if>
            <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
@@ -173,10 +174,9 @@
            <if test="leavehospitaldistrictname != null  ">and leavehospitaldistrictname =
                #{leavehospitaldistrictname}
            </if>
            <if test="leavehospitaldistrictcode != null  ">and leavehospitaldistrictcode =
                #{leavehospitaldistrictcode}
            <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">
                and leavehospitaldistrictcode REGEXP CONCAT('(^|,)', #{leavehospitaldistrictcode}, '(,|$)')
            </if>
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
                AND leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
@@ -95,6 +95,7 @@
        <where>
            del_flag=0
            <if test="templateid != null ">and templateid = #{templateid}</if>
            <if test="id != null ">and id = #{id}</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>
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
@@ -44,6 +44,7 @@
        <result property="score" column="score"/>
        <result property="prompt" column="prompt"/>
        <result property="groupName" column="group_name"/>
        <result property="categoryid" column="categoryid"/>
    </resultMap>
@@ -52,6 +53,7 @@
               sort,
               ishide,
               prompt,
               categoryid,
               group_name,
               branch_flag,
               branch_nextscriptno,
@@ -72,6 +74,7 @@
        <include refid="selectSvyTaskTemplateScriptVo"/>
        <where>
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
            <if test="ishide != null ">and ishide = #{ishide}</if>
            <if test="scriptno != null ">and scriptno = #{scriptno}</if>
            <if test="templateID != null ">and templateID = #{templateID}</if>
@@ -157,6 +160,7 @@
            <if test="prompt != null ">prompt,</if>
            <if test="groupName != null ">group_name,</if>
            <if test="ishide != null ">ishide,</if>
            <if test="categoryid != null ">categoryid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -197,6 +201,7 @@
            <if test="prompt != null ">#{prompt},</if>
            <if test="groupName != null ">#{groupName},</if>
            <if test="ishide != null ">#{ishide},</if>
            <if test="categoryid != null ">#{categoryid},</if>
        </trim>
    </insert>
@@ -243,6 +248,7 @@
            <if test="prompt != null">prompt = #{prompt},</if>
            <if test="groupName != null ">group_name = #{groupName},</if>
            <if test="ishide != null ">ishide = #{ishide},</if>
            <if test="categoryid != null ">categoryid = #{categoryid},</if>
        </trim>
        where id = #{d}
    </update>
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateTargetoptionMapper.xml
@@ -73,6 +73,7 @@
            resultMap="SvyTaskTemplateTargetoptionResult">
        <include refid="selectSvyTaskTemplateTargetoptionVo"/>
        <where>
            del_flag=0
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="score != null ">and score = #{score}</if>
            <if test="prompt != null ">and prompt = #{prompt}</if>
@@ -99,8 +100,8 @@
            <if test="pid != null ">and pid = #{pid}</if>
            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
            <if test="scriptid != null ">and scriptid = #{scriptid}</if>
            <if test="nodynamiccruxs != null ">and nodynamiccruxs = #{nodynamiccruxsJson}</if>
            <if test="dynamiccruxs != null ">and dynamiccruxs = #{dynamiccruxsJson}</if>
<!--            <if test="nodynamiccruxs != null ">and nodynamiccruxs = #{nodynamiccruxsJson}</if>-->
<!--            <if test="dynamiccruxs != null ">and dynamiccruxs = #{dynamiccruxsJson}</if>-->
            <if test="nextQuestion != null ">and next_question = #{nextQuestion}</if>
            <if test="picturePath != null  and picturePath != ''">and picture_path = #{picturePath}</if>
            <if test="optionCode != null">and option_code = #{optionCode}</if>