Files
hospital_performance/docs/enhancement_design.md
2026-02-28 15:02:08 +08:00

17 KiB
Raw Blame History

医院绩效管理系统增强设计文档

一、系统架构设计

1.1 技术架构

┌─────────────────────────────────────────────────────────────┐
│                      前端层 (Frontend)                       │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐      │
│  │ Web 管理端 │ │ 移动端 H5 │ │ 小程序    │ │ 数据大屏  │      │
│  └──────────┘ └──────────┘ └──────────┘ └──────────┘      │
└─────────────────────────┬───────────────────────────────────┘
                          │ HTTP/REST API
┌─────────────────────────▼───────────────────────────────────┐
│                      后端层 (Backend)                        │
│  ┌──────────────────────────────────────────────────────┐  │
│  │                  API Gateway                          │  │
│  ├──────────┬──────────┬──────────┬──────────┬──────────┤  │
│  │ 科室管理  │ 指标管理  │ 考核管理  │ 工资核算  │ 统计报表  │  │
│  └──────────┴──────────┴──────────┴──────────┴──────────┘  │
│  ┌──────────┬──────────┬──────────┬──────────┬──────────┤  │
│  │ 用户认证  │ 权限管理  │ 日志管理  │ 系统配置  │ 消息通知  │  │
│  └──────────┴──────────┴──────────┴──────────┴──────────┘  │
└─────────────────────────┬───────────────────────────────────┘
                          │ SQLAlchemy Async
┌─────────────────────────▼───────────────────────────────────┐
│                    数据层 (Data Layer)                       │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │  PostgreSQL  │  │    Redis     │  │  文件存储     │     │
│  │  (主数据库)   │  │   (缓存)     │  │  (报表/附件)  │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
└─────────────────────────────────────────────────────────────┘

1.2 功能模块设计

医院绩效管理系统
├── 基础数据管理
│   ├── 科室信息管理(树形结构,支持 9 种科室类型)
│   ├── 员工信息管理
│   ├── 考核指标管理(支持 BSC 维度、指标模板)
│   └── 指标模板库(按科室类型预置指标)
├── 绩效考核流程
│   ├── 考核方案配置
│   ├── 考核任务创建
│   ├── 考核数据填报
│   ├── 考核提交与审核
│   ├── 考核结果确认
│   └── 批量创建考核
├── 数据分析报表
│   ├── BSC 维度分析(财务/客户/内部流程/学习成长)
│   ├── 科室绩效统计
│   ├── 员工绩效排名
│   ├── 趋势分析(月度/季度/年度)
│   ├── 指标完成度分析
│   └── 绩效分布分析
├── 绩效工资核算
│   ├── 绩效系数配置
│   ├── 自动计算工资
│   ├── 批量生成工资记录
│   ├── 工资确认与发放
│   └── 工资条导出
├── 满意度调查
│   ├── 调查问卷管理
│   ├── 移动端调查页面
│   ├── 满意度统计
│   └── 满意度趋势分析
└── 系统管理
    ├── 用户管理
    ├── 角色权限
    ├── 系统配置
    └── 操作日志

二、数据库设计增强

2.1 新增数据表

2.1.1 考核方案表 (assessment_plans)

CREATE TABLE assessment_plans (
    id INTEGER PRIMARY KEY,
    name VARCHAR(100) NOT NULL,           -- 方案名称
    plan_type VARCHAR(20) NOT NULL,       -- 方案类型monthly/quarterly/yearly
    applicable_dept_types TEXT,           -- 适用科室类型 (JSON)
    bs_dimension_weights TEXT,            -- BSC 维度权重 (JSON)
    start_date DATE,                      -- 开始日期
    end_date DATE,                        -- 结束日期
    status VARCHAR(20) DEFAULT 'draft',   -- 状态
    created_at DATETIME,
    updated_at DATETIME
);

2.1.2 满意度调查表 (satisfaction_surveys)

