Commit f2893e8be83c2cb964290c74badd8166515429c6
1 parent
f6e66e0b18
Exists in
master
and in
6 other branches
秦皇岛-区域妇幼-建档优惠券统计:海港区、北戴河区、山海关区 辖区下所有医院
Showing 7 changed files with 226 additions and 4 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/BookbuildingCouponQuery.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/ReportServiceImpl.java
- platform-operate-api/src/main/resources/log4j_config.xml
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
View file @
f2893e8
| 1 | 1 | package com.lyms.platform.permission.dao.master; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.permission.model.BookbuildingCouponQuery; | |
| 3 | 4 | import com.lyms.platform.permission.model.CouponInfo; |
| 4 | 5 | |
| 5 | 6 | import java.util.List; |
| ... | ... | @@ -162,5 +163,9 @@ |
| 162 | 163 | List<String> findUsedInfo2ids(Map<String, Object> param); |
| 163 | 164 | |
| 164 | 165 | List<String> findCouponInfoCount2Ids(Map<String, Object> param); |
| 166 | + | |
| 167 | + List<Map> bookbuildingCoupon(BookbuildingCouponQuery query); | |
| 168 | + | |
| 169 | + int bookbuildingCouponCount(BookbuildingCouponQuery query); | |
| 165 | 170 | } |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/BookbuildingCouponQuery.java
View file @
f2893e8
| 1 | +package com.lyms.platform.permission.model; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 建档优惠券统计 查询参数 | |
| 10 | + */ | |
| 11 | +public class BookbuildingCouponQuery extends BaseQuery { | |
| 12 | + | |
| 13 | + private String startDate; | |
| 14 | + private String endDate; | |
| 15 | + private String name; | |
| 16 | + private String cardNo; | |
| 17 | + private String areaId; | |
| 18 | + private String hospitalId; | |
| 19 | + private List<String> personIds; | |
| 20 | + | |
| 21 | + public List<String> getPersonIds() { | |
| 22 | + return personIds; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setPersonIds(List<String> personIds) { | |
| 26 | + this.personIds = personIds; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public String getStartDate() { | |
| 30 | + return startDate; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setStartDate(String startDate) { | |
| 34 | + this.startDate = startDate; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getEndDate() { | |
| 38 | + return endDate; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setEndDate(String endDate) { | |
| 42 | + this.endDate = endDate; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public String getName() { | |
| 46 | + return name; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setName(String name) { | |
| 50 | + this.name = name; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public String getCardNo() { | |
| 54 | + return cardNo; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setCardNo(String cardNo) { | |
| 58 | + this.cardNo = cardNo; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public String getAreaId() { | |
| 62 | + return areaId; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setAreaId(String areaId) { | |
| 66 | + this.areaId = areaId; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public String getHospitalId() { | |
| 70 | + return hospitalId; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setHospitalId(String hospitalId) { | |
| 74 | + this.hospitalId = hospitalId; | |
| 75 | + } | |
| 76 | +} |
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
f2893e8
| ... | ... | @@ -1429,7 +1429,65 @@ |
| 1429 | 1429 | and h.hospital_id = #{hid} |
| 1430 | 1430 | and p.type='2')) temp |
| 1431 | 1431 | </select> |
| 1432 | + <select id="bookbuildingCoupon" resultType="java.util.Map" | |
| 1433 | + parameterType="com.lyms.platform.permission.model.BookbuildingCouponQuery"> | |
| 1434 | + SELECT | |
| 1435 | + o.area_id as areaid, | |
| 1436 | + c.user_id as userid, | |
| 1437 | + c.create_hospital_id as hospitalid, | |
| 1438 | + o.`name` as hospitalname, | |
| 1439 | + DATE_FORMAT( c.create_date, '%Y-%m-%d' ) as created | |
| 1440 | + FROM | |
| 1441 | + `organization` o | |
| 1442 | + INNER JOIN coupon_info c ON c.create_hospital_id = o.id | |
| 1443 | + <include refid="queryBookbuildingCoupon"/> | |
| 1444 | + GROUP BY | |
| 1445 | + c.create_hospital_id,c.user_id,DATE_FORMAT( c.create_date, '%Y-%m-%d' ) | |
| 1446 | + ORDER BY c.create_date desc | |
| 1447 | + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER} | |
| 1448 | + </select> | |
| 1432 | 1449 | |
| 1450 | + <select id="bookbuildingCouponCount" resultType="java.lang.Integer" | |
| 1451 | + parameterType="com.lyms.platform.permission.model.BookbuildingCouponQuery"> | |
| 1452 | + SELECT | |
| 1453 | + count(1) | |
| 1454 | + FROM( | |
| 1455 | + SELECT | |
| 1456 | + o.area_id as areaid, | |
| 1457 | + c.user_id as userid, | |
| 1458 | + c.create_hospital_id as hospitalid, | |
| 1459 | + o.`name` as hospitalname, | |
| 1460 | + DATE_FORMAT( c.create_date, '%Y-%m-%d' ) as created | |
| 1461 | + FROM | |
| 1462 | + `organization` o | |
| 1463 | + INNER JOIN coupon_info c ON c.create_hospital_id = o.id | |
| 1464 | + <include refid="queryBookbuildingCoupon"/> | |
| 1465 | + GROUP BY | |
| 1466 | + c.create_hospital_id,c.user_id,DATE_FORMAT( c.create_date, '%Y-%m-%d' ) | |
| 1467 | + ) coun | |
| 1468 | + </select> | |
| 1469 | + | |
| 1470 | + <sql id="queryBookbuildingCoupon"> | |
| 1471 | + <where> | |
| 1472 | + 1 = 1 | |
| 1473 | + <if test="(startDate != null and startDate != '') and (endDate != null and endDate != '')"> | |
| 1474 | + AND DATE_FORMAT( c.create_date, '%Y-%m-%d' ) >= date_format(#{startDate},'%Y-%m-%d') | |
| 1475 | + AND <![CDATA[ DATE_FORMAT( c.create_date, '%Y-%m-%d' ) <= date_format(#{endDate},'%Y-%m-%d') ]]> | |
| 1476 | + </if> | |
| 1477 | + <if test="areaId != null and areaId != '' "> | |
| 1478 | + AND o.area_id=#{areaId} | |
| 1479 | + </if> | |
| 1480 | + <if test="hospitalId != null and hospitalId != '' "> | |
| 1481 | + AND c.create_hospital_id=#{hospitalId} | |
| 1482 | + </if> | |
| 1483 | + <if test="personIds != null and personIds.size() > 0"> | |
| 1484 | + and c.user_id in | |
| 1485 | + <foreach collection="personIds" index="index" item="item" open="(" separator="," close=")"> | |
| 1486 | + #{item} | |
| 1487 | + </foreach> | |
| 1488 | + </if> | |
| 1489 | + </where> | |
| 1490 | + </sql> | |
| 1433 | 1491 | |
| 1434 | 1492 | </mapper> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
f2893e8
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 11 | 11 | import com.lyms.platform.operate.web.service.IReportService; |
| 12 | 12 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 13 | +import com.lyms.platform.permission.model.BookbuildingCouponQuery; | |
| 13 | 14 | import com.lyms.platform.permission.model.Organization; |
| 14 | 15 | import com.lyms.platform.permission.service.OrganizationService; |
| 15 | 16 | import com.lyms.platform.permission.service.UsersService; |
| ... | ... | @@ -678,6 +679,19 @@ |
| 678 | 679 | @RequestParam(required = true)Date startDate, |
| 679 | 680 | @RequestParam(required = true)Date endDate) { |
| 680 | 681 | return reportService.getAreaFinallyOverdue(hospitalId,areaId,startDate,endDate); |
| 682 | + } | |
| 683 | + | |
| 684 | + /** | |
| 685 | + * 秦皇岛 海港区、北戴河区、山海关区 辖区下所有医院 | |
| 686 | + * 建档优惠券统计 | |
| 687 | + * @param bookbuildingCouponQuery | |
| 688 | + * @return | |
| 689 | + */ | |
| 690 | + @RequestMapping(value = "/bookbuildingCoupon", method = RequestMethod.GET) | |
| 691 | + @ResponseBody | |
| 692 | + @TokenRequired | |
| 693 | + public BaseObjectResponse bookbuildingCoupon(BookbuildingCouponQuery bookbuildingCouponQuery) { | |
| 694 | + return reportService.bookbuildingCoupon(bookbuildingCouponQuery); | |
| 681 | 695 | } |
| 682 | 696 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
View file @
f2893e8
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 4 | 4 | import com.lyms.platform.common.result.BaseResponse; |
| 5 | +import com.lyms.platform.permission.model.BookbuildingCouponQuery; | |
| 5 | 6 | |
| 6 | 7 | import javax.servlet.http.HttpServletResponse; |
| 7 | 8 | import java.util.Date; |
| ... | ... | @@ -132,5 +133,7 @@ |
| 132 | 133 | BaseResponse getFinallyCheckOverdue(String hospitalId, Date startDate, Date endDate); |
| 133 | 134 | |
| 134 | 135 | BaseResponse getAreaFinallyOverdue(String hospitalId,String areaId ,Date startDate, Date endDate); |
| 136 | + | |
| 137 | + BaseObjectResponse bookbuildingCoupon(BookbuildingCouponQuery bookbuildingCouponQuery); | |
| 135 | 138 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
f2893e8
| ... | ... | @@ -5,7 +5,9 @@ |
| 5 | 5 | import com.lyms.hospitalapi.pojo.ReportModel; |
| 6 | 6 | import com.lyms.platform.biz.AntExChuModelTemp; |
| 7 | 7 | import com.lyms.platform.biz.service.*; |
| 8 | +import com.lyms.platform.common.base.PageInfo; | |
| 8 | 9 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 10 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 9 | 11 | import com.lyms.platform.common.enums.*; |
| 10 | 12 | import com.lyms.platform.common.result.*; |
| 11 | 13 | import com.lyms.platform.common.utils.*; |
| 12 | 14 | |
| ... | ... | @@ -19,15 +21,13 @@ |
| 19 | 21 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 20 | 22 | import com.lyms.platform.operate.web.worker.AntExRecordWorker; |
| 21 | 23 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| 24 | +import com.lyms.platform.permission.model.BookbuildingCouponQuery; | |
| 22 | 25 | import com.lyms.platform.permission.model.Organization; |
| 23 | 26 | import com.lyms.platform.permission.model.Users; |
| 24 | 27 | import com.lyms.platform.permission.service.OrganizationService; |
| 25 | 28 | import com.lyms.platform.permission.service.UsersService; |
| 26 | 29 | import com.lyms.platform.pojo.*; |
| 27 | -import com.lyms.platform.query.AntExChuQuery; | |
| 28 | -import com.lyms.platform.query.AntExRecordQuery; | |
| 29 | -import com.lyms.platform.query.PatientsQuery; | |
| 30 | -import com.lyms.platform.query.SieveApplyOrderQuery; | |
| 30 | +import com.lyms.platform.query.*; | |
| 31 | 31 | import com.lymsh.platform.reportdata.model.echarts.Series; |
| 32 | 32 | import org.apache.commons.collections.*; |
| 33 | 33 | import org.apache.commons.collections.map.HashedMap; |
| ... | ... | @@ -112,6 +112,8 @@ |
| 112 | 112 | |
| 113 | 113 | @Autowired |
| 114 | 114 | private PatientsService patientsService; |
| 115 | + @Autowired | |
| 116 | + private PersonService personService; | |
| 115 | 117 | |
| 116 | 118 | |
| 117 | 119 | private static final Map<String, String> colorMap = new HashMap<>(); |
| ... | ... | @@ -5396,6 +5398,69 @@ |
| 5396 | 5398 | br.setErrormsg("成功"); |
| 5397 | 5399 | br.setObject(mapList); |
| 5398 | 5400 | return br; |
| 5401 | + } | |
| 5402 | + | |
| 5403 | + @Override | |
| 5404 | + public BaseObjectResponse bookbuildingCoupon(BookbuildingCouponQuery query) { | |
| 5405 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 5406 | + List<PersonModel> personList=new ArrayList<>(); | |
| 5407 | + if(StringUtils.isNotEmpty(query.getName()) || StringUtils.isNotEmpty(query.getCardNo())){ | |
| 5408 | + PersonModelQuery personModelQuery = new PersonModelQuery(); | |
| 5409 | + personModelQuery.setYn(YnEnums.YES.getId()); | |
| 5410 | + if (StringUtils.isNotEmpty(query.getName())) { | |
| 5411 | + personModelQuery.setName(query.getName()); | |
| 5412 | + } | |
| 5413 | + if (StringUtils.isNotEmpty(query.getCardNo())) { | |
| 5414 | + personModelQuery.setCardNo(query.getCardNo()); | |
| 5415 | + } | |
| 5416 | + personList = personService.queryPersons(personModelQuery); | |
| 5417 | + //没查到 | |
| 5418 | + if(CollectionUtils.isEmpty(personList)){ | |
| 5419 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 5420 | + objectResponse.setErrormsg("成功"); | |
| 5421 | + return objectResponse; | |
| 5422 | + } | |
| 5423 | + } | |
| 5424 | + List<String> personIds=new ArrayList<>(); | |
| 5425 | + for (PersonModel personModel : personList) { | |
| 5426 | + if (StringUtils.isNotEmpty(personModel.getId())) { | |
| 5427 | + personIds.add(personModel.getId()); | |
| 5428 | + } | |
| 5429 | + } | |
| 5430 | + //查询姓名身份证结果放入mysql查询 | |
| 5431 | + if(CollectionUtils.isNotEmpty(personIds)){ | |
| 5432 | + query.setPersonIds(personIds); | |
| 5433 | + } | |
| 5434 | + //查询mysql 优惠券记录 | |
| 5435 | + List<Map> bookbuildingCouponList=couponMapper.bookbuildingCoupon(query); | |
| 5436 | + //分页总数 | |
| 5437 | + int count = couponMapper.bookbuildingCouponCount(query); | |
| 5438 | + List<Map> result=new ArrayList<>(); | |
| 5439 | + for (Map bookbuildingCoupon : bookbuildingCouponList) { | |
| 5440 | + Map map=new HashedMap(); | |
| 5441 | + PersonModel personModel = mongoTemplate.findById(bookbuildingCoupon.get("userid").toString(), PersonModel.class); | |
| 5442 | + if(null!=personModel){ | |
| 5443 | + map.put("name", personModel.getName()); | |
| 5444 | + map.put("phone", personModel.getPhone()); | |
| 5445 | + map.put("cardNo", personModel.getCardNo()); | |
| 5446 | + map.put("hospitalName", bookbuildingCoupon.get("hospitalname")); | |
| 5447 | + map.put("created", bookbuildingCoupon.get("created")); | |
| 5448 | + }else { | |
| 5449 | + //处理分页计数 | |
| 5450 | + if(0!=count){ | |
| 5451 | + count--; | |
| 5452 | + } | |
| 5453 | + } | |
| 5454 | + result.add(map); | |
| 5455 | + } | |
| 5456 | + //分页数据 | |
| 5457 | + query.mysqlBuild(count); | |
| 5458 | + | |
| 5459 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 5460 | + objectResponse.setErrormsg("成功"); | |
| 5461 | + objectResponse.setData(result); | |
| 5462 | + objectResponse.setPageInfo(query.getPageInfo()); | |
| 5463 | + return objectResponse; | |
| 5399 | 5464 | } |
| 5400 | 5465 | } |