dictionary.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import 'package:fis_jsonrpc/services/dictionary.m.dart';
  2. import 'package:vitalapp/managers/interfaces/dictionary.dart';
  3. import 'package:vitalapp/rpc.dart';
  4. import 'package:vitalapp/store/store.dart';
  5. class DictionaryManager implements IDictionaryManager {
  6. DictionaryManager();
  7. @override
  8. Future<List<DictionaryWithUnitDTO>?> getDictionaryNameAndUnitByKeysAsync(
  9. List<String> keys) async {
  10. var request = GetDictionaryNameAndUnitByKeysRequest(
  11. keys: keys,
  12. token: Store.user.token,
  13. );
  14. var result =
  15. await rpc.dictionary.getDictionaryNameAndUnitByKeysAsync(request);
  16. return result;
  17. }
  18. ///根据key返回单位
  19. @override
  20. String getUnitByKey(String key) {
  21. switch (key) {
  22. case 'Temperature':
  23. return "°C";
  24. case 'sugar':
  25. return 'mmol/l';
  26. case 'Pulse_Frequency':
  27. return 'bpm';
  28. case 'Spo2':
  29. return '%';
  30. case 'Height':
  31. return 'cm';
  32. case 'Weight':
  33. return 'kg';
  34. case 'Bmi':
  35. return 'kg/m²';
  36. case "HEART":
  37. case "Pulse_Beat":
  38. return 'bpm';
  39. case 'Sbp':
  40. case 'Dbp':
  41. return 'mmgh';
  42. }
  43. return '';
  44. }
  45. }