Commit 5e0f4540b4e45f71155f901a579e0bf02333e923

Authored by liquanyu
1 parent f19169fa68

复诊修改优化

Showing 1 changed file with 59 additions and 42 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 5e0f454
... ... @@ -29,10 +29,12 @@
29 29 import org.slf4j.Logger;
30 30 import org.slf4j.LoggerFactory;
31 31 import org.springframework.beans.factory.annotation.Autowired;
  32 +import org.springframework.beans.factory.annotation.Qualifier;
32 33 import org.springframework.data.domain.Sort;
33 34 import org.springframework.data.mongodb.core.MongoTemplate;
34 35 import org.springframework.data.mongodb.core.query.Criteria;
35 36 import org.springframework.data.mongodb.core.query.Query;
  37 +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
36 38 import org.springframework.stereotype.Component;
37 39 import org.springframework.util.StopWatch;
38 40  
... ... @@ -113,6 +115,11 @@
113 115 @Autowired
114 116 private SieveFacade sieveFacade;
115 117  
  118 +
  119 + @Autowired
  120 + @Qualifier("commonThreadPool")
  121 + private ThreadPoolTaskExecutor commonThreadPool;
  122 +
116 123 /**
117 124 * 处理区域隐藏建档
118 125 *
119 126  
... ... @@ -257,9 +264,12 @@
257 264 * @param antExAddRequest
258 265 * @return
259 266 */
260   - public BaseResponse addOneAntEx(AntExAddRequest antExAddRequest, Integer userId) {
261   - String hospitalId = autoMatchFacade.getHospitalId(userId);
  267 + public BaseResponse addOneAntEx(final AntExAddRequest antExAddRequest, final Integer userId) {
  268 + final String hospitalId = autoMatchFacade.getHospitalId(userId);
262 269 AntenatalExaminationModel model = antExAddRequest.convertToDataModel();
  270 +
  271 + final String otherRisk = model.getOtherRisk();
  272 +
263 273 //表示区域的
264 274 if (StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId))) {
265 275 String parentId = handHideBuild(antExAddRequest.getPid(), antExAddRequest.getParentId(), userId, 1);
266 276  
... ... @@ -268,10 +278,16 @@
268 278 }
269 279 model.setParentId(parentId);
270 280 antExAddRequest.setParentId(parentId);
271   - Patients p = patientsService.findOnePatientById(parentId);
272 281  
273   - //加入产筛
274   - patientsService.validata(p);
  282 + final Patients p = patientsService.findOnePatientById(parentId);
  283 +
  284 + commonThreadPool.execute(new Runnable() {
  285 + @Override
  286 + public void run() {
  287 + //加入产筛
  288 + patientsService.validata(p);
  289 + }
  290 + });
275 291 }
276 292  
277 293  
278 294  
279 295  
280 296  
281 297  
282 298  
283 299  
284 300  
... ... @@ -282,32 +298,42 @@
282 298 //修改申请单状态
283 299 updateApplyOrder(model, antExAddRequest.getParentId());
284 300  
285   - Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
  301 + final Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
286 302  
287   - patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
288   - patientsService.updateNextCheckTime(antExAddRequest.getNextCheckTime(), patients.getId());
289   - patientsService.updatePatient(patients);
290   - patientsService.updatePatientOneCol(patients.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(antExAddRequest.getNextCheckTime()) ? null : DateUtil.parseYMD(antExAddRequest.getNextCheckTime()));
291   - //修改孕妇高危等级
292   - updateLastRisk(antExAddRequest.getParentId());
  303 + final AntenatalExaminationModel tempModel = model;
293 304  
294   - //修改本院最后一次定义高危
295   - updateLastRhTime(patients.getId(), hospitalId);
296   - //修改最后一次检查时间
297   - setLashCTimes(antExAddRequest.getParentId());
298 305  
  306 + commonThreadPool.execute(new Runnable() {
  307 + @Override
  308 + public void run() {
  309 + patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
  310 + patientsService.updateNextCheckTime(antExAddRequest.getNextCheckTime(), patients.getId());
  311 + patientsService.updatePatient(patients);
  312 + patientsService.updatePatientOneCol(patients.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(antExAddRequest.getNextCheckTime()) ? null : DateUtil.parseYMD(antExAddRequest.getNextCheckTime()));
  313 + //修改孕妇高危等级
  314 + updateLastRisk(antExAddRequest.getParentId());
299 315  
300   - //修改数据
301   - syncMaster(antExAddRequest.getParentId(), antExAddRequest.getNextCheckTime());
  316 + //修改本院最后一次定义高危
  317 + updateLastRhTime(patients.getId(), hospitalId);
  318 + //修改最后一次检查时间
  319 + setLashCTimes(antExAddRequest.getParentId());
302 320  
303   - //复诊,修改产检管理
304   - antenatalExaminationService.updateAntExRecord(antExAddRequest.getId(), 2);
305 321  
  322 + //修改数据
  323 + syncMaster(antExAddRequest.getParentId(), antExAddRequest.getNextCheckTime());
306 324  
307   - AntExQuery antExQuery = new AntExQuery();
308   - antExQuery.setId(antExAddRequest.getId());
309   - List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
310   - operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospitalId), list.get(0), model, OptActionEnums.UPDATE.getId(), "修改复诊");
  325 + //复诊,修改产检管理
  326 + antenatalExaminationService.updateAntExRecord(antExAddRequest.getId(), 2);
  327 +
  328 +
  329 + AntExQuery antExQuery = new AntExQuery();
  330 + antExQuery.setId(antExAddRequest.getId());
  331 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  332 + operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospitalId), list.get(0), tempModel, OptActionEnums.UPDATE.getId(), "修改复诊");
  333 +
  334 + }
  335 + });
  336 +
311 337 } else {
312 338 model.setOperator(userId);
313 339 model.setYn(YnEnums.YES.getId());
... ... @@ -321,22 +347,6 @@
321 347 return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("同一天只能建一次复诊");
322 348 }
323 349  
324   - // 修改关联券的使用状态,如果已使用,则返回错误码
325   - //初诊只能建一次
326   - /* if (StringUtils.isNotBlank(model.getBarCode())) {
327   - PatientCheckTicketQuery checkTicketQuery = new PatientCheckTicketQuery();
328   - checkTicketQuery.setPid(model.getPid());
329   - checkTicketQuery.setId(model.getBarCode());
330   - checkTicketQuery.setStatus(1);
331   - if (patientCheckTicketService.queryTicketCount(checkTicketQuery) > 0) {
332   - String code = patientCheckTicketService.updateTicket(model.getBarCode(), 2, model.getHospitalId());
333   - if (code != null) {
334   - return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg(code);
335   - }
336   - } else {
337   - return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("该产检劵不属于本人");
338   - }
339   - }*/
340 350 Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
341 351 Patients patients1 = new Patients();
342 352 patients1.setId(patients.getId());
... ... @@ -414,8 +424,15 @@
414 424 //添加复诊时添加追访信息
415 425 addTrackDownInfo(userId,patients);
416 426 }
417   - //处理自定义高危状态为已使用状态
418   - highRiskFacade.dispHospHighRiskUse(model.getOtherRisk());
  427 +
  428 + commonThreadPool.execute(new Runnable() {
  429 + @Override
  430 + public void run() {
  431 + //处理自定义高危状态为已使用状态
  432 + highRiskFacade.dispHospHighRiskUse(otherRisk);
  433 + }
  434 + });
  435 +
419 436  
420 437 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
421 438 }