Commit e547aa8cd54480a68dc9c5030794ea9af2de439e

Authored by dongqin
1 parent 67ce36cd8d

新增增值服务统计模块

Showing 7 changed files with 51 additions and 75 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/PatientServiceMapper.java View file @ e547aa8
... ... @@ -65,6 +65,6 @@
65 65 */
66 66 List<Map<String, Object>> getServeDetailList(@Param("param") ServiceListQuery param);
67 67  
68   - List<String> getHospitalIds(@Param("param") ServiceListQuery param);
  68 + List<String> getHospitalIds(@Param("param") ServiceListQuery param, @Param("ids") List<String> ids);
69 69 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/PatientServiceService.java View file @ e547aa8
... ... @@ -29,6 +29,6 @@
29 29  
30 30 List<Map<String, Object>> getServeDetailList(ServiceListQuery param);
31 31  
32   - List<String> getHospitalIds(ServiceListQuery param);
  32 + List<String> getHospitalIds(ServiceListQuery param, List<String> ids);
33 33 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/PatientServiceServiceImpl.java View file @ e547aa8
... ... @@ -77,8 +77,8 @@
77 77 }
78 78  
79 79 @Override
80   - public List<String> getHospitalIds(ServiceListQuery param) {
81   - return patientServiceMapper.getHospitalIds(param);
  80 + public List<String> getHospitalIds(ServiceListQuery param, List<String> hospitalIds) {
  81 + return patientServiceMapper.getHospitalIds(param, hospitalIds);
82 82 }
83 83 }
platform-biz-service/src/main/resources/mainOrm/master/PatientService.xml View file @ e547aa8
... ... @@ -411,13 +411,13 @@
411 411 <if test="query.endTime != null ">
412 412 AND ps.create_date &lt;= #{query.endTime}
413 413 </if>
414   - <if test="query.provinceId != null">
  414 + <if test="query.provinceId != null and query.provinceId != '' ">
415 415 and o.province_id = #{query.provinceId}
416 416 </if>
417   - <if test="query.cityId != null">
  417 + <if test="query.cityId != null and query.cityId != ''">
418 418 and o.city_id = #{query.cityId}
419 419 </if>
420   - <if test="query.areaId != null">
  420 + <if test="query.areaId != null and query.areaId != ''">
421 421 and o.area_id = #{query.areaId}
422 422 </if>
423 423 ) as "open",
424 424  
425 425  
... ... @@ -432,13 +432,13 @@
432 432 <if test="query.endTime != null ">
433 433 AND ps.create_date &lt;= #{query.endTime}
434 434 </if>
435   - <if test="query.provinceId != null">
  435 + <if test="query.provinceId != null and query.provinceId != '' ">
436 436 and o.province_id = #{query.provinceId}
437 437 </if>
438   - <if test="query.cityId != null">
  438 + <if test="query.cityId != null and query.cityId != ''">
439 439 and o.city_id = #{query.cityId}
440 440 </if>
441   - <if test="query.areaId != null">
  441 + <if test="query.areaId != null and query.areaId != ''">
442 442 and o.area_id = #{query.areaId}
443 443 </if>
444 444 ) as "unsubscribe",
445 445  
446 446  
... ... @@ -453,13 +453,13 @@
453 453 <if test="query.endTime != null ">
454 454 AND ps.create_date &lt;= #{query.endTime}
455 455 </if>
456   - <if test="query.provinceId != null">
  456 + <if test="query.provinceId != null and query.provinceId != '' ">
457 457 and o.province_id = #{query.provinceId}
458 458 </if>
459   - <if test="query.cityId != null">
  459 + <if test="query.cityId != null and query.cityId != ''">
460 460 and o.city_id = #{query.cityId}
461 461 </if>
462   - <if test="query.areaId != null">
  462 + <if test="query.areaId != null and query.areaId != ''">
