Commit 7ccdf14198459a5d4d86dddc6e41b341c3f0f12e
1 parent
4f7551bd19
Exists in
fengning2023-06-06
modify 新增获取近七日高危人员数量
Showing 5 changed files with 247 additions and 0 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RiskReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
View file @
7ccdf14
... | ... | @@ -656,5 +656,18 @@ |
656 | 656 | return antenatalExaminationFacade.antexCheckCount(checkTime,loginState.getId()); |
657 | 657 | } |
658 | 658 | |
659 | + | |
660 | + /** | |
661 | + * 获取产妇整个产程的建档记录 | |
662 | + * | |
663 | + * @return | |
664 | + */ | |
665 | + @RequestMapping(method = RequestMethod.GET, value = "/antex/wxantexlist") | |
666 | + @ResponseBody | |
667 | + public BaseResponse wxantexlist( AntExListQueryRequest exListQueryRequest, String doctorId) { | |
668 | + int id = Integer.parseInt(doctorId); | |
669 | + return antenatalExaminationFacade.findAntExListTwo(exListQueryRequest, id); | |
670 | + } | |
671 | + | |
659 | 672 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RiskReportController.java
View file @
7ccdf14
... | ... | @@ -3,7 +3,10 @@ |
3 | 3 | import com.lyms.platform.common.annotation.TokenRequired; |
4 | 4 | import com.lyms.platform.common.base.BaseController; |
5 | 5 | import com.lyms.platform.common.base.LoginContext; |
6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
7 | +import com.lyms.platform.common.result.BaseListResponse; | |
6 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | +import com.lyms.platform.common.utils.DateUtil; | |
7 | 10 | import com.lyms.platform.common.utils.ExcelUtil; |
8 | 11 | import com.lyms.platform.operate.web.facade.RiskReportFacade; |
9 | 12 | import com.lyms.platform.operate.web.request.RiskBabysQueryRequest; |
... | ... | @@ -11,6 +14,7 @@ |
11 | 14 | import com.lyms.platform.operate.web.request.RiskPatientsQueryRequest; |
12 | 15 | import com.lyms.platform.operate.web.result.RiskReportResult; |
13 | 16 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
17 | +import org.apache.commons.lang.StringUtils; | |
14 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
15 | 19 | import org.springframework.stereotype.Controller; |
16 | 20 | import org.springframework.web.bind.annotation.RequestMapping; |
... | ... | @@ -139,6 +143,31 @@ |
139 | 143 | |
140 | 144 | // riskReportFacade.exportAreaHighRisk(riskPatientsCountRequest, |
141 | 145 | // 1000000185, response); |
146 | + } | |
147 | + | |
148 | + | |
149 | + /** | |
150 | + * 院内高危统计报表 | |
151 | + * @return | |
152 | + */ | |
153 | + @RequestMapping(method = RequestMethod.GET, value = "/querywxRiskReportCount") | |
154 | + @ResponseBody | |
155 | + public BaseResponse querywxRiskReportCount(RiskPatientsQueryRequest patientsQueryRequest,String userId) { | |
156 | + Date now = new Date(); | |
157 | + List result = new ArrayList(); | |
158 | + for (int i=0;i<7;i++){ | |
159 | + Map<String,Object> map = new HashMap<String,Object>(); | |
160 | + String ctime = DateUtil.getYyyyMmDd(DateUtil.addDay(now,-i)); | |
161 | + patientsQueryRequest.setLastCTime(ctime); | |
162 | + int id = Integer.parseInt(userId); | |
163 | + BaseListResponse br = riskReportFacade.querywxRiskReportCount(patientsQueryRequest,id); | |
164 | + map.put("data",br); | |
165 | + map.put("date",ctime); | |
166 | + result.add(map); | |
167 | + } | |
168 | + | |
169 | + return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(result); | |
170 | + | |
142 | 171 | } |
143 | 172 | |
144 | 173 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
View file @
7ccdf14
... | ... | @@ -1279,5 +1279,18 @@ |
1279 | 1279 | public BaseObjectResponse findMatDeliverData2wx(String id) { |
1280 | 1280 | return viewFacade.findMatDeliverData(id); |
1281 | 1281 | } |
1282 | + | |
1283 | + /** | |
1284 | + * 微信小程序查询复诊接口 | |
1285 | + * | |
1286 | + * @param id | |
1287 | + * @return | |
1288 | + */ | |
1289 | + @RequestMapping(value = "/wxfindAntenatalExaminationData", method = RequestMethod.GET) | |
1290 | + @ResponseBody | |
1291 | + public BaseObjectResponse wxfindAntenatalExaminationData( String id) { | |
1292 | + | |
1293 | + return viewFacade.findAntenatalExamination(id); | |
1294 | + } | |
1282 | 1295 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
7ccdf14
... | ... | @@ -267,6 +267,10 @@ |
267 | 267 | if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getIsFocus())){ |
268 | 268 | patientsQuery.setIsFocus(riskPatientsQueryRequest.getIsFocus()); |
269 | 269 | } |
270 | + //重点关注人数时间查询 | |
271 | + if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getFocusTime())){ | |
272 | + patientsQuery.setFocusTime(riskPatientsQueryRequest.getFocusTime()); | |
273 | + } | |
270 | 274 | //乡镇卫生院查询条件 |
271 | 275 | if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getTownOrgId())) { |
272 | 276 | patientsQuery.setTownOrgId(riskPatientsQueryRequest.getTownOrgId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
View file @
7ccdf14
... | ... | @@ -1636,5 +1636,193 @@ |
1636 | 1636 | // series.addAll(mom); |
1637 | 1637 | |
1638 | 1638 | |
1639 | + /** | |
1640 | + * 孕妇、产妇查询高危统计,wx该统计的高危是已经有孕妇有此高危 | |
1641 | + * | |
1642 | + * @return | |
1643 | + */ | |
1644 | + public BaseListResponse querywxRiskReportCount(RiskPatientsQueryRequest riskPatientsQueryRequest, Integer userId) { | |
1645 | + | |
1646 | +// String hospitalId = "242"; | |
1647 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1648 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
1649 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
1650 | + //最后一次检查时间 | |
1651 | + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getLastCTime())) { | |
1652 | + String nextDateStr = riskPatientsQueryRequest.getLastCTime(); | |
1653 | + String[] dates = nextDateStr.split(" - "); | |
1654 | + | |
1655 | + patientsQuery.setLastCTimeStart(DateUtil.parseYMD(dates[0])); | |
1656 | + if (dates.length == 2) { | |
1657 | + patientsQuery.setLastCTimeEnd(DateUtil.parseYMD(dates[1])); | |
1658 | + } | |
1659 | + } | |
1660 | + | |
1661 | + List buildType = new ArrayList(); | |
1662 | + buildType.add(0); | |
1663 | + buildType.add(2); | |
1664 | + patientsQuery.setBuildTypeList(buildType); | |
1665 | + patientsQuery.setHospitalId(hospitalId); | |
1666 | + | |
1667 | + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getType())) { | |
1668 | + if ("2".equals(riskPatientsQueryRequest.getType())) { | |
1669 | + //1孕妇 | |
1670 | + patientsQuery.setType(1); | |
1671 | + } else if ("3".equals(riskPatientsQueryRequest.getType())) { | |
1672 | + //3产妇 | |
1673 | + patientsQuery.setType(3); | |
1674 | + } | |
1675 | + } | |
1676 | + | |
1677 | + | |
1678 | + //预产期 | |
1679 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(riskPatientsQueryRequest.getDueDate())) { | |
1680 | + String nextDateStr = riskPatientsQueryRequest.getDueDate(); | |
1681 | + String[] dates = nextDateStr.split(" - "); | |
1682 | + patientsQuery.setDueDateStart(DateUtil.parseYMD(dates[0])); | |
1683 | + if (dates.length == 2) { | |
1684 | + patientsQuery.setDueDateEnd(DateUtil.parseYMD(dates[1])); | |
1685 | + } | |
1686 | + } | |
1687 | + | |
1688 | + //建档时间 | |
1689 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(riskPatientsQueryRequest.getBuildTime())) { | |
1690 | + | |
1691 | + String nextDateStr = riskPatientsQueryRequest.getBuildTime(); | |
1692 | + String[] dates = nextDateStr.split(" - "); | |
1693 | + | |
1694 | + patientsQuery.setBookbuildingDateStart(DateUtil.parseYMD(dates[0])); | |
1695 | + if (dates.length == 2) { | |
1696 | + patientsQuery.setBookbuildingDateEnd(DateUtil.parseYMD(dates[1])); | |
1697 | + } | |
1698 | + } | |
1699 | + | |
1700 | + //高危等级 | |
1701 | + patientsQuery.setrLevel(riskPatientsQueryRequest.getrLevel()); | |
1702 | + //产检医生 | |
1703 | + patientsQuery.setLastCheckEmployeeId(riskPatientsQueryRequest.getLastCheckDoctorId()); | |
1704 | + | |
1705 | + patientsQuery.setNorFactor(Boolean.TRUE); | |
1706 | + | |
1707 | + PatientsQuery query = new PatientsQuery(); | |
1708 | + query.setYn(YnEnums.YES.getId()); | |
1709 | + query.setBuildTypeList(patientsQuery.getBuildTypeList()); | |
1710 | + query.setHospitalId(patientsQuery.getHospitalId()); | |
1711 | + query.setDueStatus(patientsQuery.getDueStatus()); | |
1712 | + //高危等级 | |
1713 | + query.setrLevel(patientsQuery.getrLevel()); | |
1714 | + //产检医生 | |
1715 | + query.setLastCheckEmployeeId(patientsQuery.getLastCheckEmployeeId()); | |
1716 | + query.setDueDateStart(patientsQuery.getDueDateStart()); | |
1717 | + query.setDueDateEnd(patientsQuery.getDueDateEnd()); | |
1718 | + //最后一次检查时间 | |
1719 | + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getLastCTime())) { | |
1720 | + String nextDateStr = riskPatientsQueryRequest.getLastCTime(); | |
1721 | + String[] dates = nextDateStr.split(" - "); | |
1722 | + query.setLastCTimeStart(DateUtil.parseYMD(dates[0])); | |
1723 | + query.setLastCTimeEnd(DateUtil.parseYMD(dates[0])); | |
1724 | + } | |
1725 | + query.setBookbuildingDateStart(patientsQuery.getBookbuildingDateStart()); | |
1726 | + query.setBookbuildingDateEnd(patientsQuery.getBookbuildingDateEnd()); | |
1727 | + query.setNotoRiskFactor(""); | |
1728 | + query.setoRiskFactor("true"); | |
1729 | + query.setNullrFactor(true); | |
1730 | + query.setType(patientsQuery.getType()); | |
1731 | + | |
1732 | + //不包含国家高危的自定义高危人数 | |
1733 | + int riskPatientCount = patientsService.queryPatientCount(query); | |
1734 | + query.setNullrFactor(false); | |
1735 | + //包含国家高危的自定义高危人数 | |
1736 | + int otherPatientCount = patientsService.queryPatientCount(query); | |
1737 | + | |
1738 | + System.out.println(patientsQuery.convertToQuery().convertToMongoQuery().toString()); | |
1739 | + //总的孕妇条数(国家标准高危) | |
1740 | + int allPatientCount = patientsService.queryPatientCount(patientsQuery); | |
1741 | + // allPatientCount += riskPatientCount; | |
1742 | + | |
1743 | + List<RiskReportResult> results = new ArrayList<>(); | |
1744 | + | |
1745 | + BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
1746 | + basicConfigQuery.setYn(YnEnums.YES.getId()); | |
1747 | + basicConfigQuery.setParentId(SystemConfig.HIGH_RISK_ID); | |
1748 | + basicConfigQuery.setEnable(1); | |
1749 | + basicConfigQuery.setId(riskPatientsQueryRequest.getrLevel()); | |
1750 | + | |
1751 | + List<Future> futures = new ArrayList<>(); | |
1752 | + List<BasicConfig> riskLevelConfig = basicConfigService.queryBasicConfig(basicConfigQuery); | |
1753 | + if (CollectionUtils.isNotEmpty(riskLevelConfig)) { | |
1754 | + | |
1755 | + List<RiskReportResult> mainRiskReportResults = new ArrayList<>(); | |
1756 | + | |
1757 | + for (BasicConfig levelConfig : riskLevelConfig) { | |
1758 | + if ("e637b361-99cf-41eb-84f2-f0dab596e928".equals(levelConfig.getId())) { | |
1759 | + continue; | |
1760 | + } | |
1761 | + RiskReportResult risk = new RiskReportResult(); | |
1762 | + risk.setLevel(1); | |
1763 | + risk.setHighRiskId(levelConfig.getId()); | |
1764 | + risk.setHighRisk(levelConfig.getName()); | |
1765 | + risk.setPid(levelConfig.getpId()); | |
1766 | + Map map = new HashMap(); | |
1767 | + levelConfig.replenRisk(map); | |
1768 | + risk.setHighLevel(Arrays.asList(new Map[]{map})); | |
1769 | + mainRiskReportResults.add(risk); | |
1770 | + Callable c = new HiskCountTask(basicConfigService, | |
1771 | + patientsService, levelConfig, | |
1772 | + patientsQuery, | |
1773 | + allPatientCount); | |
1774 | + Future f = commonThreadPool.submit(c); | |
1775 | + futures.add(f); | |
1776 | + } | |
1777 | + results.addAll(mainRiskReportResults); | |
1778 | + | |
1779 | + | |
1780 | + if (CollectionUtils.isNotEmpty(futures)) { | |
1781 | + for (Future f : futures) { | |
1782 | + try { | |
1783 | + results.addAll((List<RiskReportResult>) f.get()); | |
1784 | + } catch (Exception e) { | |
1785 | + ExceptionUtils.catchException(e, "high risk count error."); | |
1786 | + } | |
1787 | + } | |
1788 | + } | |
1789 | + | |
1790 | + results.addAll(getOtherRiskCount(otherPatientCount, allPatientCount + riskPatientCount)); | |
1791 | + Map<String, List<RiskReportResult>> slaveBasicConfigMap = new HashMap<>(); | |
1792 | + for (RiskReportResult bc : results) { | |
1793 | + if (bc.getPid() != null) { | |
1794 | + if (slaveBasicConfigMap.containsKey(bc.getPid())) { | |
1795 | + slaveBasicConfigMap.get(bc.getPid()).add(bc); | |
1796 | + } else { | |
1797 | + List<RiskReportResult> basicConfigs = new ArrayList<>(); | |
1798 | + basicConfigs.add(bc); | |
1799 | + slaveBasicConfigMap.put(bc.getPid(), basicConfigs); | |
1800 | + } | |
1801 | + } | |
1802 | + } | |
1803 | + for (RiskReportResult bs : mainRiskReportResults) { | |
1804 | + System.out.println(bs); | |
1805 | + configData(bs, slaveBasicConfigMap, allPatientCount); | |
1806 | + } | |
1807 | + } | |
1808 | + List<RiskReportResult> datas = new ArrayList<>(); | |
1809 | + if (CollectionUtils.isNotEmpty(results)) | |
1810 | + { | |
1811 | + for (RiskReportResult result : results) | |
1812 | + { | |
1813 | + if (result.getRiskCount() == 0) | |
1814 | + { | |
1815 | + continue; | |
1816 | + } | |
1817 | + datas.add(result); | |
1818 | + } | |
1819 | + } | |
1820 | + | |
1821 | + | |
1822 | + return new BaseListResponse() | |
1823 | + .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas); | |
1824 | + } | |
1825 | + | |
1826 | + | |
1639 | 1827 | } |