feat(miniprogram): 医护端小程序页面 — 8 页面覆盖患者/咨询/随访/报告
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

Iteration 2 医护端前端核心页面:

- 新增 doctor.ts service 层(仪表盘/患者/咨询/随访/报告 API)
- 升级医生首页:接入真实仪表盘数据 + 快捷操作入口
- 患者管理:搜索 + 标签筛选 + 详情页(基本信息/过敏史/健康概览)
- 咨询回复:会话列表 + 状态筛选 + 聊天详情 + 发送消息 + 关闭会话
- 随访管理:任务列表 + 状态筛选 + 详情 + 填写随访记录
- 报告解读:化验报告列表 + 异常高亮 + 指标表格 + 医生审核注释
- 修复 login 页面重复解构
- 注册 8 个新页面路由到 app.config.ts
This commit is contained in:
iven
2026-04-26 13:32:08 +08:00
parent a0b72b0f73
commit 3723cd93c0
21 changed files with 2795 additions and 28 deletions

View File

@@ -1,41 +1,101 @@
import { View, Text } from '@tarojs/components';
import { useAuthStore } from '@/stores/auth';
import { useState, useEffect } from 'react';
import { View, Text, ScrollView } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useAuthStore } from '@/stores/auth';
import * as doctorApi from '@/services/doctor';
import Loading from '@/components/Loading';
import './index.scss';
interface CardConfig {
key: keyof doctorApi.DoctorDashboard;
label: string;
icon: string;
route: string;
color: string;
}
const CARDS: CardConfig[] = [
{ key: 'total_patients', label: '我的患者', icon: '👥', route: '/pages/doctor/patients/index', color: '#0891b2' },
{ key: 'unread_messages', label: '未读消息', icon: '💬', route: '/pages/doctor/consultation/index', color: '#f59e0b' },
{ key: 'pending_follow_ups', label: '待处理随访', icon: '📋', route: '/pages/doctor/followup/index', color: '#8b5cf6' },
{ key: 'today_consultations', label: '今日咨询', icon: '🩺', route: '/pages/doctor/consultation/index', color: '#10b981' },
];
export default function DoctorHome() {
const { user, logout } = useAuthStore();
const [dashboard, setDashboard] = useState<doctorApi.DoctorDashboard | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
loadDashboard();
}, []);
const loadDashboard = async () => {
try {
const data = await doctorApi.getDashboard();
setDashboard(data);
} catch {
// 静默失败,显示占位
} finally {
setLoading(false);
}
};
const handleCardClick = (card: CardConfig) => {
Taro.navigateTo({ url: card.route });
};
const handleLogout = () => {
logout();
Taro.redirectTo({ url: '/pages/login/index' });
};
const getValue = (key: keyof doctorApi.DoctorDashboard): number | string => {
if (!dashboard) return '-';
return dashboard[key] ?? 0;
};
if (loading) return <Loading />;
return (
<View className='doctor-home'>
<ScrollView scrollY className='doctor-home'>
<View className='doctor-home__header'>
<Text className='doctor-home__title'></Text>
<Text className='doctor-home__greeting'>{user?.display_name || user?.username || '医生'}</Text>
<Text className='doctor-home__greeting'>
{user?.display_name || user?.username || '医生'}
</Text>
<Text className='doctor-home__date'>
{new Date().toLocaleDateString('zh-CN', { month: 'long', day: 'numeric', weekday: 'long' })}
</Text>
</View>
<View className='doctor-home__section'>
<Text className='doctor-home__section-title'></Text>
<View className='doctor-home__grid'>
<View className='doctor-home__card' onClick={() => Taro.showToast({ title: '开发中', icon: 'none' })}>
<Text className='doctor-home__card-num'>-</Text>
<Text className='doctor-home__card-label'></Text>
{CARDS.map((card) => (
<View
key={card.key}
className='doctor-home__card'
style={`border-left: 6px solid ${card.color}`}
onClick={() => handleCardClick(card)}
>
<Text className='doctor-home__card-icon'>{card.icon}</Text>
<Text className='doctor-home__card-num'>{getValue(card.key)}</Text>
<Text className='doctor-home__card-label'>{card.label}</Text>
</View>
))}
</View>
</View>
<View className='doctor-home__section'>
<Text className='doctor-home__section-title'></Text>
<View className='doctor-home__quick-actions'>
<View className='quick-action' onClick={() => Taro.navigateTo({ url: '/pages/doctor/report/index' })}>
<Text className='quick-action__icon'>📊</Text>
<Text className='quick-action__label'></Text>
</View>
<View className='doctor-home__card' onClick={() => Taro.showToast({ title: '开发中', icon: 'none' })}>
<Text className='doctor-home__card-num'>-</Text>
<Text className='doctor-home__card-label'>访</Text>
</View>
<View className='doctor-home__card' onClick={() => Taro.showToast({ title: '开发中', icon: 'none' })}>
<Text className='doctor-home__card-num'>-</Text>
<Text className='doctor-home__card-label'></Text>
</View>
<View className='doctor-home__card' onClick={() => Taro.showToast({ title: '开发中', icon: 'none' })}>
<Text className='doctor-home__card-num'>-</Text>
<Text className='doctor-home__card-label'></Text>
<View className='quick-action' onClick={() => Taro.navigateTo({ url: '/pages/doctor/patients/index' })}>
<Text className='quick-action__icon'>🔍</Text>
<Text className='quick-action__label'></Text>
</View>
</View>
</View>
@@ -43,6 +103,6 @@ export default function DoctorHome() {
<View className='doctor-home__footer'>
<Text className='doctor-home__logout' onClick={handleLogout}>退</Text>
</View>
</View>
</ScrollView>
);
}