Commit 3f32a1658a2ab31b544982faa9cf471c7a584afa

Authored by shiyang
1 parent 013180f43d

全区域-区域妇幼管理-眼保健管理

Showing 3 changed files with 293 additions and 1 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java View file @ 3f32a16
... ... @@ -289,7 +289,42 @@
289 289 babySource,healthCheckType,healthCheckTypeScattered,healthCheckTypeWhole,kindergarten,basicOrganization,
290 290 provinceId,cityId,areaId,streetId,hospitalProvinceId,hospitalCityId,hospitalAreaId,hospitalId);
291 291 }
292   -
  292 + /**
  293 + * 区域眼保健管理-眼保健管理
  294 + *@param startDate
  295 + * @param endDate
  296 + * @param doctor
  297 + * @param key 姓名/联系方式/就诊卡
  298 + * @param currentMonthStart/currentMonthEnd 当前月龄范围
  299 + * @param chechMonth 检查月龄
  300 + * @param positive 是否是阳性
  301 + * @param bookStartDate 预约开始时间
  302 + * @param bookEndDate 预约结束时间
  303 + * @param positive 是否是阳性
  304 + * @param page
  305 + * @param limit
  306 + * @param request
  307 + * @param provinceId //居住地-省
  308 + * @param cityId //居住地-市
  309 + * @param areaId //居住地-区县
  310 + * @param streetId //居住地-街道
  311 + * @param hospitalProvinceId //检查医院-省
  312 + * @param hospitalCityId //检查医院-市
  313 + * @param hospitalAreaId //检查医院-区县
  314 + * @param hospitalId //检查医院-医院
  315 + */
  316 + @ResponseBody
  317 + @TokenRequired
  318 + @RequestMapping(value = "/childrenFilingListQy", method = RequestMethod.GET)
  319 + public BaseResponse childrenFilingListQy( Date startBuildDate, Date endBuildDate,Date startDate, Date endDate, String doctor, String key, Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive, String positiveIds, Integer page, Integer limit, HttpServletRequest request,
  320 + Date bookStartDate, Date bookEndDate, String apparatusPositive, String doctorPositive, String yin,String noPassIds,
  321 + String provinceId, String cityId, String areaId, String streetId,
  322 + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId) {
  323 + return babyEyeCheckService.childrenFilingListQy(getUserId(request), startBuildDate, endBuildDate, startDate, endDate, doctor, key,
  324 + currentMonthStart, currentMonthEnd, chechMonth, positive, positiveIds, page, limit,
  325 + bookStartDate, bookEndDate, apparatusPositive, doctorPositive, yin, noPassIds,
  326 + provinceId,cityId,areaId,streetId,hospitalProvinceId,hospitalCityId,hospitalAreaId,hospitalId);
  327 + }
293 328  
294 329 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java View file @ 3f32a16
... ... @@ -59,5 +59,12 @@
59 59 Integer kindergarten, Integer basicOrganization,
60 60 String provinceId, String cityId, String areaId, String streetId,
61 61 String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId);
  62 +
  63 + BaseResponse childrenFilingListQy(Integer userId, Date startBuildDate, Date endBuildDate, Date startDate, Date endDate, String doctor,
  64 + String key, Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive,
  65 + String positiveIds, Integer page, Integer limit, Date bookStartDate, Date bookEndDate, String apparatusPositive,
  66 + String doctorPositive, String yin, String noPassIds,
  67 + String provinceId, String cityId, String areaId, String streetId,
  68 + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId);
62 69 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java View file @ 3f32a16
... ... @@ -2385,6 +2385,7 @@
2385 2385  
2386 2386 chechMonths.add(chechMonth);
2387 2387 }
  2388 + //这里加医院筛选为了只查本院检查的儿童
