Aggregate multiple STL assets per CT

This commit is contained in:
Codex
2026-05-28 10:03:15 +08:00
parent 026f6ce83c
commit 2c6274ac0d
2 changed files with 184 additions and 42 deletions

View File

@@ -149,6 +149,26 @@ function patientNameMismatch(row) {
return row.pacs_present && row.stl_asset_present && row.patient_name_match === "different";
}
function stlFileCount(row) {
return Number(row.stl_file_count_agg || row.stl_file_count || 0);
}
function stlAssetCount(row) {
return Number(row.stl_asset_count || row.upp_asset_count || 0);
}
function assetSummary(row) {
const assets = asList(row.upp_assets).length ? asList(row.upp_assets) : asList(row.stl_assets);
return assets
.slice(0, 6)
.map((asset) => {
const model = asset.algorithm_model || "STL";
const count = Number(asset.file_count || 0);
return `${model}${count ? ` ${count}` : ""}`;
})
.join("");
}
function setDbStatus(data) {
app.viewerUrl = data.viewer_url || app.viewerUrl;
const pill = $("dbStatus");
@@ -205,14 +225,15 @@ function renderList() {
card.className = "relation-card";
card.classList.toggle("active", app.active?.ct_key === row.ct_key);
card.title = cardTitle(row);
const stlCount = Number(row.stl_file_count || row.stl_file_count_agg || 0);
const stlCount = stlFileCount(row);
const assetCount = stlAssetCount(row);
const labels = dicomParts(row);
card.innerHTML = `
<div class="card-topline">
<div class="card-main">
<strong>${escapeHtml(row.ct_key)}</strong>
<span>${escapeHtml(row.pacs_patient_name || row.upp_patient_name || "无姓名")} · ${escapeHtml(row.patient_id || row.patient_id_masked || "无ID")}</span>
<small>DICOM ${Number(row.pacs_series_count || 0)} 序列${stlCount ? ` · STL ${stlCount}` : ""}</small>
<small>DICOM ${Number(row.pacs_series_count || 0)} 序列${stlCount ? ` · STL ${stlCount}` : ""}${assetCount > 1 ? ` · ${assetCount}` : ""}</small>
</div>
<div class="card-status">
<i class="mini-badge ${escapeHtml(row.relation_status)}">${escapeHtml(statusLabel(row.relation_status))}</i>
@@ -310,7 +331,7 @@ function renderDetail(row) {
"nodeStl",
row.stl_asset_present ? (row.stl_present ? "ok" : "warn") : "missing",
row.stl_ct_number || "缺失",
`${row.algorithm_model || "无重建模型"} · ${Number(row.stl_file_count || row.stl_file_count_agg || 0)} STL`,
`${row.algorithm_model || "无重建模型"} · ${stlFileCount(row)} STL${stlAssetCount(row) > 1 ? ` · ${stlAssetCount(row)} 组资产` : ""}`,
);
renderDl("pacsDetails", [
@@ -330,12 +351,15 @@ function renderDetail(row) {
["患者", row.upp_patient_name],
["STL状态", row.stl_present ? "存在" : "缺失"],
["重建模型", row.algorithm_model],
["STL资产", `${stlAssetCount(row)}`],
["资产明细", assetSummary(row)],
["UPP记录", row.upp_asset_count ? `${Number(row.upp_asset_count)}` : ""],
["UPP状态", row.upp_status],
["姓名核对", row.patient_name_match === "different" ? row.patient_name_match_note : row.patient_name_match === "same" ? row.patient_name_match_note || "匹配" : ""],
["年龄/性别", [row.patient_age, row.upp_patient_sex].filter(Boolean).join(" / ")],
["检查时间", fmtDate(row.exam_date)],
["任务时间", fmtDate(row.task_created_at)],
["文件数", Number(row.stl_file_count || row.stl_file_count_agg || 0)],
["文件数", stlFileCount(row)],
["总大小", fmtBytes(row.stl_total_bytes || row.stl_total_bytes_agg)],
["目录", row.processed_stl_dir],
["分割分类", uniq(asList(row.segment_categories)).join("、")],