Commit efeee3ec9c99f128791ba45624c7c60e2d3384ab
1 parent
99dec23eed
Exists in
master
and in
6 other branches
建档优化
Showing 1 changed file with 51 additions and 35 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
efeee3e
... | ... | @@ -35,10 +35,12 @@ |
35 | 35 | import org.slf4j.Logger; |
36 | 36 | import org.slf4j.LoggerFactory; |
37 | 37 | import org.springframework.beans.factory.annotation.Autowired; |
38 | +import org.springframework.beans.factory.annotation.Qualifier; | |
38 | 39 | import org.springframework.data.domain.Sort; |
39 | 40 | import org.springframework.data.mongodb.core.MongoTemplate; |
40 | 41 | import org.springframework.data.mongodb.core.query.Criteria; |
41 | 42 | import org.springframework.data.mongodb.core.query.Query; |
43 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
42 | 44 | import org.springframework.stereotype.Component; |
43 | 45 | |
44 | 46 | import javax.servlet.http.HttpServletResponse; |
... | ... | @@ -140,6 +142,10 @@ |
140 | 142 | private PatientServiceFacade patientServiceFacade; |
141 | 143 | |
142 | 144 | @Autowired |
145 | + @Qualifier("commonThreadPool") | |
146 | + private ThreadPoolTaskExecutor commonThreadPool; | |
147 | + | |
148 | + @Autowired | |
143 | 149 | private MongoTemplate mongoTemplate; |
144 | 150 | |
145 | 151 | @Autowired |
146 | 152 | |
147 | 153 | |
... | ... | @@ -379,14 +385,17 @@ |
379 | 385 | } |
380 | 386 | } |
381 | 387 | |
382 | - | |
383 | 388 | if (type == ServiceObjEnums.YUNOBJ.getId()) { |
384 | - //生成建档短信 | |
385 | -// createBuildSms(p); | |
386 | - createBuildMsg(p); | |
389 | + final Patients tempP = p; | |
390 | + commonThreadPool.execute(new Runnable() { | |
391 | + @Override | |
392 | + public void run() { | |
393 | + //生成建档短信 | |
394 | + createBuildMsg(tempP); | |
395 | + } | |
396 | + }); | |
387 | 397 | } |
388 | 398 | |
389 | - | |
390 | 399 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
391 | 400 | br.setErrormsg("成功"); |
392 | 401 | br.setData(p.getId()); |
393 | 402 | |
394 | 403 | |
... | ... | @@ -398,38 +407,45 @@ |
398 | 407 | * @param userId |
399 | 408 | * @param patient |
400 | 409 | */ |
401 | - public void addTrackDownInfo(Integer userId, Patients patient) { | |
402 | - //添加产检追访信息 | |
403 | - TrackDownRecord trackDownRecord = patient.build(); | |
404 | - //根据patient查询是否存在追访信息 | |
405 | - TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
406 | - downRecordQuery.setParentId(patient.getId()); | |
407 | - downRecordQuery.setStatus(3); | |
408 | - List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
409 | - if (CollectionUtils.isNotEmpty(records)) {//存在则进行修改,只修改基本信息,不修改显示状态和追访类型 | |
410 | - TrackDownRecord trackDownRecord1 = records.get(0); | |
411 | - trackDownRecord.setId(trackDownRecord1.getId()); | |
412 | - } else {//不存在查询居民健康档案是否存在追访 | |
413 | - downRecordQuery = new TrackDownRecordQuery(); | |
414 | - downRecordQuery.setHospitalId(patient.getHospitalId()); | |
415 | - if(StringUtils.isNotEmpty(patient.getCardNo())){ | |
416 | - downRecordQuery.setCardNo(patient.getCardNo()); | |
417 | - }else if(StringUtils.isNotEmpty(patient.getPhone())){ | |
418 | - downRecordQuery.setPhone(patient.getPhone()); | |
419 | - } | |
420 | - records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
421 | - if(CollectionUtils.isNotEmpty(records)){ | |
422 | - TrackDownRecord trackDownRecord1 = records.get(0); | |
423 | - trackDownRecord.setId(trackDownRecord1.getId()); | |
424 | - } | |
425 | - } | |
426 | - int week = DateUtil.getWeek2(patient.getLastMenses(),new Date()); | |
410 | + public void addTrackDownInfo(final Integer userId, final Patients patient) { | |
427 | 411 | |
428 | - if(week>20){//不能做产前筛查追访,产前检查追访 | |
429 | - trackDownRecord.setTrackType(TrackDownDateEnums.I.getId()); | |
430 | - } | |
412 | + commonThreadPool.execute(new Runnable() { | |
413 | + @Override | |
414 | + public void run() { | |
415 | + //添加产检追访信息 | |
416 | + TrackDownRecord trackDownRecord = patient.build(); | |
417 | + //根据patient查询是否存在追访信息 | |
418 | + TrackDownRecordQuery downRecordQuery = new TrackDownRecordQuery(); | |
419 | + downRecordQuery.setParentId(patient.getId()); | |
420 | + downRecordQuery.setStatus(3); | |
421 | + List<TrackDownRecord> records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
422 | + if (CollectionUtils.isNotEmpty(records)) {//存在则进行修改,只修改基本信息,不修改显示状态和追访类型 | |
423 | + TrackDownRecord trackDownRecord1 = records.get(0); | |
424 | + trackDownRecord.setId(trackDownRecord1.getId()); | |
425 | + } else {//不存在查询居民健康档案是否存在追访 | |
426 | + downRecordQuery = new TrackDownRecordQuery(); | |
427 | + downRecordQuery.setHospitalId(patient.getHospitalId()); | |
428 | + if(StringUtils.isNotEmpty(patient.getCardNo())){ | |
429 | + downRecordQuery.setCardNo(patient.getCardNo()); | |
430 | + }else if(StringUtils.isNotEmpty(patient.getPhone())){ | |
431 | + downRecordQuery.setPhone(patient.getPhone()); | |
432 | + } | |
433 | + records = trackDownRecordService.queryTrackDown(downRecordQuery); | |
434 | + if(CollectionUtils.isNotEmpty(records)){ | |
435 | + TrackDownRecord trackDownRecord1 = records.get(0); | |
436 | + trackDownRecord.setId(trackDownRecord1.getId()); | |
437 | + } | |
438 | + } | |
439 | + int week = DateUtil.getWeek2(patient.getLastMenses(),new Date()); | |
431 | 440 | |
432 | - trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
441 | + if(week>20){//不能做产前筛查追访,产前检查追访 | |
442 | + trackDownRecord.setTrackType(TrackDownDateEnums.I.getId()); | |
443 | + } | |
444 | + | |
445 | + trackDownService.addOrupdateTrackDownRecord(userId, trackDownRecord); | |
446 | + } | |
447 | + }); | |
448 | + | |
433 | 449 | } |
434 | 450 | |
435 | 451 | /** |