Commit 29299877d5ba2de5fd30a3aacc42e2c3450c5b62
1 parent
009874cca2
Exists in
master
and in
1 other branch
报表
Showing 6 changed files with 372 additions and 5 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RiskReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskReportPatientResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskReportResult.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RiskReportController.java
View file @
2929987
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.common.base.BaseController; | |
4 | +import com.lyms.platform.common.base.LoginContext; | |
5 | +import com.lyms.platform.common.result.BaseResponse; | |
6 | +import com.lyms.platform.operate.web.facade.RiskReportFacade; | |
7 | +import com.lyms.platform.operate.web.request.RiskPatientsQueryRequest; | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.stereotype.Controller; | |
10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
11 | +import org.springframework.web.bind.annotation.RequestMethod; | |
12 | +import org.springframework.web.bind.annotation.ResponseBody; | |
13 | + | |
14 | +import javax.servlet.http.HttpServletRequest; | |
15 | +import javax.validation.Valid; | |
16 | + | |
17 | + | |
18 | +/** | |
19 | + * Created by Administrator on 2016/6/22 0022. | |
20 | + */ | |
21 | +@Controller | |
22 | +public class RiskReportController extends BaseController { | |
23 | + | |
24 | + @Autowired | |
25 | + private RiskReportFacade riskReportFacade; | |
26 | + | |
27 | + /** | |
28 | + * 高危统计报表 | |
29 | + * @return | |
30 | + */ | |
31 | + @RequestMapping(method = RequestMethod.GET, value = "/queryRiskReportCount") | |
32 | + @ResponseBody | |
33 | + public BaseResponse queryRiskReportCount(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { | |
34 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
35 | + return riskReportFacade.queryRiskReportCount(patientsQueryRequest,loginState.getId()); | |
36 | + | |
37 | + } | |
38 | + | |
39 | + | |
40 | +// /** | |
41 | +// * 高危孕妇统计报表 | |
42 | +// * @return | |
43 | +// */ | |
44 | +// @RequestMapping(method = RequestMethod.GET, value = "/queryRiskPatientReport") | |
45 | +// @ResponseBody | |
46 | +// public BaseResponse queryRiskPatientReport(@RequestParam(value = "dueDate", required = false) String dueDate, | |
47 | +// @RequestParam(value = "rLevel", required = false) String rLevel, | |
48 | +// @RequestParam(value = "checkDoctor", required = false) String checkDoctor, | |
49 | +// @RequestParam(value = "buildDate", required = false) String buildDate, | |
50 | +// @RequestParam(value = "riskId", required = false) String riskId) { | |
51 | +// | |
52 | +// return riskReportFacade.queryRiskPatientReport(dueDate, rLevel, checkDoctor, buildDate, riskId); | |
53 | +// | |
54 | +// } | |
55 | + | |
56 | + | |
57 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
2929987
... | ... | @@ -165,7 +165,8 @@ |
165 | 165 | } catch (Exception e) { |
166 | 166 | ExceptionUtils.catchException(e, "patients.getRiskLevelId error."); |
167 | 167 | } |
168 | - cjStatisticsListResult.setrLevel(HighScoreResult.getLevelStr(HighScoreResult.filter(level))); | |
168 | + cjStatisticsListResult.setrLevel(HighScoreResult.filter(level)); | |
169 | +// cjStatisticsListResult.setrLevel(HighScoreResult.getLevelStr(HighScoreResult.filter(level))); | |
169 | 170 | } |
170 | 171 | data.add(cjStatisticsListResult); |
171 | 172 | } |
... | ... | @@ -187,7 +188,7 @@ |
187 | 188 | data.add(cjStatisticsResult); |
188 | 189 | } |
189 | 190 | } |
190 | - return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data); | |
191 | + return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery1.getPageInfo()); | |
191 | 192 | } |
192 | 193 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
View file @
2929987
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.*; | |
4 | +import com.lyms.platform.common.base.LoginContext; | |
5 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
6 | +import com.lyms.platform.common.enums.FyTypeEnums; | |
7 | +import com.lyms.platform.common.enums.SexEnum; | |
8 | +import com.lyms.platform.common.enums.WyTypeEnums; | |
9 | +import com.lyms.platform.common.enums.YnEnums; | |
10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
11 | +import com.lyms.platform.common.result.BaseResponse; | |
12 | +import com.lyms.platform.common.utils.DateUtil; | |
13 | +import com.lyms.platform.common.utils.JsonUtil; | |
14 | +import com.lyms.platform.common.utils.StringUtils; | |
15 | +import com.lyms.platform.common.utils.SystemConfig; | |
16 | +import com.lyms.platform.operate.web.request.BabyCheckRequest; | |
17 | +import com.lyms.platform.operate.web.request.RiskPatientsQueryRequest; | |
18 | +import com.lyms.platform.operate.web.result.*; | |
19 | +import com.lyms.platform.permission.model.Organization; | |
20 | +import com.lyms.platform.permission.model.Users; | |
21 | +import com.lyms.platform.permission.service.OrganizationService; | |
22 | +import com.lyms.platform.permission.service.UsersService; | |
23 | +import com.lyms.platform.pojo.*; | |
24 | +import com.lyms.platform.query.*; | |
25 | +import org.apache.commons.collections.CollectionUtils; | |
26 | +import org.springframework.beans.factory.annotation.Autowired; | |
27 | +import org.springframework.data.domain.Sort; | |
28 | +import org.springframework.stereotype.Component; | |
29 | + | |
30 | +import java.text.DecimalFormat; | |
31 | +import java.util.*; | |
32 | + | |
33 | +@Component | |
34 | +public class RiskReportFacade { | |
35 | + | |
36 | + | |
37 | + | |
38 | + @Autowired | |
39 | + private PatientsService patientsService; | |
40 | + | |
41 | + | |
42 | + @Autowired | |
43 | + private BasicConfigService basicConfigService; | |
44 | + | |
45 | + | |
46 | + @Autowired | |
47 | + private AutoMatchFacade autoMatchFacade; | |
48 | + | |
49 | + /** | |
50 | + * 查询高危统计,该统计的高危是已经有孕妇有此高危 | |
51 | + * @return | |
52 | + */ | |
53 | + public BaseObjectResponse queryRiskReportCount(RiskPatientsQueryRequest riskPatientsQueryRequest,Integer userId) { | |
54 | + | |
55 | + String hospitalId = "242"; | |
56 | +// hospitalId = autoMatchFacade.getHospitalId(userId); | |
57 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
58 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
59 | + | |
60 | + List buildType = new ArrayList(); | |
61 | + buildType.add(0); | |
62 | + buildType.add(2); | |
63 | + patientsQuery.setBuildTypeList(buildType); | |
64 | + patientsQuery.setHospitalId(hospitalId); | |
65 | + | |
66 | + //1孕妇 | |
67 | +// patientsQuery.setType(1); | |
68 | + // 0未终止妊娠 1终止妊娠 | |
69 | + patientsQuery.setDueStatus(0); | |
70 | + | |
71 | + //预产期 | |
72 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(riskPatientsQueryRequest.getDueDate())) { | |
73 | + String nextDateStr = riskPatientsQueryRequest.getDueDate(); | |
74 | + String[] dates = nextDateStr.split(" - "); | |
75 | + patientsQuery.setDueDateStart(DateUtil.parseYMD(dates[0])); | |
76 | + if (dates.length == 2) { | |
77 | + patientsQuery.setDueDateEnd(DateUtil.parseYMD(dates[1])); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + //建档时间 | |
82 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(riskPatientsQueryRequest.getBuildTime())) { | |
83 | + | |
84 | + String nextDateStr = riskPatientsQueryRequest.getBuildTime(); | |
85 | + String[] dates = nextDateStr.split(" - "); | |
86 | + | |
87 | + patientsQuery.setBookbuildingDateStart(DateUtil.parseYMD(dates[0])); | |
88 | + if (dates.length == 2) { | |
89 | + patientsQuery.setBookbuildingDateEnd(DateUtil.parseYMD(dates[1])); | |
90 | + } | |
91 | + } | |
92 | + | |
93 | + //高危等级 | |
94 | + patientsQuery.setrLevel(riskPatientsQueryRequest.getrLevel()); | |
95 | + //产检医生 | |
96 | + patientsQuery.setLastCheckEmployeeId(riskPatientsQueryRequest.getLastCheckDoctorId()); | |
97 | + | |
98 | + //总的孕妇条数 | |
99 | + int allPatientCount = patientsService.queryPatientCount(patientsQuery); | |
100 | + | |
101 | + List<RiskReportResult> results = new ArrayList<>(); | |
102 | + | |
103 | + BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
104 | + basicConfigQuery.setYn(YnEnums.YES.getId()); | |
105 | + basicConfigQuery.setParentId(SystemConfig.HIGH_RISK_ID); | |
106 | + basicConfigQuery.setEnable(1); | |
107 | + | |
108 | + List<BasicConfig> riskLevelConfig = basicConfigService.queryBasicConfig(basicConfigQuery); | |
109 | + if (CollectionUtils.isNotEmpty(riskLevelConfig)) | |
110 | + { | |
111 | + for(BasicConfig levelConfig : riskLevelConfig) | |
112 | + { | |
113 | + basicConfigQuery.setParentId(levelConfig.getId()); | |
114 | + List<BasicConfig> riskConfig = basicConfigService.queryBasicConfig(basicConfigQuery); | |
115 | + | |
116 | + if (CollectionUtils.isNotEmpty(riskConfig)) { | |
117 | + for (BasicConfig config : riskConfig) { | |
118 | + patientsQuery.setrFactor(config.getId()); | |
119 | + //单个高危孕妇条数 | |
120 | + int riskPatientCount = patientsService.queryPatientCount(patientsQuery); | |
121 | + if (riskPatientCount > 0) | |
122 | + { | |
123 | + RiskReportResult risk = new RiskReportResult(); | |
124 | + risk.setHighRiskId(config.getId()); | |
125 | + risk.setHighRisk(config.getName()); | |
126 | + risk.setRiskCount(String.valueOf(riskPatientCount)); | |
127 | + | |
128 | + DecimalFormat df = new DecimalFormat("0.00"); | |
129 | + String percent = df.format((double)riskPatientCount/allPatientCount*100)+"%"; | |
130 | + risk.setPercent(percent); | |
131 | + risk.setHighLevel(levelConfig.getName()); | |
132 | + results.add(risk); | |
133 | + } | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | + } | |
138 | + return new BaseObjectResponse() | |
139 | + .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(results); | |
140 | + } | |
141 | +// | |
142 | +// public BaseResponse queryRiskPatientReport(Integer userId,) { | |
143 | +// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
144 | +// patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, loginState.getId(), "true",Boolean.FALSE); | |
145 | +// | |
146 | +// return null; | |
147 | +// } | |
148 | + | |
149 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsListResult.java
View file @
2929987
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | import org.codehaus.jackson.annotate.JsonIgnore; |
8 | 8 | |
9 | 9 | import java.util.Date; |
10 | +import java.util.List; | |
10 | 11 | |
11 | 12 | /** |
12 | 13 | * Created by Administrator on 2016/11/29 0029. |
... | ... | @@ -25,7 +26,7 @@ |
25 | 26 | |
26 | 27 | private Integer score; |
27 | 28 | //等级 |
28 | - private String rLevel; | |
29 | + private List rLevel; | |
29 | 30 | //因素 |
30 | 31 | private String rRisk; |
31 | 32 | //产检医生 |
32 | 33 | |
... | ... | @@ -95,11 +96,11 @@ |
95 | 96 | this.score = score; |
96 | 97 | } |
97 | 98 | |
98 | - public String getrLevel() { | |
99 | + public List getrLevel() { | |
99 | 100 | return rLevel; |
100 | 101 | } |
101 | 102 | |
102 | - public void setrLevel(String rLevel) { | |
103 | + public void setrLevel(List rLevel) { | |
103 | 104 | this.rLevel = rLevel; |
104 | 105 | } |
105 | 106 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskReportPatientResult.java
View file @
2929987
1 | +package com.lyms.platform.operate.web.result; | |
2 | + | |
3 | + | |
4 | +import java.util.List; | |
5 | +import java.util.Map; | |
6 | + | |
7 | +/** | |
8 | + * Created by lqy on 2016/11/28. | |
9 | + */ | |
10 | +public class RiskReportPatientResult { | |
11 | + | |
12 | + //孕妇 | |
13 | + private String id; | |
14 | + //孕妇名字 | |
15 | + private String name; | |
16 | + | |
17 | + //孕周 | |
18 | + private String dueWeek; | |
19 | + //风险等级 | |
20 | + private List<Map> rLevel; | |
21 | + | |
22 | + //高危评分 | |
23 | + private Integer hScore; | |
24 | + | |
25 | + //预产期 | |
26 | + private String dueDate; | |
27 | + //产检医生 | |
28 | + private String checkDoctor; | |
29 | + | |
30 | + private String pid; | |
31 | + | |
32 | + public String getId() { | |
33 | + return id; | |
34 | + } | |
35 | + | |
36 | + public void setId(String id) { | |
37 | + this.id = id; | |
38 | + } | |
39 | + | |
40 | + public String getName() { | |
41 | + return name; | |
42 | + } | |
43 | + | |
44 | + public void setName(String name) { | |
45 | + this.name = name; | |
46 | + } | |
47 | + | |
48 | + public String getDueWeek() { | |
49 | + return dueWeek; | |
50 | + } | |
51 | + | |
52 | + public void setDueWeek(String dueWeek) { | |
53 | + this.dueWeek = dueWeek; | |
54 | + } | |
55 | + | |
56 | + public List<Map> getrLevel() { | |
57 | + return rLevel; | |
58 | + } | |
59 | + | |
60 | + public void setrLevel(List<Map> rLevel) { | |
61 | + this.rLevel = rLevel; | |
62 | + } | |
63 | + | |
64 | + public Integer gethScore() { | |
65 | + return hScore; | |
66 | + } | |
67 | + | |
68 | + public void sethScore(Integer hScore) { | |
69 | + this.hScore = hScore; | |
70 | + } | |
71 | + | |
72 | + public String getDueDate() { | |
73 | + return dueDate; | |
74 | + } | |
75 | + | |
76 | + public void setDueDate(String dueDate) { | |
77 | + this.dueDate = dueDate; | |
78 | + } | |
79 | + | |
80 | + public String getCheckDoctor() { | |
81 | + return checkDoctor; | |
82 | + } | |
83 | + | |
84 | + public void setCheckDoctor(String checkDoctor) { | |
85 | + this.checkDoctor = checkDoctor; | |
86 | + } | |
87 | + | |
88 | + public String getPid() { | |
89 | + return pid; | |
90 | + } | |
91 | + | |
92 | + public void setPid(String pid) { | |
93 | + this.pid = pid; | |
94 | + } | |
95 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskReportResult.java
View file @
2929987
1 | +package com.lyms.platform.operate.web.result; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * 高危报表结果 | |
6 | + * Created by lqy on 2016/11/28 | |
7 | + */ | |
8 | +public class RiskReportResult { | |
9 | + | |
10 | + //高危因素Id | |
11 | + private String highRiskId; | |
12 | + | |
13 | + //风险等级 | |
14 | + private String highLevel; | |
15 | + | |
16 | + //高危因素 | |
17 | + private String highRisk; | |
18 | + | |
19 | + //人数 | |
20 | + private String riskCount; | |
21 | + | |
22 | + //发病率 | |
23 | + private String percent; | |
24 | + | |
25 | + public String getHighRiskId() { | |
26 | + return highRiskId; | |
27 | + } | |
28 | + | |
29 | + public void setHighRiskId(String highRiskId) { | |
30 | + this.highRiskId = highRiskId; | |
31 | + } | |
32 | + | |
33 | + public String getHighLevel() { | |
34 | + return highLevel; | |
35 | + } | |
36 | + | |
37 | + public void setHighLevel(String highLevel) { | |
38 | + this.highLevel = highLevel; | |
39 | + } | |
40 | + | |
41 | + public String getHighRisk() { | |
42 | + return highRisk; | |
43 | + } | |
44 | + | |
45 | + public void setHighRisk(String highRisk) { | |
46 | + this.highRisk = highRisk; | |
47 | + } | |
48 | + | |
49 | + public String getRiskCount() { | |
50 | + return riskCount; | |
51 | + } | |
52 | + | |
53 | + public void setRiskCount(String riskCount) { | |
54 | + this.riskCount = riskCount; | |
55 | + } | |
56 | + | |
57 | + public String getPercent() { | |
58 | + return percent; | |
59 | + } | |
60 | + | |
61 | + public void setPercent(String percent) { | |
62 | + this.percent = percent; | |
63 | + } | |
64 | +} |