#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re print("修复health_11的结构...") # 读取文件 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_health11_fix', 'w', encoding='utf-8') as f: f.write(content) # 找到health_11的开始和结束 health11_start = content.find('"id": "health_11"') if health11_start == -1: print("未找到health_11") exit(1) # 找到industries数组结束 industries_end = content.find('];', health11_start) # 获取health_11的内容 health11_content = content[health11_start:industries_end] # 移除所有错误位置的questions # 1. 找到所有positions positions_matches = list(re.finditer(r'"id":\s*"health_11_\d+"', health11_content)) # 提取所有position对象 positions = [] for i, match in enumerate(positions_matches): start = match.start() # 找到这个position的结束(下一个position的开始或positions数组结束) if i < len(positions_matches) - 1: end = positions_matches[i + 1].start() else: # 最后一个position,找到它的结束 # 查找requirements数组结束后的'}' req_end = health11_content.find('"requirements":', start) if req_end > 0: # 找到requirements数组的结束 bracket_start = health11_content.find('[', req_end) bracket_end = health11_content.find(']', bracket_start) # position对象的结束是']'后的'}' pos_end = health11_content.find('}', bracket_end) end = pos_end + 1 else: end = len(health11_content) position_obj = health11_content[start:end] # 移除position内的questions(如果有) if '"questions":' in position_obj: # 找到requirements的结束 req_end_match = re.search(r'"requirements":\s*\[[^\]]*?\]', position_obj) if req_end_match: # 保留到requirements结束 clean_position = position_obj[:req_end_match.end()] # 查找position对象原本的结束'}' remaining = position_obj[req_end_match.end():] # 跳过questions内容,找到属于position的'}' # 这需要计算括号平衡 clean_position += '\n }' else: clean_position = position_obj else: clean_position = position_obj positions.append(clean_position) # 重建health_11对象 health11_new = ''' { "id": "health_11", "name": "药物研发", "positions": [ ''' # 添加所有positions health11_new += ',\n '.join(positions) # 关闭positions数组 health11_new += ''' ], "questions": [ { "id": "group_q1", "question": "二、生物制药特性", "subQuestions": [ { "id": "q1", "question": "生物药物有哪些化学与生物学特性?", "answer": "生物药物的化学本质可以是蛋白质、多肽、抗体或核酸,分子量大多在数万到数十万之间。它们的稳定性受温度、湿度、光照影响,需要在冷链或特定环境下保存;溶解性与分子量、荷电状态相关;药代动力学则取决于分子大小与代谢通路。" }, { "id": "q2", "question": "体液调控药物有哪些作用?", "answer": "体液调控药物包括胰岛素(调控血糖)、血液制品(如白蛋白、免疫球蛋白)、促红细胞生成素(刺激红细胞生成)和脂肪因子(调节脂质代谢)。这些药物通过补充或调节人体内源性活性物质,实现代谢平衡、免疫增强和生理调控。" }, { "id": "q3", "question": "生物制药中的主要产品有哪些?", "answer": "生物制药主要产品包括:治疗性蛋白(如胰岛素、生长激素);单克隆抗体(如抗肿瘤药物);疫苗(如重组疫苗);血液制品(如凝血因子);细胞与基因治疗产品(如CAR-T)。这些产品广泛应用于肿瘤、免疫、代谢疾病治疗。" } ] }, { "id": "group_q2", "question": "三、药理学特性", "subQuestions": [ { "id": "q4", "question": "生物制药的药理学特性是什么?", "answer": "生物制药的药理学特性包括:高特异性(作用于特定靶点或受体);低毒性(较少产生非特异性反应);免疫原性(可能引起抗药抗体);药代动力学复杂(代谢途径多样化);给药途径受限(多为注射给药)。理解这些特性对药物研发至关重要。" }, { "id": "q5", "question": "生物药物的清除途径有哪些?", "answer": "生物药物主要通过以下途径清除:肾脏滤过(小分子蛋白);肝脏代谢(酶解作用);网状内皮系统吞噬(大分子药物);受体介导的内吞(抗体类);蛋白酶降解(多肽类)。不同药物的清除机制影响其半衰期和给药频率设计。" }, { "id": "q6", "question": "如何评价生物药物的安全性?", "answer": "生物药物安全性评价包括:免疫原性测试(抗药抗体检测);毒理学研究(急性、慢性毒性);生殖毒性评估;致癌性试验;过敏反应监测;细胞因子释放综合征评估。这些评价需遵循ICH等国际指南,确保临床应用安全。" } ] }, { "id": "group_q3", "question": "四、生物药物分类", "subQuestions": [ { "id": "q7", "question": "常见的生物药物类型有哪些?", "answer": "常见生物药物包括:重组蛋白药物(如干扰素、EPO);单克隆抗体(如贝伐珠单抗);融合蛋白(如依那西普);多肽激素(如GLP-1类似物);疫苗(如HPV疫苗);基因治疗药物;细胞治疗产品。每类药物都有独特的作用机制和临床应用。" }, { "id": "q8", "question": "抗体药物的作用机制有哪些?", "answer": "抗体药物作用机制包括:直接中和(阻断配体-受体结合);ADCC效应(抗体依赖的细胞毒性);CDC效应(补体依赖的细胞毒性);信号传导阻断;免疫检查点抑制;药物偶联递送。这些机制使抗体药物在肿瘤、自身免疫疾病治疗中发挥重要作用。" }, { "id": "q9", "question": "核酸类药物的发展现状如何?", "answer": "核酸药物包括DNA和RNA类,已在疫苗(如mRNA新冠疫苗)、基因治疗(CRISPR相关药物)中广泛应用。虽然在稳定性、递送效率方面仍存在挑战,但发展前景广阔。" } ] } ] }''' # 替换原内容 content_before = content[:health11_start] content_after = content[industries_end:] # 查找health_10的结束 health10_end = content_before.rfind('},') # 构建新内容 new_content = content_before[:health10_end + 2] + '\n' + health11_new + '\n' + content_after # 写回文件 with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f: f.write(new_content) print("✓ 修复完成!")