| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.PreachFormEnum; |
| | | 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.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.entity.ServiceSubtaskEntity; |
| | |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.WebDataBinder; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("/smartor/serviceSubtask") |
| | | public class ServiceSubtaskController extends BaseController { |
| | | @InitBinder |
| | | public void initBinder(WebDataBinder binder) { |
| | | binder.setAutoGrowCollectionLimit(1024); // 或 2048、4096 等 |
| | | } |
| | | |
| | | @Autowired |
| | | private IServiceSubtaskService serviceSubtaskService; |
| | | |
| | |
| | | // 直接从已有聚合结果推算total,避免去掉分页后再全量查一遍大表 |
| | | long total = 0L; |
| | | try { |
| | | // * wzx: 未执行数量 |
| | | // * ysf: 已随访数量 |
| | | // * fssb: 发送失败数量 |
| | | // * yfs: 已发送数量 |
| | | // * dsf: 待随访数量 |
| | | |
| | | // long wzx = map.get("wzx") != null ? ((Number) map.get("wzx")).longValue() : 0L; |
| | | // long ysf = map.get("ysf") != null ? ((Number) map.get("ysf")).longValue() : 0L; |
| | | // long dsf = map.get("dsf") != null ? ((Number) map.get("dsf")).longValue() : 0L; |
| | | // long fssb = map.get("fssb") != null ? ((Number) map.get("fssb")).longValue() : 0L; |
| | | total = map.get("total") != null ? ((Number) map.get("total")).longValue() : 0L; |
| | | |
| | | } catch (Exception e) { |
| | |
| | | if (ObjectUtils.isNotEmpty(oldCondition) && isSameCondition(oldCondition, serviceSubtaskEntity)) { |
| | | redisFlag = true; |
| | | map = redisMap; |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 60, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | if (!redisFlag) { |
| | |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | | @Log(title = "单一任务(随访宣教)", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/patItemExport") |
| | | public void patItemExport(HttpServletResponse response, @RequestBody ServiceSubtaskEntity serviceSubtaskVO) { |
| | | public void patItemExport(HttpServletResponse response, ServiceSubtaskEntity serviceSubtaskVO) { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | serviceSubtaskVO.setOrgid(user.getOrgid()); |
| | | List<ServiceSubtaskRes> serviceSubtaskList = null; |
| | | if (serviceSubtaskVO != null) { |
| | | if (serviceSubtaskVO.getPageNum() != null && serviceSubtaskVO.getPageSize() != null) |
| | | PageUtils.startPageByPost(serviceSubtaskVO.getPageNum(), serviceSubtaskVO.getPageSize()); |
| | | serviceSubtaskList = serviceSubtaskService.patItem(serviceSubtaskVO); |
| | | } |
| | | List<ServiceSubtaskExprot> serviceSubtaskExprots = null; |
| | | List<ServiceSubtaskExport> serviceSubtaskExports = null; |
| | | if (!CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | serviceSubtaskExprots = DtoConversionUtils.sourceToTarget(serviceSubtaskList, ServiceSubtaskExprot.class); |
| | | for (ServiceSubtaskExprot serviceSubtaskExprot : serviceSubtaskExprots) { |
| | | String pf = PreachFormEnum.getDescByCode(serviceSubtaskExprot.getPreachform()); |
| | | serviceSubtaskExprot.setPreachform(pf); |
| | | serviceSubtaskExports = DtoConversionUtils.sourceToTarget(serviceSubtaskList, ServiceSubtaskExport.class); |
| | | for (ServiceSubtaskExport serviceSubtaskExport : serviceSubtaskExports) { |
| | | String pf = PreachFormEnum.getDescByCode(serviceSubtaskExport.getPreachform()); |
| | | serviceSubtaskExport.setPreachform(pf); |
| | | |
| | | //计算出院天数 |
| | | if (!Objects.isNull(serviceSubtaskExport.getEndtime())) { |
| | | Integer endDay = DateUtils.differentDaysByMillisecond(serviceSubtaskExport.getEndtime(), new Date()); |
| | | serviceSubtaskExport.setEndDay(endDay); |
| | | } |
| | | } |
| | | |
| | | } |
| | | ExcelUtil<ServiceSubtaskExprot> util = new ExcelUtil<ServiceSubtaskExprot>(ServiceSubtaskExprot.class); |
| | | util.exportExcel(response, serviceSubtaskExprots, "患者随访信息表单"); |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | util.exportExcel(response, serviceSubtaskExports, "患者随访信息表单"); |
| | | } |
| | | |
| | | |
| | |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:list')") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/patItemByCondition") |
| | | public TableDataInfo patItemByCondition(@RequestBody ServiceSubtaskVO serviceSubtaskVO) { |
| | | public Map<String, Object> patItemByCondition(@RequestBody ServiceSubtaskVO serviceSubtaskVO) { |
| | | List<ServiceSubtask> serviceSubtaskList = null; |
| | | ServiceSubtaskEntity serviceSubtaskEntity = DtoConversionUtils.sourceToTarget(serviceSubtaskVO, ServiceSubtaskEntity.class); |
| | | serviceSubtaskEntity.setContinueContent(ObjectUtils.isNotEmpty(serviceSubtaskVO.getContinueContent()) ? serviceSubtaskVO.getContinueContent().toString() : null); |
| | | if (serviceSubtaskEntity != null) { |
| | | PageUtils.startPageByPost(serviceSubtaskEntity.getPageNum(), serviceSubtaskEntity.getPageSize()); |
| | | |
| | | serviceSubtaskEntity.setPageNum(PageUtils.getOffset(serviceSubtaskEntity.getPageNum(), serviceSubtaskEntity.getPageSize())); |
| | | serviceSubtaskList = serviceSubtaskService.patItem2(serviceSubtaskEntity); |
| | | } |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | |
| | | serviceSubtaskService.patItem2(serviceSubtaskEntity); |
| | | } |
| | | }); |
| | | return getDataTable2(total, list); |
| | | return getDataTable3(total, list); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation("获取随访统计比例") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/getSfStatistics") |
| | | public AjaxResult getSfStatistics(@RequestBody ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | public Map<String, Object> getSfStatistics(@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"); |
| | | } |
| | | return success(serviceSubtaskService.getSfStatistics(serviceSubtaskCountReq)); |
| | | serviceSubtaskCountReq.setPageNum(null); |
| | | serviceSubtaskCountReq.setPageSize(null); |
| | | List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSfStatistics(serviceSubtaskCountReq); |
| | | return getDataTable4(CollectionUtils.isEmpty(sfStatistics) ? sfStatistics.size() : 0, serviceSubtaskService.getSfStatistics(serviceSubtaskCountReq)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 延续护理统计 |
| | | */ |
| | |
| | | } |
| | | return success(serviceSubtaskService.getContinueNurseCount(serviceSubtaskCotinueCountVO)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return map; |
| | | } |
| | | |
| | | @ApiOperation("获取当前用户宣教数量统计") |
| | | @PostMapping("/gethelibraryCount") |
| | | public Map<String, Object> getHeLibraryCount(@RequestBody HeLibraryCountVO heLibraryCountVO) { |
| | | log.info("获取当前用户宣教数量统计的入参为:{}", heLibraryCountVO); |
| | | return serviceSubtaskService.getHeLibraryCount(heLibraryCountVO); |
| | | } |
| | | |
| | | } |