diff --git a/src/api/his.ts b/src/api/his.ts index ef7efda..26b75f5 100644 --- a/src/api/his.ts +++ b/src/api/his.ts @@ -40,6 +40,8 @@ import type { VerificationCodePhoneResponse, InputUserOwnedMenus, UserOwnedMenusResponse, + InputB1ServiceBoard, + B1ServiceBoardResponse, } from './types'; /** @@ -332,3 +334,15 @@ export const getUserOwnedMenus = ( ).then(res => res.data); }; +/** + * B1服务看板 + */ +export const getB1ServiceBoard = ( + data: InputB1ServiceBoard = {} +): Promise => { + return request.post( + `${MEDICAL_EXAM_BASE_PATH}/b1-service-board`, + data + ).then(res => res.data); +}; + diff --git a/src/api/types.ts b/src/api/types.ts index a5776c4..7dfe68d 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -708,3 +708,39 @@ export interface OutputUserOwnedMenus { */ export type UserOwnedMenusResponse = CommonActionResult; +/** + * B1服务点信息 + */ +export interface B1ServiceInfo { + /** 科室名称 */ + dept_name?: string | null; + /** 医生名称 */ + doctor_name?: string | null; + /** 已检部位数 */ + exam_part_count?: number | null; + /** 总时长(分钟) */ + total_duration_minutes?: number | null; + /** 平均时长(分钟) */ + average_duration_minutes?: number | null; +} + +/** + * B1服务看板入参 + */ +export interface InputB1ServiceBoard { + // 空对象,无需参数 +} + +/** + * B1服务看板出参 + */ +export interface OutputB1ServiceBoard { + /** B1服务点信息列表 */ + b1_service_info_list: B1ServiceInfo[]; +} + +/** + * B1服务看板响应 + */ +export type B1ServiceBoardResponse = CommonActionResult; + diff --git a/src/components/home/HomeSection.tsx b/src/components/home/HomeSection.tsx index abd7c2a..6c6099d 100644 --- a/src/components/home/HomeSection.tsx +++ b/src/components/home/HomeSection.tsx @@ -1,6 +1,7 @@ import { useEffect, useMemo, useState } from 'react'; -import { getRevenueStatistics, getTodayExamStatistics, getUserOwnedMenus } from '../../api'; -import { B1_ROWS, B1_SUMMARY, NORTH3_ROWS, NORTH3_SUMMARY } from '../../data/mockData'; +import { getRevenueStatistics, getTodayExamStatistics, getUserOwnedMenus, getB1ServiceBoard } from '../../api'; +import type { B1ServiceInfo } from '../../api/types'; +import { NORTH3_ROWS, NORTH3_SUMMARY } from '../../data/mockData'; import { Card, CardContent, CardHeader, InfoCard } from '../ui'; const APP_ID = 'b2b49e91d21446aeb14579930f732985'; @@ -25,6 +26,8 @@ export const HomeSection = () => { { label: '当日缺口', value: '¥ 0' }, ]); const [showRevenueStats, setShowRevenueStats] = useState(false); + const [b1ServiceList, setB1ServiceList] = useState([]); + const [b1Loading, setB1Loading] = useState(false); const currencyFormatter = useMemo(() => new Intl.NumberFormat('zh-CN', { style: 'currency', @@ -98,6 +101,32 @@ export const HomeSection = () => { }); }, []); + useEffect(() => { + setB1Loading(true); + getB1ServiceBoard({}) + .then((res) => { + if (res.Status === 200 && res.Data) { + setB1ServiceList(res.Data.b1_service_info_list || []); + } + }) + .catch((err) => { + console.error('获取B1服务看板失败', err); + setB1ServiceList([]); + }) + .finally(() => { + setB1Loading(false); + }); + }, []); + + // 计算B1汇总信息 + const b1Summary = useMemo(() => { + const totalClients = b1ServiceList.length; + // 由于接口没有返回"在检"和"待检"数据,这里暂时使用0 + const waiting = 0; + const inExam = 0; + return { totalClients, waiting, inExam }; + }, [b1ServiceList]); + return (
@@ -129,42 +158,44 @@ export const HomeSection = () => { B1 服务看板
- - - + + +
- - - - - - - - - - - - - - - {B1_ROWS.map(([dept, doctor, done, inExam, waiting, avg]) => { - const parts = done * 3; - const totalTime = done * avg; - return ( - - - - - - - - - + {b1Loading ? ( +
加载中...
+ ) : b1ServiceList.length === 0 ? ( +
暂无数据
+ ) : ( +
科室医生已检人数已检部位数总时长平均时长在检待检
{dept}{doctor}{done}{parts}{totalTime}{avg}{inExam}{waiting}
+ + + + + + + + + + + + + + {b1ServiceList.map((item, index) => ( + + + + + + + + + - ); - })} - -
科室医生已检人数已检部位数总时长平均时长在检待检
{item.dept_name || '-'}{item.doctor_name || '-'}-{item.exam_part_count ?? '-'}{item.total_duration_minutes ?? '-'}{item.average_duration_minutes ?? '-'}--
+ ))} + + + )}