Commit 17b1b6ce1a79c8898ef44acd4adff4cc5e36c470
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 9 changed files
- platform-common/src/main/java/com/lyms/platform/common/result/BaseObjectResponse.java
- platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntexDoctorStatistController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntextDoctorPatient.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PostReviewServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/result/BaseObjectResponse.java
View file @
17b1b6c
1 | 1 | package com.lyms.platform.common.result; |
2 | 2 | |
3 | +import com.lyms.platform.common.base.PageInfo; | |
4 | + | |
3 | 5 | public class BaseObjectResponse extends BaseResponse { |
4 | 6 | |
5 | 7 | /** |
... | ... | @@ -8,6 +10,16 @@ |
8 | 10 | private static final long serialVersionUID = 1L; |
9 | 11 | |
10 | 12 | private Object data; |
13 | + | |
14 | + private PageInfo pageInfo; | |
15 | + | |
16 | + public PageInfo getPageInfo() { | |
17 | + return pageInfo; | |
18 | + } | |
19 | + | |
20 | + public void setPageInfo(PageInfo pageInfo) { | |
21 | + this.pageInfo = pageInfo; | |
22 | + } | |
11 | 23 | |
12 | 24 | public Object getData() { |
13 | 25 | return data; |
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
View file @
17b1b6c
... | ... | @@ -131,6 +131,27 @@ |
131 | 131 | return phone; |
132 | 132 | } |
133 | 133 | |
134 | + /** | |
135 | + * 证件号加密处理 | |
136 | + * @param id | |
137 | + * @return | |
138 | + */ | |
139 | + public static String encryCardNo(String id) { | |
140 | + if (org.apache.commons.lang.StringUtils.isEmpty(id)) { | |
141 | + return ""; | |
142 | + } | |
143 | + if (id.length() == 11) { | |
144 | + return id.substring(0, 3) + "****" + id.substring(7); | |
145 | + } | |
146 | + if (id.length() == 15) { | |
147 | + return id.substring(0, 6) + "****" + id.substring(10, 13) + "*" + id.substring(14); | |
148 | + } | |
149 | + if (id.length() == 18) { | |
150 | + return id.substring(0, 6) + "******" + id.substring(12, 15) + "**" + id.substring(17); | |
151 | + } | |
152 | + return ""; | |
153 | + } | |
154 | + | |
134 | 155 | public static Date getBirthDay(String idCard){ |
135 | 156 | if (isEmpty(idCard)) |
136 | 157 | { |
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
View file @
17b1b6c
... | ... | @@ -33,7 +33,16 @@ |
33 | 33 | private String pid; |
34 | 34 | private Date checkTimeStart; |
35 | 35 | private Date checkTimeEnd; |
36 | + private String checkDoctor; | |
36 | 37 | |
38 | + public String getCheckDoctor() { | |
39 | + return checkDoctor; | |
40 | + } | |
41 | + | |
42 | + public void setCheckDoctor(String checkDoctor) { | |
43 | + this.checkDoctor = checkDoctor; | |
44 | + } | |
45 | + | |
37 | 46 | public List<String> getParentIds() { |
38 | 47 | return parentIds; |
39 | 48 | } |
... | ... | @@ -167,6 +176,9 @@ |
167 | 176 | |
168 | 177 | if (null != hospitalId) { |
169 | 178 | condition = condition.and("hospitalId", hospitalId, MongoOper.IS); |
179 | + } | |
180 | + if (null != checkDoctor) { | |
181 | + condition = condition.and("prodDoctor", checkDoctor, MongoOper.IS); | |
170 | 182 | } |
171 | 183 | if (null != pid) { |
172 | 184 | condition = condition.and("pid", pid, MongoOper.IS); |
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
View file @
17b1b6c
... | ... | @@ -30,12 +30,21 @@ |
30 | 30 | private boolean neStart; |
31 | 31 | |
32 | 32 | private boolean neEnd; |
33 | + private String checkDoctor; | |
33 | 34 | |
34 | 35 | //大于修改时间 |
35 | 36 | private Date gteModified; |
36 | 37 | |
37 | 38 | private Date gteCreated; |
38 | 39 | |
40 | + public String getCheckDoctor() { | |
41 | + return checkDoctor; | |
42 | + } | |
43 | + | |
44 | + public void setCheckDoctor(String checkDoctor) { | |
45 | + this.checkDoctor = checkDoctor; | |
46 | + } | |
47 | + | |
39 | 48 | public List<String> getParentIds() { |
40 | 49 | return parentIds; |
41 | 50 | } |
... | ... | @@ -128,6 +137,9 @@ |
128 | 137 | } |
129 | 138 | if(null!=id){ |
130 | 139 | condition= condition.and("id",id, MongoOper.IS); |
140 | + } | |
141 | + if(null!=checkDoctor){ | |
142 | + condition= condition.and("checkDoctor",checkDoctor, MongoOper.IS); | |
131 | 143 | } |
132 | 144 | |
133 | 145 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntexDoctorStatistController.java
View file @
17b1b6c
... | ... | @@ -2,12 +2,16 @@ |
2 | 2 | |
3 | 3 | import com.lyms.hospitalapi.pojo.ReportModel; |
4 | 4 | import com.lyms.platform.biz.service.AntenatalExaminationService; |
5 | +import com.lyms.platform.biz.service.BasicConfigService; | |
6 | +import com.lyms.platform.biz.service.CommonService; | |
5 | 7 | import com.lyms.platform.biz.service.YunBookbuildingService; |
6 | 8 | import com.lyms.platform.common.annotation.TokenRequired; |
7 | 9 | import com.lyms.platform.common.base.BaseController; |
8 | 10 | import com.lyms.platform.common.base.LoginContext; |
11 | +import com.lyms.platform.common.base.PageInfo; | |
9 | 12 | import com.lyms.platform.common.result.BaseObjectResponse; |
10 | 13 | import com.lyms.platform.common.utils.BeanUtils; |
14 | +import com.lyms.platform.common.utils.DateUtil; | |
11 | 15 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
12 | 16 | import com.lyms.platform.operate.web.result.AntextDoctorPatient; |
13 | 17 | import com.lyms.platform.operate.web.result.AntextDoctorResult; |
... | ... | @@ -19,6 +23,7 @@ |
19 | 23 | import com.lyms.platform.query.AntExChuQuery; |
20 | 24 | import com.lyms.platform.query.AntExQuery; |
21 | 25 | import com.lyms.platform.query.PatientsQuery; |
26 | +import org.apache.commons.collections.CollectionUtils; | |
22 | 27 | import org.apache.commons.collections.map.HashedMap; |
23 | 28 | import org.apache.commons.lang.StringUtils; |
24 | 29 | import org.springframework.beans.factory.annotation.Autowired; |
25 | 30 | |
26 | 31 | |
27 | 32 | |
28 | 33 | |
29 | 34 | |
30 | 35 | |
31 | 36 | |
32 | 37 | |
33 | 38 | |
34 | 39 | |
35 | 40 | |
36 | 41 | |
37 | 42 | |
38 | 43 | |
39 | 44 | |
40 | 45 | |
... | ... | @@ -47,56 +52,244 @@ |
47 | 52 | private YunBookbuildingService yunBookbuildingService; |
48 | 53 | @Autowired |
49 | 54 | private UsersService usersService; |
55 | + @Autowired | |
56 | + private BasicConfigService basicConfigService; | |
57 | + @Autowired | |
58 | + private CommonService commonService; | |
50 | 59 | |
60 | + | |
51 | 61 | /** |
52 | - * 产检医生统计 | |
62 | + * 产检医生统计详情 | |
53 | 63 | * |
54 | - * @param startDate 建档开始时间 | |
55 | - * @param endDate 建档结束时间 | |
56 | - * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
64 | + * @param startDate 建档开始时间 | |
65 | + * @param endDate 建档结束时间 | |
66 | + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
67 | + * @param number 产检次数 点的是产检人数的话就传1, 2次(含)以上就传2, 5次(含)以上就传5 | |
68 | + * @param doctorId 医生ID | |
69 | + * @param currentPage 当前页 | |
70 | + * @param pageSize 每页显示的数量 | |
57 | 71 | * @return |
58 | 72 | */ |
59 | - @RequestMapping(method = RequestMethod.GET,value = "/getDoctorStatic") | |
73 | + @RequestMapping(method = RequestMethod.GET, value = "/doctorStatInfo") | |
60 | 74 | @ResponseBody |
61 | 75 | @TokenRequired |
62 | - public BaseObjectResponse getDoctorStatic(Date startDate,Date endDate,Integer childBirth ,HttpServletRequest request){ | |
63 | - BaseObjectResponse rest = new BaseObjectResponse(); | |
64 | - | |
76 | + public BaseObjectResponse doctorInfo(Date startDate, Date endDate, Integer childBirth, Integer number, String doctorId, | |
77 | + Integer currentPage, Integer pageSize, HttpServletRequest request) { | |
65 | 78 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
79 | + if (pageSize == null) { | |
80 | + pageSize = 20; | |
81 | + } | |
82 | + if (currentPage == null) { | |
83 | + currentPage = 1; | |
84 | + } | |
85 | + if (number == null) { | |
86 | + number = 1; | |
87 | + } | |
88 | + | |
89 | + //获取患者信息 | |
90 | + List<AntextDoctorPatient> antextDoctorPatient = getPatientList(loginState.getId(), startDate, endDate, childBirth, doctorId); | |
91 | + //结果数据集合 | |
92 | + Map<String, AntextDoctorPatient> resultInfo = new HashMap<>(); | |
93 | + | |
94 | + List<String> patientIds = new ArrayList<>(); | |
95 | + | |
96 | + for (AntextDoctorPatient adp : antextDoctorPatient) { | |
97 | + if (resultInfo.containsKey(adp.getpId())) {//存在 | |
98 | + AntextDoctorPatient antextDoctorPatient1 = resultInfo.get(adp.getpId()); | |
99 | + antextDoctorPatient1.setCjNum(antextDoctorPatient1.getCjNum() + 1); | |
100 | + if (StringUtils.isNotEmpty(adp.getRiskFactors())) {//高危风险不为空 | |
101 | + antextDoctorPatient1.setRiskFactors(adp.getRiskFactors()); | |
102 | + } | |
103 | + if (CollectionUtils.isNotEmpty(adp.getRiskLevelId())) { | |
104 | + antextDoctorPatient1.setRiskLevelId(adp.getRiskLevelId()); | |
105 | + } | |
106 | + if (StringUtils.isNotEmpty(adp.getcDueWeek())) { | |
107 | + antextDoctorPatient1.setcDueWeek(adp.getcDueWeek()); | |
108 | + } | |
109 | + if (adp.getDueFmDate() != null) { | |
110 | + antextDoctorPatient1.setDueFmDate(adp.getDueFmDate()); | |
111 | + } | |
112 | + } else {//不存在 | |
113 | + patientIds.add(adp.getpId()); | |
114 | + adp.setCjNum(1); | |
115 | + resultInfo.put(adp.getpId(), adp); | |
116 | + } | |
117 | + } | |
118 | + if (CollectionUtils.isNotEmpty(patientIds)) { | |
119 | + getAllPatientList(patientIds, resultInfo,loginState.getId()); | |
120 | + } | |
121 | + | |
122 | + | |
123 | + List<AntextDoctorPatient> antextDoctorPatients = new ArrayList<>(); | |
124 | + | |
125 | + for (Map.Entry<String, AntextDoctorPatient> adp : resultInfo.entrySet()) { | |
126 | + AntextDoctorPatient antextDoctorPatient1 = adp.getValue(); | |
127 | + if (number == 2) {//2次及以上 | |
128 | + if (antextDoctorPatient1.getCjNum() > 1) { | |
129 | + antextDoctorPatients.add(adp.getValue()); | |
130 | + } | |
131 | + } else if (number == 5) {//5次及以上 | |
132 | + if (antextDoctorPatient1.getCjNum() > 4) { | |
133 | + antextDoctorPatients.add(adp.getValue()); | |
134 | + } | |
135 | + } else { | |
136 | + antextDoctorPatients.add(adp.getValue()); | |
137 | + } | |
138 | + } | |
139 | + | |
140 | + PageInfo pageInfo = new PageInfo(); | |
141 | + pageInfo.setLimit(pageSize); | |
142 | + pageInfo.setPage(currentPage); | |
143 | + pageInfo.setCount(resultInfo.size()); | |
144 | + | |
145 | + int startIndex = pageSize * (currentPage - 1); | |
146 | + | |
147 | + List<AntextDoctorPatient> resultData = new ArrayList<>(); | |
148 | + | |
149 | + if (CollectionUtils.isNotEmpty(antextDoctorPatients) && antextDoctorPatients.size() > startIndex) { | |
150 | + int size = startIndex + pageSize; | |
151 | + if (antextDoctorPatients.size() < size) { | |
152 | + size = antextDoctorPatients.size(); | |
153 | + } | |
154 | + for (int i = startIndex; i < size; i++) { | |
155 | + AntextDoctorPatient doctorPatient = antextDoctorPatients.get(i); | |
156 | + Users users = usersService.getUsers(Integer.parseInt(doctorPatient.getDoctorId())); | |
157 | + if (users != null) { | |
158 | + doctorPatient.setDoctorName(users.getName()); | |
159 | + } else { | |
160 | + doctorPatient.setDoctorName("产检医生"); | |
161 | + } | |
162 | + resultData.add(doctorPatient); | |
163 | + } | |
164 | + } | |
165 | + BaseObjectResponse result = new BaseObjectResponse(); | |
166 | + result.setData(resultData); | |
167 | + result.setPageInfo(pageInfo); | |
168 | + return result; | |
169 | + } | |
170 | + | |
171 | + //获取患者全部检测数据 | |
172 | + public void getAllPatientList(List<String> patientId, Map<String, AntextDoctorPatient> resultInfo,Integer userId) { | |
173 | + | |
66 | 174 | //根据当前登录人获取医院id |
67 | - String hospital = autoMatchFacade.getHospitalId(loginState.getId()); | |
175 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
176 | + | |
177 | + //根据patientId集合查询产检表、产检复查表,获取医生id、patientId列表 | |
178 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
179 | + //患者集合 | |
180 | + antExChuQuery.setParentIds(patientId); | |
181 | + antExChuQuery.setYn(1); | |
182 | + //初诊集合列表 | |
183 | + List<AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery); | |
184 | + AntExQuery antExQuery = new AntExQuery(); | |
185 | + antExQuery.setParentIds(patientId); | |
186 | + antExQuery.setYn(1); | |
187 | + //复诊集合列表 | |
188 | + List<AntenatalExaminationModel> antenatalExaminationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
189 | + | |
190 | + //复诊:患者id | |
191 | + Map<String,Integer> hostNum = new HashMap<>(); | |
192 | + | |
193 | + //添加初诊结果 | |
194 | + for (AntExChuModel ac : antExChuModels) { | |
195 | + AntextDoctorPatient doctorPatient = resultInfo.get(ac.getParentId()); | |
196 | + doctorPatient.setAllCjNum(doctorPatient.getAllCjNum() + 1); | |
197 | + if(ac.getHospitalId().equals(hospital)){//如果医院id相同, | |
198 | + if(hostNum.containsKey(ac.getPid())){ | |
199 | + int num = hostNum.get(ac.getPid()); | |
200 | + num++; | |
201 | + if(num>doctorPatient.getCjNum()){ | |
202 | + doctorPatient.setCjNum(num); | |
203 | + } | |
204 | + hostNum.put(ac.getPid(),num); | |
205 | + }else{ | |
206 | + hostNum.put(ac.getPid(),1); | |
207 | + } | |
208 | + } | |
209 | + if (ac.getCheckTime().after(doctorPatient.getCheckTime())) { | |
210 | + doctorPatient.setCheckTime(ac.getCheckTime()); | |
211 | + doctorPatient.setDoctorId(ac.getProdDoctor()); | |
212 | + } | |
213 | + doctorPatient.setCheckTimeStr(DateUtil.getyyyy_MM_dd(doctorPatient.getCheckTime())); | |
214 | + } | |
215 | + | |
216 | + | |
217 | + | |
218 | + //添加复诊结果 | |
219 | + for (AntenatalExaminationModel aec : antenatalExaminationModels) { | |
220 | + AntextDoctorPatient doctorPatient = resultInfo.get(aec.getParentId()); | |
221 | + if(aec.getHospitalId().equals(hospital)){//如果医院id相同, | |
222 | + if(hostNum.containsKey(aec.getPid())){ | |
223 | + int num = hostNum.get(aec.getPid()); | |
224 | + num++; | |
225 | + if(num>doctorPatient.getCjNum()){ | |
226 | + doctorPatient.setCjNum(num); | |
227 | + } | |
228 | + hostNum.put(aec.getPid(),num); | |
229 | + }else{ | |
230 | + hostNum.put(aec.getPid(),1); | |
231 | + } | |
232 | + } | |
233 | + | |
234 | + doctorPatient.setAllCjNum(doctorPatient.getAllCjNum() + 1); | |
235 | + if (aec.getCheckDate().after(doctorPatient.getCheckTime())) { | |
236 | + doctorPatient.setCheckTime(aec.getCheckDate()); | |
237 | + doctorPatient.setDoctorId(aec.getCheckDoctor()); | |
238 | + } | |
239 | + doctorPatient.setCheckTimeStr(DateUtil.getyyyy_MM_dd(doctorPatient.getCheckTime())); | |
240 | + } | |
241 | + } | |
242 | + | |
243 | + | |
244 | + public List<AntextDoctorPatient> getPatientList(Integer userId, Date startDate, Date endDate, Integer childBirth, String doctorId) { | |
245 | + | |
246 | + //根据当前登录人获取医院id | |
247 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
68 | 248 | PatientsQuery patientsQuery = new PatientsQuery(); |
69 | 249 | //医院id |
70 | 250 | patientsQuery.setHospitalId(hospital); |
71 | - if(startDate!=null){ | |
251 | + if (startDate != null) { | |
72 | 252 | //建档开始时间 |
73 | 253 | patientsQuery.setBookbuildingDateStart(startDate); |
74 | 254 | } |
75 | - if(endDate!=null){ | |
255 | + if (endDate != null) { | |
76 | 256 | //建档结束时间 |
77 | 257 | patientsQuery.setBookbuildingDateEnd(endDate); |
78 | 258 | } |
79 | 259 | //有效 |
80 | 260 | patientsQuery.setYn(1); |
81 | - if(childBirth!=null){ | |
261 | + if (childBirth != null) { | |
82 | 262 | patientsQuery.setType(childBirth); |
83 | 263 | } |
84 | 264 | //获取患者集合 |
85 | 265 | List<Patients> patientss = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
266 | + | |
267 | + if (CollectionUtils.isEmpty(patientss)) { | |
268 | + return new ArrayList<>(); | |
269 | + } | |
86 | 270 | //患者id |
87 | 271 | List<String> pIds = new ArrayList<>(); |
88 | - for(Patients ps : patientss){ | |
272 | + Map<String, Patients> patientsMap = new HashMap<>(); | |
273 | + for (Patients ps : patientss) { | |
89 | 274 | pIds.add(ps.getId()); |
275 | + patientsMap.put(ps.getId(), ps); | |
90 | 276 | } |
277 | + | |
91 | 278 | //根据patientId集合查询产检表、产检复查表,获取医生id、patientId列表 |
92 | 279 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
93 | 280 | //患者集合 |
94 | 281 | antExChuQuery.setParentIds(pIds); |
282 | + if (StringUtils.isNotEmpty(doctorId)) { | |
283 | + antExChuQuery.setCheckDoctor(doctorId); | |
284 | + } | |
95 | 285 | antExChuQuery.setYn(1); |
96 | 286 | antExChuQuery.setHospitalId(hospital); |
97 | 287 | //初诊集合列表 |
98 | 288 | List<AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery); |
99 | 289 | AntExQuery antExQuery = new AntExQuery(); |
290 | + if (StringUtils.isNotEmpty(doctorId)) { | |
291 | + antExQuery.setCheckDoctor(doctorId); | |
292 | + } | |
100 | 293 | antExQuery.setHospitalId(hospital); |
101 | 294 | antExQuery.setParentIds(pIds); |
102 | 295 | antExQuery.setYn(1); |
103 | 296 | |
104 | 297 | |
105 | 298 | |
106 | 299 | |
107 | 300 | |
... | ... | @@ -104,21 +297,82 @@ |
104 | 297 | List<AntenatalExaminationModel> antenatalExaminationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery()); |
105 | 298 | |
106 | 299 | List<AntextDoctorPatient> antextDoctorPatient = new ArrayList<>(); |
107 | - for(AntExChuModel ac : antExChuModels){ | |
300 | + //添加初诊结果 | |
301 | + for (AntExChuModel ac : antExChuModels) { | |
108 | 302 | AntextDoctorPatient adp = new AntextDoctorPatient(); |
109 | 303 | adp.setDoctorId(ac.getProdDoctor()); |
110 | - adp.setpId(ac.getPid()); | |
304 | + adp.setpId(ac.getParentId()); | |
305 | + Patients patients = patientsMap.get(ac.getParentId()); | |
306 | + if (patients.getType() == 1) {//孕妇 | |
307 | + //计算孕周 | |
308 | + adp.setcDueWeek(com.lyms.platform.common.utils.StringUtils.dueWeek(DateUtil.daysBetween(patients.getLastMenses(), new Date()))); | |
309 | + adp.setDueFmDate(patients.getDueDate()); | |
310 | + adp.setDueFmDateStr(DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
311 | + } else if (patients.getType() == 3) {//3-产妇 | |
312 | + adp.setcDueWeek("已分娩"); | |
313 | + adp.setDueFmDate(patients.getFmDate()); | |
314 | + adp.setDueFmDateStr(DateUtil.getyyyy_MM_dd(patients.getFmDate())); | |
315 | + } | |
316 | + adp.setCheckTime(ac.getCheckTime()); | |
317 | + adp.setpName(patients.getUsername()); | |
318 | + //高危因数 | |
319 | + adp.setRiskFactors(commonService.resloveFactor(patients.getRiskFactorId())); | |
320 | + //高危等级颜色 | |
321 | + adp.setRiskLevelId(commonService.findRiskLevel(patients.getRiskLevelId())); | |
111 | 322 | antextDoctorPatient.add(adp); |
112 | 323 | } |
113 | - for(AntenatalExaminationModel aec : antenatalExaminationModels){ | |
324 | + //添加复诊结果 | |
325 | + for (AntenatalExaminationModel aec : antenatalExaminationModels) { | |
114 | 326 | AntextDoctorPatient adp = new AntextDoctorPatient(); |
115 | 327 | adp.setDoctorId(aec.getCheckDoctor()); |
116 | - adp.setpId(aec.getPid()); | |
328 | + adp.setpId(aec.getParentId()); | |
329 | + adp.setCheckTime(aec.getCheckDate()); | |
330 | + Patients patients = patientsMap.get(aec.getParentId()); | |
331 | + if (patients.getType() == 1) {//孕妇 | |
332 | + //计算孕周 | |
333 | + adp.setcDueWeek(com.lyms.platform.common.utils.StringUtils.dueWeek(DateUtil.daysBetween(patients.getLastMenses(), new Date()))); | |
334 | + adp.setDueFmDate(patients.getDueDate()); | |
335 | + adp.setDueFmDateStr(DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
336 | + } else if (patients.getType() == 3) {//3-产妇 | |
337 | + adp.setcDueWeek("已分娩"); | |
338 | + adp.setDueFmDate(patients.getFmDate()); | |
339 | + adp.setDueFmDateStr(DateUtil.getyyyy_MM_dd(patients.getFmDate())); | |
340 | + } | |
341 | + adp.setpName(patients.getUsername()); | |
342 | + //高危因数 | |
343 | + adp.setRiskFactors(commonService.resloveFactor(patients.getRiskFactorId())); | |
344 | + //高危等级颜色 | |
345 | + adp.setRiskLevelId(commonService.findRiskLevel(patients.getRiskLevelId())); | |
346 | + | |
117 | 347 | antextDoctorPatient.add(adp); |
118 | 348 | } |
119 | - Map<String,AntextDoctorResult> adr1 = new HashMap<>(); | |
349 | + | |
350 | + | |
351 | + return antextDoctorPatient; | |
352 | + } | |
353 | + | |
354 | + /** | |
355 | + * 产检医生统计 | |
356 | + * | |
357 | + * @param startDate 建档开始时间 | |
358 | + * @param endDate 建档结束时间 | |
359 | + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
360 | + * @return | |
361 | + */ | |
362 | + @RequestMapping(method = RequestMethod.GET, value = "/getDoctorStatic") | |
363 | + @ResponseBody | |
364 | + @TokenRequired | |
365 | + public BaseObjectResponse getDoctorStatic(Date startDate, Date endDate, Integer childBirth, HttpServletRequest request) { | |
366 | + BaseObjectResponse rest = new BaseObjectResponse(); | |
367 | + | |
368 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
369 | + | |
370 | + //获取患者信息 | |
371 | + List<AntextDoctorPatient> antextDoctorPatient = getPatientList(loginState.getId(), startDate, endDate, childBirth, null); | |
372 | + | |
373 | + Map<String, AntextDoctorResult> adr1 = new HashMap<>(); | |
120 | 374 | //医生ID+患者ID 用与医生对于产检人数 + 总人数:患者ID |
121 | - Map<String,Integer> dpm = new HashMap<>(); | |
375 | + Map<String, Integer> dpm = new HashMap<>(); | |
122 | 376 | |
123 | 377 | //产检总人数 |
124 | 378 | int allCount = 0; |
125 | 379 | |
126 | 380 | |
127 | 381 | |
128 | 382 | |
129 | 383 | |
130 | 384 | |
131 | 385 | |
132 | 386 | |
133 | 387 | |
... | ... | @@ -129,40 +383,40 @@ |
129 | 383 | //产检五次及以上; |
130 | 384 | int allFive = 0; |
131 | 385 | |
132 | - for(AntextDoctorPatient adp : antextDoctorPatient){ | |
133 | - if(!dpm.containsKey(adp.getpId())){ | |
386 | + for (AntextDoctorPatient adp : antextDoctorPatient) { | |
387 | + if (!dpm.containsKey(adp.getpId())) { | |
134 | 388 | allCount++; |
135 | - dpm.put(adp.getpId(),1); | |
136 | - }else{ | |
137 | - Integer cjrc = dpm.get(adp.getpId()); | |
389 | + dpm.put(adp.getpId(), 1); | |
390 | + } else { | |
391 | + Integer cjrc = dpm.get(adp.getpId()); | |
138 | 392 | cjrc++; |
139 | - if(cjrc == 2){ | |
393 | + if (cjrc == 2) { | |
140 | 394 | allDoub++; |
141 | 395 | } |
142 | - if(cjrc == 5){ | |
396 | + if (cjrc == 5) { | |
143 | 397 | allFive++; |
144 | 398 | } |
145 | - dpm.put(adp.getpId(),cjrc); | |
399 | + dpm.put(adp.getpId(), cjrc); | |
146 | 400 | } |
147 | 401 | allCjrc++; |
148 | 402 | |
149 | - if(adr1.containsKey(adp.getDoctorId())){ | |
403 | + if (adr1.containsKey(adp.getDoctorId())) { | |
150 | 404 | AntextDoctorResult adr = adr1.get(adp.getDoctorId()); |
151 | - if(!dpm.containsKey(adp.getDoctorId()+adp.getpId())){//如果不存在,产检人数加1 | |
152 | - adr.setInspectPeople(adr.getInspectPeople()+1); | |
153 | - dpm.put(adp.getDoctorId()+adp.getpId(),1); | |
154 | - }else{//如果存在,则检测测试加一 | |
155 | - Integer num = dpm.get(adp.getDoctorId()+adp.getpId()); | |
405 | + if (!dpm.containsKey(adp.getDoctorId() + adp.getpId())) {//如果不存在,产检人数加1 | |
406 | + adr.setInspectPeople(adr.getInspectPeople() + 1); | |
407 | + dpm.put(adp.getDoctorId() + adp.getpId(), 1); | |
408 | + } else {//如果存在,则检测测试加一 | |
409 | + Integer num = dpm.get(adp.getDoctorId() + adp.getpId()); | |
156 | 410 | ++num; |
157 | - if(num == 2){ | |
158 | - adr.setTwice(adr.getTwice()+1); | |
159 | - }else if(num==5){ | |
160 | - adr.setFiveTimes(adr.getFiveTimes()+1); | |
411 | + if (num == 2) { | |
412 | + adr.setTwice(adr.getTwice() + 1); | |
413 | + } else if (num == 5) { | |
414 | + adr.setFiveTimes(adr.getFiveTimes() + 1); | |
161 | 415 | } |
162 | - dpm.put(adp.getDoctorId()+adp.getpId(),num); | |
416 | + dpm.put(adp.getDoctorId() + adp.getpId(), num); | |
163 | 417 | } |
164 | - adr.setInspectTime(adr.getInspectTime()+1); | |
165 | - }else{ | |
418 | + adr.setInspectTime(adr.getInspectTime() + 1); | |
419 | + } else { | |
166 | 420 | AntextDoctorResult adr = new AntextDoctorResult(); |
167 | 421 | adr.setDoctorId(adp.getDoctorId()); |
168 | 422 | adr.setInspectPeople(1); |
169 | 423 | |
170 | 424 | |
171 | 425 | |
172 | 426 | |
173 | 427 | |
174 | 428 | |
175 | 429 | |
176 | 430 | |
177 | 431 | |
... | ... | @@ -171,38 +425,38 @@ |
171 | 425 | adr.setFiveTimes(0); |
172 | 426 | adr.setTwiceProportion(""); |
173 | 427 | adr.setFiveTimeProportion(""); |
174 | - adr1.put(adp.getDoctorId(),adr); | |
175 | - dpm.put(adp.getDoctorId()+adp.getpId(),1); | |
428 | + adr1.put(adp.getDoctorId(), adr); | |
429 | + dpm.put(adp.getDoctorId() + adp.getpId(), 1); | |
176 | 430 | } |
177 | 431 | } |
178 | 432 | |
179 | - List<Map<String,Object>> gridList = new ArrayList<>(); | |
433 | + List<Map<String, Object>> gridList = new ArrayList<>(); | |
180 | 434 | //存总计 |
181 | 435 | gridList.add(new HashedMap()); |
182 | 436 | //表表图数据 |
183 | 437 | List<Object> doctorInfo = new ArrayList<>(); |
184 | 438 | |
185 | - for(Map.Entry<String,AntextDoctorResult> adr : adr1.entrySet()){ | |
439 | + for (Map.Entry<String, AntextDoctorResult> adr : adr1.entrySet()) { | |
186 | 440 | // System.out.println(adr.getValue().toString()); |
187 | 441 | AntextDoctorResult ar = adr.getValue(); |
188 | 442 | |
189 | - if(StringUtils.isNotEmpty(ar.getDoctorId())){ | |
190 | - Users users = usersService.getUsers(Integer.parseInt(ar.getDoctorId())); | |
191 | - if(users!=null){ | |
443 | + if (StringUtils.isNotEmpty(ar.getDoctorId())) { | |
444 | + Users users = usersService.getUsers(Integer.parseInt(ar.getDoctorId())); | |
445 | + if (users != null) { | |
192 | 446 | ar.setDoctorName(users.getName()); |
193 | - }else{ | |
447 | + } else { | |
194 | 448 | ar.setDoctorName("产检医生"); |
195 | 449 | } |
196 | - }else{ | |
450 | + } else { | |
197 | 451 | ar.setDoctorName("产检医生"); |
198 | 452 | } |
199 | - if(ar.getTwice()>0){ | |
453 | + if (ar.getTwice() > 0) { | |
200 | 454 | DecimalFormat df = new DecimalFormat("0.0");//格式化小数,不足的补0 |
201 | - ar.setTwiceProportion(df.format((float)ar.getTwice()/ar.getInspectPeople()*100)+"%"); | |
455 | + ar.setTwiceProportion(df.format((float) ar.getTwice() / ar.getInspectPeople() * 100) + "%"); | |
202 | 456 | } |
203 | - if(ar.getFiveTimes()>0){ | |
457 | + if (ar.getFiveTimes() > 0) { | |
204 | 458 | DecimalFormat df = new DecimalFormat("0.0");//格式化小数,不足的补0 |
205 | - ar.setFiveTimeProportion(df.format((float)ar.getFiveTimes()/ar.getInspectPeople()*100)+"%"); | |
459 | + ar.setFiveTimeProportion(df.format((float) ar.getFiveTimes() / ar.getInspectPeople() * 100) + "%"); | |
206 | 460 | } |
207 | 461 | gridList.add(BeanUtils.objectToObjectMap(ar)); |
208 | 462 | |
209 | 463 | |
210 | 464 | |
211 | 465 | |
212 | 466 | |
... | ... | @@ -224,26 +478,26 @@ |
224 | 478 | String allDoubBl = ""; |
225 | 479 | String allFiveBl = ""; |
226 | 480 | |
227 | - if(allDoub>0){ | |
481 | + if (allDoub > 0) { | |
228 | 482 | //两次比例 |
229 | - allDoubBl = df.format((float)allDoub/allCount*100)+"%"; | |
483 | + allDoubBl = df.format((float) allDoub / allCount * 100) + "%"; | |
230 | 484 | } |
231 | - if(allFive>0){ | |
485 | + if (allFive > 0) { | |
232 | 486 | //五次比例 |
233 | - allFiveBl = df.format((float)allFive/allCount*100)+"%"; | |
487 | + allFiveBl = df.format((float) allFive / allCount * 100) + "%"; | |
234 | 488 | } |
235 | 489 | |
236 | 490 | // System.out.println("总人数:"+allCount+",总人次:"+allCjrc+",总2次以上:"+allDoub+",总5次以上:"+allFive+",总两次比例:"+allDoubBl+",总五次比例:"+allFiveBl); |
237 | 491 | |
238 | 492 | //填充总计数据 |
239 | - Map<String,Object> allMap = gridList.get(0); | |
240 | - allMap.put("doctorName","总计"); | |
241 | - allMap.put("inspectTime",allCjrc); | |
242 | - allMap.put("inspectPeople",allCount); | |
243 | - allMap.put("twice",allDoub); | |
244 | - allMap.put("twiceProportion",allDoubBl); | |
245 | - allMap.put("fiveTimes",allFive); | |
246 | - allMap.put("fiveTimeProportion",allFiveBl); | |
493 | + Map<String, Object> allMap = gridList.get(0); | |
494 | + allMap.put("doctorName", "总计"); | |
495 | + allMap.put("inspectTime", allCjrc); | |
496 | + allMap.put("inspectPeople", allCount); | |
497 | + allMap.put("twice", allDoub); | |
498 | + allMap.put("twiceProportion", allDoubBl); | |
499 | + allMap.put("fiveTimes", allFive); | |
500 | + allMap.put("fiveTimeProportion", allFiveBl); | |
247 | 501 | |
248 | 502 | ReportModel reportModel = new ReportModel(); |
249 | 503 | reportModel.setDoctorInfo(doctorInfo); /** 医生数据详情 */ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
17b1b6c
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 |
41 | 41 | * @return |
42 | 42 | */ |
43 | - @RequestMapping(method = RequestMethod.GET, value = "/getCheckStatistics") | |
43 | +// @RequestMapping(method = RequestMethod.GET, value = "/getCheckStatistics") | |
44 | 44 | @ResponseBody |
45 | 45 | @TokenRequired |
46 | 46 | @Deprecated |
... | ... | @@ -61,7 +61,8 @@ |
61 | 61 | * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 |
62 | 62 | * @return |
63 | 63 | */ |
64 | - @RequestMapping(method = RequestMethod.GET, value = "/getCheckNumber") | |
64 | +// @RequestMapping(method = RequestMethod.GET, value = "/getCheckNumber") | |
65 | + @RequestMapping(method = RequestMethod.GET, value = "/getCheckStatistics") | |
65 | 66 | @ResponseBody |
66 | 67 | @TokenRequired |
67 | 68 | public BaseObjectResponse getCheckNumber(Date startDate, Date endDate, |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntextDoctorPatient.java
View file @
17b1b6c
1 | 1 | package com.lyms.platform.operate.web.result; |
2 | 2 | |
3 | +import java.util.Date; | |
4 | +import java.util.List; | |
5 | + | |
3 | 6 | /** |
4 | 7 | * @auther yangfei |
5 | 8 | * @createTime 2017年07月05日 16时58分 |
6 | 9 | |
7 | 10 | |
... | ... | @@ -8,9 +11,120 @@ |
8 | 11 | public class AntextDoctorPatient { |
9 | 12 | //医生ID |
10 | 13 | private String doctorId; |
14 | + //医生名称 | |
15 | + private String doctorName; | |
11 | 16 | //患者ID |
12 | 17 | private String pId; |
18 | + //患者姓名 | |
19 | + private String pName; | |
20 | + //本院产检次数 | |
21 | + private int cjNum; | |
22 | + //产检总次数 | |
23 | + private int allCjNum; | |
24 | + //高危风险 | |
25 | + private String riskFactors; | |
26 | + //风险等级颜色 | |
27 | + private List riskLevelId; | |
28 | + //孕周或已分娩 | |
29 | + private String cDueWeek; | |
30 | + //预产期或分娩日期 | |
31 | + private Date dueFmDate; | |
32 | + //预产期或分娩日期 | |
33 | + private String dueFmDateStr; | |
34 | + //产检时间 | |
35 | + private Date checkTime; | |
36 | + //产检时间 | |
37 | + private String checkTimeStr; | |
13 | 38 | |
39 | + public String getDoctorName() { | |
40 | + return doctorName; | |
41 | + } | |
42 | + | |
43 | + public void setDoctorName(String doctorName) { | |
44 | + this.doctorName = doctorName; | |
45 | + } | |
46 | + | |
47 | + public String getDueFmDateStr() { | |
48 | + return dueFmDateStr; | |
49 | + } | |
50 | + | |
51 | + public void setDueFmDateStr(String dueFmDateStr) { | |
52 | + this.dueFmDateStr = dueFmDateStr; | |
53 | + } | |
54 | + | |
55 | + public String getCheckTimeStr() { | |
56 | + return checkTimeStr; | |
57 | + } | |
58 | + | |
59 | + public void setCheckTimeStr(String checkTimeStr) { | |
60 | + this.checkTimeStr = checkTimeStr; | |
61 | + } | |
62 | + | |
63 | + public Date getCheckTime() { | |
64 | + return checkTime; | |
65 | + } | |
66 | + | |
67 | + public void setCheckTime(Date checkTime) { | |
68 | + this.checkTime = checkTime; | |
69 | + } | |
70 | + | |
71 | + | |
72 | + public int getCjNum() { | |
73 | + return cjNum; | |
74 | + } | |
75 | + | |
76 | + public int getAllCjNum() { | |
77 | + return allCjNum; | |
78 | + } | |
79 | + | |
80 | + public void setAllCjNum(int allCjNum) { | |
81 | + this.allCjNum = allCjNum; | |
82 | + } | |
83 | + | |
84 | + public void setCjNum(int cjNum) { | |
85 | + this.cjNum = cjNum; | |
86 | + } | |
87 | + | |
88 | + public String getpName() { | |
89 | + return pName; | |
90 | + } | |
91 | + | |
92 | + public void setpName(String pName) { | |
93 | + this.pName = pName; | |
94 | + } | |
95 | + | |
96 | + public String getcDueWeek() { | |
97 | + return cDueWeek; | |
98 | + } | |
99 | + | |
100 | + public void setcDueWeek(String cDueWeek) { | |
101 | + this.cDueWeek = cDueWeek; | |
102 | + } | |
103 | + | |
104 | + public Date getDueFmDate() { | |
105 | + return dueFmDate; | |
106 | + } | |
107 | + | |
108 | + public void setDueFmDate(Date dueFmDate) { | |
109 | + this.dueFmDate = dueFmDate; | |
110 | + } | |
111 | + | |
112 | + public String getRiskFactors() { | |
113 | + return riskFactors; | |
114 | + } | |
115 | + | |
116 | + public void setRiskFactors(String riskFactors) { | |
117 | + this.riskFactors = riskFactors; | |
118 | + } | |
119 | + | |
120 | + public List getRiskLevelId() { | |
121 | + return riskLevelId; | |
122 | + } | |
123 | + | |
124 | + public void setRiskLevelId(List riskLevelId) { | |
125 | + this.riskLevelId = riskLevelId; | |
126 | + } | |
127 | + | |
14 | 128 | public String getDoctorId() { |
15 | 129 | return doctorId; |
16 | 130 | } |
... | ... | @@ -25,6 +139,22 @@ |
25 | 139 | |
26 | 140 | public void setpId(String pId) { |
27 | 141 | this.pId = pId; |
142 | + } | |
143 | + | |
144 | + @Override | |
145 | + public String toString() { | |
146 | + return "AntextDoctorPatient{" + | |
147 | + "doctorId='" + doctorId + '\'' + | |
148 | + ", pId='" + pId + '\'' + | |
149 | + ", pName='" + pName + '\'' + | |
150 | + ", cjNum=" + cjNum + | |
151 | + ", allCjNum=" + allCjNum + | |
152 | + ", riskFactors='" + riskFactors + '\'' + | |
153 | + ", riskLevelId=" + riskLevelId + | |
154 | + ", cDueWeek='" + cDueWeek + '\'' + | |
155 | + ", dueFmDate=" + dueFmDate + | |
156 | + ", checkTime=" + checkTime + | |
157 | + '}'; | |
28 | 158 | } |
29 | 159 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PostReviewServiceImpl.java
View file @
17b1b6c
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | |
56 | 56 | if(StringUtils.isNotEmpty(key)) { |
57 | 57 | Criteria criteria = new Criteria(); |
58 | - criteria.orOperator(Criteria.where("username").is(key), Criteria.where("vcCardNo").is(key), Criteria.where("phone").is(key)); | |
58 | + criteria.orOperator(Criteria.where("username").regex(key), Criteria.where("cardNo").is(key), Criteria.where("phone").is(key)); | |
59 | 59 | List<Patients> patients = mongoUtil.findField(Patients.class, criteria, "id"); |
60 | 60 | if(CollectionUtils.isEmpty(patients)) { |
61 | 61 | return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); |
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | } |
67 | 67 | query.addCriteria(Criteria.where("parentId").in(ids)); |
68 | 68 | } |
69 | + query.with(new Sort(Sort.Direction.DESC, "checkTime")); | |
69 | 70 | |
70 | 71 | PageResult pageResult = findMongoPage(PostReviewModel.class, query, page, limit); |
71 | 72 | List<PostReviewModel> grid = (List<PostReviewModel>) pageResult.getGrid(); |
... | ... | @@ -80,7 +81,7 @@ |
80 | 81 | tempMap.put("vcCardNo", p.getVcCardNo()); |
81 | 82 | tempMap.put("pcerteTypeId", p.getPcerteTypeId()); |
82 | 83 | tempMap.put("checkTime", model.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(model.getCheckTime())); /** 复查日期 */ |
83 | - tempMap.put("hcertificateNum", p == null ? null : p.getCardNo()); /** 证件号 */ | |
84 | + tempMap.put("hcertificateNum", p == null ? null : StringUtils.encryCardNo(p.getCardNo())); /** 证件号 */ | |
84 | 85 | tempMap.put("name", p == null ? null : p.getUsername()); /** 姓名 */ |
85 | 86 | tempMap.put("age", p == null ? null : DateUtil.getAge(p.getBirth())); /** 年龄 */ |
86 | 87 | tempMap.put("day", p == null ? null : model.getDay()); /** 产后天数 */ |
... | ... | @@ -94,7 +95,7 @@ |
94 | 95 | } else { |
95 | 96 | tempMap.put("doctorName", null); |
96 | 97 | } |
97 | - tempMap.put("phone", p == null ? null : p.getPhone()); | |
98 | + tempMap.put("phone", p == null ? null : StringUtils.encryPhone(p.getPhone())); | |
98 | 99 | rest.add(tempMap); |
99 | 100 | } |
100 | 101 | pageResult.setGrid(rest); |
... | ... | @@ -110,7 +111,7 @@ |
110 | 111 | cnames.put("id", "#"); |
111 | 112 | cnames.put("checkTime", "复查日期"); |
112 | 113 | cnames.put("hcertificateNum", "证件号"); |
113 | - cnames.put("username", "姓名"); | |
114 | + cnames.put("name", "姓名"); | |
114 | 115 | cnames.put("age", "年龄"); |
115 | 116 | cnames.put("day", "产后天数"); |
116 | 117 | cnames.put("reviewCount", "复查次数"); |
... | ... | @@ -126,7 +127,7 @@ |
126 | 127 | result.put("id", ++i); |
127 | 128 | result.put("checkTime", data.get("checkTime")); |
128 | 129 | result.put("hcertificateNum", data.get("hcertificateNum")); |
129 | - result.put("username", data.get("username")); | |
130 | + result.put("name", data.get("name")); | |
130 | 131 | result.put("age", data.get("age")); |
131 | 132 | result.put("day", data.get("day")); |
132 | 133 | result.put("reviewCount", data.get("reviewCount")); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
17b1b6c
... | ... | @@ -1165,11 +1165,14 @@ |
1165 | 1165 | criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1)); |
1166 | 1166 | } |
1167 | 1167 | if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */ |
1168 | - criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)) | |
1169 | - .gte(DateUtil.getWeekDay(-startWeek)); | |
1168 | + criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)).gte(DateUtil.getWeekDay(-endWeek)); | |
1170 | 1169 | } |
1170 | + if(childBirth != null) { | |
1171 | + criteria.and("type").is(childBirth); | |
1172 | + } | |
1171 | 1173 | List<Patients> patients = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid"); |
1172 | 1174 | List<String> patientIds = CollectionUtils.getId(patients, "id", String.class); |
1175 | + Map<String, Object> restMap = new HashMap<>(); | |
1173 | 1176 | if(CollectionUtils.isNotEmpty(patientIds)) { |
1174 | 1177 | /** 初诊数据 */ |
1175 | 1178 | Criteria c = Criteria.where("hospitalId").is(hid).and("parentId").in(patientIds); |
1176 | 1179 | |
1177 | 1180 | |
... | ... | @@ -1182,27 +1185,17 @@ |
1182 | 1185 | doMerge(datas, antExChuModels, antExModels, patients); |
1183 | 1186 | |
1184 | 1187 | /** 拼装好产检次数 */ |
1185 | - List<Map<String, Object>> grid = getCheckNumerGrid(datas); | |
1188 | + List<Object> yData = new ArrayList<>(); | |
1189 | + List<Map<String, Object>> grid = getCheckNumerGrid(datas, yData); | |
1190 | + restMap.put("grid", grid); | |
1191 | + restMap.put("xAxis", Arrays.asList("1次", "2次", "3次", "4次", "5次", "6次", "7次", "8次", "9次", "10次", "11次", "12次", "≥13次")); | |
1192 | + restMap.put("yAxis", yData); | |
1193 | + rest.setData(restMap); | |
1186 | 1194 | } |
1187 | - | |
1188 | -// List<AntExChuModel> antExChuModels = mongoTemplate.find(antexcQuery, AntExChuModel.class); | |
1189 | - | |
1190 | -// mongoUtil.findField(AntExChuModel.class, antexcQuery, ""); | |
1191 | - | |
1192 | - /*Map<String, Object> restMap = new HashMap<>(); | |
1193 | - List<Object> params = new ArrayList<>(); | |
1194 | - String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1195 | - List<Map<String, Object>> mapList = reportDao.findList(getAreaCountFacadeSql(startDate, endDate, startWeek, endWeek, childBirth, hospitalId, params), params); | |
1196 | - List<Object> peopleList = createPeoples(mapList); | |
1197 | - restMap.put("grid", createGrid( createPeoples(mapList), createProportion(peopleList))); | |
1198 | - restMap.put("xAxis", Arrays.asList("1次", "2次", "3次", "4次", "5次", "6次", "7次", "8次", "9次", "10次", "11次", "12次", "≥13次")); *//** x轴数据 *//* | |
1199 | - restMap.put("yAxis", createYData(peopleList)); | |
1200 | - | |
1201 | - rest.setData(restMap);*/ | |
1202 | 1195 | return rest; |
1203 | 1196 | } |
1204 | 1197 | |
1205 | - private List<Map<String,Object>> getCheckNumerGrid(List<Map<String, Object>> datas) { | |
1198 | + private List<Map<String,Object>> getCheckNumerGrid(List<Map<String, Object>> datas, List<Object> yData) { | |
1206 | 1199 | /** key = pid, value = 初诊复诊记录 */ |
1207 | 1200 | Map<String, List<Map<String, Object>>> userCheckInfo = new HashMap<>(); |
1208 | 1201 | for (Map<String, Object> data : datas) { |
1209 | 1202 | |
1210 | 1203 | |
1211 | 1204 | |
1212 | 1205 | |
1213 | 1206 | |
... | ... | @@ -1216,24 +1209,99 @@ |
1216 | 1209 | userCheckInfo.put(patientId, maps); |
1217 | 1210 | } |
1218 | 1211 | } |
1219 | - System.out.println("==========="); | |
1220 | - for (Map.Entry<String, List<Map<String, Object>>> map : userCheckInfo.entrySet()) { | |
1221 | - System.out.println(map.getKey() + " : " + map.getValue()); | |
1222 | - } | |
1223 | - | |
1224 | 1212 | Map<Integer, Integer> countMap = new HashMap<>(); |
1225 | 1213 | for (int i = 1; i < 14; i++) { |
1226 | 1214 | countMap.put(i, 0); |
1227 | 1215 | } |
1228 | - for (Map<String,Object> map : datas) { | |
1229 | - | |
1216 | + Set<Map.Entry<String, List<Map<String, Object>>>> entries = userCheckInfo.entrySet(); | |
1217 | + for (Map.Entry<String, List<Map<String, Object>>> entry : entries) { | |
1218 | + List<Map<String, Object>> value = entry.getValue(); | |
1219 | + if(value.size() == 1) { | |
1220 | + countMap.put(1, countMap.get(1) + 1); | |
1221 | + } else { | |
1222 | + /** 按照分娩时间分组 */ | |
1223 | + /** key=pid value=count */ | |
1224 | + Map<Date, Integer> tempMap = new HashMap<>(); | |
1225 | + Integer other = 0; | |
1226 | + for (Map<String, Object> map : value) { | |
1227 | + Date fmDate = (Date) map.get("fmDate"); | |
1228 | + if(fmDate == null) { | |
1229 | + ++other; | |
1230 | + continue; | |
1231 | + } | |
1232 | + if(tempMap.containsKey(fmDate)) { | |
1233 | + tempMap.put(fmDate, tempMap.get(fmDate) + 1); | |
1234 | + } else { | |
1235 | + tempMap.put(fmDate, 1); | |
1236 | + } | |
1237 | + } | |
1238 | + if(other != 0) { /** 处理大于或等于13次 没有分娩时间的数据 */ | |
1239 | + if(other >= 13) { | |
1240 | + countMap.put(13, countMap.get(13) + 1); | |
1241 | + } else { | |
1242 | + countMap.put(other, countMap.get(other) + 1); | |
1243 | + } | |
1244 | + } | |
1245 | + | |
1246 | + Set<Map.Entry<Date, Integer>> entries1 = tempMap.entrySet(); | |
1247 | + for (Map.Entry<Date, Integer> en : entries1) { | |
1248 | + Integer v = en.getValue(); | |
1249 | + if(v >= 13) { | |
1250 | + countMap.put(13, countMap.get(13) + 1); | |
1251 | + } else { | |
1252 | + countMap.put(v, countMap.get(v) + 1); | |
1253 | + } | |
1254 | + | |
1255 | + } | |
1256 | + } | |
1230 | 1257 | } |
1258 | + /** 处理总数 */ | |
1259 | + Integer count = 0; | |
1260 | + for (int i = 1; i < 14; i++) { | |
1261 | + count += countMap.get(i); | |
1262 | + } | |
1263 | + countMap.put(0, count); | |
1231 | 1264 | |
1232 | 1265 | List<Map<String,Object>> restList = new ArrayList<>(); |
1233 | 1266 | Map<String, Object> peoples = new LinkedHashMap<>(); |
1234 | - peoples.put("desc", "产检人数"); | |
1267 | + peoples.put("desc", "产检人数"); /** 产检人数 */ | |
1268 | + peoples.put("count", countMap.get(0));/** 总计 */ | |
1269 | + peoples.put("once", countMap.get(1)); | |
1270 | + peoples.put("twice", countMap.get(2)); | |
1271 | + peoples.put("threeTimes", countMap.get(3)); | |
1272 | + peoples.put("fourTimes", countMap.get(4)); | |
1273 | + peoples.put("fiveTimes", countMap.get(5)); | |
1274 | + peoples.put("sixTimes", countMap.get(6)); | |
1275 | + peoples.put("sevenTimes", countMap.get(7)); | |
1276 | + peoples.put("eightTimes", countMap.get(8)); | |
1277 | + peoples.put("nineTimes", countMap.get(9)); | |
1278 | + peoples.put("tenTimes", countMap.get(10)); | |
1279 | + peoples.put("elevenTimes", countMap.get(11)); | |
1280 | + peoples.put("twelveTimes", countMap.get(12)); | |
1281 | + peoples.put("otherTimes", countMap.get(13)); | |
1282 | + restList.add(peoples); | |
1235 | 1283 | |
1284 | + Map<String, Object> proportion = new LinkedHashMap<>(); | |
1285 | + proportion.put("desc", "占比"); /** 占比 */ | |
1286 | + proportion.put("count", "100%");/** 总计 */ | |
1287 | + proportion.put("once", MathUtil.getProportion(countMap.get(1), count)); | |
1288 | + proportion.put("twice", MathUtil.getProportion(countMap.get(2), count)); | |
1289 | + proportion.put("threeTimes", MathUtil.getProportion(countMap.get(3), count)); | |
1290 | + proportion.put("fourTimes", MathUtil.getProportion(countMap.get(4), count)); | |
1291 | + proportion.put("fiveTimes", MathUtil.getProportion(countMap.get(5), count)); | |
1292 | + proportion.put("sixTimes", MathUtil.getProportion(countMap.get(6), count)); | |
1293 | + proportion.put("sevenTimes", MathUtil.getProportion(countMap.get(7), count)); | |
1294 | + proportion.put("eightTimes", MathUtil.getProportion(countMap.get(8), count)); | |
1295 | + proportion.put("nineTimes", MathUtil.getProportion(countMap.get(9), count)); | |
1296 | + proportion.put("tenTimes", MathUtil.getProportion(countMap.get(10), count)); | |
1297 | + proportion.put("elevenTimes", MathUtil.getProportion(countMap.get(11), count)); | |
1298 | + proportion.put("twelveTimes", MathUtil.getProportion(countMap.get(12), count)); | |
1299 | + proportion.put("otherTimes", MathUtil.getProportion(countMap.get(13), count)); | |
1300 | + restList.add(proportion); | |
1236 | 1301 | |
1302 | + for (int i = 0; i < 12; i++) { | |
1303 | + yData.add(countMap.get(i + 1)); | |
1304 | + } | |
1237 | 1305 | return restList; |
1238 | 1306 | } |
1239 | 1307 | |
1240 | 1308 | |
... | ... | @@ -1267,16 +1335,13 @@ |
1267 | 1335 | } |
1268 | 1336 | } |
1269 | 1337 | } |
1270 | - System.out.println(antExChuModels.size()); | |
1271 | - System.out.println(antExModels.size()); | |
1272 | - System.out.println(datas.size()); | |
1273 | - for (Map<String, Object> data : datas) { | |
1338 | + /* for (Map<String, Object> data : datas) { | |
1274 | 1339 | Set<Map.Entry<String, Object>> entries = data.entrySet(); |
1275 | 1340 | for (Map.Entry<String, Object> entry : entries) { |
1276 | 1341 | System.out.print(entry.getKey() + " = " + (entry.getValue() instanceof Date ? ((Date) entry.getValue()).toLocaleString(): entry.getValue()) + "\t"); |
1277 | 1342 | } |
1278 | 1343 | System.out.println(); |
1279 | - } | |
1344 | + }*/ | |
1280 | 1345 | } |
1281 | 1346 | |
1282 | 1347 | private List<Series> createPatientSeries(List<Map<String, Object>> datas) { |