陈昶聿
昨天 cc3fe1ad9b366533d184d9e239b45f731f014e74
Merge branch 'master' into master-手术随访
已删除1个文件
已修改42个文件
已添加2个文件
1116 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/EquipmentinfoController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/DingTalkController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/AesUtils.java 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxMpUtils.java 175 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/pom.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SmsRecordsServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserDeptServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/BaseSmsRequest.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedInhosp.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/DingTalkService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceExternalService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateTargetoptionMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -757,6 +757,7 @@
                if (allSendStateNot1AndNot9) {
                    //说明全发送失败了
                    serviceSubtask.setSendstate(5L);
                    serviceSubtask.setUpdateTime(new Date());
                    serviceSubtask.setRemark("-----getSendPreachform,发送方式全部失败");
                    serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/EquipmentinfoController.java
@@ -7,8 +7,6 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.ReportReqVo;
import com.ruoyi.system.service.IBaseUserInfoService;
import com.smartor.domain.DingTalkReqVo;
import com.smartor.service.DingTalkService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java
@@ -4,6 +4,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.domain.*;
@@ -14,10 +15,7 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap;
@@ -374,6 +372,21 @@
        return returnParam(aBoolean, dataMap);
    }
    /**
     * 360患者信息获取
     */
    @ApiOperation("360患者信息获取(来未来)")
    @GetMapping("/query360PatInfolwl/{patid}")
    public Map<String, Object> query360PatInfolwl(@PathVariable("patid") Long patid) {
        Map<String, Object> result = new HashMap<>();
        if (patid == null) {
            result.put("url", null);
            result.put("error", "患者id为空");
            return result;
        }
        LoginUser loginUser = getLoginUser();
        return serviceExternalService.query360PatInfolwl(patid, loginUser.getUser());
    }
    private Map<String, Object> returnParam(Boolean b, Map dataMap) {
@@ -395,9 +408,6 @@
        map.put("Data", map2);
        return map;
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -437,37 +437,6 @@
    }
    /**
     * æ–°å¢žæˆ–修改删除单一任务(临时接口)
     */
    @ApiOperation("新增或修改删除单一任务(临时接口)")
    //@PreAuthorize("@ss.hasPermi('system:task:add')")
    @Log(title = "单一任务(随访)", businessType = BusinessType.INSERT)
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/insertOrUpdateTaskByTaskId")
    public AjaxResult insertOrUpdateTaskByTaskId(@RequestBody ServiceTaskVO ivrTaskVO) {
        log.info("insertOrUpdateTaskByTaskId的入参为:{}", ivrTaskVO);
        LoginUser loginUser = getLoginUser();
        SysUser user = loginUser.getUser();
        ivrTaskVO.setCreateBy(user.getNickName());
        ivrTaskVO.setUpdateBy(user.getNickName());
        ivrTaskVO.setOrgid(user.getOrgid());
        //根据入参查询信息-用户关系
        ServiceSubtask serviceSubtask = new ServiceSubtask();
        if(ObjectUtils.isNotEmpty(ivrTaskVO.getTaskid())){
            serviceSubtask.setTaskid(ivrTaskVO.getTaskid());
            serviceSubtask.setOrgid(user.getOrgid());
            serviceSubtask.setCampusid(user.getCampusid());
            ServiceTaskVO ivrTaskVO1 = serviceSubtaskService.queryTaskByCondition(serviceSubtask);
            ivrTaskVO.setPatTaskRelevances(ivrTaskVO1.getPatTaskRelevances());
            return success(serviceSubtaskService.insertOrUpdateTask(ivrTaskVO));
        }else {
            return error("insertOrUpdateTaskByTaskId taskid不可为空");
        }
    }
    /**
     * ç”µè¯å›žè°ƒä»»åŠ¡(上海)
     */
    @ApiOperation("电话回调任务")
@@ -758,6 +727,5 @@
        }
        return map;
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/BaseSmsaccountController.java
@@ -12,6 +12,7 @@
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.sms.smsUtils;
import com.smartor.common.MtSubmitSmUtil;
import com.smartor.domain.BaseSmsRequest;
import com.smartor.domain.BaseSmsaccount;
import com.smartor.domain.BatchBaseSmsRequest;
@@ -27,6 +28,7 @@
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
 * çŸ­ä¿¡è´¦å·Controller
@@ -52,6 +54,9 @@
    @Value("${spring.profiles.active}")
    private String active;
    @Autowired
    private MtSubmitSmUtil mtSubmitSmUtil;
    /**
     * æŸ¥è¯¢çŸ­ä¿¡è´¦å·åˆ—表
@@ -135,6 +140,10 @@
                return AjaxResult.error(ex.getMessage());
            }
            return AjaxResult.success(sendMsg);
        } else if (active.equals("nhfy")) {
            Map<String, Object> smsResult = mtSubmitSmUtil.submitSm(baseSmsRequest.getPhoneNumber(), baseSmsRequest.getTemplateCode());
            return AjaxResult.success(smsResult.get("result"));
        } else {
            if (baseSmsaccountService.sendMsg(baseSmsRequest) == null) {
                return error();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/DingTalkController.java
@@ -1,7 +1,7 @@
package com.ruoyi.web.controller.smartor.tools;
import com.ruoyi.common.core.controller.BaseController;
import com.smartor.domain.DingTalkReqVo;
import com.ruoyi.common.core.domain.DingTalkReqVo;
import com.smartor.service.DingTalkService;
import com.taobao.api.ApiException;
import io.swagger.annotations.Api;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -15,10 +15,11 @@
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysMenuService;
import com.smartor.mapper.SysUserDeptMapper;
import com.ruoyi.system.mapper.SysUserDeptMapper;
import com.smartor.service.IServiceSLTDHealthcareRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.view.RedirectView;
@@ -55,6 +56,7 @@
    private IServiceSLTDHealthcareRecordService iServiceSLTDHealthcareRecordService;
    @Autowired
    @Qualifier("sysUserDeptSystemMapper")
    private SysUserDeptMapper sysUserDeptMapper;
    /**
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -20,12 +20,13 @@
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import com.smartor.mapper.SysUserDeptMapper;
import com.ruoyi.system.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;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -60,6 +61,7 @@
    private ISysPostService postService;
    @Autowired
    @Qualifier("sysUserDeptSystemMapper")
    private SysUserDeptMapper sysUserDeptMapper;
    @Value("${isAdmin}")
ruoyi-common/src/main/java/com/ruoyi/common/utils/AesUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,129 @@
package com.ruoyi.common.utils;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
/**
 * AES åŠ è§£å¯†å·¥å…·ç±»
 * ç®—法:AES/CBC/PKCS5Padding(等效 PKCS7,128 ä½æ•°æ®å—)
 * è¾“出:HEX å¤§å†™å­—符串
 * å­—符集:UTF-8
 */
public class AesUtils {
    /** ç®—法/模式/填充 */
    private static final String ALGORITHM = "AES/CBC/PKCS5Padding";
    /** é»˜è®¤ Key(HEX,32字节→256位密钥) */
    private static final String DEFAULT_KEY = "0F471C56362408AF8DB929C38EDFD23C";
    /** é»˜è®¤ IV(HEX,16字节→128位偏移量) */
    private static final String DEFAULT_IV = "11BEE6E35B881A33CF1649607295D1A7";
    private AesUtils() {
    }
    // -------------------------------------------------------------------------
    // å…¬å…± API
    // -------------------------------------------------------------------------
    /**
     * ä½¿ç”¨é»˜è®¤ Key / IV åР坆
     *
     * @param plainText æ˜Žæ–‡
     * @return HEX å¤§å†™å¯†æ–‡
     */
    public static String encrypt(String plainText) {
        return encrypt(plainText, DEFAULT_KEY, DEFAULT_IV);
    }
    /**
     * ä½¿ç”¨é»˜è®¤ Key / IV è§£å¯†
     *
     * @param hexCipherText HEX å¤§å†™å¯†æ–‡
     * @return æ˜Žæ–‡
     */
    public static String decrypt(String hexCipherText) {
        return decrypt(hexCipherText, DEFAULT_KEY, DEFAULT_IV);
    }
    /**
     * AES-CBC åР坆
     *
     * @param plainText  æ˜Žæ–‡
     * @param hexKey     HEX æ ¼å¼çš„密钥(16/24/32字节对应128/192/256位)
     * @param hexIv      HEX æ ¼å¼çš„偏移量(16字节)
     * @return HEX å¤§å†™å¯†æ–‡
     */
    public static String encrypt(String plainText, String hexKey, String hexIv) {
        try {
            byte[] keyBytes = hexToBytes(hexKey);
            byte[] ivBytes = hexToBytes(hexIv);
            SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
            IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
            Cipher cipher = Cipher.getInstance(ALGORITHM);
            cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivSpec);
            byte[] encrypted = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
            return bytesToHex(encrypted).toUpperCase();
        } catch (Exception e) {
            throw new RuntimeException("AES åŠ å¯†å¤±è´¥", e);
        }
    }
    /**
     * AES-CBC è§£å¯†
     *
     * @param hexCipherText HEX å¤§å†™å¯†æ–‡
     * @param hexKey        HEX æ ¼å¼çš„密钥
     * @param hexIv         HEX æ ¼å¼çš„偏移量
     * @return æ˜Žæ–‡
     */
    public static String decrypt(String hexCipherText, String hexKey, String hexIv) {
        try {
            byte[] keyBytes = hexToBytes(hexKey);
            byte[] ivBytes = hexToBytes(hexIv);
            byte[] cipherBytes = hexToBytes(hexCipherText);
            SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
            IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
            Cipher cipher = Cipher.getInstance(ALGORITHM);
            cipher.init(Cipher.DECRYPT_MODE, secretKey, ivSpec);
            byte[] decrypted = cipher.doFinal(cipherBytes);
            return new String(decrypted, StandardCharsets.UTF_8);
        } catch (Exception e) {
            throw new RuntimeException("AES è§£å¯†å¤±è´¥", e);
        }
    }
    // -------------------------------------------------------------------------
    // ç§æœ‰è¾…助方法
    // -------------------------------------------------------------------------
    /**
     * HEX å­—符串转字节数组(大小写均可)
     */
    private static byte[] hexToBytes(String hex) {
        if (hex == null || hex.length() % 2 != 0) {
            throw new IllegalArgumentException("非法 HEX å­—符串:" + hex);
        }
        int len = hex.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4)
                    + Character.digit(hex.charAt(i + 1), 16));
        }
        return data;
    }
    /**
     * å­—节数组转 HEX å­—符串(小写,调用方统一转大写)
     */
    private static String bytesToHex(byte[] bytes) {
        StringBuilder sb = new StringBuilder(bytes.length * 2);
        for (byte b : bytes) {
            sb.append(String.format("%02x", b));
        }
        return sb.toString();
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxMpUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,175 @@
package com.ruoyi.common.utils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import java.util.Map;
/**
 * å¾®ä¿¡å…¬ä¼—号消息发送工具类
 * æ”¯æŒï¼šæ–‡æœ¬å®¢æœæ¶ˆæ¯ã€æ¨¡æ¿æ¶ˆæ¯
 */
@Slf4j
public class WxMpUtils {
    private final WxMpService wxMpService;
    /**
     * æž„造方法,通过 appId å’Œ appSecret åˆå§‹åŒ–微信公众号服务
     *
     * @param appId     å¾®ä¿¡å…¬ä¼—号 AppID
     * @param appSecret å¾®ä¿¡å…¬ä¼—号 AppSecret
     */
    public WxMpUtils(String appId, String appSecret) {
        WxMpInMemoryConfigStorage configStorage = new WxMpInMemoryConfigStorage();
        configStorage.setAppId(appId);
        configStorage.setSecret(appSecret);
        wxMpService = new WxMpServiceImpl();
        wxMpService.setWxMpConfigStorage(configStorage);
    }
    // -------------------------------------------------------------------------
    // æ–‡æœ¬å®¢æœæ¶ˆæ¯
    // -------------------------------------------------------------------------
    /**
     * å‘指定 openid çš„用户发送文本客服消息
     * æ³¨æ„ï¼šç”¨æˆ·éœ€åœ¨48小时内与公众号有过交互才可发送
     *
     * @param openid  ç”¨æˆ·çš„微信 openid
     * @param content æ¶ˆæ¯å†…容
     * @return å‘送成功返回 true,失败返回 false
     */
    public boolean sendTextMessage(String openid, String content) {
        if (StringUtils.isEmpty(openid)) {
            log.warn("【WxMpUtils】sendTextMessage å¤±è´¥ï¼šopenid ä¸ºç©º");
            return false;
        }
        if (StringUtils.isEmpty(content)) {
            log.warn("【WxMpUtils】sendTextMessage å¤±è´¥ï¼šcontent ä¸ºç©º");
            return false;
        }
        try {
            WxMpKefuMessage message = WxMpKefuMessage.TEXT()
                    .toUser(openid)
                    .content(content)
                    .build();
            boolean result = wxMpService.getKefuService().sendKefuMessage(message);
            log.info("【WxMpUtils】文本客服消息发送{},openid:{}", result ? "成功" : "失败", openid);
            return result;
        } catch (WxErrorException e) {
            log.error("【WxMpUtils】文本客服消息发送异常,openid:{},错误:{}", openid, e.getError(), e);
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // æ¨¡æ¿æ¶ˆæ¯
    // -------------------------------------------------------------------------
    /**
     * å‘指定 openid çš„用户发送模板消息(含跳转URL)
     *
     * @param openid     ç”¨æˆ·çš„微信 openid
     * @param templateId æ¨¡æ¿æ¶ˆæ¯ ID(在微信公众平台配置)
     * @param url        ç‚¹å‡»æ¶ˆæ¯åŽçš„跳转 URL,不需要跳转可传 null
     * @param dataMap    æ¨¡æ¿æ•°æ®ï¼Œkey ä¸ºæ¨¡æ¿å­—段名,value ä¸º WxMpTemplateData(含值和颜色)
     *                   ç¤ºä¾‹ï¼š{"first": new WxMpTemplateData("first", "你好", "#173177"), ...}
     * @return å‘送成功返回微信返回的 msgid,失败返回 null
     */
    public String sendTemplateMessage(String openid, String templateId, String url,
                                      Map<String, WxMpTemplateData> dataMap) {
        if (StringUtils.isEmpty(openid)) {
            log.warn("【WxMpUtils】sendTemplateMessage å¤±è´¥ï¼šopenid ä¸ºç©º");
            return null;
        }
        if (StringUtils.isEmpty(templateId)) {
            log.warn("【WxMpUtils】sendTemplateMessage å¤±è´¥ï¼štemplateId ä¸ºç©º");
            return null;
        }
        try {
            WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
            templateMessage.setToUser(openid);
            templateMessage.setTemplateId(templateId);
            if (StringUtils.isNotEmpty(url)) {
                templateMessage.setUrl(url);
            }
            if (dataMap != null) {
                for (WxMpTemplateData data : dataMap.values()) {
                    templateMessage.addData(data);
                }
            }
            String msgId = wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
            log.info("【WxMpUtils】模板消息发送成功,openid:{},msgId:{}", openid, msgId);
            return msgId;
        } catch (WxErrorException e) {
            log.error("【WxMpUtils】模板消息发送异常,openid:{},templateId:{},错误:{}",
                    openid, templateId, e.getError(), e);
            return null;
        }
    }
    /**
     * å‘指定 openid çš„用户发送模板消息(简化版,value ä¸è®¾ç½®é¢œè‰²ï¼‰
     *
     * @param openid     ç”¨æˆ·çš„微信 openid
     * @param templateId æ¨¡æ¿æ¶ˆæ¯ ID
     * @param url        ç‚¹å‡»æ¶ˆæ¯åŽçš„跳转 URL,不需要跳转可传 null
     * @param dataMap    æ¨¡æ¿æ•°æ®ï¼Œkey ä¸ºæ¨¡æ¿å­—段名,value ä¸ºå­—段显示的文本内容
     *                   ç¤ºä¾‹ï¼š{"first": "你好", "keyword1": "2024-01-01", "remark": "感谢使用"}
     * @return å‘送成功返回微信返回的 msgid,失败返回 null
     */
    public String sendTemplateMessage(String openid, String templateId, String url,
                                      Map<String, String> dataMap, String defaultColor) {
        if (StringUtils.isEmpty(openid)) {
            log.warn("【WxMpUtils】sendTemplateMessage å¤±è´¥ï¼šopenid ä¸ºç©º");
            return null;
        }
        if (StringUtils.isEmpty(templateId)) {
            log.warn("【WxMpUtils】sendTemplateMessage å¤±è´¥ï¼štemplateId ä¸ºç©º");
            return null;
        }
        try {
            WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
            templateMessage.setToUser(openid);
            templateMessage.setTemplateId(templateId);
            if (StringUtils.isNotEmpty(url)) {
                templateMessage.setUrl(url);
            }
            if (dataMap != null) {
                String color = StringUtils.isEmpty(defaultColor) ? "#173177" : defaultColor;
                for (Map.Entry<String, String> entry : dataMap.entrySet()) {
                    templateMessage.addData(new WxMpTemplateData(entry.getKey(), entry.getValue(), color));
                }
            }
            String msgId = wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
            log.info("【WxMpUtils】模板消息发送成功,openid:{},msgId:{}", openid, msgId);
            return msgId;
        } catch (WxErrorException e) {
            log.error("【WxMpUtils】模板消息发送异常,openid:{},templateId:{},错误:{}",
                    openid, templateId, e.getError(), e);
            return null;
        }
    }
    // -------------------------------------------------------------------------
    // é™æ€å·¥åŽ‚æ–¹æ³•ï¼ˆå¿«é€Ÿæž„é€ ï¼‰
    // -------------------------------------------------------------------------
    /**
     * å¿«é€Ÿåˆ›å»º WxMpUtils å®žä¾‹
     *
     * @param appId     å¾®ä¿¡å…¬ä¼—号 AppID
     * @param appSecret å¾®ä¿¡å…¬ä¼—号 AppSecret
     * @return WxMpUtils å®žä¾‹
     */
    public static WxMpUtils of(String appId, String appSecret) {
        return new WxMpUtils(appId, appSecret);
    }
}
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -609,6 +609,18 @@
        }
    }
    /**
     * è®¾ç½®å¤±è´¥ä»»åŠ¡é»˜è®¤å€¼,并将失败任务重新置为成功
     * <p>
     * *@param failDay   (失败天数:距离当前日期失败天数)
     *
     * @return
     */
    public void setFailSubTaskDefalutVal() {
        String failDay = configService.selectConfigByKey("hosp.default.fail.day");
        if (StringUtils.isNotEmpty(failDay)) iServiceSubtaskService.setFailSubTaskDefalutVal(Long.valueOf(failDay));
    }
    /**
     * åˆ¤æ–­æ—¥æœŸæ˜¯å¦æ˜¯ä»Šå¤©
@@ -616,7 +628,7 @@
     * @param date
     * @return
     */
    public boolean isDateToday(Date date) {
    private boolean isDateToday(Date date) {
        if (date == null) {
            return false;
        }
@@ -633,7 +645,7 @@
     *
     * @param serviceSubtask
     */
    public void sfHandlle(ServiceSubtask serviceSubtask) {
    private void sfHandlle(ServiceSubtask serviceSubtask) {
        //这里需要根据身份证去重(给微信小程序的固定任务用的)
        List<ServiceSubtask> serviceSubtaskListFilter = new ArrayList<>();
        ServiceTask ivrTask1 = serviceTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
ruoyi-system/pom.xml
@@ -22,13 +22,17 @@
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common</artifactId>
        </dependency>
        <!-- WebService (短信发送) -->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>smartor</artifactId>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>smartor</artifactId>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis-jaxrpc</artifactId>
            <version>1.4</version>
        </dependency>
    </dependencies>
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.system.domain.SysConfig;
/**
@@ -8,7 +9,7 @@
 *
 * @author ruoyi
 */
public interface ISysConfigService
public interface ISysConfigService extends IConfigService
{
    /**
     * æŸ¥è¯¢å‚数配置信息
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java
@@ -2,10 +2,11 @@
import java.util.List;
import com.ruoyi.common.core.domain.DingTalkReqVo;
import com.ruoyi.common.core.service.IDingTalkService;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.ReportReqVo;
import com.smartor.domain.DingTalkReqVo;
import com.smartor.service.DingTalkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.EquipmentinfoMapper;
@@ -23,8 +24,7 @@
    @Autowired
    private EquipmentinfoMapper equipmentinfoMapper;
    @Autowired
    private DingTalkService dingTalkService;
    /**
@@ -119,6 +119,7 @@
            dingTalkReqVo.setContents(null);
            dingTalkReqVo.setDeptId(Long.valueOf(reportReqVo.getDealDeptID()));
            dingTalkReqVo.setUserId(reportReqVo.getDealPersionDingNO());
            IDingTalkService dingTalkService = SpringUtils.getBean(IDingTalkService.class);
            aBoolean = dingTalkService.sendNotification(dingTalkReqVo);
        }
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SmsRecordsServiceImpl.java
@@ -15,9 +15,8 @@
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 com.ruoyi.common.core.service.ISubtaskSmsService;
import com.ruoyi.common.utils.spring.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -41,9 +40,6 @@
    @Autowired
    private ISysConfigService iSysConfigService;
    @Autowired
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private ISysConfigService configService;
@@ -109,10 +105,10 @@
        List<SmsRecords> selectSmsRecordsList = smsRecordsMapper.selectSmsRecordsList(smsRecords);
        for (SmsRecords record : selectSmsRecordsList) {
            Boolean aBoolean = sendSMS(record.getOrgid(), record.getPhone(), record.getMsg());
            ServiceSubtask serviceSubtask = new ServiceSubtask();
            serviceSubtask.setId(record.getSubId());
            if (aBoolean) serviceSubtask.setVisitNotice(1);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
            if (aBoolean) {
                ISubtaskSmsService subtaskSmsService = SpringUtils.getBean(ISubtaskSmsService.class);
                subtaskSmsService.updateSubtaskVisitNotice(record.getSubId(), 1);
            }
        }
        return true;
@@ -137,7 +133,8 @@
            }
            log.info("-----------map的值为:{}", msgInfo);
            String token = LSHospTokenUtil.getToken(orgid,msgInfo.get("tokenUrl"));
            ISubtaskSmsService subtaskSmsService = SpringUtils.getBean(ISubtaskSmsService.class);
            String token = subtaskSmsService.getLSHospToken(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);
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserDeptServiceImpl.java
@@ -4,9 +4,10 @@
import com.ruoyi.common.core.domain.entity.SysUserDept;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.service.ISysUserDeptService;
import com.smartor.mapper.SysUserDeptMapper;
import com.ruoyi.system.mapper.SysUserDeptMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.Date;
@@ -21,6 +22,7 @@
@Service
public class SysUserDeptServiceImpl implements ISysUserDeptService {
    @Autowired
    @Qualifier("sysUserDeptSystemMapper")
    private SysUserDeptMapper sysUserDeptMapper;
    @Autowired
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -14,17 +14,12 @@
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import com.smartor.domain.IvrLibaScriptAssort;
import com.smartor.domain.SvyLibScriptCategory;
import com.smartor.domain.SvyTaskVO;
import com.smartor.domain.SysUserOrg;
import com.smartor.mapper.IvrLibaScriptAssortMapper;
import com.smartor.mapper.SvyLibScriptCategoryMapper;
import com.smartor.mapper.SysUserDeptMapper;
import com.smartor.mapper.SysUserOrgMapper;
import com.ruoyi.common.core.service.IUserExtInfoService;
import com.ruoyi.system.mapper.SysUserDeptMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -36,7 +31,7 @@
import java.util.stream.Collectors;
/**
 * ç”¨æˆ· ä¸šåŠ¡å±‚å¤„ç†
 * ç”¨æˆ· ä¸šåŠ¡å±‚å¤„ï¿½?
 *
 * @author ruoyi
 */
@@ -48,19 +43,12 @@
    private SysUserMapper userMapper;
    @Autowired
    private SysUserOrgMapper sysUserOrgMapper;
    @Autowired
    private SysDeptMapper sysDeptMapper;
    @Autowired
    @Qualifier("sysUserDeptSystemMapper")
    private SysUserDeptMapper sysUserDeptMapper;
    @Autowired
    private IvrLibaScriptAssortMapper ivrLibaScriptAssortMapper;
    @Autowired
    private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
    @Autowired
    private SysRoleMapper roleMapper;
@@ -102,7 +90,7 @@
    }
    /**
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢å·²åˆ†é…ç”¨æˆ·è§’色列表
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢å·²åˆ†é…ç”¨æˆ·è§’色列�?
     *
     * @param user ç”¨æˆ·ä¿¡æ¯
     * @return ç”¨æˆ·ä¿¡æ¯é›†åˆä¿¡æ¯
@@ -114,7 +102,7 @@
    }
    /**
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢æœªåˆ†é…ç”¨æˆ·è§’色列表
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢æœªåˆ†é…ç”¨æˆ·è§’色列�?
     *
     * @param user ç”¨æˆ·ä¿¡æ¯
     * @return ç”¨æˆ·ä¿¡æ¯é›†åˆä¿¡æ¯
@@ -126,9 +114,9 @@
    }
    /**
     * é€šè¿‡ç”¨æˆ·åæŸ¥è¯¢ç”¨æˆ·
     * é€šè¿‡ç”¨æˆ·åæŸ¥è¯¢ç”¨ï¿½?
     *
     * @param userName ç”¨æˆ·å
     * @param userName ç”¨æˆ·ï¿½?
     * @return ç”¨æˆ·å¯¹è±¡ä¿¡æ¯
     */
    @Override
@@ -190,15 +178,15 @@
        String[] split = userName.split("&");
        SysUser sysUser = userMapper.selectUserByUserNameByCondition(split[0], split[1], null);
        //获取当前登陆人的机构和院区
        SysUserOrg sysUserOrg = new SysUserOrg();
        sysUserOrg.setUserId(sysUser.getUserId().toString());
        sysUserOrg.setOrgid(split[1].equals("null") ? "" : split[1]);
        sysUserOrg.setCampusid(split[2].equals("null") ? "" : split[2]);
        List<SysUserOrg> sysUserOrgs = sysUserOrgMapper.selectSysUserOrgList(sysUserOrg);
        if (!CollectionUtils.isEmpty(sysUserOrgs)) {
            sysUser.setOrgid(sysUserOrgs.get(0).getOrgid());
            sysUser.setCampusid(sysUserOrgs.get(0).getCampusid());
        //获取当前登陆人的机构和院�?
        IUserExtInfoService userExtInfoService = SpringUtils.getBean(IUserExtInfoService.class);
        Map<String, String> userOrgInfo = userExtInfoService.getUserOrgInfo(
                sysUser.getUserId().toString(),
                split[1],
                split[2]);
        if (!userOrgInfo.isEmpty()) {
            sysUser.setOrgid(userOrgInfo.get("orgid"));
            sysUser.setCampusid(userOrgInfo.get("campusid"));
        }
        if (Objects.isNull(sysUser)) return sysUser;
@@ -300,40 +288,9 @@
            //获取当前机构的满意度问题分类
            sysUser.setBelongDepts(list);
            Map<String, Object> satisfactionCategories = new HashMap<>();
            //获取语音问题分类
            IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort();
            ivrLibaScriptAssort.setOrgid(sysUser.getOrgid());
            ivrLibaScriptAssort.setType("myd");
            List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort);
            List<Map<String, Object>> categoryList = new ArrayList<>();
            if (!CollectionUtils.isEmpty(ivrLibaScriptAssorts)) {
                for (IvrLibaScriptAssort assort : ivrLibaScriptAssorts) {
                    Map<String, Object> map = new HashMap<>();
                    map.put("categoryid", assort.getId());
                    map.put("categoryName", assort.getIndexAssortName());
                    categoryList.add(map);
                }
            }
            satisfactionCategories.put("voiceCategories", categoryList);
            //获取问卷问题分类
            SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory();
            svyLibScriptCategory.setOrgid(sysUser.getOrgid());
            svyLibScriptCategory.setType("myd");
            List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory);
            List<Map<String, Object>> questionnaireCategorys = new ArrayList<>();
            if (!CollectionUtils.isEmpty(svyLibScriptCategories)) {
                for (SvyLibScriptCategory scriptCategory : svyLibScriptCategories) {
                    Map<String, Object> map = new HashMap<>();
                    map.put("categoryid", scriptCategory.getId());
                    map.put("categoryName", scriptCategory.getName());
                    questionnaireCategorys.add(map);
                }
            }
            satisfactionCategories.put("questionnaireCategorys", questionnaireCategorys);
            //设置当前用户的声音问题分类和问卷问题分类
            sysUser.setSatisfactionCategories(satisfactionCategories);
            IUserExtInfoService userExtInfoService3 = SpringUtils.getBean(IUserExtInfoService.class);
            sysUser.setSatisfactionCategories(userExtInfoService3.getSatisfactionCategories(sysUser.getOrgid()));
        }
        return sysUser;
    }
@@ -346,15 +303,15 @@
        }
        SysUser sysUser = userMapper.selectUserByUserNameByCondition(split[0], split[1], split[2]);
        //获取当前登陆人的机构和院区
        SysUserOrg sysUserOrg = new SysUserOrg();
        sysUserOrg.setUserId(sysUser.getUserId().toString());
        sysUserOrg.setOrgid(split[1].equals("null") ? "" : split[1]);
        sysUserOrg.setCampusid(split[3].equals("null") ? "" : split[3]);
        List<SysUserOrg> sysUserOrgs = sysUserOrgMapper.selectSysUserOrgList(sysUserOrg);
        if (!CollectionUtils.isEmpty(sysUserOrgs)) {
            sysUser.setOrgid(sysUserOrgs.get(0).getOrgid());
            sysUser.setCampusid(sysUserOrgs.get(0).getCampusid());
        //获取当前登陆人的机构和院�?
        IUserExtInfoService userExtInfoService2 = SpringUtils.getBean(IUserExtInfoService.class);
        Map<String, String> userOrgInfo2 = userExtInfoService2.getUserOrgInfo(
                sysUser.getUserId().toString(),
                split[1],
                split[3]);
        if (!userOrgInfo2.isEmpty()) {
            sysUser.setOrgid(userOrgInfo2.get("orgid"));
            sysUser.setCampusid(userOrgInfo2.get("campusid"));
        }
        log.info("selectUserByUserNameAndDeptId的sysUser的值为:{}", sysUser);
@@ -481,7 +438,7 @@
    /**
     * æŸ¥è¯¢ç”¨æˆ·æ‰€å±žè§’色组
     *
     * @param userName ç”¨æˆ·å
     * @param userName ç”¨æˆ·ï¿½?
     * @return ç»“æžœ
     */
    @Override
@@ -496,7 +453,7 @@
    /**
     * æŸ¥è¯¢ç”¨æˆ·æ‰€å±žå²—位组
     *
     * @param userName ç”¨æˆ·å
     * @param userName ç”¨æˆ·ï¿½?
     * @return ç»“æžœ
     */
    @Override
@@ -569,7 +526,7 @@
    }
    /**
     * æ ¡éªŒç”¨æˆ·æ˜¯å¦æœ‰æ•°æ®æƒé™
     * æ ¡éªŒç”¨æˆ·æ˜¯å¦æœ‰æ•°æ®æƒï¿½?
     *
     * @param userId ç”¨æˆ·id
     */
@@ -580,7 +537,7 @@
            user.setUserId(userId);
            List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
            if (StringUtils.isEmpty(users)) {
                throw new ServiceException("没有权限访问用户数据!");
                throw new ServiceException("没有权限访问用户数据");
            }
        }
    }
@@ -596,7 +553,7 @@
    public int insertUser(SysUser user) {
        // æ–°å¢žç”¨æˆ·ä¿¡æ¯
        int rows = userMapper.insertUser(user);
        //新增用户与部门关联
        //新增用户与部门关�?
//        if (!CollectionUtils.isEmpty(user.getDepts())) {
//            for (Long deptId : user.getDepts()) {
//                SysUserDept sysUserDep = new SysUserDept();
@@ -661,7 +618,7 @@
        }
        // æ–°å¢žç”¨æˆ·å²—位关联
        insertUserPost(user);
        // æ–°å¢žç”¨æˆ·ä¸Žè§’色管理
        // æ–°å¢žç”¨æˆ·ä¸Žè§’色管�?
        insertUserRole(user);
        return rows;
    }
@@ -687,24 +644,24 @@
    @Transactional
    public int updateUser(SysUser user) {
        Long userId = user.getUserId();
        // åˆ é™¤ç”¨æˆ·ä¸Žè§’色关联
        // åˆ é™¤ç”¨æˆ·ä¸Žè§’色关�?
        userRoleMapper.deleteUserRoleByUserId(userId);
        // æ–°å¢žç”¨æˆ·ä¸Žè§’色管理
        // æ–°å¢žç”¨æˆ·ä¸Žè§’色管�?
        insertUserRole(user);
        // åˆ é™¤ç”¨æˆ·ä¸Žå²—位关联
        // åˆ é™¤ç”¨æˆ·ä¸Žå²—位关�?
        userPostMapper.deleteUserPostByUserId(userId);
        // æ–°å¢žç”¨æˆ·ä¸Žå²—位管理
        // æ–°å¢žç”¨æˆ·ä¸Žå²—位管�?
        insertUserPost(user);
        //删除用户与部门的关联
        Long[] ids = {user.getUserId()};
        //新增用户与部门关联
        //新增用户与部门关�?
//        sysUserDeptMapper.deleteSysUserDeptByIds(ids);
//        if (!CollectionUtils.isEmpty(user.getDepts())) {
//            for (Long deptId : user.getDepts()) {
//                SysUserDept sysUserDep = new SysUserDept();
//                sysUserDep.setUserId(user.getUserId());
//                sysUserDep.setDeptId(deptId);
//                //查询是否 å·²ç»å…³è”该部门
//                //查询是否 å·²ç»å…³è”该部�?
//                List<SysUserDept> sysUserDepts = sysUserDeptMapper.selectSysUserDeptList(sysUserDep);
//                if (!CollectionUtils.isEmpty(sysUserDepts)) {
//                    SysUserDept sysUserDept = sysUserDepts.get(0);
@@ -775,7 +732,7 @@
     * ç”¨æˆ·æŽˆæƒè§’色
     *
     * @param userId  ç”¨æˆ·ID
     * @param roleIds è§’色组
     * @param roleIds è§’色�?
     */
    @Override
    @Transactional
@@ -785,7 +742,7 @@
    }
    /**
     * ä¿®æ”¹ç”¨æˆ·çŠ¶æ€
     * ä¿®æ”¹ç”¨æˆ·çŠ¶ï¿½?
     *
     * @param user ç”¨æˆ·ä¿¡æ¯
     * @return ç»“æžœ
@@ -809,7 +766,7 @@
    /**
     * ä¿®æ”¹ç”¨æˆ·å¤´åƒ
     *
     * @param userName ç”¨æˆ·å
     * @param userName ç”¨æˆ·ï¿½?
     * @param avatar   å¤´åƒåœ°å€
     * @return ç»“æžœ
     */
@@ -832,7 +789,7 @@
    /**
     * é‡ç½®ç”¨æˆ·å¯†ç 
     *
     * @param userName ç”¨æˆ·å
     * @param userName ç”¨æˆ·ï¿½?
     * @param password å¯†ç 
     * @return ç»“æžœ
     */
@@ -858,7 +815,7 @@
    public void insertUserPost(SysUser user) {
        Long[] posts = user.getPostIds();
        if (StringUtils.isNotEmpty(posts)) {
            // æ–°å¢žç”¨æˆ·ä¸Žå²—位管理
            // æ–°å¢žç”¨æˆ·ä¸Žå²—位管�?
            List<SysUserPost> list = new ArrayList<SysUserPost>(posts.length);
            for (Long postId : posts) {
                SysUserPost up = new SysUserPost();
@@ -875,11 +832,11 @@
     * æ–°å¢žç”¨æˆ·è§’色信息
     *
     * @param userId  ç”¨æˆ·ID
     * @param roleIds è§’色组
     * @param roleIds è§’色�?
     */
    public void insertUserRole(Long userId, Long[] roleIds, String orgid) {
        if (StringUtils.isNotEmpty(roleIds)) {
            // æ–°å¢žç”¨æˆ·ä¸Žè§’色管理
            // æ–°å¢žç”¨æˆ·ä¸Žè§’色管�?
            List<SysUserRole> list = new ArrayList<SysUserRole>(roleIds.length);
            for (Long roleId : roleIds) {
                SysUserRole ur = new SysUserRole();
@@ -901,7 +858,7 @@
    @Override
    @Transactional
    public int deleteUserById(Long userId) {
        // åˆ é™¤ç”¨æˆ·ä¸Žè§’色关联
        // åˆ é™¤ç”¨æˆ·ä¸Žè§’色关�?
        userRoleMapper.deleteUserRoleByUserId(userId);
        // åˆ é™¤ç”¨æˆ·ä¸Žå²—位表
        userPostMapper.deleteUserPostByUserId(userId);
@@ -921,9 +878,9 @@
            checkUserAllowed(new SysUser(userId));
            checkUserDataScope(userId);
        }
        // åˆ é™¤ç”¨æˆ·ä¸Žè§’色关联
        // åˆ é™¤ç”¨æˆ·ä¸Žè§’色关�?
        userRoleMapper.deleteUserRole(userIds);
        // åˆ é™¤ç”¨æˆ·ä¸Žå²—位关联
        // åˆ é™¤ç”¨æˆ·ä¸Žå²—位关�?
        userPostMapper.deleteUserPost(userIds);
        return userMapper.deleteUserByIds(userIds);
    }
@@ -939,7 +896,7 @@
    @Override
    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
        if (StringUtils.isNull(userList) || userList.size() == 0) {
            throw new ServiceException("导入用户数据不能为空!");
            throw new ServiceException("导入用户数据不能为空");
        }
        int successNum = 0;
        int failureNum = 0;
@@ -956,7 +913,7 @@
                    user.setCreateBy(operName);
                    this.insertUser(user);
                    successNum++;
                    successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " å¯¼å…¥æˆåŠŸ");
                    successMsg.append("<br/>" + successNum + "、账�?" + user.getUserName() + " å¯¼å…¥æˆåŠŸ");
                } else if (isUpdateSupport) {
                    BeanValidators.validateWithException(validator, user);
                    checkUserAllowed(user);
@@ -964,14 +921,14 @@
                    user.setUpdateBy(operName);
                    this.updateUser(user);
                    successNum++;
                    successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " æ›´æ–°æˆåŠŸ");
                    successMsg.append("<br/>" + successNum + "账号?" + user.getUserName() + " æ›´æ–°æˆåŠŸ");
                } else {
                    failureNum++;
                    failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " å·²å­˜åœ¨");
                    failureMsg.append("<br/>" + failureNum + "账号" + user.getUserName() + " å·²å­˜åœ¨");
                }
            } catch (Exception e) {
                failureNum++;
                String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " å¯¼å…¥å¤±è´¥ï¼š";
                String msg = "<br/>" + failureNum + "账号" + user.getUserName() + " å¯¼å…¥å¤±è´¥";
                failureMsg.append(msg + e.getMessage());
                log.error(msg, e);
            }
smartor/src/main/java/com/smartor/domain/BaseSmsRequest.java
@@ -30,7 +30,7 @@
    /**
     * çŸ­ä¿¡æ¨¡æ¿CODE
     */
    @ApiModelProperty(value = "模板ID")
    @ApiModelProperty(value = "模板ID;如果南华附一的话,该字段就是content")
    private String templateCode;
smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java
ÎļþÒÑɾ³ý
smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
@@ -54,6 +54,12 @@
    private Long scriptid;
    /**
     * é»˜è®¤é€‰é¡¹ï¼š1 å¦     2 æ˜¯
     */
    @ApiModelProperty("默认选项:1 å¦     2 æ˜¯")
    private Long defaultValue;
    /**
     * $column.columnComment
     */
    @ApiModelProperty("主键")
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
@@ -263,4 +263,10 @@
    @Excel(name = "异常选项:1否(默认)    2是")
    @ApiModelProperty(value = "异常选项:1否(默认)    2是")
    private Long isException;
    /**
     * é»˜è®¤é€‰é¡¹ï¼š1 å¦     2 æ˜¯
     */
    @ApiModelProperty("默认选项:1 å¦ï¼ˆé»˜è®¤ï¼‰     2 æ˜¯")
    private Long defaultValue;
}
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
@@ -285,4 +285,10 @@
     */
    @ApiModelProperty(value = "服务的名称")
    private String sendTaskname;
    /**
     * é»˜è®¤é€‰é¡¹ï¼š1 å¦     2 æ˜¯
     */
    @ApiModelProperty("默认选项:1 å¦     2 æ˜¯")
    private Long defaultValue;
}
smartor/src/main/java/com/smartor/domain/PatMedInhosp.java
@@ -79,6 +79,12 @@
    private String hospitaldistrictcode;
    /**
     * é™¢åŒºç¼–号集合
     */
    @ApiModelProperty(value = "院区编号集合")
    private List<String> hospitaldistrictcodeList;
    /**
     * é™¢åŒºåç§°
     */
    @ApiModelProperty(value = "院区名称")
@@ -118,6 +124,11 @@
     */
    @ApiModelProperty(value = "入院科室代码")
    private String deptcode;
    /**
     * å…¥é™¢ç§‘室代码
     */
    @ApiModelProperty(value = "入院科室代码集合")
    private List<String> deptcodeList;
    /**
     * å…¥é™¢ç§‘室名称
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -31,11 +31,11 @@
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    private Integer isabnormal;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "开始时间")
    private Date startTime;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "结束时间")
    private Date endTime;
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
@@ -118,6 +118,9 @@
    @Excel(name = " é¦–次随访失败 ")
    private Long followUpFail = 0L;
    @ApiModelProperty(value = "无需随访详情")
    private List<ServiceSubtask> nonFollowUpInfo;
    @ApiModelProperty(value = "首次应随访详情")
    private List<ServiceSubtask> needFollowUpInfo;
smartor/src/main/java/com/smartor/domain/SvyLibScriptOption.java
@@ -208,5 +208,11 @@
    @ApiModelProperty(value = "异常选项:1否(默认)    2是")
    private Integer isException;
    /**
     * é»˜è®¤é€‰é¡¹ï¼š1 å¦     2 æ˜¯
     */
    @ApiModelProperty("默认选项:1 å¦     2 æ˜¯")
    private Long defaultValue;
}
smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
@@ -277,10 +277,10 @@
     */
    @ApiModelProperty(value = "服务的名称")
    private String sendTaskname;
