|
@@ -2,6 +2,7 @@ package com.qunzhixinxi.hnqz.admin.manager;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
+import cn.hutool.core.date.DatePattern;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -49,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
@@ -462,25 +464,36 @@ public class WmPackageManager {
|
|
public List<WmScorePackageInfoExcelModel> exportPkgInfo(LocalDate startDate, LocalDate endDate) {
|
|
public List<WmScorePackageInfoExcelModel> exportPkgInfo(LocalDate startDate, LocalDate endDate) {
|
|
|
|
|
|
// 获取所有的企业
|
|
// 获取所有的企业
|
|
- List<SysDept> depts = deptService.list(Wrappers.<SysDept>lambdaQuery()
|
|
|
|
- .eq(SysDept::getDelFlag, CommonConstants.STATUS_NORMAL));
|
|
|
|
|
|
+ List<SysDept> depts = deptService.list(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getDelFlag, CommonConstants.STATUS_NORMAL));
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isEmpty(depts)) {
|
|
|
|
+ throw new BizException("不存在生效的企业信息,无法获取导出数据");
|
|
|
|
+ }
|
|
|
|
|
|
// 分别过滤区域和服务商
|
|
// 分别过滤区域和服务商
|
|
Map<Integer, SysDept> dis = depts.stream().filter(d -> d.getLevel() == 3).collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
Map<Integer, SysDept> dis = depts.stream().filter(d -> d.getLevel() == 3).collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
Map<Integer, SysDept> service = depts.stream().filter(d -> d.getLevel() == 4).collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
Map<Integer, SysDept> service = depts.stream().filter(d -> d.getLevel() == 4).collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
|
|
|
|
|
|
+ if (CollUtil.isEmpty(dis) || CollUtil.isEmpty(service)) {
|
|
|
|
+ throw new BizException("不存在生效的区域或服务商,无法获取导出数据");
|
|
|
|
+ }
|
|
|
|
|
|
// 获取区域发的包
|
|
// 获取区域发的包
|
|
List<WmScorePackage> pkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
List<WmScorePackage> pkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
.between(WmScorePackage::getCreateTime, startDate, endDate)
|
|
.between(WmScorePackage::getCreateTime, startDate, endDate)
|
|
.in(WmScorePackage::getSendPackageDeptId, dis.keySet().stream().map(String::valueOf).sorted().collect(Collectors.toList())));
|
|
.in(WmScorePackage::getSendPackageDeptId, dis.keySet().stream().map(String::valueOf).sorted().collect(Collectors.toList())));
|
|
|
|
|
|
|
|
+ if (CollUtil.isEmpty(pkgs)) {
|
|
|
|
+ throw new BizException(String.format("%s至%s没有区域发包记录,不支持导出", DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(startDate), DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(endDate)));
|
|
|
|
+ }
|
|
|
|
+
|
|
List<String> pkgIds = pkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
List<String> pkgIds = pkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
|
|
|
// 获取包所关联的产品
|
|
// 获取包所关联的产品
|
|
List<String> drugIds = pkgs.stream().flatMap(p -> Arrays.stream(p.getDrugtable())).distinct().sorted().collect(Collectors.toList());
|
|
List<String> drugIds = pkgs.stream().flatMap(p -> Arrays.stream(p.getDrugtable())).distinct().sorted().collect(Collectors.toList());
|
|
|
|
|
|
- Map<String, WmDaDrugEntDrugtable> drugtableMap = wmDaDrugEntDrugtableMapper.selectBatchIds(drugIds).stream().collect(Collectors.toMap(WmDaDrugEntDrugtable::getId, Function.identity()));
|
|
|
|
|
|
+ Map<String, WmDaDrugEntDrugtable> drugtableMap = CollUtil.isEmpty(drugIds) ? Collections.emptyMap() :
|
|
|
|
+ wmDaDrugEntDrugtableMapper.selectBatchIds(drugIds).stream().collect(Collectors.toMap(WmDaDrugEntDrugtable::getId, Function.identity()));
|
|
|
|
|
|
// 获得包所管理计划
|
|
// 获得包所管理计划
|
|
Map<Integer, Integer> pkg2PlanMap = planPkgService.list(Wrappers.<SysPlanPkg>lambdaQuery().in(SysPlanPkg::getPkgId, pkgIds.stream().mapToInt(Integer::parseInt).boxed().distinct().sorted().collect(Collectors.toList()))).stream().collect(Collectors.toMap(SysPlanPkg::getPkgId, SysPlanPkg::getPlanId));
|
|
Map<Integer, Integer> pkg2PlanMap = planPkgService.list(Wrappers.<SysPlanPkg>lambdaQuery().in(SysPlanPkg::getPkgId, pkgIds.stream().mapToInt(Integer::parseInt).boxed().distinct().sorted().collect(Collectors.toList()))).stream().collect(Collectors.toMap(SysPlanPkg::getPkgId, SysPlanPkg::getPlanId));
|
|
@@ -492,7 +505,8 @@ public class WmPackageManager {
|
|
List<WmScorePackage> childrenPkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery().in(WmScorePackage::getRelationScoreId, pkgIds));
|
|
List<WmScorePackage> childrenPkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery().in(WmScorePackage::getRelationScoreId, pkgIds));
|
|
List<String> cPkgIds = childrenPkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
List<String> cPkgIds = childrenPkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
// 父级下的所有子集
|
|
// 父级下的所有子集
|
|
- Map<String, List<String>> parentId2PkgMap = childrenPkgs.stream().collect(Collectors.groupingBy(WmScorePackage::getRelationScoreId, Collectors.mapping(WmScorePackage::getId, Collectors.toList())));
|
|
|
|
|
|
+ Map<String, List<String>> parentId2PkgMap = CollUtil.isEmpty(childrenPkgs) ? Collections.emptyMap() :
|
|
|
|
+ childrenPkgs.stream().collect(Collectors.groupingBy(WmScorePackage::getRelationScoreId, Collectors.mapping(WmScorePackage::getId, Collectors.toList())));
|
|
|
|
|
|
// 获取全部的任务
|
|
// 获取全部的任务
|
|
List<WmTask> tasks = taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId, cPkgIds).ne(WmTask::getTaskStatus, UpmsState.TaskState.REJECTED));
|
|
List<WmTask> tasks = taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId, cPkgIds).ne(WmTask::getTaskStatus, UpmsState.TaskState.REJECTED));
|
|
@@ -520,8 +534,9 @@ public class WmPackageManager {
|
|
|
|
|
|
// 产品&生产企业
|
|
// 产品&生产企业
|
|
WmDaDrugEntDrugtable drugtable = drugtableMap.get(pkg.getDrugtable()[0]);
|
|
WmDaDrugEntDrugtable drugtable = drugtableMap.get(pkg.getDrugtable()[0]);
|
|
- model.setSkuName(drugtable.getDrugname());
|
|
|
|
- model.setMah(drugtable.getDrugEntName());
|
|
|
|
|
|
+
|
|
|
|
+ model.setSkuName(drugtable == null ? "未分配产品" : drugtable.getDrugname());
|
|
|
|
+ model.setMah(drugtable == null ? "未知" : drugtable.getDrugEntName());
|
|
|
|
|
|
// 承接对象
|
|
// 承接对象
|
|
SysDept s = service.get(Integer.parseInt(pkg.getDeptId()));
|
|
SysDept s = service.get(Integer.parseInt(pkg.getDeptId()));
|
|
@@ -529,7 +544,6 @@ public class WmPackageManager {
|
|
|
|
|
|
// 任务数据统计
|
|
// 任务数据统计
|
|
List<WmTask> list = pkg2TaskListMap.get(pkg.getId());
|
|
List<WmTask> list = pkg2TaskListMap.get(pkg.getId());
|
|
-
|
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
Map<String, List<WmTask>> tt2TaskMap = list.stream().collect(Collectors.groupingBy(WmTask::getTaskTypeId));
|
|
Map<String, List<WmTask>> tt2TaskMap = list.stream().collect(Collectors.groupingBy(WmTask::getTaskTypeId));
|
|
|
|
|
|
@@ -602,10 +616,8 @@ public class WmPackageManager {
|
|
|
|
|
|
// 下发任务统计
|
|
// 下发任务统计
|
|
List<String> cPkgIdList = parentId2PkgMap.get(pkg.getId());
|
|
List<String> cPkgIdList = parentId2PkgMap.get(pkg.getId());
|
|
-
|
|
|
|
if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
|
|
|
-
|
|
|
|
int tt53dist = 0;
|
|
int tt53dist = 0;
|
|
int tt52dist = 0;
|
|
int tt52dist = 0;
|
|
int tt51dist = 0;
|
|
int tt51dist = 0;
|
|
@@ -629,55 +641,55 @@ public class WmPackageManager {
|
|
for (WmPackageTaskTypeQty packageTaskTypeQty : packageTaskTypeQtyList) {
|
|
for (WmPackageTaskTypeQty packageTaskTypeQty : packageTaskTypeQtyList) {
|
|
String taskTypeName = packageTaskTypeQty.getTaskTypeName();
|
|
String taskTypeName = packageTaskTypeQty.getTaskTypeName();
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "基础拜访")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "基础拜访")) {
|
|
tt53dist++;
|
|
tt53dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "专项拜访")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "专项拜访")) {
|
|
tt52dist++;
|
|
tt52dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "专业拜访")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "专业拜访")) {
|
|
tt51dist++;
|
|
tt51dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "数据收集")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "数据收集")) {
|
|
tt14dist++;
|
|
tt14dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "医学警戒信息收集")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "医学警戒信息收集")) {
|
|
tt17dist++;
|
|
tt17dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "产品展示")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "产品展示")) {
|
|
tt12dist++;
|
|
tt12dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "业务宣传服务")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "业务宣传服务")) {
|
|
tt13dist++;
|
|
tt13dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "POV科室会")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "POV科室会")) {
|
|
tt1dist++;
|
|
tt1dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "沙龙会")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "沙龙会")) {
|
|
tt5dist++;
|
|
tt5dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "市级学术会议")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "市级学术会议")) {
|
|
tt3dist++;
|
|
tt3dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "省级学术会议")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "省级学术会议")) {
|
|
tt4dist++;
|
|
tt4dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "线上学术会议")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "线上学术会议")) {
|
|
tt64dist++;
|
|
tt64dist++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StrUtil.equals(taskTypeName, "健康教育课堂")){
|
|
|
|
|
|
+ if (StrUtil.equals(taskTypeName, "健康教育课堂")) {
|
|
tt19dist++;
|
|
tt19dist++;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -702,6 +714,125 @@ public class WmPackageManager {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ // 审批统计
|
|
|
|
+ if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
|
+
|
|
|
|
+ int tt53checked = 0;
|
|
|
|
+ int tt52checked = 0;
|
|
|
|
+ int tt51checked = 0;
|
|
|
|
+ int tt14checked = 0;
|
|
|
|
+ int tt17checked = 0;
|
|
|
|
+ int tt12Checked = 0;
|
|
|
|
+ int tt13checked = 0;
|
|
|
|
+ int tt1checked = 0;
|
|
|
|
+ int tt5checked = 0;
|
|
|
|
+ int tt3checked = 0;
|
|
|
|
+ int tt4checked = 0;
|
|
|
|
+ int tt64checked = 0;
|
|
|
|
+ int tt19checked = 0;
|
|
|
|
+
|
|
|
|
+ for (String cPkgId : cPkgIdList) {
|
|
|
|
+ // 获取单个子包任务信息
|
|
|
|
+ List<WmTask> tasks1 = pkg2TaskListMap.get(cPkgId);
|
|
|
|
+ if (CollUtil.isEmpty(tasks1)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Integer> tIds = tasks1.stream().mapToInt(t -> Integer.parseInt(t.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ Set<Integer> collect = checkChainNodeCheckHistoryService.list(Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery()
|
|
|
|
+ .in(SysCheckChainNodeCheckHistory::getTargetId, tIds)
|
|
|
|
+ .eq(SysCheckChainNodeCheckHistory::getCheckResult, Boolean.TRUE)
|
|
|
|
+ .eq(SysCheckChainNodeCheckHistory::getNodeId, 6))
|
|
|
|
+ .stream()
|
|
|
|
+ .map(SysCheckChainNodeCheckHistory::getTargetId)
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isEmpty(collect)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (WmTask task : tasks1) {
|
|
|
|
+ Integer id = Integer.valueOf(task.getId());
|
|
|
|
+
|
|
|
|
+ if (!collect.contains(id)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String taskTypeId = task.getTaskTypeId();
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "53")) {
|
|
|
|
+ tt53checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "52")) {
|
|
|
|
+ tt52checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "51")) {
|
|
|
|
+ tt51checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "14")) {
|
|
|
|
+ tt14checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "17")) {
|
|
|
|
+ tt17checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "12")) {
|
|
|
|
+ tt12Checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "13")) {
|
|
|
|
+ tt13checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "1")) {
|
|
|
|
+ tt1checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "5")) {
|
|
|
|
+ tt5checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "3")) {
|
|
|
|
+ tt3checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "4")) {
|
|
|
|
+ tt4checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "64")) {
|
|
|
|
+ tt64checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StrUtil.equals(taskTypeId, "19")) {
|
|
|
|
+ tt19checked++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ model.setTt53checked(String.valueOf(tt53checked));
|
|
|
|
+ model.setTt52checked(String.valueOf(tt52checked));
|
|
|
|
+ model.setTt51checked(String.valueOf(tt51checked));
|
|
|
|
+ model.setTt14checked(String.valueOf(tt14checked));
|
|
|
|
+ model.setTt17checked(String.valueOf(tt17checked));
|
|
|
|
+ model.setTt12Checked(String.valueOf(tt12Checked));
|
|
|
|
+ model.setTt13checked(String.valueOf(tt13checked));
|
|
|
|
+ model.setTt1checked(String.valueOf(tt1checked));
|
|
|
|
+ model.setTt5checked(String.valueOf(tt5checked));
|
|
|
|
+ model.setTt3checked(String.valueOf(tt3checked));
|
|
|
|
+ model.setTt4checked(String.valueOf(tt4checked));
|
|
|
|
+ model.setTt64checked(String.valueOf(tt64checked));
|
|
|
|
+ model.setTt19checked(String.valueOf(tt19checked));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
return model;
|
|
return model;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
|
|