Commit f2429e1219f9e6a70755710a93d54d2138a97e69

Authored by litao@lymsh.com
1 parent 47304a89f0

产检次数详情修改

Showing 1 changed file with 68 additions and 24 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ f2429e1
... ... @@ -1232,11 +1232,11 @@
1232 1232 PageResult pageResult = new PageResult(count, currentPage, pageSize, rest);
1233 1233 for (String pid : ids) {
1234 1234 Map<String, Object> tempMap = new HashMap<>();
1235   - PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class);
1236   - if(personModel != null) {
  1235 + List<Patients> patients = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), Patients.class);
  1236 + if(CollectionUtils.isNotEmpty(patients)) {
  1237 + /** 设置本院产检次数 + 总产检次数 */
1237 1238 List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class);
1238 1239 List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class);
1239   - tempMap.put("NAME", personModel.getName());
1240 1240 tempMap.put("TOTAL_NUM", antenatalExaminationModels.size() + antExChuModels.size());
1241 1241 Integer benyuan = 0;
1242 1242 for (AntenatalExaminationModel antenatalExaminationModel : antenatalExaminationModels) {
1243 1243  
1244 1244  
1245 1245  
1246 1246  
... ... @@ -1250,35 +1250,79 @@
1250 1250 }
1251 1251 }
1252 1252 tempMap.put("BENYUAN_NUM", benyuan);
1253   - if(CollectionUtils.isNotEmpty(antenatalExaminationModels)) {
1254   - AntenatalExaminationModel examinationModel = antenatalExaminationModels.get(0);
1255   - tempMap.put("YUNZHOU", DateUtil.getWeek(examinationModel.getLastMenses(), examinationModel.getCheckDate()));
1256   - tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(examinationModel.getRiskScore()));
1257   - tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(examinationModel.getRiskFactor()));
1258   -// tempMap.put("EDD_DATE", examinationModel.);
1259   - tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(examinationModel.getLastMenses()));
1260   - String prodDoctor = examinationModel.getCheckDoctor();
1261   - if(StringUtils.isNotBlank(prodDoctor)) {
1262   - Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
1263   - tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
  1253 +
  1254 + if(patients.size() == 1) {
  1255 + Patients p = patients.get(0);
  1256 + tempMap.put("YUNZHOU", DateUtil.getWeek(p.getLastMenses(), p.getLastCTime()));
  1257 +// List riskLeve = commonService.findRiskLevel(commonService.findRiskLevel(antExChuModel.getHighrisk()));
  1258 + tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(p.getRiskLevelId())); /** 高危等级 */
  1259 + List<String> riskFactorId = p.getRiskFactorId();
  1260 + if (CollectionUtils.isNotEmpty(riskFactorId)) {
  1261 + String HIGH_RISK_FACTOR = "";
  1262 + for (String s : riskFactorId) {
  1263 + HIGH_RISK_FACTOR = HIGH_RISK_FACTOR + mongoUtil.findName(s) + " ";
  1264 + }
  1265 + tempMap.put("HIGH_RISK_FACTOR", HIGH_RISK_FACTOR); /** 风险因素 */
1264 1266 }
1265   - } else if(CollectionUtils.isNotEmpty(antExChuModels)) {
1266   - AntExChuModel antExChuModel = antExChuModels.get(0);
1267   - tempMap.put("YUNZHOU", DateUtil.getWeek(antExChuModel.getLastMenses(), antExChuModel.getCheckTime()));
1268   - List riskLeve = commonService.findRiskLevel(commonService.findRiskLevel(antExChuModel.getHighrisk()));
1269   - tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(antExChuModel.getHighriskSocre())); /** 高危等级 */
1270   - tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(antExChuModel.getHighrisk())); /** 风险因素 */
1271   - tempMap.put("EDD_DATE", antExChuModel.getDueDate());
1272   - tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime()));
1273   - String prodDoctor = antExChuModel.getProdDoctor();
  1267 + tempMap.put("EDD_DATE", p.getDueDate());
  1268 + tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(p.getLastCTime()));
  1269 + String prodDoctor = p.getBookbuildingDoctor();
1274 1270 if(StringUtils.isNotBlank(prodDoctor)) {
1275 1271 Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
1276 1272 tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
1277 1273 }
1278 1274 }
  1275 + } else {
1279 1276  
1280   - rest.add(tempMap);
1281 1277 }
  1278 +
  1279 +// PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class);
  1280 +// if(personModel != null) {
  1281 +// List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class);
  1282 +// List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class);
  1283 +// tempMap.put("NAME", personModel.getName());
  1284 +// tempMap.put("TOTAL_NUM", antenatalExaminationModels.size() + antExChuModels.size());
  1285 +// Integer benyuan = 0;
  1286 +// for (AntenatalExaminationModel antenatalExaminationModel : antenatalExaminationModels) {
  1287 +// if(antenatalExaminationModel.getHospitalId().equals(hospitalId)) {
  1288 +// benyuan++;
  1289 +// }
  1290 +// }
  1291 +// for (AntExChuModel antExChuModel : antExChuModels) {
  1292 +// if(antExChuModel.getHospitalId().equals(hospitalId)) {
  1293 +// benyuan++;
  1294 +// }
  1295 +// }
  1296 +// tempMap.put("BENYUAN_NUM", benyuan);
  1297 +// if(CollectionUtils.isNotEmpty(antenatalExaminationModels)) {
  1298 +// AntenatalExaminationModel examinationModel = antenatalExaminationModels.get(0);
  1299 +// tempMap.put("YUNZHOU", DateUtil.getWeek(examinationModel.getLastMenses(), examinationModel.getCheckDate()));
  1300 +// tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(examinationModel.getRiskScore()));
  1301 +// tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(examinationModel.getRiskFactor()));
  1302 +//// tempMap.put("EDD_DATE", examinationModel.);
  1303 +// tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(examinationModel.getLastMenses()));
  1304 +// String prodDoctor = examinationModel.getCheckDoctor();
  1305 +// if(StringUtils.isNotBlank(prodDoctor)) {
  1306 +// Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
  1307 +// tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
  1308 +// }
  1309 +// } else if(CollectionUtils.isNotEmpty(antExChuModels)) {
  1310 +// AntExChuModel antExChuModel = antExChuModels.get(0);
  1311 +// tempMap.put("YUNZHOU", DateUtil.getWeek(antExChuModel.getLastMenses(), antExChuModel.getCheckTime()));
  1312 +// List riskLeve = commonService.findRiskLevel(commonService.findRiskLevel(antExChuModel.getHighrisk()));
  1313 +// tempMap.put("HIGH_RISK_GRADE", mongoUtil.findName(antExChuModel.getHighriskSocre())); /** 高危等级 */
  1314 +// tempMap.put("HIGH_RISK_FACTOR", mongoUtil.findName(antExChuModel.getHighrisk())); /** 风险因素 */
  1315 +// tempMap.put("EDD_DATE", antExChuModel.getDueDate());
  1316 +// tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime()));
  1317 +// String prodDoctor = antExChuModel.getProdDoctor();
  1318 +// if(StringUtils.isNotBlank(prodDoctor)) {
  1319 +// Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
  1320 +// tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
  1321 +// }
  1322 +// }
  1323 +
  1324 + rest.add(tempMap);
  1325 +// }
1282 1326 setColor(rest);
1283 1327 pageResult.setGrid(rest);
1284 1328 }