Commit 3de4b3b5bf9b15648e4affc8b08dc560ad376af5
1 parent
85071b93a9
Exists in
master
and in
6 other branches
结算
Showing 1 changed file with 69 additions and 4 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java
View file @
3de4b3b
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | -import com.lyms.platform.biz.service.BabyBookbuildingService; | |
4 | -import com.lyms.platform.biz.service.ChargeRecordService; | |
5 | -import com.lyms.platform.biz.service.HealthChargeService; | |
6 | -import com.lyms.platform.biz.service.PatientsService; | |
3 | +import com.lyms.platform.biz.service.*; | |
7 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | 5 | import com.lyms.platform.common.enums.YnEnums; |
9 | 6 | import com.lyms.platform.common.result.BaseListResponse; |
10 | 7 | |
11 | 8 | |
... | ... | @@ -18,10 +15,13 @@ |
18 | 15 | import com.lyms.platform.permission.model.Users; |
19 | 16 | import com.lyms.platform.permission.service.UsersService; |
20 | 17 | import com.lyms.platform.pojo.*; |
18 | +import com.lyms.platform.query.AntExRecordQuery; | |
21 | 19 | import com.lyms.platform.query.ChargeRecordQuery; |
22 | 20 | import com.lyms.platform.query.HealthChargeQuery; |
23 | 21 | import org.apache.commons.collections.CollectionUtils; |
22 | +import org.apache.commons.lang.math.NumberUtils; | |
24 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
24 | +import org.springframework.data.domain.Sort; | |
25 | 25 | import org.springframework.data.mongodb.core.MongoTemplate; |
26 | 26 | import org.springframework.data.mongodb.core.query.Criteria; |
27 | 27 | import org.springframework.data.mongodb.core.query.Query; |
28 | 28 | |
... | ... | @@ -55,8 +55,17 @@ |
55 | 55 | private UsersService usersService; |
56 | 56 | |
57 | 57 | @Autowired |
58 | + private AntExRecordService recordService; | |
59 | + | |
60 | + @Autowired | |
58 | 61 | private BabyBookbuildingService babyBookbuildingService; |
59 | 62 | |
63 | + @Autowired | |
64 | + private CommonService commonService; | |
65 | + | |
66 | + @Autowired | |
67 | + private AntenatalExaminationService antenatalExaminationService; | |
68 | + | |
60 | 69 | /** |
61 | 70 | * 新增字段:报表解读人 孕妇/儿童 |
62 | 71 | * |
... | ... | @@ -284,6 +293,7 @@ |
284 | 293 | { |
285 | 294 | return null; |
286 | 295 | } |
296 | + map.put("risk",getLastRisk(patients,model.getCreated())); | |
287 | 297 | map.put("userName", patients.getUsername()); |
288 | 298 | map.put("age",DateUtil.getAge(patients.getBirth(), model.getCreated())); |
289 | 299 | map.put("week",patients.getType() == 3 ? "已分娩": DateUtil.getWeekDesc(patients.getLastMenses(),model.getCreated())); |
... | ... | @@ -300,6 +310,61 @@ |
300 | 310 | map.put("time", DateUtil.getyyyy_MM_dd(model.getCreated())); |
301 | 311 | return map; |
302 | 312 | } |
313 | + | |
314 | + | |
315 | + private String getLastRisk(Patients patients,Date lastDate) | |
316 | + { | |
317 | + String ri = ""; | |
318 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
319 | + antExRecordQuery.setPid(patients.getPid()); | |
320 | + antExRecordQuery.setCheckTimeEnd(lastDate); | |
321 | + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created"); | |
322 | + if (CollectionUtils.isNotEmpty(antExRecordModelList)) | |
323 | + { | |
324 | + | |
325 | + AntExRecordModel model = antExRecordModelList.get(0); | |
326 | + | |
327 | + | |
328 | + String risk = null; | |
329 | + if (model.getType() == 2) { | |
330 | + AntExChuModel model1 = antenatalExaminationService.findOne(model.getfId()); | |
331 | + if (null != model1) { | |
332 | + risk = model1.getOtherHighRisk(); | |
333 | + } | |
334 | + } else if (model.getType() == 1) { | |
335 | + AntenatalExaminationModel model2 = antenatalExaminationService.findOneById(model.getfId()); | |
336 | + if (null != model2) { | |
337 | + risk = model2.getOtherRisk(); | |
338 | + } | |
339 | + } | |
340 | + | |
341 | + List<Map<String, Object>> results = commonService.resolveOtherRisk(risk); | |
342 | + StringBuffer name = new StringBuffer(); | |
343 | + Integer score = 0; | |
344 | + if (CollectionUtils.isNotEmpty(results)) { | |
345 | + for (Map result : results) { | |
346 | + //高危因素名字 | |
347 | + name.append(result.get("name").toString() + ","); | |
348 | + String level = result.get("levelId").toString(); | |
349 | + score += NumberUtils.toInt(result.get("score").toString(), 0); | |
350 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(level) && !"null".equals(level)) { | |
351 | + model.gethLevel().add(level); | |
352 | + } | |
353 | + } | |
354 | + } | |
355 | + | |
356 | + ri = commonService.resloveFactor(model.gethRisk()); | |
357 | + if (StringUtils.isNotEmpty(name.toString())) { | |
358 | + if (StringUtils.isNotEmpty(ri)) { | |
359 | + ri += ","; | |
360 | + } | |
361 | + ri += name.substring(0, name.length() - 1); | |
362 | + } | |
363 | + } | |
364 | + | |
365 | + return ri; | |
366 | + } | |
367 | + | |
303 | 368 | |
304 | 369 | |
305 | 370 | /** |