Commit 40c968a9ad7d371f531ed224b1e2efae50f28f05

Authored by liquanyu
1 parent 15edbe4709

复诊修改优化

Showing 1 changed file with 64 additions and 49 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 40c968a
... ... @@ -347,10 +347,9 @@
347 347 return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("同一天只能建一次复诊");
348 348 }
349 349  
350   - final Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
  350 + final Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
  351 + model.setPid(patients.getPid());
351 352  
352   - antenatalExaminationService.addOneBabyAnt(model);
353   - final AntenatalExaminationModel modelTemp = model;
354 353 commonThreadPool.execute(new Runnable() {
355 354 @Override
356 355 public void run() {
357 356  
358 357  
359 358  
360 359  
361 360  
362 361  
363 362  
... ... @@ -359,26 +358,44 @@
359 358 patients1.setId(patients.getId());
360 359 patients1.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
361 360  
362   - modelTemp.setPid(patients.getPid());
363 361 if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
364 362 patients1.setEnable("1");
365 363 }
366 364  
367   -
368 365 patientsService.updateNextCheckTime(antExAddRequest.getNextCheckTime(), patients.getId());
369 366 patientsService.updatePatient(patients1);
370 367 patientsService.updatePatientOneCol(patients.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(antExAddRequest.getNextCheckTime()) ? null : DateUtil.parseYMD(antExAddRequest.getNextCheckTime()));
  368 + }
  369 + });
371 370  
372   - operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), modelTemp, OptActionEnums.ADD.getId(), "添加复诊");
373 371  
  372 + antenatalExaminationService.addOneBabyAnt(model);
