|
@@ -636,39 +636,180 @@ public class ApiController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ Map<String, Object> connfigMap = getTaskContentConfigByTaskTypeIdByShareId(taskTypeId);
|
|
|
+ return R.ok(connfigMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> getTaskContentConfigByTaskTypeIdByShareId(String taskTypeId) {
|
|
|
Map<String, Object> connfigMap = new LinkedHashMap<>();
|
|
|
Map<String, Object> dictMap = new LinkedHashMap<>();
|
|
|
|
|
|
- WmTaskContentConfig queryConn = new WmTaskContentConfig();
|
|
|
- // 应收账款回款-A类/应收账款回款-B类/应收账款回款-C类 统一设置为 39(应收账款回款-A类)
|
|
|
- if ("39".equals(taskTypeId) || "40".equals(taskTypeId) || "41".equals(taskTypeId)) {
|
|
|
- taskTypeId = "39";
|
|
|
- } else if ("42".equals(taskTypeId) || "43".equals(taskTypeId) || "44".equals(taskTypeId)) {
|
|
|
- // 手术跟台-一级/手术跟台-二级/手术跟台-三级 都取42
|
|
|
- taskTypeId = "42";
|
|
|
- } else if ("47".equals(taskTypeId) || "48".equals(taskTypeId) || "49".equals(taskTypeId) || "50".equals(taskTypeId)) {
|
|
|
- // 库存调研、竞品调研、培训、使用情况调查
|
|
|
- taskTypeId = "47";
|
|
|
- } else if ("51".equals(taskTypeId) || "52".equals(taskTypeId) || "53".equals(taskTypeId)) {
|
|
|
- // 信用管理A、信用管理B、信用管理C
|
|
|
- taskTypeId = "51";
|
|
|
- }
|
|
|
-
|
|
|
- queryConn.setTaskTypeId(taskTypeId);
|
|
|
- queryConn.setDelFlag("0");
|
|
|
- queryConn.setEnableFlag("0");
|
|
|
+ List<WmTaskContentConfig> listConfig = wmTaskContentConfigService.list(Wrappers.<WmTaskContentConfig>lambdaQuery()
|
|
|
+ .eq(WmTaskContentConfig::getDelFlag, CommonConstants.STATUS_NORMAL)
|
|
|
+ .eq(WmTaskContentConfig::getEnableFlag, CommonConstants.STATUS_NORMAL)
|
|
|
+ .eq(WmTaskContentConfig::getTaskTypeId, taskTypeId)
|
|
|
+ .orderByAsc(WmTaskContentConfig::getSeq));
|
|
|
|
|
|
- List<WmTaskContentConfig> listConfig =
|
|
|
- wmTaskContentConfigService.list(new QueryWrapper<>(queryConn).orderByAsc("seq", "id"));
|
|
|
- for (WmTaskContentConfig config :
|
|
|
- listConfig) {
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ for (WmTaskContentConfig config : listConfig) {
|
|
|
if ("select".equals(config.getTaskFiledType().trim())) {
|
|
|
- SysDictItem sysDictItemConn = new SysDictItem();
|
|
|
- sysDictItemConn.setType(config.getDictGroupName());
|
|
|
- List<SysDictItem> dictItems = sysDictItemService.list(new QueryWrapper<>(sysDictItemConn));
|
|
|
+ List<SysDictItem> dictItems = sysDictItemService.list(Wrappers.<SysDictItem>lambdaQuery().eq(SysDictItem::getType, config.getDictGroupName()));
|
|
|
dictMap.put(config.getDictGroupName(), dictItems);
|
|
|
}
|
|
|
|
|
|
+ if ("tree".equals(config.getTaskFiledType())) {
|
|
|
+ if ("package_tree".equals(config.getDictGroupName())) {
|
|
|
+ // 查询可以关联的积分包
|
|
|
+ List<Map<String, Object>> listMap;
|
|
|
+ if (user != null) {
|
|
|
+ List<WmScorePackageStatus> statusList = wmScorePackageStatusService.list(
|
|
|
+ Wrappers.<WmScorePackageStatus>lambdaQuery().eq(WmScorePackageStatus::getUserId, user.getId().toString())
|
|
|
+ .eq(WmScorePackageStatus::getStatus, "2")
|
|
|
+ .eq(WmScorePackageStatus::getTaskAddFlag, "1")
|
|
|
+ .eq(WmScorePackageStatus::getDelFlag, CommonConstants.STATUS_NORMAL)
|
|
|
+ .eq(WmScorePackageStatus::getEnableFlag, CommonConstants.STATUS_NORMAL));
|
|
|
+
|
|
|
+ log.info("score_pkg_status:<--{}-->", statusList);
|
|
|
+ if (CollUtil.isNotEmpty(statusList)) {
|
|
|
+ Set<String> scoreIds = statusList.stream().map(WmScorePackageStatus::getPackageId).collect(Collectors.toSet());
|
|
|
+ // 批量查询积分包
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ log.info("score_pkg_ids:<--{}-->, start_time:<--{}-->", scoreIds, now);
|
|
|
+ // List<WmScorePackage> wmScorePackages = wmScorePackageService.listByIds(scoreIds);
|
|
|
+ List<WmScorePackage> wmScorePackages = wmScorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ .le(WmScorePackage::getStartTime, now)
|
|
|
+ .in(WmScorePackage::getId, scoreIds));
|
|
|
+ log.info("score_pkgs:<--{}-->", wmScorePackages);
|
|
|
+ Map<String, WmScorePackage> scorePackageMap = wmScorePackages.stream().collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
|
|
|
+ // 批量查询scoreTaskType
|
|
|
+ log.info("score_package_map:<--{}-->", scorePackageMap);
|
|
|
+ List<Map<String, Object>> scoreTaskTypeCountList = wmScoreTaskTypeMapper.countByScoreId(taskTypeId, scoreIds);
|
|
|
+ log.info("score_task_type_count_list:<--{}-->", scoreTaskTypeCountList);
|
|
|
+ Map<String, Integer> scoreTaskTypeCountMap = new LinkedHashMap<>();
|
|
|
+ String pkgId = "-10";
|
|
|
+ String count = "0";
|
|
|
+ for (Map<String, Object> map : scoreTaskTypeCountList) {
|
|
|
+ for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
|
+ Object value = entry.getValue();
|
|
|
+ String key = entry.getKey();
|
|
|
+
|
|
|
+
|
|
|
+ log.info("value:<--{}-->", value);
|
|
|
+ if (Objects.nonNull(value) || !"null".equals(value.toString())) {
|
|
|
+ if ("score_id".equals(key)) {
|
|
|
+ pkgId = value.toString();
|
|
|
+ }
|
|
|
+ if ("COUNT".equalsIgnoreCase(key)) {
|
|
|
+ count = value.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("pkg_id:{}, count:{}", pkgId, count);
|
|
|
+ scoreTaskTypeCountMap.put(pkgId, Integer.valueOf(count));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("score_task_type_count_map:<--{}-->", scoreTaskTypeCountMap);
|
|
|
+ listMap = new ArrayList<>(statusList.size());
|
|
|
+ for (WmScorePackageStatus item : statusList) {
|
|
|
+ WmScorePackage wmScorePackage = scorePackageMap.get(item.getPackageId());
|
|
|
+ if (null != wmScorePackage) {
|
|
|
+ if ("0".equals(wmScorePackage.getTaskAddFlag())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if ("1".equals(wmScorePackage.getEnableFlag())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (PackageTypeEnum.TYPE2_SETTLE_PACKAGE.val().equals(wmScorePackage.getPackageType2()) && !PackageTypeEnum.TYPE1_SCORE_AND_TASK_PACKAGE.val().equals(wmScorePackage.getPackageType1())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (LocalDate.now().isAfter(wmScorePackage.getEndTime())) {
|
|
|
+ // 过截止日期的过滤掉
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("28".equals(taskTypeId)) {
|
|
|
+ if ("3".equals(wmScorePackage.getPackageType1())) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("label", wmScorePackage.getScorePackageName());
|
|
|
+ map.put("value", wmScorePackage.getId());
|
|
|
+ String drugProducer = ArrayUtils.isEmpty(wmScorePackage.getDrugProducerList()) ? "" : String.join(StrPool.COMMA, wmScorePackage.getDrugProducerList());
|
|
|
+ map.put("drugProducer", drugProducer);
|
|
|
+ listMap.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if ("3".equals(wmScorePackage.getPackageType1())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 过滤有效任务类型
|
|
|
+ WmScoreTaskType taskType = new WmScoreTaskType();
|
|
|
+ taskType.setTaskTypeId(taskTypeId);
|
|
|
+ taskType.setScoreId(wmScorePackage.getId());
|
|
|
+
|
|
|
+ int total = scoreTaskTypeCountMap.getOrDefault(wmScorePackage.getId(), 0);
|
|
|
+ log.info("total:<{}>", total);
|
|
|
+ if (total != 0) {
|
|
|
+ Map<String, Object> map = new HashMap<>(5);
|
|
|
+ map.put("label", wmScorePackage.getScorePackageName());
|
|
|
+ map.put("value", wmScorePackage.getId());
|
|
|
+ String drugProducer = ArrayUtils.isEmpty(wmScorePackage.getDrugProducerList()) ? "" : String.join(StrPool.COMMA, wmScorePackage.getDrugProducerList());
|
|
|
+ map.put("drugProducer", drugProducer);
|
|
|
+
|
|
|
+ List<String> drugIds = Arrays.stream(wmScorePackage.getDrugtable()).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ map.put("drugTableIds", drugIds);
|
|
|
+
|
|
|
+ List<Integer> pkgQuizIds = new LinkedList<>();
|
|
|
+ if (ArrayUtil.isNotEmpty(drugIds)) {
|
|
|
+
|
|
|
+ // 获取药品绑定的试卷
|
|
|
+ List<WmDrugQuizRelation> relations = drugQuizRelationService.list(Wrappers.<WmDrugQuizRelation>lambdaQuery().in(WmDrugQuizRelation::getDrugId, drugIds));
|
|
|
+
|
|
|
+ Map<Integer, List<WmDrugQuizRelation>> drugIdToQuizzes = relations.stream().collect(Collectors.groupingBy(WmDrugQuizRelation::getDrugId));
|
|
|
+
|
|
|
+
|
|
|
+ List<WmDaDrugEntDrugtable> drugtables = wmDaDrugEntDrugtableService.list(Wrappers.<WmDaDrugEntDrugtable>lambdaQuery().in(WmDaDrugEntDrugtable::getId, drugIds));
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(drugtables)) {
|
|
|
+ List<Map<String, Object>> drugMap = drugtables.stream().map(drug -> {
|
|
|
+ Map<String, Object> res = new HashMap<>(3);
|
|
|
+ res.put("drugId", drug.getId());
|
|
|
+ res.put("drugName", drug.getDrugname());
|
|
|
+ res.put("drugPordName", drug.getDrugnameTy());
|
|
|
+ List<WmDrugQuizRelation> quizRelations = drugIdToQuizzes.get(Integer.valueOf(drug.getId()));
|
|
|
+ List<Integer> quizIds = CollUtil.isEmpty(quizRelations) ? Collections.emptyList() : quizRelations.stream().mapToInt(WmDrugQuizRelation::getQuizId).boxed().distinct().collect(Collectors.toList());
|
|
|
+ res.put("quizIds", quizIds);
|
|
|
+ pkgQuizIds.addAll(quizIds);
|
|
|
+ return res;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ map.put("drugTable", drugMap);
|
|
|
+ } else {
|
|
|
+ map.put("drugTable", Collections.emptyMap());
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ map.put("drugTable", Collections.emptyMap());
|
|
|
+ }
|
|
|
+ map.put("pkgQuizIds", pkgQuizIds);
|
|
|
+
|
|
|
+ listMap.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ listMap = Collections.emptyList();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ listMap = Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ dictMap.put(config.getDictGroupName(), listMap);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ("domain".equals(config.getTaskFiledType().trim())) {
|
|
|
if ("ent_service".equals(config.getDictGroupName())) {
|
|
|
List<WmDaDrugEnt> wmDaDrugEnts;
|
|
@@ -782,7 +923,7 @@ public class ApiController {
|
|
|
|
|
|
connfigMap.put("config", listConfig);
|
|
|
connfigMap.put("dict", dictMap);
|
|
|
- return R.ok(connfigMap);
|
|
|
+ return connfigMap;
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getDeptBuildName/{deptId}")
|