From 8d2de15d04d958191340304ccbbbe7100b2a0231 Mon Sep 17 00:00:00 2001 From: wangbo <184677810@qq.com> Date: Sun, 2 Jun 2019 23:08:22 +0800 Subject: [PATCH] =?UTF-8?q?20190602=20=20=E4=B8=8A=E7=BA=BF=E6=A0=BE?= =?UTF-8?q?=E6=80=BB=E6=96=B0=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/impl/PatientWeightServiceImpl.java | 128 +++++++++++++++++++-- 1 file changed, 116 insertions(+), 12 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index dff0db5..3f3d93f 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -679,15 +679,15 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient @Override public String getDoctorId(List> dayWeights2) { - if (CollectionUtils.isNotEmpty(dayWeights2)){ - if (dayWeights2 != null){ - for (Map m : dayWeights2){ + if (CollectionUtils.isNotEmpty(dayWeights2)) { + if (dayWeights2 != null) { + for (Map m : dayWeights2) { String currentDate = DateUtil.getyyyy_MM_dd(new Date()); Object object = m.get("date"); - if (object != null){ - if (currentDate.equals(object.toString())){ + if (object != null) { + if (currentDate.equals(object.toString())) { Object obj = m.get("doctorId"); - if (obj != null){ + if (obj != null) { return obj.toString(); } } @@ -903,7 +903,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put("hospitalName", couponMapper.getHospitalName(hospitalId)); map.put("nowWeight", nowWeight); // 同步时暂时不用 - if (sync){ + if (sync) { map.put("doctorId", doctorId); } } @@ -2049,6 +2049,10 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient high = entry.getValue(); } } + + //20190602 上线前新加bug + + //计算出属于那种类型 偏重 还事负重 还是正常 当前体重-孕前体重 Double residualWeight = Double.valueOf(patientWeight.getNowWeight()).doubleValue() - Double.valueOf(patientWeight.getBeforeWeight()).doubleValue(); //贫血/高血压计算规则 @@ -2139,15 +2143,15 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient List> dayWeights2 = patientWeight.getDayWeights2(); String doctorId = ""; - if (CollectionUtils.isNotEmpty(dayWeights2)){ - for (Map map: dayWeights2){ + if (CollectionUtils.isNotEmpty(dayWeights2)) { + for (Map map : dayWeights2) { Object data = map.get("data"); - if (data != null){ + if (data != null) { String dbData = data.toString(); String currentDate = DateUtil.getyyyy_MM_dd(new Date()); - if (dbData.equals(currentDate)){ + if (dbData.equals(currentDate)) { Object doctorIdObj = map.get("doctorId"); - if (doctorId != null){ + if (doctorId != null) { doctorId = (String) doctorIdObj; } } @@ -2183,6 +2187,8 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient userMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); userMap.put("NowWeight", patientWeight.getNowWeight() + "kg"); userMap.put("BeforeWeight", patientWeight.getBeforeWeight() + "kg"); + userMap.put("state", this.getState(patientWeight.getNowWeight(), patientWeight.getBeforeWeight(), patientWeight.getBregmatic(), week, bmi)); + //userMap.put("riskFactor", set); data.put("userInfo", userMap); Map map2 = new HashMap(); @@ -2247,6 +2253,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient userMap.put("NowWeight", patientWeight.getNowWeight() + "kg"); userMap.put("BeforeWeight", patientWeight.getBeforeWeight() + "kg"); //userMap.put("riskFactor", set); + userMap.put("state", this.getState(patientWeight.getNowWeight(), patientWeight.getBeforeWeight(), patientWeight.getBregmatic(), week, bmi)); data.put("userInfo", userMap); Map map2 = new HashMap(); map2.put("guideTitle", weightReportModel.getGuideTitle()); @@ -2869,4 +2876,101 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return 0.0; } + public String getState(String currentWeights, String beforeWeights, String bregmatic, Integer week, double bmi) { + Map statusMap = new HashMap<>(); + String status = ""; + if (StringUtils.isNotEmpty(currentWeights) && StringUtils.isNotEmpty(beforeWeights)) { + //double bmi = Double.parseDouble(patientWeight.getBmi()); + + double kulStart = 0; + double kulEnd = 0; + + Double currentWeight = Double.valueOf(currentWeights); + Double beforeWeight = Double.valueOf(beforeWeights); + double add = Double.valueOf(String.format("%.2f", currentWeight - beforeWeight)); + if (week <= 12) { + if (add < 1 && (1 - add >= 0.5)) { + status = "低于"; + kulStart = currentWeight * 30 + 500; + } else if (add > 1.5 && (add - 1.5 >= 0.5)) { + status = "高于"; + kulStart = currentWeight * 30 - 500; + } else { + status = "处于"; + kulStart = currentWeight * 30; + } + kulEnd = kulStart; + } + //孕中期 //孕晚期 + else if (week > 12) { + //基础kcal值 + int basekul = (week > 12 && week <= 27) ? 340 : 450; + String bmiStrs = ""; + + if (StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) { + if (bmi < 18.5) { + bmiStrs = "BMI<18.5孕" + week + "周"; + } else if (bmi <= 24.9 && bmi >= 18.5) { + bmiStrs = "BMI=18.5-24.9孕" + week + "周"; + } else if (bmi <= 29.9 && bmi >= 25) { + bmiStrs = "BMI=25-29.9孕" + week + "周"; + } else if (bmi >= 30) { + bmiStrs = "BMI≥30孕" + week + "周"; + } + } else { + if (bmi <= 24.9) { + bmiStrs = "BMI≤24.9孕" + week + "周"; + } else if (bmi <= 29.9 && bmi >= 25) { + bmiStrs = "BMI=25-29.9孕" + week + "周"; + } else if (bmi >= 30) { + bmiStrs = "BMI≥30孕" + week + "周"; + } + } + if (StringUtils.isEmpty(bmiStrs)) { + statusMap.put("state", ""); + } + + String[] rangeWeight = null; + + if (StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) { + rangeWeight = ReportConfig.getWeightRange(bmiStrs).split("-"); + } else { + rangeWeight = ReportConfig.getDWeightRange(bmiStrs).split("-"); + } + + + if (rangeWeight == null || rangeWeight.length != 2) { + statusMap.put("state", ""); + } + + double addWeightStart = Double.parseDouble(rangeWeight[0]); + double addWeightEnd = Double.parseDouble(rangeWeight[1]); + + /* BigDecimal b1 = new BigDecimal(Double.toString(addWeightStart)); + BigDecimal b2 = new BigDecimal(Double.toString(addWeightEnd)); + BigDecimal bw = new BigDecimal(Double.toString(beforeWeight));*/ + + BigDecimal b1 = new BigDecimal(Double.toString(currentWeight)); + double kstart = b1.multiply(new BigDecimal(30)).doubleValue() + basekul; + double kend = b1.multiply(new BigDecimal(30)).doubleValue() + basekul; + + + status = "处于"; + if (addWeightEnd < add && (Double.valueOf(String.format("%.2f", add - addWeightEnd))) >= 0.5) { + status = "高于"; + kstart -= 500; + kend -= 500; + } else if (addWeightStart > add && (Double.valueOf(String.format("%.2f", addWeightStart - add))) >= 0.5) { + status = "低于"; + kstart += 500; + kend += 500; + } + kulStart = kstart; + kulEnd = kend; + } + + } + return status; + } + } -- 1.8.3.1