Commit a3e7c7fc6dcac167277bbaf63908ceb73deb33e5
1 parent
4163205c1a
Exists in
master
and in
6 other branches
血糖报告
Showing 6 changed files with 175 additions and 7 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodSugarController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodSugarService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TnbComputeKulServiceImpl.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodSugarController.java
View file @
a3e7c7f
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.annotation.TokenRequired; |
| 4 | 4 | import com.lyms.platform.common.base.BaseController; |
| 5 | +import com.lyms.platform.common.base.LoginContext; | |
| 5 | 6 | import com.lyms.platform.common.result.BaseResponse; |
| 6 | 7 | import com.lyms.platform.operate.web.service.IBloodSugarService; |
| 7 | 8 | import com.lyms.platform.pojo.BloodSugar; |
| ... | ... | @@ -78,7 +79,7 @@ |
| 78 | 79 | @ResponseBody |
| 79 | 80 | @RequestMapping(value = "/wx/{id}", method = RequestMethod.GET) |
| 80 | 81 | public BaseResponse setWeightInfo(@PathVariable String id, String beforeWeight, String currentWeight) { |
| 81 | - return bloodSugarService.addWeightInfo(id,beforeWeight,currentWeight); | |
| 82 | + return bloodSugarService.addWeightInfo(id, beforeWeight, currentWeight); | |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | 85 | |
| ... | ... | @@ -109,6 +110,21 @@ |
| 109 | 110 | @RequestMapping(value = "/app/{parentId}", method = RequestMethod.GET) |
| 110 | 111 | public BaseResponse getAppInfo(@PathVariable String parentId) { |
| 111 | 112 | return bloodSugarService.getAppInfo(parentId); |
| 113 | + } | |
| 114 | + | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * 院内系统血糖报告 | |
| 118 | + * @param patientId | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + @ResponseBody | |
| 122 | + @RequestMapping(value = "/getBloodSugarReport/{patientId}", method = RequestMethod.GET) | |
| 123 | + @TokenRequired | |
| 124 | + public BaseResponse getSysBloodSugarReport(@PathVariable String patientId | |
| 125 | + ,HttpServletRequest httpServletRequest) { | |
| 126 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
| 127 | + return bloodSugarService.getSysBloodSugarReport(patientId,loginState.getId()); | |
| 112 | 128 | } |
| 113 | 129 | |
| 114 | 130 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodSugarService.java
View file @
a3e7c7f
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
View file @
a3e7c7f
| ... | ... | @@ -2,7 +2,10 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.result.BaseResponse; |
| 4 | 4 | import com.lyms.platform.pojo.PatientWeight; |
| 5 | +import com.lyms.platform.pojo.WeightConfigModel; | |
| 5 | 6 | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by lt on 2017/9/6 0006 |
| 8 | 11 | */ |
| ... | ... | @@ -34,5 +37,8 @@ |
| 34 | 37 | String getBmi(String weight, String height); |
| 35 | 38 | BaseResponse patientBaseInfo(String pid); |
| 36 | 39 | BaseResponse update(Integer userId, String id, String beforeWeight, String beforeHeight, String date, String nowWeight, String bregmatic, String bregmaticOther, boolean sync); |
| 40 | + | |
| 41 | + WeightConfigModel getWeightConfigByWeek(int week); | |
| 42 | + WeightConfigModel getWeightConfigBykcal(Map<String, String> map, String northSouth, String risk); | |
| 37 | 43 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
a3e7c7f
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 16 | 16 | import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; |
| 17 | 17 | import com.lyms.platform.operate.web.service.IBloodSugarService; |
| 18 | +import com.lyms.platform.operate.web.service.PatientWeightService; | |
| 18 | 19 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 19 | 20 | import com.lyms.platform.operate.web.utils.MathUtil; |
| 20 | 21 | import com.lyms.platform.operate.web.utils.MongoUtil; |
| 21 | 22 | |
| 22 | 23 | |
| ... | ... | @@ -66,9 +67,17 @@ |
| 66 | 67 | private CommonService commonService; |
| 67 | 68 | |
| 68 | 69 | @Autowired |
| 70 | + private PatientsService patientsService; | |
| 71 | + | |
| 72 | + @Autowired | |
| 69 | 73 | private AntenatalExaminationService antenatalExaminationService; |
| 70 | 74 | |
| 75 | + @Autowired | |
| 76 | + private ComputeKulServiceManager computeKulServiceManager; | |
| 71 | 77 | |
| 78 | + @Autowired | |
| 79 | + private PatientWeightService patientWeightService; | |
| 80 | + | |
| 72 | 81 | public BaseResponse add(Integer userId, BloodSugar bloodSugar) { |
| 73 | 82 | // BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(bloodSugar.getParentId()).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class); |
| 74 | 83 | BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(mongoUtil.getPid(bloodSugar.getParentId())).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class); |
| ... | ... | @@ -459,7 +468,7 @@ |
| 459 | 468 | hrisks.add("5aab6d3e422b03d4ad2bf83f"); |
| 460 | 469 | hrisks.add("de7468e6-1bb5-4fab-ae84-78857868409a"); |
| 461 | 470 | antExRecordQuery.setrFactorList(hrisks); |
| 462 | - List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.ASC,"created"); | |
| 471 | + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.ASC, "created"); | |
| 463 | 472 | if (org.apache.commons.collections.CollectionUtils.isNotEmpty(antExRecordModelList)) |
| 464 | 473 | { |
| 465 | 474 | for (AntExRecordModel model : antExRecordModelList) |
| ... | ... | @@ -870,7 +879,7 @@ |
| 870 | 879 | kulEnd = kend; |
| 871 | 880 | } |
| 872 | 881 | |
| 873 | - map.put("kulStart",String.valueOf(kulStart)); | |
| 882 | + map.put("kulStart", String.valueOf(kulStart)); | |
| 874 | 883 | map.put("kulEnd", String.valueOf(kulEnd)); |
| 875 | 884 | return map; |
| 876 | 885 | } |
| ... | ... | @@ -924,5 +933,137 @@ |
| 924 | 933 | resp.setErrormsg(ResponseCode.SUCCESS.getMsg()); |
| 925 | 934 | return resp; |
| 926 | 935 | } |
| 936 | + | |
| 937 | + @Override | |
| 938 | + public BaseResponse getSysBloodSugarReport(String patientId, Integer userId) { | |
| 939 | + | |
| 940 | + BaseObjectResponse resp = new BaseObjectResponse(); | |
| 941 | + | |
| 942 | + Patients patients = patientsService.findOnePatientById(patientId); | |
| 943 | + | |
| 944 | + List<String> risks = patients.getRiskFactorId(); //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗) | |
| 945 | + if (!(CollectionUtils.isNotEmpty(risks) && (risks.contains("5aab6d3d422b03d4ad2bf83e") || risks.contains("5aab6d3e422b03d4ad2bf83f") | |
| 946 | + //需药物治疗的糖尿病 | |
| 947 | + || risks.contains("de7468e6-1bb5-4fab-ae84-78857868409a")))) | |
| 948 | + { | |
| 949 | + resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); | |
| 950 | + resp.setErrormsg("孕妇没有糖尿病不能出报告"); | |
| 951 | + return resp; | |
| 952 | + } | |
| 953 | + | |
| 954 | + | |
| 955 | + PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId)), PatientWeight.class); | |
| 956 | + Map<String, String> dayWeights = patientWeight.getDayWeights(); | |
| 957 | + | |
| 958 | + //当天没有体重测量 | |
| 959 | + if (!(dayWeights != null && dayWeights.size() > 0 && StringUtils.isNotEmpty(dayWeights.get(DateUtil.getyyyy_MM_dd(new Date()))))) | |
| 960 | + { | |
| 961 | + resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); | |
| 962 | + resp.setErrormsg("当天没有测量体重,不能出报告"); | |
| 963 | + return resp; | |
| 964 | + } | |
| 965 | + | |
| 966 | + String rid = ""; | |
| 967 | + | |
| 968 | + int week = DateUtil.getWeek(patients.getLastMenses(), new Date()); | |
| 969 | + | |
| 970 | + if (week < 6) | |
| 971 | + { | |
| 972 | + resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); | |
| 973 | + resp.setErrormsg("小于6孕周,不能出报告"); | |
| 974 | + return resp; | |
| 975 | + } | |
| 976 | + Map data = new HashMap(); | |
| 977 | + | |
| 978 | + //妊娠期糖尿病(无需药物治疗) //糖尿病合并妊娠(无需药物治疗) | |
| 979 | + if (risks.contains("5aab6d3d422b03d4ad2bf83e") && (risks.contains("5aab6d3e422b03d4ad2bf83f") | |
| 980 | + //需药物治疗的糖尿病 | |
| 981 | + || risks.contains("de7468e6-1bb5-4fab-ae84-78857868409a"))) | |
| 982 | + { | |
| 983 | + rid = week < 24 ? "5aab6d3e422b03d4ad2bf83f": "5aab6d3d422b03d4ad2bf83e"; | |
| 984 | + } //糖尿病合并妊娠(无需药物治疗) //需药物治疗的糖尿病 | |
| 985 | + else if (risks.contains("5aab6d3e422b03d4ad2bf83f") || risks.contains("de7468e6-1bb5-4fab-ae84-78857868409a")) | |
| 986 | + { | |
| 987 | + rid = "5aab6d3e422b03d4ad2bf83f"; | |
| 988 | + } | |
| 989 | + else | |
| 990 | + { | |
| 991 | + rid = "5aab6d3d422b03d4ad2bf83e"; | |
| 992 | + } | |
| 993 | + | |
| 994 | + //1:妊娠期糖尿病(无需药物治疗) 2:糖尿病合并妊娠(无需药物治疗)(需药物治疗的糖尿病) | |
| 995 | + data.put("riskType","5aab6d3d422b03d4ad2bf83e".equals(rid) ? "1" : "2"); | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + double bmi = Double.parseDouble(patientWeight.getBmi()); | |
| 1000 | + //根据高危获取不同的卡路里计算公式 | |
| 1001 | + Map<String, String> kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), | |
| 1002 | + Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight()); | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + String weekYyzl = ""; | |
| 1006 | + WeightConfigModel weightConfigModel = patientWeightService.getWeightConfigByWeek(week); | |
| 1007 | + if (weightConfigModel != null) | |
| 1008 | + { | |
| 1009 | + weekYyzl = weightConfigModel.getWeekContent(); | |
| 1010 | + } | |
| 1011 | + data.put("weekYyzl", weekYyzl); | |
| 1012 | + | |
| 1013 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 1014 | + Organization org = organizationService.getOrganization(Integer.parseInt(hospitalId)); | |
| 1015 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(org.getProvinceId()); | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + Map<String, Object> breakfast = new LinkedHashMap<>(); // 早餐 | |
| 1020 | + Map<String, Object> breakfast2 = new LinkedHashMap<>(); // 上午加餐 | |
| 1021 | + Map<String, Object> lunch = new LinkedHashMap<>(); // 午餐 | |
| 1022 | + Map<String, Object> lunch2 = new LinkedHashMap<>(); // 下午加餐 | |
| 1023 | + Map<String, Object> dinner = new LinkedHashMap<>(); // 晚餐 | |
| 1024 | + Map<String, Object> dinner2 = new LinkedHashMap<>(); // 晚加餐 | |
| 1025 | + | |
| 1026 | + String nsArea = ReportConfig.getNSArea(basicConfig.getName()); | |
| 1027 | + WeightConfigModel configModel = patientWeightService.getWeightConfigBykcal(kmap, nsArea, rid); | |
| 1028 | + | |
| 1029 | + if (configModel != null) | |
| 1030 | + { | |
| 1031 | + setData(breakfast, "早餐", configModel.getBreakfast()); | |
| 1032 | + setData(breakfast2, "上午加餐", configModel.getBreakfastAdd()); | |
| 1033 | + setData(lunch, "午餐", configModel.getLunch()); | |
| 1034 | + setData(lunch2, "下午加餐", configModel.getLunchAdd()); | |
| 1035 | + setData(dinner, "晚餐", configModel.getDinner()); | |
| 1036 | + setData(dinner2, "晚加餐", configModel.getDinnerAdd()); | |
| 1037 | + } | |
| 1038 | + | |
| 1039 | + data.put("food", Arrays.asList(breakfast, breakfast2, lunch, lunch2, dinner, dinner2)); | |
| 1040 | + | |
| 1041 | + String weekRange = ""; | |
| 1042 | + if (week < 12) | |
| 1043 | + { | |
| 1044 | + weekRange = "1"; | |
| 1045 | + } | |
| 1046 | + else if (week > 12 && week < 28) | |
| 1047 | + { | |
| 1048 | + weekRange = "2"; | |
| 1049 | + } | |
| 1050 | + else | |
| 1051 | + { | |
| 1052 | + weekRange = "3"; | |
| 1053 | + } | |
| 1054 | + data.put("weekRange",weekRange); | |
| 1055 | + | |
| 1056 | + resp.setData(data); | |
| 1057 | + resp.setErrorcode(ResponseCode.SUCCESS.getCode()); | |
| 1058 | + resp.setErrormsg("成功"); | |
| 1059 | + return resp; | |
| 1060 | + } | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + private void setData(Map<String, Object> map, String key, String value) { | |
| 1064 | + map.put("id", key); | |
| 1065 | + map.put("name", value); | |
| 1066 | + } | |
| 1067 | + | |
| 927 | 1068 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
a3e7c7f
| ... | ... | @@ -1218,7 +1218,8 @@ |
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | - private WeightConfigModel getWeightConfigBykcal(Map<String, String> map, String northSouth, String risk) { | |
| 1221 | + @Override | |
| 1222 | + public WeightConfigModel getWeightConfigBykcal(Map<String, String> map, String northSouth, String risk) { | |
| 1222 | 1223 | if (map.get("kulStart") == null) { |
| 1223 | 1224 | return null; |
| 1224 | 1225 | } |
| ... | ... | @@ -1249,7 +1250,8 @@ |
| 1249 | 1250 | } |
| 1250 | 1251 | |
| 1251 | 1252 | |
| 1252 | - private WeightConfigModel getWeightConfigByWeek(int week) { | |
| 1253 | + @Override | |
| 1254 | + public WeightConfigModel getWeightConfigByWeek(int week) { | |
| 1253 | 1255 | WeightConfigModel weightConfigModel = mongoTemplate.findOne(Query.query(Criteria.where("week").is(String.valueOf(week))), |
| 1254 | 1256 | WeightConfigModel.class); |
| 1255 | 1257 | return weightConfigModel; |
| ... | ... | @@ -1263,7 +1265,8 @@ |
| 1263 | 1265 | * @param beforeWeight 当前体重 |
| 1264 | 1266 | * @return |
| 1265 | 1267 | */ |
| 1266 | - private Map<String, String> getComputeKul(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic) { | |
| 1268 | + | |
| 1269 | + public Map<String, String> getComputeKul(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic) { | |
| 1267 | 1270 | Map<String, String> map = new HashMap<>(); |
| 1268 | 1271 | |
| 1269 | 1272 | double kulStart = 0; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TnbComputeKulServiceImpl.java
View file @
a3e7c7f
| ... | ... | @@ -57,7 +57,7 @@ |
| 57 | 57 | String status = ""; |
| 58 | 58 | |
| 59 | 59 | double add = Double.valueOf(String.format("%.2f", currentWeight - beforeWeight)); |
| 60 | - double height = Double.valueOf(String.format("%.2f", beforeHeight)); | |
| 60 | + double height = Double.valueOf(String.format("%.2f", Double.parseDouble(beforeHeight)/100)); | |
| 61 | 61 | |
| 62 | 62 | //孕早期 |
| 63 | 63 | if (week <= 12) { |