Commit 06f1a99cbb0197f90ff41001d96f13e6f4672ce3

Authored by yangfei

Merge remote-tracking branch 'origin/master'

Showing 14 changed files

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 06f1a99
... ... @@ -124,5 +124,7 @@
124 124 List<Map<String,Object>> findUserTypeInfo(Map<String, Object> map);
125 125  
126 126 List<Map<String,Object>> findHospitalInfoByIds2(Map<String, Object> map);
  127 +
  128 + void invalid2(Map<String, Object> param);
127 129 }
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterOrganizationMapper.java View file @ 06f1a99
... ... @@ -4,6 +4,7 @@
4 4 import com.lyms.platform.permission.model.OrganizationQuery;
5 5  
6 6 import java.util.List;
  7 +import java.util.Map;
7 8  
8 9 public interface MasterOrganizationMapper {
9 10 public Integer addOrganization(Organization obj);
... ... @@ -23,5 +24,7 @@
23 24 List<Organization> queryHospital();
24 25  
25 26 void execSql(String sql);
  27 +
  28 + List<Map<String,Object>> getOrganizationByAreaId(String id);
26 29 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java View file @ 06f1a99
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.common.result.BaseObjectResponse;
4 4  
  5 +import java.util.Date;
5 6 import java.util.List;
6 7 import java.util.Map;
7 8 import java.util.Set;
... ... @@ -56,5 +57,7 @@
56 57 * @return
57 58 */
58 59 String findByType(String id, int i);
  60 +
  61 + void invalid2(String pid, Date created, String s);
59 62 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/OrganizationService.java View file @ 06f1a99
... ... @@ -4,6 +4,7 @@
4 4 import com.lyms.platform.permission.model.OrganizationQuery;
5 5  
6 6 import java.util.List;
  7 +import java.util.Map;
7 8  
8 9 public interface OrganizationService {
9 10 public Integer addOrganization(Organization obj);
... ... @@ -31,5 +32,7 @@
31 32 public void rebuildDefaultRoles();
32 33  
33 34 void execSql(String sql);
  35 +
  36 + List<Map<String,Object>> getOrganizationByAreaId(String id);
34 37 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java View file @ 06f1a99
... ... @@ -565,6 +565,15 @@
565 565 }
566 566  
567 567 @Override
  568 + public void invalid2(String pid, Date created, String couponTypes) {
  569 + Map<String, Object> param = new HashMap<>();
  570 + param.put("personId", pid);
  571 + param.put("couponTypes", com.lyms.platform.common.utils.StringUtils.covertToList(couponTypes, Integer.class));
  572 + param.put("created", created);
  573 + couponMapper.invalid2(param);
  574 + }
  575 +
  576 + @Override
568 577 public List<Map<String, Object>> queryCouponItemsByType(Map<String, Object> params) {
569 578 return couponMapper.queryCouponItemsByType(params);
570 579 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java View file @ 06f1a99
... ... @@ -82,6 +82,12 @@
82 82 masterOrganizationMapper.execSql(sql);
83 83 }
84 84  
  85 + @Override
  86 + public List<Map<String, Object>> getOrganizationByAreaId(String id) {
  87 + return masterOrganizationMapper.getOrganizationByAreaId(id);
  88 + }
  89 +
  90 +
85 91 private void addDefaultRoles(Organization obj) {
86 92 List<Roles> rolesList = new ArrayList<>();
87 93 rolesList.add(rolesService.getRoles(87));
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 06f1a99
... ... @@ -133,6 +133,18 @@
133 133 ) b on a.id = b.id set a.status = 3
134 134 </update>
135 135  
  136 + <update id="invalid2" parameterType="map">
  137 + update coupon_info a inner join (
  138 + select a.id
  139 + from coupon_info a, coupon_template b, coupon_type c
  140 + where a.coupon_template_id = b.id and b.type_id = c.id and a.status=1 and a.create_date > #{created} and c.type in
  141 + <foreach collection="couponTypes" open="(" close=")" separator="," item="type">
  142 + #{type}
  143 + </foreach>
  144 + and a.user_id = #{personId}
  145 + ) b on a.id = b.id set a.status = 3
  146 + </update>
  147 +
136 148 <select id="findByUsedId" parameterType="string" resultType="string">
137 149 select sequence_id from coupon_info where used_id = #{id} limit 0,1
138 150 </select>
platform-biz-service/src/main/resources/mainOrm/master/MasterOrganization.xml View file @ 06f1a99
... ... @@ -249,6 +249,10 @@
249 249 <select id="execSql" parameterType="String">
250 250 ${value}
251 251 </select>
  252 +
  253 + <select id="getOrganizationByAreaId" parameterType="string" resultType="map">
  254 + SELECT id, name FROM `organization` where yn = 1 and area_id = #{areaId}
  255 + </select>
252 256  
253 257 </mapper>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AreaCountController.java View file @ 06f1a99
... ... @@ -25,6 +25,18 @@
25 25 private AreaCountFacade areaCountFacade;
26 26  
27 27 /**
  28 + * flag 是否返回的是医院
  29 + * @param name
  30 + * @param flag
  31 + * @return
  32 + */
  33 + @RequestMapping(value = "/area/childs", method = RequestMethod.GET)
  34 + @ResponseBody
  35 + public BaseResponse getAreaChilds(@RequestParam String name, boolean flag) {
  36 + return areaCountFacade.getAreaChilds(name, flag);
  37 + }
  38 +
  39 + /**
28 40 * 产检节点统计
29 41 * @param request
30 42 * @param time 时间范围
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java View file @ 06f1a99
... ... @@ -11,6 +11,7 @@
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;
14 15 import org.springframework.web.bind.annotation.ResponseBody;
15 16  
16 17 import javax.servlet.http.HttpServletRequest;
... ... @@ -29,6 +30,37 @@
29 30  
30 31 @Autowired
31 32 private IReportService reportService;
  33 +
  34 + /**
  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=区县
  52 + * @param ageType 1=全部年龄 2=20岁以下 3=20-30岁 4=30-40岁 5=40岁以上
  53 + * @param areaId 乡镇ID
  54 + * @param patientType 建档孕周 1=孕早期 2=孕中期 3=孕晚期
  55 + * @return
  56 + */
  57 + @ResponseBody
  58 + @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));
  62 + }
  63 +
