add backend source code

This commit is contained in:
2026-02-28 15:06:52 +08:00
parent 1bc330e20c
commit 2c37aa9064
67 changed files with 11654 additions and 0 deletions

View File

@@ -0,0 +1,374 @@
"""
初始化绩效考核指标模板
根据参考文档创建各类科室的考核指标模板
"""
import asyncio
import json
from app.core.database import async_session_maker
from app.models.models import Indicator, IndicatorType, BSCDimension, DeptType
async def init_indicator_templates():
"""初始化指标模板数据"""
async with async_session_maker() as db:
# 检查是否已存在数据
from sqlalchemy import text
result = await db.execute(text("SELECT count(*) FROM indicators"))
count = result.scalar()
if count > 0:
print("指标数据已存在,跳过初始化")
return
# 临床手术科室指标模板
surgical_indicators = [
# 财务维度
Indicator(
name="业务收入增长率",
code="FIN001",
indicator_type=IndicatorType.QUANTITY,
bs_dimension=BSCDimension.FINANCIAL,
weight=1.0,
max_score=100.0,
target_value=10.0,
target_unit="%",
calculation_method="(本期收入 - 同期收入)/同期收入 × 100%",
assessment_method="统计报表",
deduction_standard="每降低 1% 扣 2 分",
data_source="HIS 系统",
applicable_dept_types=json.dumps(["clinical_surgical"]),
is_veto=False,
is_active=True
),
Indicator(
name="药品比例控制",
code="FIN002",
indicator_type=IndicatorType.COST,
bs_dimension=BSCDimension.FINANCIAL,
weight=1.2,
max_score=100.0,
target_value=40.0,
target_unit="%",
calculation_method="药品收入/总收入 × 100%",
assessment_method="药事统计",
deduction_standard="超 1% 扣 1 分",
data_source="HIS 系统",
applicable_dept_types=json.dumps(["clinical_surgical"]),
is_veto=False,
is_active=True
),
Indicator(
name="医保扣款控制",
code="FIN003",
indicator_type=IndicatorType.COST,
bs_dimension=BSCDimension.FINANCIAL,
weight=1.5,
max_score=100.0,
target_value=0.0,
target_unit="",
calculation_method="因违规导致的医保扣款金额",
assessment_method="医保办统计",
deduction_standard="每发生 1 例扣 5 分",
data_source="医保系统",
applicable_dept_types=json.dumps(["clinical_surgical"]),
is_veto=False,
is_active=True
),
# 客户维度
Indicator(
name="患者满意度",
code="CUS001",
indicator_type=IndicatorType.SERVICE,
bs_dimension=BSCDimension.CUSTOMER,
weight=1.5,
max_score=100.0,
target_value=90.0,
target_unit="%",
calculation_method="满意度调查表统计",
assessment_method="问卷调查",
deduction_standard="<90% 每降 1% 扣 1 分",
data_source="满意度调查系统",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward", "clinical_nonsurgical_noward"]),
is_veto=False,
is_active=True
),
Indicator(
name="服务投诉处理率",
code="CUS002",
indicator_type=IndicatorType.SERVICE,
bs_dimension=BSCDimension.CUSTOMER,
weight=1.0,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="已处理投诉/总投诉 × 100%",
assessment_method="投诉记录统计",
deduction_standard="每有 1 例未处理扣 5 分",
data_source="投诉管理系统",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward", "clinical_nonsurgical_noward"]),
is_veto=False,
is_active=True
),
# 内部流程维度
Indicator(
name="病历书写合格率",
code="PRO001",
indicator_type=IndicatorType.QUALITY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=2.0,
max_score=100.0,
target_value=95.0,
target_unit="%",
calculation_method="合格病历数/总病历数 × 100%",
assessment_method="每周抽查",
deduction_standard="不合格每份扣 50 元",
data_source="电子病历系统",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward"]),
is_veto=False,
is_active=True
),
Indicator(
name="手术安全核对表执行率",
code="PRO002",
indicator_type=IndicatorType.QUALITY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.5,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="执行核对的手术数/总手术数 × 100%",
assessment_method="现场核查",
deduction_standard="未执行每次扣 1 分",
data_source="手术麻醉系统",
applicable_dept_types=json.dumps(["clinical_surgical"]),
is_veto=False,
is_active=True
),
Indicator(
name="手术分级管理制度执行",
code="PRO003",
indicator_type=IndicatorType.COMPLIANCE,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.5,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="符合分级的手术数/总手术数 × 100%",
assessment_method="病历审查",
deduction_standard="越级手术每例扣 2 分",
data_source="手术麻醉系统",
applicable_dept_types=json.dumps(["clinical_surgical"]),
is_veto=False,
is_active=True
),
Indicator(
name="抗菌药物使用率",
code="PRO004",
indicator_type=IndicatorType.QUALITY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.5,
max_score=100.0,
target_value=50.0,
target_unit="%",
calculation_method="使用抗菌药物病例数/总病例数 × 100%",
assessment_method="院感统计",
deduction_standard="超 1% 扣 1 分",
data_source="院感监测系统",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward"]),
is_veto=False,
is_active=True
),
Indicator(
name="院感控制达标率",
code="PRO005",
indicator_type=IndicatorType.SAFETY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=2.0,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="院感监测指标达标情况",
assessment_method="现场抽查 + 数据监测",
deduction_standard="违规每项扣 3 分",
data_source="院感监测系统",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward", "medical_tech"]),
is_veto=True,
is_active=True
),
# 学习与成长维度
Indicator(
name="培训参与率",
code="LRN001",
indicator_type=IndicatorType.LEARNING,
bs_dimension=BSCDimension.LEARNING_GROWTH,
weight=1.0,
max_score=100.0,
target_value=90.0,
target_unit="%",
calculation_method="实际参与人数/应参与人数 × 100%",
assessment_method="培训记录",
deduction_standard="每降 1% 扣 1 分",
data_source="科教科",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward", "medical_tech"]),
is_veto=False,
is_active=True
),
Indicator(
name="继续教育学分达标率",
code="LRN002",
indicator_type=IndicatorType.LEARNING,
bs_dimension=BSCDimension.LEARNING_GROWTH,
weight=1.0,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="达标人数/总人数 × 100%",
assessment_method="学分统计",
deduction_standard="每降 1% 扣 1 分",
data_source="科教科",
applicable_dept_types=json.dumps(["clinical_surgical", "clinical_nonsurgical_ward", "medical_tech"]),
is_veto=False,
is_active=True
),
]
# 行政科室指标模板
admin_indicators = [
# 工作业绩
Indicator(
name="工作计划完成率",
code="ADM001",
indicator_type=IndicatorType.QUANTITY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=2.0,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="实际完成工作数/计划工作数 × 100%",
assessment_method="年度考核",
deduction_standard="每项未完成扣 5 分",
data_source="院办",
applicable_dept_types=json.dumps(["admin"]),
is_veto=False,
is_active=True
),
Indicator(
name="制度建设健全率",
code="ADM002",
indicator_type=IndicatorType.COMPLIANCE,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.0,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="已建立制度数/应建立制度数 × 100%",
assessment_method="查记录",
deduction_standard="每缺一项制度扣 2 分",
data_source="院办",
applicable_dept_types=json.dumps(["admin"]),
is_veto=False,
is_active=True
),
# 服务质量
Indicator(
name="临床对行政满意度",
code="ADM003",
indicator_type=IndicatorType.SERVICE,
bs_dimension=BSCDimension.CUSTOMER,
weight=1.5,
max_score=100.0,
target_value=90.0,
target_unit="%",
calculation_method="满意度调查统计",
assessment_method="季度测评",
deduction_standard="<90% 每降 1% 扣 1 分",
data_source="满意度调查",
applicable_dept_types=json.dumps(["admin"]),
is_veto=False,
is_active=True
),
# 内部管理
Indicator(
name="科务会召开率",
code="ADM004",
indicator_type=IndicatorType.COMPLIANCE,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.0,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="实际召开次数/应召开次数 × 100%",
assessment_method="查会议记录",
deduction_standard="<2 次/月扣 2 分",
data_source="院办",
applicable_dept_types=json.dumps(["admin"]),
is_veto=False,
is_active=True
),
]
# 医技科室指标模板
tech_indicators = [
Indicator(
name="报告及时率",
code="TECH001",
indicator_type=IndicatorType.EFFICIENCY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.5,
max_score=100.0,
target_value=100.0,
target_unit="%",
calculation_method="及时报告数/总报告数 × 100%",
assessment_method="系统统计",
deduction_standard="每降 1% 扣 1 分",
data_source="LIS/PACS 系统",
applicable_dept_types=json.dumps(["medical_tech"]),
is_veto=False,
is_active=True
),
Indicator(
name="检查阳性率",
code="TECH002",
indicator_type=IndicatorType.QUALITY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.5,
max_score=100.0,
target_value=70.0,
target_unit="%",
calculation_method="阳性例数/总检查例数 × 100%",
assessment_method="科室统计",
deduction_standard="每降 1% 扣 1 分",
data_source="LIS/PACS 系统",
applicable_dept_types=json.dumps(["medical_tech"]),
is_veto=False,
is_active=True
),
Indicator(
name="设备完好率",
code="TECH003",
indicator_type=IndicatorType.QUANTITY,
bs_dimension=BSCDimension.INTERNAL_PROCESS,
weight=1.0,
max_score=100.0,
target_value=95.0,
target_unit="%",
calculation_method="完好设备数/总设备数 × 100%",
assessment_method="设备科统计",
deduction_standard="每降 1% 扣 1 分",
data_source="设备科",
applicable_dept_types=json.dumps(["medical_tech"]),
is_veto=False,
is_active=True
),
]
# 添加所有指标到数据库
all_indicators = surgical_indicators + admin_indicators + tech_indicators
for indicator in all_indicators:
db.add(indicator)
await db.commit()
print(f"成功初始化 {len(all_indicators)} 个考核指标模板")
if __name__ == "__main__":
asyncio.run(init_indicator_templates())