Commit 5f7fb4961842c776046d4f1dd4d2488ffa513bb9
1 parent
8e9b062524
Exists in
dev
#fix:优化危急值管理功能模块、新增建档短信提醒
Showing 3 changed files with 347 additions and 70 deletions
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
View file @
5f7fb49
1 | 1 | package com.lyms.platform.permission.service.impl; |
2 | 2 | |
3 | +import com.lyms.platform.biz.dal.AssayConfigDao; | |
4 | +import com.lyms.platform.biz.param.ReferConfigQuery; | |
3 | 5 | import com.lyms.platform.biz.service.AntenatalExaminationService; |
6 | +import com.lyms.platform.biz.service.LisCrisisItemService; | |
4 | 7 | import com.lyms.platform.biz.service.PatientsService; |
8 | +import com.lyms.platform.biz.service.ReferConfigService; | |
5 | 9 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
10 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
11 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
6 | 12 | import com.lyms.platform.common.enums.YnEnums; |
7 | 13 | import com.lyms.platform.common.result.BaseResponse; |
8 | 14 | import com.lyms.platform.common.utils.DateUtil; |
9 | 15 | |
... | ... | @@ -14,12 +20,10 @@ |
14 | 20 | import com.lyms.platform.permission.model.LisReportQuery; |
15 | 21 | import com.lyms.platform.permission.service.LisService; |
16 | 22 | import com.lyms.platform.permission.service.OrganizationService; |
17 | -import com.lyms.platform.pojo.AntExChuModel; | |
18 | -import com.lyms.platform.pojo.AntenatalExaminationModel; | |
19 | -import com.lyms.platform.pojo.BasicConfig; | |
20 | -import com.lyms.platform.pojo.Patients; | |
23 | +import com.lyms.platform.pojo.*; | |
21 | 24 | import com.lyms.platform.query.AntExChuQuery; |
22 | 25 | import com.lyms.platform.query.AntExQuery; |
26 | +import com.lyms.platform.query.LisCrisisItemQuery; | |
23 | 27 | import com.lyms.platform.query.PatientsQuery; |
24 | 28 | import net.sf.json.JSONArray; |
25 | 29 | import net.sf.json.JSONObject; |
26 | 30 | |
... | ... | @@ -28,11 +32,12 @@ |
28 | 32 | import org.codehaus.jackson.type.TypeReference; |
29 | 33 | import org.springframework.beans.factory.annotation.Autowired; |
30 | 34 | import org.springframework.beans.factory.annotation.Qualifier; |
35 | +import org.springframework.data.domain.Sort; | |
31 | 36 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
32 | 37 | import org.springframework.stereotype.Service; |
33 | 38 | |
34 | -import java.util.ArrayList; | |
35 | -import java.util.List; | |
39 | +import java.math.BigDecimal; | |
40 | +import java.util.*; | |
36 | 41 | import java.util.concurrent.CountDownLatch; |
37 | 42 | import java.util.concurrent.Future; |
38 | 43 | import java.util.concurrent.TimeUnit; |
39 | 44 | |
... | ... | @@ -154,8 +159,12 @@ |
154 | 159 | |
155 | 160 | List<LisReportModel> lisReportModels = masterLisMapper.queryLisDataByModel(lisReportQuery); |
156 | 161 | saveLisUpdateData(lisReportModels.get(0)); |
157 | - | |
162 | + //TODO 处理大同危急值逻辑 | |
163 | + if ("2100002419".equals(model.getHospitalId())){ | |
164 | + saveLisCrisisItemList(model); | |
165 | + } | |
158 | 166 | } catch (Exception e) { |
167 | + System.out.println("LisSaveTask ->Exception,"+e); | |
159 | 168 | continue; |
160 | 169 | } |
161 | 170 | |
162 | 171 | |
163 | 172 | |
... | ... | @@ -166,8 +175,169 @@ |
166 | 175 | |
167 | 176 | } |
168 | 177 | } |
178 | + @Autowired | |
179 | + private ReferConfigService referConfigService; | |
169 | 180 | |
181 | + @Autowired | |
182 | + private LisCrisisItemService lisCrisisItemService; | |
170 | 183 | /** |
184 | + * 根据Lis数据同步大同高危急值 | |
185 | + * @param model | |
186 | + */ | |
187 | + public void saveLisCrisisItemList(LisReportModel model){ | |
188 | + System.out.println("saveLisCrisisItemList startup"); | |
189 | + //1获取孕妇pid | |
190 | + String hospitalId=model.getHospitalId(); | |
191 | + Patients patients = null; | |
192 | + List<Patients> list= null; | |
193 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
194 | + patientsQuery.setHospitalId(hospitalId); | |
195 | + patientsQuery.setName(model.getName()); | |
196 | + patientsQuery.setSort("created"); | |
197 | + patientsQuery.setVcCardNo(model.getVcCardNo()); | |
198 | + list = patientsService.queryPatient(patientsQuery); | |
199 | + if (list != null && list.size() > 0) { | |
200 | + patients = list.get(list.size() - 1); | |
201 | + } else { | |
202 | + patientsQuery.setPhone(model.getPhone()); | |
203 | + patientsQuery.setVcCardNo(null); | |
204 | + list = patientsService.queryPatient(patientsQuery); | |
205 | + if(list != null && list.size() > 0){ | |
206 | + patients = list.get(list.size() - 1); | |
207 | + } | |
208 | + | |
209 | + } | |
210 | + if(patients == null){ | |
211 | + System.out.println("lis query patients null"); | |
212 | + return; | |
213 | + } | |
214 | + | |
215 | + | |
216 | + LisCrisisItem crisisItem = new LisCrisisItem(); | |
217 | + crisisItem.setPid(patients.getPid()); | |
218 | + crisisItem.setPatientId(patients.getId()); | |
219 | + crisisItem.setPhone(patients.getPhone()); | |
220 | + crisisItem.setCardNo(patients.getCardNo()); | |
221 | + crisisItem.setPatientName(patients.getUsername()); | |
222 | + crisisItem.setServiceType(patients.getServiceType()); | |
223 | + crisisItem.setServiceStatus(patients.getServiceStatus()); | |
224 | + crisisItem.setLastMenses(patients.getLastMenses()); | |
225 | + crisisItem.setWeek(DateUtil.getWeek(patients.getLastMenses(), model.getPublishTime())); | |
226 | + crisisItem.setPublishTime(model.getPublishTime()); | |
227 | + try { | |
228 | + crisisItem.setAge(Integer.valueOf(model.getAge())); | |
229 | + }catch (Exception e){ | |
230 | + System.out.println("saveLisCrisisItemList->Exception e,"+e); | |
231 | + } | |
232 | + | |
233 | + // crisisItem.setApplyDoctorCode(model.getApplyDoctorCode()); | |
234 | + crisisItem.setApplyDoctorName(model.getApplyDoctor()); | |
235 | + crisisItem.setHospitalId(hospitalId); | |
236 | + crisisItem.setStatus(1); | |
237 | + crisisItem.setStatusName("待处理"); | |
238 | + crisisItem.setSyncStatus(0); | |
239 | + if (StringUtils.isNotEmpty(model.getItemJson())){ | |
240 | + ReferConfigQuery referConfigQuery = new ReferConfigQuery(); | |
241 | + referConfigQuery.setYn(YnEnums.YES.getId()); | |
242 | + referConfigQuery.setHospitalId(Integer.valueOf(hospitalId)); | |
243 | + referConfigQuery.setLimit(50); | |
244 | + List<ReferValue> referValueList = referConfigService.queryRefer(referConfigQuery); | |
245 | + Map<String, ReferValue> referValueMap = new HashMap<>(); | |
246 | + for (ReferValue referValue : referValueList) { | |
247 | + referValueMap.put(referValue.getCode(), referValue); | |
248 | + } | |
249 | + | |
250 | + List<LisReportItemModel> itemList= JsonUtil.jsonToList(model.getItemJson(),LisReportItemModel.class); | |
251 | + // crisis init | |
252 | + for (LisReportItemModel item : itemList) { | |
253 | + | |
254 | + ReferValue referValue = referValueMap.get(item.getCode().trim()); | |
255 | + if (referValue != null) { | |
256 | + //TODO 处理危急值逻辑 | |
257 | + boolean flag=buildEmergency(item.getResult(),referValue); | |
258 | + System.out.println("saveLisCrisisItemList flag"+flag); | |
259 | + if (flag) { | |
260 | + crisisItem.setId(model.getLisId() + "_" + item.getCode()); | |
261 | + crisisItem.setName(model.getType()); | |
262 | + crisisItem.setClassify(model.getType()); | |
263 | + crisisItem.setClassifyName(model.getType()); | |
264 | + crisisItem.setResult(item.getResult()); | |
265 | + //crisisItem.setFlag(item.getFlag()); | |
266 | + crisisItem.setItemCode(item.getCode().trim()); | |
267 | + crisisItem.setItemName(item.getName().trim()); | |
268 | + crisisItem.setRef(buildRef(referValue)); | |
269 | + crisisItem.setUnit(item.getUnit()); | |
270 | + lisCrisisItemService.addLisCrisisItem(crisisItem); | |
271 | + | |
272 | + //当前孕妇关联的初诊复诊医生危急通知 | |
273 | + /* Set<String> sets = antenatalExaminationFacade.getCrisisUnionDoc(patients); | |
274 | + | |
275 | + if (CollectionUtils.isNotEmpty(sets)) { | |
276 | + for (String doctorId : sets) { | |
277 | + LisCrisisNotify notify = new LisCrisisNotify(); | |
278 | + notify.setHospitalId(patients.getHospitalId()); | |
279 | + notify.setPatientId(patients.getId()); | |
280 | + notify.setStatus(0); | |
281 | + notify.setYn(1); | |
282 | + notify.setModified(new Date()); | |
283 | + notify.setCreated(new Date()); | |
284 | + notify.setDoctorId(doctorId); | |
285 | + | |
286 | + lisCrisisNotifyService.addLisCrisisNotify(notify); | |
287 | + } | |
288 | + }*/ | |
289 | + | |
290 | + | |
291 | + } | |
292 | + } | |
293 | + | |
294 | + } | |
295 | + System.out.println("saveLisCrisisItemList end"); | |
296 | + } | |
297 | + | |
298 | + } | |
299 | + | |
300 | + private boolean buildEmergency(String result,ReferValue referValue) { | |
301 | + boolean b=false; | |
302 | + if (StringUtils.isEmpty(result)){ | |
303 | + return b; | |
304 | + } | |
305 | + BigDecimal bd=new BigDecimal(result); | |
306 | + if (StringUtils.isNotBlank(referValue.getEmergencyMin()) && StringUtils.isNotBlank(referValue.getEmergencyMax())) { | |
307 | + if (bd.compareTo(new BigDecimal(referValue.getEmergencyMin()))<0 || | |
308 | + bd.compareTo(new BigDecimal((referValue.getEmergencyMax())))>0 ){ | |
309 | + b=true; | |
310 | + } | |
311 | + } else { | |
312 | + if (StringUtils.isNotBlank(referValue.getEmergencyMin())) { | |
313 | + if (bd.compareTo(new BigDecimal(referValue.getEmergencyMin()))<0){ | |
314 | + b=true; | |
315 | + } | |
316 | + } else if (StringUtils.isNotBlank(referValue.getEmergencyMax())) { | |
317 | + if (bd.compareTo(new BigDecimal(referValue.getEmergencyMax()))>0){ | |
318 | + b=true; | |
319 | + } | |
320 | + } | |
321 | + } | |
322 | + return b; | |
323 | + } | |
324 | + | |
325 | + | |
326 | + | |
327 | + private String buildRef(ReferValue referValue) { | |
328 | + if (StringUtils.isNotBlank(referValue.getEmergencyMin()) && StringUtils.isNotBlank(referValue.getEmergencyMax())) { | |
329 | + return "<"+referValue.getEmergencyMin() + " || " + ">"+referValue.getEmergencyMax(); | |
330 | + } else { | |
331 | + if (StringUtils.isNotBlank(referValue.getEmergencyMin())) { | |
332 | + return "<" + referValue.getEmergencyMin(); | |
333 | + } else if (StringUtils.isNotBlank(referValue.getEmergencyMax())) { | |
334 | + return ">" + referValue.getEmergencyMax(); | |
335 | + } | |
336 | + } | |
337 | + return ""; | |
338 | + } | |
339 | + | |
340 | + /** | |
171 | 341 | * 根据孕妇,修改检查项为空,检查项结果 |
172 | 342 | * |
173 | 343 | * @param model |
... | ... | @@ -195,7 +365,7 @@ |
195 | 365 | |
196 | 366 | } |
197 | 367 | if(patients == null){ |
198 | - System.out.println("lis query patients nulll"); | |
368 | + System.out.println("lis query patients null"); | |
199 | 369 | return; |
200 | 370 | } |
201 | 371 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
5f7fb49
... | ... | @@ -1198,7 +1198,7 @@ |
1198 | 1198 | mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); |
1199 | 1199 | mr.setWxTempId(WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId()); |
1200 | 1200 | messages.add(mr); |
1201 | - // smsConfigFacade.saveMsg(messages, patient.getHospitalId()); | |
1201 | + smsConfigFacade.saveMsg(messages, patient.getHospitalId()); | |
1202 | 1202 | } catch (InterruptedException e) { |
1203 | 1203 | logger.error("sendbuildingMsg Exception " + e); |
1204 | 1204 | } |
1205 | 1205 | |
... | ... | @@ -1268,12 +1268,101 @@ |
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | /** |
1271 | + * 建档短信提醒 | |
1272 | + */ | |
1273 | + public void bookbuildingSyncMsg() { | |
1274 | + logger.info("bookbuildingMsg startup"); | |
1275 | + List<String> hospitalList = new ArrayList<>(); | |
1276 | + hospitalList.add("2100002419"); | |
1277 | + hospitalList.add("1000000016"); | |
1278 | + hospitalList.add("2100002421"); | |
1279 | + hospitalList.add("1000000115"); | |
1280 | + hospitalList.add("2100001296"); | |
1281 | + hospitalList.add("2100001306"); | |
1282 | + | |
1283 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
1284 | + patientsQuery.setHospitalList(hospitalList); | |
1285 | + patientsQuery.setExtEnable(false); | |
1286 | + patientsQuery.setBuildTypeNot(1); | |
1287 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
1288 | + String time = DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(), -1)); | |
1289 | + Date createdTimeStart = DateUtil.parseYMDHMS(time + " 00:00:00"); | |
1290 | + Date createdTimeEnd = DateUtil.parseYMDHMS(time + " 23:59:59"); | |
1291 | + patientsQuery.setCreatedTimeStart(createdTimeStart); | |
1292 | + patientsQuery.setCreatedTimeEnd(createdTimeEnd); | |
1293 | + final List<Patients> patientList = patientsService.queryPatient(patientsQuery); | |
1294 | + | |
1295 | + if (CollectionUtils.isNotEmpty(patientList)) { | |
1296 | + final String date= DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(),0)); | |
1297 | + final String planTime = date+ " 16:30:00"; | |
1298 | + commonThreadPool.execute(new Runnable() { | |
1299 | + @Override | |
1300 | + public void run() { | |
1301 | + for (Patients patients : patientList) { | |
1302 | + //TODO 处理建档短信提醒逻辑 | |
1303 | + List<MsgRequest> messages = new ArrayList<>(); | |
1304 | + final String hospitalId=patients.getHospitalId(); | |
1305 | + String title = "建档成功提醒短信"; | |
1306 | + String messageContent = "【" + getHospitalName(hospitalId) + "】" + "您已成功建档!请微信-添加朋友-公众号-搜索“美生孕育”关注;点击开通成功提醒,手机号获取验证码成功登录宝贝孕程小程序。请您经常登录【宝贝孕程】小程序并持续关注【美生孕育】公众号,以便于您享受孕期的私有化服务,会依据您的年龄、孕周、单双胎、高危风险因素给予专题文章、个性指导、产检提醒等,让您了解、掌握和促进健康孕育,让我们携手并进一起迎接小宝宝的降生。"; | |
1307 | + MsgRequest request = new MsgRequest(); | |
1308 | + //1 推送服务, 2 推送和短信服务,3短信服务 | |
1309 | + request.setServiceType(3); | |
1310 | + //短信发送状态 | |
1311 | + request.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
1312 | + //平台ID | |
1313 | + request.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
1314 | + //服务对象 1孕妇 2儿童 3产妇 | |
1315 | + request.setObjType(1); | |
1316 | + request.setPhone(patients.getPhone()); | |
1317 | + request.setPlanTime(planTime); | |
1318 | + request.setSubTypeId(SmsServiceEnums.DXFW.getId()); | |
1319 | + request.setStatus(MsgStatusEnums.NO_SEND.getId()); | |
1320 | + request.setTimeType(2); | |
1321 | + request.setHospitalId(hospitalId); | |
1322 | + request.setPatientId(patients.getId()); | |
1323 | + request.setTempId(patients.getId()); | |
1324 | + request.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
1325 | + request.setFirst(messageContent); | |
1326 | + request.setKeyword1(title); | |
1327 | + request.setKeyword2(date); | |
1328 | + messages.add(request); | |
1329 | + smsConfigFacade.saveMsg(messages, hospitalId); | |
1330 | + } | |
1331 | + } | |
1332 | + }); | |
1333 | + } | |
1334 | + logger.info("bookbuildingMsg end"); | |
1335 | + } | |
1336 | + | |
1337 | + private static String getHospitalName(String hospitalId){ | |
1338 | + //TODO 暂时这样处理后期优化 | |
1339 | + if ("2100002419".equals(hospitalId)){ | |
1340 | + return "大同市第一人民医院"; | |
1341 | + }else if ("1000000016".equals(hospitalId)){ | |
1342 | + return "秦皇岛市第二医院"; | |
1343 | + }else if ("2100002421".equals(hospitalId)){ | |
1344 | + return "邢台威县人民医院"; | |
1345 | + }else if ("1000000115".equals(hospitalId)){ | |
1346 | + return "南和区人民医院"; | |
1347 | + }else if("2100001296".equals(hospitalId)){ | |
1348 | + return "临城县人民医院"; | |
1349 | + }else if("2100001306".equals(hospitalId)){ | |
1350 | + return "临西县人民医院"; | |
1351 | + } | |
1352 | + return ""; | |
1353 | + } | |
1354 | + | |
1355 | + public static void main(String[] args) { | |
1356 | + System.out.println( DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(),0))+ " 16:30:00"); | |
1357 | + } | |
1358 | + | |
1359 | + /** | |
1271 | 1360 | * 秦皇岛二院、大同产检提醒 上午9点推送 |
1272 | 1361 | */ |
1273 | 1362 | public void weekSync() { |
1274 | 1363 | logger.info("weekSync startup"); |
1275 | - // final String hospitalId = "1000000016"; | |
1276 | - List<String> hospitalList=new ArrayList<>(); | |
1364 | + // final String hospitalId = "1000000016"; | |
1365 | + List<String> hospitalList = new ArrayList<>(); | |
1277 | 1366 | hospitalList.add("2100002419"); |
1278 | 1367 | hospitalList.add("1000000016"); |
1279 | 1368 | PatientsQuery patientsQuery = new PatientsQuery(); |
... | ... | @@ -1298,7 +1387,7 @@ |
1298 | 1387 | if (StringUtils.isNotEmpty(week)) { |
1299 | 1388 | sendbuildingMsg(patients, SmsServiceEnums.CJYYTX.getId(), "【产检提醒】", "亲爱的孕妈妈,您当前孕周为" + params.get("weekDay") + "。", week); |
1300 | 1389 | |
1301 | - if ((CollectionUtils.isNotEmpty(patients.getRiskFactorId()) && patients.getRiskFactorId().size()>1 ) ||(!patients.getRiskFactorId().get(0).equals("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")) ) { | |
1390 | + if ((CollectionUtils.isNotEmpty(patients.getRiskFactorId()) && patients.getRiskFactorId().size() > 1) || (!patients.getRiskFactorId().get(0).equals("d42eec03-aa86-45b8-a4e0-78a0ff365fb6"))) { | |
1302 | 1391 | FactorProjectQuery factorProjectQuery = new FactorProjectQuery(); |
1303 | 1392 | factorProjectQuery.setHospitalId(Integer.valueOf(patients.getHospitalId())); |
1304 | 1393 | factorProjectQuery.setWeek(week); |
1305 | 1394 | |
1306 | 1395 | |
... | ... | @@ -3975,22 +4064,22 @@ |
3975 | 4064 | antExChuQuery.setParentId(patient.getId()); |
3976 | 4065 | antExChuQuery.setYn(1); |
3977 | 4066 | List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); |
3978 | - AntExChuModel antExChuModel; | |
3979 | - boolean a=false; | |
3980 | - if (CollectionUtils.isNotEmpty(antExChuModelList)){ | |
4067 | + AntExChuModel antExChuModel; | |
4068 | + boolean a = false; | |
4069 | + if (CollectionUtils.isNotEmpty(antExChuModelList)) { | |
3981 | 4070 | antExChuModel = antExChuModelList.get(0); |
3982 | - a=true; | |
3983 | - }else { | |
4071 | + a = true; | |
4072 | + } else { | |
3984 | 4073 | antExChuModel = new AntExChuModel(); |
3985 | 4074 | } |
3986 | 4075 | List<AntExRecordModel> antExRecordModels = antExRecordService.queryAntExRecords(antExRecordQuery); |
3987 | 4076 | AntExRecordModel antExRecordModel; |
3988 | - boolean r=false; | |
3989 | - if (CollectionUtils.isNotEmpty(antExRecordModels)){ | |
3990 | - antExRecordModel = antExRecordModels.get(0); | |
3991 | - r=true; | |
3992 | - }else { | |
3993 | - antExRecordModel=new AntExRecordModel(); | |
4077 | + boolean r = false; | |
4078 | + if (CollectionUtils.isNotEmpty(antExRecordModels)) { | |
4079 | + antExRecordModel = antExRecordModels.get(0); | |
4080 | + r = true; | |
4081 | + } else { | |
4082 | + antExRecordModel = new AntExRecordModel(); | |
3994 | 4083 | } |
3995 | 4084 | |
3996 | 4085 | String riskFactor = map.get("name"); |
... | ... | @@ -4045,9 +4134,9 @@ |
4045 | 4134 | } |
4046 | 4135 | } |
4047 | 4136 | yunBookbuildingService.update(patient, patient.getId()); |
4048 | - if (a){ | |
4049 | - antenatalExaminationService.updateAntExChu(antExChuModel,antExChuModel.getId()); | |
4050 | - }else { | |
4137 | + if (a) { | |
4138 | + antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId()); | |
4139 | + } else { | |
4051 | 4140 | antExChuModel.setParentId(patient.getId()); |
4052 | 4141 | antExChuModel.setName(patient.getUsername()); |
4053 | 4142 | antExChuModel.setYn(YnEnums.YES.getId()); |
... | ... | @@ -4063,9 +4152,9 @@ |
4063 | 4152 | //初诊是添加追访记录 |
4064 | 4153 | addTrackDownInfo(patient.getOperator(), patient); |
4065 | 4154 | } |
4066 | - if (r){ | |
4067 | - antExRecordService.updateOne(antExRecordModel,antExRecordModel.getId()); | |
4068 | - }else { | |
4155 | + if (r) { | |
4156 | + antExRecordService.updateOne(antExRecordModel, antExRecordModel.getId()); | |
4157 | + } else { | |
4069 | 4158 | antExRecordModel.setHospitalId(antExChuModel.getHospitalId()); |
4070 | 4159 | antExRecordModel.setLastMenses(antExChuModel.getLastMenses()); |
4071 | 4160 | antExRecordModel.setName(antExChuModel.getName()); |
4072 | 4161 | |
... | ... | @@ -4091,12 +4180,12 @@ |
4091 | 4180 | } |
4092 | 4181 | }); |
4093 | 4182 | } |
4094 | - }catch (Exception e){ | |
4095 | - logger.error("testUpdateBatch2 Exception,"+e); | |
4183 | + } catch (Exception e) { | |
4184 | + logger.error("testUpdateBatch2 Exception," + e); | |
4096 | 4185 | } |
4097 | 4186 | } |
4098 | 4187 | |
4099 | - public void updateBatch(String name){ | |
4188 | + public void updateBatch(String name) { | |
4100 | 4189 | try { |
4101 | 4190 | final List<Map<String, String>> list = ExcelUtil.readExcl("E:\\建档数据同步\\" + name, 1);// |
4102 | 4191 | for (final Map<String, String> map : list) { |
... | ... | @@ -4125,7 +4214,7 @@ |
4125 | 4214 | if (patients.size()>1){ |
4126 | 4215 | System.out.println(map.get("cardNo")); |
4127 | 4216 | }*/ |
4128 | - Patients patient=patients.get(0); | |
4217 | + Patients patient = patients.get(0); | |
4129 | 4218 | patient.setLastMenses(DateUtil.parseYMD(map.get("lastMenses"))); |
4130 | 4219 | if (CollectionUtils.isNotEmpty(users)) { |
4131 | 4220 | patient.setOperator(users.get(0).getId()); |
4132 | 4221 | |
... | ... | @@ -4150,27 +4239,27 @@ |
4150 | 4239 | } |
4151 | 4240 | |
4152 | 4241 | |
4153 | - PersonModel resperson = null; | |
4154 | - PersonModelQuery personModelQuery = new PersonModelQuery(); | |
4155 | - personModelQuery.setCardNo(map.get("cardNo")); | |
4156 | - personModelQuery.setYn(YnEnums.YES.getId()); | |
4157 | - personModelQuery.setTypes(new Integer[]{1, 3}); //孕妇或者产妇基本信息 | |
4158 | - List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
4242 | + PersonModel resperson = null; | |
4243 | + PersonModelQuery personModelQuery = new PersonModelQuery(); | |
4244 | + personModelQuery.setCardNo(map.get("cardNo")); | |
4245 | + personModelQuery.setYn(YnEnums.YES.getId()); | |
4246 | + personModelQuery.setTypes(new Integer[]{1, 3}); //孕妇或者产妇基本信息 | |
4247 | + List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
4159 | 4248 | |
4160 | - PersonModel pmodel = new PersonModel(); | |
4161 | - pmodel.setName(map.get("username").trim()); | |
4162 | - pmodel.setPhone(map.get("phone")); | |
4163 | - pmodel.setCardNo(map.get("cardNo")); | |
4164 | - pmodel.setType(type); | |
4165 | - pmodel.setModified(new Date()); | |
4166 | - if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) { | |
4167 | - resperson = personModels.get(0); | |
4168 | - personService.updatePerson(pmodel, personModels.get(0).getId()); | |
4169 | - } else { | |
4170 | - pmodel.setYn(YnEnums.YES.getId()); | |
4171 | - pmodel.setCreated(new Date()); | |
4172 | - resperson = personService.addPerson(pmodel); | |
4173 | - } | |
4249 | + PersonModel pmodel = new PersonModel(); | |
4250 | + pmodel.setName(map.get("username").trim()); | |
4251 | + pmodel.setPhone(map.get("phone")); | |
4252 | + pmodel.setCardNo(map.get("cardNo")); | |
4253 | + pmodel.setType(type); | |
4254 | + pmodel.setModified(new Date()); | |
4255 | + if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) { | |
4256 | + resperson = personModels.get(0); | |
4257 | + personService.updatePerson(pmodel, personModels.get(0).getId()); | |
4258 | + } else { | |
4259 | + pmodel.setYn(YnEnums.YES.getId()); | |
4260 | + pmodel.setCreated(new Date()); | |
4261 | + resperson = personService.addPerson(pmodel); | |
4262 | + } | |
4174 | 4263 | patient.setYn(1); |
4175 | 4264 | patient.setUsername(map.get("username")); |
4176 | 4265 | patient.setCardNo(map.get("cardNo")); |
... | ... | @@ -4221,9 +4310,9 @@ |
4221 | 4310 | getTrackHospital(patient); |
4222 | 4311 | |
4223 | 4312 | //孕妇档案 |
4224 | - yunBookbuildingService.update(patient,patient.getId()); | |
4225 | - }else { | |
4226 | - Patients patient=new Patients(); | |
4313 | + yunBookbuildingService.update(patient, patient.getId()); | |
4314 | + } else { | |
4315 | + Patients patient = new Patients(); | |
4227 | 4316 | patient.setLastMenses(DateUtil.parseYMD(map.get("lastMenses"))); |
4228 | 4317 | if (CollectionUtils.isNotEmpty(users)) { |
4229 | 4318 | patient.setOperator(users.get(0).getId()); |
... | ... | @@ -4627,7 +4716,7 @@ |
4627 | 4716 | try { |
4628 | 4717 | patientServiceFacade.addPatientService(patientService, patient.getOperator(), "2100001504"); |
4629 | 4718 | } catch (Exception e) { |
4630 | - System.out.println("孕妇建档服务开通异常!"+patient.toString()); | |
4719 | + System.out.println("孕妇建档服务开通异常!" + patient.toString()); | |
4631 | 4720 | e.printStackTrace(); |
4632 | 4721 | } |
4633 | 4722 | } |
... | ... | @@ -4832,7 +4921,7 @@ |
4832 | 4921 | patient.setLastReportDoctorName(users.get(0).getName()); |
4833 | 4922 | } |
4834 | 4923 | } |
4835 | - patient.setLastMenses(DateUtil.getCurrentDueDate(map.get("currentDueDate"),map.get("checkDate"))); | |
4924 | + patient.setLastMenses(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("checkDate"))); | |
4836 | 4925 | Integer type = 1; //1孕妇 2儿童 3产妇 |
4837 | 4926 | //建档类型 0 未分娩建档 1儿童建档时建档 2 自动分娩类型 3 转诊自动建档 |
4838 | 4927 | Integer buildType = 0; |
... | ... | @@ -4948,7 +5037,7 @@ |
4948 | 5037 | patient.setNextCheckTime(DateUtil.parseYMD(map.get("nextCheckTime"))); |
4949 | 5038 | if (patient.getDueDate() != null) { |
4950 | 5039 | } else { |
4951 | - patient.setDueDate(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.getCurrentDueDate(map.get("currentDueDate"),map.get("bookbuildingDate")), 42 * 7)))); | |
5040 | + patient.setDueDate(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("bookbuildingDate")), 42 * 7)))); | |
4952 | 5041 | } |
4953 | 5042 | OrganizationQuery organizationQuery = new OrganizationQuery(); |
4954 | 5043 | organizationQuery.setYn(YnEnums.YES.getId()); |
... | ... | @@ -5133,7 +5222,7 @@ |
5133 | 5222 | patient.setLastReportDoctorName(users.get(0).getName()); |
5134 | 5223 | } |
5135 | 5224 | } |
5136 | - patient.setLastMenses(DateUtil.getCurrentDueDate(map.get("currentDueDate"),map.get("checkDate"))); | |
5225 | + patient.setLastMenses(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("checkDate"))); | |
5137 | 5226 | Integer type = 1; //1孕妇 2儿童 3产妇 |
5138 | 5227 | //建档类型 0 未分娩建档 1儿童建档时建档 2 自动分娩类型 3 转诊自动建档 |
5139 | 5228 | Integer buildType = 0; |
... | ... | @@ -5248,7 +5337,7 @@ |
5248 | 5337 | patient.setNextCheckTime(DateUtil.parseYMD(map.get("nextCheckTime"))); |
5249 | 5338 | if (patient.getDueDate() != null) { |
5250 | 5339 | } else { |
5251 | - patient.setDueDate(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.getCurrentDueDate(map.get("currentDueDate"),map.get("checkDate")), 42 * 7)))); | |
5340 | + patient.setDueDate(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("checkDate")), 42 * 7)))); | |
5252 | 5341 | } |
5253 | 5342 | OrganizationQuery organizationQuery = new OrganizationQuery(); |
5254 | 5343 | organizationQuery.setYn(YnEnums.YES.getId()); |
5255 | 5344 | |
... | ... | @@ -5265,10 +5354,10 @@ |
5265 | 5354 | patient.setBookbuildingDoctor(String.valueOf(users.get(0).getId())); |
5266 | 5355 | } |
5267 | 5356 | } |
5268 | - // yunBookbuildingService.update(patient,patient.getId()); | |
5357 | + // yunBookbuildingService.update(patient,patient.getId()); | |
5269 | 5358 | } |
5270 | 5359 | |
5271 | - boolean a=false; | |
5360 | + boolean a = false; | |
5272 | 5361 | antExRecordQuery.setType(1); |
5273 | 5362 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
5274 | 5363 | antExChuQuery.setParentId(patient.getId()); |
... | ... | @@ -5280,7 +5369,7 @@ |
5280 | 5369 | antExRecordModel = antExRecordModels.get(0); |
5281 | 5370 | List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); |
5282 | 5371 | antExChuModel = antExChuModelList.get(0); |
5283 | - a=true; | |
5372 | + a = true; | |
5284 | 5373 | } else { |
5285 | 5374 | antExRecordModel = new AntExRecordModel(); |
5286 | 5375 | antExChuModel = new AntExChuModel(); |
... | ... | @@ -5365,10 +5454,10 @@ |
5365 | 5454 | antExRecordModel.setStatus(antExRecordModel.getDueDate().compareTo(new Date()) > 0 ? 2 : 1); |
5366 | 5455 | antExRecordModel.setDueStatus(antExRecordModel.getStatus()); |
5367 | 5456 | } |
5368 | - if (a){ | |
5369 | - antExRecordService.updateOne(antExRecordModel,antExRecordModel.getId()); | |
5370 | - antenatalExaminationService.updateAntExChu(antExChuModel,antExChuModel.getId()); | |
5371 | - }else { | |
5457 | + if (a) { | |
5458 | + antExRecordService.updateOne(antExRecordModel, antExRecordModel.getId()); | |
5459 | + antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId()); | |
5460 | + } else { | |
5372 | 5461 | antExRecordService.addOneRecord(antExRecordModel); |
5373 | 5462 | antenatalExaminationService.addOneAntEx(antExChuModel); |
5374 | 5463 | //初诊是添加追访记录 |
... | ... | @@ -5377,7 +5466,7 @@ |
5377 | 5466 | |
5378 | 5467 | } |
5379 | 5468 | if (num > 1) { |
5380 | - if (num==2){ | |
5469 | + if (num == 2) { | |
5381 | 5470 | antExRecordQuery.setType(2); |
5382 | 5471 | List<AntExRecordModel> antExRecordModels = antExRecordService.queryAntExRecords(antExRecordQuery); |
5383 | 5472 | if (CollectionUtils.isNotEmpty(antExRecordModels)) { |
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml
View file @
5f7fb49
... | ... | @@ -704,6 +704,22 @@ |
704 | 704 | <property name="cronExpression" value="0 0 9 * * ?"></property> |
705 | 705 | </bean> |
706 | 706 | |
707 | + <!--凌晨0点37点发送建档短信提醒 --> | |
708 | + <bean id="bookbuildingSyncMsgWork" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> | |
709 | + <!-- 要调用的bean --> | |
710 | + <property name="targetObject" ref="bookbuildingFacade"></property> | |
711 | + <!-- 要调用的Method --> | |
712 | + <property name="targetMethod" value="bookbuildingSyncMsg"></property> | |
713 | + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 --> | |
714 | + <property name="concurrent" value="false"></property> | |
715 | + </bean> | |
716 | + | |
717 | + <!-- 配置一个触发器 0 37 0 * * ?--> | |
718 | + <bean id="bookbuildingSyncMsgWorkTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> | |
719 | + <property name="jobDetail" ref="bookbuildingSyncMsgWork"></property> | |
720 | + <property name="cronExpression" value="0 37 0 * * ?"></property> | |
721 | + </bean> | |
722 | + | |
707 | 723 | <!-- 总调度,用于启动定时器 --> |
708 | 724 | <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> |
709 | 725 | <property name="triggers" > |
... | ... | @@ -773,6 +789,8 @@ |
773 | 789 | <ref bean="bookbuildingSyncWorkTrigger"/> |
774 | 790 | <!-- 秦皇岛二院产检提醒--> |
775 | 791 | <ref bean="weekSyncWorkTrigger"/> |
792 | + <!-- 建档短信提醒--> | |
793 | + <ref bean="bookbuildingSyncMsgWorkTrigger"/> | |
776 | 794 | </list> |
777 | 795 | </property> |
778 | 796 | </bean> |