Kaynağa Gözat

1、列表三个按钮新增权限

guanxinyi 1 yıl önce
ebeveyn
işleme
bdee64df1d

+ 3 - 0
lib/architecture/values/features.dart

@@ -19,6 +19,9 @@ class FeatureKeys {
   /// 人脸识别
   static const FaceRecognition = 'RLSB';
 
+  /// 身份证拍照OCR识别
+  static const IdCardPhotoOCR = 'SFZSBCZ';
+
   /// 健康信息
   static const HealthInformation = 'JKXXCZ';
 

+ 32 - 11
lib/pages/patient/create/controller.dart

@@ -129,7 +129,7 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
       ///这个800ms不能移除,移除后会导致建档失败
       const Duration(milliseconds: 800),
       () {
-        Get.find<PatientListController>().gotoDetail(code);
+        onIdcardInfoIsCreateRecord(code);
         busy = false;
       },
     );
@@ -270,10 +270,7 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
       patientInfo.nationality = result.nation; // 回填民族
       patientInfo.birthday = result.birthday; // 回填出生日期
       patientInfo.patientAddress = result.address; // 回填户籍地址
-      await Get.find<PatientListController>().gotoDetail(
-        patientInfo.cardNo!,
-        patientInfo,
-      );
+      onIdcardInfoIsCreateRecord(patientInfo.cardNo!, patientInfo);
     } else {
       print("读卡取消");
     }
@@ -303,10 +300,7 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
     if (result != null && result.success) {
       PromptBox.toast("身份证信息识别成功");
       PatientBaseDTO patientInfo = result.patientBaseDTO;
-      await Get.find<PatientListController>().gotoDetail(
-        patientInfo.cardNo!,
-        patientInfo,
-      );
+      onIdcardInfoIsCreateRecord(patientInfo.cardNo!, patientInfo);
     } else {
       print("识别取消");
     }
@@ -334,7 +328,7 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
     );
     if (result != null && result.success) {
       final patient = result.patientInfo;
-      final hasConfirmed = await FaceResultDialog.show(patient);
+      final hasConfirmed = await FaceResultDialog.show(patient, true);
       if (hasConfirmed) {
         await _checkinPatient(patient);
       }
@@ -344,6 +338,33 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
     Store.user.isShowUserCard = true;
   }
 
+  void onIdcardInfoIsCreateRecord(
+    String cardNo, [
+    PatientBaseDTO? patientInfo,
+  ]) async {
+    PatientDTO? patientInfoDto = await _patientManager.getDetail(cardNo);
+    if (patientInfoDto != null) {
+      Store.user.currentSelectPatientInfo = patientInfoDto;
+    }
+    if (patientInfo != null) {
+      final hasConfirmed =
+          await FaceResultDialog.show(patientInfo, patientInfoDto != null);
+
+      if (hasConfirmed) {
+        if (patientInfoDto != null) {
+          await Get.find<PatientListController>()
+              .gotoDetail(patientInfo.cardNo!, patientInfoDto, patientInfo);
+        } else {
+          await Get.find<PatientListController>().gotoCreate(
+            patientInfo.cardNo!,
+            patientInfoDto,
+            patientInfo,
+          );
+        }
+      }
+    }
+  }
+
   /// 点击录入人脸
   Future<void> onFaceEntryClicked() async {
     final PatientDTO patientInfo = PatientDTO(
@@ -565,6 +586,6 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
       patientAddress: patient.patientAddress,
     );
     Store.user.currentSelectPatientInfo = patientDTO;
-    await Get.find<PatientListController>().gotoDetail(patientDTO.code!);
+    onIdcardInfoIsCreateRecord(patientDTO.code!);
   }
 }

+ 24 - 7
lib/pages/patient/create/widgets/face_result_dialog.dart

@@ -1,7 +1,6 @@
 import 'package:fis_jsonrpc/services/patient.m.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
-import 'package:intl/intl.dart';
 import 'package:vitalapp/architecture/utils/datetime.dart';
 import 'package:vitalapp/components/alert_dialog.dart';
 import 'package:vitalapp/consts/rpc_enum_labels.dart';
