Commit 91690d5e3c4a47922fc7cf90de9240215108da56

Authored by jiangjiazhi
1 parent a4c0b3d67a

修改新电子病历

Showing 1 changed file with 39 additions and 2 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 91690d5
... ... @@ -1163,8 +1163,14 @@
1163 1163 }
1164 1164 antExQuery.setId(null);
1165 1165 list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  1166 + if(CollectionUtils.isNotEmpty(list)){
  1167 + for(int i=0;i<list.size();i++){
  1168 + if(list.get(i).getId().equals(antExQueryRequest.getId())){
  1169 + list.remove(i);
  1170 + }
  1171 + }
  1172 + }
1166 1173  
1167   -
1168 1174 if (CollectionUtils.isEmpty(list)) {
1169 1175 antenatalExaminationService.updateOneAnt(antEx, antExQueryRequest.getId());
1170 1176 } else {
... ... @@ -1174,7 +1180,38 @@
1174 1180 AntExChuModel antExChuModel = new AntExChuModel();
1175 1181 antExChuModel.setYn(YnEnums.NO.getId());
1176 1182 antExChuModel.setId(antExQueryRequest.getId());
1177   - antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId());
  1183 + String hospital = autoMatchFacade.getHospitalId(userId);
  1184 +
  1185 +
  1186 + AntExChuQuery antExQuery = new AntExChuQuery();
  1187 + antExQuery.setId(antExQueryRequest.getId());
  1188 + antExQuery.setYn(YnEnums.YES.getId());
  1189 + antExQuery.setHospitalId(hospital);
  1190 +
  1191 + List<AntExChuModel> list = antenatalExaminationService.queryAntExChu(antExQuery);
  1192 +
  1193 + //TODO 需要根据时间去查询是否是本院最后一条记录
  1194 + if (CollectionUtils.isNotEmpty(list)) {
  1195 + antExQuery.setStart(new Date(list.get(0).getCheckTime().getTime() + 40000));
  1196 + }
  1197 +
  1198 + antExQuery.setId(null);
  1199 +
  1200 + list = antenatalExaminationService.queryAntExChu(antExQuery);
  1201 +
  1202 + if(CollectionUtils.isNotEmpty(list)){
  1203 + for(int i=0;i<list.size();i++){
  1204 + if(list.get(i).getId().equals(antExQueryRequest.getId())){
  1205 + list.remove(i);
  1206 + }
  1207 + }
  1208 + }
  1209 +
  1210 + if (CollectionUtils.isEmpty(list)) {
  1211 + antenatalExaminationService.updateAntExChu(antExChuModel, antExQueryRequest.getId());
  1212 + }else{
  1213 + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前产检记录不是本院最新的产检记录,不能删除");
  1214 + }
1178 1215 }
1179 1216  
1180 1217 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");