| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.github.pagehelper.ISelect; |
| | | import com.ruoyi.common.annotation.AddOrgId; |
| | | import com.ruoyi.common.annotation.Log; |
| | |
| | | import com.ruoyi.common.enums.PreachFormEnum; |
| | | import com.ruoyi.common.enums.SendStateEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.reflect.ReflectUtils; |
| | | import com.ruoyi.quartz.service.ICollectHISService; |
| | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.utils.SecurityUtils.getLoginUser; |
| | | |
| | | /** |
| | | * 单一任务(随访)Controller |
| | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | | |
| | | @Value("${localIP}") |
| | | private String localIP; |
| | | |
| | | @Value("${req_path}") |
| | | private String req_path; |
| | | |
| | | @Value("${isAdmin}") |
| | | private List<Long> isAdmin; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | |
| | | @ApiOperation("查询患者随访信息") |
| | | @PostMapping("/patItem") |
| | | public Map<String, Object> patItem(@RequestBody ServiceSubtaskVO serviceSubtaskVO) { |
| | | |
| | | serviceSubtaskVO.setPageNum(PageUtils.getOffset(serviceSubtaskVO.getPageNum(), serviceSubtaskVO.getPageSize())); |
| | | List<ServiceSubtaskRes> serviceSubtaskList = null; |
| | | LoginUser loginUser = getLoginUser(); |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | /** |
| | | * 导出单一任务(随访宣教)列表 |
| | | * 导出单一任务列表 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | | @Log(title = "单一任务(随访宣教)", businessType = BusinessType.EXPORT) |
| | | @Log(title = "单一任务", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/patItemExport") |
| | | public void patItemExport(HttpServletResponse response, ServiceSubtaskEntity serviceSubtaskVO) { |
| | | LoginUser loginUser = getLoginUser(); |
| | |
| | | serviceSubtaskList = serviceSubtaskService.patItem(serviceSubtaskVO); |
| | | } |
| | | List<ServiceSubtaskExport> serviceSubtaskExports = null; |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = null; |
| | | if (!CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | serviceSubtaskExports = DtoConversionUtils.sourceToTarget(serviceSubtaskList, ServiceSubtaskExport.class); |
| | | for (ServiceSubtaskExport serviceSubtaskExport : serviceSubtaskExports) { |
| | | String pf = PreachFormEnum.getDescByCode(serviceSubtaskExport.getPreachform()); |
| | | serviceSubtaskExport.setPreachform(pf); |
| | | if(serviceSubtaskExport.getSendstate() != null) { |
| | | if (serviceSubtaskExport.getSendstate() != null) { |
| | | String stName = SendStateEnum.getDescByCode("" + serviceSubtaskExport.getSendstate()); |
| | | serviceSubtaskExport.setStName(stName); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | util.exportExcel(response, serviceSubtaskExports, "患者随访信息表单"); |
| | | } |
| | | //获取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()); |
| | | |
| | | } |
| | | |
| | | |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | util.exportExcelTwoSheet(response, serviceSubtaskExports, "患者随访信息表单", serviceSubtaskDetailRatioExports, "问题详情占比", ServiceSubtaskDetailRatioExport.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询患者随访信息 |
| | |
| | | Integer offset = PageUtils.getOffset(serviceSubtaskCountReq.getPageNum(), serviceSubtaskCountReq.getPageSize()); |
| | | serviceSubtaskCountReq.setPageNum(offset); |
| | | |
| | | Integer statisticaltype = serviceSubtaskCountReq.getStatisticaltype(); |
| | | |
| | | if (ObjectUtils.isNotEmpty(statisticaltype)) { |
| | | SysUser user = getLoginUser().getUser(); |
| | | if (!isAdmin.contains(user.getUserId())) { |
| | | if (statisticaltype == 1) { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) { |
| | | //全部病区 |
| | | List<String> leavehospitaldistrictcodes = null; |
| | | SysUserDept sysUserWard = new SysUserDept(); |
| | | sysUserWard.setUserId(user.getUserId()); |
| | | sysUserWard.setOrgid(user.getOrgid()); |
| | | sysUserWard.setDeptType("2"); |
| | | List<SysUserDept> wardList = sysUserDeptService.selectSysUserDeptList(sysUserWard); |
| | | if(CollectionUtils.isNotEmpty(wardList)) { |
| | | leavehospitaldistrictcodes = wardList.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | } |
| | | serviceSubtaskCountReq.setLeavehospitaldistrictcodes(leavehospitaldistrictcodes); |
| | | } |
| | | } else if (statisticaltype == 2) { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getDeptcodes())) { |
| | | //全部科室 |
| | | List<String> deptCodes = null; |
| | | SysUserDept sysUserDept = new SysUserDept(); |
| | | sysUserDept.setUserId(user.getUserId()); |
| | | sysUserDept.setOrgid(user.getOrgid()); |
| | | sysUserDept.setDeptType("1"); |
| | | List<SysUserDept> deptList = sysUserDeptService.selectSysUserDeptList(sysUserDept); |
| | | if(CollectionUtils.isNotEmpty(deptList)){ |
| | | deptCodes = deptList.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | } |
| | | serviceSubtaskCountReq.setDeptcodes(deptCodes); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String followUpCountStyle = configService.selectConfigByKey("followUpCountStyle", serviceSubtaskCountReq.getOrgid()); |
| | | if (ObjectUtils.isNotEmpty(followUpCountStyle)) { |
| | | serviceSubtaskCountReq.setFollowUpCountStyle(followUpCountStyle); |
| | |
| | | serviceSubtaskCountReq.setPageSize(null); |
| | | List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSfStatistics(serviceSubtaskCountReq); |
| | | return getDataTable4(CollectionUtils.isEmpty(sfStatistics) ? sfStatistics.size() : 0, serviceSubtaskService.getSfStatistics(serviceSubtaskCountReq)); |
| | | } |
| | | |
| | | /** |
| | | * 获取专病随访统计比例 |
| | | */ |
| | | @ApiOperation("获取专病随访统计比例") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/getSpecialSfStatistics") |
| | | public Map<String, Object> getSpecialSfStatistics(@RequestBody ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getServiceType())) { |
| | | return error("服务类型不能为空"); |
| | | } |
| | | Integer offset = PageUtils.getOffset(serviceSubtaskCountReq.getPageNum(), serviceSubtaskCountReq.getPageSize()); |
| | | serviceSubtaskCountReq.setPageNum(offset); |
| | | |
| | | String followUpCountStyle = configService.selectConfigByKey("followUpCountStyle", serviceSubtaskCountReq.getOrgid()); |
| | | if (ObjectUtils.isNotEmpty(followUpCountStyle)) { |
| | | serviceSubtaskCountReq.setFollowUpCountStyle(followUpCountStyle); |
| | | } else { |
| | | serviceSubtaskCountReq.setFollowUpCountStyle("1"); |
| | | } |
| | | serviceSubtaskCountReq.setPageNum(null); |
| | | serviceSubtaskCountReq.setPageSize(null); |
| | | List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSpecialSfStatistics(serviceSubtaskCountReq); |
| | | return getDataTable4(CollectionUtils.isEmpty(sfStatistics) ? sfStatistics.size() : 0, serviceSubtaskService.getSpecialSfStatistics(serviceSubtaskCountReq)); |
| | | } |
| | | |
| | | /** |
| | |
| | | return serviceSubtaskService.getHeLibraryCount(heLibraryCountVO); |
| | | } |
| | | |
| | | @ApiOperation("获取宣教统计超链接") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/gethelibraryCountHyperlink") |
| | | public AjaxResult gethelibraryCountHyperlink(@RequestBody HeLibraryCountVO heLibraryCountVO) { |
| | | return success(serviceSubtaskService.gethelibraryCountHyperlink(heLibraryCountVO)); |
| | | } |
| | | |
| | | /** |
| | | * 手动发送问卷模板的短信功能 |
| | | * |
| | | * @param subid |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/smsSubTask/{subid}") |
| | | public Map<String, Object> smsSubTask(@PathVariable("subid") Long subid) { |
| | | return serviceSubtaskService.smsSubTask(subid); |
| | | } |
| | | |
| | | /** |
| | | * 跳转中间页 |
| | | * |
| | | * @param taskId |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/goSfRelay") |
| | | public AjaxResult goSfRelay(@RequestParam("taskId") Long taskId) { |
| | | String url = localIP + ":" + req_path + "/SfRelay?taskid=" + taskId; |
| | | return AjaxResult.success(url); |
| | | } |
| | | |
| | | /** |
| | | * 扫码生成子任务 |
| | | * |
| | | * @param serviceTask |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/scanGenerateSubtask") |
| | | public AjaxResult scanGenerateSubtask(@RequestBody ServiceTask serviceTask) { |
| | | return AjaxResult.success(serviceSubtaskService.scanGenerateSubtask(serviceTask)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/test") |
| | | public void test() { |
| | | ryTask.dealOutHospInfo(); |
| | | } |
| | | |
| | | @PostMapping("/compensateTasktest") |
| | | public void compensateTasktest(@RequestParam("subId") Long subId) { |
| | | ryTask.compensateTaskTest(subId); |
| | | } |
| | | |
| | | @PostMapping("/longTaskSendtest") |
| | | public void longTaskSendtest(@RequestParam("subId") Long subId) { |
| | | ryTask.longTaskSendTest(subId); |
| | | } |
| | | |
| | | @PostMapping("/syncMedInhospForShiyi") |
| | |
| | | public void syncMedOperForShiyi(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) { |
| | | collectHISService.syncOper(startTime, endTime); |
| | | } |
| | | |
| | | @PostMapping("/qwenLLMTest") |
| | | public int qwenLLMTest(@RequestParam("voiceText") String questionText, @RequestParam("voiceText") String voiceText, @RequestParam("value") String value, @RequestParam("regexText") String regexText) { |
| | | int result = ryTask.qwenLLMTest(questionText, voiceText, value, regexText); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |