| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserDeptService; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.VO.HeLibraryCountVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskVO; |
| | | import com.smartor.domain.VO.TransferDeptVO; |
| | | import com.smartor.domain.DTO.QuestionResultDTO; |
| | | import com.smartor.domain.VO.*; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.service.IServiceSubtaskRecordService; |
| | | import com.smartor.service.IServiceSubtaskService; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 带Redis缓存的统计查询,供patItem和patItemCount共用,条件不变时直接命中缓存 |
| | | */ |
| | | private Map<String, Object> getPatItemCountWithCache(ServiceSubtaskEntity serviceSubtaskEntity) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | LoginUser loginUser = getLoginUser(); |
| | | Long userId = null; |
| | | if (ObjectUtils.isNotEmpty(loginUser) && ObjectUtils.isNotEmpty(loginUser.getUser())) { |
| | | userId = loginUser.getUser().getUserId(); |
| | | } |
| | | if (serviceSubtaskEntity.getSendstateView() != null) { |
| | | // 1:待随访(1 被领取、2 待发送、3 已发送、5 发送失败、7、超时);2:已完成( 6 已完成)、3:无需随访(4 不执行) |
| | | if (serviceSubtaskEntity.getSendstateView() == 1) |
| | | serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 7L))); |
| | | if (serviceSubtaskEntity.getSendstateView() == 2) |
| | | serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(6L))); |
| | | if (serviceSubtaskEntity.getSendstateView() == 3) |
| | | serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(4L))); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(userId)) { |
| | | Map<String, Object> redisMap = redisCache.getCacheObject(userId + "patItemCount"); |
| | | Boolean redisFlag = false; |
| | | if (MapUtils.isNotEmpty(redisMap)) { |
| | | ServiceSubtaskEntity oldCondition = (ServiceSubtaskEntity) redisMap.get("searchCondition"); |
| | | if (ObjectUtils.isNotEmpty(oldCondition) && isSameCondition(oldCondition, serviceSubtaskEntity)) { |
| | | redisFlag = true; |
| | | map = redisMap; |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 60, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | if (!redisFlag) { |
| | | map = serviceSubtaskService.patItemCount(serviceSubtaskEntity); |
| | | map.put("searchCondition", serviceSubtaskEntity); |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | } |
| | | } else { |
| | | map = serviceSubtaskService.patItemCount(serviceSubtaskEntity); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个ServiceSubtaskVO的查询条件是否一致 |
| | | * 使用反射比较所有字段,排除分页参数和无关字段 |
| | | */ |
| | | private boolean isSameCondition(ServiceSubtaskEntity oldCondition, ServiceSubtaskEntity newCondition) { |
| | | // 使用ReflectUtils的通用方法比较,排除分页参数等无关字段 |
| | | return ReflectUtils.equalsAllFields(oldCondition, newCondition, |
| | | // 排除的字段:分页参数、序列化ID、时间戳等 |
| | | "pageNum", "pageSize", "serialVersionUID", "createBy", "createTime", "updateBy", "updateTime", "searchValue", "params"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出单一任务列表 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | |
| | | serviceSubtaskExport.setEndDay(endDay); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(serviceSubtaskVO.getServiceType()) && serviceSubtaskVO.getServiceType().equals("2")) { |
| | | //获取serviceSubtaskList中的所有taskid |
| | | List<Long> taskIds = serviceSubtaskList.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOption(taskIds, serviceSubtaskVO.getStartOutHospTime(), serviceSubtaskVO.getEndOutHospTime()); |
| | | } else if (StringUtils.isNotEmpty(serviceSubtaskVO.getServiceType()) && serviceSubtaskVO.getServiceType().equals("6")) { |
| | | //满意度统计 (通过 subtask 的 id 去统计) |
| | | List<Long> subtaskIds = serviceSubtaskList.stream().map(ServiceSubtaskRes::getId).collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOptionBySubtaskIds(subtaskIds, serviceSubtaskVO.getStartOutHospTime(), serviceSubtaskVO.getEndOutHospTime()); |
| | | } |
| | | |
| | | QuestionResultVO questionResultVO = new QuestionResultVO(); |
| | | questionResultVO.setServiceType(serviceSubtaskVO.getServiceType()); |
| | | questionResultVO.setEndOutHospTime(serviceSubtaskVO.getEndOutHospTime()); |
| | | questionResultVO.setStartOutHospTime(serviceSubtaskVO.getStartOutHospTime()); |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.getDetailRatio(questionResultVO, serviceSubtaskList); |
| | | } |
| | | |
| | | |
| | |
| | | if (ObjectUtils.isNotEmpty(user)) serviceSubtask.setOrgid(user.getOrgid()); |
| | | if (ObjectUtils.isNotEmpty(user)) serviceSubtask.setCampusid(user.getCampusid()); |
| | | serviceSubtask.setCampusid(user.getCampusid()); |
| | | serviceSubtask.setCreateBy(user.getNickName()); |
| | | serviceSubtask.setUpdateBy(user.getNickName()); |
| | | return success(serviceSubtaskService.insertServiceSubtask(serviceSubtask)); |
| | | } |
| | | |
| | |
| | | return AjaxResult.success("【collectHISDaysBefore】同步任务已启动,天数为" + day + "天,请稍后查看结果"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/syncMedOperForShiyi") |
| | | public AjaxResult syncMedOperForShiyi(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) { |
| | | // 立即返回,后台异步执行 |
| | |
| | | }); |
| | | return AjaxResult.success("同步任务已启动,请稍后查看结果"); |
| | | } |
| | | |
| | | @PostMapping("/dealSubtaskDeadline") |
| | | public AjaxResult dealSubtaskDeadline(@RequestParam("orgid") String orgid, @RequestParam("day") Integer day) { |
| | | // 立即返回,后台异步执行 |
| | | ryTask.dealSubtaskDeadline(orgid, day); |
| | | return AjaxResult.success("【dealSubtaskDeadline】同步任务已启动,天数为" + day + "天,请稍后查看结果"); |
| | | } |
| | | /** |
| | | * 带Redis缓存的统计查询,供patItem和patItemCount共用,条件不变时直接命中缓存 |
| | | */ |
| | | private Map<String, Object> getPatItemCountWithCache(ServiceSubtaskEntity serviceSubtaskEntity) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | LoginUser loginUser = getLoginUser(); |
| | | Long userId = null; |
| | | if (ObjectUtils.isNotEmpty(loginUser) && ObjectUtils.isNotEmpty(loginUser.getUser())) { |
| | | userId = loginUser.getUser().getUserId(); |
| | | } |
| | | if (serviceSubtaskEntity.getSendstateView() != null) { |
| | | // 1:待随访(1 被领取、2 待发送、3 已发送、5 发送失败、7、超时);2:已完成( 6 已完成)、3:无需随访(4 不执行) |
| | | if (serviceSubtaskEntity.getSendstateView() == 1) |
| | | serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 7L))); |
| | | if (serviceSubtaskEntity.getSendstateView() == 2) |
| | | serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(6L))); |
| | | if (serviceSubtaskEntity.getSendstateView() == 3) |
| | | serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(4L))); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(userId)) { |
| | | Map<String, Object> redisMap = redisCache.getCacheObject(userId + "patItemCount"); |
| | | Boolean redisFlag = false; |
| | | if (MapUtils.isNotEmpty(redisMap)) { |
| | | ServiceSubtaskEntity oldCondition = (ServiceSubtaskEntity) redisMap.get("searchCondition"); |
| | | if (ObjectUtils.isNotEmpty(oldCondition) && isSameCondition(oldCondition, serviceSubtaskEntity)) { |
| | | redisFlag = true; |
| | | map = redisMap; |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 60, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | if (!redisFlag) { |
| | | map = serviceSubtaskService.patItemCount(serviceSubtaskEntity); |
| | | map.put("searchCondition", serviceSubtaskEntity); |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | } |
| | | } else { |
| | | map = serviceSubtaskService.patItemCount(serviceSubtaskEntity); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 比较两个ServiceSubtaskVO的查询条件是否一致 |
| | | * 使用反射比较所有字段,排除分页参数和无关字段 |
| | | */ |
| | | private boolean isSameCondition(ServiceSubtaskEntity oldCondition, ServiceSubtaskEntity newCondition) { |
| | | // 使用ReflectUtils的通用方法比较,排除分页参数等无关字段 |
| | | return ReflectUtils.equalsAllFields(oldCondition, newCondition, |
| | | // 排除的字段:分页参数、序列化ID、时间戳等 |
| | | "pageNum", "pageSize", "serialVersionUID", "createBy", "createTime", "updateBy", "updateTime", "searchValue", "params"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |