Commit 9601ab08b66393c7d4b5b1ab07cdcfe066555425

Authored by jiangjiazhi
1 parent 48b2d6ea84

修改电子病历 自动分娩的情况不显示初诊 复诊的问题

Showing 1 changed file with 70 additions and 23 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 9601ab0
... ... @@ -60,39 +60,40 @@
60 60  
61 61 /**
62 62 * 修改最后一次产检时间
  63 + *
63 64 * @param hospitalId
64 65 * @param id
65   - * @param type 1 初诊 2 复诊
  66 + * @param type 1 初诊 2 复诊
66 67 */
67   - private void setLashCTimes(String hospitalId,String id,int type){
  68 + private void setLashCTimes(String hospitalId, String id, int type) {
68 69  
69 70 Patients patients = patientsService.findOnePatientById(id);
70 71 List<Date> list = new ArrayList<>();
71   - if(type==2){
72   - AntExQuery antExQuery=new AntExQuery();
  72 + if (type == 2) {
  73 + AntExQuery antExQuery = new AntExQuery();
73 74 antExQuery.setYn(YnEnums.YES.getId());
74 75 antExQuery.setHospitalId(hospitalId);
75 76 antExQuery.setParentId(id);
76   - List<AntenatalExaminationModel> antExList= antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
77   - if(CollectionUtils.isNotEmpty(antExList)){
  77 + List<AntenatalExaminationModel> antExList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  78 + if (CollectionUtils.isNotEmpty(antExList)) {
78 79 for (AntenatalExaminationModel antEx : antExList) {
79 80 list.add(antEx.getCheckDate());
80 81 }
81 82 }
82   - }else if(type==1) {
83   - AntExChuQuery antExChuQuery=new AntExChuQuery();
  83 + } else if (type == 1) {
  84 + AntExChuQuery antExChuQuery = new AntExChuQuery();
84 85 antExChuQuery.setYn(YnEnums.YES.getId());
85 86 antExChuQuery.setHospitalId(hospitalId);
86 87 antExChuQuery.setParentId(id);
87   - List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery());
88   - if(CollectionUtils.isNotEmpty(antExChu)){
  88 + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery());
  89 + if (CollectionUtils.isNotEmpty(antExChu)) {
89 90 for (AntExChuModel antEx : antExChu) {
90 91 list.add(antEx.getCheckTime());
91 92 }
92 93 }
93 94 }
94 95  
95   - if(CollectionUtils.isNotEmpty(list)){
  96 + if (CollectionUtils.isNotEmpty(list)) {
96 97 Collections.sort(list, new Comparator<Date>() {
97 98 @Override
98 99 public int compare(Date o1, Date o2) {
99 100  
... ... @@ -105,12 +106,13 @@
105 106 return 0;
106 107 }
107 108 });
108   - Patients patients1=new Patients();
  109 + Patients patients1 = new Patients();
109 110 patients1.setLastCTime(list.get(0));
110 111 patients1.setId(patients.getId());
111 112 patientsService.updatePatient(patients1);
112 113 }
113 114 }
  115 +
114 116 /**
115 117 * 增加一条产前检查
116 118 *
... ... @@ -130,7 +132,7 @@
130 132 Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
131 133  
132 134 //修改最后一次检查时间
133   - setLashCTimes(hospitalId,antExAddRequest.getParentId(),2);
  135 + setLashCTimes(hospitalId, antExAddRequest.getParentId(), 2);
134 136  
135 137 patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
136 138  
... ... @@ -163,7 +165,7 @@
163 165 antenatalExaminationService.addOneBabyAnt(model);
164 166  
165 167 //修改最后一次检查时间
166   - setLashCTimes(hospitalId, antExAddRequest.getParentId(),2);
  168 + setLashCTimes(hospitalId, antExAddRequest.getParentId(), 2);
167 169 //修改申请单状态
168 170 updateApplyOrder(model, antExAddRequest.getParentId());
169 171 //修改孕妇高危等级
... ... @@ -254,7 +256,7 @@
254 256 //修改本院最后一次定义高危
255 257 updateLastRhTime(patients.getId(), hospitalId);
256 258  
257   - setLashCTimes(hospitalId,antExChuModel.getParentId(),1);
  259 + setLashCTimes(hospitalId, antExChuModel.getParentId(), 1);
258 260  
259 261 } else {
260 262 AntExChuQuery antExChuQuery1 = new AntExChuQuery();
... ... @@ -293,7 +295,7 @@
293 295  
294 296 //修改本院最后一次定义高危
295 297 updateLastRhTime(patients.getId(), hospitalId);
296   - setLashCTimes(hospitalId,antExChuModel.getParentId(),1);
  298 + setLashCTimes(hospitalId, antExChuModel.getParentId(), 1);
297 299 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
298 300 Patients patients1 = new Patients();
299 301 patients1.setEnable("1");
... ... @@ -956,6 +958,51 @@
956 958 dueDate = patients.getFmDate();
957 959 }
958 960  
  961 +
  962 + //初诊记录
  963 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  964 + antExChuQuery.setYn(YnEnums.YES.getId());
  965 + antExChuQuery.setStart(patients.getBookbuildingDate());
  966 + if(null==patients.getFmDate()){
  967 + antExChuQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime()+ 86398000));
  968 + }else{
  969 + antExChuQuery.setEnd(new Date(patients.getFmDate().getTime() + 86398000));
  970 + }
  971 +
  972 + antExChuQuery.setPid(pid);
  973 +
  974 + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
  975 + if (CollectionUtils.isNotEmpty(antExChuModels)) {
  976 + for (AntExChuModel an : antExChuModels) {
  977 + if (null != an.getHospitalId()) {
  978 + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
  979 + }
  980 + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses()));
  981 + }
  982 + }
  983 +
  984 + //复诊记录
  985 + AntExQuery antExQuery = new AntExQuery();
  986 + antExQuery.setYn(YnEnums.YES.getId());
  987 + antExQuery.setPid(pid);
  988 + antExQuery.setStart(patients.getBookbuildingDate());
  989 + if(null==patients.getFmDate()){
  990 + antExQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime()+ 86398000));
  991 + }else{
  992 + antExQuery.setEnd(new Date(patients.getFmDate().getTime() + 86398000));
  993 + }
  994 +
  995 + List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  996 + if (CollectionUtils.isNotEmpty(list1)) {
  997 + for (AntenatalExaminationModel an : list1) {
  998 + if (null != an.getHospitalId()) {
  999 + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId()));
  1000 + }
  1001 + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses()));
  1002 + }
  1003 + }
  1004 +
  1005 +
959 1006 if (null != map) {
960 1007 Object obj = map.get(listDate.get(i).getId());
961 1008 if (obj instanceof MaternalDeliverModel) {
962 1009  
... ... @@ -1121,10 +1168,10 @@
1121 1168 Collections.sort(listDate, new Comparator<SortIn>() {
1122 1169 @Override
1123 1170 public int compare(SortIn o1, SortIn o2) {
1124   - if (o1.getDate() != null &&null != o2.getDate()&& o1.getDate().after(o2.getDate())) {
  1171 + if (o1.getDate() != null && null != o2.getDate() && o1.getDate().after(o2.getDate())) {
1125 1172 return -1;
1126 1173 }
1127   - if (o1.getDate() != null &&null != o2.getDate()&& o1.getDate().before(o2.getDate())) {
  1174 + if (o1.getDate() != null && null != o2.getDate() && o1.getDate().before(o2.getDate())) {
1128 1175 return 1;
1129 1176 }
1130 1177 return 0;
... ... @@ -1361,7 +1408,7 @@
1361 1408 //修改最后一次检查时间
1362 1409 AntenatalExaminationModel antenatalExaminationModel = antenatalExaminationService.findOneById(antExQueryRequest.getId());
1363 1410  
1364   - setLashCTimes(hospital,antenatalExaminationModel.getParentId(),2);
  1411 + setLashCTimes(hospital, antenatalExaminationModel.getParentId(), 2);
1365 1412  
1366 1413 updateLastRisk(antenatalExaminationModel.getParentId());
1367 1414  
1368 1415  
... ... @@ -1406,11 +1453,11 @@
1406 1453 }*/
1407 1454  
1408 1455 // if (CollectionUtils.isEmpty(list)) {
1409   - if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true,antExQueryRequest.getId())) {
  1456 + if (deleteProcessHandler.deleteAntExChu(antExChuModel11.getPid(), antExChuModel11.getCheckTime(), hospital, true, antExQueryRequest.getId())) {
1410 1457 antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId());
1411 1458  
1412 1459 AntExChuModel antExChuModel1 = antenatalExaminationService.findOne(antExQueryRequest.getId());
1413   - setLashCTimes(hospital,antExChuModel1.getParentId(),1);
  1460 + setLashCTimes(hospital, antExChuModel1.getParentId(), 1);
1414 1461 updateLastRisk(antExChuModel1.getParentId());
1415 1462  
1416 1463 } else {
... ... @@ -1735,7 +1782,7 @@
1735 1782 }
1736 1783  
1737 1784 String doctorId = examinationModel.getCheckDoctor();
1738   - if(StringUtils.isNotEmpty(doctorId)) {
  1785 + if (StringUtils.isNotEmpty(doctorId)) {
1739 1786 Users users = usersService.getUsers(Integer.valueOf(doctorId));
1740 1787 Map<String, String> map1 = new HashMap<>();
1741 1788 if (null != users) {
... ... @@ -1776,7 +1823,7 @@
1776 1823 }
1777 1824 String doctorId = antExChuModel.getProdDoctor();
1778 1825 Map<String, String> map1 = new HashMap<>();
1779   - if(StringUtils.isNotEmpty(doctorId)){
  1826 + if (StringUtils.isNotEmpty(doctorId)) {
1780 1827 Users users = usersService.getUsers(Integer.valueOf(doctorId));
1781 1828 if (null != users) {
1782 1829 map1.put("id", users.getId() + "");