Commit 7676a6b39ec1957c4181c600f78747dbdb394e3f
1 parent
4972cd7d9b
Exists in
master
and in
6 other branches
改bug
Showing 1 changed file with 52 additions and 9 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
7676a6b
| ... | ... | @@ -569,7 +569,17 @@ |
| 569 | 569 | |
| 570 | 570 | @Override |
| 571 | 571 | public BaseObjectResponse unUsedInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) { |
| 572 | - List<String> hospitalIds = new ArrayList<>(); | |
| 572 | + BaseObjectResponse baseObjectResponse = unUsed(startDate, endDate, provinceId, cityId, areaId, hospitalId, page, limit, userId); | |
| 573 | + PageResult pageResult = (PageResult) baseObjectResponse.getData(); | |
| 574 | + List<Map<String, Object>> datas = (List<Map<String, Object>>) pageResult.getGrid(); | |
| 575 | + for (Map<String, Object> data : datas) { | |
| 576 | + if(hospitalId.equals(data.get("hospitalId").toString())) { | |
| 577 | + List<Map<String, Object>> unUsedCoupons = (List<Map<String, Object>>) data.get("un_used_coupons"); | |
| 578 | + return RespBuilder.buildSuccess(new PageResult(unUsedCoupons.size(), page, limit, CollectionUtils.getPageIds(unUsedCoupons, page, limit))); | |
| 579 | + } | |
| 580 | + } | |
| 581 | + | |
| 582 | + /*List<String> hospitalIds = new ArrayList<>(); | |
| 573 | 583 | hospitalIds.add(hospitalId); |
| 574 | 584 | List<Map<String, Object>> datas = couponMapper.findHospitalInfoByIds(hospitalIds); |
| 575 | 585 | List<Patients> patients = getPatients(hospitalIds, datas, startDate, endDate, provinceId, cityId, areaId, true); |
| ... | ... | @@ -601,7 +611,7 @@ |
| 601 | 611 | } |
| 602 | 612 | Integer count = couponMapper.findUnUsedInfoCount(CollectionUtils.createMap("userIds", userIds, "hospitalId", hospitalId)); |
| 603 | 613 | return RespBuilder.buildSuccess(new PageResult(count, page, limit, restList)); |
| 604 | - } | |
| 614 | + }*/ | |
| 605 | 615 | return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); |
| 606 | 616 | } |
| 607 | 617 | |
| ... | ... | @@ -690,6 +700,9 @@ |
| 690 | 700 | c.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1)); |
| 691 | 701 | } |
| 692 | 702 | List<Patients> patients = mongoTemplate.find(Query.query(c).with(new Sort(Sort.Direction.DESC, "created")), Patients.class); |
| 703 | + for (Patients patient : patients) { | |
| 704 | + System.out.println(patient); | |
| 705 | + } | |
| 693 | 706 | |
| 694 | 707 | List<String> userIds = new ArrayList<>(); |
| 695 | 708 | List<Map<String, String>> patientInfos = new ArrayList<>(); |
| ... | ... | @@ -803,7 +816,37 @@ |
| 803 | 816 | |
| 804 | 817 | @Override |
| 805 | 818 | public BaseObjectResponse unUsedPeopleInfo(Date startDate, Date endDate, String provinceId, String cityId, String areaId, String hospitalId, Integer page, Integer limit, Integer userId) { |
| 806 | - List<String> hospitalIds = Arrays.asList(hospitalId); | |
| 819 | + BaseObjectResponse baseObjectResponse = unUsed(startDate, endDate, provinceId, cityId, areaId, hospitalId, page, limit, userId); | |
| 820 | + PageResult pageResult = (PageResult) baseObjectResponse.getData(); | |
| 821 | + List<Map<String, Object>> datas = (List<Map<String, Object>>) pageResult.getGrid(); | |
| 822 | + for (Map<String, Object> map : datas) { | |
| 823 | + if(hospitalId.equals(map.get("hospitalId").toString())) { | |
| 824 | + List<String> patientIds = (List<String>) map.get("unUsedIds"); | |
| 825 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
| 826 | + for (String patientId : patientIds) { | |
| 827 | + Patients pt = mongoTemplate.findById(patientId, Patients.class); | |
| 828 | + if(pt != null) { | |
| 829 | + Map<String, Object> temp = new HashMap<>(); | |
| 830 | + temp.put("username", pt.getUsername()); | |
| 831 | + temp.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(pt.getPhone())); | |
| 832 | + temp.put("cardNo", com.lyms.platform.common.utils.StringUtils.encryCardNo(pt.getCardNo())); | |
| 833 | + String residenceAddress = findName(pt.getProvinceRegisterId()) + findName(pt.getCityRegisterId()) + findName(pt.getAreaRegisterId()) + findName(pt.getStreetRegisterId()) + pt.getAddressRegister(); | |
| 834 | + temp.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */ | |
| 835 | + String householdAddress = findName(pt.getProvinceId()) + findName(pt.getCityId()) + findName(pt.getAreaId()) + findName(pt.getStreetId()) + pt.getAddress(); | |
| 836 | + temp.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */ | |
| 837 | + temp.put("week", DateUtil.getWeekDesc(pt.getLastMenses(), new Date())); /** 当前孕周 */ | |
| 838 | + temp.put("buildWeek", DateUtil.getWeekDesc(pt.getBookbuildingDate(), new Date())); /** 建档孕周 */ | |
| 839 | + temp.put("buildDate", DateUtil.getyyyy_MM_dd(pt.getBookbuildingDate())); /** 建档日期 */ | |
| 840 | + temp.put("doctorName", couponMapper.getUserName(pt.getBookbuildingDoctor())); | |
| 841 | + temp.put("hospitalName", couponMapper.findHospitalNameById(pt.getHospitalId())); | |
| 842 | + restList.add(temp); | |
| 843 | + } | |
| 844 | + } | |
| 845 | + return RespBuilder.buildSuccess(new PageResult(patientIds.size(), page, limit, CollectionUtils.getPageIds(restList, page, limit))); | |
| 846 | + } | |
| 847 | + } | |
| 848 | + | |
| 849 | + /* List<String> hospitalIds = Arrays.asList(hospitalId); | |
| 807 | 850 | List<Map<String, Object>> datas = couponMapper.findHospitalInfoByIds(hospitalIds); |
| 808 | 851 | List<Patients> patients = getPatients(hospitalIds, datas, startDate, endDate, provinceId, cityId, areaId, true); |
| 809 | 852 | if(CollectionUtils.isNotEmpty(patients)) { |
| 810 | 853 | |
| ... | ... | @@ -827,12 +870,12 @@ |
| 827 | 870 | temp.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(pt.getPhone())); |
| 828 | 871 | temp.put("cardNo", com.lyms.platform.common.utils.StringUtils.encryCardNo(pt.getCardNo())); |
| 829 | 872 | String residenceAddress = findName(pt.getProvinceRegisterId()) + findName(pt.getCityRegisterId()) + findName(pt.getAreaRegisterId()) + findName(pt.getStreetRegisterId()) + pt.getAddressRegister(); |
| 830 | - temp.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */ | |
| 873 | + temp.put("residenceAddress", residenceAddress.replace("null", "")); *//** 居住地 *//* | |
| 831 | 874 | String householdAddress = findName(pt.getProvinceId()) + findName(pt.getCityId()) + findName(pt.getAreaId()) + findName(pt.getStreetId()) + pt.getAddress(); |
| 832 | - temp.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */ | |
| 833 | - temp.put("week", DateUtil.getWeekDesc(pt.getLastMenses(), new Date())); /** 当前孕周 */ | |
| 834 | - temp.put("buildWeek", DateUtil.getWeekDesc(pt.getBookbuildingDate(), new Date())); /** 建档孕周 */ | |
| 835 | - temp.put("buildDate", DateUtil.getyyyy_MM_dd(pt.getBookbuildingDate())); /** 建档日期 */ | |
| 875 | + temp.put("householdAddress", householdAddress.replace("null", "")); *//** 户籍地 *//* | |
| 876 | + temp.put("week", DateUtil.getWeekDesc(pt.getLastMenses(), new Date())); *//** 当前孕周 *//* | |
| 877 | + temp.put("buildWeek", DateUtil.getWeekDesc(pt.getBookbuildingDate(), new Date())); *//** 建档孕周 *//* | |
| 878 | + temp.put("buildDate", DateUtil.getyyyy_MM_dd(pt.getBookbuildingDate())); *//** 建档日期 *//* | |
| 836 | 879 | temp.put("doctorName", couponMapper.getUserName(pt.getBookbuildingDoctor())); |
| 837 | 880 | temp.put("hospitalName", couponMapper.findHospitalNameById(pt.getHospitalId())); |
| 838 | 881 | restList.add(temp); |
| ... | ... | @@ -840,7 +883,7 @@ |
| 840 | 883 | } |
| 841 | 884 | return RespBuilder.buildSuccess(new PageResult(count, page, limit, restList)); |
| 842 | 885 | } |
| 843 | - } | |
| 886 | + }*/ | |
| 844 | 887 | return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); |
| 845 | 888 | } |
| 846 | 889 |