Commit 585671f6baedf70d6c7e8cfc38b5182d9cf87b40
1 parent
f24778b407
Exists in
master
and in
6 other branches
添加儿童统计-打印,数据量大,有点慢
Showing 2 changed files with 152 additions and 5 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java
View file @
585671f
... | ... | @@ -78,6 +78,24 @@ |
78 | 78 | nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request), level); |
79 | 79 | } |
80 | 80 | |
81 | + @RequestMapping(value = "/queryBabyHealthStatPrint", method = RequestMethod.GET) | |
82 | + @ResponseBody | |
83 | + @TokenRequired | |
84 | + public BaseResponse queryBabyHealthStatPrint( | |
85 | + @RequestParam(value = "checkTime", required = false) String checkTime, | |
86 | + @RequestParam(value = "queryNo", required = false) String queryNo, | |
87 | + @RequestParam(value = "startMonthAge", required = false) Integer startCheckMonthAge, | |
88 | + @RequestParam(value = "endMonthAge", required = false) Integer endCheckMonthAge, | |
89 | + @RequestParam(value = "nextDate", required = false) String nextDate, | |
90 | + @RequestParam(value = "highRisk", required = false) Integer highRisk, | |
91 | + @RequestParam(value = "waskSon", required = false) Integer waskSon, | |
92 | + @RequestParam(value = "checkDoctorId", required = false) String checkDoctorId, | |
93 | + @RequestParam(value = "level", required = false) String level, | |
94 | + Integer page, Integer limit, HttpServletRequest request) { | |
95 | + return babyHealthFacade.babystatListPrint(checkTime, queryNo, startCheckMonthAge, endCheckMonthAge, | |
96 | + nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request), level); | |
97 | + } | |
98 | + | |
81 | 99 | @RequestMapping(value = "/queryBabyHealthStatReport", method = RequestMethod.GET) |
82 | 100 | @ResponseBody |
83 | 101 | @TokenRequired |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java
View file @
585671f
... | ... | @@ -599,13 +599,13 @@ |
599 | 599 | contentFormt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); |
600 | 600 | contentFormt.setVerticalAlignment(VerticalAlignment.CENTRE); |
601 | 601 | |
602 | - int lastPage = 0, pageSize = 0; | |
602 | + int lastPage = 0, pageSize = 500; | |
603 | 603 | |
604 | 604 | pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); |
605 | -// lastPage = pageResult.getLastPage(); | |
605 | + lastPage = pageResult.getLastPage(); | |
606 | 606 | // pageSize = pageResult.getSize(); |
607 | -// for (int n = 0; n < lastPage; n++) { | |
608 | -// pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), n, pageSize); | |
607 | + for (int n = 0; n < lastPage; n++) { | |
608 | + pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), n, pageSize); | |
609 | 609 | List<BabyModel> babykModelsList = (List<BabyModel>) pageResult.getGrid(); |
610 | 610 | // PageResult pageResult=new PageResult(); |
611 | 611 | // babykModelsList = this.mongoTemplate.find(new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")),BabyModel.class); |
... | ... | @@ -886,7 +886,7 @@ |
886 | 886 | |
887 | 887 | } |
888 | 888 | |
889 | -// } | |
889 | + } | |
890 | 890 | |
891 | 891 | |
892 | 892 | book.write(); |
... | ... | @@ -994,5 +994,134 @@ |
994 | 994 | |
995 | 995 | return RespBuilder.buildSuccess(babyCheckModelList); |
996 | 996 | } |
997 | + | |
998 | + | |
999 | + public BaseResponse babystatListPrint(String checkTime, String queryNo, Integer startCheckMonthAge, Integer endCheckMonthAge, String nextDate, Integer highRisk, Integer waskSon, String checkDoctorId, Integer page, Integer limit, Integer userId, String level) { | |
1000 | + boolean flag = false; | |
1001 | + // List<String> hospital = groupsFacade.findGroupHospital(userId, false); | |
1002 | + int[] monthArr = {0, 3, 4, 8, 12, 18, 24, 30, 36, 48, 60, 72};//月龄 | |
1003 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1004 | + Criteria criteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); | |
1005 | + Criteria pCriteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); | |
1006 | + if (org.apache.commons.lang.StringUtils.isNotBlank(queryNo)) { | |
1007 | + pCriteria.orOperator(Criteria.where("mcertNo").regex(queryNo), Criteria.where("name").regex(queryNo), | |
1008 | + Criteria.where("fphone").regex(queryNo), Criteria.where("vcCardNo").regex(queryNo), Criteria.where("mname").regex(queryNo)); | |
1009 | + flag = true; | |
1010 | + } | |
1011 | + limit=100; | |
1012 | + | |
1013 | + PageResult pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
1014 | + | |
1015 | + int lastPage=pageResult.getLastPage(); | |
1016 | + | |
1017 | + List<Map<String, Object>> grid = new ArrayList<>(); | |
1018 | + | |
1019 | + for ( page = 0; page < lastPage; page++) { | |
1020 | + long ptime=System.currentTimeMillis(); | |
1021 | + pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
1022 | + | |
1023 | + List<BabyModel> babykModelsList = (List<BabyModel>) pageResult.getGrid(); | |
1024 | + | |
1025 | + List<Future> listFuture = new ArrayList<>(); | |
1026 | + | |
1027 | + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(babykModelsList)) { | |
1028 | + for (BabyModel babyModel : babykModelsList) { | |
1029 | + Map<String, Object> row = new HashMap<>(); | |
1030 | + Map<String, Object> babyMap = new HashMap<>(); | |
1031 | + babyMap.put("babyName", babyModel.getName()); | |
1032 | + babyMap.put("sex", SexEnum.getTextById(babyModel.getSex())); | |
1033 | + babyMap.put("birth", DateUtil.getyyyy_MM_dd(babyModel.getBirth())); | |
1034 | + babyMap.put("mname", babyModel.getMname()); | |
1035 | + babyMap.put("address", babyModel.getAddress()); | |
1036 | + babyMap.put("mphone", babyModel.getMphone()); | |
1037 | + row.put("baby", babyMap); | |
1038 | +// ids.add(babyModel.getId()); | |
1039 | + Criteria criteriaCheck = Criteria.where("buildId").in(babyModel.getId()); | |
1040 | +// pageResult = findMongoPage(BabyCheckModel.class, new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
1041 | + List<BabyCheckModel> babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class); | |
1042 | + | |
1043 | +// List <BabyCheckModel> babyCheckModelList = (List <BabyCheckModel>) pageResult.getGrid(); | |
1044 | + | |
1045 | + List<Map<String, Object>> listAge = new ArrayList<>(); | |
1046 | + for (BabyCheckModel babyCheckModel : babyCheckModelList) { | |
1047 | + long pctime=System.currentTimeMillis(); | |
1048 | + Map<String, Object> map = new HashMap<>(); | |
1049 | + String feedType = ""; | |
1050 | + String feedTypeId = babyCheckModel.getFeedType(); | |
1051 | + if (StringUtils.isNotEmpty(feedTypeId)) { | |
1052 | + feedType = WyTypeEnums.getNameById(Integer.parseInt(feedTypeId)); | |
1053 | + } | |
1054 | + row.put("feedType", feedType); | |
1055 | + for (int i = 0; i < monthArr.length; i++) { | |
1056 | + Map<String, Object> mapAge = new HashMap<>(); | |
1057 | + if (monthArr[i] == babyCheckModel.getCheckMonth().intValue()) { | |
1058 | + mapAge.put("height", babyCheckModel.getHeight()); | |
1059 | + mapAge.put("heightEvaluate", babyCheckModel.getHeightEvaluate()); | |
1060 | + mapAge.put("weight", babyCheckModel.getWeight()); | |
1061 | + mapAge.put("weightEvaluate", babyCheckModel.getWeightEvaluate()); | |
1062 | + mapAge.put("hemoglobin", babyCheckModel.getHemoglobin()); | |
1063 | + mapAge.put("wh", babyCheckModel.getWeight()+"/"+babyCheckModel.getHeight()); | |
1064 | + mapAge.put("whEva", ifnull(babyCheckModel.getWeightEvaluate())+"/"+ifnull(babyCheckModel.getHeightEvaluate())); | |
1065 | + } else { | |
1066 | + mapAge.put("height", ""); | |
1067 | + mapAge.put("heightEvaluate", ""); | |
1068 | + mapAge.put("weight", ""); | |
1069 | + mapAge.put("weightEvaluate", ""); | |
1070 | + mapAge.put("hemoglobin", ""); | |
1071 | + mapAge.put("wh", ""); | |
1072 | + mapAge.put("whEva", ""); | |
1073 | + } | |
1074 | + mapAge.put("age", monthArr[i]); | |
1075 | + listAge.add(mapAge); | |
1076 | + } | |
1077 | + | |
1078 | + | |
1079 | + row.put("monthChk", listAge); | |
1080 | + | |
1081 | + row.put("height", babyCheckModel.getHeight()); | |
1082 | + row.put("weight", babyCheckModel.getWeight()); | |
1083 | + //秦皇岛需求,查询最后一次检查的高危详情 | |
1084 | + row.put("qhdHighRiskInfo", babyCheckModel.getQhdHighRiskInfo()); | |
1085 | + System.out.println("pcTime="+(System.currentTimeMillis()-pctime)); | |
1086 | + } | |
1087 | + | |
1088 | +// 访视 | |
1089 | + List<NewbornVisit> newbornVisits = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyModel.getId()).and("hospitalId").in(hospitalId).and("yn").ne("0")) | |
1090 | + .with(new Sort(Sort.Direction.ASC, "checkTime")), NewbornVisit.class); | |
1091 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
1092 | + for (NewbornVisit newbornVisit : newbornVisits) { | |
1093 | + Map<String, Object> temp = new HashMap<>(); | |
1094 | + temp.put("id", newbornVisit.getId()); | |
1095 | + temp.put("hospitalId", newbornVisit.getHospitalId()); | |
1096 | + temp.put("pid", newbornVisit.getPid()); | |
1097 | + temp.put("checkTime", newbornVisit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(newbornVisit.getCheckTime())); | |
1098 | + temp.put("checkTimeDesc", newbornVisit.getCheckTimeDesc()); | |
1099 | + rest.add(temp); | |
1100 | + } | |
1101 | + row.put("visitcnt", newbornVisits.size()); | |
1102 | + row.put("instWeight", ""); | |
1103 | + if (newbornVisits.size() > 1) { | |
1104 | + int size = newbornVisits.size(); | |
1105 | + String wn1 = newbornVisits.get(size - 1).getWeightNow(); | |
1106 | + String wn2 = newbornVisits.get(size - 2).getWeightNow(); | |
1107 | + if (null == wn1) wn1 = "0"; | |
1108 | + if (null == wn2) wn2 = "0"; | |
1109 | + | |
1110 | + row.put("instWeight", (Float.parseFloat(wn1) - Float.parseFloat(wn2))); | |
1111 | + } | |
1112 | + grid.add(row); | |
1113 | + System.out.println("pTime="+(System.currentTimeMillis()-ptime)+" page="+page+" lastpage:="+lastPage); | |
1114 | + } | |
1115 | + } | |
1116 | + } | |
1117 | + | |
1118 | + | |
1119 | + pageResult.setGrid(grid); | |
1120 | + return RespBuilder.buildSuccess(pageResult); | |
1121 | + } | |
1122 | + | |
1123 | + @Autowired | |
1124 | + @Qualifier("commonThreadPool") | |
1125 | + private ThreadPoolTaskExecutor commonThreadPool; | |
997 | 1126 | } |