Commit 168d78b485ebebbc2867664dd64c1bfd4bbd20b5
1 parent
17937bc436
Exists in
master
and in
1 other branch
体重管理修改接口 加上同步修改体重数据的逻辑
Showing 6 changed files with 81 additions and 8 deletions
- 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-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/IReportService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
View file @
168d78b
| ... | ... | @@ -98,5 +98,9 @@ |
| 98 | 98 | CouponInfo findUserCoupon(Map<String, Object> param); |
| 99 | 99 | |
| 100 | 100 | String findByType(Map<String, Object> map); |
| 101 | + | |
| 102 | + Map<String,Object> findHospitalInfoById(String hospitalId); | |
| 103 | + | |
| 104 | + List<Map<String,Object>> findHospitalInfoByIds(List<String> hospitalIds); | |
| 101 | 105 | } |
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
168d78b
| ... | ... | @@ -521,5 +521,16 @@ |
| 521 | 521 | update coupon_info set temp_status = 1,temp_hospital_id=#{hospitalId} where sequence_id = #{code} |
| 522 | 522 | </update> |
| 523 | 523 | |
| 524 | + <select id="findHospitalInfoById" parameterType="string" resultType="map"> | |
| 525 | + SELECT id, name, province_id, city_id, area_id FROM `organization` where id = #{id} and yn = 1 | |
| 526 | + </select> | |
| 527 | + | |
| 528 | + <select id="findHospitalInfoByIds" parameterType="list" resultType="map"> | |
| 529 | + SELECT id, name, province_id, city_id, area_id FROM `organization` where id in | |
| 530 | + <foreach collection="list" item="id" open="(" separator="," close=")"> | |
| 531 | + #{id} | |
| 532 | + </foreach> and yn = 1 | |
| 533 | + </select> | |
| 534 | + | |
| 524 | 535 | </mapper> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
168d78b
| ... | ... | @@ -33,11 +33,11 @@ |
| 33 | 33 | /** |
| 34 | 34 | * 未发放优惠券统计 |
| 35 | 35 | */ |
| 36 | - @RequestMapping(value = "/unissued", method = RequestMethod.POST) | |
| 36 | + @RequestMapping(value = "/coupon/unSend", method = RequestMethod.POST) | |
| 37 | 37 | @ResponseBody |
| 38 | 38 | @TokenRequired |
| 39 | - public BaseObjectResponse unissued(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, HttpServletRequest request) { | |
| 40 | - return reportService.unissued(startDate, endDate, provinceId, cityId, areaId, hospitalId, getUserId(request)); | |
| 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)); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
View file @
168d78b
| ... | ... | @@ -84,6 +84,6 @@ |
| 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 unissued(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 userId); | |
| 88 | 88 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
168d78b
| ... | ... | @@ -162,6 +162,7 @@ |
| 162 | 162 | param.put("doctorName", couponMapper.findUserName(userId + "")); |
| 163 | 163 | param.put("patientId", patients.getId()); |
| 164 | 164 | param.put("hospitalName", couponMapper.findHospitalNameById(hospitalId)); |
| 165 | + param.put("foreignId", hospitalId); | |
| 165 | 166 | String s = HttpClientUtil.doPost(patSerSyncUrl + "/grWeContr/bindDoctorUser", param, "UTF-8"); |
| 166 | 167 | // String s = HttpClientUtil.doPost("http://localhost:9092/grWeContr/bindDoctorUser", param, "UTF-8"); |
| 167 | 168 | System.out.println("绑定医生和患者的关系>>. " + s + " param: " + param); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
168d78b
| 1 | 1 | package com.lyms.platform.operate.web.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.alibaba.fastjson.JSONPObject; | |
| 5 | 4 | import com.lyms.hospitalapi.pojo.ReportModel; |
| 6 | 5 | import com.lyms.platform.biz.service.CommonService; |
| 7 | 6 | import com.lyms.platform.common.enums.CouponEnums; |
| 8 | 7 | |
| ... | ... | @@ -486,8 +485,17 @@ |
| 486 | 485 | ResponseUtil.responseExcel(cnames,results, resp); |
| 487 | 486 | } |
| 488 | 487 | |
| 488 | + private String getValByKey(List<Map<String, Object>> datas, String id, String key) { | |
| 489 | + for (Map<String, Object> map : datas) { | |
| 490 | + if(id.equals(map.get("id") + "")) { | |
| 491 | + return map.get(key) + ""; | |
| 492 | + } | |
| 493 | + } | |
| 494 | + return null; | |
| 495 | + } | |
| 496 | + | |
| 489 | 497 | @Override |
| 490 | - public BaseObjectResponse unissued(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId) { | |
| 498 | + public BaseObjectResponse unSend(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId) { | |
| 491 | 499 | List<String> hospitalIds = new ArrayList<>(); |
| 492 | 500 | if(StringUtils.isEmpty(hospitalId)) { |
| 493 | 501 | hospitalIds.addAll(accessPermissionFacade.getCurrentUserHospPermissions(userId)); |
| 494 | 502 | |
| 495 | 503 | |
| 496 | 504 | |
| ... | ... | @@ -495,11 +503,60 @@ |
| 495 | 503 | hospitalIds.add(hospitalId); |
| 496 | 504 | } |
| 497 | 505 | |
| 506 | + 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 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
| 528 | + Map<String, Integer> hospitalPatientCount = new HashMap<>(); | |
| 498 | 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 | + } | |
| 499 | 535 | |
| 500 | - } | |
| 536 | + List<Patients> patients = mongoTemplate.find(Query.query(c), Patients.class); | |
| 537 | + for (Patients patient : patients) { | |
| 538 | + if(hospitalPatientCount.containsKey(patient.getHospitalId())) { | |
| 539 | + hospitalPatientCount.put(patient.getHospitalId(), hospitalPatientCount.get(patient.getHospitalId()) + 1); | |
| 540 | + } else { | |
| 541 | + hospitalPatientCount.put(patient.getHospitalId(), 1); | |
| 542 | + } | |
| 543 | + } | |
| 501 | 544 | |
| 502 | - return RespBuilder.buildSuccess(); | |
| 545 | + for (Map.Entry<String, Integer> entry : hospitalPatientCount.entrySet()) { | |
| 546 | +// Map<String, Object> tempMap = couponMapper.findHospitalInfoById(entry.getKey()); | |
| 547 | + Map<String, Object> tempMap = new HashMap<>(); | |
| 548 | + tempMap.put("id", entry.getValue()); | |
| 549 | + tempMap.put("areaId", getValByKey(datas, entry.getKey(), "area_id")); | |
| 550 | + tempMap.put("areaName", findName(tempMap.get("areaId"))); | |
| 551 | + tempMap.put("cityId", getValByKey(datas, entry.getKey(), "city_id")); | |
| 552 | + tempMap.put("cityName", findName(tempMap.get("cityId"))); | |
| 553 | + tempMap.put("provinceId", getValByKey(datas, entry.getKey(), "province_id")); | |
| 554 | + tempMap.put("provinceName", findName(tempMap.get("provinceId"))); | |
| 555 | + tempMap.put("count", entry.getValue()); | |
| 556 | + restList.add(tempMap); | |
| 557 | + } | |
| 558 | + } | |
| 559 | + return RespBuilder.buildSuccess(restList); | |
| 503 | 560 | } |
| 504 | 561 | |
| 505 | 562 | @Override |