feat: 动态生成资料包异常提示
This commit is contained in:
@@ -641,3 +641,89 @@ def test_document_list_shows_export_history_links_and_processing_pipeline(client
|
||||
assert reverse("audit:list") in content
|
||||
assert "查看导出记录" in content
|
||||
assert f"{reverse('audit:list')}?keyword=SUB-20260604-012" in content
|
||||
|
||||
|
||||
def test_document_list_shows_batch_level_exception_items(client, db):
|
||||
SubmissionBatch.objects.create(
|
||||
batch_id="SUB-20260604-101",
|
||||
product_name="甲型流感病毒抗原检测试剂盒",
|
||||
workflow_type="registration",
|
||||
conversation_id="conv-101",
|
||||
file_count=4,
|
||||
page_count=28,
|
||||
import_status=SubmissionBatch.STATUS_REVIEW_REQUIRED,
|
||||
exception_count=2,
|
||||
)
|
||||
|
||||
response = client.get(reverse("documents:list"))
|
||||
|
||||
content = response.content.decode("utf-8")
|
||||
assert response.status_code == 200
|
||||
assert "资料包待复核:SUB-20260604-101" in content
|
||||
assert "甲型流感病毒抗原检测试剂盒 当前存在 2 项异常" in content
|
||||
|
||||
|
||||
def test_document_list_shows_manual_review_document_exception_items(client, db):
|
||||
batch = SubmissionBatch.objects.create(
|
||||
batch_id="SUB-20260604-102",
|
||||
product_name="乙型流感病毒抗原检测试剂盒",
|
||||
workflow_type="registration",
|
||||
conversation_id="conv-102",
|
||||
file_count=1,
|
||||
page_count=9,
|
||||
import_status=SubmissionBatch.STATUS_REVIEW_REQUIRED,
|
||||
exception_count=1,
|
||||
)
|
||||
UploadedDocument.objects.create(
|
||||
batch=batch,
|
||||
scenario_id="document_review",
|
||||
original_name="CH1-产品说明书.docx",
|
||||
file="documents/20260604/manual-review.docx",
|
||||
file_type="docx",
|
||||
size=128,
|
||||
page_count=9,
|
||||
page_count_confidence="estimated",
|
||||
chapter_code="CH1",
|
||||
chapter_match_status="matched",
|
||||
needs_manual_review=True,
|
||||
status=UploadedDocument.STATUS_UPLOADED,
|
||||
)
|
||||
|
||||
response = client.get(reverse("documents:list"))
|
||||
|
||||
content = response.content.decode("utf-8")
|
||||
assert response.status_code == 200
|
||||
assert "文档待人工复核:CH1-产品说明书.docx" in content
|
||||
assert "页数为估算值,建议人工确认" in content
|
||||
|
||||
|
||||
def test_document_list_shows_failed_document_exception_items(client, db):
|
||||
batch = SubmissionBatch.objects.create(
|
||||
batch_id="SUB-20260604-103",
|
||||
product_name="呼吸道病原体多重核酸检测试剂盒",
|
||||
workflow_type="registration",
|
||||
conversation_id="conv-103",
|
||||
file_count=1,
|
||||
page_count=5,
|
||||
import_status=SubmissionBatch.STATUS_COMPLETED,
|
||||
exception_count=0,
|
||||
)
|
||||
UploadedDocument.objects.create(
|
||||
batch=batch,
|
||||
scenario_id="document_review",
|
||||
original_name="沟通记录扫描件.pdf",
|
||||
file="documents/20260604/failed.pdf",
|
||||
file_type="pdf",
|
||||
size=256,
|
||||
page_count=5,
|
||||
chapter_match_status="unknown",
|
||||
status=UploadedDocument.STATUS_FAILED,
|
||||
error_message="OCR 识别失败,请重新上传清晰版。",
|
||||
)
|
||||
|
||||
response = client.get(reverse("documents:list"))
|
||||
|
||||
content = response.content.decode("utf-8")
|
||||
assert response.status_code == 200
|
||||
assert "文档处理失败:沟通记录扫描件.pdf" in content
|
||||
assert "OCR 识别失败,请重新上传清晰版。" in content
|
||||
|
||||
Reference in New Issue
Block a user