mock_rpc.dart 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. import 'package:flyinsono/lab/components/classify_data_selector/classify_data_model.dart';
  2. import 'package:flyinsono/lab/mock_data/mock_data.dart';
  3. import 'package:fis_measure/interfaces/process/items/item_metas.dart';
  4. import 'package:fis_measure/configs/patient.dart';
  5. import 'package:fis_jsonrpc/rpc.dart';
  6. import 'package:fis_measure/interfaces/process/items/types.dart';
  7. class MockRPC {
  8. /// 设置网络情况
  9. static const int rpcDelayMilliseconds = excellent;
  10. /// 网络延迟预设
  11. static const int excellent = 50;
  12. static const int fast = 300;
  13. static const int slow = 2000;
  14. static const int bad = 10000;
  15. /// 获取检查图片列表
  16. static Future<List<ImageModel>> getImageListByRecordId(
  17. String recordId) async {
  18. await Future.delayed(Duration(milliseconds: rpcDelayMilliseconds));
  19. // TODO mock
  20. GlobalPatientConfig.height = 80;
  21. GlobalPatientConfig.weight = 36;
  22. GlobalPatientConfig.updateBSAbyWH();
  23. return MockData.demoVidList
  24. .map((e) => ImageModel(
  25. id: e.id,
  26. fileTypeName: e.sampleRemedicalFileDataTypeEnum ==
  27. SampleRemedicalFileDataTypeEnum.AnalysisImage
  28. ? "URMVRD"
  29. : "VRD",
  30. createTime: DateTime.now(),
  31. description: (e.id +
  32. " " +
  33. (e.sampleRemedicalFileDataTypeEnum ==
  34. SampleRemedicalFileDataTypeEnum.AnalysisImage
  35. ? "URMVRD"
  36. : "VRD") +
  37. " " +
  38. DateTime.now().toString().substring(0, 16)),
  39. vidDataInfo: e,
  40. fileDataType: e.sampleRemedicalFileDataTypeEnum,
  41. ))
  42. .toList();
  43. }
  44. }
  45. class ProjectModel extends ClassifyDataBaseModel {
  46. final String id;
  47. final ProjectType type;
  48. final String projectIntroduction;
  49. final OrganizationPatientTypeEnum organizationPatientType;
  50. ProjectModel({
  51. required this.id,
  52. required this.type,
  53. required String name,
  54. required this.projectIntroduction,
  55. required this.organizationPatientType,
  56. }) : super(name);
  57. }
  58. enum ProjectType {
  59. created,
  60. joined,
  61. }
  62. class PatientModel extends ClassifyDataBaseModel {
  63. final String id;
  64. final String fileSize;
  65. final String code;
  66. final bool isExistUrmData;
  67. PatientModel({
  68. required this.id,
  69. required this.fileSize,
  70. required this.code,
  71. required String name,
  72. required this.isExistUrmData,
  73. }) : super(name);
  74. }
  75. class RecordModel {
  76. final String id;
  77. final String description;
  78. final int imageCount;
  79. final DateTime createTime;
  80. final List<ImageModel> images;
  81. final List<DataItemDTO> patientInfo;
  82. final PatientModel patient;
  83. final OrganizationPatientTypeEnum organizationPatientTypeEnum;
  84. RecordModel({
  85. required this.id,
  86. required this.description,
  87. required this.imageCount,
  88. required this.createTime,
  89. required this.images,
  90. required this.patient,
  91. required this.patientInfo,
  92. required this.organizationPatientTypeEnum,
  93. });
  94. }
  95. class ImageModel {
  96. final String id;
  97. final String fileTypeName;
  98. final DateTime createTime;
  99. final String description;
  100. final VidDataInfo vidDataInfo;
  101. final String? urmOriginalCode;
  102. ///文件类型,单帧或多帧vid、图像、视频
  103. final SampleRemedicalFileDataTypeEnum fileDataType;
  104. ImageModel({
  105. required this.id,
  106. required this.fileTypeName,
  107. required this.createTime,
  108. required this.description,
  109. required this.vidDataInfo,
  110. required this.fileDataType,
  111. this.urmOriginalCode,
  112. });
  113. }
  114. class VidDataInfo {
  115. VidDataInfo({
  116. required this.id,
  117. required this.vidUrl,
  118. required this.coverUrl,
  119. required this.imageType,
  120. required this.sampleRemedicalFileDataTypeEnum,
  121. this.extendVidUrls = const [],
  122. });
  123. final String id;
  124. final String vidUrl;
  125. final String coverUrl;
  126. final ImageType imageType;
  127. final SampleRemedicalFileDataTypeEnum sampleRemedicalFileDataTypeEnum;
  128. final List<String> extendVidUrls;
  129. }
  130. enum ImageType {
  131. Measure_Result,
  132. Video,
  133. URM,
  134. URM_Result,
  135. Vid,
  136. }
  137. class MeasureItemInfo {
  138. ItemMeta itemMeta;
  139. String description;
  140. MeasureItemInfo({
  141. required this.itemMeta,
  142. required this.description,
  143. });
  144. factory MeasureItemInfo.empty() {
  145. final emptyItem = ItemMeta(
  146. "EmptyItem",
  147. measureType: MeasureTypes.Empty,
  148. description: "",
  149. outputs: [],
  150. );
  151. return MeasureItemInfo(
  152. itemMeta: emptyItem,
  153. description: "emptyItem",
  154. );
  155. }
  156. }