Commit 62ad1321ec70f5aeb64377a45cd8a73c75d2abbe
1 parent
3d1bc1bdb8
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 45 additions and 32 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
62ad132
| ... | ... | @@ -4329,44 +4329,57 @@ |
| 4329 | 4329 | for (Organization org : organizationList) |
| 4330 | 4330 | { |
| 4331 | 4331 | System.out.println(org.getId()+org.getName()); |
| 4332 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
| 4333 | - antExRecordQuery.setHospitalId(org.getId()+""); | |
| 4334 | - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery); | |
| 4335 | - if (CollectionUtils.isNotEmpty(antExRecordModelList)) { | |
| 4336 | - int batchSize = 5000; | |
| 4337 | - int end = 0; | |
| 4338 | - for (int i = 0; i < antExRecordModelList.size(); i += batchSize) { | |
| 4339 | - end = (end + batchSize); | |
| 4340 | - if (end > antExRecordModelList.size()) { | |
| 4341 | - end = antExRecordModelList.size(); | |
| 4342 | - } | |
| 4343 | - System.out.println("start:" + i + ",end:" + end); | |
| 4344 | - final List<AntExRecordModel> tempList = antExRecordModelList.subList(i, end); | |
| 4332 | + int page = 1; | |
| 4333 | + int limit = 2000; | |
| 4334 | + while (true) | |
| 4335 | + { | |
| 4336 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
| 4337 | + antExRecordQuery.setHospitalId(org.getId()+""); | |
| 4338 | + antExRecordQuery.setPage(page); | |
| 4339 | + antExRecordQuery.setLimit(limit); | |
| 4340 | + antExRecordQuery.setNeed("true"); | |
| 4341 | + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery); | |
| 4342 | + page++; | |
| 4343 | + if (CollectionUtils.isNotEmpty(antExRecordModelList)) { | |
| 4344 | + int batchSize = 500; | |
| 4345 | + int end = 0; | |
| 4346 | + for (int i = 0; i < antExRecordModelList.size(); i += batchSize) { | |
| 4347 | + end = (end + batchSize); | |
| 4348 | + if (end > antExRecordModelList.size()) { | |
| 4349 | + end = antExRecordModelList.size(); | |
| 4350 | + } | |
| 4351 | + System.out.println("start:" + i + ",end:" + end); | |
| 4352 | + final List<AntExRecordModel> tempList = antExRecordModelList.subList(i, end); | |
| 4345 | 4353 | |
| 4346 | - new Thread(new Runnable() { | |
| 4347 | - @Override | |
| 4348 | - public void run() { | |
| 4349 | - if (CollectionUtils.isNotEmpty(tempList)) { | |
| 4350 | - for (AntExRecordModel antExRecordModel : tempList) { | |
| 4351 | - if (StringUtils.isNotEmpty(antExRecordModel.getParentId())) { | |
| 4352 | - Patients pats = patientsService.findOnePatientById(antExRecordModel.getParentId()); | |
| 4353 | - if (pats != null) | |
| 4354 | - { | |
| 4355 | - if (pats.getType() != null && pats.getType() == 3) | |
| 4354 | + commonThreadPool.execute(new Runnable() { | |
| 4355 | + @Override | |
| 4356 | + public void run() { | |
| 4357 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
| 4358 | + for (AntExRecordModel antExRecordModel : tempList) { | |
| 4359 | + if (StringUtils.isNotEmpty(antExRecordModel.getParentId())) { | |
| 4360 | + Patients pats = patientsService.findOnePatientById(antExRecordModel.getParentId()); | |
| 4361 | + if (pats != null) | |
| 4356 | 4362 | { |
| 4357 | - AntExRecordModel dbmodel = new AntExRecordModel(); | |
| 4358 | - dbmodel.setDueStatus(1); | |
| 4359 | - dbmodel.setId(antExRecordModel.getId()); | |
| 4360 | - recordService.updateOne(dbmodel, antExRecordModel.getId()); | |
| 4361 | - System.out.println(antExRecordModel.getId()); | |
| 4363 | + if (pats.getType() != null && pats.getType() == 3) | |
| 4364 | + { | |
| 4365 | + AntExRecordModel dbmodel = new AntExRecordModel(); | |
| 4366 | + dbmodel.setDueStatus(1); | |
| 4367 | + dbmodel.setId(antExRecordModel.getId()); | |
| 4368 | + recordService.updateOne(dbmodel, antExRecordModel.getId()); | |
| 4369 | + System.out.println(antExRecordModel.getId()); | |
| 4370 | + } | |
| 4362 | 4371 | } |
| 4363 | 4372 | } |
| 4364 | 4373 | } |
| 4365 | 4374 | } |
| 4366 | - } | |
| 4367 | 4375 | |
| 4368 | - } | |
| 4369 | - }).start(); | |
| 4376 | + } | |
| 4377 | + }); | |
| 4378 | + } | |
| 4379 | + } | |
| 4380 | + else | |
| 4381 | + { | |
| 4382 | + break; | |
| 4370 | 4383 | } |
| 4371 | 4384 | } |
| 4372 | 4385 | } |