| | |
| | | import com.ruoyi.quartz.task.RyTask; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserDeptService; |
| | | import com.smartor.common.MydOptionRatioChartBuilder; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.QuestionResultDTO; |
| | | import com.smartor.domain.VO.*; |
| | |
| | | serviceSubtaskExport.setEndDay(endDay); |
| | | } |
| | | } |
| | | SltdMydTotalVO sltdMydTotalVO = new SltdMydTotalVO(); |
| | | sltdMydTotalVO.setServiceTypeList(Arrays.asList(serviceSubtaskVO.getServiceType())); |
| | | sltdMydTotalVO.setEndOutHospTime(serviceSubtaskVO.getEndOutHospTime()); |
| | | sltdMydTotalVO.setStartOutHospTime(serviceSubtaskVO.getStartOutHospTime()); |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.getDetailRatio(sltdMydTotalVO, serviceSubtaskList); |
| | | //问题详情占比:只统计本次导出的这批患者,数量=选该选项的患者数,比例=占该题作答人数 |
| | | List<Long> subtaskIds = new ArrayList<>(); |
| | | for (ServiceSubtaskRes serviceSubtaskRes : serviceSubtaskList) { |
| | | if (serviceSubtaskRes.getId() != null) { |
| | | subtaskIds.add(serviceSubtaskRes.getId()); |
| | | } |
| | | } |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.statMydQuestionOptionForExport(subtaskIds, null); |
| | | } |
| | | |
| | | |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | util.exportExcelTwoSheet(response, serviceSubtaskExports, "患者随访信息表单", serviceSubtaskDetailRatioExports, "问题详情占比", ServiceSubtaskDetailRatioExport.class); |
| | | //第三个Sheet:问题详情占比图表(按任务名称分组,一个任务一张柱状图) |
| | | util.exportExcelTwoSheetWithChart(response, serviceSubtaskExports, "患者随访信息表单", |
| | | serviceSubtaskDetailRatioExports, "问题详情占比", ServiceSubtaskDetailRatioExport.class, |
| | | new MydOptionRatioChartBuilder(serviceSubtaskDetailRatioExports)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * taskSituation4Info - taskSituation = 4 |
| | | * taskSituation5Info - taskSituation = 5 |
| | | * taskSituation6Info - taskSituation = 7 |
| | | * manuallyCalledInfo - isManuallyCalled = 1L |
| | | * filterCountList - taskSituation = 6 && sendstate = 4 |
| | | * |
| | | */ |
| | |
| | | @ApiOperation("获取当前用户随访数量统计") |
| | | @PostMapping("/getCurrentUserServiceSubtaskCount") |
| | | public Map<String, Object> getCurrentUserServiceSubtaskCount() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | LoginUser loginUser = getLoginUser(); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if (loginUser == null || loginUser.getUser() == null) { |
| | | return new HashMap<>(); |
| | | } |
| | | SysUser sysUser = loginUser.getUser(); |
| | | SysUserDept sysUserDept = new SysUserDept(); |
| | | sysUserDept.setUserId(sysUser.getUserId()); |
| | | sysUserDept.setOrgid(sysUser.getOrgid()); |
| | | sysUserDept.setCampusid(sysUser.getCampusid()); |
| | | sysUserDept.setDeptType("1"); |
| | | List<SysUserDept> sysUserDepts = sysUserDeptService.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<String> deptCodes = sysUserDepts.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | List<String> wardCodes = sysUserWards.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList()); |
| | | List<String> deptCodes = CollectionUtils.emptyIfNull(sysUser.getBelongDepts()).stream() |
| | | .map(item -> item.get("deptCode")) |
| | | .filter(Objects::nonNull) // 剔除null |
| | | .map(Object::toString) |
| | | .collect(Collectors.toList()); |
| | | List<String> wardCodes = CollectionUtils.emptyIfNull(sysUser.getBelongWards()).stream() |
| | | .map(item -> item.get("districtCode")) |
| | | .filter(Objects::nonNull) // 剔除null |
| | | .map(Object::toString) |
| | | .collect(Collectors.toList()); |
| | | ServiceSubtaskEntity entity = new ServiceSubtaskEntity(); |
| | | entity.setOrgid(sysUser.getOrgid()); |
| | | entity.setLeaveldeptcodes(deptCodes); |
| | | entity.setLeavehospitaldistrictcodes(wardCodes); |
| | | if (ObjectUtils.isNotEmpty(sysUser)) { |
| | | if (!("admin").equals(sysUser.getUserName())) { |
| | | if (ObjectUtils.isNotEmpty(sysUserWards) && ObjectUtils.isNotEmpty(sysUserDepts)) { |
| | | map = serviceSubtaskService.getCurrentUserServiceSubtaskCount(entity); |
| | | } |
| | | } else { |
| | | map = serviceSubtaskService.getCurrentUserServiceSubtaskCount(entity); |
| | | } |
| | | // admin 查看全院;非 admin 只要配置了科室或病区任一维度即可查询(SQL 中为 OR 关系) |
| | | boolean isAdmin = "admin".equals(sysUser.getUserName()); |
| | | if (isAdmin || CollectionUtils.isNotEmpty(deptCodes) || CollectionUtils.isNotEmpty(wardCodes)) { |
| | | return serviceSubtaskService.getCurrentUserServiceSubtaskCount(entity); |
| | | } |
| | | return map; |
| | | // 非 admin 且未配置任何科室/病区权限时,返回默认 0 值,避免前端取不到 key |
| | | Map<String, Object> empty = new HashMap<>(); |
| | | empty.put("pendingVisitCount", 0); |
| | | empty.put("failedVisitCount", 0); |
| | | empty.put("abnormalVisitCount", 0); |
| | | empty.put("warnningVisitCount", 0); |
| | | empty.put("allVisitCount", 0); |
| | | return empty; |
| | | } |
| | | |
| | | @ApiOperation("获取当前用户宣教数量统计") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("获取统计数") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/countByCondition") |
| | | public Map<String, Object> countByCondition(@RequestBody ServiceSubtaskEntity condition) { |
| | | Map<String, Object> map = serviceSubtaskService.countByCondition(condition); |
| | | return map; |
| | | } |
| | | } |