463 463 and o.area_id = #{query.areaId}
464 464 </if>
465 465 ) as "expire",
466 466  
467 467  
468 468  
469 469  
470 470  
471 471  
472 472  
473 473  
474 474  
475 475  
... ... @@ -474,62 +474,54 @@
474 474 <if test="query.endTime != null ">
475 475 AND ps.create_date &lt;= #{query.endTime}
476 476 </if>
477   - <if test="query.provinceId != null">
  477 + <if test="query.provinceId != null and query.provinceId != '' ">
478 478 and o.province_id = #{query.provinceId}
479 479 </if>
480   - <if test="query.cityId != null">
  480 + <if test="query.cityId != null and query.cityId != ''">
481 481 and o.city_id = #{query.cityId}
482 482 </if>
483   - <if test="query.areaId != null">
  483 + <if test="query.areaId != null and query.areaId != ''">
484 484 and o.area_id = #{query.areaId}
485 485 </if>
486 486 ) as "suspend"
487   - /*FROM patient_service ps*/
488   - /* JOIN organization o
489   - ON o.id = ps.hospital_id*/
490   - <!--WHERE ps.hospital_id = #{query.hospitalId}
  487 + FROM patient_service ps
  488 + JOIN organization o
  489 + ON o.id = ps.hospital_id
  490 + WHERE ps.hospital_id = #{query.hospitalId}
491 491 <if test="query.startTime != null ">
492 492 AND ps.create_date &gt;= #{query.startTime}
493 493 </if>
494 494 <if test="query.endTime != null ">
495 495 AND ps.create_date &lt;= #{query.endTime}
496 496 </if>
497   - <if test="query.provinceId != null">
  497 + <if test="query.provinceId != null and query.provinceId != '' ">
498 498 and o.province_id = #{query.provinceId}
499 499 </if>
500   - <if test="query.cityId != null">
  500 + <if test="query.cityId != null and query.cityId != ''">
501 501 and o.city_id = #{query.cityId}
502 502 </if>
503   - <if test="query.areaId != null">
  503 + <if test="query.areaId != null and query.areaId != ''">
504 504 and o.area_id = #{query.areaId}
505 505 </if>
506 506 GROUP BY o.name,o.province_id,
507 507 o.city_id,
508   - o.area_id-->
509   - FROM organization o
510   - WHERE o.id = #{query.hospitalId}
511   - GROUP BY o.name,o.province_id,
512   - o.city_id,
513   - o.area_id
  508 + o.area_id
514 509 </select>
515 510 <select id="countStatusInfo" parameterType="com.lyms.platform.permission.model.ServiceListQuery" resultType="int">
516 511 select count(1)
517 512 from patient_service ps
518 513 join organization o on o.id = ps.hospital_id
519 514 where 1=1
520   - <if test="param.startTime != null">
521   - and ps.create_date &gt;= #{param.startTime}
522   - </if>
523   - <if test="param.endTime != null ">
524   - AND ps.create_date &lt;= #{param.endTime}
525   - </if>
526   - <if test="param.provinceId != null">
  515 + and ps.create_date &gt;= #{param.startTime}
  516 + AND ps.create_date &lt;= #{param.endTime}
  517 + and ps.ser_status = #{param.serStatus}
  518 + <if test="param.provinceId != null and param.provinceId != ''">
527 519 and o.province_id = #{param.provinceId}
528 520 </if>
529   - <if test="param.cityId != null">
  521 + <if test="param.cityId != null and param.cityId != ''">
530 522 and o.city_id = #{param.cityId}
531 523 </if>
532   - <if test="param.areaId != null">
  524 + <if test="param.areaId != null and param.areaId != ''">
