Commit 5d97f7912fa254474169b5b2faeee50578aba63c
1 parent
e98bd96904
Exists in
master
and in
6 other branches
儿童检查
Showing 2 changed files with 83 additions and 42 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java
View file @
5d97f79
| ... | ... | @@ -152,8 +152,9 @@ |
| 152 | 152 | @RequestParam(required = true) Double weight, |
| 153 | 153 | @RequestParam(required = true) Integer sex, |
| 154 | 154 | @RequestParam(required = true) String birth, |
| 155 | - @RequestParam(required = false) Integer correctAge){ | |
| 156 | - return babyCheckFacade.queryHWByHeight(height, weight, sex, birth, correctAge); | |
| 155 | + @RequestParam(required = false) String dueDate, | |
| 156 | + @RequestParam(required = false) String checkDate){ | |
| 157 | + return babyCheckFacade.queryHWByHeight(height, weight, sex, birth, dueDate,checkDate); | |
| 157 | 158 | |
| 158 | 159 | } |
| 159 | 160 | |
| ... | ... | @@ -172,8 +173,9 @@ |
| 172 | 173 | @RequestParam(required = true) Integer type, |
| 173 | 174 | @RequestParam(required = true) String birth, |
| 174 | 175 | @RequestParam(required = false) String babyId, |
| 175 | - @RequestParam(required = false) Integer correctAge){ | |
| 176 | - return babyCheckFacade.queryBabyHealthStatus(birth, value, sex, type, correctAge, babyId); | |
| 176 | + @RequestParam(required = false) String dueDate, | |
| 177 | + @RequestParam(required = false) String checkDate){ | |
| 178 | + return babyCheckFacade.queryBabyHealthStatus(birth, value, sex, type, dueDate, babyId,checkDate); | |
| 177 | 179 | |
| 178 | 180 | } |
| 179 | 181 | |
| ... | ... | @@ -190,8 +192,9 @@ |
| 190 | 192 | @ResponseBody |
| 191 | 193 | public BaseObjectResponse queryGrowthEvaluate(@RequestParam(required = true) Double height,@RequestParam(required = true) Integer sex |
| 192 | 194 | ,@RequestParam(required = true) String birth,@RequestParam(required = true) Double weight, |
| 193 | - @RequestParam(required = false) Integer correctAge){ | |
| 194 | - return babyCheckFacade.queryGrowthEvaluate(height, sex, birth, weight, correctAge); | |
| 195 | + @RequestParam(required = false) String dueDate, | |
| 196 | + @RequestParam(required = false) String checkDate){ | |
| 197 | + return babyCheckFacade.queryGrowthEvaluate(height, sex, birth, weight, dueDate,checkDate); | |
| 195 | 198 | |
| 196 | 199 | } |
| 197 | 200 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
5d97f79
| ... | ... | @@ -1393,10 +1393,10 @@ |
| 1393 | 1393 | * @param sex |
| 1394 | 1394 | * @return |
| 1395 | 1395 | */ |
| 1396 | - public BaseObjectResponse queryHWByHeight(Double height, Double weight, Integer sex, String birth,Integer correctAge) { | |
| 1396 | + public BaseObjectResponse queryHWByHeight(Double height, Double weight, Integer sex, String birth, String dueDate,String checkDate) { | |
| 1397 | 1397 | |
| 1398 | 1398 | |
| 1399 | - String res = getBabyHW(height, weight, sex, birth,correctAge); | |
| 1399 | + String res = getBabyHW(height, weight, sex, birth, dueDate,checkDate); | |
| 1400 | 1400 | BaseObjectResponse br = new BaseObjectResponse(); |
| 1401 | 1401 | br.setData(res); |
| 1402 | 1402 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 1403 | 1403 | |
| 1404 | 1404 | |
| 1405 | 1405 | |
| ... | ... | @@ -1405,15 +1405,24 @@ |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | |
| 1408 | - public String getBabyHW(Double height, Double weight, Integer sex, String birth,Integer correctAge) { | |
| 1408 | + public String getBabyHW(Double height, Double weight, Integer sex, String birth,String dueDate,String checkDate) { | |
| 1409 | 1409 | Double hw = getHw(height); |
| 1410 | 1410 | |
| 1411 | + int monthAge = 0; | |
| 1412 | + if (StringUtils.isNotEmpty(dueDate)) | |
| 1413 | + { | |
| 1414 | + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate)); | |
| 1415 | + if (monthAge < 0) | |
| 1416 | + { | |
| 1417 | + monthAge = 0; | |
| 1418 | + } | |
| 1419 | + } | |
| 1420 | + else | |
| 1421 | + { | |
| 1422 | + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate)); | |
| 1423 | + } | |
| 1411 | 1424 | |
| 1412 | - Date birthday = DateUtil.addDay(DateUtil.parseYMD(birth), Math.abs(correctAge == null ? 0 : correctAge)); | |
| 1413 | 1425 | |
| 1414 | - //计算儿童的月龄 | |
| 1415 | - int monthAge = DateUtil.getBabyAgeMonth(birthday, new Date()); | |
| 1416 | -// int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | |
| 1417 | 1426 | int ageType = 0; |
| 1418 | 1427 | if (monthAge > 24) { |
| 1419 | 1428 | ageType = 1; |
| 1420 | 1429 | |
| ... | ... | @@ -1487,9 +1496,9 @@ |
| 1487 | 1496 | * @param birth |
| 1488 | 1497 | * @return |
| 1489 | 1498 | */ |
| 1490 | - public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth, Double weight,Integer correctAge) { | |
| 1499 | + public BaseObjectResponse queryGrowthEvaluate(Double height, Integer sex, String birth, Double weight,String dueDate,String checkDate) { | |
| 1491 | 1500 | |
| 1492 | - List<String> list = getBabyGrowthEvaluate(height, sex, birth, weight, correctAge); | |
| 1501 | + List<String> list = getBabyGrowthEvaluate(height, sex, birth, weight, dueDate, checkDate); | |
| 1493 | 1502 | BaseObjectResponse br = new BaseObjectResponse(); |
| 1494 | 1503 | br.setData(list); |
| 1495 | 1504 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 1496 | 1505 | |
| 1497 | 1506 | |
| ... | ... | @@ -1513,16 +1522,24 @@ |
| 1513 | 1522 | * |
| 1514 | 1523 | * @return |
| 1515 | 1524 | */ |
| 1516 | - public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth, Double weight,Integer correctAge) { | |
| 1525 | + public List<String> getBabyGrowthEvaluate(Double height, Integer sex, String birth, Double weight,String dueDate,String checkDate) { | |
| 1517 | 1526 | List<String> growthEvaluate = new ArrayList<>(); |
| 1518 | 1527 | Double hw = getHw(height); |
| 1519 | 1528 | |
| 1520 | - Date birthday = DateUtil.addDay(DateUtil.parseYMD(birth), Math.abs(correctAge == null ? 0 : correctAge)); | |
| 1529 | + int monthAge = 0; | |
| 1530 | + if (StringUtils.isNotEmpty(dueDate)) | |
| 1531 | + { | |
| 1532 | + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate)); | |
| 1533 | + if (monthAge < 0) | |
| 1534 | + { | |
| 1535 | + monthAge = 0; | |
| 1536 | + } | |
| 1537 | + } | |
| 1538 | + else | |
| 1539 | + { | |
| 1540 | + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate)); | |
| 1541 | + } | |
| 1521 | 1542 | |
| 1522 | - //计算儿童的月龄 | |
| 1523 | - int monthAge = DateUtil.getBabyAgeMonth(birthday, new Date()); | |
| 1524 | - | |
| 1525 | - //int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | |
| 1526 | 1543 | int ageType = 0; |
| 1527 | 1544 | if (monthAge > 24) { |
| 1528 | 1545 | ageType = 1; |
| 1529 | 1546 | |
| 1530 | 1547 | |
| ... | ... | @@ -1638,16 +1655,17 @@ |
| 1638 | 1655 | return objectResponse; |
| 1639 | 1656 | } |
| 1640 | 1657 | |
| 1641 | - public BaseObjectResponse queryBabyHealthStatus(String birth, Double value, Integer sex, Integer type,Integer correctAge,String babyId) { | |
| 1658 | + public BaseObjectResponse queryBabyHealthStatus(String birth, Double value, Integer sex, Integer type,String dueDate,String babyId, | |
| 1659 | + String checkDate) { | |
| 1642 | 1660 | String res = ""; |
| 1643 | 1661 | //体重 |
| 1644 | 1662 | if (type == 0) |
| 1645 | 1663 | { |
| 1646 | - res = getGrowthValue(birth, value, sex,correctAge,babyId); | |
| 1664 | + res = getGrowthValue(birth, value, sex,dueDate,babyId,checkDate); | |
| 1647 | 1665 | } |
| 1648 | 1666 | else |
| 1649 | 1667 | { |
| 1650 | - res = getGrowthValue1(birth, value, sex, type, correctAge); | |
| 1668 | + res = getGrowthValue1(birth, value, sex, type, dueDate,checkDate); | |
| 1651 | 1669 | } |
| 1652 | 1670 | |
| 1653 | 1671 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 1654 | 1672 | |
| 1655 | 1673 | |
| 1656 | 1674 | |
| 1657 | 1675 | |
| 1658 | 1676 | |
| 1659 | 1677 | |
| 1660 | 1678 | |
| 1661 | 1679 | |
| ... | ... | @@ -1658,33 +1676,41 @@ |
| 1658 | 1676 | } |
| 1659 | 1677 | |
| 1660 | 1678 | |
| 1661 | - public String getGrowthValue(String birth, Double value, Integer sex,Integer correctAge,String babyId) { | |
| 1679 | + public String getGrowthValue(String birth, Double value, Integer sex,String dueDate,String babyId,String checkDate) { | |
| 1662 | 1680 | |
| 1663 | 1681 | |
| 1664 | - BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 1665 | - babyQuery.setId(babyId); | |
| 1666 | - babyQuery.setYn(YnEnums.YES.getId()); | |
| 1667 | - //查询儿童的基本信息 | |
| 1668 | - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery, "created", Sort.Direction.DESC); | |
| 1682 | +// BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 1683 | +// babyQuery.setId(babyId); | |
| 1684 | +// babyQuery.setYn(YnEnums.YES.getId()); | |
| 1685 | +// //查询儿童的基本信息 | |
| 1686 | +// List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery, "created", Sort.Direction.DESC); | |
| 1669 | 1687 | |
| 1670 | 1688 | List<AwModel> list = null; |
| 1671 | - if (CollectionUtils.isNotEmpty(models) && models.get(0).getDueWeek() != null && correctAge != null) | |
| 1689 | + if (dueDate != null) | |
| 1672 | 1690 | { |
| 1673 | - Integer days = DateUtil.daysBetween(DateUtil.parseYMD(birth), new Date()); | |
| 1674 | - if (models.get(0).getDueDay() != null) | |
| 1691 | + Integer week = DateUtil.getWeek2(DateUtil.addDay(DateUtil.parseYMD(dueDate), -280),DateUtil.parseYMD(checkDate)); | |
| 1692 | + if (week < 41) | |
| 1675 | 1693 | { |
| 1676 | - days+=models.get(0).getDueDay(); | |
| 1694 | + //查询该月龄的年龄别体重值 | |
| 1695 | + list = babyCheckService.queryBabyHealthConfigWeek(week, sex, 4); | |
| 1677 | 1696 | } |
| 1678 | - Integer week = models.get(0).getDueWeek() + days/7; | |
| 1697 | + else | |
| 1698 | + { | |
| 1699 | + //计算儿童的月龄 | |
| 1700 | + int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate)); | |
| 1701 | + if (monthAge < 0) | |
| 1702 | + { | |
| 1703 | + monthAge = 0; | |
| 1704 | + } | |
| 1705 | + //查询该月龄的年龄别体重值 | |
| 1706 | + list = babyCheckService.queryBabyHealthConfig(monthAge, sex, 0); | |
| 1707 | + } | |
| 1679 | 1708 | |
| 1680 | - //查询该月龄的年龄别体重值 | |
| 1681 | - list = babyCheckService.queryBabyHealthConfigWeek(week, sex, 4); | |
| 1682 | 1709 | } |
| 1683 | 1710 | else |
| 1684 | 1711 | { |
| 1685 | - //Date birthday = DateUtil.addDay(DateUtil.parseYMD(birth),Math.abs(correctAge == null ? 0 : correctAge)); | |
| 1686 | 1712 | //计算儿童的月龄 |
| 1687 | - int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), new Date()); | |
| 1713 | + int monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate)); | |
| 1688 | 1714 | //查询该月龄的年龄别体重值 |
| 1689 | 1715 | list = babyCheckService.queryBabyHealthConfig(monthAge, sex, 0); |
| 1690 | 1716 | } |
| 1691 | 1717 | |
| ... | ... | @@ -1716,10 +1742,22 @@ |
| 1716 | 1742 | } |
| 1717 | 1743 | |
| 1718 | 1744 | |
| 1719 | - public String getGrowthValue1(String birth, Double value, Integer sex, Integer type,Integer correctAge) { | |
| 1720 | - Date birthday = DateUtil.addDay(DateUtil.parseYMD(birth),Math.abs(correctAge == null ? 0 : correctAge)); | |
| 1745 | + public String getGrowthValue1(String birth, Double value, Integer sex, | |
| 1746 | + Integer type,String dueDate,String checkDate) { | |
| 1721 | 1747 | //计算儿童的月龄 |
| 1722 | - int monthAge = DateUtil.getBabyAgeMonth(birthday, new Date()); | |
| 1748 | + int monthAge = 0; | |
| 1749 | + if (StringUtils.isNotEmpty(dueDate)) | |
| 1750 | + { | |
| 1751 | + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(dueDate), DateUtil.parseYMD(checkDate)); | |
| 1752 | + if (monthAge < 0) | |
| 1753 | + { | |
| 1754 | + monthAge = 0; | |
| 1755 | + } | |
| 1756 | + } | |
| 1757 | + else | |
| 1758 | + { | |
| 1759 | + monthAge = DateUtil.getBabyAgeMonth(DateUtil.parseYMD(birth), DateUtil.parseYMD(checkDate)); | |
| 1760 | + } | |
| 1723 | 1761 | |
| 1724 | 1762 | |
| 1725 | 1763 | //查询该月龄的年龄别体重值 |