更新
This commit is contained in:
@@ -75,7 +75,7 @@ $menuId = static function (string $perm) use ($now): int {
|
||||
$leaderboardMenu = $menuId('stats.yejiStats/leaderboard');
|
||||
Db::name('system_menu')->where('id', $leaderboardMenu)->update(['is_disable' => 0]);
|
||||
$grantsByRole = [
|
||||
197 => ['ai.mcp/access', 'stats.yejiStats/leaderboard', 'stats.doctorDailyStats/overview', 'stats.yejiStats/overview'],
|
||||
197 => ['ai.mcp/access', 'stats.yejiStats/leaderboard', 'stats.doctorDailyStats/overview', 'stats.yejiStats/overview', 'tcm.prescriptionOrder/lists'],
|
||||
198 => ['ai.mcp/access', 'stats.yejiStats/overview', 'stats.yejiStats/tabLeaderboard'],
|
||||
199 => ['ai.mcp/access', 'stats.yejiStats/leaderboard'],
|
||||
];
|
||||
@@ -107,6 +107,13 @@ foreach ($orders as [$no, $rx, $diag, $creator, $amount, $status, $refund, $time
|
||||
Db::name('tcm_prescription_order')->insert(['order_no' => $no, 'prescription_id' => $rx, 'diagnosis_id' => $diag, 'creator_id' => $creator,
|
||||
'amount' => $amount, 'fulfillment_status' => $status, 'refund_amount' => $refund, 'create_time' => strtotime($time)]);
|
||||
}
|
||||
// 已完成的挂号(面诊完成数,后台列名“接诊单数”):王医助 2 人次、钱医助 1 人次——与订单数无关
|
||||
Db::name('doctor_appointment')->whereIn('id', [96201, 96202, 96203])->delete();
|
||||
foreach ([96201 => [95011, 92002, 92004, '2031-02-03'], 96202 => [95012, 92003, 92004, '2031-02-10'], 96203 => [95013, 92003, 92009, '2031-02-10']] as $id => [$diag, $doctor, $assistant, $day]) {
|
||||
Db::name('doctor_appointment')->insert(['id' => $id, 'patient_id' => $diag, 'doctor_id' => $doctor, 'assistant_id' => $assistant, 'roster_id' => 0,
|
||||
'appointment_date' => $day, 'period' => 'morning', 'appointment_time' => '09:00:00', 'appointment_type' => 'video', 'status' => 3,
|
||||
'remark' => '', 'channel_source' => '', 'create_time' => $now, 'update_time' => $now]);
|
||||
}
|
||||
\think\facade\Cache::clear();
|
||||
|
||||
// ---------------------------------------------------------------- HTTP 工具
|
||||
@@ -189,6 +196,26 @@ aiMcpPerfExpect($ids === [92004, 92009], 'root with two department names sees bo
|
||||
$data = $ok($asst, 'zyt_perf_assistants', $feb)['structuredContent'];
|
||||
aiMcpPerfExpect(array_column($data['rows'], 'admin_id') === [92004] && $data['totals']['fee_amount'] == 1700, 'assistant with self data scope only sees itself');
|
||||
|
||||
// 指标名称:后台“接诊单数”是面诊完成人次,不能被说成订单数(线上把 96 人次面诊说成了 96 单)
|
||||
$result = $ok($mgr, 'zyt_perf_assistants', $feb + ['sort_by' => 'consult_count']);
|
||||
$data = $result['structuredContent'];
|
||||
aiMcpPerfExpect(str_contains($data['columns']['consult_count'], '面诊完成数') && str_contains($data['columns']['consult_count'], '接诊单数')
|
||||
&& str_contains($data['columns']['deal_order_count'], '成交订单数') && str_contains($data['definitions']['consult_count'], '不是订单数'), 'metric names say what is counted: ' . json_encode($data['columns'], JSON_UNESCAPED_UNICODE));
|
||||
aiMcpPerfExpect(($data['chart']['title'] ?? '') === '医助面诊完成数排行' && $data['chart']['unit'] === '人次' && $data['chart']['series'][0]['data'] == [2, 1]
|
||||
&& str_contains($data['chart']['note'], '不是订单数'), 'completed consultations chart: ' . json_encode($data['chart'] ?? null, JSON_UNESCAPED_UNICODE));
|
||||
aiMcpPerfExpect(str_contains($result['content'][0]['text'], '不是订单数') && str_contains($result['content'][0]['text'], '成交订单 4 单'), 'summary warns that consultations are not orders');
|
||||
|
||||
// 只看一个人:附上处方业务订单列表(按医助筛选)的数字,列表含已取消的 1 单,业绩不含
|
||||
$result = $ok($mgr, 'zyt_perf_assistants', $feb + ['name' => '王']);
|
||||
$check = $result['structuredContent']['order_list'] ?? null;
|
||||
aiMcpPerfExpect($check !== null && $check['total'] === 3 && $check['amount'] == 2200 && $check['performance_amount'] == 1700 && $check['not_counted'] === 1,
|
||||
'single assistant carries the order-list reconciliation: ' . json_encode($check, JSON_UNESCAPED_UNICODE));
|
||||
aiMcpPerfExpect(str_contains($result['content'][0]['text'], '对账') && str_contains($result['content'][0]['text'], '成交订单是 2 单'), 'reconciliation is spelled out in the text');
|
||||
$data = $ok($mgr, 'zyt_perf_doctors', $feb + ['name' => '张'])['structuredContent'];
|
||||
aiMcpPerfExpect(!isset($data['order_list']), 'doctor reconciliation is skipped for accounts that only see their own orders in the list');
|
||||
$check = $ok($root, 'zyt_perf_doctors', $feb + ['name' => '业绩张'])['structuredContent']['order_list'] ?? null;
|
||||
aiMcpPerfExpect($check !== null && $check['total'] === 3 && $check['not_counted'] === 1, 'doctor reconciliation for accounts that see all orders: ' . json_encode($check, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
// ---------------------------------------------------------------- 医生排行
|
||||
$data = $ok($mgr, 'zyt_perf_doctors', $feb)['structuredContent'];
|
||||
$rows = $byId($data['rows']);
|
||||
@@ -250,6 +277,12 @@ try {
|
||||
// ---------------------------------------------------------------- params 里写分页
|
||||
$result = $ok($root, 'zyt_query', ['resource' => 'doctor.appointment/lists', 'params' => ['start_date' => '2026-01-01', 'end_date' => '2026-12-31', 'page_size' => 2, 'page' => 1]]);
|
||||
aiMcpPerfExpect(($result['structuredContent']['page_size'] ?? 0) === 2, 'page_size inside params is treated as paging');
|
||||
// 自带分页的统计明细:外层 page/page_size 生效(以前被忽略,翻页永远拿到第一页,看起来像同一批记录反复出现)
|
||||
$lines = static fn (int $page) => $ok($root, 'zyt_query', ['resource' => 'stats.yejiStats/appointmentLines', 'params' => $feb + ['assistant_id' => 92004], 'page' => $page, 'page_size' => 1])['structuredContent']['result'];
|
||||
[$first, $second] = [$lines(1), $lines(2)];
|
||||
aiMcpPerfExpect(($first['paging'] ?? null) == ['total' => 2, 'page' => 1, 'page_size' => 1, 'has_more' => true] && ($second['paging']['has_more'] ?? null) === false,
|
||||
'report paging follows the outer page arguments: ' . json_encode([$first['paging'] ?? null, $second['paging'] ?? null]));
|
||||
aiMcpPerfExpect(count($first['lists']) === 1 && count($second['lists']) === 1 && $first['lists'][0]['id'] !== $second['lists'][0]['id'], 'page 2 returns the next record, not page 1 again');
|
||||
|
||||
// ---------------------------------------------------------------- 审计
|
||||
$logged = Db::name('ai_access_log')->where('admin_id', 92001)->where('tool', 'zyt_perf_assistants')->where('client_task_id', 'perf-task')->order('id', 'desc')->find();
|
||||
|
||||
Reference in New Issue
Block a user