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 15da916..67f7716 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 @@ -4172,6 +4172,141 @@ public class BasicConfigServiceTest { } + /** + * 秦皇岛儿童膳食报告 + */ + public static void babyReport(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); + BabyDietReportModel babyDiet = new BabyDietReportModel(); + //6-11月膳食结构正常消瘦超重类型 0 正常 1超重消瘦 + babyDiet.setWeightType(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: + babyDiet.setMonthAge(Integer.parseInt(str)); + continue; + case 1: + List list1 = Arrays.asList(str.split("\n")); + babyDiet.setDietStructure(list1); + continue; + case 2: + List list2 = Arrays.asList(str.split("\n")); + babyDiet.setWeeklyRecipes(list2); + continue; + case 3: + List list3 = Arrays.asList(str.split("\n")); + babyDiet.setRecommendRecipes(list3); + continue; + } + } + } + mongoTemplate.save(babyDiet); + } + + } + + Sheet s1 = wb.getSheet(1); + System.out.println(s.getName() + " : "); + int rows1 = s1.getRows(); + if (rows1 > 0) { + for (int i = 1; i < rows1; i++) { + System.out.println("rows=" + i); + BabyDietReportModel babyDiet = new BabyDietReportModel(); + //6-11月膳食结构正常消瘦超重类型 0 正常 1超重消瘦 + babyDiet.setWeightType(1); + Cell[] cells = s1.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + babyDiet.setMonthAge(Integer.parseInt(str)); + continue; + case 1: + babyDiet.setKcal(str); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + babyDiet.setDietStructure(list1); + continue; + case 3: + List list2 = Arrays.asList(str.split("\n")); + babyDiet.setOneDayRecipes(list2); + continue; + case 4: + List list3 = Arrays.asList(str.split("\n")); + babyDiet.setRecommendRecipes(list3); + continue; + } + } + + } + mongoTemplate.save(babyDiet); + } + } + + Sheet s2 = wb.getSheet(2); + System.out.println(s2.getName() + " : "); + int rows2 = s2.getRows(); + if (rows2 > 0) { + //遍历每行 + for (int i = 1; i < rows2; i++) { + System.out.println("rows=" + i); + BabyDietReportModel babyDiet = new BabyDietReportModel(); + Cell[] cells = s2.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + babyDiet.setMonthAge(Integer.parseInt(str)); + continue; + case 1: + babyDiet.setFeedingPattern(Integer.parseInt(str)); + continue; + case 2: + babyDiet.setShape(Integer.parseInt(str)); + continue; + case 3: + List list2 = Arrays.asList(str.split("\n")); + babyDiet.setFeedingGuide(list2); + continue; + } + } + + } + mongoTemplate.save(babyDiet); + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (BiffException e) { + e.printStackTrace(); + } + + } + public static void main(String[] args) { // weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); @@ -4186,16 +4321,17 @@ public class BasicConfigServiceTest { // babyConfig("F:\\儿童营养报告\\儿童营养报告模板.xls"); -// babyNutritionConfig("F:\\儿童营养报告\\婴幼儿体重与营养管理报告内容及规则\\儿童膳食报告文章2.xls"); + //babyNutritionConfig("F:\\儿童营养报告\\婴幼儿体重与营养管理报告内容及规则\\儿童膳食报告文章2.xls"); //xyPresentation("E:\\血压报告.xls"); //weightReport("E:\\体重营养报告10.xls"); //renGaoZhen("G:\\妊高症风险.xls"); - Test("G:\\text.xls"); + //Test("G:\\text.xls"); // weightReport("E:\\体重营养报告10.xls"); // saveCdgwOrg("F:\\承德工位\\cdorg.xls"); // saveCdgwOrgJwhRe("F:\\承德工位\\承德卫生机构与居委会对应关系表.xls"); - saveCdgwOrg("F:\\承德工位\\qhdorg.xls"); + //saveCdgwOrg("F:\\承德工位\\qhdorg.xls"); + babyReport("G:\\儿童膳食报告.xls"); } } diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/BabyDietReportModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/BabyDietReportModel.java new file mode 100644 index 0000000..fec7a8f --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/BabyDietReportModel.java @@ -0,0 +1,126 @@ +package com.lyms.platform.pojo; + +import com.lyms.platform.common.result.BaseModel; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.List; + +@Document(collection = "lyms_baby_diet_report") +public class BabyDietReportModel extends BaseModel { + private String id; + //月龄 + private Integer monthAge; + + //热量值 + private String kcal; + + //膳食结构 + private List dietStructure; + + //一周参考食谱 + private List weeklyRecipes; + + //推荐食谱 + private List recommendRecipes; + //超重消瘦一日喂养指南 + private List oneDayRecipes; + + //6-11月膳食结构正常消瘦超重类型 0 正常 1超重消瘦 + private Integer weightType; + + //喂养方式 0 母乳喂养 1.混合喂养 2 人工喂养 + private Integer feedingPattern; + //体型 0 消瘦 1.正常 2.超重 + private Integer shape; + //喂养方式 + private List feedingGuide; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getMonthAge() { + return monthAge; + } + + public void setMonthAge(Integer monthAge) { + this.monthAge = monthAge; + } + + public List getRecommendRecipes() { + return recommendRecipes; + } + + public void setRecommendRecipes(List recommendRecipes) { + this.recommendRecipes = recommendRecipes; + } + + public String getKcal() { + return kcal; + } + + public void setKcal(String kcal) { + this.kcal = kcal; + } + + public List getDietStructure() { + return dietStructure; + } + + public void setDietStructure(List dietStructure) { + this.dietStructure = dietStructure; + } + + public List getWeeklyRecipes() { + return weeklyRecipes; + } + + public void setWeeklyRecipes(List weeklyRecipes) { + this.weeklyRecipes = weeklyRecipes; + } + + + public List getOneDayRecipes() { + return oneDayRecipes; + } + + public void setOneDayRecipes(List oneDayRecipes) { + this.oneDayRecipes = oneDayRecipes; + } + + public Integer getWeightType() { + return weightType; + } + + public void setWeightType(Integer weightType) { + this.weightType = weightType; + } + + public Integer getFeedingPattern() { + return feedingPattern; + } + + public void setFeedingPattern(Integer feedingPattern) { + this.feedingPattern = feedingPattern; + } + + public Integer getShape() { + return shape; + } + + public void setShape(Integer shape) { + this.shape = shape; + } + + public List getFeedingGuide() { + return feedingGuide; + } + + public void setFeedingGuide(List feedingGuide) { + this.feedingGuide = feedingGuide; + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java index 52f00ec..91b0504 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyNutritionController.java @@ -16,18 +16,19 @@ import javax.validation.Valid; /** - *儿童营养报告 + * 儿童营养报告 */ @Controller -public class BabyNutritionController extends BaseController{ +public class BabyNutritionController extends BaseController { + - @Autowired private BabyNutritionFacade babyNutritionFacade; /** - * 添加儿童营养 + * 添加儿童营养 + * * @param request * @return */ @@ -37,12 +38,13 @@ public class BabyNutritionController extends BaseController{ public BaseResponse addOrUpBabyNutrition(@Valid @RequestBody BabyNutritionRequest request, HttpServletRequest httpServletRequest) { - return babyNutritionFacade.addOrUpBabyNutrition(request,getUserId(httpServletRequest)); + return babyNutritionFacade.addOrUpBabyNutrition(request, getUserId(httpServletRequest)); } /** * 膳食列表 + * * @param page * @param limit * @param queryNo @@ -54,64 +56,75 @@ public class BabyNutritionController extends BaseController{ @RequestMapping(value = "/queryBabyNutritionList", method = RequestMethod.GET) @ResponseBody @TokenRequired - public BaseResponse queryBabyNutritionList( @RequestParam("page") Integer page, - @RequestParam("limit") Integer limit, - @RequestParam(required = false)String queryNo, - @RequestParam(required = false)String vcCardNo, - @RequestParam(required = false)String babyName, - @RequestParam(required = false)String recordTime, - HttpServletRequest request){ - return babyNutritionFacade.queryBabyNutritionList(page, limit, queryNo, vcCardNo, babyName, getUserId(request), recordTime); + public BaseResponse queryBabyNutritionList(@RequestParam("page") Integer page, + @RequestParam("limit") Integer limit, + @RequestParam(required = false) String queryNo, + @RequestParam(required = false) String vcCardNo, + @RequestParam(required = false) String babyName, + @RequestParam(required = false) String recordTime, + HttpServletRequest request) { + return babyNutritionFacade.queryBabyNutritionList(page, limit, queryNo, vcCardNo, babyName, getUserId(request), recordTime); } /** * 查询营养记录 + * * @param babyId * @return */ @RequestMapping(value = "/queryBabyNutritionRecord/{babyId}", method = RequestMethod.GET) @ResponseBody @TokenRequired - public BaseObjectResponse queryBabyNutritionRecord(@PathVariable("babyId")String babyId){ - return babyNutritionFacade.queryBabyNutritionRecord(babyId); + public BaseObjectResponse queryBabyNutritionRecord(@PathVariable("babyId") String babyId) { + return babyNutritionFacade.queryBabyNutritionRecord(babyId); } /** * 查询单条记录 + * * @param id * @return */ @RequestMapping(value = "/queryBabyNutritionById/{id}", method = RequestMethod.GET) @ResponseBody @TokenRequired - public BaseObjectResponse queryBabyNutritionById(@PathVariable("id")String id){ - return babyNutritionFacade.queryBabyNutritionById(id); + public BaseObjectResponse queryBabyNutritionById(@PathVariable("id") String id) { + return babyNutritionFacade.queryBabyNutritionById(id); } /** * 从ams获取儿童营养食谱 + * * @return */ - @RequestMapping(value = "/queryBabyNutritionFood", method = RequestMethod.GET,produces = "application/json; charset=utf-8") + @RequestMapping(value = "/queryBabyNutritionFood", method = RequestMethod.GET, produces = "application/json; charset=utf-8") @ResponseBody - public BaseObjectResponse queryBabyNutritionFood(){ + public BaseObjectResponse queryBabyNutritionFood() { return babyNutritionFacade.queryBabyNutritionFood(); } /** * 儿童营养报告 + * * @param id * @return */ @RequestMapping(value = "/queryBabyNutritionReport/{id}", method = RequestMethod.GET) @ResponseBody @TokenRequired - public BaseObjectResponse queryBabyNutritionReport(@PathVariable("id")String id,HttpServletRequest request){ - return babyNutritionFacade.queryBabyNutritionReport(id,getUserId(request)); + public BaseObjectResponse queryBabyNutritionReport(@PathVariable("id") String id, HttpServletRequest request) { + return babyNutritionFacade.queryBabyNutritionReport(id, getUserId(request)); } + /** + * 秦皇岛儿童膳食报告模板 + */ + @RequestMapping(value = "/queryBabyDietReport/{id}", method = RequestMethod.GET) + public BaseObjectResponse queryBabyDietReport(@PathVariable("id") String id, HttpServletRequest request) { + return null; + } } \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java index d4b05fb..f832390 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java @@ -940,4 +940,6 @@ public class BabyNutritionFacade { } return kaupEvaluate; } + + } \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanChanResult.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanChanResult.java index 74e2a9b..d51cb86 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanChanResult.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanChanResult.java @@ -457,7 +457,22 @@ public class QuanChanResult implements IBasicResultConvert 7 * 42 - 1) { + dueWeek = "已分娩"; + } else { + String week = (days / 7) + ""; + int day = (days % 7); + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); + } + + } catch (Exception e) { + // 什么都不干 + } + setCreatedWeek(dueWeek); setFileCode(destModel.getFileCode()); if (null != destModel.getFmDate()) { diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanPatientsResult.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanPatientsResult.java index dfe9b0c..39c5f71 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanPatientsResult.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/QuanPatientsResult.java @@ -43,7 +43,7 @@ public class QuanPatientsResult implements IBasicResultConvert 7 * 42 - 1) { + dueWeek = "已分娩"; + } else { + String week = (days / 7) + ""; + int day = (days % 7); + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); + } + + } catch (Exception e) { + // 什么都不干 + } + setCreatedWeek(dueWeek); if (null != destModel.getLastMenses()) { int days = DateUtil.daysBetween(destModel.getLastMenses(), new Date()); this.dueWeek = StringUtils.dueWeek(days); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskPatientsResult.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskPatientsResult.java index 997cd24..b585a70 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskPatientsResult.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskPatientsResult.java @@ -356,7 +356,23 @@ public class RiskPatientsResult implements IBasicResultConvert 7 * 42 - 1) { + dueWeek = "已分娩"; + } else { + String week = (days / 7) + ""; + int day = (days % 7); + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); + } + + } catch (Exception e) { + // 什么都不干 + } + setCreatedWeek(dueWeek); + if (null != destModel.getDueStatus() && 1 == destModel.getDueStatus()) { this.dueWeek = "终止妊娠"; } else if (3 == destModel.getType()) {