feat(router): 添加医生工作站等功能模块路由配置
- 新增医生工作站路由,包含待写病历功能 - 添加全部功能模块路由,支持功能列表和配置页面 - 集成待办事项模块路由,完善工作流功能 - 配置相关API接口和服务类,实现用户配置管理 - 实现待写病历列表展示和相关业务逻辑 - 完善首页统计数据显示功能
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
package com.core.system.controller;
|
||||
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.system.domain.SysUserConfig;
|
||||
import com.core.system.service.ISysUserConfigService;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户配置Controller
|
||||
*
|
||||
* @author
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
@Api(tags = "用户配置")
|
||||
@RestController
|
||||
@RequestMapping("/system/userConfig")
|
||||
public class SysUserConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserConfigService sysUserConfigService;
|
||||
|
||||
/**
|
||||
* 查询用户配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:userConfig:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUserConfig sysUserConfig)
|
||||
{
|
||||
startPage();
|
||||
List<SysUserConfig> list = sysUserConfigService.selectSysUserConfigList(sysUserConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户配置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:userConfig:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable("configId") Long configId)
|
||||
{
|
||||
return AjaxResult.success(sysUserConfigService.selectSysUserConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:userConfig:add')")
|
||||
@Log(title = "用户配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysUserConfig sysUserConfig)
|
||||
{
|
||||
return AjaxResult.success(sysUserConfigService.insertSysUserConfig(sysUserConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:userConfig:edit')")
|
||||
@Log(title = "用户配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysUserConfig sysUserConfig)
|
||||
{
|
||||
return toAjax(sysUserConfigService.updateSysUserConfig(sysUserConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:userConfig:remove')")
|
||||
@Log(title = "用户配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
return toAjax(sysUserConfigService.deleteSysUserConfigByIds(configIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的指定配置
|
||||
*/
|
||||
@ApiOperation("获取当前用户的指定配置")
|
||||
@GetMapping("/currentUserConfig")
|
||||
public AjaxResult getCurrentUserConfig(@RequestParam String configKey)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
String configValue = sysUserConfigService.selectConfigValueByUserIdAndKey(userId, configKey);
|
||||
// 返回原始配置值,不需要额外编码,由前端处理
|
||||
return AjaxResult.success(configValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存当前用户的配置
|
||||
*/
|
||||
@ApiOperation("保存当前用户的配置")
|
||||
@Log(title = "用户配置", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/saveCurrentUserConfig")
|
||||
public AjaxResult saveCurrentUserConfig(@RequestParam String configKey, @RequestParam String configValue)
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
int result = sysUserConfigService.saveConfigValueByUserIdAndKey(userId, configKey, configValue);
|
||||
return result > 0 ? AjaxResult.success() : AjaxResult.error("保存失败");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.core.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.core.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户配置对象 sys_user_config
|
||||
*
|
||||
* @author
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_user_config")
|
||||
public class SysUserConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 配置ID */
|
||||
@TableId
|
||||
private Long configId;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 配置键名 */
|
||||
private String configKey;
|
||||
|
||||
/** 配置值 */
|
||||
private String configValue;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 创建者 - 标记为非数据库字段 */
|
||||
@TableField(exist = false)
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 - 使用自动填充 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 - 标记为非数据库字段 */
|
||||
@TableField(exist = false)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 - 使用自动填充 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.core.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.core.system.domain.SysUserConfig;
|
||||
|
||||
/**
|
||||
* 用户配置Mapper接口
|
||||
*
|
||||
* @author
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
public interface SysUserConfigMapper extends BaseMapper<SysUserConfig>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.core.system.service;
|
||||
|
||||
import com.core.system.domain.SysUserConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户配置Service接口
|
||||
*
|
||||
* @author
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
public interface ISysUserConfigService
|
||||
{
|
||||
/**
|
||||
* 查询用户配置
|
||||
*
|
||||
* @param configId 用户配置ID
|
||||
* @return 用户配置
|
||||
*/
|
||||
public SysUserConfig selectSysUserConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 查询用户配置列表
|
||||
*
|
||||
* @param sysUserConfig 用户配置
|
||||
* @return 用户配置集合
|
||||
*/
|
||||
public List<SysUserConfig> selectSysUserConfigList(SysUserConfig sysUserConfig);
|
||||
|
||||
/**
|
||||
* 新增用户配置
|
||||
*
|
||||
* @param sysUserConfig 用户配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserConfig(SysUserConfig sysUserConfig);
|
||||
|
||||
/**
|
||||
* 修改用户配置
|
||||
*
|
||||
* @param sysUserConfig 用户配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserConfig(SysUserConfig sysUserConfig);
|
||||
|
||||
/**
|
||||
* 批量删除用户配置
|
||||
*
|
||||
* @param configIds 需要删除的用户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserConfigByIds(Long[] configIds);
|
||||
|
||||
/**
|
||||
* 删除用户配置信息
|
||||
*
|
||||
* @param configId 用户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 根据用户ID和配置键获取配置值
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param configKey 配置键
|
||||
* @return 配置值
|
||||
*/
|
||||
public String selectConfigValueByUserIdAndKey(Long userId, String configKey);
|
||||
|
||||
/**
|
||||
* 根据用户ID和配置键保存配置
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param configKey 配置键
|
||||
* @param configValue 配置值
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveConfigValueByUserIdAndKey(Long userId, String configKey, String configValue);
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.core.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.system.domain.SysUserConfig;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.system.mapper.SysUserConfigMapper;
|
||||
import com.core.system.service.ISysUserConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户配置Service业务层处理
|
||||
*
|
||||
* @author
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
@Service
|
||||
public class SysUserConfigServiceImpl extends ServiceImpl<SysUserConfigMapper, SysUserConfig> implements ISysUserConfigService
|
||||
{
|
||||
@Autowired
|
||||
private SysUserConfigMapper sysUserConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询用户配置
|
||||
*
|
||||
* @param configId 用户配置ID
|
||||
* @return 用户配置
|
||||
*/
|
||||
@Override
|
||||
public SysUserConfig selectSysUserConfigById(Long configId)
|
||||
{
|
||||
return sysUserConfigMapper.selectById(configId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户配置列表
|
||||
*
|
||||
* @param sysUserConfig 用户配置
|
||||
* @return 用户配置集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserConfig> selectSysUserConfigList(SysUserConfig sysUserConfig)
|
||||
{
|
||||
LambdaQueryWrapper<SysUserConfig> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StringUtils.isNotEmpty(sysUserConfig.getConfigKey()), SysUserConfig::getConfigKey, sysUserConfig.getConfigKey())
|
||||
.eq(sysUserConfig.getUserId() != null, SysUserConfig::getUserId, sysUserConfig.getUserId());
|
||||
return sysUserConfigMapper.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户配置
|
||||
*
|
||||
* @param sysUserConfig 用户配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysUserConfig(SysUserConfig sysUserConfig)
|
||||
{
|
||||
return sysUserConfigMapper.insert(sysUserConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户配置
|
||||
*
|
||||
* @param sysUserConfig 用户配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysUserConfig(SysUserConfig sysUserConfig)
|
||||
{
|
||||
return sysUserConfigMapper.updateById(sysUserConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和配置键更新配置值
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param configKey 配置键
|
||||
* @param configValue 配置值
|
||||
* @return 结果
|
||||
*/
|
||||
private int updateConfigValueByUserIdAndKey(Long userId, String configKey, String configValue)
|
||||
{
|
||||
SysUserConfig config = new SysUserConfig();
|
||||
config.setConfigValue(configValue);
|
||||
|
||||
LambdaQueryWrapper<SysUserConfig> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SysUserConfig::getUserId, userId)
|
||||
.eq(SysUserConfig::getConfigKey, configKey);
|
||||
|
||||
return sysUserConfigMapper.update(config, lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户配置
|
||||
*
|
||||
* @param configIds 需要删除的用户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserConfigByIds(Long[] configIds)
|
||||
{
|
||||
return sysUserConfigMapper.deleteBatchIds(java.util.Arrays.asList(configIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户配置信息
|
||||
*
|
||||
* @param configId 用户配置ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserConfigById(Long configId)
|
||||
{
|
||||
return sysUserConfigMapper.deleteById(configId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和配置键获取配置值
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param configKey 配置键
|
||||
* @return 配置值
|
||||
*/
|
||||
@Override
|
||||
public String selectConfigValueByUserIdAndKey(Long userId, String configKey)
|
||||
{
|
||||
LambdaQueryWrapper<SysUserConfig> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SysUserConfig::getUserId, userId)
|
||||
.eq(SysUserConfig::getConfigKey, configKey);
|
||||
SysUserConfig config = sysUserConfigMapper.selectOne(lqw);
|
||||
return config != null ? config.getConfigValue() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和配置键保存配置
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param configKey 配置键
|
||||
* @param configValue 配置值
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveConfigValueByUserIdAndKey(Long userId, String configKey, String configValue)
|
||||
{
|
||||
// 参数验证
|
||||
if (userId == null || configKey == null) {
|
||||
throw new IllegalArgumentException("用户ID和配置键不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
LambdaQueryWrapper<SysUserConfig> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SysUserConfig::getUserId, userId)
|
||||
.eq(SysUserConfig::getConfigKey, configKey);
|
||||
SysUserConfig config = sysUserConfigMapper.selectOne(lqw);
|
||||
|
||||
if (config != null) {
|
||||
// 更新现有配置,只更新配置值,避免更新审计字段
|
||||
return updateConfigValueByUserIdAndKey(userId, configKey, configValue);
|
||||
} else {
|
||||
// 插入新配置
|
||||
SysUserConfig newConfig = new SysUserConfig();
|
||||
newConfig.setUserId(userId);
|
||||
newConfig.setConfigKey(configKey);
|
||||
newConfig.setConfigValue(configValue);
|
||||
return sysUserConfigMapper.insert(newConfig);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录错误日志以便调试
|
||||
System.err.println("保存用户配置时发生错误: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
throw e; // 重新抛出异常让上层处理
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.core.system.mapper.SysUserConfigMapper">
|
||||
|
||||
<resultMap type="com.core.system.domain.SysUserConfig" id="SysUserConfigResult">
|
||||
<result property="configId" column="config_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="configKey" column="config_key" />
|
||||
<result property="configValue" column="config_value" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据用户ID和配置键名查询配置值 -->
|
||||
<select id="selectConfigValueByUserIdAndKey" resultType="String">
|
||||
SELECT config_value
|
||||
FROM sys_user_config
|
||||
WHERE user_id = #{userId} AND config_key = #{configKey}
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和配置键名查询完整配置 -->
|
||||
<select id="selectByUserIdAndKey" resultMap="SysUserConfigResult">
|
||||
SELECT config_id, user_id, config_key, config_value, remark, create_time, update_time
|
||||
FROM sys_user_config
|
||||
WHERE user_id = #{userId} AND config_key = #{configKey}
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和配置键更新配置值 -->
|
||||
<update id="updateConfigValueByUserIdAndKey">
|
||||
UPDATE sys_user_config
|
||||
SET config_value = #{configValue}, update_time = CURRENT_TIMESTAMP
|
||||
WHERE user_id = #{userId} AND config_key = #{configKey}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user