Commit 1a591a54c5c62aebe655daba09a613e607e59477
1 parent
428871c432
Exists in
master
and in
1 other branch
衔接加固定和半固定
Showing 4 changed files with 153 additions and 5 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/JoinEnums.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/ConvertHelper.java
- platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java
platform-common/src/main/java/com/lyms/platform/common/enums/JoinEnums.java
View file @
1a591a5
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
1a591a5
... | ... | @@ -53,6 +53,18 @@ |
53 | 53 | return days; |
54 | 54 | } |
55 | 55 | |
56 | + //返回孕周(需要计算) | |
57 | + public static String getPregnancyWeek(Date start, Date end) { | |
58 | + | |
59 | + int day = DateUtil.daysBetween(start, end); | |
60 | + | |
61 | + if (day == -1) { | |
62 | + return ""; | |
63 | + } | |
64 | + | |
65 | + return StringUtils.dueWeek(day); | |
66 | + } | |
67 | + | |
56 | 68 | /** |
57 | 69 | * 获取传入日期 相加xx月后的第xx天 |
58 | 70 | * @param date |
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/ConvertHelper.java
View file @
1a591a5
1 | 1 | package com.lyms.platform.job.index.restore.data; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
4 | +import com.lyms.platform.biz.service.PatientsService; | |
4 | 5 | import com.lyms.platform.common.constants.UnitConstants; |
5 | 6 | import com.lyms.platform.common.enums.*; |
6 | 7 | import com.lyms.platform.common.utils.*; |
7 | 8 | import com.lyms.platform.job.index.model.Placenta; |
8 | 9 | import com.lyms.platform.permission.model.Organization; |
10 | +import com.lyms.platform.permission.model.Users; | |
11 | +import com.lyms.platform.permission.service.UsersService; | |
9 | 12 | import com.lyms.platform.pojo.*; |
10 | 13 | import com.lyms.platform.pojo.Patients; |
11 | 14 | import com.lymsh.mommybaby.maindata.model.*; |
15 | +import com.lymsh.mommybaby.maindata.service.HospitalsService; | |
12 | 16 | import net.sf.json.JSONObject; |
13 | 17 | import org.apache.commons.collections.CollectionUtils; |
14 | 18 | import org.apache.commons.collections.MapUtils; |
... | ... | @@ -620,8 +624,7 @@ |
620 | 624 | * @param antExFuModel |
621 | 625 | * @return |
622 | 626 | */ |
623 | - public static Reports convertAntExFu(AntenatalExaminationModel antExFuModel, Date lastMenses, | |
624 | - Map<String, String> rhMap, String doctorUserName) { | |
627 | + public static Reports convertAntExFu(AntenatalExaminationModel antExFuModel, BasicConfigService basicConfigService,PatientsService patientsService,Date lastMenses,Map<String, String> rhMap, HospitalsService hospitalsService,UsersService usersService, String doctorUserName) { | |
625 | 628 | Reports reports = new Reports(); |
626 | 629 | //孕期类型 |
627 | 630 | reports.setType(1); |
... | ... | @@ -639,6 +642,7 @@ |
639 | 642 | |
640 | 643 | reports.setWeeks(DateUtil.getWeek(lastMenses, antExFuModel.getCheckDate())); |
641 | 644 | reports.setResult(convertAntExResult(antExFuModel, rhMap, doctorUserName)); |
645 | + reports.setMomResult(convertNewAntExResult(antExFuModel, basicConfigService,patientsService,hospitalsService,usersService, doctorUserName)); | |
642 | 646 | return reports; |
643 | 647 | } |
644 | 648 | |
... | ... | @@ -793,6 +797,10 @@ |
793 | 797 | antChuJson.put("heart", antExChuModel.getHeart()); |
794 | 798 | //肺部 |
795 | 799 | antChuJson.put("lungs", antExChuModel.getLungs()); |
800 | + //血型 | |
801 | + antChuJson.put("abo", FunvCommonUtil.getBaseicConfigByid(antExChuModel.getAbo(), basicConfigService)); | |
802 | + //rh血型 | |
803 | + antChuJson.put("rh", FunvCommonUtil.checkYiGan(antExChuModel.getRh())); | |
796 | 804 | //产次 |
797 | 805 | antChuJson.put("prodTime", StringUtils.unitHandle(antExChuModel.getProdTime(), UnitConstants.CI)); |
798 | 806 | //顺产 |
... | ... | @@ -1291,6 +1299,129 @@ |
1291 | 1299 | } |
1292 | 1300 | |
1293 | 1301 | /** |
1302 | + * 新版复诊:转换json | |
1303 | + * | |
1304 | + * @param doctorUserName | |
1305 | + * @return | |
1306 | + */ | |
1307 | + private static String convertNewAntExResult(AntenatalExaminationModel antExFuModel, BasicConfigService basicConfigService, com.lyms.platform.biz.service.PatientsService patientsService,HospitalsService hospitalsService,UsersService usersService, | |
1308 | + String doctorUserName) { | |
1309 | + JSONObject antFuJson = new JSONObject(); | |
1310 | + Patients patients = patientsService.findOnePatientById(antExFuModel.getParentId()); | |
1311 | + if (patients == null || patients.getYn() == YnEnums.NO.getId()) { | |
1312 | + return ""; | |
1313 | + } | |
1314 | + | |
1315 | + //检查时间 | |
1316 | + antFuJson.put("checkTime", DateUtil.getyyyy_MM_dd(antExFuModel.getCheckDate())); | |
1317 | + //末次月经 | |
1318 | + antFuJson.put("lastMenses", DateUtil.getyyyy_MM_dd(antExFuModel.getLastMenses())); | |
1319 | + //产检孕周 | |
1320 | + antFuJson.put("currentDueDate", DateUtil.getPregnancyWeek(patients.getLastMenses(), antExFuModel.getCheckDate())); | |
1321 | + // 血压 | |
1322 | + String ssy = ""; | |
1323 | + String szy = ""; | |
1324 | + Map<String, String> chBpMap = JsonUtil.getMap(antExFuModel.getBp()); | |
1325 | + if (MapUtils.isNotEmpty(chBpMap)) { | |
1326 | + ssy = chBpMap.get("ssy"); | |
1327 | + szy = chBpMap.get("szy"); | |
1328 | + } | |
1329 | + antFuJson.put("bp", StringUtils.unitHandle(ssy + "/" + szy, UnitConstants.MMHG)); | |
1330 | + //体重 | |
1331 | + antFuJson.put("weight", StringUtils.unitHandle(antExFuModel.getWeight(), UnitConstants.KG)); | |
1332 | + String gongGao = ""; | |
1333 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(antExFuModel.getGongGaoSelect()) ) | |
1334 | + { | |
1335 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(antExFuModel.getGongGaoType())) { | |
1336 | + gongGao = GongJingEnums.getGongGaoNameById(antExFuModel.getGongGaoSelect()) + "," + GongJingEnums.getHengZhiNameById(antExFuModel.getGongGaoType()); | |
1337 | + } else { | |
1338 | + gongGao = GongJingEnums.getGongGaoNameById(antExFuModel.getGongGaoSelect()); | |
1339 | + } | |
1340 | + } | |
1341 | + else if (org.apache.commons.lang.StringUtils.isNotEmpty(antExFuModel.getGongGao())) | |
1342 | + { | |
1343 | + gongGao = StringUtils.unitHandle(antExFuModel.getGongGao(), UnitConstants.CM); | |
1344 | + } | |
1345 | + //宫高 | |
1346 | + antFuJson.put("gongGao", gongGao); | |
1347 | + //腹围 | |
1348 | + antFuJson.put("abdomCircum", StringUtils.unitHandle(antExFuModel.getAbdominalCircumference(), UnitConstants.CM)); | |
1349 | + | |
1350 | + //胎儿情况 | |
1351 | + List<Map> tireList = new ArrayList<>(); | |
1352 | + if (CollectionUtils.isNotEmpty(antExFuModel.getTireData())) { | |
1353 | + for (Object temp : antExFuModel.getTireData()) { | |
1354 | + Map<String, Object> tire = (Map<String, Object>) temp; | |
1355 | + if (tire != null) { | |
1356 | + String heartRate = tire.get("heartRate") == null ? "" : String.valueOf(tire.get("heartRate")); | |
1357 | + String fetalPresentation = tire.get("fetalPresentation") + ""; | |
1358 | + | |
1359 | + Map<String, Object> tireMap = new HashMap<>(); | |
1360 | + //胎心率 | |
1361 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(heartRate)) { | |
1362 | + tireMap.put("heartRate", StringUtils.unitHandle(heartRate, UnitConstants.CIFEN)); | |
1363 | + } else { | |
1364 | + tireMap.put("" +"heartRate", ""); | |
1365 | + } | |
1366 | + String fetalPosition = tire.get("fetalPosition") + ""; | |
1367 | + //胎位 | |
1368 | + tireMap.put("fetalPosition", FetalPositionEnums.getTitle(fetalPosition)); | |
1369 | + //先露 | |
1370 | + tireMap.put("fetalPresentation", FetalEnums.getTitle(fetalPresentation)); | |
1371 | + tireList.add(tireMap); | |
1372 | + } | |
1373 | + } | |
1374 | + } | |
1375 | + //胎儿情况集合 | |
1376 | + antFuJson.put("tireData", tireList); | |
1377 | + //尿蛋白 | |
1378 | + antFuJson.put("urineProtein", antExFuModel.getUrineProtein()); | |
1379 | + //血红蛋白 | |
1380 | + antFuJson.put("hemoglobin", StringUtils.unitHandle(antExFuModel.getHemoglobin(), UnitConstants.GL)); | |
1381 | + /* 诊断指导 */ | |
1382 | + String diagnosis = ""; | |
1383 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(antExFuModel.getDiagnosis())) { | |
1384 | + List<String> temp = JsonUtil.toList(antExFuModel.getDiagnosis(), String.class); | |
1385 | + if (CollectionUtils.isNotEmpty(temp)) { | |
1386 | + StringBuilder sb = new StringBuilder(); | |
1387 | + for (String sId : temp) { | |
1388 | + sb.append(FunvCommonUtil.getBaseicConfigByid(sId, basicConfigService)).append(","); | |
1389 | + } | |
1390 | + if (sb.toString().endsWith(",")) { | |
1391 | + diagnosis = sb.substring(0, sb.length() - 1); | |
1392 | + } else { | |
1393 | + diagnosis = sb.toString(); | |
1394 | + } | |
1395 | + } | |
1396 | + } | |
1397 | + antFuJson.put("diagnosis", diagnosis); | |
1398 | + String hospital = ""; | |
1399 | + if (StringUtils.isNotEmpty(antExFuModel.getHospitalId())) { | |
1400 | + HospitalsQuery hospitalsQuery = new HospitalsQuery(); | |
1401 | + hospitalsQuery.setForeignId(antExFuModel.getHospitalId()); | |
1402 | + List<Hospitals> hospList = hospitalsService.queryHospitals(hospitalsQuery); | |
1403 | + | |
1404 | + if (CollectionUtils.isNotEmpty(hospList)) { | |
1405 | + hospital = hospList.get(0).getTitle(); | |
1406 | + } | |
1407 | + } | |
1408 | + antFuJson.put("hospital", hospital); | |
1409 | + | |
1410 | + String checkDoctor = ""; | |
1411 | + | |
1412 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(antExFuModel.getCheckDoctor())) { | |
1413 | + Users users = usersService.getUsers(Integer.parseInt(antExFuModel.getCheckDoctor())); | |
1414 | + if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
1415 | + checkDoctor = users.getName(); | |
1416 | + } | |
1417 | + } | |
1418 | + antFuJson.put("checkDoctor", checkDoctor); | |
1419 | + // 处理意见 | |
1420 | + antFuJson.put("treatmentOpinion", antExFuModel.getTreatmentOpinion()); | |
1421 | + return antFuJson.toString(); | |
1422 | + } | |
1423 | + | |
1424 | + /** | |
1294 | 1425 | * 复诊:转换json |
1295 | 1426 | * |
1296 | 1427 | * @param antExChuModel |
... | ... | @@ -1545,7 +1676,7 @@ |
1545 | 1676 | list.add(placenta); |
1546 | 1677 | antenatalExaminationModel.setTireData(list); |
1547 | 1678 | |
1548 | - System.out.print(convertAntExFu(antenatalExaminationModel, null, null, "").getResult()); | |
1679 | + // System.out.print(convertAntExFu(antenatalExaminationModel, null, null, "").getResult()); | |
1549 | 1680 | } |
1550 | 1681 | |
1551 | 1682 | private static String replace(Map map, StringBuilder sb) { |
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java
View file @
1a591a5
... | ... | @@ -75,7 +75,10 @@ |
75 | 75 | */ |
76 | 76 | @Autowired |
77 | 77 | private PatientsService patientsService; |
78 | + | |
78 | 79 | @Autowired |
80 | + private com.lyms.platform.biz.service.PatientsService patientService; | |
81 | + @Autowired | |
79 | 82 | private HospitalsService hospitalsService; |
80 | 83 | /** |
81 | 84 | * 妈咪贝比 |
... | ... | @@ -716,8 +719,8 @@ |
716 | 719 | //处理复诊高危 |
717 | 720 | handRiskFu(ant, mamiPatient.getId()); |
718 | 721 | |
719 | - Reports reports = ConvertHelper.convertAntExFu(ant, patients.getLastMenses(), | |
720 | - bgHighRisk, doctorUserName); | |
722 | + Reports reports = ConvertHelper.convertAntExFu(ant, basicConfigService,patientService,patients.getLastMenses(), | |
723 | + bgHighRisk,hospitalsService,usersService, doctorUserName); | |
721 | 724 | |
722 | 725 | logger.info("handleDoctorMemeber antex" + patients.getId() + ". antex id:" + ant.getId()); |
723 | 726 | handleDoctorMemeber(reports, ant.getCheckDoctor(), mamiPatient, patients, stopWatch3); |