Commit 29d4a7fa799490c008bed818afd8e975fb6d9db1

Authored by liquanyu
1 parent 2fbc1834de

儿童查询

Showing 1 changed file with 76 additions and 9 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java View file @ 29d4a7f
... ... @@ -1623,15 +1623,8 @@
1623 1623 babyQuery.setName(request.getName());
1624 1624 babyQuery.setMphone(request.getMphone());
1625 1625 Date currentDate = DateUtil.formatDate(new Date());
1626   - if (request.getMonthAgeStart() != null) {
1627   - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
1628   - babyQuery.setBirthEnd(start);
1629   - }
1630   - if(request.getMonthAgeEnd() != null){
1631   - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
1632   - babyQuery.setBirthStart(end);
1633   - }
1634 1626  
  1627 +
1635 1628 // if (StringUtils.isNotEmpty(request.getDiagnose()))
1636 1629 // {
1637 1630 // BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
1638 1631  
1639 1632  
1640 1633  
... ... @@ -1663,12 +1656,86 @@
1663 1656 }
1664 1657 }
1665 1658  
1666   - if (StringUtils.isNotEmpty(request.getBirth())) {
  1659 + if(StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null)
  1660 + {
  1661 +
  1662 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
1667 1663 String birthStr = request.getBirth();
1668 1664 String[] dates = birthStr.split(" - ");
  1665 +
  1666 + if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime())
  1667 + {
  1668 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1669 +
  1670 + }
  1671 + else
  1672 + {
  1673 + babyQuery.setBirthEnd(start);
  1674 + }
  1675 +
  1676 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1677 +
  1678 + if (DateUtil.parseYMD(dates[0]).getTime() < end.getTime())
  1679 + {
  1680 + babyQuery.setBirthStart(end);
  1681 + }
  1682 + else
  1683 + {
  1684 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1685 + }
  1686 + }
  1687 + else if (StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null )
  1688 + {
  1689 +
  1690 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1691 + String birthStr = request.getBirth();
  1692 + String[] dates = birthStr.split(" - ");
  1693 +
  1694 + if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime())
  1695 + {
  1696 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1697 + }
  1698 + else
  1699 + {
  1700 + babyQuery.setBirthEnd(start);
  1701 + }
  1702 +
1669 1703 babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1704 +
  1705 + }
  1706 + else if (StringUtils.isNotEmpty(request.getBirth()))
  1707 + {
  1708 + String birthStr = request.getBirth();
  1709 + String[] dates = birthStr.split(" - ");
  1710 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
1670 1711 babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
1671 1712 }
  1713 + else if (request.getMonthAgeStart() != null)
  1714 + {
  1715 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1716 + babyQuery.setBirthEnd(start);
  1717 + }
  1718 + else if (request.getMonthAgeEnd() != null)
  1719 + {
  1720 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1721 + babyQuery.setBirthStart(end);
  1722 + }
  1723 +
  1724 +// if (request.getMonthAgeStart() != null) {
  1725 +// Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1726 +// babyQuery.setBirthEnd(start);
  1727 +// }
  1728 +// if(request.getMonthAgeEnd() != null){
  1729 +// Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1730 +// babyQuery.setBirthStart(end);
  1731 +// }
  1732 +
  1733 +// if (StringUtils.isNotEmpty(request.getBirth())) {
  1734 +// String birthStr = request.getBirth();
  1735 +// String[] dates = birthStr.split(" - ");
  1736 +// babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1737 +// babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1738 +// }
1672 1739  
1673 1740  
1674 1741 if (request.getServiceType() != null && request.getServiceType() != 100) {