| | |
| | | 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.common.utils.sms.SmsUtils; |
| | | import com.ruoyi.quartz.service.ICollectHISService; |
| | | import com.ruoyi.quartz.util.CreateDataTable; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 按机构查询配置值(同一 key 在不同机构下可配置不同值) |
| | | * |
| | | * @param configKey 配置key |
| | | * @param orgid 机构ID |
| | | * @return 配置值,未配置返回 null |
| | | */ |
| | | private String getConfigValue(String configKey, String orgid) { |
| | | SysConfig query = new SysConfig(); |
| | | query.setConfigKey(configKey); |
| | | query.setOrgid(orgid); |
| | | List<SysConfig> sysConfigs = configService.selectConfigList(query); |
| | | if (CollectionUtils.isNotEmpty(sysConfigs)) { |
| | | return sysConfigs.get(0).getConfigValue(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 随访-补偿处理 |
| | | * |
| | | * @param serviceSubtask |
| | |
| | | // 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(); |
| | | if ("47226079133110211G1001".equals(serviceSubtask.getOrgid())) { |
| | | // 妇幼中国移动云MAS,不依赖 ls.msg.info 与 token |
| | | SmsUtils.YunMasConfig yunMasConfig = SmsUtils.YunMasConfig.of(getConfigValue("ls.msg.yunmas", serviceSubtask.getOrgid())); |
| | | SmsUtils.SmsResult smsResult = SmsUtils.sendYunMasSms(yunMasConfig, sendMagParam.getPhone(), sendMagParam.getContent()); |
| | | log.info("【sfHandlle】云MAS短信发送结果:ok={},rspcod={},msgGroup={},message={}", |
| | | smsResult.isOk(), smsResult.getRspcod(), smsResult.getMsgGroup(), smsResult.getMessage()); |
| | | if (smsResult.isOk()) { |
| | | isSuccess = "true"; |
| | | } else { |
| | | log.error("【sfHandlle】云MAS短信发送失败,subid:{},手机号:{},原因:{}", |
| | | serviceSubtask.getId(), sendMagParam.getPhone(), smsResult.getMessage()); |
| | | } |
| | | } else { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey("ls.msg.info"); |
| | | config.setOrgid(serviceSubtask.getOrgid()); |
| | | List<SysConfig> sysConfigs = configService.selectConfigList(config); |
| | | Map<String, String> msgInfo = new HashMap<>(); |
| | | if (CollectionUtils.isNotEmpty(sysConfigs)) { |
| | | String configValue = sysConfigs.get(0).getConfigValue(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | msgInfo = objectMapper.readValue(configValue, Map.class); |
| | | } |
| | | } |
| | | log.info("-----------map的值为:{}", msgInfo); |
| | | if (ObjectUtils.isEmpty(msgInfo) || StringUtils.isEmpty(msgInfo.get("address"))) { |
| | | setSuccessPreachForm(serviceSubtask, sendPreachform, "短信发送失败,该机构没有配置短信地址, 时间:" + now, "5"); |
| | | return; |
| | | } |
| | | String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), msgInfo.get("tokenUrl")); |
| | | 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(); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | msgInfo = objectMapper.readValue(configValue, Map.class); |
| | | Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class); |
| | | String code = textParam.get("Code").toString(); |
| | | if (code.equals("0")) { |
| | | isSuccess = "true"; |
| | | } |
| | | } |
| | | 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 campusid = ObjectUtils.isNotEmpty(sysDept) ? sysDept.getCampusid() : "2"; |
| | | //湖滨单独发送方式 |
| | | if ("1".equals(campusid)) { |
| | | String result = smsUtils.sendSms1(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content); |
| | | 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); |
| | | String result = SmsUtils.sendSms(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content); |
| | | //这里需要根据result返回的值去判断,是否成功,然后将值赋值给isSuccess |
| | | if (StringUtils.isNotEmpty(result) && result.contains("处理成功")) { |
| | | isSuccess = "true"; |
| | |
| | | //市一医院 |
| | | if (active.equals("hzszlyy")) { |
| | | //处理中文乱码问题 |
| | | wxCode = smsUtils.sendChat(url, patArchive.getTelcode(), serviceSubtask.getSfzh()); |
| | | 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); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | String config = configService.selectConfigByKey("visit.early.day"); |
| | | for (ServiceTask serviceTask : serviceTasks) { |
| | | deadlineDay = -deadlineDay; |
| | | Date deadline = DateUtils.addDays(new Date(), deadlineDay); |
| | |
| | | } |
| | | ServiceTask nextServiceTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceTask.getNexttaskid()); |
| | | PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtask.getPatid()); |
| | | String config = configService.selectConfigByKey("visit.early.day"); |
| | | Integer type = 1; |
| | | |
| | | //新增再次随访任务 |