Commit 9865f267520be93ac7248f94a9a91b8cfd1fb176
1 parent
cc0f987bf9
Exists in
master
and in
1 other branch
儿童检查
Showing 7 changed files with 172 additions and 59 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyCheckDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyCheckDao.java
View file @
9865f26
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java
View file @
9865f26
1 | 1 | package com.lyms.platform.biz.dal.impl; |
2 | 2 | |
3 | -import com.lyms.platform.biz.dal.IBabyBookBuildingDao; | |
4 | 3 | import com.lyms.platform.biz.dal.IBabyCheckDao; |
5 | 4 | import com.lyms.platform.common.dao.BaseMongoDAOImpl; |
6 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; |
7 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
8 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
8 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
9 | 9 | import com.lyms.platform.pojo.BabyCheckModel; |
10 | -import com.lyms.platform.pojo.BabyModel; | |
11 | -import com.lyms.platform.pojo.HwModel; | |
12 | -import com.lyms.platform.query.BabyCheckModelQuery; | |
10 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
11 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
12 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
13 | +import org.springframework.data.mongodb.core.query.Criteria; | |
13 | 14 | import org.springframework.stereotype.Repository; |
14 | 15 | |
15 | 16 | import java.util.List; |
... | ... | @@ -35,6 +36,17 @@ |
35 | 36 | @Override |
36 | 37 | public List<BabyCheckModel> queryBabyCheckRecord(MongoQuery query) { |
37 | 38 | return find(query.convertToMongoQuery()); |
39 | + } | |
40 | + | |
41 | + @Override | |
42 | + public List<BabyCheckModel> queryLastCheck(List<String> ids) { | |
43 | + | |
44 | + AggregationOperation match = Aggregation.match(Criteria.where("buildId").in(ids).and("yn").is(1)); | |
45 | + AggregationOperation group = Aggregation.group("_id","diagnose").max("modified").as("modified"); | |
46 | + AggregationOperation fields = Aggregation.project("_id", "diagnose"); | |
47 | + Aggregation aggregation = Aggregation.newAggregation(match, group,fields); | |
48 | + AggregationResults<BabyCheckModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_babycheck", BabyCheckModel.class); | |
49 | + return result.getMappedResults(); | |
38 | 50 | } |
39 | 51 | |
40 | 52 |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
View file @
9865f26
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | @Override |
68 | 68 | public Patients findLastBuildRecord(String pid, int yn) { |
69 | 69 | AggregationOperation match = Aggregation.match(Criteria.where("pid").is(pid).and("yn").is(yn)); |
70 | - AggregationOperation group = Aggregation.group("_id","pid","dueDate").max("created").as("created"); | |
70 | + AggregationOperation group = Aggregation.group("_id","pid","dueDate").max("modified").as("modified"); | |
71 | 71 | AggregationOperation fields = Aggregation.project("_id", "pid", "dueDate"); |
72 | 72 | Aggregation aggregation = Aggregation.newAggregation(match, group,fields); |
73 | 73 | AggregationResults<Patients> result = this.mongoTemplate.aggregate(aggregation, "lyms_patient", Patients.class); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java
View file @
9865f26
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | babyQuery.mysqlBuild(babyBookBuildingDao.queryBabyManageCount(babyQuery.convertToQuery())); |
47 | 47 | query.start(babyQuery.getOffset()).end(babyQuery.getLimit()); |
48 | 48 | } |
49 | - return babyBookBuildingDao.queryBabyWithQuery(query.addOrder(Sort.Direction.DESC, "created")); | |
49 | + return babyBookBuildingDao.queryBabyWithQuery(query.addOrder(Sort.Direction.DESC, "modified")); | |
50 | 50 | } |
51 | 51 | |
52 | 52 | public int queryBabyCount(BabyModelQuery babyQuery) { |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
View file @
9865f26
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
9865f26
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
5 | 6 | import com.lyms.platform.common.enums.*; |
6 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
7 | 8 | import com.lyms.platform.common.result.BaseResponse; |
8 | 9 | |
... | ... | @@ -10,16 +11,14 @@ |
10 | 11 | import com.lyms.platform.common.utils.StringUtils; |
11 | 12 | import com.lyms.platform.common.utils.SystemConfig; |
12 | 13 | import com.lyms.platform.operate.web.request.BabyCheckRequest; |
13 | -import com.lyms.platform.operate.web.result.BabyBasicResult; | |
14 | -import com.lyms.platform.operate.web.result.BabyCheckResult; | |
15 | -import com.lyms.platform.operate.web.result.BabyChooseResult; | |
16 | -import com.lyms.platform.operate.web.result.BasicConfigResult; | |
14 | +import com.lyms.platform.operate.web.result.*; | |
17 | 15 | import com.lyms.platform.permission.model.Users; |
18 | 16 | import com.lyms.platform.permission.service.UsersService; |
19 | 17 | import com.lyms.platform.pojo.*; |
20 | 18 | import com.lyms.platform.query.*; |
21 | 19 | import org.apache.commons.collections.CollectionUtils; |
22 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | +import org.springframework.data.domain.Sort; | |
23 | 22 | import org.springframework.stereotype.Component; |
24 | 23 | |
25 | 24 | import java.util.*; |
26 | 25 | |
27 | 26 | |
... | ... | @@ -43,13 +42,15 @@ |
43 | 42 | @Autowired |
44 | 43 | private AntenatalExaminationService antenatalExaminationService; |
45 | 44 | |
45 | + @Autowired | |
46 | + private UsersService usersService; | |
46 | 47 | |
47 | 48 | @Autowired |
48 | - private AntenatalExaminationFacade antenatalExaminationFacade; | |
49 | + private PersonService personService; | |
49 | 50 | |
50 | 51 | |
51 | 52 | @Autowired |
52 | - private UsersService usersService; | |
53 | + private AntenatalExaminationFacade antenatalExaminationFacade; | |
53 | 54 | /** |
54 | 55 | * 更新检查 |
55 | 56 | * |
56 | 57 | |
... | ... | @@ -271,10 +272,10 @@ |
271 | 272 | |
272 | 273 | base.setMonthAge(DateUtil.getBabyMonthAge(model.getBirth(), new Date())); |
273 | 274 | base.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirth())); |
274 | - if (model.getDiagnose() != null) | |
275 | + if (model.getPid() != null) | |
275 | 276 | { |
276 | 277 | //诊断 |
277 | - List list = JsonUtil.toList(model.getDiagnose(), List.class); | |
278 | + List list = getBabyLastDiagnose(model.getPid()); | |
278 | 279 | List<Map> dlist = new ArrayList<>(); |
279 | 280 | if (CollectionUtils.isNotEmpty(list)) { |
280 | 281 | for (Object did : list) { |
281 | 282 | |
282 | 283 | |
283 | 284 | |
284 | 285 | |
285 | 286 | |
286 | 287 | |
287 | 288 | |
288 | 289 | |
289 | 290 | |
... | ... | @@ -298,60 +299,79 @@ |
298 | 299 | //母亲是否高危 |
299 | 300 | if (!StringUtils.isEmpty(model.getMcertNo())) |
300 | 301 | { |
301 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
302 | - patientsQuery.setCardNo(model.getMcertNo()); | |
303 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
302 | +// PatientsQuery patientsQuery = new PatientsQuery(); | |
303 | +// patientsQuery.setCardNo(model.getMcertNo()); | |
304 | +// patientsQuery.setYn(YnEnums.YES.getId()); | |
305 | +// | |
306 | +// | |
307 | +// List listHighRisk = new ArrayList(); | |
308 | +// List<Patients> list = patientsService.queryPatient(patientsQuery); | |
309 | +// Patients patients = null; | |
310 | +// if (CollectionUtils.isNotEmpty(list)) { | |
311 | +// patients = list.get(0); | |
312 | +// base.setCardNo(patients.getCardNo()); | |
313 | +// base.setVcCardNo(patients.getVcCardNo()); | |
314 | +// AntExChuQuery antExChuQuery=new AntExChuQuery(); | |
315 | +// antExChuQuery.setParentId(patients.getId()); | |
316 | +// antExChuQuery.setYn(YnEnums.YES.getId()); | |
317 | +// //查询产前检查记录 | |
318 | +// List checkList = antenatalExaminationService.findAllByParentId(patients.getId()); | |
319 | +// | |
320 | +// String highRisk = ""; | |
321 | +// if (CollectionUtils.isNotEmpty(checkList)) | |
322 | +// { | |
323 | +// AntenatalExaminationModel m = (AntenatalExaminationModel)checkList.get(0); | |
324 | +// highRisk = m.getRiskFactor(); | |
325 | +// } | |
326 | +// else | |
327 | +// { | |
328 | +// | |
329 | +// //获取初诊记录 | |
330 | +// List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
331 | +// AntExChuModel antExChuModel=null; | |
332 | +// if(CollectionUtils.isNotEmpty(antExChulist)){ | |
333 | +// antExChuModel= antExChulist.get(0); | |
334 | +// } | |
335 | +// if (antExChuModel != null) | |
336 | +// { | |
337 | +// highRisk = antExChuModel.getHighrisk(); | |
338 | +// } | |
339 | +// | |
340 | +// } | |
341 | +// | |
342 | +// if (!StringUtils.isEmpty(highRisk)) | |
343 | +// { | |
344 | +// listHighRisk = JsonUtil.toList(highRisk, List.class); | |
345 | +// } | |
304 | 346 | |
347 | +// if (CollectionUtils.isNotEmpty(listHighRisk)) | |
348 | +// { | |
349 | +// base.setHighRisk("高危"); | |
350 | +// } | |
351 | +// else | |
352 | +// { | |
353 | +// base.setHighRisk("健康"); | |
354 | +// } | |
305 | 355 | |
306 | - List listHighRisk = new ArrayList(); | |
307 | - List<Patients> list = patientsService.queryPatient(patientsQuery); | |
308 | - Patients patients = null; | |
309 | - if (CollectionUtils.isNotEmpty(list)) { | |
310 | - patients = list.get(0); | |
311 | - base.setCardNo(patients.getCardNo()); | |
312 | - base.setVcCardNo(patients.getVcCardNo()); | |
313 | - AntExChuQuery antExChuQuery=new AntExChuQuery(); | |
314 | - antExChuQuery.setParentId(patients.getId()); | |
315 | - antExChuQuery.setYn(YnEnums.YES.getId()); | |
316 | - //查询产前检查记录 | |
317 | - List checkList = antenatalExaminationService.findAllByParentId(patients.getId()); | |
318 | 356 | |
319 | - String highRisk = ""; | |
320 | - if (CollectionUtils.isNotEmpty(checkList)) | |
321 | - { | |
322 | - AntenatalExaminationModel m = (AntenatalExaminationModel)checkList.get(0); | |
323 | - highRisk = m.getRiskFactor(); | |
324 | - } | |
325 | - else | |
326 | - { | |
357 | + HighScoreResult res = antenatalExaminationFacade.findLastRisk(model.getPid(),false); | |
358 | + List<String> listHighRisk = res.getHighRisk(); | |
327 | 359 | |
328 | - //获取初诊记录 | |
329 | - List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
330 | - AntExChuModel antExChuModel=null; | |
331 | - if(CollectionUtils.isNotEmpty(antExChulist)){ | |
332 | - antExChuModel= antExChulist.get(0); | |
360 | + if (CollectionUtils.isNotEmpty(listHighRisk)) | |
361 | + { | |
362 | + if (listHighRisk.contains("健康")) | |
363 | + { | |
364 | + base.setHighRisk("健康"); | |
333 | 365 | } |
334 | - if (antExChuModel != null) | |
366 | + else | |
335 | 367 | { |
336 | - highRisk = antExChuModel.getHighrisk(); | |
368 | + base.setHighRisk("高危"); | |
337 | 369 | } |
338 | - | |
339 | 370 | } |
340 | - | |
341 | - if (!StringUtils.isEmpty(highRisk)) | |
342 | - { | |
343 | - listHighRisk = JsonUtil.toList(highRisk, List.class); | |
344 | - } | |
345 | - | |
346 | - if (CollectionUtils.isNotEmpty(listHighRisk)) | |
347 | - { | |
348 | - base.setHighRisk("高危"); | |
349 | - } | |
350 | 371 | else |
351 | 372 | { |
352 | 373 | base.setHighRisk("健康"); |
353 | 374 | } |
354 | - } | |
355 | 375 | } |
356 | 376 | |
357 | 377 | |
... | ... | @@ -362,6 +382,81 @@ |
362 | 382 | } |
363 | 383 | return model; |
364 | 384 | } |
385 | + | |
386 | + /** | |
387 | + * 查询孕妇最后一次检查的高危因素 全院 | |
388 | + * @param cardNo | |
389 | + * @param babyBirth | |
390 | + * @return | |
391 | + */ | |
392 | +// private List getYunLastDiagnose(String cardNo,Date babyBirth) | |
393 | +// { | |
394 | +// PatientsQuery patientsQuery = new PatientsQuery(); | |
395 | +// patientsQuery.setCardNo(cardNo); | |
396 | +// patientsQuery.setYn(YnEnums.YES.getId()); | |
397 | +// | |
398 | +// | |
399 | +// List listHighRisk = new ArrayList(); | |
400 | +// List<Patients> list = patientsService.queryPatient1(patientsQuery); | |
401 | +// if (CollectionUtils.isNotEmpty(list)) | |
402 | +// { | |
403 | +// AntExQuery antExQuery = new AntExQuery(); | |
404 | +// antExQuery.setYn(YnEnums.YES.getId()); | |
405 | +// | |
406 | +// MongoQuery query = antExQuery.convertToQuery(); | |
407 | +// query.addOrder(Sort.Direction.DESC, "modified"); | |
408 | +// | |
409 | +// //查询产前检查记录 | |
410 | +// List checkList = antenatalExaminationService.queryAntenatalExamination(query); | |
411 | +// } | |
412 | +// | |
413 | +// return listHighRisk; | |
414 | +// } | |
415 | + | |
416 | + /** | |
417 | + * 获取儿童最后一次检查诊断因素 所有医院 | |
418 | + * @param pid person表的id | |
419 | + * @return | |
420 | + */ | |
421 | + private List getBabyLastDiagnose(String pid) | |
422 | + { | |
423 | + //诊断 | |
424 | + List list = null; | |
425 | + String diagnose = null; | |
426 | + List<String> ids = new ArrayList<>(); | |
427 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
428 | + babyQuery.setPid(pid); | |
429 | + babyQuery.setYn(YnEnums.YES.getId()); | |
430 | + //查询儿童的基本信息 | |
431 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
432 | + if (CollectionUtils.isNotEmpty(models)) | |
433 | + { | |
434 | + for(BabyModel model : models) | |
435 | + { | |
436 | + ids.add(model.getId()); | |
437 | + } | |
438 | + if (CollectionUtils.isNotEmpty(ids)) | |
439 | + { | |
440 | + List<BabyCheckModel> checkModels = babyCheckService.queryLastCheck(ids); | |
441 | + if (CollectionUtils.isNotEmpty(checkModels) && checkModels.get(0) != null) | |
442 | + { | |
443 | + diagnose = checkModels.get(0).getDiagnose(); | |
444 | + } | |
445 | + else | |
446 | + { | |
447 | + diagnose = models.get(0).getDiagnose(); | |
448 | + } | |
449 | + } | |
450 | + | |
451 | + } | |
452 | + | |
453 | + if (StringUtils.isNotEmpty(diagnose)) | |
454 | + { | |
455 | + list = JsonUtil.toList(diagnose, List.class); | |
456 | + } | |
457 | + return list; | |
458 | + } | |
459 | + | |
365 | 460 | |
366 | 461 | /** |
367 | 462 | * 查询母亲身份证下面或者就诊卡号下面的儿童 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
9865f26