From 62ad1321ec70f5aeb64377a45cd8a73c75d2abbe Mon Sep 17 00:00:00 2001 From: liquanyu Date: Sat, 6 Feb 2021 17:59:38 +0800 Subject: [PATCH] update --- .../operate/web/controller/TestController.java | 77 +++++++++++++--------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java index eca1643..04fec2d 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java @@ -4329,44 +4329,57 @@ public class TestController extends BaseController { for (Organization org : organizationList) { System.out.println(org.getId()+org.getName()); - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); - antExRecordQuery.setHospitalId(org.getId()+""); - List antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery); - if (CollectionUtils.isNotEmpty(antExRecordModelList)) { - int batchSize = 5000; - int end = 0; - for (int i = 0; i < antExRecordModelList.size(); i += batchSize) { - end = (end + batchSize); - if (end > antExRecordModelList.size()) { - end = antExRecordModelList.size(); - } - System.out.println("start:" + i + ",end:" + end); - final List tempList = antExRecordModelList.subList(i, end); - - new Thread(new Runnable() { - @Override - public void run() { - if (CollectionUtils.isNotEmpty(tempList)) { - for (AntExRecordModel antExRecordModel : tempList) { - if (StringUtils.isNotEmpty(antExRecordModel.getParentId())) { - Patients pats = patientsService.findOnePatientById(antExRecordModel.getParentId()); - if (pats != null) - { - if (pats.getType() != null && pats.getType() == 3) + int page = 1; + int limit = 2000; + while (true) + { + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); + antExRecordQuery.setHospitalId(org.getId()+""); + antExRecordQuery.setPage(page); + antExRecordQuery.setLimit(limit); + antExRecordQuery.setNeed("true"); + List antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery); + page++; + if (CollectionUtils.isNotEmpty(antExRecordModelList)) { + int batchSize = 500; + int end = 0; + for (int i = 0; i < antExRecordModelList.size(); i += batchSize) { + end = (end + batchSize); + if (end > antExRecordModelList.size()) { + end = antExRecordModelList.size(); + } + System.out.println("start:" + i + ",end:" + end); + final List tempList = antExRecordModelList.subList(i, end); + + commonThreadPool.execute(new Runnable() { + @Override + public void run() { + if (CollectionUtils.isNotEmpty(tempList)) { + for (AntExRecordModel antExRecordModel : tempList) { + if (StringUtils.isNotEmpty(antExRecordModel.getParentId())) { + Patients pats = patientsService.findOnePatientById(antExRecordModel.getParentId()); + if (pats != null) { - AntExRecordModel dbmodel = new AntExRecordModel(); - dbmodel.setDueStatus(1); - dbmodel.setId(antExRecordModel.getId()); - recordService.updateOne(dbmodel, antExRecordModel.getId()); - System.out.println(antExRecordModel.getId()); + if (pats.getType() != null && pats.getType() == 3) + { + AntExRecordModel dbmodel = new AntExRecordModel(); + dbmodel.setDueStatus(1); + dbmodel.setId(antExRecordModel.getId()); + recordService.updateOne(dbmodel, antExRecordModel.getId()); + System.out.println(antExRecordModel.getId()); + } } } } } - } - } - }).start(); + } + }); + } + } + else + { + break; } } } -- 1.8.3.1