- 从 HMS 基座复制 apps/web/ (React + Ant Design + Vite + TypeScript) - 管理端自动代理 API 到 localhost:3000 (vite.config.ts) - 更新 scripts/dev.sh 支持三端启动: backend/admin/app - 登录验证通过, 用户管理/角色权限/审计日志等页面正常 - 添加 .gitignore 排除 node_modules/dist
29 lines
900 B
TypeScript
29 lines
900 B
TypeScript
import { Tag, Tooltip } from 'antd';
|
|
import type { RiskLevel } from '../../api/copilot';
|
|
import { useCopilotRisk } from './useCopilotRisk';
|
|
|
|
const levelConfig: Record<RiskLevel, { color: string; label: string }> = {
|
|
low: { color: 'green', label: '低风险' },
|
|
medium: { color: 'orange', label: '中风险' },
|
|
high: { color: 'red', label: '高风险' },
|
|
critical: { color: '#cf1322', label: '危急' },
|
|
};
|
|
|
|
interface CopilotBadgeProps {
|
|
patientId: string | undefined;
|
|
}
|
|
|
|
export function CopilotBadge({ patientId }: CopilotBadgeProps) {
|
|
const { data, loading } = useCopilotRisk(patientId);
|
|
|
|
if (!data || loading) return null;
|
|
|
|
const config = levelConfig[data.level as RiskLevel] ?? levelConfig.low;
|
|
|
|
return (
|
|
<Tooltip title={`Copilot 风险评分: ${data.score}/10 — ${config.label}`}>
|
|
<Tag color={config.color}>{config.label} {data.score}/10</Tag>
|
|
</Tooltip>
|
|
);
|
|
}
|