feat: 积分商城子页面 + 日常监测 + 统计报表 (Chunk 6)
小程序 — 积分商城 (3 新页面): - mall/exchange: 兑换确认 (余额校验/QR码生成) - mall/orders: 我的订单 (状态筛选/分页/QR展示) - mall/detail: 积分明细 (余额卡片/收入支出筛选/流水列表) 小程序 — 上报 Tab 改造: - health/daily-monitoring: 日常监测表单 (血压/体重/血糖/出入量) - health/index: 增加快捷操作/打卡状态/近期监测卡片 - consultation: 替换占位为咨询列表 (会话/状态/未读) - profile: 新增积分余额/打卡天数/我的订单/积分明细入口 小程序 — 新增服务: - services/consultation.ts: 咨询会话 API - services/points.ts: 扩展兑换/订单/流水 API - services/health.ts: 扩展日常监测 API PC 管理端: - StatisticsDashboard: 统计报表仪表盘 (患者/咨询/随访/积分卡片 + Top10排行 + 快速链接) - 侧边栏新增统计报表入口 (健康模块首页)
This commit is contained in:
24
apps/miniprogram/src/services/consultation.ts
Normal file
24
apps/miniprogram/src/services/consultation.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { api } from './request';
|
||||
|
||||
export interface ConsultationSession {
|
||||
id: string;
|
||||
patient_id: string;
|
||||
doctor_id: string | null;
|
||||
type: string;
|
||||
status: string;
|
||||
subject: string | null;
|
||||
last_message: string | null;
|
||||
last_message_at: string | null;
|
||||
unread_count: number;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export async function listConsultations(params?: {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}) {
|
||||
return api.get<{ data: ConsultationSession[]; total: number }>(
|
||||
'/health/consultation-sessions',
|
||||
params,
|
||||
);
|
||||
}
|
||||
@@ -29,3 +29,51 @@ export async function getTrend(indicator: string, range: string) {
|
||||
{ indicator, range },
|
||||
);
|
||||
}
|
||||
|
||||
// ---- Daily Monitoring (日常监测) ----
|
||||
|
||||
export interface DailyMonitoring {
|
||||
id: string;
|
||||
patient_id: string;
|
||||
record_date: string;
|
||||
morning_bp_systolic: number | null;
|
||||
morning_bp_diastolic: number | null;
|
||||
evening_bp_systolic: number | null;
|
||||
evening_bp_diastolic: number | null;
|
||||
weight: number | null;
|
||||
blood_sugar: number | null;
|
||||
fluid_intake: number | null;
|
||||
urine_output: number | null;
|
||||
notes: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
version: number;
|
||||
}
|
||||
|
||||
export interface CreateDailyMonitoringReq {
|
||||
patient_id: string;
|
||||
record_date: string;
|
||||
morning_bp_systolic?: number;
|
||||
morning_bp_diastolic?: number;
|
||||
evening_bp_systolic?: number;
|
||||
evening_bp_diastolic?: number;
|
||||
weight?: number;
|
||||
blood_sugar?: number;
|
||||
fluid_intake?: number;
|
||||
urine_output?: number;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export async function createDailyMonitoring(data: CreateDailyMonitoringReq) {
|
||||
return api.post<DailyMonitoring>('/health/daily-monitoring', data);
|
||||
}
|
||||
|
||||
export async function listDailyMonitoring(
|
||||
patientId: string,
|
||||
params?: { page?: number; page_size?: number },
|
||||
) {
|
||||
return api.get<{ data: DailyMonitoring[]; total: number }>(
|
||||
`/health/patients/${patientId}/daily-monitoring`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,3 +55,46 @@ export async function listProducts(params?: {
|
||||
}) {
|
||||
return api.get<ProductListResponse>('/health/points/products', params);
|
||||
}
|
||||
|
||||
// ===== 兑换订单 =====
|
||||
|
||||
export interface PointsOrder {
|
||||
id: string;
|
||||
patient_id: string;
|
||||
product_id: string;
|
||||
points_cost: number;
|
||||
status: string; // pending / verified / cancelled / expired
|
||||
qr_code: string;
|
||||
verified_by: string | null;
|
||||
verified_at: string | null;
|
||||
expires_at: string | null;
|
||||
notes: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
version: number;
|
||||
}
|
||||
|
||||
export interface PointsTransaction {
|
||||
id: string;
|
||||
account_id: string;
|
||||
type: string; // earn / spend / expired
|
||||
amount: number;
|
||||
remaining_amount: number;
|
||||
status: string;
|
||||
expires_at: string | null;
|
||||
balance_after: number;
|
||||
description: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export async function exchangeProduct(product_id: string) {
|
||||
return api.post<PointsOrder>('/health/points/exchange', { product_id });
|
||||
}
|
||||
|
||||
export async function listMyOrders(params?: { page?: number; page_size?: number }) {
|
||||
return api.get<{ data: PointsOrder[]; total: number }>('/health/points/orders', params);
|
||||
}
|
||||
|
||||
export async function listMyTransactions(params?: { page?: number; page_size?: number }) {
|
||||
return api.get<{ data: PointsTransaction[]; total: number }>('/health/points/transactions', params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user