162 lines
5.9 KiB
Python
162 lines
5.9 KiB
Python
|
|
#!/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)
|
|||
|
|
|
|||
|
|
# 按岗位群分组
|
|||
|
|
position_groups = {}
|
|||
|
|
for item in health_data:
|
|||
|
|
group_name = item['简历岗位群']
|
|||
|
|
if group_name not in position_groups:
|
|||
|
|
position_groups[group_name] = []
|
|||
|
|
position_groups[group_name].append(item)
|
|||
|
|
|
|||
|
|
# 创建岗位群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'
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 生成industries数组
|
|||
|
|
industries = []
|
|||
|
|
for idx, (group_name, items) in enumerate(position_groups.items(), 1):
|
|||
|
|
group_id = group_id_map.get(group_name, f'health_{idx}')
|
|||
|
|
|
|||
|
|
# 创建岗位群对象
|
|||
|
|
industry = {
|
|||
|
|
'id': group_id,
|
|||
|
|
'name': group_name,
|
|||
|
|
'positions': [],
|
|||
|
|
'questions': []
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 处理该岗位群的所有岗位
|
|||
|
|
position_idx = 1
|
|||
|
|
questions_added = False
|
|||
|
|
|
|||
|
|
for item in items:
|
|||
|
|
# 添加岗位
|
|||
|
|
position = {
|
|||
|
|
'id': f"{group_id}_{position_idx}",
|
|||
|
|
'title': item['岗位名称'],
|
|||
|
|
'level': item['岗位等级标签'],
|
|||
|
|
'department': group_name,
|
|||
|
|
'type': '全职',
|
|||
|
|
'experience': '1-3年',
|
|||
|
|
'education': '大专',
|
|||
|
|
'salary': '6-10K',
|
|||
|
|
'location': '北京',
|
|||
|
|
'updateTime': '2024-01-20',
|
|||
|
|
'description': f"{item['岗位名称']}职位描述",
|
|||
|
|
'requirements': [
|
|||
|
|
f"熟悉{group_name}相关工作",
|
|||
|
|
"具有良好的沟通能力",
|
|||
|
|
"有相关工作经验优先"
|
|||
|
|
]
|
|||
|
|
}
|
|||
|
|
industry['positions'].append(position)
|
|||
|
|
position_idx += 1
|
|||
|
|
|
|||
|
|
# 添加面试题(只添加一次)
|
|||
|
|
if not questions_added and item.get('面试题内容'):
|
|||
|
|
# 解析面试题内容
|
|||
|
|
content = item['面试题内容']
|
|||
|
|
|
|||
|
|
# 提取大类问题
|
|||
|
|
sections = re.findall(r'#\s*([一二三四五六七八九十]+、[^\\n]+)\\n(.*?)(?=#\s*[一二三四五六七八九十]+、|$)', content, re.DOTALL)
|
|||
|
|
|
|||
|
|
if sections:
|
|||
|
|
for section_idx, (section_title, section_content) in enumerate(sections, 1):
|
|||
|
|
# 提取具体问题
|
|||
|
|
questions = re.findall(r'(\d+\.\s*[^\\n]+)\\n\\s*示例答案[::]\\n(.*?)(?=\\d+\.|$)', section_content, re.DOTALL)
|
|||
|
|
|
|||
|
|
if questions:
|
|||
|
|
subQuestions = []
|
|||
|
|
for q_idx, (question_text, answer_text) in enumerate(questions, 1):
|
|||
|
|
subQuestions.append({
|
|||
|
|
'id': f'q{q_idx}',
|
|||
|
|
'question': question_text.strip(),
|
|||
|
|
'answer': answer_text.strip()
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
if subQuestions:
|
|||
|
|
industry['questions'].append({
|
|||
|
|
'id': f"{group_id}_q{section_idx}",
|
|||
|
|
'question': section_title.strip(),
|
|||
|
|
'subQuestions': subQuestions[:3] # 只取前3个问题
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
questions_added = True
|
|||
|
|
|
|||
|
|
# 如果没有面试题,添加默认的
|
|||
|
|
if not industry['questions']:
|
|||
|
|
industry['questions'].append({
|
|||
|
|
'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}领域充满热情,希望在这个领域深耕发展。"
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
industries.append(industry)
|
|||
|
|
|
|||
|
|
# 生成resumeTemplates对象
|
|||
|
|
resumeTemplates = {}
|
|||
|
|
for group_name, items in position_groups.items():
|
|||
|
|
templates = []
|
|||
|
|
for item in items:
|
|||
|
|
template = {
|
|||
|
|
'position': item['岗位名称'],
|
|||
|
|
'level': item['岗位等级标签'],
|
|||
|
|
'content': {
|
|||
|
|
'original': item['简历内容'],
|
|||
|
|
'modified': item['简历内容'] # 使用相同内容作为modified版本
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
templates.append(template)
|
|||
|
|
resumeTemplates[group_name] = templates
|
|||
|
|
|
|||
|
|
# 保存转换后的数据
|
|||
|
|
output = {
|
|||
|
|
'industries': industries,
|
|||
|
|
'resumeTemplates': resumeTemplates
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data.json', 'w', encoding='utf-8') as f:
|
|||
|
|
json.dump(output, f, ensure_ascii=False, indent=2)
|
|||
|
|
|
|||
|
|
print(f"\n✓ 数据转换完成!")
|
|||
|
|
print(f" - 生成了 {len(industries)} 个岗位群")
|
|||
|
|
print(f" - 总计 {sum(len(ind['positions']) for ind in industries)} 个岗位")
|
|||
|
|
print(f" - 数据已保存到 health_mock_data.json")
|
|||
|
|
print("\n下一步:将生成的数据替换到 resumeInterviewMock.js 中")
|