import { Component } from '@angular/core';
import { NavController } from '@ionic/angular';
import { ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-consultation',
  templateUrl: 'consultation.page.html',
  styleUrls: ['consultation.page.scss']
})
export class ConsultationPage {
  constructor(private navCtrl: NavController, private route: ActivatedRoute) {}
  selectedDoctor: any;

  // 示例专家列表
  experts = [
    {
      avatar: '../../assets/images/doctor.png',
      name: '张医生',
      specialty: '心血管科'
    },
    {
      avatar: '../../assets/images/doctor.png',
      name: '李医生',
      specialty: '神经科'
    },
    {
      avatar: '../../assets/images/doctor.png',
      name: '王医生',
      specialty: '儿科'
    },
    {
      avatar: '../../assets/images/doctor.png',
      name: '赵医生',
      specialty: '外科'
    },
    {
      avatar: '../../assets/images/doctor.png',
      name: '陈医生',
      specialty: '内科'
    }
  ];

  // 示例方法：返回上一页
  goBack() {
    this.navCtrl.back();
  }
  ngOnInit() {
    // 获取传递过来的医生信息
    this.route.data.subscribe((data: any) => {
      this.selectedDoctor = data.state?.doctor;
      if (this.selectedDoctor) {
        console.log('Selected Doctor:', this.selectedDoctor);
      }
    });
  }

}