Commit 38cc06e8a4711ab8d04de119081eaf8d604cea68

Authored by jiangjiazhi
1 parent e8d1bf34d1

commit

Showing 1 changed file with 17 additions and 3 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 38cc06e
... ... @@ -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 javax.servlet.http.HttpServletResponse;
29 32 import java.io.IOException;
... ... @@ -35,7 +38,7 @@
35 38 */
36 39 @Component
37 40 public class PatientFacade {
38   -
  41 + private Logger logger = LoggerFactory.getLogger(PatientFacade.class);
39 42 @Autowired
40 43 private PatientsService patientsService;
41 44 @Autowired
42 45  
... ... @@ -283,7 +286,12 @@
283 286 patientsQuery.setHospitalId(hospital);
284 287 patientsQuery.setNeed(needPage);
285 288 //查询符合条件的孕妇
  289 + StopWatch stopWatch=new StopWatch("queryPatient1 -"+hospital);
  290 + stopWatch.start();
286 291 List<Patients> patientses = patientsService.queryPatient1(patientsQuery, "modified");
  292 + stopWatch.stop();
  293 +
  294 + logger.info(stopWatch.toString());
287 295 List data = new ArrayList<>();
288 296 if (CollectionUtils.isNotEmpty(patientses)) {
289 297 //如果是查高危孕妇
... ... @@ -509,6 +517,7 @@
509 517 List data = new ArrayList<>();
510 518 // String hospital = autoMatchFacade.getHospitalId(userId);
511 519 for (Patients patients : patientses) {
  520 + StopWatch stopWatch=new StopWatch("convert -"+patients.getId());
512 521 RiskPatientsResult riskPatientsResult = new RiskPatientsResult();
513 522 riskPatientsResult.convertToResult(patients);
514 523 if (StringUtils.isNotEmpty(patients.getBookbuildingDoctor())) {
... ... @@ -528,7 +537,7 @@
528 537 antExQuery.setPid(patients.getPid());
529 538 antExQuery.setYn(YnEnums.YES.getId());
530 539 antExQuery.setHospitalId(null);
531   -
  540 + stopWatch.start("cap antex count");
532 541 //复诊次数
533 542 int i = antExService.queryAntenatalExaminationCount(antExQuery.convertToQuery());
534 543 antExChuQuery.setPid(patients.getPid());
... ... @@ -545,6 +554,8 @@
545 554 riskPatientsResult.setcTimes(i + b);
546 555 riskPatientsResult.setcHTimes(chi + chb);
547 556 String nextCheckTime = "";
  557 + stopWatch.stop();
  558 + stopWatch.start("query antex count");
548 559  
549 560 List<AntenatalExaminationModel> examinationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
550 561 if (CollectionUtils.isNotEmpty(examinationModels)) {
551 562  
552 563  
553 564  
... ... @@ -571,15 +582,18 @@
571 582 }
572 583 }
573 584 }
  585 + stopWatch.stop();
574 586  
575   -
576 587 riskPatientsResult.setServiceType(ServiceTypeEnums.getTitleById(patients.getServiceType()));
577 588 riskPatientsResult.setServiceStatus(ServiceStatusEnums.getNameById(patients.getServiceStatus()));
578 589 riskPatientsResult.setcTime(nextCheckTime);
  590 + stopWatch.start("query findLastRisk");
579 591 HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getPid(), true);
580 592 riskPatientsResult.setrFactor(highScoreResult.gethighRiskStr());
581 593 riskPatientsResult.setrLevel(highScoreResult.filter(highScoreResult.getLevel()));
582 594 riskPatientsResult.sethScore(highScoreResult.getScore());
  595 + stopWatch.stop();
  596 + logger.info(stopWatch.toString());
583 597 data.add(riskPatientsResult);
584 598 }
585 599 return data;