feige
2024-06-10 2f432628a460a73f830c278a7d69e8328767a7b6
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -72,6 +72,11 @@
//        return AjaxResult.success(data);
        //要查自己家庭的
        ZInfoUser myself = zInfoUserService.getMyself();
        if(myself==null)
        {
            //   System.out.println("ssssss");
            return AjaxResult.success("您没加入到对应的家庭,请联系管理员");
        }
        Long familyId = myself.getFamilyId();
        //也要查别人授权的
        List<ZAuthority> authority = zAuthorityService.getAuthority();
@@ -150,10 +155,15 @@
        }
        log.info("数据列表为:{}", dataList);
        for (ZfDoctor zfDoctor : dataList) {
            zfDoctorService.addData(zfDoctor);
        }
        for (ZfDoctor zfDoctor : dataList) {
            if (zfDoctor.getSymptom().length() == 0 || zfDoctor.getSymptom() == null) {
                throw new RuntimeException("症状为空,导入数据失败");
            }
            else {
                zfDoctorService.addData(zfDoctor);
            }
        }
        return AjaxResult.success("导入数据成功");
    }
@@ -246,6 +256,10 @@
            //先到es中查询到对应那条数据在es的id
            EsModel esResult = esService.findByCtId(dataById.getId().intValue(), "家庭小医生");
            if (esResult == null){
                return AjaxResult.success();
            }
            //操作es修改数据
            EsModel newModel = new EsModel();
            if(zfDoctor.getType()!=null){
@@ -337,11 +351,15 @@
            //删除es中的数据
            zfDoctors.stream().forEach(zfDoctor -> {
                EsModel esModel = esService.findByCtId(zfDoctor.getId().intValue(), "家庭小医生");
                DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
                try {
                    restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                if (esModel != null){
                    DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
                    try {
                        restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            });
            return AjaxResult.success();