Commit 06a961aaee75549117f79fe90545e4e52d15bf60

Authored by liquanyu
1 parent 6cc5d0444f

update

Showing 4 changed files with 116 additions and 82 deletions

platform-common/src/main/java/com/lyms/platform/common/enums/BloodSugarEnums2.java View file @ 06a961a
... ... @@ -4,8 +4,18 @@
4 4 * 血糖时间段枚举
5 5 */
6 6 public enum BloodSugarEnums2 {
  7 + //空腹 早餐后 午餐前 午餐后 晚餐前 晚餐后 0点
  8 + A(1, "空腹"),
7 9  
8   - A(1, "空腹"), B(2, "早餐前"), C(3, "早餐后"), D(4, "午餐前"), E(5, "午餐后"), F(6, "晚餐前"), G(7, "晚餐后") ,H(8, "夜间"), I(9, "睡前");
  10 + C(3, "早餐后"),
  11 + D(4, "午餐前"),
  12 + E(5, "午餐后"),
  13 + F(6, "晚餐前"),
  14 + G(7, "晚餐后"),
  15 + H(8, "0点");
  16 + //B(2, "早餐前"),
  17 + //H(8, "夜间");
  18 + //I(9, "睡前");
9 19  
10 20 BloodSugarEnums2(Integer id, String name) {
11 21 this.id = id;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 06a961a
... ... @@ -2175,12 +2175,14 @@
2175 2175 patientBaseResult.setHeight(StringUtils.isNotEmpty(chuModel.getHeight()) ? chuModel.getHeight() : "");
2176 2176 patientBaseResult.setWeight(StringUtils.isNotEmpty(chuModel.getWeight()) ? chuModel.getWeight() : "");
2177 2177 patientBaseResult.setBeforWeight(StringUtils.isNotEmpty(chuModel.getYqWeight()) ? chuModel.getYqWeight() : "");
  2178 + patientBaseResult.setBmi(patientWeightService.getBmi(chuModel.getYqWeight(),chuModel.getHeight()));
2178 2179 } else {
2179 2180 PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(p.getId())), PatientWeight.class);
2180 2181 if (patientWeight != null) {
2181 2182 patientBaseResult.setHeight(StringUtils.isNotEmpty(patientWeight.getBeforeHeight()) ? patientWeight.getBeforeHeight() : "");
2182 2183 patientBaseResult.setWeight(StringUtils.isNotEmpty(patientWeight.getNowWeight()) ? patientWeight.getNowWeight() : "");
2183 2184 patientBaseResult.setBeforWeight(StringUtils.isNotEmpty(patientWeight.getBeforeWeight()) ? patientWeight.getBeforeWeight() : "");
  2185 + patientBaseResult.setBmi(patientWeight.getBmi());
2184 2186 List<Map<String, Object>> dayWeights2 = patientWeight.getDayWeights2();
2185 2187 String doctorId = patientWeightService.getDoctorId(dayWeights2);
2186 2188 patientBaseResult.setDoctorId(doctorId);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientBaseResult.java View file @ 06a961a
... ... @@ -66,6 +66,16 @@
66 66 //限制三周打印
67 67 private boolean hasPrintInWeek;
68 68  
  69 + private String bmi;
  70 +
  71 + public String getBmi() {
  72 + return bmi;
  73 + }
  74 +
  75 + public void setBmi(String bmi) {
  76 + this.bmi = bmi;
  77 + }
  78 +
69 79 public boolean isHasPrintInWeek() {
70 80 return hasPrintInWeek;
71 81 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java View file @ 06a961a
... ... @@ -1083,6 +1083,26 @@
1083 1083  
1084 1084 Patients patients = patientsService.findOnePatientById(patientId);
1085 1085  
  1086 + //判断开通血糖服务没有
  1087 + if (patients != null)
  1088 + {
  1089 + //根据用户id获取医院ID
  1090 + // String hospitalId = autoMatchFacade.getHospitalId(id);
  1091 + PatientServiceQuery patientQuery = new PatientServiceQuery();
  1092 + patientQuery.setPid(patients.getPid());
  1093 + patientQuery.setSerStatus(1);//'服务状态(1-开通、2-退订、3-过期、4-暂停)',
  1094 + patientQuery.setSerType(PatientSerEnums.SerTypeEnums.xt.getId());
  1095 + patientQuery.setSort("create_date desc");
  1096 + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery);
  1097 + if (!CollectionUtils.isNotEmpty(patientServices))
  1098 + {
  1099 + resp.setErrorcode(ResponseCode.DATA_ERROR.getCode());
  1100 + resp.setErrormsg("孕妇开通血糖服务才能打印报告");
  1101 + return resp;
  1102 + }
  1103 + }
  1104 +
  1105 +
1086 1106 List<String> risks = patients.getRiskFactorId(); //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗)
1087 1107 if (!(CollectionUtils.isNotEmpty(risks) && (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f")
1088 1108 //需药物治疗的糖尿病
... ... @@ -1121,6 +1141,20 @@
1121 1141 }
1122 1142 Map data = new HashMap();
1123 1143  
  1144 +
  1145 + List<BloodSugar> bloodSugars = mongoTemplate.find(Query.query(Criteria.where("pid").is(patients.getPid()).and("created").gt(DateUtil.getYMDTime())), BloodSugar.class);
  1146 + if (CollectionUtils.isNotEmpty(bloodSugars))
  1147 + {
  1148 + Map bloodData = new HashMap();
  1149 + for (BloodSugar bloodSugar : bloodSugars)
  1150 + {
  1151 + bloodData.put(bloodSugar.getBloodSugarType(),bloodSugar.getBloodSugar());
  1152 + }
  1153 +
  1154 + data.put("bloodData",bloodData);
  1155 + }
  1156 +
  1157 +
1124 1158 //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗)
1125 1159 if (risks.contains("5aab6d3d422b03d4ad2bf83e") && (risks.contains("5aab6d3e422b03d4ad2bf83f")
1126 1160 //需药物治疗的糖尿病
1127 1161  
1128 1162  
1129 1163  
... ... @@ -1133,16 +1167,16 @@
1133 1167 rid = "5aab6d3d422b03d4ad2bf83e";
1134 1168 }
1135 1169  
1136   - //1:妊娠期糖尿病(无需药物治疗) 2:糖尿病合并妊娠(无需药物治疗)(需药物治疗的糖尿病)
1137   - data.put("riskType", "5aab6d3d422b03d4ad2bf83e".equals(rid) ? "1" : "2");
  1170 + data.put("riskType", (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f")) ? "1" : "2"); //1 无需药物治疗 2 需要药物治疗
  1171 + data.put("riskType", (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("de7468e6-1bb5-4fab-ae84-78857868409a")) ? 1 : 2 ); //1 妊娠期糖尿病 2 糖尿病合并妊娠
1138 1172  
1139 1173  
1140 1174 double bmi = Double.parseDouble(patientWeight.getBmi());
1141 1175 //根据高危获取不同的卡路里计算公式
1142   - Map<String, String> kmap = getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()),
  1176 + double kcal = getComputeKcal(Double.parseDouble(patientWeight.getBeforeWeight()),
1143 1177 Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight(), version);
  1178 + data.put("bmi", bmi);
1144 1179  
1145   -
1146 1180 String weekYyzl = "";
1147 1181 WeightConfigModel weightConfigModel = patientWeightService.getWeightConfigByWeek(week);
1148 1182 if (weightConfigModel != null) {
... ... @@ -1163,7 +1197,7 @@
1163 1197 Map<String, Object> dinner2 = new LinkedHashMap<>(); // 晚加餐
1164 1198  
1165 1199 String nsArea = ReportConfig.getNSArea(basicConfig.getName());
1166   - WeightConfigModel configModel = getWeightConfigBykcal(kmap, nsArea, rid);
  1200 + WeightConfigModel configModel = getWeightConfigBykcal(kcal, nsArea, rid);
1167 1201  
1168 1202 if (configModel != null) {
1169 1203 setData(breakfast, "早餐", configModel.getBreakfast());
... ... @@ -1176,14 +1210,8 @@
1176 1210  
1177 1211 data.put("food", Arrays.asList(breakfast, breakfast2, lunch, lunch2, dinner, dinner2));
1178 1212  
1179   - String weekRange = "";
1180   - if (week < 12) {
1181   - weekRange = "1";
1182   - } else if (week > 12 && week < 28) {
1183   - weekRange = "2";
1184   - } else {
1185   - weekRange = "3";
1186   - }
  1213 + //1 孕早期 2 孕中期 3 孕晚期
  1214 + String weekRange = week < 12 ? "1" : ((week >= 12 && week < 28) ? "2" : "3");
1187 1215 data.put("weekRange", weekRange);
1188 1216  
1189 1217 healthChargeFacade.addHealthCharge(hospitalId, 2, patientId, 1, 1, userId, doctorId, false);
1190 1218  
1191 1219  
... ... @@ -1195,28 +1223,20 @@
1195 1223 }
1196 1224  
1197 1225  
1198   - public WeightConfigModel getWeightConfigBykcal(Map<String, String> map, String northSouth, String risk) {
1199   - if (map.get("kulStart") == null) {
1200   - return null;
1201   - }
1202   - double kulStart = Double.valueOf(map.get("kulStart"));
1203   - int k1 = ((int) kulStart / 100) * 100;
1204   - double k2 = kulStart - k1;
  1226 + public WeightConfigModel getWeightConfigBykcal(double kcal, String northSouth, String risk) {
  1227 +
  1228 + int k1 = ((int) kcal / 100) * 100;
  1229 + double k2 = kcal - k1;
1205 1230 if (k2 > 50) {
1206 1231 k1 += 100;
1207 1232 }
1208   -
1209 1233 if (k1 < 1500) {
1210 1234 k1 = 1500;
1211 1235 } else if (k1 > 2800) {
1212 1236 k1 = 2800;
1213 1237 }
1214   - Criteria criteria = null;
1215   - if ("3".equals((String) map.get("type"))) {
1216   - criteria = Criteria.where("kcal").is(k1).and("dietaryType").is(0);
1217   - } else {
1218   - criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(k1);
1219   - }
  1238 +
  1239 + Criteria criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(k1);
1220 1240 //如果传了高危因素id就按高危去查
1221 1241 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(risk)) {
1222 1242 criteria = criteria.and("riskId").in(risk).and("type").is("1");
1223 1243  
1224 1244  
1225 1245  
1226 1246  
1227 1247  
... ... @@ -1229,64 +1249,56 @@
1229 1249 return weightConfigModel;
1230 1250 }
1231 1251  
  1252 + /**
  1253 + * 八、热量计算
  1254 + ①公式:(身高cm-105)*系数
  1255 + 系数:BMI<18.5 系数为35
  1256 + 18.5-24.9 系数为25
  1257 + ≥25 系数为20
  1258 + ②在①公式的基础上,判断孕周:孕早期(0到11+6)热量不变
  1259 + 孕中期(12到27+6)热量+200
  1260 + 孕晚期(28到42)热量+400
  1261 + ③计算出来后所有人不能超过2300,超过的按照2300给热量;孕晚期(28到42)不能低于1800,低于1800的按1800给热量。
  1262 + ④计算出的热量四舍五入。
  1263 + * @param beforeWeight
  1264 + * @param currentWeight
  1265 + * @param week
  1266 + * @param bmi
  1267 + * @param bregmatic
  1268 + * @param beforeHeight
  1269 + * @param version
  1270 + * @return
  1271 + */
1232 1272  
1233   - public Map<String, String> getComputeKul(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic, String beforeHeight,String version) {
1234   - Map<String, String> map = new HashMap<>();
1235   - double kulStart = 0;
1236   - double height = Double.valueOf(String.format("%.2f", Double.parseDouble(beforeHeight) / 100));
1237   - //孕早期
1238   - if (week <= 12) {
1239   - kulStart = (new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue() * 21 + 1.5) * 30;
  1273 + public double getComputeKcal(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic, String beforeHeight,String version) {
  1274 +
  1275 + //系数
  1276 + int coefficient = 25;
  1277 + if (bmi < 18.5)
  1278 + {
  1279 + coefficient = 35;
1240 1280 }
1241   - //孕中期 //孕晚期
1242   - else if (week > 12) {
1243   - //基础kcal值
1244   - int basekul = (week > 12 && week <= 27) ? 340 : 450;
  1281 + else if (bmi >=25 )
  1282 + {
  1283 + coefficient = 20;
  1284 + }
1245 1285  
1246   - String bmiStr = "";
  1286 + double kcal = (Double.parseDouble(beforeHeight) - 105) * coefficient;
1247 1287  
1248   - if (org.apache.commons.lang.StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) {
1249   - if (bmi < 18.5) {
1250   - bmiStr = "BMI<18.5孕" + week + "周";
1251   - } else if (bmi <= 24.9 && bmi >= 18.5) {
1252   - bmiStr = "BMI=18.5-24.9孕" + week + "周";
1253   - } else if (bmi <= 29.9 && bmi >= 25) {
1254   - bmiStr = "BMI=25-29.9孕" + week + "周";
1255   - } else if (bmi >= 30) {
1256   - bmiStr = "BMI≥30孕" + week + "周";
1257   - }
1258   - } else {
1259   - if (bmi <= 24.9) {
1260   - bmiStr = "BMI≤24.9孕" + week + "周";
1261   - } else if (bmi <= 29.9 && bmi >= 25) {
1262   - bmiStr = "BMI=25-29.9孕" + week + "周";
1263   - } else if (bmi >= 30) {
1264   - bmiStr = "BMI≥30孕" + week + "周";
1265   - }
1266   - }
1267   -
1268   - if (org.apache.commons.lang.StringUtils.isEmpty(bmiStr)) {
1269   - return map;
1270   - }
1271   -
1272   - String[] rangeWeight = null;
1273   - if (org.apache.commons.lang.StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) {
1274   - rangeWeight = ReportConfig.getWeightRange(bmiStr).split("-");
1275   - } else {
1276   - rangeWeight = ReportConfig.getDWeightRange(bmiStr).split("-");
1277   - }
1278   -
1279   - if (rangeWeight == null || rangeWeight.length != 2) {
1280   - return map;
1281   - }
1282   -
1283   - double addWeightEnd = Double.parseDouble(rangeWeight[1]);
1284   -
1285   - kulStart = (new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue() * 21 + addWeightEnd ) * 30+basekul;
  1288 + if(week >= 12 && week < 28)
  1289 + {
  1290 + kcal+=200;
1286 1291 }
1287   -
1288   - map.put("kulStart", String.valueOf(kulStart));
1289   - return map;
  1292 + else if (week >= 28)
  1293 + {
  1294 + kcal+=400;
  1295 + kcal = kcal < 1800 ? 1800 : kcal;
  1296 + }
  1297 + if (kcal > 2300)
  1298 + {
  1299 + kcal = 2300;
  1300 + }
  1301 + return kcal;
1290 1302 }
1291 1303  
1292 1304