feat(miniprogram): 医护端小程序页面 — 8 页面覆盖患者/咨询/随访/报告
Iteration 2 医护端前端核心页面: - 新增 doctor.ts service 层(仪表盘/患者/咨询/随访/报告 API) - 升级医生首页:接入真实仪表盘数据 + 快捷操作入口 - 患者管理:搜索 + 标签筛选 + 详情页(基本信息/过敏史/健康概览) - 咨询回复:会话列表 + 状态筛选 + 聊天详情 + 发送消息 + 关闭会话 - 随访管理:任务列表 + 状态筛选 + 详情 + 填写随访记录 - 报告解读:化验报告列表 + 异常高亮 + 指标表格 + 医生审核注释 - 修复 login 页面重复解构 - 注册 8 个新页面路由到 app.config.ts
This commit is contained in:
199
apps/miniprogram/src/pages/doctor/patients/detail/index.scss
Normal file
199
apps/miniprogram/src/pages/doctor/patients/detail/index.scss
Normal file
@@ -0,0 +1,199 @@
|
||||
.patient-detail {
|
||||
min-height: 100vh;
|
||||
background: #f0f4f8;
|
||||
padding: 24px;
|
||||
padding-bottom: 120px;
|
||||
}
|
||||
|
||||
.section {
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
padding: 28px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
display: block;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 22px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 28px;
|
||||
color: #0f172a;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.warning-card {
|
||||
background: #fef3c7;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.warning-label {
|
||||
font-size: 22px;
|
||||
color: #b45309;
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.warning-text {
|
||||
font-size: 26px;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.info-block {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.info-block-label {
|
||||
font-size: 22px;
|
||||
color: #94a3b8;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.info-block-text {
|
||||
font-size: 26px;
|
||||
color: #334155;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.vitals-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.vital-item {
|
||||
background: #f0f9ff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.vital-value {
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
color: #0891b2;
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.vital-label {
|
||||
font-size: 22px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 26px;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
|
||||
&--warn {
|
||||
color: #f59e0b;
|
||||
}
|
||||
}
|
||||
|
||||
.lab-item {
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__type {
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
&__date {
|
||||
font-size: 24px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
&__abnormal {
|
||||
font-size: 24px;
|
||||
color: #ef4444;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
background: #0891b2;
|
||||
color: #fff;
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
text {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.error-text {
|
||||
text-align: center;
|
||||
padding: 80px 32px;
|
||||
color: #94a3b8;
|
||||
font-size: 28px;
|
||||
}
|
||||
156
apps/miniprogram/src/pages/doctor/patients/detail/index.tsx
Normal file
156
apps/miniprogram/src/pages/doctor/patients/detail/index.tsx
Normal file
@@ -0,0 +1,156 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { View, Text, ScrollView } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import * as doctorApi from '@/services/doctor';
|
||||
import Loading from '@/components/Loading';
|
||||
import './index.scss';
|
||||
|
||||
export default function PatientDetail() {
|
||||
const router = useRouter();
|
||||
const patientId = router.params.id || '';
|
||||
const [patient, setPatient] = useState<doctorApi.PatientDetail | null>(null);
|
||||
const [summary, setSummary] = useState<doctorApi.HealthSummary | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (patientId) loadData();
|
||||
}, [patientId]);
|
||||
|
||||
const loadData = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const [p, s] = await Promise.all([
|
||||
doctorApi.getPatient(patientId),
|
||||
doctorApi.getHealthSummary(patientId),
|
||||
]);
|
||||
setPatient(p);
|
||||
setSummary(s);
|
||||
} catch {
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const getGenderLabel = (g?: string) => (g === 'male' ? '男' : g === 'female' ? '女' : g || '-');
|
||||
const calcAge = (bd?: string) => {
|
||||
if (!bd) return '-';
|
||||
const diff = Date.now() - new Date(bd).getTime();
|
||||
return Math.floor(diff / (365.25 * 24 * 3600 * 1000));
|
||||
};
|
||||
|
||||
if (loading) return <Loading />;
|
||||
if (!patient) return <View className='error-text'><Text>患者信息加载失败</Text></View>;
|
||||
|
||||
return (
|
||||
<ScrollView scrollY className='patient-detail'>
|
||||
{/* 基本信息 */}
|
||||
<View className='section'>
|
||||
<View className='section-header'>
|
||||
<Text className='section-title'>基本信息</Text>
|
||||
</View>
|
||||
<View className='info-grid'>
|
||||
<View className='info-item'><Text className='info-label'>姓名</Text><Text className='info-value'>{patient.name}</Text></View>
|
||||
<View className='info-item'><Text className='info-label'>性别</Text><Text className='info-value'>{getGenderLabel(patient.gender)}</Text></View>
|
||||
<View className='info-item'><Text className='info-label'>年龄</Text><Text className='info-value'>{calcAge(patient.birth_date)}岁</Text></View>
|
||||
{patient.blood_type && <View className='info-item'><Text className='info-label'>血型</Text><Text className='info-value'>{patient.blood_type}</Text></View>}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* 医疗信息 */}
|
||||
{(patient.allergy_history || patient.medical_history_summary) && (
|
||||
<View className='section'>
|
||||
<Text className='section-title'>医疗信息</Text>
|
||||
{patient.allergy_history && (
|
||||
<View className='warning-card'>
|
||||
<Text className='warning-label'>过敏史</Text>
|
||||
<Text className='warning-text'>{patient.allergy_history}</Text>
|
||||
</View>
|
||||
)}
|
||||
{patient.medical_history_summary && (
|
||||
<View className='info-block'>
|
||||
<Text className='info-block-label'>病史摘要</Text>
|
||||
<Text className='info-block-text'>{patient.medical_history_summary}</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* 健康摘要 */}
|
||||
{summary && (
|
||||
<View className='section'>
|
||||
<Text className='section-title'>健康概览</Text>
|
||||
{summary.latest_vital_signs && (
|
||||
<View className='vitals-grid'>
|
||||
{summary.latest_vital_signs.systolic_bp != null && (
|
||||
<View className='vital-item'>
|
||||
<Text className='vital-value'>{summary.latest_vital_signs.systolic_bp}/{summary.latest_vital_signs.diastolic_bp}</Text>
|
||||
<Text className='vital-label'>血压 mmHg</Text>
|
||||
</View>
|
||||
)}
|
||||
{summary.latest_vital_signs.heart_rate != null && (
|
||||
<View className='vital-item'>
|
||||
<Text className='vital-value'>{summary.latest_vital_signs.heart_rate}</Text>
|
||||
<Text className='vital-label'>心率 bpm</Text>
|
||||
</View>
|
||||
)}
|
||||
{summary.latest_vital_signs.weight != null && (
|
||||
<View className='vital-item'>
|
||||
<Text className='vital-value'>{summary.latest_vital_signs.weight}</Text>
|
||||
<Text className='vital-label'>体重 kg</Text>
|
||||
</View>
|
||||
)}
|
||||
{summary.latest_vital_signs.blood_sugar != null && (
|
||||
<View className='vital-item'>
|
||||
<Text className='vital-value'>{summary.latest_vital_signs.blood_sugar}</Text>
|
||||
<Text className='vital-label'>血糖 mmol/L</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
{summary.pending_follow_ups != null && summary.pending_follow_ups > 0 && (
|
||||
<View className='stat-row'>
|
||||
<Text className='stat-label'>待处理随访</Text>
|
||||
<Text className='stat-value stat-value--warn'>{summary.pending_follow_ups} 项</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* 近期化验 */}
|
||||
{summary?.recent_lab_reports && summary.recent_lab_reports.length > 0 && (
|
||||
<View className='section'>
|
||||
<Text className='section-title'>近期化验</Text>
|
||||
{summary.recent_lab_reports.map((r) => (
|
||||
<View
|
||||
key={r.id}
|
||||
className='lab-item'
|
||||
onClick={() => Taro.navigateTo({ url: `/pages/doctor/report/detail/index?patientId=${patientId}&id=${r.id}` })}
|
||||
>
|
||||
<View className='lab-item__header'>
|
||||
<Text className='lab-item__type'>{r.report_type}</Text>
|
||||
<Text className='lab-item__date'>{r.report_date}</Text>
|
||||
</View>
|
||||
{r.abnormal_count > 0 && (
|
||||
<Text className='lab-item__abnormal'>{r.abnormal_count} 项异常</Text>
|
||||
)}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* 快捷操作 */}
|
||||
<View className='section'>
|
||||
<Text className='section-title'>操作</Text>
|
||||
<View className='action-buttons'>
|
||||
<View className='action-btn' onClick={() => Taro.navigateTo({ url: `/pages/doctor/report/index?patientId=${patientId}` })}>
|
||||
<Text>查看化验报告</Text>
|
||||
</View>
|
||||
<View className='action-btn' onClick={() => Taro.navigateTo({ url: `/pages/doctor/followup/index?patientId=${patientId}` })}>
|
||||
<Text>随访记录</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user