| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.dx.MessageSend; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.smartor.common.FtpService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | ServiceTaskVO serviceTaskVO = DtoConversionUtils.sourceToTarget(serviceTask, ServiceTaskVO.class); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | List<Map<String, Object>> mapList = objectMapper.readValue(serviceTask.getPreachform(), List.class); |
| | | List<Map<String, Object>> mapList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class); |
| | | serviceTaskVO.setPreachformList(mapList); |
| | | |
| | | String result = mapList.stream().map(mapList1 -> mapList1.get("preachform")).map(String::valueOf).collect(Collectors.joining(",")); |
| | | serviceTaskVO.setPreachform(result); |
| | | // |
| | | // String result = mapList.stream().map(mapList1 -> mapList1.get("preachform")).map(String::valueOf).collect(Collectors.joining(",")); |
| | | // serviceTaskVO.setPreachform(result); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | return serviceTaskVO; |
| | | } |
| | |
| | | }).collect(Collectors.toList()); |
| | | serviceTaskVO.setPreachformList(resultList); |
| | | |
| | | String result = resultList.stream().map(mapList1 -> mapList1.get("preachform")).map(String::valueOf).collect(Collectors.joining(",")); |
| | | serviceTaskVO.setPreachform(result); |
| | | // String result = resultList.stream().map(mapList1 -> mapList1.get("preachform")).map(String::valueOf).collect(Collectors.joining(",")); |
| | | // serviceTaskVO.setPreachform(result); |
| | | } |
| | | |
| | | serviceTaskVO.setPatTaskRelevances(patTaskRelevances); |
| | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | String preachformList = mapper.writeValueAsString(serviceTaskVO.getPreachformList()); |
| | | serviceTask.setPreachform(preachformList); |
| | | serviceTask.setPreachformDesc(preachformList); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform(); |
| | | serviceSubtaskPreachform.setSort(ObjectUtils.isEmpty(map.get("sort")) ? 0 : Long.valueOf(map.get("sort").toString())); |
| | | serviceSubtaskPreachform.setPreachform(ObjectUtils.isEmpty(map.get("preachform")) ? "" : map.get("preachform").toString()); |
| | | serviceSubtaskPreachform.setCompensateTime(ObjectUtils.isEmpty(map.get("compensateTime")) ? "" : map.get("preachcompensateTimeform").toString()); |
| | | serviceSubtaskPreachform.setCompensateTime(ObjectUtils.isEmpty(map.get("compensateTime")) ? "" : map.get("compensateTime").toString()); |
| | | serviceSubtaskPreachform.setTaskid(serviceTask.getTaskid()); |
| | | serviceSubtaskPreachform.setSubid(serviceSubtask.getId()); |
| | | //这个sendstate需要在数据库设置一个默认值为“1” |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<PatArchiveSrmVO> sendMsgTemplate(List<PatArchiveSrmVO> patArchiveSrmVOS) { |
| | | //用来记录发送失败的 |
| | | List<PatArchiveSrmVO> sendError = new ArrayList<>(); |
| | | |
| | | for (PatArchiveSrmVO patArchiveSrmVO : patArchiveSrmVOS) { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY年MM月dd日HH:mm"); |
| | | String timestamp = simpleDateFormat.format(patArchiveSrmVO.getVisitTime()); |
| | | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | if (patArchiveSrmVO.getSrmTemplate().equals("入院准备中心-无检查")) { |
| | | stringBuilder.append(patArchiveSrmVO.getName() + ",您好!主管医生已为您安排住院,请于当天"); |
| | | } else if (patArchiveSrmVO.getSrmTemplate().equals("入院准备中心-空腹检查")) { |
| | | stringBuilder.append(patArchiveSrmVO.getName() + ",您好!主管医生已为您安排住院,请当天空腹并于"); |
| | | } else if (patArchiveSrmVO.getSrmTemplate().equals("日间病房—择期病人检查")) { |
| | | stringBuilder.append(patArchiveSrmVO.getName() + ",您好!主管医生已为您安排住院前检查,请当天空腹并于"); |
| | | } |
| | | |
| | | stringBuilder.append(timestamp + ",之前携带医保卡或电子医保卡身份证凭此条短信到1号楼3楼南入院准备中心入院登记窗口,办理正式住院手续,完成各项检查后再到相应病区护士站报到。"); |
| | | stringBuilder.append("入院准备中心电话:89975977。入院办理须知:https://mp.weixin.qq.com/s/OCkotuRyQ8Ld2owFF0YErw"); |
| | | |
| | | JSONObject data = MessageSend.sendMsg(stringBuilder.toString(), "2", patArchiveSrmVO.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | String code = data.get("code").toString(); |
| | | if (StringUtils.isNotEmpty(code) && !code.equals("00000")) { |
| | | sendError.add(patArchiveSrmVO); |
| | | } |
| | | } |
| | | |
| | | return sendError; |
| | | } |
| | | |
| | | /** |
| | | * 获取随访统计比例 |
| | | * |
| | |
| | | } |
| | | } |
| | | //随访情况 |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==1) { |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 1) { |
| | | serviceSubtaskStatistic.setTaskSituation1(serviceSubtaskStatistic.getTaskSituation1() + 1); |
| | | } |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==2) { |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 2) { |
| | | serviceSubtaskStatistic.setTaskSituation2(serviceSubtaskStatistic.getTaskSituation2() + 1); |
| | | } |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==3) { |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 3) { |
| | | serviceSubtaskStatistic.setTaskSituation3(serviceSubtaskStatistic.getTaskSituation3() + 1); |
| | | } |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==4) { |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 4) { |
| | | serviceSubtaskStatistic.setTaskSituation4(serviceSubtaskStatistic.getTaskSituation4() + 1); |
| | | } |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==5) { |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 5) { |
| | | serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1); |
| | | } |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==6) { |
| | | if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) { |
| | | serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1); |
| | | } |
| | | } |