Commit cdabb304766ec07d22f8b1333699ac55bf20f344

Authored by litao@lymsh.com
1 parent 7549f0405b

改bug

Showing 5 changed files with 55 additions and 8 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java View file @ cdabb30
... ... @@ -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;
... ... @@ -32,6 +33,7 @@
32 33  
33 34 /**
34 35 * 建档统计
  36 + * @param statistType 统计环比 1=周 2=月 3=季度 4=半年 5=年
35 37 * @param ageType 1=全部年龄 2=20岁以下 3=20-30岁 4=30-40岁 5=40岁以上
36 38 * @param patientType 建档孕周 1=孕早期 2=孕中期 3=孕晚期
37 39 * @return
... ... @@ -39,8 +41,9 @@
39 41 @ResponseBody
40 42 @TokenRequired
41 43 @RequestMapping(value = "/patients", method = RequestMethod.GET)
42   - public BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, HttpServletRequest request) {
43   - return reportService.patients(provinceId, cityId, aredId, streetId, ageType, patientType, startDate, endDate, getUserId(request));
  44 + public BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId,
  45 + @RequestParam Integer statistType, Integer ageType, Integer patientType, Date startDate, Date endDate, HttpServletRequest request) {
  46 + return reportService.patients(provinceId, cityId, aredId, streetId, statistType, ageType, patientType, startDate, endDate, getUserId(request));
44 47 }
45 48  
46 49  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ cdabb30
... ... @@ -1110,7 +1110,6 @@
1110 1110 patient.setFuckLastMens(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()));
1111 1111 patient.setLastMenses(DateUtil.parseYMD(yunRequest.getFuckLastMens()));
1112 1112 }
1113   - patient.setLastMenses(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()));
1114 1113  
1115 1114 patient.setLastMenstrualPeriodBasis(yunRequest.getLastMenstrualPeriodBasis());
1116 1115 patient.setLastMenstrualPeriodBasisDoctorId(yunRequest.getLastMenstrualPeriodBasisDoctorId());
... ... @@ -1248,6 +1247,7 @@
1248 1247 if (patients != null && patients.size() > 0) {
1249 1248 Patients p = patients.get(0);
1250 1249 result = getResult(p);
  1250 + result.setLastMenstrualPeriodBasis(p.getLastMenstrualPeriodBasis());
1251 1251 /** 末次月经和纠正末次月经反起来返回 */
1252 1252 if(p.getFuckLastMens() != null) {
1253 1253 result.setFuckLastMens(DateUtil.getyyyy_MM_dd(p.getLastMenses()));
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java View file @ cdabb30
... ... @@ -98,6 +98,6 @@
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 100  
101   - BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId);
  101 + BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer statistType, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId);
102 102 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ cdabb30
... ... @@ -179,15 +179,59 @@
179 179  
180 180 /**
181 181 * 建档统计
  182 + * @param statistType 统计环比 1=周 2=月 3=季度 4=半年 5=年
182 183 * @param ageType 1=全部年龄 2=20岁以下 3=20-30岁 4=30-40岁 5=40岁以上
183 184 * @param patientType 建档孕周 1=孕早期 2=孕中期 3=孕晚期
184 185 * @return
185 186 */
186 187 @Override
187   - public BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId) {
188   - List<String> hospitals = mongoUtil.getHospitals(userId, provinceId, cityId, aredId, streetId);
  188 + public BaseObjectResponse patients(String provinceId, String cityId, String aredId, String streetId,
  189 + Integer statistType, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId) {
  190 + List<Map<String, Object>> hospitalInfos = mongoUtil.getHospitals(userId, provinceId, cityId, aredId, streetId);
  191 + List<String> hospitalIds = CollectionUtils.getListByKey(hospitalInfos, "id");
  192 + Criteria c = new Criteria();
  193 + c.and("hospitalId").in(hospitalIds).and("yn").ne(0).and("enable").ne("2").and("buildType").ne(1);
  194 + if(startDate != null && endDate != null) {
  195 + c.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1));
  196 + }
  197 + List<Patients> patients = mongoTemplate.find(Query.query(c), Patients.class);
189 198  
190 199 return null;
  200 + }
  201 +
  202 + private void doFilter(List<Patients> patients, Integer ageType, Integer patientType) {
  203 + if(patientType != null) {
  204 + Iterator<Patients> iterator = patients.iterator();
  205 + while (iterator.hasNext()) {
  206 +
  207 + }
  208 + }
  209 + if (ageType != null) {
  210 + Iterator<Patients> iterator = patients.iterator();
  211 + while (iterator.hasNext()) {
  212 + Integer age = DateUtil.getAge(iterator.next().getBirth());
  213 + if(age == null) {
  214 + iterator.remove();
  215 + continue;
  216 + }
  217 + if(ageType == 2 && age >= 20) {
  218 + iterator.remove();
  219 + continue;
  220 + }
  221 + if(ageType == 3 && age >= 30) {
  222 + iterator.remove();
  223 + continue;
  224 + }
  225 + if(ageType == 4 && age >= 40) {
  226 + iterator.remove();
  227 + continue;
  228 + }
  229 + if(ageType == 5 && age < 40) {
  230 + iterator.remove();
  231 + continue;
  232 + }
  233 + }
  234 + }
191 235 }
192 236  
193 237 @Override
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java View file @ cdabb30
... ... @@ -51,10 +51,10 @@
51 51 @Autowired
52 52 private CouponMapper couponMapper;
53 53  
54   - public List<String> getHospitals(Integer userId, String provinceId, String cityId, String areaId, String streetId) {
  54 + public List<Map<String, Object>> getHospitals(Integer userId, String provinceId, String cityId, String areaId, String streetId) {
55 55 List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId);
56 56 List<Map<String, Object>> hospitals= couponMapper.findHospitalInfoByIds2(CollectionUtils.createMap("list", hospitalIds, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "streetId", streetId));
57   - return null;
  57 + return hospitals;
58 58 }
59 59  
60 60 public List<Map<String, Object>> getListByParentId(String id) {