374 373  
375 374  
  375 + operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), model, OptActionEnums.ADD.getId(), "添加复诊");
  376 +
  377 + /** 验证产检券是否可用 可用就改为已使用状态 */
  378 + if (StringUtils.isNotBlank(antExAddRequest.getCouponCode()) && antExAddRequest.getCouponType() != null) {
  379 + BaseObjectResponse resp = couponService.validate(antExAddRequest.getCouponCode(), antExAddRequest.getCouponType(), autoMatchFacade.getHospitalId(userId));
  380 + if (resp.getErrorcode() != 0) {
  381 + return resp;
  382 + } else {
  383 + couponService.use(autoMatchFacade.getHospitalId(userId), antExAddRequest.getCouponCode(), userId, model.getId());
  384 + }
  385 + }
  386 +
  387 + //修改申请单状态
  388 + updateApplyOrder(model, antExAddRequest.getParentId());
  389 + final String aid = model.getId();
  390 + commonThreadPool.execute(new Runnable() {
  391 + @Override
  392 + public void run() {
  393 +
376 394 //修改最后一次检查时间
377 395 setLashCTimes(antExAddRequest.getParentId());
378   - //修改申请单状态
379   - updateApplyOrder(modelTemp, antExAddRequest.getParentId());
  396 +
380 397 //修改孕妇高危等级
381   - //updatePatientRiskLevel(model, patients);
  398 + // updatePatientRiskLevel(model, patients);
382 399 //修改孕妇高危
383 400 updateLastRisk(antExAddRequest.getParentId());
384 401  
385 402  
... ... @@ -388,51 +405,49 @@
388 405 //修改数据
389 406 syncMaster(antExAddRequest.getParentId(), antExAddRequest.getNextCheckTime());
390 407 //复诊,修改产检管理
391   - antenatalExaminationService.updateAntExRecord(modelTemp.getId(), 2);
392   - if (null != patients.getBuildType() && patients.getBuildType() == 3) {
393   - ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
394   - referralApplyOrderQuery.setParentId(patients.getId());
395   - String hospital = autoMatchFacade.getHospitalId(userId);
396   - referralApplyOrderQuery.setHospitalId(hospital);
397   - referralApplyOrderQuery.setStatus(1);
398   - List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery);
399   - if (CollectionUtils.isNotEmpty(orderModelList)) {
400   - String outHospitalId = orderModelList.get(0).getOutHospitalId();
401   - ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery();
402   - referralApplyOrderQuery1.setOutHospitalId(outHospitalId);
403   - referralApplyOrderQuery1.setTransferredHospital(hospital);
404   - referralApplyOrderQuery1.setPid(patients.getPid());
405   - referralApplyOrderQuery1.setStatus(1);
406   - ReferralApplyOrderModel model1 = new ReferralApplyOrderModel();
407   - //设置接收时间
408   - model1.setReceived(modelTemp.getCheckDate());
409   - model1.setRecDoctor(modelTemp.getCheckDoctor());
410   - model1.setModified(new Date());
411   - model1.setStatus(2);
412   - applyOrderService.updateByParentId(referralApplyOrderQuery1, model1);
413   - ReferralApplyOrderQuery referralApplyOrderQuery2 = new ReferralApplyOrderQuery();
414   - referralApplyOrderQuery2.setOutHospitalId(hospital);
415   - referralApplyOrderQuery2.setTransferredHospital(outHospitalId);
416   - referralApplyOrderQuery2.setPid(patients.getPid());
417   - referralApplyOrderQuery2.setStatus(1);
418   - applyOrderService.updateByParentId(referralApplyOrderQuery2, model1);
419   - }
420   - }
  408 + antenatalExaminationService.updateAntExRecord(aid, 2);
  409 + }});
  410 +
  411 +
  412 + if (null != patients.getBuildType() && patients.getBuildType() == 3) {
  413 + ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
  414 + referralApplyOrderQuery.setParentId(patients.getId());
  415 + String hospital = autoMatchFacade.getHospitalId(userId);
  416 + referralApplyOrderQuery.setHospitalId(hospital);
  417 + referralApplyOrderQuery.setStatus(1);
  418 + List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery);
  419 + if (CollectionUtils.isNotEmpty(orderModelList)) {
  420 + String outHospitalId = orderModelList.get(0).getOutHospitalId();
  421 + ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery();
  422 + referralApplyOrderQuery1.setOutHospitalId(outHospitalId);
  423 + referralApplyOrderQuery1.setTransferredHospital(hospital);
  424 + referralApplyOrderQuery1.setPid(patients.getPid());
  425 + referralApplyOrderQuery1.setStatus(1);
  426 + ReferralApplyOrderModel model1 = new ReferralApplyOrderModel();
  427 + //设置接收时间
  428 + model1.setReceived(model.getCheckDate());
  429 + model1.setRecDoctor(model.getCheckDoctor());
  430 + model1.setModified(new Date());
  431 + model1.setStatus(2);
  432 + applyOrderService.updateByParentId(referralApplyOrderQuery1, model1);
  433 + ReferralApplyOrderQuery referralApplyOrderQuery2 = new ReferralApplyOrderQuery();
  434 + referralApplyOrderQuery2.setOutHospitalId(hospital);
  435 + referralApplyOrderQuery2.setTransferredHospital(outHospitalId);
  436 + referralApplyOrderQuery2.setPid(patients.getPid());
  437 + referralApplyOrderQuery2.setStatus(1);
  438 + applyOrderService.updateByParentId(referralApplyOrderQuery2, model1);
  439 + }
  440 + }
  441 +
  442 +
  443 + commonThreadPool.execute(new Runnable() {
  444 + @Override
  445 + public void run() {
421 446 //添加复诊时添加追访信息
422 447 addTrackDownInfo(userId,patients);
423 448 }
424 449 });
425 450  
426   -
427   - /** 验证产检券是否可用 可用就改为已使用状态 */
428   - if (StringUtils.isNotBlank(antExAddRequest.getCouponCode()) && antExAddRequest.getCouponType() != null) {
429   - BaseObjectResponse resp = couponService.validate(antExAddRequest.getCouponCode(), antExAddRequest.getCouponType(), autoMatchFacade.getHospitalId(userId));
430   - if (resp.getErrorcode() != 0) {
431   - return resp;
432   - } else {
433   - couponService.use(autoMatchFacade.getHospitalId(userId), antExAddRequest.getCouponCode(), userId, model.getId());
434   - }
435   - }
436 451 }
437 452  
438 453 commonThreadPool.execute(new Runnable() {