Files
zkxw/backend/app/constants/research_category.py
T
zlwuandCursor 6b1bf8a1d2 feat(pilot): 临床科研申请单新增业务类型字段
在申请单信息中增加 researchCategory(生物新技术临床科研/临床课题联合申报/生物制药研发),贯通 SQL、后端校验与 Web 表单/列表/详情;用户确认免除 Figma。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-20 15:51:19 +08:00

28 lines
836 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""临床科研申请单 · 业务子类型(research_category)"""
from typing import Optional
RESEARCH_CATEGORY_LABELS = {
"bio_tech_clinical": "生物新技术临床科研",
"joint_topic_declare": "临床课题联合申报",
"bio_pharma_rd": "生物制药研发",
}
RESEARCH_CATEGORY_CODES = tuple(RESEARCH_CATEGORY_LABELS.keys())
def research_category_label(code: Optional[str]) -> str:
if not code:
return ""
return RESEARCH_CATEGORY_LABELS.get(code, code)
def validate_research_category(code: Optional[str], required: bool = False) -> str:
value = (code or "").strip()
if not value:
if required:
raise ValueError("请选择业务类型")
return ""
if value not in RESEARCH_CATEGORY_LABELS:
raise ValueError("业务类型无效")
return value