Commit 1566c319d907bf1fa042d6d8efd5d45007183472
1 parent
06f1a99cbb
Exists in
master
and in
6 other branches
部分逻辑
Showing 7 changed files with 70 additions and 91 deletions
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java
- 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/facade/AreaCountFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.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/MongoUtil.java
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
1566c31
| ... | ... | @@ -559,6 +559,9 @@ |
| 559 | 559 | <if test="areaId != null and areaId != ''"> |
| 560 | 560 | and area_id = #{areaId} |
| 561 | 561 | </if> |
| 562 | + <if test="streetId != null and streetId != ''"> | |
| 563 | + and street_id = #{streetId} | |
| 564 | + </if> | |
| 562 | 565 | </select> |
| 563 | 566 | |
| 564 | 567 | <select id="findUnUsed" parameterType="map" resultType="map"> |
| ... | ... | @@ -695,17 +698,27 @@ |
| 695 | 698 | |
| 696 | 699 | <select id="findUserSendInfoByUids" resultType="map" parameterType="map"> |
| 697 | 700 | select a.create_hospital_id, a.user_id, a.create_date, a.send_hospital, b.name as doctoer_name from ( |
| 698 | - select distinct(a.create_hospital_id), a.user_id, DATE_FORMAT(a.create_date, '%Y-%m-%d') as create_date, d.name as send_hospital, a.create_user_id | |
| 699 | - from coupon_info a, coupon_template b, coupon_type c, organization d | |
| 700 | - where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id | |
| 701 | - and a.create_hospital_id in | |
| 702 | - <foreach collection="hid" open="(" close=")" separator="," item="hid"> | |
| 703 | - #{hid} | |
| 704 | - </foreach> | |
| 705 | - and a.user_id in | |
| 706 | - <foreach collection="uids" open="(" close=")" separator="," item="uid"> | |
| 707 | - #{uid} | |
| 708 | - </foreach> | |
| 701 | + select distinct(a.create_hospital_id), a.user_id, DATE_FORMAT(a.create_date, '%Y-%m-%d') as create_date, d.name as send_hospital, a.create_user_id | |
| 702 | + from coupon_info a, coupon_template b, coupon_type c, organization d | |
| 703 | + where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id | |
| 704 | + and a.create_hospital_id in | |
| 705 | + <foreach collection="hid" open="(" close=")" separator="," item="hid"> | |
| 706 | + #{hid} | |
| 707 | + </foreach> | |
| 708 | + and a.user_id in | |
| 709 | + <foreach collection="uids" open="(" close=")" separator="," item="uid"> | |
| 710 | + #{uid} | |
| 711 | + </foreach> | |
| 712 | + and c.type in | |
| 713 | + <foreach collection="couponType" open="(" close=")" separator="," item="type"> | |
| 714 | + #{type} | |
| 715 | + </foreach> | |
| 716 | + <if test="startDate != null"> | |
| 717 | + and a.create_date >= #{startDate} | |
| 718 | + </if> | |
| 719 | + <if test="endDate != null"> | |
| 720 | + and a.create_date <![CDATA[ < ]]> #{endDate} | |
| 721 | + </if> | |
| 709 | 722 | ) a left join users b on a.create_user_id = b.id |
| 710 | 723 | |
| 711 | 724 | <!-- select distinct(a.create_hospital_id), a.user_id, DATE_FORMAT(a.create_date, '%Y-%m-%d') as create_date, d.name as send_hospital, e.name as doctoer_name |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java
View file @
1566c31
| ... | ... | @@ -24,16 +24,10 @@ |
| 24 | 24 | @Autowired |
| 25 | 25 | private AreaCountFacade areaCountFacade; |
| 26 | 26 | |
| 27 | - /** | |
| 28 | - * flag 是否返回的是医院 | |
| 29 | - * @param name | |
| 30 | - * @param flag | |
| 31 | - * @return | |
| 32 | - */ | |
| 33 | 27 | @RequestMapping(value = "/area/childs", method = RequestMethod.GET) |
| 34 | 28 | @ResponseBody |
| 35 | - public BaseResponse getAreaChilds(@RequestParam String name, boolean flag) { | |
| 36 | - return areaCountFacade.getAreaChilds(name, flag); | |
| 29 | + public BaseResponse getAreaChilds(@RequestParam String provinceName, String cityName, String areaName) { | |
| 30 | + return areaCountFacade.getAreaChilds(provinceName, cityName, areaName); | |
| 37 | 31 | } |
| 38 | 32 | |
| 39 | 33 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
1566c31
| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | import org.springframework.stereotype.Controller; |
| 12 | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
| 13 | 13 | import org.springframework.web.bind.annotation.RequestMethod; |
| 14 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 15 | 14 | import org.springframework.web.bind.annotation.ResponseBody; |
| 16 | 15 | |
| 17 | 16 | import javax.servlet.http.HttpServletRequest; |
| 18 | 17 | |
| 19 | 18 | |
| ... | ... | @@ -32,33 +31,16 @@ |
| 32 | 31 | private IReportService reportService; |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | - * 建档统计(环比) | |
| 36 | - * @param areaType 1=省 2=市 3=区县 | |
| 37 | - * @param startDate | |
| 38 | - * @param endDate | |
| 39 | - * @param reportType 1=周 2=月 3=季度 4=半年 5=年 | |
| 40 | - * @return | |
| 41 | - */ | |
| 42 | - @ResponseBody | |
| 43 | - @TokenRequired | |
| 44 | - @RequestMapping(value = "/patient/huanbi", method = RequestMethod.GET) | |
| 45 | - public BaseObjectResponse patientHuanBi(@RequestParam Integer areaType, Date startDate, Date endDate, Integer reportType, HttpServletRequest request) { | |
| 46 | - return reportService.patientHuanBi(areaType, startDate, endDate, reportType, getUserId(request)); | |
| 47 | - } | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * 建档统计(占比) | |
| 51 | - * @param areaType 1=省 2=市 3=区县 | |
| 34 | + * 建档统计 | |
| 52 | 35 | * @param ageType 1=全部年龄 2=20岁以下 3=20-30岁 4=30-40岁 5=40岁以上 |
| 53 | - * @param areaId 乡镇ID | |
| 54 | 36 | * @param patientType 建档孕周 1=孕早期 2=孕中期 3=孕晚期 |
| 55 | 37 | * @return |
| 56 | 38 | */ |
| 57 | 39 | @ResponseBody |
| 58 | 40 | @TokenRequired |
| 59 | - @RequestMapping(value = "/patient/zhanbi", method = RequestMethod.GET) | |
| 60 | - public BaseObjectResponse patientZhanbi(@RequestParam Integer areaType, @RequestParam Integer ageType, Integer areaId, Integer patientType, HttpServletRequest request) { | |
| 61 | - return reportService.patientZhanbi(areaType, ageType, areaId, patientType, getUserId(request)); | |
| 41 | + @RequestMapping(value = "/patients", method = RequestMethod.GET) | |
| 42 | + public BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, HttpServletRequest request) { | |
| 43 | + return reportService.patients(provinceId, cityId, aredId, streetId, ageType, patientType, startDate, endDate, getUserId(request)); | |
| 62 | 44 | } |
| 63 | 45 | |
| 64 | 46 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java
View file @
1566c31
| ... | ... | @@ -840,26 +840,35 @@ |
| 840 | 840 | ResponseUtil.responseExcel(cnames,results,httpServletResponse); |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | - public BaseResponse getAreaChilds(String name, boolean flag) { | |
| 843 | + public BaseResponse getAreaChilds(String provinceName, String cityName, String areaName) { | |
| 844 | 844 | List<Map<String, Object>> childs = new ArrayList<>(); |
| 845 | - BasicConfig basic = mongoTemplate.findOne(Query.query(Criteria.where("name").is(name)), BasicConfig.class); | |
| 846 | - if(basic != null) { | |
| 847 | - if(flag) { | |
| 848 | - List<Map<String, Object>> hospitals = organizationService.getOrganizationByAreaId(basic.getId()); | |
| 849 | - childs.addAll(hospitals); | |
| 845 | + BasicConfig province = mongoTemplate.findOne(Query.query(Criteria.where("name").is(provinceName).and("typeId").is("b7ea005c-dfac-4c2a-bdae-25239b3f44fd")), BasicConfig.class); | |
| 846 | + if(province != null) { | |
| 847 | + List<BasicConfig> basicConfigs = new ArrayList<>(); | |
| 848 | + if(StringUtils.isEmpty(cityName)) { | |
| 849 | + basicConfigs = mongoTemplate.find(Query.query(Criteria.where("parentId").is(province.getId()).and("typeId").is("b7ea005c-dfac-4c2a-bdae-25239b3f44fd")), BasicConfig.class); | |
| 850 | 850 | } else { |
| 851 | - List<BasicConfig> basicConfigs = mongoTemplate.find(Query.query(Criteria.where("typeId").is("b7ea005c-dfac-4c2a-bdae-25239b3f44fd").and("parentId").is(basic.getId())), BasicConfig.class); | |
| 852 | - for (BasicConfig basicConfig : basicConfigs) { | |
| 853 | - Map<String, Object> temp = new HashMap<>(); | |
| 854 | - temp.put("id", basicConfig.getId()); | |
| 855 | - temp.put("name", basicConfig.getName()); | |
| 856 | - childs.add(temp); | |
| 851 | + BasicConfig city = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(province.getId()).and("name").is(cityName).and("typeId").is("b7ea005c-dfac-4c2a-bdae-25239b3f44fd")), BasicConfig.class); | |
| 852 | + if(city != null) { | |
| 853 | + if(StringUtils.isEmpty(areaName)) { | |
| 854 | + basicConfigs = mongoTemplate.find(Query.query(Criteria.where("parentId").is(city.getId())), BasicConfig.class); | |
| 855 | + } else { | |
| 856 | + BasicConfig area = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(city.getId()).and("name").is(areaName).and("typeId").is("b7ea005c-dfac-4c2a-bdae-25239b3f44fd")), BasicConfig.class); | |
| 857 | + if(area != null) { | |
| 858 | + basicConfigs = mongoTemplate.find(Query.query(Criteria.where("parentId").is(area.getId()).and("typeId").is("b7ea005c-dfac-4c2a-bdae-25239b3f44fd")), BasicConfig.class); | |
| 859 | + } | |
| 860 | + } | |
| 857 | 861 | } |
| 858 | 862 | } |
| 863 | + for (BasicConfig basicConfig : basicConfigs) { | |
| 864 | + Map<String, Object> temp = new HashMap<>(); | |
| 865 | + temp.put("id", basicConfig.getId()); | |
| 866 | + temp.put("name", basicConfig.getName()); | |
| 867 | + childs.add(temp); | |
| 868 | + } | |
| 859 | 869 | } |
| 860 | 870 | return RespBuilder.buildSuccess(childs); |
| 861 | 871 | } |
| 862 | - | |
| 863 | 872 | |
| 864 | 873 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
View file @
1566c31
| ... | ... | @@ -98,8 +98,6 @@ |
| 98 | 98 | |
| 99 | 99 | BaseObjectResponse unUsedPeopleInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId); |
| 100 | 100 | |
| 101 | - BaseObjectResponse patientHuanBi(Integer areaType, Date startDate, Date endDate, Integer reportType, Integer userId); | |
| 102 | - | |
| 103 | - BaseObjectResponse patientZhanbi(Integer areaType, Integer ageType, Integer areaId, Integer patientType, Integer userId); | |
| 101 | + BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId); | |
| 104 | 102 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
1566c31
| ... | ... | @@ -178,12 +178,9 @@ |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | @Override |
| 181 | - public BaseObjectResponse patientHuanBi(Integer areaType, Date startDate, Date endDate, Integer reportType, Integer userId) { | |
| 182 | - return null; | |
| 183 | - } | |
| 181 | + public BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId) { | |
| 182 | + List<String> hospitals = mongoUtil.getHospitals(userId, provinceId, cityId, aredId, streetId); | |
| 184 | 183 | |
| 185 | - @Override | |
| 186 | - public BaseObjectResponse patientZhanbi(Integer areaType, Integer ageType, Integer areaId, Integer patientType, Integer userId) { | |
| 187 | 184 | return null; |
| 188 | 185 | } |
| 189 | 186 | |
| ... | ... | @@ -908,35 +905,6 @@ |
| 908 | 905 | return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); |
| 909 | 906 | } |
| 910 | 907 | |
| 911 | - /** | |
| 912 | - * 过滤掉全部优惠券所对应的项目都没做的userid | |
| 913 | - * @param userIds | |
| 914 | - */ | |
| 915 | - /*private void doFilter(List<String> userIds, String hospitalId) { | |
| 916 | - if(CollectionUtils.isNotEmpty(userIds) && StringUtils.isNotEmpty(hospitalId)) { | |
| 917 | - List<Map<String, Object>> lists = couponMapper.findUserTypeInfo(CollectionUtils.createMap("userIds", userIds, "hospitalId", hospitalId)); | |
| 918 | - if(CollectionUtils.isNotEmpty(lists)) { | |
| 919 | - // key = user_id, value = isRemove 默认true | |
| 920 | - Map<String, Boolean> temp = new HashMap<>(); | |
| 921 | - for (String userId : userIds) { | |
| 922 | - temp.put(userId, true); | |
| 923 | - } | |
| 924 | - for (Map<String, Object> map : lists) { | |
| 925 | - Integer type = (Integer) map.get("type"); | |
| 926 | - String userId = (String) map.get("user_id"); | |
| 927 | - String checkTime = getCheckTime(type, userId, (Date) map.get("create_date"), patientId); | |
| 928 | - if(!"".equals(checkTime)) { // 找到对应信息 | |
| 929 | - temp.put(userId, false); | |
| 930 | - } | |
| 931 | - } | |
| 932 | - for (Map.Entry<String, Boolean> entry : temp.entrySet()) { | |
| 933 | - if(entry.getValue()) { | |
| 934 | - userIds.remove(entry.getKey()); | |
| 935 | - } | |
| 936 | - } | |
| 937 | - } | |
| 938 | - } | |
| 939 | - }*/ | |
| 940 | 908 | |
| 941 | 909 | |
| 942 | 910 | @Override |
| ... | ... | @@ -1499,6 +1467,7 @@ |
| 1499 | 1467 | Integer count = userIds.size(); |
| 1500 | 1468 | List<String> ids = CollectionUtils.getPageIds(userIds, (Integer) param.get("currentPage2"), (Integer) param.get("pageSize2")); |
| 1501 | 1469 | Map<String, Object> param2 = new HashMap<>(); |
| 1470 | + param2.putAll(param); | |
| 1502 | 1471 | param2.put("hid", param.get("hospitalId")); |
| 1503 | 1472 | param2.put("uids", ids); |
| 1504 | 1473 | List<Map<String,Object>> userSendInfo = couponMapper.findUserSendInfoByUids(param2); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
1566c31
| ... | ... | @@ -4,8 +4,10 @@ |
| 4 | 4 | import com.lyms.platform.common.enums.RiskDefaultTypeEnum; |
| 5 | 5 | import com.lyms.platform.common.utils.DateUtil; |
| 6 | 6 | import com.lyms.platform.common.utils.StringUtils; |
| 7 | +import com.lyms.platform.operate.web.facade.AccessPermissionFacade; | |
| 7 | 8 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 8 | 9 | import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; |
| 10 | +import com.lyms.platform.permission.dao.master.CouponMapper; | |
| 9 | 11 | import com.lyms.platform.pojo.BabyModel; |
| 10 | 12 | import com.lyms.platform.pojo.BasicConfig; |
| 11 | 13 | import com.lyms.platform.pojo.Patients; |
| 12 | 14 | |
| ... | ... | @@ -38,10 +40,22 @@ |
| 38 | 40 | AutoMatchFacade autoMatchFacade; |
| 39 | 41 | |
| 40 | 42 | @Autowired |
| 43 | + private AccessPermissionFacade accessPermissionFacade; | |
| 44 | + | |
| 45 | + @Autowired | |
| 41 | 46 | private BabyBookbuildingService babyBookbuildingService; |
| 42 | 47 | |
| 43 | 48 | @Autowired |
| 44 | 49 | private OrganizationGroupsFacade organizationGroupsFacade; |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + private CouponMapper couponMapper; | |
| 53 | + | |
| 54 | + public List<String> getHospitals(Integer userId, String provinceId, String cityId, String areaId, String streetId) { | |
| 55 | + List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId); | |
| 56 | + List<Map<String, Object>> hospitals= couponMapper.findHospitalInfoByIds2(CollectionUtils.createMap("list", hospitalIds, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "streetId", streetId)); | |
| 57 | + return null; | |
| 58 | + } | |
| 45 | 59 | |
| 46 | 60 | public List<Map<String, Object>> getListByParentId(String id) { |
| 47 | 61 | List<Map<String, Object>> list = new ArrayList<>(); |