From f4d5c085eeeff284236bbf188ca693e6b98579d5 Mon Sep 17 00:00:00 2001 From: xianyi Date: Wed, 10 Dec 2025 15:28:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E4=BB=8A=E6=97=A5=E4=BD=93=E6=A3=80=E8=BF=9B=E5=BA=A6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/his.ts | 16 ++ src/api/types.ts | 26 +++ src/components/exam/ExamSection.tsx | 259 ++++++++++++++++------------ src/data/mockData.ts | 6 - 4 files changed, 186 insertions(+), 121 deletions(-) diff --git a/src/api/his.ts b/src/api/his.ts index a5bf655..b6c4227 100644 --- a/src/api/his.ts +++ b/src/api/his.ts @@ -4,6 +4,8 @@ import type { TodayExamStatisticsResponse, InputRevenueStatisticsInfo, RevenueStatisticsResponse, + InputTodayExamProgress, + TodayExamProgressResponse, } from './types'; /** @@ -46,3 +48,17 @@ export const getRevenueStatistics = ( ).then(res => res.data); }; +/** + * 今日体检进度信息 + * @param data 请求参数(空对象) + * @returns 今日体检进度信息 + */ +export const getTodayExamProgress = ( + data: InputTodayExamProgress = {} +): Promise => { + return request.post( + `${MEDICAL_EXAM_BASE_PATH}/today-exam-progress`, + data + ).then(res => res.data); +}; + diff --git a/src/api/types.ts b/src/api/types.ts index 1d02d48..9f7f80c 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -55,6 +55,32 @@ export interface OutputTodayExamStatisticsInfo { */ export type TodayExamStatisticsResponse = CommonActionResult; +/** + * 今日体检进度入参 + */ +export interface InputTodayExamProgress { + // 空对象,无需参数 +} + +/** + * 今日体检进度出参 + */ +export interface OutputTodayExamProgress { + /** 今日预约人数 */ + today_appointment_count?: number | null; + /** 今日已签到人数 */ + today_signin_count?: number | null; + /** 今日体检中人数 */ + today_in_exam_count?: number | null; + /** 今日用餐人数 */ + today_meal_count?: number | null; +} + +/** + * 今日体检进度接口返回 + */ +export type TodayExamProgressResponse = CommonActionResult; + /** * 营收数据统计入参 */ diff --git a/src/components/exam/ExamSection.tsx b/src/components/exam/ExamSection.tsx index 5500f12..726f5d6 100644 --- a/src/components/exam/ExamSection.tsx +++ b/src/components/exam/ExamSection.tsx @@ -1,5 +1,7 @@ +import { useEffect, useState } from 'react'; import type { ExamClient, ExamModalTab } from '../../data/mockData'; -import { EXAM_STATS, EXAM_TAGS } from '../../data/mockData'; +import { EXAM_TAGS } from '../../data/mockData'; +import { getTodayExamProgress } from '../../api'; import { Badge, Card, CardContent, CardHeader, InfoCard } from '../ui'; import { cls } from '../../utils/cls'; @@ -17,126 +19,153 @@ export const ExamSection = ({ examFilterTag, onFilterChange, onOpenModal, -}: ExamSectionProps) => ( -
- - 今日体检进度 - -
- {EXAM_STATS.map(([label, value]) => ( - - ))} -
-
-
+}: ExamSectionProps) => { + const [progressStats, setProgressStats] = useState([ + { label: '预约人数', value: 0 }, + { label: '已签到', value: 0 }, + { label: '体检中', value: 0 }, + { label: '用餐', value: 0 }, + ]); - - - 体检客户列表 -
- {EXAM_TAGS.map((tag) => ( - - ))} -
-
- -
- {filteredClients.map((client) => { - const signDone = client.signStatus === '已登记' || client.checkedItems.includes('签到'); - const addonCount = client.addonCount || 0; - const printDone = !!client.guidePrinted; - const openModal = (tab: ExamModalTab) => onOpenModal(client.id, tab); + useEffect(() => { + getTodayExamProgress({}) + .then((res) => { + const d = res.Data; + setProgressStats([ + { label: '预约人数', value: Number(d?.today_appointment_count ?? 0) }, + { label: '已签到', value: Number(d?.today_signin_count ?? 0) }, + { label: '体检中', value: Number(d?.today_in_exam_count ?? 0) }, + { label: '用餐', value: Number(d?.today_meal_count ?? 0) }, + ]); + }) + .catch((err) => { + console.error('获取今日体检进度失败', err); + }); + }, []); - return ( + return ( +
+ + 今日体检进度 + +
+ {progressStats.map(({ label, value }) => ( + + ))} +
+
+
+ + + + 体检客户列表 +
+ {EXAM_TAGS.map((tag) => ( - - - - - -
+ {tag} - ); - })} -
- - -
-); + ))} +
+ + +
+ {filteredClients.map((client) => { + const signDone = client.signStatus === '已登记' || client.checkedItems.includes('签到'); + const addonCount = client.addonCount || 0; + const printDone = !!client.guidePrinted; + const openModal = (tab: ExamModalTab) => onOpenModal(client.id, tab); + + return ( +
openModal('detail')} + className={cls( + 'text-left p-3 rounded-2xl border bg-white hover:bg-gray-50 flex flex-col gap-1 cursor-pointer', + selectedExamClient.id === client.id && 'border-gray-900 bg-gray-50', + )} + > +
+ {client.name} + {client.level} +
+
套餐:{client.packageName}
+
+ 状态:{client.status} + 已耗时:{client.elapsed} +
+
+ + + + + + +
+
+ ); + })} +
+
+ + + ); +}; diff --git a/src/data/mockData.ts b/src/data/mockData.ts index ad736b5..fe80b3d 100644 --- a/src/data/mockData.ts +++ b/src/data/mockData.ts @@ -226,12 +226,6 @@ export const EXAM_CLIENTS: ExamClient[] = [ }, ]; -export const EXAM_STATS: [string, number][] = [ - ['预约人数', EXAM_CLIENTS.length], - ['已签到', EXAM_CLIENTS.filter((c) => c.status === '已签到').length], - ['体检中', EXAM_CLIENTS.filter((c) => c.status === '体检中').length], - ['用餐', EXAM_CLIENTS.filter((c) => c.status === '用餐').length], -]; export const EXAM_TAGS = ['全部', '上午', '下午', '高客', '普客', '已登记', '未登记', '散客', '团客'] as const;