diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java b/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java index ff1b04c..dc64245 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java @@ -24,26 +24,6 @@ public class PatientWeight { private String patientId; - /* // 证件号 - private String cardNo; - - // 就诊卡号 - private String vcCardNo; - - // 姓名 - private String username; - - // 电话 - private String phone; - - // 生日 - private Date birth; - - private Date lastMenses; - - // 证件类型 - private String pcerteTypeId;*/ - // 孕前体重 private String beforeWeight; @@ -55,6 +35,9 @@ public class PatientWeight { private Map weights; + // 存储 年月日 = xxKG + private Map dayWeights; + // 前囟 单胎/双胎/多胎 private String bregmatic; @@ -63,6 +46,13 @@ public class PatientWeight { private String bmi; + public Map getDayWeights() { + return dayWeights; + } + + public void setDayWeights(Map dayWeights) { + this.dayWeights = dayWeights; + } public Map getWeights() { return weights; 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 dbb1800..14331a1 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 @@ -36,43 +36,10 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient @Autowired private MongoUtil mongoUtil; - - - /* *//** + /** * 最低:0~13 : 0~1.9 13~40 1.9~11.9 * 最高: 0~2.2 2.2~15.9 - *//* - static { - for (int i = 0; i <= 40; i++) { - xAxis.add(i); - } - - double avg = 1.9 / 13; - for (int i = 0; i <= 13; i++) { - lowMap.put(i, i * avg); - } - - double avg2 = 10.0 / 27; - for (int i = 1; i <= 27; i++) { - lowMap.put(13 + i, 1.9 + i * avg2); - } - - double highAvg = 2.2 / 13; - for (int i = 0; i <= 13; i++) { - highMap.put(i, i * highAvg); - } - - double highAvg2 = 13.7 / 27; - for (int i = 1; i <= 27; i++) { - highMap.put(13 + i, 2.2 + i * highAvg2); - } - - for (int i = 0; i <= 40; i++) { - normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); - } - }*/ - - + */ @Override public BaseResponse init() { @@ -88,20 +55,28 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId()).and("hospitalId").is(hospitalId)), PatientWeight.class); Map weights = new HashMap<>(); + Map dayWeights = new HashMap<>(); if(pw != null) { if(MapUtils.isNotEmpty(pw.getWeights())) { weights = pw.getWeights(); } + if(MapUtils.isNotEmpty(pw.getDayWeights())) { + dayWeights = pw.getDayWeights(); + } + dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), nowWeight); if(patients != null) { weights.put(DateUtil.getWeek(patients.getLastMenses(), new Date()), nowWeight); } pw.setWeights(weights); + pw.setDayWeights(dayWeights); Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(pw)); mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(pw.getId())), update, PatientWeight.class); return RespBuilder.buildSuccess(pw.getId()); } if(StringUtils.isEmpty(patientWeight.getId()) && patients != null) { + dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), nowWeight); + patientWeight.setDayWeights(dayWeights); patientWeight.setHospitalId(hospitalId); patientWeight.setOperaterId(userId.toString()); patientWeight.setCreated(new Date()); @@ -202,7 +177,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put("bregmatic", BregmaticEnums2.getName(patientWeight.getBregmatic())); map.put("bim", patientWeight.getBmi()); // 体质指数(BMI)=体重(kg)÷身高^2(m) - setReport(map, patientWeight.getWeights(), patientWeight.getBeforeWeight(), patientWeight.getBmi()); + setReport(map, patientWeight.getWeights(), patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights()); CollectionUtils.removeNullValue(map); return RespBuilder.buildSuccess(map); @@ -256,7 +231,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient setRecipe(week, map); // 设置食谱 setGuide(week, map); // 设置指南 } - setReport(map, patientWeight.getWeights(), patientWeight.getBeforeWeight(), patientWeight.getBmi()); + setReport(map, patientWeight.getWeights(), patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights()); CollectionUtils.removeNullValue(map); return RespBuilder.buildSuccess(map); } @@ -268,7 +243,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId).and("hospitalId").is(hospitalId)), PatientWeight.class); if(patientWeight != null) { Map map = new HashMap<>(); - setReport(map, patientWeight.getWeights(), patientWeight.getBeforeWeight(), patientWeight.getBmi()); + setReport(map, patientWeight.getWeights(), patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights()); return RespBuilder.buildSuccess(map); } return RespBuilder.buildSuccess(); @@ -629,7 +604,17 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient 最低 0-0.8 0.9-4.9 最高 0-2.1 2.1-8.9 */ - public void setReport(Map restMap, Map weights, String beforeWeight, String bmi) { + public void setReport(Map restMap, Map weights, String beforeWeight, String bmi, Map dayWeights) { + if(MapUtils.isNotEmpty(dayWeights)) { + List> restList = new ArrayList<>(); + for (String key : dayWeights.keySet()) { + Map temp = new HashMap<>(); + temp.put("nowWeight", dayWeights.get(key)); + temp.put("recordTime", key); + restList.add(temp); + } + } + Double bmiD = Double.parseDouble(bmi); double low = 0D; double low2 = 0D;