@@ -9,11 +8,24 @@ import 'package:vitalapp/consts/rpc_enum_labels.dart';
 class FaceResultDialog extends StatelessWidget {
   final PatientBaseDTO data;
 
-  const FaceResultDialog({super.key, required this.data});
+  /// 是否已建档
+  final bool? hasCreateRecord;
 
-  static Future<bool> show(PatientBaseDTO data) async {
+  const FaceResultDialog({
+    super.key,
+    required this.data,
+    this.hasCreateRecord = true,
+  });
+
+  static Future<bool> show(
+    PatientBaseDTO data,
+    bool hasCreateRecord,
+  ) async {
     final result = await Get.dialog(
-      FaceResultDialog(data: data),
+      FaceResultDialog(
+        data: data,
+        hasCreateRecord: hasCreateRecord,
+      ),
       barrierDismissible: false,
     );
     return result == true;
@@ -21,8 +33,13 @@ class FaceResultDialog extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
+    return _buildContent();
+  }
+
+  Widget _buildContent() {
+    final title = hasCreateRecord! ? "识别结果-已建档" : "识别结果-未建档";
     return VAlertDialog(
-      title: "人脸识别结果",
+      title: title,
       width: 400,
       contentPadding: const EdgeInsets.symmetric(horizontal: 36, vertical: 12),
       showCancel: false, // 目前销售确认只要确定,不需要取消
@@ -50,8 +67,8 @@ class FaceResultDialog extends StatelessWidget {
           SizedBox(
             width: 90,
             child: Text(
-              label,
-              style: const TextStyle(color: Colors.grey, fontSize: 20),
+              '$label:',
+              style: const TextStyle(color: Colors.black, fontSize: 20),
             ),
           ),
           const SizedBox(width: 12),

+ 51 - 35
lib/pages/patient/create/widgets/quick_create.dart

@@ -10,6 +10,7 @@ import 'package:vitalapp/pages/patient/create/widgets/area.dart';
 import 'package:vitalapp/pages/patient/create/widgets/crowd_label.dart';
 import 'package:vitalapp/pages/patient/create/widgets/patient_info.dart';
 import 'package:vitalapp/store/store.dart';
+import 'package:fis_common/helpers/color.dart';
 
 class QuickCreatePatientPage extends GetView<CreatePatientController> {
   const QuickCreatePatientPage({super.key});
@@ -20,42 +21,46 @@ class QuickCreatePatientPage extends GetView<CreatePatientController> {
       children: [
         Row(
           children: [
-            Expanded(
-              flex: 1,
-              child: Container(
-                decoration: BoxDecoration(
-                  border: Border(
-                    right: BorderSide(
-                      color: Colors.grey.shade300,
+            if (Store.user.hasFeature(FeatureKeys.IdCardPhotoOCR) ||
+                Store.user.hasFeature(FeatureKeys.IDCardReader))
+              Expanded(
+                flex: 1,
+                child: Container(
+                  decoration: BoxDecoration(
+                    border: Border(
+                      right: BorderSide(
+                        color: Colors.grey.shade300,
+                      ),
                     ),
                   ),
-                ),
-                child: Column(
-                  mainAxisAlignment: MainAxisAlignment.center,
-                  children: [
-                    _buildClickCard(
-                      Icons.perm_contact_cal_rounded,
-                      '拍照识别',
-                      () {
-                        if (!kIsOnline) {
-                          PromptBox.toast("当前为离线模式,不支持此功能");
-                          return;
-                        }
-                        controller.onIdCardScanClicked();
-                      },
-                    ),
-                    const SizedBox(
-                      height: 80,
-                    ),
-                    _buildClickCard(
-                      Icons.chrome_reader_mode,
-                      '读卡识别',
-                      () => controller.onReadCardClicked(),
-                    ),
-                  ],
+                  child: Column(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    children: [
+                      if (Store.user.hasFeature(FeatureKeys.IdCardPhotoOCR))
+                        _buildClickCard(
+                          Icons.perm_contact_cal_rounded,
+                          '拍照识别',
+                          () {
+                            if (!kIsOnline) {
+                              PromptBox.toast("当前为离线模式,不支持此功能");
+                              return;
+                            }
+                            controller.onIdCardScanClicked();
+                          },
+                        ),
+                      const SizedBox(
+                        height: 80,
+                      ),
+                      if (Store.user.hasFeature(FeatureKeys.IDCardReader))
+                        _buildClickCard(
+                          Icons.chrome_reader_mode,
+                          '读卡识别',
+                          () => controller.onReadCardClicked(),
+                        ),
+                    ],
+                  ),
                 ),
               ),
-            ),
             Expanded(
               flex: 2,
               child: PatientInfo(),
@@ -92,7 +97,8 @@ class QuickCreatePatientPage extends GetView<CreatePatientController> {
     VoidCallback voidCallback,
   ) {
     return Material(
-      color: Colors.blueAccent,
+      // color: Colors.blueAccent,
+
       borderRadius: const BorderRadius.all(
         Radius.circular(8),
       ),
@@ -109,10 +115,20 @@ class QuickCreatePatientPage extends GetView<CreatePatientController> {
                 horizontal: 80,
               ),
               // margin: const EdgeInsets.symmetric(horizontal: 50),
-              decoration: const BoxDecoration(
-                borderRadius: BorderRadius.all(
+              decoration: BoxDecoration(
+                borderRadius: const BorderRadius.all(
                   Radius.circular(8),
                 ),
+                gradient: LinearGradient(
+                  colors: [
+                    // Color.fromRGBO(59, 188, 255, 1),
+                    // Color.fromRGBO(44, 120, 229, 1),
+                    Colors.blue,
+                    FColorHelper.mixColor(Colors.white, Colors.blue, 50),
+                  ],
+                  begin: Alignment.topLeft,
+                  end: Alignment.bottomRight,
+                ),
               ),
               child: Text(
                 textString,

+ 19 - 25
lib/pages/patient/list/controller.dart

@@ -6,9 +6,7 @@ import 'package:vitalapp/global.dart';
 import 'package:vitalapp/managers/interfaces/patient.dart';
 import 'package:vitalapp/pages/controllers/crowd_labels.dart';
 import 'package:vitalapp/pages/home/controller.dart';
-import 'package:vitalapp/pages/medical/controller.dart';
 import 'package:vitalapp/pages/patient/detail/controller.dart';
-import 'package:vitalapp/store/store.dart';
 
 import 'state.dart';
 
@@ -23,38 +21,34 @@ class PatientListController extends FControllerBase {
 
   final crowdLabelsController = CrowdLabelsController();
 
-  /// 前进到检测页面
+  /// 前进到用户详情页面
   Future<void> gotoDetail(
     String code, [
+    PatientDTO? patientInfoDto,
     PatientBaseDTO? patientInfo,
   ]) async {
-    if (!Get.isRegistered<MedicalController>()) {
-      Get.lazyPut(() => MedicalController());
-    }
-    final medicalController = Get.find<MedicalController>();
-
-    PatientDTO? patientInfoDto = await _patientManager.getDetail(code);
-    if (patientInfoDto != null) {
-      Store.user.currentSelectPatientInfo = patientInfoDto;
-
-      await _patientDetailController.loadData();
-      await medicalController.initData();
-      _homeController.updateMenus();
-      _homeController.switchNavByName("/patient/detail");
-    } else {
-      _homeController.initMenus();
-      if (patientInfo != null) {
-        _homeController.switchNavByName(
-          "/patient/create",
-          patientInfo.toJson(),
-        );
-      }
-    }
+    await _patientDetailController.loadData();
+    _homeController.updateMenus();
+    _homeController.switchNavByName("/patient/detail");
 
     //这里应该刷新病人诊断数据缓存
     // _medicalController.changePatient.emit(this, code);
   }
 
+  Future<void> gotoCreate(
+    String code, [
+    PatientDTO? patientInfoDto,
+    PatientBaseDTO? patientInfo,
+  ]) async {
+    _homeController.initMenus();
+    if (patientInfo != null) {
+      _homeController.switchNavByName(
+        "/patient/create",
+        patientInfo.toJson(),
+      );
+    }
+  }
+
   /// 新建档案
   void onCreateClicked() {
     // Get.toNamed(

+ 21 - 17
lib/pages/patient/list/view.dart

@@ -4,6 +4,7 @@ import 'package:intl/intl.dart';
 import 'package:vitalapp/architecture/utils/datetime.dart';
 import 'package:vitalapp/architecture/utils/prompt_box.dart';
 import 'package:vitalapp/architecture/utils/sensitive.dart';
+import 'package:vitalapp/architecture/values/features.dart';
 import 'package:vitalapp/components/button.dart';
 import 'package:vitalapp/components/dialog_date.dart';
 import 'package:vitalapp/components/dynamic_drawer.dart';
@@ -309,23 +310,26 @@ class _HeaderWidget extends GetView<PatientListController> {
       height: 76,
       child: Row(
         children: [
-          _buildIconButton(Icons.sensor_occupied, '人脸识别', () {
-            if (!kIsOnline) {
-              PromptBox.toast("当前为离线模式,不支持此功能");
-              return;
-            }
-            createPatientController.onFaceIdLoginClicked();
-          }),
-          _buildIconButton(Icons.perm_contact_cal_rounded, '拍照识别', () {
-            if (!kIsOnline) {
-              PromptBox.toast("当前为离线模式,不支持此功能");
-              return;
-            }
-            createPatientController.onIdCardScanClickedToDetail();
-          }),
-          _buildIconButton(Icons.chrome_reader_mode, '读卡识别', () {
-            createPatientController.onReadCardClickedToDetail();
-          }),
+          if (Store.user.hasFeature(FeatureKeys.FaceRecognition))
+            _buildIconButton(Icons.sensor_occupied, '人脸识别', () {
+              if (!kIsOnline) {
+                PromptBox.toast("当前为离线模式,不支持此功能");
+                return;
+              }
+              createPatientController.onFaceIdLoginClicked();
+            }),
+          if (Store.user.hasFeature(FeatureKeys.IdCardPhotoOCR))
+            _buildIconButton(Icons.perm_contact_cal_rounded, '拍照识别', () {
+              if (!kIsOnline) {
+                PromptBox.toast("当前为离线模式,不支持此功能");
+                return;
+              }
+              createPatientController.onIdCardScanClickedToDetail();
+            }),
+          if (Store.user.hasFeature(FeatureKeys.IDCardReader))
+            _buildIconButton(Icons.chrome_reader_mode, '读卡识别', () {
+              createPatientController.onReadCardClickedToDetail();
+            }),
           Expanded(
             child: SizedBox(
               height: 70,