follow_up.dart 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import 'package:fis_jsonrpc/rpc.dart';
  2. import 'package:vitalapp/managers/interfaces/follow_up.dart';
  3. import 'package:vitalapp/rpc.dart';
  4. import 'package:vitalapp/store/store.dart';
  5. import 'package:fis_common/logger/logger.dart';
  6. class FollowUpManager implements IFollowUpManager {
  7. @override
  8. Future<String> createFollowUp(CreateFollowUpRequest examRequest) async {
  9. try {
  10. examRequest.token = Store.user.token;
  11. final examCode = await rpc.vitalFollowUp.createFollowUpAsync(
  12. examRequest,
  13. );
  14. return examCode;
  15. } catch (e) {
  16. logger.e("DoctorManager sync user info error.", e);
  17. return '';
  18. }
  19. }
  20. @override
  21. Future<bool?> updateFollowUp(UpdateFollowUpRequest followRequest) async {
  22. try {
  23. followRequest.token = Store.user.token;
  24. final result = await rpc.vitalFollowUp.updateFollowUpAsync(
  25. followRequest,
  26. );
  27. return result;
  28. } catch (e) {
  29. logger.e("FollowUpManager sync user info error.", e);
  30. return null;
  31. }
  32. }
  33. @override
  34. Future<List<FollowUpDTO>?> getFollowUpPage(
  35. FollowUpPageRequest followUpPageRequest) async {
  36. try {
  37. followUpPageRequest.token = Store.user.token;
  38. final result = await rpc.vitalFollowUp.getFollowUpPageAsync(
  39. followUpPageRequest,
  40. );
  41. return result.pageData;
  42. } catch (e) {
  43. logger.e("DoctorManager sync user info error.", e);
  44. return null;
  45. }
  46. }
  47. @override
  48. Future<List<FollowUpRecordDTO>?> getFollowUpRecordList(
  49. List<String> keys, String patientCode) async {
  50. try {
  51. var request = GetFollowUpRecordListRequest(
  52. keys: keys, patientCode: patientCode, token: Store.user.token);
  53. final result =
  54. await rpc.vitalFollowUp.getFollowUpRecordListAsync(request);
  55. return result;
  56. } catch (e) {
  57. return null;
  58. }
  59. }
  60. @override
  61. Future<List<FollowUpRecordDTO>?> getFollowUpRecordListByYearAsync(
  62. GetFollowUpRecordListByYearRequest
  63. followUpRecordListByYearRequest) async {
  64. try {
  65. followUpRecordListByYearRequest.token = Store.user.token;
  66. final result = await rpc.vitalFollowUp
  67. .getFollowUpRecordListByYearAsync(followUpRecordListByYearRequest);
  68. return result;
  69. } catch (e) {
  70. return null;
  71. }
  72. }
  73. }