From b7f6f89f287a37a731f0385069ef76f5e3c70a26 Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Mon, 24 Jul 2017 10:42:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E6=A3=80=E4=BA=BA=E6=95=B0=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E6=9F=A5=E7=9C=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/impl/ReportServiceImpl.java | 92 ++++++++++------------ 1 file changed, 42 insertions(+), 50 deletions(-) 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 c602bb0..d32bf1c 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 @@ -1276,57 +1276,49 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService } } } else { - + for (Patients patient : patients) { + /** 查出所有符合条件的patients */ + Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("yn").ne("0"); + if(startDate != null && endDate != null) { + criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1)); + } + if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */ + criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)).gte(DateUtil.getWeekDay(-endWeek)); + } + if(childBirth != null) { + criteria.and("type").is(childBirth); + } + List p = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid"); + List patientIds = CollectionUtils.getId(p, "id", String.class); + + /** 初诊数据 */ + Criteria c = Criteria.where("hospitalId").is(hospitalId).and("parentId").in(patientIds).and("pid").is(pid); + Long antExChuModelCount = mongoTemplate.count(Query.query(c), AntExChuModel.class); + Long antExModelCount = mongoTemplate.count(Query.query(c), AntenatalExaminationModel.class); + if(antExChuModelCount.intValue() + antExModelCount.intValue() == number) { + tempMap.put("NAME", patient.getUsername()); + tempMap.put("YUNZHOU", DateUtil.getWeek(patient.getLastMenses(), patient.getLastCTime())); + String riskLevelId = patient.getRiskLevelId(); + if(StringUtils.isNotBlank(riskLevelId)) { + List basicIds = JSON.parseArray(riskLevelId, String.class); + String HIGH_RISK_GRADE = ""; + for (String basicId : basicIds) { + HIGH_RISK_GRADE = HIGH_RISK_GRADE + mongoUtil.findName(basicId) + ","; + } + tempMap.put("HIGH_RISK_GRADE", HIGH_RISK_GRADE.substring(0, HIGH_RISK_GRADE.length() - 1)); /** 高危等级 */ + } + tempMap.put("HIGH_RISK_FACTOR", patient.getoRiskFactor()); /** 风险因素 */ + tempMap.put("EDD_DATE", patient.getDueDate()); + tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(patient.getLastCTime())); + String prodDoctor = patient.getBookbuildingDoctor(); + if(StringUtils.isNotBlank(prodDoctor)) { + Users users = usersService.getUsers(Integer.parseInt(prodDoctor)); + tempMap.put("DOCTOR_NAME", users == null ? null : users.getName()); + } + } + } } - -// PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class); -// if(personModel != null) { -// List antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class); -// List antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class); -// tempMap.put("NAME", personModel.getName()); -// tempMap.put("TOTAL_NUM", antenatalExaminationModels.size() + antExChuModels.size()); -// Integer benyuan = 0; -// for (AntenatalExaminationModel antenatalExaminationModel : antenatalExaminationModels) { -// if(antenatalExaminationModel.getHospitalId().equals(hospitalId)) { -// benyuan++; -// } -// } -// for (AntExChuModel antExChuModel : antExChuModels) { -// if(antExChuModel.getHospitalId().equals(hospitalId)) { -// benyuan++; -// } -// } -// tempMap.put("BENYUAN_NUM", benyuan); -// if(CollectionUtils.isNotEmpty(antenatalExaminationModels)) { -// AntenatalExaminationModel examinationModel = antenatalExaminationModels.get(0); -// tempMap.put("YUNZHOU", DateUtil.getWeek(examinationModel.getLastMenses(), examinationModel.getCheckDate())); -// tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(examinationModel.getRiskScore())); -// tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(examinationModel.getRiskFactor())); -//// tempMap.put("EDD_DATE", examinationModel.); -// tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(examinationModel.getLastMenses())); -// String prodDoctor = examinationModel.getCheckDoctor(); -// if(StringUtils.isNotBlank(prodDoctor)) { -// Users users = usersService.getUsers(Integer.parseInt(prodDoctor)); -// tempMap.put("DOCTOR_NAME", users == null ? null : users.getName()); -// } -// } else if(CollectionUtils.isNotEmpty(antExChuModels)) { -// AntExChuModel antExChuModel = antExChuModels.get(0); -// tempMap.put("YUNZHOU", DateUtil.getWeek(antExChuModel.getLastMenses(), antExChuModel.getCheckTime())); -// List riskLeve = commonService.findRiskLevel(commonService.findRiskLevel(antExChuModel.getHighrisk())); -// tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(antExChuModel.getHighriskSocre())); /** 高危等级 */ -// tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(antExChuModel.getHighrisk())); /** 风险因素 */ -// tempMap.put("EDD_DATE", antExChuModel.getDueDate()); -// tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); -// String prodDoctor = antExChuModel.getProdDoctor(); -// if(StringUtils.isNotBlank(prodDoctor)) { -// Users users = usersService.getUsers(Integer.parseInt(prodDoctor)); -// tempMap.put("DOCTOR_NAME", users == null ? null : users.getName()); -// } -// } - - rest.add(tempMap); -// } - // + rest.add(tempMap); } pageResult.setGrid(rest); setColor(rest); -- 1.8.3.1