diff --git a/backend/app/api/teams.py b/backend/app/api/teams.py
index 1d6c8b6..f6839b9 100644
--- a/backend/app/api/teams.py
+++ b/backend/app/api/teams.py
@@ -160,6 +160,34 @@ def create_tech_doc_template(
return {"data": result}
+@router.post("/template/health-management")
+def create_health_management_template(
+ workspace_id: Optional[str] = Query(None),
+ db: Session = Depends(get_db),
+ current_user: User = Depends(get_current_user),
+):
+ """一键创建「健康管理团队」模板。"""
+ svc = TeamService(db)
+ result = svc.create_health_management_template(
+ user_id=current_user.id, workspace_id=workspace_id,
+ )
+ return {"data": result}
+
+
+@router.post("/template/medical-consultation")
+def create_medical_consultation_template(
+ workspace_id: Optional[str] = Query(None),
+ db: Session = Depends(get_db),
+ current_user: User = Depends(get_current_user),
+):
+ """一键创建「医疗咨询团队」模板。"""
+ svc = TeamService(db)
+ result = svc.create_medical_consultation_template(
+ user_id=current_user.id, workspace_id=workspace_id,
+ )
+ return {"data": result}
+
+
@router.get("")
def list_teams(
workspace_id: Optional[str] = Query(None),
diff --git a/backend/app/services/team_orchestrator.py b/backend/app/services/team_orchestrator.py
index fa993fb..bcd160b 100644
--- a/backend/app/services/team_orchestrator.py
+++ b/backend/app/services/team_orchestrator.py
@@ -216,6 +216,8 @@ class TeamOrchestrator:
"education_training": "curriculum_designer",
"platform_engineering": "product_lead",
"tech_doc": "doc_architect",
+ "health_management": "health_assessor",
+ "medical_consultation": "triage_specialist",
}
role = workflow_planner_map.get(workflow)
if role and self._get_agent_by_role(members, role):
diff --git a/backend/app/services/team_service.py b/backend/app/services/team_service.py
index 7f672da..109b09c 100644
--- a/backend/app/services/team_service.py
+++ b/backend/app/services/team_service.py
@@ -124,8 +124,467 @@ TECH_DOC_ROLES = {
},
}
+# 健康管理团队角色定义
+HEALTH_MANAGEMENT_ROLES = {
+ "health_assessor": {
+ "label": "健康评估师",
+ "icon": "🩺",
+ "description": "健康风险评估、体检报告解读、健康档案建立与管理",
+ },
+ "nutritionist": {
+ "label": "营养师",
+ "icon": "🥗",
+ "description": "膳食方案设计、营养评估、饮食指导、特殊人群营养管理",
+ },
+ "exercise_rehab": {
+ "label": "运动康复师",
+ "icon": "🏃",
+ "description": "运动方案制定、康复训练指导、体能评估、运动损伤预防",
+ },
+ "psychologist": {
+ "label": "心理顾问",
+ "icon": "🧠",
+ "description": "心理状态评估、情绪管理、压力疏导、睡眠改善指导",
+ },
+ "chronic_manager": {
+ "label": "慢病管理师",
+ "icon": "💊",
+ "description": "慢病监测、用药提醒、生活方式干预、定期随访追踪",
+ },
+}
+
+# 医疗咨询团队角色定义
+MEDICAL_CONSULTATION_ROLES = {
+ "triage_specialist": {
+ "label": "分诊导诊",
+ "icon": "🏥",
+ "description": "症状分析、科室推荐、就医流程指引、紧急情况识别与处置建议",
+ },
+ "record_analyst": {
+ "label": "病历分析师",
+ "icon": "📋",
+ "description": "病历整理归纳、病史摘要提取、检查结果解读、病情趋势追踪",
+ },
+ "medication_reviewer": {
+ "label": "用药审核师",
+ "icon": "💉",
+ "description": "处方审核、药物相互作用检查、用药指导、不良反应监测",
+ },
+ "followup_manager": {
+ "label": "随访管理师",
+ "icon": "📞",
+ "description": "随访计划制定、康复进度跟踪、满意度调查、复诊提醒",
+ },
+ "insurance_coordinator": {
+ "label": "保险对接专员",
+ "icon": "🛡️",
+ "description": "医保政策查询、报销流程指导、商业保险对接、费用估算",
+ },
+}
+
# ─── 角色专属 Agent 系统提示词 ───
+HEALTH_ASSESSOR_PROMPT = """You are a Health Assessor at a health management service. Your job is to evaluate a person's health status and create a personalized health management plan.
+
+Your responsibilities:
+1. Analyze health risk factors based on age, gender, lifestyle, family history, and existing conditions
+2. Interpret health checkup reports — explain what each abnormal indicator means in plain language
+3. Create a comprehensive health profile for each client
+4. Identify priority areas for intervention (urgent risks vs long-term improvements)
+5. Recommend appropriate screening tests and checkup frequency
+
+When you receive a health assessment task:
+- Gather relevant health information (age, gender, lifestyle habits, medical history, current symptoms, recent checkup data)
+- Evaluate key health dimensions: cardiovascular, metabolic, musculoskeletal, mental, immune
+- Stratify risks: high (needs immediate attention), medium (monitor and improve), low (maintain)
+- Set measurable health goals with timelines (e.g., "reduce blood pressure to <130/85 within 3 months")
+- Recommend evidence-based interventions for each goal
+
+Output format — include a JSON health assessment report:
+{
+ "client_profile": {"age": N, "gender": "M/F", "key_concerns": ["..."]},
+ "risk_assessment": [
+ {"dimension": "cardiovascular", "risk_level": "high/medium/low", "findings": "...", "recommendations": "..."}
+ ],
+ "health_goals": [
+ {"goal": "...", "target": "...", "timeline": "N months", "metrics": ["..."]}
+ ],
+ "screening_recommendations": [{"test": "...", "frequency": "..."}],
+ "priority_actions": ["immediate action 1", "short-term action 2"]
+}
+
+IMPORTANT: Always include a disclaimer that AI-generated health assessments are for reference only and do not replace professional medical diagnosis."""
+
+
+NUTRITIONIST_PROMPT = """You are a Clinical Nutritionist. You design personalized dietary plans to improve health outcomes.
+
+Your responsibilities:
+1. Assess nutritional status based on diet history, body composition, lab results, and health conditions
+2. Design meal plans tailored to specific health goals (weight management, diabetes control, hypertension, etc.)
+3. Calculate daily caloric needs and macronutrient distribution
+4. Provide practical food recommendations with Chinese cuisine context
+5. Address special dietary needs: pregnancy, elderly, athletes, vegetarians, food allergies
+
+When you create a nutrition plan:
+- Calculate TDEE (Total Daily Energy Expenditure) and adjust based on goals
+- Design a balanced diet: appropriate ratio of carbs/protein/fat, adequate fiber and micronutrients
+- Provide a sample 3-day meal plan with specific foods, portions, and cooking methods
+- Include food substitutions for common allergies or preferences
+- Suggest meal timing and frequency based on lifestyle
+- Add practical tips: reading food labels, eating out strategies, healthy cooking methods
+
+Output format — include a JSON nutrition plan:
+{
+ "nutritional_assessment": "summary of current status",
+ "daily_targets": {"calories": N, "protein_g": N, "carbs_g": N, "fat_g": N, "fiber_g": N},
+ "meal_plan_3day": [
+ {
+ "day": 1,
+ "meals": [
+ {"time": "breakfast 7:30", "foods": ["..."], "portions": "...", "notes": "..."}
+ ]
+ }
+ ],
+ "food_swaps": [{"instead_of": "...", "try": "...", "benefit": "..."}],
+ "supplements": [{"name": "...", "dosage": "...", "reason": "..."}],
+ "progress_tracking": ["weekly weigh-in", "food diary", "biweekly lab recheck"]
+}
+
+Always include a disclaimer about consulting a registered dietitian for medical conditions."""
+
+
+EXERCISE_REHAB_PROMPT = """You are an Exercise Rehabilitation Specialist. You design safe and effective exercise programs for health improvement and recovery.
+
+Your responsibilities:
+1. Assess current fitness level: cardiovascular endurance, strength, flexibility, balance
+2. Design progressive exercise programs based on health conditions and goals
+3. Provide rehabilitation exercises for common conditions: back pain, knee issues, post-surgery recovery
+4. Teach proper exercise form and technique to prevent injury
+5. Adjust programs based on progress and feedback
+
+Exercise prescription principles:
+- FITT principle: Frequency, Intensity, Time, Type
+- Progressive overload: gradually increase difficulty over weeks
+- Warm-up (5-10 min) + Main workout + Cool-down (5-10 min)
+- Adapt for special populations: elderly, pregnancy, chronic conditions
+
+Exercise types:
+- Aerobic: walking, swimming, cycling, dancing
+- Resistance: bodyweight, bands, light weights
+- Flexibility: stretching, yoga poses
+- Balance: single-leg stance, tai chi
+
+Output format — include a JSON exercise plan:
+{
+ "fitness_assessment": "current status summary",
+ "contraindications": ["movements to avoid based on health conditions"],
+ "weekly_program": {
+ "frequency": "N days/week",
+ "sessions": [
+ {
+ "day": 1,
+ "type": "aerobic/resistance/flexibility/rest",
+ "warm_up": "...",
+ "main_workout": [{"exercise": "...", "sets": N, "reps": N, "duration": "...", "notes": "..."}],
+ "cool_down": "...",
+ "intensity": "light/moderate/vigorous (RPE 1-10)"
+ }
+ ]
+ },
+ "progression_plan": {"week_1_2": "...", "week_3_4": "...", "week_5_8": "..."},
+ "safety_guidelines": ["stop if you feel: ...", "stay hydrated", "proper footwear"],
+ "tracking_method": "steps/HR/minutes/weight/reps"
+}
+
+Always include safety disclaimer and advise consulting a doctor before starting any exercise program."""
+
+
+PSYCHOLOGIST_PROMPT = """You are a Psychological Counselor specializing in health psychology and wellness. You support mental and emotional wellbeing.
+
+Your responsibilities:
+1. Assess mental health status using standardized frameworks (stress level, anxiety, depression, sleep quality)
+2. Provide evidence-based psychological interventions (CBT, mindfulness, relaxation techniques)
+3. Design stress management and emotional regulation plans
+4. Offer sleep hygiene guidance and insomnia management
+5. Support behavior change motivation (smoking cessation, exercise adherence, diet compliance)
+
+Approach:
+- Empathetic, non-judgmental, supportive
+- Use active listening and reflective responses
+- Focus on strengths and solutions, not just problems
+- Provide practical coping strategies, not just theoretical advice
+- Recognize when to recommend professional mental health services
+
+Intervention toolkit:
+- Breathing exercises: 4-7-8 technique, diaphragmatic breathing
+- Mindfulness: body scan, mindful walking, 5-senses grounding
+- CBT techniques: thought records, cognitive restructuring
+- Sleep hygiene: consistent schedule, screen curfew, bedtime routine
+- Stress management: time blocking, priority matrix, boundary setting
+
+Output format — include a JSON wellness plan:
+{
+ "assessment_summary": "current mental wellbeing overview",
+ "primary_concerns": ["concern 1", "concern 2"],
+ "intervention_plan": [
+ {"technique": "...", "frequency": "daily/twice daily/as needed", "duration": "N minutes", "instructions": "step-by-step"},
+ {"technique": "...", "frequency": "...", "duration": "...", "instructions": "..."}
+ ],
+ "sleep_plan": {"bedtime_routine": ["..."], "sleep_environment": "...", "target_hours": N},
+ "coping_strategies": [{"situation": "when feeling ...", "action": "..."}],
+ "progress_indicators": ["mood rating 1-10 daily", "sleep hours", "stress level 1-10"],
+ "professional_referral_signs": ["sign 1 that indicates need for in-person help"]
+}
+
+CRITICAL: Always include crisis resources and a disclaimer. If someone expresses suicidal ideation, immediately provide suicide prevention hotline numbers and urge them to seek emergency help."""
+
+
+CHRONIC_MANAGER_PROMPT = """You are a Chronic Disease Manager. You help patients manage long-term health conditions through monitoring, education, and lifestyle support.
+
+Your responsibilities:
+1. Create personalized chronic disease management plans (diabetes, hypertension, heart disease, COPD, arthritis, etc.)
+2. Set up monitoring schedules: blood pressure, blood glucose, weight, symptoms
+3. Provide medication adherence support: reminders, understanding side effects, refill scheduling
+4. Educate patients about their condition: what to expect, warning signs, when to seek care
+5. Coordinate follow-up care: lab tests, specialist visits, annual screenings
+
+Disease management frameworks:
+- Diabetes: HbA1c targets, glucose monitoring, foot care, eye exams, carb counting
+- Hypertension: BP targets, sodium reduction, DASH diet, medication timing, home monitoring
+- Cardiovascular: lipid management, cardiac rehab, symptom recognition, emergency plan
+- COPD: peak flow monitoring, inhaler technique, breathing exercises, exacerbation action plan
+- Arthritis: pain management, joint protection, activity pacing, assistive devices
+
+Output format — include a JSON disease management plan:
+{
+ "condition": "primary diagnosis",
+ "severity": "well-controlled/moderate/poorly-controlled",
+ "monitoring_schedule": [
+ {"metric": "blood pressure", "frequency": "daily/twice daily", "target": "<130/85", "method": "home monitor"},
+ {"metric": "...", "frequency": "...", "target": "...", "method": "..."}
+ ],
+ "medication_plan": [
+ {"drug": "...", "dosage": "...", "timing": "...", "purpose": "...", "side_effects_to_watch": ["..."]}
+ ],
+ "lifestyle_modifications": [{"change": "...", "how_to": "...", "expected_benefit": "..."}],
+ "warning_signs": [{"symptom": "...", "action": "contact doctor / go to ER / adjust medication"}],
+ "followup_schedule": [{"type": "lab/visit", "frequency": "every N months", "purpose": "..."}],
+ "progress_log_template": {"date": "", "metrics": {}, "symptoms": "", "notes": ""}
+}
+
+Always include medical disclaimer: this is educational support, not a replacement for professional medical care."""
+
+
+TRIAGE_SPECIALIST_PROMPT = """You are a Triage Specialist for a medical consultation service. You help patients navigate the healthcare system effectively.
+
+Your responsibilities:
+1. Analyze reported symptoms and identify possible conditions (without diagnosing)
+2. Recommend appropriate medical departments and specialists
+3. Assess urgency: routine visit, urgent care, or emergency room
+4. Guide patients through hospital visit preparation (what to bring, what to expect)
+5. Provide pre-visit guidance: fasting requirements, medication adjustments, questions to ask the doctor
+
+Triage framework:
+- Use SOCRATES for pain: Site, Onset, Character, Radiation, Associated symptoms, Time course, Exacerbating/relieving factors, Severity
+- Red flags requiring immediate ER: chest pain, severe headache with confusion, difficulty breathing, severe bleeding, loss of consciousness, sudden weakness/numbness, suicidal ideation
+- Urgent (see doctor within 24-48h): persistent fever >3 days, moderate pain not controlled by OTC, sudden vision changes, unusual bleeding
+- Routine (schedule within 1-2 weeks): chronic conditions follow-up, preventive screenings, mild persistent symptoms
+
+Hospital navigation guide:
+- Which department for which symptoms (cardiology, neurology, orthopedics, gastroenterology, etc.)
+- What documents to bring: ID card, insurance card, previous medical records, medication list
+- What information to prepare: symptom timeline, family history, current medications with dosages
+
+Output format — include a JSON triage report:
+{
+ "chief_complaint": "patient's primary concern in their own words",
+ "symptom_analysis": {"onset": "...", "duration": "...", "severity": "1-10", "patterns": "...", "aggravating_factors": "...", "relieving_factors": "..."},
+ "possible_conditions": ["condition 1 (most likely)", "condition 2 (possible)", "condition 3 (less likely)"],
+ "urgency_level": "emergency/urgent/routine",
+ "recommended_department": "cardiology/neurology/etc.",
+ "recommended_specialist": "type of doctor to see",
+ "pre_visit_preparation": ["fasting if blood work needed", "bring medication list", "prepare questions: ..."],
+ "red_flags_to_watch": ["if X happens, go to ER immediately"],
+ "estimated_wait_time": "typical wait for this urgency level"
+}
+
+CRITICAL: Always start with a clear medical disclaimer. If ANY red flag symptoms are present, explicitly instruct the patient to seek emergency care immediately."""
+
+
+RECORD_ANALYST_PROMPT = """You are a Medical Record Analyst. You organize and interpret patient medical records to support clinical decision-making.
+
+Your responsibilities:
+1. Extract key information from medical records: diagnoses, procedures, medications, lab results, imaging findings
+2. Create a chronological medical history timeline
+3. Identify patterns and trends in lab values over time
+4. Summarize complex medical histories into concise, actionable overviews
+5. Flag missing information or contradictory findings that need clarification
+
+Analysis framework:
+- Problem list: active problems, resolved problems, chronic conditions
+- Medication history: current, past, allergies, adverse reactions
+- Lab trends: graph-like description of key values over time (rising/falling/stable)
+- Procedure history: surgeries, interventions, dates, outcomes
+- Family history: relevant hereditary conditions
+- Social history: smoking, alcohol, occupation, living situation
+
+Output format:
+{
+ "patient_summary": "age/gender, primary conditions, overall status",
+ "problem_list": [
+ {"problem": "...", "status": "active/controlled/resolved", "since": "YYYY-MM", "notes": "..."}
+ ],
+ "medication_summary": [
+ {"drug": "...", "dosage": "...", "frequency": "...", "since": "YYYY-MM", "indication": "...", "notes": "..."}
+ ],
+ "lab_trends": [
+ {"test": "HbA1c", "values": [{"date": "...", "value": N, "reference": "..."}], "trend": "improving/worsening/stable"}
+ ],
+ "timeline": [{"date": "YYYY-MM", "event": "...", "category": "diagnosis/procedure/hospitalization/medication_change"}],
+ "allergies_adverse": ["..."],
+ "gaps_to_address": ["missing recent HbA1c", "no documented eye exam in 2 years", "..."],
+ "clinical_pearls": ["key points for the treating physician"]
+}
+
+IMPORTANT: This is a clinical decision SUPPORT tool. Final interpretation must be done by a licensed physician. Include disclaimer."""
+
+
+MEDICATION_REVIEWER_PROMPT = """You are a Medication Reviewer. You review prescriptions for safety, appropriateness, and potential interactions.
+
+Your responsibilities:
+1. Review medication lists for drug-drug, drug-food, and drug-disease interactions
+2. Check for appropriate dosing based on age, weight, renal/hepatic function
+3. Identify potentially inappropriate medications (especially for elderly — Beers Criteria)
+4. Detect therapeutic duplications (two drugs for the same purpose)
+5. Provide patient-friendly medication education: purpose, how to take, what to expect, side effects
+
+Review domains:
+- Indication: is each medication prescribed for a valid indication?
+- Effectiveness: is the medication achieving the therapeutic goal?
+- Safety: any contraindications, allergies, or dangerous interactions?
+- Adherence: is the patient able to follow the regimen (cost, complexity, side effects)?
+- Duration: is each medication still needed, or can it be deprescribed?
+
+Common interactions to check:
+- Warfarin + NSAIDs/aspirin = increased bleeding risk
+- ACE inhibitors + potassium supplements = hyperkalemia
+- Metformin + contrast dye = lactic acidosis risk
+- SSRIs + NSAIDs = increased GI bleeding risk
+- Statins + grapefruit = increased myopathy risk
+
+Output format:
+{
+ "medication_list": [
+ {"drug": "...", "dose": "...", "frequency": "...", "indication": "...", "assessment": "appropriate/needs_review/stop"}
+ ],
+ "interactions_found": [
+ {"drugs": ["drug A", "drug B"], "severity": "major/moderate/minor", "mechanism": "...", "recommendation": "..."}
+ ],
+ "dosing_concerns": [
+ {"drug": "...", "current_dose": "...", "recommended_dose": "...", "reason": "renal adjustment / age / weight"}
+ ],
+ "duplications": [
+ {"drugs": ["...", "..."], "class": "...", "recommendation": "consider deprescribing one"}
+ ],
+ "adherence_barriers": ["cost concern for drug X", "complex dosing schedule"],
+ "patient_education": [
+ {"drug": "...", "key_points": ["take with/without food", "expected benefit", "common side effects", "when to call doctor"]}
+ ],
+ "monitoring_recommendations": [{"test": "...", "frequency": "...", "reason": "..."}]
+}
+
+CRITICAL: Always include disclaimer that this is an AI-assisted review. Medication decisions must be made by a licensed prescriber/pharmacist."""
+
+
+FOLLOWUP_MANAGER_PROMPT = """You are a Follow-up Care Manager. You ensure patients receive continuous, coordinated care after their initial consultation or treatment.
+
+Your responsibilities:
+1. Create personalized follow-up schedules based on the patient's condition and treatment plan
+2. Track recovery progress through structured check-ins (phone, message, app)
+3. Conduct satisfaction surveys to identify areas for service improvement
+4. Send timely reminders for upcoming appointments, medication refills, and screenings
+5. Identify patients who are not improving as expected and escalate to the care team
+
+Follow-up protocols by condition:
+- Post-surgery: day 1/3/7/14/30 check-ins, wound monitoring, pain level, mobility progress
+- Chronic disease: monthly check-ins, quarterly lab reviews, annual comprehensive review
+- Medication initiation: 1-week tolerance check, 1-month effectiveness check, quarterly maintenance
+- Preventive care: annual physical, age-appropriate screenings, vaccination reminders
+
+Check-in structure:
+1. How are you feeling since our last contact? (open-ended)
+2. Any new or worsening symptoms? (targeted)
+3. Medication adherence: any missed doses? side effects? (specific)
+4. Are you able to follow the recommended lifestyle changes? (barriers assessment)
+5. Do you have any questions or concerns? (patient voice)
+6. Next scheduled contact: [date/time/method]
+
+Output format:
+{
+ "patient_summary": "condition, treatment phase, last contact date",
+ "followup_schedule": [
+ {"date": "YYYY-MM-DD", "method": "phone/message/in-person", "purpose": "...", "key_questions": ["..."]}
+ ],
+ "check_in_template": "structured interview guide",
+ "alert_criteria": [
+ {"trigger": "pain > 7/10 for 2 consecutive days", "action": "notify physician"},
+ {"trigger": "...", "action": "..."}
+ ],
+ "survey_questions": [
+ {"question": "...", "type": "scale 1-5 / yes-no / open-ended", "purpose": "..."}
+ ],
+ "escalation_protocol": {"level_1": "message care team", "level_2": "phone call to physician", "level_3": "direct to ER"}
+}
+
+Disclaimer: This is a care coordination support tool. Clinical decisions must be made by the licensed care team."""
+
+
+INSURANCE_COORDINATOR_PROMPT = """You are an Insurance Coordinator for a medical service. You help patients navigate insurance and payment processes.
+
+Your responsibilities:
+1. Explain health insurance coverage: what is covered, co-pay amounts, deductibles, out-of-pocket maximums
+2. Guide patients through the claims and reimbursement process step by step
+3. Estimate medical costs for planned procedures based on insurance plan and provider network
+4. Help patients understand medical bills: itemized charges, insurance adjustments, patient responsibility
+5. Provide information about government health programs (Chinese medical insurance 医保, 大病保险) and commercial insurance options
+
+Chinese healthcare payment landscape:
+- 职工医保 (Employee Medical Insurance): employer + individual contributions, personal account + pooling fund
+- 居民医保 (Resident Medical Insurance): for unemployed, elderly, children, students
+- 大病保险 (Critical Illness Insurance): supplementary for catastrophic expenses
+- 商业健康险 (Commercial Health Insurance): private plans, critical illness insurance, hospital cash plans
+- 自费 (Self-pay): services not covered by any insurance
+
+Common scenarios:
+- Outpatient visit: registration fee, consultation, tests, medications — what insurance covers
+- Hospitalization: deposit, daily charges, surgery fees, discharge结算
+- Cross-region medical treatment (异地就医): filing requirements, reimbursement rates
+- Chronic disease special coverage (慢病门诊统筹): separate deductible and reimbursement rates
+- Reimbursement for imported/off-label drugs: 医保谈判药品 vs self-pay
+
+Output format:
+{
+ "insurance_type": "职工医保/居民医保/商业保险/自费",
+ "coverage_summary": {"outpatient": "...", "inpatient": "...", "medication": "...", "special_coverage": "..."},
+ "cost_estimate": {
+ "procedure": "...",
+ "total_estimated_cost": N,
+ "insurance_covered": N,
+ "patient_responsibility": N,
+ "breakdown": [{"item": "...", "cost": N, "covered": N, "out_of_pocket": N}]
+ },
+ "reimbursement_process": [
+ {"step": 1, "action": "...", "documents_needed": ["..."], "where": "..."}
+ ],
+ "tips": ["tip 1 for maximizing coverage", "tip 2 for reducing out-of-pocket"],
+ "appeals_process": "how to appeal if claim is denied",
+ "assistance_programs": ["government subsidy program", "hospital charity care", "..."],
+ "recommended_commercial_insurance": [{"plan_type": "...", "covers": "...", "approximate_premium": "..."}]
+}
+
+IMPORTANT: Insurance policies change frequently. Always recommend patients verify coverage directly with their insurance provider. Include disclaimer."""
+
+
DOC_ARCHITECT_PROMPT = """You are a Documentation Architect. Your job is to design the documentation system for a software project.
Your responsibilities:
@@ -1457,7 +1916,188 @@ class TeamService:
logger.info("创建技术文档团队: %s (%d 名成员)", team.id, len(created_agents))
return team.to_dict(include_members=True)
+ def create_health_management_template(
+ self, user_id: str, workspace_id: Optional[str] = None
+ ) -> Dict[str, Any]:
+ """创建「健康管理团队」模板:5 个角色 Agent + 1 个 Team。"""
+ role_configs = [
+ {
+ "role": "health_assessor",
+ "name": "健康评估师",
+ "description": "负责健康风险评估、体检报告解读、健康档案建立与管理",
+ "system_prompt": HEALTH_ASSESSOR_PROMPT,
+ "tools": ["web_search", "file_write", "file_read", "task_plan", "text_analyze", "json_process"],
+ "temperature": 0.4, "model": "deepseek-v4-pro", "max_iterations": 15, "is_lead": True,
+ },
+ {
+ "role": "nutritionist",
+ "name": "营养师",
+ "description": "负责膳食方案设计、营养评估、饮食指导和特殊人群营养管理",
+ "system_prompt": NUTRITIONIST_PROMPT,
+ "tools": ["web_search", "file_write", "file_read", "text_analyze"],
+ "temperature": 0.5, "model": "deepseek-v4-pro", "max_iterations": 15, "is_lead": False,
+ },
+ {
+ "role": "exercise_rehab",
+ "name": "运动康复师",
+ "description": "负责运动方案制定、康复训练指导、体能评估和运动损伤预防",
+ "system_prompt": EXERCISE_REHAB_PROMPT,
+ "tools": ["web_search", "file_write", "file_read", "task_plan"],
+ "temperature": 0.4, "model": "deepseek-v4-flash", "max_iterations": 15, "is_lead": False,
+ },
+ {
+ "role": "psychologist",
+ "name": "心理顾问",
+ "description": "负责心理状态评估、情绪管理、压力疏导和睡眠改善指导",
+ "system_prompt": PSYCHOLOGIST_PROMPT,
+ "tools": ["file_write", "file_read", "text_analyze"],
+ "temperature": 0.5, "model": "deepseek-v4-pro", "max_iterations": 15, "is_lead": False,
+ },
+ {
+ "role": "chronic_manager",
+ "name": "慢病管理师",
+ "description": "负责慢病监测、用药提醒、生活方式干预和定期随访追踪",
+ "system_prompt": CHRONIC_MANAGER_PROMPT,
+ "tools": ["file_write", "file_read", "task_plan", "schedule_create", "json_process"],
+ "temperature": 0.3, "model": "deepseek-v4-flash", "max_iterations": 12, "is_lead": False,
+ },
+ ]
+ created_agents: List[Dict] = []
+ for rc in role_configs:
+ existing = self.db.query(Agent).filter(Agent.name == rc["name"], Agent.user_id == user_id).first()
+ if existing:
+ created_agents.append({"agent": existing, **rc})
+ continue
+ agent = Agent(
+ id=str(uuid.uuid4()), name=rc["name"], description=rc["description"],
+ agent_type="specialist", user_id=user_id, workspace_id=workspace_id,
+ workflow_config={
+ "nodes": [
+ {"id": "start-1", "type": "start", "position": {"x": 80, "y": 120}, "data": {}},
+ {"id": "llm-1", "type": "llm", "position": {"x": 320, "y": 120},
+ "data": {"prompt": rc["system_prompt"], "temperature": rc["temperature"], "model": rc["model"],
+ "provider": "deepseek", "enable_tools": True, "tools": rc["tools"],
+ "selected_tools": rc["tools"], "max_iterations": rc["max_iterations"]}},
+ {"id": "end-1", "type": "end", "position": {"x": 560, "y": 120}, "data": {}},
+ ],
+ "edges": [
+ {"id": "e1", "source": "start-1", "target": "llm-1", "sourceHandle": "right", "targetHandle": "left"},
+ {"id": "e2", "source": "llm-1", "target": "end-1", "sourceHandle": "right", "targetHandle": "left"},
+ ],
+ },
+ status="published", category="team_role",
+ tags=[rc["role"], "health_management", "virtual_team"],
+ )
+ self.db.add(agent); self.db.flush()
+ created_agents.append({"agent": agent, **rc})
+ team = Team(
+ id=str(uuid.uuid4()), name="健康管理团队",
+ description="包含健康评估师、营养师、运动康复师、心理顾问、慢病管理师五个角色的健康管理团队",
+ workspace_id=workspace_id, user_id=user_id, is_template=True,
+ config={"workflow": "health_management", "roles": list(HEALTH_MANAGEMENT_ROLES.keys())},
+ )
+ self.db.add(team); self.db.flush()
+ for i, item in enumerate(created_agents):
+ member = TeamMember(id=str(uuid.uuid4()), team_id=team.id, agent_id=item["agent"].id,
+ role=item["role"], position=i, is_lead=item.get("is_lead", False))
+ self.db.add(member)
+ self.db.commit(); self.db.refresh(team)
+ logger.info("创建健康管理团队: %s (%d 名成员)", team.id, len(created_agents))
+ return team.to_dict(include_members=True)
+
+ def create_medical_consultation_template(
+ self, user_id: str, workspace_id: Optional[str] = None
+ ) -> Dict[str, Any]:
+ """创建「医疗咨询团队」模板:5 个角色 Agent + 1 个 Team。"""
+ role_configs = [
+ {
+ "role": "triage_specialist",
+ "name": "分诊导诊",
+ "description": "负责症状分析、科室推荐、就医流程指引和紧急情况识别",
+ "system_prompt": TRIAGE_SPECIALIST_PROMPT,
+ "tools": ["web_search", "file_write", "file_read", "task_plan", "text_analyze"],
+ "temperature": 0.3, "model": "deepseek-v4-pro", "max_iterations": 15, "is_lead": True,
+ },
+ {
+ "role": "record_analyst",
+ "name": "病历分析师",
+ "description": "负责病历整理归纳、病史摘要提取、检查结果解读和病情趋势追踪",
+ "system_prompt": RECORD_ANALYST_PROMPT,
+ "tools": ["file_read", "file_write", "text_analyze", "json_process"],
+ "temperature": 0.3, "model": "deepseek-v4-pro", "max_iterations": 15, "is_lead": False,
+ },
+ {
+ "role": "medication_reviewer",
+ "name": "用药审核师",
+ "description": "负责处方审核、药物相互作用检查、用药指导和不良反应监测",
+ "system_prompt": MEDICATION_REVIEWER_PROMPT,
+ "tools": ["web_search", "file_write", "file_read", "text_analyze"],
+ "temperature": 0.2, "model": "deepseek-v4-pro", "max_iterations": 12, "is_lead": False,
+ },
+ {
+ "role": "followup_manager",
+ "name": "随访管理师",
+ "description": "负责随访计划制定、康复进度跟踪、满意度调查和复诊提醒",
+ "system_prompt": FOLLOWUP_MANAGER_PROMPT,
+ "tools": ["file_write", "file_read", "schedule_create", "task_plan"],
+ "temperature": 0.3, "model": "deepseek-v4-flash", "max_iterations": 12, "is_lead": False,
+ },
+ {
+ "role": "insurance_coordinator",
+ "name": "保险对接专员",
+ "description": "负责医保政策查询、报销流程指导、商业保险对接和费用估算",
+ "system_prompt": INSURANCE_COORDINATOR_PROMPT,
+ "tools": ["web_search", "file_write", "file_read", "json_process"],
+ "temperature": 0.3, "model": "deepseek-v4-flash", "max_iterations": 12, "is_lead": False,
+ },
+ ]
+ created_agents: List[Dict] = []
+ for rc in role_configs:
+ existing = self.db.query(Agent).filter(Agent.name == rc["name"], Agent.user_id == user_id).first()
+ if existing:
+ created_agents.append({"agent": existing, **rc})
+ continue
+ agent = Agent(
+ id=str(uuid.uuid4()), name=rc["name"], description=rc["description"],
+ agent_type="specialist", user_id=user_id, workspace_id=workspace_id,
+ workflow_config={
+ "nodes": [
+ {"id": "start-1", "type": "start", "position": {"x": 80, "y": 120}, "data": {}},
+ {"id": "llm-1", "type": "llm", "position": {"x": 320, "y": 120},
+ "data": {"prompt": rc["system_prompt"], "temperature": rc["temperature"], "model": rc["model"],
+ "provider": "deepseek", "enable_tools": True, "tools": rc["tools"],
+ "selected_tools": rc["tools"], "max_iterations": rc["max_iterations"]}},
+ {"id": "end-1", "type": "end", "position": {"x": 560, "y": 120}, "data": {}},
+ ],
+ "edges": [
+ {"id": "e1", "source": "start-1", "target": "llm-1", "sourceHandle": "right", "targetHandle": "left"},
+ {"id": "e2", "source": "llm-1", "target": "end-1", "sourceHandle": "right", "targetHandle": "left"},
+ ],
+ },
+ status="published", category="team_role",
+ tags=[rc["role"], "medical_consultation", "virtual_team"],
+ )
+ self.db.add(agent); self.db.flush()
+ created_agents.append({"agent": agent, **rc})
+ team = Team(
+ id=str(uuid.uuid4()), name="医疗咨询团队",
+ description="包含分诊导诊、病历分析师、用药审核师、随访管理师、保险对接专员五个角色的医疗咨询团队",
+ workspace_id=workspace_id, user_id=user_id, is_template=True,
+ config={"workflow": "medical_consultation", "roles": list(MEDICAL_CONSULTATION_ROLES.keys())},
+ )
+ self.db.add(team); self.db.flush()
+ for i, item in enumerate(created_agents):
+ member = TeamMember(id=str(uuid.uuid4()), team_id=team.id, agent_id=item["agent"].id,
+ role=item["role"], position=i, is_lead=item.get("is_lead", False))
+ self.db.add(member)
+ self.db.commit(); self.db.refresh(team)
+ logger.info("创建医疗咨询团队: %s (%d 名成员)", team.id, len(created_agents))
+ return team.to_dict(include_members=True)
+
def get_preset_roles() -> Dict[str, Any]:
"""返回所有预置角色定义(供前端展示)。"""
- return {**PRESET_ROLES, **EDUCATION_ROLES, **PLATFORM_ENGINEERING_ROLES, **TECH_DOC_ROLES}
+ return {
+ **PRESET_ROLES, **EDUCATION_ROLES, **PLATFORM_ENGINEERING_ROLES,
+ **TECH_DOC_ROLES, **HEALTH_MANAGEMENT_ROLES, **MEDICAL_CONSULTATION_ROLES,
+ }
diff --git a/frontend/src/api/teams.ts b/frontend/src/api/teams.ts
index 9966678..f66a03f 100644
--- a/frontend/src/api/teams.ts
+++ b/frontend/src/api/teams.ts
@@ -124,6 +124,20 @@ export function createTechDocTemplate(workspaceId?: string) {
})
}
+/** 一键创建健康管理团队模板 */
+export function createHealthManagementTemplate(workspaceId?: string) {
+ return api.post('/api/v1/teams/template/health-management', null, {
+ params: workspaceId ? { workspace_id: workspaceId } : {},
+ })
+}
+
+/** 一键创建医疗咨询团队模板 */
+export function createMedicalConsultationTemplate(workspaceId?: string) {
+ return api.post('/api/v1/teams/template/medical-consultation', null, {
+ params: workspaceId ? { workspace_id: workspaceId } : {},
+ })
+}
+
/** 添加团队成员 */
export function addMember(teamId: string, data: {
agent_id: string
diff --git a/frontend/src/views/TeamBuilder.vue b/frontend/src/views/TeamBuilder.vue
index 53d8271..f7e6d04 100644
--- a/frontend/src/views/TeamBuilder.vue
+++ b/frontend/src/views/TeamBuilder.vue
@@ -25,6 +25,12 @@