Commit 86a5b44aabcb66045a386517ca2b6cc11bc7aa01
1 parent
a631279271
Exists in
master
and in
6 other branches
体重营养报告接口修改
Showing 2 changed files with 144 additions and 43 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
86a5b44
... | ... | @@ -3116,6 +3116,7 @@ |
3116 | 3116 | } |
3117 | 3117 | |
3118 | 3118 | Sheet s18 = wb.getSheet(18); |
3119 | + | |
3119 | 3120 | System.out.println(s18.getName() + " : "); |
3120 | 3121 | int rows18 = s18.getRows(); |
3121 | 3122 | if (rows18 > 0) { |
... | ... | @@ -3125,6 +3126,12 @@ |
3125 | 3126 | WeightReportModel weighReport = new WeightReportModel(); |
3126 | 3127 | //0 健康教育之孕期相关 1 饮食 2 饮食之营养指南 3 运动 |
3127 | 3128 | weighReport.setType(18); |
3129 | + weighReport.setgDMId("5aab6d3d422b03d4ad2bf83e"); | |
3130 | + weighReport.setgDMName("妊娠期糖尿病(无需药物治疗)"); | |
3131 | + weighReport.setoDIPId("5aab6d3e422b03d4ad2bf83f"); | |
3132 | + weighReport.setoDIPName("糖尿病合并妊娠(无需药物治疗)"); | |
3133 | + weighReport.setMedicationDiabetesID("de7468e6-1bb5-4fab-ae84-78857868409a"); | |
3134 | + weighReport.setModerateAnemiaName("需药物治疗的糖尿病"); | |
3128 | 3135 | Cell[] cells = s18.getRow(i); |
3129 | 3136 | if (cells.length > 0) { |
3130 | 3137 | //遍历每行中的每列 |
... | ... | @@ -3282,7 +3289,7 @@ |
3282 | 3289 | weighReport.setType(22); |
3283 | 3290 | weighReport.setHyperthyroidismNeedID("5aab6d40422b03d4ad2bf85f"); |
3284 | 3291 | weighReport.setHyperthyroidismName("甲亢(需药物治疗)"); |
3285 | - Cell[] cells = s18.getRow(i); | |
3292 | + Cell[] cells = s22.getRow(i); | |
3286 | 3293 | if (cells.length > 0) { |
3287 | 3294 | //遍历每行中的每列 |
3288 | 3295 | for (int j = 0; j < cells.length; j++) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
86a5b44
... | ... | @@ -1958,10 +1958,9 @@ |
1958 | 1958 | @Override |
1959 | 1959 | public BaseResponse getWeightsReport(String pid, Integer userId, String rid) { |
1960 | 1960 | Map<String, Map<Integer, Double>> series = new HashMap<>(); |
1961 | - Map<String, Map<String, Object>> datas = new HashMap<>(); | |
1961 | + Map<String, Map<String, Object>> datas = new TreeMap<>(); | |
1962 | 1962 | PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(pid)), PatientWeight.class); |
1963 | 1963 | //1.获取该孕妇是否有推荐的高危项 |
1964 | - System.out.println("id" + patientWeight.getPatientId()); | |
1965 | 1964 | Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(patientWeight.getPatientId())), Patients.class); |
1966 | 1965 | //1.1获取到这孕妇所有的高危因素id |
1967 | 1966 | //1.2获取身高 |
1968 | 1967 | |
... | ... | @@ -1969,11 +1968,8 @@ |
1969 | 1968 | //获取体重 |
1970 | 1969 | String weight = patientWeight.getBeforeWeight(); |
1971 | 1970 | Double heights = Double.valueOf(height).doubleValue() / 100; |
1972 | - System.out.println("身高" + heights); | |
1973 | 1971 | int week = DateUtil.getWeek2(patients.getLastMenses(), new Date()); |
1974 | 1972 | this.getAcuteHepatitis(heights, week); |
1975 | - System.out.println("热量值" + this.getAcuteHepatitis(heights, week)); | |
1976 | - System.out.println("孕周:" + week); | |
1977 | 1973 | //获取胎数 |
1978 | 1974 | String bregmatic = patientWeight.getBregmatic(); |
1979 | 1975 | //获取bmi值 |
1980 | 1976 | |
1981 | 1977 | |
1982 | 1978 | |
1983 | 1979 | |
... | ... | @@ -2019,26 +2015,21 @@ |
2019 | 2015 | //贫血/高血压计算规则 |
2020 | 2016 | Integer gxyKcal = this.getRounding((int) this.getKcal(bregmatic, residualWeight, low, high, week, bmiD, patients, patientWeight, heights, 1.12)); |
2021 | 2017 | String gxyKcalStr = gxyKcal + "kcal"; |
2022 | - System.out.println("贫血/高血压计算规则获取到热量值kcalss:" + gxyKcalStr); | |
2023 | - | |
2024 | 2018 | //获取慢性肝炎的计算规则 |
2025 | 2019 | Integer mxgyKcal = this.getRounding((int) this.getHepatitisKcal(patientWeight, bregmatic, residualWeight, low, high, bmiD, week)); |
2026 | 2020 | String mxgyKcalStr = mxgyKcal + "kcal"; |
2027 | - System.out.println("获取慢性肝炎的计算规则热量值:" + mxgyKcalStr); | |
2028 | - | |
2029 | - //急性肝炎跟糖尿病的计算规则 | |
2021 | + //急性肝炎计算规则 | |
2030 | 2022 | Integer kcal = getRounding((int) this.getAcuteHepatitis(heights, week)); |
2031 | 2023 | String kcals = kcal + "kcal"; |
2032 | - System.out.println("急性肝炎跟糖尿病的计算规则热量值:" + kcals); | |
2033 | - | |
2024 | + //糖尿病计算规则 | |
2025 | + Integer diabetesKcal = getDiabetesRounding((int) this.getAcuteHepatitis(heights, week)); | |
2026 | + String diabetesKcalStr = diabetesKcal + "kcal"; | |
2034 | 2027 | //甲亢计算规则 |
2035 | 2028 | Integer gkKcal = this.getRounding((int) this.getKcal(bregmatic, residualWeight, low, high, week, bmiD, patients, patientWeight, heights, 1.45)); |
2036 | 2029 | String gkKcalStr = gkKcal + "kcal"; |
2037 | - System.out.println("甲亢获取到热量值kcalss:" + gkKcalStr); | |
2038 | 2030 | //甲减计算规则 |
2039 | 2031 | Integer gjKcal = this.getRounding((int) this.getKcal(bregmatic, residualWeight, low, high, week, bmiD, patients, patientWeight, heights, 1.45)); |
2040 | 2032 | String gjKcalStr = gjKcal + "kcal"; |
2041 | - System.out.println("甲减获取到热量值kcalss:" + gjKcalStr); | |
2042 | 2033 | //获取改孕妇的高危项 |
2043 | 2034 | String risk = patients.getRiskLevelId(); |
2044 | 2035 | if (risk.contains("eb146c03-b19f-4e28-b85f-fda574b2283b") || risk.contains("224b2329-cb82-4da3-a071-8527f8283aab")) { |
... | ... | @@ -2050,6 +2041,7 @@ |
2050 | 2041 | Map<String, Object> data3 = new HashMap<>(); |
2051 | 2042 | Map<String, Object> data4 = new HashMap<>(); |
2052 | 2043 | Map<String, Object> data5 = new HashMap<>(); |
2044 | + Map<String, Object> data6 = new HashMap<>(); | |
2053 | 2045 | List<String> reiskFactor = patients.getRiskFactorId(); |
2054 | 2046 | List<WeightReportModel> weightReport = mongoTemplate.findAll(WeightReportModel.class); |
2055 | 2047 | //获取视图 |
2056 | 2048 | |
2057 | 2049 | |
2058 | 2050 | |
2059 | 2051 | |
2060 | 2052 | |
2061 | 2053 | |
2062 | 2054 | |
2063 | 2055 | |
2064 | 2056 | |
... | ... | @@ -2061,52 +2053,71 @@ |
2061 | 2053 | weights.put(DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(entry.getKey())), entry.getValue()); |
2062 | 2054 | } |
2063 | 2055 | } |
2064 | - for (WeightReportModel weightReportModel : weightReport) { | |
2065 | - for (String reis : reiskFactor) { | |
2056 | + for (String reis : reiskFactor) { | |
2057 | + for (WeightReportModel weightReportModel : weightReport) { | |
2066 | 2058 | if (reis.equals(weightReportModel.getgDMId()) || reis.equals(weightReportModel.getoDIPId()) || |
2067 | 2059 | reis.equals(weightReportModel.getMedicationDiabetesID())) { |
2068 | - //糖尿病 | |
2069 | - datas.put("diabetes", this.getInfo(weights, data3, weightReportModel, patientWeight, patients, bmiD, week, kcals)); | |
2060 | + //糖尿病diabetes | |
2061 | + datas.put("1", this.getDiabetestInfo(weights, data3, weightReportModel, patientWeight, patients, bmiD, week, diabetesKcalStr)); | |
2070 | 2062 | } else if (reis.equals(weightReportModel.getGestationalHypertensionGHID()) || reis.equals(weightReportModel.getChronicHypertensionID())) { |
2071 | - //高血压 | |
2072 | - datas.put("hypertension", this.getInfo(weights, data2, weightReportModel, patientWeight, patients, bmiD, week, gxyKcalStr)); | |
2063 | + //高血压hypertension | |
2064 | + datas.put("2", this.getInfo(weights, data2, weightReportModel, patientWeight, patients, bmiD, week, gxyKcalStr)); | |
2073 | 2065 | } else if (reis.equals(weightReportModel.getHyperthyroidismNeedID()) || reis.equals(weightReportModel.getHyperthyroidismID())) { |
2074 | - //甲亢 | |
2075 | - datas.put("hyperthyroidism", this.getInfo(weights, data4, weightReportModel, patientWeight, patients, bmiD, week, gkKcalStr)); | |
2066 | + //甲亢hyperthyroidism | |
2067 | + datas.put("3", this.getDiabetestInfo(weights, data4, weightReportModel, patientWeight, patients, bmiD, week, gkKcalStr)); | |
2076 | 2068 | } else if (reis.equals(weightReportModel.getHypothyroidismID()) || reis.equals(weightReportModel.getyLCHypothyroidismID()) || |
2077 | 2069 | reis.equals(weightReportModel.getHypothyroidismNeedID())) { |
2078 | - //甲减 | |
2079 | - datas.put("hypothyroidism", this.getInfo(weights, data5, weightReportModel, patientWeight, patients, bmiD, week, gjKcalStr)); | |
2080 | - } else if (reis.equals(weightReportModel.getDiseasesDigestiveSystemId()) || reis.equals(weightReportModel.getViralHepatitisId())) { | |
2081 | - //急性肝炎 | |
2082 | - datas.put("acuteHepatitis", this.getInfo(weights, data1, weightReportModel, patientWeight, patients, bmiD, week, kcals)); | |
2083 | - | |
2084 | - } else if (reis.equals(weightReportModel.getCirrhosis()) || reis.equals(weightReportModel.getLiverFunctionErrorId())) { | |
2085 | - //慢性肝炎 | |
2086 | - datas.put("chronicHepatitis", this.getInfo(weights, data1, weightReportModel, patientWeight, patients, bmiD, week, mxgyKcalStr)); | |
2070 | + //甲减hypothyroidism | |
2071 | + datas.put("4", this.getDiabetestInfo(weights, data5, weightReportModel, patientWeight, patients, bmiD, week, gjKcalStr)); | |
2087 | 2072 | } else if (reis.equals(weightReportModel.getAnemiaPregnancyId()) || reis.equals(weightReportModel.getMildAnemiaID()) || |
2088 | 2073 | reis.equals(weightReportModel.getModerateAnemiaID()) || reis.equals(weightReportModel.getSevereAnemiaID()) || |
2089 | 2074 | reis.equals(weightReportModel.getSevereAnemiaHBID()) || reis.equals(weightReportModel.getObstructiveAnemiaID())) { |
2090 | - //贫血 | |
2091 | - datas.put("anemia", this.getInfo(weights, data0, weightReportModel, patientWeight, patients, bmiD, week, gjKcalStr)); | |
2075 | + //贫血anemia | |
2076 | + datas.put("5", this.getInfo(weights, data0, weightReportModel, patientWeight, patients, bmiD, week, gjKcalStr)); | |
2077 | + } else if (reis.equals(weightReportModel.getDiseasesDigestiveSystemId()) || reis.equals(weightReportModel.getViralHepatitisId())) { | |
2078 | + //急性肝炎acuteHepatitis | |
2079 | + datas.put("6", this.getInfo(weights, data1, weightReportModel, patientWeight, patients, bmiD, week, kcals)); | |
2080 | + } else if (reis.equals(weightReportModel.getCirrhosis()) || reis.equals(weightReportModel.getLiverFunctionErrorId())) { | |
2081 | + //慢性肝炎chronicHepatitis | |
2082 | + datas.put("7", this.getInfo(weights, data6, weightReportModel, patientWeight, patients, bmiD, week, mxgyKcalStr)); | |
2092 | 2083 | } |
2093 | 2084 | } |
2094 | 2085 | } |
2095 | 2086 | } |
2096 | - if (datas.size() > 1) { | |
2097 | - Map map = new HashMap(); | |
2098 | - datas.put("tips", map); | |
2099 | - map.put("info", "您当前情况存在两种及以上高危风险因素,需请您的主管医生结合临床实际情况对报告进行解读,并根据医生解读建议,指导日常营养膳食"); | |
2100 | - } | |
2101 | 2087 | if (datas.size() == 0) { |
2102 | 2088 | BaseResponse baseResponse = this.report(pid, userId, rid); |
2103 | 2089 | return baseResponse; |
2104 | 2090 | } |
2105 | - return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(datas); | |
2091 | + | |
2092 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(this.getFirstOrNull(datas)); | |
2106 | 2093 | } |
2107 | 2094 | |
2095 | + private static String getKeyOrNull(Map<String, Object> map) { | |
2096 | + String obj = null; | |
2097 | + for (Map.Entry<String, Object> entry : map.entrySet()) { | |
2098 | + obj = entry.getKey(); | |
2099 | + if (obj != null) { | |
2100 | + break; | |
2101 | + } | |
2102 | + } | |
2103 | + return obj; | |
2104 | + } | |
2105 | + | |
2106 | + //获取第一个map中数据值 | |
2107 | + private static Object getFirstOrNull(Map<String, Map<String, Object>> map) { | |
2108 | + Object obj = null; | |
2109 | + for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) { | |
2110 | + obj = entry.getValue(); | |
2111 | + if (obj != null) { | |
2112 | + break; | |
2113 | + } | |
2114 | + } | |
2115 | + return obj; | |
2116 | + } | |
2117 | + | |
2118 | + | |
2108 | 2119 | public Map getInfo(Map<Integer, String> weights, Map<String, Object> data, WeightReportModel weightReportModel, PatientWeight patientWeight, Patients patients, double bmi, int week, String kcal) { |
2109 | - setReport(data, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(), patientWeight.getBregmatic()); | |
2120 | + //setReport(data, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(), patientWeight.getBregmatic()); | |
2110 | 2121 | Map userMap = new HashMap(); |
2111 | 2122 | userMap.put("userName", patients.getUsername()); |
2112 | 2123 | userMap.put("age", patients.getAge()); |
2113 | 2124 | |
... | ... | @@ -2115,10 +2126,10 @@ |
2115 | 2126 | userMap.put("week", week); |
2116 | 2127 | userMap.put("vcCardNo", patients.getVcCardNo()); |
2117 | 2128 | userMap.put("phone", patients.getPhone()); |
2118 | - userMap.put("dueDate", patients.getDueDate()); | |
2129 | + userMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
2119 | 2130 | userMap.put("NowWeight", patientWeight.getNowWeight()); |
2120 | 2131 | userMap.put("BeforeWeight", patientWeight.getBeforeWeight()); |
2121 | - userMap.put("riskFactor", "高危因素集合"); | |
2132 | + userMap.put("riskFactor", patients.getRiskFactorId()); | |
2122 | 2133 | data.put("userInfo", userMap); |
2123 | 2134 | Map map2 = new HashMap(); |
2124 | 2135 | map2.put("guideTitle", weightReportModel.getGuideTitle()); |
2125 | 2136 | |
... | ... | @@ -2157,10 +2168,69 @@ |
2157 | 2168 | map1.put("proposalInfo", weightReportModel.getLaterSuggests()); |
2158 | 2169 | } |
2159 | 2170 | data.put("recipes", map1); |
2171 | + if (patients.getRiskFactorId().size() >= 2) { | |
2172 | + Map map = new HashMap(); | |
2173 | + map.put("tipsInfo", "您当前情况存在两种及以上高危风险因素,需请您的主管医生结合临床实际情况对报告进行解读,并根据医生解读建议,指导日常营养膳食"); | |
2174 | + data.put("tips", map); | |
2175 | + } | |
2160 | 2176 | } |
2161 | 2177 | return data; |
2162 | 2178 | } |
2163 | 2179 | |
2180 | + public Map getDiabetestInfo(Map<Integer, String> weights, Map<String, Object> data, WeightReportModel weightReportModel, PatientWeight patientWeight, Patients patients, double bmi, int week, String kcal) { | |
2181 | + //setReport(data, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(), patientWeight.getBregmatic()); | |
2182 | + Map userMap = new HashMap(); | |
2183 | + userMap.put("userName", patients.getUsername()); | |
2184 | + userMap.put("age", patients.getAge()); | |
2185 | + userMap.put("height", patientWeight.getBeforeHeight()); | |
2186 | + userMap.put("bmi", bmi); | |
2187 | + userMap.put("week", week); | |
2188 | + userMap.put("vcCardNo", patients.getVcCardNo()); | |
2189 | + userMap.put("phone", patients.getPhone()); | |
2190 | + userMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); | |
2191 | + userMap.put("NowWeight", patientWeight.getNowWeight()); | |
2192 | + userMap.put("BeforeWeight", patientWeight.getBeforeWeight()); | |
2193 | + userMap.put("riskFactor", patients.getRiskFactorId()); | |
2194 | + data.put("userInfo", userMap); | |
2195 | + Map map2 = new HashMap(); | |
2196 | + map2.put("guideTitle", weightReportModel.getGuideTitle()); | |
2197 | + map2.put("guideInfo", weightReportModel.getGuideInfo()); | |
2198 | + data.put("nutritionGuide", map2); | |
2199 | + Map map3 = new HashMap(); | |
2200 | + if (StringUtils.isNotEmpty(weightReportModel.getDietTitle()) && null != weightReportModel.getDietInfo()) { | |
2201 | + map3.put("dietTitle", weightReportModel.getDietTitle()); | |
2202 | + map3.put("dietInfo", weightReportModel.getDietInfo()); | |
2203 | + data.put("dietaryRules", map3); | |
2204 | + } | |
2205 | + if (null != weightReportModel.getWeeks() && weightReportModel.getWeeks() == week) { | |
2206 | + Map map = new HashMap(); | |
2207 | + map.put("weeks", weightReportModel.getWeeks()); | |
2208 | + map.put("becareful", weightReportModel.getBecareful()); | |
2209 | + data.put("attentionWeek", map); | |
2210 | + } | |
2211 | + if (kcal.equals(weightReportModel.getKcal())) { | |
2212 | + Map map1 = new HashMap(); | |
2213 | + map1.put("kacl", weightReportModel.getKcal()); | |
2214 | + map1.put("breakfast", weightReportModel.getBreakfast()); | |
2215 | + map1.put("breakfastAdd", weightReportModel.getBreakfastAdd()); | |
2216 | + map1.put("lunch", weightReportModel.getLunch()); | |
2217 | + map1.put("lunchAdd", weightReportModel.getLunchAdd()); | |
2218 | + map1.put("dinner", weightReportModel.getDinner()); | |
2219 | + map1.put("dinnerAdd", weightReportModel.getDinnerAdd()); | |
2220 | + map1.put("northSouth", weightReportModel.getNorthSouth()); | |
2221 | + map1.put("proposalInfo", weightReportModel.getEarlySuggests()); | |
2222 | + | |
2223 | + | |
2224 | + data.put("recipes", map1); | |
2225 | + } | |
2226 | + if (patients.getRiskFactorId().size() >= 2) { | |
2227 | + Map map = new HashMap(); | |
2228 | + map.put("tipsInfo", "您当前情况存在两种及以上高危风险因素,需请您的主管医生结合临床实际情况对报告进行解读,并根据医生解读建议,指导日常营养膳食"); | |
2229 | + data.put("tips", map); | |
2230 | + } | |
2231 | + return data; | |
2232 | + } | |
2233 | + | |
2164 | 2234 | //获取急性肝炎 /糖尿病的计算规则 |
2165 | 2235 | public double getAcuteHepatitis(double height, Integer weeks) { |
2166 | 2236 | if (weeks > 0 && weeks <= 12) { |
... | ... | @@ -2173,6 +2243,29 @@ |
2173 | 2243 | return 0.0; |
2174 | 2244 | } |
2175 | 2245 | |
2246 | + public int getDiabetesRounding(Integer number) { | |
2247 | + if (number <= 1200) { | |
2248 | + return 1200; | |
2249 | + } else if (number >= 2500) { | |
2250 | + return 2500; | |
2251 | + } | |
2252 | + if (number / 10 % 10 >= 5) { | |
2253 | + int g = 0; //s % 10; | |
2254 | + int sw = 0;//s / 10 % 10; | |
2255 | + int b = number / 100 % 10 + 1; | |
2256 | + int q = number / 1000 % 10; | |
2257 | + int num = q * 1000 + b * 100 + sw * 0 + g * 0; | |
2258 | + return num; | |
2259 | + } else { | |
2260 | + int g = 0; //s % 10; | |
2261 | + int sw = 0;//s / 10 % 10; | |
2262 | + int b = number / 100 % 10; | |
2263 | + int q = number / 1000 % 10; | |
2264 | + int num = q * 1000 + b * 100 + sw * 0 + g * 0; | |
2265 | + return num; | |
2266 | + } | |
2267 | + } | |
2268 | + | |
2176 | 2269 | public int getRounding(Integer number) { |
2177 | 2270 | if (number <= 1000) { |
2178 | 2271 | return 1000; |
... | ... | @@ -2685,5 +2778,6 @@ |
2685 | 2778 | } |
2686 | 2779 | return 0.0; |
2687 | 2780 | } |
2781 | + | |
2688 | 2782 | } |