diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java index 854dee9..06b2992 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java @@ -285,11 +285,11 @@ public class ReportController extends BaseController { * @return */ @ResponseBody -// @TokenRequired + @TokenRequired @RequestMapping(value = "/patient", method = RequestMethod.GET) public BaseObjectResponse patient(HttpServletRequest request, String year, String provinceId, String cityId, String areaId) { -// return reportService.patient(getUserId(request), year); - return reportService.patient(2144, year, provinceId, cityId, areaId); + return reportService.patient(getUserId(request), year, provinceId, cityId, areaId); +// return reportService.patient(2144, year, provinceId, cityId, areaId); } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java index 7fc12f7..c18c8f0 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java @@ -20,9 +20,6 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.data.mongodb.core.aggregation.Aggregation; -import org.springframework.data.mongodb.core.aggregation.AggregationOperation; -import org.springframework.data.mongodb.core.aggregation.AggregationResults; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; @@ -1068,9 +1065,11 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService Set patientIds = new HashSet<>(); - Criteria criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) + /*Criteria criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) .lt(DateUtil.getNextYearDate(year)) - .and("hospitalId").is(hospitalId); + .and("hospitalId").is(hospitalId);*/ + + Criteria criteria = Criteria.where("hospitalId").is(hospitalId); /** 产前检查: lyms_antexc(初诊),lyms_antex(复诊)设置pid */ List antenatalExaminationModels = mongoUtil.findField(AntenatalExaminationModel.class, criteria, "parentId"); @@ -1108,6 +1107,10 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService patientIds.add(sieveModel.getParentId()); } + /** 增加年份条件限制 */ + criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) + .lt(DateUtil.getNextYearDate(year)) + .and("hospitalId").is(hospitalId); if(StringUtils.isNotEmpty(provinceId)) { criteria.and("provinceId").in(CollectionUtils.asList(provinceId)); } @@ -1148,7 +1151,8 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService qhdSeries.setType("bar"); qhdSeries.setStack("总计"); - String provinceId = mongoUtil.findId("河北省"); +// String provinceId = mongoUtil.findId("河北省"); + String provinceId = mongoUtil.findId("秦皇岛市"); if(StringUtils.isNotEmpty(provinceId)) { Map qhdTemp = new HashMap<>();/** key = month . value = count*/ for (int i = 1; i < 13; i++) { @@ -1159,7 +1163,8 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService otherTemp.put(i, 0); } for (Map data : datas) { - if(provinceId.equals(data.get("province_id"))) { +// if(provinceId.equals(data.get("province_id"))) { + if(provinceId.equals(data.get("city_id"))) { for(int i = 1; i < 13; i++) { qhdTemp.put(i, qhdTemp.get(i) + Integer.parseInt(data.get(i + "") + "")); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java index ee3e700..8fe4abe 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java @@ -150,99 +150,7 @@ public class MongoUtil { } tempMap.put("count", count); rest.add(tempMap); - /* List>> datas = new ArrayList<>(); - Set> entries = codeMap.entrySet(); - for (Map.Entry entry : entries) { - String key = entry.getKey(); - String id = key.split("_")[0]; - Integer month = Integer.parseInt(key.split("_")[1]); - Integer count = entry.getValue(); - boolean flag = true; - for (Map> data : datas) { - if(data.containsKey(id)) { - Map map = data.get(id); - if(map.containsKey(month)) { - map.put(month, map.get(month) + count); - } else { - map.put(month, count); - } - flag = false; - } - } - - if(flag) { - Map> tempMap = new HashMap<>(); - Map map = new HashMap<>(); - map.put(month, count); - tempMap.put(id, map); - datas.add(tempMap); - } - }*/ - - /* System.out.println("===================================== codemap ================================="); - Set> codeMapEntries = codeMap.entrySet(); - for (Map.Entry codeMapEntry : codeMapEntries) { - System.out.println(codeMapEntry.getKey() + " : " + codeMapEntry.getValue()); - } - System.out.println("===================================== datas ================================="); - for (Map> data : datas) { - Set>> set = data.entrySet(); - for (Map.Entry> mapEntry : set) { - System.out.println(mapEntry.getKey() + " : " + mapEntry.getValue()); - } - }*/ - - /*List> restMap = new ArrayList<>(); - - *//** 设置没数据的月份为0 *//* - for (Map> data : datas) { - Integer count = 0; - Set>> set = data.entrySet(); - for (Map.Entry> entry : set) { - Map map = entry.getValue(); - Map tempMap = new HashMap<>(); - for (int i = 1; i <= 12; i++) { - if(!map.containsKey(i)) { - map.put(i, 0); - tempMap.put(i + "", 0); - } else { - count += map.get(i); - tempMap.put(i + "", map.get(i)); - } - } - map.put(0, count); - tempMap.put("count", count); - tempMap.put("id", entry.getKey()); - tempMap.put("parentId", findParentId(entry.getKey())); - tempMap.put("name", findName(entry.getKey())); - restMap.add(tempMap); - } - } -*/ - - /** 处理 其他 数据 */ - /* Map tempMap = new HashMap<>(); - otherMonthMap.put("count", otherCount); - tempMap.put("name", "其他"); - tempMap.put("id", null); - tempMap.put("parentId", -1); - for (int i = 1; i <= 12; i++) { - if(otherMonthMap.containsKey(i + "")) { - tempMap.put(i + "", otherMonthMap.get(i + "")); - } else { - tempMap.put(i + "", 0); - } - } - restMap.add(tempMap);*/ - - /* for (Map> data : datas) { - System.out.println("data>>> " + data); - } - System.out.println("========================"); - for (Map map : restMap) { - System.out.println("rest>> " + map); - }*/ return rest; }