platform.dart 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. import 'package:fis_common/json_convert.dart';
  2. import '../client_base.dart';
  3. import 'platform.m.dart';
  4. /// 平台服务
  5. class PlatformService extends JsonRpcClientBase {
  6. PlatformService(
  7. String host, {
  8. String serviceName = "IPlatformService",
  9. Map<String, String>? headers,
  10. int? timeout,
  11. }) : super(
  12. host,
  13. serviceName,
  14. headers: headers,
  15. timeout: timeout,
  16. ) {
  17. /// 注册响应实体反序列化处理器
  18. FJsonConvert.setDecoder((map) => LoadVidResult.fromJson(map));
  19. FJsonConvert.setDecoder((map) => GetVidFrameResult.fromJson(map));
  20. }
  21. /// 加载主题
  22. Future<bool> loadTheme(String name) async {
  23. var rpcRst = await call("LoadTheme", name);
  24. return rpcRst;
  25. }
  26. /// 保存配置
  27. ///
  28. /// [jsonText] 配置json文本
  29. Future<bool> saveConfig(String jsonText) async {
  30. var rpcRst = await call("SaveConfig", jsonText);
  31. return rpcRst;
  32. }
  33. /// 获取配置
  34. Future<String?> getConfig() async {
  35. var rpcRst = await call("GetConfig");
  36. return rpcRst;
  37. }
  38. /// 保存文本文件
  39. ///
  40. /// [name] 文件名
  41. ///
  42. /// [text] 文本
  43. Future<bool> saveText(String name, String text) async {
  44. var rpcRst = await call("SaveText", [name, text]);
  45. return rpcRst;
  46. }
  47. /// 获取文件文本
  48. ///
  49. /// [name] 文件名
  50. Future<String?> getText(String name) async {
  51. var rpcRst = await call("GetText", name);
  52. return rpcRst;
  53. }
  54. /// 加载Vid文件
  55. ///
  56. /// [url] Vid文件链接
  57. Future<LoadVidResult> loadVid(String url) async {
  58. var rpcRst = await call("LoadVid", url);
  59. var result = LoadVidResult.fromJson(rpcRst as Map<String, dynamic>);
  60. return result;
  61. }
  62. /// 获取Vid单针帧图
  63. Future<GetVidFrameResult> getVidFrame(GetVidFrameRequest request) async {
  64. var rpcRst = await call("GetVidFrame", request);
  65. var result = GetVidFrameResult.fromJson(rpcRst as Map<String, dynamic>);
  66. return result;
  67. }
  68. /// 释放Vid缓存资源
  69. void releaseVid() => notify("ReleaseVid");
  70. /// 获取单帧Vid文件图像
  71. Future<GetVidFrameResult> getSingleImage(String url) async {
  72. var rpcRst = await call("GetSingleImage", url);
  73. var result = GetVidFrameResult.fromJson(rpcRst as Map<String, dynamic>);
  74. return result;
  75. }
  76. /// 获取vid文件(base64)
  77. Future<String?> getVidFile(String url) async {
  78. var rpcRst = await call("GetVidFile", [url]);
  79. return rpcRst;
  80. }
  81. /// 导出文件
  82. Future<bool> setBytesToExport(String data, String fileName) async {
  83. var rpcRst = await call("SetBytesToExport", [data, fileName]);
  84. return rpcRst;
  85. }
  86. ///缓存文件
  87. Future<bool> setBinaryFileCache(String data, String fileName) async {
  88. var rpcRst = await call("SetBinaryFileCache", [data, fileName]);
  89. return rpcRst;
  90. }
  91. ///读取缓存文件
  92. Future<String?> getBinaryFileCache(String fileName) async {
  93. var rpcRst = await call("GetBinaryFileCache", [fileName]);
  94. return rpcRst;
  95. }
  96. ///导出病例zip文件
  97. Future<bool> exportPatientZipFile(String data, String fileName) async {
  98. var rpcRst = await call("ExportPatientZipFile", [data, fileName]);
  99. return rpcRst;
  100. }
  101. ///撤销病例导出
  102. Future<bool> abortExportOperation() async {
  103. var rpcRst = await call("AbortExportOperation", []);
  104. return rpcRst;
  105. }
  106. ///打开图像测量页(独立窗口)
  107. Future<bool?> openImageMeasureAsync(String token, String patientCode,
  108. String remedicalCode, String recordCode) async {
  109. var rpcRst = await call(
  110. "OpenImageMeasure", [token, patientCode, remedicalCode, recordCode]);
  111. return rpcRst;
  112. }
  113. ///打开报告预览页(独立窗口)
  114. Future<bool?> openReportPreviewAsync(String token, String reportCode,
  115. String recordCode, String isFormEditor) async {
  116. var rpcRst = await call(
  117. "OpenReportPreview", [token, reportCode, recordCode, isFormEditor]);
  118. return rpcRst;
  119. }
  120. ///打开图像测量页(独立窗口)
  121. Future<bool?> openReportEditAsync(
  122. String token,
  123. String patientCode,
  124. String reportCode,
  125. String recordCode,
  126. String referralRecordCode,
  127. String consultationCode) async {
  128. var rpcRst = await call("OpenReportEdit", [
  129. token,
  130. patientCode,
  131. reportCode,
  132. recordCode,
  133. referralRecordCode,
  134. consultationCode
  135. ]);
  136. return rpcRst;
  137. }
  138. ///打开报告设计器页面(独立窗口)
  139. Future<bool?> openReportDesignerAsync(String templateId, String name,
  140. String type, String token, String json) async {
  141. var rpcRst =
  142. await call("OpenReportDesigner", [templateId, name, type, token, json]);
  143. return rpcRst;
  144. }
  145. ///打开在线会诊页面(独立窗口)
  146. Future<void> openLiveConsultationAsync(
  147. String consultationCode, bool isJoin, int pageIndex, String token) async {
  148. await call(
  149. "OpenLiveConsultation", [consultationCode, isJoin, pageIndex, token]);
  150. }
  151. /// 打开设备直播 独立窗口
  152. ///
  153. /// [deviceCode] 设备编码
  154. ///
  155. /// [token] 登录令牌
  156. Future<void> openDeviceLiveWindow(String deviceCode, String token) {
  157. return call("OpenDeviceLiveWindow", [deviceCode, token]);
  158. }
  159. ///获取屏幕个数
  160. Future<int> getWindowsNum() async {
  161. var rpcRst = await call("GetWindowsNum");
  162. return rpcRst;
  163. }
  164. ///关闭副窗口
  165. Future<void> closeSlaveWindow() async {
  166. var rpcRst = await call("CloseSlaveWindow");
  167. return rpcRst;
  168. }
  169. ///关闭会诊窗口
  170. Future<void> closeLiveConsultation() async {
  171. var rpcRst = await call("CloseLiveConsultation");
  172. return rpcRst;
  173. }
  174. ///开启拖拽窗口
  175. Future<void> beginWindowDrag(String windowName) async {
  176. var rpcRst = await call("BeginWindowDrag", [windowName]);
  177. return rpcRst;
  178. }
  179. ///关闭拖拽窗口
  180. Future<void> endWindowDrag(String windowName) async {
  181. var rpcRst = await call("EndWindowDrag", [windowName]);
  182. return rpcRst;
  183. }
  184. ///最小化窗口
  185. Future<void> minimizeWindow(String windowName) async {
  186. var rpcRst = await call("MinimizeWindow", [windowName]);
  187. return rpcRst;
  188. }
  189. ///最大化窗口
  190. Future<void> maximizeWindow(String windowName) async {
  191. var rpcRst = await call("MaximizeWindow", [windowName]);
  192. return rpcRst;
  193. }
  194. ///重置
  195. Future<void> restoreWindow(String windowName) async {
  196. var rpcRst = await call("RestoreWindow", [windowName]);
  197. return rpcRst;
  198. }
  199. ///获取Window状态
  200. Future<int> getWindowState(String windowName) async {
  201. var rpcRst = await call("GetWindowStateAsync", [windowName]);
  202. return rpcRst;
  203. }
  204. ///关闭窗口
  205. Future<void> closeWindow(String windowName) async {
  206. var rpcRst = await call("CloseWindow", [windowName]);
  207. return rpcRst;
  208. }
  209. ///设置语言Code
  210. Future<void> setLanguageCodeAsync(String code) async {
  211. var rpcRst = await call("SetLanguageCode", [code]);
  212. return rpcRst;
  213. }
  214. //获取语言Code
  215. Future<String> getLanguageCodeAsync() async {
  216. var rpcRst = await call("GetLanguageCode");
  217. return rpcRst;
  218. }
  219. ///设置当前登录信息
  220. Future<void> setLoginUserInfoAsync(String userInfo) async {
  221. var rpcRst = await call("SetUserLoginInfo", [userInfo]);
  222. return rpcRst;
  223. }
  224. ///设置当前第二窗口状态
  225. Future<void> setSecondWindowStateInfoAsync(bool isSecondWindowMode) async {
  226. var rpcRst = await call("SetSecondWindowState", [isSecondWindowMode]);
  227. return rpcRst;
  228. }
  229. ///默认词条变更
  230. Future<void> thesaurusChange(String token) async {
  231. var rpcRst = await call("ThesaurusChange", [token]);
  232. return rpcRst;
  233. }
  234. ///提交报告通知
  235. Future<void> onSubmitReport(String patientId, String code) async {
  236. var rpcRst = await call("OnSubmitReport", [patientId, code]);
  237. return rpcRst;
  238. }
  239. ///刷新报告通知
  240. Future<void> refershReports() async {
  241. var rpcRst = await call("RefershReports", []);
  242. return rpcRst;
  243. }
  244. ///刷新报告通知
  245. Future<void> reloadConfig() async {
  246. var rpcRst = await call("ReloadConfig", []);
  247. return rpcRst;
  248. }
  249. ///重载配置
  250. Future<bool> getIsUseSecondWindow() async {
  251. var rpcRst = await call("GetIsUseSecondWindow", []);
  252. return rpcRst;
  253. }
  254. ///重载配置
  255. Future<bool> getIsWin7() async {
  256. var rpcRst = await call("GetIsWin7", []);
  257. return rpcRst;
  258. }
  259. ///打开控制台
  260. Future<void> openConsole() async {
  261. var rpcRst = await call("OpenConsole", []);
  262. return rpcRst;
  263. }
  264. ///主窗口关闭通知
  265. Future<void> onMainWindowLogout() async {
  266. var rpcRst = await call("OnMainWindowLogout", []);
  267. return rpcRst;
  268. }
  269. ///设置开启自启动
  270. Future<void> setAutoStartAsync(bool isAutoStart) async {
  271. var rpcRst = await call("SetAutoStart", [isAutoStart]);
  272. return rpcRst;
  273. }
  274. ///启用壳子录音
  275. Future<void> startShellRecord() async {
  276. var rpcRst = await call("StartShellRecord");
  277. return rpcRst;
  278. }
  279. ///停止壳子录音
  280. Future<String> stopShellRecord() async {
  281. var rpcRst = await call("StopShellRecord");
  282. return rpcRst;
  283. }
  284. ///导出日志
  285. Future<bool> exportAppLogZipFile(int exportType, String fileName) async {
  286. var rpcRst = await call("ExportAppLogZipFile", [exportType, fileName]);
  287. return rpcRst;
  288. }
  289. ///开始录制
  290. Future<void> startRecording(
  291. String filePrefixTitle, String micDeviceId) async {
  292. var rpcRst = await call("StartRecording", [filePrefixTitle, micDeviceId]);
  293. return rpcRst;
  294. }
  295. ///暂停录制
  296. Future<void> pauseRecording(bool isPause) async {
  297. var rpcRst = await call("PauseRecording", [isPause]);
  298. return rpcRst;
  299. }
  300. ///结束录制
  301. Future<void> stopRecording() async {
  302. var rpcRst = await call("StopRecording");
  303. return rpcRst;
  304. }
  305. ///导出会诊病例zip文件
  306. Future<bool> exportConsultationZipFile(String data, String fileName) async {
  307. var rpcRst = await call("ExportConsultationZipFile", [data, fileName]);
  308. return rpcRst;
  309. }
  310. ///升级客户端
  311. Future<bool> doUpgradClient(String upgradInfo) async {
  312. var rpcRst = await call("DoUpgradClient", [upgradInfo]);
  313. return rpcRst;
  314. }
  315. ///获得当前客户端版本
  316. Future<String> getCurrentAppVersion() async {
  317. var rpcRst = await call("GetCurrentAppVersion");
  318. return rpcRst;
  319. }
  320. ///下载测量数据
  321. Future<void> downloadMeasureData(String url) async {
  322. var rpcRst = await call("DownloadMeasureData", [url]);
  323. return rpcRst;
  324. }
  325. }