From 10f7e81e88cdaff97e538d9e6408747b1b2d99ee Mon Sep 17 00:00:00 2001 From: wangbo <184677810@qq.com> Date: Sun, 28 Apr 2019 12:18:10 +0800 Subject: [PATCH] update --- .../web/controller/annualReportController.java | 6 +-- .../operate/web/facade/annualReportFacade.java | 61 +++++++++++++++------- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java index bc1a86a..50dd8d5 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java @@ -29,13 +29,13 @@ public class annualReportController extends BaseController { @RequestMapping(value = "/annualReport", method = RequestMethod.GET) public void queryAnnualReport(HttpServletRequest request, @RequestParam(required = false) String time, - @RequestParam(required = false) String proviceId, + @RequestParam(required = false) String provinceId, @RequestParam(required = false) String cityId, HttpServletResponse httpServletResponse) { - if (StringUtils.isEmpty(proviceId) && StringUtils.isEmpty(cityId) && StringUtils.isEmpty(time)) { + if (StringUtils.isEmpty(provinceId) && StringUtils.isEmpty(cityId) && StringUtils.isEmpty(time)) { return; } - annualReportFacade.queryAnnualReport(getUserId(request), time, proviceId, cityId, httpServletResponse); + annualReportFacade.queryAnnualReport(getUserId(request), time, provinceId, cityId, httpServletResponse); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/annualReportFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/annualReportFacade.java index 79dc999..f72939f 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/annualReportFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/annualReportFacade.java @@ -73,7 +73,7 @@ public class annualReportFacade { @Autowired private MongoTemplate mongoTemplate; - public void queryAnnualReport(Integer userId, String time, String proviceId, String cityId, HttpServletResponse httpServletResponse) { + public void queryAnnualReport(Integer userId, String time, String provinceId, String cityId, HttpServletResponse httpServletResponse) { //本市户籍 BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); @@ -90,14 +90,19 @@ public class annualReportFacade { listArea.add(basicConfig.getId()); } } + + try { Map> map = new HashMap<>(); for (String area : listArea) { - List hospitalIds = this.getCurrentUserHospPermissions(userId, proviceId, cityId, area); + List hospitalIds = this.getCurrentUserHospPermissions(userId, provinceId, cityId, area); map.put(area, hospitalIds); } + List> mapList = this.getDates(map, organizationService, time, babyService, matDeliverService, antExRecordService, antenatalExaminationService, sieveService, matDeliverFollowService, patientsService, mongoTemplate); + + System.out.println(mapList); this.sum(mapList); httpServletResponse.setContentType("application/force-download"); httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("年报表.xls").getBytes("UTF-8"), "ISO-8859-1")); @@ -213,8 +218,8 @@ public class annualReportFacade { int bigBoyCount = 0;//巨大儿人数 int zcBabyCount = 0;//早产儿数 int babySiChanSiTaiCount = 0;//死胎人数 - - + int patientCount = 0;// + int babyCount = 0;//产儿总数 if (CollectionUtils.isNotEmpty(list)) { for (Map map : list) { huoChanCount += Integer.parseInt(map.get("huoChanCount")); //分娩方式 剖宫产 @@ -251,8 +256,8 @@ public class annualReportFacade { bigBoyCount += Integer.parseInt(map.get("bigBoyCount")); zcBabyCount += Integer.parseInt(map.get("zcBabyCount")); babySiChanSiTaiCount += Integer.parseInt(map.get("babySiChanSiTaiCount")); - - + patientCount += Integer.parseInt(map.get("patientCount")); + babyCount += Integer.parseInt(map.get("babyCount")); } } Map totalMap = new LinkedHashMap<>(); @@ -265,7 +270,7 @@ public class annualReportFacade { totalMap.put("maternalCount", String.valueOf(maternalCount)); totalMap.put("maternalPercent", this.division(maternalCount, chanCount)); totalMap.put("antexCount", String.valueOf(antexCount)); - totalMap.put("antexPercent", this.division(antexCount, antexCount)); + totalMap.put("antexPercent", this.division(antexCount, patientCount)); totalMap.put("fiveCount", String.valueOf(fiveCount)); totalMap.put("fivePercent", this.division(fiveCount, antexCount)); totalMap.put("antexcCout", String.valueOf(antexcCout)); @@ -274,9 +279,9 @@ public class annualReportFacade { totalMap.put("hemoglobinCount", String.valueOf(hemoglobinCount)); totalMap.put("hemoglobinPervent", this.division(hemoglobinCount, hemoglobin)); totalMap.put("hivCount", String.valueOf(hivCount)); - totalMap.put("hivPervent", this.division(hivCount, chanCount)); + totalMap.put("hivPervent", this.division(hivCount, antexCount)); totalMap.put("hivYang", String.valueOf(hivYang)); - totalMap.put("hivYangPervent", this.division(hivYang, chanCount)); + totalMap.put("hivYangPervent", String.valueOf((double) hivYang != 0.0 ? (double) hivYang / 100000 : 0.0)); totalMap.put("veroleCount", String.valueOf(veroleCount)); totalMap.put("verolePervent", this.division(veroleCount, chanCount)); totalMap.put("veroleYang", String.valueOf(veroleYang)); @@ -298,11 +303,11 @@ public class annualReportFacade { totalMap.put("gravidaCount", String.valueOf(gravidaCount)); totalMap.put("gravidaPervent", this.division(gravidaCount, chanCount)); totalMap.put("fmZuYuanCount", String.valueOf(fmZuYuanCount)); - totalMap.put("fmZuYuanPervent", "最后处理"); + totalMap.put("fmZuYuanPervent", this.division(fmZuYuanCount, babyCount)); totalMap.put("fmPoGongCount", String.valueOf(fmPoGongCount)); - totalMap.put("fmPogongPervent", "后面处理"); + totalMap.put("fmPogongPervent", this.division(fmPoGongCount, babyCount)); totalMap.put("killCount", String.valueOf(killCount)); - Double killPervent = killCount != 0 ? killCount / 100000 : 0.0; + Double killPervent = (double) killCount != 0.0 ? (double) killCount / 100000 : 0; totalMap.put("killPervent", String.valueOf(killPervent)); totalMap.put("chuXueCount", String.valueOf(chuXueCount)); totalMap.put("chuXuePervent", this.division(chuXueCount, chanCount)); @@ -401,6 +406,17 @@ public class annualReportFacade { map.put("maternalCount", String.valueOf(chanCount)); //产妇建卡 百分比 map.put("maternalPercent", this.division(chanCount, chanCount)); + + //获取所有建档人数 + PatientsQuery patientsQuerys = new PatientsQuery(); + patientsQuerys.setYn(YnEnums.YES.getId()); + if (StringUtils.isNotEmpty(time)) { + patientsQuerys.setCreatedTimeStart(DateUtil.getSNDate(time)[0]); + patientsQuerys.setCreatedTimeEnd(DateUtil.getSNDate(time)[1]); + } + patientsQuerys.setHospitalList(entry.getValue()); + int patientCount = patientsService.queryPatientCount(patientsQuerys); + //产检 人数 AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); if (StringUtils.isNotEmpty(time)) { @@ -416,7 +432,7 @@ public class annualReportFacade { count.add(antExRecord.getParentId()); } map.put("antexCount", String.valueOf(antexMap.size())); - map.put("antexPercent", this.division(antexMap.size(), chanCount)); + map.put("antexPercent", this.division(antexMap.size(), patientCount)); //产检>=5次 Map maps = new HashMap<>(); for (String string : count) { @@ -514,7 +530,7 @@ public class annualReportFacade { int hiv = antenatalExaminationService.queryAntExChuCount(antExChuQuery.convertToQuery()); map.put("hivYang", String.valueOf(hiv)); //感染人数的10万分之1 - map.put("hivYangPervent", String.valueOf(hiv != 0 ? hiv / 100000 : 0)); + map.put("hivYangPervent", String.valueOf((double) hiv != 0.0 ? hiv / 100000 : 0)); //产妇梅毒检测人数 AntExChuQuery veroleChuQuery1 = new AntExChuQuery(); @@ -690,7 +706,7 @@ public class annualReportFacade { matDeliverKillQuery.setMaternalInfo("2"); int killCount = matDeliverService.count(matDeliverKillQuery); map.put("killCount", String.valueOf(killCount)); - Double s = killCount != 0 ? killCount / 100000 : 0.0; + Double s = (double) killCount != 0.0 ? (double) killCount / 100000 : 0; map.put("killPervent", String.valueOf(s)); //产科出血人数 @@ -866,6 +882,10 @@ public class annualReportFacade { } babySiWangList.clear(); map.put("babySiChanSiTaiCount", String.valueOf(babySiChanCount + babySiTaiCount)); + + map.put("patientCount", String.valueOf(patientCount)); + map.put("babyCount", String.valueOf(babyCount)); + list.add(map); } @@ -895,9 +915,14 @@ public class annualReportFacade { } public static void main(String[] args) { - int s = 12; - int d = s != 0 ? s / 1 : 0; - System.out.println(d); + double s = 12; + double d; + if (s != 0.0) { + d = s / 10000; + System.out.println(d); + } + } + } -- 1.8.3.1