Commit 90a194492d92a6bbfd61aeea2512edb8f135b634
1 parent
c2f96380c2
Exists in
master
and in
6 other branches
bug修复
Showing 1 changed file with 69 additions and 67 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
90a1944
... | ... | @@ -1719,22 +1719,27 @@ |
1719 | 1719 | */ |
1720 | 1720 | public BaseListResponse postpartumDeliver(MatdeliverFollowRequest matdeliverFollowRequest) { |
1721 | 1721 | BaseListResponse listResponse = new BaseListResponse(); |
1722 | - | |
1722 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
1723 | 1723 | List<MatdeliverFollowListResult> matdeliverFollowListResults = new ArrayList<>(); |
1724 | 1724 | //根据用户id获取医院ID |
1725 | 1725 | String hospitalId = autoMatchFacade.getHospitalId(matdeliverFollowRequest.getOperatorId()); |
1726 | 1726 | |
1727 | 1727 | // 构造医院id集合 |
1728 | 1728 | List<String> hospitalList = new ArrayList<>(); |
1729 | + List<String> fmhospitalId = new ArrayList<>(); | |
1729 | 1730 | //传入了具体的医院id |
1730 | 1731 | if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalId())) { |
1731 | 1732 | hospitalList.add(matdeliverFollowRequest.getHospitalId()); |
1732 | - } else { | |
1733 | + if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalProvinceId()) || StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalCityId()) || StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalAreaId())) { | |
1734 | + matDeliverQuery.setFmHospitalList(hospitalList); | |
1735 | + } | |
1733 | 1736 | |
1734 | - //默认添加当前医院 | |
1735 | - hospitalList.add(hospitalId); | |
1737 | + } else { | |
1736 | 1738 | |
1737 | - /*DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
1739 | + //默认添加当前医院 | |
1740 | + hospitalList.add(hospitalId); | |
1741 | + | |
1742 | + /* DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
1738 | 1743 | dataPermissionsModelQuery.setUserId(matdeliverFollowRequest.getOperatorId()); |
1739 | 1744 | List<DataPermissionsModel> dataPermissionsModelList = dataPermissionService.queryPermission(dataPermissionsModelQuery); |
1740 | 1745 | if (CollectionUtils.isNotEmpty(dataPermissionsModelList)) { |
1741 | 1746 | |
1742 | 1747 | |
1743 | 1748 | |
1744 | 1749 | |
1745 | 1750 | |
... | ... | @@ -1745,39 +1750,42 @@ |
1745 | 1750 | } |
1746 | 1751 | } |
1747 | 1752 | }*/ |
1748 | - // 未传入查询条件,进行院内系统进行查询 | |
1749 | - if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalProvinceId()) || StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalCityId()) || StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalAreaId())) { | |
1750 | - // 传入了查询条件 | |
1751 | - OrganizationQuery organizationQuery = new OrganizationQuery(); | |
1752 | - if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalProvinceId())) { | |
1753 | - organizationQuery.setProvinceId(matdeliverFollowRequest.getHospitalProvinceId()); | |
1754 | - } | |
1755 | - if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalCityId())) { | |
1756 | - organizationQuery.setCityId(matdeliverFollowRequest.getHospitalCityId()); | |
1757 | - } | |
1758 | - if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalAreaId())) { | |
1759 | - organizationQuery.setAreaId(matdeliverFollowRequest.getHospitalAreaId()); | |
1760 | - } | |
1761 | - organizationQuery.setYn(YnEnums.YES.getId()); | |
1762 | - List<Organization> organizationList = organizationService.queryHospitals(organizationQuery); | |
1763 | - List<String> orgId = new ArrayList<>(); | |
1764 | - if (CollectionUtils.isNotEmpty(organizationList)) { | |
1765 | - for (Organization organization : organizationList) { | |
1766 | - orgId.add(organization.getId().toString()); | |
1753 | + // 未传入查询条件,进行院内系统进行查询 | |
1754 | + if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalProvinceId()) || StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalCityId()) || StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalAreaId())) { | |
1755 | + // 传入了查询条件 | |
1756 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
1757 | + if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalProvinceId())) { | |
1758 | + organizationQuery.setProvinceId(matdeliverFollowRequest.getHospitalProvinceId()); | |
1767 | 1759 | } |
1760 | + if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalCityId())) { | |
1761 | + organizationQuery.setCityId(matdeliverFollowRequest.getHospitalCityId()); | |
1762 | + } | |
1763 | + if (StringUtils.isNotEmpty(matdeliverFollowRequest.getHospitalAreaId())) { | |
1764 | + organizationQuery.setAreaId(matdeliverFollowRequest.getHospitalAreaId()); | |
1765 | + } | |
1766 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
1767 | + List<Organization> organizationList = organizationService.queryHospitals(organizationQuery); | |
1768 | + List<String> orgId = new ArrayList<>(); | |
1769 | + if (CollectionUtils.isNotEmpty(organizationList)) { | |
1770 | + for (Organization organization : organizationList) { | |
1771 | + orgId.add(organization.getId().toString()); | |
1772 | + fmhospitalId.add(organization.getId().toString()); | |
1773 | + } | |
1774 | + } | |
1775 | + | |
1776 | + if (CollectionUtils.isEmpty(fmhospitalId)) { | |
1777 | + return listResponse; | |
1778 | + } else { | |
1779 | + hospitalList.retainAll(fmhospitalId); | |
1780 | + if (CollectionUtils.isEmpty(fmhospitalId)) { | |
1781 | + return listResponse; | |
1782 | + } | |
1783 | + matDeliverQuery.setFmHospitalList(hospitalList); | |
1784 | + } | |
1768 | 1785 | } |
1769 | - //取区域范围内的医院id。交集 | |
1770 | - hospitalList.retainAll(orgId); | |
1771 | 1786 | } |
1772 | - } | |
1773 | 1787 | |
1774 | - if (CollectionUtils.isEmpty(hospitalList)) { | |
1775 | - // 没有查到,直接抛出 | |
1776 | - return listResponse; | |
1777 | - } | |
1778 | 1788 | |
1779 | - MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
1780 | - | |
1781 | 1789 | if (matdeliverFollowRequest.getFollowStarDate() != null) { |
1782 | 1790 | MatDeliverFollowQuery matDeliverFollowQuery = new MatDeliverFollowQuery(); |
1783 | 1791 | matDeliverFollowQuery.setVisitStartDate(matdeliverFollowRequest.getFollowStarDate()); |
... | ... | @@ -1827,7 +1835,8 @@ |
1827 | 1835 | patientsQuery.setFmDateEnd(DateUtil.addDay(new Date(), -29)); |
1828 | 1836 | } |
1829 | 1837 | } |
1830 | - patientsQuery.setFmHospitalQueryList(hospitalList); | |
1838 | + //patientsQuery.setFmHospitalQueryList(hospitalList); | |
1839 | + //patientsQuery.setTownOrgId(hospitalId); | |
1831 | 1840 | |
1832 | 1841 | List<Patients> patientsList = patientsService.queryPatient(patientsQuery); |
1833 | 1842 | if (CollectionUtils.isEmpty(patientsList)) { |
... | ... | @@ -1881,7 +1890,7 @@ |
1881 | 1890 | |
1882 | 1891 | // 访视列表无需加上分娩医院,因此注释 |
1883 | 1892 | //matDeliverQuery.setFmHospitalList(hospitalList); |
1884 | - matDeliverQuery.setFsHospital(hospitalId); | |
1893 | + matDeliverQuery.setFsHospitalId(hospitalId); | |
1885 | 1894 | |
1886 | 1895 | matDeliverQuery.setContactResult(matdeliverFollowRequest.getContactResult()); |
1887 | 1896 | if (matdeliverFollowRequest.getContactReason() != null) { |
... | ... | @@ -1904,7 +1913,13 @@ |
1904 | 1913 | for (Patients md : patientsList) { |
1905 | 1914 | parentIdList.add(md.getId()); |
1906 | 1915 | } |
1907 | - matDeliverQuery.setParentIdList(parentIdList); | |
1916 | + List<String> idList = matDeliverQuery.getParentIdList(); | |
1917 | + if (CollectionUtils.isNotEmpty(idList)) { | |
1918 | + idList.retainAll(parentIdList); | |
1919 | + } else { | |
1920 | + idList = parentIdList; | |
1921 | + } | |
1922 | + matDeliverQuery.setParentIdList(idList); | |
1908 | 1923 | } |
1909 | 1924 | |
1910 | 1925 | // 高危等级 |
1911 | 1926 | |
1912 | 1927 | |
... | ... | @@ -1919,29 +1934,14 @@ |
1919 | 1934 | List<String> parentIdList1 = matDeliverQuery.getParentIdList(); |
1920 | 1935 | if (CollectionUtils.isNotEmpty(parentIdList1)) { |
1921 | 1936 | patientIds.addAll(parentIdList1); |
1937 | + parentIdList1.retainAll(parentIdList1); | |
1938 | + } else { | |
1939 | + parentIdList1 = patientIds; | |
1922 | 1940 | } |
1923 | - matDeliverQuery.setParentIdList(patientIds); | |
1941 | + matDeliverQuery.setParentIdList(parentIdList1); | |
1924 | 1942 | } |
1925 | 1943 | |
1926 | 1944 | |
1927 | - /*List<String> currentParentIdList = matDeliverQuery.getParentIdList(); | |
1928 | - | |
1929 | - List<String> townOrgIds = new ArrayList<>(); | |
1930 | - | |
1931 | - List<Patients> patients1 = mongoTemplate.find(Query.query(Criteria.where("yn").is(YnEnums.YES.getId()).and("fmHospital").exists(true). | |
1932 | - orOperator(Criteria.where("townOrgId").is(hospitalId), Criteria.where("townOrgId").exists(false))), Patients.class); | |
1933 | - for (Patients p : patients1) { | |
1934 | - townOrgIds.add(p.getId()); | |
1935 | - } | |
1936 | - | |
1937 | - | |
1938 | - | |
1939 | - if (CollectionUtils.isEmpty(currentParentIdList)) { | |
1940 | - currentParentIdList = townOrgIds; | |
1941 | - } else { | |
1942 | - currentParentIdList.retainAll(townOrgIds); | |
1943 | - } | |
1944 | - matDeliverQuery.setParentIdList(currentParentIdList);*/ | |
1945 | 1945 | if (StringUtils.isNotEmpty(matdeliverFollowRequest.getNeed())) {//是否分页 |
1946 | 1946 | matDeliverQuery.setNeed("need"); |
1947 | 1947 | matDeliverQuery.setLimit(matdeliverFollowRequest.getLimit()); |
1948 | 1948 | |
... | ... | @@ -1998,18 +1998,20 @@ |
1998 | 1998 | matdeliverFollowListResult.setId(deliverModel.getId()); |
1999 | 1999 | //机构信息 |
2000 | 2000 | Organization organization = organizationService.getOrganization(Integer.valueOf(deliverModel.getFmHospital())); |
2001 | - // 市 | |
2002 | - BasicConfig cityName = basicConfigService.getOneBasicConfigById(organization.getCityId()); | |
2003 | - // 区 | |
2004 | - BasicConfig areaName = basicConfigService.getOneBasicConfigById(organization.getAreaId()); | |
2005 | - if (cityName != null) { | |
2006 | - matdeliverFollowListResult.setHospitalCityName(cityName.getName()); | |
2001 | + if (organization != null) { | |
2002 | + // 市 | |
2003 | + BasicConfig cityName = basicConfigService.getOneBasicConfigById(organization.getCityId()); | |
2004 | + // 区 | |
2005 | + BasicConfig areaName = basicConfigService.getOneBasicConfigById(organization.getAreaId()); | |
2006 | + if (cityName != null) { | |
2007 | + matdeliverFollowListResult.setHospitalCityName(cityName.getName()); | |
2008 | + } | |
2009 | + if (areaName != null) { | |
2010 | + matdeliverFollowListResult.setHospitalAreaName(areaName.getName()); | |
2011 | + } | |
2012 | + //分娩医院 | |
2013 | + matdeliverFollowListResult.setFmHospital(organization.getName()); | |
2007 | 2014 | } |
2008 | - if (areaName != null) { | |
2009 | - matdeliverFollowListResult.setHospitalAreaName(areaName.getName()); | |
2010 | - } | |
2011 | - //分娩医院 | |
2012 | - matdeliverFollowListResult.setFmHospital(organization.getName()); | |
2013 | 2015 | matdeliverFollowListResult.setContactResult(deliverModel.getContactResult()); |
2014 | 2016 | //预约联系结果 |
2015 | 2017 | if (deliverModel.getContactResult() != null) { |