CREATE TABLE satisfaction_surveys (
    id INTEGER PRIMARY KEY,
    survey_name VARCHAR(100) NOT NULL,    -- 调查名称
    survey_type VARCHAR(20) NOT NULL,     -- 调查类型patient/staff
    questions TEXT NOT NULL,              -- 问题列表 (JSON)
    status VARCHAR(20) DEFAULT 'active',
    start_date DATE,
    end_date DATE,
    target_departments TEXT,              -- 目标科室 (JSON)
    created_at DATETIME,
    updated_at DATETIME
);

2.1.3 满意度回答表 (satisfaction_responses)

CREATE TABLE satisfaction_responses (
    id INTEGER PRIMARY KEY,
    survey_id INTEGER NOT NULL,
    respondent_type VARCHAR(20),          -- 回答者类型
    department_id INTEGER,                -- 被评价科室
    answers TEXT NOT NULL,                -- 回答内容 (JSON)
    total_score DECIMAL(5,2),             -- 总分
    submitted_at DATETIME,
    FOREIGN KEY (survey_id) REFERENCES surveys(id)
);

2.1.4 绩效系数配置表 (performance_coefficients)

CREATE TABLE performance_coefficients (
    id INTEGER PRIMARY KEY,
    department_id INTEGER,                -- 科室 ID
    staff_id INTEGER,                     -- 员工 ID
    coefficient DECIMAL(5,2) DEFAULT 1.0, -- 系数
    effective_year INTEGER,               -- 生效年度
    effective_month INTEGER,              -- 生效月份
    remark TEXT,
    created_at DATETIME,
    updated_at DATETIME
);

2.1.5 奖惩记录表 (bonus_penalty_records)

CREATE TABLE bonus_penalty_records (
    id INTEGER PRIMARY KEY,
    department_id INTEGER,
    staff_id INTEGER,
    record_type VARCHAR(20),              -- reward/punishment
    reason TEXT NOT NULL,                 -- 原因
    amount DECIMAL(10,2),                 -- 金额
    score_impact DECIMAL(5,2),            -- 分数影响
    period_year INTEGER,
    period_month INTEGER,
    status VARCHAR(20) DEFAULT 'pending',
    approved_by INTEGER,
    created_at DATETIME,
    updated_at DATETIME
);

2.2 指标模板数据结构

{
  "template_name": "手术临床科室考核指标",
  "dept_type": "clinical_surgical",
  "indicators": [
    {
      "name": "业务收入增长率",
      "code": "FIN001",
      "indicator_type": "quantity",
      "bs_dimension": "financial",
      "weight": 1.0,
      "max_score": 100,
      "target_value": 10,
      "target_unit": "%",
      "calculation_method": "(本期收入 - 同期收入)/同期收入 × 100%",
      "assessment_method": "统计报表",
      "deduction_standard": "每降低 1% 扣 2 分",
      "data_source": "HIS 系统",
      "is_veto": false
    }
  ]
}

三、API 接口设计

3.1 指标管理 API

GET    /api/v1/indicators              # 获取指标列表
POST   /api/v1/indicators              # 创建指标
GET    /api/v1/indicators/{id}         # 获取指标详情
PUT    /api/v1/indicators/{id}         # 更新指标
DELETE /api/v1/indicators/{id}         # 删除指标
GET    /api/v1/indicators/templates    # 获取指标模板列表
POST   /api/v1/indicators/templates    # 导入指标模板
POST   /api/v1/indicators/batch        # 批量操作指标

3.2 统计报表 API

GET    /api/v1/stats/bsc-dimension     # BSC 维度分析
GET    /api/v1/stats/department        # 科室绩效统计
GET    /api/v1/stats/trend             # 趋势分析
GET    /api/v1/stats/ranking           # 绩效排名
GET    /api/v1/stats/completion        # 指标完成度
GET    /api/v1/stats/satisfaction      # 满意度统计

