Files
ALL-teach_sys/frontend_大健康/merge_questions_to_single_card.py
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含12个产业的完整教务系统前端代码
- 智能启动脚本 (start-industry.sh)
- 可视化产业导航页面 (index.html)
- 项目文档 (README.md)

优化内容:
- 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB
- 添加.gitignore文件避免上传不必要的文件
- 自动依赖管理和智能启动系统

产业列表:
1. 文旅产业 (5150)
2. 智能制造 (5151)
3. 智能开发 (5152)
4. 财经商贸 (5153)
5. 视觉设计 (5154)
6. 交通物流 (5155)
7. 大健康 (5156)
8. 土木水利 (5157)
9. 食品产业 (5158)
10. 化工产业 (5159)
11. 能源产业 (5160)
12. 环保产业 (5161)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:14:14 +08:00

198 lines
7.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
print("合并面试题到单个卡片...")
# 读取大健康岗位简历数据
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/网页未导入数据/大健康产业/大健康岗位简历.json', 'r', encoding='utf-8') as f:
health_data = json.load(f)
# 备份当前文件
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js.backup_before_merge', 'w', encoding='utf-8') as f:
f.write(content)
# 读取当前的mock数据
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data_full.json', 'r', encoding='utf-8') as f:
mock_data = json.load(f)
# 按岗位群分组,提取完整面试题
position_groups = {}
for item in health_data:
group_name = item['简历岗位群']
if group_name not in position_groups:
position_groups[group_name] = {
'positions': [],
'questions_content': item.get('面试题内容', ''),
'questions_title': item.get('面试题', '')
}
# 岗位群ID映射
group_id_map = {
'健康管理': 'health_management',
'健康检查': 'health_check',
'康复治疗': 'rehabilitation',
'慢性病管理': 'chronic_disease',
'轻医美': 'medical_beauty',
'社群运营': 'community_operation',
'心理健康': 'mental_health',
'药品供应链管理': 'pharma_supply',
'药品生产': 'pharma_production',
'药品质量检测': 'pharma_quality',
'药物研发': 'pharma_research'
}
# 解析面试题内容 - 将所有问题合并到一个卡片
def parse_questions_single_card(content, group_id, group_name, questions_title):
if not content:
return [{
'id': f"{group_id}_q1",
'question': f"{group_name}岗位群面试题",
'subQuestions': [
{
'id': 'q1',
'question': f"您如何理解{group_name}工作的核心要点?",
'answer': f"{group_name}工作需要专业知识、实践经验和良好的沟通能力。"
},
{
'id': 'q2',
'question': f"{group_name}领域,您认为最重要的技能是什么?",
'answer': f"最重要的是专业技术能力、团队协作能力和持续学习能力。"
},
{
'id': 'q3',
'question': f"您为什么选择{group_name}这个职业方向?",
'answer': f"我对{group_name}领域充满热情,希望在这个领域深耕发展。"
}
]
}]
all_sub_questions = []
q_counter = 1
# 提取所有大类问题
sections = re.findall(r'#\s*([一二三四五六七八九十]+、[^\n]+)\n(.*?)(?=#\s*[一二三四五六七八九十]+、|$)', content, re.DOTALL)
for section_idx, (section_title, section_content) in enumerate(sections):
# 先添加一个大类标题作为问题(不需要答案)
all_sub_questions.append({
'id': f'q{q_counter}',
'question': section_title.strip(),
'answer': '' # 大类标题没有答案
})
q_counter += 1
# 提取该大类下的具体问题和答案
q_pattern = r'(\d+\.\s*[^\n]+)\n\s*示例答案[:]\s*\n(.*?)(?=\d+\.|#|$)'
questions_match = re.findall(q_pattern, section_content, re.DOTALL)
for question_text, answer_text in questions_match:
# 清理问题和答案文本
question_clean = question_text.strip()
answer_clean = answer_text.strip()
all_sub_questions.append({
'id': f'q{q_counter}',
'question': question_clean,
'answer': answer_clean
})
q_counter += 1
# 创建单个面试题卡片,包含所有问题
card_title = questions_title if questions_title else f"{group_name}岗位群面试题"
return [{
'id': f"{group_id}_q1",
'question': card_title,
'subQuestions': all_sub_questions
}]
# 更新industries中的questions - 每个岗位群只有一个面试题卡片
for industry in mock_data['industries']:
group_name = industry['name']
if group_name in position_groups:
questions_content = position_groups[group_name]['questions_content']
questions_title = position_groups[group_name]['questions_title']
# 生成单个卡片包含所有面试题
single_card_questions = parse_questions_single_card(
questions_content,
industry['id'],
group_name,
questions_title
)
industry['questions'] = single_card_questions
total_questions = len(single_card_questions[0]['subQuestions']) if single_card_questions else 0
print(f"{group_name}: 1个卡片包含 {total_questions} 个问题")
# 将更新后的数据转换为JavaScript格式
industries_js = json.dumps(mock_data['industries'], ensure_ascii=False, indent=2)
resumeTemplates_js = json.dumps(mock_data['resumeTemplates'], ensure_ascii=False, indent=2)
# 创建新的Mock文件内容
new_content = f"""// 简历与面试题Mock数据
// 岗位群列表
const industries = {industries_js};
// 简历模板数据
const resumeTemplates = {resumeTemplates_js};
// 我的简历数据
const myResume = {{
personalInfo: {{
name: "张三",
phone: "138****8888",
email: "zhangsan@example.com",
age: 25,
education: "苏州信息职业技术学院 2020.9-2023.6",
experience: "2年",
location: "北京"
}},
workExperience: [
{{
company: "某健康管理公司",
position: "健康管理师",
duration: "2022.03-2024.01",
description: "负责健康评估和健康管理方案制定工作"
}}
],
skills: ["健康评估", "健康管理", "数据分析", "客户服务"],
projects: [
{{
name: "企业员工健康管理项目",
role: "健康管理师",
duration: "2023.05-2023.12",
description: "负责企业员工的健康评估和管理方案制定"
}}
]
}};
// 获取页面mock数据的函数
export function getMockPageData() {{
return resumeInterviewMockData;
}}
// 导出合并的数据
export const resumeInterviewMockData = {{
industries,
resumeTemplates,
myResume
}};
"""
# 写入新内容
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(new_content)
print("\n✓ 面试题合并完成!")
print(" - 每个岗位群现在只有一个面试题卡片")
print(" - 所有面试题内容都在这一个卡片中")
print(" - 原文件已备份为 resumeInterviewMock.js.backup_before_merge")