| ÎļþÃû´Ó ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | package com.ruoyi.task.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.github.pagehelper.ISelect; |
| | |
| | | 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 com.ruoyi.quartz.task.RyTask; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserDeptService; |
| | | import com.ruoyi.common.core.service.TaskOpsTriggerApi; |
| | | import com.ruoyi.task.api.spi.TaskSysConfigPort; |
| | | import com.ruoyi.task.api.spi.TaskSysUserDeptPort; |
| | | import com.ruoyi.satisfaction.api.SatisfactionExportBundle; |
| | | import com.ruoyi.satisfaction.api.SatisfactionFacade; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.VO.*; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.service.IServiceSubtaskRecordService; |
| | | import com.smartor.service.IServiceSubtaskService; |
| | | import com.smartor.service.IServiceTaskService; |
| | | import com.ruoyi.task.api.spi.TaskSubtaskRecordPort; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | import com.ruoyi.template.domain.VO.HeLibraryCountVO; |
| | | import static com.ruoyi.common.utils.SecurityUtils.getLoginUser; |
| | | import com.ruoyi.task.domain.entity.ServiceSubtaskEntity; |
| | | import com.ruoyi.task.domain.ServiceStatisticsRequest; |
| | | import com.ruoyi.task.domain.ServiceStatisticsResponse; |
| | | import com.ruoyi.task.domain.ServiceSubtask; |
| | | import com.ruoyi.task.domain.ServiceSubtaskCountReq; |
| | | import com.ruoyi.task.domain.ServiceSubtaskRecord; |
| | | import com.ruoyi.task.domain.ServiceSubtaskStatistic; |
| | | import com.ruoyi.task.domain.ServiceTask; |
| | | import com.ruoyi.task.domain.VO.ServiceSubtaskCotinueCountVO; |
| | | import com.ruoyi.task.service.IServiceSubtaskService; |
| | | import com.ruoyi.task.service.IServiceTaskService; |
| | | import com.ruoyi.task.domain.PatArchiveSrmVO; |
| | | import com.ruoyi.task.domain.ServiceSubTaskDetailReq; |
| | | import com.ruoyi.task.domain.ServiceSubtaskDiagname; |
| | | import com.ruoyi.task.domain.ServiceSubtaskRes; |
| | | import com.ruoyi.task.domain.ServiceSubtaskTemplateVO; |
| | | import com.ruoyi.task.domain.ServiceTaskVO; |
| | | import com.ruoyi.task.domain.VO.ServiceSubtaskVO; |
| | | import com.ruoyi.task.domain.VO.TransferDeptVO; |
| | | import com.ruoyi.task.domain.ServiceSubtaskExport; |
| | | |
| | | /** |
| | | * åä¸ä»»å¡ï¼é访ï¼Controller |
| | | * <p> |
| | | * â ï¸ çµè¯ç¸å
³ç 6 个端ç¹ï¼phoneCallBack / phoneCallBackYQ / taskPull / |
| | | * saveQuestionAnswerPhone / recordAcceptshanghai / recordAcceptï¼å·²éçµè¯æ¨¡åå |
| | | * æ´ä½æ¬è¿ {@code ruoyi-phone} ç {@code PhoneCallbackController}ï¼<b>URL ä¿æä¸å</b> |
| | | * ï¼å¤é¨çµè¯å¹³å°çåè°å°åä¸è½æ¹ï¼ï¼å æ¤æ¬ Controller ä¸çµè¯æ¨¡åå
±ç¨ |
| | | * {@code /smartor/serviceSubtask} è¿ä¸åç¼ï¼åªè¦å®æ´è·¯å¾ä¸éå¤å³å¯æ£å¸¸æ³¨åã |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-02-02 |
| | |
| | | private IServiceTaskService serviceTaskService; |
| | | |
| | | @Autowired |
| | | private ISysUserDeptService sysUserDeptService; |
| | | private TaskSysUserDeptPort taskSysUserDeptPort; |
| | | |
| | | @Autowired |
| | | private IServiceSubtaskRecordService serviceSubtaskRecordService; |
| | | private TaskSubtaskRecordPort serviceSubtaskRecordService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | private TaskSysConfigPort taskSysConfigPort; |
| | | |
| | | /** |
| | | * ä»»å¡è¿ç»´è§¦åè½åã |
| | | * <p> |
| | | * åå
æ¤å¤ç´æ¥æ³¨å
¥ {@code ruoyi-quartz} ç {@code RyTask} / {@code ICollectHISService}ï¼ |
| | | * ä¼è®©ã端ç¹å½å±ãä¸ãHIS ééå®ç°ãç»æ»ï¼è¿ 6 个端ç¹çå½å±è¦æ¬è¿ {@code ruoyi-task}ï¼ |
| | | * èå®ç°ï¼{@code RyTask} 2214 è¡ã注å
¥çº¦ 20 个 smartor serviceï¼ä¸è½æ¬ï¼ |
| | | * å¦åå½¢æ {@code ruoyi-task -> smartor} + {@code ruoyi-quartz -> ruoyi-task} ç硬循ç¯ã |
| | | * <p> |
| | | * æ¹ä¸ºç» {@code ruoyi-common} ç端å£åç¨ï¼æ¥å£å¨ ruoyi-commonï¼ |
| | | * å®ç°ï¼{@code TaskOpsTriggerApiImpl}ï¼çå¨ ruoyi-quartzã |
| | | * è¿æ ·ç«¯ç¹å¯ä»¥æ´ä½æ¬èµ°è<b>ä¸éè¦</b>ä¾èµ ruoyi-quartzã |
| | | */ |
| | | @Autowired |
| | | private RyTask ryTask; |
| | | |
| | | @Autowired |
| | | private ICollectHISService collectHISService; |
| | | private TaskOpsTriggerApi taskOpsTriggerApi; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | |
| | | } |
| | | |
| | | /** |
| | | * çµè¯åè°ä»»å¡(䏿µ·) |
| | | */ |
| | | @ApiOperation("çµè¯åè°ä»»å¡") |
| | | @PostMapping("/phoneCallBack") |
| | | public AjaxResult phoneCallBack(@RequestBody PhoneCallBackVO phoneCallBackVO) { |
| | | serviceSubtaskService.phoneCallBack(phoneCallBackVO); |
| | | return success(); |
| | | } |
| | | |
| | | @ApiOperation("çµè¯ASRéè¯åè°(é¨ç»®)") |
| | | @PostMapping("/phoneCallBackYQ") |
| | | public PhoneCallBackYQVO phoneCallBackYQ(@RequestBody PhoneCallReqYQVO phoneCallReqYQVO) { |
| | | log.info("çµè¯ASRéè¯åè°(é¨ç»®) ï¼{}", phoneCallReqYQVO); |
| | | PhoneCallBackYQVO phoneCallBackYQVO = serviceSubtaskService.phoneCallBackYQ(phoneCallReqYQVO); |
| | | return phoneCallBackYQVO; |
| | | } |
| | | |
| | | /** |
| | | * çµè¯ä»»å¡æå(é¨ç»®) |
| | | */ |
| | | @ApiOperation("çµè¯ä»»å¡æå(é¨ç»®)") |
| | | @PostMapping("/taskPull") |
| | | public List<PullTaskVO> taskPull() { |
| | | log.info("çµè¯ä»»å¡æå(é¨ç»®)"); |
| | | List<PullTaskVO> pullTaskVOList = serviceSubtaskService.taskPull(); |
| | | log.info("çµè¯ä»»å¡æåæ°æ®(é¨ç»®):{}", pullTaskVOList); |
| | | return pullTaskVOList; |
| | | } |
| | | |
| | | /** |
| | | * æ£è
é®é¢ç»æè®°å½ |
| | | */ |
| | | @ApiOperation("æ£è
é®é¢ç»æè®°å½ï¼çµè¯ï¼") |
| | | @PostMapping("/saveQuestionAnswerPhone") |
| | | public AjaxResult saveQuestionAnswerPhone(@RequestBody ServiceSubTaskDetailReq serviceSubTaskDetailReq) { |
| | | // SysUser user = getLoginUser().getUser(); |
| | | // serviceSubTaskDetailReq.setOrgid(user.getOrgid()); |
| | | log.info("æ£è
é®é¢ç»æè®°å½(çµè¯):{}", serviceSubTaskDetailReq); |
| | | return toAjax(serviceSubtaskService.saveQuestionAnswerPhone(serviceSubTaskDetailReq)); |
| | | } |
| | | |
| | | /** |
| | | * éè¯è®°å½åè° |
| | | */ |
| | | @ApiOperation("éè¯è®°å½åè°(䏿µ·)") |
| | | @PostMapping("/recordAcceptshanghai") |
| | | public AjaxResult recordAccepshanghait(@RequestBody ServiceSubTaskDetailReq serviceSubTaskDetailReq) { |
| | | log.info("éè¯è®°å½åè°(䏿µ·):{}", serviceSubTaskDetailReq); |
| | | return toAjax(serviceSubtaskService.saveQuestionAnswerPhone(serviceSubTaskDetailReq)); |
| | | } |
| | | |
| | | /** |
| | | * éè¯è®°å½åè° |
| | | */ |
| | | @ApiOperation("éè¯è®°å½åè°(é¨ç»®)") |
| | | @PostMapping("/recordAccept") |
| | | public AjaxResult recordAccept(@RequestBody PhoneCallRecordVO phoneCallRecordVO) { |
| | | log.info("éè¯è®°å½åè°(é¨ç»®):{}", phoneCallRecordVO); |
| | | serviceSubtaskService.recordAccept(phoneCallRecordVO); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¯ä¸ªæçé访ãå¤è¯é |
| | | */ |
| | | @ApiOperation("è·åæ¯ä¸ªæçé访ãå¤è¯é") |
| | |
| | | sysUserWard.setOrgid(user.getOrgid()); |
| | | sysUserWard.setCampusid(user.getCampusid()); |
| | | sysUserWard.setDeptType("2"); |
| | | List<SysUserDept> wardList = sysUserDeptService.selectSysUserDeptList(sysUserWard); |
| | | List<SysUserDept> wardList = taskSysUserDeptPort.selectSysUserDeptList(sysUserWard); |
| | | if (CollectionUtils.isNotEmpty(wardList)) { |
| | | leavehospitaldistrictcodes = wardList.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | } |
| | |
| | | sysUserDept.setOrgid(user.getOrgid()); |
| | | sysUserDept.setCampusid(user.getCampusid()); |
| | | sysUserDept.setDeptType("1"); |
| | | List<SysUserDept> deptList = sysUserDeptService.selectSysUserDeptList(sysUserDept); |
| | | List<SysUserDept> deptList = taskSysUserDeptPort.selectSysUserDeptList(sysUserDept); |
| | | if (CollectionUtils.isNotEmpty(deptList)) { |
| | | deptCodes = deptList.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | String followUpCountStyle = configService.selectConfigByKey("followUpCountStyle", serviceSubtaskCountReq.getOrgid()); |
| | | String followUpCountStyle = taskSysConfigPort.selectConfigValue("followUpCountStyle", serviceSubtaskCountReq.getOrgid()); |
| | | if (ObjectUtils.isNotEmpty(followUpCountStyle)) { |
| | | serviceSubtaskCountReq.setFollowUpCountStyle(followUpCountStyle); |
| | | } else { |
| | |
| | | Integer offset = PageUtils.getOffset(serviceSubtaskCountReq.getPageNum(), serviceSubtaskCountReq.getPageSize()); |
| | | serviceSubtaskCountReq.setPageNum(offset); |
| | | |
| | | String followUpCountStyle = configService.selectConfigByKey("followUpCountStyle", serviceSubtaskCountReq.getOrgid()); |
| | | String followUpCountStyle = taskSysConfigPort.selectConfigValue("followUpCountStyle", serviceSubtaskCountReq.getOrgid()); |
| | | if (ObjectUtils.isNotEmpty(followUpCountStyle)) { |
| | | serviceSubtaskCountReq.setFollowUpCountStyle(followUpCountStyle); |
| | | } else { |
| | |
| | | String orgid = loginUser.getUser().getOrgid(); |
| | | String configKey = serviceSubtaskCountReq.getConfigKey(); |
| | | if (StringUtils.isNotEmpty(configKey)) { |
| | | String configValue = configService.selectConfigByKey(configKey, orgid); |
| | | String configValue = taskSysConfigPort.selectConfigValue(configKey, orgid); |
| | | serviceSubtaskCountReq.setConfigValue(configValue); |
| | | if (StringUtils.isEmpty(configValue)) { |
| | | String logInfo = "getSfStatisticsCount-åæ° " + configKey + " æªé
ç½®, 请é
置好åéè¯"; |
| | |
| | | } |
| | | } |
| | | |
| | | String followUpCountStyle = configService.selectConfigByKey("followUpCountStyle", orgid); |
| | | String followUpCountStyle = taskSysConfigPort.selectConfigValue("followUpCountStyle", orgid); |
| | | if (ObjectUtils.isNotEmpty(followUpCountStyle)) { |
| | | serviceSubtaskCountReq.setFollowUpCountStyle(followUpCountStyle); |
| | | } else { |
| | |
| | | } |
| | | String configKey = serviceSubtaskCountReq.getConfigKey(); |
| | | if (StringUtils.isNotEmpty(configKey)) { |
| | | String configValue = configService.selectConfigByKey(configKey, serviceSubtaskCountReq.getOrgid()); |
| | | String configValue = taskSysConfigPort.selectConfigValue(configKey, serviceSubtaskCountReq.getOrgid()); |
| | | serviceSubtaskCountReq.setConfigValue(configValue); |
| | | if (StringUtils.isEmpty(configValue)) { |
| | | String logInfo = "getSfStatisticsCount-åæ° " + configKey + " æªé
ç½®, 请é
置好åéè¯"; |
| | |
| | | //å¤è¯ç»è®¡ |
| | | String configKey = serviceSubtaskCountReq.getConfigKey(); |
| | | if (StringUtils.isNotEmpty(configKey)) { |
| | | String configValue = configService.selectConfigByKey(configKey, serviceSubtaskCountReq.getOrgid()); |
| | | String configValue = taskSysConfigPort.selectConfigValue(configKey, serviceSubtaskCountReq.getOrgid()); |
| | | if (StringUtils.isEmpty(configValue)) { |
| | | String logInfo = "getSfStatisticsCountDetails-åæ° " + configKey + " æªé
ç½®, 请é
置好åéè¯"; |
| | | log.error(logInfo); |
| | |
| | | sysUserDept.setOrgid(sysUser.getOrgid()); |
| | | sysUserDept.setCampusid(sysUser.getCampusid()); |
| | | sysUserDept.setDeptType("1"); |
| | | List<SysUserDept> sysUserDepts = sysUserDeptService.selectSysUserDeptList(sysUserDept); |
| | | List<SysUserDept> sysUserDepts = taskSysUserDeptPort.selectSysUserDeptList(sysUserDept); |
| | | SysUserDept sysUserWard = new SysUserDept(); |
| | | sysUserWard.setUserId(sysUser.getUserId()); |
| | | sysUserWard.setOrgid(sysUser.getOrgid()); |
| | | sysUserWard.setCampusid(sysUser.getCampusid()); |
| | | sysUserWard.setDeptType("2"); |
| | | List<SysUserDept> sysUserWards = sysUserDeptService.selectSysUserDeptList(sysUserWard); |
| | | List<SysUserDept> sysUserWards = taskSysUserDeptPort.selectSysUserDeptList(sysUserWard); |
| | | List<String> deptCodes = sysUserDepts.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | List<String> wardCodes = sysUserWards.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | ServiceSubtaskEntity entity = new ServiceSubtaskEntity(); |
| | |
| | | public AjaxResult syncMedInhospForShiyi(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) { |
| | | // ç«å³è¿åï¼åå°å¼æ¥æ§è¡ |
| | | CompletableFuture.runAsync(() -> { |
| | | collectHISService.syncMedInhosp(startTime, endTime); |
| | | taskOpsTriggerApi.syncMedInhosp(startTime, endTime); |
| | | }); |
| | | return AjaxResult.success("忥任å¡å·²å¯å¨ï¼è¯·ç¨åæ¥çç»æ"); |
| | | } |
| | |
| | | @PostMapping("/syncMedInhospForShiyiYesterday") |
| | | public AjaxResult syncMedInhospForShiyiYesterday() { |
| | | // ç«å³è¿åï¼åå°å¼æ¥æ§è¡ |
| | | ryTask.collectHISYesterday(); |
| | | taskOpsTriggerApi.collectHISYesterday(); |
| | | return AjaxResult.success("忥任å¡å·²å¯å¨ï¼è¯·ç¨åæ¥çç»æ"); |
| | | } |
| | | |
| | | @PostMapping("/syncMedInhospForShiyiDaysBefore") |
| | | public AjaxResult syncMedInhospForShiyiDaysBefore(@RequestParam("day") Long day) { |
| | | // ç«å³è¿åï¼åå°å¼æ¥æ§è¡ |
| | | ryTask.collectHISDaysBefore(day); |
| | | taskOpsTriggerApi.collectHISDaysBefore(day); |
| | | return AjaxResult.success("ãcollectHISDaysBeforeã忥任å¡å·²å¯å¨ï¼å¤©æ°ä¸º" + day + "天ï¼è¯·ç¨åæ¥çç»æ"); |
| | | } |
| | | |
| | |
| | | public AjaxResult syncMedOperForShiyi(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) { |
| | | // ç«å³è¿åï¼åå°å¼æ¥æ§è¡ |
| | | CompletableFuture.runAsync(() -> { |
| | | collectHISService.syncOper(startTime, endTime); |
| | | taskOpsTriggerApi.syncOper(startTime, endTime); |
| | | }); |
| | | return AjaxResult.success("忥任å¡å·²å¯å¨ï¼è¯·ç¨åæ¥çç»æ"); |
| | | } |
| | |
| | | @PostMapping("/dealSubtaskDeadline") |
| | | public AjaxResult dealSubtaskDeadline(@RequestParam("orgid") String orgid, @RequestParam("day") Integer day) { |
| | | // ç«å³è¿åï¼åå°å¼æ¥æ§è¡ |
| | | ryTask.dealSubtaskDeadline(orgid, day); |
| | | taskOpsTriggerApi.dealSubtaskDeadline(orgid, day); |
| | | return AjaxResult.success("ãdealSubtaskDeadlineã忥任å¡å·²å¯å¨ï¼å¤©æ°ä¸º" + day + "天ï¼è¯·ç¨åæ¥çç»æ"); |
| | | } |
| | | |
| | | @PostMapping("/sendExceptInfo") |
| | | public AjaxResult sendExceptInfo() throws Exception { |
| | | ryTask.sendExceptInfo(); |
| | | taskOpsTriggerApi.sendExceptInfo(); |
| | | return AjaxResult.success("sendExceptInfo"); |
| | | } |
| | | |