//
//    /**
//     * å¼‚常选项:1否(默认)    2是
//     */
//    @ApiModelProperty(value = "异常选项:1否(默认)    2是")
//    private Integer isException;
    /**
     * é»˜è®¤é€‰é¡¹ï¼š1 å¦ï¼ˆé»˜è®¤ï¼‰     2 æ˜¯
     */
    @ApiModelProperty("默认选项:1 å¦ï¼ˆé»˜è®¤ï¼‰     2 æ˜¯")
    private Long defaultValue;
}
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
@@ -259,9 +259,9 @@
    @ApiModelProperty(value = "是否是用户选择的选项")
    private Boolean isUserOperation = false;
//    /**
//     * å¼‚常选项:1否(默认)    2是
//     */
//    @ApiModelProperty(value = "异常选项:1否(默认)    2是")
//    private Integer isException;
    /**
     * é»˜è®¤é€‰é¡¹ï¼š1 å¦     2 æ˜¯
     */
    @ApiModelProperty("默认选项:1 å¦     2 æ˜¯")
    private Long defaultValue;
}
smartor/src/main/java/com/smartor/service/DingTalkService.java
@@ -1,6 +1,7 @@
package com.smartor.service;
import com.smartor.domain.DingTalkReqVo;
import com.ruoyi.common.core.domain.DingTalkReqVo;
import com.ruoyi.common.core.service.IDingTalkService;
import com.smartor.domain.HeCategory;
import com.taobao.api.ApiException;
import org.springframework.web.bind.annotation.RequestBody;
@@ -13,7 +14,7 @@
 * @author smartor
 * @date 2023-03-04
 */
public interface DingTalkService {
public interface DingTalkService extends IDingTalkService {
    /**
     * å‘送钉钉消息
     *
smartor/src/main/java/com/smartor/service/IServiceExternalService.java
@@ -1,7 +1,9 @@
package com.smartor.service;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.smartor.domain.ExternalDept;
import com.smartor.domain.PatArchive;
import com.smartor.domain.ServiceSubtaskDetail;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
@@ -130,4 +132,6 @@
     * æ£€æŸ¥æŠ¥å‘ŠæœåŠ¡
     */
    public Boolean addInspectBGService(Map dataMap);
    public Map<String, Object> query360PatInfolwl(Long patid, SysUser sysUser);
}
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -132,6 +132,7 @@
    public List<ServiceSubtaskCount> getSfFzInfoEveryMonth(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    //导出随访
    public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq);
@@ -159,4 +160,13 @@
     * @return noContinueCount、ContinueCount åŠ detail åˆ—表
     */
    Map<String, Object> getContinueNurseCount(ServiceSubtaskCotinueCountVO vo);
    /**
     * è®¾ç½®å¤±è´¥ä»»åŠ¡é»˜è®¤å€¼,并将失败任务重新置为成功
     * <p>
     * *@param failDay   (失败天数:距离当前日期失败天数)
     *
     * @return
     */
    public void setFailSubTaskDefalutVal(Long failDay);
    }
smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java
@@ -12,8 +12,8 @@
import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
import com.dingtalk.api.response.OapiUserListidResponse;
import com.dingtalk.api.response.OapiV2UserGetbymobileResponse;
import com.ruoyi.common.core.domain.DingTalkReqVo;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.DingTalkReqVo;
import com.smartor.service.DingTalkService;
import com.taobao.api.ApiException;
import lombok.extern.log4j.Log4j;
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -85,6 +85,16 @@
     */
    @Override
    public List<PatMedInhosp> selectPatMedInhospList(PatMedInhosp patMedInhosp) {
        if (patMedInhosp.getCry() == 0) {
            patMedInhosp.setDeptcodeList(patMedInhosp.getLeaveldeptcodes());
            patMedInhosp.setHospitaldistrictcodeList(patMedInhosp.getLeavehospitaldistrictcodes());
            patMedInhosp.setLeaveldeptcodes(null);
            patMedInhosp.setLeavehospitaldistrictcodes(null);
            patMedInhosp.setInhospstate("0");
        } else if (patMedInhosp.getCry() == 1) {
            patMedInhosp.setInhospstate("1");
        }
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
            String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
smartor/src/main/java/com/smartor/service/impl/PatMedOuthospServiceImpl.java
@@ -76,6 +76,11 @@
        PatMedOuthospQueryReq patMedOuthospQueryReq = DtoConversionUtils.sourceToTarget(patMedOuthosp, PatMedOuthospQueryReq.class);
        patMedOuthospQueryReq.setBeginAdmitdate(patMedOuthosp.getBeginTime());
        patMedOuthospQueryReq.setEndAdmitdate(patMedOuthosp.getEndTime());
        if(!CollectionUtils.isEmpty(patMedOuthosp.getDeptcodes())) {
            String result = String.join(",",   patMedOuthosp.getDeptcodes());
            patMedOuthospQueryReq.setDeptcode(result);
        }
        List<PatMedOuthosp> patMedOuthospQueryResps = patMedOuthospMapper.callSpQueryOuthosp(patMedOuthospQueryReq);
        if (patMedOuthosp.getPageNum() != null) {
            for (PatMedOuthosp patMedOuthosp1 : patMedOuthospQueryResps) {
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -7,6 +7,7 @@
import com.ruoyi.common.core.domain.entity.SysUserDept;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.AesUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
@@ -24,6 +25,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -1855,6 +1858,44 @@
        return true;
    }
    @Override
    public Map<String, Object> query360PatInfolwl(Long patid, SysUser sysUser) {
        Map<String, Object> result = new HashMap<>();
        PatArchive pa = patArchiveMapper.selectPatArchiveByPatid(patid);
        if (pa.getPatientno() == null) {
            result.put("url", null);
            result.put("error", "患者编号为空");
            return result;
        }
        StringBuffer sbf = new StringBuffer("http://cfdata.nhyfy.cn/cfdata/h360/patient-summary?");
        sbf.append("referer=thirdparty");
        sbf.append("&encode=1");
        sbf.append("&patientMainIndexNum=" + AesUtils.encrypt(pa.getPatientno()));
        sbf.append("&workId=" + AesUtils.encrypt(sysUser.getUserName()));
        sbf.append("&workName=" + AesUtils.encrypt(sysUser.getNickName()));
        sbf.append("&hisOrgCode=" + AesUtils.encrypt("20001001"));
        sbf.append("&hisOrgName=" + AesUtils.encrypt("南华大学附属第一医院"));
        sbf.append("&hisHosCode=" + AesUtils.encrypt("30001002"));
        sbf.append("&hisHosName=" + AesUtils.encrypt("南华大学附属第一医院"));
        String url360 = null;
        try {
            url360 = URLEncoder.encode(sbf.toString(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        StringBuffer stringBuffer = new StringBuffer("http://cfdata.nhyfy.cn/cfdata/login/nologin?");
        //accountNo对接人不给,先空着---------------------------------------------------------------
        stringBuffer.append("accountNo=");
        stringBuffer.append("&source=third");
        stringBuffer.append("&redirectUrl=" + url360);
        result.put("url", stringBuffer.toString());
        result.put("error", null);
        return result;
    }
    private Boolean getType(String type, Map dataMap) {
        switch (type) {
            case "BR_DA_DangAnJL":
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -225,17 +225,16 @@
                        String professionalTitleName = getStringValue(diagnosisMap, "professionalTitleName");
                        if (professionalTitleName.contains("医师")) {
                            sysUser.setUserType("医生");
                            sysUser.setSearchscope("1");
                        }
                        if (professionalTitleName.contains("护")) {
                            sysUser.setUserType("护士");
                            sysUser.setSearchscope("2");
                        }
                        sysUser.setTitle(getStringValue(diagnosisMap, "professionalTitleName"));
                    }
                }
            }
            //如果用户的患者范围为空,则默认为0
            if (StringUtils.isEmpty(sysUser.getSearchscope())) sysUser.setSearchscope("0");
            sysUser.setPhonenumber(getStringValue(dataItem, "telephone"));
            sysUser.setUserCode(getStringValue(dataItem, "jobNumber"));
            //设置性别
@@ -250,12 +249,13 @@
            sysUser.setCreateBy("admin");
            sysUser.setCreateBy("admin");
            sysUser.setOrgid("" + getLongValue(dataItem, "orgId"));
//            sysUser.setCampusid("" + getLongValue(dataItem, "cmpusId"));
            BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
            sysUser.setPassword(passwordEncoder.encode(userPwd));
            SysUser sysUser1 = sysUser2Mapper.selectUserByUserName(sysUser.getUserName());
            if (ObjectUtils.isNotEmpty(sysUser1)) {
                //由人工维护的字段是不需要更新的
                sysUser.setSearchscope(null);
                sysUser.setPassword(null);
                sysUser.setUserId(sysUser1.getUserId());
                sysUser2Mapper.updateUser(sysUser);
            } else {
@@ -708,6 +708,7 @@
        patMedInhosp.setNurseId(dto.getChiefNurseId() == null ? "" : dto.getChiefNurseId().toString());
        patMedInhosp.setNurseName(dto.getChiefNurseName());
        patMedInhosp.setSerialnum(dto.getHealthcareRecordNo());
        patMedInhosp.setInhospno(dto.getHealthcareRecordNo());
        patMedInhosp.setFuflag("1");
        if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1"))
            patMedInhosp.setFuflag("0");
@@ -791,7 +792,8 @@
    private PatArchive buildPatientArchive(ServiceSLTDInhospResDTO dto) {
        PatArchive patArchive = new PatArchive();
        patArchive.setPatientno(dto.getPatientId() == null ? null : String.valueOf(dto.getPatientId()));
        patArchive.setPatientno(dto.getMedicalRecordNo() == null ? null : String.valueOf(dto.getMedicalRecordNo()));
        patArchive.setPatidHis(dto.getPatientId() == null ? null : String.valueOf(dto.getPatientId()));
        patArchive.setIdcardno(StringUtils.isEmpty(dto.getIdCardNo()) ? "" + dto.getMedicalCardId() : dto.getIdCardNo().trim());
        patArchive.setName(dto.getPatientName());
        patArchive.setSourcefrom(2L);
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -197,7 +197,7 @@
            String[] split = key.split("-");
            //先判断,是不是当前提交人的,不是当前提交人的,跳过
            try {
                if (ObjectUtils.isNotEmpty(split[0]) && ObjectUtils.isNotEmpty(split[1]) && !Long.valueOf(split[0]).equals(pid) && !Long.valueOf(split[1]).equals(tid) && !Long.valueOf(split[2]).equals(subid)) {
                if (ObjectUtils.isNotEmpty(split[0]) && ObjectUtils.isNotEmpty(split[1]) && !Long.valueOf(split[0]).equals(pid) && !Long.valueOf(split[1]).equals(tid) && !Objects.isNull(split[2]) && !Long.valueOf(split[2]).equals(subid)) {
                    continue;
                }
            } catch (Exception e) {
@@ -238,7 +238,7 @@
                        if (svyTaskTemplateScriptVO.getSort() != null && svyTaskTemplateScriptVO.getSort().equals(nextScriptno)) {
//                            log.error("svyTaskTemplateScriptVO的值为:{}", svyTaskTemplateScriptVO);
                            Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Long.valueOf(split[2]));
                            Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Objects.isNull(split[2]) ? null : Long.valueOf(split[2]));
                            log.error("nextScriptNo的信息为:{}", map.get("nextScriptNo"));
                            if (!Objects.isNull(map.get("nextScriptNo")))
                                nextScriptno = Long.valueOf(map.get("nextScriptNo"));
@@ -281,7 +281,7 @@
                        ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions);
                        if (ivrTaskTemplateScriptVO.getSort() != null && Long.valueOf(ivrTaskTemplateScriptVO.getSort()).equals(nextScriptno)) {
                            Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Long.valueOf(split[2]));
                            Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Objects.isNull(split[2]) ? null : Long.valueOf(split[2]));
                            log.error("----nextScriptNo2的信息为:{}", map.get("nextScriptNo"));
                            if (!Objects.isNull(map.get("nextScriptNo")))
                                nextScriptno = Long.valueOf(map.get("nextScriptNo"));
@@ -354,7 +354,7 @@
                        for (SvyTaskTemplateScriptVO svyTaskTemplateScriptVO : cacheList) {
                            if (svyTaskTemplateScriptVO.getSort() == 1L) {
                                //说明是第一题
                                List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(0).getSvyTaskTemplateTargetoptions();
                                List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = svyTaskTemplateScriptVO.getSvyTaskTemplateTargetoptions();
                                svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions);
                                Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, tid, pid, subid);
                                if (map == null) continue;
@@ -399,7 +399,7 @@
                        for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : cacheList) {
                            if (ivrTaskTemplateScriptVO.getSort() != null && ivrTaskTemplateScriptVO.getSort() == 1L) {
                                //说明是第一题
                                List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = cacheList.get(0).getIvrTaskScriptTargetoptionList();
                                List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
                                ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions);
                                //它俩都是ivr_task_templatescript_id,所以这里需要设置一下
                                ivrTaskTemplateScriptVO.setId(ivrTaskTemplateScriptVO.getScriptID());
@@ -1091,7 +1091,7 @@
        ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
        serviceSubtaskVO.setTaskid(taskid);
        serviceSubtaskVO.setPatid(patid);
        serviceSubtaskVO.setPatid(subid);
        serviceSubtaskVO.setSubId(subid);
        List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
        String score = "0";
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -10,8 +10,11 @@
import com.ruoyi.common.dx.MessageSend;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.smartor.common.FtpService;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
import com.smartor.domain.*;
import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
import com.smartor.domain.entity.ServiceSubtaskEntity;
@@ -97,6 +100,9 @@
    @Autowired
    private IIvrTaskTemplateScriptService iIvrTaskTemplateScriptService;
    @Autowired
    private IIvrTaskTemplateTargetoptionService iIvrTaskTemplateTargetoptionService;
    @Autowired
    private IServiceOutPathService iServiceOutPathService;
@@ -2679,6 +2685,8 @@
            serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
            //出院人次
            serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
            //无需随访详情
            List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
            //记录过滤患者详情
            List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
            //记录首次应随访详情
@@ -2715,6 +2723,7 @@
                //无需随访人次
                if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
                    serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
                    nonFollowUpInfo.add(serviceSubtask);
                    if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
                        serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
                        filterServiceSubtasks.add(serviceSubtask);
@@ -2893,6 +2902,8 @@
                }
            }
            serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
            //记录无需随访详情
            serviceSubtaskStatistic.setNonFollowUpInfo(nonFollowUpInfo);
            //记录首次应随访详情
            serviceSubtaskStatistic.setNeedFollowUpInfo(needFollowUpInfo);
            //记录首次待随访详情
@@ -2945,6 +2956,8 @@
        serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
        //出院人次
        serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
        //无需随访详情
        List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
        //记录过滤患者详情
        List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
        //记录首次应随访详情
@@ -2966,6 +2979,7 @@
            //无需随访人次
            if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
                serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
                nonFollowUpInfo.add(serviceSubtask);
                if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
                    serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
                    filterServiceSubtasks.add(serviceSubtask);
@@ -3071,6 +3085,8 @@
            }
        }
        serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
        //记录无需随访详情
        serviceSubtaskStatistic.setNonFollowUpInfo(nonFollowUpInfo);
        //记录首次应随访详情
        serviceSubtaskStatistic.setNeedFollowUpInfo(needFollowUpInfo);
        //记录首次待随访详情
@@ -3107,6 +3123,8 @@
        serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
        //出院人次
        serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
        //无需随访详情
        List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
        //记录过滤患者详情
        List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
@@ -3129,6 +3147,7 @@
            //无需随访人次
            if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
                serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
                nonFollowUpInfo.add(serviceSubtask);
                if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
                    serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
                    filterServiceSubtasks.add(serviceSubtask);
@@ -3234,6 +3253,8 @@
            }
        }
        serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
        //记录无需随访详情
        serviceSubtaskStatistic.setNonFollowUpInfo(nonFollowUpInfo);
        //记录再次应随访详情
        serviceSubtaskStatistic.setNeedFollowUpAgainInfo(needFollowUpAgainInfo);
        //记录再次待随访详情