533 525 and o.area_id = #{param.areaId}
534 526 </if>
535 527 <if test="param.hospitalIds.size() > 0">
... ... @@ -538,7 +530,6 @@
538 530 #{item}
539 531 </foreach>
540 532 </if>
541   - and ps.ser_status = #{param.serStatus}
542 533 </select>
543 534 <select id="getServeDetailList" parameterType="com.lyms.platform.permission.model.ServiceListQuery" resultType="java.util.Map">
544 535 SELECT
545 536  
546 537  
547 538  
... ... @@ -568,16 +559,16 @@
568 559 <if test="param.endTime != null ">
569 560 AND ps.create_date &lt;= #{param.endTime}
570 561 </if>
571   - <if test="param.hospitalId != null">
  562 + <if test="param.hospitalId != null and param.hospitalId != ''">
572 563 and o.id = #{param.hospitalId}
573 564 </if>
574   - <if test="param.provinceId != null">
  565 + <if test="param.provinceId != null and param.provinceId != ''">
575 566 AND o.province_id = #{param.provinceId}
576 567 </if>
577   - <if test="param.cityId != null">
  568 + <if test="param.cityId != null and param.cityId != ''">
578 569 AND o.city_id = #{param.cityId}
579 570 </if>
580   - <if test="param.areaId != null">
  571 + <if test="param.areaId != null and param.areaId != ''">
581 572 AND o.area_id = #{param.areaId}
582 573 </if>
583 574 <if test="param.serStatus != null">
584 575  
585 576  
586 577  
587 578  
588 579  
589 580  
590 581  
... ... @@ -597,29 +588,25 @@
597 588 patient_service ps
598 589 JOIN organization o ON o.id = ps.hospital_id
599 590 WHERE 1=1
600   - <if test="param.hospitalId != null">
  591 + <if test="param.hospitalId != null and param.hospitalId != ''">
601 592 and o.id = #{param.hospitalId}
602 593 </if>
603   - <if test="param.provinceId != null">
  594 + <if test="param.provinceId != null and param.provinceId != ''">
604 595 AND o.province_id = #{param.provinceId}
605 596 </if>
606   - <if test="param.cityId != null">
  597 + <if test="param.cityId != null and param.cityId != ''">
607 598 AND o.city_id = #{param.cityId}
608 599 </if>
609   - <if test="param.areaId != null">
  600 + <if test="param.areaId != null and param.areaId != ''">
610 601 AND o.area_id = #{param.areaId}
611 602 </if>
612 603 <if test="param.serStatus != null">
613 604 AND ps.ser_status = #{param.serStatus}
614 605 </if>
615   - <if test="param.startTime != null">
616 606 and ps.create_date &gt;= #{param.startTime}
617   - </if>
618   - <if test="param.endTime != null ">
619 607 AND ps.create_date &lt;= #{param.endTime}
620   - </if>
621 608 </select>
622   - <select id="getHospitalIds" parameterType="com.lyms.platform.permission.model.ServiceListQuery" resultType="java.lang.String">
  609 + <select id="getHospitalIds" resultType="string">
623 610  
624 611 SELECT
625 612 o.id as "hospitalId"
... ... @@ -627,7 +614,7 @@
627 614 JOIN organization o
628 615 ON o.id = ps.hospital_id
629 616 WHERE ps.hospital_id in
630   - <foreach collection="param.hospitalIds" item="item" open="(" close=")" separator=",">
  617 + <foreach collection="ids" item="item" open="(" close=")" separator=",">
631 618 #{item}
632 619 </foreach>
633 620 <if test="param.startTime != null ">
634 621  
635 622  
... ... @@ -636,13 +623,13 @@
636 623 <if test="param.endTime != null ">
637 624 AND ps.create_date &lt;= #{param.endTime}
638 625 </if>
639   - <if test="param.provinceId != null">
  626 + <if test="param.provinceId != null and param.provinceId != ''">
640 627 and o.province_id = #{param.provinceId}
641 628 </if>
642   - <if test="param.cityId != null">
  629 + <if test="param.cityId != null and param.cityId != ''">
643 630 and o.city_id = #{param.cityId}
644 631 </if>
645   - <if test="param.areaId != null">
  632 + <if test="param.areaId != null and param.areaId != ''">
