feat(health+miniprogram): 预约/报告/随访/资讯/家庭管理 — Chunk 4-6
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

后端:
- 添加 articles 表迁移 + Entity + Service + Handler
- 健康数据趋势 API (get_mini_trend) 注册路由
- article CRUD (list/get) + DTO

前端 (11个新页面 + 5个服务):
- 预约挂号: 列表/创建向导/详情页
- 报告管理: 列表/详情页
- 随访管理: 任务列表/记录详情页
- 资讯文章: 文章详情页
- 个人中心: 就诊人管理/新增/我的报告/我的随访/用药提醒/设置
- 更新 app.config.ts 注册全部路由
- 更新 profile/article 页面为真实功能
This commit is contained in:
iven
2026-04-24 00:58:40 +08:00
parent ee9a5c4da1
commit 9ef65b9a9f
53 changed files with 6044 additions and 32 deletions

View File

@@ -0,0 +1,158 @@
import React, { useState, useEffect } from 'react';
import { View, Text } from '@tarojs/components';
import Taro from '@tarojs/taro';
import './index.scss';
interface MedicationReminder {
id: string;
name: string;
dosage: string;
time: string;
enabled: boolean;
}
const STORAGE_KEY = 'medication_reminders';
function loadReminders(): MedicationReminder[] {
return Taro.getStorageSync(STORAGE_KEY) || [];
}
function saveReminders(reminders: MedicationReminder[]) {
Taro.setStorageSync(STORAGE_KEY, reminders);
}
export default function MedicationReminder() {
const [reminders, setReminders] = useState<MedicationReminder[]>([]);
const [showForm, setShowForm] = useState(false);
const [formName, setFormName] = useState('');
const [formDosage, setFormDosage] = useState('');
const [formTime, setFormTime] = useState('08:00');
useEffect(() => {
setReminders(loadReminders());
}, []);
const updateReminders = (updated: MedicationReminder[]) => {
setReminders(updated);
saveReminders(updated);
};
const handleToggle = (id: string) => {
const updated = reminders.map((r) =>
r.id === id ? { ...r, enabled: !r.enabled } : r
);
updateReminders(updated);
};
const handleDelete = (id: string) => {
Taro.showModal({
title: '确认删除',
content: '确定要删除这个提醒吗?',
}).then((res) => {
if (res.confirm) {
updateReminders(reminders.filter((r) => r.id !== id));
}
});
};
const handleAdd = () => {
if (!formName.trim()) {
Taro.showToast({ title: '请输入药品名称', icon: 'none' });
return;
}
const newReminder: MedicationReminder = {
id: Date.now().toString(),
name: formName.trim(),
dosage: formDosage.trim(),
time: formTime,
enabled: true,
};
updateReminders([...reminders, newReminder]);
setFormName('');
setFormDosage('');
setFormTime('08:00');
setShowForm(false);
Taro.showToast({ title: '添加成功', icon: 'success' });
};
return (
<View className='medication-page'>
<View className='reminder-list'>
{reminders.map((r) => (
<View className='reminder-card' key={r.id}>
<View className='reminder-left'>
<Text className='reminder-name'>{r.name}</Text>
<Text className='reminder-dosage'>
{r.dosage} | {r.time}
</Text>
</View>
<View className='reminder-actions'>
<View
className={`toggle ${r.enabled ? 'on' : 'off'}`}
onClick={() => handleToggle(r.id)}
>
<View className='toggle-dot' />
</View>
<Text
className='delete-btn'
onClick={() => handleDelete(r.id)}
>
</Text>
</View>
</View>
))}
</View>
{reminders.length === 0 && (
<View className='empty-state'>
<Text className='empty-text'></Text>
</View>
)}
{/* 添加表单 */}
{showForm && (
<View className='form-card'>
<View className='form-item'>
<Text className='form-label'></Text>
<input
className='form-input'
placeholder='请输入药品名称'
value={formName}
onInput={(e) => setFormName(e.detail.value)}
/>
</View>
<View className='form-item'>
<Text className='form-label'></Text>
<input
className='form-input'
placeholder='如1片、10ml'
value={formDosage}
onInput={(e) => setFormDosage(e.detail.value)}
/>
</View>
<View className='form-item'>
<Text className='form-label'></Text>
<View className='time-picker-wrap'>
<Text className='time-value'>{formTime}</Text>
</View>
</View>
<View className='form-actions'>
<View className='form-cancel' onClick={() => setShowForm(false)}>
<Text className='form-cancel-text'></Text>
</View>
<View className='form-confirm' onClick={handleAdd}>
<Text className='form-confirm-text'></Text>
</View>
</View>
</View>
)}
{!showForm && (
<View className='add-btn' onClick={() => setShowForm(true)}>
<Text className='add-text'>+ </Text>
</View>
)}
</View>
);
}