Commit 936654b2ede7839f81ccfecdc7d022047ad02970

Authored by liquanyu
1 parent a493fd92ac

update

Showing 6 changed files with 410 additions and 19 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 936654b
... ... @@ -5361,6 +5361,94 @@
5361 5361 }
5362 5362  
5363 5363 /**
  5364 + * 秦皇岛定制儿童膳食12-35正常膳食.xlsx
  5365 + */
  5366 + public static void baby12to35ReportNomal(String fileName) {
  5367 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  5368 + MongoTemplate mongoTemplate
  5369 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  5370 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  5371 + File file = new File(fileName);
  5372 + Workbook wb = null;
  5373 + try {
  5374 + wb = Workbook.getWorkbook(file);
  5375 +
  5376 + Sheet s = wb.getSheet(0);
  5377 + System.out.println(s.getName() + " : ");
  5378 + int rows = s.getRows();
  5379 + if (rows > 0) {
  5380 + //遍历每行
  5381 + for (int i = 1; i < rows; i++) {
  5382 + System.out.println("rows=" + i);
  5383 + BabyDietReportModel babyDiet = new BabyDietReportModel();
  5384 + Cell[] cells = s.getRow(i);
  5385 + if (cells.length > 0) {
  5386 + //遍历每行中的每列
  5387 + for (int j = 0; j < cells.length; j++) {
  5388 + String str = cells[j].getContents().trim();
  5389 + switch (j) {
  5390 + case 0:
  5391 + babyDiet.setShape(Integer.parseInt(str));
  5392 +
  5393 + continue;
  5394 + case 1:
  5395 + babyDiet.setStartMonthAge(Integer.parseInt(str));
  5396 + continue;
  5397 + case 2:
  5398 + babyDiet.setEndMonthAge(Integer.parseInt(str));
  5399 + continue;
  5400 + case 3:
  5401 + List<String> list1 = Arrays.asList(str.split("\n"));
  5402 + babyDiet.setDietStructure(list1);
  5403 + continue;
  5404 + case 4:
  5405 + List<String> list2 = Arrays.asList(str.split("\n"));
  5406 + babyDiet.setRecommendRecipes(list2);
  5407 + continue;
  5408 + case 5:
  5409 + List<String> list3 = Arrays.asList(str.split("\n"));
  5410 + babyDiet.setMonday(list3);
  5411 + continue;
  5412 + case 6:
  5413 + List<String> list4 = Arrays.asList(str.split("\n"));
  5414 + babyDiet.setTuesday(list4);
  5415 + continue;
  5416 + case 7:
  5417 + List<String> list5 = Arrays.asList(str.split("\n"));
  5418 + babyDiet.setWednesday(list5);
  5419 + continue;
  5420 + case 8:
  5421 + List<String> list6 = Arrays.asList(str.split("\n"));
  5422 + babyDiet.setThursday(list6);
  5423 + continue;
  5424 + case 9:
  5425 + List<String> list7 = Arrays.asList(str.split("\n"));
  5426 + babyDiet.setFriday(list7);
  5427 + continue;
  5428 + case 10:
  5429 + List<String> list8 = Arrays.asList(str.split("\n"));
  5430 + babyDiet.setSaturday(list8);
  5431 + continue;
  5432 + case 11:
  5433 + List<String> list9 = Arrays.asList(str.split("\n"));
  5434 + babyDiet.setSunday(list9);
  5435 + continue;
  5436 + }
  5437 + }
  5438 +
  5439 + }
  5440 + System.out.println(babyDiet);
  5441 + mongoTemplate.save(babyDiet);
  5442 + }
  5443 + }
  5444 + }catch (Exception e)
  5445 + {
  5446 + e.printStackTrace();
  5447 + }
  5448 +
  5449 + }
  5450 +
  5451 + /**
5364 5452 * 秦皇岛儿童膳食报告
5365 5453 */
5366 5454 public static void babyReport(String fileName) {
5367 5455  
5368 5456  
... ... @@ -6214,8 +6302,153 @@
6214 6302 }
6215 6303 }
6216 6304  
  6305 + public static void getData()
  6306 + {
  6307 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  6308 + MongoTemplate mongoTemplate
  6309 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  6310 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  6311 + try
  6312 + {
  6313 + List<BabyDietReportModel> babyDietReportList1 = mongoTemplate.find(Query.query(Criteria.where("_id").exists(true)),
  6314 + BabyDietReportModel.class);
  6315 + for (BabyDietReportModel baby : babyDietReportList1)
  6316 + {
6217 6317  
  6318 +
  6319 +
  6320 + for (String str : baby.getDietStructure())
  6321 + {
  6322 + System.out.println(str);
  6323 + }
  6324 +
  6325 + for (String str : baby.getRecommendRecipes())
  6326 + {
  6327 + System.out.println(str);
  6328 + }
  6329 +
  6330 + for (String str : baby.getOneDayRecipes())
  6331 + {
  6332 + System.out.println(str);
  6333 + }
  6334 +
  6335 + }
  6336 + }catch (Exception e)
  6337 + {
  6338 +
  6339 + }
  6340 + }
  6341 +
  6342 +
  6343 +
  6344 + /**
  6345 + * 每类食物不爱吃的指导建议
  6346 + *
  6347 + * @param fileName
  6348 + */
  6349 + public static void saveDiteSuggest(String fileName) {
  6350 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  6351 + MongoTemplate mongoTemplate
  6352 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  6353 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  6354 + File file = new File(fileName);
  6355 + Workbook wb = null;
  6356 + try {
  6357 + wb = Workbook.getWorkbook(file);
  6358 +
  6359 + Sheet s = wb.getSheet(0);
  6360 + System.out.println(s.getName() + " : ");
  6361 + int rows = s.getRows();
  6362 + if (rows > 0) {
  6363 + //遍历每行
  6364 + for (int i = 1; i < rows; i++) {
  6365 + System.out.println("rows=" + i);
  6366 + BabyDietSuggestModel diet = new BabyDietSuggestModel();
  6367 + diet.setType(2);
  6368 + Cell[] cells = s.getRow(i);
  6369 + if (cells.length > 0) {
  6370 + for (int j = 0; j < cells.length; j++) {
  6371 + String str = cells[j].getContents().trim();
  6372 + switch (j) {
  6373 + case 0:
  6374 + diet.setTitle(str);
  6375 + continue;
  6376 + case 1:
  6377 + List<String> list2 = Arrays.asList(str.split("\n"));
  6378 + diet.setSuggests(list2);
  6379 + continue;
  6380 + case 2:
  6381 + diet.setLevel(Integer.parseInt(str));
  6382 + continue;
  6383 + }
  6384 + }
  6385 + }
  6386 + mongoTemplate.save(diet);
  6387 + }
  6388 + }
  6389 + } catch (Exception e) {
  6390 + e.printStackTrace();
  6391 + }
  6392 + }
  6393 +
  6394 +
  6395 +
  6396 + /**
  6397 + * 医生建议内容
  6398 + *
  6399 + * @param fileName
  6400 + */
  6401 + public static void saveDiteDoctorSuggest(String fileName) {
  6402 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  6403 + MongoTemplate mongoTemplate
  6404 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  6405 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  6406 + File file = new File(fileName);
  6407 + Workbook wb = null;
  6408 + try {
  6409 + wb = Workbook.getWorkbook(file);
  6410 +
  6411 + Sheet s = wb.getSheet(0);
  6412 + System.out.println(s.getName() + " : ");
  6413 + int rows = s.getRows();
  6414 + if (rows > 0) {
  6415 + //遍历每行
  6416 + for (int i = 1; i < rows; i++) {
  6417 + System.out.println("rows=" + i);
  6418 + BabyDietSuggestModel diet = new BabyDietSuggestModel();
  6419 + diet.setType(1);
  6420 + Cell[] cells = s.getRow(i);
  6421 + List<List<String>> list = new ArrayList<>();
  6422 + if (cells.length > 0) {
  6423 + for (int j = 0; j < cells.length; j++) {
  6424 + String str = cells[j].getContents().trim();
  6425 + if (!StringUtils.isNotEmpty(str))
  6426 + {
  6427 + continue;
  6428 + }
  6429 + if (j == 0)
  6430 + {
  6431 + diet.setMonthAge(Integer.parseInt(str));
  6432 + }
  6433 + else
  6434 + {
  6435 + List<String> list2 = Arrays.asList(str.split("\n"));
  6436 + list.add(list2);
  6437 + }
  6438 + }
  6439 + diet.setDoctorSuggests(list);
  6440 + }
  6441 + mongoTemplate.save(diet);
  6442 + }
  6443 + }
  6444 + } catch (Exception e) {
  6445 + e.printStackTrace();
  6446 + }
  6447 + }
  6448 +
  6449 +
