| | |
| | | import com.smartor.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | |
| | | @Autowired |
| | | private IServiceSubtaskService iServiceSubtaskService; |
| | | |
| | | @Autowired |
| | | private IServicePatientTempService iServicePatientTempService; |
| | | |
| | | @Autowired |
| | | private PlatformTransactionManager transactionManager; |
| | |
| | | |
| | | @Autowired |
| | | ISvyTaskTemplateService svyTaskTemplateService; |
| | | |
| | | @Autowired |
| | | IIvrTaskTemplateService iIvrTaskTemplateService; |
| | | |
| | | @Value("${hosp_info_url}") |
| | | private String hospInfoUrl; |
| | |
| | | //将患者信息、出院、门诊数据全部采集 |
| | | // 获取当前日期和时间 |
| | | LocalDateTime endTime = LocalDateTime.now(); |
| | | endTime = endTime.with(LocalTime.MIN); |
| | | // String dateStr = "2024/11/30 00:00:00"; |
| | | // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); |
| | | // LocalDateTime endTime = LocalDateTime.parse(dateStr, formatter); |
| | | // 获取前一天的日期和时间 |
| | | LocalDateTime startTime = endTime.minusDays(1); |
| | | startTime = startTime.with(LocalTime.MIN); |
| | | getInHospInfo("0", startTime, endTime); |
| | | getInHospInfo("1", startTime, endTime); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 长期任务执行 |
| | | * 处理患者信息,进入子任务表(微信小程序) |
| | | */ |
| | | public void dealOutHospInfoXHC() { |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | //获取未处理的数据 |
| | | List<ServicePatientTemp> servicePatientTemps = iServicePatientTempService.selectServicePatientTempList(new ServicePatientTemp()); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 长期任务执行(电话) |
| | | */ |
| | | public void longTaskSend() { |
| | | //获取任务信息 |
| | |
| | | //说明是立即发送(先把消息放到cache-0中, displayNo不知道怎么配置) |
| | | if (dateToday) { |
| | | try { |
| | | ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO(); |
| | | serviceSubtask1.setTaskid(ivrTask.getTaskid()); |
| | | List<ServiceSubtask> selectServiceSubtaskList1 = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask1); |
| | | for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) { |
| | | if (StringUtils.isEmpty(value)) { |
| | | value = "," + serviceSubtask2.getId().toString() + ","; |
| | | } else { |
| | | if (!value.contains("," + serviceSubtask2.getId().toString())) |
| | | value = value + "," + serviceSubtask2.getId().toString() + ","; |
| | | } |
| | | // ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO(); |
| | | // serviceSubtask1.setTaskid(ivrTask.getTaskid()); |
| | | // List<ServiceSubtask> selectServiceSubtaskList1 = iServiceSubtaskService.selectServiceSubtaskList(serviceSubtask1); |
| | | // for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) { |
| | | if (StringUtils.isEmpty(value)) { |
| | | value = "," + serviceSubtask.getId().toString() + ","; |
| | | } else { |
| | | if (!value.contains("," + serviceSubtask.getId().toString())) |
| | | value = value + "," + serviceSubtask.getId().toString() + ","; |
| | | } |
| | | // } |
| | | } catch (Exception e) { |
| | | String guid = UUID.randomUUID().toString(); |
| | | log.error("长期任务,电话发送失败原因:{},{}", e.getMessage(), guid); |
| | |
| | | //在子任务表里记录一下 |
| | | String uuid = UUID.randomUUID().toString(); |
| | | serviceSubtask.setResult("success"); |
| | | serviceSubtask.setRemark("电话发送成功"); |
| | | serviceSubtask.setRemark("长期任务,电话进入队列成功"); |
| | | serviceSubtask.setGuid(uuid); |
| | | serviceSubtask.setSendstate(3L); |
| | | serviceSubtask.setFinishtime(new Date()); |
| | |
| | | serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); |
| | | serviceSubtaskRecord.setPreachform("3"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecord.setRemark("电话发送成功"); |
| | | serviceSubtaskRecord.setRemark("长期任务,电话进入队列成功"); |
| | | serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); |
| | | |
| | | } |
| | |
| | | //多媒体 |
| | | } else if (descByCode.equals("纸质")) { |
| | | //纸质 |
| | | } else if (descByCode.equals("微信小程序")) { |
| | | //微信小程序 |
| | | for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | log.error("微信小程序期任务发送---------进来了吗?{}", serviceSubtask); |
| | | |
| | | |
| | | } |
| | | } else if (descByCode.equals("短信")) { |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); |
| | |
| | | serviceSubtask.setSendstate(3L); |
| | | if (StringUtils.isNotEmpty(isSuccess) && !isSuccess.equals("true")) { |
| | | serviceSubtask.setResult("success"); |
| | | serviceSubtask.setRemark("短信发送成功"); |
| | | } else { |
| | | serviceSubtask.setResult("error"); |
| | | serviceSubtask.setSendstate(5L); |
| | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S"); |
| | | Map<String, String> req = new HashMap<>(); |
| | | if (cry.equals("1")) { |
| | | req.put("startTime", startTime.format(formatter)); |
| | | req.put("endTime", endTime.format(formatter)); |
| | | req.put("cashStartDate", startTime.format(formatter)); |
| | | req.put("cashEndDate", endTime.format(formatter)); |
| | | req.put("currStatus", "4"); |
| | | } else if (cry.equals("0")) { |
| | | req.put("admissStartDate", startTime.format(formatter)); |
| | |
| | | patArchive.setNotrequiredreason(thiedInhospInfo.getOutWayName()); |
| | | } |
| | | if (cry.equals("1") && StringUtils.isEmpty(thiedInhospInfo.getOutWayId())) { |
| | | //如果为4就是死亡 |
| | | //出院方式为空 |
| | | patArchive.setNotrequiredFlag("1"); |
| | | patArchive.setNotrequiredreason("出院方式为空"); |
| | | } |
| | |
| | | patArchive.setName(thiedInhospInfo.getPatiRecordName()); |
| | | patArchiveService.insertPatArchive(patArchive); |
| | | } else { |
| | | patArchive = patArchives.get(0); |
| | | patArchive.setId(patArchives.get(0).getId()); |
| | | patArchiveService.update(patArchive); |
| | | // patArchive = patArchives.get(0); |
| | | } |
| | | |
| | | log.error("入参的patArchive:{}", patArchive); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | if (StringUtils.isNotEmpty(thiedInhospInfo.getOutDate())) |
| | | patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getOutDate())); |
| | | if (StringUtils.isNotEmpty(thiedInhospInfo.getCashDate())) |
| | | patMedInhosp.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getCashDate())); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | log.error("是否需要更新:{}", patMedInhosps.size()); |
| | | if (CollectionUtils.isNotEmpty(patMedInhosps)) { |
| | | patMedInhosp.setInhospid(patMedInhosps.get(0).getInhospid()); |
| | | log.error("------患者出入院修改信息:{}", patMedInhosp); |
| | | patMedInhospService.updatePatMedInhosp(patMedInhosp); |
| | | } else { |
| | | log.error("----患者出入院新增信息:{}", patMedInhosp); |
| | | patMedInhospService.insertPatMedInhosp(patMedInhosp); |
| | | } |
| | | |
| | |
| | | // String code = (String) jsonObject.get("code"); |
| | | return jsonObject.toString(); |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // LocalDateTime originalDateTime = LocalDateTime.now(); |
| | | // LocalDateTime startOfDay = originalDateTime.with(LocalTime.MIN); |
| | | // System.out.println("Original DateTime: " + originalDateTime); |
| | | // System.out.println("Start of Day: " + startOfDay); |
| | | // } |
| | | } |