Commit 7d9dde2861a5ac3b2ae172e40e680dcea58ea412

Authored by hanshaofeng

Merge remote-tracking branch 'origin/master'

Showing 2 changed files

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 7d9dde2
... ... @@ -288,47 +288,62 @@
288 288  
289 289 @RequestMapping(value = "/syncPatNextTime", method = RequestMethod.GET)
290 290 @ResponseBody
291   - public String syncPatNextTime() {
  291 + public String syncPatNextTime(@RequestParam(required = true) String hid) {
292 292 PatientsQuery patientQuery = new PatientsQuery();
293 293 patientQuery.setYn(YnEnums.YES.getId());
294   -// patientQuery.setHospitalId("221");
  294 + patientQuery.setHospitalId(hid);
295 295 patientQuery.setType(1);
296 296 List<Patients> patientses = patientsService.queryPatient(patientQuery);
297   - if (CollectionUtils.isNotEmpty(patientses))
298   - {
299   - for (Patients pat : patientses) {
300   - AntExChuQuery antExChuQuery = new AntExChuQuery();
301   - antExChuQuery.setYn(YnEnums.YES.getId());
302   - antExChuQuery.setHospitalId(pat.getHospitalId());
303   - antExChuQuery.setParentId(pat.getId());
304   - List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery);
305   - if (CollectionUtils.isNotEmpty(chus)) {
306   - Date nextTime = null;
307   - AntExChuModel chu = chus.get(0);
308   - if (chu != null)
  297 + int batchSize = 1000;
  298 + int end = 0;
  299 + for (int i = 0; i < patientses.size(); i += batchSize) {
  300 + end = (end + batchSize);
  301 + if (end > patientses.size()) {
  302 + end = patientses.size();
  303 + }
  304 + System.out.println("start:" + i + ",end:" + end);
  305 + final List<Patients> tempList = patientses.subList(i, end);
  306 + new Thread(new Runnable() {
  307 + @Override
  308 + public void run() {
  309 + if (CollectionUtils.isNotEmpty(tempList))
309 310 {
310   - nextTime = chu.getNextCheckTime();
  311 + for (Patients pat : tempList) {
  312 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  313 + antExChuQuery.setYn(YnEnums.YES.getId());
  314 + antExChuQuery.setHospitalId(pat.getHospitalId());
  315 + antExChuQuery.setParentId(pat.getId());
  316 + List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery);
  317 + if (CollectionUtils.isNotEmpty(chus)) {
  318 + Date nextTime = null;
  319 + AntExChuModel chu = chus.get(0);
  320 + if (chu != null)
  321 + {
  322 + nextTime = chu.getNextCheckTime();
  323 + AntExQuery antExQuery = new AntExQuery();
  324 + antExQuery.setParentId(pat.getId());
  325 + antExQuery.setYn(YnEnums.YES.getId());
  326 + antExQuery.setHospitalId(pat.getHospitalId());
  327 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  328 + if (CollectionUtils.isNotEmpty(list))
  329 + {
  330 + AntenatalExaminationModel ae = list.get(0);
  331 + if (ae != null)
  332 + {
  333 + nextTime = ae.getNextCheckTime();
  334 + }
  335 + }
  336 + patientsService.updatePatientOneCol(pat.getId(), nextTime);
311 337  
312   - AntExQuery antExQuery = new AntExQuery();
313   - antExQuery.setParentId(pat.getId());
314   - antExQuery.setYn(YnEnums.YES.getId());
315   - antExQuery.setHospitalId(pat.getHospitalId());
316   - List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
317   - if (CollectionUtils.isNotEmpty(list))
318   - {
319   - AntenatalExaminationModel ae = list.get(0);
320   - if (ae != null)
321   - {
322   - nextTime = ae.getNextCheckTime();
  338 + }
  339 +
323 340 }
324 341 }
325   - patientsService.updatePatientOneCol(pat.getId(), nextTime);
326   -
327 342 }
328   -
329 343 }
330   - }
  344 + });
331 345 }
  346 +
332 347 return "syncPatNextTime finish";
333 348 }
334 349  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java View file @ 7d9dde2
... ... @@ -64,7 +64,7 @@
64 64 sb.append(getName1(areaId,basicConfigService));
65 65 }
66 66 if (StringUtils.isNotEmpty(streetId)){
67   - sb.append(getName(streetId,basicConfigService));
  67 + sb.append(getName1(streetId,basicConfigService));
68 68 }
69 69 if (StringUtils.isNotEmpty(address)) {
70 70 sb.append(address);