Commit 8963986c3887fa9ccae18e10d9f65de1372c4cf9

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 3 changed files

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 8963986
... ... @@ -80,5 +80,7 @@
80 80 List<String> findCouponTitleByTemp(Map<String, Object> param);
81 81  
82 82 List<Map<String,Object>> findUserSendInfo(Map<String, Object> param);
  83 +
  84 + Integer findUserSendInfoCount(Map<String, Object> param);
83 85 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 8963986
... ... @@ -427,6 +427,46 @@
427 427 coupon_info a, coupon_template b, coupon_type c, organization d, users e, users f
428 428 where a.coupon_template_id = b.id and b.type_id = c.id
429 429 and a.create_hospital_id = d.id and a.user_id = e.id and a.create_user_id = f.id
  430 + and a.create_hospital_id in
  431 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  432 + #{hid}
  433 + </foreach>
  434 + and c.type in
  435 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  436 + #{type}
  437 + </foreach>
  438 + <if test="startDate != null">
  439 + and a.create_date >= #{startDate}
  440 + </if>
  441 + <if test="endDate != null">
  442 + and a.create_date <![CDATA[ < ]]> #{endDate}
  443 + </if>
  444 + limit #{currentPage},#{pageSize}
430 445 </select>
  446 +
  447 + <select id="findUserSendInfoCount" parameterType="map" resultType="integer">
  448 + select count(1) from (
  449 + select a.user_id, a.create_date, e.name as username, d.name as send_hospital, f.name as doctoer_name
  450 + from
  451 + coupon_info a, coupon_template b, coupon_type c, organization d, users e, users f
  452 + where a.coupon_template_id = b.id and b.type_id = c.id
  453 + and a.create_hospital_id = d.id and a.user_id = e.id and a.create_user_id = f.id
  454 + and a.create_hospital_id in
  455 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  456 + #{hid}
  457 + </foreach>
  458 + and c.type in
  459 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  460 + #{type}
  461 + </foreach>
  462 + <if test="startDate != null">
  463 + and a.create_date >= #{startDate}
  464 + </if>
  465 + <if test="endDate != null">
  466 + and a.create_date <![CDATA[ < ]]> #{endDate}
  467 + </if>
  468 + ) a
  469 + </select>
  470 +
431 471 </mapper>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 8963986
... ... @@ -25,6 +25,7 @@
25 25 import org.springframework.data.mongodb.core.query.Criteria;
26 26 import org.springframework.data.mongodb.core.query.Query;
27 27 import org.springframework.stereotype.Service;
  28 +import org.springframework.util.Assert;
28 29 import scala.util.parsing.combinator.testing.Str;
29 30  
30 31 import javax.servlet.http.HttpServletResponse;
... ... @@ -673,6 +674,9 @@
673 674 return RespBuilder.buildSuccess(new PageResult(0, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", new ArrayList<>())));
674 675 }
675 676 Integer type = (Integer) param.get("type");
  677 +
  678 + Assert.notNull(type, "type must not be null!");
  679 +
676 680 if(type == 4) { /** 使用详情统计 */
677 681 List<Map<String, Object>> couponInfos = couponMapper.couponInfo(param);
678 682 if(CollectionUtils.isNotEmpty(couponInfos)) {
679 683  
... ... @@ -699,11 +703,34 @@
699 703 return RespBuilder.buildSuccess(pageResult);
700 704 } if(type == 1) { /** 发放人数统计 */
701 705 List<Map<String,Object>> userSendInfo = couponMapper.findUserSendInfo(param);
702   - System.err.println(userSendInfo);
  706 + Integer count = couponMapper.findUserSendInfoCount(param);
  707 + for (Map<String, Object> map : userSendInfo) {
  708 + String userId = (String) map.get("user_id");
  709 + if(StringUtils.isNotEmpty(userId)) {
  710 + setUserSendInfo(userId, map); /** 设置居住地、户籍地、电话 */
  711 + }
  712 + map.put("create_date", DateUtil.getyyyy_MM_dd((Date) map.get("create_date")));
  713 + }
  714 + PageResult pageResult = new PageResult(count, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("userSendInfos", userSendInfo));
  715 + return RespBuilder.buildSuccess(pageResult);
703 716 }
704 717 return RespBuilder.buildSuccess();
705 718 }
706 719  
  720 +
  721 + private void setUserSendInfo(String userId, Map<String, Object> map) {
  722 + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(userId)), Patients.class);
  723 + if(patients != null) {
  724 + map.put("phone", patients.getPhone());
  725 +
  726 + String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId());
  727 + map.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */
  728 +
  729 + String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + findName(patients.getAddress());
  730 + map.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */
  731 + }
  732 + }
  733 +
707 734 /**
708 735 * type
709 736 * 1=孕妇建档 lyms_patient
... ... @@ -732,7 +759,7 @@
732 759 List<Patients> patientsList = mongoTemplate.find(Query.query(Criteria.where("pid").is(patients.getPid())).with(new Sort(Sort.Direction.ASC, "created")), Patients.class);
733 760 for(int i = 0; i < patientsList.size(); i++) {
734 761 if(patientsList.get(i).getId().equals(patients.getId())) {
735   - number = ++i;
  762 +// number = ++i;
736 763 }
737 764 }
738 765 operatorOrgName = couponMapper.findHospitalNameById(patients.getHospitalId());
... ... @@ -750,7 +777,8 @@
750 777 doctorName = couponMapper.findUserName(antexc.getProdDoctor());
751 778 phone = findPhoneByPid(antexc.getPid());
752 779 } else {
753   - AntenatalExaminationModel antenatal = mongoTemplate.findOne(Query.query(Criteria.where("barCode").is(sequence_id)), AntenatalExaminationModel.class);
  780 +// AntenatalExaminationModel antenatal = mongoTemplate.findOne(Query.query(Criteria.where("barCode").is(sequence_id)), AntenatalExaminationModel.class);
  781 + AntenatalExaminationModel antenatal = mongoTemplate.findById(usedId, AntenatalExaminationModel.class);
754 782 if(antenatal != null) {
755 783 checkDate = antenatal.getCheckDate();
756 784 username = findUserNameByPid(antenatal.getPid());