@@ -4075,4 +4096,221 @@
        result.put("详情", detail);
        return result;
    }
    /**
     * è®¾ç½®å¤±è´¥ä»»åŠ¡é»˜è®¤å€¼,并将失败任务重新置为成功
     *
     * @param failDay (失败天数:距离当前日期失败天数)
     * @return
     */
    @Override
    public void setFailSubTaskDefalutVal(Long failDay) {
        //1.先去sys_config中,获取哪些科室或病区需要默认问卷默认值
        IConfigService configService = SpringUtils.getBean(IConfigService.class);
        String deptConfigValue = configService.selectConfigByKey("hosp.default.dept");
        String wardConfigValue = configService.selectConfigByKey("hosp.default.ward");
        List<String> leaveWard = null;
        List<String> leaveDept = null;
        if (deptConfigValue != null && !deptConfigValue.isEmpty()) {
            leaveDept = Arrays.stream(deptConfigValue.split(",")).filter(s -> !s.trim().isEmpty()).collect(Collectors.toList());
        }
        if (wardConfigValue != null && !wardConfigValue.isEmpty()) {
            leaveWard = Arrays.stream(wardConfigValue.split(",")).filter(s -> !s.trim().isEmpty()).collect(Collectors.toList());
        }
        log.info("离院病区leaveWard: {}, ç¦»é™¢ç§‘室leaveDept: {}", leaveWard, leaveDept);
        if (leaveWard == null && leaveDept == null) return;
        //2.获取leaveWard,leaveDept中的servic_subtask表中sendstate=5的任务
        ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity();
        serviceSubtaskEntity.setSendstate(5L);
        serviceSubtaskEntity.setLeavehospitaldistrictcodes(leaveWard);
        serviceSubtaskEntity.setLeaveldeptcodes(leaveDept);
        if (!Objects.isNull(leaveWard) && !Objects.isNull(leaveDept)) serviceSubtaskEntity.setDeptOrDistrict("2");
        List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskEntity);
        if (CollectionUtils.isEmpty(serviceSubtasks)) return;
        //3.如果查出来的集合不为空,则进行循环
        for (ServiceSubtask serviceSubtask : serviceSubtasks) {
            Integer preachformSize = 0;
            Boolean flag = false;
            ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
            serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
            List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform);
            if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms))
                preachformSize = serviceSubtaskPreachforms.size();
            if (serviceSubtask.getUpdateTime() != null && DateUtils.differentDaysByMillisecond(new Date(), serviceSubtask.getUpdateTime()) >= failDay) {
                //3.1 åˆ¤æ–­å½“前serviceSubtask的updateTime是不是为空,如果不为空,则判断当前时间是不是与updateTime差距大于等于failDay
                flag = saveServiceSubtaskDetail(serviceSubtask);
            } else if (serviceSubtask.getVisitTime() != null && DateUtils.differentDaysByMillisecond(new Date(), serviceSubtask.getVisitTime()) >= failDay + preachformSize) {
                //3.2 å¦‚果当前serviceSubtask的updateTime为空,根据当前serviceSubtask的subid去查service_subtask_preachform得到size(如果size为空,则默认0),则根据当前时间是不是与当前serviceSubtask的visitTime差距大于等于failDay + size
                flag = saveServiceSubtaskDetail(serviceSubtask);
            } else {
                //3.3 å¦‚æžœ2.1且2.2都为false,则continue
                continue;
            }
            //4.如果flag为true,则更新service_subtask表中的sendstate为6,preachform为1
            if (flag) {
                serviceSubtask.setSendstate(6L);
                serviceSubtask.setPreachform("1");
                serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
            } else {
                //删除误新增detail里的数据
                ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
                serviceSubtaskDetail.setSubId(serviceSubtask.getId());
                List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
                if (CollectionUtils.isNotEmpty(serviceSubtaskDetails)) {
                    for (ServiceSubtaskDetail serviceSubtaskDetail1 : serviceSubtaskDetails) {
                        serviceSubtaskDetail1.setDelFlag("1");
                        serviceSubtaskDetailMapper.updateServiceSubtaskDetail(serviceSubtaskDetail1);
                    }
                }
            }
        }
    }
    private Boolean saveServiceSubtaskDetail(ServiceSubtask serviceSubtask) {
        Boolean result = true;
        //3.4 å¦‚æžœ3.1或3.2为true的话,根据type判断什么类型
        if (serviceSubtask.getType().equals("1")) {
            //3.3.1    å¦‚æžœtype是 1 ï¼Œåˆ™ç”¨å½“前serviceSubtask的templateid去ivr_task_temaplate_script中获取问题和选项,将问题和选项的默认值放到service_detail中
            IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
            ivrTaskTemplateScript.setTemplateID(serviceSubtask.getTemplateid());
            List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
            for (IvrTaskTemplateScript its : ivrTaskTemplateScripts) {
                IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = DtoConversionUtils.sourceToTarget(its, IvrTaskTemplateScriptVO.class);
                IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption = new IvrTaskTemplateTargetoption();
                ivrTaskTemplateTargetoption.setScriptid(ivrTaskTemplateScriptVO.getId());
                List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = iIvrTaskTemplateTargetoptionService.selectIvrTaskTemplateTargetoptionList(ivrTaskTemplateTargetoption);
                ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions);
                Integer integer = setSFDetailInfo(ivrTaskTemplateScriptVO, serviceSubtask);
                if (Objects.isNull(integer) || integer == 0) result = false;
            }
        } else if (serviceSubtask.getType().equals("2")) {
            //3.3.2    å¦‚æžœtype是 2,则用当前serviceSubtask的templateid去svy_task_temaplate_script中获取问题和选项,将问题和选项的默认值放到service_detail中
            SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript();
            svyTaskTemplateScript.setTemplateID(serviceSubtask.getTemplateid());
            List<SvyTaskTemplateScript> svyTaskTemplateScripts = svyTaskTemplateScriptService.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
            for (SvyTaskTemplateScript taskTemplateScript : svyTaskTemplateScripts) {
                SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = DtoConversionUtils.sourceToTarget(taskTemplateScript, SvyTaskTemplateScriptVO.class);
                SvyTaskTemplateScriptVO svyTaskTemplateScriptVO1 = svyTaskTemplateScriptService.selectInfoByCondition(svyTaskTemplateScriptVO);
                Integer integer = setWJDetailInfo(svyTaskTemplateScriptVO1, serviceSubtask);
                if (Objects.isNull(integer) || integer == 0) result = false;
            }
        }
        return result;
    }
    private Integer setWJDetailInfo(SvyTaskTemplateScriptVO svyTaskTemplateScriptVO, ServiceSubtask serviceSubtask) {
        log.info("-----setWJDetailInfo的入参为:{}", svyTaskTemplateScriptVO);
        ServiceSubtaskDetailVO serviceSubtaskDetailVO = new ServiceSubtaskDetailVO();
        if (svyTaskTemplateScriptVO.getScriptType().equals("1") || svyTaskTemplateScriptVO.getScriptType().equals("2")) {
            //1、2为单选或多选
            for (SvyTaskTemplateTargetoption svyTaskTemplateTargetoption : svyTaskTemplateScriptVO.getSvyTaskTemplateTargetoptions()) {
                //将问题选项记录下来
                if (StringUtils.isEmpty(serviceSubtaskDetailVO.getTargetvalue())) {
                    serviceSubtaskDetailVO.setTargetvalue(svyTaskTemplateTargetoption.getOptioncontent());
                } else {
                    serviceSubtaskDetailVO.setTargetvalue(serviceSubtaskDetailVO.getTargetvalue() + "&" + svyTaskTemplateTargetoption.getOptioncontent());
                }
                if (svyTaskTemplateTargetoption.getDefaultValue() != null && svyTaskTemplateTargetoption.getDefaultValue() == 2) {
                    serviceSubtaskDetailVO.setAsrtext(StringUtils.isNotBlank(serviceSubtaskDetailVO.getAsrtext()) ? serviceSubtaskDetailVO.getAsrtext() + "&" + svyTaskTemplateTargetoption.getOptioncontent() : svyTaskTemplateTargetoption.getOptioncontent());
                    serviceSubtaskDetailVO.setMatchedtext(StringUtils.isNotBlank(serviceSubtaskDetailVO.getMatchedtext()) ? serviceSubtaskDetailVO.getMatchedtext() + "&" + svyTaskTemplateTargetoption.getOptioncontent() : svyTaskTemplateTargetoption.getOptioncontent());
                }
            }
            //如果asrtext和matchedtext都为空,则没有默认值,则不进行处理
            if (StringUtils.isEmpty(serviceSubtaskDetailVO.getAsrtext()) && StringUtils.isEmpty(serviceSubtaskDetailVO.getMatchedtext())) {
                return 0;
            }
        }
        ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
        serviceSubtaskDetailVO.setQuestiontext(svyTaskTemplateScriptVO.getScriptContent());
        serviceSubtaskDetailVO.setCategoryid(svyTaskTemplateScriptVO.getCategoryid());
        serviceSubtaskDetailVO.setTaskid(serviceSubtask.getTaskid());
        serviceSubtaskDetailVO.setTargetid(svyTaskTemplateScriptVO.getTargetid() != null ? svyTaskTemplateScriptVO.getTargetid().intValue() : null);
        serviceSubtaskDetailVO.setPatid(serviceSubtask.getPatid());
        serviceSubtaskDetailVO.setScriptid(svyTaskTemplateScriptVO.getId());
        serviceSubtaskDetailVO.setTemplatequestionnum(StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getScriptno()) ? Long.valueOf(svyTaskTemplateScriptVO.getScriptno()) : null);
        serviceSubtaskDetailVO.setValueType(svyTaskTemplateScriptVO.getScriptType());
        serviceSubtaskDetailVO.setComment(null);
        serviceSubtaskDetailVO.setCreateTime(new Date());
        serviceSubtaskDetailVO.setUpdateTime(new Date());
        serviceSubtaskDetailVO.setTemplateType(2);
        serviceSubtaskDetailVO.setLibTemplateid(serviceSubtask.getLibtemplateid() != null ? serviceSubtask.getLibtemplateid().intValue() : null);
        if (ObjectUtils.isNotEmpty(serviceTask)) {
            serviceSubtaskDetailVO.setGuid(serviceTask.getGuid());
            serviceSubtaskDetailVO.setOrgid(serviceTask.getOrgid());
        }
        serviceSubtaskDetailVO.setSubId(serviceSubtask.getId());
        serviceSubtaskDetailVO.setTemplatequestionnum(svyTaskTemplateScriptVO.getId());
        ServiceSubtaskDetail serviceSubtaskDetail = DtoConversionUtils.sourceToTarget(serviceSubtaskDetailVO, ServiceSubtaskDetail.class);
        //先用subid和scriptid查询一下是否存在,如果存在则更新,不存在则插入
        ServiceSubtaskDetailDTO existServiceSubtaskDetail = serviceSubtaskDetailMapper.isExistServiceSubtaskDetail(serviceSubtaskDetailVO.getSubId(), serviceSubtaskDetailVO.getScriptid());
        if (ObjectUtils.isNotEmpty(existServiceSubtaskDetail)) {
            serviceSubtaskDetail.setId(existServiceSubtaskDetail.getId());
            serviceSubtaskDetail.setUpdateTime(new Date());
            return serviceSubtaskDetailMapper.updateServiceSubtaskDetail(serviceSubtaskDetail);
        } else {
            return serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
        }
    }
    private Integer setSFDetailInfo(IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask) {
        ServiceSubtaskDetailVO serviceSubtaskDetailVO = new ServiceSubtaskDetailVO();
        if (ivrTaskTemplateScriptVO.getScriptType() != null && (ivrTaskTemplateScriptVO.getScriptType().equals("1") || ivrTaskTemplateScriptVO.getScriptType().equals("2"))) {
            //1、2为单选或多选
            for (IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption : ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()) {
                //将问题选项记录下来
                if (StringUtils.isEmpty(serviceSubtaskDetailVO.getTargetvalue())) {
                    serviceSubtaskDetailVO.setTargetvalue(ivrTaskTemplateTargetoption.getTargetvalue());
                } else {
                    serviceSubtaskDetailVO.setTargetvalue(serviceSubtaskDetailVO.getTargetvalue() + "&" + ivrTaskTemplateTargetoption.getTargetvalue());
                }
                if (ivrTaskTemplateTargetoption.getDefaultValue() != null && ivrTaskTemplateTargetoption.getDefaultValue() == 2) {
                    //医生手动填报时,值是在ivrtext中
                    serviceSubtaskDetailVO.setAsrtext(StringUtils.isEmpty(serviceSubtaskDetailVO.getAsrtext()) ? ivrTaskTemplateTargetoption.getTargetvalue() : serviceSubtaskDetailVO.getAsrtext() + "&" + ivrTaskTemplateTargetoption.getTargetvalue());
                    serviceSubtaskDetailVO.setMatchedtext(StringUtils.isEmpty(serviceSubtaskDetailVO.getMatchedtext()) ? ivrTaskTemplateTargetoption.getTargetvalue() : serviceSubtaskDetailVO.getMatchedtext() + "&" + ivrTaskTemplateTargetoption.getTargetvalue());
                }
            }
            //如果asrtext和matchedtext都为空,则没有默认值,不进行处理
            if (StringUtils.isEmpty(serviceSubtaskDetailVO.getAsrtext()) && StringUtils.isEmpty(serviceSubtaskDetailVO.getMatchedtext())) {
                return 0;
            }
        }
        serviceSubtaskDetailVO.setTargetid(ivrTaskTemplateScriptVO.getTargetid() != null ? ivrTaskTemplateScriptVO.getTargetid().intValue() : null);
        serviceSubtaskDetailVO.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
        serviceSubtaskDetailVO.setTaskid(serviceSubtask.getTaskid());
        serviceSubtaskDetailVO.setPatid(serviceSubtask.getPatid());
        serviceSubtaskDetailVO.setScriptid(ivrTaskTemplateScriptVO.getScriptID() == null ? ivrTaskTemplateScriptVO.getId() : ivrTaskTemplateScriptVO.getScriptID());
        serviceSubtaskDetailVO.setTemplatequestionnum(ivrTaskTemplateScriptVO.getId());
        serviceSubtaskDetailVO.setValueType(ivrTaskTemplateScriptVO.getScriptType());
        serviceSubtaskDetailVO.setComment(null);
        serviceSubtaskDetailVO.setCreateTime(new Date());
        serviceSubtaskDetailVO.setGuid(ivrTaskTemplateScriptVO.getGuid());
        serviceSubtaskDetailVO.setOrgid(ivrTaskTemplateScriptVO.getOrgid());
        serviceSubtaskDetailVO.setUpdateTime(new Date());
        serviceSubtaskDetailVO.setSubId(serviceSubtask.getId());
        serviceSubtaskDetailVO.setTemplatequestionnum(ivrTaskTemplateScriptVO.getId());
        serviceSubtaskDetailVO.setTemplateType(1);
        serviceSubtaskDetailVO.setTemplateid(ivrTaskTemplateScriptVO.getTemplateID() == null ? null : ivrTaskTemplateScriptVO.getTemplateID().toString());
        serviceSubtaskDetailVO.setLibTemplateid(serviceSubtask.getLibtemplateid() != null ? serviceSubtask.getLibtemplateid().intValue() : null);
        ServiceSubtaskDetail serviceSubtaskDetail = DtoConversionUtils.sourceToTarget(serviceSubtaskDetailVO, ServiceSubtaskDetail.class);
        //先用subid和scriptid查询一下是否存在,如果存在则更新,不存在则插入
        ServiceSubtaskDetailDTO existServiceSubtaskDetail = serviceSubtaskDetailMapper.isExistServiceSubtaskDetail(serviceSubtaskDetailVO.getSubId(), serviceSubtaskDetailVO.getScriptid());
        if (ObjectUtils.isNotEmpty(existServiceSubtaskDetail)) {
            serviceSubtaskDetail.setId(existServiceSubtaskDetail.getId());
            serviceSubtaskDetail.setUpdateTime(new Date());
            return serviceSubtaskDetailMapper.updateServiceSubtaskDetail(serviceSubtaskDetail);
        } else {
            return serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
        }
    }
}
smartor/src/main/resources/mapper/smartor/IvrLibaScriptTargetoptionMapper.xml
@@ -38,11 +38,13 @@
        <result property="picturePath" column="picture_path"/>
        <result property="isEnd" column="is_end"/>
        <result property="isException" column="is_exception"/>
        <result property="defaultValue" column="default_value"/>
    </resultMap>
    <sql id="selectIvrLibaScriptTargetoptionVo">
        select id,
               targetid,
               default_value,
               is_end,
               is_exception,
               picture_path,