6218 6450 public static void main(String[] args) {
  6451 +// getData();
6219 6452 //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
6220 6453 // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
6221 6454 // weightFood("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls");
6222 6455  
... ... @@ -6233,9 +6466,9 @@
6233 6466 // saveCdgwOrg("F:\\承德工位\\cdorg.xls");
6234 6467 // saveCdgwOrgJwhRe("F:\\承德工位\\承德卫生机构与居委会对应关系表.xls");
6235 6468 //saveCdgwOrg("F:\\承德工位\\qhdorg.xls");
6236   - //babyReport("G:\儿童膳食报告.xls");
  6469 +// babyReport("G:\儿童膳食报告.xls");
6237 6470 // saveQhdbabyDiaginose("F:\\承德工位\\秦皇岛儿童诊断 - 副本.xls");
6238   - saveQhdWeight("F:\秦皇岛标准报告(1).xls");
  6471 + //saveQhdWeight("F:\秦皇岛标准报告(1).xls");
6239 6472  
6240 6473 //dietaryIntake("F:\\膳食摄入量推荐.xls");
6241 6474  
... ... @@ -6252,7 +6485,15 @@
6252 6485 // baby35Report("C:\\Users\\Administrator\\Desktop\\doc\\秦皇岛3-5月龄膳食报告\\3-5月龄儿童膳食报告内容.xls");
6253 6486 // baby35Report("C:\\Users\\Administrator\\Desktop\\doc\\秦皇岛3-5月龄膳食报告\\3-5月龄儿童膳食报告内容.xls");
6254 6487 //saveWeight("F:\\体成分分析报告内容.xls");
6255   - becareful("F:\\秦皇岛生重本周注意.xls");
  6488 + //becareful("F:\\秦皇岛生重本周注意.xls");
  6489 +
  6490 +
  6491 +// baby12to35ReportNomal("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\秦皇岛定制12-35月龄正常体型一周食谱(1).xls");
  6492 +
  6493 +
  6494 + saveDiteSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\每类食物不爱吃的指导建议.xls");
  6495 + saveDiteDoctorSuggest("F:\\儿童营养报告\\秦皇岛儿童膳食营养报告\\医生建议内容.xls");
  6496 +
6256 6497 }
6257 6498  
6258 6499  
platform-common/src/main/java/com/lyms/platform/common/Test.java View file @ 936654b
1 1 package com.lyms.platform.common;
2 2  
3   -import com.lyms.platform.common.utils.MessageUtil;
4   -import org.apache.commons.httpclient.HttpClient;
5   -import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
6   -import org.apache.commons.httpclient.methods.PostMethod;
7 3  
  4 +
