| | |
| | | private static final String AGAIN_LOCK_KEY_PREFIX = "smartor:again:lock:"; |
| | | private static final long AGAIN_LOCK_SECONDS = 30L; |
| | | |
| | | /** 缙云县人民医院机构编码 */ |
| | | private static final String JINYUN_PEOPLES_HOSPITAL_ORGID = "47246116333112211A1001"; |
| | | |
| | | /** |
| | | * 查询单一任务(随访) |
| | | * |
| | |
| | | log.info("getSfStatistics的入参为:{}", serviceSubtaskCountReq); |
| | | String drcode = "drcode"; |
| | | //缙云人民 根据经管医生分组 |
| | | if (serviceSubtaskCountReq.getOrgid().equals("47246116333112211A1001")) { |
| | | boolean jinyunHospital = JINYUN_PEOPLES_HOSPITAL_ORGID.equals(serviceSubtaskCountReq.getOrgid()); |
| | | if (jinyunHospital) { |
| | | drcode = "management_doctor_code"; |
| | | } |
| | | String groupKey = drcode; |
| | |
| | | collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown"))); |
| | | break; |
| | | } |
| | | //获取及时率统计合集 |
| | | Map<String, Map<String, Object>> jsRates = getSsRateForSfStatistics(serviceSubtaskCountReq, collect); |
| | | /* |
| | | * 缙云县人民医院的“及时率”口径是“及时随访人次 / 应随访人次”, |
| | | * 必须和同一批统计行里的 timelyFollowUp / followUpNeeded 保持一致。 |
| | | * 不能再走 selectTimelyRateBatch:该 SQL 在未传应随访时间范围时还会追加 |
| | | * visit_time < NOW(),只按出院时间统计时会把未到期任务排除在分母外, |
| | | * 导致页面上的及时率和“及时随访人次/应随访人次”对不上。 |
| | | */ |
| | | Map<String, Map<String, Object>> jsRates = jinyunHospital |
| | | ? Collections.emptyMap() |
| | | : getSsRateForSfStatistics(serviceSubtaskCountReq, collect); |
| | | for (String collectKey : collect.keySet()) { |
| | | List<ServiceSubtask> serviceSubtaskList = collect.get(collectKey); |
| | | if (CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | |
| | | if ("taskid".equals(groupKey)) { |
| | | applyTaskGroupInfo(statistic, serviceSubtaskList); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(jsRates)) { |
| | | if (jinyunHospital) { |
| | | statistic.setRate(calculateJinyunTimelyRate(statistic)); |
| | | } else if (ObjectUtils.isNotEmpty(jsRates)) { |
| | | Map<String, Object> jsRateMap = jsRates.get(collectKey); |
| | | BigDecimal jsRate = new BigDecimal("0"); |
| | | if (ObjectUtils.isNotEmpty(jsRateMap) && ObjectUtils.isNotEmpty(jsRateMap.get("rate"))) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 缙云县人民医院及时率:及时随访人次 / 应随访人次。 |
| | | * <p> |
| | | * 两者都取自同一条统计结果,保证页面上的及时率与这两列可以互相验算。 |
| | | * 应随访人次为 0 时返回 0,前端按 0.00% 展示。 |
| | | */ |
| | | private double calculateJinyunTimelyRate(ServiceSubtaskStatistic statistic) { |
| | | long followUpNeeded = nvlLong(statistic.getFollowUpNeeded()); |
| | | if (followUpNeeded <= 0) { |
| | | return 0D; |
| | | } |
| | | long timelyFollowUp = nvlLong(statistic.getTimelyFollowUp()); |
| | | return BigDecimal.valueOf(timelyFollowUp) |
| | | .divide(BigDecimal.valueOf(followUpNeeded), 4, RoundingMode.HALF_UP) |
| | | .doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * 把数据库聚合值(BigDecimal / Long / Integer 等)转成 int。 |
| | | */ |
| | | private int toIntValue(Object value) { |