Commit 14a66810ec1315e564b0d072e41784ac3b9bb84a

Authored by jiangjiazhi
1 parent 63992a3017

1

Showing 1 changed file with 22 additions and 4 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanPatientWorker.java View file @ 14a6681
... ... @@ -94,7 +94,10 @@
94 94 stopWatch.start("query ant count");
95 95 //复诊次数
96 96 List<AntenatalExaminationModel> ant = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  97 + //系统复诊次数
97 98 int i = 0;
  99 + //系统初诊次数
  100 + int ichu=0;
98 101 if (CollectionUtils.isNotEmpty(ant)) {
99 102 //复诊次数
100 103 i = ant.size();
... ... @@ -116,6 +119,7 @@
116 119 antExChuQuery1.setPid(patients.getPid());
117 120 antExChuQuery1.setYn(YnEnums.YES.getId());
118 121 List<AntExChuModel> chu = antExService.queryAntExChu(antExChuQuery1);
  122 + ichu=chu.size();
119 123 for (AntExChuModel a : chu) {
120 124 try {
121 125 if (StringUtils.isNotEmpty(a.getHospitalId())) {
122 126  
... ... @@ -134,10 +138,11 @@
134 138 antExChuQuery.setYn(YnEnums.YES.getId());
135 139 antExChuQuery.setHospitalId(null);
136 140 //初诊次数
137   - int b = antExService.queryAntExChuCount(antExChuQuery.convertToQuery());
138   - quanPatientsResult.setcTimes(i + b);
  141 + if(0==ichu){
  142 + ichu = antExService.queryAntExChuCount(antExChuQuery.convertToQuery());
  143 + }
  144 + quanPatientsResult.setcTimes(i + ichu);
139 145  
140   -
141 146 antExChuQuery.setHospitalId(hospital);
142 147  
143 148 antExQuery.setHospitalId(hospital);
... ... @@ -145,7 +150,7 @@
145 150 int chi = antExService.queryAntExChuCount(antExChuQuery.convertToQuery());
146 151  
147 152 //本院复诊
148   - int chb = antExService.queryAntenatalExaminationCount(antExQuery.convertToQuery());
  153 + int chb = capLocalHospital(hospital,ant);
149 154 quanPatientsResult.setcHTimes(chi + chb);
150 155 stopWatch.stop();
151 156 String nextCheckTime = "";
... ... @@ -213,6 +218,19 @@
213 218 logger.debug(stopWatch.toString());
214 219 }
215 220 return data;
  221 + }
  222 +
  223 + private int capLocalHospital(String hospitalId,List<AntenatalExaminationModel> list){
  224 + if(CollectionUtils.isEmpty(list)){
  225 + return 0;
  226 + }
  227 + int count= 0;
  228 + for(AntenatalExaminationModel model:list){
  229 + if(model.getHospitalId().equals(hospitalId)){
  230 + count++;
  231 + }
  232 + }
  233 + return count;
216 234 }
217 235 }