Commit b6b294eecb05ea17e72d82aac10e82e6a5ff488c

Authored by Administrator
1 parent 431e9f1245

区域儿童信息

Showing 3 changed files with 709 additions and 396 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HearDiagnManageController.java View file @ b6b294e
... ... @@ -13,6 +13,7 @@
13 13 import com.lyms.platform.common.result.BaseListResponse;
14 14 import com.lyms.platform.common.result.BaseResponse;
15 15 import com.lyms.platform.common.utils.DateUtil;
  16 +import com.lyms.platform.operate.web.facade.AreaCountFacade;
16 17 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
17 18 import com.lyms.platform.operate.web.facade.BabyEarFacade;
18 19 import com.lyms.platform.operate.web.request.HearDiaManageRequest;
... ... @@ -22,6 +23,7 @@
22 23 import com.lyms.platform.permission.model.*;
23 24 import com.lyms.platform.permission.service.*;
24 25 import com.lyms.platform.pojo.BabyModel;
  26 +import com.lyms.platform.query.BabyModelQuery;
25 27 import org.apache.commons.collections.CollectionUtils;
26 28 import org.apache.commons.lang.StringUtils;
27 29 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -66,6 +68,8 @@
66 68 private BabyPatientExtendEarBabyService earBabyService;
67 69 @Autowired
68 70 private BabyEarFacade earFacade;
  71 + @Autowired
  72 + private AreaCountFacade areaCountFacade;
