123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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<ReportTemplateDTO> getDefaultTemplate() async {
- final result = await rpc.ultrasoundReport
- .vitalGetDefaultReportTemplateContentAsync(
- GetDefaultReportTemplateContentRequest(
- token: token,
- languageCode: i18nBook.locale.toCodeString('-'),
- ));
- return result;
- }
- @override
- Future<PageResult<ReportTemplateDTO>> 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<ReportTemplateDTO>();
- }
- }
- @override
- Future<PageResult<ReportTemplateDTO>> 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<ReportTemplateDTO> findReportTemplateByCode({String code = ''}) {
- return rpc.ultrasoundReport
- .vitalFindReportTemplateByCodeAsync(FindReportTemplateByCodeRequest(
- token: token,
- languageCode: i18nBook.locale.toCodeString('-'),
- reportTemplateCode: code,
- ));
- }
- }
|