import 'package:fis_common/event/event_type.dart';
import 'package:fis_jsonrpc/rpc.dart';

import 'entities/patient_Info.dart';

abstract class IAppointmentConsultation {
  final onDataChange = FEventHandler<bool>();

  ///分页查询会诊记录
  Future<PageResult<ConsultationPageDTO>> findConsultationsByPageAsync(
    ConsultationQueryTypeEnum consultationQueryType,
    int pageIndex,
    int pageSize, {
    String? keyword,
    DateTime? startDate,
    DateTime? endDate,
    QueryConsultationStatusEnum? consultationStatus,
    QueryEvaluateGradeEnum? evaluateGrade,
    String? language,
    List<String>? expertCodes,
    List<String>? applyOrganizationCodes,
    List<String>? expertOrganizationCodes,
    String? patientSex,
    String? patientDiseases,
    String? patientPrimaryDiagnosis,
    QueryPatientAgeLimitDTO? patientAgeLimit,
  });

  Future<ExportConsultationDataResult> exportConsultationsAsync(
    ConsultationQueryTypeEnum consultationQueryType, {
    String? keyword,
    DateTime? startDate,
    DateTime? endDate,
    QueryConsultationStatusEnum? consultationStatus,
    QueryEvaluateGradeEnum? evaluateGrade,
    String? language,
    List<String>? expertCodes,
    List<String>? applyOrganizationCodes,
    List<String>? expertOrganizationCodes,
    String? patientSex,
    String? patientDiseases,
    String? patientPrimaryDiagnosis,
    QueryPatientAgeLimitDTO? patientAgeLimit,
    bool? isExportConsultation = false,
    bool? isExportConsultationFileData = false,
    bool? isExportReport = false,
  });

  ///获取会诊评价详情
  Future<ConsultationEvaluateDTO?> getEvaluationInfo(String consultationCode);

  //根据会诊单号查询会诊中可直接切换的会诊单列表
  Future<List<ConsultationPageDTO>> findCanSwitchConsultationsAsync(
      String consultationCode);

  //打开会诊直播间
  void startConsultation(String consultationCode,
      {bool isJoin = false, int pageIndex = 1});

  //打开报告编辑页面
  void openReportEdit(String consultationCode, String patientCode);

  /// 手机端添加申请人 取消事件通知
  final FEventHandler<bool> onCancelAddedParticipant = FEventHandler<bool>();

  //获取会诊图像
  Future<List<ConsultationImagesDTO>> getConsultationImages(
      String consultationCode);

  ///添加会诊评价
  Future<bool> addConsultationEvaluateAsync(
      String consultationCode, double evaluateScore, String feedback);

  ///添加随访信息
  Future<bool> addFollowUpVisitInfo(String? phone, String patientName,
      String currentConsultationCode, String? visitRecord);

  ///获取随访信息
  Future<List<FollowUpVisitDTO>> getFollowUpVisitInfo(
      String currentConsultationCode);

  ///开启急诊
  Future<bool> startEmergencyConsultation(String selectedUser,
      String selectedDevice, String deviceCode, PatientInfo? patientInfo);
}
