Commit 474fbfbd5fc965983828986457bbd068510b2cc6
1 parent
359c96b8eb
Exists in
master
and in
6 other branches
update
Showing 3 changed files with 118 additions and 11 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
474fbfb
| ... | ... | @@ -6729,6 +6729,102 @@ |
| 6729 | 6729 | } |
| 6730 | 6730 | } |
| 6731 | 6731 | |
| 6732 | + | |
| 6733 | + public static void saveQhdDist1(String fileName) { | |
| 6734 | + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); | |
| 6735 | + MongoTemplate mongoTemplate | |
| 6736 | + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); | |
| 6737 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
| 6738 | + File file = new File(fileName); | |
| 6739 | + Workbook wb = null; | |
| 6740 | + try { | |
| 6741 | + wb = Workbook.getWorkbook(file); | |
| 6742 | + Sheet s = wb.getSheet(0); | |
| 6743 | + System.out.println(s.getName() + " : "); | |
| 6744 | + int rows = s.getRows(); | |
| 6745 | + if (rows > 0) { | |
| 6746 | + //遍历每行 | |
| 6747 | + for (int i = 1; i < rows; i++) { | |
| 6748 | + System.out.println("rows=" + i); | |
| 6749 | + BabyDietReportModel model = new BabyDietReportModel(); | |
| 6750 | + Cell[] cells = s.getRow(i); | |
| 6751 | + if (cells.length > 0) { | |
| 6752 | + | |
| 6753 | + Integer age = null; | |
| 6754 | + //喂养方式 0 母乳喂养 1.混合喂养 2 人工喂养 | |
| 6755 | + Integer feedingPattern = null; | |
| 6756 | + //体型 0 消瘦 1.正常 2.超重 | |
| 6757 | + Integer shape = null; | |
| 6758 | + List<String> datas = new ArrayList<>(); | |
| 6759 | + | |
| 6760 | + for (int j = 0; j < cells.length; j++) { | |
| 6761 | + String str = cells[j].getContents() == null ? null : cells[j].getContents().trim(); | |
| 6762 | + switch (j) { | |
| 6763 | + case 0: | |
| 6764 | + age = StringUtils.isNotEmpty(str) ? Integer.parseInt(str) : null; | |
| 6765 | + continue; | |
| 6766 | + case 1: | |
| 6767 | + if (StringUtils.isNotEmpty(str)) | |
| 6768 | + { | |
| 6769 | + if ("母乳喂养".equals(str)) | |
| 6770 | + { | |
| 6771 | + feedingPattern = 0; | |
| 6772 | + } | |
| 6773 | + else if ("混合喂养".equals(str)) | |
| 6774 | + { | |
| 6775 | + feedingPattern = 1; | |
| 6776 | + } | |
| 6777 | + else if ("人工喂养".equals(str)) | |
| 6778 | + { | |
| 6779 | + feedingPattern = 2; | |
| 6780 | + } | |
| 6781 | + } | |
| 6782 | + continue; | |
| 6783 | + case 2: | |
| 6784 | + if (StringUtils.isNotEmpty(str)) | |
| 6785 | + { | |
| 6786 | + if ("消瘦".equals(str)) | |
| 6787 | + { | |
| 6788 | + shape = 0; | |
| 6789 | + } | |
| 6790 | + else if ("正常".equals(str)) | |
| 6791 | + { | |
| 6792 | + shape = 1; | |
| 6793 | + } | |
| 6794 | + else if ("超重".equals(str)) | |
| 6795 | + { | |
| 6796 | + shape = 2; | |
| 6797 | + } | |
| 6798 | + } | |
| 6799 | + continue; | |
| 6800 | + case 3: | |
| 6801 | + datas = Arrays.asList(str.split("\n")); | |
| 6802 | + //continue; | |
| 6803 | + } | |
| 6804 | + Query query = new Query(); | |
| 6805 | + query.addCriteria(Criteria.where("monthAge").is(age)); | |
| 6806 | + if (feedingPattern != null) | |
| 6807 | + { | |
| 6808 | + query.addCriteria(Criteria.where("feedingPattern").is(feedingPattern)); | |
| 6809 | + } | |
| 6810 | + query.addCriteria(Criteria.where("shape").is(shape)); | |
| 6811 | + | |
| 6812 | + BabyDietReportModel models = mongoTemplate.findOne(query, BabyDietReportModel.class); | |
| 6813 | + models.setQdhFeedingGuide(datas); | |
| 6814 | + | |
| 6815 | + Query query1 = Query.query(Criteria.where("id").is(models.getId())); | |
| 6816 | + Update update = MongoConvertHelper | |
| 6817 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(models)); | |
| 6818 | + mongoTemplate.updateFirst(query1, update, BabyDietReportModel.class); | |
| 6819 | + } | |
| 6820 | + } | |
| 6821 | + } | |
| 6822 | + } | |
| 6823 | + } catch (Exception e) { | |
| 6824 | + e.printStackTrace(); | |
| 6825 | + } | |
| 6826 | + } | |
| 6827 | + | |
| 6732 | 6828 | public static void main(String[] args) { |
| 6733 | 6829 | // getData(); |
| 6734 | 6830 | //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); |
| ... | ... | @@ -6778,7 +6874,8 @@ |
| 6778 | 6874 | //saveMicroelements("E:\\dev\\微量元素指导报告模板.xls"); |
| 6779 | 6875 | //saveBabyMicroelements("F:\\技术文档\\儿童微量元素\\儿童微量元素指导报告模板.xls"); |
| 6780 | 6876 | //saveBabyBone("F:\\技术文档\\骨密度\\儿童骨密度报告模板内容表.xls"); |
| 6781 | - saveQhdDist("F:\\儿童营养报告\\秦皇岛市妇幼新版选择儿童膳食报告\\秦皇岛市妇幼儿童膳食报告one.xls"); | |
| 6877 | +// saveQhdDist("F:\\儿童营养报告\\秦皇岛市妇幼新版选择儿童膳食报告\\秦皇岛市妇幼儿童膳食报告one.xls"); | |
| 6878 | + saveQhdDist1("F:\\儿童营养报告\\秦皇岛市妇幼新版选择儿童膳食报告\\秦皇岛市妇幼儿童膳食报告0-11.xls"); | |
| 6782 | 6879 | } |
| 6783 | 6880 | |
| 6784 | 6881 |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyDietReportModel.java
View file @
474fbfb
| ... | ... | @@ -29,6 +29,8 @@ |
| 29 | 29 | private Integer shape; |
| 30 | 30 | //喂养指南 |
| 31 | 31 | private List<String> feedingGuide; |
| 32 | + //秦皇岛0-11月龄喂养指南定制 | |
| 33 | + private List<String> qdhFeedingGuide; | |
| 32 | 34 | |
| 33 | 35 | private Integer startMonthAge; |
| 34 | 36 | |
| ... | ... | @@ -59,6 +61,14 @@ |
| 59 | 61 | private List<String> lunchAdd;//下午加餐 |
| 60 | 62 | private List<String> dinner;//晚餐 |
| 61 | 63 | private List<String> dinnerAdd;//晚加餐 |
| 64 | + | |
| 65 | + public List<String> getQdhFeedingGuide() { | |
| 66 | + return qdhFeedingGuide; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setQdhFeedingGuide(List<String> qdhFeedingGuide) { | |
| 70 | + this.qdhFeedingGuide = qdhFeedingGuide; | |
| 71 | + } | |
| 62 | 72 | |
| 63 | 73 | public List<String> getBreakfast() { |
| 64 | 74 | return breakfast; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java
View file @
474fbfb
| ... | ... | @@ -1854,11 +1854,11 @@ |
| 1854 | 1854 | for (BabyDietReportModel babyDiet : babyDietReport) { |
| 1855 | 1855 | if (null != babyDiet.getShape()) { |
| 1856 | 1856 | if (kaupEvaluate.equals("正常") && babyDiet.getShape() == 1) { |
| 1857 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1857 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1858 | 1858 | } else if (kaupEvaluate.equals("消瘦") && babyDiet.getShape() == 0) { |
| 1859 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1859 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1860 | 1860 | } else if (kaupEvaluate.equals("超重") && babyDiet.getShape() == 2) { |
| 1861 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1861 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1862 | 1862 | } |
| 1863 | 1863 | } |
| 1864 | 1864 | } |
| 1865 | 1865 | |
| ... | ... | @@ -1869,14 +1869,14 @@ |
| 1869 | 1869 | if (null != babyDiet.getShape() && month == 6 && babyDiet.getShape() == 1) { |
| 1870 | 1870 | if (StringUtils.isNotEmpty(model.getFeedType())) { |
| 1871 | 1871 | if (Integer.valueOf(model.getFeedType()) == month) { |
| 1872 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1872 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1873 | 1873 | } |
| 1874 | 1874 | } else { |
| 1875 | 1875 | //直接返回空 |
| 1876 | 1876 | data.put("feedingGuide", ""); |
| 1877 | 1877 | } |
| 1878 | 1878 | } else if (null != babyDiet.getShape() && babyDiet.getShape() == 1) { |
| 1879 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1879 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1880 | 1880 | } |
| 1881 | 1881 | if (null != babyDiet.getWeightType() && babyDiet.getWeightType() == 0) { |
| 1882 | 1882 | //膳食结构 |
| 1883 | 1883 | |
| ... | ... | @@ -1917,15 +1917,15 @@ |
| 1917 | 1917 | if (month == 6) { |
| 1918 | 1918 | if (StringUtils.isNotEmpty(model.getFeedType())) { |
| 1919 | 1919 | if (babyDiet.getFeedingPattern() == Integer.valueOf(model.getFeedType())) { |
| 1920 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1920 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1921 | 1921 | } |
| 1922 | 1922 | } |
| 1923 | 1923 | } else { |
| 1924 | 1924 | if (null != babyDiet.getShape()) { |
| 1925 | - if (CollectionUtils.isNotEmpty(babyDiet.getFeedingGuide()) && kaupEvaluate.equals("消瘦") && babyDiet.getShape() == 0) { | |
| 1926 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1927 | - } else if (CollectionUtils.isNotEmpty(babyDiet.getFeedingGuide()) && kaupEvaluate.equals("超重") && babyDiet.getShape() == 2) { | |
| 1928 | - data.put("feedingGuide", babyDiet.getFeedingGuide()); | |
| 1925 | + if (CollectionUtils.isNotEmpty(babyDiet.getQdhFeedingGuide()) && kaupEvaluate.equals("消瘦") && babyDiet.getShape() == 0) { | |
| 1926 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1927 | + } else if (CollectionUtils.isNotEmpty(babyDiet.getQdhFeedingGuide()) && kaupEvaluate.equals("超重") && babyDiet.getShape() == 2) { | |
| 1928 | + data.put("feedingGuide", babyDiet.getQdhFeedingGuide()); | |
| 1929 | 1929 | } |
| 1930 | 1930 | } |
| 1931 | 1931 |