From a7237bc87c45d41c546cd27b08fa85ecaa736403 Mon Sep 17 00:00:00 2001 From: liquanyu Date: Thu, 28 Dec 2017 18:00:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E5=8D=B1=E6=95=B0=E6=8D=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/controller/TestController.java | 195 +++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java index 4502756..6b716d7 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java @@ -124,6 +124,8 @@ public class TestController { @Autowired private BabyBookbuildingService babyBookbuildingService; + + @ResponseBody @RequestMapping("/init/patient/weight") public BaseResponse initPatientWeight() { @@ -1424,4 +1426,197 @@ public class TestController { @Autowired private SieveFacade sieveFacade; + + + /** + * 更新新版高危因素 + * @param hospitalId + * @param patientId + * @return + */ + @RequestMapping(value = "/upateNewHighRisk", method = RequestMethod.GET) + @ResponseBody + public String upateNewHighRisk(@RequestParam(required = false) String hospitalId, @RequestParam(required = false) String patientId) { + final Map highRisks = new HashMap<>(); + highRisks.put("f3a1c08f-a2c1-4e93-8ffd-398af9e2d8c9","5a40c763422b03d4ad2bf7c1"); // 流产≥2次---------> 不良孕产史(各类流产≥3次、早产、围产儿死亡、出生缺陷、异位妊娠、滋养细胞疾病等) + highRisks.put("ee3ba99e-64c0-4aab-b0a4-71dec0d61ca6","5a40c772422b03d4ad2bf7c4"); //人工受精------->辅助生殖妊娠 + highRisks.put("a8094bd6-de5d-4b95-9a1a-59ae376bb2a6","9310676a-9482-4da5-9ba8-e2a302843ea0"); //高血压------> 妊娠期高血压疾病(除外红、橙色) + highRisks.put("3be742b2-ed07-425e-a435-8a19fc8ba86e","52986b9e-5a44-4613-9af5-07564f15b703"); //臀位 -------->≥36周胎位不正 + highRisks.put("cbeb4447-f4cb-4c2e-96f3-973a0c701fc3","8856c4da-57e3-42af-820a-25c991dde3f0"); //BMI≥32------>BMI≥28 + highRisks.put("251833c7-7ac1-410f-a6e7-c50f4008d5ed","5a41f715422b03d4ad2bf7f7"); // 中度贫血 ------>妊娠合并贫血(Hb 60-110g/L) + highRisks.put("2adbce90-4066-4980-b7a0-14012cbfea52","d7ceb752-ce2a-4901-a94e-51b73ccefc52"); // 心律失常-----需药物治疗的心肌炎后遗症、心律失常等 + highRisks.put("8745081d-1f37-45f7-b5be-94a208686bd2","ecb2fd70-1e85-455c-8f62-ee7b9c71e48c"); // 甲减---------需药物治疗的甲状腺疾病 + highRisks.put("5cba13c2-5cb5-46c9-905a-41708d13d45e","d6cfcad8-c674-4624-b50d-8797d217f10c"); //糖尿病并发心脏病 ----糖尿病并发肾病V级、严重心血管病、增生性视网膜病变或玻璃体出血、周围神经病变等 + highRisks.put("0b51b328-1c8f-41de-90de-ef3b76341c1b","d6cfcad8-c674-4624-b50d-8797d217f10c"); //糖尿病并发蛋白尿 ----糖尿病并发肾病V级、严重心血管病、增生性视网膜病变或玻璃体出血、周围神经病变等 + highRisks.put("80587d8a-009e-46aa-87e5-57996b0708b1","d6cfcad8-c674-4624-b50d-8797d217f10c"); //糖尿病并发肾功能不全 ---糖尿病并发肾病V级、严重心血管病、增生性视网膜病变或玻璃体出血、周围神经病变等 + + OrganizationQuery organizationQuery = new OrganizationQuery(); + organizationQuery.setYn(YnEnums.YES.getId()); + if (StringUtils.isNotEmpty(hospitalId)) { + organizationQuery.setId(Integer.parseInt(hospitalId)); + } + List organizationList = organizationService.queryOrganization(organizationQuery); + + PatientsQuery patientsQuery1 = new PatientsQuery(); + patientsQuery1.setYn(YnEnums.YES.getId()); + if (StringUtils.isNotEmpty(patientId)) + { + patientsQuery1.setId(patientId); + } + + if (CollectionUtils.isNotEmpty(organizationList)) { + for (Organization organization : organizationList) { + + patientsQuery1.setHospitalId(organization.getId() + ""); + List pats = patientsService.queryPatient(patientsQuery1); + + int batchSize = 5000; + int end = 0; + for (int i = 0; i < pats.size(); i += batchSize) { + end = (end + batchSize); + if (end > pats.size()) { + end = pats.size(); + } + System.out.println("start:" + i + ",end:" + end); + final List tempList = pats.subList(i, end); + commonThreadPool.execute(new Runnable() { + @Override + public void run() { + if (CollectionUtils.isNotEmpty(tempList)) { + for (Patients pat : tempList) { + List patientRisk = pat.getRiskFactorId(); + if (CollectionUtils.isNotEmpty(patientRisk)) { + int modCount = 0; + for (String key : highRisks.keySet()) + { + if (patientRisk.contains(key)) + { + patientRisk.remove(key); + patientRisk.add(highRisks.get(key)); + modCount++; + } + } + if (modCount > 0) + { + pat.setRiskFactorId(patientRisk); + patientsService.updatePatient(pat); + } + } + + AntExChuQuery antExChuQuery = new AntExChuQuery(); + antExChuQuery.setYn(YnEnums.YES.getId()); + antExChuQuery.setParentId(pat.getId()); + antExChuQuery.setHospitalId(pat.getHospitalId()); + List antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); + if (CollectionUtils.isNotEmpty(antExChuModelList)) { + for (AntExChuModel cmodel : antExChuModelList) { + String highriskStr = cmodel.getHighrisk(); + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr)) { + + List highrisks = JsonUtil.toList(highriskStr, String.class); + if (CollectionUtils.isNotEmpty(highrisks)) { + int modCount = 0; + for (String key : highRisks.keySet()) + { + if (highrisks.contains(key)) + { + highrisks.remove(key); + highrisks.add(highRisks.get(key)); + modCount++; + } + } + if (modCount > 0) + { + cmodel.setHighrisk(JsonUtil.array2JsonString(highrisks)); + antenatalExaminationService.updateAntExChu(cmodel, cmodel.getId()); + } + } + } + } + + antExChuModelList.clear(); + + // 查询复诊 + AntExQuery antExQuery = new AntExQuery(); + antExQuery.setYn(YnEnums.YES.getId()); + antExQuery.setParentId(pat.getId()); + antExQuery.setHospitalId(pat.getHospitalId()); + List antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { + for (AntenatalExaminationModel fmodel : antenatalExaminationModelList) { + String highriskStr = fmodel.getRiskFactor(); + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr)) { + List highrisks = JsonUtil.toList(highriskStr, String.class); + if (CollectionUtils.isNotEmpty(highrisks)) + { + if (CollectionUtils.isNotEmpty(highrisks)) { + int modCount = 0; + for (String key : highRisks.keySet()) + { + if (highrisks.contains(key)) + { + highrisks.remove(key); + highrisks.add(highRisks.get(key)); + modCount++; + } + } + if (modCount > 0) + { + fmodel.setRiskFactor(JsonUtil.array2JsonString(highrisks)); + antenatalExaminationService.updateOneAnt(fmodel, fmodel.getId()); + } + } + } + } + } + } + + antenatalExaminationModelList.clear(); + + + //初诊复诊冗余记录 + AntExRecordQuery query = new AntExRecordQuery(); + query.setParentId(pat.getId()); + List antExRecordModels = recordService.queryAntExRecords(query); + if (CollectionUtils.isNotEmpty(antExRecordModels)) + { + for (AntExRecordModel model : antExRecordModels) + { + List highrisks = model.gethRisk(); + if (CollectionUtils.isNotEmpty(highrisks)) + { + if (CollectionUtils.isNotEmpty(highrisks)) + { + int modCount = 0; + for (String key : highRisks.keySet()) + { + if (highrisks.contains(key)) + { + highrisks.remove(key); + highrisks.add(highRisks.get(key)); + modCount++; + } + } + if (modCount > 0) + { + model.sethRisk(highrisks); + recordService.updateOne(model,model.getId()); + } + } + } + } + } + + antExRecordModels.clear(); + } + } + } + } + }); + } + } + } + return "upateNewHighRisk finish"; + } + } -- 1.8.3.1