Commit 72c7931d476ed8258306a153a5246c8f84a2805e
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
View file @
72c7931
| ... | ... | @@ -781,6 +781,10 @@ |
| 781 | 781 | |
| 782 | 782 | public BaseObjectResponse addNutritionInfo(NutritionInfoRequest nutritionInfoRequest) { |
| 783 | 783 | |
| 784 | + System.out.println("patientId="+nutritionInfoRequest.getPatientId()+";beforeWeight=" | |
| 785 | + +nutritionInfoRequest.getBeforeWeight()+";beforeHeight="+nutritionInfoRequest.getBeforeHeight() | |
| 786 | + +"currentWeight="+nutritionInfoRequest.getCurrentWeight()); | |
| 787 | + | |
| 784 | 788 | Patients patients = patientsService.findOnePatientById(nutritionInfoRequest.getPatientId()); |
| 785 | 789 | List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(nutritionInfoRequest.getPatientId()))); |
| 786 | 790 | String hospitalId = nutritionInfoRequest.getHospitalId(); |
| ... | ... | @@ -851,7 +855,7 @@ |
| 851 | 855 | patientWeight.setHospitalId(hospitalId); |
| 852 | 856 | // patientWeight.setOperaterId(userId.toString()); |
| 853 | 857 | patientWeight.setCreated(new Date()); |
| 854 | - if(StringUtils.isNotBlank(currentWeight) && nutritionInfoRequest.getBeforeHeight() != null) { | |
| 858 | + if(StringUtils.isNotBlank(nutritionInfoRequest.getBeforeWeight()) && nutritionInfoRequest.getBeforeHeight() != null) { | |
| 855 | 859 | patientWeight.setBmi(patientWeightService.getBmi(nutritionInfoRequest.getBeforeWeight(), nutritionInfoRequest.getBeforeHeight())); |
| 856 | 860 | } |
| 857 | 861 | patientWeight.setYn("1"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
72c7931
| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | import org.springframework.stereotype.Service; |
| 37 | 37 | |
| 38 | 38 | import java.math.BigDecimal; |
| 39 | +import java.math.RoundingMode; | |
| 39 | 40 | import java.util.*; |
| 40 | 41 | |
| 41 | 42 | @Service |
| ... | ... | @@ -279,12 +280,10 @@ |
| 279 | 280 | @Override |
| 280 | 281 | public String getBmi(String weight, String height) { |
| 281 | 282 | if(StringUtils.isNotBlank(weight) && StringUtils.isNotEmpty(height)) { |
| 282 | - Double w = Double.parseDouble(weight); | |
| 283 | - Double h = Double.parseDouble(height) / 100l; | |
| 284 | - Double bmi = w / (h * h); | |
| 285 | - BigDecimal bg = new BigDecimal(bmi); | |
| 286 | - bmi = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
| 287 | - return bmi.toString(); | |
| 283 | + java.text.DecimalFormat df = new java.text.DecimalFormat("#.#"); | |
| 284 | + df.setRoundingMode(RoundingMode.FLOOR); | |
| 285 | + double tzzs = Double.parseDouble(weight) / Math.pow(Double.parseDouble(height) / 100, 2); | |
| 286 | + return df.format(tzzs); | |
| 288 | 287 | } |
| 289 | 288 | return ""; |
| 290 | 289 | } |
| ... | ... | @@ -395,8 +394,8 @@ |
| 395 | 394 | } |
| 396 | 395 | map.put("yunqi", yunqi); |
| 397 | 396 | } |
| 398 | - map.put("height", MathUtil.doubleFormat(Double.parseDouble(patientWeight.getBeforeHeight())/100) + " 米"); | |
| 399 | - map.put("beforeWeight", patientWeight.getBeforeWeight() + " 公斤"); | |
| 397 | + map.put("height", patientWeight.getBeforeHeight() == null ? "" : MathUtil.doubleFormat(Double.parseDouble(patientWeight.getBeforeHeight())/100) + " 米"); | |
| 398 | + map.put("beforeWeight", patientWeight.getBeforeWeight() == null ? "" : patientWeight.getBeforeWeight() + " 公斤"); | |
| 400 | 399 | map.put("bmi", patientWeight.getBmi()); |
| 401 | 400 | map.put("nowWeight", patientWeight.getNowWeight() + " 公斤"); |
| 402 | 401 | String pregnancy = DateUtil.getWeekDesc(patients.getLastMenses(), new Date()); |