Commit 2f055ed591f796f5535bb949bbaf2cf81d926d19
1 parent
ad7ae004d9
Exists in
master
and in
6 other branches
update
Showing 4 changed files with 36 additions and 45 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/TemporaryBloodSugar.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryBloodSugarServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryUserServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TnbComputeKulServiceImpl.java
platform-dal/src/main/java/com/lyms/platform/pojo/TemporaryBloodSugar.java
View file @
2f055ed
... | ... | @@ -13,8 +13,6 @@ |
13 | 13 | private static final long serialVersionUID = SerialIdEnum.TemporaryBloodSugarModel.getCid(); |
14 | 14 | private String id; |
15 | 15 | |
16 | - //当前体重 | |
17 | - private String nowWeight; | |
18 | 16 | |
19 | 17 | private String cardID; |
20 | 18 | |
... | ... | @@ -40,7 +38,7 @@ |
40 | 38 | private String bloodSugar; |
41 | 39 | |
42 | 40 | |
43 | - private Map<String, String> dayWeights; | |
41 | + // private Map<String, String> dayWeights; | |
44 | 42 | |
45 | 43 | private String hospitalId; |
46 | 44 | //报告状态 1未查看 2查看 |
... | ... | @@ -65,15 +63,6 @@ |
65 | 63 | this.hospitalId = hospitalId; |
66 | 64 | } |
67 | 65 | |
68 | - | |
69 | - public Map<String, String> getDayWeights() { | |
70 | - return dayWeights; | |
71 | - } | |
72 | - | |
73 | - public void setDayWeights(Map<String, String> dayWeights) { | |
74 | - this.dayWeights = dayWeights; | |
75 | - } | |
76 | - | |
77 | 66 | public String getBloodSugar() { |
78 | 67 | return bloodSugar; |
79 | 68 | } |
... | ... | @@ -108,13 +97,6 @@ |
108 | 97 | } |
109 | 98 | |
110 | 99 | |
111 | - public String getNowWeight() { | |
112 | - return nowWeight; | |
113 | - } | |
114 | - | |
115 | - public void setNowWeight(String nowWeight) { | |
116 | - this.nowWeight = nowWeight; | |
117 | - } | |
118 | 100 | |
119 | 101 | public String getCardID() { |
120 | 102 | return cardID; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryBloodSugarServiceImpl.java
View file @
2f055ed
... | ... | @@ -17,12 +17,12 @@ |
17 | 17 | import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; |
18 | 18 | import com.lyms.platform.operate.web.service.ITemporaryBloodSugarService; |
19 | 19 | import com.lyms.platform.operate.web.service.PatientWeightService; |
20 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
20 | 21 | import com.lyms.platform.operate.web.utils.ReportConfig; |
21 | 22 | import com.lyms.platform.permission.model.Organization; |
22 | 23 | import com.lyms.platform.permission.service.OrganizationService; |
23 | 24 | import com.lyms.platform.pojo.*; |
24 | 25 | import com.mongodb.WriteResult; |
25 | -import org.apache.commons.collections.CollectionUtils; | |
26 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
27 | 27 | import org.springframework.data.domain.Sort; |
28 | 28 | import org.springframework.data.mongodb.core.MongoTemplate; |
29 | 29 | |
... | ... | @@ -292,15 +292,12 @@ |
292 | 292 | @Override |
293 | 293 | public BaseResponse getSysBloodSugarReport(String id, Integer userId) { |
294 | 294 | BaseObjectResponse resp = new BaseObjectResponse(); |
295 | - | |
296 | - TemporaryBloodSugar bloodSugar = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), TemporaryBloodSugar.class); | |
297 | - | |
295 | + //穿临时用户id | |
296 | + TemporaryUserModel temporaryUserModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), TemporaryUserModel.class); | |
298 | 297 | //Patients patients = patientsService.findOnePatientById(patientId); |
299 | 298 | |
300 | - TemporaryUserModel temporaryUser = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(bloodSugar.getTemporaryUserId())), TemporaryUserModel.class); | |
301 | - | |
302 | - List<String> risks = temporaryUser.getRiskFactorId(); //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗) | |
303 | - if (!(com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(risks) && (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f") | |
299 | + List<String> risks = temporaryUserModel.getRiskFactorId(); //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗) | |
300 | + if (!(CollectionUtils.isNotEmpty(risks) && (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f") | |
304 | 301 | //需药物治疗的糖尿病 |
305 | 302 | || risks.contains("de7468e6-1bb5-4fab-ae84-78857868409a")))) { |
306 | 303 | resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); |
307 | 304 | |
308 | 305 | |
... | ... | @@ -308,15 +305,16 @@ |
308 | 305 | return resp; |
309 | 306 | } |
310 | 307 | |
311 | - // PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId)), PatientWeight.class); | |
308 | + TemporaryWeightModel temporaryWeightModel = mongoTemplate.findOne(Query.query(Criteria.where("temporaryUserId").is(id)), TemporaryWeightModel.class); | |
309 | + //PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId)), PatientWeight.class); | |
312 | 310 | |
313 | - if (bloodSugar == null) { | |
311 | + if (temporaryWeightModel == null) { | |
314 | 312 | resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); |
315 | 313 | resp.setErrormsg("没有体重测量记录"); |
316 | 314 | return resp; |
317 | 315 | } |
318 | 316 | |
319 | - Map<String, String> dayWeights = bloodSugar.getDayWeights(); | |
317 | + Map<String, String> dayWeights = temporaryWeightModel.getDayWeights(); | |
320 | 318 | |
321 | 319 | //当天没有体重测量 |
322 | 320 | if (!(dayWeights != null && dayWeights.size() > 0 && StringUtils.isNotEmpty(dayWeights.get(DateUtil.getyyyy_MM_dd(new Date()))))) { |
... | ... | @@ -327,7 +325,7 @@ |
327 | 325 | |
328 | 326 | String rid = ""; |
329 | 327 | |
330 | - int week = DateUtil.getWeek(temporaryUser.getLastMenses(), new Date()); | |
328 | + int week = DateUtil.getWeek(temporaryUserModel.getLastMenses(), new Date()); | |
331 | 329 | |
332 | 330 | if (week < 6) { |
333 | 331 | resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); |
334 | 332 | |
335 | 333 | |
... | ... | @@ -351,13 +349,11 @@ |
351 | 349 | //1:妊娠期糖尿病(无需药物治疗) 2:糖尿病合并妊娠(无需药物治疗)(需药物治疗的糖尿病) |
352 | 350 | data.put("riskType", "5aab6d3d422b03d4ad2bf83e".equals(rid) ? "1" : "2"); |
353 | 351 | |
354 | - //算出bmi值 | |
355 | 352 | |
356 | - String bmiStr = patientWeightService.getBmi(temporaryUser.getBeforeWeight(), temporaryUser.getBeforeHeight()); | |
357 | - double bmi = Double.parseDouble(bmiStr); | |
353 | + double bmi = Double.parseDouble(temporaryWeightModel.getBmi()); | |
358 | 354 | //根据高危获取不同的卡路里计算公式 |
359 | - Map<String, String> kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(temporaryUser.getBeforeWeight()), | |
360 | - Double.parseDouble(bloodSugar.getNowWeight()), week, bmi, temporaryUser.getBregmatic(), temporaryUser.getBeforeHeight()); | |
355 | + Map<String, String> kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(temporaryUserModel.getBeforeWeight()), | |
356 | + Double.parseDouble(temporaryWeightModel.getNowWeight()), week, bmi, temporaryUserModel.getBregmatic(), temporaryUserModel.getBeforeHeight()); | |
361 | 357 | |
362 | 358 | |
363 | 359 | String weekYyzl = ""; |
364 | 360 | |
... | ... | @@ -403,9 +399,11 @@ |
403 | 399 | } |
404 | 400 | data.put("weekRange", weekRange); |
405 | 401 | |
402 | + | |
403 | + healthChargeFacade.addHealthCharge(hospitalId, 2, id, 1, 2, userId); | |
404 | + | |
406 | 405 | resp.setData(data); |
407 | 406 | resp.setErrorcode(ResponseCode.SUCCESS.getCode()); |
408 | - healthChargeFacade.addHealthCharge(hospitalId, 2, bloodSugar.getTemporaryUserId(), 1, 2, userId); | |
409 | 407 | resp.setErrormsg("成功"); |
410 | 408 | return resp; |
411 | 409 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryUserServiceImpl.java
View file @
2f055ed
... | ... | @@ -55,6 +55,14 @@ |
55 | 55 | temporaryUser.setModified(new Date()); |
56 | 56 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("修改成功"); |
57 | 57 | } |
58 | + if (StringUtils.isNotEmpty(temporaryUser.getCardID()) || StringUtils.isNotEmpty(temporaryUser.getPhone())) { | |
59 | + Criteria criteria = new Criteria(); | |
60 | + criteria = criteria.orOperator(Criteria.where("cardID").is(temporaryUser.getCardID()), Criteria.where("phone").is(temporaryUser.getPhone())); | |
61 | + List<TemporaryUserModel> temporaryUserModels = mongoTemplate.find(Query.query(criteria), TemporaryUserModel.class); | |
62 | + if (CollectionUtils.isNotEmpty(temporaryUserModels)) { | |
63 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("该用户已建档!"); | |
64 | + } | |
65 | + } | |
58 | 66 | temporaryUser.setCreated(new Date()); |
59 | 67 | temporaryUser.setModified(new Date()); |
60 | 68 | List<String> riskLevelIdList = new ArrayList<>(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TnbComputeKulServiceImpl.java
View file @
2f055ed
... | ... | @@ -30,7 +30,8 @@ |
30 | 30 | @Service |
31 | 31 | class TnbComputeKulServiceImpl implements IComputeKul { |
32 | 32 | |
33 | - private List<String> supportList =new ArrayList<>(); | |
33 | + private List<String> supportList = new ArrayList<>(); | |
34 | + | |
34 | 35 | { |
35 | 36 | /* 5aab6d3d422b03d4ad2bf83e 妊娠期糖尿病(无需药物治疗) |
36 | 37 | 5aab6d3e422b03d4ad2bf83f 糖尿病合并妊娠(无需药物治疗) |
... | ... | @@ -41,7 +42,7 @@ |
41 | 42 | |
42 | 43 | } |
43 | 44 | |
44 | -// 妊娠期糖尿病卡路里计算公式支持的高危id | |
45 | + // 妊娠期糖尿病卡路里计算公式支持的高危id | |
45 | 46 | @Override |
46 | 47 | public boolean canSupported(String riskId) { |
47 | 48 | return supportList.contains(riskId); |
48 | 49 | |
49 | 50 | |
50 | 51 | |
... | ... | @@ -57,19 +58,19 @@ |
57 | 58 | String status = ""; |
58 | 59 | |
59 | 60 | double add = Double.valueOf(String.format("%.2f", currentWeight - beforeWeight)); |
60 | - double height = Double.valueOf(String.format("%.2f", Double.parseDouble(beforeHeight)/100)); | |
61 | + double height = Double.valueOf(String.format("%.2f", Double.parseDouble(beforeHeight) / 100)); | |
61 | 62 | |
62 | 63 | //孕早期 |
63 | 64 | if (week <= 12) { |
64 | 65 | if (add < 1 && (1 - add >= 0.5)) { |
65 | 66 | status = "低于"; |
66 | - kulStart = (new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue()*21 + 500+add)*25; | |
67 | + kulStart = (new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue() * 21 + 500 + add) * 25; | |
67 | 68 | } else if (add > 1.5 && (add - 1.5 >= 0.5)) { |
68 | 69 | status = "高于"; |
69 | - kulStart =(new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue()*21- 500+add)*25; | |
70 | + kulStart = (new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue() * 21 - 500 + add) * 25; | |
70 | 71 | } else { |
71 | 72 | status = "处于"; |
72 | - kulStart =(new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue()*21+add)*25; | |
73 | + kulStart = (new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue() * 21 + add) * 25; | |
73 | 74 | } |
74 | 75 | kulEnd = kulStart; |
75 | 76 | } |
76 | 77 | |
... | ... | @@ -90,7 +91,9 @@ |
90 | 91 | if (StringUtils.isEmpty(bregmatic) || "1".equals(bregmatic)) { |
91 | 92 | rangeWeight = ReportConfig.getWeightRange(bmiStr).split("-"); |
92 | 93 | } else { |
94 | + System.out.println("====>" + bmiStr); | |
93 | 95 | rangeWeight = ReportConfig.getDWeightRange(bmiStr).split("-"); |
96 | + System.out.println("体重==========>" + rangeWeight); | |
94 | 97 | } |
95 | 98 | |
96 | 99 | |
... | ... | @@ -102,8 +105,8 @@ |
102 | 105 | double addWeightEnd = Double.parseDouble(rangeWeight[1]); |
103 | 106 | |
104 | 107 | |
105 | - double d2= new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue()*21; | |
106 | - d2=add+d2; | |
108 | + double d2 = new BigDecimal(Double.toString(height)).multiply(new BigDecimal(Double.toString(height))).doubleValue() * 21; | |
109 | + d2 = add + d2; | |
107 | 110 | |
108 | 111 | double kstart = new BigDecimal(d2).multiply(new BigDecimal(25)).doubleValue() + basekul; |
109 | 112 | double kend = new BigDecimal(d2).multiply(new BigDecimal(25)).doubleValue() + basekul; |