Files
zyt/server/tests/TcmConsultationPulseExcludedR36cBoundaryTest.php
T
2026-10-27 14:03:35 +08:00

28 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
require dirname(__DIR__) . '/vendor/autoload.php';
use app\adminapi\service\TcmConsultationPulsePolicy;
$checks = [];
foreach (['缺', '缺少', '缺乏', '未采集', '未记录'] as $missing) {
foreach (['导致', '影响', '妨碍', '则', '时', '故', '所以', '也', '说明', '会使'] as $connective) {
$text = $missing . '脉' . $connective . '无法辨证选方。';
$checks[] = ['text' => $text, 'passed' => !TcmConsultationPulsePolicy::validate([], $text)['valid']];
}
foreach (['率', '压', '搏', '络', '管'] as $suffix) {
$text = $missing . '脉' . $suffix . '相关记录,保留该信息缺口。';
$checks[] = ['text' => $text, 'passed' => TcmConsultationPulsePolicy::validate([], $text)['valid']];
}
}
foreach (['心率78次/分。', '冠状动脉钙化。', '静脉血栓病史待核实。', '记录脉络病变原始资料。',
'pulse rate 78/min.', 'pulse pressure 40mmHg.'] as $text) {
$checks[] = ['text' => $text, 'passed' => TcmConsultationPulsePolicy::validate([], $text)['valid']];
}
$failed = array_values(array_filter($checks, static fn(array $check): bool => !$check['passed']));
echo json_encode(['scope' => 'finite missing-pulse noun boundary; no clinical or provider acceptance',
'checks' => count($checks), 'passed' => count($checks) - count($failed), 'failed' => $failed],
JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . PHP_EOL;
exit($failed ? 1 : 0);