69 73  
70 74 /**
71 75 * 获取儿童听筛记录
... ... @@ -430,7 +434,7 @@
430 434 query.setSort("diagnose_time desc");
431 435 query.setNeed("1");
432 436 query.setLimit(hdReq.getLimit());
433   - query.setOffset((hdReq.getPage()-1)*hdReq.getLimit());
  437 + query.setOffset((hdReq.getPage() - 1) * hdReq.getLimit());
434 438 query.setPage(hdReq.getPage());
435 439  
436 440 List<BabyPatientExtendEarHearingDiagnose> hearingDiagnoseList = hearingDiagnoseService.getHdAndScreen(query);
... ... @@ -648,7 +652,7 @@
648 652 BaseListResponse result = new BaseListResponse();
649 653 PageInfo pageInfo = new PageInfo();
650 654 if (model.getStatus() == null) {
651   - for (int i = (model.getPage() - 1) * model.getLimit(); i < hearDiagnManageListResults.size() && i < model.getPage()*model.getLimit(); i++) {
  655 + for (int i = (model.getPage() - 1) * model.getLimit(); i < hearDiagnManageListResults.size() && i < model.getPage() * model.getLimit(); i++) {
652 656 hdmResult.add(hearDiagnManageListResults.get(i));
653 657 }
654 658 pageInfo.setCount(hearDiagnManageListResults.size());
655 659  
656 660  
... ... @@ -656,19 +660,19 @@
656 660 } else {
657 661 // 1-已诊断、2-待诊断
658 662 if (model.getStatus() == 1) {
659   - for (int i = (model.getPage() - 1) * model.getLimit(); i < alrScreens.size() && i < model.getPage()*model.getLimit(); i++) {
  663 + for (int i = (model.getPage() - 1) * model.getLimit(); i < alrScreens.size() && i < model.getPage() * model.getLimit(); i++) {
660 664 hdmResult.add(alrScreens.get(i));
661 665 }
662 666 pageInfo.setCount(alrScreens.size());
663 667 result.setData(hdmResult);
664 668 } else if (model.getStatus() == 2) {
665   - for (int i = (model.getPage() - 1) * model.getLimit(); i < notScreens.size() && i < model.getPage()*model.getLimit(); i++) {
  669 + for (int i = (model.getPage() - 1) * model.getLimit(); i < notScreens.size() && i < model.getPage() * model.getLimit(); i++) {
666 670 hdmResult.add(notScreens.get(i));
667 671 }
668 672 pageInfo.setCount(notScreens.size());
669 673 result.setData(hdmResult);
670 674 } else {
671   - for (int i = (model.getPage() - 1) * model.getLimit(); i < hearDiagnManageListResults.size() && i < model.getPage()*model.getLimit(); i++) {
  675 + for (int i = (model.getPage() - 1) * model.getLimit(); i < hearDiagnManageListResults.size() && i < model.getPage() * model.getLimit(); i++) {
672 676 hdmResult.add(hearDiagnManageListResults.get(i));
673 677 }
674 678 pageInfo.setCount(hearDiagnManageListResults.size());
... ... @@ -1148,7 +1152,7 @@
1148 1152 babyQuery.setNoEnable("0");
1149 1153 babyQuery.setNeed("y");
1150 1154 babyQuery.setSort("build_date desc");
1151   - babyQuery.setOffset((model.getPage()-1)*model.getLimit());
  1155 + babyQuery.setOffset((model.getPage() - 1) * model.getLimit());
1152 1156 babyQuery.setLimit(model.getLimit());
1153 1157 babyQuery.setPage(model.getPage());
1154 1158 List<String> babyIds = new ArrayList<>();
... ... @@ -1262,5 +1266,610 @@
1262 1266 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("没有数据");
1263 1267 }
1264 1268 }
  1269 +
  1270 + /**
  1271 + * 区域 确诊儿童管理
  1272 + *
  1273 + * @param hdReq
  1274 + * @param request
  1275 + * @return
  1276 + */
  1277 + @RequestMapping(method = RequestMethod.GET, value = "/getConfirmDiagRegionList")
  1278 + @ResponseBody
  1279 + @TokenRequired
  1280 + public BaseResponse getConfirmDiagRegionList(HearDiaManageRequest hdReq, HttpServletRequest request) {
  1281 + //获取当前登录用户ID
  1282 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  1283 + if (loginState == null) {
  1284 + return new BaseResponse().setErrorcode(ErrorCodeConstants.TOKEN_EXPIRE).setErrormsg("请重新登录");
  1285 + }
  1286 + //获取当前用户能看到的那些医院
  1287 + List<String> hospitalIds = new ArrayList<>();
  1288 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(hdReq.getHospitalId())) {
  1289 + hospitalIds.add(hdReq.getHospitalId());
  1290 + } else {
  1291 + //获取用户拥有的权限医院和条件筛选的医院交集
  1292 + hospitalIds = areaCountFacade.getCurrentUserHospPermissions(loginState.getId(), hdReq.getOrgProvinceId(), hdReq.getOrgCityId(), hdReq.getAreaId());
  1293 + }
  1294 + //当前登录人医院Id
  1295 + // String hospitalId = autoMatchFacade.getHospitalId(loginState.getId());
  1296 +
  1297 + BabyPatientExtendEarHearingDiagnoseQuery query = new BabyPatientExtendEarHearingDiagnoseQuery();
  1298 +
  1299 + query.setCheckHospitalIds(hospitalIds.toArray(new String[hospitalIds.size()]));
  1300 + //当前登录人医院Id
  1301 + // List hospiIds = earFacade.getOrgHospitalIds(hospitalId);
  1302 + // List<String> hospitalIds = new ArrayList<String>();
  1303 + //加入院组
  1304 + // hospitalIds.addAll(hospiIds);
  1305 + // query.setCheckHospitalIds((String[]) hospitalIds.toArray(new String[hospitalIds.size()]));
  1306 +
  1307 + if (hdReq.getDiagnDoctorId() != null) {//诊断医生
  1308 + query.setDiagnDoctorId(hdReq.getDiagnDoctorId());
  1309 + }
  1310 +
  1311 + if (hdReq.getConfirmStartTime() != null) {//确诊开始时间
  1312 + query.setConfirmStartTime(hdReq.getConfirmStartTime());
  1313 + }
  1314 +
  1315 + if (hdReq.getConfirmEndTime() != null) {//确诊结束时间
  1316 + query.setConfirmEndTime(hdReq.getConfirmEndTime());
  1317 + }
  1318 +
  1319 + //省市区查询儿童列表信息
  1320 + BabyModelQuery modelQuery = new BabyModelQuery();
  1321 + modelQuery.setProvinceId(hdReq.getProvinceId());
  1322 + modelQuery.setCityId(hdReq.getCityId());
  1323 + modelQuery.setAreaId(hdReq.getAreaId());
  1324 + modelQuery.setStreetId(hdReq.getStreetId());
  1325 + modelQuery.setAreaId(hdReq.getAreaId());
  1326 + List<BabyModel> babyModels = babyService.queryBabyWithQuery(modelQuery);
  1327 + List<String> list = new ArrayList<>();
  1328 + if (CollectionUtils.isNotEmpty(babyModels)) {
  1329 + for (BabyModel babyModel : babyModels) {
  1330 + list.add(babyModel.getId());
  1331 + }
  1332 + }
  1333 +
  1334 + BabyPatientExtendEarBabyQuery babyQuery = new BabyPatientExtendEarBabyQuery();
  1335 + babyQuery.setQueryNo(hdReq.getKeyWord());
  1336 + babyQuery.setBirthStart(hdReq.getBirthStartTime());
  1337 + babyQuery.setBirthEnd(hdReq.getBirthEndTime());
  1338 + babyQuery.setHospitalIds(hospitalIds.toArray(new String[hospitalIds.size()]));
  1339 + babyQuery.setBabyPatientIds(list.toArray(new String[list.size()]));
  1340 + List<BabyPatientExtendEarBaby> models = earBabyService.queryBabyPatientExtendEarBaby(babyQuery);
  1341 +
  1342 + List<String> babyIds = new ArrayList<>();
  1343 + if (CollectionUtils.isEmpty(models) && (StringUtils.isNotEmpty(hdReq.getKeyWord()) || hdReq.getBirthStartTime() != null || hdReq.getBirthEndTime() != null)) {
  1344 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  1345 + }
  1346 +
  1347 + if (CollectionUtils.isNotEmpty(models)) {
  1348 + for (BabyPatientExtendEarBaby pa : models) {
  1349 + babyIds.add(pa.getBabyPatientId());
  1350 + }
  1351 + query.setBabyIds(babyIds.toArray(new String[babyIds.size()]));
  1352 + }
  1353 +
  1354 +
  1355 + //设置确诊
  1356 + query.setIsconfirm(1);
  1357 + query.setIfdel(0);
  1358 + if (hdReq.getConfirmResult() != null) {//模糊查询确诊结果
  1359 + List<String> cfList = new ArrayList<>();
  1360 + if (hdReq.getConfirmResult() == 1) {//轻度
  1361 + cfList.add(",1,");
  1362 + cfList.add(",2,");
  1363 + cfList.add(",3,");
  1364 + } else if (hdReq.getConfirmResult() == 2) {//中度
  1365 + cfList.add(",4,");
  1366 + cfList.add(",5,");
  1367 + cfList.add(",6,");
  1368 + } else if (hdReq.getConfirmResult() == 3) {//重度
  1369 + cfList.add(",7,");
  1370 + cfList.add(",8,");
  1371 + cfList.add(",9,");
  1372 + cfList.add(",10,");
  1373 + cfList.add(",11,");
  1374 + cfList.add(",12,");
  1375 + } else if (hdReq.getConfirmResult() == 4) {//极重度
  1376 + cfList.add(",13,");
  1377 + cfList.add(",14,");
  1378 + cfList.add(",15,");
  1379 + }
  1380 + query.setConfirmResults(cfList.toArray(new String[cfList.size()]));
  1381 + }
  1382 + query.setSort("diagnose_time desc");
  1383 + query.setNeed("1");
  1384 + query.setLimit(hdReq.getLimit());
  1385 + query.setOffset((hdReq.getPage() - 1) * hdReq.getLimit());
  1386 + query.setPage(hdReq.getPage());
  1387 +
  1388 + List<BabyPatientExtendEarHearingDiagnose> hearingDiagnoseList = hearingDiagnoseService.getHdAndScreen(query);
  1389 +
  1390 + List<HearingDiagnoseListResult> hdList = new ArrayList<>();
  1391 +
  1392 + for (BabyPatientExtendEarHearingDiagnose hd : hearingDiagnoseList) {
  1393 + HearingDiagnoseListResult hea = new HearingDiagnoseListResult();
  1394 + hea.setIsconfirm(hd.getIsconfirm() == null ? "未确诊" : hd.getIsconfirm() == 0 ? "未确诊" : "已确诊");
  1395 + hea.setId(hd.getId());
  1396 + hea.setDiagnoseTime(DateUtil.getyyyy_MM_dd(hd.getDiagnoseTime()));
  1397 + String docotorId = hd.getDiagnDoctorId();
  1398 + Users users = usersService.getUsers(Integer.parseInt(docotorId == null ? "0" : docotorId));
  1399 + if (users != null) {
  1400 + hea.setDoctorName(users.getName() == null ? "-" : users.getName());
  1401 + }
  1402 + BabyModel babyModel = babyService.getOneBabyById(hd.getBabyId());
  1403 + if (babyModel != null) {
  1404 + hea.setBabyName(babyModel.getName());
  1405 + hea.setBabyId(hd.getBabyId());
  1406 + hea.setMommyName(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMname()));
  1407 + hea.setMommnyPhone(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMphone()));
  1408 + hea.setMommnyEncryptPhone(com.lyms.platform.common.utils.StringUtils.encryPhone(babyModel.getMphone()));
  1409 + hea.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date()));
  1410 + hea.setBirthday(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(babyModel.getBirth())));
  1411 + hea.setSex(com.lyms.platform.common.utils.StringUtils.emptyDeal(SexEnum.getTextById(babyModel.getSex())));
  1412 + }
  1413 + hea.setHdTime(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(hd.getDiagnoseTime())));
  1414 + if (hd.getHighFactor() != null) {
  1415 + String hf[] = hd.getHighFactor().split(",");
  1416 + StringBuffer hrSb = new StringBuffer();
  1417 + for (int b = 0; b < hf.length; b++) {
  1418 + if (StringUtils.isNotEmpty(hf[b])) {
  1419 + Map<Integer, String> map = new HashMap<>();
  1420 + String title = HighRiskEnum.getTitle(Integer.parseInt(hf[b]));
  1421 + map.put(Integer.parseInt(hf[b]), title);
  1422 + // highRiskEnums.add(map);
  1423 + hrSb.append(title + "、");
  1424 + }
  1425 + }
  1426 + String hfString = null;
  1427 + if (hrSb.toString().endsWith("、")) {
  1428 + hfString = hrSb.substring(0, hrSb.length() - 1);
  1429 + } else {
  1430 + hfString = hrSb.toString();
  1431 + }
  1432 + hea.setHighRiskEnums(hfString);
  1433 + }
  1434 + //确诊结果
  1435 + if (hd.getConfirmResult() != null) {
  1436 + String cr[] = hd.getConfirmResult().split(",");
  1437 + StringBuffer hdSb = new StringBuffer();
  1438 + for (int b = 0; b < cr.length; b++) {
  1439 + if (StringUtils.isNotEmpty(cr[b])) {
  1440 + Map<Integer, String> map = new HashMap<>();
  1441 + String title = ConfirmedEnums.getTitle(Integer.parseInt(cr[b]));
  1442 + map.put(Integer.parseInt(cr[b]), title);
  1443 + // hdEnums.add(map);
  1444 + hdSb.append(title + "、");
  1445 + }
  1446 + }
  1447 + String hfString = null;
  1448 + if (hdSb.toString().endsWith("、")) {
  1449 + hfString = hdSb.substring(0, hdSb.length() - 1);
  1450 + } else {
  1451 + hfString = hdSb.toString();
  1452 + }
  1453 + hea.setDiagnResult(hfString);
  1454 + }
  1455 + hdList.add(hea);
  1456 + }
  1457 + BaseListResponse result = new BaseListResponse();
  1458 + result.setData(hdList);
  1459 + // PageInfo pageInfo = new PageInfo();
  1460 + // pageInfo.setLimit(hdReq.getLimit());
  1461 + // pageInfo.setPage(hdReq.getPage());
  1462 + // pageInfo.setCount(query.getCount());
  1463 +
  1464 + result.setPageInfo(query.getPageInfo());
  1465 + return result;
  1466 + }
  1467 +
  1468 + /**
  1469 + * 区域儿童听力可疑
  1470 + *
  1471 + * @param model
  1472 + * @param request
  1473 + * @return
  1474 + */
  1475 + @RequestMapping(method = RequestMethod.GET, value = "/getSuspDiagRegionList")
  1476 + @ResponseBody
  1477 + @TokenRequired
  1478 + public BaseResponse getSuspDiagRegionList(HearDiaManageRequest model, HttpServletRequest request) {
  1479 + //获取当前登录用户ID
  1480 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  1481 + if (loginState == null) {
  1482 + return new BaseResponse().setErrorcode(ErrorCodeConstants.TOKEN_EXPIRE).setErrormsg("请重新登录");
  1483 + }
  1484 +
  1485 + //获取当前用户能看到的那些医院
  1486 + List<String> hospitalIds = new ArrayList<>();
  1487 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(model.getHospitalId())) {
  1488 + hospitalIds.add(model.getHospitalId());
  1489 + } else {
  1490 + //获取用户拥有的权限医院和条件筛选的医院交集
  1491 + hospitalIds = areaCountFacade.getCurrentUserHospPermissions(loginState.getId(), model.getOrgProvinceId(), model.getOrgCityId(), model.getAreaId());
  1492 + }
  1493 + //当前登录人医院Id
  1494 + //String hospitalId = autoMatchFacade.getHospitalId(loginState.getId());
  1495 +
  1496 + List<String> babyIds = new ArrayList<>();
  1497 + //省市区查询儿童列表信息
  1498 + BabyModelQuery modelQuery = new BabyModelQuery();
  1499 + modelQuery.setProvinceId(model.getProvinceId());
  1500 + modelQuery.setCityId(model.getCityId());
  1501 + modelQuery.setAreaId(model.getAreaId());
  1502 + modelQuery.setStreetId(model.getStreetId());
  1503 + modelQuery.setAreaId(model.getAreaId());
  1504 + List<BabyModel> babyModels = babyService.queryBabyWithQuery(modelQuery);
  1505 + List<String> list = new ArrayList<>();
  1506 + if (CollectionUtils.isNotEmpty(babyModels)) {
  1507 + for (BabyModel babyModel : babyModels) {
  1508 + list.add(babyModel.getId());
  1509 + }
  1510 + }
  1511 +
  1512 + BabyPatientExtendEarBabyQuery babyQuery = new BabyPatientExtendEarBabyQuery();
  1513 + babyQuery.setQueryNo(model.getKeyWord());
  1514 + babyQuery.setBirthStart(model.getBirthStartTime());
  1515 + babyQuery.setBirthEnd(model.getBirthEndTime());
  1516 + babyQuery.setHospitalIds(hospitalIds.toArray(new String[hospitalIds.size()]));
  1517 + babyQuery.setBabyPatientIds(list.toArray(new String[list.size()]));
  1518 + List<BabyPatientExtendEarBaby> models = earBabyService.queryBabyPatientExtendEarBaby(babyQuery);
  1519 +
  1520 +
  1521 + if (CollectionUtils.isEmpty(models) && (StringUtils.isNotEmpty(model.getKeyWord()) || model.getBirthStartTime() != null || model.getBirthEndTime() != null)) {
  1522 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  1523 + }
  1524 +
  1525 + BabyPatientExtendEarScreenQuery screenQuery = new BabyPatientExtendEarScreenQuery();
  1526 + if (CollectionUtils.isNotEmpty(models)) {
  1527 + for (BabyPatientExtendEarBaby pa : models) {
  1528 + babyIds.add(pa.getBabyPatientId());
  1529 + }
  1530 + screenQuery.setBabyIds(babyIds.toArray(new String[babyIds.size()]));
  1531 + }
  1532 +
  1533 + //听筛开始时间
  1534 + if (model.getSecrStartTime() != null) {
  1535 + screenQuery.setScreenStartDate(model.getSecrStartTime());
  1536 + }
  1537 + //开始结束时间
  1538 + if (model.getSecrEndTime() != null) {
  1539 + screenQuery.setScreenEndDate(model.getSecrEndTime());
  1540 + }
  1541 + //检测医生ID
  1542 + if (model.getDiagnDoctorId() != null) {
  1543 + screenQuery.setCheckDoctorId(model.getDiagnDoctorId());
  1544 + }
  1545 + screenQuery.setStatus(0);
  1546 + screenQuery.setCheckHospitalIds(hospitalIds.toArray(new String[hospitalIds.size()]));
  1547 + //当前登录人医院Id
  1548 + // List hospiIds = earFacade.getOrgHospitalIds(hospitalId);
  1549 + // List<String> hospitalIds = new ArrayList<String>();
  1550 + // hospitalIds.addAll(hospiIds);
  1551 + //加入院组
  1552 + // screenQuery.setCheckHospitalIds((String[]) hospitalIds.toArray(new String[hospitalIds.size()]));
  1553 +
  1554 + //查询全部数据
  1555 + List<BabyPatientExtendEarScreen> earScreens = screenService.dubiousScreen(screenQuery);
  1556 +
  1557 + //已诊断数据
  1558 + List<HearDiagnManageListResult> alrScreens = new ArrayList<>();
  1559 + //未诊断数据
  1560 + List<HearDiagnManageListResult> notScreens = new ArrayList<>();
  1561 + //全部数据
  1562 + List<HearDiagnManageListResult> hearDiagnManageListResults = new ArrayList<>();
  1563 + //要返回的数据
  1564 + List<HearDiagnManageListResult> hdmResult = new ArrayList<>();
  1565 + if (CollectionUtils.isNotEmpty(earScreens)) {
  1566 + for (BabyPatientExtendEarScreen es : earScreens) {
  1567 + HearDiagnManageListResult hdm = new HearDiagnManageListResult();
  1568 + hdm.setId(es.getId());
  1569 + String docotorId = es.getCheckDoctorId();
  1570 + if (StringUtils.isNotEmpty(docotorId)) {
  1571 + Users users = usersService.getUsers(Integer.parseInt(docotorId == null ? "0" : docotorId));
  1572 + if (users != null) {
  1573 + hdm.setDoctorName(users.getName() == null ? "-" : users.getName());
  1574 + }
  1575 + }
  1576 + hdm.setSecrTime(DateUtil.getyyyy_MM_dd(es.getScreenDate()));
  1577 + BabyModel babyModel = babyService.getOneBabyById(es.getBabyId());
  1578 + if (babyModel != null) {
  1579 + hdm.setBabyName(babyModel.getName());
  1580 + hdm.setBabyId(es.getBabyId());
  1581 + hdm.setMommyName(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMname()));
  1582 + hdm.setMommnyPhone(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMphone()));
  1583 + hdm.setMommnyEncryptPhone(com.lyms.platform.common.utils.StringUtils.encryPhone(babyModel.getMphone()));
  1584 + hdm.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date()));
  1585 + hdm.setBirthday(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(babyModel.getBirth())));
  1586 + hdm.setSex(com.lyms.platform.common.utils.StringUtils.emptyDeal(SexEnum.getTextById(babyModel.getSex())));
  1587 + }
  1588 +
  1589 + if (StringUtils.isNotEmpty(es.getHighRiskCause())) {
  1590 + StringBuffer hfBuff = new StringBuffer();
  1591 + String[] highFactors = es.getHighRiskCause().split(",");
  1592 + for (String hf : highFactors) {
  1593 + if (StringUtils.isNotEmpty(hf)) {
  1594 + String name = HighRiskEnum.getTitle(Integer.parseInt(hf));
  1595 + hfBuff.append(name + "、");
  1596 + }
  1597 + }
  1598 + String hfString = null;
  1599 + if (hfBuff.toString().endsWith("、")) {
  1600 + hfString = hfBuff.substring(0, hfBuff.length() - 1);
  1601 + } else {
  1602 + hfString = hfBuff.toString();
  1603 + }
  1604 + hdm.setHighRiskEnums(hfString);
  1605 + }
  1606 +
  1607 + String babyId = es.getBabyId();
  1608 + BabyPatientExtendEarHearingDiagnoseQuery hdQuery = new BabyPatientExtendEarHearingDiagnoseQuery();
  1609 + hdQuery.setBabyId(babyId);
  1610 + //根据babyId查询听力诊断,如果有数据则已诊断
  1611 + int count = hearingDiagnoseService.queryBabyPatientExtendEarHearingDiagnoseCount(hdQuery);
  1612 + hdm.setSecrType(es.getScreenType() == 1 ? "初筛" : "复筛");
  1613 + hdm.setSecrResult(es.getScrIspass() == 1 ? "通过" : "未通过");
  1614 + if (count > 0) {//儿童在医院里做过听力诊断记录,标记为已诊断
  1615 + hdm.setStatus("已诊断");
  1616 + alrScreens.add(hdm);
  1617 + } else {
  1618 + hdm.setStatus("未诊断");
  1619 + notScreens.add(hdm);
  1620 + }
  1621 + hearDiagnManageListResults.add(hdm);
  1622 + }
  1623 + } else {
  1624 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("没有数据");
  1625 + }
  1626 + BaseListResponse result = new BaseListResponse();
  1627 + PageInfo pageInfo = new PageInfo();
  1628 + if (model.getStatus() == null) {
  1629 + for (int i = (model.getPage() - 1) * model.getLimit(); i < hearDiagnManageListResults.size() && i < model.getPage() * model.getLimit(); i++) {
  1630 + hdmResult.add(hearDiagnManageListResults.get(i));
  1631 + }
  1632 + pageInfo.setCount(hearDiagnManageListResults.size());
  1633 + result.setData(hdmResult);
  1634 + } else {
  1635 + // 1-已诊断、2-待诊断
  1636 + if (model.getStatus() == 1) {
  1637 + for (int i = (model.getPage() - 1) * model.getLimit(); i < alrScreens.size() && i < model.getPage() * model.getLimit(); i++) {
  1638 + hdmResult.add(alrScreens.get(i));
  1639 + }
  1640 + pageInfo.setCount(alrScreens.size());
  1641 + result.setData(hdmResult);
  1642 + } else if (model.getStatus() == 2) {
  1643 + for (int i = (model.getPage() - 1) * model.getLimit(); i < notScreens.size() && i < model.getPage() * model.getLimit(); i++) {
  1644 + hdmResult.add(notScreens.get(i));
  1645 + }
  1646 + pageInfo.setCount(notScreens.size());
  1647 + result.setData(hdmResult);
  1648 + } else {
  1649 + for (int i = (model.getPage() - 1) * model.getLimit(); i < hearDiagnManageListResults.size() && i < model.getPage() * model.getLimit(); i++) {
  1650 + hdmResult.add(hearDiagnManageListResults.get(i));
  1651 + }
  1652 + pageInfo.setCount(hearDiagnManageListResults.size());
  1653 + result.setData(hdmResult);
  1654 + }
  1655 + }
  1656 +
  1657 + pageInfo.setLimit(model.getLimit());
  1658 + pageInfo.setPage(model.getPage());
  1659 + result.setPageInfo(pageInfo);
  1660 + result.setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("查询成功");
  1661 + return result;
  1662 + }
  1663 +
  1664 + @RequestMapping(method = RequestMethod.GET, value = "/getAllDiagRegionList")
  1665 + @ResponseBody
  1666 + @TokenRequired
  1667 + public BaseResponse getAllDiagRegionList(HearDiaManageRequest model, HttpServletRequest request) {
  1668 + //获取当前登录用户ID
  1669 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  1670 + if (loginState == null) {
  1671 + return new BaseResponse().setErrorcode(ErrorCodeConstants.TOKEN_EXPIRE).setErrormsg("请重新登录");
  1672 + }
  1673 + //当前登录人医院Id
  1674 + // String hospitalId = autoMatchFacade.getHospitalId(loginState.getId());
  1675 +
  1676 + List<String> hospitalIds = new ArrayList<>();
  1677 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(model.getHospitalId())) {
  1678 + hospitalIds.add(model.getHospitalId());
  1679 + } else {
  1680 + //获取用户拥有的权限医院和条件筛选的医院交集
  1681 + hospitalIds = areaCountFacade.getCurrentUserHospPermissions(loginState.getId(), model.getOrgProvinceId(), model.getOrgCityId(), model.getAreaId());
  1682 + }
  1683 +
  1684 +
  1685 + BabyPatientExtendEarBabyQuery babyQuery = new BabyPatientExtendEarBabyQuery();
  1686 +
  1687 + Date currentDate = DateUtil.formatDate(new Date());
  1688 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(model.getBirth()) && model.getMonthAgeStart() != null && model.getMonthAgeEnd() != null) {
  1689 +
  1690 + Date start = DateUtil.addMonth(currentDate, -model.getMonthAgeStart());
  1691 + String birthStr = model.getBirth();
  1692 + String[] dates = birthStr.split(" - ");
  1693 +
  1694 + if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime()) {
  1695 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1696 + } else {
  1697 + babyQuery.setBirthEnd(start);
  1698 + }
  1699 +
  1700 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -model.getMonthAgeEnd() - 1), 1);
  1701 +
  1702 + if (DateUtil.parseYMD(dates[0]).getTime() < end.getTime()) {
  1703 + babyQuery.setBirthStart(end);
  1704 + } else {
  1705 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1706 + }
  1707 + } else if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(model.getBirth()) && model.getMonthAgeStart() != null) {
  1708 +
  1709 + Date start = DateUtil.addMonth(currentDate, -model.getMonthAgeStart());
  1710 + String birthStr = model.getBirth();
  1711 + String[] dates = birthStr.split(" - ");
  1712 +
  1713 + if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime()) {
  1714 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1715 + } else {
  1716 + babyQuery.setBirthEnd(start);
  1717 + }
  1718 +
  1719 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1720 +
  1721 + } else if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(model.getBirth())) {
  1722 + String birthStr = model.getBirth();
  1723 + String[] dates = birthStr.split(" - ");
  1724 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1725 + babyQuery.setBirthEnd(new Date(DateUtil.parseYMD(dates[1]).getTime() + 24 * 60 * 60 * 1000 - 1));
  1726 + } else if (model.getMonthAgeStart() != null && model.getMonthAgeEnd() != null) {
  1727 + Date start = DateUtil.addMonth(currentDate, -model.getMonthAgeStart());
  1728 + babyQuery.setBirthEnd(start);
  1729 +
  1730 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -model.getMonthAgeEnd() - 1), 1);
  1731 + babyQuery.setBirthStart(end);
  1732 + } else if (model.getMonthAgeStart() != null) {
  1733 + Date start = DateUtil.addMonth(currentDate, -model.getMonthAgeStart());
  1734 + babyQuery.setBirthEnd(start);
  1735 + } else if (model.getMonthAgeEnd() != null) {
  1736 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -model.getMonthAgeEnd() - 1), 1);
  1737 + babyQuery.setBirthStart(end);
  1738 + }
  1739 +
  1740 + //省市区查询儿童列表信息
  1741 + BabyModelQuery modelQuery = new BabyModelQuery();
  1742 + modelQuery.setProvinceId(model.getProvinceId());
  1743 + modelQuery.setCityId(model.getCityId());
  1744 + modelQuery.setAreaId(model.getAreaId());
  1745 + modelQuery.setStreetId(model.getStreetId());
  1746 + modelQuery.setAreaId(model.getAreaId());
  1747 + List<BabyModel> baby = babyService.queryBabyWithQuery(modelQuery);
  1748 + List<String> list = new ArrayList<>();
  1749 + if (CollectionUtils.isNotEmpty(baby)) {
  1750 + for (BabyModel babyModel : baby) {
  1751 + list.add(babyModel.getId());
  1752 + }
  1753 + }
  1754 + babyQuery.setHospitalIds(hospitalIds.toArray(new String[hospitalIds.size()]));
  1755 + babyQuery.setNoEnable("0");
  1756 + babyQuery.setNeed("y");
  1757 + babyQuery.setSort("build_date desc");
  1758 + babyQuery.setOffset((model.getPage() - 1) * model.getLimit());
  1759 + babyQuery.setLimit(model.getLimit());
  1760 + babyQuery.setPage(model.getPage());
  1761 + babyQuery.setBabyPatientIds(list.toArray(new String[list.size()]));
  1762 + List<String> babyIds = new ArrayList<>();
  1763 +
  1764 + //如果查询号不为空,根据查询号查询儿童档案表,获取儿童档案Id
  1765 + if (StringUtils.isNotEmpty(model.getKeyWord())) {//关键字:姓名、联系方式、就诊卡 查询babyId
  1766 + babyQuery.setQueryNo(model.getKeyWord());
  1767 + // babyQuery.setHospitalId(hospitalId);
  1768 + }
  1769 +
  1770 + List<BabyPatientExtendEarBaby> babyModels = earBabyService.queryBabyPatientExtendEarBaby(babyQuery);
  1771 +
  1772 + for (BabyPatientExtendEarBaby babyModel : babyModels) {
  1773 + babyIds.add(babyModel.getBabyPatientId());
  1774 + }
  1775 +
  1776 + //查询儿童听筛记录
  1777 + BabyPatientExtendEarScreenQuery screenQuery = new BabyPatientExtendEarScreenQuery();
  1778 + //检测医生ID
  1779 + if (model.getDiagnDoctorId() != null) {
  1780 + screenQuery.setCheckDoctorId(model.getDiagnDoctorId());
  1781 + }
  1782 + screenQuery.setCheckHospitalIds(hospitalIds.toArray(new String[hospitalIds.size()]));
  1783 + // List<String> hospitalIds = new ArrayList<String>();
  1784 + //当前登录人医院Id
  1785 + // List hospiIds = earFacade.getOrgHospitalIds(hospitalId);
  1786 + // hospitalIds.addAll(hospiIds);
  1787 + // screenQuery.setCheckHospitalIds((String[]) hospitalIds.toArray(new String[hospitalIds.size()]));
  1788 + screenQuery.setStatus(0);
  1789 +
  1790 + //根据儿童条件查询如果为空
  1791 + if (CollectionUtils.isEmpty(babyIds) && (model.getMonthAgeStart() != null || model.getMonthAgeEnd() != null || StringUtils.isNotEmpty(model.getKeyWord()) || model.getBirthStartTime() != null || model.getBirthEndTime() != null)) {
  1792 + BaseListResponse result = new BaseListResponse();
  1793 + result.setData(new ArrayList());
  1794 + result.setErrorcode(0);
  1795 + return result;
  1796 + }
  1797 +
  1798 + //查询全部数据
  1799 + List<BabyPatientExtendEarScreen> earScreens = screenService.queryBabyPatientExtendEarScreen(screenQuery);
  1800 + Map<String, BabyPatientExtendEarScreen> screenMap = new HashMap<>();
  1801 + if (CollectionUtils.isNotEmpty(earScreens)) {
  1802 + for (BabyPatientExtendEarScreen es : earScreens) {
  1803 + screenMap.put(es.getBabyId(), es);
  1804 + }
  1805 + }
  1806 +
  1807 + //听筛医生不为空
  1808 + if (CollectionUtils.isEmpty(earScreens) && model.getDiagnDoctorId() != null) {
  1809 + BaseListResponse result = new BaseListResponse();
  1810 + result.setData(new ArrayList());
  1811 + result.setErrorcode(0);
  1812 + return result;
  1813 + }
  1814 +
  1815 +
  1816 + //要返回的数据
  1817 + List<HearDiagnManageListResult> hdmResult = new ArrayList<>();
  1818 + if (CollectionUtils.isNotEmpty(babyModels)) {
  1819 + for (BabyPatientExtendEarBaby ear : babyModels) {
  1820 + HearDiagnManageListResult hdm = new HearDiagnManageListResult();
  1821 + hdm.setBabyName(ear.getName());
  1822 + hdm.setBabyId(ear.getBabyPatientId());
  1823 + hdm.setMommyName(com.lyms.platform.common.utils.StringUtils.emptyDeal(ear.getMname()));
  1824 + hdm.setMommnyPhone(com.lyms.platform.common.utils.StringUtils.emptyDeal(ear.getMphone()));
  1825 + hdm.setMommnyEncryptPhone(com.lyms.platform.common.utils.StringUtils.encryPhone(ear.getMphone()));
  1826 + hdm.setMonthAge(DateUtil.getBabyMonthAge(ear.getBirth(), new Date()));
  1827 + hdm.setBirthday(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(ear.getBirth())));
  1828 + hdm.setSex(com.lyms.platform.common.utils.StringUtils.emptyDeal(SexEnum.getTextById(ear.getSex())));
  1829 +
  1830 + BabyPatientExtendEarScreen es = screenMap.get(ear.getBabyPatientId());
  1831 +
  1832 + if (es == null) {
  1833 + if (model.getDiagnDoctorId() != null) {//筛查医生查询条件不为空,没找到则跳过
  1834 + continue;
  1835 + }
  1836 + }
  1837 + if (es != null) {
  1838 + hdm.setId(es.getId());
  1839 + String docotorId = es.getCheckDoctorId();
  1840 + Users users = usersService.getUsers(Integer.parseInt(docotorId == null ? "0" : docotorId));
  1841 + if (users != null) {
  1842 + hdm.setDoctorName(users.getName() == null ? "-" : users.getName());
  1843 + }
  1844 + hdm.setSecrTime(DateUtil.getyyyy_MM_dd(es.getScreenDate()));
  1845 + if (StringUtils.isNotEmpty(es.getHighRiskCause())) {
  1846 + StringBuffer hfBuff = new StringBuffer();
  1847 + String[] highFactors = es.getHighRiskCause().split(",");
  1848 + for (String hf : highFactors) {
  1849 + if (StringUtils.isNotEmpty(hf)) {
  1850 + String name = HighRiskEnum.getTitle(Integer.parseInt(hf));
  1851 + hfBuff.append(name + "、");
  1852 + }
  1853 + }
  1854 + String hfString = null;
  1855 + if (hfBuff.toString().endsWith("、")) {
  1856 + hfString = hfBuff.substring(0, hfBuff.length() - 1);
  1857 + } else {
  1858 + hfString = hfBuff.toString();
  1859 + }
  1860 + hdm.setHighRiskEnums(hfString);
  1861 + }
  1862 + }
  1863 + hdmResult.add(hdm);
  1864 + }
  1865 + BaseListResponse result = new BaseListResponse();
  1866 + result.setPageInfo(babyQuery.getPageInfo());
  1867 + result.setData(hdmResult);
  1868 + return result;
  1869 + } else {
  1870 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("没有数据");
  1871 + }
  1872 + }
  1873 +
1265 1874 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HearingDiagnoseController.java View file @ b6b294e
... ... @@ -869,394 +869,5 @@
869 869 return result;
870 870 }
871 871  
872   - @RequestMapping(method = RequestMethod.GET, value = "/queryHearingDiagnoseRegionList")
873   - @ResponseBody
874   - @TokenRequired
875   - public BaseResponse queryHearingDiagnoseRegionList(HearingDiagnoseRequest hdReq, HttpServletRequest request) {
876   - //获取当前登录用户ID
877   - LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
878   - if (loginState == null) {
879   - return new BaseResponse().setErrorcode(ErrorCodeConstants.TOKEN_EXPIRE).setErrormsg("请重新登录");
880   - }
881   - //获取当前用户能看到的那些医院
882   - List<String> hospitalIds = new ArrayList<>();
883   - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(hdReq.getHospitalId())) {
884   - hospitalIds.add(hdReq.getHospitalId());
885   - } else {
886   - //获取用户拥有的权限医院和条件筛选的医院交集
887   - hospitalIds = areaCountFacade.getCurrentUserHospPermissions(loginState.getId(), hdReq.getOrgProvinceId(), hdReq.getOrgCityId(), hdReq.getAreaId());
888   - }
889   - //当前登录人医院Id
890   - // String hospitalId = autoMatchFacade.getHospitalId(loginState.getId());
891   - String[] hospitalIdArry = new String[hospitalIds.size()];
892   -
893   -
894   - BabyModelQuery modelQuery = new BabyModelQuery();
895   - modelQuery.setProvinceId(hdReq.getProvinceId());
896   - modelQuery.setCityId(hdReq.getCityId());
897   - modelQuery.setAreaId(hdReq.getAreaId());
898   - modelQuery.setStreetId(hdReq.getStreetId());
899   - modelQuery.setAreaId(hdReq.getAreaId());
900   - List<BabyModel> babyModels = babyService.queryBabyWithQuery(modelQuery);
901   - List<String> list = new ArrayList<>();
902   - if (CollectionUtils.isNotEmpty(babyModels)) {
903   - for (BabyModel babyModel : babyModels) {
904   - list.add(babyModel.getId());
905   - }
906   - }
907   -
908   - List<String> pids = new ArrayList<>();
909   - if (hdReq.getSource() != null) {
910   - if (hdReq.getSource() == 2) {//2.外院
911   - //转诊过来的医院id
912   - HighriskChangeHospitalQuery hchQuery = new HighriskChangeHospitalQuery();
913   - hchQuery.setTargetType(2);//儿童
914   - hchQuery.setChangeType(1);//听力转诊
915   - hchQuery.setStatus(2);//已接受
916   - hchQuery.setHospitalIds(hospitalIds.toArray(hospitalIdArry));
917   - List<HighriskChangeHospital> hchList = highchangeService.queryHighriskChangeHospital(hchQuery);
918   - if (hchList != null && hchList.size() > 0) {
919   - for (HighriskChangeHospital hch : hchList) {//如果存在则修改转诊记录状态为接收
920   - pids.add(hch.getPid());
921   - }
922   - }
923   - BabyPatientExtendEarBabyQuery babyQuery = new BabyPatientExtendEarBabyQuery();
924   - babyQuery.setHospitalIds(hospitalIds.toArray(hospitalIdArry));
925   - babyQuery.setEnables(new String[]{"0", "1", "2"});
926   - List<BabyPatientExtendEarBaby> earBabies = earBabyService.queryBabyPatientExtendEarBaby(babyQuery);
927   - for (BabyPatientExtendEarBaby eb : earBabies) {
928   - pids.add(eb.getPersonId());
929   - }
930   - } else if (hdReq.getSource() == 1) {//1.本院
931   - BabyPatientExtendEarBabyQuery babyQuery = new BabyPatientExtendEarBabyQuery();
932   - babyQuery.setHospitalIds(hospitalIds.toArray(hospitalIdArry));
933   - babyQuery.setIsEnable("1");
934   - babyQuery.setBabyPatientIds(list.toArray(new String[list.size()]));
935   -
936   -
937   - List<BabyPatientExtendEarBaby> earBabies = earBabyService.queryBabyPatientExtendEarBaby(babyQuery);
938   - for (BabyPatientExtendEarBaby eb : earBabies) {
939   - pids.add(eb.getPersonId());
940   - }
941   - }
942   - }
943   -
944   -
945   - BabyPatientExtendEarHearingDiagnoseQuery query = new BabyPatientExtendEarHearingDiagnoseQuery();
946   -
947   -
948   - BabyPatientExtendEarScreenQuery scrQuery = new BabyPatientExtendEarScreenQuery();
949   - //如果查询号不为空,根据查询号查询儿童档案表,获取儿童档案Id
950   - if (StringUtils.isNotEmpty(hdReq.getKeyWord())) {//关键字:姓名、联系方式、就诊卡 查询babyId
951   - BabyPatientExtendEarBabyQuery babyQuery = new BabyPatientExtendEarBabyQuery();
952   - babyQuery.setQueryNo(hdReq.getKeyWord());
953   - babyQuery.setHospitalIds(hospitalIds.toArray(hospitalIdArry));
954   - List<BabyPatientExtendEarBaby> models = earBabyService.queryBabyPatientExtendEarBaby(babyQuery);
955   - if (CollectionUtils.isNotEmpty(models)) {
956   - List<String> babyIds = new ArrayList<>();
957   - for (BabyPatientExtendEarBaby babyModel : models) {
958   - babyIds.add(babyModel.getBabyPatientId());
959   - }
960   - scrQuery.setBabyIds(babyIds.toArray(new String[babyIds.size()]));
961   - query.setBabyIds(babyIds.toArray(new String[babyIds.size()]));
962   - } else {
963   - return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("没有找到数据");
964   - }
965   - }
966   -
967   -
968   - //是否需要查询听筛数据
969   - boolean isHdScr = true;
970   -
971   - if (CollectionUtils.isNotEmpty(pids)) {
972   - query.setPids((String[]) pids.toArray(new String[pids.size()]));
973   - }
974   - if (CollectionUtils.isEmpty(pids) && hdReq.getSource() != null) {
975   - return new FrontEndResult().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("没有找到数据");
976   - }
977   -
978   - if (hdReq.getDiagnoseStartTime() != null) {//诊断开始时间
979   - query.setDiagnoseStartTime(hdReq.getDiagnoseStartTime());
980   - isHdScr = false;
981   - }
982   -
983   - if (hdReq.getDiagnoseEndTime() != null) {//诊断结束时间
984   - query.setDiagnoseEndTime(hdReq.getDiagnoseEndTime());
985   - isHdScr = false;
986   - }
987   -
988   - if (hdReq.getDiagnDoctorId() != null) {//诊断医生
989   - query.setDiagnDoctorId(hdReq.getDiagnDoctorId());
990   - isHdScr = false;
991   - }
992   -
993   -
994   - if (hdReq.getDiagnNextStartTime() != null) {//预约下次开始诊断时间
995   - query.setDiagnNextStartTime(hdReq.getDiagnNextStartTime());
996   - isHdScr = false;
997   - }
998   -
999   - if (hdReq.getDiagnNextEndTime() != null) {//预约下次结束诊断时间
1000   - query.setDiagnNextEndTime(hdReq.getDiagnNextEndTime());
1001   - isHdScr = false;
1002   - }
1003   -
1004   - if (hdReq.getIsconfirm() != null) {//是否确诊 0-未确诊 1-确诊
1005   - query.setIsconfirm(hdReq.getIsconfirm());
1006   - isHdScr = false;
1007   - }
1008   - if (hdReq.getConfirmDegree() != null) {//查询确诊程度
1009   - isHdScr = false;
1010   - List<String> cfList = new ArrayList<>();
1011   - if (hdReq.getConfirmDegree() == 1) {//轻度
1012   - cfList.add(",1,");
1013   - cfList.add(",2,");
1014   - cfList.add(",3,");
1015   - } else if (hdReq.getConfirmDegree() == 2) {//中度
1016   - cfList.add(",4,");
1017   - cfList.add(",5,");
1018   - cfList.add(",6,");
1019   - } else if (hdReq.getConfirmDegree() == 3) {//中重度和重度
1020   - cfList.add(",7,");
1021   - cfList.add(",8,");
1022   - cfList.add(",9,");
1023   - cfList.add(",10,");
1024   - cfList.add(",11,");
1025   - cfList.add(",12,");
1026   - } else if (hdReq.getConfirmDegree() == 4) {//极重度
1027   - cfList.add(",13,");
1028   - cfList.add(",14,");
1029   - cfList.add(",15,");
1030   - }
1031   - query.setConfirmResults(cfList.toArray(new String[cfList.size()]));
1032   - }
1033   -
1034   - if (hdReq.getConfirmResult() != null) {//确诊程度
1035   - isHdScr = false;
1036   - List<String> cfList = new ArrayList<>();
1037   - if (hdReq.getConfirmResult() == 1) {//轻度
1038   - cfList.add(",1,");
1039   - cfList.add(",2,");
1040   - cfList.add(",3,");
1041   - } else if (hdReq.getConfirmResult() == 2) {//中度
1042   - cfList.add(",4,");
1043   - cfList.add(",5,");
1044   - cfList.add(",6,");
1045   - } else if (hdReq.getConfirmResult() == 3) {//中重度和重度
1046   - cfList.add(",7,");
1047   - cfList.add(",8,");
1048   - cfList.add(",9,");
1049   - cfList.add(",10,");
1050   - cfList.add(",11,");
1051   - cfList.add(",12,");
1052   - } else if (hdReq.getConfirmResult() == 4) {//极重度
1053   - cfList.add(",13,");
1054   - cfList.add(",14,");
1055   - cfList.add(",15,");
1056   - }
1057   - query.setConfirmResults(cfList.toArray(new String[cfList.size()]));
1058   - }
1059   -
1060   -
1061   - if (hdReq.getConfirmStartTime() != null) {//确诊开始时间
1062   - isHdScr = false;
1063   - query.setConfirmStartTime(hdReq.getConfirmStartTime());
1064   - }
1065   -
1066   - if (hdReq.getConfirmEndTime() != null) {//确诊结束时间
1067   - isHdScr = false;
1068   - query.setConfirmEndTime(hdReq.getConfirmEndTime());
1069   - }
1070   -
1071   - query.setCheckHospitalIds(hospitalIds.toArray(hospitalIdArry));
1072   - query.setSort("diagnose_time desc");
1073   -
1074   - //已经诊断的数据
1075   - List<BabyPatientExtendEarHearingDiagnose> hearingDiagnoseList = hearingDiagnoseService.getHdAndScreen(query);
1076   -
1077   - //待诊断
1078   - List<HearingDiagnoseListResult> waitConfiList = new ArrayList<>();
1079   - //已诊断
1080   - List<HearingDiagnoseListResult> confiList = new ArrayList<>();
1081   - //全部
1082   - List<HearingDiagnoseListResult> hdrList = new ArrayList<>();
1083   - List<String> babyIds = new ArrayList<>();
1084   - //需要查询听筛数据
1085   - if (isHdScr) {
1086   - // scrQuery.setCreateHospitalId(hospitalId);
1087   - scrQuery.setCheckHospitalIds(hospitalIds.toArray(hospitalIdArry));
1088   - //本院听筛数据 复筛未通过-待诊断
1089   - babyIds = screenService.queryScrBabyIds(scrQuery);
1090   - }
1091   -
1092   - //添加已经诊断的数据
1093   - for (BabyPatientExtendEarHearingDiagnose hd : hearingDiagnoseList) {
1094   - //删除总数据
1095   - babyIds.remove(hd.getBabyId());
1096   - HearingDiagnoseListResult hea = new HearingDiagnoseListResult();
1097   - BabyModel babyModel = babyService.getOneBabyById(hd.getBabyId());
1098   - if (babyModel != null) {
1099   - hea.setBabyName(babyModel.getName());
1100   - hea.setBabyId(hd.getBabyId());
1101   - hea.setMommyName(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMname()));
1102   - hea.setMommnyPhone(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMphone()));
1103   - hea.setMommnyEncryptPhone(com.lyms.platform.common.utils.StringUtils.encryPhone(babyModel.getMphone()));
1104   - hea.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), hd.getDiagnoseTime()));
1105   - hea.setBirthday(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(babyModel.getBirth())));
1106   - hea.setSex(com.lyms.platform.common.utils.StringUtils.emptyDeal(SexEnum.getTextById(babyModel.getSex())));
1107   - }
1108   - hea.setIsconfirm(hd.getIsconfirm() == null ? "未确诊" : hd.getIsconfirm() == 0 ? "未确诊" : "已确诊");
1109   - hea.setId(hd.getId());
1110   - hea.setDiagnoseTime(DateUtil.getyyyy_MM_dd(hd.getDiagnoseTime()));
1111   - String docotorId = hd.getDiagnDoctorId();
1112   - Users users = usersService.getUsers(Integer.parseInt(docotorId == null ? "0" : docotorId));
1113   - if (users != null) {
1114   - hea.setDoctorName(users.getName() == null ? "-" : users.getName());
1115   - }
1116   - hea.setHdTime(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(hd.getDiagnoseTime())));
1117   - //听力高危因数
1118   - if (hd.getHighFactor() != null) {
1119   - String hf[] = hd.getHighFactor().split(",");
1120   - StringBuffer hrSb = new StringBuffer();
1121   - for (int b = 0; b < hf.length; b++) {
1122   - if (StringUtils.isNotEmpty(hf[b])) {
1123   - Map<Integer, String> map = new HashMap<>();
1124   - String title = HighRiskEnum.getTitle(Integer.parseInt(hf[b]));
1125   - map.put(Integer.parseInt(hf[b]), title);
1126   - hrSb.append(title + "、");
1127   - }
1128   - }
1129   - String hfString = null;
1130   - if (hrSb.toString().endsWith("、")) {
1131   - hfString = hrSb.substring(0, hrSb.length() - 1);
1132   - } else {
1133   - hfString = hrSb.toString();
1134   - }
1135   - hea.setHighRiskEnums(hfString);
1136   - }
1137   - //确诊结果
1138   - if (hd.getConfirmResult() != null) {
1139   - String cr[] = hd.getConfirmResult().split(",");
1140   - StringBuffer hdSb = new StringBuffer();
1141   - for (int b = 0; b < cr.length; b++) {
1142   - if (StringUtils.isNotEmpty(cr[b])) {
1143   - Map<Integer, String> map = new HashMap<>();
1144   - String title = ConfirmedEnums.getTitle(Integer.parseInt(cr[b]));
1145   - map.put(Integer.parseInt(cr[b]), title);
1146   - hdSb.append(title + "、");
1147   - }
1148   - }
1149   - String hfString = null;
1150   - if (hdSb.toString().endsWith("、")) {
1151   - hfString = hdSb.substring(0, hdSb.length() - 1);
1152   - } else {
1153   - hfString = hdSb.toString();
1154   - }
1155   - hea.setConfirmResult(hfString);
1156   - }
1157   -
1158   - //诊断结果
1159   - if (hd.getDiagnResult() != null) {
1160   - String cr[] = hd.getDiagnResult().split(",");
1161   - StringBuffer hdSb = new StringBuffer();
1162   - for (int b = 0; b < cr.length; b++) {
1163   - if (StringUtils.isNotEmpty(cr[b])) {
1164   - Map<Integer, String> map = new HashMap<>();
1165   - String title = HearingDiagnosisEnums.getTitle(Integer.parseInt(cr[b]));
1166   - map.put(Integer.parseInt(cr[b]), title);
1167   - hdSb.append(title + "、");
1168   - }
1169   - }
1170   - String hfString = null;
1171   - if (hdSb.toString().endsWith("、")) {
1172   - hfString = hdSb.substring(0, hdSb.length() - 1);
1173   - } else {
1174   - hfString = hdSb.toString();
1175   - }
1176   - hea.setDiagnResult(hfString);
1177   - }
1178   - //已诊断
1179   - confiList.add(hea);
1180   - //全部
1181   - hdrList.add(hea);
1182   - }
1183   -
1184   -
1185   - Collections.sort(hearingDiagnoseList);
1186   - for (int i = 0; i < babyIds.size(); i++) {
1187   - HearingDiagnoseListResult hea = new HearingDiagnoseListResult();
1188   - BabyModel babyModel = babyService.getOneBabyById(babyIds.get(i));
1189   - if (babyModel != null) {
1190   - hea.setBabyName(babyModel.getName());
1191   - hea.setBabyId(babyIds.get(i));
1192   - hea.setMommyName(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMname()));
1193   - hea.setMommnyPhone(com.lyms.platform.common.utils.StringUtils.emptyDeal(babyModel.getMphone()));
1194   - hea.setMommnyEncryptPhone(com.lyms.platform.common.utils.StringUtils.encryPhone(babyModel.getMphone()));
1195   - hea.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date()));
1196   - hea.setBirthday(com.lyms.platform.common.utils.StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(babyModel.getBirth())));
1197   - hea.setSex(com.lyms.platform.common.utils.StringUtils.emptyDeal(SexEnum.getTextById(babyModel.getSex())));
1198   - }
1199   - hea.setDiagnResult("待诊断");
1200   - //全部
1201   - hdrList.add(hea);
1202   - //待诊断
1203   - waitConfiList.add(hea);
1204   - }
1205   -
1206   - BaseListResponse result = new BaseListResponse();
1207   - PageInfo pageInfo = new PageInfo();
1208   - List<HearingDiagnoseListResult> resList = new ArrayList<>();
1209   - if (hdReq.getEnalble() != null) {
1210   - if (hdReq.getEnalble() == 1) {
1211   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1212   - resList.add(confiList.get(i));
1213   - }
1214   - result.setData(resList);
1215   - pageInfo.setCount(confiList.size());
1216   - } else if (hdReq.getEnalble() == 2) {
1217   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1218   - resList.add(waitConfiList.get(i));
1219   - }
1220   - pageInfo.setCount(waitConfiList.size());
1221   - result.setData(resList);
1222   - } else if (hdReq.getEnalble() == 3) {
1223   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1224   - resList.add(hdrList.get(i));
1225   - }
1226   - pageInfo.setCount(hdrList.size());
1227   - result.setData(resList);
1228   - }
1229   - } else if (hdReq.getIsconfirm() != null) {
1230   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1231   - resList.add(confiList.get(i));
1232   - }
1233   - result.setData(resList);
1234   - pageInfo.setCount(confiList.size());
1235   - } else if (hdReq.getConfirmDegree() != null) {
1236   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1237   - resList.add(confiList.get(i));
1238   - }
1239   - result.setData(resList);
1240   - pageInfo.setCount(confiList.size());
1241   - } else if (StringUtils.isNotEmpty(hdReq.getDiagnDoctorId())) {
1242   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1243   - resList.add(confiList.get(i));
1244   - }
1245   - result.setData(resList);
1246   - pageInfo.setCount(confiList.size());
1247   - } else {
1248   - for (int i = (hdReq.getPage() - 1) * hdReq.getLimit(); i < hdrList.size() && i < hdReq.getPage() * hdReq.getLimit(); i++) {
1249   - resList.add(hdrList.get(i));
1250   - }
1251   - pageInfo.setCount(hdrList.size());
1252   - result.setData(resList);
1253   - }
1254   -
1255   - pageInfo.setLimit(hdReq.getLimit());
1256   - pageInfo.setPage(hdReq.getPage());
1257   - result.setPageInfo(pageInfo);
1258   - result.setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("查询成功");
1259   - return result;
1260   - }
1261 872 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/HearDiaManageRequest.java View file @ b6b294e
... ... @@ -7,7 +7,7 @@
7 7 * @createTime 2017年07月26日 16时26分
8 8 * @discription
9 9 */
10   -public class HearDiaManageRequest extends BasePageQueryRequest{
  10 +public class HearDiaManageRequest extends BasePageQueryRequest {
11 11 /**
12 12 * 确诊开始时间
13 13 */
... ... @@ -70,6 +70,99 @@
70 70 private Integer monthAgeStart;
71 71 //结束月龄
72 72 private Integer monthAgeEnd;
  73 +
  74 + //省
  75 + private String provinceId;
  76 + //城市id
  77 + private String cityId;
  78 + //县id
  79 + private String areaId;
  80 + //镇id
  81 + private String streetId;
  82 + //详细地址
  83 + private String address;
  84 +
  85 + //省市区查询机构
  86 + private String orgProvinceId;
  87 + //城市id
  88 + private String orgCityId;
  89 + //县id
  90 + private String orgAreaId;
  91 + //医院id
  92 + private String hospitalId;
  93 +
  94 +
  95 + public String getProvinceId() {
  96 + return provinceId;
  97 + }
  98 +
  99 + public void setProvinceId(String provinceId) {
  100 + this.provinceId = provinceId;
  101 + }
  102 +
  103 + public String getCityId() {
  104 + return cityId;
  105 + }
  106 +
  107 + public void setCityId(String cityId) {
  108 + this.cityId = cityId;
  109 + }
  110 +
  111 + public String getAreaId() {
  112 + return areaId;
  113 + }
  114 +
  115 + public void setAreaId(String areaId) {
  116 + this.areaId = areaId;
  117 + }
  118 +
  119 + public String getStreetId() {
  120 + return streetId;
  121 + }
  122 +
  123 + public void setStreetId(String streetId) {
  124 + this.streetId = streetId;
  125 + }
  126 +
  127 + public String getAddress() {
  128 + return address;
  129 + }
  130 +
  131 + public void setAddress(String address) {
  132 + this.address = address;
  133 + }
  134 +
  135 + public String getOrgProvinceId() {
  136 + return orgProvinceId;
  137 + }
  138 +
  139 + public void setOrgProvinceId(String orgProvinceId) {
  140 + this.orgProvinceId = orgProvinceId;
  141 + }
  142 +
  143 + public String getOrgCityId() {
  144 + return orgCityId;
  145 + }
  146 +
  147 + public void setOrgCityId(String orgCityId) {
  148 + this.orgCityId = orgCityId;
  149 + }
  150 +
  151 + public String getOrgAreaId() {
  152 + return orgAreaId;
  153 + }
  154 +
  155 + public void setOrgAreaId(String orgAreaId) {
  156 + this.orgAreaId = orgAreaId;
  157 + }
  158 +
  159 + public String getHospitalId() {
  160 + return hospitalId;
  161 + }
  162 +
  163 + public void setHospitalId(String hospitalId) {
  164 + this.hospitalId = hospitalId;
  165 + }
73 166  
74 167 public String getBirth() {
75 168 return birth;