Commit d28f319548d43d7c3b469f9793612cfa78468ebe

Authored by litao
1 parent 0c6c972037

报表数据完善

Showing 4 changed files with 56 additions and 37 deletions

platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ d28f319
... ... @@ -320,33 +320,10 @@
320 320 <if test="endDate != null">
321 321 and a.use_date <![CDATA[ < ]]> #{endDate}
322 322 </if>
323   - <if test="currentPage != null and currentPage != 0 and pageSize != null and pageSize != 0">
  323 + <if test="needPage == true">
324 324 limit #{currentPage},#{pageSize}
325 325 </if>
326 326 </select>
327   - <!-- <select id="findCouponInfo" parameterType="map" resultType="map">
328   - select c.type, a.sequence_id, d.name, e.name as send_hospital, a.use_date, a.used_id, b.coupon_order
329   - from coupon_info a, coupon_template b, coupon_type c, users d, organization e, hospital_coupon_template_group f
330   - where a.coupon_template_id = b.id and b.type_id = c.id and a.user_id = d.id and a.status=2 and a.create_hospital_id = e.id
331   - and a.used_hospital_id in
332   - <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
333   - #{hid}
334   - </foreach>
335   - and f.hospital_id = a.used_hospital_id and c.type in
336   - <foreach collection="couponType" open="(" close=")" separator="," item="type">
337   - #{type}
338   - </foreach>
339   - <if test="startDate != null">
340   - and a.create_date >= #{startDate}
341   - </if>
342   - <if test="endDate != null">
343   - and a.create_date <![CDATA[ < ]]> #{endDate}
344   - </if>
345   - <if test="tempId != null and tempId != ''">
346   - and f.coupon_template_group_id = #{tempId}
347   - </if>
348   - limit #{currentPage},#{pageSize}
349   - </select>-->
350 327  
351 328 <select id="findCouponInfoCount" parameterType="map" resultType="integer">
352 329 select count(1) from (
... ... @@ -445,7 +422,7 @@
445 422 <if test="endDate != null">
446 423 and a.create_date <![CDATA[ < ]]> #{endDate}
447 424 </if>
448   - <if test="currentPage != null and currentPage != 0 and pageSize != null and pageSize != 0">
  425 + <if test="needPage == true">
449 426 limit #{currentPage},#{pageSize}
450 427 </if>
451 428 </select>
platform-operate-api/pom.xml View file @ d28f319
... ... @@ -82,6 +82,12 @@
82 82 <version>9.3.8.v20160314</version>
83 83 </dependency>
84 84  
  85 + <dependency>
  86 + <groupId>net.sourceforge.jexcelapi</groupId>
  87 + <artifactId>jxl</artifactId>
  88 + <version>2.6.12</version>
  89 + </dependency>
  90 +
85 91 </dependencies>
86 92 <build>
87 93 <resources>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ d28f319
... ... @@ -756,7 +756,7 @@
756 756 if(patients != null) {
757 757 map.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(patients.getPhone()));
758 758  
759   - String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()) + findName(patients.getStreetRegisterId()) + findName(patients.getAddressRegister());
  759 + String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()) + findName(patients.getStreetRegisterId()) + patients.getAddressRegister();
760 760 map.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */
761 761  
762 762 String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + patients.getAddress();
... ... @@ -771,7 +771,7 @@
771 771 map.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(patients.getPhone()));
772 772 map.put("username", patients.getUsername());
773 773  
774   - String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()) + findName(patients.getStreetRegisterId()) + findName(patients.getAddressRegister());
  774 + String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()) + findName(patients.getStreetRegisterId()) + patients.getAddressRegister();
