diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java index a851a66..9037603 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java @@ -60,39 +60,40 @@ public class AntenatalExaminationFacade { /** * 修改最后一次产检时间 + * * @param hospitalId * @param id - * @param type 1 初诊 2 复诊 + * @param type 1 初诊 2 复诊 */ - private void setLashCTimes(String hospitalId,String id,int type){ + private void setLashCTimes(String hospitalId, String id, int type) { Patients patients = patientsService.findOnePatientById(id); List list = new ArrayList<>(); - if(type==2){ - AntExQuery antExQuery=new AntExQuery(); + if (type == 2) { + AntExQuery antExQuery = new AntExQuery(); antExQuery.setYn(YnEnums.YES.getId()); antExQuery.setHospitalId(hospitalId); antExQuery.setParentId(id); - List antExList= antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); - if(CollectionUtils.isNotEmpty(antExList)){ + List antExList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); + if (CollectionUtils.isNotEmpty(antExList)) { for (AntenatalExaminationModel antEx : antExList) { list.add(antEx.getCheckDate()); } } - }else if(type==1) { - AntExChuQuery antExChuQuery=new AntExChuQuery(); + } else if (type == 1) { + AntExChuQuery antExChuQuery = new AntExChuQuery(); antExChuQuery.setYn(YnEnums.YES.getId()); antExChuQuery.setHospitalId(hospitalId); antExChuQuery.setParentId(id); - List antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery()); - if(CollectionUtils.isNotEmpty(antExChu)){ + List antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery()); + if (CollectionUtils.isNotEmpty(antExChu)) { for (AntExChuModel antEx : antExChu) { list.add(antEx.getCheckTime()); } } } - if(CollectionUtils.isNotEmpty(list)){ + if (CollectionUtils.isNotEmpty(list)) { Collections.sort(list, new Comparator() { @Override public int compare(Date o1, Date o2) { @@ -105,12 +106,13 @@ public class AntenatalExaminationFacade { return 0; } }); - Patients patients1=new Patients(); + Patients patients1 = new Patients(); patients1.setLastCTime(list.get(0)); patients1.setId(patients.getId()); patientsService.updatePatient(patients1); } } + /** * 增加一条产前检查 * @@ -130,7 +132,7 @@ public class AntenatalExaminationFacade { Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId()); //修改最后一次检查时间 - setLashCTimes(hospitalId,antExAddRequest.getParentId(),2); + setLashCTimes(hospitalId, antExAddRequest.getParentId(), 2); patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor()); @@ -163,7 +165,7 @@ public class AntenatalExaminationFacade { antenatalExaminationService.addOneBabyAnt(model); //修改最后一次检查时间 - setLashCTimes(hospitalId, antExAddRequest.getParentId(),2); + setLashCTimes(hospitalId, antExAddRequest.getParentId(), 2); //修改申请单状态 updateApplyOrder(model, antExAddRequest.getParentId()); //修改孕妇高危等级 @@ -254,7 +256,7 @@ public class AntenatalExaminationFacade { //修改本院最后一次定义高危 updateLastRhTime(patients.getId(), hospitalId); - setLashCTimes(hospitalId,antExChuModel.getParentId(),1); + setLashCTimes(hospitalId, antExChuModel.getParentId(), 1); } else { AntExChuQuery antExChuQuery1 = new AntExChuQuery(); @@ -293,7 +295,7 @@ public class AntenatalExaminationFacade { //修改本院最后一次定义高危 updateLastRhTime(patients.getId(), hospitalId); - setLashCTimes(hospitalId,antExChuModel.getParentId(),1); + setLashCTimes(hospitalId, antExChuModel.getParentId(), 1); if (null != patients.getBuildType() && patients.getBuildType() == 3) { Patients patients1 = new Patients(); patients1.setEnable("1"); @@ -956,6 +958,51 @@ public class AntenatalExaminationFacade { dueDate = patients.getFmDate(); } + + //初诊记录 + AntExChuQuery antExChuQuery = new AntExChuQuery(); + antExChuQuery.setYn(YnEnums.YES.getId()); + antExChuQuery.setStart(patients.getBookbuildingDate()); + if(null==patients.getFmDate()){ + antExChuQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime()+ 86398000)); + }else{ + antExChuQuery.setEnd(new Date(patients.getFmDate().getTime() + 86398000)); + } + + antExChuQuery.setPid(pid); + + List antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); + if (CollectionUtils.isNotEmpty(antExChuModels)) { + for (AntExChuModel an : antExChuModels) { + if (null != an.getHospitalId()) { + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId())); + } + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses())); + } + } + + //复诊记录 + AntExQuery antExQuery = new AntExQuery(); + antExQuery.setYn(YnEnums.YES.getId()); + antExQuery.setPid(pid); + antExQuery.setStart(patients.getBookbuildingDate()); + if(null==patients.getFmDate()){ + antExQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime()+ 86398000)); + }else{ + antExQuery.setEnd(new Date(patients.getFmDate().getTime() + 86398000)); + } + + List list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); + if (CollectionUtils.isNotEmpty(list1)) { + for (AntenatalExaminationModel an : list1) { + if (null != an.getHospitalId()) { + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId())); + } + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses())); + } + } + + if (null != map) { Object obj = map.get(listDate.get(i).getId()); if (obj instanceof MaternalDeliverModel) { @@ -1121,10 +1168,10 @@ public class AntenatalExaminationFacade { Collections.sort(listDate, new Comparator() { @Override public int compare(SortIn o1, SortIn o2) { - if (o1.getDate() != null &&null != o2.getDate()&& o1.getDate().after(o2.getDate())) { + if (o1.getDate() != null && null != o2.getDate() && o1.getDate().after(o2.getDate())) { return -1; } - if (o1.getDate() != null &&null != o2.getDate()&& o1.getDate().before(o2.getDate())) { + if (o1.getDate() != null && null != o2.getDate() && o1.getDate().before(o2.getDate())) { return 1; } return 0; @@ -1361,7 +1408,7 @@ public class AntenatalExaminationFacade { //修改最后一次检查时间 AntenatalExaminationModel antenatalExaminationModel = antenatalExaminationService.findOneById(antExQueryRequest.getId()); - setLashCTimes(hospital,antenatalExaminationModel.getParentId(),2); + setLashCTimes(hospital, antenatalExaminationModel.getParentId(), 2); updateLastRisk(antenatalExaminationModel.getParentId()); @@ -1406,11 +1453,11 @@ public class AntenatalExaminationFacade { }*/ // if (CollectionUtils.isEmpty(list)) { - if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true,antExQueryRequest.getId())) { + if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true, antExQueryRequest.getId())) { antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId()); AntExChuModel antExChuModel1 = antenatalExaminationService.findOne(antExQueryRequest.getId()); - setLashCTimes(hospital,antExChuModel1.getParentId(),1); + setLashCTimes(hospital, antExChuModel1.getParentId(), 1); updateLastRisk(antExChuModel1.getParentId()); } else { @@ -1735,7 +1782,7 @@ public class AntenatalExaminationFacade { } String doctorId = examinationModel.getCheckDoctor(); - if(StringUtils.isNotEmpty(doctorId)) { + if (StringUtils.isNotEmpty(doctorId)) { Users users = usersService.getUsers(Integer.valueOf(doctorId)); Map map1 = new HashMap<>(); if (null != users) { @@ -1776,7 +1823,7 @@ public class AntenatalExaminationFacade { } String doctorId = antExChuModel.getProdDoctor(); Map map1 = new HashMap<>(); - if(StringUtils.isNotEmpty(doctorId)){ + if (StringUtils.isNotEmpty(doctorId)) { Users users = usersService.getUsers(Integer.valueOf(doctorId)); if (null != users) { map1.put("id", users.getId() + "");