Commit 6849dd8f4ce5001c5ebb96f50d93d976c4133957
1 parent
64080dc2f2
Exists in
master
and in
6 other branches
优化部分逻辑
Showing 1 changed file with 12 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
6849dd8
| ... | ... | @@ -1610,12 +1610,16 @@ |
| 1610 | 1610 | executorService.shutdown(); |
| 1611 | 1611 | |
| 1612 | 1612 | List<String> usedIds = getNeedUsedIds(patients, antExChuModels, antenatalExaminationModels, maternalDeliverModels, deliverModels, postReviewModels); |
| 1613 | + | |
| 1614 | + Map<String, String> hospitalNameCache = new HashMap<>(); | |
| 1615 | + Map<String, String> doctorNameCacheMap = new HashMap<>(); | |
| 1616 | + Map<String, Map<String, Object>> hospitalInfoCacheMap = new HashMap<>(); | |
| 1617 | + | |
| 1613 | 1618 | List<Map<String, Object>> restList = new ArrayList<>(); |
| 1614 | 1619 | if(CollectionUtils.isNotEmpty(usedIds)) { |
| 1615 | 1620 | List<String> list = couponMapper.findUsededId(usedIds); |
| 1616 | 1621 | usedIds.removeAll(list); |
| 1617 | 1622 | |
| 1618 | - Map<String, String> hospitalNameCache = new HashMap<>(); | |
| 1619 | 1623 | for (String hid : hids) { |
| 1620 | 1624 | boolean flag = false; |
| 1621 | 1625 | Set<String> unUsedIds = new HashSet<>(); // 未使用优惠券patientid |
| ... | ... | @@ -1636,7 +1640,6 @@ |
| 1636 | 1640 | } else { |
| 1637 | 1641 | map.put("week", DateUtil.getWeekDesc(p.getLastMenses(), new Date())); |
| 1638 | 1642 | } |
| 1639 | - Map<String, String> doctorNameCacheMap = new HashMap<>(); | |
| 1640 | 1643 | String doctorName = doctorNameCacheMap.get(p.getBookbuildingDoctor()); |
| 1641 | 1644 | if(StringUtils.isEmpty(doctorName)) { |
| 1642 | 1645 | doctorName = couponMapper.getUserName(p.getBookbuildingDoctor()); |
| ... | ... | @@ -1656,7 +1659,13 @@ |
| 1656 | 1659 | |
| 1657 | 1660 | } |
| 1658 | 1661 | if(flag) { |
| 1659 | - Map<String, Object> hospitalInfo = couponMapper.findHospitalInfoById(hid); | |
| 1662 | + Map<String, Object> hospitalInfo = hospitalInfoCacheMap.get(hid); | |
| 1663 | + if(MapUtils.isEmpty(hospitalInfo)) { | |
| 1664 | + hospitalInfo = couponMapper.findHospitalInfoById(hid); | |
| 1665 | + hospitalInfoCacheMap.put(hid, hospitalInfo); | |
| 1666 | + } | |
| 1667 | + | |
| 1668 | +// Map<String, Object> hospitalInfo = couponMapper.findHospitalInfoById(hid); | |
| 1660 | 1669 | hospitalInfo.put("cityName", findName(hospitalInfo.get("city_id"))); |
| 1661 | 1670 | hospitalInfo.put("areaName", findName(hospitalInfo.get("area_id"))); |
| 1662 | 1671 | hospitalInfo.put("un_used_coupons", un_used_coupons); |