Commit d276b72fc9f61f9148608c5c1716554fe6d6a5bf
1 parent
b7c4950d61
Exists in
master
and in
6 other branches
全区域-区域妇幼管理-眼保健检查管理
Showing 4 changed files with 318 additions and 7 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyEyeCheck.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java
platform-dal/src/main/java/com/lyms/platform/pojo/BabyEyeCheck.java
View file @
d276b72
... | ... | @@ -492,6 +492,27 @@ |
492 | 492 | |
493 | 493 | /****************************************/ |
494 | 494 | |
495 | + //建档医院 | |
496 | + private String hospitalName; | |
497 | + //居住地 | |
498 | + private String completeAddress; | |
499 | + | |
500 | + public String getHospitalName() { | |
501 | + return hospitalName; | |
502 | + } | |
503 | + | |
504 | + public void setHospitalName(String hospitalName) { | |
505 | + this.hospitalName = hospitalName; | |
506 | + } | |
507 | + | |
508 | + public String getCompleteAddress() { | |
509 | + return completeAddress; | |
510 | + } | |
511 | + | |
512 | + public void setCompleteAddress(String completeAddress) { | |
513 | + this.completeAddress = completeAddress; | |
514 | + } | |
515 | + | |
495 | 516 | public List<Map> getHandleOpinionsIdList() { |
496 | 517 | return handleOpinionsIdList; |
497 | 518 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java
View file @
d276b72
... | ... | @@ -249,6 +249,46 @@ |
249 | 249 | map.put("QhdBasicOrganization", QhdBasicOrganizationEnums.getListMap()); |
250 | 250 | return RespBuilder.buildSuccess(map); |
251 | 251 | } |
252 | + /** | |
253 | + * 区域眼保健管理-眼保健检查管理 | |
254 | + * @param startDate | |
255 | + * @param endDate | |
256 | + * @param doctor | |
257 | + * @param key 姓名/联系方式/就诊卡 | |
258 | + * @param yeymcId 幼儿园 | |
259 | + * @param currentMonthStart/currentMonthEnd 当前月龄范围 | |
260 | + * @param chechMonth 检查月龄 | |
261 | + * @param positive 是否是阳性 | |
262 | + * @param bookStartDate 预约开始时间 | |
263 | + * @param bookEndDate 预约结束时间 | |
264 | + * @param positive 是否是阳性 | |
265 | + * @param page | |
266 | + * @param limit | |
267 | + * @param request | |
268 | + * @param provinceId //居住地-省 | |
269 | + * @param cityId //居住地-市 | |
270 | + * @param areaId //居住地-区县 | |
271 | + * @param streetId //居住地-街道 | |
272 | + * @param hospitalProvinceId //检查医院-省 | |
273 | + * @param hospitalCityId //检查医院-市 | |
274 | + * @param hospitalAreaId //检查医院-区县 | |
275 | + * @param hospitalId //检查医院-医院 | |
276 | + * @return | |
277 | + */ | |
278 | + @ResponseBody | |
279 | + @TokenRequired | |
280 | + @RequestMapping(value = "/getQy",method = RequestMethod.GET) | |
281 | + public BaseResponse getQy(Date startDate, Date endDate, String doctor, String key, String yeymcId,Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive, String positiveIds, Integer page, Integer limit, HttpServletRequest request, | |
282 | + Date bookStartDate, Date bookEndDate, String apparatusPositive, String doctorPositive, String yin,String noPassIds,Integer classify, | |
283 | + String babySource,Integer healthCheckType,String healthCheckTypeScattered,Integer healthCheckTypeWhole,Integer kindergarten,Integer basicOrganization, | |
284 | + String provinceId,String cityId,String areaId,String streetId,String hospitalProvinceId,String hospitalCityId,String hospitalAreaId, | |
285 | + String hospitalId) { | |
286 | + return babyEyeCheckService.getQy(getUserId(request), startDate, endDate, doctor, key,yeymcId, | |
287 | + currentMonthStart, currentMonthEnd, chechMonth, positive, positiveIds, page, limit, | |
288 | + bookStartDate, bookEndDate, apparatusPositive, doctorPositive, yin, noPassIds,classify, | |
289 | + babySource,healthCheckType,healthCheckTypeScattered,healthCheckTypeWhole,kindergarten,basicOrganization, | |
290 | + provinceId,cityId,areaId,streetId,hospitalProvinceId,hospitalCityId,hospitalAreaId,hospitalId); | |
291 | + } | |
252 | 292 | |
253 | 293 | |
254 | 294 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java
View file @
d276b72
... | ... | @@ -51,5 +51,13 @@ |
51 | 51 | |
52 | 52 | BaseResponse getBabyEyeCheckInfo(String hospitalId, String babyId); |
53 | 53 | public String getExcItems(BabyNerveMovementModel movementModel); |
54 | + | |
55 | + BaseResponse getQy(Integer userId, Date startDate, Date endDate, String doctor, String key, String yeymcId, Integer currentMonthStart, | |
56 | + Integer currentMonthEnd, String chechMonth, boolean positive, String positiveIds, Integer page, Integer limit, | |
57 | + Date bookStartDate, Date bookEndDate, String apparatusPositive, String doctorPositive, String yin, String noPassIds, | |
58 | + Integer classify, String babySource, Integer healthCheckType, String healthCheckTypeScattered, Integer healthCheckTypeWhole, | |
59 | + Integer kindergarten, Integer basicOrganization, | |
60 | + String provinceId, String cityId, String areaId, String streetId, | |
61 | + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId); | |
54 | 62 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java
View file @
d276b72
1 | 1 | package com.lyms.platform.operate.web.service.impl; |
2 | 2 | |
3 | -import com.lyms.platform.biz.service.BabyBookbuildingService; | |
4 | -import com.lyms.platform.biz.service.BabyCheckService; | |
5 | -import com.lyms.platform.biz.service.YunBookbuildingService; | |
3 | +import com.lyms.platform.biz.service.*; | |
6 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
7 | 5 | import com.lyms.platform.common.dao.BaseQuery; |
6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
8 | 7 | import com.lyms.platform.common.enums.*; |
9 | 8 | import com.lyms.platform.common.pojo.SyncDataModel; |
10 | 9 | import com.lyms.platform.common.result.*; |
11 | 10 | |
12 | 11 | |
13 | 12 | |
... | ... | @@ -12,18 +11,18 @@ |
12 | 11 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
13 | 12 | import com.lyms.platform.operate.web.facade.OperateLogFacade; |
14 | 13 | import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; |
14 | +import com.lyms.platform.operate.web.result.BabyManageListResult; | |
15 | 15 | import com.lyms.platform.operate.web.service.BabyAfterVisitService; |
16 | 16 | import com.lyms.platform.operate.web.service.BabyEyeCheckService; |
17 | -import com.lyms.platform.operate.web.utils.CollectionUtils; | |
18 | -import com.lyms.platform.operate.web.utils.MongoUtil; | |
19 | -import com.lyms.platform.operate.web.utils.ReflectUtil; | |
20 | -import com.lyms.platform.operate.web.utils.ResponseUtil; | |
17 | +import com.lyms.platform.operate.web.utils.*; | |
21 | 18 | import com.lyms.platform.permission.dao.master.BabyEyeCheckMapper; |
22 | 19 | import com.lyms.platform.permission.dao.master.CouponMapper; |
23 | 20 | import com.lyms.platform.permission.model.Organization; |
21 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
24 | 22 | import com.lyms.platform.permission.service.OrganizationService; |
25 | 23 | import com.lyms.platform.pojo.*; |
26 | 24 | import com.lyms.platform.query.BabyModelQuery; |
25 | +import com.lyms.platform.query.DataPermissionsModelQuery; | |
27 | 26 | import org.apache.commons.collections.map.HashedMap; |
28 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
29 | 28 | import org.springframework.data.domain.Sort; |
... | ... | @@ -76,6 +75,12 @@ |
76 | 75 | @Autowired |
77 | 76 | private OperateLogFacade operateLogFacade; |
78 | 77 | |
78 | + @Autowired | |
79 | + private DataPermissionService dataPermissionService; | |
80 | + | |
81 | + @Autowired | |
82 | + private BasicConfigService basicConfigService; | |
83 | + | |
79 | 84 | public static final String BASE_IMG_PATH = PropertiesUtils.getPropertyValue("img_path"); |
80 | 85 | |
81 | 86 | public static String mongo_crypto_key = Config.getItem("mongo_crypto_key", "0"); |
... | ... | @@ -2341,6 +2346,243 @@ |
2341 | 2346 | } |
2342 | 2347 | return new BaseObjectResponse().setData(datas).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
2343 | 2348 | |
2349 | + } | |
2350 | + | |
2351 | + @Override | |
2352 | + public BaseResponse getQy(Integer userId, Date startDate, Date endDate, String doctor, String key, String yeymcId, | |
2353 | + Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive, | |
2354 | + String positiveIds, Integer page, Integer limit, Date bookStartDate, Date bookEndDate, | |
2355 | + String apparatusPositive, String doctorPositive, String yin, String noPassIds, Integer classify, | |
2356 | + String babySource, Integer healthCheckType, String healthCheckTypeScattered, Integer healthCheckTypeWhole, | |
2357 | + Integer kindergarten, Integer basicOrganization, | |
2358 | + String provinceId, String cityId, String areaId, String streetId, | |
2359 | + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String ckHospitalId) { | |
2360 | + | |
2361 | + boolean b = true; | |
2362 | + Criteria criteria = Criteria.where("yn").ne("0"); | |
2363 | + if (startDate != null && endDate != null) { | |
2364 | + criteria.and("checkTime").gte(startDate).lt(DateUtil.addDay(endDate, 1)); | |
2365 | + } | |
2366 | + if (bookStartDate != null && bookEndDate != null) { | |
2367 | + criteria.and("nextCheckTime").gte(bookStartDate).lt(DateUtil.addDay(bookEndDate, 1)); | |
2368 | + } | |
2369 | + if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) { | |
2370 | + criteria.and("doctor").is(doctor); | |
2371 | + } | |
2372 | + List<String> chechMonths = new ArrayList<>(); | |
2373 | + if (b && StringUtils.isNotEmpty(chechMonth)) { | |
2374 | + if ("1".equals(chechMonth)) { | |
2375 | + chechMonths.add("0"); | |
2376 | + } else if ("12".equals(chechMonth)) { | |
2377 | + chechMonths.add("9"); | |
2378 | + } else if ("24".equals(chechMonth)) { | |
2379 | + chechMonths.add("18"); | |
2380 | + } | |
2381 | + | |
2382 | + chechMonths.add(chechMonth); | |
2383 | + } | |
2384 | + if (StringUtils.isNotEmpty(chechMonth)) { | |
2385 | + criteria.and("checkMonthId").in(chechMonths); | |
2386 | + } | |
2387 | + | |
2388 | + if (currentMonthStart != null && currentMonthEnd != null) { | |
2389 | + Date start = DateUtil.getBirthStart(currentMonthEnd); | |
2390 | + Date end = DateUtil.getBirthEnd(currentMonthStart); | |
2391 | + criteria.and("birth").gte(start).lt(end); | |
2392 | + } | |
2393 | + if (StringUtils.isNotEmpty(apparatusPositive)) { | |
2394 | + criteria.and("apparatus").is(apparatusPositive); | |
2395 | + } | |
2396 | + if (StringUtils.isNotEmpty(doctorPositive)) { | |
2397 | + criteria.and("doctorJudgement").is(doctorPositive); | |
2398 | + } | |
2399 | + if (StringUtils.isNotEmpty(yin)) { | |
2400 | + criteria.and("apparatus").nin("2").and("doctorJudgement").nin("2"); | |
2401 | + } | |
2402 | + //秦皇岛-分类-1.近视高危、2.弱视高危、3.异常高危。 (筛选查询) | |
2403 | + if (null!=classify) { | |
2404 | + criteria.and("classify").is(classify); | |
2405 | + } | |
2406 | + //秦皇岛-来源模块 | |
2407 | + if(StringUtils.isNotEmpty(babySource)){ | |
2408 | + criteria.and("babySource").is(babySource); | |
2409 | + } | |
2410 | + if(null!=healthCheckType){ | |
2411 | + criteria.and("healthCheckType").is(healthCheckType); | |
2412 | + } | |
2413 | + if(StringUtils.isNotEmpty(healthCheckTypeScattered)){ | |
2414 | + criteria.and("healthCheckTypeScattered").is(healthCheckTypeScattered); | |
2415 | + } | |
2416 | + if(null!=healthCheckTypeWhole){ | |
2417 | + criteria.and("healthCheckTypeWhole").is(healthCheckTypeWhole); | |
2418 | + } | |
2419 | + if(null!=kindergarten){ | |
2420 | + criteria.and("kindergarten").is(kindergarten); | |
2421 | + } | |
2422 | + if(null!=basicOrganization){ | |
2423 | + criteria.and("basicOrganization").is(basicOrganization); | |
2424 | + } | |
2425 | + //检查医院 | |
2426 | + if(StringUtils.isNotEmpty(ckHospitalId)){ | |
2427 | + criteria.and("hospitalId").is(ckHospitalId); | |
2428 | + } | |
2429 | + //区域医院筛选条件得到机构ID集合 | |
2430 | + List <String> hospitalIdList = new ArrayList <>(); | |
2431 | + if (StringUtils.isNotEmpty(hospitalProvinceId)){ | |
2432 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
2433 | + organizationQuery.setProvinceId(hospitalProvinceId); | |
2434 | + List <Organization> organizationListP = organizationService.queryOrganization(organizationQuery); | |
2435 | + for (Organization organization : organizationListP) { | |
2436 | + hospitalIdList.add(String.valueOf(organization.getId())); | |
2437 | + } | |
2438 | + if (StringUtils.isNotEmpty(hospitalCityId)) { | |
2439 | + organizationQuery.setCityId(hospitalCityId); | |
2440 | + List <Organization> organizationListC = organizationService.queryOrganization(organizationQuery); | |
2441 | + for (Organization organization : organizationListC) { | |
2442 | + hospitalIdList.add(String.valueOf(organization.getId())); | |
2443 | + } | |
2444 | + } | |
2445 | + if (StringUtils.isNotEmpty(hospitalAreaId)) { | |
2446 | + organizationQuery.setAreaId(hospitalAreaId); | |
2447 | + List <Organization> organizationListA = organizationService.queryOrganization(organizationQuery); | |
2448 | + for (Organization organization : organizationListA) { | |
2449 | + hospitalIdList.add(String.valueOf(organization.getId())); | |
2450 | + } | |
2451 | + } | |
2452 | + if (StringUtils.isNotEmpty(ckHospitalId)) { | |
2453 | + hospitalIdList.add(ckHospitalId); | |
2454 | + } | |
2455 | + | |
2456 | + List <String> permissions = new ArrayList <>(); | |
2457 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
2458 | + dataPermissionsModelQuery.setUserId(userId); | |
2459 | + List <DataPermissionsModel> dataPermissionsModelList = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
2460 | + if (CollectionUtils.isNotEmpty(dataPermissionsModelList)) { | |
2461 | + Set <String> set = dataPermissionsModelList.get(0).getData().keySet(); | |
2462 | + Iterator <String> it = set.iterator(); | |
2463 | + while (it.hasNext()) { | |
2464 | + String id = it.next(); | |
2465 | + permissions.add(id); | |
2466 | + } | |
2467 | + } | |
2468 | + | |
2469 | + if (CollectionUtils.isNotEmpty(hospitalIdList)) { | |
2470 | + hospitalIdList.retainAll(permissions); | |
2471 | + } else { | |
2472 | + hospitalIdList.addAll(permissions); | |
2473 | + } | |
2474 | + } | |
2475 | + | |
2476 | + //区域查询符合条件的儿童 | |
2477 | + if(StringUtils.isNotEmpty(key)||StringUtils.isNotEmpty(yeymcId)||CollectionUtils.isNotEmpty(hospitalIdList)||StringUtils.isNotEmpty(provinceId)){ | |
2478 | + Criteria c = new Criteria(); | |
2479 | + //名字、电话、证件号筛选 | |
2480 | + if (StringUtils.isNotEmpty(key)) { | |
2481 | + c.orOperator(Criteria.where("mphone").is(key), Criteria.where("name").regex(key), Criteria.where("mcertNo").is(key), | |
2482 | + Criteria.where("firstPyName").is(key)).and("yn").ne(0); | |
2483 | + } | |
2484 | + //幼儿园筛选 | |
2485 | + if (StringUtils.isNotEmpty(yeymcId)) { | |
2486 | + c.and("yeymcId").is(yeymcId); | |
2487 | + } | |
2488 | + //机构id集合筛选 | |
2489 | + if (CollectionUtils.isNotEmpty(hospitalIdList)) { | |
2490 | + c.and("hospitalId").in(hospitalIdList); | |
2491 | + } | |
2492 | + //居住地筛选 | |
2493 | + if(StringUtils.isNotEmpty(provinceId)){ | |
2494 | + c.and("provinceId").is(provinceId); | |
2495 | + if (StringUtils.isNotEmpty(cityId)){ | |
2496 | + c.and("cityId").is(cityId); | |
2497 | + } | |
2498 | + if (StringUtils.isNotEmpty(areaId)){ | |
2499 | + c.and("areaId").is(areaId); | |
2500 | + } | |
2501 | + if (StringUtils.isNotEmpty(streetId)){ | |
2502 | + c.and("streetId").is(streetId); | |
2503 | + } | |
2504 | + } | |
2505 | + | |
2506 | + List<BabyModel> babyModels = mongoUtil.findField(BabyModel.class, c, "id"); | |
2507 | + List<String> babyIds = CollectionUtils.getId(babyModels, "id", String.class); | |
2508 | + criteria.and("babyId").in(babyIds); | |
2509 | + } | |
2510 | + | |
2511 | + | |
2512 | + /** | |
2513 | + * 新加的 不通过查询条件 | |
2514 | + * @Author: 武涛涛 | |
2515 | + * @Date: 2020/7/21 21:56 | |
2516 | + */ | |
2517 | + if (StringUtils.isNotEmpty(noPassIds)) { | |
2518 | + List<String> ids = CollectionUtils.asList(noPassIds, String.class); | |
2519 | + for (String id : ids) { | |
2520 | + if ("eyeAppearance".equals(id)) { | |
2521 | + criteria.and("eyeAppearance").is("2"); | |
2522 | + } else if ("redReflexQhd".equals(id)) { | |
2523 | + criteria.and("redReflexQhd").is("2"); | |
2524 | + } else if ("blinkReflex".equals(id)) { | |
2525 | + criteria.and("blinkReflex").is("2"); | |
2526 | + } else if ("redBallTest".equals(id)) { | |
2527 | + criteria.and("redBallTest").is("2"); | |
2528 | + } else if ("behaviorObservation".equals(id)) { | |
2529 | + criteria.and("behaviorObservation").is("2"); | |
2530 | + } else if ("refractiveScreening".equals(id)) { | |
2531 | + criteria.and("refractiveScreening").is("2"); | |
2532 | + } else if ("eyePositionExamination".equals(id)) { | |
2533 | + criteria.and("eyePositionExamination").is("2"); | |
2534 | + } else if ("eyeMovement".equals(id)) { | |
2535 | + criteria.and("eyeMovement").is("2"); | |
2536 | + } | |
2537 | + } | |
2538 | + } | |
2539 | + | |
2540 | + /*end */ | |
2541 | + if (positive) { | |
2542 | + | |
2543 | + Query query = new Query(criteria); | |
2544 | + query.with(new Sort(Sort.Direction.DESC, "created")); | |
2545 | + query.addCriteria(new Criteria().orOperator(Criteria.where("apparatus").is("2"), Criteria.where("doctorJudgement").is("2"))); | |
2546 | + | |
2547 | + int count = (int) mongoTemplate.count(query, BabyEyeCheck.class); | |
2548 | + | |
2549 | + BaseQuery param = new BaseQuery(); | |
2550 | + param.setPage(page); | |
2551 | + param.setLimit(limit); | |
2552 | + param.mysqlBuild(count); | |
2553 | + query.skip(param.getOffset()).limit(param.getLimit()); | |
2554 | + List<BabyEyeCheck> babyEyeChecks = mongoTemplate.find(query, BabyEyeCheck.class); | |
2555 | + // doFilter(babyEyeChecks); | |
2556 | + | |
2557 | + if (StringUtils.isNotEmpty(positiveIds)) { | |
2558 | + List<String> ids = CollectionUtils.asList(positiveIds, String.class); | |
2559 | + if (CollectionUtils.isNotEmpty(ids)) { | |
2560 | + doFilter(babyEyeChecks, ids); | |
2561 | + } | |
2562 | + } | |
2563 | + //Integer count = babyEyeChecks.size(); | |
2564 | + | |
2565 | + // List<BabyEyeCheck> datas = CollectionUtils.getPageIds(babyEyeChecks, page, limit); | |
2566 | + List<Map<String, Object>> maps = setDatas(babyEyeChecks); | |
2567 | + return RespBuilder.buildSuccess(new PageResult(count, page, limit, maps)); | |
2568 | + } | |
2569 | + PageResult pageResult = findMongoPage(BabyEyeCheck.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
2570 | + List<BabyEyeCheck> babyEyeChecks = (List<BabyEyeCheck>) pageResult.getGrid(); | |
2571 | + if(CollectionUtils.isNotEmpty(babyEyeChecks)){ | |
2572 | + for (BabyEyeCheck babyEyeCheck : babyEyeChecks) { | |
2573 | + BabyModel babyModels = mongoTemplate.findById(babyEyeCheck.getBabyId(), BabyModel.class); | |
2574 | + String address = CommonsHelper.getResidence(babyModels.getProvinceId(), babyModels.getCityId(), | |
2575 | + babyModels.getAreaId(), babyModels.getStreetId(), babyModels.getAddress(), basicConfigService); | |
2576 | + //居住地 | |
2577 | + babyEyeCheck.setCompleteAddress(address); | |
2578 | + //检查医院 | |
2579 | + if(StringUtils.isNotEmpty(babyEyeCheck.getHospitalId())){ | |
2580 | + babyEyeCheck.setHospitalName(organizationService.getOrganization(Integer.valueOf(babyEyeCheck.getHospitalId())).getName()); | |
2581 | + } | |
2582 | + } | |
2583 | + } | |
2584 | + pageResult.setGrid(setDatas(babyEyeChecks)); | |
2585 | + return RespBuilder.buildSuccess(pageResult); | |
2344 | 2586 | } |
2345 | 2587 | |
2346 | 2588 | } |