Commit 11a6a537a36ea2d73b6dc7585208f6158dc205d8
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 3 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
View file @
11a6a53
... | ... | @@ -171,7 +171,7 @@ |
171 | 171 | @RequestMapping(method = RequestMethod.GET, value = "/getCourseCount") |
172 | 172 | @ResponseBody |
173 | 173 | @TokenRequired |
174 | - public BaseResponse getCourseCount(HttpServletRequest request, @RequestParam(required = true) String time) { | |
174 | + public BaseResponse getCourseCount(HttpServletRequest request, @RequestParam(required = false) String time) { | |
175 | 175 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
176 | 176 | return courseFacade.getCourseCount(time,loginState.getId()); |
177 | 177 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
11a6a53
... | ... | @@ -368,14 +368,23 @@ |
368 | 368 | public BaseResponse getCourseCount(String time, Integer userId) { |
369 | 369 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
370 | 370 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
371 | + | |
371 | 372 | Map resultData = new HashMap(); |
372 | 373 | |
373 | 374 | Map totalData = new HashMap(); |
375 | + List<Map> tableData = new ArrayList<>(); | |
376 | + Map chartData = new HashMap(); | |
374 | 377 | |
378 | + | |
375 | 379 | CourseQuery query = new CourseQuery(); |
376 | 380 | query.setYn(YnEnums.YES.getId()); |
377 | 381 | query.setHospitalId(hospitalId); |
378 | 382 | |
383 | + //课程总数 | |
384 | + int allCourses = courseService.queryCourseCount(query); | |
385 | + | |
386 | + | |
387 | + //总推送数 | |
379 | 388 | int allSends = getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, |
380 | 389 | 1,null, null, null); |
381 | 390 | |
382 | 391 | |
383 | 392 | |
384 | 393 | |
... | ... | @@ -383,28 +392,26 @@ |
383 | 392 | patientCourseQuery.setYn(YnEnums.YES.getId()); |
384 | 393 | patientCourseQuery.setHospitalId(hospitalId); |
385 | 394 | |
386 | - int allCourses = courseService.queryCourseCount(query); | |
387 | 395 | |
388 | 396 | int allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); |
389 | 397 | |
390 | 398 | //状态 1预约,2签到 |
391 | 399 | patientCourseQuery.setStatus(1); |
392 | - | |
400 | + //总预约数 | |
393 | 401 | int allOrders = patientCourseService.queryPatientCourseCount(patientCourseQuery); |
394 | 402 | |
395 | 403 | patientCourseQuery.setStatus(2); |
396 | - | |
397 | - | |
404 | + //总签到数 | |
398 | 405 | int allSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); |
399 | 406 | |
400 | 407 | DecimalFormat df = new DecimalFormat("0.00"); |
401 | 408 | |
402 | - resultData.put("allCourses",allCourses); //课程数 | |
403 | - resultData.put("allSends",allSends); //总推送数 | |
404 | - resultData.put("allOrders",allOrders); //总预约数 | |
405 | - resultData.put("allOrderRate", allCourses == 0 ? 0 : df.format((double) allOrders / allPatientCourses * 100) + "%"); //总预约率 | |
406 | - resultData.put("allSigns", allSigns);//总签到数 | |
407 | - resultData.put("allSignRate", allCourses == 0 ? 0 : df.format((double) allSigns / allPatientCourses * 100) + "%");//总签到率 | |
409 | + totalData.put("allCourses",allCourses); //课程数 | |
410 | + totalData.put("allSends",allSends); //总推送数 | |
411 | + totalData.put("allOrders",allOrders); //总预约数 | |
412 | + totalData.put("allOrderRate", allCourses == 0 ? 0 : df.format((double) allOrders / allPatientCourses * 100) + "%"); //总预约率 | |
413 | + totalData.put("allSigns", allSigns);//总签到数 | |
414 | + totalData.put("allSignRate", allCourses == 0 ? 0 : df.format((double) allSigns / allPatientCourses * 100) + "%");//总签到率 | |
408 | 415 | |
409 | 416 | CourseTypeQuery courseTypeQuery = new CourseTypeQuery(); |
410 | 417 | courseTypeQuery.setHospitalId(hospitalId); |
411 | 418 | |
412 | 419 | |
413 | 420 | |
... | ... | @@ -421,13 +428,13 @@ |
421 | 428 | end = dates[1]; |
422 | 429 | patientCourseQuery.setCreatedEnd(DateUtil.parseYMDHMS(end + " 23:59:59")); |
423 | 430 | } |
431 | + | |
432 | + allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
424 | 433 | } |
425 | 434 | |
426 | - allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
427 | 435 | |
428 | - List<Map> tableData = new ArrayList<>(); | |
429 | 436 | |
430 | - Map chartData = new HashMap(); | |
437 | + | |
431 | 438 | List<CourseModel> courseModelList = courseService.queryCourseList(query); |
432 | 439 | if (CollectionUtils.isNotEmpty(courseModelList)) |
433 | 440 | { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/CourseCountWorker.java
View file @
11a6a53
1 | +package com.lyms.platform.operate.web.worker; | |
2 | + | |
3 | +import com.lyms.platform.common.enums.SmsServiceEnums; | |
4 | +import com.lyms.platform.common.enums.YnEnums; | |
5 | +import com.lyms.platform.pojo.CourseModel; | |
6 | +import com.lyms.platform.pojo.CourseTypeModel; | |
7 | +import com.lyms.platform.query.CourseTypeQuery; | |
8 | +import com.lyms.platform.query.PatientCourseQuery; | |
9 | +import org.apache.commons.collections.CollectionUtils; | |
10 | + | |
11 | +import java.util.ArrayList; | |
12 | +import java.util.HashMap; | |
13 | +import java.util.List; | |
14 | +import java.util.Map; | |
15 | +import java.util.concurrent.Callable; | |
16 | + | |
17 | +/** | |
18 | + * Created by Administrator on 2018-04-20. | |
19 | + */ | |
20 | +public class CourseCountWorker implements Callable { | |
21 | + | |
22 | + public CourseCountWorker() | |
23 | + { | |
24 | + | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + public Map call() throws Exception { | |
29 | + Map chartData = new HashMap(); | |
30 | +// if (CollectionUtils.isNotEmpty(courseModelList)) | |
31 | +// { | |
32 | +// | |
33 | +// CourseTypeQuery courseTypeQuery = new CourseTypeQuery(); | |
34 | +// courseTypeQuery.setHospitalId(hospitalId); | |
35 | +// courseTypeQuery.setYn(YnEnums.YES.getId()); | |
36 | +// | |
37 | +// | |
38 | +// PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | |
39 | +// patientCourseQuery.setYn(YnEnums.YES.getId()); | |
40 | +// patientCourseQuery.setHospitalId(hospitalId); | |
41 | +// | |
42 | +// List titles = new ArrayList(); | |
43 | +// List sends = new ArrayList(); | |
44 | +// List orders = new ArrayList(); | |
45 | +// List signs = new ArrayList(); | |
46 | +// for (CourseModel courseModel : courseModelList) | |
47 | +// { | |
48 | +// patientCourseQuery.setCourseId(courseModel.getId()); | |
49 | +// titles.add(courseModel.getCourseName()); | |
50 | +// | |
51 | +// patientCourseQuery.setStatus(1); | |
52 | +// int courseOrders = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
53 | +// orders.add(courseOrders); | |
54 | +// | |
55 | +// patientCourseQuery.setStatus(2); | |
56 | +// int courseSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
57 | +// signs.add(courseSigns); | |
58 | +// | |
59 | +// int courseSends = getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
60 | +// 1,courseModel.getId(), start, end); | |
61 | +// sends.add(courseSends); | |
62 | +// | |
63 | +// courseTypeQuery.setId(courseModel.getCourseTypeId()); | |
64 | +// List<CourseTypeModel> typeModels = courseTypeService.queryCourseTypeList(courseTypeQuery); | |
65 | +// | |
66 | +// Map tableMap = new HashMap(); | |
67 | +// | |
68 | +// tableMap.put("courseTypeId",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getId() : ""); | |
69 | +// tableMap.put("courseTypeName",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getCourseTypeName() : ""); | |
70 | +// tableMap.put("courseName",courseModel.getCourseName()); | |
71 | +// | |
72 | +// tableMap.put("sends",courseSends); | |
73 | +// tableMap.put("orders",courseOrders); | |
74 | +// tableMap.put("ordersRate",allPatientCourses == 0 ? "0" : df.format((double) courseOrders / allPatientCourses * 100) + "%"); | |
75 | +// tableMap.put("signs",courseSigns); | |
76 | +// tableMap.put("signsRate",allPatientCourses == 0 ? "0" : df.format((double) courseSigns / allPatientCourses * 100) + "%"); | |
77 | +// tableData.add(tableMap); | |
78 | +// } | |
79 | +// | |
80 | +// chartData.put("titles",titles); | |
81 | +// chartData.put("sends",sends); | |
82 | +// chartData.put("orders",orders); | |
83 | +// chartData.put("signs",signs); | |
84 | +// } | |
85 | + | |
86 | + return chartData; | |
87 | + } | |
88 | +} |