新增患者:监护人信息限制

This commit is contained in:
2025-12-31 13:43:24 +08:00
parent aeb6b95970
commit 61f4020487
3 changed files with 80 additions and 6 deletions

View File

@@ -61,7 +61,25 @@ public class SysConfigController extends BaseController {
*/ */
@GetMapping(value = "/configKey/{configKey}") @GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey) { public AjaxResult getConfigKey(@PathVariable String configKey) {
return success(configService.selectConfigByKey(configKey)); String configValue = configService.selectConfigByKey(configKey);
// 确保即使返回 null 或空字符串,也明确设置 data 字段
// 如果 configValue 是 null转换为空字符串
if (configValue == null) {
configValue = "";
}
// 直接创建 AjaxResult 并明确设置 data 字段,确保 data 字段始终存在
AjaxResult result = new AjaxResult();
result.put("code", 200);
result.put("msg", "操作成功");
result.put("data", configValue); // 明确设置 data 字段,即使值为空字符串
System.out.println("=== getConfigKey 调试信息 ===");
System.out.println("configKey: " + configKey);
System.out.println("configValue: [" + configValue + "]");
System.out.println("result.data: " + result.get("data"));
System.out.println("result.msg: " + result.get("msg"));
System.out.println("result.code: " + result.get("code"));
System.out.println("============================");
return result;
} }
/** /**

View File

@@ -69,8 +69,25 @@ public class SysConfigServiceImpl implements ISysConfigService {
config.setConfigKey(configKey); config.setConfigKey(configKey);
SysConfig retConfig = configMapper.selectConfig(config); SysConfig retConfig = configMapper.selectConfig(config);
if (StringUtils.isNotNull(retConfig)) { if (StringUtils.isNotNull(retConfig)) {
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); String dbValue = retConfig.getConfigValue();
return retConfig.getConfigValue(); System.out.println("=== selectConfigByKey 调试信息 ===");
System.out.println("configKey: " + configKey);
System.out.println("retConfig: " + retConfig);
System.out.println("configId: " + retConfig.getConfigId());
System.out.println("configName: " + retConfig.getConfigName());
System.out.println("configValue from DB: [" + dbValue + "]");
System.out.println("configValue is null: " + (dbValue == null));
System.out.println("configValue is empty: " + StringUtils.isEmpty(dbValue));
System.out.println("================================");
if (StringUtils.isNotEmpty(dbValue)) {
redisCache.setCacheObject(getCacheKey(configKey), dbValue);
return dbValue;
} else {
System.out.println("警告: configValue 为空,返回空字符串");
return StringUtils.EMPTY;
}
} else {
System.out.println("警告: 数据库中未找到 configKey=" + configKey + " 的记录");
} }
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }

View File

@@ -701,6 +701,7 @@ const paymentId = ref('');
const loadingText = ref(''); const loadingText = ref('');
const registerInfo = ref({}); // 原挂号记录信息 const registerInfo = ref({}); // 原挂号记录信息
const queryType = ref('all'); // 查询类型all-全部, normal-正常挂号, returned-退号记录 const queryType = ref('all'); // 查询类型all-全部, normal-正常挂号, returned-退号记录
const guardianAgeConfig = ref(''); // 监护人规定年龄配置
// 使用 ref 定义查询所得用户信息数据 // 使用 ref 定义查询所得用户信息数据
const patientInfoList = ref(undefined); const patientInfoList = ref(undefined);
@@ -1524,11 +1525,49 @@ getLocationInfo();
async function loadGuardianAgeConfig() { async function loadGuardianAgeConfig() {
try { try {
const response = await getConfigKey('guardianAge'); const response = await getConfigKey('guardianAge');
if (response.code === 200) { console.log('获取监护人年龄配置完整响应:', JSON.stringify(response, null, 2));
guardianAgeConfig.value = response.data; console.log('响应 code:', response.code);
console.log('响应 data:', response.data);
console.log('响应 data 类型:', typeof response.data);
console.log('响应 data === null:', response.data === null);
console.log('响应 data === undefined:', response.data === undefined);
console.log('响应 data === "":', response.data === '');
if (response && response.code === 200) {
// response.data 可能是字符串、数字或对象
let configValue = response.data;
// 如果是对象,尝试获取 configValue 字段
if (typeof configValue === 'object' && configValue !== null) {
configValue = configValue.configValue || configValue.value || '';
console.log('从对象中提取的 configValue:', configValue);
}
// 处理数字类型(可能是数字 18
if (typeof configValue === 'number') {
configValue = String(configValue);
console.log('将数字转换为字符串:', configValue);
}
// 转换为字符串并去除空白
const trimmedValue = configValue !== null && configValue !== undefined ? String(configValue).trim() : '';
console.log('trimmedValue:', trimmedValue, '长度:', trimmedValue.length);
if (trimmedValue) {
guardianAgeConfig.value = trimmedValue;
console.log('✅ 监护人年龄配置值已设置为:', guardianAgeConfig.value, '类型:', typeof guardianAgeConfig.value);
} else {
console.warn('⚠️ 配置值为空trimmedValue:', trimmedValue);
guardianAgeConfig.value = '';
}
} else {
console.warn('⚠️ 获取监护人年龄配置失败,响应码:', response?.code, '响应:', response);
guardianAgeConfig.value = '';
} }
} catch (error) { } catch (error) {
console.error('获取监护人规定年龄配置失败:', error); console.error('获取监护人规定年龄配置失败:', error);
console.error('错误详情:', error.response || error);
guardianAgeConfig.value = '';
} }
} }
// 组件加载时获取配置 // 组件加载时获取配置