Commit 2580a69efd57d7469231bb67f19aa737515aac37

Authored by wtt
1 parent f3a49292d0

自动分娩产妇根据末次月经修改为孕妇

Showing 1 changed file with 48 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 2580a69
... ... @@ -1255,7 +1255,55 @@
1255 1255 }
1256 1256 });
1257 1257  
  1258 + //20201126 自动分娩的产妇转孕妇,秦皇岛先试用
  1259 + puerperaConvertPregnant(id, yunRequest, patient, beforePatient);
  1260 +
1258 1261 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  1262 + }
  1263 +
  1264 + /**
  1265 + * 自动分娩产妇转孕妇
  1266 + *
  1267 + * @param id
  1268 + * @param yunRequest
  1269 + * @param patient
  1270 + * @param beforePatient
  1271 + * @Author: 武涛涛
  1272 + * @Date: 2020/11/25 14:04
  1273 + */
  1274 + private void puerperaConvertPregnant (String id, YunBookbuildingAddRequest yunRequest, Patients patient, Patients beforePatient){
  1275 + try {
  1276 + Date lastMenses = patient.getLastMenses();
  1277 + Date endDate = DateUtil.addDay(new Date(), -294);
  1278 + int i = lastMenses.compareTo(endDate);
  1279 +
  1280 + //判断为自动分娩产妇(buildType 2 自动分娩类型),手动分娩的不做处理
  1281 + if(beforePatient!=null && beforePatient.getBuildType()==2 && beforePatient.getIsAutoFm()==1){
  1282 + // 修改末次月经时在孕期就修改为孕妇状态
  1283 + if(i == 1){
  1284 + patient.setType(1);
  1285 + patient.setBuildType(0);
  1286 + patient.setModified(new Date());
  1287 + patient.setIsAutoFm(YnEnums.NO.getId());
  1288 + yunBookbuildingService.updatePregnant(patient, id);
  1289 +
  1290 + PersonModel pmodel = new PersonModel();
  1291 + pmodel.setName(yunRequest.getPregnantName());
  1292 + pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
  1293 + pmodel.setPhone(yunRequest.getPregnantPhone());
  1294 + pmodel.setCardNo(yunRequest.getPregnantCertificateNum());
  1295 + pmodel.setYn(YnEnums.YES.getId());
  1296 + pmodel.setModified(new Date());
  1297 + pmodel.setType(1);
  1298 + personService.updatePerson(pmodel, yunRequest.getPid());
  1299 + }
  1300 + }else if((i == -1 || i == 0) && beforePatient.getFmDate()!=null){//自动分娩改成孕妇后,有修改末次月经成满足分娩在自动分娩
  1301 + patientsService.setAutoMatDeliver(patient.getCardNo(), null);
  1302 + }
  1303 + } catch (Exception e) {
  1304 + e.printStackTrace();
  1305 + }
  1306 +
1259 1307 }
1260 1308  
1261 1309