| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.core.service.IDingTalkService; |
| | | import com.ruoyi.common.dx.MessageSend; |
| | | import com.ruoyi.common.enums.MsgLSEnum; |
| | | import com.ruoyi.common.enums.ServiceFromEnum; |
| | | import com.ruoyi.common.enums.WxGZHEnum; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.ruoyi.common.utils.sms.smsUtils; |
| | | import com.ruoyi.message.SendResult; |
| | | import com.ruoyi.message.sms.SmsSendRequest; |
| | | import com.ruoyi.message.sms.SmsSenderFactory; |
| | | import com.ruoyi.message.sms.provider.xh.XinHuaSmsSender; |
| | | import com.ruoyi.message.wechat.WechatSendRequest; |
| | | import com.ruoyi.message.wechat.WechatSenderFactory; |
| | | import com.ruoyi.quartz.constant.MzGatherConstant; |
| | | import com.ruoyi.quartz.enums.MzGatherParamEnum; |
| | | import com.ruoyi.quartz.enums.MzGatherSlotEnum; |
| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.smartor.common.LSHospTokenUtil; |
| | | import com.smartor.common.MtSubmitSmUtil; |
| | | import com.ruoyi.message.sms.provider.sltd.ws.MessageSend; |
| | | import com.smartor.common.QwenLLMUtil; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.VO.ServiceSubtaskDetailTraceVO; |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.security.MessageDigest; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.hutool.core.convert.Convert.toHex; |
| | | |
| | | /** |
| | | * 定时任务调度测试 |
| | |
| | | @Value("${localIP}") |
| | | private String localIP; |
| | | |
| | | @Value("${xhsmsPath}") |
| | | private String xhsmsPath; |
| | | |
| | | @Value("${xhsmsAccount}") |
| | | private String xhsmsAccount; |
| | | |
| | | @Value("${xhsmsPwd}") |
| | | private String xhsmsPwd; |
| | | // 虚拟接入码 |
| | | @Value("${xhsmsjrm}") |
| | | private String xhsmsjrm; |
| | | |
| | | @Value("${pub_key}") |
| | | private String pub_key; |
| | | |
| | |
| | | @Value("${server.port}") |
| | | private String port; |
| | | |
| | | /** |
| | | * 消息发送方工厂(短信/微信公众号)。 |
| | | * <p> |
| | | * 原来短信与公众号的发送逻辑在本类里用 {@code if (active.equals("xx"))} 硬分支了约 300 行, |
| | | * 现已收口到 {@code ruoyi-message} 模块,这里只负责按 {@code active} 路由。 |
| | | */ |
| | | @Autowired |
| | | private MtSubmitSmUtil mtSubmitSmUtil; |
| | | private SmsSenderFactory smsSenderFactory; |
| | | |
| | | @Autowired |
| | | private WechatSenderFactory wechatSenderFactory; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | |
| | | preAdmitStatus.add("FH0109.53"); |
| | | reqVO.setStatusList(preAdmitStatus); |
| | | log.info("【dealHisData】预入院采集数据入参:{}", reqVO); |
| | | serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); |
| | | try { |
| | | serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); |
| | | } catch (Exception e) { |
| | | // 单类数据失败不再向上抛:否则一段失败会让本次回溯后面的所有段都不执行 |
| | | log.error("【dealHisData】预入院采集失败,跳过该类继续。院区:{},时间段:{} ~ {}", cid, startDateStr, endDateStr, e); |
| | | } |
| | | log.info("【dealHisData】预入院終了采集数据,院区:{}", cid); |
| | | |
| | | // 入院 |
| | |
| | | admitStatus.add("FH0109.24"); |
| | | reqVO.setStatusList(admitStatus); |
| | | log.info("【dealHisData】入院采集数据入参:{}", reqVO); |
| | | serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); |
| | | try { |
| | | serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); |
| | | } catch (Exception e) { |
| | | // 单类数据失败不再向上抛:否则一段失败会让本次回溯后面的所有段都不执行 |
| | | log.error("【dealHisData】入院采集失败,跳过该类继续。院区:{},时间段:{} ~ {}", cid, startDateStr, endDateStr, e); |
| | | } |
| | | log.info("【dealHisData】入院終了采集数据,院区:{}", cid); |
| | | |
| | | // 出院 |
| | |
| | | dischargeStatus.add("FH0109.25"); |
| | | reqVO.setStatusList(dischargeStatus); |
| | | log.info("【dealHisData】出院采集数据入参:{}", reqVO); |
| | | serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); |
| | | try { |
| | | serviceSLTDHealthcareRecordService.queryHealthcareRecordList(reqVO); |
| | | } catch (Exception e) { |
| | | // 单类数据失败不再向上抛:否则一段失败会让本次回溯后面的所有段都不执行 |
| | | log.error("【dealHisData】出院采集失败,跳过该类继续。院区:{},时间段:{} ~ {}", cid, startDateStr, endDateStr, e); |
| | | } |
| | | log.info("【dealHisData】出院结束采集数据,院区:{}", cid); |
| | | } |
| | | |
| | |
| | | serviceOutPath.setUpdateTime(new Date()); |
| | | serviceOutPath.setUrl(url); |
| | | iServiceOutPathService.updateServiceOutPath(serviceOutPath); |
| | | String isSuccess = null; |
| | | //短信发送:各站点对接方式差异较大(报文/签名/token/返回判定都不同), |
| | | //已收口到 ruoyi-message 模块,这里只负责组装入参并路由 |
| | | log.info("active的值为:{}", active); |
| | | if (active.equals("xh")) { |
| | | Map<String, String> req = new HashMap<>(); |
| | | // req.put("phone", sendMagParam.getPhone()); |
| | | // req.put("content", sendMagParam.getContent()); |
| | | Map<String, String> map2 = new HashMap<String, String>(); |
| | | map2.put("action", "send"); |
| | | map2.put("account", xhsmsAccount); |
| | | map2.put("password", xhsmsPwd); |
| | | map2.put("mobile", sendMagParam.getPhone()); |
| | | map2.put("content", sendMagParam.getContent()); |
| | | map2.put("extno", xhsmsjrm); |
| | | map2.put("rt", "json"); |
| | | StringBuilder encodedParams = new StringBuilder(); |
| | | |
| | | for (Map.Entry<String, String> entry : map2.entrySet()) { |
| | | if (encodedParams.length() > 0) { |
| | | encodedParams.append("&"); |
| | | } |
| | | // 对键和值进行URL编码 |
| | | String encodedKey = URLEncoder.encode(entry.getKey(), "UTF-8"); |
| | | String encodedValue = URLEncoder.encode(entry.getValue(), "UTF-8"); |
| | | encodedParams.append(encodedKey).append("=").append(encodedValue); |
| | | } |
| | | Boolean result = HttpUtils.sendPost(xhsmsPath, new Gson().toJson(req)); |
| | | if (result) isSuccess = "true"; |
| | | } else if (active.equals("ls")) { |
| | | // String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid()); |
| | | // //丽水的短信发送方式 |
| | | // Map<String, String> map = MsgLSEnum.getAddressByCode(serviceSubtask.getOrgid()); |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey("ls.msg.info"); |
| | | config.setOrgid(serviceSubtask.getOrgid()); |
| | | List<SysConfig> sysConfigs = configService.selectConfigList(config); |
| | | Map<String, String> msgInfo = new HashMap<>(); |
| | | if (CollectionUtils.isNotEmpty(sysConfigs)) { |
| | | String configValue = sysConfigs.get(0).getConfigValue(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | msgInfo = objectMapper.readValue(configValue, Map.class); |
| | | } |
| | | } |
| | | log.info("-----------map的值为:{}", msgInfo); |
| | | String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), msgInfo.get("tokenUrl")); |
| | | if (ObjectUtils.isNotEmpty(msgInfo) && StringUtils.isEmpty(msgInfo.get("address"))) { |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "短信发送失败,该机构没有配置短信地址, 时间:" + now, "5"); |
| | | return; |
| | | } |
| | | log.info("【sfHandlle】丽水短信发送,地址:{},参数:{},机构ID:{}", msgInfo.get("address"), sendMagParam, serviceSubtask.getOrgid()); |
| | | String dxCode = getDXCode(msgInfo.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), msgInfo.get("sendPersonId"), msgInfo.get("sendPersonName"), MsgLSEnum.getHeaderByCode(msgInfo), token); |
| | | log.info("【sfHandlle】丽水短信发送结果:{}", dxCode); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class); |
| | | String code = textParam.get("Code").toString(); |
| | | if (code.equals("0")) { |
| | | isSuccess = "true"; |
| | | } |
| | | } else if (active.equals("sltd") || active.equals("nhfy")) { |
| | | log.info("sltd进来了吗?{} ,---sendMagParam.getContent()的参数为:{}", active, sendMagParam.getContent()); |
| | | if (active.equals("sltd")) { |
| | | //省立同德的短信发送方式 |
| | | String data = MessageSend.sendMsg(sendMagParam.getContent(), "6", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | if (StringUtils.isNotEmpty(data)) { |
| | | // 解析 result=0&description=成功&faillist= 格式(result=0成功,1失败) |
| | | log.info("【sfHandlle】省立同德短信发送返回:{}", data); |
| | | String[] pairs = data.split("&"); |
| | | String resultVal = null; |
| | | for (String pair : pairs) { |
| | | String[] kv = pair.split("=", 2); |
| | | if ("result".equals(kv[0])) { |
| | | resultVal = kv.length > 1 ? kv[1] : null; |
| | | break; |
| | | } |
| | | } |
| | | if ("0".equals(resultVal)) { |
| | | isSuccess = "true"; |
| | | } |
| | | } |
| | | } else if (active.equals("nhfy")) { |
| | | Map<String, Object> smsResult = mtSubmitSmUtil.submitSm(sendMagParam.getPhone(), sendMagParam.getContent()); |
| | | if (smsResult != null && smsResult.get("result") != null && smsResult.get("result").toString().equals("0")) { |
| | | isSuccess = "true"; |
| | | } |
| | | } |
| | | } else if (active.equals("hzszlyy")) {//市一医院 |
| | | String content = sendMagParam.getContent().replace("【新华医院】", ""); |
| | | |
| | | SysDept sysDeptVo = new SysDept(); |
| | | List<SysDept> sysDepts = new ArrayList<>(); |
| | | if (ObjectUtils.isNotEmpty(serviceSubtask.getDeptcode())) { |
| | | sysDeptVo.setDeptType("1"); |
| | | sysDeptVo.setOrgid(serviceSubtask.getOrgid()); |
| | | sysDeptVo.setDeptCode(serviceSubtask.getDeptcode()); |
| | | sysDeptService.selectDeptList(sysDeptVo); |
| | | } else if (ObjectUtils.isNotEmpty(serviceSubtask.getLeavehospitaldistrictcode())) { |
| | | sysDeptVo.setDeptType("2"); |
| | | sysDeptVo.setOrgid(serviceSubtask.getOrgid()); |
| | | sysDeptVo.setDeptCode(serviceSubtask.getLeavehospitaldistrictcode()); |
| | | sysDeptService.selectDeptList(sysDeptVo); |
| | | } |
| | | SysDept sysDept = CollectionUtils.isNotEmpty(sysDepts) ? sysDepts.get(0) : new SysDept(); |
| | | String campusid = ObjectUtils.isNotEmpty(sysDept) ? sysDept.getCampusid() : "2"; |
| | | //湖滨单独发送方式 |
| | | if ("1".equals(campusid)) { |
| | | String result = smsUtils.sendSms1(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content); |
| | | //这里需要根据result返回的值去判断,是否成功,然后将值赋值给isSuccess |
| | | if (StringUtils.isNotEmpty(result) && result.contains("处理成功")) { |
| | | isSuccess = "true"; |
| | | } |
| | | } else { |
| | | String result = smsUtils.sendSms(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content); |
| | | //这里需要根据result返回的值去判断,是否成功,然后将值赋值给isSuccess |
| | | if (StringUtils.isNotEmpty(result) && result.contains("处理成功")) { |
| | | isSuccess = "true"; |
| | | } |
| | | } |
| | | } |
| | | SendResult smsSendResult = sendSmsByActive(serviceSubtask, sendMagParam); |
| | | String isSuccess = smsSendResult.asLegacyFlag(); |
| | | //任务发送记录 |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | |
| | | serviceOutPath.setUrl(url); |
| | | iServiceOutPathService.updateServiceOutPath(serviceOutPath); |
| | | |
| | | //获取微信公众号请求信息根据机构ID |
| | | List<String> wxqqxx = WxGZHEnum.getDescByCode(patArchive.getOrgid()); |
| | | //市一医院 不校验 |
| | | //微信公众号发送:市一与新华是两套完全不同的网关与判定标准, |
| | | //机构配置校验、HIS患者ID校验都已收口到 ruoyi-message 的发送方实现里 |
| | | SendResult wechatSendResult = sendWechatByActive(serviceSubtask, patArchive, url); |
| | | Boolean wxCodeSuccess = wechatSendResult.isOk(); |
| | | |
| | | if (CollectionUtils.isEmpty(wxqqxx) || wxqqxx.size() < 4) { |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "【公众号】该机构的公众号配置信息不全,无法通过公众号发送", "4"); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(patArchive.getPatidHis())) { |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "【公众号】公众号发送失败,his系统的患者id为空", "5"); |
| | | return; |
| | | } |
| | | String wxCode = ""; |
| | | //市一医院 |
| | | if (active.equals("hzszlyy")) { |
| | | //处理中文乱码问题 |
| | | wxCode = smsUtils.sendChat(url, patArchive.getTelcode(), serviceSubtask.getSfzh()); |
| | | } else { |
| | | wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), patArchive.getTelcode(), serviceSubtask.getSendname(), patArchive.getPatidHis(), wxqqxx); |
| | | } |
| | | |
| | | Map map = JSONObject.parseObject(wxCode, Map.class); |
| | | //任务发送记录 |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | |
| | | serviceSubtaskRecord.setPreachform("4"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecord.setResult("success"); |
| | | Boolean wxCodeSuccess = false; |
| | | if (active.equals("hzszlyy")) { |
| | | if (!map.isEmpty() && map.get("success") != null) { |
| | | Integer wxCodeSuccessShiyi = (Integer) map.get("success"); |
| | | if (ObjectUtils.isNotEmpty(wxCodeSuccessShiyi) && wxCodeSuccessShiyi == 1) { |
| | | wxCodeSuccess = true; |
| | | } else { |
| | | wxCodeSuccess = false; |
| | | } |
| | | } |
| | | } else { |
| | | if (!map.isEmpty() && map.get("succ") != null) { |
| | | wxCodeSuccess = (boolean) map.get("succ"); |
| | | } |
| | | } |
| | | if (!map.isEmpty() && !wxCodeSuccess) serviceSubtaskRecord.setResult("error"); |
| | | if (!wxCodeSuccess) serviceSubtaskRecord.setResult("error"); |
| | | serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); |
| | | |
| | | //发送完成后,修改状态 |
| | |
| | | serviceSubtask.setResult("success"); |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "【公众号】公众号发送成功", "2"); |
| | | } else { |
| | | log.error("【sfHandlle】公众号发送失败,患者信息:{},错误信息:{}", serviceSubtask, map.get("msg")); |
| | | log.error("【sfHandlle】公众号发送失败,患者信息:{},错误信息:{}", serviceSubtask, wechatSendResult.getMessage()); |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "【公众号】公众号发送失败", "5"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "人工发送成功", "2"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按 {@code active}(站点)路由到对应的短信发送方。 |
| | | * <p> |
| | | * 各站点差异见 {@code ruoyi-message} 模块各实现类;本方法只做「入参组装 + 路由 + 日志」。 |
| | | * <p> |
| | | * ⚠️ 新华({@code xh})站点仍走「旧实现(发送空报文)」,与原 {@code RyTask} 行为一字不差, |
| | | * 确认网关报文格式后应改为 {@code XinHuaSmsSender#sendForm}。详见该类的 TODO 说明。 |
| | | */ |
| | | private SendResult sendSmsByActive(ServiceSubtask serviceSubtask, SendMagParam sendMagParam) { |
| | | SmsSendRequest request = SmsSendRequest.of(sendMagParam.getPhone(), sendMagParam.getContent(), serviceSubtask.getOrgid()); |
| | | //市一区分湖滨/吴山两套短信签名 |
| | | if ("hzszlyy".equals(active)) { |
| | | request.setCampus(resolveShiyiCampus(serviceSubtask)); |
| | | } |
| | | if ("xh".equals(active)) { |
| | | XinHuaSmsSender xinHuaSmsSender = (XinHuaSmsSender) smsSenderFactory.get(active); |
| | | return xinHuaSmsSender.sendJsonLegacy(request); |
| | | } |
| | | return smsSenderFactory.send(active, request); |
| | | } |
| | | |
| | | /** |
| | | * 按 {@code active}(站点)路由到对应的微信公众号发送方。 |
| | | * <p> |
| | | * ⚠️ 新华公众号必须传患者信息(姓名 + HIS 患者ID),与原 |
| | | * {@code getWXCode(...)} 的入参保持一一对应。 |
| | | */ |
| | | private SendResult sendWechatByActive(ServiceSubtask serviceSubtask, PatArchive patArchive, String url) { |
| | | WechatSendRequest request = new WechatSendRequest(); |
| | | request.setOrgid(patArchive.getOrgid()); |
| | | request.setIdCard(serviceSubtask.getSfzh()); |
| | | request.setUrl(url); |
| | | request.setTitle(serviceSubtask.getTaskName()); |
| | | request.setContent(serviceSubtask.getTaskDesc()); |
| | | request.setPhone(patArchive.getTelcode()); |
| | | request.setPatientName(serviceSubtask.getSendname()); |
| | | request.setPatidHis(patArchive.getPatidHis()); |
| | | return wechatSenderFactory.send(active, request); |
| | | } |
| | | |
| | | /** |
| | | * 查询患者所在院区(1=湖滨,其他=吴山)。 |
| | | * <p> |
| | | * TODO 待确认:原实现并未把 {@code sysDeptService.selectDeptList(...)} 的返回值赋给 |
| | | * {@code sysDepts},因此 {@code sysDepts} 恒为空列表、{@code campusid} 恒为 {@code "2"}, |
| | | * 湖滨院区实际上永远走不到 {@code sendSms1}。本次重构<b>保持该行为不变</b>, |
| | | * 请在业务确认后再决定是否修成 {@code sysDepts = sysDeptService.selectDeptList(...)}。 |
| | | */ |
| | | private String resolveShiyiCampus(ServiceSubtask serviceSubtask) { |
| | | SysDept sysDeptVo = new SysDept(); |
| | | List<SysDept> sysDepts = new ArrayList<>(); |
| | | if (ObjectUtils.isNotEmpty(serviceSubtask.getDeptcode())) { |
| | | sysDeptVo.setDeptType("1"); |
| | | sysDeptVo.setOrgid(serviceSubtask.getOrgid()); |
| | | sysDeptVo.setDeptCode(serviceSubtask.getDeptcode()); |
| | | sysDeptService.selectDeptList(sysDeptVo); |
| | | } else if (ObjectUtils.isNotEmpty(serviceSubtask.getLeavehospitaldistrictcode())) { |
| | | sysDeptVo.setDeptType("2"); |
| | | sysDeptVo.setOrgid(serviceSubtask.getOrgid()); |
| | | sysDeptVo.setDeptCode(serviceSubtask.getLeavehospitaldistrictcode()); |
| | | sysDeptService.selectDeptList(sysDeptVo); |
| | | } |
| | | SysDept sysDept = CollectionUtils.isNotEmpty(sysDepts) ? sysDepts.get(0) : new SysDept(); |
| | | return ObjectUtils.isNotEmpty(sysDept) ? sysDept.getCampusid() : "2"; |
| | | } |
| | | |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | private String getDXCode(String address, String ShouJiHM, String FaSongNR, String FaSongRID, String FaSongRXM, Map<String, Object> headerMap, String token) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | |
| | | Map<String, Object> YeWuXX = new LinkedHashMap<>(); |
| | | Map<String, Object> DuanXinXX = new LinkedHashMap<>(); |
| | | DuanXinXX.put("ShouJiHM", ShouJiHM); |
| | | DuanXinXX.put("FaSongNR", FaSongNR); |
| | | DuanXinXX.put("FaSongRID", FaSongRID); |
| | | DuanXinXX.put("FaSongRXM", FaSongRXM); |
| | | YeWuXX.put("DuanXinXX", DuanXinXX); |
| | | |
| | | map.put("XiaoXiTou", headerMap); |
| | | map.put("YeWuXX", YeWuXX); |
| | | |
| | | String body = new Gson().toJson(map); |
| | | |
| | | // String result = HttpUtils.sendPost(address, body); |
| | | String result = null; |
| | | try { |
| | | result = OkHttpExample.sendPostRequest(address, body, token); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | log.info("【getDXCode】短信发送结果:{}", result); |
| | | |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | String code = (String) jsonObject.toString(); |
| | | return code; |
| | | } |
| | | |
| | | |
| | | private String getWXCode(String idcard, String url, String taskName, String taskDesc, String phone, String setPatientname, String setPatientid, List<String> wxqqxx) { |
| | | XinHuaWXReq xinHuaWXReq = new XinHuaWXReq(); |
| | | xinHuaWXReq.setIdcard(idcard); |
| | | xinHuaWXReq.setUrl(url); |
| | | xinHuaWXReq.setPatientid(setPatientid); |
| | | xinHuaWXReq.setPatientname(setPatientname); |
| | | xinHuaWXReq.setMobile(phone); |
| | | xinHuaWXReq.setMedcardno(null); |
| | | xinHuaWXReq.setTitlename(taskName); |
| | | xinHuaWXReq.setContent(taskDesc); |
| | | xinHuaWXReq.setAppid(wxqqxx.get(1)); |
| | | log.info("【getWXCode】微信公众号请求参数:{}", xinHuaWXReq); |
| | | String body = new Gson().toJson(xinHuaWXReq); |
| | | String encode = encode(wxqqxx.get(2).concat(body)); |
| | | Map<String, String> headerMap = new HashMap<>(); |
| | | headerMap.put("sign", encode); |
| | | String result = HttpUtils.sendPostByHeader(wxqqxx.get(3), body, headerMap); |
| | | log.info("【getWXCode】微信公众号返回参数:{}", result); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | String code = (String) jsonObject.toString(); |
| | | return code; |
| | | } |
| | | |
| | | |
| | | public String encode(String arg) { |
| | | if (arg == null) { |
| | | arg = ""; |
| | | } |
| | | MessageDigest md5 = null; |
| | | try { |
| | | md5 = MessageDigest.getInstance("MD5"); |
| | | md5.update(arg.getBytes("UTF-8")); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return toHex(md5.digest()); |
| | | } |
| | | // --------------------------------------------------------------------- |
| | | // 说明:原 getDXCode / getWXCode / encode 三个私有方法已随发送方一起收口到 |
| | | // ruoyi-message 模块(LishuiSmsSender / XinHuaMpApi),此处已删除,避免重复实现。 |
| | | // --------------------------------------------------------------------- |
| | | |
| | | public void collectHIS() { |
| | | try { |
| | |
| | | PatMedInhosp patMedInhospVo = new PatMedInhosp(); |
| | | patMedInhospVo.setOrgid(serviceSubtask.getOrgid()); |
| | | patMedInhospVo.setInhospid(serviceSubtask.getInhospid()); |
| | | patMedInhospVo.setCry(1); |
| | | List<PatMedInhosp> patMedInhospList = iPatMedInhospService.selectPatMedInhospList(patMedInhospVo); |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | if (!patMedInhospList.isEmpty()) { |