Commit fc00b4ef272e293225be24862e93ea4c481c9aab

Authored by litao
1 parent 55b6f83275

根据模板查询所有配置的title

Showing 3 changed files with 51 additions and 39 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ fc00b4e
... ... @@ -76,5 +76,7 @@
76 76 Map<String,Object> findHospitalSendInfo(Map<String, Object> param);
77 77  
78 78 List<Map<String,Object>> couponInfo(Map<String, Object> param);
  79 +
  80 + List<String> findCouponTitleByTemp(Map<String, Object> param);
79 81 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ fc00b4e
... ... @@ -391,5 +391,34 @@
391 391 #{hid}
392 392 </foreach>
393 393 </select>
  394 +
  395 + <select id="findCouponTitleByTemp" parameterType="map" resultType="string">
  396 + select concat(b.type, "_", a.coupon_order)
  397 + from coupon_template a, coupon_type b, (
  398 + select distinct(b.coupon_template_group_id)
  399 + from organization a, hospital_coupon_template_group b
  400 + where a.id = b.hospital_id
  401 + and b.coupon_template_group_id = #{tempId}
  402 + and a.id in
  403 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  404 + #{hid}
  405 + </foreach>
  406 + <if test="provinceId != null and provinceId != ''">
  407 + and a.province_id = #{provinceId}
  408 + </if>
  409 + <if test="cityId != null and cityId != '' ">
  410 + and a.city_id = #{cityId}
  411 + </if>
  412 + <if test="areaId != null and areaId != ''">
  413 + and a.area_id = #{areaId}
  414 + </if>
  415 + ) c
  416 + where a.type_id = b.id
  417 + and a.group_id = c.coupon_template_group_id
  418 + and b.type in
  419 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  420 + #{type}
  421 + </foreach>
  422 + </select>
394 423 </mapper>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ fc00b4e
... ... @@ -108,6 +108,10 @@
108 108 couponReportMap.put("8_4", "<div class='ag-double-line'>儿童保健券(三)<div><div>使用人次</div></div>");
109 109 couponReportMap.put("8_5", "<div class='ag-double-line'>儿童保健券(四)<div>使用人次</div></div>");
110 110 couponReportMap.put("8_6", "<div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div>");
  111 + couponReportMap.put("8_7", "<div class='ag-double-line'>儿童保健券(六)<div>使用人次</div></div>");
  112 + couponReportMap.put("8_8", "<div class='ag-double-line'>儿童保健券(七)<div>使用人次</div></div>");
  113 + couponReportMap.put("8_9", "<div class='ag-double-line'>儿童保健券(八)<div>使用人次</div></div>");
  114 + couponReportMap.put("8_10", "<div class='ag-double-line'>儿童保健券(九)<div>使用人次</div></div>");
111 115 /** 产后 */
112 116 couponReportMap.put("3_1", "<div class='ag-double-line'>产后建档券<div>使用人次</div></div>");
113 117 couponReportMap.put("4_1", "<div class='ag-double-line'>分娩券<div>使用人次</div></div>");
... ... @@ -116,6 +120,8 @@
116 120 couponReportMap.put("6_2", "<div class='ag-double-line'>产后复查券(一)<div>使用人次</div></div>");
117 121 couponReportMap.put("6_3", "<div class='ag-double-line'>产后复查券(二)<div>使用人次</div></div>");
118 122 couponReportMap.put("6_4", "<div class='ag-double-line'>产后复查券(三)<div>使用人次</div></div>");
  123 + couponReportMap.put("6_5", "<div class='ag-double-line'>产后复查券(四)<div>使用人次</div></div>");
  124 + couponReportMap.put("6_6", "<div class='ag-double-line'>产后复查券(五)<div>使用人次</div></div>");
119 125  
120 126 /** 1=孕妇建档 2=孕妇产检 3=产妇建档 4=产妇分娩 5=产妇出院小结 6=产妇产后复查 7=儿童建档 8=儿童保健 */
121 127 couponDescMap.put(1, "孕妇建档券");
... ... @@ -377,12 +383,6 @@
377 383 rest.setErrorcode(500);
378 384 rest.setErrormsg(e.getMessage());
379 385 }
380   -
381   -
382   - // PageResult page = findPage(getDoctorInfoSql(startDate, endDate, childBirth, number, name, hospitalId, params), currentPage, pageSize, params);
383   -// List<Map<String, Object>> grid = (List<Map<String, Object>>) page.getGrid();
384   -// setColor(grid);
385   -// rest.setData(page);
386 386 return rest;
387 387 }
388 388  
389 389  
... ... @@ -487,43 +487,24 @@
487 487 reportModel.setSeries(createSeries(couponReport));
488 488 reportModel.doMerge();
489 489  
  490 + /** 查询医院所绑定的type和coupon_order */
  491 + List<String> key = couponMapper.findCouponTitleByTemp(param);
  492 + setZeroDataByTemp(key, couponReport);
  493 +
490 494 Map<String, Object> titleMap = parseTitle(couponReport);
491 495 transNullToZero(couponReport, titleMap);
492 496  
493 497 return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", titleMap, "reportModel", reportModel);
494   - // return RespBuilder.buildSuccess(couponReport);
495   -// if(org.apache.commons.collections.CollectionUtils.isNotEmpty(couponReport) &&
496   -// org.apache.commons.collections.CollectionUtils.isNotEmpty(usedInfo)) {
497   -// if(CollectionUtils.putAll(couponReport, usedInfo, "used_hospital_id", "used_hospital_id")) {
498   -// for (Map<String, Object> map : couponReport) {
499   -// map.put("province_name", findName(map.get("province_id")));
500   -// map.put("city_name", findName(map.get("city_id")));
501   -//
502   -// String areaName = findName(map.get("area_id"));
503   -// map.put("area_name", areaName);
504   -// if(map.get("areaId") == null) { /** 没传区县 报表数据就为区域的 传了区县 报表数据就为市 */
505   -// xAxis.add(areaName);
506   -// } else {
507   -// Map<String, Object> m = couponMapper.findHospitalName(CollectionUtils.createMap("hospitalId", ""));
508   -// if(m.get("name") != null) {
509   -// xAxis.add(m.get("name").toString());
510   -// }
511   -// }
512   -// }
513   -// }
514   -// }
515   -//
516   -// ReportModel reportModel = new ReportModel();
517   -// reportModel.setxAxis(xAxis);
518   -// reportModel.setData(Arrays.asList("发放券数", "使用券数"));
519   -// reportModel.setSeries(createSeries(couponReport));
520   -// reportModel.doMerge();
521   -//
522   -// Map<String, Object> titleMap = parseTitle(couponReport);
523   -// transNullToZero(couponReport, titleMap);
524   -//
525   -//
526   -// return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", titleMap, "reportModel", reportModel);
  498 + }
  499 +
  500 + private void setZeroDataByTemp(List<String> key, List<Map<String, Object>> couponReport) {
  501 + for (Map<String, Object> map : couponReport) {
  502 + for (String s : key) {
  503 + if(map.get(s) == null) {
  504 + map.put(s, 0);
  505 + }
  506 + }
  507 + }
527 508 }
528 509  
529 510 private Map<String, Object> packCouponMap(Map<String, Object> sendInfo, Map<String, Object> usedInfo, Map<String, Object> hNameMap, String hid, List<String> xAxis, Map<String, Object> param) {