Commit 91c71e2e67e514ec01c60c46b979e916ca1b3192
1 parent
11a6a537a3
Exists in
master
and in
6 other branches
孕妇学校
Showing 4 changed files with 241 additions and 158 deletions
- platform-dal/src/main/java/com/lyms/platform/query/PatientCourseQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MessageCenterService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/CourseCountWorker.java
platform-dal/src/main/java/com/lyms/platform/query/PatientCourseQuery.java
View file @
91c71e2
| ... | ... | @@ -53,6 +53,8 @@ |
| 53 | 53 | //课程id |
| 54 | 54 | private String courseId; |
| 55 | 55 | |
| 56 | + private List<String> courseIds; | |
| 57 | + | |
| 56 | 58 | //操作签到人id |
| 57 | 59 | private String operUserId; |
| 58 | 60 | |
| ... | ... | @@ -115,6 +117,9 @@ |
| 115 | 117 | condition = condition.and("courseId", courseId, MongoOper.IS); |
| 116 | 118 | } |
| 117 | 119 | |
| 120 | + if (null != courseIds) { | |
| 121 | + condition = condition.and("courseId", courseIds, MongoOper.IN); | |
| 122 | + } | |
| 118 | 123 | |
| 119 | 124 | if (null != hospitalId) { |
| 120 | 125 | condition = condition.and("hospitalId", hospitalId, MongoOper.IS); |
| ... | ... | @@ -161,6 +166,14 @@ |
| 161 | 166 | } |
| 162 | 167 | |
| 163 | 168 | return condition.toMongoQuery(); |
| 169 | + } | |
| 170 | + | |
| 171 | + public List<String> getCourseIds() { | |
| 172 | + return courseIds; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setCourseIds(List<String> courseIds) { | |
| 176 | + this.courseIds = courseIds; | |
| 164 | 177 | } |
| 165 | 178 | |
| 166 | 179 | public Date getCreatedStart() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
91c71e2
| ... | ... | @@ -12,15 +12,17 @@ |
| 12 | 12 | import com.lyms.platform.common.result.BaseListResponse; |
| 13 | 13 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 14 | 14 | import com.lyms.platform.common.result.BaseResponse; |
| 15 | -import com.lyms.platform.common.utils.DateUtil; | |
| 16 | -import com.lyms.platform.common.utils.HttpClientUtil; | |
| 17 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 18 | -import com.lyms.platform.common.utils.PropertiesUtils; | |
| 15 | +import com.lyms.platform.common.utils.*; | |
| 19 | 16 | import com.lyms.platform.operate.web.request.CourseRequest; |
| 17 | +import com.lyms.platform.operate.web.result.BabyManageListResult; | |
| 20 | 18 | import com.lyms.platform.operate.web.result.CourseResult; |
| 21 | 19 | import com.lyms.platform.operate.web.result.CourseTypeResult; |
| 20 | +import com.lyms.platform.operate.web.utils.BabyListTask; | |
| 21 | +import com.lyms.platform.operate.web.utils.MessageCenterService; | |
| 22 | +import com.lyms.platform.operate.web.worker.CourseCountWorker; | |
| 22 | 23 | import com.lyms.platform.permission.model.Users; |
| 23 | 24 | import com.lyms.platform.permission.service.UsersService; |
| 25 | +import com.lyms.platform.pojo.BabyModel; | |
| 24 | 26 | import com.lyms.platform.pojo.CourseModel; |
| 25 | 27 | import com.lyms.platform.pojo.CourseTypeModel; |
| 26 | 28 | import com.lyms.platform.pojo.PatientCourseModel; |
| 27 | 29 | |
| ... | ... | @@ -30,10 +32,14 @@ |
| 30 | 32 | import org.apache.commons.collections.CollectionUtils; |
| 31 | 33 | import org.apache.commons.lang.StringUtils; |
| 32 | 34 | import org.springframework.beans.factory.annotation.Autowired; |
| 35 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 36 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 33 | 37 | import org.springframework.stereotype.Component; |
| 34 | 38 | |
| 35 | 39 | import java.text.DecimalFormat; |
| 36 | 40 | import java.util.*; |
| 41 | +import java.util.concurrent.Callable; | |
| 42 | +import java.util.concurrent.Future; | |
| 37 | 43 | |
| 38 | 44 | |
| 39 | 45 | /** |
| ... | ... | @@ -61,6 +67,10 @@ |
| 61 | 67 | @Autowired |
| 62 | 68 | private OperateLogFacade operateLogFacade; |
| 63 | 69 | |
| 70 | + @Autowired | |
| 71 | + @Qualifier("commonThreadPool") | |
| 72 | + private ThreadPoolTaskExecutor commonThreadPool; | |
| 73 | + | |
| 64 | 74 | public BaseResponse addCourese(CourseRequest request, Integer userId) { |
| 65 | 75 | |
| 66 | 76 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| ... | ... | @@ -385,8 +395,8 @@ |
| 385 | 395 | |
| 386 | 396 | |
| 387 | 397 | //总推送数 |
| 388 | - int allSends = getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
| 389 | - 1,null, null, null); | |
| 398 | + int allSends = MessageCenterService.getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
| 399 | + 1, null, null, null); | |
| 390 | 400 | |
| 391 | 401 | PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); |
| 392 | 402 | patientCourseQuery.setYn(YnEnums.YES.getId()); |
| 393 | 403 | |
| 394 | 404 | |
| 395 | 405 | |
| 396 | 406 | |
| 397 | 407 | |
| 398 | 408 | |
| 399 | 409 | |
| 400 | 410 | |
| 401 | 411 | |
| 402 | 412 | |
| 403 | 413 | |
| 404 | 414 | |
| 405 | 415 | |
| 406 | 416 | |
| ... | ... | @@ -417,69 +427,109 @@ |
| 417 | 427 | courseTypeQuery.setHospitalId(hospitalId); |
| 418 | 428 | courseTypeQuery.setYn(YnEnums.YES.getId()); |
| 419 | 429 | |
| 420 | - String start = null; | |
| 421 | - String end = null; | |
| 430 | + String startTime = null; | |
| 431 | + String endTime = null; | |
| 422 | 432 | |
| 423 | 433 | if (StringUtils.isNotEmpty(time)) { |
| 424 | 434 | String[] dates = time.split(" - "); |
| 425 | - start = dates[0]; | |
| 426 | - patientCourseQuery.setCreatedStart(DateUtil.parseYMD(start)); | |
| 435 | + startTime = dates[0]; | |
| 436 | + query.setPublishTimeStart(DateUtil.parseYMD(startTime)); | |
| 427 | 437 | if (dates.length == 2) { |
| 428 | - end = dates[1]; | |
| 429 | - patientCourseQuery.setCreatedEnd(DateUtil.parseYMDHMS(end + " 23:59:59")); | |
| 438 | + endTime = dates[1]; | |
| 439 | + query.setPublishTimeStart(DateUtil.parseYMDHMS(endTime + " 23:59:59")); | |
| 430 | 440 | } |
| 431 | 441 | |
| 432 | - allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
| 433 | 442 | } |
| 434 | 443 | |
| 435 | - | |
| 436 | - | |
| 437 | - | |
| 438 | 444 | List<CourseModel> courseModelList = courseService.queryCourseList(query); |
| 439 | 445 | if (CollectionUtils.isNotEmpty(courseModelList)) |
| 440 | 446 | { |
| 441 | - List titles = new ArrayList(); | |
| 442 | - List sends = new ArrayList(); | |
| 443 | - List orders = new ArrayList(); | |
| 444 | - List signs = new ArrayList(); | |
| 447 | + | |
| 448 | + List<String> courseIds = new ArrayList<>(); | |
| 445 | 449 | for (CourseModel courseModel : courseModelList) |
| 446 | 450 | { |
| 447 | - patientCourseQuery.setCourseId(courseModel.getId()); | |
| 448 | - titles.add(courseModel.getCourseName()); | |
| 451 | + courseIds.add(courseModel.getId()); | |
| 452 | + } | |
| 453 | + patientCourseQuery.setCourseIds(courseIds); | |
| 449 | 454 | |
| 450 | - patientCourseQuery.setStatus(1); | |
| 451 | - int courseOrders = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
| 452 | - orders.add(courseOrders); | |
| 455 | + allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
| 453 | 456 | |
| 454 | - patientCourseQuery.setStatus(2); | |
| 455 | - int courseSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
| 456 | - signs.add(courseSigns); | |
| 457 | + List<Map<String,String>> list = new ArrayList<>(); | |
| 458 | + int batchSize = 2; | |
| 459 | + int end = 0; | |
| 460 | + List<Future> futures = new ArrayList<>(); | |
| 461 | + for (int i = 0; i < courseModelList.size(); i += batchSize) { | |
| 462 | + end = (end + batchSize); | |
| 463 | + if (end > courseModelList.size()) { | |
| 464 | + end = courseModelList.size(); | |
| 465 | + } | |
| 466 | + List<CourseModel> ms = courseModelList.subList(i, end); | |
| 467 | + Callable c = new CourseCountWorker(ms, hospitalId, | |
| 468 | + startTime, | |
| 469 | + endTime, | |
| 470 | + patientCourseService, | |
| 471 | + courseTypeService, | |
| 472 | + allPatientCourses); | |
| 473 | + Future f = commonThreadPool.submit(c); | |
| 474 | + futures.add(f); | |
| 475 | + } | |
| 457 | 476 | |
| 458 | - int courseSends = getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
| 459 | - 1,courseModel.getId(), start, end); | |
| 460 | - sends.add(courseSends); | |
| 477 | + if (CollectionUtils.isNotEmpty(futures)) | |
| 478 | + { | |
| 479 | + for (Future f : futures) | |
| 480 | + { | |
| 481 | + try { | |
| 482 | + list.addAll((List<Map<String,String>>) f.get()); | |
| 483 | + } catch (Exception e) { | |
| 484 | + ExceptionUtils.catchException(e, "getCourseCount list error."); | |
| 485 | + } | |
| 486 | + } | |
| 487 | + } | |
| 461 | 488 | |
| 462 | - courseTypeQuery.setId(courseModel.getCourseTypeId()); | |
| 463 | - List<CourseTypeModel> typeModels = courseTypeService.queryCourseTypeList(courseTypeQuery); | |
| 489 | + List titles = new ArrayList(); | |
| 490 | + List sends = new ArrayList(); | |
| 491 | + List orders = new ArrayList(); | |
| 492 | + List signs = new ArrayList(); | |
| 493 | + int orderAll = 0; | |
| 494 | + int signsAll = 0; | |
| 464 | 495 | |
| 465 | - Map tableMap = new HashMap(); | |
| 496 | + for (CourseModel courseModel : courseModelList) | |
| 497 | + { | |
| 498 | + Map tableItem = new HashMap(); | |
| 499 | + for (Map<String,String> map: list) | |
| 500 | + { | |
| 501 | + if (courseModel.getId().equals(map.get("courseId"))) | |
| 502 | + { | |
| 503 | + titles.add(map.get("title")); | |
| 504 | + orders.add(map.get("order")); | |
| 505 | + signs.add(map.get("courseSigns")); | |
| 506 | + sends.add(map.get("courseSends")); | |
| 466 | 507 | |
| 467 | - tableMap.put("courseTypeId",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getId() : ""); | |
| 468 | - tableMap.put("courseTypeName",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getCourseTypeName() : ""); | |
| 469 | - tableMap.put("courseName",courseModel.getCourseName()); | |
| 508 | + tableItem.put("courseTypeId", map.get("courseTypeId")); | |
| 509 | + tableItem.put("courseTypeName", map.get("courseTypeName")); | |
| 510 | + tableItem.put("courseName", map.get("courseName")); | |
| 511 | + tableItem.put("orders", map.get("orders")); | |
| 512 | + orderAll+=Integer.parseInt(map.get("orders")); | |
| 470 | 513 | |
| 471 | - tableMap.put("sends",courseSends); | |
| 472 | - tableMap.put("orders",courseOrders); | |
| 473 | - tableMap.put("ordersRate",allCourses == 0 ? "0" : df.format((double) courseOrders / allPatientCourses * 100) + "%"); | |
| 474 | - tableMap.put("signs",courseSigns); | |
| 475 | - tableMap.put("signsRate",allCourses == 0 ? "0" : df.format((double) courseSigns / allPatientCourses * 100) + "%"); | |
| 476 | - tableData.add(tableMap); | |
| 514 | + tableItem.put("ordersRate", map.get("ordersRate")); | |
| 515 | + tableItem.put("signs",map.get("signs")); | |
| 516 | + | |
| 517 | + signsAll+=Integer.parseInt(map.get("signs")); | |
| 518 | + tableItem.put("signsRate",map.get("signsRate")); | |
| 519 | + } | |
| 520 | + } | |
| 521 | + tableData.add(tableItem); | |
| 477 | 522 | } |
| 478 | 523 | |
| 479 | - chartData.put("titles",titles); | |
| 480 | - chartData.put("sends",sends); | |
| 481 | - chartData.put("orders",orders); | |
| 482 | - chartData.put("signs",signs); | |
| 524 | + Map tableItem = new HashMap(); | |
| 525 | + tableItem.put("courseTypeId","courseTypeId"); | |
| 526 | + tableItem.put("courseTypeName", "合计"); | |
| 527 | + tableItem.put("courseName",courseModelList.size()); | |
| 528 | + tableItem.put("orders", orderAll); | |
| 529 | + tableItem.put("ordersRate", allPatientCourses == 0 ? "0" : df.format((double) orderAll / allPatientCourses * 100) + "%"); | |
| 530 | + tableItem.put("signs",signsAll); | |
| 531 | + tableItem.put("signsRate",allPatientCourses == 0 ? "0" : df.format((double) signsAll / allPatientCourses * 100) + "%"); | |
| 532 | + tableData.add(tableItem); | |
| 483 | 533 | } |
| 484 | 534 | |
| 485 | 535 | resultData.put("totalData",totalData); |
| ... | ... | @@ -491,45 +541,5 @@ |
| 491 | 541 | objectResponse.setErrormsg("成功"); |
| 492 | 542 | return objectResponse; |
| 493 | 543 | } |
| 494 | - | |
| 495 | - | |
| 496 | - private static int getCourseCountData(String hospitalId, | |
| 497 | - String subTypeId, | |
| 498 | - Integer status, | |
| 499 | - Integer sendType, | |
| 500 | - String tempId, | |
| 501 | - String createTimeStart, | |
| 502 | - String createTimeEnd) | |
| 503 | - { | |
| 504 | - Map<String,String> param = new HashMap<>(); | |
| 505 | - | |
| 506 | - param.put("hospitalId",hospitalId); | |
| 507 | - param.put("subTypeId",subTypeId); | |
| 508 | - param.put("tempId",tempId == null ? null : String.valueOf(tempId)); | |
| 509 | - param.put("status",status == null ? null : String.valueOf(status)); | |
| 510 | - param.put("sendType",sendType == null ? null : String.valueOf(sendType)); | |
| 511 | - param.put("createTimeStart",createTimeStart); | |
| 512 | - param.put("createTimeEnd",createTimeEnd); | |
| 513 | - param.put("page","1"); | |
| 514 | - param.put("limit","900000000"); | |
| 515 | - | |
| 516 | - String result = HttpClientUtil.doGet(CENTER_BASE_URL + "/biz-push-web/pushCount", param, "utf-8", null); | |
| 517 | - | |
| 518 | - Map<String,String> map = JsonUtil.str2Obj(result, Map.class); | |
| 519 | - if ("0".equals(String.valueOf(map.get("errorcode")))) | |
| 520 | - { | |
| 521 | - return Integer.parseInt(String.valueOf(map.get("object"))); | |
| 522 | - } | |
| 523 | - return 0; | |
| 524 | - } | |
| 525 | -// | |
| 526 | -// | |
| 527 | -// public static void main(String[] args) | |
| 528 | -// { | |
| 529 | -// | |
| 530 | -// int allSends = getCourseCountData("216", String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 1, | |
| 531 | -// 1,null, null, null); | |
| 532 | -// System.out.println(allSends); | |
| 533 | -// } | |
| 534 | 544 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MessageCenterService.java
View file @
91c71e2
| ... | ... | @@ -109,7 +109,7 @@ |
| 109 | 109 | String json = ""; |
| 110 | 110 | try{ |
| 111 | 111 | json = JsonUtil.obj2Str(list); |
| 112 | - String result = HttpClientUtil.doPostSSL(CENTER_BASE_URL+"/biz-push-web/push", json); | |
| 112 | + String result = HttpClientUtil.doPostSSL(CENTER_BASE_URL + "/biz-push-web/push", json); | |
| 113 | 113 | if (StringUtils.isNotEmpty(result)) |
| 114 | 114 | { |
| 115 | 115 | Map<String,Integer> map = JsonUtil.str2Obj(result, Map.class); |
| ... | ... | @@ -126,6 +126,38 @@ |
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + | |
| 130 | + public static int getCourseCountData(String hospitalId, | |
| 131 | + String subTypeId, | |
| 132 | + Integer status, | |
| 133 | + Integer sendType, | |
| 134 | + String tempId, | |
| 135 | + String createTimeStart, | |
| 136 | + String createTimeEnd) | |
| 137 | + { | |
| 138 | + Map<String,String> param = new HashMap<>(); | |
| 139 | + | |
| 140 | + param.put("hospitalId",hospitalId); | |
| 141 | + param.put("subTypeId",subTypeId); | |
| 142 | + param.put("tempId",tempId == null ? null : String.valueOf(tempId)); | |
| 143 | + param.put("status",status == null ? null : String.valueOf(status)); | |
| 144 | + param.put("sendType",sendType == null ? null : String.valueOf(sendType)); | |
| 145 | + param.put("createTimeStart",createTimeStart); | |
| 146 | + param.put("createTimeEnd",createTimeEnd); | |
| 147 | + param.put("page","1"); | |
| 148 | + param.put("limit","900000000"); | |
| 149 | + | |
| 150 | + String result = HttpClientUtil.doGet(CENTER_BASE_URL + "/biz-push-web/pushCount", param, "utf-8", null); | |
| 151 | + | |
| 152 | + Map<String,String> map = JsonUtil.str2Obj(result, Map.class); | |
| 153 | + if ("0".equals(String.valueOf(map.get("errorcode")))) | |
| 154 | + { | |
| 155 | + return Integer.parseInt(String.valueOf(map.get("object"))); | |
| 156 | + } | |
| 157 | + return 0; | |
| 158 | + } | |
| 159 | + | |
| 160 | + | |
| 129 | 161 | // /** |
| 130 | 162 | // * 演示换调用 |
| 131 | 163 | // * @param list |
| ... | ... | @@ -242,12 +274,22 @@ |
| 242 | 274 | return null; |
| 243 | 275 | } |
| 244 | 276 | |
| 245 | - public static void main(String[] args){ | |
| 246 | - queryMsgList(null, null,null, | |
| 247 | - null,null, | |
| 248 | - null,null,null,null, | |
| 249 | - null,null ,2,null,null, | |
| 250 | - 1,10); | |
| 251 | - } | |
| 277 | +// public static void main(String[] args){ | |
| 278 | +// queryMsgList(null, null,null, | |
| 279 | +// null,null, | |
| 280 | +// null,null,null,null, | |
| 281 | +// null,null ,2,null,null, | |
| 282 | +// 1,10); | |
| 283 | +// } | |
| 284 | + | |
| 285 | + | |
| 286 | +// public static void main(String[] args) | |
| 287 | +// { | |
| 288 | +// | |
| 289 | +// int allSends = getCourseCountData("216", String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 1, | |
| 290 | +// 1,null, null, null); | |
| 291 | +// System.out.println(allSends); | |
| 292 | +// } | |
| 293 | + | |
| 252 | 294 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/CourseCountWorker.java
View file @
91c71e2
| 1 | 1 | package com.lyms.platform.operate.web.worker; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.CourseTypeService; | |
| 4 | +import com.lyms.platform.biz.service.PatientCourseService; | |
| 3 | 5 | import com.lyms.platform.common.enums.SmsServiceEnums; |
| 4 | 6 | import com.lyms.platform.common.enums.YnEnums; |
| 7 | +import com.lyms.platform.operate.web.utils.MessageCenterService; | |
| 5 | 8 | import com.lyms.platform.pojo.CourseModel; |
| 6 | 9 | import com.lyms.platform.pojo.CourseTypeModel; |
| 7 | 10 | import com.lyms.platform.query.CourseTypeQuery; |
| 8 | 11 | import com.lyms.platform.query.PatientCourseQuery; |
| 9 | 12 | import org.apache.commons.collections.CollectionUtils; |
| 10 | 13 | |
| 14 | +import java.text.DecimalFormat; | |
| 11 | 15 | import java.util.ArrayList; |
| 12 | 16 | import java.util.HashMap; |
| 13 | 17 | import java.util.List; |
| 14 | 18 | |
| 15 | 19 | |
| 16 | 20 | |
| ... | ... | @@ -19,71 +23,85 @@ |
| 19 | 23 | */ |
| 20 | 24 | public class CourseCountWorker implements Callable { |
| 21 | 25 | |
| 22 | - public CourseCountWorker() | |
| 23 | - { | |
| 26 | + private List<CourseModel> courseModelList; | |
| 27 | + private String hospitalId; | |
| 28 | + private String start; | |
| 29 | + private String end; | |
| 30 | + private PatientCourseService patientCourseService; | |
| 31 | + private CourseTypeService courseTypeService; | |
| 32 | + private int allPatientCourses; | |
| 24 | 33 | |
| 34 | + public CourseCountWorker(List<CourseModel> courseModelList,String hospitalId, | |
| 35 | + String start, | |
| 36 | + String end, | |
| 37 | + PatientCourseService patientCourseService, | |
| 38 | + CourseTypeService courseTypeService, | |
| 39 | + int allPatientCourses) | |
| 40 | + { | |
| 41 | + this.hospitalId = hospitalId; | |
| 42 | + this.courseModelList = courseModelList; | |
| 43 | + this.patientCourseService = patientCourseService; | |
| 44 | + this.courseTypeService = courseTypeService; | |
| 45 | + this.allPatientCourses = allPatientCourses; | |
| 46 | + this.start = start; | |
| 47 | + this.end = end; | |
| 25 | 48 | } |
| 26 | 49 | |
| 27 | 50 | @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 | -// } | |
| 51 | + public List<Map<String,String>> call() throws Exception { | |
| 85 | 52 | |
| 86 | - return chartData; | |
| 53 | + List<Map<String,String>> data = new ArrayList<>(); | |
| 54 | + if (CollectionUtils.isNotEmpty(courseModelList)) | |
| 55 | + { | |
| 56 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 57 | + | |
| 58 | + CourseTypeQuery courseTypeQuery = new CourseTypeQuery(); | |
| 59 | + courseTypeQuery.setHospitalId(hospitalId); | |
| 60 | + courseTypeQuery.setYn(YnEnums.YES.getId()); | |
| 61 | + | |
| 62 | + | |
| 63 | + PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | |
| 64 | + patientCourseQuery.setYn(YnEnums.YES.getId()); | |
| 65 | + patientCourseQuery.setHospitalId(hospitalId); | |
| 66 | + | |
| 67 | + for (CourseModel courseModel : courseModelList) | |
| 68 | + { | |
| 69 | + Map<String,String> topmap = new HashMap(); | |
| 70 | + | |
| 71 | + topmap.put("courseId",courseModel.getId()); | |
| 72 | + | |
| 73 | + patientCourseQuery.setCourseId(courseModel.getId()); | |
| 74 | + topmap.put("title", courseModel.getCourseName()); | |
| 75 | + | |
| 76 | + patientCourseQuery.setStatus(1); | |
| 77 | + int courseOrders = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
| 78 | + topmap.put("order", String.valueOf(courseOrders)); | |
| 79 | + | |
| 80 | + patientCourseQuery.setStatus(2); | |
| 81 | + int courseSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
| 82 | + topmap.put("courseSigns", String.valueOf(courseSigns)); | |
| 83 | + | |
| 84 | + int courseSends = MessageCenterService.getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
| 85 | + 1, courseModel.getId(), null, null); | |
| 86 | + topmap.put("courseSends", String.valueOf(courseSends)); | |
| 87 | + | |
| 88 | + courseTypeQuery.setId(courseModel.getCourseTypeId()); | |
| 89 | + List<CourseTypeModel> typeModels = courseTypeService.queryCourseTypeList(courseTypeQuery); | |
| 90 | + | |
| 91 | + topmap.put("courseTypeId",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getId() : ""); | |
| 92 | + topmap.put("courseTypeName",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getCourseTypeName() : ""); | |
| 93 | + topmap.put("courseName",courseModel.getCourseName()); | |
| 94 | + | |
| 95 | + topmap.put("sends",String.valueOf(courseSends)); | |
| 96 | + topmap.put("orders",String.valueOf(courseOrders)); | |
| 97 | + topmap.put("ordersRate",allPatientCourses == 0 ? "0" : df.format((double) courseOrders / allPatientCourses * 100) + "%"); | |
| 98 | + topmap.put("signs",String.valueOf(courseSigns)); | |
| 99 | + topmap.put("signsRate", allPatientCourses == 0 ? "0" : df.format((double) courseSigns / allPatientCourses * 100) + "%"); | |
| 100 | + | |
| 101 | + data.add(topmap); | |
| 102 | + } | |
| 103 | + } | |
| 104 | + return data; | |
| 87 | 105 | } |
| 88 | 106 | } |