8 5 public class Test {
9 6 public static void main(String[] args) {
10   - Double kcal = 1080D;
11   - int k = (int) (kcal / 100) * 100;
12   - System.out.print((double)k);
13   -// Double d = Math.floor(k);
14   -// Double md = d + 50;
15   -// if (md > kcal) {
16   -// System.out.print(d);
17   -// } else {
18   -// System.out.print(md);
19   -// }
20   -}
  7 +
  8 + }
  9 +
21 10 }
platform-dal/src/main/java/com/lyms/platform/pojo/BabyDietSuggestModel.java View file @ 936654b
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 秦皇岛区域定制儿童膳食建议
  10 + */
  11 +@Document(collection = "lyms_baby_diet_suggest")
  12 +public class BabyDietSuggestModel extends BaseModel {
  13 + private String id;
  14 +
  15 +
  16 + //1 医生建议 2 食物不爱吃建议
  17 + private Integer type;
  18 +
  19 + private String title;
  20 + private List<String> suggests;
  21 +
  22 + //优先顺序
  23 + private Integer level;
  24 +
  25 + private Integer monthAge;
  26 +
  27 + private List<List<String>> doctorSuggests;
  28 +
  29 + public Integer getLevel() {
  30 + return level;
  31 + }
  32 +
  33 + public void setLevel(Integer level) {
  34 + this.level = level;
  35 + }
  36 +
  37 + public String getId() {
  38 + return id;
  39 + }
  40 +
  41 + public void setId(String id) {
  42 + this.id = id;
  43 + }
  44 +
  45 + public Integer getType() {
  46 + return type;
  47 + }
  48 +
  49 + public void setType(Integer type) {
  50 + this.type = type;
  51 + }
  52 +
  53 + public String getTitle() {
  54 + return title;
  55 + }
  56 +
  57 + public void setTitle(String title) {
  58 + this.title = title;
  59 + }
  60 +
  61 + public List<String> getSuggests() {
  62 + return suggests;
  63 + }
  64 +
  65 + public void setSuggests(List<String> suggests) {
  66 + this.suggests = suggests;
  67 + }
  68 +
  69 + public Integer getMonthAge() {
  70 + return monthAge;
  71 + }
  72 +
  73 + public void setMonthAge(Integer monthAge) {
  74 + this.monthAge = monthAge;
  75 + }
  76 +
  77 + public List<List<String>> getDoctorSuggests() {
  78 + return doctorSuggests;
  79 + }
  80 +
  81 + public void setDoctorSuggests(List<List<String>> doctorSuggests) {
  82 + this.doctorSuggests = doctorSuggests;
  83 + }
  84 +}
