Commit 8d2de15d04d958191340304ccbbbe7100b2a0231
1 parent
08c84282e7
Exists in
master
and in
6 other branches
20190602 上线栾总新需求
Showing 1 changed file with 116 additions and 12 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
8d2de15
... | ... | @@ -679,15 +679,15 @@ |
679 | 679 | |
680 | 680 | @Override |
681 | 681 | public String getDoctorId(List<Map<String, Object>> dayWeights2) { |
682 | - if (CollectionUtils.isNotEmpty(dayWeights2)){ | |
683 | - if (dayWeights2 != null){ | |
684 | - for (Map m : dayWeights2){ | |
682 | + if (CollectionUtils.isNotEmpty(dayWeights2)) { | |
683 | + if (dayWeights2 != null) { | |
684 | + for (Map m : dayWeights2) { | |
685 | 685 | String currentDate = DateUtil.getyyyy_MM_dd(new Date()); |
686 | 686 | Object object = m.get("date"); |
687 | - if (object != null){ | |
688 | - if (currentDate.equals(object.toString())){ | |
687 | + if (object != null) { | |
688 | + if (currentDate.equals(object.toString())) { | |
689 | 689 | Object obj = m.get("doctorId"); |
690 | - if (obj != null){ | |
690 | + if (obj != null) { | |
691 | 691 | return obj.toString(); |
692 | 692 | } |
693 | 693 | } |
... | ... | @@ -903,7 +903,7 @@ |
903 | 903 | map.put("hospitalName", couponMapper.getHospitalName(hospitalId)); |
904 | 904 | map.put("nowWeight", nowWeight); |
905 | 905 | // 同步时暂时不用 |
906 | - if (sync){ | |
906 | + if (sync) { | |
907 | 907 | map.put("doctorId", doctorId); |
908 | 908 | } |
909 | 909 | } |
... | ... | @@ -2049,6 +2049,10 @@ |
2049 | 2049 | high = entry.getValue(); |
2050 | 2050 | } |
2051 | 2051 | } |
2052 | + | |
2053 | + //20190602 上线前新加bug | |
2054 | + | |
2055 | + | |
2052 | 2056 | //计算出属于那种类型 偏重 还事负重 还是正常 当前体重-孕前体重 |
2053 | 2057 | Double residualWeight = Double.valueOf(patientWeight.getNowWeight()).doubleValue() - Double.valueOf(patientWeight.getBeforeWeight()).doubleValue(); |
2054 | 2058 | //贫血/高血压计算规则 |
2055 | 2059 | |
2056 | 2060 | |
2057 | 2061 | |
... | ... | @@ -2139,15 +2143,15 @@ |
2139 | 2143 | |
2140 | 2144 | List<Map<String, Object>> dayWeights2 = patientWeight.getDayWeights2(); |
2141 | 2145 | String doctorId = ""; |
2142 | - if (CollectionUtils.isNotEmpty(dayWeights2)){ | |
2143 | - for (Map map: dayWeights2){ | |
2146 | + if (CollectionUtils.isNotEmpty(dayWeights2)) { | |
2147 | + for (Map map : dayWeights2) { | |
2144 | 2148 | Object data = map.get("data"); |
2145 | - if (data != null){ | |
2149 | + if (data != null) { | |
2146 | 2150 | String dbData = data.toString(); |
2147 | 2151 | String currentDate = DateUtil.getyyyy_MM_dd(new Date()); |
2148 | - if (dbData.equals(currentDate)){ | |
2152 | + if (dbData.equals(currentDate)) { | |
2149 | 2153 | Object doctorIdObj = map.get("doctorId"); |
2150 | - if (doctorId != null){ | |
2154 | + if (doctorId != null) { | |
2151 | 2155 | doctorId = (String) doctorIdObj; |
2152 | 2156 | } |
2153 | 2157 | } |
... | ... | @@ -2183,6 +2187,8 @@ |
2183 | 2187 | userMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); |
2184 | 2188 | userMap.put("NowWeight", patientWeight.getNowWeight() + "kg"); |
2185 | 2189 | userMap.put("BeforeWeight", patientWeight.getBeforeWeight() + "kg"); |
2190 | + userMap.put("state", this.getState(patientWeight.getNowWeight(), patientWeight.getBeforeWeight(), patientWeight.getBregmatic(), week, bmi)); | |
2191 | + | |
2186 | 2192 | //userMap.put("riskFactor", set); |
2187 | 2193 | data.put("userInfo", userMap); |
2188 | 2194 | Map map2 = new HashMap(); |
... | ... | @@ -2247,6 +2253,7 @@ |
2247 | 2253 | userMap.put("NowWeight", patientWeight.getNowWeight() + "kg"); |
2248 | 2254 | userMap.put("BeforeWeight", patientWeight.getBeforeWeight() + "kg"); |
2249 | 2255 | //userMap.put("riskFactor", set); |
2256 | + userMap.put("state", this.getState(patientWeight.getNowWeight(), patientWeight.getBeforeWeight(), patientWeight.getBregmatic(), week, bmi)); | |
2250 | 2257 | data.put("userInfo", userMap); |
2251 | 2258 | Map map2 = new HashMap(); |
2252 | 2259 | map2.put("guideTitle", weightReportModel.getGuideTitle()); |
... | ... | @@ -2867,6 +2874,103 @@ |
2867 | 2874 | } |
2868 | 2875 | } |
2869 | 2876 | return 0.0; |
2877 | + } | |
2878 | + | |
2879 | + public String getState(String currentWeights, String beforeWeights, String bregmatic, Integer week, double bmi) { | |
2880 | + Map<String, Object> statusMap = new HashMap<>(); | |
2881 | + String status = ""; | |
2882 | + if (StringUtils.isNotEmpty(currentWeights) && StringUtils.isNotEmpty(beforeWeights)) { | |
2883 | + //double bmi = Double.parseDouble(patientWeight.getBmi()); | |
2884 | + | |
2885 | + double kulStart = 0; | |
2886 | + double kulEnd = 0; | |
2887 | + | |
2888 | + Double currentWeight = Double.valueOf(currentWeights); | |
2889 | + Double beforeWeight = Double.valueOf(beforeWeights); | |
2890 | + double add = Double.valueOf(String.format("%.2f", currentWeight - beforeWeight)); | |
2891 | + if (week <= 12) { | |
2892 | + if (add < 1 && (1 - add >= 0.5)) { | |
2893 | + status = "低于"; | |
2894 | + kulStart = currentWeight * 30 + 500; | |
2895 | + } else if (add > 1.5 && (add - 1.5 >= 0.5)) { | |
2896 | + status = "高于"; | |
2897 | + kulStart = currentWeight * 30 - 500; | |
2898 | + } else { | |
2899 | + status = "处于"; | |
2900 | + kulStart = currentWeight * 30; | |
2901 | + } | |
2902 | + kulEnd = kulStart; | |
2903 | + } | |
2904 | + //孕中期 //孕晚期 | |
2905 | + else if (week > 12) { | |
2906 | + //基础kcal值 | |
2907 | + int basekul = (week > 12 && week <= 27) ? 340 : 450; | |
2908 | + String bmiStrs = ""; | |
2909 | + | |
2910 | + if (StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) { | |
2911 | + if (bmi < 18.5) { | |
2912 | + bmiStrs = "BMI<18.5孕" + week + "周"; | |
2913 | + } else if (bmi <= 24.9 && bmi >= 18.5) { | |
2914 | + bmiStrs = "BMI=18.5-24.9孕" + week + "周"; | |
2915 | + } else if (bmi <= 29.9 && bmi >= 25) { | |
2916 | + bmiStrs = "BMI=25-29.9孕" + week + "周"; | |
2917 | + } else if (bmi >= 30) { | |
2918 | + bmiStrs = "BMI≥30孕" + week + "周"; | |
2919 | + } | |
2920 | + } else { | |
2921 | + if (bmi <= 24.9) { | |
2922 | + bmiStrs = "BMI≤24.9孕" + week + "周"; | |
2923 | + } else if (bmi <= 29.9 && bmi >= 25) { | |
2924 | + bmiStrs = "BMI=25-29.9孕" + week + "周"; | |
2925 | + } else if (bmi >= 30) { | |
2926 | + bmiStrs = "BMI≥30孕" + week + "周"; | |
2927 | + } | |
2928 | + } | |
2929 | + if (StringUtils.isEmpty(bmiStrs)) { | |
2930 | + statusMap.put("state", ""); | |
2931 | + } | |
2932 | + | |
2933 | + String[] rangeWeight = null; | |
2934 | + | |
2935 | + if (StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) { | |
2936 | + rangeWeight = ReportConfig.getWeightRange(bmiStrs).split("-"); | |
2937 | + } else { | |
2938 | + rangeWeight = ReportConfig.getDWeightRange(bmiStrs).split("-"); | |
2939 | + } | |
2940 | + | |
2941 | + | |
2942 | + if (rangeWeight == null || rangeWeight.length != 2) { | |
2943 | + statusMap.put("state", ""); | |
2944 | + } | |
2945 | + | |
2946 | + double addWeightStart = Double.parseDouble(rangeWeight[0]); | |
2947 | + double addWeightEnd = Double.parseDouble(rangeWeight[1]); | |
2948 | + | |
2949 | + /* BigDecimal b1 = new BigDecimal(Double.toString(addWeightStart)); | |
2950 | + BigDecimal b2 = new BigDecimal(Double.toString(addWeightEnd)); | |
2951 | + BigDecimal bw = new BigDecimal(Double.toString(beforeWeight));*/ | |
2952 | + | |
2953 | + BigDecimal b1 = new BigDecimal(Double.toString(currentWeight)); | |
2954 | + double kstart = b1.multiply(new BigDecimal(30)).doubleValue() + basekul; | |
2955 | + double kend = b1.multiply(new BigDecimal(30)).doubleValue() + basekul; | |
2956 | + | |
2957 | + | |
2958 | + status = "处于"; | |
2959 | + if (addWeightEnd < add && (Double.valueOf(String.format("%.2f", add - addWeightEnd))) >= 0.5) { | |
2960 | + status = "高于"; | |
2961 | + kstart -= 500; | |
2962 | + kend -= 500; | |
2963 | + } else if (addWeightStart > add && (Double.valueOf(String.format("%.2f", addWeightStart - add))) >= 0.5) { | |
2964 | + status = "低于"; | |
2965 | + kstart += 500; | |
2966 | + kend += 500; | |
2967 | + } | |
2968 | + kulStart = kstart; | |
2969 | + kulEnd = kend; | |
2970 | + } | |
2971 | + | |
2972 | + } | |
2973 | + return status; | |
2870 | 2974 | } |
2871 | 2975 | |
2872 | 2976 | } |