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 4fd67ae..3f59adf 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 @@ -1232,11 +1232,11 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService PageResult pageResult = new PageResult(count, currentPage, pageSize, rest); for (String pid : ids) { Map tempMap = new HashMap<>(); - PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class); - if(personModel != null) { + List patients = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), Patients.class); + if(CollectionUtils.isNotEmpty(patients)) { + /** 设置本院产检次数 + 总产检次数 */ 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) { @@ -1250,35 +1250,79 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService } } 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()); + + if(patients.size() == 1) { + Patients p = patients.get(0); + tempMap.put("YUNZHOU", DateUtil.getWeek(p.getLastMenses(), p.getLastCTime())); +// List riskLeve = commonService.findRiskLevel(commonService.findRiskLevel(antExChuModel.getHighrisk())); + tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(p.getRiskLevelId())); /** 高危等级 */ + List riskFactorId = p.getRiskFactorId(); + if (CollectionUtils.isNotEmpty(riskFactorId)) { + String HIGH_RISK_FACTOR = ""; + for (String s : riskFactorId) { + HIGH_RISK_FACTOR = HIGH_RISK_FACTOR + mongoUtil.findName(s) + " "; + } + tempMap.put("HIGH_RISK_FACTOR", HIGH_RISK_FACTOR); /** 风险因素 */ } - } 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(); + tempMap.put("EDD_DATE", p.getDueDate()); + tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(p.getLastCTime())); + String prodDoctor = p.getBookbuildingDoctor(); if(StringUtils.isNotBlank(prodDoctor)) { Users users = usersService.getUsers(Integer.parseInt(prodDoctor)); tempMap.put("DOCTOR_NAME", users == null ? null : users.getName()); } } + } else { - rest.add(tempMap); } + +// 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); +// } setColor(rest); pageResult.setGrid(rest); }