3.3 工资核算 API

GET    /api/v1/salary/config           # 获取工资配置
POST   /api/v1/salary/config           # 更新工资配置
POST   /api/v1/salary/calculate        # 计算工资
POST   /api/v1/salary/generate         # 生成工资记录
GET    /api/v1/salary/records          # 获取工资记录
POST   /api/v1/salary/confirm          # 确认工资

3.4 满意度调查 API

GET    /api/v1/surveys                 # 获取调查列表
POST   /api/v1/surveys                 # 创建调查
GET    /api/v1/surveys/{id}            # 获取调查详情
POST   /api/v1/surveys/{id}/respond    # 提交回答
GET    /api/v1/surveys/{id}/results    # 获取调查结果
GET    /api/v1/surveys/stats           # 满意度统计

四、前端页面设计

4.1 页面结构

/src/views
├── basic/                      # 基础数据管理
│   ├── Departments.vue         # 科室管理
│   ├── Staff.vue               # 员工管理
│   └── Indicators.vue          # 指标管理(增强版)
├── assessment/                 # 考核管理
│   ├── Plans.vue               # 考核方案
│   ├── Assessments.vue         # 考核列表
│   └── AssessmentDetail.vue    # 考核详情
├── reports/                    # 统计报表
│   ├── BSCAnalysis.vue         # BSC 维度分析
│   ├── DepartmentStats.vue     # 科室统计
│   ├── TrendAnalysis.vue       # 趋势分析
│   └── Ranking.vue             # 绩效排名
├── salary/                     # 工资核算
│   ├── Config.vue              # 工资配置
│   ├── Calculation.vue         # 工资计算
│   └── Records.vue             # 工资记录
├── satisfaction/               # 满意度调查
│   ├── Surveys.vue             # 调查管理
│   ├── SurveyDetail.vue        # 调查详情
│   └── Stats.vue               # 满意度统计
└── mobile/                     # 移动端页面
    └── Survey.vue              # 满意度调查 H5

4.2 指标管理页面增强

新增字段:

  • BSC 维度选择器
  • 适用科室类型(多选)
  • 计算方法/公式
  • 考核方法
  • 扣分标准
  • 数据来源
  • 是否一票否决

4.3 统计报表页面

BSC 维度分析

  • 四大维度得分雷达图
  • 维度得分趋势图
  • 科室维度对比

科室绩效统计

  • 科室得分排行榜
  • 科室得分明细
  • 科室得分构成

趋势分析

  • 月度趋势折线图
  • 季度对比柱状图
  • 年度对比图

五、实施计划

阶段一基础数据增强1 周)

  • 更新科室类型枚举
  • 更新指标模型和 schema
  • 创建指标模板导入功能
  • 前端指标管理页面增强

阶段二统计报表开发2 周)

  • BSC 维度分析 API
  • 科室绩效统计 API
  • 趋势分析 API
  • 前端报表页面开发

阶段三工资核算功能1 周)

  • 绩效系数配置
  • 工资自动计算
  • 工资记录管理
  • 工资条导出

阶段四满意度调查1 周)

  • 调查管理 API
  • 移动端调查页面
  • 满意度统计

阶段五测试与优化1 周)

  • 单元测试
  • 集成测试
  • 性能优化
  • 文档完善

六、关键代码实现

6.1 指标模板导入服务

class IndicatorTemplateService:
    @staticmethod
    async def import_template(
        db: AsyncSession,
        template_data: dict,
        overwrite: bool = False
    ) -> int:
        """导入指标模板"""
        dept_type = template_data['dept_type']
        indicators = template_data['indicators']
        created_count = 0
        
        for ind_data in indicators:
            # 检查是否已存在
            existing = await db.execute(
                select(Indicator).where(
                    Indicator.code == ind_data['code']
                )
            )
            
            if existing.scalar_one_or_none():
                if overwrite:
                    # 更新现有指标
                    ...
                continue
            
            # 创建新指标
            indicator = Indicator(**ind_data)
            db.add(indicator)
            created_count += 1
        
        await db.commit()
        return created_count

