Commit 0b46f49cc3d2984d080ffea6ef502c4078126a94
1 parent
76dfe4e91d
Exists in
master
and in
7 other branches
儿童统计
Showing 7 changed files with 126 additions and 37 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java
- platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
0b46f49
| ... | ... | @@ -836,7 +836,9 @@ |
| 836 | 836 | // Date startDate = getRangeDate(parseYMD("2016-09-07"),2,"周",-1); |
| 837 | 837 | // System.out.println(getyyyy_MM_dd(startDate)); |
| 838 | 838 | |
| 839 | - int a = daysBetween(parseYMD("2016-10-01"),new Date())/7; | |
| 839 | + | |
| 840 | + int a = getBabyAgeMonth(parseYMD("2012-10-01"),parseYMD("2016-10-01")); | |
| 841 | +// int a = daysBetween(parseYMD("2016-10-01"),new Date())/7; | |
| 840 | 842 | System.out.println(a); |
| 841 | 843 | |
| 842 | 844 | // Date dueDate = DateUtil.addDay(DateUtil.addMonth(parseYMD("2016-02-08"), 9), 7); |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java
View file @
0b46f49
| ... | ... | @@ -234,6 +234,17 @@ |
| 234 | 234 | |
| 235 | 235 | private Date birth; |
| 236 | 236 | |
| 237 | + //检查月龄 | |
| 238 | + private Integer checkMonth; | |
| 239 | + | |
| 240 | + public Integer getCheckMonth() { | |
| 241 | + return checkMonth; | |
| 242 | + } | |
| 243 | + | |
| 244 | + public void setCheckMonth(Integer checkMonth) { | |
| 245 | + this.checkMonth = checkMonth; | |
| 246 | + } | |
| 247 | + | |
| 237 | 248 | public Date getBirth() { |
| 238 | 249 | return birth; |
| 239 | 250 | } |
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java
View file @
0b46f49
| ... | ... | @@ -54,8 +54,11 @@ |
| 54 | 54 | private Date checkDateStart; |
| 55 | 55 | private Date checkDateEnd; |
| 56 | 56 | |
| 57 | + private Integer checkMonthStart; | |
| 58 | + private Integer checkMonthEnd; | |
| 57 | 59 | |
| 58 | 60 | |
| 61 | + | |
| 59 | 62 | @Override |
| 60 | 63 | public MongoQuery convertToQuery() { |
| 61 | 64 | MongoCondition condition = MongoCondition.newInstance(); |
| 62 | 65 | |
| ... | ... | @@ -121,11 +124,44 @@ |
| 121 | 124 | } |
| 122 | 125 | } |
| 123 | 126 | |
| 127 | + if (null != checkMonthStart) { | |
| 128 | + if (null != c) { | |
| 129 | + c = c.and("checkMonth").gte(checkMonthStart); | |
| 130 | + } else { | |
| 131 | + c = Criteria.where("checkMonth").gte(checkMonthStart); | |
| 132 | + } | |
| 133 | + } | |
| 134 | + | |
| 135 | + if (null != checkMonthEnd) { | |
| 136 | + if (null != c) { | |
| 137 | + c = c.lte(checkMonthEnd); | |
| 138 | + } else { | |
| 139 | + c = Criteria.where("checkMonth").lte(checkMonthEnd); | |
| 140 | + } | |
| 141 | + } | |
| 142 | + | |
| 143 | + | |
| 124 | 144 | if (c != null) { |
| 125 | 145 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
| 126 | 146 | } |
| 127 | 147 | |
| 128 | 148 | return condition.toMongoQuery(); |
| 149 | + } | |
| 150 | + | |
| 151 | + public Integer getCheckMonthStart() { | |
| 152 | + return checkMonthStart; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public void setCheckMonthStart(Integer checkMonthStart) { | |
| 156 | + this.checkMonthStart = checkMonthStart; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public Integer getCheckMonthEnd() { | |
| 160 | + return checkMonthEnd; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public void setCheckMonthEnd(Integer checkMonthEnd) { | |
| 164 | + this.checkMonthEnd = checkMonthEnd; | |
| 129 | 165 | } |
| 130 | 166 | |
| 131 | 167 | public String getHospitalId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
View file @
0b46f49
| 1 | 1 | package com.lyms.platform.operate.web; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.enums.YnEnums; |
| 4 | -import com.lyms.platform.common.utils.DateUtil; | |
| 5 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 6 | -import com.lyms.platform.common.utils.MongoConvertHelper; | |
| 7 | -import com.lyms.platform.common.utils.ReflectionUtils; | |
| 4 | +import com.lyms.platform.common.utils.*; | |
| 8 | 5 | import com.lyms.platform.operate.web.result.HighScoreResult; |
| 9 | 6 | import com.lyms.platform.permission.model.Users; |
| 10 | 7 | import com.lyms.platform.permission.service.UsersService; |
| 11 | 8 | import com.lyms.platform.pojo.Patients; |
| 12 | 9 | import com.lyms.platform.query.AntExChuQuery; |
| 10 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
| 13 | 11 | import com.lyms.platform.query.PatientsQuery; |
| 14 | 12 | import org.springframework.context.ApplicationContext; |
| 15 | 13 | import org.springframework.context.support.ClassPathXmlApplicationContext; |
| ... | ... | @@ -26,7 +24,7 @@ |
| 26 | 24 | public class Test { |
| 27 | 25 | |
| 28 | 26 | public static void main(String[] args) { |
| 29 | - PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 27 | +// PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 30 | 28 | // patientsQuery1.setHospitalId("221"); |
| 31 | 29 | // patientsQuery1.setYn(YnEnums.YES.getId()); |
| 32 | 30 | // patientsQuery1.setType(1); |
| 33 | 31 | |
| 34 | 32 | |
| ... | ... | @@ -62,33 +60,33 @@ |
| 62 | 60 | // patientsQuery1.setType(1); |
| 63 | 61 | // |
| 64 | 62 | |
| 65 | - patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 66 | - patientsQuery1.setType(1); | |
| 63 | +// patientsQuery1.setYn(YnEnums.YES.getId()); | |
| 64 | +// patientsQuery1.setType(1); | |
| 65 | +// | |
| 66 | +//// Date end = DateUtil.addDay(new Date(), 0); | |
| 67 | +// | |
| 68 | +// Date start = DateUtil.addDay(new Date(), -100); | |
| 69 | +// | |
| 70 | +// | |
| 71 | +// patientsQuery1.setLastMensesStart(start); | |
| 72 | +//// patientsQuery1.setLastMensesEnd(end); | |
| 73 | +// | |
| 74 | +// | |
| 75 | +// Date date1 = DateUtil.addYear(new Date(), -18); | |
| 76 | +//// patientsQuery1.setBirthEnd(date1); | |
| 77 | +// Date date2 = DateUtil.addYear(new Date(), -30); | |
| 78 | +// date2 = DateUtil.addYear(date2, -1); | |
| 79 | +// | |
| 80 | +// patientsQuery1.setBirthStart(DateUtil.addDay(date2, 1)); | |
| 81 | +// List buildType = new ArrayList(); | |
| 82 | +// buildType.add(0); | |
| 83 | +// buildType.add(2); | |
| 84 | +// patientsQuery1.setBuildTypeList(buildType); | |
| 85 | +// | |
| 86 | +// | |
| 87 | +// System.out.println(patientsQuery1.convertToQuery().convertToMongoQuery()); | |
| 67 | 88 | |
| 68 | -// Date end = DateUtil.addDay(new Date(), 0); | |
| 69 | 89 | |
| 70 | - Date start = DateUtil.addDay(new Date(), -100); | |
| 71 | - | |
| 72 | - | |
| 73 | - patientsQuery1.setLastMensesStart(start); | |
| 74 | -// patientsQuery1.setLastMensesEnd(end); | |
| 75 | - | |
| 76 | - | |
| 77 | - Date date1 = DateUtil.addYear(new Date(), -18); | |
| 78 | -// patientsQuery1.setBirthEnd(date1); | |
| 79 | - Date date2 = DateUtil.addYear(new Date(), -30); | |
| 80 | - date2 = DateUtil.addYear(date2, -1); | |
| 81 | - | |
| 82 | - patientsQuery1.setBirthStart(DateUtil.addDay(date2, 1)); | |
| 83 | - List buildType = new ArrayList(); | |
| 84 | - buildType.add(0); | |
| 85 | - buildType.add(2); | |
| 86 | - patientsQuery1.setBuildTypeList(buildType); | |
| 87 | - | |
| 88 | - | |
| 89 | - System.out.println(patientsQuery1.convertToQuery().convertToMongoQuery()); | |
| 90 | - | |
| 91 | - | |
| 92 | 90 | /* |
| 93 | 91 | |
| 94 | 92 | { |
| ... | ... | @@ -213,6 +211,38 @@ |
| 213 | 211 | } |
| 214 | 212 | |
| 215 | 213 | */ |
| 214 | + | |
| 215 | + | |
| 216 | + BabyCheckModelQuery babyQuery = new BabyCheckModelQuery(); | |
| 217 | + babyQuery.setHospitalId("216"); | |
| 218 | + | |
| 219 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 220 | + Date currentDate = DateUtil.formatDate(new Date()); | |
| 221 | + | |
| 222 | +// String birth="2016-02-01 - 2016-05-01"; | |
| 223 | + Integer monthAgeStart = 1; | |
| 224 | + Integer monthAgeEnd = 1; | |
| 225 | + | |
| 226 | +// if (StringUtils.isNotEmpty(birth)) | |
| 227 | +// { | |
| 228 | +// String birthStr = birth; | |
| 229 | +// String[] dates = birthStr.split(" - "); | |
| 230 | +// babyQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
| 231 | +// babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1])); | |
| 232 | +// } | |
| 233 | + if (monthAgeStart != null) | |
| 234 | + { | |
| 235 | + Date start = DateUtil.addMonth(currentDate, -monthAgeStart); | |
| 236 | + babyQuery.setCheckDateEnd(start); | |
| 237 | + } | |
| 238 | + if (monthAgeEnd != null) | |
| 239 | + { | |
| 240 | + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -monthAgeEnd - 1), 1); | |
| 241 | + babyQuery.setCheckDateStart(end); | |
| 242 | + } | |
| 243 | + | |
| 244 | + | |
| 245 | + System.out.println(babyQuery.convertToQuery().convertToMongoQuery()); | |
| 216 | 246 | |
| 217 | 247 | |
| 218 | 248 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
0b46f49
| ... | ... | @@ -796,6 +796,8 @@ |
| 796 | 796 | } |
| 797 | 797 | checkModel.setHospitalId(checkModel.getHospitalId()); |
| 798 | 798 | checkModel.setBirth(babyModel.getBirth()); |
| 799 | + | |
| 800 | + checkModel.setCheckMonth(DateUtil.getBabyAgeMonth(babyModel.getBirth(), checkModel.getCheckDate())); | |
| 799 | 801 | babyCheckService.updateBabyCheck(checkModel,checkModel.getId()); |
| 800 | 802 | } |
| 801 | 803 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
0b46f49
| ... | ... | @@ -2215,7 +2215,6 @@ |
| 2215 | 2215 | babyQuery.setHospitalId(hospitalId); |
| 2216 | 2216 | |
| 2217 | 2217 | babyQuery.setYn(YnEnums.YES.getId()); |
| 2218 | - Date currentDate = DateUtil.formatDate(new Date()); | |
| 2219 | 2218 | |
| 2220 | 2219 | if (StringUtils.isNotEmpty(request.getBirth())) |
| 2221 | 2220 | { |
| 2222 | 2221 | |
| ... | ... | @@ -2226,13 +2225,11 @@ |
| 2226 | 2225 | } |
| 2227 | 2226 | if (request.getMonthAgeStart() != null) |
| 2228 | 2227 | { |
| 2229 | - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); | |
| 2230 | - babyQuery.setCheckDateEnd(start); | |
| 2228 | + babyQuery.setCheckMonthStart(request.getMonthAgeStart()); | |
| 2231 | 2229 | } |
| 2232 | 2230 | if (request.getMonthAgeEnd() != null) |
| 2233 | 2231 | { |
| 2234 | - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1); | |
| 2235 | - babyQuery.setCheckDateStart(end); | |
| 2232 | + babyQuery.setCheckMonthEnd(request.getMonthAgeEnd()); | |
| 2236 | 2233 | } |
| 2237 | 2234 | |
| 2238 | 2235 | babyQuery.setPage(page); |
| ... | ... | @@ -2283,7 +2280,7 @@ |
| 2283 | 2280 | map.put("height",checkModel.getHeight()); //身长 |
| 2284 | 2281 | map.put("weight", checkModel.getWeight()); //体重 |
| 2285 | 2282 | StringBuffer sb = new StringBuffer(); |
| 2286 | - if (StringUtils.isNotEmpty(checkModel.getGrowthEvaluate()) && "[null]".equals(checkModel.getGrowthEvaluate())) | |
| 2283 | + if (StringUtils.isNotEmpty(checkModel.getGrowthEvaluate()) && "[\"null\"]".equals(checkModel.getGrowthEvaluate())) | |
| 2287 | 2284 | { |
| 2288 | 2285 | List<String> items = JsonUtil.toList(checkModel.getGrowthEvaluate(),String.class); |
| 2289 | 2286 | if (CollectionUtils.isNotEmpty(items)) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
0b46f49
| ... | ... | @@ -189,6 +189,17 @@ |
| 189 | 189 | model.setHeadEvaluate(request.getHeadEvaluate()); |
| 190 | 190 | model.setHeightEvaluate(request.getHeightEvaluate()); |
| 191 | 191 | |
| 192 | + if (StringUtils.isNotEmpty(request.getBuildId())) | |
| 193 | + { | |
| 194 | + BabyModelQuery babyModelQuery=new BabyModelQuery(); | |
| 195 | + babyModelQuery.setId(request.getBuildId()); | |
| 196 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 197 | + List<BabyModel> babyModelList= babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 198 | + if(CollectionUtils.isNotEmpty(babyModelList)){ | |
| 199 | + model.setCheckMonth(DateUtil.getBabyAgeMonth(babyModelList.get(0).getBirth(),DateUtil.parseYMD(request.getCheckDate()))); | |
| 200 | + } | |
| 201 | + } | |
| 202 | + | |
| 192 | 203 | return model; |
| 193 | 204 | } |
| 194 | 205 |