Commit b88fa2ad6dec53e8a81ed315ebdb99c669e6f851
1 parent
11064f32a8
Exists in
master
and in
6 other branches
儿童营养报告
Showing 5 changed files with 679 additions and 35 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AwModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyConfigModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
b88fa2a
... | ... | @@ -846,6 +846,82 @@ |
846 | 846 | |
847 | 847 | |
848 | 848 | |
849 | + //儿童bmi | |
850 | + public static void addBabyBmiHealthConfig(String fileName) { | |
851 | + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); | |
852 | + MongoTemplate mongoTemplate | |
853 | + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); | |
854 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
855 | + File file = new File(fileName); | |
856 | + Workbook wb = null; | |
857 | + try { | |
858 | + wb = Workbook.getWorkbook(file); | |
859 | + Sheet s = wb.getSheet(0); | |
860 | + System.out.println(s.getName() + " : "); | |
861 | + int rows = s.getRows(); | |
862 | + if(rows > 0){ | |
863 | + //遍历每行 | |
864 | + for(int i = 1 ;i < rows ; i++){ | |
865 | + System.out.println("rows=" + i); | |
866 | + AwModel model = new AwModel(); | |
867 | + model.setType(5); | |
868 | + | |
869 | + Cell[] cells = s.getRow(i); | |
870 | + if(cells.length > 0){ | |
871 | + //遍历每行中的每列 | |
872 | + for (int j = 0 ; j < cells.length ; j ++) | |
873 | + { | |
874 | + String str = cells[j].getContents().trim(); | |
875 | + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str)) | |
876 | + { | |
877 | + continue; | |
878 | + } | |
879 | + switch (j) | |
880 | + { | |
881 | + case 0: | |
882 | + model.setAge(Integer.parseInt(str)); | |
883 | + continue; | |
884 | + case 1: | |
885 | + model.setRthreeDs(Double.valueOf(str)); | |
886 | + continue; | |
887 | + case 2: | |
888 | + model.setRtwoDs(Double.valueOf(str)); | |
889 | + continue; | |
890 | + case 3: | |
891 | + model.setRoneDs(Double.valueOf(str)); | |
892 | + continue; | |
893 | + case 4: | |
894 | + model.setMiddleDs(Double.valueOf(str)); | |
895 | + continue; | |
896 | + case 5: | |
897 | + model.setPoneDs(Double.valueOf(str)); | |
898 | + continue; | |
899 | + case 6: | |
900 | + model.setPtwoDs(Double.valueOf(str)); | |
901 | + continue; | |
902 | + case 7: | |
903 | + model.setPthreeDs(Double.valueOf(str)); | |
904 | + continue; | |
905 | + case 8: | |
906 | + model.setSex(Integer.parseInt(str)); | |
907 | + continue; | |
908 | + } | |
909 | + } | |
910 | + } | |
911 | + System.out.println(model); | |
912 | + mongoTemplate.save(model); | |
913 | + } | |
914 | + } | |
915 | + } catch (IOException e) { | |
916 | + e.printStackTrace(); | |
917 | + } catch (BiffException e) { | |
918 | + e.printStackTrace(); | |
919 | + } | |
920 | + | |
921 | + } | |
922 | + | |
923 | + | |
924 | + | |
849 | 925 | public static void weightMange(String fileName) |
850 | 926 | { |
851 | 927 | |
... | ... | @@ -1455,6 +1531,250 @@ |
1455 | 1531 | } |
1456 | 1532 | |
1457 | 1533 | |
1534 | + | |
1535 | + public static void babyConfig(String fileName) | |
1536 | + { | |
1537 | + | |
1538 | + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); | |
1539 | + MongoTemplate mongoTemplate | |
1540 | + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); | |
1541 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
1542 | + File file = new File(fileName); | |
1543 | + Workbook wb = null; | |
1544 | + try { | |
1545 | + wb = Workbook.getWorkbook(file); | |
1546 | + Sheet s = wb.getSheet(0); | |
1547 | + System.out.println(s.getName() + " : "); | |
1548 | + int rows = s.getRows(); | |
1549 | + if(rows > 0){ | |
1550 | + //遍历每行 | |
1551 | + for(int i = 1 ;i < rows ; i++){ | |
1552 | + System.out.println("rows="+i); | |
1553 | + BabyConfigModel model = new BabyConfigModel(); | |
1554 | + //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 | |
1555 | + model.setType(0); | |
1556 | + Cell[] cells = s.getRow(i); | |
1557 | + if(cells.length > 0){ | |
1558 | + //遍历每行中的每列 | |
1559 | + for (int j = 0 ; j < cells.length ; j ++) | |
1560 | + { | |
1561 | + String str = cells[j].getContents().trim(); | |
1562 | + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str)) | |
1563 | + { | |
1564 | + continue; | |
1565 | + } | |
1566 | + switch (j) | |
1567 | + { | |
1568 | + case 0: | |
1569 | + model.setMonthAge(Integer.parseInt(str)); | |
1570 | + continue; | |
1571 | + case 1: | |
1572 | + List<String> list1 = Arrays.asList(str.split("\n")); | |
1573 | + model.setContentOne(list1); | |
1574 | + continue; | |
1575 | + case 2: | |
1576 | + List<String> list2 = Arrays.asList(str.split("\n")); | |
1577 | + model.setContentTwo(list2); | |
1578 | + continue; | |
1579 | + case 3: | |
1580 | + List<String> list3 = Arrays.asList(str.split("\n")); | |
1581 | + model.setContentThree(list3); | |
1582 | + continue; | |
1583 | + case 4: | |
1584 | + List<String> list4 = Arrays.asList(str.split("\n")); | |
1585 | + model.setContentFour(list4); | |
1586 | + continue; | |
1587 | + case 5: | |
1588 | + model.setStatus(str); | |
1589 | + continue; | |
1590 | + } | |
1591 | + } | |
1592 | + | |
1593 | + } | |
1594 | + mongoTemplate.save(model); | |
1595 | + } | |
1596 | + } | |
1597 | + | |
1598 | + Sheet s1 = wb.getSheet(1); | |
1599 | + System.out.println(s1.getName() + " : "); | |
1600 | + | |
1601 | + int rows1 = s1.getRows(); | |
1602 | + if(rows1 > 0){ | |
1603 | + //遍历每行 | |
1604 | + for(int i = 1 ;i < rows1 ; i++){ | |
1605 | + System.out.println("rows="+i); | |
1606 | + BabyConfigModel model = new BabyConfigModel(); | |
1607 | + //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 | |
1608 | + model.setType(1); | |
1609 | + Cell[] cells = s1.getRow(i); | |
1610 | + if(cells.length > 0){ | |
1611 | + //遍历每行中的每列 | |
1612 | + for (int j = 0 ; j < cells.length ; j ++) | |
1613 | + { | |
1614 | + String str = cells[j].getContents().trim(); | |
1615 | + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str)) | |
1616 | + { | |
1617 | + continue; | |
1618 | + } | |
1619 | + switch (j) | |
1620 | + { | |
1621 | + case 0: | |
1622 | + model.setMonthAge(Integer.parseInt(str)); | |
1623 | + continue; | |
1624 | + case 1: | |
1625 | + model.setKcal(Double.parseDouble(str)); | |
1626 | + continue; | |
1627 | + case 2: | |
1628 | + List<String> list1 = Arrays.asList(str.split("\n")); | |
1629 | + model.setContentOne(list1); | |
1630 | + continue; | |
1631 | + } | |
1632 | + } | |
1633 | + | |
1634 | + } | |
1635 | + mongoTemplate.save(model); | |
1636 | + } | |
1637 | + } | |
1638 | + | |
1639 | + | |
1640 | + | |
1641 | + Sheet s2 = wb.getSheet(2); | |
1642 | + System.out.println(s2.getName() + " : "); | |
1643 | + | |
1644 | + int rows2 = s2.getRows(); | |
1645 | + if(rows2 > 0){ | |
1646 | + //遍历每行 | |
1647 | + for(int i = 1 ;i < rows2 ; i++){ | |
1648 | + System.out.println("rows="+i); | |
1649 | + BabyConfigModel model = new BabyConfigModel(); | |
1650 | + //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 | |
1651 | + model.setType(2); | |
1652 | + Cell[] cells = s2.getRow(i); | |
1653 | + if(cells.length > 0){ | |
1654 | + //遍历每行中的每列 | |
1655 | + for (int j = 0 ; j < cells.length ; j ++) | |
1656 | + { | |
1657 | + String str = cells[j].getContents().trim(); | |
1658 | + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str)) | |
1659 | + { | |
1660 | + continue; | |
1661 | + } | |
1662 | + switch (j) | |
1663 | + { | |
1664 | + case 0: | |
1665 | + model.setMonthAge(Integer.parseInt(str)); | |
1666 | + continue; | |
1667 | + case 1: | |
1668 | + model.setTitle(str); | |
1669 | + continue; | |
1670 | + case 2: | |
1671 | + List<String> list1 = Arrays.asList(str.split("\n")); | |
1672 | + model.setContentOne(list1); | |
1673 | + continue; | |
1674 | + } | |
1675 | + } | |
1676 | + | |
1677 | + } | |
1678 | + mongoTemplate.save(model); | |
1679 | + } | |
1680 | + } | |
1681 | + | |
1682 | + | |
1683 | + Sheet s3 = wb.getSheet(3); | |
1684 | + System.out.println(s3.getName() + " : "); | |
1685 | + int rows3 = s3.getRows(); | |
1686 | + if(rows3 > 0){ | |
1687 | + //遍历每行 | |
1688 | + for(int i = 1 ;i < rows3 ; i++){ | |
1689 | + System.out.println("rows="+i); | |
1690 | + BabyConfigModel model = new BabyConfigModel(); | |
1691 | + //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 | |
1692 | + model.setType(3); | |
1693 | + Cell[] cells = s3.getRow(i); | |
1694 | + if(cells.length > 0){ | |
1695 | + //遍历每行中的每列 | |
1696 | + for (int j = 0 ; j < cells.length ; j ++) | |
1697 | + { | |
1698 | + String str = cells[j].getContents().trim(); | |
1699 | + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str)) | |
1700 | + { | |
1701 | + continue; | |
1702 | + } | |
1703 | + switch (j) | |
1704 | + { | |
1705 | + case 0: | |
1706 | + model.setKcal(Double.parseDouble(str)); | |
1707 | + continue; | |
1708 | + case 1: | |
1709 | + model.setTitle(str); | |
1710 | + continue; | |
1711 | + case 2: | |
1712 | + List<String> list2 = Arrays.asList(str.split("\n")); | |
1713 | + model.setContentOne(list2); | |
1714 | + continue; | |
1715 | + case 3: | |
1716 | + model.setStatus(str); | |
1717 | + continue; | |
1718 | + } | |
1719 | + } | |
1720 | + } | |
1721 | + mongoTemplate.save(model); | |
1722 | + } | |
1723 | + } | |
1724 | + | |
1725 | + | |
1726 | + Sheet s4 = wb.getSheet(4); | |
1727 | + System.out.println(s4.getName() + " : "); | |
1728 | + int rows4 = s4.getRows(); | |
1729 | + if(rows3 > 0){ | |
1730 | + //遍历每行 | |
1731 | + for(int i = 1 ;i < rows4 ; i++){ | |
1732 | + System.out.println("rows="+i); | |
1733 | + BabyConfigModel model = new BabyConfigModel(); | |
1734 | + //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 4.12--36喂养指南 | |
1735 | + model.setType(4); | |
1736 | + Cell[] cells = s4.getRow(i); | |
1737 | + if(cells.length > 0){ | |
1738 | + //遍历每行中的每列 | |
1739 | + for (int j = 0 ; j < cells.length ; j ++) | |
1740 | + { | |
1741 | + String str = cells[j].getContents().trim(); | |
1742 | + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(str)) | |
1743 | + { | |
1744 | + continue; | |
1745 | + } | |
1746 | + switch (j) | |
1747 | + { | |
1748 | + case 0: | |
1749 | + model.setMonthAge(Integer.parseInt(str)); | |
1750 | + continue; | |
1751 | + case 1: | |
1752 | + model.setTitle(str); | |
1753 | + continue; | |
1754 | + case 2: | |
1755 | + List<String> list2 = Arrays.asList(str.split("\n")); | |
1756 | + model.setContentOne(list2); | |
1757 | + continue; | |
1758 | + case 3: | |
1759 | + model.setStatus(str); | |
1760 | + continue; | |
1761 | + } | |
1762 | + } | |
1763 | + } | |
1764 | + mongoTemplate.save(model); | |
1765 | + } | |
1766 | + } | |
1767 | + | |
1768 | + | |
1769 | + } catch (IOException e) { | |
1770 | + e.printStackTrace(); | |
1771 | + } catch (BiffException e) { | |
1772 | + e.printStackTrace(); | |
1773 | + } | |
1774 | + | |
1775 | + } | |
1776 | + | |
1777 | + | |
1458 | 1778 | public static void main(String[] args) { |
1459 | 1779 | // weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); |
1460 | 1780 | // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); |
1461 | 1781 | |
1462 | 1782 | |
1463 | 1783 | |
... | ... | @@ -1462,32 +1782,12 @@ |
1462 | 1782 | // bloodSugar("F:\\血糖报告\\血糖报告\\血糖报告基础数据格式(2).xls"); |
1463 | 1783 | |
1464 | 1784 | // zcet("D:\\doc\\高血压报告20180813模板.xls"); |
1465 | - zcet("D:\doc\1.xls",false); | |
1785 | +// zcet("D:\doc\1.xls",false); | |
1466 | 1786 | |
1787 | +// addBabyBmiHealthConfig("F:\\儿童营养报告\\婴幼儿bmi.xls"); | |
1467 | 1788 | |
1468 | - /* ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); | |
1469 | - MongoTemplate mongoTemplate | |
1470 | - = (MongoTemplate) applicationContext.getBean("mongoTemplate"); | |
1471 | - mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
1472 | - | |
1473 | - QueryBuilder queryBuilder = new QueryBuilder(); | |
1474 | - BasicDBObject fieldsObject=new BasicDBObject(); | |
1475 | - fieldsObject.put("_id", 1); | |
1476 | - fieldsObject.put("category", 1); | |
1477 | - BasicQuery query=new BasicQuery(queryBuilder.get(),fieldsObject); | |
1478 | - System.out.println(mongoTemplate.find(query, Guidelines.class).get(0));*/ | |
1789 | + babyConfig("F:\\儿童营养报告\\儿童营养报告模板.xls"); | |
1479 | 1790 | } |
1480 | 1791 | |
1481 | - public static void addBaby(ApplicationContext applicationContext) { | |
1482 | -// BabyModel babyModel = new BabyModel(); | |
1483 | -// babyModel.setBirth(new Date()); | |
1484 | -// babyModel.setName("小孩的名字"); | |
1485 | -// babyModel.setSex(1); | |
1486 | -// babyModel.setVisitstatus(1); | |
1487 | -// babyModel.setParentId("56ebbff424fdd5ddf5dd2070"); | |
1488 | -// BabyService babyService = applicationContext.getBean(BabyService.class); | |
1489 | -// babyService.addOneBaby(babyModel); | |
1490 | - ; | |
1491 | - } | |
1492 | 1792 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
View file @
b88fa2a
... | ... | @@ -67,6 +67,13 @@ |
67 | 67 | return babyHwDao.queryHWByHeight(condition.toMongoQuery()); |
68 | 68 | } |
69 | 69 | |
70 | + public List<AwModel> queryBabyHealthConfig(Integer sex,Integer type) { | |
71 | + MongoCondition condition = MongoCondition.newInstance(); | |
72 | + condition = condition.and("sex", sex, MongoOper.IS); | |
73 | + condition = condition.and("type", type, MongoOper.IS); | |
74 | + return babyAwDao.queryAwByHeight(condition.toMongoQuery()); | |
75 | + } | |
76 | + | |
70 | 77 | public List<AwModel> queryBabyHealthConfig(Integer age, Integer sex,Integer type) { |
71 | 78 | MongoCondition condition = MongoCondition.newInstance(); |
72 | 79 | condition = condition.and("age", age, MongoOper.IS); |
platform-dal/src/main/java/com/lyms/platform/pojo/AwModel.java
View file @
b88fa2a
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | private Double poneDs; |
24 | 24 | private Double ptwoDs; |
25 | 25 | private Double pthreeDs; |
26 | - //0 体重标准差数值表 1 身长/身高标准差数值表 2 头围标准差数值表 3身高别体重 4 早产儿体重百分位数值表(男、女) | |
26 | + //0 体重标准差数值表 1 身长/身高标准差数值表 2 头围标准差数值表 3身高别体重 4 早产儿体重百分位数值表(男、女) 5.儿童bmi值 | |
27 | 27 | private Integer type; |
28 | 28 | |
29 | 29 | private Double height; |
... | ... | @@ -143,6 +143,26 @@ |
143 | 143 | |
144 | 144 | public void setPthreeDs(Double pthreeDs) { |
145 | 145 | this.pthreeDs = pthreeDs; |
146 | + } | |
147 | + | |
148 | + @Override | |
149 | + public String toString() { | |
150 | + return "AwModel{" + | |
151 | + "id='" + id + '\'' + | |
152 | + ", sex=" + sex + | |
153 | + ", age=" + age + | |
154 | + ", rthreeDs=" + rthreeDs + | |
155 | + ", rtwoDs=" + rtwoDs + | |
156 | + ", roneDs=" + roneDs + | |
157 | + ", middleDs=" + middleDs + | |
158 | + ", poneDs=" + poneDs + | |
159 | + ", ptwoDs=" + ptwoDs + | |
160 | + ", pthreeDs=" + pthreeDs + | |
161 | + ", type=" + type + | |
162 | + ", height=" + height + | |
163 | + ", ageType=" + ageType + | |
164 | + ", week=" + week + | |
165 | + '}'; | |
146 | 166 | } |
147 | 167 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyConfigModel.java
View file @
b88fa2a
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import org.springframework.data.mongodb.core.mapping.Document; | |
4 | + | |
5 | +import java.io.Serializable; | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * 儿童营养报告内容配置 | |
10 | + * Created by Administrator on 2018-06-04. | |
11 | + */ | |
12 | +@Document(collection = "lyms_baby_config") | |
13 | +public class BabyConfigModel { | |
14 | + private String id; | |
15 | + private String title; | |
16 | + private Integer monthAge;//月龄 | |
17 | + private List<String> contentOne;// | |
18 | + private List<String> contentTwo;// | |
19 | + private List<String> contentThree;// | |
20 | + private List<String> contentFour;// | |
21 | + private Double kcal; //热量 | |
22 | + private Integer type; //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 4.12--36喂养指南 | |
23 | + | |
24 | + private String status; // 消瘦、正常、超重 | |
25 | + | |
26 | + public String getId() { | |
27 | + return id; | |
28 | + } | |
29 | + | |
30 | + public void setId(String id) { | |
31 | + this.id = id; | |
32 | + } | |
33 | + | |
34 | + public String getTitle() { | |
35 | + return title; | |
36 | + } | |
37 | + | |
38 | + public void setTitle(String title) { | |
39 | + this.title = title; | |
40 | + } | |
41 | + | |
42 | + public Integer getMonthAge() { | |
43 | + return monthAge; | |
44 | + } | |
45 | + | |
46 | + public void setMonthAge(Integer monthAge) { | |
47 | + this.monthAge = monthAge; | |
48 | + } | |
49 | + | |
50 | + public List<String> getContentOne() { | |
51 | + return contentOne; | |
52 | + } | |
53 | + | |
54 | + public void setContentOne(List<String> contentOne) { | |
55 | + this.contentOne = contentOne; | |
56 | + } | |
57 | + | |
58 | + public List<String> getContentTwo() { | |
59 | + return contentTwo; | |
60 | + } | |
61 | + | |
62 | + public void setContentTwo(List<String> contentTwo) { | |
63 | + this.contentTwo = contentTwo; | |
64 | + } | |
65 | + | |
66 | + public List<String> getContentThree() { | |
67 | + return contentThree; | |
68 | + } | |
69 | + | |
70 | + public void setContentThree(List<String> contentThree) { | |
71 | + this.contentThree = contentThree; | |
72 | + } | |
73 | + | |
74 | + public List<String> getContentFour() { | |
75 | + return contentFour; | |
76 | + } | |
77 | + | |
78 | + public void setContentFour(List<String> contentFour) { | |
79 | + this.contentFour = contentFour; | |
80 | + } | |
81 | + | |
82 | + public Double getKcal() { | |
83 | + return kcal; | |
84 | + } | |
85 | + | |
86 | + public void setKcal(Double kcal) { | |
87 | + this.kcal = kcal; | |
88 | + } | |
89 | + | |
90 | + public Integer getType() { | |
91 | + return type; | |
92 | + } | |
93 | + | |
94 | + public void setType(Integer type) { | |
95 | + this.type = type; | |
96 | + } | |
97 | + | |
98 | + public String getStatus() { | |
99 | + return status; | |
100 | + } | |
101 | + | |
102 | + public void setStatus(String status) { | |
103 | + this.status = status; | |
104 | + } | |
105 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
b88fa2a
... | ... | @@ -7,8 +7,10 @@ |
7 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | 9 | import com.lyms.platform.common.utils.*; |
10 | +import com.lyms.platform.common.utils.StringUtils; | |
10 | 11 | import com.lyms.platform.operate.web.request.BabyCheckRequest; |
11 | 12 | import com.lyms.platform.operate.web.result.*; |
13 | +import com.lyms.platform.operate.web.service.PatientWeightService; | |
12 | 14 | import com.lyms.platform.operate.web.utils.MongoUtil; |
13 | 15 | import com.lyms.platform.permission.dao.master.CouponMapper; |
14 | 16 | import com.lyms.platform.permission.model.Organization; |
15 | 17 | |
... | ... | @@ -19,8 +21,12 @@ |
19 | 21 | import com.lyms.platform.pojo.*; |
20 | 22 | import com.lyms.platform.query.*; |
21 | 23 | import org.apache.commons.collections.CollectionUtils; |
24 | +import org.apache.commons.lang.*; | |
22 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
23 | 26 | import org.springframework.data.domain.Sort; |
27 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
28 | +import org.springframework.data.mongodb.core.query.Criteria; | |
29 | +import org.springframework.data.mongodb.core.query.Query; | |
24 | 30 | import org.springframework.stereotype.Component; |
25 | 31 | |
26 | 32 | import java.util.*; |
27 | 33 | |
28 | 34 | |
... | ... | @@ -34,12 +40,17 @@ |
34 | 40 | |
35 | 41 | @Autowired |
36 | 42 | private BabyBookbuildingService babyBookbuildingService; |
37 | - | |
38 | 43 | @Autowired |
44 | + private PatientWeightService patientWeightService; | |
45 | + @Autowired | |
39 | 46 | private BabyService babyService; |
40 | 47 | |
41 | 48 | |
42 | 49 | @Autowired |
50 | + private MongoTemplate mongoTemplate; | |
51 | + | |
52 | + | |
53 | + @Autowired | |
43 | 54 | private BasicConfigService basicConfigService; |
44 | 55 | |
45 | 56 | @Autowired |
46 | 57 | |
47 | 58 | |
48 | 59 | |
49 | 60 | |
50 | 61 | |
... | ... | @@ -2063,22 +2074,223 @@ |
2063 | 2074 | |
2064 | 2075 | Map data = new HashMap(); |
2065 | 2076 | |
2066 | - String hospitalId = autoMatchFacade.getHospitalId(userId); | |
2077 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
2078 | + babyQuery.setId(babyId); | |
2079 | + babyQuery.setYn(YnEnums.YES.getId()); | |
2067 | 2080 | |
2068 | - BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
2069 | - babyModelQuery.setYn(YnEnums.YES.getId()); | |
2070 | - babyModelQuery.setId(babyId); | |
2071 | - babyModelQuery.setHospitalId(hospitalId); | |
2081 | + Map baseInfo = new HashMap(); | |
2072 | 2082 | |
2073 | - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
2074 | - if (CollectionUtils.isEmpty(babyModels)) | |
2083 | + //查询儿童的基本信息 | |
2084 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
2085 | + if (!CollectionUtils.isNotEmpty(models)) | |
2075 | 2086 | { |
2076 | - return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有数据"); | |
2087 | + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有儿童档案信息"); | |
2077 | 2088 | } |
2078 | 2089 | |
2079 | - BabyModel babyModel = babyModels.get(0); | |
2090 | + BabyModel model = models.get(0); | |
2080 | 2091 | |
2081 | - return null; | |
2092 | + | |
2093 | + | |
2094 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
2095 | + query.setYn(YnEnums.YES.getId()); | |
2096 | + query.setBuildId(babyId); | |
2097 | + List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(query); | |
2098 | + if (CollectionUtils.isEmpty(babyCheckModels)) | |
2099 | + { | |
2100 | + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有检查记录"); | |
2101 | + } | |
2102 | + | |
2103 | + BabyCheckModel checkModel = babyCheckModels.get(0); | |
2104 | + | |
2105 | + int month = DateUtil.getMonth(model.getBirth(), checkModel.getCheckDate()); | |
2106 | + if (month == 0 || month > 36) | |
2107 | + { | |
2108 | + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("月龄范围没有报告"); | |
2109 | + } | |
2110 | + | |
2111 | + if (!(StringUtils.isNotEmpty(checkModel.getWeight()) && StringUtils.isNotEmpty(checkModel.getHeight()))) | |
2112 | + { | |
2113 | + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("检查报告没有体重和身长不能生成报告"); | |
2114 | + } | |
2115 | + | |
2116 | + | |
2117 | + baseInfo.put("weight", checkModel.getWeight()); | |
2118 | + baseInfo.put("weightEvaluate", checkModel.getWeightEvaluate()); | |
2119 | + | |
2120 | + baseInfo.put("height", checkModel.getHeight()); | |
2121 | + baseInfo.put("heightEvaluate", checkModel.getHeightEvaluate()); | |
2122 | + baseInfo.put("month", month); | |
2123 | + | |
2124 | + | |
2125 | + String kaupEvaluate = ""; | |
2126 | + if (StringUtils.isNotEmpty(checkModel.getWeight()) && StringUtils.isNotEmpty(checkModel.getHeight())) | |
2127 | + { | |
2128 | + String bmi = patientWeightService.getBmi(checkModel.getWeight(), checkModel.getHeight()); | |
2129 | + baseInfo.put("kaup", bmi); | |
2130 | + if (StringUtils.isNotEmpty(bmi)) | |
2131 | + { | |
2132 | + Double bbmi = Double.parseDouble(bmi); | |
2133 | + //查询该月龄的年龄别体重值 | |
2134 | + // 正常 :-2SD ≤ A ≤ +1SD | |
2135 | + // 消瘦 : A < -2SD | |
2136 | + //偏重 : A > +1SD | |
2137 | + List<AwModel> list = babyCheckService.queryBabyHealthConfig(month, model.getSex(), 5); | |
2138 | + if (CollectionUtils.isNotEmpty(list)) { | |
2139 | + AwModel awModel = list.get(0); | |
2140 | + if (awModel.getPoneDs() < bbmi) | |
2141 | + { | |
2142 | + kaupEvaluate = "超重"; | |
2143 | + } | |
2144 | + else if (awModel.getPoneDs() >= bbmi && awModel.getRtwoDs() <= bbmi) | |
2145 | + { | |
2146 | + kaupEvaluate = "正常"; | |
2147 | + } | |
2148 | + else if (awModel.getRtwoDs() > bbmi) | |
2149 | + { | |
2150 | + kaupEvaluate = "消瘦"; | |
2151 | + } | |
2152 | + } | |
2153 | + } | |
2154 | + baseInfo.put("kaupEvaluate", kaupEvaluate); | |
2155 | + } | |
2156 | + | |
2157 | + baseInfo.put("name",model.getName()); | |
2158 | + baseInfo.put("sex",SexEnum.getTextById(model.getSex())); | |
2159 | + baseInfo.put("monthAge", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); | |
2160 | + | |
2161 | + String feedType = ""; | |
2162 | + if (month < 12) | |
2163 | + { | |
2164 | + String feedTypeId = checkModel.getFeedType(); | |
2165 | + if (StringUtils.isNotEmpty(feedTypeId)) | |
2166 | + { | |
2167 | + feedType = "喂养方式:"+WyTypeEnums.getNameById(Integer.parseInt(feedTypeId)); | |
2168 | + } | |
2169 | + } | |
2170 | + baseInfo.put("feedType",feedType); | |
2171 | + | |
2172 | + data.put("baseInfo",baseInfo); | |
2173 | + | |
2174 | + if (StringUtils.isNotEmpty(kaupEvaluate)) | |
2175 | + { | |
2176 | + BabyConfigModel babyConfigModel = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("status").is(kaupEvaluate).and("type").is(0)), BabyConfigModel.class); | |
2177 | + if (month < 6) | |
2178 | + { | |
2179 | + //喂养方式 | |
2180 | + data.put("wyfs",babyConfigModel.getContentOne()); | |
2181 | + //营养需求 | |
2182 | + data.put("yyxq",babyConfigModel.getContentFour()); | |
2183 | + } | |
2184 | + else if (month < 12) | |
2185 | + { | |
2186 | + //指导意见 | |
2187 | + data.put("zdyj",babyConfigModel.getContentOne()); | |
2188 | + //辅食添加 | |
2189 | + data.put("fstj",babyConfigModel.getContentTwo()); | |
2190 | + //辅食制作 | |
2191 | + data.put("fszz",babyConfigModel.getContentThree()); | |
2192 | + | |
2193 | + if (StringUtils.isNotEmpty(checkModel.getWeight())) | |
2194 | + { | |
2195 | + Double kaul = Double.parseDouble(checkModel.getWeight()) * 100; | |
2196 | + BabyConfigModel babyConfigModel1 = mongoTemplate.findOne(Query.query(Criteria.where("kcal").is(kaul).and("monthAge").is(month).and("type").is(1)), BabyConfigModel.class); | |
2197 | + //6-11月热量 | |
2198 | + data.put("rl",babyConfigModel1.getContentOne()); | |
2199 | + } | |
2200 | + //营养需求 | |
2201 | + data.put("yyxq",babyConfigModel.getContentFour()); | |
2202 | + } | |
2203 | + else if (month < 37) | |
2204 | + { | |
2205 | + List<Map<String,Object>> list = new ArrayList<>(); | |
2206 | + double kcal = 0; | |
2207 | + if (month < 36) | |
2208 | + { | |
2209 | + kcal = 89 * Double.parseDouble(checkModel.getWeight()) - 100 + 20; | |
2210 | + } | |
2211 | + else | |
2212 | + { | |
2213 | + //男童:88.5-61.9×年龄(岁)+PA[26.7×体重(kg)+903×身长(m)]+20kcal/day | |
2214 | + // PA=1.26 | |
2215 | + //女童:135.3-30.8×年龄(岁)+PA[10×体重(kg)+934×身长(m)]+20kcal/day | |
2216 | + //PA=1.31 | |
2217 | + if (model.getSex() == 1) | |
2218 | + { | |
2219 | + kcal = 88.5-61.9*3+1.26*(26.7*Double.parseDouble(checkModel.getWeight()) +903*(Double.parseDouble(checkModel.getHeight())/100))+20; | |
2220 | + } | |
2221 | + else { | |
2222 | + kcal = 135.3-30.8*3+1.31*(10*Double.parseDouble(checkModel.getWeight()) +934*(Double.parseDouble(checkModel.getHeight())/100))+20; | |
2223 | + } | |
2224 | + } | |
2225 | + kcal = getKaul(kcal); | |
2226 | + List<BabyConfigModel> configModels = mongoTemplate.find(Query.query(Criteria.where("kcal").is(kcal).and("status").is(kaupEvaluate).and("type").is(3)), BabyConfigModel.class); | |
2227 | + if (CollectionUtils.isNotEmpty(configModels) && configModels.size() == 3) | |
2228 | + { | |
2229 | + for (BabyConfigModel configModel : configModels) | |
2230 | + { | |
2231 | + Map<String,Object> map = new HashMap<>(); | |
2232 | + map.put("title",configModel.getTitle()); | |
2233 | + map.put("contents",configModel.getContentOne()); | |
2234 | + list.add(map); | |
2235 | + } | |
2236 | + data.put("foods",list); | |
2237 | + } | |
2238 | + //type; //0 0-11月龄 1 0-11月热量计算 2 12-36月龄 3 12-36月热量计算 4.12--36喂养指南 | |
2239 | + BabyConfigModel babyConfigModel1 = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("type").is(2)), BabyConfigModel.class); | |
2240 | + | |
2241 | + //各月龄饮食指南[按月获取 12-36] | |
2242 | + data.put("yszl",babyConfigModel1.getContentOne()); | |
2243 | + | |
2244 | + BabyConfigModel wyconfig = mongoTemplate.findOne(Query.query(Criteria.where("monthAge").is(month).and("status").is(kaupEvaluate).and("type").is(4)), BabyConfigModel.class); | |
2245 | + //喂养指南 | |
2246 | + data.put("yszl",wyconfig.getContentOne()); | |
2247 | + | |
2248 | + //每日所需营养素 | |
2249 | + data.put("yys",getYys(month)); | |
2250 | + } | |
2251 | + } | |
2252 | + | |
2253 | + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
2254 | + } | |
2255 | + | |
2256 | + private List<String> getYys(int month){ | |
2257 | + List<String> list = new ArrayList<>(); | |
2258 | + | |
2259 | + if (month < 36) | |
2260 | + { | |
2261 | + list.add("碳水化合物:总能量的50-70%"); | |
2262 | + list.add("蛋白质:总能量的7-20%,平均每日约0.96g/kg"); | |
2263 | + list.add("脂肪:总能量的20-35%"); | |
2264 | + list.add("n-6:总能量的4-8%"); | |
2265 | + list.add("N-3:总能量的1%"); | |
2266 | + list.add("无机物:钙的推荐摄入量为500mg,磷的推荐摄入量为500mg,钠的充分摄入为0.7g,氯的充分摄入量为1.1g,钾的充分摄入量为1.7g,镁的推荐摄入量为75mg,铁的推荐摄入量为6mg,锌的推荐摄入量为3mg,铜的推荐摄入量为290 μg,氟的充分摄入量为0.6mg,猛的充分摄入量为1.4mg,碘的推荐摄入量为80 μg,硒的推荐摄入量为20 μg"); | |
2267 | + list.add("维生素:维生素A的推荐摄入量为300 μgRE,维生素D的充分摄入量为5 μg,维生素E的充分摄入量为5mg α-TE,维生素K的充分摄入量为25μg,维生素C的推荐摄入量为40mg,维生素B1的推荐摄入量为0.5mg,维生素B2(核黄素)的0.6mg,维生素B3烟酸的推荐摄入量为6mgNE,尼克酸的上限摄入量为10mg,尼克酰胺的上限摄入量为180mg,维生素B6的推荐摄入量0.6mg,叶酸的推荐摄入量为150μg DFE,维生素B12的推荐摄入量为0.9μg,泛酸的充分摄入量为2mg,维生素H的充分摄入量9μg"); | |
2268 | + list.add("水分:1岁120-135ml/kg/day;2岁115-125ml/kg/day"); | |
2269 | + } | |
2270 | + else | |
2271 | + { | |
2272 | + list.add("碳水化合物:总能量的55-70%"); | |
2273 | + list.add("蛋白质:总能量的7-20%,平均每日约0.88g/kg"); | |
2274 | + list.add("脂肪:总能量的15-30%"); | |
2275 | + list.add("n-6:总能量的4-8%"); | |
2276 | + list.add("n-3:总能量的1%"); | |
2277 | + list.add("无机物:钙的推荐摄入量为600mg,磷的推荐摄入量为500mg,钠的充分摄入量为0.9g,氯的充分摄入量为1.4g,钾的充分摄入量为2.3g,镁的推荐摄入量为100mg,铁的推荐摄入量7mg,锌的推荐摄入量为4mg,铜的推荐摄入量为330 μg,氟的充分摄入量为0.8mg,猛的充分摄入量为2.0mg,碘的推荐摄入量为90 μg,硒的推荐摄入量为25 μg"); | |
2278 | + list.add("维生素:维生素A的推荐摄入量为300 μgRE,维生素D的充分摄入量为5 μg,维生素E的充分摄入量为6mg α-TE,维生素K的充分摄入量为30μg,维生素C的推荐摄入量为40mg,维生素B1的推荐摄入量为0.5mg,维生素B2(核黄素)的0.7mg,维生素B3烟酸的推荐摄入量为7mgNE,尼克酸的上限摄入量为10mg,尼克酰胺的上限摄入量为250mg,维生素B6的推荐摄入量0.7mg,叶酸的推荐摄入量为180μg DFE,维生素B12的推荐摄入量为1.1μg,泛酸的充分摄入量为3mg,维生素H的充分摄入量11μg"); | |
2279 | + list.add("水分:90-100ml/kg/day"); | |
2280 | + } | |
2281 | + | |
2282 | + return list; | |
2283 | + } | |
2284 | + | |
2285 | + private Double getKaul(Double kcal) { | |
2286 | + int k = (int)(kcal/100)*100; | |
2287 | + Double d = Math.floor(k); | |
2288 | + Double md = d + 50; | |
2289 | + if (md > kcal) { | |
2290 | + return d; | |
2291 | + } else { | |
2292 | + return md; | |
2293 | + } | |
2082 | 2294 | } |
2083 | 2295 | } |