@@ -67,6 +69,7 @@
        where 1=1
            and del_flag = 0
            <if test="targetid != null  and targetid != ''">and targetid = #{targetid}</if>
        <if test="defaultValue != null">and default_value = #{defaultValue}</if>
            <if test="targetname != null  and targetname != ''">and targetname = #{targetname}</if>
            <if test="scriptid != null ">and scriptid = #{scriptid}</if>
            <if test="targettype != null  and targettype != ''">and targettype = #{targettype}</if>
@@ -139,6 +142,7 @@
            <if test="picturePath != null">picture_path,</if>
            <if test="isEnd != null ">is_end,</if>
            <if test="isException != null ">is_exception,</if>
            <if test="defaultValue != null ">default_value,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
@@ -174,6 +178,7 @@
            <if test="picturePath != null">#{picturePath},</if>
            <if test="isEnd != null ">#{isEnd},</if>
            <if test="isException != null ">#{isException},</if>
            <if test="defaultValue != null ">#{defaultValue},</if>
        </trim>
    </insert>
@@ -212,6 +217,7 @@
            <if test="picturePath != null">picture_path = #{picturePath},</if>
            <if test="isEnd != null ">is_end = #{isEnd},</if>
            <if test="isException != null ">is_exception = #{isException},</if>
            <if test="defaultValue != null ">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
