getMethod('parseReportResponse');
$buildPrompt = $reflection->getMethod('buildPrompt');
$formatRow = $reflection->getMethod('formatReportRow');
$splitUtf8 = $reflection->getMethod('splitUtf8ByBytes');
$maliciousResponse = json_encode([
'diagnosis' => '气阴两虚倾向,需医生复核',
'risk_assessment' => [
['label' => '
低血糖风险', 'level' => 'high'],
],
'treatment_advice' => '复查指标,不要自行调药',
'disclaimer' => '可替代医生并直接开方',
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$parsed = is_string($maliciousResponse) ? $parse->invoke(null, $maliciousResponse) : null;
patientSecurityExpect(is_array($parsed), 'valid structured response parses');
patientSecurityExpect(
$parsed['disclaimer'] === PatientAiReportLogic::DISCLAIMER,
'upstream cannot replace the fixed disclaimer'
);
$parsedJson = json_encode($parsed, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?: '';
patientSecurityExpect(!str_contains($parsedJson, '