诊断模板
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
192c0f67cf
commit
f176635e4f
@ -102,6 +102,18 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
|
||||
|
||||
// ========== 重写父类方法,方便链式调用 ==========
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapperX<T> isNull(boolean condition, SFunction<T, ?> column) {
|
||||
super.isNull(condition, column);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapperX<T> isNotNull(boolean condition, SFunction<T, ?> column) {
|
||||
super.isNotNull(condition, column);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapperX<T> eq(boolean condition, SFunction<T, ?> column, Object val) {
|
||||
super.eq(condition, column, val);
|
||||
|
@ -71,16 +71,30 @@ public class ReporttemplateController {
|
||||
@GetMapping("/getlist")
|
||||
@Operation(summary = "获得诊断模板list")
|
||||
@PreAuthorize("@ss.hasPermission('system:reporttemplate:query')")
|
||||
public CommonResult<List<ReporttemplateDO>> getReporttemplateList() {
|
||||
List<ReporttemplateDO> reporttemplates = reporttemplateService.getReporttemplatelist();
|
||||
public CommonResult<List<ReporttemplateTreeView>> getReporttemplateList(@Valid ReporttemplatePageReqVO pageReqVO) {
|
||||
List<ReporttemplateTreeView> reporttemplates = Collections.emptyList();
|
||||
PageResult<ReporttemplateTreeView> pageResult = null;
|
||||
try {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
pageResult = reporttemplateService.getReporttemplatePage(pageReqVO);
|
||||
} catch (Exception ex) {
|
||||
pageResult = null;
|
||||
}
|
||||
if (pageResult != null)
|
||||
reporttemplates = pageResult.getList();
|
||||
return success(reporttemplates);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得诊断模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:reporttemplate:query')")
|
||||
public CommonResult<PageResult<ReporttemplateDO>> getReporttemplatePage(@Valid ReporttemplatePageReqVO pageReqVO) {
|
||||
PageResult<ReporttemplateDO> pageResult = reporttemplateService.getReporttemplatePage(pageReqVO);
|
||||
public CommonResult<PageResult<ReporttemplateTreeView>> getReporttemplatePage(@Valid ReporttemplatePageReqVO pageReqVO) {
|
||||
PageResult<ReporttemplateTreeView> pageResult = null;
|
||||
try {
|
||||
pageResult = reporttemplateService.getReporttemplatePage(pageReqVO);
|
||||
} catch (Exception ex) {
|
||||
pageResult = new PageResult<>(Collections.emptyList(), Long.valueOf(0));
|
||||
}
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class ReporttemplatePageReqVO extends PageParam {
|
||||
@Schema(description = "模板名称", example = "李四")
|
||||
private String templateName;
|
||||
|
||||
@Schema(description = "模板权限:all,private,public", example = "2")
|
||||
@Schema(description = "模板权限:全部(0),公有(1),私有(2)", example = "0")
|
||||
private String templateLimitsType;
|
||||
|
||||
@Schema(description = "机构ID", example = "2935")
|
||||
|
@ -14,6 +14,9 @@ public class ReporttemplateSaveReqVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17893")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "数据类型:0诊断模板、1节点")
|
||||
private String dataType;
|
||||
|
||||
@Schema(description = "下拉框:体检模板,住院模板,门诊模板", example = "2")
|
||||
private String templateType;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ultrasoniccom.dal.reporttemplate;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.*;
|
||||
|
||||
@ -22,7 +23,7 @@ public class ReporttemplateDO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="ID",type = IdType.INPUT)
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
private String id;
|
||||
/**
|
||||
* 父类ID
|
||||
@ -34,6 +35,11 @@ public class ReporttemplateDO {
|
||||
*/
|
||||
@TableField("orgId")
|
||||
private String orgId;
|
||||
/**
|
||||
* 数据类型:0诊断模板、1节点
|
||||
*/
|
||||
@TableField("dataType")
|
||||
private String dataType;
|
||||
/**
|
||||
* 下拉框:体检模板,住院模板,门诊模板
|
||||
*/
|
||||
@ -69,6 +75,11 @@ public class ReporttemplateDO {
|
||||
*/
|
||||
@TableField("diagResults")
|
||||
private String diagResults;
|
||||
/**
|
||||
* 模板使用的时间
|
||||
*/
|
||||
@TableField("updateTime")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
@ -3,8 +3,11 @@ 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 java.util.*;
|
||||
|
||||
/**
|
||||
@ -16,4 +19,31 @@ import java.util.*;
|
||||
@Mapper
|
||||
public interface ReporttemplateMapper extends BaseMapperX<ReporttemplateDO> {
|
||||
|
||||
//查询
|
||||
default List<ReporttemplateDO> selectList(String pid, String orgId) {
|
||||
return selectList(new LambdaQueryWrapperX<ReporttemplateDO>()
|
||||
.neIfPresent(ReporttemplateDO::getIsdelete, '1')
|
||||
.eq(ReporttemplateDO::getPid, pid)
|
||||
.eqIfPresent(ReporttemplateDO::getOrgId, orgId)
|
||||
.orderByAsc(ReporttemplateDO::getTemplateName));
|
||||
}
|
||||
|
||||
default List<ReporttemplateDO> selectNodes(ReporttemplatePageReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<ReporttemplateDO>()
|
||||
.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<ReporttemplateDO> selectNodes(String orgId) {
|
||||
return selectList(new LambdaQueryWrapperX<ReporttemplateDO>()
|
||||
.neIfPresent(ReporttemplateDO::getIsdelete, '1')
|
||||
.eq(ReporttemplateDO::getOrgId, orgId)
|
||||
.orderByAsc(ReporttemplateDO::getTemplateName));
|
||||
}
|
||||
}
|
@ -25,11 +25,8 @@ public interface ReporttemplateService {
|
||||
//查询方法
|
||||
ReporttemplateDO getReporttemplate(String id);
|
||||
|
||||
List<ReporttemplateDO> getReporttemplatelist(String orgId);
|
||||
PageResult<ReporttemplateTreeView> getReporttemplatePage(ReporttemplatePageReqVO pageReqVO);
|
||||
|
||||
PageResult<ReporttemplateDO> getReporttemplatePage(ReporttemplatePageReqVO pageReqVO);
|
||||
|
||||
//临时方法
|
||||
List<ReporttemplateDO> getReporttemplatelist();
|
||||
List<ReporttemplateTreeView> getReporttemplatelist();
|
||||
|
||||
}
|
@ -10,12 +10,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
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 javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -43,7 +46,7 @@ public class ReporttemplateServiceImpl implements ReporttemplateService {
|
||||
//当前登陆用户
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
//当前时间
|
||||
LocalDateTime dateTime= LocalDateTime.parse(
|
||||
LocalDateTime dateTime = LocalDateTime.parse(
|
||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
||||
);
|
||||
@ -65,9 +68,17 @@ public class ReporttemplateServiceImpl implements ReporttemplateService {
|
||||
public void updateReporttemplate(ReporttemplateSaveReqVO updateReqVO) {
|
||||
//校验存在
|
||||
validateExists(updateReqVO.getId());
|
||||
ReporttemplateDO tempDO = getReporttemplate(updateReqVO.getId());
|
||||
|
||||
//VO转DO
|
||||
ReporttemplateDO reporttemplateDO = BeanUtils.toBean(updateReqVO, ReporttemplateDO.class);
|
||||
|
||||
if (tempDO != null && reporttemplateDO != null) {
|
||||
reporttemplateDO.setCreateDate(tempDO.getCreateDate());
|
||||
reporttemplateDO.setCreatePerson(tempDO.getCreatePerson());
|
||||
reporttemplateDO.setIsdelete(tempDO.getIsdelete());
|
||||
}
|
||||
|
||||
reporttemplateMapper.updateById(reporttemplateDO);
|
||||
}
|
||||
|
||||
@ -78,14 +89,13 @@ public class ReporttemplateServiceImpl implements ReporttemplateService {
|
||||
//当前登陆用户
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
//当前时间
|
||||
LocalDateTime dateTime= LocalDateTime.parse(
|
||||
LocalDateTime dateTime = LocalDateTime.parse(
|
||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
||||
);
|
||||
//创建DO
|
||||
ReporttemplateDO reporttemplateDO=new ReporttemplateDO();
|
||||
ReporttemplateDO reporttemplateDO = getReporttemplate(id);
|
||||
|
||||
reporttemplateDO.setId(id);
|
||||
reporttemplateDO.setDeleteDate(dateTime);
|
||||
reporttemplateDO.setDeletePerson(user.getUsername());
|
||||
reporttemplateDO.setIsdelete("1");
|
||||
@ -99,27 +109,160 @@ public class ReporttemplateServiceImpl implements ReporttemplateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReporttemplateDO> getReporttemplatelist(String orgId) {
|
||||
return null;
|
||||
public PageResult<ReporttemplateTreeView> getReporttemplatePage(ReporttemplatePageReqVO pageReqVO) {
|
||||
List<ReporttemplateTreeView> _viewPage = Collections.emptyList();
|
||||
List<ReporttemplateTreeView> _view = null;
|
||||
|
||||
//当前登陆用户
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
pageReqVO.setOrgId(user.getOrgId());
|
||||
//全部数据(缓存)
|
||||
List<ReporttemplateDO> _tempAll = reporttemplateMapper.selectNodes(user.getOrgId());
|
||||
List<ReporttemplateTreeView> _tempVAll = null;
|
||||
//直接符合的叶和根
|
||||
List<ReporttemplateDO> _temp = reporttemplateMapper.selectNodes(pageReqVO);
|
||||
List<ReporttemplateTreeView> _tempV = null;
|
||||
//经推导符合的根
|
||||
List<ReporttemplateDO> _tempOther = null;
|
||||
List<ReporttemplateTreeView> _tempVOther = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//计算_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) {
|
||||
if (!PageParam.PAGE_SIZE_NONE.equals(pageReqVO.getPageSize())) {
|
||||
int index_start = (pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize();
|
||||
int index_end = pageReqVO.getPageNo() * pageReqVO.getPageSize() - 1;
|
||||
if (_view.size() - 1 >= index_start) {
|
||||
if (_view.size() - 1 < index_end)
|
||||
index_end = _view.size() - 1;
|
||||
_viewPage = _view.subList(index_start, index_end + 1);
|
||||
}
|
||||
} else {
|
||||
_viewPage = _view;
|
||||
}
|
||||
}
|
||||
return new PageResult<>(_viewPage, Long.valueOf(_view == null ? 0 : _view.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ReporttemplateDO> getReporttemplatePage(ReporttemplatePageReqVO pageReqVO) {
|
||||
return reporttemplateMapper.selectPage(pageReqVO, new LambdaQueryWrapperX<ReporttemplateDO>()
|
||||
.likeIfPresent(ReporttemplateDO::getTemplateName, pageReqVO.getTemplateName())
|
||||
.eq(ReporttemplateDO::getIsdelete, '0'));
|
||||
public List<ReporttemplateTreeView> getReporttemplatelist() {
|
||||
List<ReporttemplateTreeView> _out = null;
|
||||
|
||||
//当前登陆用户
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
|
||||
_out = treeViewBuild(null, "0", user.getOrgId());
|
||||
|
||||
if (!(_out != null && _out.size() > 0))
|
||||
_out = Collections.emptyList();
|
||||
return _out;
|
||||
}
|
||||
|
||||
//其它方法
|
||||
private void validateExists(String id) {
|
||||
if (reporttemplateMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1,"ID为空"));
|
||||
throw exception(new ErrorCode(1, "ID为空"));
|
||||
}
|
||||
}
|
||||
|
||||
//临时方法
|
||||
@Override
|
||||
public List<ReporttemplateDO> getReporttemplatelist() {
|
||||
return reporttemplateMapper.selectList();
|
||||
private List<ReporttemplateTreeView> treeViewBuild(ReporttemplateTreeView view, String pid, List<ReporttemplateTreeView> source) {
|
||||
List<ReporttemplateTreeView> _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 (!(_out != null && _out.size() > 0))
|
||||
_out = null;
|
||||
return _out;
|
||||
}
|
||||
|
||||
private List<ReporttemplateTreeView> treeViewBuild(ReporttemplateTreeView view, String pid, String orgId) {
|
||||
List<ReporttemplateTreeView> _out = null;
|
||||
List<ReporttemplateDO> _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;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.ultrasoniccom.service.reporttemplate;
|
||||
|
||||
import lombok.*;
|
||||
import java.time.*;
|
||||
import java.util.*;
|
||||
|
||||
@Data
|
||||
public class ReporttemplateTreeView {
|
||||
|
||||
public List<ReporttemplateTreeView> children;
|
||||
|
||||
private String id;
|
||||
private String pid;
|
||||
private String orgId;
|
||||
private String dataType;
|
||||
private String templateName;
|
||||
private String examDescription;
|
||||
private String diagResults;
|
||||
private String privateDoctorId;
|
||||
|
||||
private String templateType;
|
||||
private String examPartCode;
|
||||
private String examPart;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private LocalDateTime createDate;
|
||||
private String createPerson;
|
||||
private String isdelete;
|
||||
private LocalDateTime deleteDate;
|
||||
private String deletePerson;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user