Commit 44f0928301743e57c99400c18be6e63aeb286807

Authored by wangbo
1 parent edb4ee2667

儿保检查高危因素添加

Showing 1 changed file with 137 additions and 230 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 44f0928
... ... @@ -409,8 +409,18 @@
409 409 bm.setLastHighRisk(0);
410 410 } else {
411 411 bm.setLastHighRisk(request.getHighRisk());
  412 + bm.setHighRiskInfo(request.getHighRiskInfo());
412 413 }
413 414  
  415 + //添加儿童高危因素
  416 + if (request.getWeakSon() == null) {
  417 + bm.setWeakSon(0);
  418 + } else {
  419 + bm.setWeakSon(request.getWeakSon());
  420 + bm.setWeakSonInfo(request.getWeakSonInfo());
  421 + }
  422 +
  423 +
414 424 bm.setNextDate(DateUtil.parseYMD(request.getNextDate()));
415 425  
416 426 if (CollectionUtils.isNotEmpty(request.getDiagnose())) {
... ... @@ -802,9 +812,8 @@
802 812 //根据出生孕周计算末次月经
803 813 Date LastMens = DateUtil.addWeek(model.getBirth(), -model.getDueWeek());
804 814  
805   - if (model.getDueDay() != null)
806   - {
807   - LastMens = DateUtil.addDay(LastMens,-model.getDueDay());
  815 + if (model.getDueDay() != null) {
  816 + LastMens = DateUtil.addDay(LastMens, -model.getDueDay());
808 817 }
809 818  
810 819 //根据末次月经计算预产期
... ... @@ -819,8 +828,6 @@
819 828 }
820 829  
821 830  
822   -
823   -
824 831 base.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirth()));
825 832 base.setSourceId(org.apache.commons.lang.StringUtils.isNotEmpty(model.getSource()) ? model.getSource() : model.getId());
826 833 if (model.getPid() != null) {
... ... @@ -990,7 +997,7 @@
990 997 * @param coupon
991 998 * @return
992 999 */
993   - public BaseObjectResponse queryChooseBabys(String vcCardNo, String cardNo, Integer userId, String coupon,String ynStatus) {
  1000 + public BaseObjectResponse queryChooseBabys(String vcCardNo, String cardNo, Integer userId, String coupon, String ynStatus) {
994 1001  
995 1002  
996 1003 Map map = new HashMap();
... ... @@ -1013,12 +1020,9 @@
1013 1020 BabyModelQuery babyQuery = new BabyModelQuery();
1014 1021 babyQuery.setPhoneOrcardNo(StringUtils.isEmpty(cardNo) ? null : cardNo); //手机号码或者身份证号码
1015 1022 babyQuery.setVcCardNo(StringUtils.isEmpty(vcCardNo) ? null : vcCardNo);
1016   - if (StringUtils.isNotEmpty(ynStatus))
1017   - {
1018   - babyQuery.setDataStatus(false);
1019   - }
1020   - else
1021   - {
  1023 + if (StringUtils.isNotEmpty(ynStatus)) {
  1024 + babyQuery.setDataStatus(false);
  1025 + } else {
1022 1026 babyQuery.setYn(YnEnums.YES.getId());
1023 1027 }
1024 1028  
1025 1029  
... ... @@ -1413,10 +1417,10 @@
1413 1417 * @param sex
1414 1418 * @return
1415 1419 */
1416   - public BaseObjectResponse queryHWByHeight(Double height, Double weight, Integer sex, String birth, String dueDate,String checkDate) {
  1420 + public BaseObjectResponse queryHWByHeight(Double height, Double weight, Integer sex, String birth, String dueDate, String checkDate) {
1417 1421  
1418 1422  
1419   - String res = getBabyHW(height, weight, sex, birth, dueDate,checkDate);
  1423 + String res = getBabyHW(height, weight, sex, birth, dueDate, checkDate);
1420 1424 BaseObjectResponse br = new BaseObjectResponse();
1421 1425 br.setData(res);
1422 1426 br.setErrorcode(ErrorCodeConstants.SUCCESS);
1423 1427  
1424 1428  
1425 1429  
1426 1430  
... ... @@ -1425,27 +1429,22 @@
1425 1429 }
1426 1430  
1427 1431  
1428   - public String getBabyHW(Double height, Double weight, Integer sex, String birth,String dueDate,String checkDate) {
  1432 + public String getBabyHW(Double height, Double weight, Integer sex, String birth, String dueDate, String checkDate) {
1429 1433 Double hw = getHw(height);
1430 1434  
1431 1435 String res = "";
1432   - if(StringUtils.isEmpty(birth) || StringUtils.isEmpty(checkDate))
1433   - {
1434   - return res;
  1436 + if (StringUtils.isEmpty(birth) || StringUtils.isEmpty(checkDate)) {
  1437 + return res;
1435 1438 }
1436 1439  
1437 1440  
1438 1441 int monthAge = 0;
1439   - if (StringUtils.isNotEmpty(dueDate))
1440   - {
  1442 + if (StringUtils.isNotEmpty(dueDate)) {
1441 1443 monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate));
1442   - if (monthAge < 0)
1443   - {
  1444 + if (monthAge < 0) {
1444 1445 monthAge = 0;
1445 1446 }
1446   - }
1447   - else
1448   - {
  1447 + } else {
1449 1448 monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate));
1450 1449 }
1451 1450  
... ... @@ -1523,7 +1522,7 @@
1523 1522 * @param birth
1524 1523 * @return
1525 1524 */
1526   - public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth, Double weight,String dueDate,String checkDate) {
  1525 + public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth, Double weight, String dueDate, String checkDate) {
1527 1526  
1528 1527 List<String> list = getBabyGrowthEvaluate(height, sex, birth, weight, dueDate, checkDate);
1529 1528 BaseObjectResponse br = new BaseObjectResponse();
1530 1529  
1531 1530  
1532 1531  
1533 1532  
... ... @@ -1549,27 +1548,22 @@
1549 1548 *
1550 1549 * @return
1551 1550 */
1552   - public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth, Double weight,String dueDate,String checkDate) {
  1551 + public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth, Double weight, String dueDate, String checkDate) {
1553 1552 List<String> growthEvaluate = new ArrayList<>();
1554 1553  
1555   - if(StringUtils.isEmpty(birth) || StringUtils.isEmpty(checkDate))
1556   - {
1557   - return growthEvaluate;
  1554 + if (StringUtils.isEmpty(birth) || StringUtils.isEmpty(checkDate)) {
  1555 + return growthEvaluate;
1558 1556 }
1559 1557  
1560 1558 Double hw = getHw(height);
1561 1559  
1562 1560 int monthAge = 0;
1563   - if (StringUtils.isNotEmpty(dueDate))
1564   - {
  1561 + if (StringUtils.isNotEmpty(dueDate)) {
1565 1562 monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate));
1566   - if (monthAge < 0)
1567   - {
  1563 + if (monthAge < 0) {
1568 1564 monthAge = 0;
1569 1565 }
1570   - }
1571   - else
1572   - {
  1566 + } else {
1573 1567 monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate));
1574 1568 }
1575 1569  
1576 1570  
1577 1571  
... ... @@ -1692,19 +1686,16 @@
1692 1686 return objectResponse;
1693 1687 }
1694 1688  
1695   - public BaseObjectResponse queryBabyHealthStatus(String birth, Double value, Integer sex, Integer type,String dueDate,String babyId,
  1689 + public BaseObjectResponse queryBabyHealthStatus(String birth, Double value, Integer sex, Integer type, String dueDate, String babyId,
1696 1690 String checkDate) {
1697 1691 String res = "";
1698 1692  
1699 1693 //体重
1700   - if (type == 0)
1701   - {
1702   - res = getGrowthValue(birth, value, sex,dueDate,babyId,checkDate);
  1694 + if (type == 0) {
  1695 + res = getGrowthValue(birth, value, sex, dueDate, babyId, checkDate);
  1696 + } else {
  1697 + res = getGrowthValue1(birth, value, sex, type, dueDate, checkDate);
1703 1698 }
1704   - else
1705   - {
1706   - res = getGrowthValue1(birth, value, sex, type, dueDate,checkDate);
1707   - }
1708 1699  
1709 1700 BaseObjectResponse objectResponse = new BaseObjectResponse();
1710 1701 objectResponse.setData(res);
... ... @@ -1714,7 +1705,7 @@
1714 1705 }
1715 1706  
1716 1707  
1717   - public String getGrowthValue(String birth, Double value, Integer sex,String dueDate,String babyId,String checkDate) {
  1708 + public String getGrowthValue(String birth, Double value, Integer sex, String dueDate, String babyId, String checkDate) {
1718 1709  
1719 1710  
1720 1711 // BabyModelQuery babyQuery = new BabyModelQuery();
... ... @@ -1726,11 +1717,9 @@
1726 1717 String res = "";
1727 1718  
1728 1719 List<AwModel> list = null;
1729   - if (dueDate != null)
1730   - {
1731   - Integer week = DateUtil.getWeek2(DateUtil.addDay(DateUtil.parseYMD(dueDate), -280),DateUtil.parseYMD(checkDate));
1732   - if (week < 41)
1733   - {
  1720 + if (dueDate != null) {
  1721 + Integer week = DateUtil.getWeek2(DateUtil.addDay(DateUtil.parseYMD(dueDate), -280), DateUtil.parseYMD(checkDate));
  1722 + if (week < 41) {
1734 1723 //查询该月龄的年龄别体重值
1735 1724 list = babyCheckService.queryBabyHealthConfigWeek(week, sex, 4);
1736 1725  
1737 1726  
1738 1727  
1739 1728  
... ... @@ -1755,25 +1744,20 @@
1755 1744 }
1756 1745 }
1757 1746 return res;
1758   - }
1759   - else
1760   - {
  1747 + } else {
1761 1748 //计算儿童的月龄
1762 1749 int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate));
1763   - if (monthAge < 0)
1764   - {
  1750 + if (monthAge < 0) {
1765 1751 monthAge = 0;
1766 1752 }
1767 1753 //查询该月龄的年龄别体重值
1768 1754 list = babyCheckService.queryBabyHealthConfig(monthAge, sex, 0);
1769 1755 }
1770   - }
1771   - else
1772   - {
  1756 + } else {
1773 1757 //计算儿童的月龄
1774 1758 int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate));
1775 1759 //查询该月龄的年龄别体重值
1776   - list = babyCheckService.queryBabyHealthConfig(monthAge, sex, 0);
  1760 + list = babyCheckService.queryBabyHealthConfig(monthAge, sex, 0);
1777 1761 }
1778 1762  
1779 1763 if (CollectionUtils.isNotEmpty(list)) {
1780 1764  
1781 1765  
1782 1766  
... ... @@ -1801,21 +1785,17 @@
1801 1785  
1802 1786  
1803 1787 public String getGrowthValue1(String birth, Double value, Integer sex,
1804   - Integer type,String dueDate,String checkDate) {
  1788 + Integer type, String dueDate, String checkDate) {
1805 1789 //计算儿童的月龄
1806 1790 int monthAge = 0;
1807   - if (StringUtils.isNotEmpty(dueDate))
1808   - {
1809   - monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate));
1810   - if (monthAge < 0)
1811   - {
  1791 + if (StringUtils.isNotEmpty(dueDate)) {
  1792 + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate));
  1793 + if (monthAge < 0) {
1812 1794 monthAge = 0;
1813 1795 }
  1796 + } else {
  1797 + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate));
1814 1798 }
1815   - else
1816   - {
1817   - monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate));
1818   - }
1819 1799  
1820 1800  
1821 1801 //查询该月龄的年龄别体重值
... ... @@ -1933,8 +1913,7 @@
1933 1913 }
1934 1914  
1935 1915  
1936   - public BaseObjectResponse getCurrentDayCheckBabies(Integer userId)
1937   - {
  1916 + public BaseObjectResponse getCurrentDayCheckBabies(Integer userId) {
1938 1917 String hospitalId = autoMatchFacade.getHospitalId(userId);
1939 1918 Date currentDay = DateUtil.parseYMD(DateUtil.getymd());
1940 1919 BabyCheckModelQuery query = new BabyCheckModelQuery();
1941 1920  
... ... @@ -1951,15 +1930,11 @@
1951 1930 List<BabyCheckModel> babyCheckList = babyCheckService.queryBabyCheckRecord(query);
1952 1931 List<String> ids = new ArrayList<>();
1953 1932 List<BabyModel> babyModels = new ArrayList<>();
1954   - if (CollectionUtils.isNotEmpty(babyCheckList))
1955   - {
1956   - for (BabyCheckModel babyCheck : babyCheckList)
1957   - {
  1933 + if (CollectionUtils.isNotEmpty(babyCheckList)) {
  1934 + for (BabyCheckModel babyCheck : babyCheckList) {
1958 1935 String buildId = babyCheck.getBuildId();
1959   - if (StringUtils.isNotEmpty(buildId))
1960   - {
1961   - if (!ids.contains(buildId))
1962   - {
  1936 + if (StringUtils.isNotEmpty(buildId)) {
  1937 + if (!ids.contains(buildId)) {
1963 1938 babyQuery.setId(buildId);
1964 1939 List<BabyModel> babyResult = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
1965 1940 babyModels.addAll(babyResult);
... ... @@ -1970,10 +1945,8 @@
1970 1945 }
1971 1946 ids.clear();
1972 1947 List<BabyManageListResult> list = new ArrayList<>();
1973   - if (CollectionUtils.isNotEmpty(babyModels))
1974   - {
1975   - for (BabyModel model : babyModels)
1976   - {
  1948 + if (CollectionUtils.isNotEmpty(babyModels)) {
  1949 + for (BabyModel model : babyModels) {
1977 1950 BabyManageListResult result = new BabyManageListResult();
1978 1951 result.setId(model.getId());
1979 1952 if (model.getLastHighRisk() == null || model.getLastHighRisk() == 0) {
... ... @@ -2015,7 +1988,7 @@
2015 1988 list.add(result);
2016 1989 }
2017 1990 }
2018   - return new BaseObjectResponse().setData(list).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  1991 + return new BaseObjectResponse().setData(list).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
2019 1992 }
2020 1993  
2021 1994 public BaseObjectResponse getHighBabyMonthAge(String babyId, String checkDate, Boolean isHighRisk) {
2022 1995  
2023 1996  
2024 1997  
2025 1998  
2026 1999  
2027 2000  
... ... @@ -2042,38 +2015,30 @@
2042 2015 Date dueDate = DateUtil.addDay(lastMens, 280);
2043 2016 String correctValue = "";
2044 2017  
2045   - if (model.getDueWeek() < 37)
2046   - {
2047   - Integer days =DateUtil.daysBetween(lastMens,DateUtil.parseYMD(checkDate));
2048   - if (days < 286)
2049   - {
  2018 + if (model.getDueWeek() < 37) {
  2019 + Integer days = DateUtil.daysBetween(lastMens, DateUtil.parseYMD(checkDate));
  2020 + if (days < 286) {
2050 2021 result.put("isCorrectMonthAge", 1);
2051 2022 //纠正胎龄
2052   - correctValue = "孕"+(days/7)+"周"+(days%7 == 0 ? "" : days%7+"天");
2053   - }
2054   - else
2055   - {
  2023 + correctValue = "孕" + (days / 7) + "周" + (days % 7 == 0 ? "" : days % 7 + "天");
  2024 + } else {
2056 2025 //纠正月龄
2057   - if (dueDate != null)
2058   - {
2059   - result.put("isCorrectMonthAge",2);
2060   - correctValue = DateUtil.getMonthDesc(dueDate,DateUtil.parseYMD(checkDate));
  2026 + if (dueDate != null) {
  2027 + result.put("isCorrectMonthAge", 2);
  2028 + correctValue = DateUtil.getMonthDesc(dueDate, DateUtil.parseYMD(checkDate));
2061 2029 }
2062 2030 }
2063   - }
2064   - else if (isHighRisk)
2065   - {
  2031 + } else if (isHighRisk) {
2066 2032 //纠正月龄
2067   - if (dueDate != null)
2068   - {
2069   - result.put("isCorrectMonthAge",2);
2070   - correctValue = DateUtil.getMonthDesc(dueDate,DateUtil.parseYMD(checkDate));
  2033 + if (dueDate != null) {
  2034 + result.put("isCorrectMonthAge", 2);
  2035 + correctValue = DateUtil.getMonthDesc(dueDate, DateUtil.parseYMD(checkDate));
2071 2036 }
2072 2037 }
2073   - result.put("correctValue",correctValue);
  2038 + result.put("correctValue", correctValue);
2074 2039 }
2075 2040 }
2076   - return new BaseObjectResponse().setData(result).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  2041 + return new BaseObjectResponse().setData(result).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
2077 2042 }
2078 2043  
2079 2044 public BaseObjectResponse getBabyReport(Integer userId, String babyId) {
2080 2045  
2081 2046  
2082 2047  
2083 2048  
... ... @@ -2088,34 +2053,29 @@
2088 2053  
2089 2054 //查询儿童的基本信息
2090 2055 List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
2091   - if (!CollectionUtils.isNotEmpty(models))
2092   - {
  2056 + if (!CollectionUtils.isNotEmpty(models)) {
2093 2057 return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有儿童档案信息");
2094 2058 }
2095 2059  
2096 2060 BabyModel model = models.get(0);
2097 2061  
2098 2062  
2099   -
2100 2063 BabyCheckModelQuery query = new BabyCheckModelQuery();
2101 2064 query.setYn(YnEnums.YES.getId());
2102 2065 query.setBuildId(babyId);
2103 2066 List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(query);
2104   - if (CollectionUtils.isEmpty(babyCheckModels))
2105   - {
  2067 + if (CollectionUtils.isEmpty(babyCheckModels)) {
2106 2068 return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有检查记录");
2107 2069 }
2108 2070  
2109 2071 BabyCheckModel checkModel = babyCheckModels.get(0);
2110 2072  
2111 2073 int month = DateUtil.getMonth(model.getBirth(), checkModel.getCheckDate());
2112   - if (month == 0 || month > 36)
2113   - {
  2074 + if (month == 0 || month > 36) {
2114 2075 return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("月龄范围没有报告");
2115 2076 }
2116 2077  
2117   - if (!(StringUtils.isNotEmpty(checkModel.getWeight()) && StringUtils.isNotEmpty(checkModel.getHeight())))
2118   - {
  2078 + if (!(StringUtils.isNotEmpty(checkModel.getWeight()) && StringUtils.isNotEmpty(checkModel.getHeight()))) {
2119 2079 return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("检查报告没有体重和身长不能生成报告");
2120 2080 }
2121 2081  
2122 2082  
... ... @@ -2129,12 +2089,10 @@
2129 2089  
2130 2090  
2131 2091 String kaupEvaluate = "";
2132   - if (StringUtils.isNotEmpty(checkModel.getWeight()) && StringUtils.isNotEmpty(checkModel.getHeight()))
2133   - {
  2092 + if (StringUtils.isNotEmpty(checkModel.getWeight()) && StringUtils.isNotEmpty(checkModel.getHeight())) {
2134 2093 String bmi = patientWeightService.getBmi(checkModel.getWeight(), checkModel.getHeight());
2135 2094 baseInfo.put("kaup", bmi);
2136   - if (StringUtils.isNotEmpty(bmi))
2137   - {
  2095 + if (StringUtils.isNotEmpty(bmi)) {
2138 2096 Double bbmi = Double.parseDouble(bmi);
2139 2097 //查询该月龄的年龄别体重值
2140 2098 // 正常 :-2SD ≤ A ≤ +1SD
2141 2099  
2142 2100  
... ... @@ -2143,16 +2101,11 @@
2143 2101 List<AwModel> list = babyCheckService.queryBabyHealthConfig(month, model.getSex(), 5);
2144 2102 if (CollectionUtils.isNotEmpty(list)) {
2145 2103 AwModel awModel = list.get(0);
2146   - if (awModel.getPoneDs() < bbmi)
2147   - {
  2104 + if (awModel.getPoneDs() < bbmi) {
2148 2105 kaupEvaluate = "超重";
2149   - }
2150   - else if (awModel.getPoneDs() >= bbmi && awModel.getRtwoDs() <= bbmi)
2151   - {
  2106 + } else if (awModel.getPoneDs() >= bbmi && awModel.getRtwoDs() <= bbmi) {
2152 2107 kaupEvaluate = "正常";
2153   - }
2154   - else if (awModel.getRtwoDs() > bbmi)
2155   - {
  2108 + } else if (awModel.getRtwoDs() > bbmi) {
2156 2109 kaupEvaluate = "消瘦";
2157 2110 }
2158 2111 }
2159 2112  
2160 2113  
2161 2114  
2162 2115  
2163 2116  
2164 2117  
2165 2118  
2166 2119  
2167 2120  
2168 2121  
2169 2122  
2170 2123  
2171 2124  
2172 2125  
2173 2126  
2174 2127  
2175 2128  
2176 2129  
2177 2130  
2178 2131  
2179 2132  
2180 2133  
2181 2134  
2182 2135  
2183 2136  
2184 2137  
2185 2138  
2186 2139  
2187 2140  
2188 2141  
2189 2142  
2190 2143  
2191 2144  
2192 2145  
2193 2146  
2194 2147  
2195 2148  
2196 2149  
... ... @@ -2160,179 +2113,135 @@
2160 2113 baseInfo.put("kaupEvaluate", kaupEvaluate);
2161 2114 }
2162 2115  
2163   - baseInfo.put("name",model.getName());
2164   - baseInfo.put("sex",SexEnum.getTextById(model.getSex()));
  2116 + baseInfo.put("name", model.getName());
  2117 + baseInfo.put("sex", SexEnum.getTextById(model.getSex()));
2165 2118 baseInfo.put("monthAge", DateUtil.getBabyMonthAge(model.getBirth(), new Date()));
2166 2119  
2167 2120 String feedType = "";
2168   - if (month < 12)
2169   - {
  2121 + if (month < 12) {
2170 2122 String feedTypeId = checkModel.getFeedType();
2171   - if (StringUtils.isNotEmpty(feedTypeId))
2172   - {
  2123 + if (StringUtils.isNotEmpty(feedTypeId)) {
2173 2124 feedType = WyTypeEnums.getNameById(Integer.parseInt(feedTypeId));
2174 2125 }
2175 2126 }
2176   - baseInfo.put("feedType",feedType);
  2127 + baseInfo.put("feedType", feedType);
2177 2128  
2178   - data.put("baseInfo",baseInfo);
  2129 + data.put("baseInfo", baseInfo);
2179 2130  
2180   - if (StringUtils.isNotEmpty(kaupEvaluate))
2181   - {
  2131 + if (StringUtils.isNotEmpty(kaupEvaluate)) {
2182 2132 BabyConfigModel babyConfigModel = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("status").is(kaupEvaluate).and("type").is(0)), BabyConfigModel.class);
2183   - if (month < 12)
2184   - {
2185   - if (month < 6)
2186   - {
  2133 + if (month < 12) {
  2134 + if (month < 6) {
2187 2135 //喂养方式
2188   - data.put("wyfs",babyConfigModel.getContentOne());
2189   - }
2190   - else if (month < 12)
2191   - {
  2136 + data.put("wyfs", babyConfigModel.getContentOne());
  2137 + } else if (month < 12) {
2192 2138 //指导意见
2193   - data.put("zdyj",babyConfigModel.getContentOne());
  2139 + data.put("zdyj", babyConfigModel.getContentOne());
2194 2140 //辅食添加
2195   - data.put("fstj",babyConfigModel.getContentTwo());
  2141 + data.put("fstj", babyConfigModel.getContentTwo());
2196 2142 //辅食制作
2197   - data.put("fszz",babyConfigModel.getContentThree());
  2143 + data.put("fszz", babyConfigModel.getContentThree());
2198 2144 }
2199 2145 //营养需求
2200   - data.put("yyxq",babyConfigModel.getContentFour());
2201   - if (StringUtils.isNotEmpty(checkModel.getWeight()) && month > 5 )
2202   - {
  2146 + data.put("yyxq", babyConfigModel.getContentFour());
  2147 + if (StringUtils.isNotEmpty(checkModel.getWeight()) && month > 5) {
2203 2148 Double kaul = null;
2204 2149 //规则:6月龄:体重*120kcal/kg 7-11月龄:体重*100kcal/kg
2205   - kaul = month == 6 ? Double.parseDouble(checkModel.getWeight()) * 120 : Double.parseDouble(checkModel.getWeight()) * 100;
  2150 + kaul = month == 6 ? Double.parseDouble(checkModel.getWeight()) * 120 : Double.parseDouble(checkModel.getWeight()) * 100;
2206 2151 kaul = getKaul(kaul);
2207 2152  
2208   - if (kaul < 800)
2209   - {
  2153 + if (kaul < 800) {
2210 2154 kaul = 800D;
2211   - }
2212   - else if (kaul > 2000)
2213   - {
  2155 + } else if (kaul > 2000) {
2214 2156 kaul = 2000D;
2215 2157 }
2216 2158  
2217 2159 BabyConfigModel babyConfigModel1 = mongoTemplate.findOne(Query.query(Criteria.where("kcal").is(kaul).and("monthAge").is(month).and("type").is(1)), BabyConfigModel.class);
2218 2160 //6-11月热量
2219   - data.put("rl",babyConfigModel1.getContentOne());
  2161 + data.put("rl", babyConfigModel1.getContentOne());
2220 2162 }
2221   - }
2222   - else if (month < 37)
2223   - {
2224   - List<Map<String,Object>> list = new ArrayList<>();
  2163 + } else if (month < 37) {
  2164 + List<Map<String, Object>> list = new ArrayList<>();
2225 2165 double kcal = 0;
2226 2166 int type = 3;
2227   - if (month < 36)
2228   - {
2229   - kcal = 89 * Double.parseDouble(checkModel.getWeight()) - 100 + 20;
2230   - }
2231   - else
2232   - {
  2167 + if (month < 36) {
  2168 + kcal = 89 * Double.parseDouble(checkModel.getWeight()) - 100 + 20;
  2169 + } else {
2233 2170 type = 5;
2234 2171 //男童:88.5-61.9×年龄(岁)+PA[26.7×体重(kg)+903×身长(m)]+20kcal/day
2235 2172 // PA=1.26
2236 2173 //女童:135.3-30.8×年龄(岁)+PA[10×体重(kg)+934×身长(m)]+20kcal/day
2237 2174 //PA=1.31
2238   - if (model.getSex() == 1)
2239   - {
2240   - kcal = 88.5-61.9*3+1.26*(26.7*Double.parseDouble(checkModel.getWeight()) +903*(Double.parseDouble(checkModel.getHeight())/100))+20;
  2175 + if (model.getSex() == 1) {
  2176 + kcal = 88.5 - 61.9 * 3 + 1.26 * (26.7 * Double.parseDouble(checkModel.getWeight()) + 903 * (Double.parseDouble(checkModel.getHeight()) / 100)) + 20;
  2177 + } else {
  2178 + kcal = 135.3 - 30.8 * 3 + 1.31 * (10 * Double.parseDouble(checkModel.getWeight()) + 934 * (Double.parseDouble(checkModel.getHeight()) / 100)) + 20;
2241 2179 }
2242   - else {
2243   - kcal = 135.3-30.8*3+1.31*(10*Double.parseDouble(checkModel.getWeight()) +934*(Double.parseDouble(checkModel.getHeight())/100))+20;
2244   - }
2245 2180 }
2246 2181 kcal = getKaul(kcal);
2247   - if (month < 36)
2248   - {
2249   - if (kcal < 600 && "正常".equals(kaupEvaluate))
2250   - {
  2182 + if (month < 36) {
  2183 + if (kcal < 600 && "正常".equals(kaupEvaluate)) {
2251 2184 kcal = 600;
2252   - }
2253   - else if (kcal > 1550 && "正常".equals(kaupEvaluate))
2254   - {
  2185 + } else if (kcal > 1550 && "正常".equals(kaupEvaluate)) {
2255 2186 kcal = 1550;
2256   - }else if (kcal < 500 && "消瘦".equals(kaupEvaluate))
2257   - {
  2187 + } else if (kcal < 500 && "消瘦".equals(kaupEvaluate)) {
2258 2188 kcal = 500;
2259   - }
2260   - else if (kcal > 1100 && "消瘦".equals(kaupEvaluate))
2261   - {
  2189 + } else if (kcal > 1100 && "消瘦".equals(kaupEvaluate)) {
2262 2190 kcal = 1100;
2263   - }
2264   - else if (kcal < 800 && "超重".equals(kaupEvaluate))
2265   - {
  2191 + } else if (kcal < 800 && "超重".equals(kaupEvaluate)) {
2266 2192 kcal = 800;
2267   - }
2268   - else if (kcal > 1750 && "超重".equals(kaupEvaluate))
2269   - {
  2193 + } else if (kcal > 1750 && "超重".equals(kaupEvaluate)) {
2270 2194 kcal = 1750;
2271 2195 }
2272   - }
2273   - else if (month == 36)
2274   - {
2275   - if (kcal < 1300 && "正常".equals(kaupEvaluate))
2276   - {
  2196 + } else if (month == 36) {
  2197 + if (kcal < 1300 && "正常".equals(kaupEvaluate)) {
2277 2198 kcal = 1300;
2278   - }
2279   - else if (kcal > 1750 && "正常".equals(kaupEvaluate))
2280   - {
  2199 + } else if (kcal > 1750 && "正常".equals(kaupEvaluate)) {
2281 2200 kcal = 1750;
2282   - }else if (kcal < 1200 && "消瘦".equals(kaupEvaluate))
2283   - {
  2201 + } else if (kcal < 1200 && "消瘦".equals(kaupEvaluate)) {
2284 2202 kcal = 1200;
2285   - }
2286   - else if (kcal > 1450 && "消瘦".equals(kaupEvaluate))
2287   - {
  2203 + } else if (kcal > 1450 && "消瘦".equals(kaupEvaluate)) {
2288 2204 kcal = 1450;
2289   - }
2290   - else if (kcal < 1500 && "超重".equals(kaupEvaluate))
2291   - {
  2205 + } else if (kcal < 1500 && "超重".equals(kaupEvaluate)) {
2292 2206 kcal = 1500;
2293   - }
2294   - else if (kcal > 1850 && "超重".equals(kaupEvaluate))
2295   - {
  2207 + } else if (kcal > 1850 && "超重".equals(kaupEvaluate)) {
2296 2208 kcal = 1850;
2297 2209 }
2298 2210 }
2299 2211  
2300 2212  
2301 2213 List<BabyConfigModel> configModels = mongoTemplate.find(Query.query(Criteria.where("kcal").is(kcal).and("status").is(kaupEvaluate).and("type").is(type)), BabyConfigModel.class);
2302   - if (CollectionUtils.isNotEmpty(configModels) && configModels.size() == 3)
2303   - {
2304   - for (BabyConfigModel configModel : configModels)
2305   - {
2306   - Map<String,Object> map = new HashMap<>();
2307   - map.put("title",configModel.getTitle());
2308   - map.put("contents",configModel.getContentOne());
  2214 + if (CollectionUtils.isNotEmpty(configModels) && configModels.size() == 3) {
  2215 + for (BabyConfigModel configModel : configModels) {
  2216 + Map<String, Object> map = new HashMap<>();
  2217 + map.put("title", configModel.getTitle());
  2218 + map.put("contents", configModel.getContentOne());
2309 2219 list.add(map);
2310 2220 }
2311   - data.put("foods",list);
  2221 + data.put("foods", list);
2312 2222 }
2313 2223 //type; //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 4.12--36喂养指南
2314 2224 BabyConfigModel babyConfigModel1 = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("type").is(2)), BabyConfigModel.class);
2315 2225  
2316 2226 //各月龄饮食指南[按月获取 12-36]
2317   - data.put("yszl",babyConfigModel1.getContentOne());
  2227 + data.put("yszl", babyConfigModel1.getContentOne());
2318 2228  
2319 2229 BabyConfigModel wyconfig = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("status").is(kaupEvaluate).and("type").is(4)), BabyConfigModel.class);
2320 2230 //喂养指南
2321   - data.put("wyzl",wyconfig.getContentOne());
  2231 + data.put("wyzl", wyconfig.getContentOne());
2322 2232  
2323 2233 //每日所需营养素
2324   - data.put("yys",getYys(month));
  2234 + data.put("yys", getYys(month));
2325 2235 }
2326 2236 }
2327 2237  
2328 2238 return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
2329 2239 }
2330 2240  
2331   - private List<String> getYys(int month){
  2241 + private List<String> getYys(int month) {
2332 2242 List<String> list = new ArrayList<>();
2333 2243  
2334   - if (month < 36)
2335   - {
  2244 + if (month < 36) {
2336 2245 list.add("碳水化合物:总能量的50-70%");
2337 2246 list.add("蛋白质:总能量的7-20%,平均每日约0.96g/kg");
2338 2247 list.add("脂肪:总能量的20-35%");
... ... @@ -2341,9 +2250,7 @@
2341 2250 list.add("无机物:钙的推荐摄入量为500mg,磷的推荐摄入量为500mg,钠的充分摄入为0.7g,氯的充分摄入量为1.1g,钾的充分摄入量为1.7g,镁的推荐摄入量为75mg,铁的推荐摄入量为6mg,锌的推荐摄入量为3mg,铜的推荐摄入量为290 μg,氟的充分摄入量为0.6mg,猛的充分摄入量为1.4mg,碘的推荐摄入量为80 μg,硒的推荐摄入量为20 μg");
2342 2251 list.add("维生素:维生素A的推荐摄入量为300 μgRE,维生素D的充分摄入量为5 μg,维生素E的充分摄入量为5mg α-TE,维生素K的充分摄入量为25μg,维生素C的推荐摄入量为40mg,维生素B1的推荐摄入量为0.5mg,维生素B2(核黄素)的0.6mg,维生素B3烟酸的推荐摄入量为6mgNE,尼克酸的上限摄入量为10mg,尼克酰胺的上限摄入量为180mg,维生素B6的推荐摄入量0.6mg,叶酸的推荐摄入量为150μg DFE,维生素B12的推荐摄入量为0.9μg,泛酸的充分摄入量为2mg,维生素H的充分摄入量9μg");
2343 2252 list.add("水分:1岁120-135ml/kg/day;2岁115-125ml/kg/day");
2344   - }
2345   - else
2346   - {
  2253 + } else {
2347 2254 list.add("碳水化合物:总能量的55-70%");
2348 2255 list.add("蛋白质:总能量的7-20%,平均每日约0.88g/kg");
2349 2256 list.add("脂肪:总能量的15-30%");
... ... @@ -2358,7 +2265,7 @@
2358 2265 }
2359 2266  
2360 2267 private Double getKaul(Double kcal) {
2361   - int k = (int)(kcal/100)*100;
  2268 + int k = (int) (kcal / 100) * 100;
2362 2269 Double d = Math.floor(k);
2363 2270 Double md = d + 50;
2364 2271 if (md > kcal) {