From 6ad2993ebb4140c2584ebf5bfecaca23a36dbfc5 Mon Sep 17 00:00:00 2001 From: yangfei Date: Wed, 10 Jan 2018 00:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=84=BF=E7=AB=A5=E6=9C=8D=E5=8A=A1=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/worker/BabyBuildSerToPatientSerWorker.java | 55 ++++++++++++---------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java index 462e431..f87a579 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java @@ -30,7 +30,7 @@ public class BabyBuildSerToPatientSerWorker implements Callable { private BabyBookbuildingService babyBookbuildingService; private PatientServiceService patientServiceService; - public BabyBuildSerToPatientSerWorker(int startIndex, int endIndex, BabyBookbuildingService babyBookbuildingService, PatientServiceService patientServiceService, boolean isSkip, int batchSize, int allCount) { + public BabyBuildSerToPatientSerWorker(int startIndex, int endIndex, BabyBookbuildingService babyBookbuildingService, PatientServiceService patientServiceService, boolean isSkip, int batchSize, int allCount) { this.allCount = allCount; this.startIndex = startIndex; this.endIndex = endIndex; @@ -51,10 +51,11 @@ public class BabyBuildSerToPatientSerWorker implements Callable { */ @Override public Object call() { - try { - Map patientsMap = new HashMap<>(); - for (int i = startIndex; i < endIndex; i += batchSize) { + Map patientsMap = new HashMap<>(); + + for (int i = startIndex; i < endIndex; i += batchSize) { + try { BabyModelQuery babyQuery = new BabyModelQuery(); List list = new ArrayList(); list.add("1");//转诊,建档已接受 @@ -70,19 +71,19 @@ public class BabyBuildSerToPatientSerWorker implements Callable { babyQuery.setLimit(batchSize); babyQuery.setPage((i + batchSize) / batchSize); - System.out.println("总数据量:"+allCount+",正在处理第:" + i+"--到--"+(i+batchSize)+",page:"+babyQuery.getPage()+",limit:"+babyQuery.getLimit()); + System.out.println("总数据量:" + allCount + ",正在处理第:" + i + "--到--" + (i + batchSize) + ",page:" + babyQuery.getPage() + ",limit:" + babyQuery.getLimit()); List patients = babyBookbuildingService.queryBabyBuildByCond(babyQuery); for (BabyModel pt : patients) { - if(StringUtils.isEmpty(pt.getId())){ - System.out.println("建档主键id为空:"+pt.getId()); - }else if(patientsMap.containsKey(pt.getId())){//存在 - System.out.println("重复的主键:"+pt.getId()); - }else{ - patientsMap.put(pt.getId(),1); + if (StringUtils.isEmpty(pt.getId())) { + System.out.println("建档主键id为空:" + pt.getId()); + } else if (patientsMap.containsKey(pt.getId())) {//存在 + System.out.println("重复的主键:" + pt.getId()); + } else { + patientsMap.put(pt.getId(), 1); } if (pt.getServiceType() == null) { - System.out.println("服务类型不存在跳过数据:"+pt.getId()); + System.out.println("服务类型不存在跳过数据:" + pt.getId()); continue; } @@ -99,13 +100,13 @@ public class BabyBuildSerToPatientSerWorker implements Callable { //增值服务状态转换为服务状态 convertZZFWtoPserStatus(pt, pser); - }else{//标准服务 + } else {//标准服务 pser.setSerType(PatientSerEnums.SerTypeEnums.babyBzfw.getId()); //标准服务状态转换成服务状态 - convertBZFWtoPserStatus(pt,pser); + convertBZFWtoPserStatus(pt, pser); } - convertPatient(pt,pser); + convertPatient(pt, pser); if (isSkip) {//是否是增量 PatientServiceQuery patientQuery = new PatientServiceQuery(); patientQuery.setParentid(pt.getId()); @@ -120,26 +121,28 @@ public class BabyBuildSerToPatientSerWorker implements Callable { patientServiceService.addPatientService(pser); } // System.out.println("endIndex:" + endIndex + "," + i + ":" + patients.size()); + } catch (Exception e) { + e.printStackTrace(); } - System.out.println("线程处理数据完成,开始条数:"+startIndex+",结束条数:"+endIndex+",map:"+ patientsMap.size()); - } catch (Exception e) { - e.printStackTrace(); } + + System.out.println("线程处理数据完成,开始条数:" + startIndex + ",结束条数:" + endIndex + ",map:" + patientsMap.size()); + return null; } public void convertPatient(BabyModel pt, PatientService pser2) { pser2.setIsOld(1); pser2.setCreateUser(pt.getBuildDoctor()); - if(pt.getBuildDate()!=null){ + if (pt.getBuildDate() != null) { pser2.setCreateDate(pt.getBuildDate()); - }else{ + } else { pser2.setCreateDate(new Date()); } //服务开通操作时间 - if(pt.getBuildDate()!=null){ + if (pt.getBuildDate() != null) { pser2.setUpdateDate(pt.getBuildDate()); - }else{ + } else { pser2.setUpdateDate(new Date()); } pser2.setParentid(pt.getId()); @@ -168,8 +171,8 @@ public class BabyBuildSerToPatientSerWorker implements Callable { pser.setSerStatus(PatientSerEnums.SerStatusEnums.zt.getId()); } - if(pser.getSerStatus() == null){ - System.out.println("增值服务没有服务状态:"+pt.getId()); + if (pser.getSerStatus() == null) { + System.out.println("增值服务没有服务状态:" + pt.getId()); pser.setSerStatus(PatientSerEnums.SerStatusEnums.gq.getId()); } } @@ -184,8 +187,8 @@ public class BabyBuildSerToPatientSerWorker implements Callable { pser.setSerStatus(PatientSerEnums.SerStatusEnums.gq.getId()); } - if(pser.getSerStatus() == null){ - System.out.println("标准服务没有服务状态:"+pt.getId()); + if (pser.getSerStatus() == null) { + System.out.println("标准服务没有服务状态:" + pt.getId()); pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); } -- 1.8.3.1