Commit 86841a66f4c387cfdb091f1a0fb8b3d2f405c8a0
1 parent
070ae9ec7c
Exists in
master
and in
6 other branches
新曾高危优化
Showing 1 changed file with 28 additions and 94 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
86841a6
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.*; |
| 4 | -import com.lyms.platform.common.base.PageInfo; | |
| 5 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 6 | 5 | import com.lyms.platform.common.enums.RiskDefaultTypeEnum; |
| 7 | 6 | import com.lyms.platform.common.enums.YnEnums; |
| 8 | 7 | |
| ... | ... | @@ -177,23 +176,23 @@ |
| 177 | 176 | //区域范围内孕妇 |
| 178 | 177 | if (isRegion) { |
| 179 | 178 | List<String> hospitalList = null; |
| 180 | - //王平说的 必须要给区域医院权限,不然他就是蠢逼 201611124 16:41 | |
| 181 | - hospitalList = new ArrayList<>(); | |
| 182 | - String hospital = autoMatchFacade.getHospitalId(userId); | |
| 183 | - if (null != hospital) { | |
| 184 | - hospitalList.add(hospital); | |
| 179 | + //王平说的 必须要给区域医院权限,不然他就是蠢逼 201611124 16:41 | |
| 180 | + hospitalList = new ArrayList<>(); | |
| 181 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 182 | + if (null != hospital) { | |
| 183 | + hospitalList.add(hospital); | |
| 184 | + } | |
| 185 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
| 186 | + dataPermissionsModelQuery.setUserId(userId); | |
| 187 | + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
| 188 | + if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
| 189 | + Set<String> set = permissionsModels.get(0).getData().keySet(); | |
| 190 | + Iterator<String> it = set.iterator(); | |
| 191 | + while (it.hasNext()) { | |
| 192 | + String id = it.next(); | |
| 193 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(id) && !hospitalList.contains(id)) { | |
| 194 | + hospitalList.add(id); | |
| 185 | 195 | } |
| 186 | - DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
| 187 | - dataPermissionsModelQuery.setUserId(userId); | |
| 188 | - List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
| 189 | - if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
| 190 | - Set<String> set = permissionsModels.get(0).getData().keySet(); | |
| 191 | - Iterator<String> it = set.iterator(); | |
| 192 | - while (it.hasNext()) { | |
| 193 | - String id = it.next(); | |
| 194 | - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(id) && !hospitalList.contains(id)) { | |
| 195 | - hospitalList.add(id); | |
| 196 | - } | |
| 197 | 196 | } |
| 198 | 197 | } |
| 199 | 198 | |
| ... | ... | @@ -626,8 +625,8 @@ |
| 626 | 625 | } |
| 627 | 626 | |
| 628 | 627 | //antExRecordQuery.setLevelId(antExManagerQueryRequest.getLevel()); |
| 629 | - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created"); | |
| 630 | - System.out.println("antExRecordModelList====================" + antExRecordModelList.size()); | |
| 628 | + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC,"created"); | |
| 629 | + System.out.println("antExRecordModelList===================="+antExRecordModelList.size()); | |
| 631 | 630 | Map<String,List<AntExRecordModel>> map = handleAntexRecord(antExRecordModelList); |
| 632 | 631 | AntExRecordQuery pageAntExRecordsQuery = new AntExRecordQuery(); |
| 633 | 632 | |
| ... | ... | @@ -645,7 +644,7 @@ |
| 645 | 644 | { |
| 646 | 645 | |
| 647 | 646 | initBasicData(); |
| 648 | - List<Map<String,Object>> ids = new ArrayList<>(); | |
| 647 | + List<String> ids = new ArrayList<>(); | |
| 649 | 648 | Map<String,List<String>> incriskMap = new HashMap<>(); |
| 650 | 649 | |
| 651 | 650 | if (map.size() > 0) |
| ... | ... | @@ -674,7 +673,7 @@ |
| 674 | 673 | public Map<String, Object> call() { |
| 675 | 674 | Map<String, Object> result = new HashMap<String, Object>(); |
| 676 | 675 | if (CollectionUtils.isNotEmpty(tempList)) { |
| 677 | - List<Map<String,Object>> ids = new ArrayList<>(); | |
| 676 | + List<String> ids = new ArrayList<>(); | |
| 678 | 677 | Map<String, List<String>> incriskMap = new HashMap<>(); |
| 679 | 678 | AntExRecordQuery beforeRecordQuery = new AntExRecordQuery(); |
| 680 | 679 | for (String patientId : tempList) { |
| ... | ... | @@ -696,10 +695,7 @@ |
| 696 | 695 | |
| 697 | 696 | if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") |
| 698 | 697 | && getConditionRisk(request.getRiskFactorId(), currentRiskList, request.getLevel())) { |
| 699 | - Map<String,Object> objMap = new HashMap<String, Object>(); | |
| 700 | - objMap.put("id",oneRecord.getId()); | |
| 701 | - objMap.put("time",oneRecord.getCheckTime()); | |
| 702 | - ids.add(objMap); | |
| 698 | + ids.add(oneRecord.getId()); | |
| 703 | 699 | incriskMap.put(oneRecord.getId(), currentRiskList); |
| 704 | 700 | } else if (CollectionUtils.isNotEmpty(beforeRiskList)) { |
| 705 | 701 | List incrHrisk = new ArrayList(); |
| 706 | 702 | |
| ... | ... | @@ -709,20 +705,14 @@ |
| 709 | 705 | } |
| 710 | 706 | } |
| 711 | 707 | if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(), incrHrisk, request.getLevel())) { |
| 712 | - Map<String,Object> objMap = new HashMap<String, Object>(); | |
| 713 | - objMap.put("id",oneRecord.getId()); | |
| 714 | - objMap.put("time",oneRecord.getCheckTime()); | |
| 715 | - ids.add(objMap); | |
| 708 | + ids.add(oneRecord.getId()); | |
| 716 | 709 | incriskMap.put(oneRecord.getId(), incrHrisk); |
| 717 | 710 | } |
| 718 | 711 | } |
| 719 | 712 | } else { |
| 720 | 713 | if (CollectionUtils.isNotEmpty(oneRecord.gethRisk()) && getConditionRisk(request.getRiskFactorId(), |
| 721 | 714 | oneRecord.gethRisk(), request.getLevel())) { |
| 722 | - Map<String,Object> objMap = new HashMap<String, Object>(); | |
| 723 | - objMap.put("id",oneRecord.getId()); | |
| 724 | - objMap.put("time",oneRecord.getCheckTime()); | |
| 725 | - ids.add(objMap); | |
| 715 | + ids.add(oneRecord.getId()); | |
| 726 | 716 | incriskMap.put(oneRecord.getId(), oneRecord.gethRisk()); |
| 727 | 717 | } |
| 728 | 718 | } |
| ... | ... | @@ -750,10 +740,7 @@ |
| 750 | 740 | |
| 751 | 741 | if (CollectionUtils.isNotEmpty(beforeRiskList) && beforeRiskList.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") |
| 752 | 742 | && getConditionRisk(request.getRiskFactorId(), currentRiskList, request.getLevel())) { |
| 753 | - Map<String,Object> objMap = new HashMap<String, Object>(); | |
| 754 | - objMap.put("id",oneRecord.getId()); | |
| 755 | - objMap.put("time",oneRecord.getCheckTime()); | |
| 756 | - ids.add(objMap); | |
| 743 | + ids.add(oneRecord.getId()); | |
| 757 | 744 | incriskMap.put(oneRecord.getId(), currentRiskList); |
| 758 | 745 | } else if (CollectionUtils.isNotEmpty(beforeRiskList)) { |
| 759 | 746 | List<String> incrHrisk = new ArrayList(); |
| ... | ... | @@ -764,10 +751,7 @@ |
| 764 | 751 | } |
| 765 | 752 | if (CollectionUtils.isNotEmpty(incrHrisk) && getConditionRisk(request.getRiskFactorId(), incrHrisk, request.getLevel())) { |
| 766 | 753 | |
| 767 | - Map<String,Object> objMap = new HashMap<String, Object>(); | |
| 768 | - objMap.put("id",oneRecord.getId()); | |
| 769 | - objMap.put("time",oneRecord.getCheckTime()); | |
| 770 | - ids.add(objMap); | |
| 754 | + ids.add(oneRecord.getId()); | |
| 771 | 755 | incriskMap.put(oneRecord.getId(), incrHrisk); |
| 772 | 756 | } |
| 773 | 757 | } |
| ... | ... | @@ -783,7 +767,7 @@ |
| 783 | 767 | |
| 784 | 768 | for (Future f : listFuture) { |
| 785 | 769 | try { |
| 786 | - Map<String,Object> fmap = (Map) f.get(30, TimeUnit.SECONDS); | |
| 770 | + Map<String,Object> fmap = (Map) f.get(30, TimeUnit.SECONDS); | |
| 787 | 771 | if (fmap.get("ids") != null) |
| 788 | 772 | { |
| 789 | 773 | ids.addAll((List)fmap.get("ids")); |
| 790 | 774 | |
| 791 | 775 | |
| 792 | 776 | |
| 793 | 777 | |
| 794 | 778 | |
| 795 | 779 | |
| ... | ... | @@ -799,54 +783,18 @@ |
| 799 | 783 | } |
| 800 | 784 | } |
| 801 | 785 | riskBasicMap.clear(); |
| 802 | - | |
| 803 | 786 | } |
| 804 | - System.out.println("ids ============ " + ids.size()); | |
| 805 | - if (CollectionUtils.isEmpty(ids)) | |
| 806 | - { | |
| 807 | - return null; | |
| 808 | - } | |
| 809 | 787 | |
| 810 | 788 | if (CollectionUtils.isEmpty(ids)) |
| 811 | 789 | { |
| 812 | - Collections.sort(ids, new Comparator<Map<String, Object>>() { | |
| 813 | - @Override | |
| 814 | - public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 815 | - Object d1 = o1.get("time"); | |
| 816 | - Object d2 = o2.get("time"); | |
| 817 | - if (d1 != null && d1 != null) | |
| 818 | - { | |
| 819 | - return ((Date)d1).compareTo((Date)d2); | |
| 820 | - } | |
| 821 | - return 0; | |
| 822 | - } | |
| 823 | - }); | |
| 824 | - } | |
| 825 | - | |
| 826 | - int index = request.getPage() * request.getLimit() - request.getLimit(); | |
| 827 | - int from = request.getPage() * request.getLimit(); | |
| 828 | - System.out.println("index = " + index + " from = " + from); | |
| 829 | - | |
| 830 | - List<Map<String,Object>> pages = ids.subList(index,from); | |
| 831 | - if (CollectionUtils.isEmpty(pages)) | |
| 832 | - { | |
| 833 | 790 | return null; |
| 834 | 791 | } |
| 835 | - | |
| 836 | - List<String> recordIds = new ArrayList<>(); | |
| 837 | - for (Map<String,Object> item : pages) | |
| 838 | - { | |
| 839 | - recordIds.add(String.valueOf(item.get("id"))); | |
| 840 | - } | |
| 841 | - | |
| 842 | 792 | pageAntExRecordsQuery.setNeed("true"); |
| 843 | 793 | pageAntExRecordsQuery.setPage(request.getPage()); |
| 844 | 794 | pageAntExRecordsQuery.setLimit(request.getLimit()); |
| 845 | - pageAntExRecordsQuery.setIds(recordIds); | |
| 795 | + pageAntExRecordsQuery.setIds(ids); | |
| 846 | 796 | pageAntExRecordsQuery.setLevelId(request.getLevel()); |
| 847 | - System.out.println("ids = " + ids.size()); | |
| 848 | 797 | |
| 849 | - pageAntExRecordsQuery.mysqlBuild(ids.size()); | |
| 850 | 798 | |
| 851 | 799 | List<AntExRecordModel> pageAntExRecords = recordService.queryAntExRecords(pageAntExRecordsQuery); |
| 852 | 800 | if (CollectionUtils.isNotEmpty(pageAntExRecords)) |
| ... | ... | @@ -873,20 +821,6 @@ |
| 873 | 821 | return false; |
| 874 | 822 | } |
| 875 | 823 | return true; |
| 876 | - | |
| 877 | -// if (StringUtils.isNotEmpty(level)) | |
| 878 | -// { | |
| 879 | -// BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
| 880 | -// basicConfigQuery.setIds(incrHrisk); | |
| 881 | -// basicConfigQuery.setParentId(level); | |
| 882 | -// List<BasicConfig> configs = basicConfigService.queryBasicConfig(basicConfigQuery); | |
| 883 | -// if (CollectionUtils.isNotEmpty(configs)) | |
| 884 | -// { | |
| 885 | -// return true; | |
| 886 | -// } | |
| 887 | -// return false; | |
| 888 | -// } | |
| 889 | -// return true; | |
| 890 | 824 | } |
| 891 | 825 | |
| 892 | 826 | private Map<String,List<String>> riskBasicMap = new HashMap<>(); |
| ... | ... | @@ -920,7 +854,7 @@ |
| 920 | 854 | { |
| 921 | 855 | return isExistsLevel(level,incrHrisk); |
| 922 | 856 | } |
| 923 | - return incrHrisk.contains(riskId) && isExistsLevel(level,incrHrisk); | |
| 857 | + return incrHrisk.contains(riskId) && isExistsLevel(level,incrHrisk); | |
| 924 | 858 | } |
| 925 | 859 | |
| 926 | 860 |