Commit 2d4405e1fb58956b782b196ecb91ff0bd71ca55f
1 parent
06a961aaee
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 26 additions and 45 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
2d4405e
... | ... | @@ -1078,9 +1078,7 @@ |
1078 | 1078 | @Override |
1079 | 1079 | public BaseResponse getSysBloodSugarReport(String patientId, Integer userId, String lsbId, String doctorId) { |
1080 | 1080 | |
1081 | - String version = null; | |
1082 | 1081 | BaseObjectResponse resp = new BaseObjectResponse(); |
1083 | - | |
1084 | 1082 | Patients patients = patientsService.findOnePatientById(patientId); |
1085 | 1083 | |
1086 | 1084 | //判断开通血糖服务没有 |
1087 | 1085 | |
1088 | 1086 | |
1089 | 1087 | |
1090 | 1088 | |
1091 | 1089 | |
1092 | 1090 | |
1093 | 1091 | |
... | ... | @@ -1114,34 +1112,32 @@ |
1114 | 1112 | |
1115 | 1113 | |
1116 | 1114 | PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId)), PatientWeight.class); |
1117 | - | |
1118 | 1115 | if (patientWeight == null) { |
1119 | - resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); | |
1120 | - resp.setErrormsg("没有体重测量记录"); | |
1121 | - return resp; | |
1116 | + AntExChuModel chuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patients.getPid()).and("yn").ne("0")).with(new Sort(Sort.Direction.DESC, "created")), AntExChuModel.class); | |
1117 | + if (chuModel != null && StringUtils.isNotEmpty(chuModel.getHeight()) && StringUtils.isNotEmpty(chuModel.getWeight())) { | |
1118 | + patientWeight = new PatientWeight(); | |
1119 | + patientWeight.setBeforeHeight(StringUtils.isNotEmpty(chuModel.getHeight()) ? chuModel.getHeight() : ""); | |
1120 | + patientWeight.setNowWeight(StringUtils.isNotEmpty(chuModel.getWeight()) ? chuModel.getWeight() : ""); | |
1121 | + patientWeight.setBeforeWeight(StringUtils.isNotEmpty(chuModel.getYqWeight()) ? chuModel.getYqWeight() : ""); | |
1122 | + patientWeight.setBmi(patientWeightService.getBmi(chuModel.getYqWeight(), chuModel.getHeight())); | |
1123 | + } | |
1122 | 1124 | } |
1123 | 1125 | |
1124 | - Map<String, String> dayWeights = patientWeight.getDayWeights(); | |
1125 | - | |
1126 | - //当天没有体重测量 | |
1127 | - if (!(dayWeights != null && dayWeights.size() > 0 && StringUtils.isNotEmpty(dayWeights.get(DateUtil.getyyyy_MM_dd(new Date()))))) { | |
1126 | + if (patientWeight == null) { | |
1128 | 1127 | resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); |
1129 | - resp.setErrormsg("当天没有测量体重,不能出报告"); | |
1128 | + resp.setErrormsg("没有体重测量记录,不能出报告"); | |
1130 | 1129 | return resp; |
1131 | 1130 | } |
1132 | 1131 | |
1133 | - String rid = ""; | |
1134 | - | |
1135 | 1132 | int week = DateUtil.getWeek(patients.getLastMenses(), new Date()); |
1136 | - | |
1137 | 1133 | if (week < 6) { |
1138 | 1134 | resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); |
1139 | 1135 | resp.setErrormsg("小于6孕周,不能出报告"); |
1140 | 1136 | return resp; |
1141 | 1137 | } |
1138 | + | |
1142 | 1139 | Map data = new HashMap(); |
1143 | 1140 | |
1144 | - | |
1145 | 1141 | List<BloodSugar> bloodSugars = mongoTemplate.find(Query.query(Criteria.where("pid").is(patients.getPid()).and("created").gt(DateUtil.getYMDTime())), BloodSugar.class); |
1146 | 1142 | if (CollectionUtils.isNotEmpty(bloodSugars)) |
1147 | 1143 | { |
... | ... | @@ -1154,7 +1150,7 @@ |
1154 | 1150 | data.put("bloodData",bloodData); |
1155 | 1151 | } |
1156 | 1152 | |
1157 | - | |
1153 | + String rid = ""; | |
1158 | 1154 | //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗) |
1159 | 1155 | if (risks.contains("5aab6d3d422b03d4ad2bf83e") && (risks.contains("5aab6d3e422b03d4ad2bf83f") |
1160 | 1156 | //需药物治疗的糖尿病 |
1161 | 1157 | |
1162 | 1158 | |
1163 | 1159 | |
1164 | 1160 | |
... | ... | @@ -1167,23 +1163,21 @@ |
1167 | 1163 | rid = "5aab6d3d422b03d4ad2bf83e"; |
1168 | 1164 | } |
1169 | 1165 | |
1170 | - data.put("riskType", (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f")) ? "1" : "2"); //1 无需药物治疗 2 需要药物治疗 | |
1166 | + data.put("needType", (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f")) ? 1 : 2); //1 无需药物治疗 2 需要药物治疗 | |
1171 | 1167 | data.put("riskType", (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("de7468e6-1bb5-4fab-ae84-78857868409a")) ? 1 : 2 ); //1 妊娠期糖尿病 2 糖尿病合并妊娠 |
1172 | 1168 | |
1173 | 1169 | |
1174 | 1170 | double bmi = Double.parseDouble(patientWeight.getBmi()); |
1175 | 1171 | //根据高危获取不同的卡路里计算公式 |
1176 | - double kcal = getComputeKcal(Double.parseDouble(patientWeight.getBeforeWeight()), | |
1177 | - Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight(), version); | |
1172 | + double kcal = getComputeKcal(week, bmi, patientWeight.getBeforeHeight()); | |
1178 | 1173 | data.put("bmi", bmi); |
1174 | + data.put("kcal", kcal); | |
1175 | + data.put("beforeWeight", patientWeight.getBeforeWeight()); | |
1176 | + data.put("nowWeight", patientWeight.getNowWeight()); | |
1177 | + data.put("beforeHeight", patientWeight.getBeforeHeight()); | |
1179 | 1178 | |
1180 | - String weekYyzl = ""; | |
1181 | - WeightConfigModel weightConfigModel = patientWeightService.getWeightConfigByWeek(week); | |
1182 | - if (weightConfigModel != null) { | |
1183 | - weekYyzl = weightConfigModel.getWeekContent(); | |
1184 | - } | |
1185 | - data.put("weekYyzl", weekYyzl); | |
1186 | 1179 | |
1180 | + | |
1187 | 1181 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
1188 | 1182 | Organization org = organizationService.getOrganization(Integer.parseInt(hospitalId)); |
1189 | 1183 | BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(org.getProvinceId()); |
1190 | 1184 | |
1191 | 1185 | |
1192 | 1186 | |
1193 | 1187 | |
1194 | 1188 | |
... | ... | @@ -1260,38 +1254,25 @@ |
1260 | 1254 | 孕晚期(28到42)热量+400 |
1261 | 1255 | ③计算出来后所有人不能超过2300,超过的按照2300给热量;孕晚期(28到42)不能低于1800,低于1800的按1800给热量。 |
1262 | 1256 | ④计算出的热量四舍五入。 |
1263 | - * @param beforeWeight | |
1264 | - * @param currentWeight | |
1265 | - * @param week | |
1266 | - * @param bmi | |
1267 | - * @param bregmatic | |
1268 | - * @param beforeHeight | |
1269 | - * @param version | |
1257 | + * @param week 孕周 | |
1258 | + * @param bmi bmi值 | |
1259 | + * @param beforeHeight 孕前生高 | |
1270 | 1260 | * @return |
1271 | 1261 | */ |
1272 | 1262 | |
1273 | - public double getComputeKcal(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic, String beforeHeight,String version) { | |
1263 | + public double getComputeKcal(int week, double bmi, String beforeHeight) { | |
1274 | 1264 | |
1275 | 1265 | //系数 |
1276 | 1266 | int coefficient = 25; |
1277 | - if (bmi < 18.5) | |
1278 | - { | |
1279 | - coefficient = 35; | |
1280 | - } | |
1281 | - else if (bmi >=25 ) | |
1282 | - { | |
1283 | - coefficient = 20; | |
1284 | - } | |
1285 | - | |
1267 | + coefficient = bmi < 18.5 ? 35 : (bmi >=25 ? 20 : coefficient); | |
1286 | 1268 | double kcal = (Double.parseDouble(beforeHeight) - 105) * coefficient; |
1287 | - | |
1288 | 1269 | if(week >= 12 && week < 28) |
1289 | 1270 | { |
1290 | - kcal+=200; | |
1271 | + kcal += 200; | |
1291 | 1272 | } |
1292 | 1273 | else if (week >= 28) |
1293 | 1274 | { |
1294 | - kcal+=400; | |
1275 | + kcal += 400; | |
1295 | 1276 | kcal = kcal < 1800 ? 1800 : kcal; |
1296 | 1277 | } |
1297 | 1278 | if (kcal > 2300) |