diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java index 432f37c..8ec4cfe 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java @@ -289,6 +289,41 @@ public class BabyEyeCheckController extends BaseController { babySource,healthCheckType,healthCheckTypeScattered,healthCheckTypeWhole,kindergarten,basicOrganization, provinceId,cityId,areaId,streetId,hospitalProvinceId,hospitalCityId,hospitalAreaId,hospitalId); } - + /** + * 区域眼保健管理-眼保健管理 + *@param startDate + * @param endDate + * @param doctor + * @param key 姓名/联系方式/就诊卡 + * @param currentMonthStart/currentMonthEnd 当前月龄范围 + * @param chechMonth 检查月龄 + * @param positive 是否是阳性 + * @param bookStartDate 预约开始时间 + * @param bookEndDate 预约结束时间 + * @param positive 是否是阳性 + * @param page + * @param limit + * @param request + * @param provinceId //居住地-省 + * @param cityId //居住地-市 + * @param areaId //居住地-区县 + * @param streetId //居住地-街道 + * @param hospitalProvinceId //检查医院-省 + * @param hospitalCityId //检查医院-市 + * @param hospitalAreaId //检查医院-区县 + * @param hospitalId //检查医院-医院 + */ + @ResponseBody + @TokenRequired + @RequestMapping(value = "/childrenFilingListQy", method = RequestMethod.GET) + 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, + Date bookStartDate, Date bookEndDate, String apparatusPositive, String doctorPositive, String yin,String noPassIds, + String provinceId, String cityId, String areaId, String streetId, + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId) { + return babyEyeCheckService.childrenFilingListQy(getUserId(request), startBuildDate, endBuildDate, startDate, endDate, doctor, key, + currentMonthStart, currentMonthEnd, chechMonth, positive, positiveIds, page, limit, + bookStartDate, bookEndDate, apparatusPositive, doctorPositive, yin, noPassIds, + provinceId,cityId,areaId,streetId,hospitalProvinceId,hospitalCityId,hospitalAreaId,hospitalId); + } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java index 417d3b5..9d47eb9 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java @@ -59,4 +59,11 @@ public interface BabyEyeCheckService extends IBaseService { Integer kindergarten, Integer basicOrganization, String provinceId, String cityId, String areaId, String streetId, String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId); + + BaseResponse childrenFilingListQy(Integer userId, 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, Date bookStartDate, Date bookEndDate, String apparatusPositive, + String doctorPositive, String yin, String noPassIds, + String provinceId, String cityId, String areaId, String streetId, + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String hospitalId); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java index 429fb5f..bf03250 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java @@ -2385,6 +2385,7 @@ public class BabyEyeCheckServiceImpl extends BaseServiceImpl implements BabyEyeC chechMonths.add(chechMonth); } + //这里加医院筛选为了只查本院检查的儿童 if (StringUtils.isNotEmpty(chechMonth)) { criteria.and("checkMonthId").in(chechMonths); } @@ -2602,4 +2603,253 @@ public class BabyEyeCheckServiceImpl extends BaseServiceImpl implements BabyEyeC return RespBuilder.buildSuccess(pageResult); } + @Override + public BaseResponse childrenFilingListQy(Integer userId, 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, + Date bookStartDate, Date bookEndDate, String apparatusPositive, + String doctorPositive, String yin, String noPassIds, + String provinceId, String cityId, String areaId, String streetId, + String hospitalProvinceId, String hospitalCityId, String hospitalAreaId, String ckHospitalId) { + + BabyModelQuery babyModelQuery = new BabyModelQuery(); + babyModelQuery.setYn(YnEnums.YES.getId()); + babyModelQuery.setDisplayState("1"); + //区域医院筛选条件得到机构ID集合 + List hospitalIdList = new ArrayList <>(); + if (StringUtils.isNotEmpty(hospitalProvinceId)){ + OrganizationQuery organizationQuery = new OrganizationQuery(); + organizationQuery.setProvinceId(hospitalProvinceId); + List organizationListP = organizationService.queryOrganization(organizationQuery); + for (Organization organization : organizationListP) { + hospitalIdList.add(String.valueOf(organization.getId())); + } + if (StringUtils.isNotEmpty(hospitalCityId)) { + organizationQuery.setCityId(hospitalCityId); + List organizationListC = organizationService.queryOrganization(organizationQuery); + for (Organization organization : organizationListC) { + hospitalIdList.add(String.valueOf(organization.getId())); + } + } + if (StringUtils.isNotEmpty(hospitalAreaId)) { + organizationQuery.setAreaId(hospitalAreaId); + List organizationListA = organizationService.queryOrganization(organizationQuery); + for (Organization organization : organizationListA) { + hospitalIdList.add(String.valueOf(organization.getId())); + } + } + if (StringUtils.isNotEmpty(ckHospitalId)) { + hospitalIdList.add(ckHospitalId); + } + + List permissions = new ArrayList <>(); + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); + dataPermissionsModelQuery.setUserId(userId); + List dataPermissionsModelList = dataPermissionService.queryPermission(dataPermissionsModelQuery); + if (CollectionUtils.isNotEmpty(dataPermissionsModelList)) { + Set set = dataPermissionsModelList.get(0).getData().keySet(); + Iterator it = set.iterator(); + while (it.hasNext()) { + String id = it.next(); + permissions.add(id); + } + } + + if (CollectionUtils.isNotEmpty(hospitalIdList)) { + hospitalIdList.retainAll(permissions); + } else { + hospitalIdList.addAll(permissions); + } + } + //机构id集合筛选 + if (CollectionUtils.isNotEmpty(hospitalIdList)) { + babyModelQuery.setHospitalIdList(hospitalIdList); + } + //居住地筛选 + if(StringUtils.isNotEmpty(provinceId)){ + babyModelQuery.setProvinceId(provinceId); + if (StringUtils.isNotEmpty(cityId)){ + babyModelQuery.setCityId(cityId); + } + if (StringUtils.isNotEmpty(areaId)){ + babyModelQuery.setAreaId(areaId); + } + if (StringUtils.isNotEmpty(streetId)){ + babyModelQuery.setStreetId(streetId); + } + } + + //筛选查询条件 + if (startBuildDate != null && endBuildDate != null) { + babyModelQuery.setBuildDateNoybjStart(startBuildDate); + babyModelQuery.setBuildDateNoybjEnd(DateUtil.addDay(endBuildDate, 1)); + } + if (startDate != null && endDate != null) { + babyModelQuery.setCheckTimeStart(startDate); + babyModelQuery.setCheckTimeEnd(DateUtil.addDay(endDate, 1)); + } + if (bookStartDate != null && bookEndDate != null) { + babyModelQuery.setNextCheckTimeStart(bookStartDate); + babyModelQuery.setNextCheckTimeEnd(DateUtil.addDay(bookEndDate, 1)); + } + babyModelQuery.setDoctor(doctor); + babyModelQuery.setQueryNo(key); + if (currentMonthStart != null && currentMonthEnd != null) { + babyModelQuery.setBirthStart(DateUtil.getBirthStart(currentMonthEnd)); + babyModelQuery.setBirthEnd(DateUtil.getBirthEnd(currentMonthStart)); + } + List chechMonths = new ArrayList<>(); + if (StringUtils.isNotEmpty(chechMonth)) { + if ("1".equals(chechMonth)) { + chechMonths.add("0"); + } else if ("12".equals(chechMonth)) { + chechMonths.add("9"); + } else if ("24".equals(chechMonth)) { + chechMonths.add("18"); + } + chechMonths.add(chechMonth); + } + babyModelQuery.setCheckMonthIds(chechMonths); + if (StringUtils.isNotEmpty(positiveIds)) { + List ids = CollectionUtils.asList(positiveIds, String.class); + if (CollectionUtils.isNotEmpty(ids)) { + for (String id : ids) { + if ("extEyelook".equals(id)) { + babyModelQuery.setExtEyelook("yang"); + } else if ("nystagmus".equals(id)) { + babyModelQuery.setNystagmus("yang"); + } else if ("extRightEyelook".equals(id)) { + babyModelQuery.setExtRightEyelook("yang"); + } else if ("extLeftEyelook".equals(id)) { + babyModelQuery.setExtLeftEyelook("yang"); + } else if ("blinkRightReflex".equals(id)) { + babyModelQuery.setBlinkRightReflex("yang"); + } else if ("blinkLefttReflex".equals(id)) { + babyModelQuery.setBlinkLefttReflex("yang"); + } else if ("pupillaryRightReflex".equals(id)) { + babyModelQuery.setPupillaryRightReflex("yang"); + } else if ("pupillaryLeftReflex".equals(id)) { + babyModelQuery.setPupillaryLeftReflex("yang"); + } else if ("redRightReflex".equals(id)) { + babyModelQuery.setRedRightReflex("yang"); + } else if ("redLeftReflex".equals(id)) { + babyModelQuery.setRedLeftReflex("yang"); + } else if ("redReflex".equals(id)) { + babyModelQuery.setRedReflex("yang"); + } else if ("conjunctiva".equals(id)) { + babyModelQuery.setConjunctiva("yang"); + } else if ("corneal".equals(id)) { + babyModelQuery.setCorneal("yang"); + } else if ("lacrimalApparatus".equals(id)) { + babyModelQuery.setLacrimalApparatus("yang"); + } else if ("eyePositionId2".equals(id)) { + babyModelQuery.setEyePositionId2("yang"); + } else if ("redLeft2".equals(id)) { + babyModelQuery.setRedLeft2("yang"); + } else if ("vision2".equals(id)) { + babyModelQuery.setVision2("yang"); + } else if ("y2".equals(id)) { + babyModelQuery.setY2("yang"); + } else if ("refraction2".equals(id)) { + babyModelQuery.setRefraction2("yang"); + } + } + } + } + if (StringUtils.isNotEmpty(noPassIds)) { + List ids = CollectionUtils.asList(noPassIds, String.class); + for (String id : ids) { + if ("eyeAppearance".equals(id)) { + babyModelQuery.setEyeAppearance("2"); + } else if ("redReflexQhd".equals(id)) { + babyModelQuery.setRedReflexQhd("2"); + } else if ("blinkReflex".equals(id)) { + babyModelQuery.setBlinkReflex("2"); + } else if ("redBallTest".equals(id)) { + babyModelQuery.setRedBallTest("2"); + } else if ("behaviorObservation".equals(id)) { + babyModelQuery.setBehaviorObservation("2"); + } else if ("refractiveScreening".equals(id)) { + babyModelQuery.setRefractiveScreening("2"); + } else if ("eyePositionExamination".equals(id)) { + babyModelQuery.setEyePositionExamination("2"); + } else if ("eyeMovement".equals(id)) { + babyModelQuery.setEyeMovement("2"); + } + } + } + if (StringUtils.isNotEmpty(yin)) { + babyModelQuery.setApparatusNin("2"); + babyModelQuery.setDoctorJudgementNin("2"); + } + if (positive) { + babyModelQuery.setApparatus("2"); + babyModelQuery.setDoctorJudgement("2"); + } + babyModelQuery.setNeed("true"); + babyModelQuery.setPage(page); + babyModelQuery.setLimit(limit); + babyModelQuery.setYn(YnEnums.YES.getId()); + List babyModelList = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery, "checkTime", Sort.Direction.DESC); + List results = new ArrayList<>(); + for (BabyModel babyModel : babyModelList) { + Map mapResult = new HashMap(); + mapResult.put("babyId", babyModel.getId());//儿童档案id + mapResult.put("babyName", babyModel.getName());//儿童姓名 + if (babyModel.getSex() != null && babyModel.getSex() == 0) { + mapResult.put("sex", "女");//性别 + } else if (babyModel.getSex() != null && babyModel.getSex() == 1) { + mapResult.put("sex", "男"); + } else { + mapResult.put("sex", "_"); + } + mapResult.put("mname", babyModel.getMname());//母亲姓名 + mapResult.put("birth", DateUtil.getyyyy_MM_dd(babyModel.getBirth()));//出生日期 + mapResult.put("buildDate", DateUtil.getyyyy_MM_dd(babyModel.getBuildDate()));//建档日期 + if (StringUtils.isNotEmpty(babyModel.getCheckMonthId())) { + if (StringUtils.isNotEmpty(babyModel.getEdition())) { + //处理老数据 + if ("0".equals(babyModel.getCheckMonthId())) { + babyModel.setCheckMonthId("1"); + } else if ("9".equals(babyModel.getCheckMonthId())) { + babyModel.setCheckMonthId("12"); + } else if ("18".equals(babyModel.getCheckMonthId())) { + babyModel.setCheckMonthId("24"); + } + mapResult.put("checkMonthAge", CheckMonthQhdEnums.getName(babyModel.getCheckMonthId())); + } else { + mapResult.put("checkMonthAge", CheckMonthEnums.getName(babyModel.getCheckMonthId())); + } + } + //居住地 + String address = CommonsHelper.getResidence(babyModel.getProvinceId(), babyModel.getCityId(), + babyModel.getAreaId(), babyModel.getStreetId(), babyModel.getAddress(), basicConfigService); + mapResult.put("completeAddress",address); + //检查医院 + String hospitalName=null; + if(StringUtils.isNotEmpty(babyModel.getId())){ + List babyEyeChecks=mongoTemplate.find(Query.query(new Criteria("babyId").is(babyModel.getId())).with(new Sort(Sort.Direction.DESC, "checkTime")), BabyEyeCheck.class); + if(CollectionUtils.isNotEmpty(babyEyeChecks)){ + hospitalName=organizationService.getOrganization(Integer.valueOf(babyEyeChecks.get(0).getHospitalId())).getName(); + } + + } + mapResult.put("hospitalName",hospitalName); + StringBuilder positiveBaby = getYxxmBaby(babyModel);//阳性项目 + mapResult.put("positive", positiveBaby.toString());//阳性项目 + mapResult.put("doctor", couponMapper.getUserName(babyModel.getDoctor()));//检查医生 + mapResult.put("checkTime", DateUtil.getYyyyMmDd(babyModel.getCheckTime()));//检查日期 + mapResult.put("nextCheckTime", DateUtil.getYyyyMmDd(babyModel.getNextCheckTime()));//预约日期 + mapResult.put("checkId", babyModel.getCheckId());//儿童眼保健检查id + results.add(mapResult); + } + + BaseListResponse objectResponse = new BaseListResponse(); + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); + objectResponse.setData(results); + objectResponse.setPageInfo(babyModelQuery.getPageInfo()); + objectResponse.setErrormsg("成功"); + return objectResponse; + } + }