Commit bd60bc19a4caf6d6d76ceed3c5154d50e7707da8
1 parent
634c80ddc6
Exists in
master
and in
6 other branches
美生县医院系统数据分析报告-4.3.2.高危预诊断
Showing 4 changed files with 155 additions and 3 deletions
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyRiskSortResult.java
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
bd60bc1
... | ... | @@ -1577,7 +1577,11 @@ |
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | if (!StringUtils.isEmpty(highRiskInfo)) { |
1580 | - condition = condition.and("highRiskInfo", highRiskInfo, MongoOper.IN); | |
1580 | + if(StringUtils.isNotEmpty(hospitalId)&&"216".equals(hospitalId)){ | |
1581 | + condition = condition.and("qhdHighRiskInfo.id", highRiskInfo, MongoOper.IN); | |
1582 | + }else { | |
1583 | + condition = condition.and("highRiskInfo", highRiskInfo, MongoOper.IN); | |
1584 | + } | |
1581 | 1585 | } |
1582 | 1586 | |
1583 | 1587 | if (!StringUtils.isEmpty(weakSonInfo)) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java
View file @
bd60bc1
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | import com.lyms.platform.operate.web.service.PatientWeightService; |
18 | 18 | import com.lyms.platform.permission.service.CouponService; |
19 | 19 | import com.lyms.platform.pojo.AntExChuModel; |
20 | +import com.lyms.platform.pojo.BabyModel; | |
20 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
21 | 22 | import org.springframework.stereotype.Controller; |
22 | 23 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -677,6 +678,20 @@ |
677 | 678 | @RequestParam(required = true) Date startDate, |
678 | 679 | @RequestParam(required = true)Date endDate) { |
679 | 680 | return babyCheckFacade.getBabyCheckStatis(hospitalId, startDate, endDate); |
681 | + } | |
682 | + /** | |
683 | + * 统计管理-孕产妇数据统计-高危预诊断(建档儿童的高危统计) | |
684 | + * | |
685 | + * @param buildTime | |
686 | + * @param request | |
687 | + * @return | |
688 | + */ | |
689 | + @RequestMapping(value = "/getBabyRiskStatis", method = RequestMethod.GET) | |
690 | + @ResponseBody | |
691 | + @TokenRequired | |
692 | + public BaseResponse getBabyRiskStatis(@RequestParam(required = true) String buildTime, HttpServletRequest request) { | |
693 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
694 | + return babyCheckFacade.getBabyRiskStatis(buildTime, loginState.getId()); | |
680 | 695 | } |
681 | 696 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
bd60bc1
... | ... | @@ -23,9 +23,7 @@ |
23 | 23 | import com.lyms.platform.permission.service.*; |
24 | 24 | import com.lyms.platform.pojo.*; |
25 | 25 | import com.lyms.platform.query.*; |
26 | -import com.mchange.lang.IntegerUtils; | |
27 | 26 | import com.mongodb.BasicDBObject; |
28 | -import jdk.nashorn.internal.ir.LiteralNode; | |
29 | 27 | import org.apache.commons.collections.CollectionUtils; |
30 | 28 | import org.apache.commons.collections.map.HashedMap; |
31 | 29 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -4970,6 +4968,100 @@ |
4970 | 4968 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
4971 | 4969 | br.setErrormsg("成功"); |
4972 | 4970 | br.setObject(map); |
4971 | + return br; | |
4972 | + } | |
4973 | + | |
4974 | + public BaseResponse getBabyRiskStatis(final String buildTime, Integer userId) { | |
4975 | + BaseResponse br=new BaseResponse(); | |
4976 | + final String hospitalId = autoMatchFacade.getHospitalId(userId); | |
4977 | + BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
4978 | + basicConfigQuery.setYn(YnEnums.YES.getId()); | |
4979 | + basicConfigQuery.setTypeId(SystemConfig.BABY_HIGH_RISK_ID); | |
4980 | + basicConfigQuery.setEnable(1); | |
4981 | + List<BabyRiskSortResult> data = new ArrayList <>(); | |
4982 | + List<BasicConfig> riskLevelConfig = basicConfigService.queryBasicConfig(basicConfigQuery); | |
4983 | + | |
4984 | + if (CollectionUtils.isNotEmpty(riskLevelConfig)) { | |
4985 | + | |
4986 | + int batchSize = 20; | |
4987 | + int end = 0; | |
4988 | + List <Future> listFuture = new ArrayList <>(); | |
4989 | + for (int i = 0; i < riskLevelConfig.size(); i += batchSize) { | |
4990 | + end = (end + batchSize); | |
4991 | + if (end > riskLevelConfig.size()) { | |
4992 | + end = riskLevelConfig.size(); | |
4993 | + } | |
4994 | + final List<BasicConfig> risks = riskLevelConfig.subList(i, end); | |
4995 | + listFuture.add(commonThreadPool.submit(new Callable() { | |
4996 | + @Override | |
4997 | + public Object call() throws Exception { | |
4998 | + if (CollectionUtils.isNotEmpty(risks)) | |
4999 | + { | |
5000 | + List<BabyRiskSortResult> data1 = new ArrayList <>(); | |
5001 | + for (final BasicConfig config : risks) | |
5002 | + { | |
5003 | + if("d42eec03-aa86-45b8-a4e0-78a0ff365fb6".equals(config.getId())) | |
5004 | + { | |
5005 | + continue; | |
5006 | + } | |
5007 | + | |
5008 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
5009 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
5010 | + babyModelQuery.setHospitalId(hospitalId); | |
5011 | + babyModelQuery.setHighRisk(1); | |
5012 | + babyModelQuery.setHighRiskInfo(config.getId()); | |
5013 | + | |
5014 | + //建档时间 | |
5015 | + if (StringUtils.isNotEmpty(buildTime)) { | |
5016 | + String nextDateStr = buildTime; | |
5017 | + String[] dates = nextDateStr.split(" - "); | |
5018 | + | |
5019 | + babyModelQuery.setBuildDateStart(DateUtil.parseYMD(dates[0])); | |
5020 | + if (dates.length == 2) { | |
5021 | + babyModelQuery.setBuildDateEnd(DateUtil.parseYMD(dates[1])); | |
5022 | + } | |
5023 | + } | |
5024 | + | |
5025 | + //总的儿童条数 | |
5026 | + int allBabyRiskCount = babyBookbuildingService.queryBabyCount(babyModelQuery); | |
5027 | + if (allBabyRiskCount == 0) | |
5028 | + { | |
5029 | + continue; | |
5030 | + } | |
5031 | + data1.add(new BabyRiskSortResult(config.getName(),allBabyRiskCount)); | |
5032 | + } | |
5033 | + return data1; | |
5034 | + } | |
5035 | + return null; | |
5036 | + } | |
5037 | + })); | |
5038 | + } | |
5039 | + for (Future f : listFuture) { | |
5040 | + try { | |
5041 | + data.addAll((List) f.get(30, TimeUnit.SECONDS)); | |
5042 | + } catch (Exception e) { | |
5043 | + ExceptionUtils.catchException(e, "convertToQuanPatient get result Future error."); | |
5044 | + } | |
5045 | + } | |
5046 | + if (data.size() >0) | |
5047 | + { | |
5048 | + Collections.sort(data); | |
5049 | + data = data.subList(0,10); | |
5050 | + int all = 0; | |
5051 | + for (BabyRiskSortResult result : data) | |
5052 | + { | |
5053 | + all+=result.getCount(); | |
5054 | + } | |
5055 | + for (BabyRiskSortResult result : data) | |
5056 | + { | |
5057 | + result.setPercent(StringUtils.getPercent(result.getCount(),all)); | |
5058 | + } | |
5059 | + } | |
5060 | + | |
5061 | + } | |
5062 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
5063 | + br.setErrormsg("成功"); | |
5064 | + br.setObject(data); | |
4973 | 5065 | return br; |
4974 | 5066 | } |
4975 | 5067 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyRiskSortResult.java
View file @
bd60bc1
1 | +package com.lyms.platform.operate.web.result; | |
2 | + | |
3 | +public class BabyRiskSortResult implements Comparable<BabyRiskSortResult>{ | |
4 | + private String riskName; | |
5 | + private Integer count; | |
6 | + private String percent; | |
7 | + | |
8 | + public BabyRiskSortResult(String riskName, Integer count) { | |
9 | + this.riskName = riskName; | |
10 | + this.count = count; | |
11 | + } | |
12 | + | |
13 | + public Integer getCount() { | |
14 | + return count; | |
15 | + } | |
16 | + | |
17 | + public void setCount(Integer count) { | |
18 | + this.count = count; | |
19 | + } | |
20 | + | |
21 | + public String getRiskName() { | |
22 | + return riskName; | |
23 | + } | |
24 | + | |
25 | + public void setRiskName(String riskName) { | |
26 | + this.riskName = riskName; | |
27 | + } | |
28 | + | |
29 | + public String getPercent() { | |
30 | + return percent; | |
31 | + } | |
32 | + | |
33 | + public void setPercent(String percent) { | |
34 | + this.percent = percent; | |
35 | + } | |
36 | + | |
37 | + @Override | |
38 | + public int compareTo(BabyRiskSortResult o) { | |
39 | + return o.getCount().compareTo(this.getCount()); | |
40 | + } | |
41 | +} |