Commit a7237bc87c45d41c546cd27b08fa85ecaa736403
1 parent
2a8115cf46
Exists in
master
and in
6 other branches
高危数据修正
Showing 1 changed file with 195 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
a7237bc
... | ... | @@ -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 | } |