Commit c902e8562de6798ac1202559a5a9edb0ff299623

Authored by liquanyu
1 parent 70f0e146f8

删除出诊或者复诊修改下次预约时间

Showing 1 changed file with 51 additions and 2 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ c902e85
... ... @@ -1379,6 +1379,9 @@
1379 1379 * @return
1380 1380 */
1381 1381 public BaseResponse delOneAntEx(AntExQueryRequest antExQueryRequest, Integer userId) {
  1382 +
  1383 + String parentId = "";
  1384 +
1382 1385 if ("1".equals(antExQueryRequest.getType())) {
1383 1386 AntenatalExaminationModel antEx = new AntenatalExaminationModel();
1384 1387 antEx.setYn(YnEnums.NO.getId());
... ... @@ -1387,7 +1390,7 @@
1387 1390  
1388 1391 AntenatalExaminationModel localAntModel = antenatalExaminationService.findOneById(antExQueryRequest.getId());
1389 1392  
1390   - ;
  1393 + parentId =localAntModel.getParentId();
1391 1394  
1392 1395 /*AntExQuery antExQuery = new AntExQuery();
1393 1396 antExQuery.setId(antExQueryRequest.getId());
1394 1397  
... ... @@ -1432,9 +1435,9 @@
1432 1435  
1433 1436 AntExChuModel antExChuModel11 = antenatalExaminationService.findOne(antExQueryRequest.getId());
1434 1437  
  1438 + parentId = antExChuModel11.getParentId();
1435 1439  
1436 1440  
1437   -
1438 1441 /*AntExChuQuery antExQuery = new AntExChuQuery();
1439 1442 antExQuery.setId(antExQueryRequest.getId());
1440 1443 antExQuery.setYn(YnEnums.YES.getId());
... ... @@ -1472,6 +1475,52 @@
1472 1475 return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前产检记录不是本院最新的产检记录,不能删除");
1473 1476 }
1474 1477 }
  1478 +
  1479 +
  1480 + //删除复诊或者出诊的时候更新patient表的下次预约时间为最近的一次预约
  1481 + if (StringUtils.isNotEmpty(parentId))
  1482 + {
  1483 + PatientsQuery patientQuery = new PatientsQuery();
  1484 + patientQuery.setYn(YnEnums.YES.getId());
  1485 + patientQuery.setId(parentId);
  1486 + List<Patients> patientses = patientsService.queryPatient(patientQuery);
  1487 + if (CollectionUtils.isNotEmpty(patientses))
  1488 + {
  1489 + for (Patients pat : patientses) {
  1490 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  1491 + antExChuQuery.setYn(YnEnums.YES.getId());
  1492 + antExChuQuery.setHospitalId(pat.getHospitalId());
  1493 + antExChuQuery.setParentId(pat.getId());
  1494 + List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery);
  1495 + if (CollectionUtils.isNotEmpty(chus)) {
  1496 + Date nextTime = null;
  1497 + AntExChuModel chu = chus.get(0);
  1498 + if (chu != null)
  1499 + {
  1500 + nextTime = chu.getNextCheckTime();
  1501 +
  1502 + AntExQuery antExQuery = new AntExQuery();
  1503 + antExQuery.setParentId(pat.getId());
  1504 + antExQuery.setYn(YnEnums.YES.getId());
  1505 + antExQuery.setHospitalId(pat.getHospitalId());
  1506 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  1507 + if (CollectionUtils.isNotEmpty(list))
  1508 + {
  1509 + AntenatalExaminationModel ae = list.get(0);
  1510 + if (ae != null)
  1511 + {
  1512 + nextTime = ae.getNextCheckTime();
  1513 + }
  1514 + }
  1515 + patientsService.updatePatientOneCol(pat.getId(), nextTime);
  1516 +
  1517 + }
  1518 +
  1519 + }
  1520 + }
  1521 + }
  1522 + }
  1523 +
1475 1524  
1476 1525 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
1477 1526 }