import 'package:fis_jsonrpc/services/diagnosis.m.dart';
import 'package:vitalapp/managers/interfaces/diagnosis.dart';
import 'package:vitalapp/rpc.dart';
import 'package:vitalapp/store/store.dart';

class DiagnosisManager implements IDiagnosisManager {
  DiagnosisManager();

  /// 创建健康检测
  @override
  Future<String> createDiagnosisAsync(createDiagnosis) async {
    createDiagnosis.token = Store.user.token;
    return await rpc.diagnosis.createDiagnosisAsync(createDiagnosis);
  }

  @override
  Future<List<DiagnosisAggregationRecord>?> getDiagnosisAggregationPageAsync(
      String patientCode) async {
    var request = DiagnosisPageRequest(
        token: Store.user.token,
        pageIndex: 1,
        pageSize: 20,
        patientCode: patientCode);
    var result = await rpc.diagnosis.getDiagnosisAggregationPageAsync(request);
    return result.pageData?.toList();
  }
}
