Commit 55fb56253864ce2996504a74ee56e77b6de7f1b3

Authored by litao@lymsh.com
1 parent b7f6f89f28

产检人数明细查看修复

Showing 1 changed file with 41 additions and 40 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 55fb562
... ... @@ -1274,50 +1274,51 @@
1274 1274 Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
1275 1275 tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
1276 1276 }
1277   - }
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);
  1277 + } else {
  1278 + for (Patients patient : patients) {
  1279 + /** 查出所有符合条件的patients */
  1280 + Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("yn").ne("0");
  1281 + if(startDate != null && endDate != null) {
  1282 + criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1));
  1283 + }
  1284 + if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */
  1285 + criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)).gte(DateUtil.getWeekDay(-endWeek));
  1286 + }
  1287 + if(childBirth != null) {
  1288 + criteria.and("type").is(childBirth);
  1289 + }
  1290 + List<Patients> p = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid");
  1291 + List<String> patientIds = CollectionUtils.getId(p, "id", String.class);
1293 1292  
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) + ",";
  1293 + /** 初诊数据 */
  1294 + Criteria c = Criteria.where("hospitalId").is(hospitalId).and("parentId").in(patientIds).and("pid").is(pid);
  1295 + Long antExChuModelCount = mongoTemplate.count(Query.query(c), AntExChuModel.class);
  1296 + Long antExModelCount = mongoTemplate.count(Query.query(c), AntenatalExaminationModel.class);
  1297 + if(antExChuModelCount.intValue() + antExModelCount.intValue() == number) {
  1298 + tempMap.put("NAME", patient.getUsername());
  1299 + tempMap.put("YUNZHOU", DateUtil.getWeek(patient.getLastMenses(), patient.getLastCTime()));
  1300 + String riskLevelId = patient.getRiskLevelId();
  1301 + if(StringUtils.isNotBlank(riskLevelId)) {
  1302 + List<String> basicIds = JSON.parseArray(riskLevelId, String.class);
  1303 + String HIGH_RISK_GRADE = "";
  1304 + for (String basicId : basicIds) {
  1305 + HIGH_RISK_GRADE = HIGH_RISK_GRADE + mongoUtil.findName(basicId) + ",";
  1306 + }
  1307 + tempMap.put("HIGH_RISK_GRADE", HIGH_RISK_GRADE.substring(0, HIGH_RISK_GRADE.length() - 1)); /** 高危等级 */
  1308 + }
  1309 + tempMap.put("HIGH_RISK_FACTOR", patient.getoRiskFactor()); /** 风险因素 */
  1310 + tempMap.put("EDD_DATE", patient.getDueDate());
  1311 + tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(patient.getLastCTime()));
  1312 + String prodDoctor = patient.getBookbuildingDoctor();
  1313 + if(StringUtils.isNotBlank(prodDoctor)) {
  1314 + Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
  1315 + tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
  1316 + }
1307 1317 }
1308   - tempMap.put("HIGH_RISK_GRADE", HIGH_RISK_GRADE.substring(0, HIGH_RISK_GRADE.length() - 1)); /** 高危等级 */
1309 1318 }
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 1319 }
1320 1320 }
  1321 +
1321 1322 rest.add(tempMap);
1322 1323 }
1323 1324 pageResult.setGrid(rest);