feat(market): 新增委托加工业务并复用临床科研流程
独立 biz_type=contract_processing,申请/缴费/出库与临床科研共用逻辑; 业务子类型支持胎盘冻干粉/脂肪外泌体/NK/MSC/其他自定义,并补充菜单与生产质检 Tab。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
964384108a
commit
9b5e68f4ae
58 files changed
+717
-116
No files matched your search
@@ -383,14 +383,14 @@ async def api_save_application(
|
||||
|
||||
if (
|
||||
not is_edit
|
||||
and biz_type not in ("clinical_application", "basic_experiment")
|
||||
and biz_type not in ("clinical_application", "basic_experiment", "contract_processing")
|
||||
and not app_data["channelServiceOrderId"]
|
||||
):
|
||||
return error_response(400, "请选择渠道服务订单")
|
||||
|
||||
if (
|
||||
not is_edit
|
||||
and biz_type in ("clinical_application", "basic_experiment")
|
||||
and biz_type in ("clinical_application", "basic_experiment", "contract_processing")
|
||||
and not app_data["channelId"]
|
||||
):
|
||||
return error_response(400, "请选择渠道")
|
||||
|
||||
@@ -56,7 +56,7 @@ class ProjectBody(Body):
|
||||
|
||||
|
||||
class PreviewBody(Body):
|
||||
bizType: Literal['presign', 'cell_storage', 'research_donation', 'pilot_service', 'basic_experiment']
|
||||
bizType: Literal['presign', 'cell_storage', 'research_donation', 'pilot_service', 'basic_experiment', 'contract_processing']
|
||||
id: str
|
||||
projectId: str
|
||||
|
||||
@@ -162,7 +162,7 @@ def records(bizType: str, page: int=Query(1, ge=1), pageSize: int=Query(20, ge=1
|
||||
|
||||
@router.get(PREFIX + '/statistics/records')
|
||||
def statistics_records(
|
||||
bizType: Literal['cell_storage', 'research_donation', 'pilot_service', 'basic_experiment'],
|
||||
bizType: Literal['cell_storage', 'research_donation', 'pilot_service', 'basic_experiment', 'contract_processing'],
|
||||
page: int = Query(1, ge=1), pageSize: int = Query(20, ge=1, le=200),
|
||||
teamId: Optional[str] = None, projectId: Optional[str] = None,
|
||||
unassigned: bool = False, status: Optional[str] = None, keyword: Optional[str] = None,
|
||||
@@ -182,7 +182,7 @@ def preview(body: PreviewBody, ctx=Depends(guard('project:assignment:edit')), db
|
||||
|
||||
@router.get(PREFIX + '/assignments/records')
|
||||
def assignment_records(
|
||||
bizType: Literal['cell_storage', 'research_donation', 'pilot_service', 'basic_experiment'],
|
||||
bizType: Literal['cell_storage', 'research_donation', 'pilot_service', 'basic_experiment', 'contract_processing'],
|
||||
page: int = Query(1, ge=1), pageSize: int = Query(20, ge=1, le=200),
|
||||
teamId: Optional[str] = None, projectId: Optional[str] = None,
|
||||
unassigned: bool = False, status: Optional[str] = None, keyword: Optional[str] = None,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
"""中试/临床/科研类申请单业务类型辅助。"""
|
||||
from typing import Optional
|
||||
|
||||
# 临床科研与委托加工共用申请/交付/缴费/出库流程
|
||||
RESEARCH_LIKE_BIZ_TYPES = ("basic_experiment", "contract_processing")
|
||||
|
||||
BIZ_TYPE_LABELS = {
|
||||
"pilot_service": "中试服务",
|
||||
"clinical_application": "临床应用",
|
||||
"basic_experiment": "临床科研",
|
||||
"contract_processing": "委托加工",
|
||||
}
|
||||
|
||||
APPLICATION_NO_PREFIX = {
|
||||
"clinical_application": "LCSQ",
|
||||
"basic_experiment": "JCSY",
|
||||
"contract_processing": "WTJG",
|
||||
"pilot_service": "ZSSQ",
|
||||
}
|
||||
|
||||
|
||||
def is_research_like_biz(biz_type: Optional[str]) -> bool:
|
||||
return (biz_type or "") in RESEARCH_LIKE_BIZ_TYPES
|
||||
|
||||
|
||||
def biz_type_label(biz_type: Optional[str]) -> str:
|
||||
key = biz_type or ""
|
||||
return BIZ_TYPE_LABELS.get(key, key or "")
|
||||
|
||||
|
||||
def application_no_prefix(biz_type: Optional[str]) -> str:
|
||||
key = biz_type or "pilot_service"
|
||||
return APPLICATION_NO_PREFIX.get(key, APPLICATION_NO_PREFIX["pilot_service"])
|
||||
@@ -1,14 +1,33 @@
|
||||
"""临床科研申请单 · 业务子类型(research_category)"""
|
||||
"""申请单业务子类型(research_category)。
|
||||
|
||||
临床科研保留历史三项;委托加工使用产品四项,并支持「其他」自定义文本。
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
RESEARCH_CATEGORY_LABELS = {
|
||||
from app.constants.pilot_biz import is_research_like_biz
|
||||
|
||||
CLINICAL_RESEARCH_CATEGORY_LABELS = {
|
||||
"bio_tech_clinical": "生物新技术临床科研",
|
||||
"joint_topic_declare": "临床课题联合申报",
|
||||
"bio_pharma_rd": "生物制药研发",
|
||||
}
|
||||
|
||||
CONTRACT_PROCESSING_CATEGORY_LABELS = {
|
||||
"placenta_freeze_dried": "胎盘冻干粉",
|
||||
"adipose_exosome": "脂肪外泌体",
|
||||
"nk": "NK",
|
||||
"msc": "MSC",
|
||||
}
|
||||
|
||||
# 兼容旧导入名
|
||||
RESEARCH_CATEGORY_LABELS = {
|
||||
**CLINICAL_RESEARCH_CATEGORY_LABELS,
|
||||
**CONTRACT_PROCESSING_CATEGORY_LABELS,
|
||||
}
|
||||
RESEARCH_CATEGORY_CODES = tuple(RESEARCH_CATEGORY_LABELS.keys())
|
||||
|
||||
CUSTOM_CATEGORY_MAX_LEN = 64
|
||||
|
||||
|
||||
def research_category_label(code: Optional[str]) -> str:
|
||||
if not code:
|
||||
@@ -16,12 +35,34 @@ def research_category_label(code: Optional[str]) -> str:
|
||||
return RESEARCH_CATEGORY_LABELS.get(code, code)
|
||||
|
||||
|
||||
def validate_research_category(code: Optional[str], required: bool = False) -> str:
|
||||
def validate_research_category(
|
||||
code: Optional[str],
|
||||
required: bool = False,
|
||||
*,
|
||||
biz_type: Optional[str] = "basic_experiment",
|
||||
) -> str:
|
||||
value = (code or "").strip()
|
||||
if not value:
|
||||
if required:
|
||||
raise ValueError("请选择业务类型")
|
||||
return ""
|
||||
|
||||
bt = biz_type or "basic_experiment"
|
||||
if bt == "contract_processing":
|
||||
if value in CONTRACT_PROCESSING_CATEGORY_LABELS:
|
||||
return value
|
||||
if len(value) > CUSTOM_CATEGORY_MAX_LEN:
|
||||
raise ValueError(f"业务类型不能超过{CUSTOM_CATEGORY_MAX_LEN}个字符")
|
||||
# 「其他」:存自定义原文;禁止仅用保留码占位
|
||||
if value in CLINICAL_RESEARCH_CATEGORY_LABELS:
|
||||
raise ValueError("业务类型无效")
|
||||
return value
|
||||
|
||||
if is_research_like_biz(bt) or bt == "basic_experiment":
|
||||
if value not in CLINICAL_RESEARCH_CATEGORY_LABELS:
|
||||
raise ValueError("业务类型无效")
|
||||
return value
|
||||
|
||||
if value not in RESEARCH_CATEGORY_LABELS:
|
||||
raise ValueError("业务类型无效")
|
||||
return value
|
||||
@@ -100,14 +100,14 @@ def _enrich_payment(db: Session, row: BizPilotPayment) -> Dict[str, Any]:
|
||||
"applicationNo": app_row.application_no if app_row else "",
|
||||
"applicationName": app_row.application_name if app_row else "",
|
||||
"channelName": app_row.channel_name if app_row else "",
|
||||
"patientName": "" if app_biz == "basic_experiment" else (patient_row.patient_name if patient_row else ""),
|
||||
"patientName": "" if app_biz in ("basic_experiment", "contract_processing") else (patient_row.patient_name if patient_row else ""),
|
||||
"cellType": cell_type,
|
||||
"specText": spec_text,
|
||||
"cellTypeSpec": cell_type_spec,
|
||||
"paymentAmount": float(row.amount) if row.amount else 0,
|
||||
"infusionTime": schedule_row.infusion_time.strftime("%Y-%m-%d %H:%M:%S") if schedule_row and schedule_row.infusion_time else "",
|
||||
}
|
||||
if app_biz == "basic_experiment" and app_row:
|
||||
if app_biz in ("basic_experiment", "contract_processing") and app_row:
|
||||
extra["projectTitle"] = app_row.project_title or ""
|
||||
extra["customerName"] = app_row.customer_name or ""
|
||||
extra["customerContact"] = app_row.customer_contact or ""
|
||||
|
||||
@@ -187,7 +187,7 @@ def save_outbound_handover(
|
||||
if not biz_type:
|
||||
biz_type = ((detail.get("application") or {}).get("bizType") or "").strip()
|
||||
# 临床科研:细胞出库由生产工单确认,市场交接只维护物料/交接信息
|
||||
cells_owned_by_production = biz_type == "basic_experiment"
|
||||
cells_owned_by_production = biz_type in ("basic_experiment", "contract_processing")
|
||||
|
||||
# 读取保存前台账,用于回滚上次出库交接的库存/状态变更
|
||||
previous_material = orm_material_svc.get_outbound_material(db, schedule_id, tenant_no)
|
||||
@@ -278,7 +278,7 @@ def _assert_basic_experiment_outbound_wo(wo: Any) -> str:
|
||||
raise HTTPException(status_code=404, detail="工单不存在")
|
||||
if (getattr(wo, "work_order_type", None) or "") != "outbound":
|
||||
raise HTTPException(status_code=400, detail="仅出库工单可确认出库细胞")
|
||||
if (getattr(wo, "biz_type", None) or "") != "basic_experiment":
|
||||
if (getattr(wo, "biz_type", None) or "") not in ("basic_experiment", "contract_processing"):
|
||||
raise HTTPException(status_code=400, detail="仅临床科研出库工单可确认出库细胞")
|
||||
if (getattr(wo, "work_order_status", None) or "") == "yzf":
|
||||
raise HTTPException(status_code=400, detail="已作废工单不可确认出库细胞")
|
||||
|
||||
@@ -42,6 +42,7 @@ _BIZ_TYPE_LABELS = {
|
||||
"pilot_service": "中试服务",
|
||||
"clinical_application": "临床应用",
|
||||
"basic_experiment": "临床科研",
|
||||
"contract_processing": "委托加工",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from app.models.models import (
|
||||
)
|
||||
from app.crud import pilot_checkup
|
||||
from app.crud.collection_protocol import attachments_to_urls, urls_to_attachment_list
|
||||
from app.constants.pilot_biz import application_no_prefix, is_research_like_biz
|
||||
from app.constants.research_category import validate_research_category
|
||||
|
||||
|
||||
@@ -77,12 +78,7 @@ def _release_application_no_for_soft_delete(application_no: str, row_id: str) ->
|
||||
|
||||
def _generate_application_no(db: Session, tenant_no: str, biz_type: str = "pilot_service") -> str:
|
||||
today_str = datetime.now().strftime("%Y%m%d")
|
||||
if biz_type == "clinical_application":
|
||||
prefix = f"LCSQ{today_str}"
|
||||
elif biz_type == "basic_experiment":
|
||||
prefix = f"JCSY{today_str}"
|
||||
else:
|
||||
prefix = f"ZSSQ{today_str}"
|
||||
prefix = f"{application_no_prefix(biz_type)}{today_str}"
|
||||
existing = (
|
||||
db.query(BizPilotApplication.application_no)
|
||||
.filter(
|
||||
@@ -425,7 +421,10 @@ def get_application(db: Session, app_id: str, tenant_no: str) -> Optional[Dict[s
|
||||
plan_id = plan.get("id")
|
||||
if plan_id:
|
||||
result["infusionSchedules"] = list_schedules_by_plan(db, plan_id, tenant_no)
|
||||
if row.biz_type in ("clinical_application", "basic_experiment") and result["infusionSchedules"]:
|
||||
if (
|
||||
row.biz_type in ("clinical_application", "basic_experiment", "contract_processing")
|
||||
and result["infusionSchedules"]
|
||||
):
|
||||
from app.crud import clinical_payment
|
||||
|
||||
payment_map = clinical_payment.map_payments_by_schedule_id(
|
||||
@@ -460,7 +459,7 @@ def create_application(
|
||||
research_category = ""
|
||||
consent_form_urls = data.get("consentFormUrls") or None
|
||||
|
||||
if biz_type == "basic_experiment":
|
||||
if is_research_like_biz(biz_type):
|
||||
if not (data.get("projectTitle") or "").strip():
|
||||
raise ValueError("请填写课题名称")
|
||||
if not (data.get("customerName") or "").strip():
|
||||
@@ -470,7 +469,7 @@ def create_application(
|
||||
if not (data.get("customerPhone") or "").strip():
|
||||
raise ValueError("请填写客户联系方式")
|
||||
research_category = validate_research_category(
|
||||
data.get("researchCategory"), required=True
|
||||
data.get("researchCategory"), required=True, biz_type=biz_type
|
||||
)
|
||||
project_title = (data.get("projectTitle") or "").strip()
|
||||
customer_name = (data.get("customerName") or "").strip()
|
||||
@@ -607,16 +606,21 @@ def update_application(db: Session, app_id: str, data: dict, tenant_no: str) ->
|
||||
if "customerPhone" in data and data["customerPhone"] is not None:
|
||||
row.customer_phone = (data["customerPhone"] or "").strip() or None
|
||||
if "researchCategory" in data and data["researchCategory"] is not None:
|
||||
if (row.biz_type or "") == "basic_experiment":
|
||||
row_biz = row.biz_type or ""
|
||||
if is_research_like_biz(row_biz):
|
||||
row.research_category = validate_research_category(
|
||||
data.get("researchCategory"), required=True
|
||||
data.get("researchCategory"), required=True, biz_type=row_biz
|
||||
) or None
|
||||
else:
|
||||
row.research_category = validate_research_category(
|
||||
data.get("researchCategory"), required=False
|
||||
data.get("researchCategory"), required=False, biz_type=row_biz
|
||||
) or None
|
||||
if "channelId" in data and data["channelId"] is not None:
|
||||
if (row.biz_type or "") in ("basic_experiment", "clinical_application"):
|
||||
if (row.biz_type or "") in (
|
||||
"basic_experiment",
|
||||
"contract_processing",
|
||||
"clinical_application",
|
||||
):
|
||||
new_channel_id = (data.get("channelId") or "").strip()
|
||||
if not new_channel_id:
|
||||
raise ValueError("请选择渠道")
|
||||
@@ -633,7 +637,7 @@ def update_application(db: Session, app_id: str, data: dict, tenant_no: str) ->
|
||||
raise ValueError("渠道不存在")
|
||||
row.channel_id = new_channel_id
|
||||
row.channel_name = ch.channel_name or ""
|
||||
if (row.biz_type or "") == "basic_experiment":
|
||||
if is_research_like_biz(row.biz_type):
|
||||
row.channel_service_order_id = ""
|
||||
if "consentFormUrls" in data:
|
||||
row.consent_form_urls = data.get("consentFormUrls") or None
|
||||
@@ -1391,7 +1395,8 @@ def create_schedule(
|
||||
application = _app
|
||||
if (
|
||||
application
|
||||
and application.biz_type in ("clinical_application", "basic_experiment")
|
||||
and application.biz_type
|
||||
in ("clinical_application", "basic_experiment", "contract_processing")
|
||||
and data.get("amount")
|
||||
):
|
||||
from app.crud.clinical_payment import auto_create_payment
|
||||
@@ -1708,8 +1713,8 @@ def create_basic_experiment_sale_schedules(
|
||||
)
|
||||
if not app:
|
||||
raise ValueError("申请单不存在")
|
||||
if (app.biz_type or "") != "basic_experiment":
|
||||
raise ValueError("仅临床科研申请单可批量创建售卖计划")
|
||||
if not is_research_like_biz(app.biz_type):
|
||||
raise ValueError("仅临床科研/委托加工申请单可批量创建售卖计划")
|
||||
if not product_lines:
|
||||
raise ValueError("请至少添加一行售卖产品")
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ def get_infusion_schedule_detail(
|
||||
"outboundHandover": handover_svc.get_outbound_handover_view(db, schedule_id, tenant_no),
|
||||
"infusionConfirm": confirm_svc.get_confirm_by_schedule(db, schedule_id, tenant_no) or {},
|
||||
}
|
||||
if application and (application.biz_type or "") in ("clinical_application", "basic_experiment"):
|
||||
if application and (application.biz_type or "") in ("clinical_application", "basic_experiment", "contract_processing"):
|
||||
from app.crud import clinical_payment
|
||||
|
||||
payment = clinical_payment.get_payment_by_schedule(
|
||||
@@ -919,7 +919,7 @@ def _deduct_fee_on_complete(db: Session, schedule_id: str, tenant_no: str, user_
|
||||
raise ValueError("中试申请单不存在")
|
||||
|
||||
# 临床应用/临床科研走缴费模块,不走服务订单扣费
|
||||
if (application.biz_type or "") in ("clinical_application", "basic_experiment"):
|
||||
if (application.biz_type or "") in ("clinical_application", "basic_experiment", "contract_processing"):
|
||||
return
|
||||
|
||||
if not application.channel_service_order_id:
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.models.models import (
|
||||
)
|
||||
|
||||
|
||||
_OUTBOUND_BIZ_TYPES = ("pilot_service", "clinical_application", "basic_experiment")
|
||||
_OUTBOUND_BIZ_TYPES = ("pilot_service", "clinical_application", "basic_experiment", "contract_processing")
|
||||
|
||||
|
||||
def _is_pilot_outbound_production(wo: BizProductionWorkOrder) -> bool:
|
||||
|
||||
@@ -91,6 +91,8 @@ _RECEPTION_SOURCE_LABELS = {
|
||||
_OUTBOUND_BIZ_TYPE_LABELS = {
|
||||
"pilot_service": "中试服务",
|
||||
"clinical_application": "临床应用",
|
||||
"basic_experiment": "临床科研",
|
||||
"contract_processing": "委托加工",
|
||||
}
|
||||
_APPLICATION_STATUS_LABELS = {
|
||||
"dks": "待开始",
|
||||
@@ -3328,6 +3330,7 @@ _PRODUCTION_TAB_STEP_COUNT_KEYS = (
|
||||
"inbound_research_donation",
|
||||
"outbound_pilot_service",
|
||||
"outbound_basic_experiment",
|
||||
"outbound_contract_processing",
|
||||
"temporary",
|
||||
)
|
||||
|
||||
@@ -3351,6 +3354,8 @@ def _resolve_production_tab_key(
|
||||
bt = (biz_type or "pilot_service").strip() or "pilot_service"
|
||||
if bt == "basic_experiment":
|
||||
return "outbound_basic_experiment"
|
||||
if bt == "contract_processing":
|
||||
return "outbound_contract_processing"
|
||||
if bt == "clinical_application":
|
||||
return None
|
||||
return "outbound_pilot_service"
|
||||
|
||||
@@ -199,6 +199,7 @@ def _wo_to_dict(wo: BizProductionWorkOrder) -> Dict[str, Any]:
|
||||
"pilot_service": "中试服务",
|
||||
"clinical_application": "临床应用",
|
||||
"basic_experiment": "临床科研",
|
||||
"contract_processing": "委托加工",
|
||||
}.get(getattr(wo, "biz_type", None) or "", ""),
|
||||
"workOrderStatus": wo.work_order_status,
|
||||
"workOrderStatusLabel": _WORK_ORDER_STATUS_LABELS.get(wo.work_order_status, wo.work_order_status),
|
||||
@@ -289,6 +290,7 @@ _BIZ_TYPE_LABELS = {
|
||||
"pilot_service": "中试服务",
|
||||
"clinical_application": "临床应用",
|
||||
"basic_experiment": "临床科研",
|
||||
"contract_processing": "委托加工",
|
||||
}
|
||||
|
||||
|
||||
@@ -545,7 +547,7 @@ def _attach_outbound_detail(
|
||||
schedule_id = getattr(wo, "infusion_schedule_id", None) or ""
|
||||
biz_type = getattr(wo, "biz_type", None) or ""
|
||||
|
||||
if schedule_id and biz_type in ("pilot_service", "clinical_application", "basic_experiment"):
|
||||
if schedule_id and biz_type in ("pilot_service", "clinical_application", "basic_experiment", "contract_processing"):
|
||||
pilot_ctx = build_outbound_pilot_context_by_schedule(
|
||||
db, schedule_id, wo.tenant_no or ""
|
||||
)
|
||||
|
||||
@@ -109,6 +109,7 @@ _OUTBOUND_BIZ_TYPE_LABELS = {
|
||||
"pilot_service": "中试服务",
|
||||
"clinical_application": "临床应用",
|
||||
"basic_experiment": "临床科研",
|
||||
"contract_processing": "委托加工",
|
||||
}
|
||||
_OUTBOUND_BIZ_TYPES = tuple(_OUTBOUND_BIZ_TYPE_LABELS.keys())
|
||||
|
||||
@@ -2003,6 +2004,7 @@ _QC_TAB_COUNT_KEYS = (
|
||||
"inbound_research_donation",
|
||||
"outbound_pilot_service",
|
||||
"outbound_basic_experiment",
|
||||
"outbound_contract_processing",
|
||||
"temporary",
|
||||
)
|
||||
|
||||
@@ -2023,6 +2025,8 @@ def _resolve_wo_tab_key(
|
||||
bt = (biz_type or "pilot_service").strip() or "pilot_service"
|
||||
if bt == "basic_experiment":
|
||||
return "outbound_basic_experiment"
|
||||
if bt == "contract_processing":
|
||||
return "outbound_contract_processing"
|
||||
if bt == "clinical_application":
|
||||
return "outbound_clinical_application"
|
||||
return "outbound_pilot_service"
|
||||
@@ -3713,7 +3717,7 @@ def build_outbound_pilot_context_by_schedule(
|
||||
"bizType": app_biz,
|
||||
"bizTypeLabel": _OUTBOUND_BIZ_TYPE_LABELS.get(app_biz, app_biz),
|
||||
}
|
||||
if app_biz == "basic_experiment":
|
||||
if app_biz in ("basic_experiment", "contract_processing"):
|
||||
out["application"]["projectTitle"] = app.project_title or ""
|
||||
out["application"]["customerName"] = app.customer_name or ""
|
||||
out["application"]["customerContact"] = app.customer_contact or ""
|
||||
|
||||
@@ -4183,15 +4183,20 @@ class BizPilotApplication(Base):
|
||||
customer_contact = Column(String(100), nullable=True, comment="客户联系人(临床科研)")
|
||||
customer_phone = Column(String(32), nullable=True, comment="客户联系方式(临床科研)")
|
||||
research_category = Column(
|
||||
String(32),
|
||||
String(64),
|
||||
nullable=True,
|
||||
comment="临床科研业务子类型: bio_tech_clinical/joint_topic_declare/bio_pharma_rd",
|
||||
comment="业务子类型;临床科研三项码/委托加工产品码或自定义其他",
|
||||
)
|
||||
application_status = Column(String(16), nullable=False, default="dks", comment="dks待开始 jxz进行中 ywc已完成 yzf已作废")
|
||||
channel_service_order_id = Column(String(64), nullable=False, comment="渠道服务购买订单ID")
|
||||
channel_id = Column(String(64), nullable=True, comment="渠道ID(缓存自服务订单)")
|
||||
channel_name = Column(String(200), nullable=True, comment="渠道名称(缓存)")
|
||||
biz_type = Column(String(20), nullable=False, default="pilot_service", comment="业务类型: pilot_service=中试服务, clinical_application=临床应用, basic_experiment=临床科研")
|
||||
biz_type = Column(
|
||||
String(20),
|
||||
nullable=False,
|
||||
default="pilot_service",
|
||||
comment="业务类型: pilot_service/clinical_application/basic_experiment/contract_processing",
|
||||
)
|
||||
tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号")
|
||||
order_num = Column(Integer, nullable=True, comment="排序号")
|
||||
remark = Column(String(512), nullable=True, comment="备注")
|
||||
|
||||
@@ -126,7 +126,7 @@ def _iter_candidate_schedules(db: Session, *, delivery_day: date) -> List[Any]:
|
||||
& (BizPilotInfusionScheduleProduct.del_flag == 0),
|
||||
)
|
||||
.filter(
|
||||
BizPilotApplication.biz_type == "basic_experiment",
|
||||
BizPilotApplication.biz_type in ("basic_experiment", "contract_processing"),
|
||||
BizPilotApplication.del_flag == 0,
|
||||
BizPilotInfusionPlan.del_flag == 0,
|
||||
BizPilotInfusionSchedule.del_flag == 0,
|
||||
|
||||
@@ -19,6 +19,7 @@ BUSINESS = {
|
||||
'research_donation': (BizResearchDonation, 'donation_no', 'donation_status'),
|
||||
'pilot_service': (BizPilotApplication, 'application_no', 'application_status'),
|
||||
'basic_experiment': (BizPilotApplication, 'application_no', 'application_status'),
|
||||
'contract_processing': (BizPilotApplication, 'application_no', 'application_status'),
|
||||
}
|
||||
COUNT_TYPES = tuple(k for k in BUSINESS if k != 'presign')
|
||||
ALL_PROJECTS_PERMISSION = 'project:project:all'
|
||||
|
||||
@@ -28,7 +28,9 @@ _PAY_STATUS_LABELS = {
|
||||
}
|
||||
|
||||
# 出库工单:输注计划缴费(临床科研 / 临床应用共用 biz_pilot_payment)
|
||||
_OUTBOUND_FEE_BIZ_TYPES = frozenset({"basic_experiment", "clinical_application"})
|
||||
_OUTBOUND_FEE_BIZ_TYPES = frozenset(
|
||||
{"basic_experiment", "contract_processing", "clinical_application"}
|
||||
)
|
||||
|
||||
|
||||
def _is_outbound_fee_biz_type(biz_type: Optional[str]) -> bool:
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
"""委托加工申请单:编号前缀、业务子类型校验、复用临床科研创建校验。"""
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from app.constants.research_category import validate_research_category
|
||||
from app.crud import pilot_application as crud
|
||||
|
||||
|
||||
class TestContractProcessingApplicationNo(unittest.TestCase):
|
||||
@patch("app.crud.pilot_application.datetime")
|
||||
def test_generate_application_no_contract_processing_prefix(self, mock_dt):
|
||||
mock_dt.now.return_value.strftime.return_value = "20261123"
|
||||
db = MagicMock()
|
||||
mock_query = MagicMock()
|
||||
db.query.return_value = mock_query
|
||||
mock_query.filter.return_value = mock_query
|
||||
mock_query.order_by.return_value = mock_query
|
||||
mock_query.first.return_value = None
|
||||
|
||||
result = crud._generate_application_no(db, "zkxw", biz_type="contract_processing")
|
||||
|
||||
self.assertEqual(result, "WTJG202611230001")
|
||||
|
||||
|
||||
class TestContractProcessingResearchCategory(unittest.TestCase):
|
||||
def test_fixed_categories(self):
|
||||
self.assertEqual(
|
||||
validate_research_category("placenta_freeze_dried", required=True, biz_type="contract_processing"),
|
||||
"placenta_freeze_dried",
|
||||
)
|
||||
self.assertEqual(
|
||||
validate_research_category("nk", required=True, biz_type="contract_processing"),
|
||||
"nk",
|
||||
)
|
||||
|
||||
def test_custom_other_text(self):
|
||||
self.assertEqual(
|
||||
validate_research_category("自定义产品A", required=True, biz_type="contract_processing"),
|
||||
"自定义产品A",
|
||||
)
|
||||
|
||||
def test_clinical_codes_rejected_for_contract_processing(self):
|
||||
with self.assertRaises(ValueError):
|
||||
validate_research_category(
|
||||
"bio_tech_clinical", required=True, biz_type="contract_processing"
|
||||
)
|
||||
|
||||
def test_clinical_still_uses_legacy_codes(self):
|
||||
self.assertEqual(
|
||||
validate_research_category("bio_tech_clinical", required=True, biz_type="basic_experiment"),
|
||||
"bio_tech_clinical",
|
||||
)
|
||||
with self.assertRaises(ValueError):
|
||||
validate_research_category("nk", required=True, biz_type="basic_experiment")
|
||||
|
||||
|
||||
class TestContractProcessingCreateValidation(unittest.TestCase):
|
||||
def test_create_requires_customer_fields(self):
|
||||
db = MagicMock()
|
||||
data = {
|
||||
"bizType": "contract_processing",
|
||||
"researchCategory": "msc",
|
||||
"channelId": "ch-1",
|
||||
"projectTitle": "课题A",
|
||||
"customerName": "",
|
||||
"customerContact": "张三",
|
||||
"customerPhone": "13800000000",
|
||||
}
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
crud.create_application(
|
||||
db,
|
||||
data=data,
|
||||
tenant_no="zkxw",
|
||||
user_id="user-1",
|
||||
dept_id="dept-1",
|
||||
)
|
||||
self.assertIn("客户名称", str(ctx.exception))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,97 @@
|
||||
-- 委托加工:市场菜单(复用临床科研页面组件)+ research_category 加长以支持「其他」自定义。
|
||||
-- MySQL 5.7,可重复执行。目标库:测试库(如 zkxw-sc)。
|
||||
|
||||
-- 1) research_category 加长(自定义「其他」文本)
|
||||
ALTER TABLE biz_pilot_application
|
||||
MODIFY COLUMN research_category VARCHAR(64) NULL
|
||||
COMMENT '业务子类型;临床科研三项码/委托加工产品码或自定义其他';
|
||||
|
||||
-- 2) 二级目录:委托加工(挂在市场下,order_num=5,器械销售前)
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
'CPG00000000000000000000000000001',
|
||||
'委托加工',
|
||||
m.id,
|
||||
'M',
|
||||
'contract-processing',
|
||||
NULL,
|
||||
'menu:contract-processing',
|
||||
1, '1', '1', m.tenant_no, 5,
|
||||
'市场-委托加工',
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu m
|
||||
WHERE m.del_flag = 0 AND m.perms = 'menu:market'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e
|
||||
WHERE e.id = 'CPG00000000000000000000000000001' AND e.del_flag = 0
|
||||
);
|
||||
|
||||
-- 3) 子菜单:申请单 / 缴退费财务确认 / 出库放行审核
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
x.id, x.menu_name, 'CPG00000000000000000000000000001', 'C', x.path,
|
||||
x.component, x.perms,
|
||||
1, '1', '1', p.tenant_no, x.order_num, x.remark,
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu p
|
||||
JOIN (
|
||||
SELECT 'CPG00000000000000000000000000002' AS id, '委托加工申请单' AS menu_name,
|
||||
'application' AS path,
|
||||
'pilot-service/pilot-application/index' AS component,
|
||||
'contract-processing:application:list' AS perms, 1 AS order_num,
|
||||
'市场-委托加工-申请单' AS remark
|
||||
UNION ALL
|
||||
SELECT 'CPG00000000000000000000000000003', '缴退费财务确认',
|
||||
'payment-confirm',
|
||||
'pilot-service/clinical-payment-confirm/index',
|
||||
'contract-processing:payment-confirm:list', 2,
|
||||
'市场-委托加工-缴退费财务确认'
|
||||
UNION ALL
|
||||
SELECT 'CPG00000000000000000000000000004', '出库放行审核',
|
||||
'outbound-release-review',
|
||||
'pilot-service/outbound-release-review/index',
|
||||
'contract-processing:outbound-release-review:list', 3,
|
||||
'市场-委托加工-出库放行审核'
|
||||
) x ON 1 = 1
|
||||
WHERE p.del_flag = 0 AND p.id = 'CPG00000000000000000000000000001'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e WHERE e.id = x.id AND e.del_flag = 0
|
||||
);
|
||||
|
||||
-- 4) 给已有「市场」顶级菜单授权的角色,授予委托加工目录+子菜单
|
||||
INSERT INTO sys_role_menu (
|
||||
id, role_id, menu_id, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
INSERT(INSERT(MD5(CONCAT('contract-processing-rm:', r.tenant_no, ':', r.id, ':', m.id)), 13, 1, '3'), 17, 1, '8'),
|
||||
r.id, m.id, r.tenant_no, NULL,
|
||||
'grant contract-processing from menu:market',
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_role r
|
||||
JOIN sys_role_menu src
|
||||
ON src.role_id = r.id AND src.tenant_no = r.tenant_no AND src.del_flag = 0
|
||||
JOIN sys_menu top
|
||||
ON top.id = src.menu_id AND top.tenant_no = src.tenant_no AND top.del_flag = 0
|
||||
AND top.perms = 'menu:market'
|
||||
JOIN sys_menu m
|
||||
ON m.tenant_no = r.tenant_no AND m.del_flag = 0 AND m.status = '1'
|
||||
AND m.id IN (
|
||||
'CPG00000000000000000000000000001',
|
||||
'CPG00000000000000000000000000002',
|
||||
'CPG00000000000000000000000000003',
|
||||
'CPG00000000000000000000000000004'
|
||||
)
|
||||
WHERE r.del_flag = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_role_menu e
|
||||
WHERE e.role_id = r.id AND e.menu_id = m.id AND e.tenant_no = r.tenant_no AND e.del_flag = 0
|
||||
);
|
||||
@@ -5,12 +5,14 @@ export type BizType =
|
||||
| 'research_donation'
|
||||
| 'pilot_service'
|
||||
| 'basic_experiment'
|
||||
| 'contract_processing'
|
||||
export const bizLabels: Record<BizType, string> = {
|
||||
presign: '预签约',
|
||||
cell_storage: '细胞存储',
|
||||
research_donation: '科研捐赠',
|
||||
pilot_service: '中试服务',
|
||||
basic_experiment: '临床科研'
|
||||
basic_experiment: '临床科研',
|
||||
contract_processing: '委托加工'
|
||||
}
|
||||
export type ProjectOption = {
|
||||
id: string
|
||||
|
||||
@@ -284,6 +284,7 @@
|
||||
protocolStatusTagType
|
||||
} from '@/utils/protocol-payment-labels'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -393,7 +394,7 @@
|
||||
)
|
||||
|
||||
const isBasicExperiment = computed(
|
||||
() => String(props.detail?.bizType || '') === 'basic_experiment'
|
||||
() => isResearchLikeBiz(props.bizType || detail?.bizType)
|
||||
)
|
||||
|
||||
const pickupTimeLabel = computed(() =>
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { payStatusLabel, payStatusTagType } from '@/utils/status-tag-registry'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -143,7 +144,7 @@
|
||||
}
|
||||
|
||||
const isBasicExperiment = computed(
|
||||
() => String(props.detail?.bizType || '') === 'basic_experiment'
|
||||
() => isResearchLikeBiz(props.bizType || detail?.bizType)
|
||||
)
|
||||
|
||||
const pickupTimeLabel = computed(() =>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
export type PilotBizType = 'pilot_service' | 'clinical_application' | 'basic_experiment'
|
||||
export type PilotBizType =
|
||||
| 'pilot_service'
|
||||
| 'clinical_application'
|
||||
| 'basic_experiment'
|
||||
| 'contract_processing'
|
||||
|
||||
export interface PilotBizTypeConfig {
|
||||
label: string
|
||||
@@ -20,6 +24,26 @@ export interface PilotBizTypeConfig {
|
||||
statusLabel: string
|
||||
}
|
||||
|
||||
const RESEARCH_LIKE_CONFIG: PilotBizTypeConfig = {
|
||||
label: '临床科研',
|
||||
applicationNoPrefix: 'JCSY',
|
||||
showChannel: true,
|
||||
showPatient: false,
|
||||
showConsent: false,
|
||||
showOtherAttachments: false,
|
||||
showStandardAttachments: true,
|
||||
showCheckup: false,
|
||||
showInfusionConfirm: false,
|
||||
showDelivery: true,
|
||||
showPayment: true,
|
||||
planLabel: '交付计划',
|
||||
scheduleLabel: '交付计划',
|
||||
pickupTimeLabel: '交付时间',
|
||||
locationLabel: '交付地点',
|
||||
methodLabel: '交付方式',
|
||||
statusLabel: '交付状态'
|
||||
}
|
||||
|
||||
export const PILOT_BIZ_TYPE_CONFIG: Record<PilotBizType, PilotBizTypeConfig> = {
|
||||
pilot_service: {
|
||||
label: '中试服务',
|
||||
@@ -60,23 +84,14 @@ export const PILOT_BIZ_TYPE_CONFIG: Record<PilotBizType, PilotBizTypeConfig> = {
|
||||
statusLabel: '输注状态'
|
||||
},
|
||||
basic_experiment: {
|
||||
...RESEARCH_LIKE_CONFIG,
|
||||
label: '临床科研',
|
||||
applicationNoPrefix: 'JCSY',
|
||||
showChannel: true,
|
||||
showPatient: false,
|
||||
showConsent: false,
|
||||
showOtherAttachments: false,
|
||||
showStandardAttachments: true,
|
||||
showCheckup: false,
|
||||
showInfusionConfirm: false,
|
||||
showDelivery: true,
|
||||
showPayment: true,
|
||||
planLabel: '交付计划',
|
||||
scheduleLabel: '交付计划',
|
||||
pickupTimeLabel: '交付时间',
|
||||
locationLabel: '交付地点',
|
||||
methodLabel: '交付方式',
|
||||
statusLabel: '交付状态'
|
||||
applicationNoPrefix: 'JCSY'
|
||||
},
|
||||
contract_processing: {
|
||||
...RESEARCH_LIKE_CONFIG,
|
||||
label: '委托加工',
|
||||
applicationNoPrefix: 'WTJG'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +101,11 @@ export function getPilotBizConfig(bizType?: string): PilotBizTypeConfig {
|
||||
}
|
||||
|
||||
export function resolvePilotBizType(bizType?: string): PilotBizType {
|
||||
if (bizType === 'clinical_application' || bizType === 'basic_experiment') {
|
||||
if (
|
||||
bizType === 'clinical_application' ||
|
||||
bizType === 'basic_experiment' ||
|
||||
bizType === 'contract_processing'
|
||||
) {
|
||||
return bizType
|
||||
}
|
||||
return 'pilot_service'
|
||||
|
||||
@@ -8,11 +8,42 @@ export const CLINICAL_RESEARCH_CATEGORY_OPTIONS = [
|
||||
export type ClinicalResearchCategory =
|
||||
(typeof CLINICAL_RESEARCH_CATEGORY_OPTIONS)[number]['value']
|
||||
|
||||
/** 委托加工 · 产品业务类型 */
|
||||
export const CONTRACT_PROCESSING_CATEGORY_OPTIONS = [
|
||||
{ value: 'placenta_freeze_dried', label: '胎盘冻干粉' },
|
||||
{ value: 'adipose_exosome', label: '脂肪外泌体' },
|
||||
{ value: 'nk', label: 'NK' },
|
||||
{ value: 'msc', label: 'MSC' }
|
||||
] as const
|
||||
|
||||
export type ContractProcessingCategory =
|
||||
(typeof CONTRACT_PROCESSING_CATEGORY_OPTIONS)[number]['value']
|
||||
|
||||
/** 前端「其他」占位,提交时改为自定义文本 */
|
||||
export const RESEARCH_CATEGORY_OTHER_VALUE = '__other__'
|
||||
|
||||
const LABEL_MAP = Object.fromEntries(
|
||||
CLINICAL_RESEARCH_CATEGORY_OPTIONS.map((o) => [o.value, o.label])
|
||||
[
|
||||
...CLINICAL_RESEARCH_CATEGORY_OPTIONS,
|
||||
...CONTRACT_PROCESSING_CATEGORY_OPTIONS
|
||||
].map((o) => [o.value, o.label])
|
||||
) as Record<string, string>
|
||||
|
||||
export function clinicalResearchCategoryLabel(code?: string | null): string {
|
||||
if (!code) return ''
|
||||
return LABEL_MAP[code] || code
|
||||
}
|
||||
|
||||
export function researchCategoryOptionsForBiz(bizType?: string | null) {
|
||||
if (bizType === 'contract_processing') {
|
||||
return [
|
||||
...CONTRACT_PROCESSING_CATEGORY_OPTIONS,
|
||||
{ value: RESEARCH_CATEGORY_OTHER_VALUE, label: '其他' }
|
||||
]
|
||||
}
|
||||
return [...CLINICAL_RESEARCH_CATEGORY_OPTIONS]
|
||||
}
|
||||
|
||||
export function isFixedContractProcessingCategory(code?: string | null): boolean {
|
||||
return CONTRACT_PROCESSING_CATEGORY_OPTIONS.some((o) => o.value === code)
|
||||
}
|
||||
@@ -605,6 +605,58 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
]
|
||||
},
|
||||
|
||||
// ── 委托加工(复用临床科研页面,bizType=contract_processing)──────────
|
||||
{
|
||||
id: 'CPG00000000000000000000000000001',
|
||||
name: 'ContractProcessing',
|
||||
path: 'contract-processing',
|
||||
component: '',
|
||||
meta: {
|
||||
title: '委托加工',
|
||||
icon: 'ri:tools-line',
|
||||
keepAlive: false,
|
||||
roles: ['admin']
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: 'CPG00000000000000000000000000002',
|
||||
name: 'ContractProcessingApplication',
|
||||
path: 'application',
|
||||
component: '/pilot-service/pilot-application/index',
|
||||
meta: {
|
||||
title: '委托加工申请单',
|
||||
keepAlive: true,
|
||||
menuCode: 'contract-processing:application:list'
|
||||
},
|
||||
props: { bizType: 'contract_processing' }
|
||||
},
|
||||
{
|
||||
id: 'CPG00000000000000000000000000003',
|
||||
name: 'ContractProcessingPaymentConfirm',
|
||||
path: 'payment-confirm',
|
||||
component: '/pilot-service/clinical-payment-confirm/index',
|
||||
meta: {
|
||||
title: '缴退费财务确认',
|
||||
keepAlive: true,
|
||||
menuCode: 'contract-processing:payment-confirm:list'
|
||||
},
|
||||
props: { bizType: 'contract_processing' }
|
||||
},
|
||||
{
|
||||
id: 'CPG00000000000000000000000000004',
|
||||
name: 'ContractProcessingOutboundRelease',
|
||||
path: 'outbound-release-review',
|
||||
component: '/pilot-service/outbound-release-review/index',
|
||||
meta: {
|
||||
title: '出库放行审核',
|
||||
keepAlive: true,
|
||||
menuCode: 'contract-processing:outbound-release-review:list'
|
||||
},
|
||||
props: { bizType: 'contract_processing' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// ── 器械销售(市场侧栏末位;占位页待完善)────────────────────────────
|
||||
{
|
||||
id: 'DEV00000000000000000000000000001',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { OutboundQcDetail } from '@/api/qc-work-order'
|
||||
import type { ViewField, ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { maskIdCard } from '@/utils/mask-sensitive'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
import {
|
||||
applicationStatusLabel,
|
||||
applicationStatusTagType,
|
||||
@@ -18,6 +19,7 @@ export type OutboundViewContextVariant =
|
||||
| 'pilot_service'
|
||||
| 'clinical_application'
|
||||
| 'basic_experiment'
|
||||
| 'contract_processing'
|
||||
|
||||
const SECTION_TITLES: Record<
|
||||
OutboundViewContextVariant,
|
||||
@@ -34,6 +36,10 @@ const SECTION_TITLES: Record<
|
||||
basic_experiment: {
|
||||
application: '临床科研申请信息',
|
||||
schedule: '交付计划信息'
|
||||
},
|
||||
contract_processing: {
|
||||
application: '委托加工申请信息',
|
||||
schedule: '交付计划信息'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +62,7 @@ function buildDefaultApplicationFields(
|
||||
app: NonNullable<OutboundQcDetail['application']>,
|
||||
variant: OutboundViewContextVariant
|
||||
) {
|
||||
if (variant === 'basic_experiment') {
|
||||
if (isResearchLikeBiz(variant)) {
|
||||
return buildBasicExperimentApplicationFields(app)
|
||||
}
|
||||
return [
|
||||
@@ -82,6 +88,7 @@ export function buildOutboundPilotContextSections(
|
||||
const schedule = detail.infusionSchedule
|
||||
const products = detail.products || []
|
||||
const titles = SECTION_TITLES[variant]
|
||||
const researchLike = isResearchLikeBiz(variant)
|
||||
const result: ViewSection[] = []
|
||||
|
||||
if (app) {
|
||||
@@ -91,7 +98,7 @@ export function buildOutboundPilotContextSections(
|
||||
})
|
||||
}
|
||||
|
||||
if (patient && variant !== 'basic_experiment') {
|
||||
if (patient && !researchLike) {
|
||||
result.push({
|
||||
title: '患者信息',
|
||||
fields: [
|
||||
@@ -113,7 +120,7 @@ export function buildOutboundPilotContextSections(
|
||||
})
|
||||
}
|
||||
|
||||
if (plan && variant !== 'basic_experiment') {
|
||||
if (plan && !researchLike) {
|
||||
result.push({
|
||||
title: '输注方案信息',
|
||||
fields: [
|
||||
@@ -128,12 +135,12 @@ export function buildOutboundPilotContextSections(
|
||||
}
|
||||
|
||||
if (schedule) {
|
||||
const pickupLabel = variant === 'basic_experiment' ? '交付时间' : '输注时间'
|
||||
const pickupLabel = researchLike ? '交付时间' : '输注时间'
|
||||
const scheduleFields: ViewField[] = [
|
||||
{ label: pickupLabel, value: schedule.infusionTime || '—' }
|
||||
]
|
||||
|
||||
if (variant === 'basic_experiment') {
|
||||
if (researchLike) {
|
||||
scheduleFields.push({
|
||||
label: '售卖金额',
|
||||
value:
|
||||
@@ -154,7 +161,7 @@ export function buildOutboundPilotContextSections(
|
||||
tagType: scheduleStatusTagType(schedule.scheduleStatus || '') as ViewField['tagType']
|
||||
})
|
||||
|
||||
if (variant !== 'basic_experiment') {
|
||||
if (!researchLike) {
|
||||
scheduleFields.push({
|
||||
label: '输注状态',
|
||||
value: infusionStatusLabel(schedule.infusionStatus || ''),
|
||||
@@ -186,9 +193,9 @@ export function buildOutboundPilotContextSections(
|
||||
}
|
||||
|
||||
export function resolveOutboundViewVariant(bizType?: string | null): OutboundViewContextVariant {
|
||||
if (bizType === 'clinical_application' || bizType === 'basic_experiment') {
|
||||
return bizType
|
||||
}
|
||||
if (bizType === 'clinical_application') return 'clinical_application'
|
||||
if (bizType === 'contract_processing') return 'contract_processing'
|
||||
if (bizType === 'basic_experiment') return 'basic_experiment'
|
||||
return 'pilot_service'
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function keywordMatchesWorkOrder(
|
||||
const fields =
|
||||
tabKey === 'temporary'
|
||||
? [row.remark]
|
||||
: tabKey === 'outbound_basic_experiment'
|
||||
: tabKey === 'outbound_basic_experiment' || tabKey === 'outbound_contract_processing'
|
||||
? [
|
||||
row.workOrderNo,
|
||||
row.applicationNo,
|
||||
|
||||
@@ -251,6 +251,19 @@ const CARD_META_BY_TAB: Record<ProductionWorkOrderTabKey, ProductionWorkOrderCar
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_contract_processing: {
|
||||
tabKey: 'outbound_contract_processing',
|
||||
showCategoryTag: false,
|
||||
showProtocolFeeSummary: false,
|
||||
showOutboundFeeSummary: true,
|
||||
showCellProducts: true,
|
||||
metaFields: outboundBasicExperimentFields,
|
||||
allowDispatchQc: true,
|
||||
allowSampleReception: false,
|
||||
allowDispatchComplete: true,
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_clinical_application: {
|
||||
tabKey: 'outbound_clinical_application',
|
||||
showCategoryTag: false,
|
||||
|
||||
@@ -26,6 +26,7 @@ const CATEGORY_LABELS: Record<ProductionWorkOrderCategoryKey, string> = {
|
||||
inbound_research_donation: '科研捐赠',
|
||||
outbound_pilot_service: '中试服务',
|
||||
outbound_basic_experiment: '临床科研',
|
||||
outbound_contract_processing: '委托加工',
|
||||
temporary: '临时'
|
||||
}
|
||||
|
||||
@@ -34,6 +35,7 @@ const CATEGORY_TAG_TYPES: Record<ProductionWorkOrderCategoryKey, TagType> = {
|
||||
inbound_research_donation: 'primary',
|
||||
outbound_pilot_service: 'info',
|
||||
outbound_basic_experiment: 'info',
|
||||
outbound_contract_processing: 'info',
|
||||
temporary: 'warning'
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,17 @@ describe('production work order tabs — hide pilot service', () => {
|
||||
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
|
||||
const defaultPilot = { workOrderType: 'outbound' }
|
||||
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
|
||||
const contract = { workOrderType: 'outbound', bizType: 'contract_processing' }
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
|
||||
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'outbound_contract_processing'), true)
|
||||
})
|
||||
|
||||
it('visible tabs include contract processing', () => {
|
||||
assert.ok(PRODUCTION_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_contract_processing'))
|
||||
})
|
||||
})
|
||||
@@ -6,6 +6,7 @@ export type ProductionWorkOrderTabKey =
|
||||
| 'inbound_research_donation'
|
||||
| 'outbound_pilot_service'
|
||||
| 'outbound_basic_experiment'
|
||||
| 'outbound_contract_processing'
|
||||
| 'outbound_clinical_application'
|
||||
| 'temporary'
|
||||
|
||||
@@ -17,7 +18,7 @@ export type ProductionWorkOrderTabConfig = {
|
||||
group: ProductionWorkOrderTabGroup
|
||||
workOrderType: 'inbound' | 'outbound' | 'temporary'
|
||||
receptionSource?: 'cell_storage' | 'research_donation'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'clinical_application'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'contract_processing' | 'clinical_application'
|
||||
listLayout: 'inbound-grouped' | 'standalone'
|
||||
/** 侧栏 Tab 不展示(保留 key 供路由/数据解析) */
|
||||
hidden?: boolean
|
||||
@@ -65,6 +66,14 @@ export const PRODUCTION_WORK_ORDER_TABS: ProductionWorkOrderTabConfig[] = [
|
||||
bizType: 'basic_experiment',
|
||||
listLayout: 'standalone'
|
||||
},
|
||||
{
|
||||
key: 'outbound_contract_processing',
|
||||
label: '委托加工生产',
|
||||
group: 'outbound',
|
||||
workOrderType: 'outbound',
|
||||
bizType: 'contract_processing',
|
||||
listLayout: 'standalone'
|
||||
},
|
||||
{
|
||||
key: 'outbound_clinical_application',
|
||||
label: '临床应用生产',
|
||||
@@ -129,6 +138,7 @@ export function resolveTabKeyFromWorkOrder(row: {
|
||||
if (wt === 'outbound') {
|
||||
const bt = row.bizType || 'pilot_service'
|
||||
if (bt === 'basic_experiment') return 'outbound_basic_experiment'
|
||||
if (bt === 'contract_processing') return 'outbound_contract_processing'
|
||||
if (bt === 'clinical_application') return 'outbound_clinical_application'
|
||||
return 'outbound_pilot_service'
|
||||
}
|
||||
@@ -140,7 +150,7 @@ export function resolveTabKeyFromWorkOrder(row: {
|
||||
export function keywordPlaceholderForTab(tab: ProductionWorkOrderTabConfig): string {
|
||||
if (tab.key === 'all') return '工单号 / 样本编码 / 申请单号 / 产品名称等'
|
||||
if (tab.key === 'temporary') return '备注'
|
||||
if (tab.key === 'outbound_basic_experiment') {
|
||||
if (tab.key === 'outbound_basic_experiment' || tab.key === 'outbound_contract_processing') {
|
||||
return '工单号/申请单号/课题名称/客户'
|
||||
}
|
||||
if (tab.group === 'outbound') return '工单号/申请单号/申请单名称/患者'
|
||||
|
||||
@@ -75,7 +75,7 @@ function keywordMatchesWorkOrder(
|
||||
const fields =
|
||||
tabKey === 'temporary'
|
||||
? [row.workOrderNo, row.productionWorkOrderNo]
|
||||
: tabKey === 'outbound_basic_experiment'
|
||||
: tabKey === 'outbound_basic_experiment' || tabKey === 'outbound_contract_processing'
|
||||
? [
|
||||
row.workOrderNo,
|
||||
row.applicationNo,
|
||||
|
||||
@@ -356,6 +356,20 @@ const CARD_META_BY_TAB: Record<QcWorkOrderTabKey, QcWorkOrderCardMetaConfig> = {
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_contract_processing: {
|
||||
tabKey: 'outbound_contract_processing',
|
||||
listLayout: 'outbound-grouped',
|
||||
showCategoryTag: false,
|
||||
showTriggerTag: true,
|
||||
showProtocolFeeSummary: false,
|
||||
showOutboundFeeSummary: true,
|
||||
showCellProducts: true,
|
||||
metaFields: outboundGroupedFields,
|
||||
buildGroupContextParts: buildOutboundBasicExperimentGroupContext,
|
||||
allowEditTemporary: false,
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_clinical_application: {
|
||||
tabKey: 'outbound_clinical_application',
|
||||
listLayout: 'standalone',
|
||||
|
||||
@@ -25,6 +25,7 @@ const CATEGORY_LABELS: Record<QcWorkOrderCategoryKey, string> = {
|
||||
inbound_research_donation: '科研捐赠',
|
||||
outbound_pilot_service: '中试服务',
|
||||
outbound_basic_experiment: '临床科研',
|
||||
outbound_contract_processing: '委托加工',
|
||||
temporary: '临时'
|
||||
}
|
||||
|
||||
@@ -33,6 +34,7 @@ const CATEGORY_TAG_TYPES: Record<QcWorkOrderCategoryKey, TagType> = {
|
||||
inbound_research_donation: 'primary',
|
||||
outbound_pilot_service: 'info',
|
||||
outbound_basic_experiment: 'info',
|
||||
outbound_contract_processing: 'info',
|
||||
temporary: 'warning'
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,17 @@ describe('qc work order tabs — hide pilot service', () => {
|
||||
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
|
||||
const defaultPilot = { workOrderType: 'outbound' }
|
||||
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
|
||||
const contract = { workOrderType: 'outbound', bizType: 'contract_processing' }
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
|
||||
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'outbound_contract_processing'), true)
|
||||
})
|
||||
|
||||
it('visible tabs include contract processing', () => {
|
||||
assert.ok(QC_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_contract_processing'))
|
||||
})
|
||||
})
|
||||
@@ -6,6 +6,7 @@ export type QcWorkOrderTabKey =
|
||||
| 'inbound_research_donation'
|
||||
| 'outbound_pilot_service'
|
||||
| 'outbound_basic_experiment'
|
||||
| 'outbound_contract_processing'
|
||||
| 'outbound_clinical_application'
|
||||
| 'temporary'
|
||||
|
||||
@@ -17,7 +18,7 @@ export type QcWorkOrderTabConfig = {
|
||||
group: QcWorkOrderTabGroup
|
||||
workOrderType?: 'inbound' | 'outbound' | 'temporary'
|
||||
receptionSource?: 'cell_storage' | 'research_donation'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'clinical_application'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'contract_processing' | 'clinical_application'
|
||||
listLayout: 'inbound-grouped' | 'outbound-grouped' | 'standalone'
|
||||
/** 侧栏 Tab 不展示(保留 key 供路由/数据解析) */
|
||||
hidden?: boolean
|
||||
@@ -65,6 +66,14 @@ export const QC_WORK_ORDER_TABS: QcWorkOrderTabConfig[] = [
|
||||
bizType: 'basic_experiment',
|
||||
listLayout: 'outbound-grouped'
|
||||
},
|
||||
{
|
||||
key: 'outbound_contract_processing',
|
||||
label: '委托加工质检',
|
||||
group: 'outbound',
|
||||
workOrderType: 'outbound',
|
||||
bizType: 'contract_processing',
|
||||
listLayout: 'outbound-grouped'
|
||||
},
|
||||
{
|
||||
key: 'outbound_clinical_application',
|
||||
label: '临床应用质检',
|
||||
@@ -127,6 +136,7 @@ export function resolveTabKeyFromWorkOrder(row: {
|
||||
if (wt === 'outbound') {
|
||||
const bt = row.bizType || 'pilot_service'
|
||||
if (bt === 'basic_experiment') return 'outbound_basic_experiment'
|
||||
if (bt === 'contract_processing') return 'outbound_contract_processing'
|
||||
if (bt === 'clinical_application') return 'outbound_clinical_application'
|
||||
return 'outbound_pilot_service'
|
||||
}
|
||||
@@ -142,7 +152,7 @@ export function tabUsesInfusionTimeFilter(tab: QcWorkOrderTabConfig): boolean {
|
||||
export function keywordPlaceholderForTab(tab: QcWorkOrderTabConfig): string {
|
||||
if (tab.key === 'all') return '工单号 / 样本编码 / 母亲姓名 / 申请单号 / 产品名称等'
|
||||
if (tab.key === 'temporary') return '工单号 / 外部编号'
|
||||
if (tab.key === 'outbound_basic_experiment') {
|
||||
if (tab.key === 'outbound_basic_experiment' || tab.key === 'outbound_contract_processing') {
|
||||
return '工单号/申请单号/课题名称/客户'
|
||||
}
|
||||
if (tab.group === 'outbound') return '工单号/申请单号/申请单名称/患者'
|
||||
@@ -157,7 +167,9 @@ export function keywordPlaceholderForTab(tab: QcWorkOrderTabConfig): string {
|
||||
|
||||
export function filterTimeLabelForTab(tab: QcWorkOrderTabConfig): string {
|
||||
if (tab.key === 'all') return '创建时间'
|
||||
if (tab.key === 'outbound_basic_experiment') return '交付时间'
|
||||
if (tab.key === 'outbound_basic_experiment' || tab.key === 'outbound_contract_processing') {
|
||||
return '交付时间'
|
||||
}
|
||||
if (tab.group === 'outbound') return '输注时间'
|
||||
return '创建时间'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** 临床科研 / 委托加工:共用申请、交付、缴费、出库流程 */
|
||||
export const RESEARCH_LIKE_BIZ_TYPES = ['basic_experiment', 'contract_processing'] as const
|
||||
|
||||
export type ResearchLikeBizType = (typeof RESEARCH_LIKE_BIZ_TYPES)[number]
|
||||
|
||||
export function isResearchLikeBiz(bizType?: string | null): boolean {
|
||||
return RESEARCH_LIKE_BIZ_TYPES.includes((bizType || '') as ResearchLikeBizType)
|
||||
}
|
||||
|
||||
export function isContractProcessing(bizType?: string | null): boolean {
|
||||
return (bizType || '') === 'contract_processing'
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
import { resolveVoidTypeLabel } from '@/utils/void-type-dict'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
// ── 类型定义 ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -228,7 +229,8 @@ export const receptionSource: StatusRegistry = {
|
||||
outbound: { label: '出库', tagType: 'primary' },
|
||||
pilot_service: { label: '中试服务', tagType: 'primary' },
|
||||
clinical_application: { label: '临床应用', tagType: 'warning' },
|
||||
basic_experiment: { label: '临床科研', tagType: 'primary' }
|
||||
basic_experiment: { label: '临床科研', tagType: 'primary' },
|
||||
contract_processing: { label: '委托加工', tagType: 'primary' }
|
||||
}
|
||||
export const receptionSourceLabel = createLabelGetter(receptionSource)
|
||||
export const receptionSourceTagType = createTagTypeGetter(receptionSource)
|
||||
@@ -761,7 +763,8 @@ export function bizTypeLabel(type: string): string {
|
||||
const map: Record<string, string> = {
|
||||
pilot_service: '中试服务',
|
||||
clinical_application: '临床应用',
|
||||
basic_experiment: '临床科研'
|
||||
basic_experiment: '临床科研',
|
||||
contract_processing: '委托加工'
|
||||
}
|
||||
return map[type] || type || '-'
|
||||
}
|
||||
@@ -769,14 +772,15 @@ export function bizTypeTagType(type: string): string {
|
||||
const map: Record<string, string> = {
|
||||
pilot_service: 'primary',
|
||||
clinical_application: 'warning',
|
||||
basic_experiment: 'primary'
|
||||
basic_experiment: 'primary',
|
||||
contract_processing: 'primary'
|
||||
}
|
||||
return map[type] || 'info'
|
||||
}
|
||||
|
||||
// ========== 中试服务 - 产品状态 ==========
|
||||
export function productStatusLabel(status: string, bizType?: string): string {
|
||||
const isBasicExperiment = bizType === 'basic_experiment'
|
||||
const isBasicExperiment = isResearchLikeBiz(bizType)
|
||||
const map: Record<string, string> = {
|
||||
dtz: isBasicExperiment ? '待交付' : '待输注',
|
||||
yrqr: '已用户确认',
|
||||
|
||||
@@ -594,6 +594,7 @@
|
||||
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'ClinicalRefundConfirmTab' })
|
||||
|
||||
@@ -602,7 +603,7 @@
|
||||
const props = defineProps<{ bizType?: string }>()
|
||||
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
|
||||
const isBasicExperiment = computed(
|
||||
() => resolvePilotBizType(props.bizType) === 'basic_experiment'
|
||||
() => isResearchLikeBiz(props.bizType)
|
||||
)
|
||||
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
|
||||
const keywordPlaceholder = computed(() =>
|
||||
|
||||
@@ -636,13 +636,14 @@
|
||||
import { useAttachmentDropZone } from '@/composables/useAttachmentDropZone'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'ClinicalPaymentConfirm' })
|
||||
|
||||
const props = defineProps<{ bizType?: string }>()
|
||||
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
|
||||
const effectiveBizType = computed(() => resolvePilotBizType(props.bizType))
|
||||
const isBasicExperiment = computed(() => effectiveBizType.value === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(effectiveBizType.value))
|
||||
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
|
||||
const route = useRoute()
|
||||
const mainTab = ref<'payment' | 'refund'>('payment')
|
||||
|
||||
+2
-1
@@ -247,6 +247,7 @@
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
type AttachmentItem = {
|
||||
id: string
|
||||
@@ -269,7 +270,7 @@
|
||||
() => getPilotBizConfig(resolvePilotBizType(props.bizType)).pickupTimeLabel
|
||||
)
|
||||
const isBasicExperiment = computed(
|
||||
() => resolvePilotBizType(props.bizType) === 'basic_experiment'
|
||||
() => isResearchLikeBiz(props.bizType)
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
||||
+2
-1
@@ -480,6 +480,7 @@
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
@@ -529,7 +530,7 @@
|
||||
const optionsLoadIssue = ref('')
|
||||
|
||||
const bizConfig = computed(() => getPilotBizConfig(scheduleContext.bizType))
|
||||
const isBasicExperiment = computed(() => scheduleContext.bizType === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(scheduleContext.bizType))
|
||||
|
||||
const applicationContextLabel = computed(() => {
|
||||
const no = scheduleContext.applicationNo?.trim()
|
||||
|
||||
+2
-2
@@ -133,6 +133,7 @@
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { resolveOutboundViewVariant } from '@/utils/outbound-qc-pilot-view-sections'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'ScheduleViewDialog' })
|
||||
|
||||
@@ -179,8 +180,7 @@
|
||||
|
||||
const isBasicExperiment = computed(
|
||||
() =>
|
||||
detail.value?.application?.bizType === 'basic_experiment' ||
|
||||
detail.value?.bizType === 'basic_experiment'
|
||||
isResearchLikeBiz(detail.value?.application?.bizType || detail.value?.bizType)
|
||||
)
|
||||
|
||||
const scheduleBizType = computed(() =>
|
||||
|
||||
+4
-4
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<dl
|
||||
class="review-context-grid"
|
||||
:class="{ 'review-context-grid--cols3': reviewBizType === 'basic_experiment' }"
|
||||
:class="{ 'review-context-grid--cols3': isResearchLikeReview }"
|
||||
>
|
||||
<div
|
||||
v-for="item in reviewContextItems"
|
||||
@@ -230,6 +230,7 @@
|
||||
type OutboundReleaseReviewDetail
|
||||
} from '@/api/outbound-release-review'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
import {
|
||||
bizTypeLabel,
|
||||
qcStatusLabel,
|
||||
@@ -275,6 +276,7 @@
|
||||
const reviewBizType = computed(() =>
|
||||
resolvePilotBizType(singleDetail.value?.application?.bizType)
|
||||
)
|
||||
const isResearchLikeReview = computed(() => isResearchLikeBiz(reviewBizType.value))
|
||||
const reviewBizConfig = computed(() => getPilotBizConfig(reviewBizType.value))
|
||||
const reviewBizTypeLabel = computed(() => {
|
||||
const fromApi = singleDetail.value?.application?.bizTypeLabel
|
||||
@@ -371,9 +373,7 @@
|
||||
const d = singleDetail.value
|
||||
if (!d) return [] as Array<{ label: string; value: string; span?: boolean }>
|
||||
const pickupLabel = reviewBizConfig.value.pickupTimeLabel
|
||||
const isBasicExperiment = reviewBizType.value === 'basic_experiment'
|
||||
|
||||
if (isBasicExperiment) {
|
||||
if (isResearchLikeReview.value) {
|
||||
return [
|
||||
{ label: '课题名称', value: d.application?.projectTitle || '—' },
|
||||
{ label: '客户名称', value: d.application?.customerName || '—' },
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
type OutboundReleaseReview
|
||||
} from '@/api/outbound-release-review'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'PilotServiceOutboundReleaseReview' })
|
||||
|
||||
@@ -170,7 +171,7 @@
|
||||
const effectiveBizType = computed(() => resolvePilotBizType(props.bizType))
|
||||
const bizConfig = computed(() => getPilotBizConfig(effectiveBizType.value))
|
||||
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
|
||||
const isBasicExperiment = computed(() => effectiveBizType.value === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(effectiveBizType.value))
|
||||
const keywordPlaceholder = computed(() =>
|
||||
isBasicExperiment.value ? '申请单号/课题名称/客户名称' : '申请单号/患者姓名'
|
||||
)
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
:required="!isEdit && projectRequired"
|
||||
><ProjectSelect
|
||||
v-model="formData.projectId"
|
||||
:biz-type="isBasicExperiment ? 'basic_experiment' : 'pilot_service'"
|
||||
:biz-type="isBasicExperiment ? props.bizType || 'basic_experiment' : 'pilot_service'"
|
||||
:disabled="isEdit"
|
||||
:project-name="formData.projectName"
|
||||
@required="projectRequired = $event"
|
||||
@@ -71,21 +71,35 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<template v-if="isBasicExperiment">
|
||||
<el-form-item label="业务类型" prop="researchCategory">
|
||||
<el-form-item label="业务类型" prop="researchCategorySelect">
|
||||
<el-select
|
||||
v-model="formData.researchCategory"
|
||||
v-model="researchCategorySelect"
|
||||
class="w-full"
|
||||
clearable
|
||||
placeholder="请选择业务类型"
|
||||
@change="onResearchCategorySelectChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in clinicalResearchCategoryOptions"
|
||||
v-for="opt in researchCategoryOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="showResearchCategoryOther"
|
||||
label="自定义业务类型"
|
||||
prop="researchCategoryCustom"
|
||||
>
|
||||
<el-input
|
||||
v-model="researchCategoryCustom"
|
||||
maxlength="64"
|
||||
show-word-limit
|
||||
placeholder="请输入业务类型"
|
||||
@input="syncResearchCategoryFromOther"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道" prop="channelId">
|
||||
<el-select
|
||||
v-model="formData.channelId"
|
||||
@@ -1321,12 +1335,15 @@
|
||||
} from '@/utils/status-tag-registry'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { CLINICAL_RESEARCH_CATEGORY_OPTIONS } from '@/constants/clinical-research-category'
|
||||
import {
|
||||
RESEARCH_CATEGORY_OTHER_VALUE,
|
||||
isFixedContractProcessingCategory,
|
||||
researchCategoryOptionsForBiz
|
||||
} from '@/constants/clinical-research-category'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'ApplicationFormDialog' })
|
||||
|
||||
const clinicalResearchCategoryOptions = CLINICAL_RESEARCH_CATEGORY_OPTIONS
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
editId: string | null
|
||||
@@ -1342,7 +1359,53 @@
|
||||
const isEdit = computed(() => !!props.editId)
|
||||
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
|
||||
const isClinical = computed(() => props.bizType === 'clinical_application')
|
||||
const isBasicExperiment = computed(() => props.bizType === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
|
||||
const researchCategoryOptions = computed(() => researchCategoryOptionsForBiz(props.bizType))
|
||||
const researchCategorySelect = ref('')
|
||||
const researchCategoryCustom = ref('')
|
||||
const showResearchCategoryOther = computed(
|
||||
() =>
|
||||
props.bizType === 'contract_processing' &&
|
||||
researchCategorySelect.value === RESEARCH_CATEGORY_OTHER_VALUE
|
||||
)
|
||||
|
||||
function applyResearchCategoryToForm() {
|
||||
if (showResearchCategoryOther.value) {
|
||||
formData.researchCategory = (researchCategoryCustom.value || '').trim()
|
||||
} else {
|
||||
formData.researchCategory = researchCategorySelect.value || ''
|
||||
}
|
||||
}
|
||||
|
||||
function onResearchCategorySelectChange() {
|
||||
if (!showResearchCategoryOther.value) {
|
||||
researchCategoryCustom.value = ''
|
||||
}
|
||||
applyResearchCategoryToForm()
|
||||
}
|
||||
|
||||
function syncResearchCategoryFromOther() {
|
||||
applyResearchCategoryToForm()
|
||||
}
|
||||
|
||||
function hydrateResearchCategorySelect(code?: string | null) {
|
||||
const value = (code || '').trim()
|
||||
if (!value) {
|
||||
researchCategorySelect.value = ''
|
||||
researchCategoryCustom.value = ''
|
||||
formData.researchCategory = ''
|
||||
return
|
||||
}
|
||||
if (props.bizType === 'contract_processing' && !isFixedContractProcessingCategory(value)) {
|
||||
researchCategorySelect.value = RESEARCH_CATEGORY_OTHER_VALUE
|
||||
researchCategoryCustom.value = value
|
||||
formData.researchCategory = value
|
||||
return
|
||||
}
|
||||
researchCategorySelect.value = value
|
||||
researchCategoryCustom.value = ''
|
||||
formData.researchCategory = value
|
||||
}
|
||||
|
||||
// ── Tabs ───────────────────────────────────────────────────────────────
|
||||
const formTabs = computed(() => {
|
||||
@@ -1412,7 +1475,42 @@
|
||||
channelServiceOrderId: [
|
||||
{ required: true, message: '请选择服务订单', trigger: 'change' }
|
||||
],
|
||||
researchCategory: [{ required: true, message: '请选择业务类型', trigger: 'change' }],
|
||||
researchCategorySelect: [
|
||||
{
|
||||
validator: (_rule: any, _value: any, callback: (e?: Error) => void) => {
|
||||
if (!isBasicExperiment.value) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
if (!researchCategorySelect.value) {
|
||||
callback(new Error('请选择业务类型'))
|
||||
return
|
||||
}
|
||||
if (showResearchCategoryOther.value && !(researchCategoryCustom.value || '').trim()) {
|
||||
callback(new Error('请填写自定义业务类型'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
researchCategoryCustom: [
|
||||
{
|
||||
validator: (_rule: any, _value: any, callback: (e?: Error) => void) => {
|
||||
if (!showResearchCategoryOther.value) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
if (!(researchCategoryCustom.value || '').trim()) {
|
||||
callback(new Error('请填写自定义业务类型'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
projectTitle: [{ required: true, message: '请填写课题名称', trigger: 'blur' }],
|
||||
customerName: [{ required: true, message: '请填写客户名称', trigger: 'blur' }],
|
||||
customerContact: [{ required: true, message: '请填写客户联系人', trigger: 'blur' }],
|
||||
@@ -2842,7 +2940,7 @@
|
||||
formData.customerName = ''
|
||||
formData.customerContact = ''
|
||||
formData.customerPhone = ''
|
||||
formData.researchCategory = ''
|
||||
hydrateResearchCategorySelect('')
|
||||
saleProductLines.value = []
|
||||
saleLineSeq = 0
|
||||
patientForm.customerId = ''
|
||||
@@ -2895,7 +2993,7 @@
|
||||
formData.customerName = detail.customerName || ''
|
||||
formData.customerContact = detail.customerContact || ''
|
||||
formData.customerPhone = detail.customerPhone || ''
|
||||
formData.researchCategory = detail.researchCategory || ''
|
||||
hydrateResearchCategorySelect(detail.researchCategory || '')
|
||||
|
||||
if (detail.consentAttachmentFiles?.length) {
|
||||
consentFileList.value = mapAttachmentFilesFromDetail(detail.consentAttachmentFiles)
|
||||
@@ -3108,6 +3206,7 @@
|
||||
}
|
||||
|
||||
if (isBasicExperiment.value) {
|
||||
applyResearchCategoryToForm()
|
||||
payload.researchCategory = formData.researchCategory || undefined
|
||||
payload.channelId = formData.channelId || undefined
|
||||
payload.projectTitle = formData.projectTitle || undefined
|
||||
|
||||
@@ -899,6 +899,7 @@
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { clinicalResearchCategoryLabel } from '@/constants/clinical-research-category'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
import {
|
||||
applicationStatusLabel,
|
||||
applicationStatusTagType,
|
||||
@@ -994,7 +995,7 @@
|
||||
const isYfkOrder = computed(() => serviceOrderDetail.value?.orderType === 'yfk')
|
||||
const isGmcpOrder = computed(() => serviceOrderDetail.value?.orderType === 'gmcp')
|
||||
const isBasicExperiment = computed(
|
||||
() => applicationDetail.value?.bizType === 'basic_experiment'
|
||||
() => isResearchLikeBiz(applicationDetail.value?.bizType)
|
||||
)
|
||||
|
||||
const settlementModeLabel = computed(() => {
|
||||
|
||||
@@ -544,12 +544,13 @@
|
||||
|
||||
const transferTypeOptions = ref<Api.Dict.DictDataOption[]>([])
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'ClinicalPaymentTab' })
|
||||
|
||||
const props = defineProps<{ bizType?: string }>()
|
||||
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
|
||||
const isBasicExperiment = computed(() => props.bizType === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
|
||||
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
|
||||
|
||||
type PayStatusKey = 'dfj' | 'jfqrz' | 'yjf' | 'tfqrz' | 'ytf'
|
||||
|
||||
@@ -399,13 +399,14 @@
|
||||
import ScheduleCancelDialog from '../infusion-schedule-management/ScheduleCancelDialog.vue'
|
||||
import InfusionScheduleHandoverDialog from '../infusion-schedule-management/InfusionScheduleHandoverDialog.vue'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'InfusionScheduleTab' })
|
||||
|
||||
const props = defineProps<{ bizType?: string }>()
|
||||
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
|
||||
const isClinical = computed(() => props.bizType === 'clinical_application')
|
||||
const isBasicExperiment = computed(() => props.bizType === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
|
||||
const keywordPlaceholder = computed(() =>
|
||||
isBasicExperiment.value ? '申请单号/课题名称/客户名称' : '申请单号/患者姓名/渠道名称'
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
team
|
||||
v-model="teamFilter"
|
||||
:biz-type="
|
||||
props.bizType === 'basic_experiment'
|
||||
isResearchLikeBiz(props.bizType)
|
||||
? 'basic_experiment'
|
||||
: 'pilot_service'
|
||||
"
|
||||
@@ -18,7 +18,7 @@
|
||||
><ProjectSelect filter
|
||||
v-model="projectFilter"
|
||||
:biz-type="
|
||||
props.bizType === 'basic_experiment'
|
||||
isResearchLikeBiz(props.bizType)
|
||||
? 'basic_experiment'
|
||||
: 'pilot_service'
|
||||
"
|
||||
@@ -342,13 +342,14 @@
|
||||
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
|
||||
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
|
||||
import { clinicalResearchCategoryLabel } from '@/constants/clinical-research-category'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'PilotApplicationTab' })
|
||||
|
||||
const props = defineProps<{ bizType?: string }>()
|
||||
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
|
||||
const isClinical = computed(() => props.bizType === 'clinical_application')
|
||||
const isBasicExperiment = computed(() => props.bizType === 'basic_experiment')
|
||||
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
|
||||
const keywordPlaceholder = computed(() =>
|
||||
isBasicExperiment.value ? '申请单号/课题名称/客户名称' : '申请单号/订单名称/患者姓名'
|
||||
)
|
||||
|
||||
+2
-1
@@ -390,6 +390,7 @@
|
||||
import ProductionStepBadge from './ProductionStepBadge.vue'
|
||||
import QcWorkOrderFeeSummaryBar from '@/views/quality-inspection/qc-work-order/QcWorkOrderFeeSummaryBar.vue'
|
||||
import QcWorkOrderProtocolPaymentPanel from '@/views/quality-inspection/qc-work-order/QcWorkOrderProtocolPaymentPanel.vue'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
defineOptions({ name: 'ProductionWorkOrderCardList' })
|
||||
|
||||
@@ -663,7 +664,7 @@
|
||||
if (row.workOrderStatus === 'yzf') return false
|
||||
const tabKey = resolveEffectiveRowTabKey(listTabKey.value, row)
|
||||
if (tabKey === 'outbound_basic_experiment') return true
|
||||
return row.bizType === 'basic_experiment' && (row.workOrderType || '') === 'outbound'
|
||||
return isResearchLikeBiz(row.bizType) && (row.workOrderType || '') === 'outbound'
|
||||
}
|
||||
|
||||
function canVoidWorkOrder(row: ProductionWorkOrderItem) {
|
||||
|
||||
+8
-3
@@ -17,7 +17,7 @@ import type { TagType } from '@/utils/status-tag-registry'
|
||||
import {
|
||||
buildOutboundPilotContextSections,
|
||||
resolveOutboundViewVariant,
|
||||
type OutboundViewVariant
|
||||
type OutboundViewContextVariant
|
||||
} from '@/utils/outbound-qc-pilot-view-sections'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import {
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
buildQcReceptionViewFields
|
||||
} from '@/utils/sample-reception-view-sections'
|
||||
import type { ProductionReceptionRecord } from '@/utils/sample-production-reception-fields'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
function woStatusTag(status: string) {
|
||||
const map: Record<string, { label: string; type: TagType }> = {
|
||||
@@ -181,7 +182,11 @@ function buildFeeSection(d: ProductionWorkOrderDetail): ViewSection {
|
||||
}
|
||||
}
|
||||
|
||||
function buildOutboundSections(d: ProductionWorkOrderDetail, variant: OutboundViewVariant, showFee: boolean) {
|
||||
function buildOutboundSections(
|
||||
d: ProductionWorkOrderDetail,
|
||||
variant: OutboundViewContextVariant,
|
||||
showFee: boolean
|
||||
) {
|
||||
const sections: ViewSection[] = [
|
||||
{
|
||||
title: '基本信息',
|
||||
@@ -271,6 +276,6 @@ export function isOutboundProductionView(d: ProductionWorkOrderDetail | null): b
|
||||
d?.workOrderType === 'outbound' &&
|
||||
(d.bizType === 'pilot_service' ||
|
||||
d.bizType === 'clinical_application' ||
|
||||
d.bizType === 'basic_experiment')
|
||||
isResearchLikeBiz(d.bizType))
|
||||
)
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export const PRODUCTION_WORK_ORDER_TAB_COMPONENTS: Record<ProductionWorkOrderTab
|
||||
inbound_research_donation: InboundResearchDonationTab,
|
||||
outbound_pilot_service: OutboundPilotTab,
|
||||
outbound_basic_experiment: OutboundBasicExperimentTab,
|
||||
outbound_contract_processing: OutboundBasicExperimentTab,
|
||||
outbound_clinical_application: OutboundClinicalTab,
|
||||
temporary: TemporaryTab
|
||||
}
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ export const PRODUCTION_WORK_ORDER_VIEW_DIALOG_COMPONENTS: Record<
|
||||
inbound_research_donation: InboundResearchDonationProductionViewDialog,
|
||||
outbound_pilot_service: OutboundPilotProductionViewDialog,
|
||||
outbound_basic_experiment: OutboundBasicExperimentProductionViewDialog,
|
||||
outbound_contract_processing: OutboundBasicExperimentProductionViewDialog,
|
||||
outbound_clinical_application: OutboundClinicalProductionViewDialog,
|
||||
temporary: TemporaryProductionViewDialog
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ export const assignmentTabs: { key: AssignmentBizType; title: string }[] = [
|
||||
{ key: 'cell_storage', title: '细胞存储' },
|
||||
{ key: 'research_donation', title: '科研捐赠' },
|
||||
{ key: 'pilot_service', title: '中试服务' },
|
||||
{ key: 'basic_experiment', title: '临床科研' }
|
||||
{ key: 'basic_experiment', title: '临床科研' },
|
||||
{ key: 'contract_processing', title: '委托加工' }
|
||||
]
|
||||
|
||||
const collectionColumns: AssignmentColumn[] = [
|
||||
@@ -45,6 +46,13 @@ export const assignmentColumns: Record<AssignmentBizType, AssignmentColumn[]> =
|
||||
{ prop: 'customerName', label: '客户名称', minWidth: 180 },
|
||||
{ prop: 'customerContact', label: '客户联系人', minWidth: 140 },
|
||||
{ prop: 'customerPhone', label: '联系电话', minWidth: 150 }
|
||||
],
|
||||
contract_processing: [
|
||||
{ prop: 'bizNo', label: '申请单号', minWidth: 180 },
|
||||
{ prop: 'projectTitle', label: '课题名称', minWidth: 200 },
|
||||
{ prop: 'customerName', label: '客户名称', minWidth: 180 },
|
||||
{ prop: 'customerContact', label: '客户联系人', minWidth: 140 },
|
||||
{ prop: 'customerPhone', label: '联系电话', minWidth: 150 }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -52,5 +60,6 @@ export const assignmentKeywordHints: Record<AssignmentBizType, string> = {
|
||||
cell_storage: '样本编码 / 母亲姓名、电话 / 医院 / 市场专员',
|
||||
research_donation: '样本编码 / 母亲姓名、电话 / 医院 / 市场专员',
|
||||
pilot_service: '申请单号、名称 / 渠道 / 服务订单 / 患者姓名、电话',
|
||||
basic_experiment: '申请单号 / 课题 / 客户名称、联系人、电话'
|
||||
basic_experiment: '申请单号 / 课题 / 客户名称、联系人、电话',
|
||||
contract_processing: '申请单号 / 课题 / 客户名称、联系人、电话'
|
||||
}
|
||||
@@ -96,7 +96,8 @@
|
||||
'cell_storage',
|
||||
'research_donation',
|
||||
'pilot_service',
|
||||
'basic_experiment'
|
||||
'basic_experiment',
|
||||
'contract_processing'
|
||||
]
|
||||
const applied = ref<ProjectRecord>({ groupBy: 'team' })
|
||||
const displayRows = computed(() => [
|
||||
|
||||
@@ -14,6 +14,7 @@ export const QC_WORK_ORDER_TAB_COMPONENTS: Record<QcWorkOrderTabKey, Component>
|
||||
inbound_research_donation: InboundResearchDonationTab,
|
||||
outbound_pilot_service: OutboundPilotTab,
|
||||
outbound_basic_experiment: OutboundBasicExperimentTab,
|
||||
outbound_contract_processing: OutboundBasicExperimentTab,
|
||||
outbound_clinical_application: OutboundClinicalTab,
|
||||
temporary: TemporaryTab
|
||||
}
|
||||
|
||||
+1
@@ -13,6 +13,7 @@ export const QC_WORK_ORDER_VIEW_DIALOG_COMPONENTS: Record<QcWorkOrderTabKey, Com
|
||||
inbound_research_donation: InboundResearchDonationViewDialog,
|
||||
outbound_pilot_service: OutboundPilotViewDialog,
|
||||
outbound_basic_experiment: OutboundBasicExperimentViewDialog,
|
||||
outbound_contract_processing: OutboundBasicExperimentViewDialog,
|
||||
outbound_clinical_application: OutboundClinicalViewDialog,
|
||||
temporary: TemporaryQcViewDialog
|
||||
}
|
||||
Reference in new issue
Block a user