const Base = require('../base'); module.exports = class extends Base { async indexAction() { this.assign('currentPage', 'dashboard'); this.assign('pageTitle', '控制台'); this.assign('adminUser', this.adminUser || {}); this.assign('canView', this.isSuperAdmin || (this.userPermissions || []).includes('patient:view')); return this.display(); } // 控制台统计数据接口 async statsAction() { const model = this.model('patient'); const [counts, todayCounts, trend, recent] = await Promise.all([ model.getStatusCounts(), model.getTodayCounts(), model.getDailyTrend(30), model.getRecentList(10) ]); return this.success({ counts, todayCounts, trend: trend.map(r => ({ date: r.date, total: parseInt(r.total, 10) || 0, rectal: parseInt(r.rectal, 10) || 0 })), recent }); } };