diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java index 843f5f5..ba64ff4 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java @@ -78,6 +78,24 @@ public class BabyHealthController extends BaseController { nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request), level); } + @RequestMapping(value = "/queryBabyHealthStatPrint", method = RequestMethod.GET) + @ResponseBody + @TokenRequired + public BaseResponse queryBabyHealthStatPrint( + @RequestParam(value = "checkTime", required = false) String checkTime, + @RequestParam(value = "queryNo", required = false) String queryNo, + @RequestParam(value = "startMonthAge", required = false) Integer startCheckMonthAge, + @RequestParam(value = "endMonthAge", required = false) Integer endCheckMonthAge, + @RequestParam(value = "nextDate", required = false) String nextDate, + @RequestParam(value = "highRisk", required = false) Integer highRisk, + @RequestParam(value = "waskSon", required = false) Integer waskSon, + @RequestParam(value = "checkDoctorId", required = false) String checkDoctorId, + @RequestParam(value = "level", required = false) String level, + Integer page, Integer limit, HttpServletRequest request) { + return babyHealthFacade.babystatListPrint(checkTime, queryNo, startCheckMonthAge, endCheckMonthAge, + nextDate, highRisk, waskSon, checkDoctorId, page, limit, getUserId(request), level); + } + @RequestMapping(value = "/queryBabyHealthStatReport", method = RequestMethod.GET) @ResponseBody @TokenRequired diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java index 057296d..687f2c7 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java @@ -599,13 +599,13 @@ public class BabyHealthFacade extends BaseServiceImpl { contentFormt.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); contentFormt.setVerticalAlignment(VerticalAlignment.CENTRE); - int lastPage = 0, pageSize = 0; + int lastPage = 0, pageSize = 500; pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); -// lastPage = pageResult.getLastPage(); + lastPage = pageResult.getLastPage(); // pageSize = pageResult.getSize(); -// for (int n = 0; n < lastPage; n++) { -// pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), n, pageSize); + for (int n = 0; n < lastPage; n++) { + pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), n, pageSize); List babykModelsList = (List) pageResult.getGrid(); // PageResult pageResult=new PageResult(); // babykModelsList = this.mongoTemplate.find(new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")),BabyModel.class); @@ -886,7 +886,7 @@ public class BabyHealthFacade extends BaseServiceImpl { } -// } + } book.write(); @@ -994,4 +994,133 @@ public class BabyHealthFacade extends BaseServiceImpl { return RespBuilder.buildSuccess(babyCheckModelList); } + + + 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) { + boolean flag = false; + // List hospital = groupsFacade.findGroupHospital(userId, false); + int[] monthArr = {0, 3, 4, 8, 12, 18, 24, 30, 36, 48, 60, 72};//月龄 + String hospitalId = autoMatchFacade.getHospitalId(userId); + Criteria criteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); + Criteria pCriteria = Criteria.where("yn").ne(0).and("hospitalId").is(hospitalId); + if (org.apache.commons.lang.StringUtils.isNotBlank(queryNo)) { + pCriteria.orOperator(Criteria.where("mcertNo").regex(queryNo), Criteria.where("name").regex(queryNo), + Criteria.where("fphone").regex(queryNo), Criteria.where("vcCardNo").regex(queryNo), Criteria.where("mname").regex(queryNo)); + flag = true; + } + limit=100; + + PageResult pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); + + int lastPage=pageResult.getLastPage(); + + List> grid = new ArrayList<>(); + + for ( page = 0; page < lastPage; page++) { + long ptime=System.currentTimeMillis(); + pageResult = findMongoPage(BabyModel.class, new Query(pCriteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); + + List babykModelsList = (List) pageResult.getGrid(); + + List listFuture = new ArrayList<>(); + + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(babykModelsList)) { + for (BabyModel babyModel : babykModelsList) { + Map row = new HashMap<>(); + Map babyMap = new HashMap<>(); + babyMap.put("babyName", babyModel.getName()); + babyMap.put("sex", SexEnum.getTextById(babyModel.getSex())); + babyMap.put("birth", DateUtil.getyyyy_MM_dd(babyModel.getBirth())); + babyMap.put("mname", babyModel.getMname()); + babyMap.put("address", babyModel.getAddress()); + babyMap.put("mphone", babyModel.getMphone()); + row.put("baby", babyMap); +// ids.add(babyModel.getId()); + Criteria criteriaCheck = Criteria.where("buildId").in(babyModel.getId()); +// pageResult = findMongoPage(BabyCheckModel.class, new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), page, limit); + List babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class); + +// List babyCheckModelList = (List ) pageResult.getGrid(); + + List> listAge = new ArrayList<>(); + for (BabyCheckModel babyCheckModel : babyCheckModelList) { + long pctime=System.currentTimeMillis(); + Map map = new HashMap<>(); + String feedType = ""; + String feedTypeId = babyCheckModel.getFeedType(); + if (StringUtils.isNotEmpty(feedTypeId)) { + feedType = WyTypeEnums.getNameById(Integer.parseInt(feedTypeId)); + } + row.put("feedType", feedType); + for (int i = 0; i < monthArr.length; i++) { + Map mapAge = new HashMap<>(); + if (monthArr[i] == babyCheckModel.getCheckMonth().intValue()) { + mapAge.put("height", babyCheckModel.getHeight()); + mapAge.put("heightEvaluate", babyCheckModel.getHeightEvaluate()); + mapAge.put("weight", babyCheckModel.getWeight()); + mapAge.put("weightEvaluate", babyCheckModel.getWeightEvaluate()); + mapAge.put("hemoglobin", babyCheckModel.getHemoglobin()); + mapAge.put("wh", babyCheckModel.getWeight()+"/"+babyCheckModel.getHeight()); + mapAge.put("whEva", ifnull(babyCheckModel.getWeightEvaluate())+"/"+ifnull(babyCheckModel.getHeightEvaluate())); + } else { + mapAge.put("height", ""); + mapAge.put("heightEvaluate", ""); + mapAge.put("weight", ""); + mapAge.put("weightEvaluate", ""); + mapAge.put("hemoglobin", ""); + mapAge.put("wh", ""); + mapAge.put("whEva", ""); + } + mapAge.put("age", monthArr[i]); + listAge.add(mapAge); + } + + + row.put("monthChk", listAge); + + row.put("height", babyCheckModel.getHeight()); + row.put("weight", babyCheckModel.getWeight()); + //秦皇岛需求,查询最后一次检查的高危详情 + row.put("qhdHighRiskInfo", babyCheckModel.getQhdHighRiskInfo()); + System.out.println("pcTime="+(System.currentTimeMillis()-pctime)); + } + +// 访视 + List newbornVisits = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyModel.getId()).and("hospitalId").in(hospitalId).and("yn").ne("0")) + .with(new Sort(Sort.Direction.ASC, "checkTime")), NewbornVisit.class); + List> rest = new ArrayList<>(); + for (NewbornVisit newbornVisit : newbornVisits) { + Map temp = new HashMap<>(); + temp.put("id", newbornVisit.getId()); + temp.put("hospitalId", newbornVisit.getHospitalId()); + temp.put("pid", newbornVisit.getPid()); + temp.put("checkTime", newbornVisit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(newbornVisit.getCheckTime())); + temp.put("checkTimeDesc", newbornVisit.getCheckTimeDesc()); + rest.add(temp); + } + row.put("visitcnt", newbornVisits.size()); + row.put("instWeight", ""); + if (newbornVisits.size() > 1) { + int size = newbornVisits.size(); + String wn1 = newbornVisits.get(size - 1).getWeightNow(); + String wn2 = newbornVisits.get(size - 2).getWeightNow(); + if (null == wn1) wn1 = "0"; + if (null == wn2) wn2 = "0"; + + row.put("instWeight", (Float.parseFloat(wn1) - Float.parseFloat(wn2))); + } + grid.add(row); + System.out.println("pTime="+(System.currentTimeMillis()-ptime)+" page="+page+" lastpage:="+lastPage); + } + } + } + + + pageResult.setGrid(grid); + return RespBuilder.buildSuccess(pageResult); + } + + @Autowired + @Qualifier("commonThreadPool") + private ThreadPoolTaskExecutor commonThreadPool; } \ No newline at end of file