From eba66cf1f182521ec10c31dc0a9bd32bd2f0ee66 Mon Sep 17 00:00:00 2001 From: hujiaqi Date: Fri, 2 Dec 2016 14:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=A4=84=E7=90=86=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=BA=A7=E6=A3=80=E5=8C=BB=E7=94=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/controller/TestController.java | 67 +++++++++++----------- 1 file changed, 34 insertions(+), 33 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 e3c86f9..fc01997 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 @@ -347,7 +347,7 @@ public class TestController { @ResponseBody @RequestMapping(value = "/syncPatientsLastCheckEmployeeId", method = RequestMethod.GET) public void syncPatientsLastCheckEmployeeId(@RequestParam String hospitalId, - @RequestParam(required = false) int batchSize) { + @RequestParam(required = false) String size) { PatientsQuery patientsQuery = new PatientsQuery(); patientsQuery.setYn(YnEnums.YES.getId()); // 医院id @@ -362,9 +362,7 @@ public class TestController { List patientsList = patientsService.queryPatient(patientsQuery); System.out.println("本次读取了【" + patientsList.size() + "】条数据"); - if (batchSize == 0) { - batchSize = 1000; - } + int batchSize = StringUtils.isEmpty(size) ? 1000 : Integer.valueOf(size); int end = 0; for (int i = 0; i < patientsList.size(); i += batchSize) { @@ -379,36 +377,39 @@ public class TestController { if (CollectionUtils.isNotEmpty(tempList)) { for (Patients patients : tempList) { - String id = patients.getId(); - String hospitalId = patients.getHospitalId(); - - String lastCheckEmployeeId = null; - String flag; - - // 查询复诊,如果没有再查询初诊 - AntExQuery antExQuery = new AntExQuery(); - antExQuery.setYn(YnEnums.YES.getId()); - antExQuery.setParentId(id); - antExQuery.setHospitalId(hospitalId); - List antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); - if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { - lastCheckEmployeeId = antenatalExaminationModelList.get(0).getCheckDoctor(); - flag = "复诊"; - } else { - // 查询初诊 - AntExChuQuery antExChuQuery = new AntExChuQuery(); - antExChuQuery.setYn(YnEnums.YES.getId()); - antExChuQuery.setParentId(id); - antExChuQuery.setHospitalId(hospitalId); - List antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); - if (antExChuModelList.size() == 1) { - lastCheckEmployeeId = antExChuModelList.get(0).getProdDoctor(); + if (StringUtils.isEmpty(patients.getLastCheckEmployeeId())) { + + String id = patients.getId(); + String hospitalId = patients.getHospitalId(); + + String lastCheckEmployeeId = null; + String flag; + + // 查询复诊,如果没有再查询初诊 + AntExQuery antExQuery = new AntExQuery(); + antExQuery.setYn(YnEnums.YES.getId()); + antExQuery.setParentId(id); + antExQuery.setHospitalId(hospitalId); + List antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { + lastCheckEmployeeId = antenatalExaminationModelList.get(0).getCheckDoctor(); + flag = "复诊"; + } else { + // 查询初诊 + AntExChuQuery antExChuQuery = new AntExChuQuery(); + antExChuQuery.setYn(YnEnums.YES.getId()); + antExChuQuery.setParentId(id); + antExChuQuery.setHospitalId(hospitalId); + List antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); + if (antExChuModelList.size() == 1) { + lastCheckEmployeeId = antExChuModelList.get(0).getProdDoctor(); + } + flag = "初诊"; + } + if (!StringUtils.isEmpty(lastCheckEmployeeId)) { + patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); + System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); } - flag = "初诊"; - } - if (!StringUtils.isEmpty(lastCheckEmployeeId)) { - patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); - System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); } } } -- 1.8.3.1