Commit 57a37487a131cd1bfed04699e9c0bb3a7ae45b72
1 parent
62652856bd
Exists in
master
and in
6 other branches
update
Showing 6 changed files with 196 additions and 59 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterLisMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/LisService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/LisHandleTask.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterLisMapper.java
View file @
57a3748
platform-biz-service/src/main/java/com/lyms/platform/permission/service/LisService.java
View file @
57a3748
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
View file @
57a3748
... | ... | @@ -91,6 +91,11 @@ |
91 | 91 | return masterLisMapper.saveLisDataTemp(models); |
92 | 92 | } |
93 | 93 | |
94 | + @Override | |
95 | + public List<LisReportModel> queryLisDataByStatus(LisReportQuery query) { | |
96 | + return masterLisMapper.queryLisDataByStatus(query); | |
97 | + } | |
98 | + | |
94 | 99 | |
95 | 100 | public class LisSaveTask implements Runnable { |
96 | 101 |
platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml
View file @
57a3748
... | ... | @@ -371,6 +371,30 @@ |
371 | 371 | <include refid="orderAndLimit"/> |
372 | 372 | </select> |
373 | 373 | |
374 | + | |
375 | + <select id="queryLisDataByStatus" parameterType="com.lyms.platform.permission.model.LisReportQuery" resultType="com.lyms.platform.permission.model.LisReportModel"> | |
376 | + SELECT | |
377 | + ID AS id, | |
378 | + LIS_ID AS lisId, | |
379 | + TITLE AS title, | |
380 | + TYPE AS type, | |
381 | + VCCARDNO AS vcCardNo, | |
382 | + APPLY_TIME AS applyTime, | |
383 | + CHECK_TIME AS checkTime, | |
384 | + PUBLISH_TIME AS publishTime, | |
385 | + APPLY_DOCTOR AS applyDoctor, | |
386 | + APPLY_DEPT AS applyDept, | |
387 | + HOSPITAL_ID AS hospitalId, | |
388 | + CHECKER AS checker | |
389 | + FROM LIS_REPORT_TBL | |
390 | + <include refid="LisCondition"/> | |
391 | + AND PHONE IS NOT NULL AND VCCARDNO IS NOT NULL | |
392 | + <include refid="orderAndLimit"/> | |
393 | + </select> | |
394 | + | |
395 | + | |
396 | + | |
397 | + | |
374 | 398 | <select id="queryLisCount" resultType="int" |
375 | 399 | parameterType="com.lyms.platform.permission.model.LisReportQuery"> |
376 | 400 | select count(1) from LIS_REPORT_TBL |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java
View file @
57a3748
... | ... | @@ -9,12 +9,10 @@ |
9 | 9 | import com.lyms.platform.common.enums.*; |
10 | 10 | import com.lyms.platform.common.result.BaseObjectResponse; |
11 | 11 | import com.lyms.platform.common.result.BaseResponse; |
12 | -import com.lyms.platform.common.utils.Assert; | |
13 | -import com.lyms.platform.common.utils.DateUtil; | |
14 | -import com.lyms.platform.common.utils.JsonUtil; | |
15 | -import com.lyms.platform.common.utils.SystemConfig; | |
12 | +import com.lyms.platform.common.utils.*; | |
16 | 13 | import com.lyms.platform.operate.web.request.*; |
17 | 14 | import com.lyms.platform.operate.web.result.*; |
15 | +import com.lyms.platform.operate.web.utils.LisHandleTask; | |
18 | 16 | import com.lyms.platform.permission.model.*; |
19 | 17 | import com.lyms.platform.permission.model.LisReportQuery; |
20 | 18 | import com.lyms.platform.permission.service.LisService; |
21 | 19 | |
22 | 20 | |
23 | 21 | |
24 | 22 | |
25 | 23 | |
26 | 24 | |
27 | 25 | |
28 | 26 | |
29 | 27 | |
30 | 28 | |
31 | 29 | |
... | ... | @@ -26,50 +24,38 @@ |
26 | 24 | import org.apache.commons.lang.StringUtils; |
27 | 25 | import org.apache.commons.lang.math.NumberUtils; |
28 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
27 | +import org.springframework.beans.factory.annotation.Qualifier; | |
29 | 28 | import org.springframework.data.domain.Sort; |
29 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
30 | 30 | import org.springframework.stereotype.Component; |
31 | 31 | |
32 | 32 | import javax.servlet.http.HttpServletRequest; |
33 | 33 | import java.util.*; |
34 | +import java.util.concurrent.*; | |
34 | 35 | |
35 | 36 | /** |
36 | 37 | * |
37 | 38 | */ |
38 | 39 | @Component |
39 | 40 | public class LisFacade { |
41 | + | |
40 | 42 | @Autowired |
41 | - private AntenatalExaminationService antenatalExaminationService; | |
42 | - @Autowired | |
43 | 43 | private PatientsService patientsService; |
44 | + | |
44 | 45 | @Autowired |
45 | - private BasicConfigFacade basicConfigFacade; | |
46 | - @Autowired | |
47 | - private BasicConfigService basicConfigService; | |
48 | - @Autowired | |
49 | - private ApplyOrderService applyOrderService; | |
50 | - @Autowired | |
51 | 46 | private OrganizationService organizationService; |
47 | + | |
52 | 48 | @Autowired |
53 | - private MatDeliverService matDeliverService; | |
54 | - @Autowired | |
55 | - private PostReviewService postReviewService; | |
56 | - @Autowired | |
57 | 49 | private AutoMatchFacade autoMatchFacade; |
58 | - @Autowired | |
59 | - private StopPregnancyService stopPregnancyService; | |
60 | - @Autowired | |
61 | - private UsersService usersService; | |
62 | - @Autowired | |
63 | - private DeleteProcessHandler deleteProcessHandler; | |
64 | - @Autowired | |
65 | - private AntExRecordService recordService; | |
66 | 50 | |
67 | - @Autowired | |
68 | - private OrganizationGroupsFacade groupsFacade; | |
69 | 51 | |
70 | 52 | @Autowired |
71 | 53 | private LisService lisService; |
72 | 54 | |
55 | + @Autowired | |
56 | + @Qualifier("commonThreadPool") | |
57 | + private ThreadPoolTaskExecutor commonThreadPool; | |
58 | + | |
73 | 59 | /** |
74 | 60 | * ่ทๅlisๅrisๆฃ้ชๆฅๅ |
75 | 61 | * @param vcCardNo ๅฐฑ่ฏๅกๅท |
76 | 62 | |
77 | 63 | |
78 | 64 | |
79 | 65 | |
80 | 66 | |
81 | 67 | |
... | ... | @@ -581,48 +567,88 @@ |
581 | 567 | query.setSort(" PUBLISH_TIME DESC "); |
582 | 568 | query.setStatus(0); //ๆชๆจ้็ถๆ |
583 | 569 | |
584 | - Set<String> patientIds = new HashSet<>(); | |
585 | - List<Map<String,String>> lists = new ArrayList<>(); | |
570 | + final CopyOnWriteArraySet<String> patientIds = new CopyOnWriteArraySet<>(); | |
571 | + List<Map<String,String>> lists = new ArrayList<>(); | |
586 | 572 | |
587 | - List<LisReportModel> lises = lisService.queryLisDataByQuery(query); | |
573 | + List<LisReportModel> lises = lisService.queryLisDataByStatus(query); | |
588 | 574 | if (CollectionUtils.isNotEmpty(lises)) |
589 | 575 | { |
590 | - for(LisReportModel lisReportModel : lises) | |
591 | - { | |
592 | - Map<String,String> map = new HashMap<>(); | |
593 | - if (StringUtils.isNotEmpty(lisReportModel.getHospitalId())) | |
594 | - { | |
595 | - Organization organization = organizationService.getOrganization(Integer.parseInt(lisReportModel.getHospitalId())); | |
596 | - if (organization != null) | |
597 | - { | |
598 | - map.put("hospitalName",organization.getName()); | |
599 | - } | |
576 | + Map<String, String> map = new HashMap<>(); | |
577 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
578 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
579 | + List<Organization> organizations = organizationService.queryOrganization(organizationQuery); | |
580 | + if (organizations != null) { | |
581 | + for(Organization organization : organizations) | |
582 | + { | |
583 | + map.put(organization.getId() + "", organization.getName()); | |
584 | + } | |
585 | + } | |
586 | + organizations.clear(); | |
587 | + | |
588 | + | |
589 | + List<Future> futures = new ArrayList<>(); | |
590 | + int batchSize = 20; | |
591 | + int end = 0; | |
592 | + for (int i = 0; i < lises.size(); i += batchSize) { | |
593 | + end = (end + batchSize); | |
594 | + if (end > lises.size()) { | |
595 | + end = lises.size(); | |
600 | 596 | } |
597 | + final List<LisReportModel> models = lises.subList(i, end); | |
598 | + Callable c = new LisHandleTask(patientsService,models,map); | |
599 | + Future f = commonThreadPool.submit(c); | |
600 | + futures.add(f); | |
601 | + } | |
601 | 602 | |
602 | - PatientsQuery patientsQuery=new PatientsQuery(); | |
603 | - String[] strs = new String[]{lisReportModel.getPhone(), lisReportModel.getVcCardNo()}; | |
604 | - patientsQuery.setPv(strs); | |
605 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
606 | - List<Patients> list= patientsService.queryPatient(patientsQuery); | |
607 | - if (CollectionUtils.isNotEmpty(list)) | |
603 | + if (CollectionUtils.isNotEmpty(futures)) | |
604 | + { | |
605 | + for (Future f : futures) | |
608 | 606 | { |
609 | - Patients pat = list.get(0); | |
610 | - String patientId = pat.getId(); | |
611 | - if (!patientIds.contains(patientId)) | |
612 | - { | |
613 | - patientIds.add(patientId); | |
614 | - map.put("vcCardNo", pat.getVcCardNo()); | |
615 | - map.put("name",pat.getUsername()); | |
616 | - map.put("phone",pat.getPhone()); | |
617 | - map.put("checkTime",DateUtil.getyyyy_MM_dd_hms(lisReportModel.getPublishTime())); | |
618 | - map.put("patientId",patientId); | |
619 | - map.put("hospitalId",lisReportModel.getHospitalId()); | |
620 | - map.put("title",lisReportModel.getTitle()); | |
621 | - map.put("id",lisReportModel.getId()+""); | |
622 | - lists.add(map); | |
607 | + try { | |
608 | + lists.addAll((List<Map<String,String>>) f.get()); | |
609 | + } catch (Exception e) { | |
610 | + ExceptionUtils.catchException(e, "getNoSendLis list error."); | |
623 | 611 | } |
624 | 612 | } |
625 | 613 | } |
614 | + | |
615 | +// for(LisReportModel lisReportModel : lises) | |
616 | +// { | |
617 | +// Map<String,String> map = new HashMap<>(); | |
618 | +// if (StringUtils.isNotEmpty(lisReportModel.getHospitalId())) | |
619 | +// { | |
620 | +// Organization organization = organizationService.getOrganization(Integer.parseInt(lisReportModel.getHospitalId())); | |
621 | +// if (organization != null) | |
622 | +// { | |
623 | +// map.put("hospitalName",organization.getName()); | |
624 | +// } | |
625 | +// } | |
626 | +// | |
627 | +// PatientsQuery patientsQuery=new PatientsQuery(); | |
628 | +// String[] strs = new String[]{lisReportModel.getPhone(), lisReportModel.getVcCardNo()}; | |
629 | +// patientsQuery.setPv(strs); | |
630 | +// patientsQuery.setYn(YnEnums.YES.getId()); | |
631 | +// List<Patients> list= patientsService.queryPatient(patientsQuery); | |
632 | +// if (CollectionUtils.isNotEmpty(list)) | |
633 | +// { | |
634 | +// Patients pat = list.get(0); | |
635 | +// String patientId = pat.getId(); | |
636 | +// if (!patientIds.contains(patientId)) | |
637 | +// { | |
638 | +// patientIds.add(patientId); | |
639 | +// map.put("vcCardNo", pat.getVcCardNo()); | |
640 | +// map.put("name",pat.getUsername()); | |
641 | +// map.put("phone",pat.getPhone()); | |
642 | +// map.put("checkTime",lisReportModel.getCheckTime() == null ? DateUtil.getyyyy_MM_dd_hms(lisReportModel.getPublishTime()) | |
643 | +// : DateUtil.getyyyy_MM_dd_hms(lisReportModel.getCheckTime())); | |
644 | +// map.put("patientId",patientId); | |
645 | +// map.put("hospitalId",lisReportModel.getHospitalId()); | |
646 | +// map.put("title",lisReportModel.getTitle()); | |
647 | +// map.put("id",lisReportModel.getId()+""); | |
648 | +// lists.add(map); | |
649 | +// } | |
650 | +// } | |
651 | +// } | |
626 | 652 | } |
627 | 653 | patientIds.clear(); |
628 | 654 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/LisHandleTask.java
View file @
57a3748
1 | +package com.lyms.platform.operate.web.utils; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.PatientsService; | |
4 | +import com.lyms.platform.common.enums.YnEnums; | |
5 | +import com.lyms.platform.common.utils.DateUtil; | |
6 | +import com.lyms.platform.common.utils.StringUtils; | |
7 | +import com.lyms.platform.permission.model.LisReportModel; | |
8 | +import com.lyms.platform.pojo.Patients; | |
9 | +import com.lyms.platform.query.PatientsQuery; | |
10 | +import org.apache.commons.collections.CollectionUtils; | |
11 | + | |
12 | +import java.util.ArrayList; | |
13 | +import java.util.HashMap; | |
14 | +import java.util.List; | |
15 | +import java.util.Map; | |
16 | +import java.util.concurrent.Callable; | |
17 | + | |
18 | +/** | |
19 | + * Created by Administrator on 2017-05-15. | |
20 | + */ | |
21 | +public class LisHandleTask implements Callable { | |
22 | + | |
23 | + private PatientsService patientsService; | |
24 | + | |
25 | + private List<LisReportModel> lises; | |
26 | + | |
27 | + private Map<String, String> hospitalMap; | |
28 | + | |
29 | + public LisHandleTask(PatientsService patientsService,List<LisReportModel> lises,Map<String, String> hospitalMap) | |
30 | + { | |
31 | + this.patientsService = patientsService; | |
32 | + this.lises = lises; | |
33 | + this.hospitalMap = hospitalMap; | |
34 | + } | |
35 | + | |
36 | + @Override | |
37 | + public List<Map<String,String>> call() throws Exception { | |
38 | + | |
39 | + List<Map<String,String>> result = new ArrayList<>(); | |
40 | + | |
41 | + for(LisReportModel lisReportModel : lises) | |
42 | + { | |
43 | + | |
44 | + if (StringUtils.isNotEmpty(lisReportModel.getPhone()) || StringUtils.isNotEmpty(lisReportModel.getVcCardNo())) | |
45 | + { | |
46 | + Map<String, String> map = new HashMap<>(); | |
47 | + | |
48 | + if (StringUtils.isNotEmpty(lisReportModel.getHospitalId())) | |
49 | + { | |
50 | + map.put("hospitalName",hospitalMap.get(lisReportModel.getHospitalId())); | |
51 | + } | |
52 | + | |
53 | + PatientsQuery patientsQuery=new PatientsQuery(); | |
54 | + String[] strs = new String[]{lisReportModel.getPhone(), lisReportModel.getVcCardNo()}; | |
55 | + patientsQuery.setPv(strs); | |
56 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
57 | + List<Patients> list= patientsService.queryPatient(patientsQuery); | |
58 | + if (CollectionUtils.isNotEmpty(list)) | |
59 | + { | |
60 | + Patients pat = list.get(0); | |
61 | + String patientId = pat.getId(); | |
62 | + | |
63 | + map.put("vcCardNo", pat.getVcCardNo()); | |
64 | + map.put("name",pat.getUsername()); | |
65 | + map.put("phone",pat.getPhone()); | |
66 | + map.put("checkTime",lisReportModel.getCheckTime() == null ? DateUtil.getyyyy_MM_dd_hms(lisReportModel.getPublishTime()) | |
67 | + : DateUtil.getyyyy_MM_dd_hms(lisReportModel.getCheckTime())); | |
68 | + map.put("patientId",patientId); | |
69 | + map.put("hospitalId",lisReportModel.getHospitalId()); | |
70 | + map.put("title", lisReportModel.getTitle()); | |
71 | + map.put("id",lisReportModel.getId()+""); | |
72 | + result.add(map); | |
73 | + } | |
74 | + } | |
75 | + } | |
76 | + return result; | |
77 | + } | |
78 | +} |