Commit 6ad2993ebb4140c2584ebf5bfecaca23a36dbfc5
1 parent
8571949915
Exists in
master
and in
6 other branches
儿童服务同步
Showing 1 changed file with 29 additions and 26 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java
View file @
6ad2993
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | private BabyBookbuildingService babyBookbuildingService; |
31 | 31 | private PatientServiceService patientServiceService; |
32 | 32 | |
33 | - public BabyBuildSerToPatientSerWorker(int startIndex, int endIndex, BabyBookbuildingService babyBookbuildingService, PatientServiceService patientServiceService, boolean isSkip, int batchSize, int allCount) { | |
33 | + public BabyBuildSerToPatientSerWorker(int startIndex, int endIndex, BabyBookbuildingService babyBookbuildingService, PatientServiceService patientServiceService, boolean isSkip, int batchSize, int allCount) { | |
34 | 34 | this.allCount = allCount; |
35 | 35 | this.startIndex = startIndex; |
36 | 36 | this.endIndex = endIndex; |
37 | 37 | |
... | ... | @@ -51,10 +51,11 @@ |
51 | 51 | */ |
52 | 52 | @Override |
53 | 53 | public Object call() { |
54 | - try { | |
55 | - Map<String,Integer> patientsMap = new HashMap<>(); | |
56 | 54 | |
57 | - for (int i = startIndex; i < endIndex; i += batchSize) { | |
55 | + Map<String, Integer> patientsMap = new HashMap<>(); | |
56 | + | |
57 | + for (int i = startIndex; i < endIndex; i += batchSize) { | |
58 | + try { | |
58 | 59 | BabyModelQuery babyQuery = new BabyModelQuery(); |
59 | 60 | List list = new ArrayList(); |
60 | 61 | list.add("1");//转诊,建档已接受 |
61 | 62 | |
62 | 63 | |
... | ... | @@ -70,19 +71,19 @@ |
70 | 71 | babyQuery.setLimit(batchSize); |
71 | 72 | babyQuery.setPage((i + batchSize) / batchSize); |
72 | 73 | |
73 | - System.out.println("总数据量:"+allCount+",正在处理第:" + i+"--到--"+(i+batchSize)+",page:"+babyQuery.getPage()+",limit:"+babyQuery.getLimit()); | |
74 | + System.out.println("总数据量:" + allCount + ",正在处理第:" + i + "--到--" + (i + batchSize) + ",page:" + babyQuery.getPage() + ",limit:" + babyQuery.getLimit()); | |
74 | 75 | |
75 | 76 | List<BabyModel> patients = babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
76 | 77 | for (BabyModel pt : patients) { |
77 | - if(StringUtils.isEmpty(pt.getId())){ | |
78 | - System.out.println("建档主键id为空:"+pt.getId()); | |
79 | - }else if(patientsMap.containsKey(pt.getId())){//存在 | |
80 | - System.out.println("重复的主键:"+pt.getId()); | |
81 | - }else{ | |
82 | - patientsMap.put(pt.getId(),1); | |
78 | + if (StringUtils.isEmpty(pt.getId())) { | |
79 | + System.out.println("建档主键id为空:" + pt.getId()); | |
80 | + } else if (patientsMap.containsKey(pt.getId())) {//存在 | |
81 | + System.out.println("重复的主键:" + pt.getId()); | |
82 | + } else { | |
83 | + patientsMap.put(pt.getId(), 1); | |
83 | 84 | } |
84 | 85 | if (pt.getServiceType() == null) { |
85 | - System.out.println("服务类型不存在跳过数据:"+pt.getId()); | |
86 | + System.out.println("服务类型不存在跳过数据:" + pt.getId()); | |
86 | 87 | continue; |
87 | 88 | } |
88 | 89 | |
89 | 90 | |
90 | 91 | |
... | ... | @@ -99,13 +100,13 @@ |
99 | 100 | |
100 | 101 | //增值服务状态转换为服务状态 |
101 | 102 | convertZZFWtoPserStatus(pt, pser); |
102 | - }else{//标准服务 | |
103 | + } else {//标准服务 | |
103 | 104 | pser.setSerType(PatientSerEnums.SerTypeEnums.babyBzfw.getId()); |
104 | 105 | //标准服务状态转换成服务状态 |
105 | - convertBZFWtoPserStatus(pt,pser); | |
106 | + convertBZFWtoPserStatus(pt, pser); | |
106 | 107 | } |
107 | 108 | |
108 | - convertPatient(pt,pser); | |
109 | + convertPatient(pt, pser); | |
109 | 110 | if (isSkip) {//是否是增量 |
110 | 111 | PatientServiceQuery patientQuery = new PatientServiceQuery(); |
111 | 112 | patientQuery.setParentid(pt.getId()); |
112 | 113 | |
113 | 114 | |
114 | 115 | |
115 | 116 | |
116 | 117 | |
117 | 118 | |
... | ... | @@ -120,26 +121,28 @@ |
120 | 121 | patientServiceService.addPatientService(pser); |
121 | 122 | } |
122 | 123 | // System.out.println("endIndex:" + endIndex + "," + i + ":" + patients.size()); |
124 | + } catch (Exception e) { | |
125 | + e.printStackTrace(); | |
123 | 126 | } |
124 | 127 | |
125 | - System.out.println("线程处理数据完成,开始条数:"+startIndex+",结束条数:"+endIndex+",map:"+ patientsMap.size()); | |
126 | - } catch (Exception e) { | |
127 | - e.printStackTrace(); | |
128 | 128 | } |
129 | + | |
130 | + System.out.println("线程处理数据完成,开始条数:" + startIndex + ",结束条数:" + endIndex + ",map:" + patientsMap.size()); | |
131 | + | |
129 | 132 | return null; |
130 | 133 | } |
131 | 134 | |
132 | 135 | public void convertPatient(BabyModel pt, PatientService pser2) { |
133 | 136 | pser2.setIsOld(1); |
134 | 137 | pser2.setCreateUser(pt.getBuildDoctor()); |
135 | - if(pt.getBuildDate()!=null){ | |
138 | + if (pt.getBuildDate() != null) { | |
136 | 139 | pser2.setCreateDate(pt.getBuildDate()); |
137 | - }else{ | |
140 | + } else { | |
138 | 141 | pser2.setCreateDate(new Date()); |
139 | 142 | } //服务开通操作时间 |
140 | - if(pt.getBuildDate()!=null){ | |
143 | + if (pt.getBuildDate() != null) { | |
141 | 144 | pser2.setUpdateDate(pt.getBuildDate()); |
142 | - }else{ | |
145 | + } else { | |
143 | 146 | pser2.setUpdateDate(new Date()); |
144 | 147 | } |
145 | 148 | pser2.setParentid(pt.getId()); |
... | ... | @@ -168,8 +171,8 @@ |
168 | 171 | pser.setSerStatus(PatientSerEnums.SerStatusEnums.zt.getId()); |
169 | 172 | } |
170 | 173 | |
171 | - if(pser.getSerStatus() == null){ | |
172 | - System.out.println("增值服务没有服务状态:"+pt.getId()); | |
174 | + if (pser.getSerStatus() == null) { | |
175 | + System.out.println("增值服务没有服务状态:" + pt.getId()); | |
173 | 176 | pser.setSerStatus(PatientSerEnums.SerStatusEnums.gq.getId()); |
174 | 177 | } |
175 | 178 | } |
... | ... | @@ -184,8 +187,8 @@ |
184 | 187 | pser.setSerStatus(PatientSerEnums.SerStatusEnums.gq.getId()); |
185 | 188 | } |
186 | 189 | |
187 | - if(pser.getSerStatus() == null){ | |
188 | - System.out.println("标准服务没有服务状态:"+pt.getId()); | |
190 | + if (pser.getSerStatus() == null) { | |
191 | + System.out.println("标准服务没有服务状态:" + pt.getId()); | |
189 | 192 | pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); |
190 | 193 | } |
191 | 194 |