775 775 map.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */
776 776  
777 777 String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + patients.getAddress();
... ... @@ -1018,6 +1018,7 @@
1018 1018  
1019 1019 @Override
1020 1020 public void exportCouponInfo(Map<String, Object> param, HttpServletResponse response) {
  1021 + param.put("needPage", false);
1021 1022 BaseObjectResponse resp = couponInfo(param);
1022 1023 PageResult pageResult = (PageResult) resp.getData();
1023 1024 Map<String,Object> map = (Map<String, Object>) pageResult.getGrid();
1024 1025  
1025 1026  
... ... @@ -1031,16 +1032,54 @@
1031 1032 */
1032 1033 Integer exportType = (Integer) param.get("exportType");
1033 1034  
  1035 +// exportPostpartum(couponInfos, response);
  1036 +
1034 1037 /**
1035 1038 * 1 = 发放人数 2 = 发放券数 3 = 使用人数 4 = 使用券数
1036 1039 */
1037 1040 Integer type = (Integer) param.get("type");
1038 1041 if(exportType == 1 && type == 1) { /** 孕期发放人数 */
1039 1042 exportPregnancy(userSendInfos, response);
1040   - } else if(type == 2 || type == 3) { /** 产后和儿童类似 */
1041   - exportPostpartum(couponInfos, response);
  1043 + } else if(exportType == 1 && type == 1) { /** 孕期使用券数 */
  1044 + exportPregnancyUsedInfo(couponInfos, response);
  1045 + }else if(exportType == 2 && type == 1) { /** 产后和儿童类似 */
  1046 +
1042 1047 }
1043 1048  
  1049 + }
  1050 +
  1051 + private void exportPregnancyUsedInfo(List<Map<String, Object>> data, HttpServletResponse response) {
  1052 + Map<String, String> cnames = new LinkedHashMap<>();
  1053 + cnames.put("id", "#");
  1054 + cnames.put("use_date", "使用日期");
  1055 + cnames.put("username", "姓名");
  1056 + cnames.put("week", "使用孕周");
  1057 + cnames.put("number", "产检第次");
  1058 + cnames.put("type_desc", "优惠券");
  1059 + cnames.put("sequence_id", "优惠券号");
  1060 + cnames.put("operatorOrgName", "使用机构");
  1061 + cnames.put("doctorName", "使用医生");
  1062 + cnames.put("send_hospital", "优惠券发放机构");
  1063 + cnames.put("phone", "联系电话");
  1064 +
  1065 + List<Map<String,Object>> results = new ArrayList<>();
  1066 + int i = 0;
  1067 + for (Map<String, Object> m : data) {
  1068 + Map<String, Object> result = new LinkedHashMap<>();
  1069 + result.put("id", ++i);
  1070 + result.put("use_date", m.get("use_date"));
  1071 + result.put("username", m.get("username"));
  1072 + result.put("week", m.get("week"));
  1073 + result.put("number", m.get("number"));
  1074 + result.put("type_desc", m.get("type_desc"));
  1075 + result.put("sequence_id", m.get("sequence_id"));
  1076 + result.put("operatorOrgName", m.get("operatorOrgName"));
  1077 + result.put("doctorName", m.get("doctorName"));
  1078 + result.put("send_hospital", m.get("send_hospital"));
  1079 + result.put("phone", m.get("phone"));
  1080 + results.add(result);
  1081 + }
  1082 + ResponseUtil.responseExcel(cnames, results, response);
1044 1083 }
1045 1084  
1046 1085 private void exportPostpartum(List<Map<String, Object>> couponInfos, HttpServletResponse response) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/PageUtil.java View file @ d28f319
... ... @@ -24,15 +24,12 @@
24 24 //日志调测器
25 25 private static final Logger logger = LoggerFactory.getLogger(PageUtil.class);
26 26 public static void setPageInfo(Map<String,Object> map) {
27   -// Integer pageSize = map.get("pageSize") == null ? 15 : Integer.parseInt(map.get("pageSize").toString());
28   -// Integer currentPage = map.get("currentPage") == null ? 1 : Integer.parseInt(map.get("currentPage").toString());
  27 + if(map.get("needPage") == null) {
  28 + map.put("needPage", true);
  29 + }
29 30  
30   - /* if(map.get("currentPage") == null || map.get("pageSize") == null) { *//** 为了详情导出 不做分页 *//*
31   - return;
32   - }*/
33   -
34   - Integer pageSize = map.get("pageSize") == null ? 0 : Integer.parseInt(map.get("pageSize").toString());
35   - Integer currentPage = map.get("currentPage") == null ? 0 : Integer.parseInt(map.get("currentPage").toString());
  31 + Integer pageSize = map.get("pageSize") == null ? 15 : Integer.parseInt(map.get("pageSize").toString());
  32 + Integer currentPage = map.get("currentPage") == null ? 1 : Integer.parseInt(map.get("currentPage").toString());
36 33 if(pageSize < 1) {
37 34 pageSize = 10;
38 35 }