Commit eba66cf1f182521ec10c31dc0a9bd32bd2f0ee66
1 parent
e78fbc95fb
Exists in
master
and in
1 other branch
批量处理最后产检医生
Showing 1 changed file with 34 additions and 33 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
eba66cf
... | ... | @@ -347,7 +347,7 @@ |
347 | 347 | @ResponseBody |
348 | 348 | @RequestMapping(value = "/syncPatientsLastCheckEmployeeId", method = RequestMethod.GET) |
349 | 349 | public void syncPatientsLastCheckEmployeeId(@RequestParam String hospitalId, |
350 | - @RequestParam(required = false) int batchSize) { | |
350 | + @RequestParam(required = false) String size) { | |
351 | 351 | PatientsQuery patientsQuery = new PatientsQuery(); |
352 | 352 | patientsQuery.setYn(YnEnums.YES.getId()); |
353 | 353 | // 医院id |
... | ... | @@ -362,9 +362,7 @@ |
362 | 362 | List<Patients> patientsList = patientsService.queryPatient(patientsQuery); |
363 | 363 | System.out.println("本次读取了【" + patientsList.size() + "】条数据"); |
364 | 364 | |
365 | - if (batchSize == 0) { | |
366 | - batchSize = 1000; | |
367 | - } | |
365 | + int batchSize = StringUtils.isEmpty(size) ? 1000 : Integer.valueOf(size); | |
368 | 366 | int end = 0; |
369 | 367 | |
370 | 368 | for (int i = 0; i < patientsList.size(); i += batchSize) { |
371 | 369 | |
372 | 370 | |
373 | 371 | |
... | ... | @@ -379,36 +377,39 @@ |
379 | 377 | if (CollectionUtils.isNotEmpty(tempList)) { |
380 | 378 | for (Patients patients : tempList) { |
381 | 379 | |
382 | - String id = patients.getId(); | |
383 | - String hospitalId = patients.getHospitalId(); | |
380 | + if (StringUtils.isEmpty(patients.getLastCheckEmployeeId())) { | |
384 | 381 | |
385 | - String lastCheckEmployeeId = null; | |
386 | - String flag; | |
382 | + String id = patients.getId(); | |
383 | + String hospitalId = patients.getHospitalId(); | |
387 | 384 | |
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(); | |
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 = "初诊"; | |
406 | 408 | } |
407 | - flag = "初诊"; | |
408 | - } | |
409 | - if (!StringUtils.isEmpty(lastCheckEmployeeId)) { | |
410 | - patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
411 | - System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); | |
409 | + if (!StringUtils.isEmpty(lastCheckEmployeeId)) { | |
410 | + patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
411 | + System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); | |
412 | + } | |
412 | 413 | } |
413 | 414 | } |
414 | 415 | } |