Commit 79122eb1db5288965f9e2d3f8bb15030b4f78ee4
1 parent
6e1e2f694a
Exists in
master
and in
1 other branch
批量处理最后产检医生
Showing 1 changed file with 27 additions and 35 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
79122eb
... | ... | @@ -361,10 +361,8 @@ |
361 | 361 | // 查询 |
362 | 362 | List<Patients> patientsList = patientsService.queryPatient(patientsQuery); |
363 | 363 | System.out.println("本次读取了【" + patientsList.size() + "】条数据"); |
364 | - | |
365 | 364 | int batchSize = StringUtils.isEmpty(size) ? 1000 : Integer.valueOf(size); |
366 | 365 | int end = 0; |
367 | - | |
368 | 366 | for (int i = 0; i < patientsList.size(); i += batchSize) { |
369 | 367 | end = (end + batchSize); |
370 | 368 | if (end > patientsList.size()) { |
371 | 369 | |
... | ... | @@ -376,40 +374,34 @@ |
376 | 374 | public void run() { |
377 | 375 | if (CollectionUtils.isNotEmpty(tempList)) { |
378 | 376 | for (Patients patients : tempList) { |
379 | - | |
380 | - if (StringUtils.isEmpty(patients.getLastCheckEmployeeId())) { | |
381 | - | |
382 | - String id = patients.getId(); | |
383 | - String hospitalId = patients.getHospitalId(); | |
384 | - | |
385 | - String lastCheckEmployeeId = null; | |
386 | - String flag; | |
387 | - | |
388 | - // 查询复诊,如果没有再查询初诊 | |
389 | - AntExQuery antExQuery = new AntExQuery(); | |
390 | - antExQuery.setYn(YnEnums.YES.getId()); | |
391 | - antExQuery.setParentId(id); | |
392 | - antExQuery.setHospitalId(hospitalId); | |
393 | - List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
394 | - if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { | |
395 | - lastCheckEmployeeId = antenatalExaminationModelList.get(0).getCheckDoctor(); | |
396 | - flag = "复诊"; | |
397 | - } else { | |
398 | - // 查询初诊 | |
399 | - AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
400 | - antExChuQuery.setYn(YnEnums.YES.getId()); | |
401 | - antExChuQuery.setParentId(id); | |
402 | - antExChuQuery.setHospitalId(hospitalId); | |
403 | - List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
404 | - if (antExChuModelList.size() == 1) { | |
405 | - lastCheckEmployeeId = antExChuModelList.get(0).getProdDoctor(); | |
406 | - } | |
407 | - flag = "初诊"; | |
377 | + String id = patients.getId(); | |
378 | + String hospitalId = patients.getHospitalId(); | |
379 | + String lastCheckEmployeeId = null; | |
380 | + String flag; | |
381 | + // 查询复诊,如果没有再查询初诊 | |
382 | + AntExQuery antExQuery = new AntExQuery(); | |
383 | + antExQuery.setYn(YnEnums.YES.getId()); | |
384 | + antExQuery.setParentId(id); | |
385 | + antExQuery.setHospitalId(hospitalId); | |
386 | + List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
387 | + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { | |
388 | + lastCheckEmployeeId = antenatalExaminationModelList.get(0).getCheckDoctor(); | |
389 | + flag = "复诊"; | |
390 | + } else { | |
391 | + // 查询初诊 | |
392 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
393 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
394 | + antExChuQuery.setParentId(id); | |
395 | + antExChuQuery.setHospitalId(hospitalId); | |
396 | + List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
397 | + if (antExChuModelList.size() == 1) { | |
398 | + lastCheckEmployeeId = antExChuModelList.get(0).getProdDoctor(); | |
408 | 399 | } |
409 | - if (!StringUtils.isEmpty(lastCheckEmployeeId)) { | |
410 | - patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
411 | - System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); | |
412 | - } | |
400 | + flag = "初诊"; | |
401 | + } | |
402 | + if (!StringUtils.isEmpty(lastCheckEmployeeId)) { | |
403 | + patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
404 | + System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); | |
413 | 405 | } |
414 | 406 | } |
415 | 407 | } |