Commit c8c6ee5ae53e219a659f91302a6364ffc11b56ad
1 parent
b893755d51
Exists in
master
and in
6 other branches
导出
Showing 2 changed files with 115 additions and 19 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
c8c6ee5
| ... | ... | @@ -255,11 +255,12 @@ |
| 255 | 255 | * @param couponType |
| 256 | 256 | */ |
| 257 | 257 | @ResponseBody |
| 258 | + @TokenRequired | |
| 258 | 259 | @RequestMapping(value = "/coupon/info/export", method = RequestMethod.GET) |
| 259 | 260 | public void couponInfoExport(HttpServletRequest request, HttpServletResponse response, Date startDate, Date endDate, Integer type, |
| 260 | 261 | String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType, Integer exportType) { |
| 261 | - Map<String, Object> param = CollectionUtils.createMap("userId", "1000000185", "startDate", startDate, | |
| 262 | -// Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, | |
| 262 | +// Map<String, Object> param = CollectionUtils.createMap("userId", "1000000185", "startDate", startDate, | |
| 263 | + Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, | |
| 263 | 264 | "endDate", endDate != null ? DateUtil.addDay(endDate, 1) : endDate, "hospitalId", CollectionUtils.asList(hospitalId), "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, |
| 264 | 265 | "tempId", tempId, "couponType",couponType, "exportType", exportType); |
| 265 | 266 | reportService.exportCouponInfo(param, response); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
c8c6ee5
| ... | ... | @@ -1040,21 +1040,88 @@ |
| 1040 | 1040 | Integer type = (Integer) param.get("type"); |
| 1041 | 1041 | if(exportType == 1 && type == 1) { /** 孕期发放人数 */ |
| 1042 | 1042 | exportPregnancy(userSendInfos, response); |
| 1043 | - } else if(exportType == 1 && type == 1) { /** 孕期使用券数 */ | |
| 1043 | + } else if(exportType == 1 && type == 3) { /** 孕期使用券数 */ | |
| 1044 | 1044 | exportPregnancyUsedInfo(couponInfos, response); |
| 1045 | - }else if(exportType == 2 && type == 1) { /** 产后和儿童类似 */ | |
| 1045 | + } else if(exportType == 2 && type == 1) { /** 产后发放统计 */ | |
| 1046 | + exportPostpartumSendInfo(userSendInfos, response); | |
| 1047 | + } else if(exportType == 2 && type == 3) { /** 产后使用 */ | |
| 1048 | + exportPostpartumUsedInfo(userSendInfos, response); | |
| 1049 | + } else if(exportType == 3 && type == 1) {/** 儿童发放 */ | |
| 1050 | + exportChildSendInfo(userSendInfos, response); | |
| 1051 | + } else if(exportType == 3 && type == 3) {/** 儿童使用 */ | |
| 1052 | + exportChildUsedInfo(userSendInfos, response); | |
| 1053 | + } | |
| 1046 | 1054 | |
| 1055 | + } | |
| 1056 | + | |
| 1057 | + private void exportChildUsedInfo(List<Map<String, Object>> data, HttpServletResponse response) { | |
| 1058 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
| 1059 | + cnames.put("id", "#"); | |
| 1060 | + cnames.put("use_date", "使用日期"); | |
| 1061 | + cnames.put("username", "姓名"); | |
| 1062 | + cnames.put("week", "使用时间"); | |
| 1063 | + cnames.put("type_desc", "优惠券"); | |
| 1064 | + cnames.put("sequence_id", "优惠券号"); | |
| 1065 | + cnames.put("operatorOrgName", "使用机构"); | |
| 1066 | + cnames.put("doctorName", "使用医生"); | |
| 1067 | + cnames.put("send_hospital", "优惠券发放机构"); | |
| 1068 | + cnames.put("phone", "联系电话"); | |
| 1069 | + | |
| 1070 | + List<Map<String,Object>> results = new ArrayList<>(); | |
| 1071 | + int i = 0; | |
| 1072 | + for (Map<String, Object> m : data) { | |
| 1073 | + Map<String, Object> result = new LinkedHashMap<>(); | |
| 1074 | + result.put("id", ++i); | |
| 1075 | + result.put("phone", m.get("phone")); | |
| 1076 | + result.put("username", m.get("username")); | |
| 1077 | + result.put("week", m.get("week")); | |
| 1078 | + result.put("type_desc", m.get("type_desc")); | |
| 1079 | + result.put("sequence_id", m.get("sequence_id")); | |
| 1080 | + result.put("operatorOrgName", m.get("operatorOrgName")); | |
| 1081 | + result.put("doctorName", m.get("doctorName")); | |
| 1082 | + result.put("send_hospital", m.get("send_hospital")); | |
| 1083 | + result.put("phone", m.get("phone")); | |
| 1084 | + results.add(result); | |
| 1047 | 1085 | } |
| 1086 | + ResponseUtil.responseExcel(cnames, results, response); | |
| 1087 | + } | |
| 1048 | 1088 | |
| 1089 | + private void exportChildSendInfo(List<Map<String, Object>> data, HttpServletResponse response) { | |
| 1090 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
| 1091 | + cnames.put("id", "#"); | |
| 1092 | + cnames.put("create_date", "发放日期"); | |
| 1093 | + cnames.put("username", "姓名"); | |
| 1094 | + cnames.put("send_hospital", "发放机构"); | |
| 1095 | + cnames.put("doctoer_name", "发放医生"); | |
| 1096 | + cnames.put("residenceAddress", "居住地"); | |
| 1097 | + cnames.put("householdAddress", "户籍地"); | |
| 1098 | + cnames.put("phone", "联系电话"); | |
| 1099 | + | |
| 1100 | + List<Map<String,Object>> results = new ArrayList<>(); | |
| 1101 | + int i = 0; | |
| 1102 | + for (Map<String, Object> m : data) { | |
| 1103 | + Map<String, Object> result = new LinkedHashMap<>(); | |
| 1104 | + result.put("id", ++i); | |
| 1105 | + result.put("create_date", m.get("create_date")); | |
| 1106 | + result.put("username", m.get("username")); | |
| 1107 | + result.put("send_hospital", m.get("send_hospital")); | |
| 1108 | + result.put("doctoer_name", m.get("doctoer_name")); | |
| 1109 | + result.put("residenceAddress", m.get("residenceAddress")); | |
| 1110 | + result.put("householdAddress", m.get("householdAddress")); | |
| 1111 | + result.put("phone", m.get("phone")); | |
| 1112 | + results.add(result); | |
| 1113 | + } | |
| 1114 | + ResponseUtil.responseExcel(cnames, results, response); | |
| 1049 | 1115 | } |
| 1050 | 1116 | |
| 1051 | - private void exportPregnancyUsedInfo(List<Map<String, Object>> data, HttpServletResponse response) { | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + private void exportPostpartumUsedInfo(List<Map<String, Object>> data, HttpServletResponse response) { | |
| 1052 | 1120 | Map<String, String> cnames = new LinkedHashMap<>(); |
| 1053 | 1121 | cnames.put("id", "#"); |
| 1054 | 1122 | cnames.put("use_date", "使用日期"); |
| 1055 | 1123 | cnames.put("username", "姓名"); |
| 1056 | - cnames.put("week", "使用孕周"); | |
| 1057 | - cnames.put("number", "产检第次"); | |
| 1124 | + cnames.put("week", "使用时间"); | |
| 1058 | 1125 | cnames.put("type_desc", "优惠券"); |
| 1059 | 1126 | cnames.put("sequence_id", "优惠券号"); |
| 1060 | 1127 | cnames.put("operatorOrgName", "使用机构"); |
| 1061 | 1128 | |
| ... | ... | @@ -1067,10 +1134,9 @@ |
| 1067 | 1134 | for (Map<String, Object> m : data) { |
| 1068 | 1135 | Map<String, Object> result = new LinkedHashMap<>(); |
| 1069 | 1136 | result.put("id", ++i); |
| 1070 | - result.put("use_date", m.get("use_date")); | |
| 1137 | + result.put("phone", m.get("phone")); | |
| 1071 | 1138 | result.put("username", m.get("username")); |
| 1072 | 1139 | result.put("week", m.get("week")); |
| 1073 | - result.put("number", m.get("number")); | |
| 1074 | 1140 | result.put("type_desc", m.get("type_desc")); |
| 1075 | 1141 | result.put("sequence_id", m.get("sequence_id")); |
| 1076 | 1142 | result.put("operatorOrgName", m.get("operatorOrgName")); |
| 1077 | 1143 | |
| 1078 | 1144 | |
| ... | ... | @@ -1082,14 +1148,42 @@ |
| 1082 | 1148 | ResponseUtil.responseExcel(cnames, results, response); |
| 1083 | 1149 | } |
| 1084 | 1150 | |
| 1085 | - private void exportPostpartum(List<Map<String, Object>> couponInfos, HttpServletResponse response) { | |
| 1151 | + private void exportPostpartumSendInfo(List<Map<String, Object>> data, HttpServletResponse response) { | |
| 1086 | 1152 | Map<String, String> cnames = new LinkedHashMap<>(); |
| 1087 | 1153 | cnames.put("id", "#"); |
| 1088 | - cnames.put("checkDate", "产检日期"); | |
| 1154 | + cnames.put("create_date", "发放日期"); | |
| 1089 | 1155 | cnames.put("username", "姓名"); |
| 1090 | - cnames.put("use_day", "使用时间"); | |
| 1091 | - cnames.put("type", "产检券类型"); | |
| 1092 | - cnames.put("coupon_desc", "优惠券"); | |
| 1156 | + cnames.put("send_hospital", "发放机构"); | |
| 1157 | + cnames.put("doctoer_name", "发放医生"); | |
| 1158 | + cnames.put("residenceAddress", "居住地"); | |
| 1159 | + cnames.put("householdAddress", "户籍地"); | |
| 1160 | + cnames.put("phone", "联系电话"); | |
| 1161 | + | |
| 1162 | + List<Map<String,Object>> results = new ArrayList<>(); | |
| 1163 | + int i = 0; | |
| 1164 | + for (Map<String, Object> m : data) { | |
| 1165 | + Map<String, Object> result = new LinkedHashMap<>(); | |
| 1166 | + result.put("id", ++i); | |
| 1167 | + result.put("create_date", m.get("create_date")); | |
| 1168 | + result.put("username", m.get("username")); | |
| 1169 | + result.put("send_hospital", m.get("send_hospital")); | |
| 1170 | + result.put("doctoer_name", m.get("doctoer_name")); | |
| 1171 | + result.put("residenceAddress", m.get("residenceAddress")); | |
| 1172 | + result.put("householdAddress", m.get("householdAddress")); | |
| 1173 | + result.put("phone", m.get("phone")); | |
| 1174 | + results.add(result); | |
| 1175 | + } | |
| 1176 | + ResponseUtil.responseExcel(cnames, results, response); | |
| 1177 | + } | |
| 1178 | + | |
| 1179 | + private void exportPregnancyUsedInfo(List<Map<String, Object>> data, HttpServletResponse response) { | |
| 1180 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
| 1181 | + cnames.put("id", "#"); | |
| 1182 | + cnames.put("use_date", "使用日期"); | |
| 1183 | + cnames.put("username", "姓名"); | |
| 1184 | + cnames.put("week", "使用孕周"); | |
| 1185 | + cnames.put("number", "产检第次"); | |
| 1186 | + cnames.put("type_desc", "优惠券"); | |
| 1093 | 1187 | cnames.put("sequence_id", "优惠券号"); |
| 1094 | 1188 | cnames.put("operatorOrgName", "使用机构"); |
| 1095 | 1189 | cnames.put("doctorName", "使用医生"); |
| 1096 | 1190 | |
| 1097 | 1191 | |
| ... | ... | @@ -1098,14 +1192,14 @@ |
| 1098 | 1192 | |
| 1099 | 1193 | List<Map<String,Object>> results = new ArrayList<>(); |
| 1100 | 1194 | int i = 0; |
| 1101 | - for (Map<String, Object> m : couponInfos) { | |
| 1195 | + for (Map<String, Object> m : data) { | |
| 1102 | 1196 | Map<String, Object> result = new LinkedHashMap<>(); |
| 1103 | 1197 | result.put("id", ++i); |
| 1104 | - result.put("checkDate", DateUtil.getyyyy_MM_dd((Date) m.get("checkDate"))); | |
| 1198 | + result.put("use_date", m.get("use_date")); | |
| 1105 | 1199 | result.put("username", m.get("username")); |
| 1106 | - result.put("use_day", m.get("use_day")); | |
| 1107 | - result.put("type", couponDescMap.get(m.get("type"))); | |
| 1108 | - result.put("coupon_desc", couponReportMap.get(m.get("type") + "_" + m.get("coupon_order"))); | |
| 1200 | + result.put("week", m.get("week")); | |
| 1201 | + result.put("number", m.get("number")); | |
| 1202 | + result.put("type_desc", m.get("type_desc")); | |
| 1109 | 1203 | result.put("sequence_id", m.get("sequence_id")); |
| 1110 | 1204 | result.put("operatorOrgName", m.get("operatorOrgName")); |
| 1111 | 1205 | result.put("doctorName", m.get("doctorName")); |
| ... | ... | @@ -1115,6 +1209,7 @@ |
| 1115 | 1209 | } |
| 1116 | 1210 | ResponseUtil.responseExcel(cnames, results, response); |
| 1117 | 1211 | } |
| 1212 | + | |
| 1118 | 1213 | |
| 1119 | 1214 | private void exportPregnancy(List<Map<String, Object>> userSendInfos, HttpServletResponse response) { |
| 1120 | 1215 | Map<String, String> cnames = new LinkedHashMap<>(); |