@@ -42,12 +42,13 @@
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
        <result property="isException" column="is_exception"/>
        <result property="defaultValue" column="default_value"/>
    </resultMap>
    <sql id="selectIvrLibaTemplateTargetoptionVo">
        select id,
               targetid,
               is_exception,
               default_value,
               send_taskid,
               send_taskname,
               is_end,
@@ -77,7 +78,7 @@
        where 1=1
            and del_flag = 0
            <if test="targetid != null ">and targetid = #{targetid}</if>
            <if test="isException != null ">and is_exception = #{isException}</if>
            <if test="defaultValue != null ">and default_value = #{defaultValue}</if>
            <if test="isEnd != null ">and is_end = #{isEnd}</if>
            <if test="score != null ">and score = #{score}</if>
            <if test="targetname != null ">and targetname = #{targetname}</if>
@@ -154,6 +155,7 @@
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
            <if test="isException != null">is_exception,</if>
            <if test="defaultValue != null">default_value,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="targetid != null">#{targetid},</if>
@@ -191,6 +193,7 @@
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname},</if>
            <if test="isException != null">#{isException},</if>
            <if test="defaultValue != null">#{defaultValue},</if>
        </trim>
    </insert>
@@ -232,6 +235,7 @@
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
            <if test="isException != null">is_exception = #{isException},</if>
            <if test="defaultValue != null">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
    </update>
@@ -242,6 +246,7 @@
            <if test="nodynamiccruxsJson == null ">nodynamiccruxs = #{nodynamiccruxsJson},</if>
            <if test="dynamiccruxsJson == null ">dynamiccruxs = #{dynamiccruxsJson},</if>
            <if test="defaultValue == null ">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml
@@ -45,6 +45,7 @@
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
        <result property="isException" column="is_exception"/>
        <result property="defaultValue" column="default_value"/>
    </resultMap>
    <sql id="selectIvrTaskTemplateTargetoptionVo">
@@ -66,6 +67,7 @@
               targetvalue,
               targetregex2,
               targetregex,
               default_value,
               optiondesc, language, version, groupid, isabnormal, warnup, warndown, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, scriptid, nodynamiccruxs, dynamiccruxs, next_question
        from ivr_task_template_targetoption
    </sql>
@@ -111,6 +113,7 @@
            <if test="score != null ">and score = #{score}</if>
            <if test="sendTaskid != null">and send_taskid= #{sendTaskid}</if>
            <if test="sendTaskname != null">and send_taskname = #{sendTaskname}</if>
            <if test="defaultValue != null">and default_value = #{defaultValue}</if>
    </select>
    <select id="selectIvrTaskTemplateTargetoptionById" parameterType="Long"
@@ -161,6 +164,7 @@
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
            <if test="isException != null ">is_exception,</if>
            <if test="defaultValue != null">default_value,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -201,6 +205,7 @@
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname},</if>
            <if test="isException != null ">#{isException},</if>
            <if test="defaultValue != null">#{defaultValue},</if>
        </trim>
    </insert>
@@ -245,6 +250,7 @@
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
            <if test="isException != null ">is_exception = #{isException},</if>
            <if test="defaultValue != null">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -280,6 +280,14 @@
                #{leavehospitaldistrictcode}
            </foreach>
        </if>
        <if test="hospitaldistrictcodeList != null and hospitaldistrictcodeList.size()>0">
            AND b.hospitaldistrictcode IN
            <foreach collection="hospitaldistrictcodeList" item="hospitaldistrictcode" open="(" separator=","
                     close=")">
                #{hospitaldistrictcode}
            </foreach>
        </if>
        <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
            AND b.leaveldeptcode IN
            <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
@@ -287,6 +295,13 @@
                #{leaveldeptcode}
            </foreach>
        </if>
        <if test="deptcodeList != null and deptcodeList.size()>0">
            AND b.deptcode IN
            <foreach collection="deptcodeList" item="deptcode" open="(" separator=","
                     close=")">
                #{deptcode}
            </foreach>
        </if>
        GROUP BY
        b.inhospid,
        a.age,
smartor/src/main/resources/mapper/smartor/SvyLibScriptOptionMapper.xml
@@ -41,12 +41,14 @@
        <result property="appendflag" column="appendflag"/>
        <result property="appenddesc" column="appenddesc"/>
        <result property="guid" column="guid"/>
        <result property="defaultValue" column="default_value"/>
    </resultMap>
    <sql id="selectSvyLibScriptOptionVo">
        select id,
               topicid,
               svyid,
               default_value,
               guid,
               picture_path,
               appendflag,
@@ -117,6 +119,7 @@
            <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
            <if test="picturePath != null">and picture_path = #{picturePath}</if>
            <if test="isException != null">and is_exception = #{isException}</if>
            <if test="defaultValue != null">and default_value = #{defaultValue}</if>
    </select>
    <select id="selectSvyLibScriptOptionByOptionid" parameterType="Long" resultMap="SvyLibScriptOptionResult">
@@ -163,6 +166,7 @@
            <if test="picturePath != null">picture_path,</if>
            <if test="guid != null">guid,</if>
            <if test="isException != null">is_exception,</if>
            <if test="defaultValue != null">default_value,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="topicid != null">#{topicid},</if>
@@ -200,6 +204,7 @@
            <if test="picturePath != null">#{picturePath},</if>
            <if test="guid != null">#{guid},</if>
            <if test="isException != null">#{isException},</if>
            <if test="defaultValue != null">#{defaultValue},</if>
        </trim>
    </insert>
@@ -240,6 +245,7 @@
            <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
            <if test="picturePath != null">picture_path = #{picturePath},</if>
            <if test="isException != null">is_exception = #{isException},</if>
            <if test="defaultValue != null">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
@@ -43,6 +43,7 @@
        <result property="prompt" column="prompt"/>
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
        <result property="defaultValue" column="default_value"/>
    </resultMap>
    <sql id="selectSvyLibTemplateTargetoptionVo">
@@ -54,6 +55,7 @@
               score,
               prompt,
               option_no,
               default_value,
               appendflag,
               appenddesc,
               categoryName,
@@ -104,6 +106,7 @@
            <if test="nextQuestion != null ">and next_question = #{nextQuestion}</if>
            <if test="language != null  and language != ''">and language = #{language}</if>
            <if test="version != null  and version != ''">and version = #{version}</if>
            <if test="defaultValue != null">and default_value = #{defaultValue}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
@@ -164,6 +167,7 @@
            <if test="prompt != null">prompt,</if>
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
            <if test="defaultValue != null">default_value,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="groupid != null">#{groupid},</if>
@@ -203,6 +207,7 @@
            <if test="prompt != null">#{prompt},</if>
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname},</if>
            <if test="defaultValue != null">#{defaultValue},</if>
        </trim>
    </insert>
@@ -246,6 +251,7 @@
            <if test="prompt != null">prompt = #{prompt},</if>
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
            <if test="defaultValue != null">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateTargetoptionMapper.xml
@@ -45,6 +45,7 @@
        <result property="prompt" column="prompt"/>
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
        <result property="defaultValue" column="default_value"/>
    </resultMap>
    <sql id="selectSvyTaskTemplateTargetoptionVo">
@@ -64,6 +65,7 @@
               categoryName,
               targetvalue,
               targetregex2,
               default_value,
               targetregex,
               optioncontent, language, version, groupid, isabnormal, warnup, warndown, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, scriptid, nodynamiccruxs, dynamiccruxs, next_question, picture_path
        from svy_task_template_targetoption
@@ -85,6 +87,7 @@
                '%')
            </if>
            <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
        <if test="defaultValue != null">and default_value = #{defaultValue}</if>
            <if test="targetregex2 != null  and targetregex2 != ''">and targetregex2 = #{targetregex2}</if>
            <if test="targetregex != null  and targetregex != ''">and targetregex = #{targetregex}</if>
            <if test="optioncontent != null  and optioncontent != ''">and optioncontent = #{optioncontent}</if>
@@ -159,6 +162,7 @@
            <if test="prompt != null">prompt,</if>
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
            <if test="defaultValue != null">default_value,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -199,6 +203,7 @@
            <if test="prompt != null">#{prompt},</if>
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname}</if>
            <if test="defaultValue != null">#{defaultValue}</if>
        </trim>
    </insert>
@@ -243,6 +248,7 @@
            <if test="prompt != null">score = #{prompt},</if>
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
            <if test="defaultValue != null">default_value = #{defaultValue},</if>
        </trim>
        where id = #{id}
    </update>