| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | |
| | | // return map; |
| | | // } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 统计任务各种状态的数量(已优化) |
| | | * 优化说明: |
| | |
| | | stringBuilder.append("入院准备中心电话:89975977。入院办理须知:https://mp.weixin.qq.com/s/OCkotuRyQ8Ld2owFF0YErw"); |
| | | |
| | | String data = MessageSend.sendMsg(stringBuilder.toString(), "6", patArchiveSrmVO.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | if (StringUtils.isNotEmpty(data) && data.contains("result=0")) { |
| | | sendError.add(patArchiveSrmVO); |
| | | if (StringUtils.isNotEmpty(data)) { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | JsonNode root = null; |
| | | try { |
| | | root = mapper.readTree(data); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String status = root.get("result").get(0).get("status").asText(); |
| | | if (status.equals("00000")) { |
| | | sendError.add(patArchiveSrmVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | allItemCounts = serviceSubtaskMapper.getSfStatisticsScriptItemDetails(serviceSubtaskCountReq); |
| | | } |
| | | |
| | | |
| | | for(ServiceSubtaskScriptCount count : allCounts){ |
| | | Map<String, ServiceSubtaskScriptCount> itemCountMap = new HashMap<>(); |
| | | if(ObjectUtils.isNotEmpty(count.getOptions())){ |
| | | String[] optionsArray = count.getOptions().split(","); |
| | | List<String> optionsList = Arrays.stream(optionsArray).map(String::valueOf).collect(Collectors.toList()); |
| | | if(ObjectUtils.isNotEmpty(optionsList)){ |
| | | //填入空白信息 |
| | | optionsList.forEach(option ->{ |
| | | ServiceSubtaskScriptCount emptyCount = new ServiceSubtaskScriptCount(); |
| | | emptyCount.setScriptContent(count.getScriptContent()); |
| | | emptyCount.setScriptType(count.getScriptType()); |
| | | emptyCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | emptyCount.setAllQuantity(count.getAllQuantity()); |
| | | emptyCount.setChosenQuantity(0); |
| | | emptyCount.setChosenPercentage("0.0"); |
| | | itemCountMap.put(option,emptyCount); |
| | | }); |
| | | //问卷加上空白选项 |
| | | if(ObjectUtils.isNotEmpty(count.getTemplateid()) |
| | | && ObjectUtils.isNotEmpty(count.getSubtaskType()) |
| | | && count.getSubtaskType().equals("2")){ |
| | | SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = new SvyTaskTemplateScriptVO(); |
| | | svyTaskTemplateScriptVO.setId(count.getScriptid()); |
| | | SvyTaskTemplateScriptVO svyTaskTemplateScriptResultVo = svyTaskTemplateScriptService.selectInfoByCondition(svyTaskTemplateScriptVO); |
| | | if(ObjectUtils.isNotEmpty(svyTaskTemplateScriptResultVo)){ |
| | | List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = svyTaskTemplateScriptResultVo.getSvyTaskTemplateTargetoptions(); |
| | | if(ObjectUtils.isNotEmpty(svyTaskTemplateTargetoptions)){ |
| | | //填入空白信息 |
| | | svyTaskTemplateTargetoptions.forEach(targetoption ->{ |
| | | ServiceSubtaskScriptCount emptyCount = new ServiceSubtaskScriptCount(); |
| | | emptyCount.setScriptid(count.getScriptid()); |
| | | emptyCount.setScriptContent(count.getScriptContent()); |
| | | emptyCount.setScriptType(count.getScriptType()); |
| | | emptyCount.setSubtaskType(count.getSubtaskType()); |
| | | emptyCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | emptyCount.setAllQuantity(count.getAllQuantity()); |
| | | emptyCount.setCompletedPercentage(count.getCompletedPercentage()); |
| | | emptyCount.setTemplateid(count.getTemplateid()); |
| | | emptyCount.setChosenQuantity(0); |
| | | emptyCount.setChosenPercentage("0.0"); |
| | | emptyCount.setOptionText(targetoption.getOptioncontent()); |
| | | itemCountMap.put(targetoption.getOptioncontent(),emptyCount); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | List<ServiceSubtaskScriptCount> itemCounts = new ArrayList<>(); |
| | | allItemCounts.forEach(itemCount ->{ |
| | | if(ObjectUtils.isNotEmpty(count.getScriptid()) && ObjectUtils.isNotEmpty(itemCount.getScriptid())){ |
| | | if(count.getScriptid().equals(itemCount.getScriptid())){ |
| | | //放入统计信息 |
| | | itemCount.setScriptContent(count.getScriptContent()); |
| | | itemCount.setScriptType(count.getScriptType()); |
| | | itemCount.setSubtaskType(count.getSubtaskType()); |
| | | itemCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | itemCount.setAllQuantity(count.getAllQuantity()); |
| | | itemCount.setCompletedPercentage(count.getCompletedPercentage()); |
| | | itemCount.setTemplateid(count.getTemplateid()); |
| | | //计算选择比例 |
| | | int chosenQuantity = ObjectUtils.isNotEmpty(itemCount.getChosenQuantity())?itemCount.getChosenQuantity():0; |
| | | int completedQuantity = itemCount.getCompletedQuantity(); |
| | |
| | | BigDecimal chosenPercentage = (new BigDecimal(chosenQuantity)).divide(new BigDecimal(completedQuantity), 2, RoundingMode.HALF_UP); |
| | | itemCount.setChosenPercentage(chosenPercentage.toString()); |
| | | } |
| | | itemCountMap.put(count.getOptionText(), itemCount); |
| | | itemCountMap.put(itemCount.getOptionText(), itemCount); |
| | | } |
| | | } |
| | | }); |
| | | itemCounts = new ArrayList<>(itemCountMap.values()); |
| | | List<ServiceSubtaskScriptCount> itemCounts = new ArrayList<>(itemCountMap.values()); |
| | | count.setDetails(itemCounts); |
| | | result.put(count.getScriptid().toString(),count); |
| | | } |