refactor(web): 统一健康模块静态映射常量到 constants/health.ts
- 收敛 SEVERITY_COLOR/LABEL (5处→1处) - 收敛 ALERT_STATUS_COLOR/LABEL (3处→1处) - 收敛 DEVICE_TYPE_OPTIONS/COLOR (3处→1处) - 收敛 GENDER_LABEL (4处→1处) - StatusTag 组件改引用 STATUS_TAG_CONFIG - DoctorDashboard 严重度映射改引用常量
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
/**
|
||||
* 健康管理模块共享常量
|
||||
*
|
||||
* 集中定义性别、血型、患者状态等下拉选项,
|
||||
* 供 PatientList / PatientDetail 等页面复用。
|
||||
* 集中定义性别、血型、患者状态、严重度、告警状态、设备类型等映射,
|
||||
* 供各健康模块页面复用。避免在组件中重复定义。
|
||||
*/
|
||||
|
||||
// --- 性别 ---
|
||||
export const GENDER_OPTIONS = [
|
||||
{ value: 'male', label: '男' },
|
||||
{ value: 'female', label: '女' },
|
||||
{ value: 'other', label: '其他' },
|
||||
];
|
||||
|
||||
export const GENDER_LABEL: Record<string, string> = {
|
||||
male: '男',
|
||||
female: '女',
|
||||
other: '其他',
|
||||
};
|
||||
|
||||
// --- 血型 ---
|
||||
export const BLOOD_TYPE_OPTIONS = [
|
||||
{ value: 'A', label: 'A 型' },
|
||||
{ value: 'B', label: 'B 型' },
|
||||
@@ -18,9 +26,106 @@ export const BLOOD_TYPE_OPTIONS = [
|
||||
{ value: 'O', label: 'O 型' },
|
||||
];
|
||||
|
||||
// --- 患者状态 ---
|
||||
export const STATUS_OPTIONS = [
|
||||
{ value: '', label: '全部状态' },
|
||||
{ value: 'active', label: '活跃' },
|
||||
{ value: 'inactive', label: '停用' },
|
||||
{ value: 'deceased', label: '已故' },
|
||||
];
|
||||
|
||||
// --- 严重度(统一 5 处重复定义: AlertDashboard, AlertList, AlertRuleList, DoctorDashboard) ---
|
||||
export const SEVERITY_COLOR: Record<string, string> = {
|
||||
info: 'default',
|
||||
warning: 'orange',
|
||||
critical: 'red',
|
||||
urgent: 'magenta',
|
||||
};
|
||||
|
||||
export const SEVERITY_LABEL: Record<string, string> = {
|
||||
info: '提示',
|
||||
warning: '警告',
|
||||
critical: '严重',
|
||||
urgent: '紧急',
|
||||
};
|
||||
|
||||
export const SEVERITY_OPTIONS = [
|
||||
{ value: 'info', label: '提示' },
|
||||
{ value: 'warning', label: '警告' },
|
||||
{ value: 'critical', label: '严重' },
|
||||
{ value: 'urgent', label: '紧急' },
|
||||
];
|
||||
|
||||
// --- 告警状态(统一 3 处: AlertDashboard, AlertList) ---
|
||||
export const ALERT_STATUS_COLOR: Record<string, string> = {
|
||||
pending: 'orange',
|
||||
acknowledged: 'blue',
|
||||
resolved: 'green',
|
||||
dismissed: 'default',
|
||||
};
|
||||
|
||||
export const ALERT_STATUS_LABEL: Record<string, string> = {
|
||||
pending: '待处理',
|
||||
acknowledged: '已确认',
|
||||
resolved: '已恢复',
|
||||
dismissed: '已忽略',
|
||||
};
|
||||
|
||||
export const ALERT_STATUS_OPTIONS = [
|
||||
{ value: '', label: '全部状态' },
|
||||
{ value: 'pending', label: '待处理' },
|
||||
{ value: 'acknowledged', label: '已确认' },
|
||||
{ value: 'resolved', label: '已恢复' },
|
||||
{ value: 'dismissed', label: '已忽略' },
|
||||
];
|
||||
|
||||
// --- 设备类型(统一 3 处: DeviceManage, DeviceReadingsTab, AlertRuleList) ---
|
||||
export const DEVICE_TYPE_OPTIONS = [
|
||||
{ value: 'blood_pressure', label: '血压' },
|
||||
{ value: 'blood_glucose', label: '血糖' },
|
||||
{ value: 'heart_rate', label: '心率' },
|
||||
{ value: 'blood_oxygen', label: '血氧' },
|
||||
{ value: 'temperature', label: '体温' },
|
||||
{ value: 'steps', label: '步数' },
|
||||
{ value: 'sleep', label: '睡眠' },
|
||||
{ value: 'stress', label: '压力' },
|
||||
];
|
||||
|
||||
export const DEVICE_TYPE_COLOR: Record<string, string> = {
|
||||
blood_pressure: 'red',
|
||||
blood_glucose: 'purple',
|
||||
heart_rate: 'volcano',
|
||||
blood_oxygen: 'blue',
|
||||
temperature: 'orange',
|
||||
steps: 'green',
|
||||
sleep: 'cyan',
|
||||
stress: 'geekblue',
|
||||
};
|
||||
|
||||
// --- 告警规则条件类型 ---
|
||||
export const CONDITION_TYPE_OPTIONS = [
|
||||
{ value: 'single_threshold', label: '单次阈值' },
|
||||
{ value: 'consecutive', label: '连续触发' },
|
||||
{ value: 'trend', label: '趋势变化' },
|
||||
];
|
||||
|
||||
// --- 通用状态标签(StatusTag 组件统一引用) ---
|
||||
export const STATUS_TAG_CONFIG: Record<string, { color: string; label: string }> = {
|
||||
// 预约状态
|
||||
pending: { color: 'gold', label: '待确认' },
|
||||
confirmed: { color: 'blue', label: '已确认' },
|
||||
completed: { color: 'green', label: '已完成' },
|
||||
cancelled: { color: 'default', label: '已取消' },
|
||||
no_show: { color: 'red', label: '未到诊' },
|
||||
// 随访状态
|
||||
overdue: { color: 'red', label: '逾期' },
|
||||
in_progress: { color: 'processing', label: '进行中' },
|
||||
// 咨询状态
|
||||
waiting: { color: 'gold', label: '等待中' },
|
||||
active: { color: 'green', label: '进行中' },
|
||||
closed: { color: 'default', label: '已关闭' },
|
||||
// 患者状态
|
||||
inactive: { color: 'default', label: '停用' },
|
||||
deceased: { color: 'default', label: '已故' },
|
||||
verified: { color: 'green', label: '已认证' },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user