Commit 51cac3b76d48f5a813cf91f4a9259335b1ffbd14
1 parent
978670a523
Exists in
master
and in
6 other branches
产检医生统计
Showing 3 changed files with 164 additions and 12 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
51cac3b
... | ... | @@ -39,15 +39,35 @@ |
39 | 39 | return reportService.areaCountFacade(startDate, endDate, startWeek, endWeek, childBirth); |
40 | 40 | } |
41 | 41 | |
42 | - @RequestMapping(method = RequestMethod.GET,value = "/date") | |
42 | + /** | |
43 | + * 孕产妇明细查看 | |
44 | + * @param startDate 建档开始时间 | |
45 | + * @param endDate 建档结束时间 | |
46 | + * @param startWeek 孕周开始时间 | |
47 | + * @param endWeek 孕周结束时间 | |
48 | + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
49 | + * @param number 检查次数 | |
50 | + * @param name 医生名称 | |
51 | + * @return | |
52 | + */ | |
53 | + @RequestMapping(method = RequestMethod.GET,value = "/checkInfo") | |
43 | 54 | @ResponseBody |
44 | - public BaseObjectResponse testDate(Date startDate) { | |
45 | - if(startDate != null) { | |
46 | - System.out.println("startDate = [" + startDate.toLocaleString() + "]"); | |
47 | - } | |
48 | - BaseObjectResponse obj = new BaseObjectResponse(); | |
49 | - obj.setData(startDate); | |
50 | - return obj; | |
55 | + public BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, String name) { | |
56 | + return reportService.checkInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name); | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * 产检医生统计 | |
61 | + * @param startDate 建档开始时间 | |
62 | + * @param endDate 建档结束时间 | |
63 | + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
64 | + * @return | |
65 | + */ | |
66 | + @RequestMapping(method = RequestMethod.GET,value = "/doctor") | |
67 | + @ResponseBody | |
68 | + public BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth) { | |
69 | + return reportService.doctorMedical | |
70 | + (startDate, endDate, childBirth); | |
51 | 71 | } |
52 | 72 | |
53 | 73 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
View file @
51cac3b
... | ... | @@ -20,5 +20,27 @@ |
20 | 20 | * @return |
21 | 21 | */ |
22 | 22 | BaseObjectResponse areaCountFacade(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth); |
23 | + | |
24 | + /** | |
25 | + * 产检医生统计 | |
26 | + * @param startDate | |
27 | + * @param endDate | |
28 | + * @param childBirth | |
29 | + * @return | |
30 | + */ | |
31 | + BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth); | |
32 | + | |
33 | + /** | |
34 | + * 孕产妇明细查看 | |
35 | + * @param childBirth | |
36 | + * @param startDate | |
37 | + * @param endDate | |
38 | + * @param startWeek | |
39 | + * @param endWeek | |
40 | + * @param number | |
41 | + * @param name | |
42 | + * @return | |
43 | + */ | |
44 | + BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, String name); | |
23 | 45 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
51cac3b
... | ... | @@ -7,7 +7,6 @@ |
7 | 7 | import org.apache.commons.lang.StringUtils; |
8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 9 | import org.springframework.stereotype.Service; |
10 | -import scala.collection.mutable.StringBuilder; | |
11 | 10 | |
12 | 11 | import java.util.*; |
13 | 12 | |
14 | 13 | |
... | ... | @@ -38,11 +37,58 @@ |
38 | 37 | return rest; |
39 | 38 | } |
40 | 39 | |
40 | + @Override | |
41 | + public BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth) { | |
42 | + BaseObjectResponse rest = new BaseObjectResponse(); | |
43 | + Map<String, Object> restMap = new HashMap<>(); | |
44 | + List<Object> params = new ArrayList<>(); | |
45 | + List<Map<String, Object>> restList = reportDao.findList(getDoctorMedicalSql(startDate, endDate, childBirth, params), params); | |
46 | + return null; | |
47 | + } | |
48 | + | |
49 | + @Override | |
50 | + public BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, String name) { | |
51 | + return null; | |
52 | + } | |
53 | + | |
54 | + | |
41 | 55 | private Map<String, Object> createGrid(List<Object> peopleList, List<Object> proportionList) { |
42 | 56 | Map<String, Object> map = new HashMap<>(); |
43 | - map.put("peoples", peopleList); | |
44 | - map.put("proportion", proportionList); | |
45 | - map.put("header", Arrays.asList("产检次数", "总计", "1次", "2次", "3次", "4次", "5次", "6次", "7次", "8次", "9次", "10次", "11次", "12次", "≥13次")); | |
57 | + Map<String, Object> peoples = new HashMap<>(); | |
58 | + peoples.put("desc", peopleList.get(0)); /** 产检人数 */ | |
59 | + peoples.put("count", peopleList.get(1));/** 总计 */ | |
60 | + peoples.put("once", peopleList.get(2)); | |
61 | + peoples.put("twice", peopleList.get(3)); | |
62 | + peoples.put("threeTimes", peopleList.get(4)); | |
63 | + peoples.put("fourTimes", peopleList.get(5)); | |
64 | + peoples.put("fiveTimes", peopleList.get(6)); | |
65 | + peoples.put("sixTimes", peopleList.get(7)); | |
66 | + peoples.put("sevenTimes", peopleList.get(8)); | |
67 | + peoples.put("eightTimes", peopleList.get(9)); | |
68 | + peoples.put("nineTimes", peopleList.get(10)); | |
69 | + peoples.put("tenTimes", peopleList.get(11)); | |
70 | + peoples.put("elevenTimes", peopleList.get(12)); | |
71 | + peoples.put("twelveTimes", peopleList.get(13)); | |
72 | +// map.put("peoples", peopleList); | |
73 | + map.put("peoples", peoples); | |
74 | + | |
75 | + Map<String, Object> proportion = new HashMap<>(); | |
76 | + proportion.put("desc", proportionList.get(0)); /** 占比 */ | |
77 | + proportion.put("count", proportionList.get(1));/** 总计 */ | |
78 | + proportion.put("once", proportionList.get(2)); | |
79 | + proportion.put("twice", proportionList.get(3)); | |
80 | + proportion.put("threeTimes", proportionList.get(4)); | |
81 | + proportion.put("fourTimes", proportionList.get(5)); | |
82 | + proportion.put("fiveTimes", proportionList.get(6)); | |
83 | + proportion.put("sixTimes", proportionList.get(7)); | |
84 | + proportion.put("sevenTimes", proportionList.get(8)); | |
85 | + proportion.put("eightTimes", proportionList.get(9)); | |
86 | + proportion.put("nineTimes", proportionList.get(10)); | |
87 | + proportion.put("tenTimes", proportionList.get(11)); | |
88 | + proportion.put("elevenTimes", proportionList.get(12)); | |
89 | + proportion.put("twelveTimes", proportionList.get(13)); | |
90 | +// map.put("proportion", proportionList); | |
91 | + map.put("proportion", proportion); | |
46 | 92 | return map; |
47 | 93 | } |
48 | 94 | |
... | ... | @@ -125,6 +171,70 @@ |
125 | 171 | sql.append("GROUP BY B.EXAMINE_HISTORY_NUM ") |
126 | 172 | .append("ORDER BY EXAMINE_HISTORY_NUM"); |
127 | 173 | |
174 | + return sql.toString(); | |
175 | + } | |
176 | + | |
177 | + private String getDoctorMedicalSql(String startDate, String endDate, Integer childBirth, List<Object> params) { | |
178 | + StringBuilder sql = new StringBuilder(); | |
179 | + sql.append("SELECT B.DOCTOR_NAME, ") | |
180 | + .append("COUNT(B.EXAMINE_ID) AS CJ_RC, ") | |
181 | + .append("COUNT(DISTINCT A.RECORD_ID) AS CJ_RS, ") | |
182 | + .append("COUNT(DISTINCT D.RECORD_ID) AS LIANGCI_RS, ") | |
183 | + .append("COUNT(DISTINCT E.RECORD_ID) AS WUCI_RS ") | |
184 | + .append("FROM ODS_F_GRAVIDA_RECORD A ") | |
185 | + .append("INNER JOIN ODS_F_EXAMINE_HISTORY_ASC B ON A.RECORD_ID=B.RECORD_ID AND A.HOSPITAL_NO=B.HOSPITAL_NO ") | |
186 | + .append("INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO ") | |
187 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC D ON B.EXAMINE_ID=D.EXAMINE_ID AND D.EXAMINE_HISTORY_NUM>1 ") | |
188 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC E ON B.EXAMINE_ID=E.EXAMINE_ID AND E.EXAMINE_HISTORY_NUM>4 ") | |
189 | + .append("WHERE C.YCY_STSTEM_ID='216' "); | |
190 | + | |
191 | + if(childBirth != null) { | |
192 | + sql.append("AND A.IS_CHILDBIRTH = ? "); | |
193 | + params.add(childBirth); | |
194 | + } | |
195 | + | |
196 | + if(startDate != null && endDate != null) { | |
197 | + sql.append("AND A.CREATE_DATE BETWEEN to_date(?,'yyyy-mm-dd') AND to_date(?,'yyyy-mm-dd') "); | |
198 | + params.add(startDate); | |
199 | + params.add(endDate); | |
200 | + } | |
201 | + | |
202 | + /* if(startWeek != null && endWeek != null) { | |
203 | + sql.append("AND A.NOW_WEEKS BETWEEN ? AND ? "); | |
204 | + params.add(startWeek); | |
205 | + params.add(endWeek); | |
206 | + }*/ | |
207 | + | |
208 | + | |
209 | + sql.append("GROUP BY B.DOCTOR_NAME,B.DOCTOR_NO ") | |
210 | + .append("UNION ALL ") | |
211 | + .append("SELECT '总计', ") | |
212 | + .append("COUNT(B.EXAMINE_ID) AS CJ_RC, ") | |
213 | + .append("COUNT(DISTINCT A.RECORD_ID) AS CJ_RS, ") | |
214 | + .append("COUNT(DISTINCT D.RECORD_ID) AS LIANGCI_RS, ") | |
215 | + .append("COUNT(DISTINCT E.RECORD_ID) AS WUCI_RS ") | |
216 | + .append("FROM ODS_F_GRAVIDA_RECORD A ") | |
217 | + .append("INNER JOIN ODS_F_EXAMINE_HISTORY_ASC B ON A.RECORD_ID=B.RECORD_ID AND A.HOSPITAL_NO=B.HOSPITAL_NO ") | |
218 | + .append("INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO ") | |
219 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC D ON B.EXAMINE_ID=D.EXAMINE_ID AND D.EXAMINE_HISTORY_NUM>1 ") | |
220 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC E ON B.EXAMINE_ID=E.EXAMINE_ID AND E.EXAMINE_HISTORY_NUM>4 "); | |
221 | + | |
222 | + if(childBirth != null) { | |
223 | + sql.append("AND A.IS_CHILDBIRTH = ? "); | |
224 | + params.add(childBirth); | |
225 | + } | |
226 | + | |
227 | + if(startDate != null && endDate != null) { | |
228 | + sql.append("AND A.CREATE_DATE BETWEEN to_date(?,'yyyy-mm-dd') AND to_date(?,'yyyy-mm-dd') "); | |
229 | + params.add(startDate); | |
230 | + params.add(endDate); | |
231 | + } | |
232 | + | |
233 | + /*if(startWeek != null && endWeek != null) { | |
234 | + sql.append("AND A.NOW_WEEKS BETWEEN ? AND ? "); | |
235 | + params.add(startWeek); | |
236 | + params.add(endWeek); | |
237 | + }*/ | |
128 | 238 | return sql.toString(); |
129 | 239 | } |
130 | 240 |