From 5d0df4646b4fb1c0a4dd91301be7a5c8dd19a636 Mon Sep 17 00:00:00 2001
From: admin <572701190@qq.com>
Date: Fri, 8 May 2026 23:06:00 +0800
Subject: [PATCH] move export options to results
---
README.md | 2 +-
app/main.py | 97 ++++++++++++++++++++++++++++++++++++++----------
app/processor.py | 81 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 156 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
index b8cb27d..3fa0ca2 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ V2:zip 解压后包含 `Patients_info.csv`,并按患者目录分别保存检
患者编号类型可选择自动识别。自动识别会读取 `Patients_info.csv` 中的 `pat_no`,并与 `Tests_List` 文件名或患者目录名比对:若更匹配 10 位补零编号,则使用 `pat_no`;若更匹配原始编号,则使用 `zhuyuanhao`。
-导出的压缩包默认只包含 Excel 结果,不包含处理日志。系统默认输出全部检测记录,并可选择是否保留:
+导出的压缩包默认只包含 Excel 结果,不包含处理日志。系统默认输出完整结果;处理完成后可在结果页选择导出时是否保留:
- 基本工作表
- 未匹配检测内容项
diff --git a/app/main.py b/app/main.py
index 36c393f..942f364 100644
--- a/app/main.py
+++ b/app/main.py
@@ -62,11 +62,6 @@ def index() -> str:
-
-
-
-
-
\u9ed8\u8ba4\u8f93\u51fa\u5168\u90e8\u68c0\u6d4b\u8bb0\u5f55\uff0c\u5e76\u4fdd\u7559\u201c{UNMATCHED}\u201d\u5217\uff1b\u8be5\u5217\u4e3a\u989d\u5916\u8f85\u52a9\u4fe1\u606f\uff0c\u4fbf\u4e8e\u6838\u5bf9\u672a\u5f52\u7c7b\u9879\u76ee\u3002
@@ -82,9 +77,6 @@ async def process(
data_type: str = Form("auto"),
result_name: str = Form("Result"),
preview_rows: int = Form(20),
- include_basic_sheets: str | None = Form(None),
- include_unmatched_items: str | None = Form(None),
- include_summary_sheet: str | None = Form(None),
) -> str:
if not file.filename or not file.filename.lower().endswith(".zip"):
raise HTTPException(status_code=400, detail="\u8bf7\u4e0a\u4f20 zip \u6587\u4ef6\u3002")
@@ -106,9 +98,9 @@ async def process(
show_not_match=True,
show_all_infos=True,
preview_rows=rows,
- include_basic_sheets=include_basic_sheets == "true",
- include_unmatched_items=include_unmatched_items == "true",
- include_summary_sheet=include_summary_sheet == "true",
+ include_basic_sheets=True,
+ include_unmatched_items=True,
+ include_summary_sheet=True,
)
except ProcessingError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc
@@ -130,20 +122,42 @@ def result_page(job_id: str, preview_rows: int = Query(20, ge=5, le=200)) -> str
@app.get("/download/all/{job_id}")
-def download_all(job_id: str) -> FileResponse:
+def download_all(
+ job_id: str,
+ include_basic_sheets: bool = Query(True),
+ include_unmatched_items: bool = Query(True),
+ include_summary_sheet: bool = Query(True),
+) -> FileResponse:
job_dir = _get_job_dir(job_id)
try:
- result_zip = create_result_zip(job_dir)
+ result_zip = create_result_zip(
+ job_dir,
+ include_basic_sheets=include_basic_sheets,
+ include_unmatched_items=include_unmatched_items,
+ include_summary_sheet=include_summary_sheet,
+ )
except ProcessingError as exc:
raise HTTPException(status_code=404, detail=str(exc)) from exc
return FileResponse(result_zip, media_type="application/zip", filename="result.zip")
@app.get("/download/file/{job_id}")
-def download_file(job_id: str, path: str = Query(...)) -> FileResponse:
+def download_file(
+ job_id: str,
+ path: str = Query(...),
+ include_basic_sheets: bool = Query(True),
+ include_unmatched_items: bool = Query(True),
+ include_summary_sheet: bool = Query(True),
+) -> FileResponse:
job_dir = _get_job_dir(job_id)
try:
- target = find_output_file(job_dir, path)
+ target = find_output_file(
+ job_dir,
+ path,
+ include_basic_sheets=include_basic_sheets,
+ include_unmatched_items=include_unmatched_items,
+ include_summary_sheet=include_summary_sheet,
+ )
except ProcessingError as exc:
raise HTTPException(status_code=404, detail=str(exc)) from exc
return FileResponse(
@@ -184,9 +198,15 @@ def _render_result(result: ProcessingResult, preview_rows: int = 20) -> str:
\u6570\u636e\u884c{total_rows}
+