Commit 2c25ccd81f9bc39e8815452a5970299b8a5d2668

Authored by liquanyu
1 parent b43ca76946

儿童报告

Showing 8 changed files with 1162 additions and 31 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 2c25ccd
... ... @@ -1819,6 +1819,382 @@
1819 1819 }
1820 1820  
1821 1821  
  1822 +
  1823 + public static void babyNutritionConfig(String fileName)
  1824 + {
  1825 +
  1826 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  1827 + MongoTemplate mongoTemplate
  1828 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  1829 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  1830 + File file = new File(fileName);
  1831 + Workbook wb = null;
  1832 + try {
  1833 + wb = Workbook.getWorkbook(file);
  1834 + Sheet s = wb.getSheet(0);
  1835 + System.out.println(s.getName() + " : ");
  1836 + int rows = s.getRows();
  1837 + if(rows > 0){
  1838 + //遍历每行
  1839 + for(int i = 1 ;i < rows ; i++){
  1840 + System.out.println("rows="+i);
  1841 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  1842 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量
  1843 + model.setType(0);
  1844 + Cell[] cells = s.getRow(i);
  1845 + if(cells.length > 0){
  1846 + //遍历每行中的每列
  1847 + for (int j = 0 ; j < cells.length ; j ++)
  1848 + {
  1849 + String str = cells[j].getContents().trim();
  1850 +// if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str))
  1851 +// {
  1852 +// continue;
  1853 +// }
  1854 + switch (j)
  1855 + {
  1856 + case 0:
  1857 + model.setMonthAge(Integer.parseInt(str));
  1858 + continue;
  1859 + case 1:
  1860 + model.setFeedType(str);
  1861 + continue;
  1862 + case 2:
  1863 + model.setStatus(str);
  1864 + continue;
  1865 + case 3:
  1866 + List<String> list3 = Arrays.asList(str.split("\n"));
  1867 + model.setContentOne(list3);
  1868 + continue;
  1869 +
  1870 + }
  1871 + }
  1872 +
  1873 + }
  1874 + mongoTemplate.save(model);
  1875 + }
  1876 + }
  1877 +
  1878 + Sheet s1 = wb.getSheet(1);
  1879 + System.out.println(s1.getName() + " : ");
  1880 +
  1881 + int rows1 = s1.getRows();
  1882 + if(rows1 > 0){
  1883 + //遍历每行
  1884 + for(int i = 1 ;i < rows1 ; i++){
  1885 + System.out.println("rows="+i);
  1886 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  1887 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量
  1888 + model.setType(1);
  1889 + Cell[] cells = s1.getRow(i);
  1890 + if(cells.length > 0){
  1891 + //遍历每行中的每列
  1892 + for (int j = 0 ; j < cells.length ; j ++)
  1893 + {
  1894 + String str = cells[j].getContents().trim();
  1895 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str))
  1896 + {
  1897 + continue;
  1898 + }
  1899 + switch (j)
  1900 + {
  1901 + case 0:
  1902 + model.setMonthAge(Integer.parseInt(str));
  1903 + continue;
  1904 + case 1:
  1905 + List<String> list1 = Arrays.asList(str.split("\n"));
  1906 + model.setContentOne(list1);
  1907 + continue;
  1908 + }
  1909 + }
  1910 +
  1911 + }
  1912 + mongoTemplate.save(model);
  1913 + }
  1914 + }
  1915 +
  1916 +
  1917 +
  1918 + Sheet s2 = wb.getSheet(2);
  1919 + System.out.println(s2.getName() + " : ");
  1920 +
  1921 + int rows2 = s2.getRows();
  1922 + if(rows2 > 0){
  1923 + //遍历每行
  1924 + for(int i = 1 ;i < rows2 ; i++){
  1925 + System.out.println("rows="+i);
  1926 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  1927 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量
  1928 + model.setType(2);
  1929 + Cell[] cells = s2.getRow(i);
  1930 + if(cells.length > 0){
  1931 + //遍历每行中的每列
  1932 + for (int j = 0 ; j < cells.length ; j ++)
  1933 + {
  1934 + String str = cells[j].getContents().trim();
  1935 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str))
  1936 + {
  1937 + continue;
  1938 + }
  1939 + switch (j)
  1940 + {
  1941 + case 0:
  1942 + model.setMonthAge(Integer.parseInt(str));
  1943 + continue;
  1944 + case 1:
  1945 + model.setTitle(str);
  1946 + continue;
  1947 + case 2:
  1948 + List<String> list1 = Arrays.asList(str.split("\n"));
  1949 + model.setContentOne(list1);
  1950 + continue;
  1951 + }
  1952 + }
  1953 +
  1954 + }
  1955 + mongoTemplate.save(model);
  1956 + }
  1957 + }
  1958 +
  1959 +
  1960 + Sheet s3 = wb.getSheet(3);
  1961 + System.out.println(s3.getName() + " : ");
  1962 + int rows3 = s3.getRows();
  1963 + if(rows3 > 0){
  1964 + //遍历每行
  1965 + for(int i = 1 ;i < rows3 ; i++){
  1966 + System.out.println("rows="+i);
  1967 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  1968 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量
  1969 + model.setType(3);
  1970 + Cell[] cells = s3.getRow(i);
  1971 + if(cells.length > 0){
  1972 + //遍历每行中的每列
  1973 + for (int j = 0 ; j < cells.length ; j ++)
  1974 + {
  1975 + String str = cells[j].getContents().trim();
  1976 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str))
  1977 + {
  1978 + continue;
  1979 + }
  1980 + switch (j)
  1981 + {
  1982 + case 0:
  1983 + model.setMonthAge(Integer.parseInt(str));
  1984 + continue;
  1985 + case 1:
  1986 + model.setMonthAgeEnd(Integer.parseInt(str));
  1987 + continue;
  1988 + case 2:
  1989 + model.setKcal(Double.parseDouble(str));
  1990 + continue;
  1991 + case 3:
  1992 + model.setTitle(str);
  1993 + continue;
  1994 + case 4:
  1995 + List<String> list2 = Arrays.asList(str.split("\n"));
  1996 + model.setContentOne(list2);
  1997 + continue;
  1998 + case 5:
  1999 + model.setStatus(str);
  2000 + continue;
  2001 + }
  2002 + }
  2003 + }
  2004 + mongoTemplate.save(model);
  2005 + }
  2006 + }
  2007 +
  2008 +
  2009 + Sheet s4 = wb.getSheet(4);
  2010 + System.out.println(s4.getName() + " : ");
  2011 + int rows4 = s4.getRows();
  2012 + if(rows3 > 0){
  2013 + //遍历每行
  2014 + for(int i = 1 ;i < rows4 ; i++){
  2015 + System.out.println("rows="+i);
  2016 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  2017 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量
  2018 + model.setType(4);
  2019 + Cell[] cells = s4.getRow(i);
  2020 + if(cells.length > 0){
  2021 + //遍历每行中的每列
  2022 + for (int j = 0 ; j < cells.length ; j ++)
  2023 + {
  2024 + String str = cells[j].getContents().trim();
  2025 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str))
  2026 + {
  2027 + continue;
  2028 + }
  2029 + switch (j)
  2030 + {
  2031 +
  2032 + case 0:
  2033 + model.setMonthAge(Integer.parseInt(str));
  2034 + continue;
  2035 + case 1:
  2036 + model.setMonthAgeEnd(Integer.parseInt(str));
  2037 + continue;
  2038 + case 2:
  2039 + model.setTitle(str);
  2040 + continue;
  2041 + case 3:
  2042 + List<String> list2 = Arrays.asList(str.split("\n"));
  2043 + model.setContentOne(list2);
  2044 + continue;
  2045 + case 4:
  2046 + model.setStatus(str);
  2047 + continue;
  2048 + }
  2049 + }
  2050 + }
  2051 + mongoTemplate.save(model);
  2052 + }
  2053 + }
  2054 +
  2055 +
  2056 +
  2057 +
  2058 + Sheet s5 = wb.getSheet(5);
  2059 + System.out.println(s5.getName() + " : ");
  2060 + int rows5 = s5.getRows();
  2061 + if(rows5 > 0){
  2062 + //遍历每行
  2063 + for(int i = 1 ;i < rows5 ; i++){
  2064 + System.out.println("rows="+i);
  2065 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  2066 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量
  2067 + model.setType(5);
  2068 + Cell[] cells = s5.getRow(i);
  2069 + if(cells.length > 0){
  2070 + //遍历每行中的每列
  2071 + for (int j = 0 ; j < cells.length ; j ++)
  2072 + {
  2073 + String str = cells[j].getContents().trim();
  2074 + switch (j)
  2075 + {
  2076 + case 0:
  2077 + model.setMonthAge(Integer.parseInt(str));
  2078 + continue;
  2079 + case 1:
  2080 + model.setMonthAgeEnd(Integer.parseInt(str));
  2081 + continue;
  2082 + case 2:
  2083 + model.setTitle(str);
  2084 + continue;
  2085 + case 3:
  2086 + model.setDownValue(str);
  2087 + continue;
  2088 + case 4:
  2089 + model.setNormalValue(str);
  2090 + continue;
  2091 + case 5:
  2092 + model.setUpValue(str);
  2093 + continue;
  2094 + case 6:
  2095 + model.setUnit(str);
  2096 + continue;
  2097 + }
  2098 + }
  2099 + }
  2100 + mongoTemplate.save(model);
  2101 + }
  2102 + }
  2103 +
  2104 +
  2105 +
  2106 + Sheet s6 = wb.getSheet(6);
  2107 + System.out.println(s6.getName() + " : ");
  2108 + int rows6 = s6.getRows();
  2109 + if(rows6 > 0){
  2110 + //遍历每行
  2111 + for(int i = 1 ;i < rows6 ; i++){
  2112 + System.out.println("rows="+i);
  2113 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  2114 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量 6 6-11辅食添加
  2115 + model.setType(6);
  2116 + Cell[] cells = s6.getRow(i);
  2117 + if(cells.length > 0){
  2118 + //遍历每行中的每列
  2119 + for (int j = 0 ; j < cells.length ; j ++)
  2120 + {
  2121 + String str = cells[j].getContents().trim();
  2122 + switch (j)
  2123 + {
  2124 + case 0:
  2125 + model.setMonthAge(Integer.parseInt(str));
  2126 + continue;
  2127 + case 1:
  2128 + model.setKcal(Double.parseDouble(str));
  2129 + continue;
  2130 + case 2:
  2131 + List<String> list1 = Arrays.asList(str.split("\n"));
  2132 + model.setContentOne(list1);
  2133 + continue;
  2134 + case 3:
  2135 + List<String> list2 = Arrays.asList(str.split("\n"));
  2136 + model.setContentTwo(list2);
  2137 + continue;
  2138 + case 4:
  2139 + List<String> list3 = Arrays.asList(str.split("\n"));
  2140 + model.setContentThree(list3);
  2141 + continue;
  2142 + }
  2143 + }
  2144 + }
  2145 + mongoTemplate.save(model);
  2146 + }
  2147 + }
  2148 +
  2149 +
  2150 +
  2151 +
  2152 + Sheet s7 = wb.getSheet(7);
  2153 + System.out.println(s7.getName() + " : ");
  2154 + int rows7 = s7.getRows();
  2155 + if(rows7 > 0){
  2156 + //遍历每行
  2157 + for(int i = 1 ;i < rows7 ; i++){
  2158 + System.out.println("rows="+i);
  2159 + BabyNutritionConfigModel model = new BabyNutritionConfigModel();
  2160 + // 0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量 6 6-11辅食添加 7 12-36元素文章
  2161 + model.setType(7);
  2162 + Cell[] cells = s7.getRow(i);
  2163 + if(cells.length > 0){
  2164 + //遍历每行中的每列
  2165 + for (int j = 0 ; j < cells.length ; j ++)
  2166 + {
  2167 + String str = cells[j].getContents().trim();
  2168 + switch (j)
  2169 + {
  2170 + case 0:
  2171 + model.setTitle(str);
  2172 + continue;
  2173 + case 1:
  2174 + List<String> list1 = Arrays.asList(str.split("\n"));
  2175 + model.setContentOne(list1);
  2176 + continue;
  2177 + case 2:
  2178 + model.setStatus(str);
  2179 + continue;
  2180 +
  2181 + }
  2182 + }
  2183 + }
  2184 + mongoTemplate.save(model);
  2185 + }
  2186 + }
  2187 +
  2188 +
  2189 + } catch (IOException e) {
  2190 + e.printStackTrace();
  2191 + } catch (BiffException e) {
  2192 + e.printStackTrace();
  2193 + }
  2194 +
  2195 + }
  2196 +
  2197 +