6.2 BSC 维度统计服务

class StatsService:
    @staticmethod
    async def get_bsc_dimension_stats(
        db: AsyncSession,
        department_id: int,
        period_year: int,
        period_month: int
    ) -> dict:
        """获取 BSC 维度统计"""
        dimensions = {
            'financial': {'score': 0, 'weight': 0},
            'customer': {'score': 0, 'weight': 0},
            'internal_process': {'score': 0, 'weight': 0},
            'learning_growth': {'score': 0, 'weight': 0}
        }
        
        # 查询考核详情
        result = await db.execute(
            select(
                AssessmentDetail.score,
                Indicator.weight,
                Indicator.bs_dimension
            )
            .join(Indicator)
            .join(Assessment)
            .where(
                Assessment.department_id == department_id,
                Assessment.period_year == period_year,
                Assessment.period_month == period_month
            )
        )
        
        for row in result.fetchall():
            dim = row.bs_dimension
            if dim in dimensions:
                dimensions[dim]['score'] += row.score * row.weight
                dimensions[dim]['weight'] += row.weight
        
        # 计算各维度得分
        for dim in dimensions.values():
            if dim['weight'] > 0:
                dim['average'] = dim['score'] / dim['weight']
        
        return dimensions

6.3 工资计算服务

class SalaryService:
    @staticmethod
    async def calculate_salary(
        db: AsyncSession,
        staff_id: int,
        period_year: int,
        period_month: int
    ) -> dict:
        """计算员工工资"""
        # 获取员工信息
        staff = await StaffService.get_by_id(db, staff_id)
        
        # 获取考核得分
        assessment = await AssessmentService.get_by_staff_and_period(
            db, staff_id, period_year, period_month
        )
        
        if not assessment:
            return None
        
        # 获取绩效系数
        coeff = await PerformanceCoefficientService.get_coefficient(
            db, staff_id, period_year, period_month
        )
        
        # 计算绩效奖金
        base_salary = float(staff.base_salary)
        performance_score = assessment.total_score
        performance_ratio = float(staff.performance_ratio) * coeff
        
        # 绩效奖金 = 基本工资 × (绩效得分/100) × 绩效系数
        performance_bonus = base_salary * (performance_score / 100) * performance_ratio
        
        # 获取奖惩记录
        bonus_penalty = await BonusPenaltyService.get_total(
            db, staff_id, period_year, period_month
        )
        
        # 应发工资 = 基本工资 + 绩效奖金 + 奖励 - 扣款
        total_salary = base_salary + performance_bonus + bonus_penalty.get('reward', 0) - bonus_penalty.get('punishment', 0)
        
        return {
            'base_salary': base_salary,
            'performance_score': performance_score,
            'performance_ratio': performance_ratio,
            'performance_bonus': performance_bonus,
            'reward': bonus_penalty.get('reward', 0),
            'punishment': bonus_penalty.get('punishment', 0),
            'total_salary': total_salary
        }

七、测试计划

7.1 单元测试

  • 服务层方法测试
  • API 接口测试
  • 数据验证测试

7.2 集成测试

  • 考核流程测试
  • 工资计算测试
  • 报表统计测试

7.3 性能测试

  • 大数据量查询测试
  • 并发访问测试
  • 工资批量计算测试

八、部署方案

8.1 开发环境

  • SQLite 数据库
  • 热重载模式
  • 详细日志

8.2 生产环境

  • PostgreSQL 数据库
  • Nginx 反向代理
  • Gunicorn/Uvicorn workers
  • Redis 缓存
  • 日志轮转

8.3 备份策略

  • 数据库每日备份
  • 配置文件版本控制
  • 日志归档保存