Commit 6b2a2e2390682d3e16f85f49e2dfe240cd4096de
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 14 changed files
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-common/src/main/java/com/lyms/platform/common/result/PageResult.java
- platform-dal/src/main/java/com/lyms/platform/pojo/OperateLogModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisCrisisItemController.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/ApplyOrderFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/OperateLogFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostReviewFacade.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/CollectionUtils.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
View file @
6b2a2e2
... | ... | @@ -102,5 +102,9 @@ |
102 | 102 | Map<String,Object> findHospitalInfoById(String hospitalId); |
103 | 103 | |
104 | 104 | List<Map<String,Object>> findHospitalInfoByIds(List<String> hospitalIds); |
105 | + | |
106 | + List<Map<String,Object>> findUnUsedInfo(Map<String, Object> param); | |
107 | + | |
108 | + Integer findUnUsedInfoCount(Map<String, Object> param); | |
105 | 109 | } |
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
6b2a2e2
... | ... | @@ -532,5 +532,56 @@ |
532 | 532 | </foreach> and yn = 1 |
533 | 533 | </select> |
534 | 534 | |
535 | + <select id="findUnUsedInfo" parameterType="map" resultType="map"> | |
536 | + select count(distinct(user_id)) as un_used_people, count(1) as un_used_coupon_count, b.province_id, b.city_id, b.area_id | |
537 | + from coupon_info a, organization b | |
538 | + where a.create_hospital_id = b.id and a.status = 1 and a.create_hospital_id in | |
539 | + <foreach collection="hospitalIds" open="(" close=")" separator="," item="hid"> | |
540 | + #{hid} | |
541 | + </foreach> | |
542 | + and user_id in | |
543 | + <foreach collection="userIds" open="(" close=")" separator="," item="uid"> | |
544 | + #{uid} | |
545 | + </foreach> | |
546 | + <if test="provinceId != null and provinceId != ''"> | |
547 | + and b.province_id = #{provinceId} | |
548 | + </if> | |
549 | + <if test="cityId != null and cityId != '' "> | |
550 | + and b.city_id = #{cityId} | |
551 | + </if> | |
552 | + <if test="areaId != null and areaId != ''"> | |
553 | + and b.area_id = #{areaId} | |
554 | + </if> | |
555 | + group by a.create_hospital_id | |
556 | + <if test="page != null and limit != null"> | |
557 | + limit #{page}, #{limit} | |
558 | + </if> | |
559 | + </select> | |
560 | + | |
561 | + <select id="findUnUsedInfoCount" parameterType="map" resultType="integer"> | |
562 | + select count(1) from ( | |
563 | + select count(distinct(user_id)) as un_used_people, count(1) as un_used_coupon_count, b.province_id, b.city_id, b.area_id | |
564 | + from coupon_info a, organization b | |
565 | + where a.create_hospital_id = b.id and a.status = 1 and a.create_hospital_id in | |
566 | + <foreach collection="hospitalIds" open="(" close=")" separator="," item="hid"> | |
567 | + #{hid} | |
568 | + </foreach> | |
569 | + and user_id in | |
570 | + <foreach collection="userIds" open="(" close=")" separator="," item="uid"> | |
571 | + #{uid} | |
572 | + </foreach> | |
573 | + <if test="provinceId != null and provinceId != ''"> | |
574 | + and b.province_id = #{provinceId} | |
575 | + </if> | |
576 | + <if test="cityId != null and cityId != '' "> | |
577 | + and b.city_id = #{cityId} | |
578 | + </if> | |
579 | + <if test="areaId != null and areaId != ''"> | |
580 | + and b.area_id = #{areaId} | |
581 | + </if> | |
582 | + group by a.create_hospital_id | |
583 | + ) a | |
584 | + </select> | |
585 | + | |
535 | 586 | </mapper> |
platform-common/src/main/java/com/lyms/platform/common/result/PageResult.java
View file @
6b2a2e2
... | ... | @@ -18,8 +18,8 @@ |
18 | 18 | public PageResult(Integer count, Integer page, Integer limit, |
19 | 19 | Object rows) { |
20 | 20 | this.count = count; |
21 | - this.page = page; | |
22 | - this.limit = limit; | |
21 | + this.page = page == null ? 1 : page;; | |
22 | + this.limit = limit == null ? 15 : limit; | |
23 | 23 | this.grid = rows; |
24 | 24 | // this.page = ((count - 1)/this.limit) + 1; |
25 | 25 | this.lastPage = ((count - 1)/this.limit) + 1; |
platform-dal/src/main/java/com/lyms/platform/pojo/OperateLogModel.java
View file @
6b2a2e2
... | ... | @@ -49,6 +49,16 @@ |
49 | 49 | |
50 | 50 | private String modifyContent; |
51 | 51 | |
52 | + private String _class; | |
53 | + | |
54 | + public String get_class() { | |
55 | + return _class; | |
56 | + } | |
57 | + | |
58 | + public void set_class(String _class) { | |
59 | + this._class = _class; | |
60 | + } | |
61 | + | |
52 | 62 | public String getModifyContent() { |
53 | 63 | return modifyContent; |
54 | 64 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisCrisisItemController.java
View file @
6b2a2e2
... | ... | @@ -125,8 +125,27 @@ |
125 | 125 | map.put("emergenceId", data.getId()); |
126 | 126 | map.put("hospitalId", data.getHospitalId()); |
127 | 127 | content.put("type", data.getItemName()); |
128 | - content.put("ref", data.getRef() + " " + data.getUnit()); | |
129 | - content.put("real", data.getResult() + " " + data.getUnit()); | |
128 | + String ref = ""; | |
129 | + if (data.getRef() != null && data.getUnit() != null) | |
130 | + { | |
131 | + ref = data.getRef() + " " + data.getUnit(); | |
132 | + } | |
133 | + else if (data.getRef() != null) | |
134 | + { | |
135 | + ref = data.getRef(); | |
136 | + } | |
137 | + content.put("ref", ref); | |
138 | + | |
139 | + String real = ""; | |
140 | + if (data.getResult() != null && data.getUnit() != null) | |
141 | + { | |
142 | + real = data.getResult() + " " + data.getUnit(); | |
143 | + } | |
144 | + else if (data.getResult() != null) | |
145 | + { | |
146 | + real = data.getResult(); | |
147 | + } | |
148 | + content.put("real", real); | |
130 | 149 | map.put("content", JsonUtil.obj2JsonString(content)); |
131 | 150 | map.put("applyDoctorCode", data.getApplyDoctorCode()); |
132 | 151 | map.put("applyDoctorName", data.getApplyDoctorName()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
6b2a2e2
... | ... | @@ -33,11 +33,61 @@ |
33 | 33 | /** |
34 | 34 | * 未发放优惠券统计 |
35 | 35 | */ |
36 | - @RequestMapping(value = "/coupon/unSend", method = RequestMethod.POST) | |
36 | + @RequestMapping(value = "/coupon/unSend", method = RequestMethod.GET) | |
37 | 37 | @ResponseBody |
38 | 38 | @TokenRequired |
39 | - public BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, HttpServletRequest request) { | |
40 | - return reportService.unSend(startDate, endDate, provinceId, cityId, areaId, hospitalId, getUserId(request)); | |
39 | + public BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, HttpServletRequest request) { | |
40 | + return reportService.unSend(startDate, endDate, provinceId, cityId, areaId, hospitalId, page, limit, getUserId(request)); | |
41 | + } | |
42 | + | |
43 | + /** | |
44 | + * 未发放优惠券统计导出 | |
45 | + */ | |
46 | + @RequestMapping(value = "/coupon/unSend/export", method = RequestMethod.GET) | |
47 | + @ResponseBody | |
48 | + @TokenRequired | |
49 | + public void unSendExport(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, HttpServletRequest request, HttpServletResponse response) { | |
50 | + reportService.unSendExport(startDate, endDate, provinceId, cityId, areaId, hospitalId, getUserId(request), response); | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * 未发放优惠券统计详情 | |
55 | + */ | |
56 | + @RequestMapping(value = "/coupon/unSend/info", method = RequestMethod.GET) | |
57 | + @ResponseBody | |
58 | + @TokenRequired | |
59 | + public BaseObjectResponse unSendInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, HttpServletRequest request) { | |
60 | + return reportService.unSendInfo(startDate, endDate, provinceId, cityId, areaId, hospitalId, page, limit, getUserId(request)); | |
61 | + } | |
62 | + | |
63 | + /** | |
64 | + * 未使用优惠券统计 | |
65 | + */ | |
66 | + @RequestMapping(value = "/coupon/unUsed", method = RequestMethod.GET) | |
67 | + @ResponseBody | |
68 | + @TokenRequired | |
69 | + public BaseObjectResponse unUsed(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, HttpServletRequest request) { | |
70 | + return reportService.unUsed(startDate, endDate, provinceId, cityId, areaId, hospitalId, page, limit, getUserId(request)); | |
71 | + } | |
72 | + | |
73 | + /** | |
74 | + * 未使用优惠券统计导出 | |
75 | + */ | |
76 | + @RequestMapping(value = "/coupon/unUsed/export", method = RequestMethod.GET) | |
77 | + @ResponseBody | |
78 | + @TokenRequired | |
79 | + public void unUsedExport(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, HttpServletRequest request, HttpServletResponse response) { | |
80 | + reportService.unSendExport(startDate, endDate, provinceId, cityId, areaId, hospitalId, getUserId(request), response); | |
81 | + } | |
82 | + | |
83 | + /** | |
84 | + * 未使用优惠券统计详情 | |
85 | + */ | |
86 | + @RequestMapping(value = "/coupon/unUsed/info", method = RequestMethod.GET) | |
87 | + @ResponseBody | |
88 | + @TokenRequired | |
89 | + public BaseObjectResponse unUsedInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, HttpServletRequest request) { | |
90 | + return reportService.unUsedInfo(startDate, endDate, provinceId, cityId, areaId, hospitalId, page, limit, getUserId(request)); | |
41 | 91 | } |
42 | 92 | |
43 | 93 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ApplyOrderFacade.java
View file @
6b2a2e2
... | ... | @@ -68,6 +68,9 @@ |
68 | 68 | @Autowired |
69 | 69 | private OrganizationGroupsFacade groupsFacade; |
70 | 70 | |
71 | + @Autowired | |
72 | + private OperateLogFacade operateLogFacade; | |
73 | + | |
71 | 74 | /** |
72 | 75 | * 增加转诊申请 |
73 | 76 | * |
... | ... | @@ -182,6 +185,8 @@ |
182 | 185 | patients.setExpVip(0); |
183 | 186 | patients.setEnable("0"); |
184 | 187 | id = patientsService.addPatient(patients).getId(); |
188 | + | |
189 | + operateLogFacade.addAddOptLog(userId,Integer.parseInt(hospital),patients,OptActionEnums.ADD.getId(),"添加孕妇转诊"); | |
185 | 190 | } else { |
186 | 191 | Patients patients1 = patientsList.get(0); |
187 | 192 | id = patients1.getId(); |
... | ... | @@ -257,6 +262,8 @@ |
257 | 262 | babyModel.setBuildType(3); |
258 | 263 | babyModel.setEnable("0"); |
259 | 264 | id = babyService.addOneBaby(babyModel).getId(); |
265 | + | |
266 | + operateLogFacade.addAddOptLog(userId,Integer.parseInt(hospital),babyModel,OptActionEnums.ADD.getId(),"添加儿童转诊"); | |
260 | 267 | } else { |
261 | 268 | BabyModel babyModel1 = babyModels.get(0); |
262 | 269 | id = babyModel1.getId(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
6b2a2e2
... | ... | @@ -649,6 +649,7 @@ |
649 | 649 | base.setSex(model.getSex()); |
650 | 650 | base.setName(model.getName()); |
651 | 651 | base.setCardNo(model.getMcertNo()); |
652 | + base.setPregnantCertificateTypeId(model.getMcertTypeId()); | |
652 | 653 | base.setMonthAge(DateUtil.getBabyMonthAge(model.getBirth(), new Date())); |
653 | 654 | base.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirth())); |
654 | 655 | base.setSourceId(org.apache.commons.lang.StringUtils.isNotEmpty(model.getSource())?model.getSource():model.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/OperateLogFacade.java
View file @
6b2a2e2
... | ... | @@ -54,7 +54,6 @@ |
54 | 54 | String operateRemark) |
55 | 55 | { |
56 | 56 | OperateLogModel model = new OperateLogModel(); |
57 | - | |
58 | 57 | UsersQuery usersQuery = new UsersQuery(); |
59 | 58 | usersQuery.setId(userId); |
60 | 59 | List<Users> list = usersService.queryUsers(usersQuery); |
61 | 60 | |
... | ... | @@ -67,13 +66,14 @@ |
67 | 66 | } |
68 | 67 | |
69 | 68 | model.setOperateAction(operateAction); |
69 | + model.set_class(operateBeforeContent.getClass().getName()); | |
70 | 70 | model.setOperateBeforeContent(JsonUtil.obj2Str(operateBeforeContent)); |
71 | 71 | model.setOperateAfterContent(JsonUtil.obj2Str(operateAfterContent)); |
72 | 72 | model.setOperateRemark(operateRemark); |
73 | 73 | |
74 | 74 | if (operateAfterContent != null && operateBeforeContent != null) |
75 | 75 | { |
76 | - String json = JsonUtil.obj2Str(getChangeItems(operateAfterContent, operateBeforeContent)); | |
76 | + String json = JsonUtil.obj2Str(getChangeItems(operateBeforeContent,operateAfterContent)); | |
77 | 77 | System.out.print(json); |
78 | 78 | model.setModifyContent(json); |
79 | 79 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
6b2a2e2
... | ... | @@ -41,8 +41,6 @@ |
41 | 41 | import java.io.OutputStream; |
42 | 42 | import java.util.*; |
43 | 43 | import java.util.concurrent.Future; |
44 | -import java.util.concurrent.LinkedBlockingQueue; | |
45 | -import java.util.concurrent.ThreadPoolExecutor; | |
46 | 44 | import java.util.concurrent.TimeUnit; |
47 | 45 | |
48 | 46 | /** |
... | ... | @@ -827,7 +825,7 @@ |
827 | 825 | List<Map<String, Object>> datas = new ArrayList<>(); |
828 | 826 | Map<String, String> cnames = new LinkedHashMap<>(); |
829 | 827 | if (patientsQueryRequest.getQueryType() != null) { |
830 | - // 0 高危孕妇 1 全部孕妇 2全部产妇 | |
828 | + // 0 高危孕妇 1 全部孕妇 2全部产妇 3产后孕妇统计导出 | |
831 | 829 | if (patientsQueryRequest.getQueryType() == 0) { |
832 | 830 | listResponse = (BaseListResponse) queryHighRisk(patientsQueryRequest, Boolean.TRUE, 1, userId, null, Boolean.FALSE); |
833 | 831 | List list = listResponse.getData(); |
... | ... | @@ -932,6 +930,30 @@ |
932 | 930 | cnames.put("lName", "登记人"); |
933 | 931 | cnames.put("serviceType", "服务类型"); |
934 | 932 | cnames.put("serviceStatus", "服务状态"); |
933 | + }else if(patientsQueryRequest.getQueryType() == 3){ | |
934 | + listResponse = (BaseListResponse) queryHighRisk(patientsQueryRequest, null, 3, userId, null, Boolean.FALSE); | |
935 | + List list = listResponse.getData(); | |
936 | + for (Object obj : list) { | |
937 | + Map<String, Object> data = new HashMap<>(); | |
938 | + QuanChanResult rp = (QuanChanResult) obj; | |
939 | + data.put("name", rp.getName()); | |
940 | + data.put("realPhone", rp.getRealPhone()); | |
941 | + data.put("cTime", rp.getcTime()); | |
942 | + data.put("dueWeek", rp.getDueWeek()); | |
943 | + data.put("fCh", rp.getfCh()); | |
944 | + data.put("addr", rp.getAddr()); | |
945 | + data.put("street", rp.getStreet()); | |
946 | + data.put("registerAddr", rp.getRegisterAddr()); | |
947 | + datas.add(data); | |
948 | + } | |
949 | + cnames.put("name", "姓名"); | |
950 | + cnames.put("realPhone", "分娩年龄"); | |
951 | + cnames.put("cTime", "产后天数"); | |
952 | + cnames.put("dueWeek", "分娩日期"); | |
953 | + cnames.put("fCh", "分娩医院"); | |
954 | + cnames.put("addr", "居住地"); | |
955 | + cnames.put("street", "乡镇/街道名称"); | |
956 | + cnames.put("registerAddr", "户籍地"); | |
935 | 957 | } |
936 | 958 | } |
937 | 959 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostReviewFacade.java
View file @
6b2a2e2
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
5 | +import com.lyms.platform.common.enums.OptActionEnums; | |
5 | 6 | import com.lyms.platform.common.enums.ServiceStatusEnums; |
6 | 7 | import com.lyms.platform.common.enums.ServiceTypeEnums; |
7 | 8 | import com.lyms.platform.common.enums.YnEnums; |
... | ... | @@ -67,6 +68,9 @@ |
67 | 68 | @Autowired |
68 | 69 | private CouponService couponService; |
69 | 70 | |
71 | + @Autowired | |
72 | + private OperateLogFacade operateLogFacade; | |
73 | + | |
70 | 74 | /** |
71 | 75 | * 增加产后复查记录 |
72 | 76 | * <p/> |
... | ... | @@ -122,6 +126,10 @@ |
122 | 126 | postReviewModel.setPid(patients.getPid()); |
123 | 127 | |
124 | 128 | postReviewService.addPostReview(postReviewModel); |
129 | + | |
130 | + | |
131 | + operateLogFacade.addAddOptLog(userId,Integer.parseInt(hospital),postReviewModel, OptActionEnums.ADD.getId(),"添加产后复查"); | |
132 | + | |
125 | 133 | /** 使用优惠券 */ |
126 | 134 | if(org.apache.commons.lang3.StringUtils.isNotBlank(postReviewRequest.getCouponCode()) && postReviewRequest.getCouponType() != null) { |
127 | 135 | couponService.use(autoMatchFacade.getHospitalId(userId), postReviewRequest.getCouponCode(), userId, postReviewModel.getId()); |
128 | 136 | |
... | ... | @@ -189,8 +197,17 @@ |
189 | 197 | } |
190 | 198 | patients.setLastCheckEmployeeId(postReviewModel.getProdDoctor()); |
191 | 199 | patientsService.updatePatient(patients); |
192 | - patientsService.updateNextCheckTime(postReviewRequest.getNextCheckTime(),patients.getId()); | |
200 | + patientsService.updateNextCheckTime(postReviewRequest.getNextCheckTime(), patients.getId()); | |
201 | + | |
202 | + | |
203 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
204 | + matDeliverQuery.setId(postReviewRequest.getId()); | |
205 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
206 | + | |
207 | + List<MaternalDeliverModel> list = matDeliverService.query(matDeliverQuery); | |
193 | 208 | postReviewService.updatePostById(postReviewModel, postReviewRequest.getId()); |
209 | + operateLogFacade.addModifyOptLog(userId, Integer.parseInt(hospital), list.get(0),postReviewModel, OptActionEnums.UPDATE.getId(), "修改产后复查"); | |
210 | + | |
194 | 211 | syncMaster(patients.getId()); |
195 | 212 | } |
196 | 213 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
... | ... | @@ -440,6 +457,8 @@ |
440 | 457 | postReviewModel.setId(id); |
441 | 458 | postReviewModel.setOperator(userId); |
442 | 459 | postReviewService.updatePostById(postReviewModel, id); |
460 | + | |
461 | + operateLogFacade.addDeleteOptLog(userId, Integer.parseInt(hospital), list.get(0), OptActionEnums.DELETE.getId(), "删除产后复查"); | |
443 | 462 | |
444 | 463 | |
445 | 464 | PostReviewModel postReviewModel1 = postReviewService.findOneById(id); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
View file @
6b2a2e2
... | ... | @@ -84,6 +84,14 @@ |
84 | 84 | |
85 | 85 | void checkNumberInfoExport(Integer childBirth, Date startDate, Date endDate, Integer startWeek, Integer endWeek, Integer number, Integer id, HttpServletResponse resp); |
86 | 86 | |
87 | - BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId); | |
87 | + BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId); | |
88 | + | |
89 | + BaseObjectResponse unSendInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId); | |
90 | + | |
91 | + void unSendExport(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId, HttpServletResponse response); | |
92 | + | |
93 | + BaseObjectResponse unUsedInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId); | |
94 | + | |
95 | + BaseObjectResponse unUsed(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId); | |
88 | 96 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
6b2a2e2
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | import org.springframework.data.mongodb.core.query.Query; |
31 | 31 | import org.springframework.stereotype.Service; |
32 | 32 | import org.springframework.util.Assert; |
33 | +import scala.annotation.target.param; | |
33 | 34 | |
34 | 35 | import javax.servlet.http.HttpServletResponse; |
35 | 36 | import java.sql.PreparedStatement; |
36 | 37 | |
37 | 38 | |
38 | 39 | |
39 | 40 | |
40 | 41 | |
... | ... | @@ -493,47 +494,26 @@ |
493 | 494 | } |
494 | 495 | return null; |
495 | 496 | } |
496 | - | |
497 | - @Override | |
498 | - public BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId) { | |
497 | + | |
498 | + private List<String> getHospitalIds(Integer userId, String hospitalId) { | |
499 | 499 | List<String> hospitalIds = new ArrayList<>(); |
500 | 500 | if(StringUtils.isEmpty(hospitalId)) { |
501 | 501 | hospitalIds.addAll(accessPermissionFacade.getCurrentUserHospPermissions(userId)); |
502 | 502 | } else { |
503 | 503 | hospitalIds.add(hospitalId); |
504 | 504 | } |
505 | + return hospitalIds; | |
506 | + } | |
505 | 507 | |
508 | + @Override | |
509 | + public BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) { | |
510 | + List<String> hospitalIds = getHospitalIds(userId, hospitalId); | |
506 | 511 | List<Map<String, Object>> datas = couponMapper.findHospitalInfoByIds(hospitalIds); |
507 | - Iterator<String> iterator = hospitalIds.iterator(); | |
508 | - while (iterator.hasNext()) { | |
509 | - String id = iterator.next(); | |
510 | - if(StringUtils.isNotEmpty(provinceId)) { | |
511 | - if(!provinceId.equals(getValByKey(datas, id, "province_id"))) { | |
512 | - iterator.remove(); | |
513 | - } | |
514 | - } | |
515 | - if(StringUtils.isNotEmpty(cityId)) { | |
516 | - if(!cityId.equals(getValByKey(datas, id, "city_id"))) { | |
517 | - iterator.remove(); | |
518 | - } | |
519 | - } | |
520 | - if(StringUtils.isNotEmpty(areaId)) { | |
521 | - if(!areaId.equals(getValByKey(datas, id, "area_id"))) { | |
522 | - iterator.remove(); | |
523 | - } | |
524 | - } | |
525 | - } | |
526 | - | |
527 | 512 | List<Map<String, Object>> restList = new ArrayList<>(); |
528 | 513 | Map<String, Integer> hospitalPatientCount = new HashMap<>(); |
529 | - if(CollectionUtils.isNotEmpty(hospitalIds)) { | |
530 | - Criteria c = new Criteria(); | |
531 | - c.and("hospitalId").in(hospitalIds).and("isSendCoupon").ne(true).and("yn").ne(0); | |
532 | - if(startDate != null && endDate != null) { | |
533 | - c.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1)); | |
534 | - } | |
535 | 514 | |
536 | - List<Patients> patients = mongoTemplate.find(Query.query(c), Patients.class); | |
515 | + if(CollectionUtils.isNotEmpty(hospitalIds)) { | |
516 | + List<Patients> patients = getPatients(hospitalIds, datas, startDate, endDate, provinceId, cityId, areaId, false); | |
537 | 517 | for (Patients patient : patients) { |
538 | 518 | if(hospitalPatientCount.containsKey(patient.getHospitalId())) { |
539 | 519 | hospitalPatientCount.put(patient.getHospitalId(), hospitalPatientCount.get(patient.getHospitalId()) + 1); |
540 | 520 | |
... | ... | @@ -543,9 +523,7 @@ |
543 | 523 | } |
544 | 524 | |
545 | 525 | for (Map.Entry<String, Integer> entry : hospitalPatientCount.entrySet()) { |
546 | -// Map<String, Object> tempMap = couponMapper.findHospitalInfoById(entry.getKey()); | |
547 | 526 | Map<String, Object> tempMap = new HashMap<>(); |
548 | - tempMap.put("id", entry.getValue()); | |
549 | 527 | tempMap.put("areaId", getValByKey(datas, entry.getKey(), "area_id")); |
550 | 528 | tempMap.put("areaName", findName(tempMap.get("areaId"))); |
551 | 529 | tempMap.put("cityId", getValByKey(datas, entry.getKey(), "city_id")); |
552 | 530 | |
... | ... | @@ -553,10 +531,142 @@ |
553 | 531 | tempMap.put("provinceId", getValByKey(datas, entry.getKey(), "province_id")); |
554 | 532 | tempMap.put("provinceName", findName(tempMap.get("provinceId"))); |
555 | 533 | tempMap.put("count", entry.getValue()); |
534 | + tempMap.put("hospitalId", entry.getKey()); | |
535 | + tempMap.put("hospitalName", couponMapper.findHospitalNameById(entry.getKey())); | |
556 | 536 | restList.add(tempMap); |
557 | 537 | } |
558 | 538 | } |
559 | - return RespBuilder.buildSuccess(restList); | |
539 | + return RespBuilder.buildSuccess(new PageResult(restList.size(), page, limit, CollectionUtils.getPageIds(restList, page, limit))); | |
540 | + } | |
541 | + | |
542 | + @Override | |
543 | + public void unSendExport(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId, HttpServletResponse response) { | |
544 | + BaseObjectResponse rest = unSend(startDate, endDate, provinceId, cityId, areaId, hospitalId, 1, Integer.MAX_VALUE, userId); | |
545 | + PageResult pageResult = (PageResult) rest.getData(); | |
546 | + List<Map<String, Object>> datas = (List<Map<String, Object>>) pageResult.getGrid(); | |
547 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
548 | + cnames.put("id", "#"); | |
549 | + cnames.put("cityName", "地市名称"); | |
550 | + cnames.put("areaName", "区县名称"); | |
551 | + cnames.put("hospitalName", "医院名称"); | |
552 | + cnames.put("count", "未发放人数"); | |
553 | + | |
554 | + List<Map<String,Object>> results = new ArrayList<>(); | |
555 | + if(org.apache.commons.collections.CollectionUtils.isNotEmpty(datas)) { | |
556 | + int i = 0; | |
557 | + for (Map<String, Object> data : datas) { | |
558 | + Map<String, Object> result = new LinkedHashMap<>(); | |
559 | + result.put("id", ++i); | |
560 | + result.put("cityName", data.get("cityName")); | |
561 | + result.put("areaName", data.get("areaName")); | |
562 | + result.put("hospitalName", data.get("hospitalName")); | |
563 | + result.put("count", data.get("count")); | |
564 | + results.add(result); | |
565 | + } | |
566 | + } | |
567 | + | |
568 | + ResponseUtil.responseExcel(cnames, results, response); | |
569 | + } | |
570 | + | |
571 | + @Override | |
572 | + public BaseObjectResponse unUsedInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) { | |
573 | + List<String> hospitalIds = getHospitalIds(userId, hospitalId); | |
574 | + if(CollectionUtils.isNotEmpty(hospitalIds)) { | |
575 | + List<Map<String, Object>> datas = couponMapper.findHospitalInfoByIds(hospitalIds); | |
576 | + List<Patients> patients = getPatients(hospitalIds, datas, startDate, endDate, provinceId, cityId, areaId, false); | |
577 | + Set<String> userIds = new HashSet<>(); | |
578 | + for (Patients patient : patients) { | |
579 | + userIds.add(patient.getPid()); | |
580 | + } | |
581 | + Map<String, Object> param = CollectionUtils.createMap("hospitalIds", hospitalIds, "userIds", userIds, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "page", page, "limit", limit); | |
582 | + List<Map<String, Object>> restList = couponMapper.findUnUsedInfo(param); | |
583 | + Integer count = couponMapper.findUnUsedInfoCount(param); | |
584 | + return RespBuilder.buildSuccess(new PageResult(count, page, limit, restList)); | |
585 | + } | |
586 | + return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); | |
587 | + } | |
588 | + | |
589 | + @Override | |
590 | + public BaseObjectResponse unUsed(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) { | |
591 | + List<String> hospitalIds = getHospitalIds(userId, hospitalId); | |
592 | + if(CollectionUtils.isNotEmpty(hospitalIds)) { | |
593 | + List<Map<String, Object>> datas = couponMapper.findHospitalInfoByIds(hospitalIds); | |
594 | + List<Patients> patients = getPatients(hospitalIds, datas, startDate, endDate, provinceId, cityId, areaId, true); | |
595 | + Set<String> userIds = new HashSet<>(); | |
596 | + for (Patients patient : patients) { | |
597 | + userIds.add(patient.getPid()); | |
598 | + } | |
599 | + Map<String, Object> param = CollectionUtils.createMap("hospitalIds", hospitalIds, "userIds", userIds, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "page", page, "limit", limit); | |
600 | + System.out.println(param); | |
601 | + List<Map<String, Object>> restList = couponMapper.findUnUsedInfo(param); | |
602 | + Integer count = couponMapper.findUnUsedInfoCount(param); | |
603 | + return RespBuilder.buildSuccess(new PageResult(count, page, limit, restList)); | |
604 | + } | |
605 | + return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); | |
606 | + } | |
607 | + | |
608 | + | |
609 | + @Override | |
610 | + public BaseObjectResponse unSendInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) { | |
611 | + List<String> hospitalIds = getHospitalIds(userId, hospitalId); | |
612 | + List<Map<String, Object>> datas = couponMapper.findHospitalInfoByIds(hospitalIds); | |
613 | + if(CollectionUtils.isNotEmpty(hospitalIds)) { | |
614 | + List<Patients> patients = getPatients(hospitalIds, datas, startDate, endDate, provinceId, cityId, areaId, false); | |
615 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
616 | + List<Patients> pageRows = CollectionUtils.getPageIds(patients, page, limit); | |
617 | + for (Patients patient : pageRows) { | |
618 | + Map<String, Object> temp = new HashMap<>(); | |
619 | + temp.put("username", patient.getUsername()); | |
620 | + temp.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(patient.getPhone())); | |
621 | + temp.put("cardNo", com.lyms.platform.common.utils.StringUtils.encryCardNo(patient.getCardNo())); | |
622 | + String residenceAddress = findName(patient.getProvinceRegisterId()) + findName(patient.getCityRegisterId()) + findName(patient.getAreaRegisterId()) + findName(patient.getStreetRegisterId()) + patient.getAddressRegister(); | |
623 | + temp.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */ | |
624 | + String householdAddress = findName(patient.getProvinceId()) + findName(patient.getCityId()) + findName(patient.getAreaId()) + findName(patient.getStreetId()) + patient.getAddress(); | |
625 | + temp.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */ | |
626 | + temp.put("lastMenses", DateUtil.getyyyy_MM_dd(patient.getLastMenses())); | |
627 | + temp.put("week", DateUtil.getWeekDesc(patient.getLastMenses(), new Date())); /** 当前孕周 */ | |
628 | + temp.put("buildWeek", DateUtil.getWeekDesc(patient.getBookbuildingDate(), new Date())); /** 建档孕周 */ | |
629 | + temp.put("buildDate", DateUtil.getyyyy_MM_dd(patient.getBookbuildingDate())); /** 建档日期 */ | |
630 | + temp.put("doctorName", couponMapper.getUserName(patient.getBookbuildingDoctor())); | |
631 | + temp.put("hospitalName", couponMapper.findHospitalNameById(patient.getHospitalId())); | |
632 | + restList.add(temp); | |
633 | + } | |
634 | + PageResult pageResult = new PageResult(patients.size(), page, limit, restList); | |
635 | + return RespBuilder.buildSuccess(pageResult); | |
636 | + } | |
637 | + return RespBuilder.buildSuccess("hospitalIds为null"); | |
638 | + } | |
639 | + private List<Patients> getPatients(List<String> hospitalIds, List<Map<String, Object>> datas, Date startDate, Date endDate, String provinceId, String cityId, String areaId, boolean isSendCoupon) { | |
640 | + Iterator<String> iterator = hospitalIds.iterator(); | |
641 | + while (iterator.hasNext()) { | |
642 | + String id = iterator.next(); | |
643 | + if(StringUtils.isNotEmpty(provinceId)) { | |
644 | + if(!provinceId.equals(getValByKey(datas, id, "province_id"))) { | |
645 | + iterator.remove(); | |
646 | + continue; | |
647 | + } | |
648 | + } | |
649 | + if(StringUtils.isNotEmpty(cityId)) { | |
650 | + if(!cityId.equals(getValByKey(datas, id, "city_id"))) { | |
651 | + iterator.remove(); | |
652 | + continue; | |
653 | + } | |
654 | + } | |
655 | + if(StringUtils.isNotEmpty(areaId)) { | |
656 | + if(!areaId.equals(getValByKey(datas, id, "area_id"))) { | |
657 | + iterator.remove(); | |
658 | + continue; | |
659 | + } | |
660 | + } | |
661 | + } | |
662 | + Criteria c = new Criteria(); | |
663 | + c.and("hospitalId").in(hospitalIds).and("isSendCoupon").ne(!isSendCoupon).and("yn").ne(0); | |
664 | + if(startDate != null && endDate != null) { | |
665 | + c.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1)); | |
666 | + } | |
667 | + | |
668 | + List<Patients> patients = mongoTemplate.find(Query.query(c), Patients.class); | |
669 | + return patients; | |
560 | 670 | } |
561 | 671 | |
562 | 672 | @Override |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java
View file @
6b2a2e2
... | ... | @@ -186,6 +186,8 @@ |
186 | 186 | } |
187 | 187 | |
188 | 188 | public static <T> List<T> getPageIds(List<T> data, Integer page, Integer limit) { |
189 | + page = page == null ? 1 : page; | |
190 | + limit = limit == null ? 15 : limit; | |
189 | 191 | Integer startIndex = (page - 1) * limit; |
190 | 192 | Integer endIndex = startIndex + limit; |
191 | 193 | if(startIndex >= data.size()) { |