platform-dal/src/main/java/com/lyms/platform/pojo/BabyNutritionModel.java View file @ 936654b
... ... @@ -126,6 +126,18 @@
126 126 */
127 127 private String interpretDoctorId;
128 128  
  129 + //秦皇岛膳食定制
  130 + private List<Map<String,Integer>> diets;
  131 +
  132 +
  133 + public List<Map<String,Integer>> getDiets() {
  134 + return diets;
  135 + }
  136 +
  137 + public void setDiets(List<Map<String,Integer>> diets) {
  138 + this.diets = diets;
  139 + }
  140 +
129 141 public String getInterpretDoctorId() {
130 142 return interpretDoctorId;
131 143 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java View file @ 936654b
... ... @@ -1381,7 +1381,6 @@
1381 1381 }
1382 1382 } else if (kaupEvaluate.equals("正常") && month >= 12 && month <= 36) {
1383 1383 List<BabyDietReportModel> babyDietReportList = mongoTemplate.find(Query.query(Criteria.where("startMonthAge").lte(month).and("endMonthAge").gte(month)), BabyDietReportModel.class);
1384   - System.out.println(babyDietReportList.size());
1385 1384 for (BabyDietReportModel babyDiet : babyDietReportList) {
1386 1385 // 1代表正常
1387 1386 if (null != babyDiet.getShape() && babyDiet.getShape() == 1) {
... ... @@ -1504,6 +1503,59 @@
1504 1503 }
1505 1504 }
1506 1505  
  1506 + //6-12月龄膳食建议 其中可能包括医生建议和不爱吃某类食物建议
  1507 + if (month > 5 && month <= 12) {
  1508 + List<Map<String,Integer>> list = model.getDiets();
  1509 + Collections.sort(list, new Comparator<Map<String, Integer>>() {
  1510 + @Override
  1511 + public int compare(Map<String, Integer> o1, Map<String, Integer> o2) {
  1512 + return o1.get("id") - o2.get("id");
  1513 + }
  1514 + });
  1515 +
  1516 + int items = 0;
  1517 + switch (month) {
  1518 + case 6: items = 8;break;
  1519 + case 7: items = 15;break;
  1520 + case 8: items = 20;break;
  1521 + case 9: items = 20;break;
  1522 + case 10: items = 23;break;
  1523 + case 11: items = 23;break;
  1524 + case 12: items = 24;break;
  1525 + }
  1526 +
  1527 + List<List<String>> dss = new ArrayList<>();
  1528 +
  1529 + Integer noLovelType = -1;
  1530 +
  1531 + //获取对应月龄的医生建议
  1532 + BabyDietSuggestModel dietDoctorSuggests = mongoTemplate.findOne(Query.query(Criteria.where("type").is(1).and("monthAge").is(month)), BabyDietSuggestModel.class);
  1533 + List<List<String>> doctorSuggests = dietDoctorSuggests.getDoctorSuggests();
  1534 + List<Map<String,Integer>> tempList = list.subList(0, items);
  1535 + for (int i = 0; i < tempList.size() ; i++)
  1536 + {
  1537 + //没有添加对应月龄的食物 add 0 为未添加 1为添加
  1538 + if (tempList.get(i).get("add") != null && tempList.get(i).get("add") != 1)
  1539 + {
  1540 + dss.add(doctorSuggests.get(i));
  1541 + }
  1542 + else
  1543 + { //对应月龄添加了食物,才再判断是否爱吃 love 0为不爱吃 1为爱吃
  1544 + if(tempList.get(i).get("love") != null && tempList.get(i).get("love") != 1)
  1545 + {
  1546 + noLovelType = tempList.get(i).get("type") > noLovelType ? tempList.get(i).get("type") : noLovelType;
  1547 + }
  1548 + }
  1549 + }
  1550 +
  1551 + data.put("suggests", null);
  1552 + if (noLovelType != -1)
  1553 + {
  1554 + BabyDietSuggestModel dietSuggestModel1 = mongoTemplate.findOne(Query.query(Criteria.where("type").is(2).and("level").is(noLovelType)), BabyDietSuggestModel.class);
  1555 + data.put("suggests", dietSuggestModel1.getSuggests());
  1556 + }
  1557 + data.put("doctorSuggests", dss);
  1558 + }
1507 1559  
1508 1560 healthChargeFacade.addHealthCharge(hospitalId, 5, baby.getId(), null, null, userId, doctorId, true, model.getId());
1509 1561 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyNutritionRequest.java View file @ 936654b
... ... @@ -133,6 +133,17 @@
133 133 */
134 134 private String interpretDoctorId;
135 135  
  136 + //秦皇岛膳食定制
  137 + private List<Map<String,Integer>> diets;
  138 +
  139 + public List<Map<String,Integer>> getDiets() {
  140 + return diets;
  141 + }
  142 +
  143 + public void setDiets(List<Map<String,Integer>> diets) {
  144 + this.diets = diets;
  145 + }
  146 +
136 147 public String getInterpretDoctorId() {
137 148 return interpretDoctorId;
138 149 }
... ... @@ -188,6 +199,8 @@
188 199 model.setFruits(fruits);
189 200 model.setFoods(foods);
190 201 model.setRemark(remark);
  202 +
  203 + model.setDiets(diets);
191 204 return model;
192 205 }
193 206