scanning_image.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:fis_common/logger/logger.dart';
  2. import 'package:fis_jsonrpc/rpc.dart';
  3. import 'package:vitalapp/managers/interfaces/base_manager.dart';
  4. import 'package:vitalapp/managers/interfaces/scanning_image.dart';
  5. import 'package:vitalapp/rpc.dart';
  6. import 'package:vitalapp/store/store.dart';
  7. class ScanningImage extends BaseManager implements IScanningImage {
  8. ///需区分杏聆荟和健康平台
  9. @override
  10. Future<bool> startScan(String recordCode) async {
  11. bool result = false;
  12. try {
  13. result = await rpc.recordInfo
  14. .startCollectingImgAsync(StartCollectingImgRequest(
  15. recordCode: recordCode,
  16. token: Store.user.token,
  17. isVital: true,
  18. ));
  19. } catch (e) {
  20. logger.e("ScanningImage startScan ex:", e);
  21. }
  22. return result;
  23. }
  24. ///检查采图是否空闲
  25. @override
  26. Future<bool> checkCollectingImgAsync() async {
  27. bool result = false;
  28. try {
  29. result = await rpc.recordInfo
  30. .checkCollectingImgAsync(CheckCollectingImgRequest(
  31. token: Store.user.token,
  32. isVital: true,
  33. ));
  34. } catch (e) {
  35. logger.e("ScanningImage checkCollectingImgAsync ex:", e);
  36. }
  37. return result;
  38. }
  39. @override
  40. Future<RecordInfoDTO> getVitalRecordByPhysicalExamNumberAsync(
  41. String physicalExamNumber) async {
  42. return rpc.vitalHealthExamBooking.getVitalRecordByPhysicalExamNumberAsync(
  43. GetVitalRecordByPhysicalExamNumberRequest(
  44. physicalExamNumber: physicalExamNumber,
  45. token: token,
  46. ));
  47. }
  48. @override
  49. Future<bool> endScan(String recordCode) async {
  50. final finishRecordAsync = await rpc.recordInfo.finishRecordAsync(
  51. FinishRecordRequest(
  52. recordCode: recordCode,
  53. token: Store.user.token,
  54. isVital: true,
  55. ),
  56. );
  57. return finishRecordAsync;
  58. }
  59. }