entry_manager.dart 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import 'package:fis_common/logger/logger.dart';
  2. import 'package:fis_i18n/i18n.dart';
  3. import 'package:fis_jsonrpc/rpc.dart';
  4. import 'package:vitalapp/rpc.dart';
  5. import 'interfaces/base_manager.dart';
  6. import 'interfaces/entry.dart';
  7. class EntryManager extends BaseManager implements IEntryManager {
  8. ///获取词条库分页
  9. @override
  10. Future<List<ThesaurusDTO>> getThesaurusPage({String keyword = ''}) async {
  11. try {
  12. final getThesaurusPage =
  13. await rpc.ultrasoundReport.vitalGetThesaurusPageAsync(
  14. GetThesaurusPageRequest(
  15. token: token,
  16. pageIndex: 1,
  17. pageSize: 100,
  18. thesaurusName: keyword,
  19. languageCode: i18nBook.locale.toCodeString('-'),
  20. ),
  21. );
  22. return getThesaurusPage.pageData ?? <ThesaurusDTO>[];
  23. } catch (e) {
  24. logger.e("EntryManager getThesaurusPage ex:$e");
  25. return <ThesaurusDTO>[];
  26. }
  27. }
  28. @override
  29. Future<List<ThesaurusItemDTO>> getThesaurusItems({
  30. String? thesaurusCode,
  31. String? keyword,
  32. }) async {
  33. return await rpc.ultrasoundReport
  34. .vitalGetThesaurusItemsAsync(GetThesaurusItemsRequest(
  35. thesaurusCode: thesaurusCode,
  36. keyword: keyword,
  37. token: token,
  38. ));
  39. }
  40. }