1822 2198 public static void main(String[] args) {
1823 2199 // weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
1824 2200 // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
1825 2201  
... ... @@ -1828,9 +2204,12 @@
1828 2204 // zcet("D:\\doc\\高血压报告20180813模板.xls");
1829 2205 // zcet("D:\\doc\\1.xls",false);
1830 2206  
1831   - addBabyBmiHealthConfig("F:\儿童营养报告\婴幼儿bmi.xls");
  2207 +// addBabyBmiHealthConfig("F:\儿童营养报告\婴幼儿bmi.xls");
1832 2208  
1833 2209 // babyConfig("F:\\儿童营养报告\\儿童营养报告模板.xls");
  2210 +
  2211 +
  2212 + babyNutritionConfig("F:\\儿童营养报告\\婴幼儿体重与营养管理报告内容及规则\\儿童膳食报告文章1.xls");
1834 2213 }
1835 2214  
1836 2215 }
platform-dal/src/main/java/com/lyms/platform/pojo/BabyNutritionConfigModel.java View file @ 2c25ccd
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import org.springframework.data.mongodb.core.mapping.Document;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 儿童膳食营养报告
  9 + * Created by Administrator on 2018-06-04.
  10 + */
  11 +@Document(collection = "lyms_baby_Nutrition_config")
  12 +public class BabyNutritionConfigModel {
  13 + private String id;
  14 + private String title;
  15 + private Integer monthAge;//月龄
  16 + private Integer monthAgeEnd;//月龄
  17 + private String feedType;
  18 + private List<String> contentOne;//
  19 + private List<String> contentTwo;//
  20 + private List<String> contentThree;//
  21 + private List<String> contentFour;//
  22 + private Double kcal; //热量
  23 + private Integer type; //0 0-11月龄喂养 1 0-11月每月营养素需求 2 12-36各月龄饮食指南 3 12-36月龄热量计算 4 12-36喂养指南 5 0-36营养元素参考摄入量 6 6-11辅食添加 7 12-36元素文章
  24 +
  25 + private String status; // 消瘦、正常、超重
  26 +
  27 + private String upValue;
  28 + private String normalValue;
  29 + private String downValue;
  30 +
  31 + private String unit;
  32 +
  33 + public Integer getMonthAge() {
  34 + return monthAge;
  35 + }
  36 +
  37 + public void setMonthAge(Integer monthAge) {
  38 + this.monthAge = monthAge;
  39 + }
  40 +
  41 + public Integer getMonthAgeEnd() {
  42 + return monthAgeEnd;
  43 + }
  44 +
  45 + public void setMonthAgeEnd(Integer monthAgeEnd) {
  46 + this.monthAgeEnd = monthAgeEnd;
  47 + }
  48 +
  49 + public String getFeedType() {
  50 + return feedType;
  51 + }
  52 +
  53 + public void setFeedType(String feedType) {
  54 + this.feedType = feedType;
  55 + }
  56 +
  57 + public String getUpValue() {
  58 + return upValue;
  59 + }
  60 +
  61 + public void setUpValue(String upValue) {
  62 + this.upValue = upValue;
  63 + }
  64 +
  65 + public String getNormalValue() {
  66 + return normalValue;
  67 + }
  68 +
  69 + public void setNormalValue(String normalValue) {
  70 + this.normalValue = normalValue;
  71 + }
  72 +
  73 + public String getDownValue() {
  74 + return downValue;
  75 + }
  76 +
  77 + public void setDownValue(String downValue) {
  78 + this.downValue = downValue;
  79 + }
  80 +
  81 + public String getUnit() {
  82 + return unit;
  83 + }
  84 +
  85 + public void setUnit(String unit) {
  86 + this.unit = unit;
  87 + }
  88 +
  89 + public String getId() {
  90 + return id;
  91 + }
  92 +
  93 + public void setId(String id) {
  94 + this.id = id;
  95 + }
  96 +
  97 + public String getTitle() {
  98 + return title;
  99 + }
  100 +
  101 + public void setTitle(String title) {
  102 + this.title = title;
  103 + }
  104 +
  105 +
  106 + public List<String> getContentOne() {
  107 + return contentOne;
  108 + }
  109 +
  110 + public void setContentOne(List<String> contentOne) {
  111 + this.contentOne = contentOne;
  112 + }
  113 +
  114 + public List<String> getContentTwo() {
  115 + return contentTwo;
  116 + }
  117 +
  118 + public void setContentTwo(List<String> contentTwo) {
  119 + this.contentTwo = contentTwo;
  120 + }
  121 +
  122 + public List<String> getContentThree() {
  123 + return contentThree;
  124 + }
  125 +
  126 + public void setContentThree(List<String> contentThree) {
  127 + this.contentThree = contentThree;
  128 + }
  129 +
  130 + public List<String> getContentFour() {
  131 + return contentFour;
  132 + }
  133 +
  134 + public void setContentFour(List<String> contentFour) {
  135 + this.contentFour = contentFour;
  136 + }
  137 +
  138 + public Double getKcal() {
  139 + return kcal;
  140 + }
  141 +
  142 + public void setKcal(Double kcal) {
  143 + this.kcal = kcal;
  144 + }
  145 +
  146 + public Integer getType() {
  147 + return type;
  148 + }
  149 +
  150 + public void setType(Integer type) {
  151 + this.type = type;
  152 + }
  153 +
  154 + public String getStatus() {
  155 + return status;
  156 + }
  157 +
  158 + public void setStatus(String status) {
  159 + this.status = status;
  160 + }
  161 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java View file @ 2c25ccd
... ... @@ -63,7 +63,7 @@
63 63 @RequestParam(required = false)String babyName,
64 64 @RequestParam(required = false)String recordTime,
65 65 HttpServletRequest request){
66   - return babyNutritionFacade.queryBabyNutritionList(page, limit, queryNo, vcCardNo, babyName, getUserId(request),recordTime);
  66 + return babyNutritionFacade.queryBabyNutritionList(page, limit, queryNo, vcCardNo, babyName, getUserId(request), recordTime);
67 67 }
68 68  
69 69  
... ... @@ -100,6 +100,19 @@
100 100 @ResponseBody
101 101 public BaseObjectResponse queryBabyNutritionFood(){
102 102 return babyNutritionFacade.queryBabyNutritionFood();
  103 + }
  104 +
  105 +
  106 + /**
  107 + * 儿童营养报告
  108 + * @param id
  109 + * @return
  110 + */
  111 + @RequestMapping(value = "/queryBabyNutritionReport/{id}", method = RequestMethod.GET)
  112 + @ResponseBody
  113 + @TokenRequired
  114 + public BaseObjectResponse queryBabyNutritionReport(@PathVariable("id")String id,HttpServletRequest request){
  115 + return babyNutritionFacade.queryBabyNutritionReport(id,getUserId(request));
103 116 }
104 117  
105 118  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 2c25ccd
... ... @@ -2238,19 +2238,7 @@
2238 2238 }
2239 2239 }
2240 2240 kcal = getKaul(kcal);
2241   -
2242   - if (month < 12)
2243   - {
2244   - if (kcal < 800)
2245   - {
2246   - kcal = 800;
2247   - }
2248   - else if (kcal > 2000)
2249   - {
2250   - kcal = 2000;
2251   - }
2252   - }
2253   - else if (month < 36)
  2241 + if (month < 36)