646 633 and o.area_id = #{param.areaId}
647 634 </if>
648 635  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java View file @ e547aa8
... ... @@ -234,9 +234,9 @@
234 234 * @param param
235 235 */
236 236 @RequestMapping(value = "/getServiceDetail/export",method = RequestMethod.GET)
237   - @ResponseBody
  237 + //@ResponseBody
238 238 @TokenRequired
239   - public void getServiceDetailExport(@RequestBody ServiceListQuery param, HttpServletRequest request, HttpServletResponse response){
  239 + public void getServiceDetailExport(ServiceListQuery param, HttpServletRequest request, HttpServletResponse response){
240 240 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
241 241 param.setUserId(loginState.getId());
242 242 areaCountFacade.getServiceDetailExport(param, response);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java View file @ e547aa8
... ... @@ -1054,8 +1054,8 @@
1054 1054 hospitalIds.add(hospitalId);
1055 1055 }
1056 1056 ExecutorService threadPool = Executors.newFixedThreadPool(5);
1057   - param.setHospitalIds(hospitalIds);
1058   - List<String> ids = patientServiceService.getHospitalIds(param);
  1057 + //param.setHospitalIds(hospitalIds);
  1058 + //List<String> ids = patientServiceService.getHospitalIds(param, hospitalIds);
1059 1059 int size = hospitalIds.size();
1060 1060 int batchSize = 2;
1061 1061 int end = 0;
... ... @@ -1080,8 +1080,8 @@
1080 1080  
1081 1081 CopyOnWriteArrayList statusValList = new CopyOnWriteArrayList();
1082 1082 param.setHospitalIds(hospitalIds);
1083   - CountDownLatch cdl=new CountDownLatch(4);
1084   - ExecutorService service= new ThreadPoolExecutor(5, 10, 3000, TimeUnit.MILLISECONDS,
  1083 + CountDownLatch cdl = new CountDownLatch(4);
  1084 + ExecutorService service = new ThreadPoolExecutor(5, 10, 3000, TimeUnit.MILLISECONDS,
1085 1085 new ArrayBlockingQueue<Runnable>(10),
1086 1086 new RejectedExecutionHandler() {
1087 1087 @Override
... ... @@ -1093,6 +1093,7 @@
1093 1093 for (int i =1; i < 5; i ++){
1094 1094 String serStatus = i + "" ;
1095 1095 service.execute(new ServiceListBySerStatusWorker(cdl, param, statusValList, serStatus, patientServiceService ));
  1096 + Thread.sleep(300);
1096 1097 }
1097 1098 cdl.await();
1098 1099 service.shutdown();
... ... @@ -1187,19 +1188,6 @@
1187 1188 public void getServiceDetailExport(ServiceListQuery param, HttpServletResponse response) {
1188 1189 setDefaultTime(param);
1189 1190 List<Map<String, Object>> serviceDetailListMap = getServiceDetailListMap(param);
1190   - /*for (Map map : serviceDetailListMap){
1191   - HashMap<Object, Object> result = new HashMap<>(16);
1192   - *//**
1193   - * "patientName": "王静洁",
1194   - * "serTypeName": "精准指导",
1195   - * "doctorName": "",
1196   - * "opnYumSize": "",
1197   - * "serviceWeek": "",
1198   - * "createDate": 1480953600000,
1199   - * "serStatus": "开通中"
1200   - *//*
1201   - result.put("createDate",map.get("createDate"));
1202   - }*/
1203 1191 Map<String, String> names = new LinkedHashMap<>();
1204 1192 names.put("createDate","购买日期");
1205 1193 names.put("patientName", "姓名");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/ServiceListWorker.java View file @ e547aa8
... ... @@ -38,6 +38,7 @@
38 38 public String call() throws Exception {
39 39 for (String hospital : hospitals){
40 40 param.setHospitalId(hospital);
  41 +
41 42 Map<String, Object> map = patientServiceService.getServiceList(param);
42 43 if (map != null){
43 44 HashMap<String, Object> hashMap = new HashMap<>(16);