Commit db7c77a01345ce6ca20e28b9ea3bcbf5c70b12b1
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
db7c77a
... | ... | @@ -124,6 +124,8 @@ |
124 | 124 | @Autowired |
125 | 125 | private BabyBookbuildingService babyBookbuildingService; |
126 | 126 | |
127 | + | |
128 | + | |
127 | 129 | @ResponseBody |
128 | 130 | @RequestMapping("/init/patient/weight") |
129 | 131 | public BaseResponse initPatientWeight() { |
... | ... | @@ -1424,5 +1426,198 @@ |
1424 | 1426 | |
1425 | 1427 | @Autowired |
1426 | 1428 | private SieveFacade sieveFacade; |
1429 | + | |
1430 | + | |
1431 | + /** | |
1432 | + * 更新新版高危因素 | |
1433 | + * @param hospitalId | |
1434 | + * @param patientId | |
1435 | + * @return | |
1436 | + */ | |
1437 | + @RequestMapping(value = "/upateNewHighRisk", method = RequestMethod.GET) | |
1438 | + @ResponseBody | |
1439 | + public String upateNewHighRisk(@RequestParam(required = false) String hospitalId, @RequestParam(required = false) String patientId) { | |
1440 | + final Map<String,String> highRisks = new HashMap<>(); | |
1441 | + highRisks.put("f3a1c08f-a2c1-4e93-8ffd-398af9e2d8c9","5a40c763422b03d4ad2bf7c1"); // 流产≥2次---------> 不良孕产史(各类流产≥3次、早产、围产儿死亡、出生缺陷、异位妊娠、滋养细胞疾病等) | |
1442 | + highRisks.put("ee3ba99e-64c0-4aab-b0a4-71dec0d61ca6","5a40c772422b03d4ad2bf7c4"); //人工受精------->辅助生殖妊娠 | |
1443 | + highRisks.put("a8094bd6-de5d-4b95-9a1a-59ae376bb2a6","9310676a-9482-4da5-9ba8-e2a302843ea0"); //高血压------> 妊娠期高血压疾病(除外红、橙色) | |
1444 | + highRisks.put("3be742b2-ed07-425e-a435-8a19fc8ba86e","52986b9e-5a44-4613-9af5-07564f15b703"); //臀位 -------->≥36周胎位不正 | |
1445 | + highRisks.put("cbeb4447-f4cb-4c2e-96f3-973a0c701fc3","8856c4da-57e3-42af-820a-25c991dde3f0"); //BMI≥32------>BMI≥28 | |
1446 | + highRisks.put("251833c7-7ac1-410f-a6e7-c50f4008d5ed","5a41f715422b03d4ad2bf7f7"); // 中度贫血 ------>妊娠合并贫血(Hb 60-110g/L) | |
1447 | + highRisks.put("2adbce90-4066-4980-b7a0-14012cbfea52","d7ceb752-ce2a-4901-a94e-51b73ccefc52"); // 心律失常-----需药物治疗的心肌炎后遗症、心律失常等 | |
1448 | + highRisks.put("8745081d-1f37-45f7-b5be-94a208686bd2","ecb2fd70-1e85-455c-8f62-ee7b9c71e48c"); // 甲减---------需药物治疗的甲状腺疾病 | |
1449 | + highRisks.put("5cba13c2-5cb5-46c9-905a-41708d13d45e","d6cfcad8-c674-4624-b50d-8797d217f10c"); //糖尿病并发心脏病 ----糖尿病并发肾病V级、严重心血管病、增生性视网膜病变或玻璃体出血、周围神经病变等 | |
1450 | + highRisks.put("0b51b328-1c8f-41de-90de-ef3b76341c1b","d6cfcad8-c674-4624-b50d-8797d217f10c"); //糖尿病并发蛋白尿 ----糖尿病并发肾病V级、严重心血管病、增生性视网膜病变或玻璃体出血、周围神经病变等 | |
1451 | + highRisks.put("80587d8a-009e-46aa-87e5-57996b0708b1","d6cfcad8-c674-4624-b50d-8797d217f10c"); //糖尿病并发肾功能不全 ---糖尿病并发肾病V级、严重心血管病、增生性视网膜病变或玻璃体出血、周围神经病变等 | |
1452 | + | |
1453 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
1454 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
1455 | + if (StringUtils.isNotEmpty(hospitalId)) { | |
1456 | + organizationQuery.setId(Integer.parseInt(hospitalId)); | |
1457 | + } | |
1458 | + List<Organization> organizationList = organizationService.queryOrganization(organizationQuery); | |
1459 | + | |
1460 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
1461 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
1462 | + if (StringUtils.isNotEmpty(patientId)) | |
1463 | + { | |
1464 | + patientsQuery1.setId(patientId); | |
1465 | + } | |
1466 | + | |
1467 | + if (CollectionUtils.isNotEmpty(organizationList)) { | |
1468 | + for (Organization organization : organizationList) { | |
1469 | + | |
1470 | + patientsQuery1.setHospitalId(organization.getId() + ""); | |
1471 | + List<Patients> pats = patientsService.queryPatient(patientsQuery1); | |
1472 | + | |
1473 | + int batchSize = 5000; | |
1474 | + int end = 0; | |
1475 | + for (int i = 0; i < pats.size(); i += batchSize) { | |
1476 | + end = (end + batchSize); | |
1477 | + if (end > pats.size()) { | |
1478 | + end = pats.size(); | |
1479 | + } | |
1480 | + System.out.println("start:" + i + ",end:" + end); | |
1481 | + final List<Patients> tempList = pats.subList(i, end); | |
1482 | + commonThreadPool.execute(new Runnable() { | |
1483 | + @Override | |
1484 | + public void run() { | |
1485 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
1486 | + for (Patients pat : tempList) { | |
1487 | + List<String> patientRisk = pat.getRiskFactorId(); | |
1488 | + if (CollectionUtils.isNotEmpty(patientRisk)) { | |
1489 | + int modCount = 0; | |
1490 | + for (String key : highRisks.keySet()) | |
1491 | + { | |
1492 | + if (patientRisk.contains(key)) | |
1493 | + { | |
1494 | + patientRisk.remove(key); | |
1495 | + patientRisk.add(highRisks.get(key)); | |
1496 | + modCount++; | |
1497 | + } | |
1498 | + } | |
1499 | + if (modCount > 0) | |
1500 | + { | |
1501 | + pat.setRiskFactorId(patientRisk); | |
1502 | + patientsService.updatePatient(pat); | |
1503 | + } | |
1504 | + } | |
1505 | + | |
1506 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
1507 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
1508 | + antExChuQuery.setParentId(pat.getId()); | |
1509 | + antExChuQuery.setHospitalId(pat.getHospitalId()); | |
1510 | + List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
1511 | + if (CollectionUtils.isNotEmpty(antExChuModelList)) { | |
1512 | + for (AntExChuModel cmodel : antExChuModelList) { | |
1513 | + String highriskStr = cmodel.getHighrisk(); | |
1514 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr)) { | |
1515 | + | |
1516 | + List<String> highrisks = JsonUtil.toList(highriskStr, String.class); | |
1517 | + if (CollectionUtils.isNotEmpty(highrisks)) { | |
1518 | + int modCount = 0; | |
1519 | + for (String key : highRisks.keySet()) | |
1520 | + { | |
1521 | + if (highrisks.contains(key)) | |
1522 | + { | |
1523 | + highrisks.remove(key); | |
1524 | + highrisks.add(highRisks.get(key)); | |
1525 | + modCount++; | |
1526 | + } | |
1527 | + } | |
1528 | + if (modCount > 0) | |
1529 | + { | |
1530 | + cmodel.setHighrisk(JsonUtil.array2JsonString(highrisks)); | |
1531 | + antenatalExaminationService.updateAntExChu(cmodel, cmodel.getId()); | |
1532 | + } | |
1533 | + } | |
1534 | + } | |
1535 | + } | |
1536 | + | |
1537 | + antExChuModelList.clear(); | |
1538 | + | |
1539 | + // 查询复诊 | |
1540 | + AntExQuery antExQuery = new AntExQuery(); | |
1541 | + antExQuery.setYn(YnEnums.YES.getId()); | |
1542 | + antExQuery.setParentId(pat.getId()); | |
1543 | + antExQuery.setHospitalId(pat.getHospitalId()); | |
1544 | + List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
1545 | + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { | |
1546 | + for (AntenatalExaminationModel fmodel : antenatalExaminationModelList) { | |
1547 | + String highriskStr = fmodel.getRiskFactor(); | |
1548 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr)) { | |
1549 | + List<String> highrisks = JsonUtil.toList(highriskStr, String.class); | |
1550 | + if (CollectionUtils.isNotEmpty(highrisks)) | |
1551 | + { | |
1552 | + if (CollectionUtils.isNotEmpty(highrisks)) { | |
1553 | + int modCount = 0; | |
1554 | + for (String key : highRisks.keySet()) | |
1555 | + { | |
1556 | + if (highrisks.contains(key)) | |
1557 | + { | |
1558 | + highrisks.remove(key); | |
1559 | + highrisks.add(highRisks.get(key)); | |
1560 | + modCount++; | |
1561 | + } | |
1562 | + } | |
1563 | + if (modCount > 0) | |
1564 | + { | |
1565 | + fmodel.setRiskFactor(JsonUtil.array2JsonString(highrisks)); | |
1566 | + antenatalExaminationService.updateOneAnt(fmodel, fmodel.getId()); | |
1567 | + } | |
1568 | + } | |
1569 | + } | |
1570 | + } | |
1571 | + } | |
1572 | + } | |
1573 | + | |
1574 | + antenatalExaminationModelList.clear(); | |
1575 | + | |
1576 | + | |
1577 | + //初诊复诊冗余记录 | |
1578 | + AntExRecordQuery query = new AntExRecordQuery(); | |
1579 | + query.setParentId(pat.getId()); | |
1580 | + List<AntExRecordModel> antExRecordModels = recordService.queryAntExRecords(query); | |
1581 | + if (CollectionUtils.isNotEmpty(antExRecordModels)) | |
1582 | + { | |
1583 | + for (AntExRecordModel model : antExRecordModels) | |
1584 | + { | |
1585 | + List<String> highrisks = model.gethRisk(); | |
1586 | + if (CollectionUtils.isNotEmpty(highrisks)) | |
1587 | + { | |
1588 | + if (CollectionUtils.isNotEmpty(highrisks)) | |
1589 | + { | |
1590 | + int modCount = 0; | |
1591 | + for (String key : highRisks.keySet()) | |
1592 | + { | |
1593 | + if (highrisks.contains(key)) | |
1594 | + { | |
1595 | + highrisks.remove(key); | |
1596 | + highrisks.add(highRisks.get(key)); | |
1597 | + modCount++; | |
1598 | + } | |
1599 | + } | |
1600 | + if (modCount > 0) | |
1601 | + { | |
1602 | + model.sethRisk(highrisks); | |
1603 | + recordService.updateOne(model,model.getId()); | |
1604 | + } | |
1605 | + } | |
1606 | + } | |
1607 | + } | |
1608 | + } | |
1609 | + | |
1610 | + antExRecordModels.clear(); | |
1611 | + } | |
1612 | + } | |
1613 | + } | |
1614 | + } | |
1615 | + }); | |
1616 | + } | |
1617 | + } | |
1618 | + } | |
1619 | + return "upateNewHighRisk finish"; | |
1620 | + } | |
1621 | + | |
1427 | 1622 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
db7c77a
... | ... | @@ -250,7 +250,7 @@ |
250 | 250 | Map<String, Integer> temp = new HashMap<>(); |
251 | 251 | for (Map<String, Date> dateMap : range) { |
252 | 252 | if(patient.getBookbuildingDate().getTime() >= dateMap.get("start").getTime() |
253 | - && patient.getBookbuildingDate().getTime() < dateMap.get("end").getTime()) { | |
253 | + && patient.getBookbuildingDate().getTime() <= dateMap.get("end").getTime()) { | |
254 | 254 | temp.put(DateUtil.getyyyy_mm(dateMap.get("cname")), 1); |
255 | 255 | break; |
256 | 256 | } |
257 | 257 | |
... | ... | @@ -601,12 +601,16 @@ |
601 | 601 | public BaseObjectResponse health(String parentId, Integer userId) { |
602 | 602 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
603 | 603 | List<Map<String, Object>> restList = new ArrayList<>(); |
604 | - Patients p = mongoTemplate.findById(parentId, Patients.class); | |
604 | + Patients patients = mongoTemplate.findById(parentId, Patients.class); | |
605 | + if(patients == null) { | |
606 | + return RespBuilder.buildSuccess(); | |
607 | + } | |
608 | + Patients p = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patients.getPid()).and("type").is(1)), Patients.class); | |
605 | 609 | if(p == null) { |
606 | 610 | return RespBuilder.buildSuccess(); |
607 | 611 | } |
608 | 612 | AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(p.getId()).and("yn").is(1).and("hospitalId").is(hospitalId)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class); |
609 | - List<AntenatalExaminationModel> antexModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(p.getId()).and("yn").is(1).and("hospitalId").is(hospitalId)).with(new Sort(Sort.Direction.ASC, "checkDate")), AntenatalExaminationModel.class); | |
613 | + List<AntenatalExaminationModel> antexModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(p.getId()).and("yn").is(1).and("hospitalId").is(hospitalId)).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class); | |
610 | 614 | |
611 | 615 | Map<String, Object> xyMap = new HashMap<>(); |
612 | 616 | List<Integer> szyMin = new ArrayList<>(); |
613 | 617 | |
... | ... | @@ -631,46 +635,7 @@ |
631 | 635 | Map<Integer, String> weights = new LinkedHashMap<>(); |
632 | 636 | boolean tzFlag = antExChuModel == null || StringUtils.isEmpty(antExChuModel.getYqWeight()) || StringUtils.isEmpty(antExChuModel.getHeight()) ? false : true; |
633 | 637 | |
634 | - // 添加初诊list | |
635 | - if(antExChuModel != null) { | |
636 | - Map<String, Object> temp = new HashMap<>(); | |
637 | - temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); | |
638 | - Integer week = DateUtil.getWeek2(p.getLastMenses(), antExChuModel.getCheckTime()); | |
639 | - temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), antExChuModel.getCheckTime())); | |
640 | - temp.put("weight", antExChuModel.getWeight()); | |
641 | - temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--")); | |
642 | - temp.put("gonggao", antExChuModel.getGonggao()); | |
643 | - temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围 | |
644 | 638 | |
645 | - List<Map> tireData = antExChuModel.getPlacentas(); | |
646 | - String fetalPosition = ""; | |
647 | - String heartRate = ""; | |
648 | - String fetalPresentation = ""; | |
649 | - if(CollectionUtils.isNotEmpty(tireData)) { | |
650 | - for (Map tireDatum : tireData) { | |
651 | - fetalPosition = fetalPosition.length() > 0 ? fetalPosition + "/" + tireDatum.get("fetalPosition") : tireDatum.get("fetalPosition") + ""; | |
652 | - heartRate = heartRate.length() > 0 ? heartRate + "/" + tireDatum.get("heartRate") : tireDatum.get("heartRate") + ""; | |
653 | - fetalPresentation = fetalPresentation.length() > 0 ? fetalPresentation + "/" + FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")) : FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")); | |
654 | - } | |
655 | - } else { | |
656 | - fetalPosition = "--"; | |
657 | - heartRate = "--"; | |
658 | - fetalPresentation = "--"; | |
659 | - } | |
660 | - | |
661 | - temp.put("fetalPosition", fetalPosition); // 胎位 | |
662 | - temp.put("heartRate", heartRate); // 胎心 | |
663 | - temp.put("fetalPresentation", fetalPresentation); // 先露 | |
664 | - temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿 | |
665 | - temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白 | |
666 | - temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素 | |
667 | - | |
668 | - ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0)); | |
669 | - szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0)); | |
670 | - | |
671 | - restList.add(temp); | |
672 | - } | |
673 | - | |
674 | 639 | for (AntenatalExaminationModel antexModel : antexModels) { |
675 | 640 | Map<String, Object> temp = new HashMap<>(); |
676 | 641 | Integer week = DateUtil.getWeek2(p.getLastMenses(), antexModel.getCheckDate()); |
... | ... | @@ -711,6 +676,47 @@ |
711 | 676 | |
712 | 677 | restList.add(temp); |
713 | 678 | } |
679 | + | |
680 | + // 添加初诊list\ | |
681 | + if(antExChuModel != null) { | |
682 | + Map<String, Object> temp = new HashMap<>(); | |
683 | + temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); | |
684 | + Integer week = DateUtil.getWeek2(p.getLastMenses(), antExChuModel.getCheckTime()); | |
685 | + temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), antExChuModel.getCheckTime())); | |
686 | + temp.put("weight", antExChuModel.getWeight()); | |
687 | + temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--")); | |
688 | + temp.put("gonggao", antExChuModel.getGonggao()); | |
689 | + temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围 | |
690 | + | |
691 | + List<Map> tireData = antExChuModel.getPlacentas(); | |
692 | + String fetalPosition = ""; | |
693 | + String heartRate = ""; | |
694 | + String fetalPresentation = ""; | |
695 | + if(CollectionUtils.isNotEmpty(tireData)) { | |
696 | + for (Map tireDatum : tireData) { | |
697 | + fetalPosition = fetalPosition.length() > 0 ? fetalPosition + "/" + tireDatum.get("fetalPosition") : tireDatum.get("fetalPosition") + ""; | |
698 | + heartRate = heartRate.length() > 0 ? heartRate + "/" + tireDatum.get("heartRate") : tireDatum.get("heartRate") + ""; | |
699 | + fetalPresentation = fetalPresentation.length() > 0 ? fetalPresentation + "/" + FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")) : FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")); | |
700 | + } | |
701 | + } else { | |
702 | + fetalPosition = "--"; | |
703 | + heartRate = "--"; | |
704 | + fetalPresentation = "--"; | |
705 | + } | |
706 | + | |
707 | + temp.put("fetalPosition", fetalPosition); // 胎位 | |
708 | + temp.put("heartRate", heartRate); // 胎心 | |
709 | + temp.put("fetalPresentation", fetalPresentation); // 先露 | |
710 | + temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿 | |
711 | + temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白 | |
712 | + temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素 | |
713 | + | |
714 | + ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0)); | |
715 | + szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0)); | |
716 | + | |
717 | + restList.add(temp); | |
718 | + } | |
719 | + | |
714 | 720 | |
715 | 721 | |
716 | 722 |