diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java index 4622643..ac8fad1 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java @@ -4221,7 +4221,7 @@ public class BasicConfigServiceTest { for (int i = 1; i < rows; i++) { System.out.println("rows=" + i); QhdWeightConfigModel qhd = new QhdWeightConfigModel(); - + qhd.setIsHighRisk("0"); Cell[] cells = s.getRow(i); if (cells.length > 0) { //遍历每行中的每列 @@ -4263,7 +4263,7 @@ public class BasicConfigServiceTest { for (int i = 1; i < rows1; i++) { System.out.println("rows=" + i); QhdWeightConfigModel qhd = new QhdWeightConfigModel(); - + qhd.setIsHighRisk("0"); Cell[] cells = s1.getRow(i); if (cells.length > 0) { //遍历每行中的每列 @@ -5028,7 +5028,6 @@ public class BasicConfigServiceTest { } - public static void baby35Report(String fileName) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); MongoTemplate mongoTemplate @@ -5075,7 +5074,6 @@ public class BasicConfigServiceTest { } - Sheet s1 = wb.getSheet(1); System.out.println(s1.getName() + " : "); int rows1 = s1.getRows(); @@ -5156,7 +5154,6 @@ public class BasicConfigServiceTest { } - Sheet s3 = wb.getSheet(3); System.out.println(s3.getName() + " : "); int rows3 = s3.getRows(); @@ -5361,6 +5358,55 @@ public class BasicConfigServiceTest { } } + /*** + * + *微信食谱摄入 + * + */ + public static void dietaryIntake(String fileName) { + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); + MongoTemplate mongoTemplate + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); + File file = new File(fileName); + Workbook wb = null; + try { + wb = Workbook.getWorkbook(file); + + Sheet s = wb.getSheet(0); + System.out.println(s.getName() + " : "); + int rows = s.getRows(); + if (rows > 0) { + //遍历每行 + for (int i = 1; i < rows; i++) { + System.out.println("rows=" + i); + WeightConfigModel weightConfigModel = new WeightConfigModel(); + weightConfigModel.setType("0"); + weightConfigModel.setDietaryType(0); + Cell[] cells = s.getRow(i); + if (cells.length > 0) { + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + weightConfigModel.setKcal(Double.valueOf(str)); + continue; + case 1: + List list2 = Arrays.asList(str.split("\n")); + weightConfigModel.setDietaryIntake(list2); + continue; + + } + } + } + mongoTemplate.save(weightConfigModel); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + public static void main(String[] args) { //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); @@ -5381,9 +5427,11 @@ public class BasicConfigServiceTest { //saveCdgwOrg("F:\\承德工位\\qhdorg.xls"); //babyReport("G:\\儿童膳食报告.xls"); // saveQhdbabyDiaginose("F:\\承德工位\\秦皇岛儿童诊断 - 副本.xls"); + // saveQhdWeight("F:\\text.xls"); + + dietaryIntake("F:\\膳食摄入量推荐.xls"); + - //saveQhdWeight("F:\\text.xls"); - // //saveQhdbabyDiaginose("F:\\承德工位\\秦皇岛儿童诊断 - 副本.xls"); @@ -5391,9 +5439,9 @@ public class BasicConfigServiceTest { //saveEvaluationCriterionModel2("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童智能等级.xls"); // saveEvaluationCriterionModel3("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童神经心理发育情况.xls"); //saveQhdWeight("F:\\text.xls"); -// saveQhdGaoWeiWeight("F:\\秦皇岛高危版体重报告.xls"); + // saveQhdGaoWeiWeight("F:\\秦皇岛高危版体重报告.xls"); // saveQhdWeight("F:\\text.xls"); - baby35Report("C:\\Users\\Administrator\\Desktop\\doc\\秦皇岛3-5月龄膳食报告\\3-5月龄儿童膳食报告内容.xls"); + // baby35Report("C:\\Users\\Administrator\\Desktop\\doc\\秦皇岛3-5月龄膳食报告\\3-5月龄儿童膳食报告内容.xls"); } } diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/WeightConfigModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/WeightConfigModel.java index 41bfa52..4a68ccb 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/WeightConfigModel.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/WeightConfigModel.java @@ -29,11 +29,32 @@ public class WeightConfigModel { //菜谱 private List cookbooks; - private String northSouth;//南北 + private String northSouth;//南北 private List earlySuggests;//早期建议 private List middleSuggests;//中期建议 private List laterSuggests;//晚期建议 + //20190729 修改膳食摄入量 + private List dietaryIntake; + + private Integer dietaryType; + + + public Integer getDietaryType() { + return dietaryType; + } + + public void setDietaryType(Integer dietaryType) { + this.dietaryType = dietaryType; + } + + public List getDietaryIntake() { + return dietaryIntake; + } + + public void setDietaryIntake(List dietaryIntake) { + this.dietaryIntake = dietaryIntake; + } public String getId() { return id; @@ -76,7 +97,6 @@ public class WeightConfigModel { } - public String getWeekContent() { return weekContent; } @@ -191,12 +211,13 @@ public class WeightConfigModel { '}'; } - public static class Cookbook implements Serializable { + public static class Cookbook implements Serializable { private String vegetable;//菜名称 - private String foodMaterial; //食材 + private String foodMaterial; //食材 private List makeMethod;//制作方法 private Double kcal; //整值卡路里 - private String northSouth;//南北 + private String northSouth;//南北 + public String getNorthSouth() { return northSouth; } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java index 5ad6ea3..e56dc15 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java @@ -179,6 +179,17 @@ public class PatientWeightController extends BaseController { return patientWeightService.patientRecipeInfo(pid, 2, time); } + /*** + * 生活方式建议 + * + * **/ + @ResponseBody + @RequestMapping(value = "/lifeStyle/info", method = RequestMethod.GET) + public BaseResponse lifeStyle() { + return patientWeightService.lifeStyle(); + } + + /** * 膳食摄入量推荐 * @@ -281,8 +292,8 @@ public class PatientWeightController extends BaseController { @RequestMapping(value = "/qhdReport/{pid}", method = RequestMethod.GET) @TokenRequired public BaseResponse qhdReport(@PathVariable String pid, - HttpServletRequest request, - @RequestParam(value = "rid", required = false) String rid, String version) { + HttpServletRequest request, + @RequestParam(value = "rid", required = false) String rid, String version) { if (pid.isEmpty() || "null".equals(pid)) { return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.USER_PASSWORD_ERROR).setErrormsg("pid值不能为空!"); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java index 989837e..29833cd 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java @@ -23,6 +23,8 @@ public interface PatientWeightService extends IBaseService { BaseResponse patientRecipeInfo(String pid, Integer type, String time); + BaseResponse lifeStyle(); + BaseResponse addOrUpdate(Integer userId, PatientWeight patientWeight, String doctorId); BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/DefaultComputeKulServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/DefaultComputeKulServiceImpl.java index 6a984a5..3bdc280 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/DefaultComputeKulServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/DefaultComputeKulServiceImpl.java @@ -112,7 +112,6 @@ public class DefaultComputeKulServiceImpl implements IComputeKul { bw = new BigDecimal(Double.toString(beforeWeight)); } else if ("1".equals(version)) { bw = new BigDecimal(Integer.parseInt(beforeHeight) - 105); - System.out.println("==========>标准体重" + bw); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index f0d890d..4f3af42 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -530,8 +530,13 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if (week > 5 && week < 41) { double bmi = Double.parseDouble(patientWeight.getBmi()); Map kmap = getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), - Double.parseDouble(nowWeight), week, bmi, patientWeight.getBregmatic()); + Double.parseDouble(nowWeight), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight()); + if (3 == type) { + kmap.put("type", "3"); + } else { + kmap.put("type", null); + } if (1 == type) { setGuide(week, map, patientWeight.getHospitalId()); // 设置指南 } else { @@ -553,6 +558,26 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); } + @Override + public BaseResponse lifeStyle() { + Map map = new HashMap(); + List list = new ArrayList<>(); + list.add("食物多样化"); + list.add("平衡膳食模式是最大程度上保障人体营养需要和健康基础,每天膳食应包括谷薯类、蔬菜水果类、畜禽鱼蛋奶类、大豆类、坚果类,以保证糖类、蛋白质、脂肪、维生素、矿物质、水、膳食纤维的摄入,谷类为主,每日摄入多种类食物,不可挑食,规律饮食,多选择新鲜时令的当地的食物进行摄入。"); + list.add("食物的选择"); + list.add("牛奶、酸奶、奶酪、排骨、鱼虾类含钙及优质蛋白丰富可作为日常选择;咸菜、烟熏肉类含钠较多且不为新鲜食物,应减少食用;常选择粗粮杂豆类含膳食纤维丰富的食物可促进胃肠道运动,减少有害物质吸收;新鲜蔬菜水果含维生素及生物活性物质较多,应选择新鲜的蔬果食用。可选择脂肪酸比例较好含不饱和脂肪酸或多不饱和脂肪酸较多的橄榄油、亚麻籽油、葵花籽油等植物油,坚果虽然含不饱和脂肪酸丰富但要适量食用,减少食用动物肥肉。"); + list.add("饮食习惯"); + list.add("每日进餐次数可由孕前的3次增加至5-6次,每日可在3次正餐中间加2-3次的加餐,每餐时间间隔约2小时左右,每餐8-9分饱即可。宜选择天然食物作为加餐,并加餐在总的能量范围内,合理饮食应避免增重过快或消瘦的情况发生。每日食盐的摄入量5-6g,咸味调料如酱油味精等可减少放入,减少口味过重身体钠含量过多诱发水肿的风险。饮食不可过于油腻。如有过敏者需避免致敏食物或潜在致敏食物。"); + list.add("远离烟、酒、咖啡因、高能量食物,低营养素的食物"); + list.add("孕期绝对禁止抽烟、饮酒、咖啡浓茶、碳酸饮料的摄入,远离二手烟或烟污染严重的环境。学会阅读营养标签,营养成分表中高能量高脂肪和高钠的食物应限制其摄入量。保证每日2300ml左右水的摄入。"); + list.add("保证食物的清洁卫生"); + list.add("食物生熟要分开制作,肉类选择时可观察肌肉部分是否有光泽、红色均匀、脂肪白色(牛羊肉为淡黄色),外表微干或微湿润、不粘手,指压肌肉过后的凹陷立即恢复,具有畜禽应有的正常气味。新鲜的鸡蛋壳上有粉状物,手感发涩,不新鲜的鸡蛋蛋壳上有小孔,蛋黄分散,味臭。新鲜的鱼类有光泽鳞片完整眼球饱满,角膜透亮肌肉坚实有弹性,不新鲜的鱼类体表颜色泛红,眼球凹陷,肌肉松弛,有异味。奶类不新鲜有沉淀或粘稠不流动,有异味。"); + list.add("规律的生活,适当的运动"); + list.add("养成规律的睡眠习惯,早睡——11点以前入睡,避免熬夜;早起——7:30-8:00间起床吃早餐。每天根据自己的情况保证30-40分钟的中等强度运动"); + map.put("lifeStyle", list); + return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); + } + public BaseResponse patientBaseInfo(String pid) { PatientWeight patientWeight = queryPatientWeight(pid); @@ -1102,13 +1127,14 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient private void setSuggest(Map map, WeightConfigModel configModel, int week) { List suggests = null; - if (week < 12) { + /* if (week < 12) { suggests = configModel.getEarlySuggests(); } else if (week <= 28) { suggests = configModel.getMiddleSuggests(); } else { suggests = configModel.getLaterSuggests(); - } + }*/ + suggests = configModel.getDietaryIntake(); map.put("suggest", suggests); } @@ -1630,8 +1656,12 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } else if (k1 > 3300) { k1 = 3300; } - Criteria criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(k1); - + Criteria criteria = null; + if ("3".equals((String) map.get("type"))) { + criteria = Criteria.where("kcal").is(k1).and("dietaryType").is(0); + } else { + criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(k1); + } //如果传了高危因素id就按高危去查 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(risk)) { criteria = criteria.and("riskId").in(risk).and("type").is("1"); @@ -1661,7 +1691,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient * @return */ - public Map getComputeKul(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic) { + public Map getComputeKul(double beforeWeight, double currentWeight, int week, double bmi, String bregmatic, String height) { Map map = new HashMap<>(); double kulStart = 0; @@ -1736,7 +1766,13 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient BigDecimal b1 = new BigDecimal(Double.toString(addWeightStart)); BigDecimal b2 = new BigDecimal(Double.toString(addWeightEnd)); - BigDecimal bw = new BigDecimal(Double.toString(beforeWeight)); + BigDecimal bw = null; + if (bmi >= 25) { + bw = new BigDecimal(Double.toString(Integer.valueOf(height) - 105)); + } else { + bw = new BigDecimal(Double.toString(beforeWeight)); + } + double kstart = (bw.add(b1)).multiply(new BigDecimal(25)).doubleValue() + basekul; double kend = (bw.add(b2)).multiply(new BigDecimal(25)).doubleValue() + basekul;