Commit b4b38356984b7d0734b8ee6654edb3147b1e46b3
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
b4b3835
| ... | ... | @@ -13,6 +13,8 @@ |
| 13 | 13 | import com.lyms.platform.operate.web.service.IReportService; |
| 14 | 14 | import com.lyms.platform.operate.web.utils.*; |
| 15 | 15 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| 16 | +import com.lyms.platform.permission.model.Organization; | |
| 17 | +import com.lyms.platform.permission.service.OrganizationService; | |
| 16 | 18 | import com.lyms.platform.pojo.*; |
| 17 | 19 | import com.lymsh.platform.reportdata.model.echarts.Series; |
| 18 | 20 | import org.apache.commons.collections.MapUtils; |
| ... | ... | @@ -57,6 +59,9 @@ |
| 57 | 59 | @Autowired |
| 58 | 60 | private MongoUtil mongoUtil; |
| 59 | 61 | |
| 62 | + @Autowired | |
| 63 | + private OrganizationService organizationService; | |
| 64 | + | |
| 60 | 65 | private static final Map<String, String> colorMap = new HashMap<>(); |
| 61 | 66 | |
| 62 | 67 | /** |
| ... | ... | @@ -1080,10 +1085,6 @@ |
| 1080 | 1085 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 1081 | 1086 | Set<String> patientIds = new HashSet<>(); |
| 1082 | 1087 | |
| 1083 | - /*Criteria criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) | |
| 1084 | - .lt(DateUtil.getNextYearDate(year)) | |
| 1085 | - .and("hospitalId").is(hospitalId);*/ | |
| 1086 | - | |
| 1087 | 1088 | Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("yn").nin(0); |
| 1088 | 1089 | |
| 1089 | 1090 | /** 产前检查: lyms_antexc(初诊),lyms_antex(复诊)设置pid */ |
| 1090 | 1091 | |
| 1091 | 1092 | |
| ... | ... | @@ -1140,14 +1141,22 @@ |
| 1140 | 1141 | } |
| 1141 | 1142 | |
| 1142 | 1143 | List<Patients> patients = mongoTemplate.find(Query.query(criteria), Patients.class); |
| 1144 | + Organization organization = organizationService.getOrganization(Integer.parseInt(hospitalId)); | |
| 1145 | + if(organization == null) { | |
| 1146 | + throw new IllegalStateException("机构未找到"); | |
| 1147 | + } | |
| 1148 | + String hospitalCityId = organization.getCityId(); | |
| 1149 | + BasicConfig basicConfig = mongoUtil.findBasicConfigById(hospitalCityId); | |
| 1150 | + | |
| 1143 | 1151 | ReportModel reportModel = new ReportModel(); |
| 1144 | - reportModel.setLegend(Arrays.asList("秦皇岛市", "辖区外")); | |
| 1152 | + String name = basicConfig.getName(); | |
| 1153 | + reportModel.setLegend(Arrays.asList(name, "辖区外")); | |
| 1145 | 1154 | |
| 1146 | 1155 | reportModel.setxAxis(Arrays.asList("1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月")); |
| 1147 | 1156 | |
| 1148 | 1157 | List<Map<String, Object>> mapList = mongoUtil.getListByGroup(patients); |
| 1149 | 1158 | |
| 1150 | - List<Series> series = createPatientSeries(mapList); | |
| 1159 | + List<Series> series = createPatientSeries(mapList, basicConfig.getId(), name); | |
| 1151 | 1160 | reportModel.setSeries(series); |
| 1152 | 1161 | return RespBuilder.buildSuccess("patients", mapList, "report", reportModel); |
| 1153 | 1162 | } |
| 1154 | 1163 | |
| 1155 | 1164 | |
| ... | ... | @@ -1343,17 +1352,15 @@ |
| 1343 | 1352 | }*/ |
| 1344 | 1353 | } |
| 1345 | 1354 | |
| 1346 | - private List<Series> createPatientSeries(List<Map<String, Object>> datas) { | |
| 1355 | + private List<Series> createPatientSeries(List<Map<String, Object>> datas, String cityId, String name) { | |
| 1347 | 1356 | List<Series> series = new ArrayList<>(); |
| 1348 | 1357 | |
| 1349 | 1358 | Series qhdSeries = new Series(); |
| 1350 | - qhdSeries.setName("秦皇岛市"); | |
| 1359 | + qhdSeries.setName(name); | |
| 1351 | 1360 | qhdSeries.setType("bar"); |
| 1352 | 1361 | qhdSeries.setStack("总计"); |
| 1353 | 1362 | |
| 1354 | -// String provinceId = mongoUtil.findId("河北省"); | |
| 1355 | - String provinceId = mongoUtil.findId("秦皇岛市"); | |
| 1356 | - if(StringUtils.isNotEmpty(provinceId)) { | |
| 1363 | + if(StringUtils.isNotEmpty(cityId)) { | |
| 1357 | 1364 | Map<Integer, Integer> qhdTemp = new HashMap<>();/** key = month . value = count*/ |
| 1358 | 1365 | for (int i = 1; i < 13; i++) { |
| 1359 | 1366 | qhdTemp.put(i, 0); |
| ... | ... | @@ -1364,7 +1371,7 @@ |
| 1364 | 1371 | } |
| 1365 | 1372 | for (Map<String, Object> data : datas) { |
| 1366 | 1373 | // if(provinceId.equals(data.get("province_id"))) { |
| 1367 | - if(provinceId.equals(data.get("city_id"))) { | |
| 1374 | + if(cityId.equals(data.get("city_id"))) { | |
| 1368 | 1375 | for(int i = 1; i < 13; i++) { |
| 1369 | 1376 | qhdTemp.put(i, qhdTemp.get(i) + Integer.parseInt(data.get(i + "") + "")); |
| 1370 | 1377 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
b4b3835
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | import org.springframework.data.mongodb.core.query.Criteria; |
| 13 | 13 | import org.springframework.data.mongodb.core.query.Query; |
| 14 | 14 | import org.springframework.stereotype.Component; |
| 15 | +import org.springframework.util.Assert; | |
| 15 | 16 | |
| 16 | 17 | import java.util.*; |
| 17 | 18 | |
| ... | ... | @@ -195,6 +196,11 @@ |
| 195 | 196 | } |
| 196 | 197 | } |
| 197 | 198 | return null; |
| 199 | + } | |
| 200 | + | |
| 201 | + public BasicConfig findBasicConfigById(String id) { | |
| 202 | + Assert.notNull(id, "id不能为空"); | |
| 203 | + return mongoTemplate.findById(id, BasicConfig.class); | |
| 198 | 204 | } |
| 199 | 205 | |
| 200 | 206 | } |