Commit 830c8204e20be806bbcf2bb46d2fe681b1cb0748
1 parent
ddd2798e24
Exists in
master
and in
6 other branches
报表数据完善
Showing 1 changed file with 116 additions and 21 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
830c820
| ... | ... | @@ -731,7 +731,7 @@ |
| 731 | 731 | if(StringUtils.isNotEmpty(userId)) { |
| 732 | 732 | if(StringUtils.isNotEmpty(coupon)) { |
| 733 | 733 | List<String> list = CollectionUtils.asList(coupon, String.class); |
| 734 | - if(list.contains(7) || list.contains(8)) { | |
| 734 | + if(list.contains("7") || list.contains("8")) { | |
| 735 | 735 | setUserSendInfoByBaby(userId, map); |
| 736 | 736 | } else { |
| 737 | 737 | setUserSendInfo(userId, map); /** 设置姓名、居住地、户籍地、电话 */ |
| 738 | 738 | |
| 739 | 739 | |
| ... | ... | @@ -809,13 +809,31 @@ |
| 809 | 809 | } |
| 810 | 810 | } else if(type == 2) { |
| 811 | 811 | AntExChuModel antexc = mongoTemplate.findById(usedId, AntExChuModel.class); |
| 812 | + List<SortTempModel> sortTempModels = new ArrayList<>(); | |
| 813 | + String id = null; | |
| 814 | + | |
| 812 | 815 | if(antexc != null) { |
| 813 | 816 | checkDate = antexc.getCheckTime(); |
| 814 | 817 | username = findUserNameByPid(antexc.getPid()); |
| 815 | 818 | week = DateUtil.getWeekDesc(antexc.getLastMenses(), antexc.getCheckTime()); |
| 816 | - number = findNumberByList("checkTime", "pid", antexc.getPid(), antexc, AntExChuModel.class); | |
| 819 | +// number = findNumberByList("checkTime", "pid", antexc.getPid(), antexc, AntExChuModel.class); | |
| 817 | 820 | operatorOrgName = couponMapper.findHospitalNameById(antexc.getHospitalId()); |
| 818 | 821 | phone = findPhoneByPid(antexc.getPid()); |
| 822 | + | |
| 823 | + id = antexc.getId();/** 处理排序 */ | |
| 824 | + List<AntExChuModel> AntExChuModel = mongoTemplate.find(Query.query(Criteria.where("pid").is(antexc.getPid())), AntExChuModel.class); | |
| 825 | + if(CollectionUtils.isNotEmpty(AntExChuModel)) { | |
| 826 | + for (AntExChuModel antExChuModel : AntExChuModel) { | |
| 827 | + sortTempModels.add(new SortTempModel(antExChuModel.getId(), antExChuModel.getCheckTime())); | |
| 828 | + } | |
| 829 | + } | |
| 830 | + List<AntenatalExaminationModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(antexc.getPid())), AntenatalExaminationModel.class); | |
| 831 | + if(CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 832 | + for (AntenatalExaminationModel antExChuModel : antExChuModels) { | |
| 833 | + sortTempModels.add(new SortTempModel(antExChuModel.getId(), antExChuModel.getCreated())); | |
| 834 | + } | |
| 835 | + } | |
| 836 | + | |
| 819 | 837 | } else { |
| 820 | 838 | AntenatalExaminationModel antenatal = mongoTemplate.findById(usedId, AntenatalExaminationModel.class); |
| 821 | 839 | if(antenatal != null) { |
| 822 | 840 | |
| 823 | 841 | |
| 824 | 842 | |
| 825 | 843 | |
| ... | ... | @@ -823,22 +841,35 @@ |
| 823 | 841 | username = findUserNameByPid(antenatal.getPid()); |
| 824 | 842 | week = antenatal.getCurrentDueDate(); |
| 825 | 843 | List<AntenatalExaminationModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(antenatal.getPid())).with(new Sort(Sort.Direction.ASC, "created")), AntenatalExaminationModel.class); |
| 826 | - List<AntExChuModel> antexcs = mongoTemplate.find(Query.query(Criteria.where("pid").is(antenatal.getPid())), AntExChuModel.class); | |
| 827 | - if(CollectionUtils.isNotEmpty(antexcs)) { | |
| 828 | 844 | |
| 829 | - } | |
| 830 | - | |
| 845 | + id = antenatal.getId(); | |
| 831 | 846 | if(CollectionUtils.isNotEmpty(antExChuModels)) { |
| 832 | - for(int i = 0; i < antExChuModels.size(); i++) { | |
| 833 | - if(antExChuModels.get(i).getId().equals(antenatal.getId())) { | |
| 834 | - number = ++i; | |
| 835 | - } | |
| 847 | + for (AntenatalExaminationModel antExChuModel : antExChuModels) { | |
| 848 | + sortTempModels.add(new SortTempModel(antExChuModel.getId(), antExChuModel.getCreated())); | |
| 836 | 849 | } |
| 837 | 850 | } |
| 851 | + List<AntExChuModel> AntExChuModel = mongoTemplate.find(Query.query(Criteria.where("pid").is(antenatal.getPid())), AntExChuModel.class); | |
| 852 | + if(CollectionUtils.isNotEmpty(AntExChuModel)) { | |
| 853 | + for (AntExChuModel antExChuModel : AntExChuModel) { | |
| 854 | + sortTempModels.add(new SortTempModel(antExChuModel.getId(), antExChuModel.getCheckTime())); | |
| 855 | + } | |
| 856 | + } | |
| 838 | 857 | operatorOrgName = couponMapper.findHospitalNameById(antenatal.getHospitalId()); |
| 839 | 858 | phone = findPhoneByPid(antenatal.getPid()); |
| 840 | 859 | } |
| 841 | 860 | } |
| 861 | + Collections.sort(sortTempModels, new Comparator<SortTempModel>() { | |
| 862 | + @Override | |
| 863 | + public int compare(SortTempModel o1, SortTempModel o2) { | |
| 864 | + return o1.getDate().after(o2.getDate()) ? 1 : -1; | |
| 865 | + } | |
| 866 | + }); | |
| 867 | + | |
| 868 | + for(int i = 0; i < sortTempModels.size(); i++) { | |
| 869 | + if(sortTempModels.get(i).getId().equals(id)) { | |
| 870 | + number = ++i; | |
| 871 | + } | |
| 872 | + } | |
| 842 | 873 | } else if(type == 4) { |
| 843 | 874 | MaternalDeliverModel maternalDeliverModel = mongoTemplate.findById(usedId, MaternalDeliverModel.class); |
| 844 | 875 | if(maternalDeliverModel != null) { |
| 845 | 876 | |
| ... | ... | @@ -846,20 +877,20 @@ |
| 846 | 877 | week = DateUtil.getWeekDesc(findLastMensesByPatientId(maternalDeliverModel.getParentId()), useDate); |
| 847 | 878 | username = findUserNameByPid(maternalDeliverModel.getPid()); |
| 848 | 879 | operatorOrgName = couponMapper.findHospitalNameById(maternalDeliverModel.getHospitalId()); |
| 849 | - phone = findPhoneByPid(maternalDeliverModel.getHospitalId()); | |
| 880 | + Patients patients = mongoTemplate.findById(maternalDeliverModel.getParentId(), Patients.class); | |
| 881 | + if(patients != null) { | |
| 882 | + phone = patients.getPhone(); | |
| 883 | + } | |
| 850 | 884 | } |
| 851 | 885 | } else if(type == 5) { |
| 852 | 886 | DischargeAbstractMotherModel monther = mongoTemplate.findById(usedId, DischargeAbstractMotherModel.class); |
| 853 | 887 | if(monther != null) { |
| 854 | - username = findUserNameByPid(monther.getpId()); | |
| 855 | - phone = findPhoneByPid(monther.getpId()); | |
| 856 | - String patientId = monther.getPatientId(); | |
| 857 | - if(StringUtils.isNotEmpty(patientId)) { | |
| 858 | - Patients patients = mongoTemplate.findById(usedId, Patients.class); | |
| 859 | - if(patients != null) { | |
| 860 | - operatorOrgName = couponMapper.findHospitalNameById(patients.getHospitalId()); | |
| 861 | - week = "产后" + DateUtil.getDays(patients.getFmDate(), useDate) + "天"; | |
| 862 | - } | |
| 888 | + Patients patients = mongoTemplate.findById(monther.getPatientId(), Patients.class); | |
| 889 | + if(patients != null) { | |
| 890 | + username = patients.getUsername(); | |
| 891 | + phone = patients.getPhone(); | |
| 892 | + operatorOrgName = couponMapper.findHospitalNameById(patients.getHospitalId()); | |
| 893 | + week = "产后" + DateUtil.getDays(patients.getFmDate(), useDate) + "天"; | |
| 863 | 894 | } |
| 864 | 895 | } |
| 865 | 896 | } else if(type == 6) { |
| ... | ... | @@ -868,7 +899,10 @@ |
| 868 | 899 | username = findUserNameByPid(postReviewModel.getPid()); |
| 869 | 900 | phone = findPhoneByPid(postReviewModel.getPid()); |
| 870 | 901 | operatorOrgName = couponMapper.findHospitalNameById(postReviewModel.getHospitalId()); |
| 871 | - week = "产后" + DateUtil.getDays(findLastMensesByPatientId(postReviewModel.getParentId()), useDate) + "天"; | |
| 902 | + Patients patients = mongoTemplate.findById(postReviewModel.getParentId(), Patients.class); | |
| 903 | + if(patients != null) { | |
| 904 | + week = "产后" + DateUtil.getDays(patients.getFmDate(), useDate) + "天"; | |
| 905 | + } | |
| 872 | 906 | } |
| 873 | 907 | } else if(type == 7) { |
| 874 | 908 | BabyModel babyModel = mongoTemplate.findById(usedId, BabyModel.class); |
| ... | ... | @@ -898,6 +932,67 @@ |
| 898 | 932 | map.put("operatorOrgName", operatorOrgName); |
| 899 | 933 | map.put("doctorName", doctorName); |
| 900 | 934 | map.put("phone", phone); |
| 935 | + } | |
| 936 | + | |
| 937 | + public static class SortTempModel { | |
| 938 | + private Date date; | |
| 939 | + private String id; | |
| 940 | + | |
| 941 | + public SortTempModel(String id, Date date) { | |
| 942 | + this.date = date; | |
| 943 | + this.id = id; | |
| 944 | + } | |
| 945 | + | |
| 946 | + public SortTempModel() { | |
| 947 | + super(); | |
| 948 | + } | |
| 949 | + | |
| 950 | + public Date getDate() { | |
| 951 | + return date; | |
| 952 | + } | |
| 953 | + | |
| 954 | + public void setDate(Date date) { | |
| 955 | + this.date = date; | |
| 956 | + } | |
| 957 | + | |
| 958 | + public String getId() { | |
| 959 | + return id; | |
| 960 | + } | |
| 961 | + | |
| 962 | + public void setId(String id) { | |
| 963 | + this.id = id; | |
| 964 | + } | |
| 965 | + | |
| 966 | + @Override | |
| 967 | + public String toString() { | |
| 968 | + return "SortTempModel{" + | |
| 969 | + "date=" + date + | |
| 970 | + ", id='" + id + '\'' + | |
| 971 | + '}'; | |
| 972 | + } | |
| 973 | + } | |
| 974 | + | |
| 975 | + public static void main(String[] args) { | |
| 976 | + SortTempModel temp = new SortTempModel(); | |
| 977 | + temp.setId("123"); | |
| 978 | + temp.setDate(DateUtil.parseYMD("2016-04-05")); | |
| 979 | + | |
| 980 | + SortTempModel temp2 = new SortTempModel(); | |
| 981 | + temp2.setId("456"); | |
| 982 | + temp2.setDate(DateUtil.parseYMD("2016-05-05")); | |
| 983 | + | |
| 984 | + List<SortTempModel> sortTempModels = new ArrayList<>(); | |
| 985 | + sortTempModels.add(temp2); | |
| 986 | + sortTempModels.add(temp); | |
| 987 | + System.out.println(sortTempModels); | |
| 988 | + Collections.sort(sortTempModels, new Comparator<SortTempModel>() { | |
| 989 | + @Override | |
| 990 | + public int compare(SortTempModel o1, SortTempModel o2) { | |
| 991 | + return o1.getDate().after(o2.getDate()) ? 1 : -1; | |
| 992 | + } | |
| 993 | + | |
| 994 | + }); | |
| 995 | + System.out.println(sortTempModels); | |
| 901 | 996 | } |
| 902 | 997 | |
| 903 | 998 | private String findUserNameByPid(String pid) { |