ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java
@@ -1,11 +1,16 @@ package com.ruoyi.web.controller.common; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.ruoyi.common.annotation.AddOrgId; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.dx.MessageSend; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.HttpUtil; import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.StringUtils; @@ -277,11 +282,67 @@ @AddOrgId @PostMapping("/sendYunMasSms") public AjaxResult sendYunMasSms(@RequestBody smsVO vo) throws Exception { // String yunMasConfig = configService.selectConfigByKey("ls.msg.yunmas",vo.getOrgid()); SmsUtils.YunMasConfig yunMasConfig = new SmsUtils.YunMasConfig(); String yunMasConfigJson = configService.selectConfigByKey("ls.msg.yunmas", vo.getOrgid()); SmsUtils.YunMasConfig yunMasConfig = SmsUtils.YunMasConfig.of(yunMasConfigJson); SmsUtils.SmsResult smsResult = SmsUtils.sendYunMasSms(yunMasConfig, vo.getPhone(), vo.getContent()); return AjaxResult.success(smsResult); } /** * 丽水妇幼 微信消息发送 * <p> * 外部系统传入患者信息和通知内容,由本系统统一获取 token、解析模板并调用丽水微信 sendMessage 接口。 * * @param request 微信消息请求 * @return 发送结果 */ @Anonymous @ApiOperation(value = "丽水妇幼 微信消息发送", notes = "供丽水市妇幼保健院外部调用") @Log(title = "丽水妇幼微信消息发送", businessType = BusinessType.OTHER) @PostMapping("/sendChatFuyou") public AjaxResult sendChatFuyou(@RequestBody LishuiFuyouWxChatRequest request) { if (request == null) { return AjaxResult.error("请求参数不能为空"); } try { SmsUtils.LsWxConfig config = SmsUtils.LsWxConfig.defaultLishui(); SmsUtils.LsWxMessage message = new SmsUtils.LsWxMessage(); message.setId(request.getTemplateId()); message.setPatientId(request.getPatientId()); message.setPatientName(request.getPatientName()); message.setIdCard(request.getIdCard()); message.setMobile(request.getMobile()); message.setMedCardNo(request.getMedCardNo()); message.setTitleName(request.getTitleName()); message.setContent(request.getContent()); message.setUrl(request.getUrl()); log.info("【丽水妇幼微信】收到外部调用,手机号:{},模板ID:{}", request.getMobile(), request.getTemplateId()); String resp = SmsUtils.sendChatLs(config, message); log.info("【丽水妇幼微信】外部调用结果:{}", resp); JSONObject result; try { result = JSON.parseObject(resp); } catch (Exception e) { log.error("【丽水妇幼微信】第三方响应不是合法JSON:{}", resp, e); return AjaxResult.error("丽水妇幼微信发送失败:第三方响应异常", resp); } if (result == null) { return AjaxResult.error("丽水妇幼微信发送失败:第三方响应为空", resp); } if (result.getIntValue("code") != 0) { String msg = result.getString("msg"); return AjaxResult.error("丽水妇幼微信发送失败:" + (StringUtils.isEmpty(msg) ? "第三方接口返回失败" : msg), result); } return AjaxResult.success("发送成功", result); } catch (Exception e) { log.error("【丽水妇幼微信】外部调用异常,手机号:{}", request.getMobile(), e); return AjaxResult.error("丽水妇幼微信发送异常:" + e.getMessage()); } } } ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -709,6 +709,8 @@ * taskSituation5Info - taskSituation = 5 * taskSituation6Info - taskSituation = 7 * manuallyCalledInfo - isManuallyCalled = 1L * firstDischargeCountInfo - visitCount = 1 * againFollowUpPushCountInfo - visitCount = 2 && visitDeptCode = sys.smartor.center.dept * filterCountList - taskSituation = 6 && sendstate = 4 * */ ruoyi-common/src/main/java/com/ruoyi/common/utils/sms/SmsUtils.java
@@ -1,6 +1,7 @@ package com.ruoyi.common.utils.sms; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.ruoyi.common.utils.HttpUtil; @@ -10,11 +11,20 @@ import lombok.Data; import lombok.extern.slf4j.Slf4j; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 短信发送工具类 @@ -333,4 +343,569 @@ } return sendMsg; } /** * 丽水微信 app-api 前缀 */ private static final String LS_WX_APP_PREFIX = "/app-api"; /** * 丽水微信开放接口前缀 */ private static final String LS_WX_API_PREFIX = LS_WX_APP_PREFIX + "/cross/open-api"; /** * 获取访问令牌 */ private static final String LS_WX_TOKEN_PATH = "/token"; /** * 获取消息模板 */ private static final String LS_WX_TEMPLATE_PATH = "/getTemplate"; /** * 发送消息 */ private static final String LS_WX_SEND_PATH = "/sendMessage"; /** * 访问令牌请求头 */ private static final String LS_WX_TOKEN_HEADER = "openApiToken"; /** * 令牌缓存(key:baseUrl|appId) */ private static final Map<String, LsWxToken> LS_WX_TOKEN_CACHE = new ConcurrentHashMap<>(); /** * 令牌提前刷新的秒数,避免临界过期 */ private static final long LS_WX_TOKEN_REFRESH_AHEAD_SECONDS = 60L; /** * 丽水微信接口配置 */ @Data public static class LsWxConfig { /** * 应用名称 */ private String appName; /** * 接口根地址,如 http://127.0.0.1:8080 * <p> * 可以只填 scheme://host:port,也可以填到 /app-api 或 /app-api/cross/open-api。 */ private String baseUrl; /** * 应用ID */ private String appId; /** * 应用密钥 */ private String appSecret; /** * 默认消息模板ID,消息里未指定时使用 */ private Long templateId; /** * 默认消息模板名称,未配置模板ID时通过 getTemplate 按名称查找 */ private String templateName; /** * 连接超时,单位:毫秒 */ private Integer connectTimeout = 5000; /** * 读取超时,单位:毫秒 */ private Integer readTimeout = 10000; /** * 丽水默认配置 */ public static LsWxConfig defaultLishui() { LsWxConfig config = new LsWxConfig(); config.setAppName("患者随访"); config.setBaseUrl("https://wmini.lsfby.com.cn/app-api"); config.setAppId("kpzEHgZSteCO4lz74"); config.setAppSecret("HKUDVMJSVTKQADIXV7XXRLNBQM8HNNL7"); // 消息模板:诊后随访提醒(未指定模板ID时按名称从 getTemplate 查询) config.setTemplateName("诊后随访提醒"); return config; } /** * 根据配置内容(json)构建,未配置的字段沿用默认值 * * @param configJson 形如 * {"appName":"患者随访","baseUrl":"https://wmini.lsfby.com.cn/app-api","appId":"...","appSecret":"...","templateId":16,"templateName":"诊后随访提醒"} */ public static LsWxConfig of(String configJson) { LsWxConfig config = defaultLishui(); if (StringUtils.isEmpty(configJson)) { return config; } JSONObject json; try { json = JSON.parseObject(configJson); } catch (Exception e) { log.error("【丽水微信】配置解析失败,使用默认配置,配置内容:{}", configJson, e); return config; } if (json == null) { return config; } if (StringUtils.isNotEmpty(json.getString("appName"))) { config.setAppName(json.getString("appName")); } if (StringUtils.isNotEmpty(json.getString("baseUrl"))) { config.setBaseUrl(json.getString("baseUrl")); } else if (StringUtils.isNotEmpty(json.getString("url"))) { config.setBaseUrl(json.getString("url")); } else if (StringUtils.isNotEmpty(json.getString("address"))) { config.setBaseUrl(json.getString("address")); } if (StringUtils.isNotEmpty(json.getString("appId"))) { config.setAppId(json.getString("appId")); } if (StringUtils.isNotEmpty(json.getString("appSecret"))) { config.setAppSecret(json.getString("appSecret")); } if (json.containsKey("templateId")) { config.setTemplateId(json.getLong("templateId")); } else if (json.containsKey("id")) { config.setTemplateId(json.getLong("id")); } if (StringUtils.isNotEmpty(json.getString("templateName"))) { config.setTemplateName(json.getString("templateName")); } else if (StringUtils.isNotEmpty(json.getString("tmpName"))) { config.setTemplateName(json.getString("tmpName")); } if (json.containsKey("connectTimeout")) { config.setConnectTimeout(json.getInteger("connectTimeout")); } if (json.containsKey("readTimeout")) { config.setReadTimeout(json.getInteger("readTimeout")); } return config; } /** * 关键参数是否齐全 */ public boolean isValid() { return StringUtils.isNotEmpty(baseUrl) && StringUtils.isNotEmpty(appId) && StringUtils.isNotEmpty(appSecret); } /** * 拼接开放接口地址 */ private String url(String path) { String prefix = baseUrl == null ? "" : baseUrl.trim(); while (prefix.endsWith("/")) { prefix = prefix.substring(0, prefix.length() - 1); } if (prefix.endsWith(LS_WX_API_PREFIX)) { return prefix + path; } if (prefix.endsWith(LS_WX_APP_PREFIX)) { return prefix + "/cross/open-api" + path; } return prefix + LS_WX_API_PREFIX + path; } } /** * 丽水微信消息参数,字段与 sendMessage 接口一致 */ @Data public static class LsWxMessage { /** * 消息模板ID,为空时使用配置中的模板 */ private Long id; /** * 患者编号 */ private String patientId; /** * 患者姓名 */ private String patientName; /** * 证件号 */ private String idCard; /** * 手机号码 */ private String mobile; /** * 就诊卡号 */ private String medCardNo; /** * 通知标题 */ private String titleName; /** * 通知内容 */ private String content; /** * 链接地址 */ private String url; } /** * 访问令牌缓存对象 */ private static class LsWxToken { private final String token; private final long expireAt; private LsWxToken(String token, long expireAt) { this.token = token; this.expireAt = expireAt; } private String getToken() { return token; } private long getExpireAt() { return expireAt; } } /** * 丽水微信消息发送(先获取/复用访问令牌,再调用 sendMessage) * <p> * 接口流程: * <ol> * <li>GET /app-api/cross/open-api/token?appId=...&appSecret=... 获取 openApiToken</li> * <li>POST /app-api/cross/open-api/sendMessage,请求头携带 openApiToken</li> * </ol> * * @param config 丽水微信配置 * @param message 消息参数 * @return 接口原始响应;本地校验失败时返回 {"code":-1,"msg":"失败原因"} */ public static String sendChatLs(LsWxConfig config, LsWxMessage message) { if (config == null || !config.isValid()) { return lsWxFail("丽水微信配置不完整,请配置 baseUrl、appId、appSecret"); } if (message == null) { return lsWxFail("丽水微信消息参数不能为空"); } if (StringUtils.isEmpty(message.getMobile()) && StringUtils.isEmpty(message.getIdCard()) && StringUtils.isEmpty(message.getPatientId()) && StringUtils.isEmpty(message.getMedCardNo())) { return lsWxFail("手机号码、证件号、患者编号、就诊卡号不能全部为空"); } try { String token = getLsWxToken(config); if (StringUtils.isEmpty(token)) { return lsWxFail("获取丽水微信访问令牌失败"); } // 模板优先级:消息指定 > 配置指定 > 按模板名称查询 Long templateId = message.getId(); if (templateId == null) { templateId = config.getTemplateId(); } if (templateId == null) { templateId = findLsWxTemplateId(config, token, config.getTemplateName()); if (templateId == null && StringUtils.isNotEmpty(config.getTemplateName())) { // 可能是缓存的令牌已失效,刷新令牌后重试一次 LS_WX_TOKEN_CACHE.remove(tokenCacheKey(config)); token = getLsWxToken(config); if (StringUtils.isNotEmpty(token)) { templateId = findLsWxTemplateId(config, token, config.getTemplateName()); } } } if (templateId == null) { return lsWxFail("未找到丽水微信消息模板,请指定消息模板ID或模板名称"); } JSONObject body = new JSONObject(true); body.put("id", templateId); body.put("patientId", nvl(message.getPatientId())); body.put("patientName", nvl(message.getPatientName())); body.put("idCard", nvl(message.getIdCard())); body.put("mobile", message.getMobile()); body.put("medCardNo", nvl(message.getMedCardNo())); body.put("titleName", nvl(message.getTitleName())); body.put("content", nvl(message.getContent())); body.put("url", nvl(message.getUrl())); String requestBody = body.toJSONString(); Map<String, String> headers = new HashMap<>(2); headers.put(LS_WX_TOKEN_HEADER, token); String sendUrl = config.url(LS_WX_SEND_PATH); log.info("【丽水微信】发送消息,地址:{},参数:{}", sendUrl, requestBody); String resp = lsWxRequest("POST", sendUrl, requestBody, headers, config); log.info("【丽水微信】发送结果:{}", resp); // 令牌失效时清除缓存并重试一次 if (isLsWxTokenInvalid(resp)) { LS_WX_TOKEN_CACHE.remove(tokenCacheKey(config)); token = getLsWxToken(config); if (StringUtils.isNotEmpty(token)) { headers.put(LS_WX_TOKEN_HEADER, token); resp = lsWxRequest("POST", sendUrl, requestBody, headers, config); log.info("【丽水微信】令牌失效重试结果:{}", resp); } } return resp; } catch (Exception e) { log.error("【丽水微信】发送异常,手机号:{},原因:{}", message.getMobile(), e.getMessage(), e); return lsWxFail("丽水微信发送异常:" + e.getMessage()); } } /** * 丽水微信消息发送(常用随访参数) * * @param config 丽水微信配置 * @param mobile 手机号码 * @param idCard 证件号 * @param patientName 患者姓名 * @param titleName 通知标题 * @param content 通知内容 * @param url 链接地址 * @return 接口原始响应;本地校验失败时返回 {"code":-1,"msg":"失败原因"} */ public static String sendChatLs(LsWxConfig config, String mobile, String idCard, String patientName, String titleName, String content, String url) { LsWxMessage message = new LsWxMessage(); message.setMobile(mobile); message.setIdCard(idCard); message.setPatientName(patientName); message.setTitleName(titleName); message.setContent(content); message.setUrl(url); return sendChatLs(config, message); } /** * 丽水微信消息发送(配置直接传 sys_config 中的 json) * * @param configJson 丽水微信配置 json * @param mobile 手机号码 * @param idCard 证件号 * @param patientName 患者姓名 * @param titleName 通知标题 * @param content 通知内容 * @param url 链接地址 * @return 接口原始响应;本地校验失败时返回 {"code":-1,"msg":"失败原因"} */ public static String sendChatLs(String configJson, String mobile, String idCard, String patientName, String titleName, String content, String url) { return sendChatLs(LsWxConfig.of(configJson), mobile, idCard, patientName, titleName, content, url); } /** * 获取丽水微信访问令牌,优先使用缓存 */ private static String getLsWxToken(LsWxConfig config) throws IOException { String cacheKey = tokenCacheKey(config); long now = System.currentTimeMillis(); LsWxToken cached = LS_WX_TOKEN_CACHE.get(cacheKey); if (cached != null && cached.getExpireAt() > now) { return cached.getToken(); } String url = config.url(LS_WX_TOKEN_PATH) + "?appId=" + encode(config.getAppId()) + "&appSecret=" + encode(config.getAppSecret()); String resp = lsWxRequest("GET", url, null, null, config); log.info("【丽水微信】获取token响应:{}", resp); if (StringUtils.isEmpty(resp)) { return null; } JSONObject json = JSON.parseObject(resp); if (json == null || json.getIntValue("code") != 0) { log.error("【丽水微信】获取token失败:{}", resp); return null; } JSONObject data = json.getJSONObject("data"); String token = data == null ? null : data.getString("token"); if (StringUtils.isEmpty(token)) { log.error("【丽水微信】获取token失败,响应中没有token:{}", resp); return null; } long expiresIn = data.getLongValue("expiresIn"); if (expiresIn <= 0) { expiresIn = 3000L; } long expireAt = now + Math.max(expiresIn - LS_WX_TOKEN_REFRESH_AHEAD_SECONDS, 1L) * 1000L; LS_WX_TOKEN_CACHE.put(cacheKey, new LsWxToken(token, expireAt)); return token; } /** * 根据模板名称查询模板ID */ private static Long findLsWxTemplateId(LsWxConfig config, String token, String templateName) throws IOException { if (StringUtils.isEmpty(templateName)) { return null; } String url = config.url(LS_WX_TEMPLATE_PATH) + "?appId=" + encode(config.getAppId()); Map<String, String> headers = new HashMap<>(2); headers.put(LS_WX_TOKEN_HEADER, token); String resp = lsWxRequest("GET", url, null, headers, config); log.info("【丽水微信】获取模板响应:{}", resp); if (StringUtils.isEmpty(resp)) { return null; } JSONObject json = JSON.parseObject(resp); if (json == null || json.getIntValue("code") != 0) { log.error("【丽水微信】获取模板失败:{}", resp); return null; } JSONArray data = json.getJSONArray("data"); if (data == null) { return null; } for (int i = 0; i < data.size(); i++) { JSONObject item = data.getJSONObject(i); if (item != null && templateName.equals(item.getString("tmpName"))) { return item.getLong("id"); } } log.error("【丽水微信】未找到模板:{}", templateName); return null; } /** * 判断响应是否属于令牌失效 */ private static boolean isLsWxTokenInvalid(String resp) { if (StringUtils.isEmpty(resp)) { return false; } try { JSONObject json = JSON.parseObject(resp); if (json == null) { return false; } int code = json.getIntValue("code"); if (code == 401 || code == 403) { return true; } String msg = json.getString("msg"); if (StringUtils.isEmpty(msg)) { return false; } String lower = msg.toLowerCase(); return (lower.contains("token") || msg.contains("令牌")) && (lower.contains("expire") || lower.contains("invalid") || msg.contains("失效") || msg.contains("过期")); } catch (Exception e) { return false; } } /** * 发送丽水微信 HTTP 请求 */ private static String lsWxRequest(String method, String url, String body, Map<String, String> headers, LsWxConfig config) throws IOException { HttpURLConnection connection = null; try { connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestMethod(method); connection.setConnectTimeout(config.getConnectTimeout() == null ? 5000 : config.getConnectTimeout()); connection.setReadTimeout(config.getReadTimeout() == null ? 10000 : config.getReadTimeout()); connection.setRequestProperty("Accept", "*/*"); if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } } if (body != null) { connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); try (OutputStream os = connection.getOutputStream()) { os.write(body.getBytes(StandardCharsets.UTF_8)); } } int status = connection.getResponseCode(); InputStream inputStream = status >= 200 && status < 300 ? connection.getInputStream() : connection.getErrorStream(); String resp = readStream(inputStream); if (status < 200 || status >= 300) { log.warn("【丽水微信】请求返回非200,地址:{},状态码:{},响应:{}", url, status, resp); } return resp; } finally { if (connection != null) { connection.disconnect(); } } } /** * 读取响应流 */ private static String readStream(InputStream inputStream) throws IOException { if (inputStream == null) { return ""; } StringBuilder result = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { result.append(line); } } return result.toString(); } /** * 令牌缓存key */ private static String tokenCacheKey(LsWxConfig config) { return config.getBaseUrl() + "|" + config.getAppId(); } /** * URL参数编码 */ private static String encode(String value) { if (value == null) { return ""; } try { return URLEncoder.encode(value, StandardCharsets.UTF_8.name()); } catch (Exception e) { return value; } } /** * null转空字符串 */ private static String nvl(String value) { return value == null ? "" : value; } /** * 构造本地失败响应 */ private static String lsWxFail(String msg) { JSONObject json = new JSONObject(true); json.put("code", -1); json.put("msg", msg); return json.toJSONString(); } } smartor/src/main/java/com/smartor/common/ScheduleSubtaskBuilder.java
@@ -74,7 +74,16 @@ // 模板:detail 优先于 task if (detail.getTemplateid() != null) { subtask.setTemplateid(detail.getTemplateid()); // 兼容历史数据:明细 templateid 可能是模板库ID,不能直接作为任务模板ID使用。 if ("2".equals(serviceTask.getType()) && String.valueOf(detail.getTemplateid()).equals(serviceTask.getLibtemplateid()) && serviceTask.getTemplateid() != null) { log.warn("计划明细 templateid [{}] 是模板库ID,已回退为任务模板ID [{}], taskid={}, detailId={}", detail.getTemplateid(), serviceTask.getTemplateid(), serviceTask.getTaskid(), detail.getId()); subtask.setTemplateid(serviceTask.getTemplateid()); } else { subtask.setTemplateid(detail.getTemplateid()); } subtask.setTemplatename(detail.getTemplatename()); } if (detail.getLibtemplateid() != null) { smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
@@ -90,6 +90,14 @@ @Excel(name = " 出院人次 ") private Integer dischargeCount = 0; @ApiModelProperty(value = "首次出院人次(visitCount = 1)") @Excel(name = " 首次出院人次 ") private Long firstDischargeCount = 0L; @ApiModelProperty(value = "再次随访推送人数(首个再次随访且执行科室为随访中心)再次随访推送率(再次随访推送人数 / 首次出院人次)") @Excel(name = " 再次随访推送人数 ") private Long againFollowUpPushCount = 0L; @ApiModelProperty(value = "无需随访人次") @Excel(name = " 无需随访人次 ") private Long nonFollowUp = 0L; smartor/src/main/java/com/smartor/service/IServiceTaskdeptService.java
@@ -67,4 +67,12 @@ * @return 结果 */ public int deleteServiceTaskdeptById(Long id); /** * 按任务ID删除科室关联,可指定科室类型 * * @param serviceTaskdept 模板科室关联 * @return 结果 */ public int deleteServiceTaskdeptByTaskId(ServiceTaskdept serviceTaskdept); } smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -1312,6 +1312,20 @@ } /** * 科室编码去重,保持原顺序,避免 service_task.deptcode 超长和 service_taskdept 重复绑定 */ private String normalizeDeptCodes(String deptCodes) { if (StringUtils.isEmpty(deptCodes)) { return deptCodes; } return Arrays.stream(deptCodes.split(",")) .map(String::trim) .filter(code -> StringUtils.isNotEmpty(code)) .distinct() .collect(Collectors.joining(",")); } /** * 单一任务 * * @return 结果 @@ -1323,6 +1337,8 @@ log.info("任务入参为空,请检查入参"); throw new BaseException("任务入参为空,请检查入参"); } // 科室编码去重,避免 service_task.deptcode 超长及 service_taskdept 重复绑定 serviceTaskVO.setDeptcode(normalizeDeptCodes(serviceTaskVO.getDeptcode())); ServiceTask serviceTask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceTask.class); if (CollectionUtils.isEmpty(serviceTaskVO.getPreachformList())) throw new BaseException("任务的发送方式为空"); //将preachfromList放到serviceTask中的preachfrom中 @@ -1557,7 +1573,12 @@ serviceSubtask.setInhospid(patTaskRelevance.getHospid()); //新建完成就是待发送状态 serviceSubtask.setSendstate(2L); serviceSubtask.setDeptcode(StringUtils.isNotEmpty(patTaskRelevance.getDeptcode()) ? patTaskRelevance.getDeptcode() : serviceTaskVO.getDeptcode()); String subtaskDeptCode = patTaskRelevance.getDeptcode(); if (StringUtils.isEmpty(subtaskDeptCode) && StringUtils.isNotEmpty(serviceTaskVO.getDeptcode())) { // service_subtask.deptcode 为单值字段,不能写入任务的多科室拼接串,取第一个科室兜底 subtaskDeptCode = serviceTaskVO.getDeptcode().split(",")[0].trim(); } serviceSubtask.setDeptcode(subtaskDeptCode); serviceSubtask.setDeptname(StringUtils.isNotEmpty(patTaskRelevance.getDeptName()) ? patTaskRelevance.getDeptName() : serviceTaskVO.getDeptname()); serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode()); serviceSubtask.setLeavehospitaldistrictname(patTaskRelevance.getLeavehospitaldistrictname()); @@ -1697,6 +1718,11 @@ if (StringUtils.isNotEmpty(serviceTaskVO.getAppltype())) { if (serviceTaskVO.getAppltype().equals("1") || serviceTaskVO.getAppltype().equals("2")) { if (StringUtils.isNotEmpty(serviceTaskVO.getDeptcode())) { // 修改任务时先软删除旧的科室绑定,避免旧科室残留 ServiceTaskdept oldDept = new ServiceTaskdept(); oldDept.setTaskId(serviceTask.getTaskid()); oldDept.setDeptType("1"); serviceTaskdeptService.deleteServiceTaskdeptByTaskId(oldDept); String[] deptcodes = serviceTaskVO.getDeptcode().split(","); for (String deptCode : deptcodes) { ServiceTaskdept serviceTaskdept = new ServiceTaskdept(); @@ -3735,6 +3761,8 @@ serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode()); serviceSubtaskStatistic.setDrcode(serviceSubtaskList.get(0).getDrcode()); serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname()); //随访中心科室,用于统计再次随访推送到随访中心的人数 String centerDept = configService.selectConfigByKey("sys.smartor.center.dept", serviceSubtaskList.get(0).getOrgid()); //出院人次 serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size()); for (ServiceSubtask serviceSubtask : serviceSubtaskList) { @@ -3752,6 +3780,17 @@ //及时随访人次:已完成且未超时 if (isTimelyFollowUp(serviceSubtask)) { serviceSubtaskStatistic.setTimelyFollowUp(serviceSubtaskStatistic.getTimelyFollowUp() + 1L); } //首次出院人次:visitCount = 1,作为再次随访推送率的分母 if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) { serviceSubtaskStatistic.setFirstDischargeCount(serviceSubtaskStatistic.getFirstDischargeCount() + 1L); } //再次随访推送人数:首个再次随访(visitCount = 2)且执行科室为随访中心科室 if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 2 && StringUtils.isNotEmpty(centerDept) && StringUtils.equals(StringUtils.trim(centerDept), StringUtils.trim(serviceSubtask.getVisitDeptCode()))) { serviceSubtaskStatistic.setAgainFollowUpPushCount(serviceSubtaskStatistic.getAgainFollowUpPushCount() + 1L); } //人工已拨通总量 @@ -4768,6 +4807,8 @@ * 获取随访统计超链接 * dischargeCountInfo * followUpNeededAllInfo - sendstate != 4 (1,2,3,5,6,7) * firstDischargeCountInfo - visitCount = 1 * againFollowUpPushCountInfo - visitCount = 2 && visitDeptCode = sys.smartor.center.dept(随访中心科室) * nonFollowUpInfo - sendstate = 4 * needFollowUpInfo - visitCount = 1 && sendstate != 4 * pendingFollowUpInfo - visitCount = 1 && sendstate = 2 @@ -4810,7 +4851,10 @@ public List<ServiceSubtask> getSfStatisticsHyperlink(ServiceSubtaskCountReq serviceSubtaskCountReq) { String hyperLinkInfoType = serviceSubtaskCountReq.getHyperLinkInfoType(); if (StringUtils.isNotEmpty(hyperLinkInfoType)) { applyHyperLinkInfoType(serviceSubtaskCountReq, hyperLinkInfoType); if (!applyHyperLinkInfoType(serviceSubtaskCountReq, hyperLinkInfoType)) { // 下钻依赖的配置缺失时返回空明细,避免退化成无过滤条件的查询 return new ArrayList<>(); } } String followUpCountStyle = serviceSubtaskCountReq.getFollowUpCountStyle(); @@ -4831,7 +4875,7 @@ return serviceSubtasks; } private void applyHyperLinkInfoType(ServiceSubtaskCountReq serviceSubtaskCountReq, String hyperLinkInfoType) { private boolean applyHyperLinkInfoType(ServiceSubtaskCountReq serviceSubtaskCountReq, String hyperLinkInfoType) { //及时随访明细需要沿用请求的首次/再次口径 Integer originVisitCount = serviceSubtaskCountReq.getVisitCount(); serviceSubtaskCountReq.setVisitCount(null); @@ -4844,6 +4888,22 @@ switch (hyperLinkInfoType) { case "dischargeCountInfo": break; case "firstDischargeCountInfo": //首次出院人次:visitCount = 1 serviceSubtaskCountReq.setVisitCount(1); break; case "againFollowUpPushCountInfo": { //再次随访推送人数:visitCount = 2 且执行科室为随访中心科室 String centerDept = configService.selectConfigByKey("sys.smartor.center.dept", serviceSubtaskCountReq.getOrgid()); if (StringUtils.isBlank(centerDept)) { log.warn("获取再次随访推送明细失败,未配置随访中心科室参数 sys.smartor.center.dept, orgid={}", serviceSubtaskCountReq.getOrgid()); return false; } serviceSubtaskCountReq.setVisitCount(2); serviceSubtaskCountReq.setVisitDeptCode(centerDept.trim()); serviceSubtaskCountReq.setVisitDeptName(null); break; } case "timelyFollowUpInfo": serviceSubtaskCountReq.setVisitCount(originVisitCount); serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L))); @@ -4995,6 +5055,7 @@ default: break; } return true; } @@ -5336,6 +5397,8 @@ // 初始化数值字段 total.setDischargeCount(0); total.setFirstDischargeCount(0L); total.setAgainFollowUpPushCount(0L); total.setNonFollowUp(0L); total.setFilterCount(0L); total.setFollowUpNeeded(0L); @@ -5368,6 +5431,8 @@ if (stat.getDischargeCount() != null) { total.setDischargeCount(total.getDischargeCount() + stat.getDischargeCount()); } total.setFirstDischargeCount(total.getFirstDischargeCount() + (stat.getFirstDischargeCount() != null ? stat.getFirstDischargeCount() : 0L)); total.setAgainFollowUpPushCount(total.getAgainFollowUpPushCount() + (stat.getAgainFollowUpPushCount() != null ? stat.getAgainFollowUpPushCount() : 0L)); total.setNonFollowUp(total.getNonFollowUp() + (stat.getNonFollowUp() != null ? stat.getNonFollowUp() : 0L)); total.setFilterCount(total.getFilterCount() + (stat.getFilterCount() != null ? stat.getFilterCount() : 0L)); total.setFollowUpNeeded(total.getFollowUpNeeded() + (stat.getFollowUpNeeded() != null ? stat.getFollowUpNeeded() : 0L)); @@ -5762,7 +5827,15 @@ return resultMap; } if (StringUtils.isEmpty(serviceSubtask.getPatidHis())) { if (patArchive == null) { resultMap.put("code", -1); resultMap.put("message", "发送异常:" + "【公众号】未查询到患者档案信息,无法通过公众号发送"); return resultMap; } // his系统的患者id取自患者档案pat_archive.patid_his, // service_subtask查询未关联该字段(serviceSubtask.getPatidHis()恒为空),不能用于校验 if (StringUtils.isEmpty(patArchive.getPatidHis())) { resultMap.put("code", -1); resultMap.put("message", "发送异常:" + "【公众号】公众号发送失败,his系统的患者id为空"); return resultMap; smartor/src/main/java/com/smartor/service/impl/ServiceTaskScheduleServiceImpl.java
@@ -6,13 +6,17 @@ import com.ruoyi.common.utils.spring.SpringUtils; import com.smartor.domain.ServiceSubtask; import com.smartor.domain.ServiceSubtaskPreachform; import com.smartor.domain.ServiceTask; import com.smartor.domain.ServiceTaskSchedule; import com.smartor.domain.ServiceTaskScheduleDetail; import com.smartor.domain.ServiceTaskScheduleVO; import com.smartor.domain.SvyTaskTemplateScript; import com.smartor.mapper.ServiceSubtaskMapper; import com.smartor.mapper.ServiceSubtaskPreachformMapper; import com.smartor.mapper.ServiceTaskMapper; import com.smartor.mapper.ServiceTaskScheduleDetailMapper; import com.smartor.mapper.ServiceTaskScheduleMapper; import com.smartor.mapper.SvyTaskTemplateScriptMapper; import com.smartor.service.IServiceTaskScheduleService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -46,6 +50,12 @@ @Autowired private ServiceSubtaskPreachformMapper serviceSubtaskPreachformMapper; @Autowired private ServiceTaskMapper serviceTaskMapper; @Autowired private SvyTaskTemplateScriptMapper svyTaskTemplateScriptMapper; /** 单次扫描的最大计划数,避免长事务。 */ private static final int ROLL_BATCH_LIMIT = 200; @@ -57,6 +67,10 @@ } if (CollectionUtils.isEmpty(vo.getDetailList())) { throw new BaseException("任务计划明细不能为空(至少一条 detail)"); } ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(vo.getTaskid()); if (serviceTask == null) { throw new BaseException("任务不存在或已删除,taskid=" + vo.getTaskid()); } // 1. 旧计划删 @@ -100,6 +114,10 @@ for (ServiceTaskScheduleDetail detail : detailList) { detail.setTaskid(vo.getTaskid()); detail.setScheduleid(schedule.getId()); Long resolvedTemplateId = resolveTaskTemplateId(serviceTask, detail); if (resolvedTemplateId != null) { detail.setTemplateid(resolvedTemplateId); } if (detail.getSeq() == null) { detail.setSeq(seq); } @@ -120,6 +138,48 @@ log.info("[任务组] taskid={} 计划保存完成, scheduleId={}, detail 条数={}", vo.getTaskid(), schedule.getId(), detailList.size()); return schedule; } /** * 计划明细的 templateid 应保存任务模板ID(svy_task_template.id), * libtemplateid 才保存模板库ID(svy_lib_template_script.svyid)。 * 兼容前端仍传模板库ID的情况:若明细模板在任务模板问题表中不存在, * 且该ID就是任务的模板库ID,则回退到任务自己的模板ID。 */ private Long resolveTaskTemplateId(ServiceTask serviceTask, ServiceTaskScheduleDetail detail) { Long detailTemplateId = detail.getTemplateid(); if (detailTemplateId == null || serviceTask == null) { return detailTemplateId; } if (hasTaskTemplateScripts(detailTemplateId)) { return detailTemplateId; } // 只有问卷任务才依赖 svy_task_template_script,其它任务类型保持原逻辑 if (!"2".equals(serviceTask.getType())) { return detailTemplateId; } Long taskTemplateId = serviceTask.getTemplateid(); boolean detailUsesLibTemplate = detailTemplateId.equals(detail.getLibtemplateid()) || String.valueOf(detailTemplateId).equals(serviceTask.getLibtemplateid()); if (detailUsesLibTemplate && hasTaskTemplateScripts(taskTemplateId)) { log.warn("计划明细模板ID [{}] 是模板库ID,已映射为任务模板ID [{}], taskid={}", detailTemplateId, taskTemplateId, serviceTask.getTaskid()); return taskTemplateId; } log.warn("计划明细模板ID [{}] 在任务模板问题表中不存在, taskid={}, taskTemplateId={}, taskLibTemplateId={}", detailTemplateId, serviceTask.getTaskid(), taskTemplateId, serviceTask.getLibtemplateid()); return detailTemplateId; } private boolean hasTaskTemplateScripts(Long templateId) { if (templateId == null) { return false; } SvyTaskTemplateScript query = new SvyTaskTemplateScript(); query.setTemplateID(templateId); query.setDelFlag("0"); return CollectionUtils.isNotEmpty(svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(query)); } @Override @@ -230,6 +290,7 @@ log.warn("[任务组-滚动] scheduleId={} 明细为空, 跳过", scheduleId); return false; } ServiceTask serviceTask = serviceTaskMapper.selectServiceTaskByTaskid(schedule.getTaskid()); // 推进步长(轮间隔) int stepNum = schedule.getScheduleTimeNum() == null ? 0 : schedule.getScheduleTimeNum(); @@ -258,7 +319,7 @@ scheduleId, src.getScheduleSeq(), src.getId()); continue; } ServiceSubtask copy = cloneForNextLoop(src, detail, nextLoop, stepNum, stepUnit, now); ServiceSubtask copy = cloneForNextLoop(src, serviceTask, detail, nextLoop, stepNum, stepUnit, now); serviceSubtaskMapper.insertServiceSubtask(copy); // 复制 preachform copyPreachform(src.getId(), copy); @@ -282,7 +343,8 @@ /** * 克隆 subtask 到下一轮:清主键、清回签字段、推进 visit_time、设置 loop_count。 */ private ServiceSubtask cloneForNextLoop(ServiceSubtask src, ServiceTaskScheduleDetail detail, private ServiceSubtask cloneForNextLoop(ServiceSubtask src, ServiceTask serviceTask, ServiceTaskScheduleDetail detail, long nextLoop, int stepNum, int stepUnit, Date now) { ServiceSubtask copy = JSON.parseObject(JSON.toJSONString(src), ServiceSubtask.class); copy.setId(null); @@ -294,9 +356,10 @@ copy.setSendstate(2L); copy.setLoopCount(nextLoop); copy.setScheduleDetailId(detail.getId()); // 模板:detail 优先 if (detail.getTemplateid() != null) { copy.setTemplateid(detail.getTemplateid()); // 模板:detail 优先,并把历史数据里的模板库ID映射为任务模板ID Long resolvedTemplateId = resolveTaskTemplateId(serviceTask, detail); if (resolvedTemplateId != null) { copy.setTemplateid(resolvedTemplateId); copy.setTemplatename(detail.getTemplatename()); } if (detail.getLibtemplateid() != null) { smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -442,34 +442,50 @@ serviceSubtaskVO.setPatid(patid); } List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); List<SvyTaskTemplateScriptVO> svyTaskTemplateScriptVOS = null; if (CollectionUtils.isNotEmpty(serviceSubtaskList) && serviceSubtaskList.size() == 1) { if (serviceSubtaskList.get(0).getSendstate() == 3 && isFinish == true) { ServiceSubtask serviceSubtask = new ServiceSubtask(); serviceSubtask.setSendstate(1L); serviceSubtask.setPatid(patid); serviceSubtask.setTaskid(serviceTask.getTaskid()); serviceSubtaskMapper.updateServiceSubtaskByPatId(serviceSubtask); } //通过模板ID获取问题信息 SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript(); svyTaskTemplateScript.setTemplateID(Long.valueOf(serviceTask.getTemplateid())); if (serviceSubtaskList.get(0).getTemplateid() != null) svyTaskTemplateScript.setTemplateID(serviceSubtaskList.get(0).getTemplateid()); else if (serviceTask.getTemplateid() != null) svyTaskTemplateScript.setTemplateID(serviceTask.getTemplateid()); svyTaskTemplateScript.setDelFlag("0"); List<SvyTaskTemplateScript> svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript); if (CollectionUtils.isEmpty(svyTaskTemplateScripts) || svyTaskTemplateScripts.size() == 0) { insertSvyTaskTempScript(null, serviceTask); svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript); if (CollectionUtils.isEmpty(svyTaskTemplateScripts)) { throw new BaseException("请联系管理员,检查问题模板信息!"); } } svyTaskTemplateScriptVOS = DtoConversionUtils.sourceToTarget(svyTaskTemplateScripts, SvyTaskTemplateScriptVO.class); if (CollectionUtils.isEmpty(serviceSubtaskList)) { throw new BaseException("未找到患者子任务,taskid=" + serviceTask.getTaskid() + ", patid=" + patid + ", subId=" + subId); } if (serviceSubtaskList.size() > 1) { throw new BaseException("存在多条患者子任务,请传入子任务ID后再查询,taskid=" + serviceTask.getTaskid() + ", patid=" + patid); } ServiceSubtask serviceSubtask = serviceSubtaskList.get(0); if (Long.valueOf(3L).equals(serviceSubtask.getSendstate()) && Boolean.TRUE.equals(isFinish)) { ServiceSubtask updateSubtask = new ServiceSubtask(); updateSubtask.setSendstate(1L); updateSubtask.setPatid(patid); updateSubtask.setTaskid(serviceTask.getTaskid()); serviceSubtaskMapper.updateServiceSubtaskByPatId(updateSubtask); } // 子任务模板优先;子任务未设置时回退到任务模板。 Long templateId = serviceSubtask.getTemplateid() != null ? serviceSubtask.getTemplateid() : serviceTask.getTemplateid(); if (templateId == null) { throw new BaseException("任务未配置问卷模板,taskid=" + serviceTask.getTaskid()); } // 查询与兜底复制必须使用同一个模板ID,否则会出现“复制到A、仍查B”的死循环。 SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript(); svyTaskTemplateScript.setTemplateID(templateId); svyTaskTemplateScript.setDelFlag("0"); List<SvyTaskTemplateScript> svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript); if (CollectionUtils.isEmpty(svyTaskTemplateScripts)) { log.warn("问卷任务模板问题为空,开始从模板库兜底复制, taskid={}, patid={}, subId={}, queryTemplateId={}, taskTemplateId={}, libTemplateId={}", serviceTask.getTaskid(), patid, subId, templateId, serviceTask.getTemplateid(), serviceTask.getLibtemplateid()); insertSvyTaskTempScript(null, serviceTask, templateId); svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript); if (CollectionUtils.isEmpty(svyTaskTemplateScripts)) { throw new BaseException("请联系管理员,检查问题模板信息! taskid=" + serviceTask.getTaskid() + ", templateId=" + templateId + ", libTemplateId=" + serviceTask.getLibtemplateid()); } } List<SvyTaskTemplateScriptVO> svyTaskTemplateScriptVOS = DtoConversionUtils.sourceToTarget(svyTaskTemplateScripts, SvyTaskTemplateScriptVO.class); //获取患者信息 PatArchive patArchive = null; if (patfrom.equals("0")) patArchive = patArchiveMapper.selectPatArchiveByPatid(patid); @@ -529,7 +545,7 @@ svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions); } else { //如果选项没有查到,需要去基础模板库将选项查询出来,放到任务模板选项库中 insertSvyTaskTempScript(svyTaskTemplateScriptVO, serviceTask); insertSvyTaskTempScript(svyTaskTemplateScriptVO, serviceTask, templateId); } } @@ -539,8 +555,13 @@ } private void insertSvyTaskTempScript(SvyTaskTemplateScriptVO svyTaskTemplateScriptVO, ServiceTask serviceTask) { log.info("-------基础模板libtemplateid的值为:{}", serviceTask.getLibtemplateid()); private void insertSvyTaskTempScript(SvyTaskTemplateScriptVO svyTaskTemplateScriptVO, ServiceTask serviceTask, Long targetTemplateId) { log.info("-------基础模板libtemplateid的值为:{},目标templateID为:{}", serviceTask.getLibtemplateid(), targetTemplateId); if (targetTemplateId == null) { log.warn("目标模板ID为空,无法复制基础模板问题, taskid={}", serviceTask.getTaskid()); return; } if (StringUtils.isEmpty(serviceTask.getLibtemplateid())) { return; } @@ -551,7 +572,8 @@ log.info("-------基础模板svyLibTemplateScripts问题值为:{}", svyLibTemplateScripts.size()); for (SvyLibTemplateScript sll : svyLibTemplateScripts) { if (ObjectUtils.isNotEmpty(svyTaskTemplateScriptVO)) { if (sll.getScriptContent().trim().equals(svyTaskTemplateScriptVO.getScriptContent().trim())) { if (StringUtils.equals(StringUtils.trim(sll.getScriptContent()), StringUtils.trim(svyTaskTemplateScriptVO.getScriptContent()))) { SvyLibTemplateTargetoption sltto = new SvyLibTemplateTargetoption(); sltto.setScriptid(sll.getId()); List<SvyLibTemplateTargetoption> svyLibTemplateTargetoptions = svyLibTemplateTargetoptionMapper.selectSvyLibTemplateTargetoptionList(sltto); @@ -559,7 +581,7 @@ //将查出来的选项,放到svyTaskTemplateTargetoption中 List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptionList = DtoConversionUtils.sourceToTarget(svyLibTemplateTargetoptions, SvyTaskTemplateTargetoption.class); for (int i = 0; i < svyTaskTemplateTargetoptionList.size(); i++) { svyTaskTemplateTargetoptionList.get(i).setTemplateID(svyTaskTemplateScriptVO.getTemplateID()); svyTaskTemplateTargetoptionList.get(i).setTemplateID(targetTemplateId); svyTaskTemplateTargetoptionList.get(i).setScriptid(svyTaskTemplateScriptVO.getId()); svyTaskTemplateTargetoptionMapper.insertSvyTaskTemplateTargetoption(svyTaskTemplateTargetoptionList.get(i)); log.info("-------新增完之后的选项ID值为:{}", svyTaskTemplateTargetoptionList.get(i).getId()); @@ -571,7 +593,7 @@ SvyTaskTemplateScript stts = DtoConversionUtils.sourceToTarget(sll, SvyTaskTemplateScript.class); stts.setId(null); stts.setTaskid(serviceTask.getTaskid()); stts.setTemplateID(serviceTask.getTemplateid()); stts.setTemplateID(targetTemplateId); svyTaskTemplateScriptMapper.insertSvyTaskTemplateScript(stts); //新增问题选项 @@ -580,7 +602,7 @@ List<SvyLibTemplateTargetoption> svyLibTemplateTargetoptions = svyLibTemplateTargetoptionMapper.selectSvyLibTemplateTargetoptionList(sltto); List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptionList = DtoConversionUtils.sourceToTarget(svyLibTemplateTargetoptions, SvyTaskTemplateTargetoption.class); for (int i = 0; i < svyTaskTemplateTargetoptionList.size(); i++) { svyTaskTemplateTargetoptionList.get(i).setTemplateID(serviceTask.getTemplateid()); svyTaskTemplateTargetoptionList.get(i).setTemplateID(targetTemplateId); svyTaskTemplateTargetoptionList.get(i).setScriptid(stts.getId()); svyTaskTemplateTargetoptionMapper.insertSvyTaskTemplateTargetoption(svyTaskTemplateTargetoptionList.get(i)); } smartor/src/main/java/com/smartor/service/impl/ServiceTaskdeptServiceImpl.java
@@ -106,4 +106,9 @@ public int deleteServiceTaskdeptById(Long id) { return serviceTaskdeptMapper.deleteServiceTaskdeptById(id); } @Override public int deleteServiceTaskdeptByTaskId(ServiceTaskdept serviceTaskdept) { return serviceTaskdeptMapper.deleteServiceTaskdeptByTaskId(serviceTaskdept); } } smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1671,6 +1671,7 @@ taskid, task_name, visit_time, visit_dept_code, finishtime, endtime, senddate, @@ -1959,6 +1960,8 @@ taskid, task_name, visit_time, visit_dept_code, visit_dept_name, finishtime, endtime, senddate, smartor/src/main/resources/mapper/smartor/ServiceTaskdeptMapper.xml
@@ -196,6 +196,9 @@ where 1=1 <if test="id != null">and id = #{id}</if> <if test="taskId != null">and task_id = #{taskId}</if> <if test="deptType != null and deptType != ''"> AND dept_type = #{deptType} </if> <if test="orgid != null and orgid != ''"> AND orgid = #{orgid} </if>