| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private IvrTaskVisitResultMapper serviceTaskVisitResultMapper; |
| | | |
| | | @Autowired |
| | | private SvyTaskTemplateScriptMapper svyTaskTemplateScriptMapper; |
| | | |
| | | @Autowired |
| | | private IServiceTaskdeptService serviceTaskdeptService; |
| | |
| | | // 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | //满意度 |
| | | List<ServiceSubtaskCount> joyCountTemp = joySubCount.stream().filter(r -> r.getSubTaskId().equals(serviceSubtask.getId())).collect(Collectors.toList()); |
| | | if (joyCountTemp != null && joyCountTemp.size() > 0) { |
| | | if (ObjectUtils.isNotEmpty(joyCountTemp.get(0).getJoyCount())) |
| | | serviceSubtaskStatistic.setJoyCount(serviceSubtaskStatistic.getJoyCount() + joyCountTemp.get(0).getJoyCount()); |
| | | if (ObjectUtils.isNotEmpty(joyCountTemp.get(0).getJoyAllCount())) |
| | | serviceSubtaskStatistic.setJoyAllCount(serviceSubtaskStatistic.getJoyAllCount() + joyCountTemp.get(0).getJoyAllCount()); |
| | | Integer joyCount = joyCountTemp.get(0).getJoyCount(); |
| | | Integer joyAllCount = joyCountTemp.get(0).getJoyAllCount(); |
| | | if (ObjectUtils.isNotEmpty(joyCount)){ |
| | | if(joyCount>0){ |
| | | serviceSubtaskStatistic.setJoyCount(serviceSubtaskStatistic.getJoyCount() + joyCount); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(joyAllCount)){ |
| | | if(joyAllCount>0){ |
| | | serviceSubtaskStatistic.setJoyAllCount(serviceSubtaskStatistic.getJoyAllCount() + joyAllCount); |
| | | } |
| | | } |
| | | } |
| | | //无需随访人次 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) { |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Cacheable(value = "sfStatisticsJoy", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()") |
| | | // @Cacheable(value = "sfStatisticsJoy", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()") |
| | | public List<ServiceSubtaskStatistic> getSfStatisticsScript(ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | log.error("getSfStatisticsScript的入参为:{}", serviceSubtaskCountReq); |
| | | List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>(); |
| | |
| | | BigDecimal mydtblsum = new BigDecimal(0); |
| | | //完成比例 |
| | | Double wcbl = null; |
| | | if(ObjectUtils.isNotEmpty(serviceSubtaskStatistic.getJoyAllCount())){ |
| | | mydtblsum = new BigDecimal(serviceSubtaskStatistic.getJoyAllCount()); |
| | | } |
| | | |
| | | //满意度填报量 |
| | | if(ObjectUtils.isNotEmpty(serviceSubtaskStatistic.getJoyCount())){ |
| | | mydtmzlsum = new BigDecimal(serviceSubtaskStatistic.getJoyCount()); |
| | | mydtblsum = new BigDecimal(serviceSubtaskStatistic.getJoyCount()); |
| | | } |
| | | //满意度题目总量 |
| | | if(ObjectUtils.isNotEmpty(serviceSubtaskStatistic.getJoyAllCount())){ |
| | | mydtmzlsum = new BigDecimal(serviceSubtaskStatistic.getJoyAllCount()); |
| | | } |
| | | if(mydtmzlsum.intValue() != 0){ |
| | | wcbl = mydtblsum.divide(mydtmzlsum, 2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | serviceSubtaskStatistic.setJoyAllCount(mydtmzlsum.intValue()); |
| | | serviceSubtaskStatistic.setJoyCount(mydtblsum.intValue()); |
| | | serviceSubtaskStatistic.setJoyAllCount(mydtmzlsum.intValue()); |
| | | serviceSubtaskStatistic.setJoyTotal(wcbl); |
| | | } |
| | | } |
| | |
| | | Map<String, ServiceSubtaskScriptCount> result = new HashMap<>(); |
| | | List<ServiceSubtaskScriptCount> allCounts = new ArrayList<>(); |
| | | List<ServiceSubtaskScriptCount> allItemCounts = new ArrayList<>(); |
| | | |
| | | List<ServiceSubtaskScriptCount> emptyCounts = svyTaskTemplateScriptMapper.getSvyTemplateScriptListForSubtaskCount(serviceSubtaskCountReq); |
| | | if(ObjectUtils.isNotEmpty(emptyCounts)){ |
| | | Map<Long, List<ServiceSubtaskScriptCount>> emptyCountMap = emptyCounts.stream().collect(Collectors.groupingBy(ServiceSubtaskScriptCount::getScriptid)); |
| | | for (Map.Entry<Long, List<ServiceSubtaskScriptCount>> entry : emptyCountMap.entrySet()) { |
| | | Long eScriptId = entry.getKey(); |
| | | if(ObjectUtils.isNotEmpty(eScriptId)){ |
| | | ServiceSubtaskScriptCount eCount = new ServiceSubtaskScriptCount(); |
| | | List<ServiceSubtaskScriptCount> emptyCountList = entry.getValue(); |
| | | Map<String, ServiceSubtaskScriptCount> eMap = new HashMap<>(); |
| | | if(ObjectUtils.isNotEmpty(emptyCountList)){ |
| | | eCount.setScriptid(eScriptId); |
| | | eCount.setScriptType(emptyCountList.get(0).getScriptType()); |
| | | eCount.setScriptContent(emptyCountList.get(0).getScriptContent()); |
| | | eCount.setTemplateid(emptyCountList.get(0).getTemplateid()); |
| | | eCount.setChosenQuantity(0); |
| | | eCount.setChosenPercentage("0.0"); |
| | | eCount.setCompletedQuantity(0); |
| | | eCount.setCompletedPercentage("0.0"); |
| | | eCount.setAllQuantity(0); |
| | | //填空空数据 |
| | | for(ServiceSubtaskScriptCount empCount: emptyCountList){ |
| | | empCount.setChosenQuantity(0); |
| | | empCount.setChosenPercentage("0.0"); |
| | | empCount.setCompletedQuantity(0); |
| | | empCount.setCompletedPercentage("0.0"); |
| | | empCount.setAllQuantity(0); |
| | | eMap.put(empCount.getOptionText(),eCount); |
| | | } |
| | | } |
| | | List<ServiceSubtaskScriptCount> empCountList = new ArrayList<>(eMap.values()); |
| | | eCount.setDetails(empCountList); |
| | | result.put(eScriptId.toString(),eCount); |
| | | } |
| | | } |
| | | } |
| | | |
| | | String type = serviceSubtaskCountReq.getType(); |
| | | if(ObjectUtils.isEmpty(type)){ |
| | | //查询语音统计明细 |
| | |
| | | |
| | | for(ServiceSubtaskScriptCount count : allCounts){ |
| | | Map<String, ServiceSubtaskScriptCount> itemCountMap = new HashMap<>(); |
| | | if(ObjectUtils.isNotEmpty(count.getTemplateid())){ |
| | | SvyTaskTemplateVO svyTaskTemplateVO = new SvyTaskTemplateVO(); |
| | | svyTaskTemplateVO.setId(count.getTemplateid()); |
| | | SvyTaskTemplateVO svyTaskTemplateResultVo = svyTaskTemplateService.selectInfoByCondition(svyTaskTemplateVO); |
| | | if(ObjectUtils.isNotEmpty(svyTaskTemplateResultVo)){ |
| | | List<SvyTaskTemplateScriptVO> templateScriptVOS = svyTaskTemplateResultVo.getSvyTaskTemplateScriptVOS(); |
| | | if(ObjectUtils.isNotEmpty(templateScriptVOS)){ |
| | | //问卷加上空白选项 |
| | | if(ObjectUtils.isNotEmpty(count.getTemplateid()) |
| | | && ObjectUtils.isNotEmpty(count.getSubtaskType()) |
| | | && count.getSubtaskType().equals("2")){ |
| | | SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = new SvyTaskTemplateScriptVO(); |
| | | svyTaskTemplateScriptVO.setId(count.getScriptid()); |
| | | svyTaskTemplateScriptVO.setOrgid(serviceSubtaskCountReq.getOrgid()); |
| | | SvyTaskTemplateScriptVO svyTaskTemplateScriptResultVo = svyTaskTemplateScriptService.selectInfoByCondition(svyTaskTemplateScriptVO); |
| | | if(ObjectUtils.isNotEmpty(svyTaskTemplateScriptResultVo)){ |
| | | List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = svyTaskTemplateScriptResultVo.getSvyTaskTemplateTargetoptions(); |
| | | if(ObjectUtils.isNotEmpty(svyTaskTemplateTargetoptions)){ |
| | | //填入空白信息 |
| | | templateScriptVOS.forEach(templateScriptVO ->{ |
| | | 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"); |
| | | itemCountMap.put(templateScriptVO.getScriptResult(),emptyCount); |
| | | emptyCount.setOptionText(targetoption.getOptioncontent()); |
| | | itemCountMap.put(targetoption.getOptioncontent(),emptyCount); |
| | | }); |
| | | } |
| | | } |
| | |
| | | //放入统计信息 |
| | | 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); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | List<ServiceSubtaskScriptCount> itemCounts = new ArrayList<>(itemCountMap.values()); |
| | | count.setDetails(itemCounts); |
| | | result.put(count.getScriptid().toString(),count); |