platform.dart 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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(String token, String patientCode,
  122. String reportCode, String recordCode, String referralRecordCode) async {
  123. var rpcRst = await call("OpenReportEdit",
  124. [token, patientCode, reportCode, recordCode, referralRecordCode]);
  125. return rpcRst;
  126. }
  127. ///打开报告设计器页面(独立窗口)
  128. Future<bool?> openReportDesignerAsync(String templateId, String name,
  129. String type, String token, String json) async {
  130. var rpcRst =
  131. await call("OpenReportDesigner", [templateId, name, type, token, json]);
  132. return rpcRst;
  133. }
  134. ///获取屏幕个数
  135. Future<int> getWindowsNum() async {
  136. var rpcRst = await call("GetWindowsNum");
  137. return rpcRst;
  138. }
  139. ///关闭副窗口
  140. Future<void> closeSlaveWindow() async {
  141. var rpcRst = await call("CloseSlaveWindow");
  142. return rpcRst;
  143. }
  144. ///开启拖拽窗口
  145. Future<void> beginWindowDrag(String windowName) async {
  146. var rpcRst = await call("BeginWindowDrag", [windowName]);
  147. return rpcRst;
  148. }
  149. ///关闭拖拽窗口
  150. Future<void> endWindowDrag(String windowName) async {
  151. var rpcRst = await call("EndWindowDrag", [windowName]);
  152. return rpcRst;
  153. }
  154. ///最小化窗口
  155. Future<void> minimizeWindow(String windowName) async {
  156. var rpcRst = await call("MinimizeWindow", [windowName]);
  157. return rpcRst;
  158. }
  159. ///最大化窗口
  160. Future<void> maximizeWindow(String windowName) async {
  161. var rpcRst = await call("MaximizeWindow", [windowName]);
  162. return rpcRst;
  163. }
  164. ///重置
  165. Future<void> restoreWindow(String windowName) async {
  166. var rpcRst = await call("RestoreWindow", [windowName]);
  167. return rpcRst;
  168. }
  169. ///获取Window状态
  170. Future<int> getWindowState(String windowName) async {
  171. var rpcRst = await call("GetWindowStateAsync", [windowName]);
  172. return rpcRst;
  173. }
  174. ///关闭窗口
  175. Future<void> closeWindow(String windowName) async {
  176. var rpcRst = await call("CloseWindow", [windowName]);
  177. return rpcRst;
  178. }
  179. ///设置语言Code
  180. Future<void> setLanguageCodeAsync(String code) async {
  181. var rpcRst = await call("SetLanguageCode", [code]);
  182. return rpcRst;
  183. }
  184. //获取语言Code
  185. Future<String> getLanguageCodeAsync() async {
  186. var rpcRst = await call("GetLanguageCode");
  187. return rpcRst;
  188. }
  189. ///设置当前登录信息
  190. Future<void> setLoginUserInfoAsync(String userInfo) async {
  191. var rpcRst = await call("SetUserLoginInfo", [userInfo]);
  192. return rpcRst;
  193. }
  194. ///设置当前第二窗口状态
  195. Future<void> setSecondWindowStateInfoAsync(bool isSecondWindowMode) async {
  196. var rpcRst = await call("SetSecondWindowState", [isSecondWindowMode]);
  197. return rpcRst;
  198. }
  199. ///默认词条变更
  200. Future<void> thesaurusChange() async {
  201. var rpcRst = await call("ThesaurusChange");
  202. return rpcRst;
  203. }
  204. ///提交报告通知
  205. Future<void> onSubmitReport(String patientId, String code) async {
  206. var rpcRst = await call("OnSubmitReport", [patientId, code]);
  207. return rpcRst;
  208. }
  209. ///刷新报告通知
  210. Future<void> refershReports() async {
  211. var rpcRst = await call("RefershReports", []);
  212. return rpcRst;
  213. }
  214. ///刷新报告通知
  215. Future<void> reloadConfig() async {
  216. var rpcRst = await call("ReloadConfig", []);
  217. return rpcRst;
  218. }
  219. ///重载配置
  220. Future<bool> getIsUseSecondWindow() async {
  221. var rpcRst = await call("GetIsUseSecondWindow", []);
  222. return rpcRst;
  223. }
  224. ///重载配置
  225. Future<bool> getIsWin7() async {
  226. var rpcRst = await call("GetIsWin7", []);
  227. return rpcRst;
  228. }
  229. ///打开控制台
  230. Future<void> openConsole() async {
  231. var rpcRst = await call("OpenConsole", []);
  232. return rpcRst;
  233. }
  234. ///主窗口关闭通知
  235. Future<void> onMainWindowLogout() async {
  236. var rpcRst = await call("OnMainWindowLogout", []);
  237. return rpcRst;
  238. }
  239. ///设置开启自启动
  240. Future<void> setAutoStartAsync(bool isAutoStart) async {
  241. var rpcRst = await call("SetAutoStart", [isAutoStart]);
  242. return rpcRst;
  243. }
  244. ///启用壳子录音
  245. Future<void> startShellRecord() async {
  246. var rpcRst = await call("StartShellRecord");
  247. return rpcRst;
  248. }
  249. ///停止壳子录音
  250. Future<String> stopShellRecord() async {
  251. var rpcRst = await call("StopShellRecord");
  252. return rpcRst;
  253. }
  254. ///导出日志
  255. Future<bool> exportAppLogZipFile(int exportType, String fileName) async {
  256. var rpcRst = await call("ExportAppLogZipFile", [exportType, fileName]);
  257. return rpcRst;
  258. }
  259. }