Commit 7e47adbc0bb9d9447ad1bb2278a426e56987ea61
1 parent
cb3c086ac3
Exists in
master
and in
6 other branches
威海体重
Showing 6 changed files with 414 additions and 82 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java
- platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBaseService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java
View file @
7e47adb
| ... | ... | @@ -50,7 +50,8 @@ |
| 50 | 50 | FWDGTX(36,"服务订购提醒",18,"1"), |
| 51 | 51 | JSGWZD(37,"及时高危指导",1,""), |
| 52 | 52 | CSJGTZ(38,"产筛结果通知",21,"1"), |
| 53 | - YFXXJSTX(39,"孕妇学校课程结束提醒",21,"1,3"); | |
| 53 | + YFXXJSTX(39,"孕妇学校课程结束提醒",21,"1,3"), | |
| 54 | + TZTX(40,"体重测量提醒",21,"1"); | |
| 54 | 55 | |
| 55 | 56 | private SmsServiceEnums(int id,String name,int pid,String serviceObj){ |
| 56 | 57 | this.id = id; |
platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
View file @
7e47adb
| ... | ... | @@ -22,7 +22,8 @@ |
| 22 | 22 | YUN_XUE_JSTX("jBHP98VRjIf3d0TDnor89V_z2IQ9b0ecKW3fAZW4FS8","孕妇学校课程结束提醒"),//孕妇学校课程结束提醒 |
| 23 | 23 | |
| 24 | 24 | FU_WU_DING_GOU_TX("UEwcdz3lJL3NR38KRqN6yTO4nUvRgym5mlXl4jXQBik","服务订购提醒"),//服务订购提醒和收费成功后的高危提醒 |
| 25 | - YI_SHENG_ZHI_DAO("OggqiSHitLkCgSLCaCH72reCZzaw5NyG8iO56InQiQg","医生指导"),//指导 | |
| 25 | + YI_SHENG_ZHI_DAO("5yoQyJ92Ruip87JWQ1zdWO9JtllyyqE3jtHGHV7GyeI","医生指导"),//指导 | |
| 26 | + //YI_SHENG_ZHI_DAO("OggqiSHitLkCgSLCaCH72reCZzaw5NyG8iO56InQiQg","医生指导"),//指导 | |
| 26 | 27 | // WEI_JI_ZHI_DAO("fNkkLSp_gS-YWvzji6gwgdTddl4XBlk8SNP7FRksrfk","危急值提醒");//危急值提醒 |
| 27 | 28 | SHAI_CHA_TONG_ZHI("opEi89qoMHOgr692OGi5O1clvn6XKnYJRXn5BVx0lCA","产筛结果通知");//产筛结果通知 |
| 28 | 29 |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
7e47adb
| ... | ... | @@ -123,6 +123,17 @@ |
| 123 | 123 | |
| 124 | 124 | private boolean isShow; |
| 125 | 125 | |
| 126 | + //异常次数 | |
| 127 | + private Integer exceptionCount; | |
| 128 | + | |
| 129 | + public Integer getExceptionCount() { | |
| 130 | + return exceptionCount; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setExceptionCount(Integer exceptionCount) { | |
| 134 | + this.exceptionCount = exceptionCount; | |
| 135 | + } | |
| 136 | + | |
| 126 | 137 | public boolean isShow() { |
| 127 | 138 | return isShow; |
| 128 | 139 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
View file @
7e47adb
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | import javax.servlet.http.HttpServletRequest; |
| 13 | 13 | import javax.servlet.http.HttpServletResponse; |
| 14 | +import java.util.List; | |
| 14 | 15 | |
| 15 | 16 | /** |
| 16 | 17 | * 孕产妇体重管理 |
| ... | ... | @@ -91,7 +92,7 @@ |
| 91 | 92 | public BaseResponse report(@PathVariable String id, |
| 92 | 93 | HttpServletRequest request, |
| 93 | 94 | @RequestParam(value = "rid",required = false)String rid) { |
| 94 | - return patientWeightService.report(id, getUserId(request),rid); | |
| 95 | + return patientWeightService.report(id, getUserId(request), rid); | |
| 95 | 96 | } |
| 96 | 97 | |
| 97 | 98 | /** |
| ... | ... | @@ -159,7 +160,7 @@ |
| 159 | 160 | @ResponseBody |
| 160 | 161 | @RequestMapping(value = "/last/check", method = RequestMethod.GET) |
| 161 | 162 | public BaseResponse patientLastCheck(String pid,@RequestParam(required = false) String time) { |
| 162 | - return patientWeightService.lastCheckTime(pid,time); | |
| 163 | + return patientWeightService.lastCheckTime(pid, time); | |
| 163 | 164 | } |
| 164 | 165 | |
| 165 | 166 | /** |
| ... | ... | @@ -171,7 +172,7 @@ |
| 171 | 172 | @ResponseBody |
| 172 | 173 | @RequestMapping(value = "/recipe/info", method = RequestMethod.GET) |
| 173 | 174 | public BaseResponse patientRecipeInfo(String pid,@RequestParam(required = false) String time) { |
| 174 | - return patientWeightService.patientRecipeInfo(pid, 2,time); | |
| 175 | + return patientWeightService.patientRecipeInfo(pid, 2, time); | |
| 175 | 176 | } |
| 176 | 177 | |
| 177 | 178 | /** |
| ... | ... | @@ -221,6 +222,29 @@ |
| 221 | 222 | @RequestMapping(value = "/find/risk", method = RequestMethod.GET) |
| 222 | 223 | public BaseResponse canChooseRisk(String patientId){ |
| 223 | 224 | return patientWeightService.findRiskDietaryPrinciples(patientId); |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * 生成通知 | |
| 229 | + * @param patientIds | |
| 230 | + * @param request | |
| 231 | + * @return | |
| 232 | + */ | |
| 233 | + @ResponseBody | |
| 234 | + @RequestMapping(method = RequestMethod.POST) | |
| 235 | + public BaseResponse notify(List<String> patientIds, HttpServletRequest request) { | |
| 236 | + return patientWeightService.notify(getUserId(request), patientIds); | |
| 237 | + } | |
| 238 | + | |
| 239 | + /** | |
| 240 | + * 医生下面其他没有测量记录的用户 | |
| 241 | + * @param doctorId | |
| 242 | + * @return | |
| 243 | + */ | |
| 244 | + @ResponseBody | |
| 245 | + @RequestMapping(value = "/getSevenNotWeights/{doctorId}", method = RequestMethod.GET) | |
| 246 | + public BaseResponse getSevenNotWeights(@PathVariable String doctorId) { | |
| 247 | + return patientWeightService.getSevenNotWeights(doctorId); | |
| 224 | 248 | } |
| 225 | 249 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBaseService.java
View file @
7e47adb
| 1 | 1 | package com.lyms.platform.operate.web.service; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.result.BaseResponse; | |
| 3 | 4 | import com.lyms.platform.common.result.PageResult; |
| 4 | 5 | |
| 5 | 6 | import org.springframework.data.mongodb.core.query.Query; |
| ... | ... | @@ -23,5 +24,9 @@ |
| 23 | 24 | PageResult findPage(String sql, Integer currentPage, Integer pageSize, List<Object> params); |
| 24 | 25 | |
| 25 | 26 | <T> PageResult findMongoPage (Class<T> entity, Query query, Integer page, Integer limit); |
| 27 | + | |
| 28 | + BaseResponse notify(Integer userId, List<String> patientIds); | |
| 29 | + | |
| 30 | + BaseResponse getSevenNotWeights(String doctorId); | |
| 26 | 31 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
7e47adb
| 1 | 1 | package com.lyms.platform.operate.web.service.impl; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.beans.MsgRequest; | |
| 3 | 4 | import com.lyms.platform.biz.service.BasicConfigService; |
| 4 | 5 | import com.lyms.platform.biz.service.DoctorUserMapService; |
| 5 | 6 | import com.lyms.platform.biz.service.PatientWeightService2; |
| 6 | 7 | import com.lyms.platform.biz.service.PatientsService; |
| 7 | 8 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 8 | -import com.lyms.platform.common.enums.BregmaticEnums2; | |
| 9 | -import com.lyms.platform.common.enums.OptActionEnums; | |
| 10 | -import com.lyms.platform.common.enums.RemoteServerEnmus; | |
| 9 | +import com.lyms.platform.common.enums.*; | |
| 11 | 10 | import com.lyms.platform.common.result.*; |
| 12 | 11 | import com.lyms.platform.common.utils.*; |
| 13 | 12 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 14 | 13 | import com.lyms.platform.operate.web.facade.OperateLogFacade; |
| 15 | 14 | import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; |
| 15 | +import com.lyms.platform.operate.web.facade.SmsConfigFacade; | |
| 16 | 16 | import com.lyms.platform.operate.web.service.PatientWeightService; |
| 17 | 17 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 18 | 18 | import com.lyms.platform.operate.web.utils.MathUtil; |
| 19 | 19 | import com.lyms.platform.operate.web.utils.MongoUtil; |
| 20 | 20 | import com.lyms.platform.operate.web.utils.ReportConfig; |
| 21 | 21 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| 22 | -import com.lyms.platform.permission.model.Organization; | |
| 22 | +import com.lyms.platform.permission.model.*; | |
| 23 | +import com.lyms.platform.permission.service.DepartmentsService; | |
| 23 | 24 | import com.lyms.platform.permission.service.OrganizationService; |
| 25 | +import com.lyms.platform.permission.service.PatientServiceService; | |
| 26 | +import com.lyms.platform.permission.service.UsersService; | |
| 24 | 27 | import com.lyms.platform.pojo.*; |
| 28 | +import com.lyms.platform.query.SmsConfigQuery; | |
| 25 | 29 | import net.sf.json.JSONArray; |
| 26 | 30 | import net.sf.json.JSONObject; |
| 27 | 31 | import org.apache.commons.collections.MapUtils; |
| 28 | 32 | |
| ... | ... | @@ -75,7 +79,15 @@ |
| 75 | 79 | @Autowired |
| 76 | 80 | private ComputeKulServiceManager computeKulServiceManager; |
| 77 | 81 | |
| 82 | + @Autowired | |
| 83 | + private SmsConfigFacade smsConfigFacade; | |
| 78 | 84 | |
| 85 | + @Autowired | |
| 86 | + private PatientServiceService patientServiceService; | |
| 87 | + @Autowired | |
| 88 | + private UsersService usersService; | |
| 89 | + | |
| 90 | + | |
| 79 | 91 | /** |
| 80 | 92 | * 最低:0~13 : 0~1.9 13~40 1.9~11.9 |
| 81 | 93 | * 最高: 0~2.2 2.2~15.9 |
| ... | ... | @@ -653,7 +665,7 @@ |
| 653 | 665 | weights.put(DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(entry.getKey())), entry.getValue()); |
| 654 | 666 | } |
| 655 | 667 | } |
| 656 | - setAppReport(map, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights()); | |
| 668 | + setAppReport(patients.getLastMenses(),patientWeight,map, weights); | |
| 657 | 669 | return RespBuilder.buildSuccess(map); |
| 658 | 670 | } |
| 659 | 671 | return RespBuilder.buildSuccess(); |
| ... | ... | @@ -980,6 +992,51 @@ |
| 980 | 992 | } |
| 981 | 993 | |
| 982 | 994 | |
| 995 | + private int getLevel(String lbmiStr,int week,String beforeWeight,String weight,int add,double prcent) | |
| 996 | + { | |
| 997 | + int level = 0; | |
| 998 | + String range = ""; | |
| 999 | + if (week < 12) | |
| 1000 | + { | |
| 1001 | + range = "1-1.5"; | |
| 1002 | + } | |
| 1003 | + else { | |
| 1004 | + range = ReportConfig.getWeightRange(lbmiStr + "孕" + week + "周"); | |
| 1005 | + } | |
| 1006 | + | |
| 1007 | + if (StringUtils.isNotEmpty(range)) { | |
| 1008 | + String[] array = range.split("-"); | |
| 1009 | + double cz = getDiff(beforeWeight, weight); | |
| 1010 | + if ((cz-Double.parseDouble(array[1])) >= add && cz/Double.parseDouble(array[1]) > prcent) | |
| 1011 | + { | |
| 1012 | + level = 1; | |
| 1013 | + } | |
| 1014 | + } | |
| 1015 | + return level; | |
| 1016 | + } | |
| 1017 | + | |
| 1018 | + private int getDLevel(String lbmiStr,int week,String beforeWeight,String weight,int add,double prcent) | |
| 1019 | + { | |
| 1020 | + int level = 0; | |
| 1021 | + String range = ""; | |
| 1022 | + if (week < 12) | |
| 1023 | + { | |
| 1024 | + range = "1-1.5"; | |
| 1025 | + } | |
| 1026 | + else { | |
| 1027 | + range = ReportConfig.getDWeightRange(lbmiStr + "孕" + week + "周"); | |
| 1028 | + } | |
| 1029 | + if (StringUtils.isNotEmpty(range)) { | |
| 1030 | + String[] array = range.split("-"); | |
| 1031 | + double cz = getDiff(beforeWeight, weight); | |
| 1032 | + if ((cz-Double.parseDouble(array[1])) >= add && cz/Double.parseDouble(array[1]) > prcent) | |
| 1033 | + { | |
| 1034 | + level = 1; | |
| 1035 | + } | |
| 1036 | + } | |
| 1037 | + return level; | |
| 1038 | + } | |
| 1039 | + | |
| 983 | 1040 | /** |
| 984 | 1041 | * BMI指数: |
| 985 | 1042 | * 低体重(<18.5) 0-13周 13-40周 |
| 986 | 1043 | |
| 987 | 1044 | |
| 988 | 1045 | |
| 989 | 1046 | |
| 990 | 1047 | |
| 991 | 1048 | |
| 992 | 1049 | |
| 993 | 1050 | |
| 994 | 1051 | |
| 995 | 1052 | |
| 996 | 1053 | |
| 997 | 1054 | |
| ... | ... | @@ -996,106 +1053,225 @@ |
| 996 | 1053 | * 最低 0-0.8 0.9-4.9 |
| 997 | 1054 | * 最高 0-2.1 2.1-8.9 |
| 998 | 1055 | */ |
| 999 | - public void setAppReport(Map<String, Object> restMap, Map<Integer, String> weights, String beforeWeight, String bmi, Map<String, String> dayWeights) { | |
| 1056 | + public void setAppReport(Date lastMenses,PatientWeight patientWeight,Map<String, Object> restMap, Map<Integer, String> weights) { | |
| 1057 | + | |
| 1058 | + String beforeWeight= patientWeight.getBeforeWeight(); | |
| 1059 | + String bmi = patientWeight.getBmi(); | |
| 1060 | + Map<String, String> dayWeights = patientWeight.getDayWeights(); | |
| 1061 | + | |
| 1062 | + String bregmatic = patientWeight.getBregmatic(); | |
| 1063 | + // 小程序和app可能没有bmi 默认返回标准 | |
| 1064 | + Double bmiD = 20D; | |
| 1065 | + if (StringUtils.isNotEmpty(bmi)) { | |
| 1066 | + bmiD = Double.parseDouble(bmi); | |
| 1067 | + } | |
| 1068 | + | |
| 1000 | 1069 | List<Map<String, Object>> restList = new ArrayList<>(); |
| 1001 | 1070 | dayWeights = sortMapByKey(dayWeights); |
| 1071 | + | |
| 1002 | 1072 | if (MapUtils.isNotEmpty(dayWeights)) { |
| 1003 | 1073 | for (String key : dayWeights.keySet()) { |
| 1074 | + int level = 0; //-1过低 0正常 1过高 | |
| 1075 | + String lbmiStr = ""; | |
| 1076 | + int week = DateUtil.getWeek2(lastMenses, DateUtil.parseYMD(key)); | |
| 1004 | 1077 | Map<String, Object> temp = new LinkedHashMap<>(); |
| 1078 | + //空和1表示单胎 | |
| 1079 | + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) | |
| 1080 | + { | |
| 1081 | + | |
| 1082 | + if (bmiD < 18.5) { | |
| 1083 | + lbmiStr = "BMI<18.5"; | |
| 1084 | + level = getLevel( lbmiStr, week, beforeWeight, key,1,1.2); | |
| 1085 | + } else if (bmiD >= 18.5 && bmiD <= 24.9) { | |
| 1086 | + lbmiStr = "BMI=18.5-24.9"; | |
| 1087 | + level = getLevel( lbmiStr, week, beforeWeight, key,1,1.2); | |
| 1088 | + } else if (bmiD > 24.9 && bmiD < 30) { | |
| 1089 | + lbmiStr = "BMI=25-29.9"; | |
| 1090 | + level = getLevel( lbmiStr, week, beforeWeight, key,1,1.25); | |
| 1091 | + } else if (bmiD >= 30) { | |
| 1092 | + lbmiStr = "BMI≥30"; | |
| 1093 | + level = getLevel( lbmiStr, week, beforeWeight, key,1,1.25); | |
| 1094 | + } | |
| 1095 | + } | |
| 1096 | + else | |
| 1097 | + { | |
| 1098 | + if (bmiD <= 24.9) { | |
| 1099 | + lbmiStr = "BMI≤24.9"; | |
| 1100 | + level = getDLevel(lbmiStr, week, beforeWeight, key, 1, 1.15); | |
| 1101 | + } else if (bmiD >= 25 && bmiD <= 29.9) { | |
| 1102 | + lbmiStr = "BMI=25-29.9"; | |
| 1103 | + level = getDLevel(lbmiStr, week, beforeWeight, key,1,1.2); | |
| 1104 | + } else if (bmiD >= 30) { | |
| 1105 | + lbmiStr = "BMI≥30"; | |
| 1106 | + level = getDLevel(lbmiStr, week, beforeWeight, key,1,1.2); | |
| 1107 | + } | |
| 1108 | + } | |
| 1109 | + | |
| 1005 | 1110 | temp.put("nowWeight", dayWeights.get(key)); |
| 1006 | 1111 | temp.put("recordTime", key); |
| 1112 | + temp.put("level", level); | |
| 1007 | 1113 | restList.add(temp); |
| 1008 | 1114 | } |
| 1009 | 1115 | } |
| 1010 | 1116 | |
| 1011 | - // 小程序和app可能没有bmi 默认返回标准 | |
| 1012 | - Double bmiD = 20D; | |
| 1013 | - if (StringUtils.isNotEmpty(bmi)) { | |
| 1014 | - bmiD = Double.parseDouble(bmi); | |
| 1015 | - } | |
| 1016 | - double low = 0D; | |
| 1017 | - double low2 = 0D; | |
| 1018 | - double high = 0D; | |
| 1019 | - double high2 = 0D; | |
| 1117 | + String title = ""; | |
| 1020 | 1118 | String color = ""; |
| 1021 | - if (bmiD <= 18.5) { | |
| 1022 | - low = 1.2; | |
| 1023 | - low2 = 11.9; | |
| 1024 | - high = 3.8; | |
| 1025 | - high2 = 18.1; | |
| 1026 | - color = "#00CD00"; | |
| 1027 | - } else if (bmiD > 18.5 && bmiD <= 24.9) { | |
| 1028 | - low = 1.4; | |
| 1029 | - low2 = 11.9; | |
| 1030 | - high = 3.2; | |
| 1031 | - high2 = 15.9; | |
| 1032 | - color = "#7EC0EE"; | |
| 1033 | - } else if (bmiD > 24.9 && bmiD < 30) { | |
| 1034 | - low = 1.1; | |
| 1035 | - low2 = 7.1; | |
| 1036 | - high = 3.1; | |
| 1037 | - high2 = 11.6; | |
| 1038 | - color = "#CD3333"; | |
| 1039 | - } else if (bmiD >= 30) { | |
| 1040 | - low = 0.8; | |
| 1041 | - low2 = 4.9; | |
| 1042 | - high = 2.1; | |
| 1043 | - high2 = 8.9; | |
| 1044 | - color = "#CD00CD"; | |
| 1119 | + String bmiStr = ""; | |
| 1120 | + | |
| 1121 | + //空和1表示单胎 | |
| 1122 | + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) { | |
| 1123 | + if (bmiD < 18.5) { | |
| 1124 | + title = "低体重推荐增重均值"; | |
| 1125 | + color = "#00CD00"; | |
| 1126 | + bmiStr = "BMI<18.5"; | |
| 1127 | + } else if (bmiD >= 18.5 && bmiD <= 24.9) { | |
| 1128 | + title = "标准体重推荐增重均值"; | |
| 1129 | + color = "#7EC0EE"; | |
| 1130 | + bmiStr = "BMI=18.5-24.9"; | |
| 1131 | + } else if (bmiD > 24.9 && bmiD < 30) { | |
| 1132 | + title = "超重体重推荐增重均值"; | |
| 1133 | + color = "#CD3333"; | |
| 1134 | + bmiStr = "BMI=25-29.9"; | |
| 1135 | + } else if (bmiD >= 30) { | |
| 1136 | + title = "肥胖体重推荐增重均值"; | |
| 1137 | + color = "#CD00CD"; | |
| 1138 | + bmiStr = "BMI≥30"; | |
| 1139 | + } | |
| 1140 | + } else { | |
| 1141 | + if (bmiD <= 24.9) { | |
| 1142 | + title = "标准体重推荐增重均值"; | |
| 1143 | + color = "#7EC0EE"; | |
| 1144 | + bmiStr = "BMI≤24.9"; | |
| 1145 | + } else if (bmiD >= 25 && bmiD <= 29.9) { | |
| 1146 | + title = "超重体重推荐增重均值"; | |
| 1147 | + color = "#CD3333"; | |
| 1148 | + bmiStr = "BMI=25-29.9"; | |
| 1149 | + } else if (bmiD >= 30) { | |
| 1150 | + title = "肥胖体重推荐增重均值"; | |
| 1151 | + color = "#CD00CD"; | |
| 1152 | + bmiStr = "BMI≥30"; | |
| 1153 | + } | |
| 1045 | 1154 | } |
| 1046 | 1155 | |
| 1047 | - Map<Integer, Double> highMap = new LinkedHashMap<>(); | |
| 1048 | - Map<Integer, Double> normalMap = new LinkedHashMap<>(); | |
| 1049 | - Map<Integer, Double> lowMap = new LinkedHashMap<>(); | |
| 1050 | 1156 | List<Integer> xAxis = new ArrayList<>(); |
| 1051 | - double avg = low / 13; | |
| 1052 | - for (int i = 0; i <= 13; i++) { | |
| 1053 | - lowMap.put(i, i * avg); | |
| 1054 | - } | |
| 1055 | - double avg2 = (low2 - low) / 27; | |
| 1056 | - for (int i = 1; i <= 27; i++) { | |
| 1057 | - lowMap.put(13 + i, low + i * avg2); | |
| 1058 | - } | |
| 1059 | - double highAvg = high / 13; | |
| 1060 | - for (int i = 0; i <= 13; i++) { | |
| 1061 | - highMap.put(i, i * highAvg); | |
| 1062 | - } | |
| 1063 | - double highAvg2 = (high2 - high) / 27; | |
| 1064 | - for (int i = 1; i <= 27; i++) { | |
| 1065 | - highMap.put(13 + i, high + i * highAvg2); | |
| 1066 | - } | |
| 1067 | - for (int i = 0; i <= 40; i++) { | |
| 1068 | - normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); | |
| 1069 | - } | |
| 1070 | 1157 | |
| 1071 | 1158 | Map<String, Object> reportModel = new LinkedHashMap<>(); |
| 1072 | 1159 | Map<String, Object> series = new LinkedHashMap<>(); |
| 1073 | -// series.put("lowData", MathUtil.doubleFormat2(CollectionUtils.getValList(lowMap))); | |
| 1074 | -// series.put("highData", MathUtil.doubleFormat2(CollectionUtils.getValList(highMap))); | |
| 1075 | -// series.put("normalData", MathUtil.doubleFormat2(CollectionUtils.getValList(normalMap))); | |
| 1076 | - series.put("lowData", delOtherPort(CollectionUtils.getValList(lowMap))); | |
| 1077 | - series.put("highData", delOtherPort(CollectionUtils.getValList(highMap))); | |
| 1078 | - series.put("normalData", delOtherPort(CollectionUtils.getValList(normalMap))); | |
| 1160 | + getSeries(series, bmiStr, bregmatic); | |
| 1079 | 1161 | |
| 1080 | 1162 | series.put("dayWeights", restList); |
| 1081 | 1163 | |
| 1082 | 1164 | reportModel.put("series", series); |
| 1165 | + | |
| 1166 | + reportModel.put("title", title); | |
| 1083 | 1167 | reportModel.put("color", color); |
| 1084 | 1168 | |
| 1085 | - for (int i = 0; i <= 40; i++) { | |
| 1169 | + String doctorName = ""; | |
| 1170 | + String doctorPhone = ""; | |
| 1171 | + if (StringUtils.isNotEmpty(patientWeight.getPatientId())) | |
| 1172 | + { | |
| 1173 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 1174 | + patientQuery.setSerType(PatientSerEnums.SerTypeEnums.tz.getId()); | |
| 1175 | + patientQuery.setParentid(patientWeight.getPatientId()); | |
| 1176 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 1177 | + if (CollectionUtils.isNotEmpty(patientServices)) | |
| 1178 | + { | |
| 1179 | + String doctId = patientServices.get(0).getSerDoct(); | |
| 1180 | + if (StringUtils.isNotEmpty(doctId)) | |
| 1181 | + { | |
| 1182 | + Users user = usersService.getUsers(Integer.parseInt(doctId)); | |
| 1183 | + if (user != null) | |
| 1184 | + { | |
| 1185 | + doctorName = user.getName(); | |
| 1186 | + doctorPhone = user.getPhone(); | |
| 1187 | + } | |
| 1188 | + } | |
| 1189 | + } | |
| 1190 | + } | |
| 1191 | + | |
| 1192 | + reportModel.put("doctorName", doctorName); | |
| 1193 | + reportModel.put("doctorPhone", doctorPhone); | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + for (int i = 1; i <= 40; i++) { | |
| 1086 | 1197 | xAxis.add(i); |
| 1087 | 1198 | } |
| 1088 | 1199 | reportModel.put("xAxis", xAxis); |
| 1089 | 1200 | |
| 1090 | - /* List<Object> list = new ArrayList<>(); | |
| 1091 | - if(MapUtils.isNotEmpty(weights)) { | |
| 1092 | - Iterator<Map.Entry<Integer, String>> iterator = weights.entrySet().iterator(); | |
| 1093 | - while (iterator.hasNext()) { | |
| 1094 | - Map.Entry<Integer, String> next = iterator.next(); | |
| 1095 | - list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); | |
| 1096 | - } | |
| 1097 | - } | |
| 1098 | - series.put("portData", list);*/ | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | +// double low = 0D; | |
| 1205 | +// double low2 = 0D; | |
| 1206 | +// double high = 0D; | |
| 1207 | +// double high2 = 0D; | |
| 1208 | +// String color = ""; | |
| 1209 | +// if (bmiD <= 18.5) { | |
| 1210 | +// low = 1.2; | |
| 1211 | +// low2 = 11.9; | |
| 1212 | +// high = 3.8; | |
| 1213 | +// high2 = 18.1; | |
| 1214 | +// color = "#00CD00"; | |
| 1215 | +// } else if (bmiD > 18.5 && bmiD <= 24.9) { | |
| 1216 | +// low = 1.4; | |
| 1217 | +// low2 = 11.9; | |
| 1218 | +// high = 3.2; | |
| 1219 | +// high2 = 15.9; | |
| 1220 | +// color = "#7EC0EE"; | |
| 1221 | +// } else if (bmiD > 24.9 && bmiD < 30) { | |
| 1222 | +// low = 1.1; | |
| 1223 | +// low2 = 7.1; | |
| 1224 | +// high = 3.1; | |
| 1225 | +// high2 = 11.6; | |
| 1226 | +// color = "#CD3333"; | |
| 1227 | +// } else if (bmiD >= 30) { | |
| 1228 | +// low = 0.8; | |
| 1229 | +// low2 = 4.9; | |
| 1230 | +// high = 2.1; | |
| 1231 | +// high2 = 8.9; | |
| 1232 | +// color = "#CD00CD"; | |
| 1233 | +// } | |
| 1234 | +// | |
| 1235 | +// Map<Integer, Double> highMap = new LinkedHashMap<>(); | |
| 1236 | +// Map<Integer, Double> normalMap = new LinkedHashMap<>(); | |
| 1237 | +// Map<Integer, Double> lowMap = new LinkedHashMap<>(); | |
| 1238 | +// List<Integer> xAxis = new ArrayList<>(); | |
| 1239 | +// double avg = low / 13; | |
| 1240 | +// for (int i = 0; i <= 13; i++) { | |
| 1241 | +// lowMap.put(i, i * avg); | |
| 1242 | +// } | |
| 1243 | +// double avg2 = (low2 - low) / 27; | |
| 1244 | +// for (int i = 1; i <= 27; i++) { | |
| 1245 | +// lowMap.put(13 + i, low + i * avg2); | |
| 1246 | +// } | |
| 1247 | +// double highAvg = high / 13; | |
| 1248 | +// for (int i = 0; i <= 13; i++) { | |
| 1249 | +// highMap.put(i, i * highAvg); | |
| 1250 | +// } | |
| 1251 | +// double highAvg2 = (high2 - high) / 27; | |
| 1252 | +// for (int i = 1; i <= 27; i++) { | |
| 1253 | +// highMap.put(13 + i, high + i * highAvg2); | |
| 1254 | +// } | |
| 1255 | +// for (int i = 0; i <= 40; i++) { | |
| 1256 | +// normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); | |
| 1257 | +// } | |
| 1258 | +// | |
| 1259 | +// Map<String, Object> reportModel = new LinkedHashMap<>(); | |
| 1260 | +// Map<String, Object> series = new LinkedHashMap<>(); | |
| 1261 | +// series.put("lowData", delOtherPort(CollectionUtils.getValList(lowMap))); | |
| 1262 | +// series.put("highData", delOtherPort(CollectionUtils.getValList(highMap))); | |
| 1263 | +// series.put("normalData", delOtherPort(CollectionUtils.getValList(normalMap))); | |
| 1264 | +// | |
| 1265 | +// series.put("dayWeights", restList); | |
| 1266 | +// | |
| 1267 | +// reportModel.put("series", series); | |
| 1268 | +// reportModel.put("color", color); | |
| 1269 | +// | |
| 1270 | +// for (int i = 0; i <= 40; i++) { | |
| 1271 | +// xAxis.add(i); | |
| 1272 | +// } | |
| 1273 | +// reportModel.put("xAxis", xAxis); | |
| 1274 | + | |
| 1099 | 1275 | List<Map<String, Object>> list = new ArrayList<>(); |
| 1100 | 1276 | if (MapUtils.isNotEmpty(weights)) { |
| 1101 | 1277 | Iterator<Map.Entry<Integer, String>> iterator = weights.entrySet().iterator(); |
| ... | ... | @@ -1561,5 +1737,119 @@ |
| 1561 | 1737 | Map<String, String> map = patientWeightService.getComputeKul(50, 70.43, 18, Double.parseDouble(bmi), "2"); |
| 1562 | 1738 | System.out.println(map); |
| 1563 | 1739 | } |
| 1740 | + | |
| 1741 | + @Override | |
| 1742 | + public BaseResponse notify(Integer userId, final List<String> patientIds) { | |
| 1743 | + | |
| 1744 | + new Thread(new Runnable() { | |
| 1745 | + @Override | |
| 1746 | + public void run() { | |
| 1747 | + if (CollectionUtils.isNotEmpty(patientIds)) | |
| 1748 | + { | |
| 1749 | + for (String patientId : patientIds) | |
| 1750 | + { | |
| 1751 | + Patients patient = patientsService.findOnePatientById(patientId); | |
| 1752 | + if (patient != null) | |
| 1753 | + { | |
| 1754 | + SmsConfigModel configModel = new SmsConfigModel(); | |
| 1755 | + // 1 推送服务, 2 推送和短信服务 3短信服务, | |
| 1756 | + int startType = smsConfigFacade.hospitalIsStart(patient.getHospitalId(), configModel, SmsServiceEnums.TZTX.getId()); | |
| 1757 | + | |
| 1758 | + if (startType == 0) { | |
| 1759 | + return; | |
| 1760 | + } | |
| 1761 | + | |
| 1762 | + //短信前缀 | |
| 1763 | + String messagePrefix = smsConfigFacade.getMsgPrefix(configModel, patient.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 1764 | + | |
| 1765 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 1766 | + MsgRequest mr = new MsgRequest(); | |
| 1767 | + String content = "您好,您设置的体重记录时间到了,请尽快打开小程序记录您今天的体重信息吧。"; | |
| 1768 | + | |
| 1769 | + mr.setFirst("【" + messagePrefix + "】" + content); | |
| 1770 | + mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 1771 | + mr.setPhone(patient.getPhone()); | |
| 1772 | + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
| 1773 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 1774 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 1775 | + mr.setSubTypeId(SmsServiceEnums.TZTX.getId()); | |
| 1776 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 1777 | + mr.setHospitalId(patient.getHospitalId()); | |
| 1778 | + mr.setTempId(""); | |
| 1779 | + mr.setPatientId(patient.getId()); | |
| 1780 | + mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 1781 | + mr.setServiceType(1); //判断发送类型 | |
| 1782 | + | |
| 1783 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 1784 | + patientQuery.setHospitalId(patient.getHospitalId()); | |
| 1785 | + patientQuery.setSerType(PatientSerEnums.SerTypeEnums.tz.getId()); | |
| 1786 | + | |
| 1787 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 1788 | + | |
| 1789 | + if (CollectionUtils.isNotEmpty(patientServices) && StringUtils.isNotEmpty(patientServices.get(0).getSerDoct())) { | |
| 1790 | + try { | |
| 1791 | + Users users = usersService.getUsers(Integer.parseInt(patientServices.get(0).getSerDoct())); | |
| 1792 | + if (users != null) { | |
| 1793 | + mr.setKeyword1(users.getName()); | |
| 1794 | + } | |
| 1795 | + } catch (Exception e) { | |
| 1796 | + mr.setKeyword1("产检医生"); | |
| 1797 | + } | |
| 1798 | + } | |
| 1799 | + | |
| 1800 | + mr.setKeyword2(DateUtil.getyyyy_MM_dd(new Date())); | |
| 1801 | + mr.setRemark(""); | |
| 1802 | + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 1803 | + mr.setWxTempId(WxTempleteIdEnums.YI_SHENG_ZHI_DAO.getId()); | |
| 1804 | + System.out.println(mr); | |
| 1805 | + messages.add(mr); | |
| 1806 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 1807 | + smsConfigFacade.saveMsg(messages, patient.getHospitalId()); | |
| 1808 | + } | |
| 1809 | + } | |
| 1810 | + } | |
| 1811 | + } | |
| 1812 | + } | |
| 1813 | + }).start(); | |
| 1814 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 1815 | + } | |
| 1816 | + | |
| 1817 | + @Override | |
| 1818 | + public BaseResponse getSevenNotWeights(String doctorId) { | |
| 1819 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 1820 | + patientQuery.setSerDoct(doctorId); | |
| 1821 | + patientQuery.setSerType(PatientSerEnums.SerTypeEnums.tz.getId()); | |
| 1822 | + List<PatientService> list = patientServiceService.queryPatientService(patientQuery); | |
| 1823 | + List<String> patientIds = new ArrayList<>(); | |
| 1824 | + List<Map> datas = new ArrayList<>(); | |
| 1825 | + if (CollectionUtils.isNotEmpty(list)) | |
| 1826 | + { | |
| 1827 | + for (PatientService ps : list) | |
| 1828 | + { | |
| 1829 | + patientIds.add(ps.getParentid()); | |
| 1830 | + } | |
| 1831 | + } | |
| 1832 | + if (CollectionUtils.isNotEmpty(patientIds)) | |
| 1833 | + { | |
| 1834 | + List<PatientWeight> weights = mongoTemplate.find(Query.query(Criteria.where("patientId").in(patientIds).and("modified").lte(DateUtil.addDay(new Date(),-7))), PatientWeight.class); | |
| 1835 | + if (CollectionUtils.isNotEmpty(weights)) | |
| 1836 | + { | |
| 1837 | + for (PatientWeight weight : weights) | |
| 1838 | + { | |
| 1839 | + Map map = new HashMap(); | |
| 1840 | + Patients patients = patientsService.findOnePatientById(weight.getPatientId()); | |
| 1841 | + map.put("name",patients != null ? patients.getUsername() : ""); | |
| 1842 | + map.put("age",patients != null ? DateUtil.getAge(patients.getBirth(), weight.getModified()): ""); | |
| 1843 | + map.put("week",patients != null ? DateUtil.getWeekDesc(patients.getLastMenses(), weight.getModified()): ""); | |
| 1844 | + map.put("weight",weight.getNowWeight()); | |
| 1845 | + map.put("days",DateUtil.getDays(weight.getModified(),new Date())); | |
| 1846 | + } | |
| 1847 | + } | |
| 1848 | + } | |
| 1849 | + | |
| 1850 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(datas); | |
| 1851 | + } | |
| 1852 | + | |
| 1853 | + | |
| 1564 | 1854 | } |