2254 2242 {
2255 2243 if (kcal < 600 && "正常".equals(kaupEvaluate))
2256 2244 {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java View file @ 2c25ccd
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.biz.service.*;
4 4 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 5 import com.lyms.platform.common.enums.SexEnum;
  6 +import com.lyms.platform.common.enums.WyTypeEnums;
6 7 import com.lyms.platform.common.enums.YnEnums;
7 8 import com.lyms.platform.common.result.BaseListResponse;
8 9 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -24,6 +25,9 @@
24 25 import org.springframework.beans.factory.annotation.Autowired;
25 26  
26 27 import org.springframework.data.domain.Sort;
  28 +import org.springframework.data.mongodb.core.MongoTemplate;
  29 +import org.springframework.data.mongodb.core.query.Criteria;
  30 +import org.springframework.data.mongodb.core.query.Query;
27 31 import org.springframework.stereotype.Component;
28 32  
29 33 import java.util.*;
30 34  
... ... @@ -59,7 +63,16 @@
59 63 @Autowired
60 64 private BasicConfigService basicConfigService;
61 65  
  66 + @Autowired
  67 + private BabyCheckService babyCheckService;
62 68  
  69 + @Autowired
  70 + private MongoTemplate mongoTemplate;
  71 +
  72 +
  73 + @Autowired
  74 + private PatientWeightService patientWeightService;
  75 +
63 76 public BaseObjectResponse queryBabyNutritionRecord(String babyId) {
64 77 Map<String, Object> resMap = new HashMap<>();
65 78 BabyBasicResult base = new BabyBasicResult();
... ... @@ -105,9 +118,9 @@
105 118 if (CollectionUtils.isNotEmpty(models))
106 119 {
107 120 MeasureBabyInfoModel model = models.get(0);
108   - map.put("weight",model.getValueTwo());
109   - map.put("hegiht",model.getValueOne());
110   - map.put("lastTime",DateUtil.getyyyy_MM_dd(model.getModified()));
  121 + map.put("weight", model.getValueTwo());
  122 + map.put("hegiht", model.getValueOne());
  123 + map.put("lastTime", DateUtil.getyyyy_MM_dd(model.getModified()));
111 124 }
112 125 return map;
113 126 }
... ... @@ -170,7 +183,8 @@
170 183 Map<String,String> map = new HashMap<String, String>();
171 184 map.put("ids", ids);
172 185 String data = HttpClientUtil.doGet(amsUrl + "/v1/getFoodsByIds", map, "utf-8", "3d19960bf3e81e7d816c4f26051c49ba");
173   - List<FoodResult> results = JsonUtil.toList(data, FoodResult.class);
  186 + FoodBaseResult foodBaseResult = JsonUtil.jkstr2Obj(data, FoodBaseResult.class);
  187 + List<FoodResult> results = foodBaseResult.getList();
174 188 return results;
175 189 }
176 190  
... ... @@ -273,6 +287,546 @@
273 287 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
274 288 objectResponse.setErrormsg("成功");
275 289 return objectResponse;
  290 + }
  291 +
  292 + public BaseObjectResponse queryBabyNutritionReport(String id,Integer userId) {
  293 +
  294 +
  295 + Map data = new HashMap();
  296 +
  297 + BabyNutritionQuery babyQuery = new BabyNutritionQuery();
  298 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  299 + babyQuery.setHospitalId(hospitalId);
  300 + babyQuery.setId(id);
  301 +
  302 + List<BabyNutritionModel> models = babyNutritionService.queryBabyNutritions(babyQuery);
  303 + if (CollectionUtils.isNotEmpty(models))
  304 + {
  305 + BabyNutritionModel model = models.get(0);
  306 + BabyModel baby = babyBookbuildingService.queryBabyBuildById(model.getBabyId());
  307 +
  308 + Map map = new HashMap();
  309 + map.put("id",model.getId());
  310 + map.put("babyId",model.getBabyId());
  311 + map.put("babyName",baby.getName());
  312 + map.put("babySex", SexEnum.getTextById(baby.getSex()));
  313 + map.put("monthAge",StringUtils.emptyDeal(DateUtil.getBabyMonthAge(baby.getBirth(), new Date())));
  314 + map.put("motherName", baby.getMname());
  315 + map.put("phone", baby.getMphone());
  316 + map.put("vcCardNo", baby.getVcCardNo());
  317 + map.put("weight", model.getWeight());
  318 + map.put("height", model.getHeight());
  319 + Organization org = organizationService.getOrganization(Integer.parseInt(hospitalId));
  320 + map.put("hospitalName", org.getName());
  321 +
  322 +
  323 + int month = DateUtil.getMonth(baby.getBirth(), model.getNutritiTime());
  324 +
  325 + if (month == 0 || month > 36)
  326 + {
  327 + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("月龄范围没有报告");
  328 + }
  329 +
  330 + String kaupEvaluate = getBabyStatus(month,baby.getSex(),model.getHeight(),model.getWeight());
  331 + map.put("kaupEvaluate", kaupEvaluate);
  332 + map.put("month", month);
  333 + data.put("baseInfo", map);
  334 +
  335 + double kaul = getKal(month,model.getHeight(),model.getWeight(), baby.getSex(), kaupEvaluate);
  336 +
  337 + if (month < 12)
  338 + {
  339 + //根据喂养方式获取 合理喂养
  340 + Criteria ca = Criteria.where("monthAge").is(month).and("type").is(0).and("status").is(kaupEvaluate);
  341 + if (month < 7)
  342 + {
  343 + String feedType = WyTypeEnums.getNameById(Integer.parseInt(model.getFeedType()));
  344 + ca.and("feedType").is(feedType);
  345 + }
  346 + BabyNutritionConfigModel babyNutritionConfig = mongoTemplate.findOne(Query.query(ca),
  347 + BabyNutritionConfigModel.class);
  348 +
  349 + //合理喂养
  350 + data.put("hlFeed",babyNutritionConfig.getContentOne());
  351 +
  352 +
  353 + BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
  354 + Query.query(Criteria.where("monthAge").is(month).and("type").is(1)), BabyNutritionConfigModel.class);
  355 +
  356 + //每月营养素需求
  357 + data.put("yysxq",babyNutritionConfig1.getContentOne());
  358 +
  359 + if (month > 5)
  360 + {
  361 + BabyNutritionConfigModel babyNutritionConfig2 = mongoTemplate.findOne(
  362 + Query.query(Criteria.where("monthAge").is(month).and("type").is(6)), BabyNutritionConfigModel.class);
  363 +
  364 + //食用须知
  365 + data.put("syxz",babyNutritionConfig2.getContentOne());
  366 + //辅食添加
  367 + data.put("fstj",babyNutritionConfig2.getContentTwo());
  368 + //辅食制作
  369 + data.put("fszz",babyNutritionConfig2.getContentThree());
  370 + }
  371 +
  372 + }
  373 + else
  374 + {
  375 + BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
  376 + Query.query(Criteria.where("monthAge").is(month).and("type").is(2)), BabyNutritionConfigModel.class);
  377 + //各月龄饮食指南
  378 + data.put("yszl",babyNutritionConfig1.getContentOne());
  379 +
  380 +
  381 + int tempMonth = month < 36 ? 12 : 36;
  382 + List<BabyNutritionConfigModel> configModels = mongoTemplate.find(Query.query(
  383 + Criteria.where("kcal").is(kaul).and("status").is(kaupEvaluate).and("type").is(3).and("monthAge").is(tempMonth)), BabyNutritionConfigModel.class);
  384 + if (CollectionUtils.isNotEmpty(configModels) && configModels.size() == 3)
  385 + {
  386 + List<Map<String,Object>> list = new ArrayList<>();
  387 + for (BabyNutritionConfigModel configModel : configModels)
  388 + {
  389 + Map<String,Object> map1 = new HashMap<>();
  390 + map1.put("title",configModel.getTitle());
  391 + map1.put("contents",configModel.getContentOne());
  392 + list.add(map);
  393 + }
  394 + data.put("foods",list);
  395 + }
  396 +
  397 + //每日所需营养素
  398 + List<String> yys = getYys(month);
  399 +
  400 + data.put("yys",yys);
  401 +
  402 + }
  403 +
  404 + //元素计算
  405 + List<Map> yysMapList = new ArrayList<>();
  406 +
  407 + List<Map> wlysMapList = new ArrayList<>();
  408 +
  409 + //能量计算
  410 + double nl = getBasicKaul( month, model.getWeight(),model.getHeight(),baby.getSex());
  411 + double nlCurrent = 0;
  412 + yysMapList.add(getNl(nl,nlCurrent));
  413 +
  414 + double tsCurrent = 0;//碳素化合物 TODO
  415 + double dbzCurrent = 0;//蛋白质 TODO
  416 + double zfCurrent = 0;//脂肪 TODO
  417 + if (month < 5)
  418 + {
  419 + yysMapList.add(getYysItems( nl, tsCurrent, "碳水化合物",0.55,0.65));
  420 + yysMapList.add(getYysItems( nl, dbzCurrent, "蛋白质",0.07,0.09));
  421 + yysMapList.add(getYysItems( nl, zfCurrent, "脂肪",0.4,0.5));
  422 +
  423 + }
  424 + else if (month < 12)
  425 + {
  426 +
  427 + yysMapList.add(getYysItems( nl, tsCurrent, "碳水化合物",0.55,0.65));
  428 +
  429 + yysMapList.add(getYysItems( nl, dbzCurrent, "蛋白质",0.05,0.07));
  430 +
  431 + yysMapList.add(getYysItems( nl, zfCurrent, "脂肪",0.4,0.5));
  432 + }
  433 + else if (month < 36)
  434 + {
  435 + yysMapList.add(getYysItems( nl, tsCurrent, "碳水化合物",0.5,0.7));
  436 +
  437 + yysMapList.add(getYysItems( nl, dbzCurrent, "蛋白质",0.07,0.2));
  438 +
  439 + yysMapList.add(getYysItems( nl, zfCurrent, "脂肪",0.2,0.35));
  440 + }
  441 + else
  442 + {
  443 + yysMapList.add(getYysItems( nl, tsCurrent, "碳水化合物",0.55,0.7));
  444 + yysMapList.add(getYysItems( nl, dbzCurrent, "蛋白质",0.07,0.2));
  445 + yysMapList.add(getYysItems( nl, zfCurrent, "脂肪",0.15,0.3));
  446 + }
  447 +
  448 + Map<String,Double> elements = new HashMap();
  449 +
  450 + List<Map> mainFoods = model.getMainFood();
  451 + getFoodElements(elements,mainFoods);
  452 +
  453 + List<Map> vegYj = model.getVegYj();
  454 + getFoodElements(elements,vegYj);
  455 +
  456 + List<Map> vegGj = model.getVegGj();
  457 + getFoodElements(elements,vegGj);
  458 +
  459 + List<Map> vegGq = model.getVegGq();
  460 + getFoodElements(elements,vegGq);
  461 +
  462 + List<Map> vegHc = model.getVegHc();
  463 + getFoodElements(elements,vegHc);
  464 +
  465 + List<Map> vegJl = model.getVegJl();
  466 + getFoodElements(elements,vegJl);
  467 +
  468 + List<Map> meatC = model.getMeatC();
  469 + getFoodElements(elements,meatC);
  470 +
  471 +
  472 + List<Map> meatQ = model.getMeatQ();
  473 + getFoodElements(elements,meatQ);
  474 +
  475 + List<Map> meatD = model.getMeatD();
  476 + getFoodElements(elements,meatD);
  477 +
  478 + List<Map> meatX = model.getMeatX();
  479 + getFoodElements(elements,meatX);
  480 +
  481 + List<Map> meatH = model.getMeatH();
  482 + getFoodElements(elements,meatH);
  483 +
  484 + List<Map> meatY = model.getMeatY();
  485 + getFoodElements(elements,meatY);
  486 +
  487 +
  488 + List<Map> meatYz = model.getMeatYz();
  489 + getFoodElements(elements,meatYz);
  490 +
  491 + List<Map> milk = model.getMilk();
  492 + getFoodElements(elements,milk);
  493 +
  494 + List<Map> oilGg = model.getOilGg();
  495 + getFoodElements(elements,oilGg);
  496 +
  497 +
  498 + List<Map> beansGd = model.getBeansGd();
  499 + getFoodElements(elements,beansGd);
  500 +
  501 + List<Map> beansDl = model.getBeansDl();
  502 + getFoodElements(elements,beansDl);
  503 +
  504 + List<Map> fruits = model.getFruits();
  505 + getFoodElements(elements,fruits);
  506 +
  507 + List<Map> vegXd = model.getVegXd();
  508 + getFoodElements(elements,vegXd);
  509 +
  510 + if (elements.size() > 0)
  511 + {
  512 + for (String key : elements.keySet())
  513 + {
  514 + BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
  515 + Query.query(Criteria.where("type").is(5).and("monthAge").is(6).and("title").is(key)), BabyNutritionConfigModel.class);
  516 + if (babyNutritionConfig1 == null)
  517 + {
  518 + continue;
  519 + }
  520 + Double value = elements.get(key);
  521 + String upValue = babyNutritionConfig1.getUpValue();
  522 + String normalValue = babyNutritionConfig1.getNormalValue();
  523 + String downValue = babyNutritionConfig1.getDownValue();
  524 +
  525 + Map wly = new HashMap();
  526 + wly.put("name",key);
  527 + wly.put("normalValue", normalValue);
  528 + wly.put("currentValue", value);
  529 + wly.put("status", -1);
  530 + wlysMapList.add(wly);
  531 + }
  532 + }
  533 +
  534 +
  535 + data.put("yysMapList",yysMapList);
  536 + data.put("wlysMapList", wlysMapList);
  537 +
  538 + List<Map> items = new ArrayList<>();
  539 + if (CollectionUtils.isNotEmpty(yysMapList))
  540 + {
  541 + for (Map map1 : yysMapList)
  542 + {
  543 + Integer status = Integer.valueOf(String.valueOf(map1.get("status")));
  544 + if (status != 0)
  545 + {
  546 + String str = status == -1 ? "摄入不足" : "摄入过量";
  547 + BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
  548 + Query.query(Criteria.where("type").is(7).and("status").is(str).and("title").is(String.valueOf(map1.get("name")))), BabyNutritionConfigModel.class);
  549 + Map item = new HashMap();
  550 + item.put("title",babyNutritionConfig1.getTitle());
  551 + item.put("content",babyNutritionConfig1.getContentOne());
  552 + items.add(item);
  553 + }
  554 + }
  555 + }
  556 + data.put("items", items);
  557 +
  558 + List<Map> wlysitems = new ArrayList<>();
  559 + if (CollectionUtils.isNotEmpty(wlysMapList))
  560 + {
  561 + for (Map map1 : wlysMapList)
  562 + {
  563 + Integer status = Integer.valueOf(String.valueOf(map1.get("status")));
  564 + if (status != 0)
  565 + {
  566 + String str = status == -1 ? "摄入不足" : "摄入过量";
  567 + BabyNutritionConfigModel babyNutritionConfig1 = mongoTemplate.findOne(
  568 + Query.query(Criteria.where("type").is(7).and("status").is(str).and("title").is(String.valueOf(map1.get("name")))), BabyNutritionConfigModel.class);
  569 + Map item = new HashMap();
  570 + item.put("title",babyNutritionConfig1.getTitle());
  571 + item.put("content",babyNutritionConfig1.getContentOne());
  572 + wlysitems.add(item);
  573 + }
  574 + }
  575 + }
  576 +
  577 + data.put("wlysitems", wlysitems);
  578 +
  579 + }
  580 +
  581 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  582 + objectResponse.setData(data);
  583 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  584 + objectResponse.setErrormsg("成功");
  585 + return objectResponse;
  586 + }
  587 +
  588 + private void getFoodElements(Map<String,Double> elements,List<Map> foods)
  589 + {
  590 + if (CollectionUtils.isNotEmpty(foods))
  591 + {
  592 + for (Map map1 : foods)
  593 + {
  594 + if (map1.get("val") == null || map1.get("ids") == null)
  595 + {
  596 + continue;
  597 + }
  598 + String ids = String.valueOf(map1.get("ids"));
  599 + String val = String.valueOf(map1.get("val"));
  600 +
  601 + if (StringUtils.isEmpty(ids) || StringUtils.isEmpty(val))
  602 + {
  603 + continue;
  604 + }
  605 +
  606 + if (StringUtils.isNotEmpty(ids))
  607 + {
  608 + List<FoodResult> foodResults = getFoods(ids);
  609 + if (CollectionUtils.isNotEmpty(foodResults))
  610 + {
  611 + for (FoodResult food : foodResults)
  612 + {
  613 + Double protein = (elements.get(food.getNutritionName()) == null ? 0 : elements.get(food.getNutritionName())) * Double.valueOf(val);
  614 + elements.put(food.getNutritionName(),protein == null ? 0+food.getProtein() : protein+food.getProtein());
  615 + }
  616 + }
  617 + }
  618 + }
  619 + }
  620 + }
  621 +
  622 + private Map getYysItems(double nl,double current,String title,double down,double up)
  623 + {
  624 + Map map = new HashMap();
  625 + map.put("name",title);
  626 + map.put("normalValue", (nl * down) + "-" + (nl * up));
  627 + map.put("currentValue", current);
  628 + map.put("status", (nl * up) < current ? 1 : (nl * down > current ? -1 : 0));
  629 + return map;
  630 + }
  631 +
  632 + private Map getNl(double nl,double current)
  633 + {
  634 +
  635 + Map nlMap = new HashMap();
  636 + nlMap.put("name","能量");
  637 + nlMap.put("normalValue",(nl-50)+"-" +(nl+50));
  638 + nlMap.put("currentValue",current);
  639 + nlMap.put("status", nl + 50 < current ? 1 : (nl - 50 > current ? -1 : 0));
  640 + return nlMap;
  641 + }
  642 +
  643 +
  644 + private List<String> getYys(int month){
  645 + List<String> list = new ArrayList<>();
  646 +
  647 + if (month < 36)
  648 + {
  649 + list.add("碳水化合物:总能量的50-70%");
  650 + list.add("蛋白质:总能量的7-20%,平均每日约0.96g/kg");
  651 + list.add("脂肪:总能量的20-35%");
  652 + list.add("n-6:总能量的4-8%");
  653 + list.add("N-3:总能量的1%");
  654 + list.add("无机物:钙的推荐摄入量为500mg,磷的推荐摄入量为500mg,钠的充分摄入为0.7g,氯的充分摄入量为1.1g,钾的充分摄入量为1.7g,镁的推荐摄入量为75mg,铁的推荐摄入量为6mg,锌的推荐摄入量为3mg,铜的推荐摄入量为290 μg,氟的充分摄入量为0.6mg,猛的充分摄入量为1.4mg,碘的推荐摄入量为80 μg,硒的推荐摄入量为20 μg");
  655 + 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");
  656 + list.add("水分:1岁120-135ml/kg/day;2岁115-125ml/kg/day");
  657 + }
  658 + else
  659 + {
  660 + list.add("碳水化合物:总能量的55-70%");
  661 + list.add("蛋白质:总能量的7-20%,平均每日约0.88g/kg");
  662 + list.add("脂肪:总能量的15-30%");
  663 + list.add("n-6:总能量的4-8%");
  664 + list.add("n-3:总能量的1%");
  665 + list.add("无机物:钙的推荐摄入量为600mg,磷的推荐摄入量为500mg,钠的充分摄入量为0.9g,氯的充分摄入量为1.4g,钾的充分摄入量为2.3g,镁的推荐摄入量为100mg,铁的推荐摄入量7mg,锌的推荐摄入量为4mg,铜的推荐摄入量为330 μg,氟的充分摄入量为0.8mg,猛的充分摄入量为2.0mg,碘的推荐摄入量为90 μg,硒的推荐摄入量为25 μg");
  666 + list.add("维生素:维生素A的推荐摄入量为300 μgRE,维生素D的充分摄入量为5 μg,维生素E的充分摄入量为6mg α-TE,维生素K的充分摄入量为30μg,维生素C的推荐摄入量为40mg,维生素B1的推荐摄入量为0.5mg,维生素B2(核黄素)的0.7mg,维生素B3烟酸的推荐摄入量为7mgNE,尼克酸的上限摄入量为10mg,尼克酰胺的上限摄入量为250mg,维生素B6的推荐摄入量0.7mg,叶酸的推荐摄入量为180μg DFE,维生素B12的推荐摄入量为1.1μg,泛酸的充分摄入量为3mg,维生素H的充分摄入量11μg");
  667 + list.add("水分:90-100ml/kg/day");
  668 + }
  669 +
  670 + return list;
  671 + }
  672 +
  673 + /**
  674 + * 1-5 体重 * 90kcal/kg
  675 + * 6-11月龄热量计算:体重 * 80kcal/kg
  676 + * 12月龄-35月龄 [80×体重(kg)-100]+20kcal/day
  677 + * 36月龄 男童:88.5-61.9×年龄(岁)+PA[26.7×体重(kg)+903×身长(m)]+20kcal/day PA=1.26
  678 + * 36月龄 女童:135.3-30.8×年龄(岁)+PA[10×体重(kg)+934×身长(m)]+20kcal/day PA=1.31
  679 + * 获取热量
  680 + * @return
  681 + */
  682 + private double getBasicKaul(int month,Double weight,Double height,int sex)
  683 + {
  684 + double kaul = 0;
  685 + if (month < 12)
  686 + {
  687 + kaul = weight * (month < 6 ? 90 : 80);
  688 + }
  689 + else if (month < 36)
  690 + {
  691 + kaul = 89 * weight - 100 + 20;
  692 + }
  693 + else
  694 + {
  695 + if (sex == 1)
  696 + {
  697 + kaul = 88.5-61.9*3+1.26*(26.7*weight +903*(height/100))+20;
  698 + }
  699 + else {
  700 + kaul = 135.3-30.8*3+1.31*(10*weight +934*(height/100))+20;
  701 + }
  702 + }
  703 + return kaul;
  704 + }
  705 +
  706 +
  707 +
  708 + private double getKal(int month,Double weight,Double height,int sex,String kaupEvaluate)
  709 + {
  710 + double kaul = getBasicKaul(month, weight, height, sex);
  711 + kaul = getMathAbs(kaul);
  712 + if (month < 12)
  713 + {
  714 + if (kaul < 800)
  715 + {
  716 + kaul = 800;
  717 + }
  718 + else if (kaul > 2000)
  719 + {
  720 + kaul = 2000;
  721 + }
  722 + }
  723 + else if (month < 36)
  724 + {
  725 + if (kaul < 600 && "正常".equals(kaupEvaluate))
  726 + {
  727 + kaul = 600;
  728 + }
  729 + else if (kaul > 1550 && "正常".equals(kaupEvaluate))
  730 + {
  731 + kaul = 1550;
  732 + }else if (kaul < 500 && "消瘦".equals(kaupEvaluate))
  733 + {
  734 + kaul = 500;
  735 + }
  736 + else if (kaul > 1100 && "消瘦".equals(kaupEvaluate))
  737 + {
  738 + kaul = 1100;
  739 + }
  740 + else if (kaul < 800 && "超重".equals(kaupEvaluate))
  741 + {
  742 + kaul = 800;
  743 + }
  744 + else if (kaul > 1750 && "超重".equals(kaupEvaluate))
  745 + {
  746 + kaul = 1750;
  747 + }
  748 + }
  749 + else if (month == 36)
  750 + {
  751 + if (kaul < 1300 && "正常".equals(kaupEvaluate))
  752 + {
  753 + kaul = 1300;
  754 + }
  755 + else if (kaul > 1750 && "正常".equals(kaupEvaluate))
  756 + {
  757 + kaul = 1750;
  758 + }else if (kaul < 1200 && "消瘦".equals(kaupEvaluate))
  759 + {
  760 + kaul = 1200;
  761 + }
  762 + else if (kaul > 1450 && "消瘦".equals(kaupEvaluate))
  763 + {
  764 + kaul = 1450;
  765 + }
  766 + else if (kaul < 1500 && "超重".equals(kaupEvaluate))
  767 + {
  768 + kaul = 1500;
  769 + }
  770 + else if (kaul > 1850 && "超重".equals(kaupEvaluate))
  771 + {
  772 + kaul = 1850;
  773 + }
  774 + }
  775 +
  776 + return kaul;
  777 +
  778 + }
  779 +
  780 +
  781 + private Double getMathAbs(Double kcal) {
  782 + int k = (int)(kcal/100)*100;
  783 + Double d = Math.floor(k);
  784 + Double md = d + 50;
  785 + if (md > kcal) {
  786 + return d;
  787 + } else {
  788 + return md;
  789 + }
  790 + }
  791 +
  792 +
  793 + /**
  794 + * 0-11分为正常、消瘦、超重及以上三种情况:-2SD ≤ BMI ≤ 1SD正常;BMI<-2SD消瘦;BMI>+1SD超重
  795 + * 12-26分为正常、消瘦、超重及以上三种情况:-2SD ≤ BMI ≤ 1SD正常;BMI<-2SD消瘦;BMI>+1SD超重
  796 + * @return
  797 + */
  798 + private String getBabyStatus(int month,int sex,Double weight,Double hegiht)
  799 + {
  800 + String kaupEvaluate = "";
  801 + if (weight != null && hegiht != null)
  802 + {
  803 + String bmi = patientWeightService.getBmi(String.valueOf(weight),String.valueOf(hegiht));
  804 + if (StringUtils.isNotEmpty(bmi))
  805 + {
  806 + Double bbmi = Double.parseDouble(bmi);
  807 + //查询该月龄的年龄别体重值
  808 + // 正常 :-2SD ≤ A ≤ +1SD
  809 + // 消瘦 : A < -2SD
  810 + //偏重 : A > +1SD
  811 + List<AwModel> list = babyCheckService.queryBabyHealthConfig(month, sex, 5);
  812 + if (CollectionUtils.isNotEmpty(list)) {
  813 + AwModel awModel = list.get(0);
  814 + if (awModel.getPoneDs() < bbmi)
  815 + {
  816 + kaupEvaluate = "超重";
  817 + }
  818 + else if (awModel.getPoneDs() >= bbmi && awModel.getRtwoDs() <= bbmi)
  819 + {
  820 + kaupEvaluate = "正常";
  821 + }
  822 + else if (awModel.getRtwoDs() > bbmi)
  823 + {
  824 + kaupEvaluate = "消瘦";
  825 + }
  826 + }
  827 + }
  828 + }
  829 + return kaupEvaluate;
276 830 }
277 831 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/FoodBaseResult.java View file @ 2c25ccd
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + * Created by Administrator on 2019-01-30.
  7 + */
  8 +public class FoodBaseResult {
  9 + private int errorcode;
  10 + private String errormsg;
  11 + private List<FoodResult> list;
  12 +
  13 + public int getErrorcode() {
  14 + return errorcode;
  15 + }
  16 +
  17 + public void setErrorcode(int errorcode) {
  18 + this.errorcode = errorcode;
  19 + }
  20 +
  21 + public String getErrormsg() {
  22 + return errormsg;
  23 + }
  24 +
  25 + public void setErrormsg(String errormsg) {
  26 + this.errormsg = errormsg;
  27 + }
  28 +
  29 + public List<FoodResult> getList() {
  30 + return list;
  31 + }
  32 +
  33 + public void setList(List<FoodResult> list) {
  34 + this.list = list;
  35 + }
  36 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/FoodResult.java View file @ 2c25ccd
... ... @@ -6,11 +6,20 @@
6 6 public class FoodResult {
7 7  
8 8 private Integer id;
9   - private Integer protein;
  9 + private Double protein;
10 10 private Integer categoryId;
11 11 private Integer nutritionId;
12 12 private Integer unitId;
  13 + private String nutritionName;
13 14  
  15 + public String getNutritionName() {
  16 + return nutritionName;
  17 + }
  18 +
  19 + public void setNutritionName(String nutritionName) {
  20 + this.nutritionName = nutritionName;
  21 + }
  22 +
14 23 public Integer getId() {
15 24 return id;
16 25 }
17 26  
... ... @@ -19,11 +28,11 @@
19 28 this.id = id;
20 29 }
21 30  
22   - public Integer getProtein() {
  31 + public Double getProtein() {
23 32 return protein;
24 33 }
25 34  
26   - public void setProtein(Integer protein) {
  35 + public void setProtein(Double protein) {
27 36 this.protein = protein;
28 37 }
29 38  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/BabyNutritionConstant.java View file @ 2c25ccd
1   -package com.lyms.platform.operate.web.utils;
2   -
3   -/**
4   - * Created by Administrator on 2019-01-30.
5   - */
6   -public class BabyNutritionConstant {
7   -
8   -
9   -}