Commit 26537ca8d0adbfcf449f53f0f3c10c24d514c681
1 parent
c89e76ffca
Exists in
master
and in
6 other branches
update
Showing 3 changed files with 145 additions and 3 deletions
platform-dal/src/main/java/com/lyms/platform/query/BabyHighRiskBabyModelQuery.java
View file @
26537ca
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | import org.apache.commons.collections.CollectionUtils; |
| 10 | 10 | import org.springframework.data.mongodb.core.query.Criteria; |
| 11 | 11 | |
| 12 | +import java.util.Arrays; | |
| 12 | 13 | import java.util.Date; |
| 13 | 14 | import java.util.List; |
| 14 | 15 | |
| 15 | 16 | |
| ... | ... | @@ -23,7 +24,10 @@ |
| 23 | 24 | private Integer yn; |
| 24 | 25 | //儿童建档ID |
| 25 | 26 | private String buildId; |
| 27 | + //建档IDs | |
| 28 | + private String[] buildIds; | |
| 26 | 29 | private String hospitalId; |
| 30 | + | |
| 27 | 31 | //月龄 |
| 28 | 32 | private Integer monthStart; |
| 29 | 33 | private Integer monthEnd; |
| ... | ... | @@ -101,6 +105,14 @@ |
| 101 | 105 | this.type = type; |
| 102 | 106 | } |
| 103 | 107 | |
| 108 | + public String[] getBuildIds() { | |
| 109 | + return buildIds; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setBuildIds(String[] buildIds) { | |
| 113 | + this.buildIds = buildIds; | |
| 114 | + } | |
| 115 | + | |
| 104 | 116 | public String getcCOutcome() { |
| 105 | 117 | return cCOutcome; |
| 106 | 118 | } |
| ... | ... | @@ -286,6 +298,10 @@ |
| 286 | 298 | if (StringUtils.isNotEmpty(buildId)) { |
| 287 | 299 | |
| 288 | 300 | condition = condition.and("buildId", buildId, MongoOper.IS); |
| 301 | + } | |
| 302 | + if(null!=buildIds && buildIds.length > 0){ | |
| 303 | + Criteria c = Criteria.where("buildId").in(Arrays.asList(buildIds)); | |
| 304 | + condition.andCondition( new MongoCondition(c)); | |
| 289 | 305 | } |
| 290 | 306 | if (StringUtils.isNotEmpty(hospitalId)) { |
| 291 | 307 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHighRiskBabyController.java
View file @
26537ca
| ... | ... | @@ -27,7 +27,20 @@ |
| 27 | 27 | |
| 28 | 28 | @Autowired |
| 29 | 29 | private BabyHighRiskBabyFacade babyHighRiskBabyFacade; |
| 30 | - | |
| 30 | + /** | |
| 31 | + * 高危儿专科检查曲线图 | |
| 32 | + * | |
| 33 | + * @param babyId | |
| 34 | + * @param request | |
| 35 | + * @return | |
| 36 | + */ | |
| 37 | + @RequestMapping(method = RequestMethod.GET, value = "/getBabyCurve") | |
| 38 | + @ResponseBody | |
| 39 | + @TokenRequired | |
| 40 | + public BaseResponse getBabyCurve(@RequestParam(required = true) String babyId, HttpServletRequest request) { | |
| 41 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 42 | + return babyHighRiskBabyFacade.getBabyCurve(babyId, loginState.getId()); | |
| 43 | + } | |
| 31 | 44 | |
| 32 | 45 | /** |
| 33 | 46 | * 高危儿专科 添加或者修改 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHighRiskBabyFacade.java
View file @
26537ca
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
| 4 | 4 | import com.lyms.platform.biz.service.BabyHighRiskBabyService; |
| 5 | +import com.lyms.platform.biz.service.BabyService; | |
| 5 | 6 | import com.lyms.platform.biz.service.BasicConfigService; |
| 6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | 8 | import com.lyms.platform.common.enums.OptActionEnums; |
| ... | ... | @@ -30,6 +31,7 @@ |
| 30 | 31 | import org.springframework.stereotype.Component; |
| 31 | 32 | |
| 32 | 33 | import java.util.*; |
| 34 | +import java.util.regex.Pattern; | |
| 33 | 35 | |
| 34 | 36 | /** |
| 35 | 37 | * 高危儿专科 逻辑处理 |
| 36 | 38 | |
| 37 | 39 | |
| ... | ... | @@ -44,12 +46,12 @@ |
| 44 | 46 | private BabyHighRiskBabyService babyHighRiskBabyService; |
| 45 | 47 | @Autowired |
| 46 | 48 | private BabyDepartmentReferralFacade babyDepartmentReferralFacade; |
| 47 | - | |
| 48 | 49 | @Autowired |
| 49 | 50 | private BabyBookbuildingService babyBookbuildingService; |
| 50 | 51 | @Autowired |
| 52 | + private BabyService babyService; | |
| 53 | + @Autowired | |
| 51 | 54 | private AutoMatchFacade autoMatchFacade; |
| 52 | - | |
| 53 | 55 | @Autowired |
| 54 | 56 | private OperateLogFacade operateLogFacade; |
| 55 | 57 | @Autowired |
| ... | ... | @@ -169,6 +171,117 @@ |
| 169 | 171 | return model; |
| 170 | 172 | } |
| 171 | 173 | |
| 174 | + | |
| 175 | + public BaseResponse getBabyCurve(String babyId, Integer id) { | |
| 176 | + | |
| 177 | + Map <String, Object> map = new HashMap <>(); | |
| 178 | + | |
| 179 | + List <Integer> weightTitles = new LinkedList <>(); | |
| 180 | + List <String> weightValues = new LinkedList <>(); | |
| 181 | + | |
| 182 | + List <Integer> headTitles = new LinkedList <>(); | |
| 183 | + List <String> headValues = new LinkedList <>(); | |
| 184 | + | |
| 185 | + List <Integer> heightTitles = new LinkedList <>(); | |
| 186 | + List <String> heightValues = new LinkedList <>(); | |
| 187 | + | |
| 188 | + List <Map <String, Object>> tables = new LinkedList <>(); | |
| 189 | + | |
| 190 | + BabyModel babyModel = babyService.getOneBabyById(babyId); | |
| 191 | + | |
| 192 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 193 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 194 | + | |
| 195 | + //查询建档记录 得到pid 通过pid查询所有的儿童建档记录 | |
| 196 | + babyQuery.setPid(babyModel.getPid()); | |
| 197 | + //查询建档记录 | |
| 198 | + List <BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 199 | + String[] buildIds = new String[models.size()]; | |
| 200 | + for (int i = 0; i < models.size(); i++) { | |
| 201 | + buildIds[i] = models.get(i).getId(); | |
| 202 | + } | |
| 203 | + | |
| 204 | + BabyHighRiskBabyModelQuery babyHighRiskBabyModelQuery = new BabyHighRiskBabyModelQuery(); | |
| 205 | + babyHighRiskBabyModelQuery.setYn(YnEnums.YES.getId()); | |
| 206 | + babyHighRiskBabyModelQuery.setBuildIds(buildIds); | |
| 207 | + babyHighRiskBabyModelQuery.setSort("checkDate"); | |
| 208 | + //查询高危儿专科的检查记录 | |
| 209 | + List <BabyHighRiskBabyModel> checkModels = babyHighRiskBabyService.queryOne(babyHighRiskBabyModelQuery); | |
| 210 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 211 | + for (BabyHighRiskBabyModel checkModel : checkModels) { | |
| 212 | + if (checkModel != null) { | |
| 213 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight()) | |
| 214 | + || org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight()) | |
| 215 | + || org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHead()) | |
| 216 | + ) { | |
| 217 | + int month = DateUtil.getBabyAgeMonth(babyModel.getBirth(), checkModel.getCheckDate()); | |
| 218 | + Map <String, Object> heightMap = new HashMap <>(); | |
| 219 | + heightMap.put("time", month); | |
| 220 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight())) { | |
| 221 | + if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getHeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getHeight()).matches()) { | |
| 222 | + if (heightTitles.contains(month)) { | |
| 223 | + int index = heightTitles.indexOf(month); | |
| 224 | + heightValues.set(index, checkModel.getHeight()); | |
| 225 | + } else { | |
| 226 | + heightTitles.add(month); | |
| 227 | + heightValues.add(checkModel.getHeight()); | |
| 228 | + } | |
| 229 | + } | |
| 230 | + heightMap.put("height", checkModel.getHeight()); | |
| 231 | + } else { | |
| 232 | + heightMap.put("height", "--"); | |
| 233 | + } | |
| 234 | + | |
| 235 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight())) { | |
| 236 | + if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getWeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getWeight()).matches()) { | |
| 237 | + | |
| 238 | + if (weightTitles.contains(month)) {//如果存在月的数据则更新对应索引的值 | |
| 239 | + int index = weightTitles.indexOf(month); | |
| 240 | + weightValues.set(index, checkModel.getWeight()); | |
| 241 | + } else { | |
| 242 | + weightTitles.add(month); | |
| 243 | + weightValues.add(checkModel.getWeight()); | |
| 244 | + } | |
| 245 | + } | |
| 246 | + heightMap.put("weight", checkModel.getWeight()); | |
| 247 | + } else { | |
| 248 | + heightMap.put("weight", "--"); | |
| 249 | + } | |
| 250 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHead())) { | |
| 251 | + if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getHead()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getHead()).matches()) { | |
| 252 | + | |
| 253 | + if (headTitles.contains(month)) {//如果存在月的数据则更新对应索引的值 | |
| 254 | + int index = headTitles.indexOf(month); | |
| 255 | + headValues.set(index, checkModel.getHead()); | |
| 256 | + } else { | |
| 257 | + headTitles.add(month); | |
| 258 | + headValues.add(checkModel.getHead()); | |
| 259 | + } | |
| 260 | + } | |
| 261 | + heightMap.put("head", checkModel.getHead()); | |
| 262 | + } else { | |
| 263 | + heightMap.put("head", "--"); | |
| 264 | + } | |
| 265 | + tables.add(heightMap); | |
| 266 | + } | |
| 267 | + } | |
| 268 | + } | |
| 269 | + } | |
| 270 | + map.put("weightTitles", weightTitles); | |
| 271 | + map.put("weightValues", weightValues); | |
| 272 | + | |
| 273 | + map.put("headTitles", headTitles); | |
| 274 | + map.put("headValues", headValues); | |
| 275 | + | |
| 276 | + map.put("heightTitles", heightTitles); | |
| 277 | + map.put("heightValues", heightValues); | |
| 278 | + | |
| 279 | + map.put("tables", tables); | |
| 280 | + if (babyModel != null) { | |
| 281 | + map.put("sex", babyModel.getSex()); | |
| 282 | + } | |
| 283 | + return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 284 | + } | |
| 172 | 285 | /** |
| 173 | 286 | * 新增 高危儿专科 |
| 174 | 287 | */ |