Files
ALL-teach_sys/frontend_大健康/update_full_questions.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

164 lines
5.6 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)
# 读取当前的Mock数据
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_full_questions', 'w', encoding='utf-8') as f:
f.write(content)
# 读取health_mock_data.json以获取当前结构
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data.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('面试题内容', '')
}
# 岗位群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(content, group_id):
if not content:
return []
questions = []
# 提取大类问题(一、二、三等)
sections = re.findall(r'#\s*([一二三四五六七八九十]+、[^\n]+)\n(.*?)(?=#\s*[一二三四五六七八九十]+、|$)', content, re.DOTALL)
for section_idx, (section_title, section_content) in enumerate(sections, 1):
# 提取每个小问题和答案
q_pattern = r'(\d+\.\s*[^\n]+)\n\s*示例答案[:]\s*\n(.*?)(?=\d+\.|#|$)'
sub_questions_match = re.findall(q_pattern, section_content, re.DOTALL)
if sub_questions_match:
subQuestions = []
for q_idx, (question_text, answer_text) in enumerate(sub_questions_match, 1):
# 清理问题和答案文本
question_clean = question_text.strip()
answer_clean = answer_text.strip()
subQuestions.append({
'id': f'q{q_idx}',
'question': question_clean,
'answer': answer_clean
})
if subQuestions:
questions.append({
'id': f"{group_id}_q{section_idx}",
'question': section_title.strip(),
'subQuestions': subQuestions # 包含所有问题,不限制数量
})
return 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']
full_questions = parse_questions(questions_content, industry['id'])
if full_questions:
industry['questions'] = full_questions
print(f"{group_name}: 更新了 {len(full_questions)} 个大类,共 {sum(len(q['subQuestions']) for q in full_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)
# 保存更新后的JSON数据
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data_full.json', 'w', encoding='utf-8') as f:
json.dump(mock_data, f, ensure_ascii=False, indent=2)
print("\n✓ 面试题更新完成!")
print(" - 已包含完整的面试题内容")
print(" - 原文件已备份为 resumeInterviewMock.js.backup_before_full_questions")