Commit b7f6f89f287a37a731f0385069ef76f5e3c70a26

Authored by litao@lymsh.com
1 parent 22ba8b537c

产检人数明细查看修复

Showing 1 changed file with 42 additions and 50 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ b7f6f89
... ... @@ -1276,57 +1276,49 @@
1276 1276 }
1277 1277 }
1278 1278 } else {
  1279 + for (Patients patient : patients) {
  1280 + /** 查出所有符合条件的patients */
  1281 + Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("yn").ne("0");
  1282 + if(startDate != null && endDate != null) {
  1283 + criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1));
  1284 + }
  1285 + if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */
  1286 + criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)).gte(DateUtil.getWeekDay(-endWeek));
  1287 + }
  1288 + if(childBirth != null) {
  1289 + criteria.and("type").is(childBirth);
  1290 + }
  1291 + List<Patients> p = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid");
  1292 + List<String> patientIds = CollectionUtils.getId(p, "id", String.class);
1279 1293  
  1294 + /** 初诊数据 */
  1295 + Criteria c = Criteria.where("hospitalId").is(hospitalId).and("parentId").in(patientIds).and("pid").is(pid);
  1296 + Long antExChuModelCount = mongoTemplate.count(Query.query(c), AntExChuModel.class);
  1297 + Long antExModelCount = mongoTemplate.count(Query.query(c), AntenatalExaminationModel.class);
  1298 + if(antExChuModelCount.intValue() + antExModelCount.intValue() == number) {
  1299 + tempMap.put("NAME", patient.getUsername());
  1300 + tempMap.put("YUNZHOU", DateUtil.getWeek(patient.getLastMenses(), patient.getLastCTime()));
  1301 + String riskLevelId = patient.getRiskLevelId();
  1302 + if(StringUtils.isNotBlank(riskLevelId)) {
  1303 + List<String> basicIds = JSON.parseArray(riskLevelId, String.class);
  1304 + String HIGH_RISK_GRADE = "";
  1305 + for (String basicId : basicIds) {
  1306 + HIGH_RISK_GRADE = HIGH_RISK_GRADE + mongoUtil.findName(basicId) + ",";
  1307 + }
  1308 + tempMap.put("HIGH_RISK_GRADE", HIGH_RISK_GRADE.substring(0, HIGH_RISK_GRADE.length() - 1)); /** 高危等级 */
  1309 + }
  1310 + tempMap.put("HIGH_RISK_FACTOR", patient.getoRiskFactor()); /** 风险因素 */
  1311 + tempMap.put("EDD_DATE", patient.getDueDate());
  1312 + tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(patient.getLastCTime()));
  1313 + String prodDoctor = patient.getBookbuildingDoctor();
  1314 + if(StringUtils.isNotBlank(prodDoctor)) {
  1315 + Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
  1316 + tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
  1317 + }
  1318 + }
  1319 + }
1280 1320 }
1281   -
1282   -// PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class);
1283   -// if(personModel != null) {
1284   -// List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class);
1285   -// List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class);
1286   -// tempMap.put("NAME", personModel.getName());
1287   -// tempMap.put("TOTAL_NUM", antenatalExaminationModels.size() + antExChuModels.size());
1288   -// Integer benyuan = 0;
1289   -// for (AntenatalExaminationModel antenatalExaminationModel : antenatalExaminationModels) {
1290   -// if(antenatalExaminationModel.getHospitalId().equals(hospitalId)) {
1291   -// benyuan++;
1292   -// }
1293   -// }
1294   -// for (AntExChuModel antExChuModel : antExChuModels) {
1295   -// if(antExChuModel.getHospitalId().equals(hospitalId)) {
1296   -// benyuan++;
1297   -// }
1298   -// }
1299   -// tempMap.put("BENYUAN_NUM", benyuan);
1300   -// if(CollectionUtils.isNotEmpty(antenatalExaminationModels)) {
1301   -// AntenatalExaminationModel examinationModel = antenatalExaminationModels.get(0);
1302   -// tempMap.put("YUNZHOU", DateUtil.getWeek(examinationModel.getLastMenses(), examinationModel.getCheckDate()));
1303   -// tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(examinationModel.getRiskScore()));
1304   -// tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(examinationModel.getRiskFactor()));
1305   -//// tempMap.put("EDD_DATE", examinationModel.);
1306   -// tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(examinationModel.getLastMenses()));
1307   -// String prodDoctor = examinationModel.getCheckDoctor();
1308   -// if(StringUtils.isNotBlank(prodDoctor)) {
1309   -// Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
1310   -// tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
1311   -// }
1312   -// } else if(CollectionUtils.isNotEmpty(antExChuModels)) {
1313   -// AntExChuModel antExChuModel = antExChuModels.get(0);
1314   -// tempMap.put("YUNZHOU", DateUtil.getWeek(antExChuModel.getLastMenses(), antExChuModel.getCheckTime()));
1315   -// List riskLeve = commonService.findRiskLevel(commonService.findRiskLevel(antExChuModel.getHighrisk()));
1316   -// tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(antExChuModel.getHighriskSocre())); /** 高危等级 */
1317   -// tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(antExChuModel.getHighrisk())); /** 风险因素 */
1318   -// tempMap.put("EDD_DATE", antExChuModel.getDueDate());
1319   -// tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime()));
1320   -// String prodDoctor = antExChuModel.getProdDoctor();
1321   -// if(StringUtils.isNotBlank(prodDoctor)) {
1322   -// Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
1323   -// tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
1324   -// }
1325   -// }
1326   -
1327   - rest.add(tempMap);
1328   -// }
1329   - //
  1321 + rest.add(tempMap);
1330 1322 }
1331 1323 pageResult.setGrid(rest);
1332 1324 setColor(rest);