diff --git a/apps/miniprogram/src/pages/appointment/detail/index.tsx b/apps/miniprogram/src/pages/appointment/detail/index.tsx index 1deb9f9..7487723 100644 --- a/apps/miniprogram/src/pages/appointment/detail/index.tsx +++ b/apps/miniprogram/src/pages/appointment/detail/index.tsx @@ -97,34 +97,53 @@ export default function AppointmentDetail() { + {/* 状态卡片 */} - - {status.label} + + {status.label} {appointment.doctor_name} - {appointment.department} + {appointment.department || ''} + {/* 预约信息 */} 预约信息 + - 就诊人 + + + 就诊人 + {appointment.patient_name} + - 就诊日期 - {appointment.appointment_date} + + + 就诊日期 + + {appointment.appointment_date} + - 就诊时段 - {appointment.start_time} - {appointment.end_time} + + + 就诊时段 + + {appointment.start_time} - {appointment.end_time} + - 预约单号 + + + 预约单号 + {appointment.id} + {/* 温馨提示 */} {(appointment.status === 'pending' || appointment.status === 'confirmed') && ( 温馨提示 @@ -132,6 +151,7 @@ export default function AppointmentDetail() { )} + {/* 取消按钮 */} {canCancel && ( = { completed: { label: '已完成', className: 'tag-completed' }, }; +// 科室首字映射(用于衬线图标) +const DEPT_INITIAL: Record = { + '内科': '内', + '外科': '外', + '妇科': '妇', + '儿科': '儿', + '体检中心': '检', + '中医科': '中', +}; + export default function AppointmentList() { const [appointments, setAppointments] = useState([]); const [page, setPage] = useState(1); @@ -71,16 +81,21 @@ export default function AppointmentList() { return STATUS_MAP[status] || { label: status, className: 'tag-pending' }; }; + const getDeptInitial = (dept: string) => { + return DEPT_INITIAL[dept] || dept.charAt(0); + }; + return ( {/* 页面标题 */} 预约挂号 + Appointment {/* 预约列表 */} {appointments.length === 0 && !loading ? ( - + ) : ( {appointments.map((item) => { @@ -92,22 +107,34 @@ export default function AppointmentList() { onClick={() => goDetail(item.id)} > - - {item.doctor_name} - {item.department} + + + {getDeptInitial(item.department || '')} + + + {item.doctor_name} + + {item.department || ''} + + {tag.label} + - 📅 + + + {item.appointment_date} - 🕐 - {item.start_time} - {item.end_time} + + + + {item.start_time} - {item.end_time} @@ -124,7 +151,7 @@ export default function AppointmentList() { {/* 底部悬浮按钮 */} - + 新建预约 + 新建预约 ); diff --git a/apps/miniprogram/src/pages/followup/detail/index.tsx b/apps/miniprogram/src/pages/followup/detail/index.tsx index 61aea40..dbd885f 100644 --- a/apps/miniprogram/src/pages/followup/detail/index.tsx +++ b/apps/miniprogram/src/pages/followup/detail/index.tsx @@ -38,9 +38,9 @@ export default function FollowUpDetail() { } setSubmitting(true); try { - await submitRecord({ - task_id: id, - content: { text: content.trim() }, + await submitRecord(id, { + result: content.trim(), + patient_condition: content.trim(), }); Taro.showToast({ title: '提交成功', icon: 'success' }); trackEvent('followup_submit', { task_id: id }); diff --git a/apps/miniprogram/src/services/appointment.ts b/apps/miniprogram/src/services/appointment.ts index 938379f..48104a6 100644 --- a/apps/miniprogram/src/services/appointment.ts +++ b/apps/miniprogram/src/services/appointment.ts @@ -4,7 +4,7 @@ export interface Appointment { id: string; patient_name: string; doctor_name: string; - department: string; + department?: string; appointment_date: string; start_time: string; end_time: string; diff --git a/apps/miniprogram/src/services/article.ts b/apps/miniprogram/src/services/article.ts index 018beed..1f1a168 100644 --- a/apps/miniprogram/src/services/article.ts +++ b/apps/miniprogram/src/services/article.ts @@ -13,6 +13,7 @@ export interface Article { published_at?: string; author?: string; view_count?: number; + status?: string; } export interface ArticleCategory { diff --git a/apps/miniprogram/src/services/consultation.ts b/apps/miniprogram/src/services/consultation.ts index be4d4ca..8e3b178 100644 --- a/apps/miniprogram/src/services/consultation.ts +++ b/apps/miniprogram/src/services/consultation.ts @@ -6,8 +6,8 @@ export interface ConsultationSession { doctor_id: string | null; consultation_type: string; status: string; - subject: string | null; - last_message: string | null; + subject?: string | null; + last_message?: string | null; last_message_at: string | null; unread_count_patient: number; created_at: string; diff --git a/apps/miniprogram/src/services/followup.ts b/apps/miniprogram/src/services/followup.ts index 5137053..7fab72d 100644 --- a/apps/miniprogram/src/services/followup.ts +++ b/apps/miniprogram/src/services/followup.ts @@ -11,15 +11,15 @@ export interface FollowUpTask { version: number; } -export interface FollowUpContent { - text: string; - [key: string]: string; -} - export interface FollowUpRecord { id: string; task_id: string; - content: FollowUpContent; + executed_by?: string; + executed_date: string; + result?: string; + patient_condition?: string; + medical_advice?: string; + next_follow_up_date?: string; created_at: string; } @@ -36,8 +36,16 @@ export async function getTaskDetail(id: string) { return api.get(`/health/follow-up-tasks/${id}`); } -export async function submitRecord(data: { task_id: string; content: FollowUpContent }) { - return api.post('/health/follow-up-records', data); +export async function submitRecord(taskId: string, data: { + result?: string; + patient_condition?: string; + medical_advice?: string; + next_follow_up_date?: string; +}) { + return api.post(`/health/follow-up-tasks/${taskId}/records`, { + ...data, + executed_date: new Date().toISOString().slice(0, 10), + }); } export async function listRecords(taskId?: string) {