Files
his/openhis-ui-vue3/src/utils/medicalConstants.js
zhaoyun 3a29797808 fix(#570): 请修复 Bug #570:[一般] [门诊预约挂号] 患者预约成功后的状态显示错误为“已锁定”,导致查询“已预约”状态数据为空
根因:
- 后端将预约成功后的槽位状态设为 `LOCKED(2)`,但前端 `SlotStatusDescriptions` 将 `2` 映射为 `"已锁定"`,导致:
- 页面显示为 `"已锁定"` 而非正确的 `"已预约"`
- 状态筛选栏按 `"已预约"` 过滤时匹配不到数据
- ### 修改内容(2 个文件,+3/-4 行)
- `src/utils/medicalConstants.js`** — 状态映射修正
- `SlotStatus.LOCKED` 注释:`已锁定` → `已预约(预约后未签到)`
- `SlotStatusDescriptions[2]`:`'已锁定'` → `'已预约'`
- `SlotStatusClassMap`:删除不再使用的 `'已锁定': 'status-locked'`(表中已有 `'已预约': 'status-booked'`)
- `src/views/appoinmentmanage/outpatientAppointment/index.vue`** — 提示文案更新
- 预约成功提示:从 `"预约成功,号源已锁定。患者到院签到时需缴费取号。"` 改为 `"预约成功,请提醒患者按时到院签到取号。"`
- ### 验证
- `eslint` 对修改文件检查通过,无新错误
- 修改范围精准,仅涉及状态字符串映射,不影响其他逻辑

修复:
- Bug #570
2026-05-29 01:49:06 +08:00

246 lines
5.5 KiB
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 医疗常量配置
* 从字典动态获取常量值,避免硬编码
*
* 使用方式:
* import { DIAG_TYPE, RequestStatus } from '@/utils/medicalConstants';
* medTypeCode: DIAG_TYPE.WESTERN_MEDICINE
* serviceStatus: RequestStatus.ACTIVE
*/
import { getDicts } from '@/api/system/dict/data';
// 诊断类型字典缓存
let diagTypeCache = null;
/**
* 请求状态枚举(与后端 RequestStatus.java 保持一致)
* 用于服务申请、医嘱执行等状态管理
*/
export const RequestStatus = {
/** 待发送 */
DRAFT: 1,
/** 已发送/待执行 */
ACTIVE: 2,
/** 已完成 */
COMPLETED: 3,
/** 暂停 */
ON_HOLD: 4,
/** 取消/待退 */
CANCELLED: 5,
/** 停嘱 */
STOPPED: 6,
/** 不执行 */
ENDED: 7,
/** 未知 */
UNKNOWN: 9,
/** 已校对(检查申请:护士校对通过) */
CHECK_VERIFIED: 10,
/** 待接收(检查申请:等待医技科室接单) */
PENDING_RECEIVE: 11,
/** 已接收(检查申请:医技科室已接单) */
CHECK_RECEIVED: 12,
};
/**
* 请求状态枚举的说明信息
*/
export const RequestStatusDescriptions = {
1: '待发送',
2: '已发送/待执行',
3: '已完成',
4: '暂停',
5: '取消/待退',
6: '停嘱',
7: '不执行',
9: '未知',
10: '已校对',
11: '待接收',
12: '已接收',
};
/**
* 获取请求状态的说明
* @param {number} value - 请求状态值
* @returns {string} - 说明信息
*/
export function getRequestStatusDescription(value) {
return RequestStatusDescriptions[value] || '未知状态';
}
/**
* 获取诊断类型字典(异步初始化)
*/
async function initDiagType() {
if (!diagTypeCache) {
try {
const res = await getDicts('diag_type');
diagTypeCache = res.data || [];
} catch (error) {
console.error('获取诊断类型字典失败:', error);
diagTypeCache = [];
}
}
return diagTypeCache;
}
/**
* 根据标签获取诊断类型的值
* @param {string} label - 诊断类型标签,如 '西医诊断'
* @returns {string|null} - 诊断类型的值,如 '1'
*/
export async function getDiagTypeValue(label) {
const dictList = await initDiagType();
const item = dictList.find(d => d.dictLabel === label);
return item ? item.dictValue : null;
}
/**
* 根据值获取诊断类型的标签
* @param {string} value - 诊断类型的值,如 '1'
* @returns {string|null} - 诊断类型的标签,如 '西医诊断'
*/
export async function getDiagTypeLabel(value) {
const dictList = await initDiagType();
const item = dictList.find(d => d.dictValue === value);
return item ? item.dictLabel : null;
}
/**
* 获取完整的诊断类型字典列表
* @returns {Array} - 诊断类型字典列表
*/
export async function getDiagTypeList() {
return await initDiagType();
}
/**
* 诊断类型常量(同步使用,需要先初始化字典)
* 注意:这些值在字典加载后才有效
*/
export const DIAG_TYPE = {
/** 西医诊断 */
WESTERN_MEDICINE: '1',
/** 中医主病诊断 */
TCM_MAIN_DISEASE: '2',
/** 中医主证诊断 */
TCM_MAIN_SYNDROME: '3',
/** 初诊诊断 */
INITIAL: '4',
/** 修正诊断 */
REVISED: '5',
/** 补充诊断 */
SUPPLEMENTARY: '6',
};
/**
* 诊断类型常量的说明信息
*/
export const DIAG_TYPE_DESCRIPTIONS = {
'1': '西医诊断',
'2': '中医主病诊断',
'3': '中医主证诊断',
'4': '初诊诊断',
'5': '修正诊断',
'6': '补充诊断',
};
/**
* 获取诊断类型的说明
* @param {string} value - 诊断类型的值
* @returns {string} - 说明信息
*/
export function getDiagTypeDescription(value) {
return DIAG_TYPE_DESCRIPTIONS[value] || '未知类型';
}
// 默认导出
export default {
DIAG_TYPE,
DIAG_TYPE_DESCRIPTIONS,
getDiagTypeValue,
getDiagTypeLabel,
getDiagTypeList,
getDiagTypeDescription,
};
/**
* 状态通用常量(与后端 status 字段保持一致0=正常/启用1=停用)
*/
export const STATUS = {
NORMAL: '0', // 正常/启用
DISABLE: '1' // 停用
};
/**
* 号源槽位状态(与后端 CommonConstants.SlotStatus 保持一致)
* adm_schedule_slot.status 字段
*/
export const SlotStatus = {
/** 可用 / 待预约 */
AVAILABLE: 0,
/** 已预约 */
BOOKED: 1,
/** 已预约(预约后未签到) */
LOCKED: 2,
/** 已签到 / 已取号 */
CHECKED_IN: 3,
/** 已取消 / 已停诊 */
CANCELLED: 4,
};
/**
* 号源槽位状态说明信息
*/
export const SlotStatusDescriptions = {
0: '未预约',
1: '已取号',
2: '已预约',
3: '已取号',
4: '已停诊',
};
/**
* 号源槽位状态对应的CSS类名
*/
export const SlotStatusClassMap = {
'未预约': 'status-unbooked',
'已预约': 'status-booked',
'已取号': 'status-checked',
'已停诊': 'status-cancelled',
'已取消': 'status-cancelled',
};
/**
* 获取号源槽位状态的说明
* @param {number} value - 状态值
* @returns {string} - 说明信息
*/
export function getSlotStatusDescription(value) {
return SlotStatusDescriptions[value] || '未知状态';
}
/**
* 获取号源槽位状态对应的CSS类名
* @param {string} status - 状态说明
* @returns {string} - CSS类名
*/
export function getSlotStatusClass(status) {
return SlotStatusClassMap[status] || 'status-unbooked';
}
/**
* 诊疗项目分类代码(对应后端 ActivityDefCategory 枚举)
* wor_activity_definition.category_code 字段
*/
export const ActivityCategory = {
/** 治疗 */
TREATMENT: '21',
/** 检验 */
PROOF: '22',
/** 检查 */
TEST: '23',
/** 手术 */
PROCEDURE: '24',
};