Commit b2dab2c848cfd8b5cf1973ed99afaf911bb7ee9c
1 parent
67ec4f8f5d
Exists in
master
and in
6 other branches
纠正月龄
Showing 2 changed files with 76 additions and 24 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyCheckController.java
View file @
b2dab2c
... | ... | @@ -153,7 +153,7 @@ |
153 | 153 | @RequestParam(required = true) Integer sex, |
154 | 154 | @RequestParam(required = true) String birth, |
155 | 155 | @RequestParam(required = false) Integer correctAge){ |
156 | - return babyCheckFacade.queryHWByHeight(height, weight, sex, birth,correctAge); | |
156 | + return babyCheckFacade.queryHWByHeight(height, weight, sex, birth, correctAge); | |
157 | 157 | |
158 | 158 | } |
159 | 159 | |
... | ... | @@ -173,7 +173,7 @@ |
173 | 173 | @RequestParam(required = true) String birth, |
174 | 174 | @RequestParam(required = false) String babyId, |
175 | 175 | @RequestParam(required = false) Integer correctAge){ |
176 | - return babyCheckFacade.queryBabyHealthStatus(birth, value, sex, type,correctAge,babyId); | |
176 | + return babyCheckFacade.queryBabyHealthStatus(birth, value, sex, type, correctAge, babyId); | |
177 | 177 | |
178 | 178 | } |
179 | 179 | |
... | ... | @@ -216,6 +216,16 @@ |
216 | 216 | |
217 | 217 | } |
218 | 218 | |
219 | + | |
220 | + @RequestMapping(value = "/getHighBabyMonthAge", method = RequestMethod.GET) | |
221 | + @ResponseBody | |
222 | + public BaseObjectResponse getHighBabyMonthAge( | |
223 | + @RequestParam(required = true) String babyId, | |
224 | + @RequestParam(required = true) String checkDate, | |
225 | + @RequestParam(required = true) Boolean isHighRisk){ | |
226 | + return babyCheckFacade.getHighBabyMonthAge(babyId,checkDate,isHighRisk); | |
227 | + | |
228 | + } | |
219 | 229 | |
220 | 230 | |
221 | 231 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
b2dab2c
... | ... | @@ -788,6 +788,12 @@ |
788 | 788 | if (model.getDueDate() == null || ymdBirth.getTime() == model.getDueDate().getTime()) {//预产期为空或者预产期与生日一致进行计算真实预产期 |
789 | 789 | //根据出生孕周计算末次月经 |
790 | 790 | Date LastMens = DateUtil.addWeek(model.getBirth(), -model.getDueWeek()); |
791 | + | |
792 | + if (model.getDueDay() != null) | |
793 | + { | |
794 | + LastMens = DateUtil.addDay(LastMens,-model.getDueDay()); | |
795 | + } | |
796 | + | |
791 | 797 | //根据末次月经计算预产期 |
792 | 798 | // Date dueDate = DateUtil.addMonth(LastMens, 9); |
793 | 799 | // dueDate = DateUtil.addDay(dueDate, 7); |
... | ... | @@ -797,28 +803,6 @@ |
797 | 803 | } else { |
798 | 804 | base.setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate())); |
799 | 805 | } |
800 | -// | |
801 | -// String c = ""; | |
802 | -// if (model.getDueWeek() != null) | |
803 | -// { | |
804 | -// Integer days = model.getDueWeek()*7 + (model.getDueDay() == null ? 0 : model.getDueDay()); | |
805 | -// if ((DateUtil.daysBetween(model.getBirth(),new Date())+days) < 280) | |
806 | -// { | |
807 | -// base.setIsCorrectMonthAge(1); | |
808 | -// //纠正胎龄 | |
809 | -// c = "孕"+(days/7)+"周"+(days%7 == 0 ? "" : days%7+"天"); | |
810 | -// } | |
811 | -// else | |
812 | -// { | |
813 | -// //纠正月龄 | |
814 | -// if (StringUtils.isNotEmpty(base.getDueDate())) | |
815 | -// { | |
816 | -// base.setIsCorrectMonthAge(2); | |
817 | -// DateUtil.getMonthDesc(DateUtil.parseYMD(base.getDueDate()),new Date()); | |
818 | -// } | |
819 | -// } | |
820 | -// } | |
821 | -// base.setCorrectValue(c); | |
822 | 806 | } |
823 | 807 | |
824 | 808 | |
... | ... | @@ -1936,5 +1920,63 @@ |
1936 | 1920 | return new BaseObjectResponse().setData(list).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
1937 | 1921 | } |
1938 | 1922 | |
1923 | + public BaseObjectResponse getHighBabyMonthAge(String babyId, String checkDate, Boolean isHighRisk) { | |
1924 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
1925 | + babyQuery.setId(babyId); | |
1926 | + babyQuery.setDataStatus(false); | |
1927 | + | |
1928 | + Map result = new HashMap(); | |
1929 | + //查询儿童的基本信息 | |
1930 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
1931 | + if (CollectionUtils.isNotEmpty(models)) { | |
1932 | + BabyModel model = models.get(0); | |
1933 | + //计算儿童的预产期 | |
1934 | + //早产儿,根据出生孕周计算末次月经,在根据末次月经计算预产期 | |
1935 | + if (model.getBirth() != null && model.getDueWeek() != null) { | |
1936 | + //Date ymdBirth =DateUtil.formatDate(model.getBirth()); | |
1937 | + | |
1938 | + //根据出生孕周计算末次月经 | |
1939 | + Date lastMens = DateUtil.addWeek(model.getBirth(), -model.getDueWeek()); | |
1940 | + if (model.getDueDay() != null) { | |
1941 | + lastMens = DateUtil.addDay(lastMens, -model.getDueDay()); | |
1942 | + } | |
1943 | + | |
1944 | + Date dueDate = DateUtil.addDay(lastMens, 280); | |
1945 | + String correctValue = ""; | |
1946 | + | |
1947 | + if (model.getDueWeek() < 37) | |
1948 | + { | |
1949 | + | |
1950 | + Integer days = model.getDueWeek()*7 + (model.getDueDay() == null ? 0 : model.getDueDay()); | |
1951 | + if ((DateUtil.daysBetween(model.getBirth(),DateUtil.parseYMD(checkDate))+days) < 280) | |
1952 | + { | |
1953 | + result.put("isCorrectMonthAge", 1); | |
1954 | + //纠正胎龄 | |
1955 | + correctValue = "孕"+(days/7)+"周"+(days%7 == 0 ? "" : days%7+"天"); | |
1956 | + } | |
1957 | + else | |
1958 | + { | |
1959 | + //纠正月龄 | |
1960 | + if (dueDate != null) | |
1961 | + { | |
1962 | + result.put("isCorrectMonthAge",2); | |
1963 | + correctValue = DateUtil.getMonthDesc(dueDate,DateUtil.parseYMD(checkDate)); | |
1964 | + } | |
1965 | + } | |
1966 | + } | |
1967 | + else if (isHighRisk) | |
1968 | + { | |
1969 | + //纠正月龄 | |
1970 | + if (dueDate != null) | |
1971 | + { | |
1972 | + result.put("isCorrectMonthAge",2); | |
1973 | + correctValue = DateUtil.getMonthDesc(dueDate,DateUtil.parseYMD(checkDate)); | |
1974 | + } | |
1975 | + } | |
1976 | + result.put("correctValue",correctValue); | |
1977 | + } | |
1978 | + } | |
1979 | + return new BaseObjectResponse().setData(result).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
1980 | + } | |
1939 | 1981 | } |