import 'package:fis_common/logger/logger.dart'; import 'package:fis_i18n/i18n.dart'; import 'package:fis_jsonrpc/rpc.dart'; import 'package:vitalapp/rpc.dart'; import 'interfaces/base_manager.dart'; import 'interfaces/report_template.dart'; class ReportTemplateManager extends BaseManager implements IReportTemplateManager { @override Future getDefaultTemplate() async { final result = await rpc.ultrasoundReport .vitalGetDefaultReportTemplateContentAsync( GetDefaultReportTemplateContentRequest( token: token, languageCode: i18nBook.locale.toCodeString('-'), )); return result; } @override Future> getReportTemplatePage({ int pageIndex = 1, int pageSize = 100, String? keyword, }) async { try { var result = await rpc.ultrasoundReport.vitalGetReportTemplatePageAsync( FindReportTemplatePagesRequest( token: token, languageCode: i18nBook.locale.toCodeString('-'), reportTemplateName: keyword, pageIndex: pageIndex, pageSize: pageSize, ), ); return result; } catch (e) { logger.e('ReportTemplateManager getReportTemplatePage ex:$e'); return PageResult(); } } @override Future> getOrgReportTemplatePage({ int pageIndex = 1, int pageSize = 100, String? keyword, }) async { var result = await rpc.report.getOrgReportTemplatePageAsync( FindReportTemplatePagesRequest( token: token, languageCode: i18nBook.locale.toCodeString('-'), reportTemplateName: keyword, pageIndex: pageIndex, pageSize: pageSize, ), ); return result; } @override Future findReportTemplateByCode({String code = ''}) { return rpc.ultrasoundReport .vitalFindReportTemplateByCodeAsync(FindReportTemplateByCodeRequest( token: token, languageCode: i18nBook.locale.toCodeString('-'), reportTemplateCode: code, )); } }