Commit afbf03f80cc6608045455c509ea216b1b0fc1458
1 parent
94963ae0fa
Exists in
master
and in
7 other branches
分娩作废产检劵
Showing 1 changed file with 126 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntExRecordWorker.java
View file @
afbf03f
1 | +package com.lyms.platform.operate.web.worker; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.AntExRecordService; | |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
5 | +import com.lyms.platform.biz.service.CommonService; | |
6 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
7 | +import com.lyms.platform.common.utils.StringUtils; | |
8 | +import com.lyms.platform.operate.web.result.AntExManagerResult; | |
9 | +import com.lyms.platform.operate.web.result.RiskPatientsResult; | |
10 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
11 | +import com.lyms.platform.permission.model.Organization; | |
12 | +import com.lyms.platform.permission.model.Users; | |
13 | +import com.lyms.platform.permission.service.OrganizationService; | |
14 | +import com.lyms.platform.permission.service.UsersService; | |
15 | +import com.lyms.platform.pojo.AntExRecordModel; | |
16 | +import com.lyms.platform.query.AntExRecordQuery; | |
17 | +import org.apache.commons.lang.math.NumberUtils; | |
18 | + | |
19 | +import java.util.ArrayList; | |
20 | +import java.util.List; | |
21 | +import java.util.concurrent.Callable; | |
22 | + | |
23 | +/** | |
24 | + * 产检记录 | |
25 | + * <p/> | |
26 | + * Created by Administrator on 2017/1/13 0013. | |
27 | + */ | |
28 | +public class AntExRecordWorker implements Callable<List<AntExManagerResult>> { | |
29 | + | |
30 | + private List<AntExRecordModel> record; | |
31 | + private boolean isRegion; | |
32 | + private OrganizationService organizationService; | |
33 | + private UsersService usersService; | |
34 | + private AntExRecordService recordService; | |
35 | + private CommonService commonService; | |
36 | + private String hospital; | |
37 | + | |
38 | + private BasicConfigService basicConfigService; | |
39 | + | |
40 | + public AntExRecordWorker(List<AntExRecordModel> record, | |
41 | + boolean isRegion, | |
42 | + OrganizationService organizationService, | |
43 | + UsersService usersService, | |
44 | + AntExRecordService recordService, | |
45 | + CommonService commonService, | |
46 | + String hospital, | |
47 | + BasicConfigService basicConfigService) { | |
48 | + this.record = record; | |
49 | + this.isRegion = isRegion; | |
50 | + this.organizationService = organizationService; | |
51 | + this.usersService = usersService; | |
52 | + this.recordService = recordService; | |
53 | + this.commonService = commonService; | |
54 | + this.hospital = hospital; | |
55 | + this.basicConfigService = basicConfigService; | |
56 | + } | |
57 | + | |
58 | + @Override | |
59 | + public List<AntExManagerResult> call() { | |
60 | + List<AntExManagerResult> data = new ArrayList<>(); | |
61 | + for (AntExRecordModel e : record) { | |
62 | + try { | |
63 | + AntExManagerResult antExManagerResult = new AntExManagerResult(); | |
64 | + antExManagerResult.convertToResult(e); | |
65 | + if (isRegion) { | |
66 | + //产检医院 | |
67 | + if (StringUtils.isNotEmpty(e.getHospitalId())) { | |
68 | + Organization org = organizationService.getOrganization(Integer.valueOf(e.getHospitalId())); | |
69 | + if (null != org) { | |
70 | + antExManagerResult.setCheckHospital(org.getName()); | |
71 | + } else { | |
72 | + antExManagerResult.setCheckHospital(e.getHospitalId()); | |
73 | + } | |
74 | + } | |
75 | + antExManagerResult.setAddr(CommonsHelper.getResidence(e.getProvinceRegisterId(), e.getCityRegisterId(), e.getAreaRegisterId(), e.getStreetRegisterId(), e.getAddressRegister(), basicConfigService)); | |
76 | + } | |
77 | + | |
78 | + //登记人 | |
79 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(e.getBuildDoctor())) { | |
80 | + if (NumberUtils.isNumber(e.getBuildDoctor())) { | |
81 | + Users users = usersService.getUsers(NumberUtils.toInt(e.getBuildDoctor())); | |
82 | + if (null != users) { | |
83 | + antExManagerResult.setlName(users.getName()); | |
84 | + } else { | |
85 | + antExManagerResult.setlName(e.getBuildDoctor()); | |
86 | + } | |
87 | + } else { | |
88 | + antExManagerResult.setlName(e.getBuildDoctor()); | |
89 | + } | |
90 | + } | |
91 | + //产检医生 | |
92 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(e.getCheckDoctor())) { | |
93 | + if (NumberUtils.isNumber(e.getCheckDoctor())) { | |
94 | + Users users = usersService.getUsers(NumberUtils.toInt(e.getCheckDoctor())); | |
95 | + if (null != users) { | |
96 | + antExManagerResult.setCheckDoctor(users.getName()); | |
97 | + } else { | |
98 | + antExManagerResult.setCheckDoctor(e.getCheckDoctor()); | |
99 | + } | |
100 | + } else { | |
101 | + antExManagerResult.setCheckDoctor(e.getCheckDoctor()); | |
102 | + } | |
103 | + } | |
104 | + | |
105 | + AntExRecordQuery antExRecordQuery1 = new AntExRecordQuery(); | |
106 | + antExRecordQuery1.setCheckTimeEnd(e.getCheckTime()); | |
107 | + antExRecordQuery1.setPid(e.getPid()); | |
108 | + antExRecordQuery1.setHospitalId(hospital); | |
109 | + | |
110 | + //本院低次 | |
111 | + int dichi = recordService.count(antExRecordQuery1); | |
112 | + antExRecordQuery1.setHospitalId(null); | |
113 | + | |
114 | + antExManagerResult.settTimes(recordService.count(antExRecordQuery1)); | |
115 | + antExManagerResult.setChTimes(dichi); | |
116 | + //高危因素 | |
117 | + antExManagerResult.setrLevel(commonService.findRiskLevel(e.gethLevel())); | |
118 | + antExManagerResult.setRiskFactor(commonService.resloveFactor(e.gethRisk())); | |
119 | + data.add(antExManagerResult); | |
120 | + }catch (Exception e1){ | |
121 | + ExceptionUtils.catchException(e1,"antex worker error."); | |
122 | + } | |
123 | + } | |
124 | + return data; | |
125 | + } | |
126 | +} |