Files
hms/apps/web/src/pages/health/components/FollowUpTab.tsx
iven 0bf1822fa9
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
fix: QA 第二轮修复 — PatientDetail 重构/测试覆盖/id_number 列宽/小程序 URL 规范化
- refactor(web): PatientDetail.tsx 拆分为 4 个子组件(737→334行)
- refactor(web): 提取 usePaginatedData hook 消除重复分页状态
- feat(db): patient.id_number varchar(20)→varchar(255) 容纳加密值
- test(health): 添加预约模块集成测试(创建/列表/租户隔离)
- test(plugin): 添加 6 个 SQL 注入 sanitize 测试
- fix(miniprogram): 7 个 service 文件 URL 构建规范化(params 对象)
- fix(miniprogram): 跨平台字段名对齐(birth_date/start_time/end_time)
2026-04-25 10:22:44 +08:00

84 lines
1.8 KiB
TypeScript

import { useCallback } from 'react';
import { Table } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { followUpApi } from '../../../api/health/followUp';
import type { FollowUpRecord } from '../../../api/health/followUp';
import { usePaginatedData } from '../../../hooks/usePaginatedData';
interface Props {
patientId: string;
}
const columns: ColumnsType<FollowUpRecord> = [
{
title: '执行日期',
dataIndex: 'executed_date',
key: 'executed_date',
width: 120,
},
{
title: '随访结果',
dataIndex: 'result',
key: 'result',
ellipsis: true,
},
{
title: '患者状况',
dataIndex: 'patient_condition',
key: 'patient_condition',
ellipsis: true,
},
{
title: '医嘱',
dataIndex: 'medical_advice',
key: 'medical_advice',
ellipsis: true,
},
{
title: '下次随访日期',
dataIndex: 'next_follow_up_date',
key: 'next_follow_up_date',
width: 130,
render: (v?: string) => v || '-',
},
];
/**
* 随访记录标签页 — 分页表格
*/
export function FollowUpTab({ patientId }: Props) {
const fetcher = useCallback(
async (page: number, pageSize: number) => {
return followUpApi.listRecords({
patient_id: patientId,
page,
page_size: pageSize,
});
},
[patientId],
);
const { data, total, page, loading, refresh } = usePaginatedData<FollowUpRecord>(
fetcher,
10,
);
return (
<Table
columns={columns}
dataSource={data}
rowKey="id"
loading={loading}
size="small"
pagination={{
current: page,
total,
pageSize: 10,
onChange: (p) => refresh(p),
showTotal: (t) => `${t}`,
style: { margin: 0 },
}}
/>
);
}