Commit 96bc34000ec800a327008bf65808784fedb1c8a7
1 parent
9a79d71109
Exists in
master
and in
6 other branches
commit
Showing 1 changed file with 29 additions and 14 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
96bc340
| ... | ... | @@ -21,9 +21,12 @@ |
| 21 | 21 | import org.apache.commons.collections.CollectionUtils; |
| 22 | 22 | import org.apache.commons.lang.StringUtils; |
| 23 | 23 | import org.apache.commons.lang.math.NumberUtils; |
| 24 | +import org.slf4j.Logger; | |
| 25 | +import org.slf4j.LoggerFactory; | |
| 24 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 27 | import org.springframework.data.domain.Sort; |
| 26 | 28 | import org.springframework.stereotype.Component; |
| 29 | +import org.springframework.util.StopWatch; | |
| 27 | 30 | |
| 28 | 31 | import java.util.*; |
| 29 | 32 | |
| ... | ... | @@ -34,6 +37,8 @@ |
| 34 | 37 | */ |
| 35 | 38 | @Component |
| 36 | 39 | public class AntenatalExaminationFacade { |
| 40 | + | |
| 41 | + private static final Logger logger = LoggerFactory.getLogger(AntenatalExaminationFacade.class); | |
| 37 | 42 | @Autowired |
| 38 | 43 | private AntenatalExaminationService antenatalExaminationService; |
| 39 | 44 | @Autowired |
| 40 | 45 | |
| 41 | 46 | |
| 42 | 47 | |
| 43 | 48 | |
| ... | ... | @@ -386,18 +391,22 @@ |
| 386 | 391 | * @return |
| 387 | 392 | */ |
| 388 | 393 | public BaseResponse addOneAnetExChu(AntExcAddRequest excAddRequest, Integer userId) { |
| 394 | + StopWatch stopWatch =new StopWatch("addOneAnetExChu"); | |
| 389 | 395 | |
| 396 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 390 | 397 | /** 验证产检券是否可用 可用就改为已使用状态 */ |
| 391 | 398 | if(StringUtils.isNotBlank(excAddRequest.getCouponCode()) && excAddRequest.getCouponType() != null) { |
| 392 | - BaseObjectResponse resp = couponService.validate(excAddRequest.getCouponCode(), excAddRequest.getCouponType(), autoMatchFacade.getHospitalId(userId)); | |
| 399 | + stopWatch.start("couponService.validate"); | |
| 400 | + BaseObjectResponse resp = couponService.validate(excAddRequest.getCouponCode(), excAddRequest.getCouponType(),hospitalId); | |
| 401 | + stopWatch.stop(); | |
| 393 | 402 | if(resp.getErrorcode() != 0) { |
| 394 | 403 | return resp; |
| 395 | 404 | } |
| 396 | 405 | } |
| 397 | 406 | |
| 398 | 407 | AntExChuModel antExChuModel = excAddRequest.convertToDataModel(); |
| 399 | - String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 400 | 408 | |
| 409 | + | |
| 401 | 410 | //表示区域的 |
| 402 | 411 | if (StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId))) { |
| 403 | 412 | String parentId = handHideBuild(excAddRequest.getPid(), excAddRequest.getParentId(), userId, 1); |
| 404 | 413 | |
| 405 | 414 | |
| ... | ... | @@ -445,9 +454,10 @@ |
| 445 | 454 | AntExChuQuery antExChuQuery1 = new AntExChuQuery(); |
| 446 | 455 | antExChuQuery1.setParentId(excAddRequest.getParentId()); |
| 447 | 456 | antExChuQuery1.setYn(YnEnums.YES.getId()); |
| 457 | + stopWatch.start("queryAntExChu"); | |
| 448 | 458 | List<AntExChuModel> data1 = antenatalExaminationService.queryAntExChu(antExChuQuery1); |
| 459 | + stopWatch.stop(); | |
| 449 | 460 | |
| 450 | - | |
| 451 | 461 | //初诊只能建一次 |
| 452 | 462 | // 修改关联券的使用状态,如果已使用,则返回错误码 |
| 453 | 463 | if (StringUtils.isNotBlank(antExChuModel.getBarCode())) { |
| 454 | 464 | |
| 455 | 465 | |
| 456 | 466 | |
| 457 | 467 | |
| 458 | 468 | |
| 459 | 469 | |
| 460 | 470 | |
| 461 | 471 | |
| 462 | 472 | |
| 463 | 473 | |
| 464 | 474 | |
| ... | ... | @@ -474,36 +484,44 @@ |
| 474 | 484 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
| 475 | 485 | antExChuQuery.setYn(YnEnums.YES.getId()); |
| 476 | 486 | antExChuQuery.setHospitalId(hospitalId); |
| 477 | - | |
| 487 | + stopWatch.start("queryPatient"); | |
| 478 | 488 | List<Patients> list = patientsService.queryPatient(patientsQuery); |
| 489 | + stopWatch.stop(); | |
| 479 | 490 | antExChuQuery.setStart(list.get(0).getCreated()); |
| 480 | 491 | antExChuQuery.setParentId(excAddRequest.getParentId()); |
| 492 | + stopWatch.start("queryAntExChu"); | |
| 481 | 493 | List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery); |
| 494 | + stopWatch.stop(); | |
| 482 | 495 | if (CollectionUtils.isNotEmpty(data)) { |
| 483 | 496 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("您本次妊娠中已在本医院建档"); |
| 484 | 497 | } |
| 485 | 498 | |
| 486 | 499 | antExChuModel.setPid(patients.getPid()); |
| 487 | 500 | antExChuModel.setYn(YnEnums.YES.getId()); |
| 488 | - antExChuModel.setHospitalId(autoMatchFacade.getHospitalId(userId)); | |
| 501 | + antExChuModel.setHospitalId(hospitalId); | |
| 502 | + stopWatch.start("queryAntExChu"); | |
| 489 | 503 | antenatalExaminationService.addOneAntEx(antExChuModel); |
| 504 | + stopWatch.stop(); | |
| 490 | 505 | /** 把优惠券设置为已使用状态 */ |
| 506 | + stopWatch.start("couponService.use"); | |
| 491 | 507 | couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, antExChuModel.getId()); |
| 492 | - | |
| 508 | + stopWatch.stop(); | |
| 493 | 509 | //修改患者风险等级 |
| 494 | 510 | |
| 495 | 511 | patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor()); |
| 496 | 512 | |
| 497 | 513 | patientsService.updatePatient(patients); |
| 498 | - patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(),patients.getId()); | |
| 514 | + patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId()); | |
| 499 | 515 | updateLastRisk(patients.getId()); |
| 500 | 516 | |
| 501 | 517 | //修改本院最后一次定义高危 |
| 502 | 518 | updateLastRhTime(patients.getId(), hospitalId); |
| 503 | 519 | setLashCTimes(antExChuModel.getParentId()); |
| 504 | - | |
| 520 | + stopWatch.start("updateAntExRecord"); | |
| 505 | 521 | antenatalExaminationService.updateAntExRecord(antExChuModel.getId(), 1); |
| 522 | + stopWatch.stop(); | |
| 506 | 523 | syncMaster(excAddRequest.getParentId(),excAddRequest.getNextCheckTime()); |
| 524 | + logger.info(stopWatch.toString()); | |
| 507 | 525 | if (null != patients.getBuildType() && patients.getBuildType() == 3) { |
| 508 | 526 | Patients patients1 = new Patients(); |
| 509 | 527 | patients1.setEnable("1"); |
| 510 | 528 | |
| ... | ... | @@ -511,15 +529,14 @@ |
| 511 | 529 | patientsService.updatePatient(patients1); |
| 512 | 530 | ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); |
| 513 | 531 | referralApplyOrderQuery.setParentId(patients.getId()); |
| 514 | - String hospital = autoMatchFacade.getHospitalId(userId); | |
| 515 | - referralApplyOrderQuery.setHospitalId(hospital); | |
| 532 | + referralApplyOrderQuery.setHospitalId(hospitalId); | |
| 516 | 533 | referralApplyOrderQuery.setStatus(1); |
| 517 | 534 | List<ReferralApplyOrderModel> orderModelList = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery); |
| 518 | 535 | if (CollectionUtils.isNotEmpty(orderModelList)) { |
| 519 | 536 | String outHospitalId = orderModelList.get(0).getOutHospitalId(); |
| 520 | 537 | ReferralApplyOrderQuery referralApplyOrderQuery1 = new ReferralApplyOrderQuery(); |
| 521 | 538 | referralApplyOrderQuery1.setOutHospitalId(outHospitalId); |
| 522 | - referralApplyOrderQuery1.setTransferredHospital(hospital); | |
| 539 | + referralApplyOrderQuery1.setTransferredHospital(hospitalId); | |
| 523 | 540 | referralApplyOrderQuery1.setPid(patients.getPid()); |
| 524 | 541 | |
| 525 | 542 | ReferralApplyOrderModel model = new ReferralApplyOrderModel(); |
| 526 | 543 | |
| ... | ... | @@ -531,12 +548,10 @@ |
| 531 | 548 | applyOrderService.updateByParentId(referralApplyOrderQuery1, model); |
| 532 | 549 | |
| 533 | 550 | ReferralApplyOrderQuery referralApplyOrderQuery2 = new ReferralApplyOrderQuery(); |
| 534 | - referralApplyOrderQuery2.setOutHospitalId(hospital); | |
| 551 | + referralApplyOrderQuery2.setOutHospitalId(hospitalId); | |
| 535 | 552 | referralApplyOrderQuery2.setTransferredHospital(outHospitalId); |
| 536 | 553 | referralApplyOrderQuery2.setPid(patients.getPid()); |
| 537 | 554 | applyOrderService.updateByParentId(referralApplyOrderQuery2, model); |
| 538 | - | |
| 539 | - | |
| 540 | 555 | } |
| 541 | 556 | } |
| 542 | 557 | } else { |