Commit 110be563bfa49e0308c238c3465df50a96692fea
1 parent
d26eb99a75
Exists in
master
and in
6 other branches
报表数据完善
Showing 4 changed files with 27 additions and 48 deletions
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/PageUtil.java
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
110be56
| ... | ... | @@ -320,7 +320,9 @@ |
| 320 | 320 | <if test="endDate != null"> |
| 321 | 321 | and a.use_date <![CDATA[ < ]]> #{endDate} |
| 322 | 322 | </if> |
| 323 | - limit #{currentPage},#{pageSize} | |
| 323 | + <if test="currentPage != null and pageSize != null"> | |
| 324 | + limit #{currentPage},#{pageSize} | |
| 325 | + </if> | |
| 324 | 326 | </select> |
| 325 | 327 | <!-- <select id="findCouponInfo" parameterType="map" resultType="map"> |
| 326 | 328 | select c.type, a.sequence_id, d.name, e.name as send_hospital, a.use_date, a.used_id, b.coupon_order |
| ... | ... | @@ -443,7 +445,9 @@ |
| 443 | 445 | <if test="endDate != null"> |
| 444 | 446 | and a.create_date <![CDATA[ < ]]> #{endDate} |
| 445 | 447 | </if> |
| 446 | - limit #{currentPage},#{pageSize} | |
| 448 | + <if test="currentPage != null and pageSize != null"> | |
| 449 | + limit #{currentPage},#{pageSize} | |
| 450 | + </if> | |
| 447 | 451 | </select> |
| 448 | 452 | |
| 449 | 453 | <select id="findUserSendInfoCount" parameterType="map" resultType="integer"> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
110be56
| ... | ... | @@ -245,7 +245,7 @@ |
| 245 | 245 | * @param request |
| 246 | 246 | * @param startDate |
| 247 | 247 | * @param endDate |
| 248 | - * @param type 1 = 孕期优惠券使用统计详情导出, 2 = 产后优惠券使用统计详情导出, 3 = 儿童优惠券使用统计详情导出 | |
| 248 | + * @param exportType 1 = 孕期优惠券使用统计详情导出, 2 = 产后优惠券使用统计详情导出, 3 = 儿童优惠券使用统计详情导出 | |
| 249 | 249 | * @param response |
| 250 | 250 | * @param provinceId |
| 251 | 251 | * @param cityId |
| 252 | 252 | |
| 253 | 253 | |
| 254 | 254 | |
| ... | ... | @@ -253,18 +253,14 @@ |
| 253 | 253 | * @param hospitalId |
| 254 | 254 | * @param tempId |
| 255 | 255 | * @param couponType |
| 256 | - * @param page | |
| 257 | - * @param limit | |
| 258 | 256 | */ |
| 259 | 257 | @ResponseBody |
| 260 | -// @TokenRequired | |
| 261 | 258 | @RequestMapping(value = "/coupon/info/export", method = RequestMethod.GET) |
| 262 | - public void couponInfoExport(HttpServletRequest request, Date startDate, Date endDate, Integer type, HttpServletResponse response, | |
| 263 | - String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType, | |
| 264 | - Integer page, Integer limit) { | |
| 259 | + public void couponInfoExport(HttpServletRequest request, HttpServletResponse response, Date startDate, Date endDate, Integer type, | |
| 260 | + String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType, Integer exportType) { | |
| 265 | 261 | Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, |
| 266 | - "endDate", endDate != null ? DateUtil.addDay(endDate, 1) : endDate, "hospitalId", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, | |
| 267 | - "tempId", tempId, "couponType", CollectionUtils.asList(couponType), "currentPage", page, "pageSize", limit); | |
| 262 | + "endDate", endDate != null ? DateUtil.addDay(endDate, 1) : endDate, "hospitalId", CollectionUtils.asList(hospitalId), "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, | |
| 263 | + "tempId", tempId, "couponType",couponType, "exportType", exportType); | |
| 268 | 264 | reportService.exportCouponInfo(param, response); |
| 269 | 265 | } |
| 270 | 266 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
110be56
| ... | ... | @@ -756,10 +756,10 @@ |
| 756 | 756 | if(patients != null) { |
| 757 | 757 | map.put("phone", patients.getPhone()); |
| 758 | 758 | |
| 759 | - String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()); | |
| 759 | + String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()) + findName(patients.getStreetRegisterId()) + findName(patients.getAddressRegister()); | |
| 760 | 760 | map.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */ |
| 761 | 761 | |
| 762 | - String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + findName(patients.getAddress()); | |
| 762 | + String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + patients.getAddress(); | |
| 763 | 763 | map.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */ |
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | |
| ... | ... | @@ -771,10 +771,10 @@ |
| 771 | 771 | map.put("phone", patients.getPhone()); |
| 772 | 772 | map.put("username", patients.getUsername()); |
| 773 | 773 | |
| 774 | - String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()); | |
| 774 | + String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()) + findName(patients.getStreetRegisterId()) + findName(patients.getAddressRegister()); | |
| 775 | 775 | map.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */ |
| 776 | 776 | |
| 777 | - String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + findName(patients.getAddress()); | |
| 777 | + String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + patients.getAddress(); | |
| 778 | 778 | map.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */ |
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
| ... | ... | @@ -795,8 +795,11 @@ |
| 795 | 795 | String username = null; /** 姓名 */ |
| 796 | 796 | String week = null; /** 产检孕周 = 产检时间 - 末次月经 */ |
| 797 | 797 | Integer number = null; /** 产检第次 */ |
| 798 | - String operatorOrgName = null; /** 产检机构 */ | |
| 799 | 798 | String phone = null; /** 联系电话 */ |
| 799 | + if(map.get("used_hospital_id") != null) { | |
| 800 | + String operatorOrgName = couponMapper.findHospitalNameById(map.get("used_hospital_id").toString()); /** 使用机构 */ | |
| 801 | + map.put("operatorOrgName", operatorOrgName); | |
| 802 | + } | |
| 800 | 803 | String doctorName = couponMapper.findUserName(operatorUserId); /** 使用医生 */ |
| 801 | 804 | if(type == 1 || type == 3) { |
| 802 | 805 | Patients patients = mongoTemplate.findById(usedId, Patients.class); |
| ... | ... | @@ -804,7 +807,6 @@ |
| 804 | 807 | checkDate = patients.getCreated(); |
| 805 | 808 | username = patients.getUsername(); |
| 806 | 809 | week = DateUtil.getWeekDesc(patients.getLastMenses(), checkDate); |
| 807 | - operatorOrgName = couponMapper.findHospitalNameById(patients.getHospitalId()); | |
| 808 | 810 | phone = patients.getPhone(); |
| 809 | 811 | } |
| 810 | 812 | } else if(type == 2) { |
| ... | ... | @@ -817,7 +819,6 @@ |
| 817 | 819 | username = findUserNameByPid(antexc.getPid()); |
| 818 | 820 | week = DateUtil.getWeekDesc(antexc.getLastMenses(), antexc.getCheckTime()); |
| 819 | 821 | // number = findNumberByList("checkTime", "pid", antexc.getPid(), antexc, AntExChuModel.class); |
| 820 | - operatorOrgName = couponMapper.findHospitalNameById(antexc.getHospitalId()); | |
| 821 | 822 | phone = findPhoneByPid(antexc.getPid()); |
| 822 | 823 | |
| 823 | 824 | id = antexc.getId();/** 处理排序 */ |
| ... | ... | @@ -854,7 +855,6 @@ |
| 854 | 855 | sortTempModels.add(new SortTempModel(antExChuModel.getId(), antExChuModel.getCheckTime())); |
| 855 | 856 | } |
| 856 | 857 | } |
| 857 | - operatorOrgName = couponMapper.findHospitalNameById(antenatal.getHospitalId()); | |
| 858 | 858 | phone = findPhoneByPid(antenatal.getPid()); |
| 859 | 859 | } |
| 860 | 860 | } |
| ... | ... | @@ -876,7 +876,6 @@ |
| 876 | 876 | /** 使用时间 - 分娩时间 */ |
| 877 | 877 | week = DateUtil.getWeekDesc(findLastMensesByPatientId(maternalDeliverModel.getParentId()), useDate); |
| 878 | 878 | username = findUserNameByPid(maternalDeliverModel.getPid()); |
| 879 | - operatorOrgName = couponMapper.findHospitalNameById(maternalDeliverModel.getHospitalId()); | |
| 880 | 879 | Patients patients = mongoTemplate.findById(maternalDeliverModel.getParentId(), Patients.class); |
| 881 | 880 | if(patients != null) { |
| 882 | 881 | phone = patients.getPhone(); |
| ... | ... | @@ -889,7 +888,6 @@ |
| 889 | 888 | if(patients != null) { |
| 890 | 889 | username = patients.getUsername(); |
| 891 | 890 | phone = patients.getPhone(); |
| 892 | - operatorOrgName = couponMapper.findHospitalNameById(patients.getHospitalId()); | |
| 893 | 891 | week = "产后" + DateUtil.getDays(patients.getFmDate(), useDate) + "天"; |
| 894 | 892 | } |
| 895 | 893 | } |
| ... | ... | @@ -898,7 +896,6 @@ |
| 898 | 896 | if(postReviewModel != null) { |
| 899 | 897 | username = findUserNameByPid(postReviewModel.getPid()); |
| 900 | 898 | phone = findPhoneByPid(postReviewModel.getPid()); |
| 901 | - operatorOrgName = couponMapper.findHospitalNameById(postReviewModel.getHospitalId()); | |
| 902 | 899 | Patients patients = mongoTemplate.findById(postReviewModel.getParentId(), Patients.class); |
| 903 | 900 | if(patients != null) { |
| 904 | 901 | week = "产后" + DateUtil.getDays(patients.getFmDate(), useDate) + "天"; |
| 905 | 902 | |
| ... | ... | @@ -909,13 +906,11 @@ |
| 909 | 906 | if(babyModel != null) { |
| 910 | 907 | username = findUserNameByPid(babyModel.getPid()); |
| 911 | 908 | phone = findPhoneByPid(babyModel.getPid()); |
| 912 | - operatorOrgName = couponMapper.findHospitalNameById(babyModel.getHospitalId()); | |
| 913 | 909 | week = DateUtil.getMonthDesc(babyModel.getBirth(), useDate); |
| 914 | 910 | } |
| 915 | 911 | } else if(type == 8) { |
| 916 | 912 | BabyCheckModel babyCheckModel = mongoTemplate.findById(usedId, BabyCheckModel.class); |
| 917 | 913 | if(babyCheckModel != null) { |
| 918 | - operatorOrgName = couponMapper.findHospitalNameById(babyCheckModel.getHospitalId()); | |
| 919 | 914 | BabyModel babyModel = mongoTemplate.findById(babyCheckModel.getBuildId(), BabyModel.class); |
| 920 | 915 | if(babyModel != null) { |
| 921 | 916 | week = DateUtil.getMonthDesc(babyModel.getBirth(), useDate); |
| ... | ... | @@ -929,7 +924,6 @@ |
| 929 | 924 | map.put("username", username); |
| 930 | 925 | map.put("week", week); |
| 931 | 926 | map.put("number", number); |
| 932 | - map.put("operatorOrgName", operatorOrgName); | |
| 933 | 927 | map.put("doctorName", doctorName); |
| 934 | 928 | map.put("phone", phone); |
| 935 | 929 | } |
| ... | ... | @@ -972,29 +966,6 @@ |
| 972 | 966 | } |
| 973 | 967 | } |
| 974 | 968 | |
| 975 | - public static void main(String[] args) { | |
| 976 | - SortTempModel temp = new SortTempModel(); | |
| 977 | - temp.setId("123"); | |
| 978 | - temp.setDate(DateUtil.parseYMD("2016-04-05")); | |
| 979 | - | |
| 980 | - SortTempModel temp2 = new SortTempModel(); | |
| 981 | - temp2.setId("456"); | |
| 982 | - temp2.setDate(DateUtil.parseYMD("2016-05-05")); | |
| 983 | - | |
| 984 | - List<SortTempModel> sortTempModels = new ArrayList<>(); | |
| 985 | - sortTempModels.add(temp2); | |
| 986 | - sortTempModels.add(temp); | |
| 987 | - System.out.println(sortTempModels); | |
| 988 | - Collections.sort(sortTempModels, new Comparator<SortTempModel>() { | |
| 989 | - @Override | |
| 990 | - public int compare(SortTempModel o1, SortTempModel o2) { | |
| 991 | - return o1.getDate().after(o2.getDate()) ? 1 : -1; | |
| 992 | - } | |
| 993 | - | |
| 994 | - }); | |
| 995 | - System.out.println(sortTempModels); | |
| 996 | - } | |
| 997 | - | |
| 998 | 969 | private String findUserNameByPid(String pid) { |
| 999 | 970 | if(StringUtils.isNotEmpty(pid)) { |
| 1000 | 971 | PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class); |
| ... | ... | @@ -1052,6 +1023,7 @@ |
| 1052 | 1023 | Map<String,Object> map = (Map<String, Object>) pageResult.getGrid(); |
| 1053 | 1024 | List<Map<String, Object>> couponInfos = (List<Map<String, Object>>) map.get("couponInfos"); |
| 1054 | 1025 | |
| 1026 | + Integer exportType = (Integer) param.get("exportType"); | |
| 1055 | 1027 | Integer type = (Integer) param.get("type"); |
| 1056 | 1028 | if(type == 1) { /** 孕期 */ |
| 1057 | 1029 | exportPregnancy(couponInfos, response); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/PageUtil.java
View file @
110be56
| ... | ... | @@ -24,6 +24,13 @@ |
| 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()); | |
| 29 | + | |
| 30 | + if(map.get("currentPage") == null || map.get("pageSize") == null) { /** 为了详情导出 不做分页 */ | |
| 31 | + return; | |
| 32 | + } | |
| 33 | + | |
| 27 | 34 | Integer pageSize = map.get("pageSize") == null ? 15 : Integer.parseInt(map.get("pageSize").toString()); |
| 28 | 35 | Integer currentPage = map.get("currentPage") == null ? 1 : Integer.parseInt(map.get("currentPage").toString()); |
| 29 | 36 | if(pageSize < 1) { |