fix: harden sentinel quick verify findings

This commit is contained in:
Codex
2026-06-30 20:31:07 +00:00
parent aa5ac9481e
commit 45f890bf7f
2 changed files with 129 additions and 8 deletions
@@ -1187,17 +1187,37 @@ function safeDetailValue(value) {
function checkDisplay(item) {
const rawCode = rawCheckCode(item);
const registered = checkDisplayCatalog[rawCode];
if (registered) return registered;
const rawId = rawFindingId(item);
const registered = checkDisplayCatalog[rawId] || checkDisplayCatalog[rawCode];
const serviceCode = displayCheckCode(item?.checkCode || item?.check?.code);
if (registered) {
return {
...registered,
code: serviceCode || registered.code,
title: safeUserText(item?.checkTitleZh || item?.check?.titleZh) || registered.title,
summary: safeUserText(item?.checkSummaryZh || item?.summary || item?.evidenceSummary || item?.check?.summaryZh) || registered.summary,
};
}
return {
code: stableCheckCode(rawCode),
code: serviceCode || displayCheckCode(rawId || rawCode) || stableCheckCode(rawCode),
title: safeUserText(item?.checkTitleZh || item?.check?.titleZh) || "未登记监测项",
summary: safeUserText(item?.checkSummaryZh || item?.summary || item?.evidenceSummary) || "已记录监测项详情,见报告原文。",
};
}
function rawCheckCode(item) {
return String(item?.checkCode || item?.check?.code || item?.code || item?.findingId || item?.kind || "unknown");
return String(item?.checkCode || item?.check?.code || rawFindingId(item) || "unknown");
}
function rawFindingId(item) {
const value = item?.findingId || item?.finding_id || item?.id || item?.kind || item?.code;
return value === null || value === undefined || value === "" ? "" : String(value);
}
function displayCheckCode(value) {
const text = String(value || "").replace(/\s+/g, " ").trim();
if (text.length === 0 || text === "unknown") return "";
return text;
}
function stableCheckCode(value) {