Browse Source

心电记录权限控制

loki.wu 8 months ago
parent
commit
048765142d
5 changed files with 79 additions and 28 deletions
  1. 12 0
      lib/ecg_list/controller.dart
  2. 63 24
      lib/ecg_list/view.dart
  3. 1 1
      lib/main.dart
  4. 2 2
      pubspec.lock
  5. 1 1
      pubspec.yaml

+ 12 - 0
lib/ecg_list/controller.dart

@@ -33,6 +33,8 @@ class EcgListController extends GetxController {
 
   List<ElectrocardiogramRecord> residentList = [];
 
+  List<UserFeatureDTO> userFeatures = [];
+
   /// 列表的总数
   int tableCount = 0;
 
@@ -120,6 +122,7 @@ class EcgListController extends GetxController {
   @override
   void onReady() {
     super.onReady();
+    _getOperationPermission();
     getDatas();
   }
 
@@ -177,6 +180,15 @@ class EcgListController extends GetxController {
     update(["ecg_list"]);
   }
 
+  Future<void> _getOperationPermission() async {
+    userFeatures = await RPCBridge.ins.rpc.vitalUser
+        .getOperationPermissionAsync(GetOperationPermissionRequest(
+      token: RPCBridge.ins.token,
+      appType: ApplicationTypeEnum.App,
+    ));
+    update(["ecg_list"]);
+  }
+
   // @override
   // void onClose() {
   //   super.onClose();

+ 63 - 24
lib/ecg_list/view.dart

@@ -1,5 +1,7 @@
+import 'package:ecg_list_view/rpc/rpc_bridge.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
 import 'package:get/get.dart';
 import 'package:fis_jsonrpc/rpc.dart';
 import 'index.dart';
@@ -39,7 +41,7 @@ class EcgListPage extends GetView<EcgListController> {
               Container(
                 margin: const EdgeInsets.all(5),
                 height: 50,
-                child: _buildHeader(),
+                child: _buildHeader(context),
               ),
               Expanded(child: _buildListView())
             ],
@@ -77,7 +79,7 @@ class EcgListPage extends GetView<EcgListController> {
     );
   }
 
-  Widget _buildHeader() {
+  Widget _buildHeader(BuildContext context) {
     return Row(
       children: [
         Expanded(
@@ -127,29 +129,39 @@ class EcgListPage extends GetView<EcgListController> {
           title: "已完成",
           value: RecordProcessStateEnum.Done,
         ),
-        IconButton(
-          onPressed: () {
-            Get.dialog(CreateExam(
-              onConfirm: () {
-                controller.getDatas();
+        if (controller.userFeatures.any((e) => e.code == "RECGCZQX"))
+          GestureDetector(
+              onTap: () {
+                Get.dialog(CreateExam(
+                  onConfirm: () {
+                    controller.getDatas();
+                  },
+                ));
               },
-            ));
-          },
-          icon: Row(
-            children: const [
-              Icon(
-                Icons.add,
-                color: Colors.blue,
-                size: 24,
-              ),
-              if (kIsWeb)
-                Text(
-                  "新增",
-                  style: TextStyle(fontSize: 20),
-                )
-            ],
-          ),
-        )
+              child: Container(
+                decoration: BoxDecoration(
+                  color: Theme.of(context).primaryColor,
+                  borderRadius: BorderRadius.circular(8),
+                ),
+                child: Row(
+                  children: const [
+                    Icon(
+                      Icons.add,
+                      color: Colors.white,
+                      size: 24,
+                    ),
+                    if (kIsWeb) ...[
+                      Text(
+                        "新增",
+                        style: TextStyle(fontSize: 20, color: Colors.white),
+                      ),
+                      SizedBox(
+                        width: 5,
+                      )
+                    ]
+                  ],
+                ),
+              ))
       ],
     );
   }
@@ -388,6 +400,33 @@ class EcgListPage extends GetView<EcgListController> {
               child: const Text("检查"),
             ),
           ),
+        if (controller.userFeatures.any((e) => e.code == "RECGCZQX")) ...[
+          const SizedBox(
+            width: 15,
+          ),
+          SizedBox(
+            width: 120,
+            child: ElevatedButton(
+              onPressed: () async {
+                ElectrocardiogramRecord examRecord =
+                    controller.residentList[controller.currectSelected];
+                bool result = await RPCBridge.ins.rpc.vitalElectrocardiogram
+                    .removeElectrocardiogramAsync(
+                  GetElectrocardiogramRecordRequest(
+                    token: RPCBridge.ins.token,
+                    code: examRecord.code,
+                  ),
+                );
+                if (result) {
+                  EasyLoading.showToast("删除成功");
+                  controller.getDatas();
+                  controller.loadReports();
+                }
+              },
+              child: const Text("删除记录"),
+            ),
+          ),
+        ],
       ],
     );
   }

+ 1 - 1
lib/main.dart

@@ -18,7 +18,7 @@ class Global {
     await logger.init();
     var rpc = JsonRpcProxy(host: "platform.xinglinghui.com:9308");
     rpc.setServerHost("platform.xinglinghui.com:9308", true);
-    Get.put(RPCBridge(rpc, "07F3BBB9EA0E4AFC9A2E8D17932FB134"));
+    Get.put(RPCBridge(rpc, "2507110B51FA453BA0472EDD76DDFB78"));
   }
 }
 

+ 2 - 2
pubspec.lock

@@ -198,8 +198,8 @@ packages:
     dependency: "direct overridden"
     description:
       path: "."
-      ref: b3fc3588ebe488a47b07ba9549c540d2625d0b3f
-      resolved-ref: b3fc3588ebe488a47b07ba9549c540d2625d0b3f
+      ref: "9ecd100964bb61833ce2f011988e41054d9821c4"
+      resolved-ref: "9ecd100964bb61833ce2f011988e41054d9821c4"
       url: "http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git"
     source: git
     version: "0.0.1"

+ 1 - 1
pubspec.yaml

@@ -44,7 +44,7 @@ dependency_overrides:
   fis_jsonrpc:
     git:
       url: http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git
-      ref: b3fc3588ebe488a47b07ba9549c540d2625d0b3f
+      ref: 9ecd100964bb61833ce2f011988e41054d9821c4
   fis_common:
     git:
       url: http://git.ius.plus:88/Project-Wing/fis_lib_common.git