32 64  
33 65 /**
34 66 * 未发放优惠券统计
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java View file @ 06f1a99
... ... @@ -7,6 +7,7 @@
7 7 import com.lyms.platform.common.result.BaseListResponse;
8 8 import com.lyms.platform.common.result.BaseObjectResponse;
9 9 import com.lyms.platform.common.result.BaseResponse;
  10 +import com.lyms.platform.common.result.RespBuilder;
10 11 import com.lyms.platform.common.utils.*;
11 12 import com.lyms.platform.common.utils.StringUtils;
12 13 import com.lyms.platform.operate.web.utils.CommonsHelper;
... ... @@ -19,6 +20,7 @@
19 20 import com.lyms.platform.permission.service.OrganizationService;
20 21 import com.lyms.platform.permission.service.UsersService;
21 22 import com.lyms.platform.pojo.AntExRecordModel;
  23 +import com.lyms.platform.pojo.BasicConfig;
22 24 import com.lyms.platform.pojo.DataPermissionsModel;
23 25 import com.lyms.platform.pojo.Patients;
24 26 import com.lyms.platform.query.AntExRecordQuery;
... ... @@ -28,6 +30,9 @@
28 30 import org.springframework.beans.factory.annotation.Autowired;
29 31 import org.springframework.beans.factory.annotation.Qualifier;
30 32 import org.springframework.data.domain.Sort;
  33 +import org.springframework.data.mongodb.core.MongoTemplate;
  34 +import org.springframework.data.mongodb.core.query.Criteria;
  35 +import org.springframework.data.mongodb.core.query.Query;
31 36 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
32 37 import org.springframework.stereotype.Component;
33 38  
... ... @@ -46,6 +51,8 @@
46 51 @Component
47 52 public class AreaCountFacade {
48 53  
  54 + @Autowired
  55 + private MongoTemplate mongoTemplate;
49 56  
50 57 @Autowired
51 58 private AntExRecordService recordService;
... ... @@ -832,6 +839,27 @@
832 839  
833 840 ResponseUtil.responseExcel(cnames,results,httpServletResponse);
834 841 }
  842 +
  843 + public BaseResponse getAreaChilds(String name, boolean flag) {
  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);
  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);
  857 + }
  858 + }
  859 + }
  860 + return RespBuilder.buildSuccess(childs);
  861 + }
  862 +
835 863  
836 864 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 06f1a99
... ... @@ -1429,7 +1429,9 @@
1429 1429  
1430 1430  
1431 1431 /** 删除建档应该是把全部未使用的优惠券状态更新为3【已作废】 */
  1432 +
1432 1433 couponService.invalid(patients.getPid(), "1,2,3,4,5,6,7,8");
  1434 +// couponService.invalid2(patients.getPid(), patients.getCreated(), "1,2,3,4,5,6,7,8,9,10");
1433 1435 }
1434 1436  
1435 1437 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java View file @ 06f1a99
... ... @@ -97,5 +97,9 @@
97 97 void unUsedExport(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer userId, HttpServletResponse response);
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 +
  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);
100 104 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 06f1a99
... ... @@ -178,6 +178,16 @@
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 + }
  184 +
  185 + @Override
  186 + public BaseObjectResponse patientZhanbi(Integer areaType, Integer ageType, Integer areaId, Integer patientType, Integer userId) {
  187 + return null;
  188 + }
  189 +
  190 + @Override
181 191 public BaseObjectResponse areaCountFacade(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth, Integer userId) {
182 192 BaseObjectResponse rest = new BaseObjectResponse();
183 193 Map<String, Object> restMap = new HashMap<>();