| | |
| | | |
| | | import com.github.pagehelper.ISelect; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.PatMedInhospMapper; |
| | | import com.smartor.mapper.PatMedOuthospMapper; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.bytebuddy.implementation.bytecode.Throw; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | /** |
| | | * 查询患者随访信息 |
| | |
| | | ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid()); |
| | | if (ObjectUtils.isNotEmpty(serviceTask)) serviceSubtask.setPreachform(serviceTask.getPreachform()); |
| | | } |
| | | |
| | | /** |
| | | * 代码优化 分离统计 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("serviceSubtaskList", serviceSubtaskList); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | list.add(map); |
| | | **/ |
| | | //todo 代码优化 |
| | | Map<String, Object> map = serviceSubtaskService.patItemCount(serviceSubtaskVO); |
| | | // Map<String, Object> map = patItemCount(serviceSubtaskVO); |
| | | map.put("serviceSubtaskList", serviceSubtaskList); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | list.add(map); |
| | |
| | | } |
| | | }); |
| | | return getDataTable2(total, list); |
| | | } |
| | | |
| | | /** |
| | | * 统计随访数据 |
| | | */ |
| | | @ApiOperation("统计随访数据") |
| | | @PostMapping("/patItemCount") |
| | | public Map<String, Object> patItemCount(@RequestBody ServiceSubtaskVO serviceSubtaskVO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // 通过redis记录结果 |
| | | Map<String, Object> redisMap = new HashMap<>(); |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = null; |
| | | Long userId = null; |
| | | if(ObjectUtils.isNotEmpty(loginUser)){ |
| | | user = loginUser.getUser(); |
| | | if(ObjectUtils.isNotEmpty(user)){ |
| | | userId = user.getUserId(); |
| | | } |
| | | } |
| | | if(ObjectUtils.isNotEmpty(userId)){ |
| | | redisMap = redisCache.getCacheObject(userId + "patItemCount"); |
| | | //记录是否有可用缓存 |
| | | // Boolean redisFlag = false; |
| | | // Map oldConditionMap = (Map)redisMap.get("searchCondition"); |
| | | if(MapUtils.isNotEmpty(redisMap)){ |
| | | map = redisMap; |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | }else { |
| | | map = serviceSubtaskService.patItemCount(serviceSubtaskVO); |
| | | // map.put("searchCondition",serviceSubtaskVO); |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | |
| | | map.put("code", HttpStatus.SUCCESS); |
| | | return map; |
| | | } |
| | | |
| | | |
| | |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | | serviceSubtask.setServiceSubtaskRecordList(serviceSubtaskRecordService.selectServiceSubtaskRecordList(serviceSubtaskRecord)); |
| | | } |
| | | //todo 代码优化 |
| | | Map<String, Object> map = serviceSubtaskService.patItemCount(serviceSubtaskVO); |
| | | // Map<String, Object> map = patItemCount(serviceSubtaskVO); |
| | | map.put("serviceSubtaskList", serviceSubtaskList); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | list.add(map); |
| | |
| | | /** |
| | | * 随访历史记录导出 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | | // @Log(title = "随访历史记录导出", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/getSubtaskByDiagnameExport") |
| | | // public void getSubtaskByDiagnameExport(HttpServletResponse response, List<ServiceSubtaskDiagname> serviceSubtaskDiagnameList) { |
| | | // ExcelUtil<ServiceSubtaskDiagname> util = new ExcelUtil<ServiceSubtaskDiagname>(ServiceSubtaskDiagname.class); |
| | | // |
| | | // if (active.equals("ls") || active.equals("druid")) { |
| | | // util.exportExcel(response, serviceSubtaskDiagnameList, LocalDate.now().getMonthValue() + "随访统计导出"); |
| | | // } else { |
| | | // util.exportExcel(response, serviceSubtaskDiagnameList, "随访统计导出"); |
| | | // } |
| | | // } |
| | | |
| | | //@PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | | @Log(title = "随访历史记录导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/getSubtaskByDiagnameExport") |
| | | public void getSubtaskByDiagnameExport(HttpServletResponse response, ServiceSubtask serviceSubtask) { |
| | |
| | | serviceSubtask.setOrgid(user.getOrgid()); |
| | | serviceSubtask.setPageNum(PageUtils.getOffset(serviceSubtask.getPageNum(), serviceSubtask.getPageSize())); |
| | | List<ServiceSubtask> subtaskList = serviceSubtaskService.selectServiceSubtaskByDiagname(serviceSubtask); |
| | | ExcelUtil<ServiceSubtask> util = new ExcelUtil<ServiceSubtask>(ServiceSubtask.class); |
| | | List<ServiceSubtaskDiagname> serviceSubtaskDiagnameList = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(subtaskList)) serviceSubtaskDiagnameList = serviceSubtaskService.convertToDiagnameList(subtaskList); |
| | | ExcelUtil<ServiceSubtaskDiagname> util = new ExcelUtil<ServiceSubtaskDiagname>(ServiceSubtaskDiagname.class); |
| | | |
| | | if (active.equals("ls") || active.equals("druid")) { |
| | | util.exportExcel(response, subtaskList, LocalDate.now().getMonthValue() + "随访统计导出"); |
| | | util.exportExcel(response, serviceSubtaskDiagnameList, LocalDate.now().getMonthValue() + "随访统计导出"); |
| | | } else { |
| | | util.exportExcel(response, subtaskList, "随访统计导出"); |
| | | util.exportExcel(response, serviceSubtaskDiagnameList, "随访统计导出"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增或修改删除单一任务 |
| | |
| | | |
| | | ExcelUtil<ServiceSubtaskStatistic> util = new ExcelUtil<ServiceSubtaskStatistic>(ServiceSubtaskStatistic.class); |
| | | |
| | | String sheetName = ""; |
| | | String fileName = ""; |
| | | if (active.equals("ls") || active.equals("druid")) { |
| | | util.exportExcel(response, sfStatistics, LocalDate.now().getMonthValue() + "月出院随访统计表"); |
| | | fileName = sheetName = LocalDate.now().getMonthValue() + "月出院随访统计表"; |
| | | util.exportExcelWithFileName(response, sfStatistics, sheetName, fileName); |
| | | } else { |
| | | util.exportExcel(response, sfStatistics, "随访统计导出"); |
| | | sheetName = "随访统计导出"; |
| | | util.exportExcel(response, sfStatistics, sheetName); |
| | | } |
| | | } |
| | | |