2388 2389 if (StringUtils.isNotEmpty(chechMonth)) {
2389 2390 criteria.and("checkMonthId").in(chechMonths);
2390 2391 }
... ... @@ -2600,6 +2601,255 @@
2600 2601 }
2601 2602 pageResult.setGrid(setDatas(babyEyeChecks));
2602 2603 return RespBuilder.buildSuccess(pageResult);
  2604 + }
  2605 +
  2606 + @Override
  2607 + public BaseResponse childrenFilingListQy(Integer userId, Date startBuildDate, Date endBuildDate, Date startDate,
  2608 + Date endDate, String doctor, String key, Integer currentMonthStart, Integer currentMonthEnd,
  2609 + String chechMonth, boolean positive, String positiveIds, Integer page, Integer limit,
  2610 + Date bookStartDate, Date bookEndDate, String apparatusPositive,
  2611 + String doctorPositive, String yin, String noPassIds,
  2612 + String provinceId, String cityId, String areaId, String streetId,
  2613 + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String ckHospitalId) {
  2614 +
  2615 + BabyModelQuery babyModelQuery = new BabyModelQuery();
  2616 + babyModelQuery.setYn(YnEnums.YES.getId());
  2617 + babyModelQuery.setDisplayState("1");
  2618 + //区域医院筛选条件得到机构ID集合
  2619 + List <String> hospitalIdList = new ArrayList <>();
  2620 + if (StringUtils.isNotEmpty(hospitalProvinceId)){
  2621 + OrganizationQuery organizationQuery = new OrganizationQuery();
  2622 + organizationQuery.setProvinceId(hospitalProvinceId);
  2623 + List <Organization> organizationListP = organizationService.queryOrganization(organizationQuery);
  2624 + for (Organization organization : organizationListP) {
  2625 + hospitalIdList.add(String.valueOf(organization.getId()));
  2626 + }
  2627 + if (StringUtils.isNotEmpty(hospitalCityId)) {
  2628 + organizationQuery.setCityId(hospitalCityId);
  2629 + List <Organization> organizationListC = organizationService.queryOrganization(organizationQuery);
  2630 + for (Organization organization : organizationListC) {
  2631 + hospitalIdList.add(String.valueOf(organization.getId()));
  2632 + }
  2633 + }
  2634 + if (StringUtils.isNotEmpty(hospitalAreaId)) {
  2635 + organizationQuery.setAreaId(hospitalAreaId);
  2636 + List <Organization> organizationListA = organizationService.queryOrganization(organizationQuery);
  2637 + for (Organization organization : organizationListA) {
  2638 + hospitalIdList.add(String.valueOf(organization.getId()));
  2639 + }
  2640 + }
  2641 + if (StringUtils.isNotEmpty(ckHospitalId)) {
  2642 + hospitalIdList.add(ckHospitalId);
  2643 + }
  2644 +
  2645 + List <String> permissions = new ArrayList <>();
  2646 + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery();
  2647 + dataPermissionsModelQuery.setUserId(userId);
  2648 + List <DataPermissionsModel> dataPermissionsModelList = dataPermissionService.queryPermission(dataPermissionsModelQuery);
  2649 + if (CollectionUtils.isNotEmpty(dataPermissionsModelList)) {
  2650 + Set <String> set = dataPermissionsModelList.get(0).getData().keySet();
  2651 + Iterator <String> it = set.iterator();
  2652 + while (it.hasNext()) {
  2653 + String id = it.next();
  2654 + permissions.add(id);
  2655 + }
  2656 + }
  2657 +
  2658 + if (CollectionUtils.isNotEmpty(hospitalIdList)) {
  2659 + hospitalIdList.retainAll(permissions);
  2660 + } else {
  2661 + hospitalIdList.addAll(permissions);
  2662 + }
  2663 + }
  2664 + //机构id集合筛选
  2665 + if (CollectionUtils.isNotEmpty(hospitalIdList)) {
  2666 + babyModelQuery.setHospitalIdList(hospitalIdList);
  2667 + }
  2668 + //居住地筛选
  2669 + if(StringUtils.isNotEmpty(provinceId)){
  2670 + babyModelQuery.setProvinceId(provinceId);
  2671 + if (StringUtils.isNotEmpty(cityId)){
  2672 + babyModelQuery.setCityId(cityId);
  2673 + }
  2674 + if (StringUtils.isNotEmpty(areaId)){
  2675 + babyModelQuery.setAreaId(areaId);
  2676 + }
  2677 + if (StringUtils.isNotEmpty(streetId)){
  2678 + babyModelQuery.setStreetId(streetId);
  2679 + }
  2680 + }
  2681 +
  2682 + //筛选查询条件
  2683 + if (startBuildDate != null && endBuildDate != null) {
  2684 + babyModelQuery.setBuildDateNoybjStart(startBuildDate);
  2685 + babyModelQuery.setBuildDateNoybjEnd(DateUtil.addDay(endBuildDate, 1));
  2686 + }
  2687 + if (startDate != null && endDate != null) {
  2688 + babyModelQuery.setCheckTimeStart(startDate);
  2689 + babyModelQuery.setCheckTimeEnd(DateUtil.addDay(endDate, 1));
  2690 + }
  2691 + if (bookStartDate != null && bookEndDate != null) {
  2692 + babyModelQuery.setNextCheckTimeStart(bookStartDate);
  2693 + babyModelQuery.setNextCheckTimeEnd(DateUtil.addDay(bookEndDate, 1));
  2694 + }
  2695 + babyModelQuery.setDoctor(doctor);
  2696 + babyModelQuery.setQueryNo(key);
  2697 + if (currentMonthStart != null && currentMonthEnd != null) {
  2698 + babyModelQuery.setBirthStart(DateUtil.getBirthStart(currentMonthEnd));
  2699 + babyModelQuery.setBirthEnd(DateUtil.getBirthEnd(currentMonthStart));
  2700 + }
  2701 + List<String> chechMonths = new ArrayList<>();
  2702 + if (StringUtils.isNotEmpty(chechMonth)) {
  2703 + if ("1".equals(chechMonth)) {
  2704 + chechMonths.add("0");
  2705 + } else if ("12".equals(chechMonth)) {
  2706 + chechMonths.add("9");
  2707 + } else if ("24".equals(chechMonth)) {
  2708 + chechMonths.add("18");
  2709 + }
  2710 + chechMonths.add(chechMonth);
  2711 + }
  2712 + babyModelQuery.setCheckMonthIds(chechMonths);
  2713 + if (StringUtils.isNotEmpty(positiveIds)) {
  2714 + List<String> ids = CollectionUtils.asList(positiveIds, String.class);
  2715 + if (CollectionUtils.isNotEmpty(ids)) {
  2716 + for (String id : ids) {
  2717 + if ("extEyelook".equals(id)) {
  2718 + babyModelQuery.setExtEyelook("yang");
  2719 + } else if ("nystagmus".equals(id)) {
  2720 + babyModelQuery.setNystagmus("yang");
  2721 + } else if ("extRightEyelook".equals(id)) {
  2722 + babyModelQuery.setExtRightEyelook("yang");
  2723 + } else if ("extLeftEyelook".equals(id)) {
  2724 + babyModelQuery.setExtLeftEyelook("yang");
  2725 + } else if ("blinkRightReflex".equals(id)) {
  2726 + babyModelQuery.setBlinkRightReflex("yang");
  2727 + } else if ("blinkLefttReflex".equals(id)) {
  2728 + babyModelQuery.setBlinkLefttReflex("yang");
  2729 + } else if ("pupillaryRightReflex".equals(id)) {
  2730 + babyModelQuery.setPupillaryRightReflex("yang");
  2731 + } else if ("pupillaryLeftReflex".equals(id)) {
  2732 + babyModelQuery.setPupillaryLeftReflex("yang");
  2733 + } else if ("redRightReflex".equals(id)) {
  2734 + babyModelQuery.setRedRightReflex("yang");
  2735 + } else if ("redLeftReflex".equals(id)) {
  2736 + babyModelQuery.setRedLeftReflex("yang");
  2737 + } else if ("redReflex".equals(id)) {
  2738 + babyModelQuery.setRedReflex("yang");
  2739 + } else if ("conjunctiva".equals(id)) {
  2740 + babyModelQuery.setConjunctiva("yang");
  2741 + } else if ("corneal".equals(id)) {
  2742 + babyModelQuery.setCorneal("yang");
  2743 + } else if ("lacrimalApparatus".equals(id)) {
  2744 + babyModelQuery.setLacrimalApparatus("yang");
  2745 + } else if ("eyePositionId2".equals(id)) {
  2746 + babyModelQuery.setEyePositionId2("yang");
  2747 + } else if ("redLeft2".equals(id)) {
  2748 + babyModelQuery.setRedLeft2("yang");
  2749 + } else if ("vision2".equals(id)) {
  2750 + babyModelQuery.setVision2("yang");
  2751 + } else if ("y2".equals(id)) {
  2752 + babyModelQuery.setY2("yang");
  2753 + } else if ("refraction2".equals(id)) {
  2754 + babyModelQuery.setRefraction2("yang");
  2755 + }
  2756 + }
  2757 + }
  2758 + }
  2759 + if (StringUtils.isNotEmpty(noPassIds)) {
  2760 + List<String> ids = CollectionUtils.asList(noPassIds, String.class);
  2761 + for (String id : ids) {
  2762 + if ("eyeAppearance".equals(id)) {
  2763 + babyModelQuery.setEyeAppearance("2");
  2764 + } else if ("redReflexQhd".equals(id)) {
  2765 + babyModelQuery.setRedReflexQhd("2");
  2766 + } else if ("blinkReflex".equals(id)) {
  2767 + babyModelQuery.setBlinkReflex("2");
  2768 + } else if ("redBallTest".equals(id)) {
  2769 + babyModelQuery.setRedBallTest("2");
  2770 + } else if ("behaviorObservation".equals(id)) {
  2771 + babyModelQuery.setBehaviorObservation("2");
  2772 + } else if ("refractiveScreening".equals(id)) {
  2773 + babyModelQuery.setRefractiveScreening("2");
  2774 + } else if ("eyePositionExamination".equals(id)) {
  2775 + babyModelQuery.setEyePositionExamination("2");
  2776 + } else if ("eyeMovement".equals(id)) {
  2777 + babyModelQuery.setEyeMovement("2");
  2778 + }
  2779 + }
  2780 + }
  2781 + if (StringUtils.isNotEmpty(yin)) {
  2782 + babyModelQuery.setApparatusNin("2");
  2783 + babyModelQuery.setDoctorJudgementNin("2");
  2784 + }
  2785 + if (positive) {
  2786 + babyModelQuery.setApparatus("2");
  2787 + babyModelQuery.setDoctorJudgement("2");
  2788 + }
  2789 + babyModelQuery.setNeed("true");
  2790 + babyModelQuery.setPage(page);
  2791 + babyModelQuery.setLimit(limit);
  2792 + babyModelQuery.setYn(YnEnums.YES.getId());
  2793 + List<BabyModel> babyModelList = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery, "checkTime", Sort.Direction.DESC);
  2794 + List<Map> results = new ArrayList<>();
  2795 + for (BabyModel babyModel : babyModelList) {
  2796 + Map mapResult = new HashMap();
  2797 + mapResult.put("babyId", babyModel.getId());//儿童档案id
  2798 + mapResult.put("babyName", babyModel.getName());//儿童姓名
  2799 + if (babyModel.getSex() != null && babyModel.getSex() == 0) {
  2800 + mapResult.put("sex", "女");//性别
  2801 + } else if (babyModel.getSex() != null && babyModel.getSex() == 1) {
  2802 + mapResult.put("sex", "男");
  2803 + } else {
  2804 + mapResult.put("sex", "_");
  2805 + }
  2806 + mapResult.put("mname", babyModel.getMname());//母亲姓名
  2807 + mapResult.put("birth", DateUtil.getyyyy_MM_dd(babyModel.getBirth()));//出生日期
  2808 + mapResult.put("buildDate", DateUtil.getyyyy_MM_dd(babyModel.getBuildDate()));//建档日期
  2809 + if (StringUtils.isNotEmpty(babyModel.getCheckMonthId())) {
  2810 + if (StringUtils.isNotEmpty(babyModel.getEdition())) {
  2811 + //处理老数据
  2812 + if ("0".equals(babyModel.getCheckMonthId())) {
  2813 + babyModel.setCheckMonthId("1");
  2814 + } else if ("9".equals(babyModel.getCheckMonthId())) {
  2815 + babyModel.setCheckMonthId("12");
  2816 + } else if ("18".equals(babyModel.getCheckMonthId())) {
  2817 + babyModel.setCheckMonthId("24");
  2818 + }
  2819 + mapResult.put("checkMonthAge", CheckMonthQhdEnums.getName(babyModel.getCheckMonthId()));
  2820 + } else {
  2821 + mapResult.put("checkMonthAge", CheckMonthEnums.getName(babyModel.getCheckMonthId()));
  2822 + }
  2823 + }
  2824 + //居住地
  2825 + String address = CommonsHelper.getResidence(babyModel.getProvinceId(), babyModel.getCityId(),
  2826 + babyModel.getAreaId(), babyModel.getStreetId(), babyModel.getAddress(), basicConfigService);
  2827 + mapResult.put("completeAddress",address);
  2828 + //检查医院
  2829 + String hospitalName=null;
  2830 + if(StringUtils.isNotEmpty(babyModel.getId())){
  2831 + List<BabyEyeCheck> babyEyeChecks=mongoTemplate.find(Query.query(new Criteria("babyId").is(babyModel.getId())).with(new Sort(Sort.Direction.DESC, "checkTime")), BabyEyeCheck.class);
  2832 + if(CollectionUtils.isNotEmpty(babyEyeChecks)){
  2833 + hospitalName=organizationService.getOrganization(Integer.valueOf(babyEyeChecks.get(0).getHospitalId())).getName();
  2834 + }
  2835 +
  2836 + }
  2837 + mapResult.put("hospitalName",hospitalName);
  2838 + StringBuilder positiveBaby = getYxxmBaby(babyModel);//阳性项目
  2839 + mapResult.put("positive", positiveBaby.toString());//阳性项目
  2840 + mapResult.put("doctor", couponMapper.getUserName(babyModel.getDoctor()));//检查医生
  2841 + mapResult.put("checkTime", DateUtil.getYyyyMmDd(babyModel.getCheckTime()));//检查日期
  2842 + mapResult.put("nextCheckTime", DateUtil.getYyyyMmDd(babyModel.getNextCheckTime()));//预约日期
  2843 + mapResult.put("checkId", babyModel.getCheckId());//儿童眼保健检查id
  2844 + results.add(mapResult);
  2845 + }
  2846 +
  2847 + BaseListResponse objectResponse = new BaseListResponse();
  2848 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  2849 + objectResponse.setData(results);
  2850 + objectResponse.setPageInfo(babyModelQuery.getPageInfo());
  2851 + objectResponse.setErrormsg("成功");
  2852 + return objectResponse;
2603 2853 }
2604 2854  
2605 2855 }