diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java index ea96e1ed2..35a5ee751 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java @@ -42,6 +42,7 @@ import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.Patientexam import cn.iocoder.yudao.module.tblist.service.patientexamlist.PatientexamlistService; import javax.annotation.Resource; +import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -173,6 +174,19 @@ public class PatientexamlistController { return success(_out); } + @GetMapping("/getCheckRecord") + @Operation(summary = "云胶片-getCheckRecord") + public CommonResult> getCheckRecord(@RequestParam("no") String no, @RequestParam("orgId") String orgId) { + Map _out = null; + try { + _out = patientexamlistService.getCheckRecord(no, orgId); + } catch (Exception ex) { + _out = new HashMap<>(); + _out.put("code", "error"); + } + return success(_out); + } + @GetMapping("/dicomDataRefresh") @Operation(summary = "dicomj检查后数据刷新") @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:query')") diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java index 4685a9c06..9ddc12f6e 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java @@ -102,5 +102,27 @@ public interface PatientexamlistMapper extends BaseMapperX { + " ORDER BY date") List GetDateYYZDCount(@Param("orgId") String orgId); - + //云胶片功能 + @Select(" SELECT\n" + + " t1.ID as id, \n" + + " t1.examId as checkNumber, \n" + + " t1.pName as patientName, \n" + + " t1.gender as patientSex, \n" + + " '' as patientAge,t1.birthday as patientBirthday, \n" + + " '' as phone, \n" + + " t1.examItemCode as checkModuleId, \n" + + " t1.examItemName as checkModuleName, \n" + + " t1.examDescription as itemResult, \n" + + " t1.diagResults as diagResult, \n" + + " t1.examDate as checkDate, \n" + + " t1.diagDoctor as doctor, \n" + + " t1.orgId as orgId,\n" + + " t2.orgName as orgName, \n" + + " t2.dcmprefix as hostUrl \n" + + "FROM tb_patientexamlist t1\n" + + "LEFT JOIN tb_org t2 ON t1.orgId=t2.orgID AND t2.isdelete!=1\n" + + "WHERE 1=1\n" + + "AND t1.regId=#{regId}\n" + + "AND t1.orgId=#{orgId} ") + List> getCheckRecord(@Param("regId") String regId, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java index c7efd9918..5a040f32f 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java @@ -92,9 +92,16 @@ public interface PatientexamlistService extends IService { boolean dicomDataRefresh(String orgId); boolean insertbatch(List doList); -// 获取已检查的阴性阳性重大阳性统计 - PatientexamlistCountVO GetWholeDiagFlagCount(String orgId); - // 获取一周已检查的阴性阳性重大阳性统计 + //获取已检查的阴性阳性重大阳性统计 + PatientexamlistCountVO GetWholeDiagFlagCount(String orgId); + + //获取一周已检查的阴性阳性重大阳性统计 List GetDateWholeDiagFlagCount(String orgId); + + /** + * 云胶片功能 + * getCheckRecord + */ + Map getCheckRecord(String regId, String orgId); } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java index 8355d3e22..51852b0c2 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java @@ -272,4 +272,25 @@ public class PatientexamlistServiceImpl extends ServiceImpl getCheckRecord(String regId, String orgId) { + Map _out = new HashMap<>(); + + List> _list = patientexamlistMapper.getCheckRecord(regId, orgId); + + if (_list != null && _list.size() > 0) { + _out.put("code", "success"); + _out.put("items", _list); + _out.put("no", regId); + _out.put("name", _list.get(0).get("patientName")); + _out.put("orgId", orgId); + _out.put("orgName", _list.get(0).get("orgName")); + _out.put("title", (_list.get(0).get("patientName") != null ? _list.get(0).get("patientName").toString().trim() : "") + " CT影像检查报告单和云胶片"); + } else { + _out.put("code", "empty"); + } + + return _out; + } + } \ No newline at end of file diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/reporttemplate/ReporttemplateController.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/reporttemplate/ReporttemplateController.java index 30f8c1d9d..0b67ba27c 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/reporttemplate/ReporttemplateController.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/reporttemplate/ReporttemplateController.java @@ -68,6 +68,23 @@ public class ReporttemplateController { return success(reporttemplate); } + @GetMapping("/hasChildren") + @Operation(summary = "诊断模板是否存在子数据") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:reporttemplate:query')") + public CommonResult hasReporttemplateChildren(@RequestParam("id") String id) { + boolean _out = reporttemplateService.hasReporttemplateChildren(id); + return success(_out); + } + + @GetMapping("/getroot") + @Operation(summary = "获得诊断模板root节点") + @PreAuthorize("@ss.hasPermission('system:reporttemplate:query')") + public CommonResult> getReporttemplateRoot() { + List reporttemplates = reporttemplateService.getReporttemplateRoot(); + return success(reporttemplates); + } + @GetMapping("/getlist") @Operation(summary = "获得诊断模板list") @PreAuthorize("@ss.hasPermission('system:reporttemplate:query')") diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/dal/reporttemplate/ReporttemplateMapper.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/dal/reporttemplate/ReporttemplateMapper.java index 5aababb5e..f49d9a8a5 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/dal/reporttemplate/ReporttemplateMapper.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/dal/reporttemplate/ReporttemplateMapper.java @@ -1,12 +1,10 @@ package cn.iocoder.yudao.module.ultrasoniccom.dal.reporttemplate; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.reporttemplate.vo.*; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.*; import java.util.*; @@ -20,30 +18,31 @@ import java.util.*; public interface ReporttemplateMapper extends BaseMapperX { //查询 - default List selectList(String pid, String orgId) { - return selectList(new LambdaQueryWrapperX() - .neIfPresent(ReporttemplateDO::getIsdelete, '1') - .eq(ReporttemplateDO::getPid, pid) - .eqIfPresent(ReporttemplateDO::getOrgId, orgId) - .orderByAsc(ReporttemplateDO::getTemplateName)); - } - - default List selectNodes(ReporttemplatePageReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .neIfPresent(ReporttemplateDO::getIsdelete, '1') - .eq(ReporttemplateDO::getOrgId, reqVO.getOrgId()) - .likeIfPresent(ReporttemplateDO::getTemplateName, reqVO.getTemplateName()) - .isNull(reqVO.getTemplateLimitsType() != null && reqVO.getTemplateLimitsType().trim().equals("1"), - ReporttemplateDO::getPrivateDoctorId) - .isNotNull(reqVO.getTemplateLimitsType() != null && reqVO.getTemplateLimitsType().trim().equals("2"), - ReporttemplateDO::getPrivateDoctorId) - .orderByAsc(ReporttemplateDO::getTemplateName)); - } - default List selectNodes(String orgId) { return selectList(new LambdaQueryWrapperX() .neIfPresent(ReporttemplateDO::getIsdelete, '1') .eq(ReporttemplateDO::getOrgId, orgId) .orderByAsc(ReporttemplateDO::getTemplateName)); } + + default List selectNodes(String orgId, String Pid) { + return selectList(new LambdaQueryWrapperX() + .neIfPresent(ReporttemplateDO::getIsdelete, '1') + .eq(ReporttemplateDO::getOrgId, orgId) + .isNotNull(ReporttemplateDO::getPid) + .eq(ReporttemplateDO::getPid, (Pid == null ? "" : Pid.trim())) + .orderByAsc(ReporttemplateDO::getTemplateName)); + } + + default List selectNodes_Root(String orgId) { + return selectList(new LambdaQueryWrapperX() + .neIfPresent(ReporttemplateDO::getIsdelete, '1') + .eq(ReporttemplateDO::getDataType, '1') + .eq(ReporttemplateDO::getOrgId, orgId) + .orderByAsc(ReporttemplateDO::getTemplateName)); + } + + //私有通用 + @Select(" ${sql} ") + List use_selectList(@Param("sql") String sql); } \ No newline at end of file diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateService.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateService.java index fd36491b9..7035fb594 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateService.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateService.java @@ -27,6 +27,8 @@ public interface ReporttemplateService { PageResult getReporttemplatePage(ReporttemplatePageReqVO pageReqVO); - List getReporttemplatelist(); + List getReporttemplateRoot(); + + boolean hasReporttemplateChildren(String id); } \ No newline at end of file diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateServiceImpl.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateServiceImpl.java index 4e453ed62..a9d645118 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateServiceImpl.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/reporttemplate/ReporttemplateServiceImpl.java @@ -1,24 +1,20 @@ package cn.iocoder.yudao.module.ultrasoniccom.service.reporttemplate; import cn.iocoder.yudao.framework.common.exception.ErrorCode; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.*; +import cn.iocoder.yudao.module.system.service.user.*; import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.reporttemplate.vo.*; import cn.iocoder.yudao.module.ultrasoniccom.dal.reporttemplate.*; -import cn.iocoder.yudao.module.system.service.user.*; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.*; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import java.util.stream.*; import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -110,83 +106,187 @@ public class ReporttemplateServiceImpl implements ReporttemplateService { @Override public PageResult getReporttemplatePage(ReporttemplatePageReqVO pageReqVO) { + List _viewPage = Collections.emptyList(); List _view = null; - //当前登陆用户 AdminUserDO user = userService.getUser(getLoginUserId()); pageReqVO.setOrgId(user.getOrgId()); - //全部数据(缓存) - List _tempAll = reporttemplateMapper.selectNodes(user.getOrgId()); - List _tempVAll = null; - //直接符合的叶和根 - List _temp = reporttemplateMapper.selectNodes(pageReqVO); - List _tempV = null; - //经推导符合的根 - List _tempOther = null; - List _tempVOther = null; + List Nodes_all = reporttemplateMapper.selectNodes(pageReqVO.getOrgId()); + List Nodes_res = null; - if (_temp != null && _temp.size() > 0) { - //计算_tempOther - ReporttemplateDO _tempDO = null; - ReporttemplateDO _tempDO2 = null; - boolean doNext = true; - _tempOther = new ArrayList<>(); - for (ReporttemplateDO item : _temp) { - _tempDO = item; - doNext = true; - while (doNext) { - _tempDO2 = null; - final String pid = _tempDO.getPid(); - _tempDO = _tempAll.stream().filter(it -> it.getId() != null && pid != null && !pid.trim().equals("0") && it.getId().equals(pid)) - .findFirst().orElse(null); - if (_tempDO == null || _tempDO.getId() == null || _tempDO.getPid() == null) - doNext = false; - else { - final String id = _tempDO.getId(); - _tempDO2 = _temp.stream().filter(it -> it.getId() != null && it.getId().equals(id)) - .findFirst().orElse(null); - if (_tempDO2 != null) - doNext = false; - else if (_tempOther.contains(_tempDO)) - doNext = false; - else { - _tempOther.add(_tempDO); - if (_tempDO.getPid().trim().equals("0")) - doNext = false; + //计算Nodes_res + if (isEmptyList(Nodes_all) || + (pageReqVO.getTemplateName() == null || pageReqVO.getTemplateName().trim().equals("")) && + (pageReqVO.getTemplateLimitsType() == null || !new ArrayList(Arrays.asList("1", "2")).contains(pageReqVO.getTemplateLimitsType().trim())) && + (pageReqVO.getTemplateType() == null || pageReqVO.getTemplateType().trim().equals(""))) { + Nodes_res = Nodes_all; + } else { + Nodes_res = null; + List Nodes_select_name = null; + List Nodes_select_private = null; + List Nodes_select_Type = null; + + //姓名 + if (pageReqVO.getTemplateName() != null && !pageReqVO.getTemplateName().trim().equals("")) { + Nodes_select_name = Collections.emptyList(); + List Nodes_name = Nodes_all.stream().filter(it -> it.getId() != null && it.getTemplateName() != null && it.getTemplateName().trim().contains(pageReqVO.getTemplateName().trim())) + .collect(Collectors.toList()); + + if (!isEmptyList(Nodes_name)) { + List Nodes_name_tree = new ArrayList<>(Nodes_name); + List Nodes_name_temp = null; + List Nodes_name_temp2 = null; + List Nodes_name_temp3 = null; + + Nodes_name_temp = Nodes_name_tree.stream().filter(it -> it.getId() != null && it.getDataType() != null && it.getDataType().trim().equals("1")) + .collect(Collectors.toList()); + while (!isEmptyList(Nodes_name_temp)) { + Nodes_name_temp2 = new ArrayList<>(); + for (ReporttemplateDO item : Nodes_name_temp) { + String id = (item.getId() == null ? "" : item.getId().trim()); + Nodes_name_temp3 = Nodes_all.stream().filter(it -> it.getId() != null && it.getPid() != null && it.getPid().trim().equals(id)) + .collect(Collectors.toList()); + if (!isEmptyList(Nodes_name_temp3)) { + for (ReporttemplateDO item2 : Nodes_name_temp3) { + if (item2 != null && !Nodes_name_tree.contains(item2)) { + Nodes_name_tree.add(item2); + if (item2.getDataType() != null && item2.getDataType().trim().equals("1") && !Nodes_name_temp2.contains(item2)) + Nodes_name_temp2.add(item2); + } + } + } } + Nodes_name_temp = Nodes_name_temp2; + } + + Nodes_select_name = Nodes_name_tree.stream().filter(it -> it.getId() != null && (it.getDataType() == null || it.getDataType().trim().equals("0"))) + .collect(Collectors.toList()); + } + if (isEmptyList(Nodes_select_name)) + Nodes_select_name = Collections.emptyList(); + } + + //权限 + if (pageReqVO.getTemplateLimitsType() != null && new ArrayList(Arrays.asList("1", "2")).contains(pageReqVO.getTemplateLimitsType().trim())) { + Nodes_select_private = Nodes_all.stream().filter(it -> it.getId() != null && it.getDataType() != null && it.getDataType().trim().equals("0") && + (pageReqVO.getTemplateLimitsType().trim().equals("1") ? (it.getPrivateDoctorId() == null || it.getPrivateDoctorId().trim().equals("")) : (it.getPrivateDoctorId() != null && !it.getPrivateDoctorId().trim().equals("")))) + .collect(Collectors.toList()); + if (isEmptyList(Nodes_select_private)) + Nodes_select_private = Collections.emptyList(); + } + + //类型 + if (pageReqVO.getTemplateType() != null && !pageReqVO.getTemplateType().trim().equals("")) { + Nodes_select_Type = Nodes_all.stream().filter(it -> it.getId() != null && it.getTemplateType() != null && it.getTemplateType().trim().equals(pageReqVO.getTemplateType().trim())) + .collect(Collectors.toList()); + List Nodes_type_tree = null; + if (!isEmptyList(Nodes_select_Type)) + Nodes_type_tree = Nodes_select_Type.stream().filter(it -> it.getPid() != null && it.getPid().trim().equals("0") && it.getDataType() != null && it.getDataType().trim().equals("1")) + .collect(Collectors.toList()); + if (!isEmptyList(Nodes_select_Type) && !isEmptyList(Nodes_type_tree)) { + + List Nodes_type_temp = null; + List Nodes_type_temp2 = null; + List Nodes_type_temp3 = null; + + Nodes_type_temp = new ArrayList<>(Nodes_type_tree); + while (!isEmptyList(Nodes_type_temp)) { + Nodes_type_temp2 = new ArrayList<>(); + for (ReporttemplateDO item : Nodes_type_temp) { + String id = (item.getId() == null ? "" : item.getId().trim()); + Nodes_type_temp3 = Nodes_select_Type.stream().filter(it -> it.getId() != null && it.getPid() != null && it.getPid().trim().equals(id)) + .collect(Collectors.toList()); + if (!isEmptyList(Nodes_type_temp3)) { + for (ReporttemplateDO item2 : Nodes_type_temp3) { + if (item2 != null && !Nodes_type_tree.contains(item2)) { + Nodes_type_tree.add(item2); + if (item2.getDataType() != null && item2.getDataType().trim().equals("1") && !Nodes_type_temp2.contains(item2)) + Nodes_type_temp2.add(item2); + } + } + } + } + Nodes_type_temp = Nodes_type_temp2; + } + + Nodes_select_Type = Nodes_type_tree.stream().filter(it -> it.getId() != null && (it.getDataType() == null || it.getDataType().trim().equals("0"))) + .collect(Collectors.toList()); + } else + Nodes_select_Type = Collections.emptyList(); + if (isEmptyList(Nodes_select_Type)) + Nodes_select_Type = Collections.emptyList(); + } + + //整理Nodes_res + if (Nodes_select_name == null && Nodes_select_private == null && Nodes_select_Type == null) { + Nodes_res = Nodes_all; + } else if ((Nodes_select_name != null && Nodes_select_name.size() <= 0) || + (Nodes_select_private != null && Nodes_select_private.size() <= 0) || + (Nodes_select_Type != null && Nodes_select_Type.size() <= 0)) { + Nodes_res = null; + } else { + Nodes_res = new ArrayList<>(); + boolean canAdd = false; + for (ReporttemplateDO it : Nodes_all) { + canAdd = false; + if (it != null && it.getDataType() != null && it.getDataType().trim().equals("0")) { + if ((Nodes_select_name == null || Nodes_select_name.contains(it)) && + (Nodes_select_private == null || Nodes_select_private.contains(it)) && + (Nodes_select_Type == null || Nodes_select_Type.contains(it))) { + canAdd = true; + } + } + if (canAdd && !Nodes_res.contains(it)) + Nodes_res.add(it); + } + if(!isEmptyList(Nodes_res)) + { + List Nodes_name_temp = null; + List Nodes_name_temp2 = null; + ReporttemplateDO Node_temp = null; + + Nodes_name_temp = new ArrayList<>(Nodes_res); + while (!isEmptyList(Nodes_name_temp)) { + Nodes_name_temp2 = new ArrayList<>(); + for (ReporttemplateDO item : Nodes_name_temp) { + String Pid = (item.getPid() == null ? "" : item.getPid().trim()); + Node_temp = Nodes_all.stream().filter(it -> it.getId() != null && it.getId().trim().equals(Pid) && it.getDataType() != null && it.getDataType().trim().equals("1")) + .findFirst().orElse(null); + if (Node_temp != null && !Nodes_res.contains(Node_temp)) { + Nodes_res.add(Node_temp); + if (!Nodes_name_temp2.contains(Node_temp)) + Nodes_name_temp2.add(Node_temp); + } + } + Nodes_name_temp = Nodes_name_temp2; } } } - //计算_tempV - if (!(pageReqVO.getTemplateLimitsType() != null && (pageReqVO.getTemplateLimitsType().trim().equals("1") || pageReqVO.getTemplateLimitsType().trim().equals("2"))) && - !StringUtils.hasText(pageReqVO.getTemplateName())) { - //判断查询条件优化渲染速度 - _tempV = treeViewBuild(null, "0", user.getOrgId()); - _tempVOther = new ArrayList<>(); - } else { - _tempV = BeanUtils.toBean(_temp, ReporttemplateTreeView.class); - for (ReporttemplateTreeView item : _tempV) { - if (item != null && item.getDataType() != null && item.getDataType().trim().equals("1")) - treeViewBuild(item, item.getId(), item.getOrgId()); - } - _tempVOther = BeanUtils.toBean(_tempOther, ReporttemplateTreeView.class); - } - _tempVAll = Stream.concat(_tempV.stream(), _tempVOther.stream()) - .distinct().collect(Collectors.toList()); - //计算_view - _view = _tempVAll.stream().filter(it -> it.getId() != null && it.getPid() != null && it.getPid().trim().equals("0")) - .sorted(Comparator.comparing(ReporttemplateTreeView::getTemplateName)).collect(Collectors.toList()); - if (_view != null && _view.size() > 0) { - for (ReporttemplateTreeView item : _view) { - if (item != null && item.getDataType() != null && item.getDataType().trim().equals("1")) - treeViewBuild(item, item.getId(), _tempVAll); - } - } else - _view = null; } - //结果 - if (_view != null && _view.size() > 0) { + + //计算_view + if (!isEmptyList(Nodes_res)) { + List _viewTemp = relationViewBuild(BeanUtils.toBean(Nodes_res, ReporttemplateTreeView.class)); + if (!isEmptyList(_viewTemp)) { + for (ReporttemplateTreeView item : _viewTemp) { + if (isEmptyList(item.children)) + item.children = null; + else { + item.children.sort(Comparator.comparing(ReporttemplateTreeView::getTemplateName)); + } + } + _view = _viewTemp.stream().filter(it -> it.getId() != null && it.getPid() != null && it.getPid().trim().equals("0")) + .collect(Collectors.toList()); + if (isEmptyList(_view)) + _view = null; + else + _view.sort(Comparator.comparing(ReporttemplateTreeView::getTemplateName)); + } + } + + //计算_viewPage + if (!isEmptyList(_view)) { if (!PageParam.PAGE_SIZE_NONE.equals(pageReqVO.getPageSize())) { int index_start = (pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize(); int index_end = pageReqVO.getPageNo() * pageReqVO.getPageSize() - 1; @@ -199,20 +299,50 @@ public class ReporttemplateServiceImpl implements ReporttemplateService { _viewPage = _view; } } - return new PageResult<>(_viewPage, Long.valueOf(_view == null ? 0 : _view.size())); + + return new PageResult<>(_viewPage, Long.valueOf(isEmptyList(_view) ? 0 : _view.size())); } @Override - public List getReporttemplatelist() { - List _out = null; + public List getReporttemplateRoot() { + List _view = null; - //当前登陆用户 AdminUserDO user = userService.getUser(getLoginUserId()); + List _viewDO = reporttemplateMapper.selectNodes_Root(user.getOrgId()); - _out = treeViewBuild(null, "0", user.getOrgId()); + if (!isEmptyList(_viewDO)) { + List _viewTemp = relationViewBuild(BeanUtils.toBean(_viewDO, ReporttemplateTreeView.class)); + if (!isEmptyList(_viewTemp)) { + for (ReporttemplateTreeView item : _viewTemp) { + if (isEmptyList(item.children)) + item.children = null; + else { + item.children.sort(Comparator.comparing(ReporttemplateTreeView::getTemplateName)); + } + } + _view = _viewTemp.stream().filter(it -> it.getId() != null && it.getPid() != null && it.getPid().trim().equals("0")) + .collect(Collectors.toList()); + } + } + + if (isEmptyList(_view)) + _view = Collections.emptyList(); + else + _view.sort(Comparator.comparing(ReporttemplateTreeView::getTemplateName)); + + return _view; + } + + @Override + public boolean hasReporttemplateChildren(String id) { + boolean _out = false; + + AdminUserDO user = userService.getUser(getLoginUserId()); + List _viewDO = reporttemplateMapper.selectNodes(user.getOrgId(), id); + + if (!isEmptyList(_viewDO)) + _out = true; - if (!(_out != null && _out.size() > 0)) - _out = Collections.emptyList(); return _out; } @@ -223,46 +353,39 @@ public class ReporttemplateServiceImpl implements ReporttemplateService { } } - private List treeViewBuild(ReporttemplateTreeView view, String pid, List source) { + private List relationViewBuild(List source) { List _out = null; - if (view != null && view.children != null) - return view.children; - - if (source != null && source.size() > 0) - _out = source.stream().filter(it -> it.getId() != null && it.getPid() != null && it.getPid().trim().equals(pid)) - .sorted(Comparator.comparing(ReporttemplateTreeView::getTemplateName)).collect(Collectors.toList()); - if (_out != null && _out.size() > 0) { - if (view != null) - view.children = _out; - for (ReporttemplateTreeView item : _out) { - if (item != null && item.getDataType() != null && item.getDataType().trim().equals("1") && item.children == null) - treeViewBuild(item, item.getId(), source); + if (!isEmptyList(source)) { + ReporttemplateTreeView temp = null; + for (ReporttemplateTreeView item : source) { + temp = null; + if (item != null) { + String Pid = item.getPid() != null ? item.getPid().trim() : ""; + temp = source.stream().filter(it -> it.getId() != null && it.getId().trim().equals(Pid) && + it.getDataType() != null && it.getDataType().trim().equals("1")) + .findFirst().orElse(null); + if (temp != null) { + if (temp.children == null) + temp.children = new ArrayList<>(); + if (!temp.children.contains(item)) + temp.children.add(item); + } + } } - } + _out = source; + } else + _out = null; - if (!(_out != null && _out.size() > 0)) + if (isEmptyList(_out)) _out = null; return _out; } - private List treeViewBuild(ReporttemplateTreeView view, String pid, String orgId) { - List _out = null; - List _temp = null; - - _temp = reporttemplateMapper.selectList(pid, orgId); - if (_temp != null && _temp.size() > 0) { - _out = BeanUtils.toBean(_temp, ReporttemplateTreeView.class); - if (view != null) - view.children = _out; - for (ReporttemplateTreeView item : _out) { - if (item != null && item.getDataType() != null && item.getDataType().trim().equals("1")) - treeViewBuild(item, item.getId(), item.getOrgId()); - } - } - - if (!(_out != null && _out.size() > 0)) - _out = null; - return _out; + private boolean isEmptyList(List list) { + if (list != null && list.size() > 0) + return false; + else + return true; } } \ No newline at end of file diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 029f71691..5b031150b 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -17,8 +17,8 @@ spring: mvc: pathmatch: matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类 -# throw-exception-if-no-handler-found: true # 404 错误时抛出异常,方便统一处理 -# static-path-pattern: /static/** # 静态资源路径; 注意:如果不配置,则 throw-exception-if-no-handler-found 不生效!!! TODO 芋艿:不能配置,会导致 swagger 不生效 + # throw-exception-if-no-handler-found: true # 404 错误时抛出异常,方便统一处理 + # static-path-pattern: /static/** # 静态资源路径; 注意:如果不配置,则 throw-exception-if-no-handler-found 不生效!!! TODO 芋艿:不能配置,会导致 swagger 不生效 # Jackson 配置项 jackson: @@ -68,9 +68,9 @@ mybatis-plus: global-config: db-config: id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。 -# id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库 -# id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 -# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解 + # id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库 + # id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 + # id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解 logic-delete-value: 1 # 逻辑已删除值(默认为 1) logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) banner: false # 关闭控制台的 Banner 打印 @@ -152,10 +152,12 @@ yudao: admin-ui: url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 security: - permit-all_urls: + permit-all-urls: - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录 + # 自定义接口 - /admin-api/ultrasoniccom/ultrasonic/getdcm - /admin-api/org/org/getone + - /admin-api/tblist/patientexamlist/getCheckRecord websocket: enable: true # websocket的开关 path: /infra/ws # 路径 @@ -195,6 +197,10 @@ yudao: - /admin-api/pay/notify/** # 支付回调通知,不携带租户编号 - /jmreport/* # 积木报表,无法携带租户编号 - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号 + # 自定义接口 + - /admin-api/ultrasoniccom/ultrasonic/getdcm + - /admin-api/org/org/getone + - /admin-api/tblist/patientexamlist/getCheckRecord ignore-tables: - system_tenant - system_tenant_package