report_teacher_weekly_stats.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <?php
  2. /**
  3. * 近 7 天老师组卷 + 学情分析套数(exam_analysis_results 按 paper_id 去重,一套卷计 1)。
  4. * 按老师:参与学生·组卷 = papers.student_id 去重;参与学生·学情 = exam_analysis_results.student_id 去重(均按本/上周期)。
  5. * 用法:
  6. * php scripts/report_teacher_weekly_stats.php
  7. * php scripts/report_teacher_weekly_stats.php > storage/app/reports/teacher-weekly-stats-$(date +%Y-%m-%d)_$(date +%H%M%S).md
  8. * (shell 里 %H%M%S 会展开为当前时分秒;PDF 见 scripts/report_teacher_weekly_stats_pdf.php)
  9. */
  10. require __DIR__ . '/../vendor/autoload.php';
  11. $app = require_once __DIR__ . '/../bootstrap/app.php';
  12. $app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
  13. $endCurrent = now();
  14. $startCurrent = now()->subDays(7);
  15. $startPrev = now()->subDays(14);
  16. $endPrev = $startCurrent;
  17. $db = \Illuminate\Support\Facades\DB::class;
  18. $sumPapers = static function ($from, $toExclusive) use ($db) {
  19. $q = $db::table('papers')
  20. ->whereNotNull('teacher_id')
  21. ->where('teacher_id', '!=', '')
  22. ->where('created_at', '>=', $from);
  23. if ($toExclusive !== null) {
  24. $q->where('created_at', '<', $toExclusive);
  25. }
  26. return (int) $q->count();
  27. };
  28. /** 学情分析:以卷子为单位,同一 paper_id 在区间内多条记录只计 1 */
  29. $countDistinctAnalysisPapers = static function ($from, $toExclusive) use ($db) {
  30. $q = $db::table('exam_analysis_results as ear')
  31. ->join('papers as p', 'p.paper_id', '=', 'ear.paper_id')
  32. ->whereNotNull('p.teacher_id')
  33. ->where('p.teacher_id', '!=', '')
  34. ->where('ear.created_at', '>=', $from);
  35. if ($toExclusive !== null) {
  36. $q->where('ear.created_at', '<', $toExclusive);
  37. }
  38. return (int) $q->distinct()->count('ear.paper_id');
  39. };
  40. $countActiveTeachers = static function ($from, $toExclusive) use ($db) {
  41. $q = $db::table('papers')
  42. ->whereNotNull('teacher_id')
  43. ->where('teacher_id', '!=', '')
  44. ->where('created_at', '>=', $from);
  45. if ($toExclusive !== null) {
  46. $q->where('created_at', '<', $toExclusive);
  47. }
  48. return (int) $q->distinct()->count('teacher_id');
  49. };
  50. $totalPapersCur = $sumPapers($startCurrent, null);
  51. $totalPapersPrev = $sumPapers($startPrev, $endPrev);
  52. $totalAnalysisCur = $countDistinctAnalysisPapers($startCurrent, null);
  53. $totalAnalysisPrev = $countDistinctAnalysisPapers($startPrev, $endPrev);
  54. $teachersCur = $countActiveTeachers($startCurrent, null);
  55. $teachersPrev = $countActiveTeachers($startPrev, $endPrev);
  56. $wowLine = static function (int $cur, int $prev): string {
  57. $delta = $cur - $prev;
  58. if ($prev === 0) {
  59. if ($cur === 0) {
  60. return '0';
  61. }
  62. return sprintf('+%d(上周期0)', $delta);
  63. }
  64. $pct = round(($delta / $prev) * 100, 2);
  65. $sign = $delta >= 0 ? '+' : '';
  66. $dir = match (true) {
  67. $delta > 0 => '↑',
  68. $delta < 0 => '↓',
  69. default => '→',
  70. };
  71. return sprintf('%s%d(%s%.2f%%)%s', $sign, $delta, $sign, $pct, $dir);
  72. };
  73. /** 总量表环比列:仅增长标绿 */
  74. $wowLineHtml = static function (int $cur, int $prev) use ($wowLine): string {
  75. $plain = $wowLine($cur, $prev);
  76. if ($cur > $prev) {
  77. return '<span style="color:#16a34a;font-weight:600;">'.$plain.'</span>';
  78. }
  79. return $plain;
  80. };
  81. /** 明细环比列:仅增长标绿 */
  82. $compareCellHtml = static function (int $cur, int $prev): string {
  83. $d = $cur - $prev;
  84. if ($d === 0) {
  85. return '0';
  86. }
  87. if ($prev === 0) {
  88. if ($cur === 0) {
  89. return '0';
  90. }
  91. return '<span style="color:#16a34a;font-weight:600;">+'.$d.'(上0)</span>';
  92. }
  93. $pct = round(($d / $prev) * 100, 1);
  94. $sign = $d > 0 ? '+' : '';
  95. $text = sprintf('%s%d(%s%.1f%%)', $sign, $d, $sign, $pct);
  96. if ($d > 0) {
  97. return '<span style="color:#16a34a;font-weight:600;">'.$text.'</span>';
  98. }
  99. return $text;
  100. };
  101. $byTeacher = \Illuminate\Support\Facades\DB::table('papers')
  102. ->whereNotNull('teacher_id')
  103. ->where('teacher_id', '!=', '')
  104. ->where('created_at', '>=', $startCurrent)
  105. ->selectRaw('teacher_id, COUNT(*) as paper_count')
  106. ->groupBy('teacher_id')
  107. ->get();
  108. // 近 7 天产生学情分析的试卷套数:按 ear.paper_id 去重后归到 papers.teacher_id
  109. $analysisByTeacher = \Illuminate\Support\Facades\DB::table('exam_analysis_results as ear')
  110. ->join('papers as p', 'p.paper_id', '=', 'ear.paper_id')
  111. ->whereNotNull('p.teacher_id')
  112. ->where('p.teacher_id', '!=', '')
  113. ->where('ear.created_at', '>=', $startCurrent)
  114. ->selectRaw('p.teacher_id, COUNT(DISTINCT ear.paper_id) AS paper_set_count')
  115. ->groupBy('p.teacher_id')
  116. ->get();
  117. $analysisMap = [];
  118. foreach ($analysisByTeacher as $r) {
  119. $analysisMap[(string) $r->teacher_id] = (int) $r->paper_set_count;
  120. }
  121. $paperMap = [];
  122. foreach ($byTeacher as $r) {
  123. $paperMap[(string) $r->teacher_id] = (int) $r->paper_count;
  124. }
  125. $byTeacherPrev = $db::table('papers')
  126. ->whereNotNull('teacher_id')
  127. ->where('teacher_id', '!=', '')
  128. ->where('created_at', '>=', $startPrev)
  129. ->where('created_at', '<', $endPrev)
  130. ->selectRaw('teacher_id, COUNT(*) as paper_count')
  131. ->groupBy('teacher_id')
  132. ->get();
  133. $analysisByTeacherPrev = $db::table('exam_analysis_results as ear')
  134. ->join('papers as p', 'p.paper_id', '=', 'ear.paper_id')
  135. ->whereNotNull('p.teacher_id')
  136. ->where('p.teacher_id', '!=', '')
  137. ->where('ear.created_at', '>=', $startPrev)
  138. ->where('ear.created_at', '<', $endPrev)
  139. ->selectRaw('p.teacher_id, COUNT(DISTINCT ear.paper_id) AS paper_set_count')
  140. ->groupBy('p.teacher_id')
  141. ->get();
  142. $paperMapPrev = [];
  143. foreach ($byTeacherPrev as $r) {
  144. $paperMapPrev[(string) $r->teacher_id] = (int) $r->paper_count;
  145. }
  146. $analysisMapPrev = [];
  147. foreach ($analysisByTeacherPrev as $r) {
  148. $analysisMapPrev[(string) $r->teacher_id] = (int) $r->paper_set_count;
  149. }
  150. /** 组卷参与学生:papers.student_id 在本/上周期内按老师去重 */
  151. $studentAsmCurRows = $db::table('papers')
  152. ->whereNotNull('teacher_id')
  153. ->where('teacher_id', '!=', '')
  154. ->whereNotNull('student_id')
  155. ->where('student_id', '!=', '')
  156. ->where('created_at', '>=', $startCurrent)
  157. ->groupBy('teacher_id')
  158. ->selectRaw('teacher_id, COUNT(DISTINCT student_id) AS c')
  159. ->get();
  160. $studentAsmPrevRows = $db::table('papers')
  161. ->whereNotNull('teacher_id')
  162. ->where('teacher_id', '!=', '')
  163. ->whereNotNull('student_id')
  164. ->where('student_id', '!=', '')
  165. ->where('created_at', '>=', $startPrev)
  166. ->where('created_at', '<', $endPrev)
  167. ->groupBy('teacher_id')
  168. ->selectRaw('teacher_id, COUNT(DISTINCT student_id) AS c')
  169. ->get();
  170. /** 学情参与学生:exam_analysis_results.student_id 在本/上周期内按 papers.teacher_id 去重 */
  171. $studentAnalysisCurRows = $db::table('exam_analysis_results as ear')
  172. ->join('papers as p', 'p.paper_id', '=', 'ear.paper_id')
  173. ->whereNotNull('p.teacher_id')
  174. ->where('p.teacher_id', '!=', '')
  175. ->whereNotNull('ear.student_id')
  176. ->where('ear.student_id', '!=', '')
  177. ->where('ear.created_at', '>=', $startCurrent)
  178. ->groupBy('p.teacher_id')
  179. ->selectRaw('p.teacher_id AS teacher_id, COUNT(DISTINCT ear.student_id) AS c')
  180. ->get();
  181. $studentAnalysisPrevRows = $db::table('exam_analysis_results as ear')
  182. ->join('papers as p', 'p.paper_id', '=', 'ear.paper_id')
  183. ->whereNotNull('p.teacher_id')
  184. ->where('p.teacher_id', '!=', '')
  185. ->whereNotNull('ear.student_id')
  186. ->where('ear.student_id', '!=', '')
  187. ->where('ear.created_at', '>=', $startPrev)
  188. ->where('ear.created_at', '<', $endPrev)
  189. ->groupBy('p.teacher_id')
  190. ->selectRaw('p.teacher_id AS teacher_id, COUNT(DISTINCT ear.student_id) AS c')
  191. ->get();
  192. $studentAsmCurMap = [];
  193. foreach ($studentAsmCurRows as $row) {
  194. $studentAsmCurMap[(string) $row->teacher_id] = (int) $row->c;
  195. }
  196. $studentAsmPrevMap = [];
  197. foreach ($studentAsmPrevRows as $row) {
  198. $studentAsmPrevMap[(string) $row->teacher_id] = (int) $row->c;
  199. }
  200. $studentAnalysisCurMap = [];
  201. foreach ($studentAnalysisCurRows as $row) {
  202. $studentAnalysisCurMap[(string) $row->teacher_id] = (int) $row->c;
  203. }
  204. $studentAnalysisPrevMap = [];
  205. foreach ($studentAnalysisPrevRows as $row) {
  206. $studentAnalysisPrevMap[(string) $row->teacher_id] = (int) $row->c;
  207. }
  208. $names = \Illuminate\Support\Facades\DB::table('teachers')->pluck('name', 'teacher_id');
  209. $nameStrMap = [];
  210. foreach ($names as $tid => $nm) {
  211. $nameStrMap[(string) $tid] = $nm;
  212. }
  213. $rows = [];
  214. foreach ($paperMap as $tid => $paperCount) {
  215. $rows[] = [
  216. 'teacher_id' => $tid,
  217. 'name' => (string) ($nameStrMap[$tid] ?? $tid),
  218. 'papers' => $paperCount,
  219. 'analysis_sets' => (int) ($analysisMap[$tid] ?? 0),
  220. 'papers_prev' => (int) ($paperMapPrev[$tid] ?? 0),
  221. 'analysis_sets_prev' => (int) ($analysisMapPrev[$tid] ?? 0),
  222. ];
  223. }
  224. usort($rows, static fn ($a, $b) => $b['papers'] <=> $a['papers']);
  225. $windowCur = sprintf(
  226. '%s ~ %s',
  227. $startCurrent->format('Y-m-d H:i:s'),
  228. $endCurrent->format('Y-m-d H:i:s')
  229. );
  230. $windowPrev = sprintf(
  231. '%s ~ %s',
  232. $startPrev->format('Y-m-d H:i:s'),
  233. $endPrev->format('Y-m-d H:i:s')
  234. );
  235. $generatedAt = $endCurrent->format('Y-m-d H:i:s');
  236. $tz = (string) config('app.timezone', 'UTC');
  237. /**
  238. * 将 [from, to) 均分为 7 段,返回每段内组卷数、学情去重套数。
  239. *
  240. * @return array{labels: list<string>, papers: list<int>, analysis: list<int>}
  241. */
  242. $dailySlices = static function (\Carbon\Carbon $from, \Carbon\Carbon $toExclusive) use ($db): array {
  243. $totalSec = max(1, $toExclusive->getTimestamp() - $from->getTimestamp());
  244. $sliceSec = $totalSec / 7;
  245. $labels = [];
  246. $papers = [];
  247. $analysis = [];
  248. for ($i = 0; $i < 7; $i++) {
  249. $sliceFrom = $from->copy()->addSeconds((int) floor($sliceSec * $i));
  250. $sliceTo = $i < 6
  251. ? $from->copy()->addSeconds((int) floor($sliceSec * ($i + 1)))
  252. : $toExclusive;
  253. $labels[] = $sliceFrom->format('n/j');
  254. $papers[] = (int) $db::table('papers')
  255. ->whereNotNull('teacher_id')
  256. ->where('teacher_id', '!=', '')
  257. ->where('created_at', '>=', $sliceFrom)
  258. ->where('created_at', '<', $sliceTo)
  259. ->count();
  260. $analysis[] = (int) $db::table('exam_analysis_results as ear')
  261. ->join('papers as p', 'p.paper_id', '=', 'ear.paper_id')
  262. ->whereNotNull('p.teacher_id')
  263. ->where('p.teacher_id', '!=', '')
  264. ->where('ear.created_at', '>=', $sliceFrom)
  265. ->where('ear.created_at', '<', $sliceTo)
  266. ->distinct()
  267. ->count('ear.paper_id');
  268. }
  269. return ['labels' => $labels, 'papers' => $papers, 'analysis' => $analysis];
  270. };
  271. $curDaily = $dailySlices($startCurrent, $endCurrent);
  272. $prevDaily = $dailySlices($startPrev, $endPrev);
  273. $buildChartSvg = static function (array $curDaily, array $prevDaily): string {
  274. $labels = $curDaily['labels'];
  275. $pc = $curDaily['papers'];
  276. $ac = $curDaily['analysis'];
  277. $pp = $prevDaily['papers'];
  278. $ap = $prevDaily['analysis'];
  279. $maxY = max(1, ...$pc, ...$ac, ...$pp, ...$ap);
  280. $W = 480;
  281. $H = 200;
  282. $padL = 44;
  283. $padR = 12;
  284. $padT = 16;
  285. $padB = 36;
  286. $gw = $W - $padL - $padR;
  287. $gh = $H - $padT - $padB;
  288. $n = 7;
  289. $xAt = static function (int $i) use ($padL, $gw, $n): float {
  290. return $padL + ($n <= 1 ? $gw / 2 : $gw * $i / ($n - 1));
  291. };
  292. $yAt = static function (int $v) use ($padT, $gh, $maxY): float {
  293. return $padT + $gh - ($v / $maxY) * $gh;
  294. };
  295. $lineWithDots = static function (array $vals, string $stroke, string $dash, float $sw = 1.6) use ($xAt, $yAt, $n): string {
  296. $pts = [];
  297. $circles = '';
  298. for ($i = 0; $i < $n; $i++) {
  299. $x = $xAt($i);
  300. $y = $yAt((int) $vals[$i]);
  301. $pts[] = round($x, 1).','.round($y, 1);
  302. $circles .= sprintf(
  303. '<circle cx="%.1f" cy="%.1f" r="3.2" fill="%s" stroke="#fff" stroke-width="1"/>',
  304. $x,
  305. $y,
  306. $stroke
  307. );
  308. }
  309. $poly = implode(' ', $pts);
  310. $dashAttr = $dash !== '' ? ' stroke-dasharray="'.$dash.'"' : '';
  311. return '<polyline fill="none" stroke="'.$stroke.'" stroke-width="'.$sw.'"'.$dashAttr.' points="'.$poly.'" />'.$circles;
  312. };
  313. $xAxisY = $padT + $gh;
  314. $tickTxt = '';
  315. for ($i = 0; $i < $n; $i++) {
  316. $x = $xAt($i);
  317. $lab = htmlspecialchars((string) ($labels[$i] ?? ''), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
  318. $tickTxt .= sprintf(
  319. '<text x="%.1f" y="%d" text-anchor="middle" font-size="9" fill="#374151" font-family="sun-exta,sans-serif">%s</text>',
  320. $x,
  321. $H - 10,
  322. $lab
  323. );
  324. }
  325. $yTick = '';
  326. for ($k = 0; $k <= 4; $k++) {
  327. $v = (int) round($maxY * $k / 4);
  328. $y = $yAt($v);
  329. $yTick .= sprintf(
  330. '<line x1="%d" y1="%.1f" x2="%d" y2="%.1f" stroke="#e5e7eb" stroke-width="1"/>',
  331. $padL,
  332. $y,
  333. $padL + $gw,
  334. $y
  335. );
  336. $yTick .= sprintf(
  337. '<text x="%d" y="%.1f" font-size="8" fill="#6b7280" font-family="sun-exta,sans-serif">%d</text>',
  338. 4,
  339. $y + 3,
  340. $v
  341. );
  342. }
  343. $legend = '<g font-family="sun-exta,sans-serif" font-size="9">';
  344. $lx = $padL + $gw - 168;
  345. $ly = $padT + 4;
  346. $items = [
  347. ['#2563eb', '组卷·本周期', ''],
  348. ['#ea580c', '学情·本周期', ''],
  349. ['#93c5fd', '组卷·上周期', '6,4'],
  350. ['#fdba74', '学情·上周期', '6,4'],
  351. ];
  352. foreach ($items as $idx => $it) {
  353. $yy = $ly + $idx * 13;
  354. $legend .= sprintf(
  355. '<line x1="%d" y1="%d" x2="%d" y2="%d" stroke="%s" stroke-width="2" %s/>',
  356. $lx,
  357. $yy,
  358. $lx + 18,
  359. $yy,
  360. $it[0],
  361. $it[2] !== '' ? 'stroke-dasharray="'.$it[2].'"' : ''
  362. );
  363. $legend .= sprintf(
  364. '<text x="%d" y="%d" fill="#111">%s</text>',
  365. $lx + 24,
  366. $yy + 4,
  367. htmlspecialchars($it[1], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8')
  368. );
  369. }
  370. $legend .= '</g>';
  371. $svg = sprintf(
  372. '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 %d %d" width="100%%" height="auto" style="max-width:520px;">',
  373. $W,
  374. $H
  375. );
  376. $svg .= sprintf('<rect x="0" y="0" width="%d" height="%d" fill="#fafafa"/>', $W, $H);
  377. $svg .= $yTick;
  378. $svg .= sprintf('<line x1="%d" y1="%.1f" x2="%.1f" y2="%.1f" stroke="#9ca3af" stroke-width="1"/>', $padL, $xAxisY, $padL + $gw, $xAxisY);
  379. $svg .= $lineWithDots($pp, '#93c5fd', '6,4', 1.4);
  380. $svg .= $lineWithDots($ap, '#fdba74', '6,4', 1.4);
  381. $svg .= $lineWithDots($pc, '#2563eb', '', 1.8);
  382. $svg .= $lineWithDots($ac, '#ea580c', '', 1.8);
  383. $svg .= $tickTxt;
  384. $svg .= $legend;
  385. $svg .= '</svg>';
  386. return $svg;
  387. };
  388. $chartSvg = $buildChartSvg($curDaily, $prevDaily);
  389. echo "## 老师组卷与学情分析(近7天)\n\n";
  390. echo "> 生成 {$generatedAt} · {$tz} · 本 {$windowCur} · 上 {$windowPrev}\n\n";
  391. echo "### 总量\n\n";
  392. echo "| 指标 | 本周期 | 上周期 | 环比 |\n";
  393. echo "| --- | ---: | ---: | --- |\n";
  394. echo sprintf("| 组卷总套数 | %d | %d | %s |\n", $totalPapersCur, $totalPapersPrev, $wowLineHtml($totalPapersCur, $totalPapersPrev));
  395. echo sprintf("| 学情分析套数(卷去重) | %d | %d | %s |\n", $totalAnalysisCur, $totalAnalysisPrev, $wowLineHtml($totalAnalysisCur, $totalAnalysisPrev));
  396. echo sprintf("| 有组卷老师数 | %d | %d | %s |\n", $teachersCur, $teachersPrev, $wowLineHtml($teachersCur, $teachersPrev));
  397. echo "\n### 近7段每日对比(本周期与上周期时间轴对齐)\n\n";
  398. echo '<div class="weekly-chart">';
  399. echo '<p style="font-size:9pt;color:#4b5563;margin:0 0 6px 0;">横轴为统计窗口均分的 7 段,数字为每段「组卷套数 / 学情分析套数(卷去重)」;实线本周期,虚线上一同期。</p>';
  400. echo $chartSvg;
  401. echo "</div>\n\n";
  402. echo "### 按老师\n\n";
  403. echo '<table class="weekly-teacher-table">';
  404. echo '<colgroup>';
  405. echo '<col style="width:4%" /><col style="width:5%" /><col style="width:7%" />';
  406. echo '<col style="width:7%" /><col style="width:7%" /><col style="width:8%" />';
  407. echo '<col class="col-an" style="width:9%" /><col class="col-an" style="width:9%" /><col style="width:8%" />';
  408. echo '<col class="col-stu" style="width:9%" /><col class="col-stu" style="width:9%" />';
  409. echo '</colgroup>';
  410. echo '<thead><tr>';
  411. echo '<th>排名</th><th>老师</th><th>teacher_id</th><th>组卷·本</th><th>组卷·上</th><th>组卷·环比</th><th>学情·本</th><th>学情·上</th><th>学情·环比</th>';
  412. echo '<th>参与学生·组卷</th><th>参与学生·学情</th>';
  413. echo "</tr></thead>\n<tbody>\n";
  414. $i = 1;
  415. foreach ($rows as $r) {
  416. $nm = htmlspecialchars((string) $r['name'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
  417. $pc = $r['papers'];
  418. $pp = $r['papers_prev'];
  419. $ac = $r['analysis_sets'];
  420. $ap = $r['analysis_sets_prev'];
  421. $tidKey = (string) $r['teacher_id'];
  422. $stuAsmC = (int) ($studentAsmCurMap[$tidKey] ?? 0);
  423. $stuAsmP = (int) ($studentAsmPrevMap[$tidKey] ?? 0);
  424. $stuAnC = (int) ($studentAnalysisCurMap[$tidKey] ?? 0);
  425. $stuAnP = (int) ($studentAnalysisPrevMap[$tidKey] ?? 0);
  426. echo '<tr>';
  427. echo '<td style="text-align:right">'.((string) $i++).'</td>';
  428. echo '<td class="td-name">'.$nm.'</td>';
  429. echo '<td>'.htmlspecialchars((string) $r['teacher_id'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8').'</td>';
  430. echo '<td style="text-align:right">'.((string) $pc).'</td>';
  431. echo '<td style="text-align:right">'.((string) $pp).'</td>';
  432. echo '<td>'.$compareCellHtml($pc, $pp).'</td>';
  433. echo '<td style="text-align:right" class="td-an">'.((string) $ac).'</td>';
  434. echo '<td style="text-align:right" class="td-an">'.((string) $ap).'</td>';
  435. echo '<td>'.$compareCellHtml($ac, $ap).'</td>';
  436. echo '<td style="text-align:right" class="td-stu" title="本周期/上周期,学生去重">'.$stuAsmC.' / '.$stuAsmP.'</td>';
  437. echo '<td style="text-align:right" class="td-stu" title="本周期/上周期,学生去重">'.$stuAnC.' / '.$stuAnP.'</td>';
  438. echo "</tr>\n";
  439. }
  440. echo "</tbody></table>\n";
  441. echo sprintf("\n本周期有组卷 **%d** 人。\n", count($rows));