| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.github.pagehelper.ISelect; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.ruoyi.common.annotation.AddOrgId; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.dx.MessageSend; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.MsgLSEnum; |
| | | import com.ruoyi.common.enums.PreachFormEnum; |
| | | import com.ruoyi.common.enums.SendStateEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | |
| | | import com.ruoyi.common.utils.reflect.ReflectUtils; |
| | | import com.ruoyi.quartz.service.ICollectHISService; |
| | | import com.ruoyi.quartz.task.RyTask; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserDeptService; |
| | | import com.smartor.common.LSHospTokenUtil; |
| | | import com.smartor.common.QwenLLMUtil; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.VO.HeLibraryCountVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | 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; |
| | | |
| | |
| | | @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; |
| | |
| | | |
| | | //获取serviceSubtaskList中的所有taskid |
| | | List<Long> taskIds = serviceSubtaskList.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOption(taskIds); |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOption(taskIds, serviceSubtaskVO.getStartOutHospTime(), serviceSubtaskVO.getEndOutHospTime()); |
| | | |
| | | } |
| | | |
| | | |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | util.exportExcelTwoSheet(response, serviceSubtaskExports, "患者随访信息表单", |
| | | serviceSubtaskDetailRatioExports, "问题详情占比", ServiceSubtaskDetailRatioExport.class); |
| | | util.exportExcelTwoSheet(response, serviceSubtaskExports, "患者随访信息表单", serviceSubtaskDetailRatioExports, "问题详情占比", ServiceSubtaskDetailRatioExport.class); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (statisticaltype == 1) { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) { |
| | | //全部病区 |
| | | String deptInfo = user.getDeptInfo(); |
| | | List<String> leavehospitaldistrictcodes = JSON.parseArray(deptInfo).stream().map(item -> (String) ((List<?>) item).get(0)).collect(Collectors.toList()); |
| | | 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())) { |
| | | //全部科室 |
| | | String hospInfo = user.getHospInfo(); |
| | | List<String> deptCodes = JSON.parseArray(hospInfo).stream().map(item -> (String) ((List<?>) item).get(0)).collect(Collectors.toList()); |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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() { |
| | |
| | | int result = ryTask.qwenLLMTest(questionText, voiceText, value, regexText); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |