refactor(mp): 分包策略优化 — 合并单页分包 + doctor 拆包 + consultation 移出主包

- 合并 4 个单页分包:report→pkg-profile/reports, followup→pkg-profile/followups,
  events→pkg-profile/events, device-sync→pkg-health
- consultation/detail 移出主包到 pkg-consultation 分包(减少主包体积)
- doctor 18 页拆分为 pkg-doctor-core(8页) + pkg-doctor-clinical(10页)
- 全部导航路径和 import 路径同步更新
- 分包 10→8 个,主包页面 13→12
This commit is contained in:
iven
2026-05-15 07:53:00 +08:00
parent 5baa518516
commit 4c38fcd89d
58 changed files with 71 additions and 78 deletions

View File

@@ -0,0 +1,147 @@
@import '../../../../styles/variables.scss';
@import '../../../../styles/mixins.scss';
.detail-page {
min-height: 100vh;
background: $bg;
padding: 24px;
padding-bottom: 40px;
}
.detail-card {
background: $card;
border-radius: $r;
padding: 28px;
margin-bottom: 20px;
box-shadow: $shadow-sm;
}
.detail-title {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: var(--tk-font-num-lg);
font-weight: bold;
color: $tx;
display: block;
margin-bottom: 20px;
}
.detail-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 12px 0;
border-bottom: 1px solid $bd-l;
&:last-child {
border-bottom: none;
}
}
.detail-label {
font-size: var(--tk-font-h1);
color: $tx2;
flex-shrink: 0;
}
.detail-value {
font-size: var(--tk-font-h1);
color: $tx;
text-align: right;
flex: 1;
margin-left: 24px;
}
.indicators-card {
background: $card;
border-radius: $r;
padding: 28px;
box-shadow: $shadow-sm;
}
.section-title {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: var(--tk-font-num);
font-weight: bold;
color: $tx;
display: block;
margin-bottom: 16px;
}
.indicator-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 0;
border-bottom: 1px solid $bd-l;
&:last-child {
border-bottom: none;
}
}
.indicator-left {
display: flex;
flex-direction: column;
}
.indicator-name {
font-size: var(--tk-font-h1);
color: $tx2;
margin-bottom: 4px;
}
.indicator-value {
font-size: var(--tk-font-num);
font-weight: bold;
color: $tx;
@include serif-number;
}
.indicator-right {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.indicator-ref {
font-size: var(--tk-font-body);
color: var(--tk-text-secondary);
margin-bottom: 4px;
@include serif-number;
}
.indicator-status {
font-size: var(--tk-font-h2);
font-weight: bold;
padding: 4px 12px;
border-radius: $r;
&.normal {
color: $tx3;
background: $bd-l;
}
&.high {
color: $dan;
background: $dan-l;
}
&.low {
color: $dan;
background: $dan-l;
}
}
.loading-state,
.empty-state {
display: flex;
justify-content: center;
align-items: center;
padding: 120px 0;
}
.loading-text,
.empty-text {
font-size: var(--tk-font-body-lg);
color: var(--tk-text-secondary);
}

View File

@@ -0,0 +1,128 @@
import React, { useState, useCallback } from 'react';
import { View, Text } from '@tarojs/components';
import Taro, { useRouter } from '@tarojs/taro';
import { usePageData } from '@/hooks/usePageData';
import { getReportDetail, LabReport } from '@/services/report';
import Loading from '@/components/Loading';
import { useElderClass } from '@/hooks/useElderClass';
import { useAuthStore } from '@/stores/auth';
import './index.scss';
interface IndicatorItem {
name: string;
value: number;
unit?: string;
reference_min?: number;
reference_max?: number;
status?: string;
}
export default function ReportDetail() {
const modeClass = useElderClass();
const router = useRouter();
const id = router.params.id || '';
const currentPatient = useAuthStore((s) => s.currentPatient);
const patientId = currentPatient?.id || '';
const [report, setReport] = useState<LabReport | null>(null);
const [loading, setLoading] = useState(true);
const fetchReport = useCallback(async () => {
if (!id || !patientId) return;
setLoading(true);
try {
const data = await getReportDetail(patientId, id);
setReport(data);
} catch {
Taro.showToast({ title: '加载失败', icon: 'none' });
} finally {
setLoading(false);
}
}, [id, patientId]);
usePageData(fetchReport, { throttleMs: 60000 });
const indicators: IndicatorItem[] = React.useMemo(() => {
if (!report?.indicators || typeof report.indicators !== 'object') return [];
return Object.entries(report.indicators).map(([name, val]) => ({
name,
value: val.value,
unit: val.unit,
reference_min: val.reference_min,
reference_max: val.reference_max,
status: val.status,
}));
}, [report]);
const getStatusInfo = (status?: string) => {
if (status === 'high') return { text: '偏高', icon: '', className: 'high' };
if (status === 'low') return { text: '偏低', icon: '', className: 'low' };
return { text: '正常', icon: '', className: 'normal' };
};
if (loading) {
return (
<View className={`detail-page ${modeClass}`}>
<Loading />
</View>
);
}
if (!report) {
return (
<View className={`detail-page ${modeClass}`}>
<View className='empty-state'>
<Text className='empty-text'></Text>
</View>
</View>
);
}
return (
<View className={`detail-page ${modeClass}`}>
{/* 基本信息 */}
<View className='detail-card'>
<Text className='detail-title'>{report.report_type}</Text>
<View className='detail-row'>
<Text className='detail-label'></Text>
<Text className='detail-value'>{report.report_date}</Text>
</View>
{report.doctor_interpretation && (
<View className='detail-row'>
<Text className='detail-label'></Text>
<Text className='detail-value'>{report.doctor_interpretation}</Text>
</View>
)}
</View>
{/* 指标列表 */}
<View className='indicators-card'>
<Text className='section-title'></Text>
{indicators.map((item) => {
const statusInfo = getStatusInfo(item.status);
return (
<View className='indicator-item' key={item.name}>
<View className='indicator-left'>
<Text className='indicator-name'>{item.name}</Text>
<Text className='indicator-value'>
{item.value}
{item.unit ? ` ${item.unit}` : ''}
</Text>
</View>
<View className='indicator-right'>
{item.reference_min != null && item.reference_max != null && (
<Text className='indicator-ref'>
{item.reference_min}~{item.reference_max}
</Text>
)}
<Text className={`indicator-status ${statusInfo.className}`}>
{statusInfo.icon} {statusInfo.text}
</Text>
</View>
</View>
);
})}
</View>
</View>
);
}

View File

@@ -47,7 +47,7 @@ export default function MyReports() {
});
const goToDetail = (id: string) => {
Taro.navigateTo({ url: `/pages/report/detail/index?id=${id}` });
Taro.navigateTo({ url: `/pages/pkg-profile/reports/detail/index?id=${id}` });
};
const formatStatus = (report: LabReport) => {