Sfoglia il codice sorgente

人脸识别结果展示框

Melon 1 anno fa
parent
commit
92fc9c2327

+ 20 - 13
lib/pages/patient/create/controller.dart

@@ -14,6 +14,7 @@ import 'package:vitalapp/pages/controllers/home_nav_mixin.dart';
 import 'package:vitalapp/pages/patient/bluetooth_card_reader/view.dart';
 import 'package:vitalapp/pages/patient/card_reader/index.dart';
 import 'package:vitalapp/pages/patient/create/state.dart';
+import 'package:vitalapp/pages/patient/create/widgets/face_result_dialog.dart';
 import 'package:vitalapp/pages/patient/list/controller.dart';
 import 'package:vitalapp/store/store.dart';
 import 'package:vnote_device_plugin/consts/types.dart';
@@ -220,19 +221,10 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
     );
     if (result != null && result.success) {
       final patient = result.patientInfo;
-      // PromptBox.toast("录入成功");
-      final patientDTO = PatientDTO(
-        code: patient.cardNo,
-        cardNo: patient.cardNo,
-        patientName: patient.patientName,
-        nationality: patient.nationality,
-        patientGender: patient.patientGender,
-        birthday: patient.birthday,
-        patientAddress: patient.patientAddress,
-      );
-      Store.user.currentSelectPatientInfo = patientDTO;
-      await Get.find<PatientListController>().gotoDetail(patientDTO.code!);
-      PromptBox.toast('人脸识别成功,姓名:${patient.patientName}');
+      final hasConfirmed = await FaceResultDialog.show(patient);
+      if (hasConfirmed) {
+        await _checkinPatient(patient);
+      }
     } else {
       print("识别取消");
     }
@@ -439,4 +431,19 @@ class CreatePatientController extends FControllerBase with HomeNavMixin {
     // }
     return null;
   }
+
+  /// 切换当前登记居民
+  Future<void> _checkinPatient(PatientBaseDTO patient) async {
+    final patientDTO = PatientDTO(
+      code: patient.cardNo,
+      cardNo: patient.cardNo,
+      patientName: patient.patientName,
+      nationality: patient.nationality,
+      patientGender: patient.patientGender,
+      birthday: patient.birthday,
+      patientAddress: patient.patientAddress,
+    );
+    Store.user.currentSelectPatientInfo = patientDTO;
+    await Get.find<PatientListController>().gotoDetail(patientDTO.code!);
+  }
 }

+ 68 - 0
lib/pages/patient/create/widgets/face_result_dialog.dart

@@ -0,0 +1,68 @@
+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';
+
+class FaceResultDialog extends StatelessWidget {
+  final PatientBaseDTO data;
+
+  const FaceResultDialog({super.key, required this.data});
+
+  static Future<bool> show(PatientBaseDTO data) async {
+    final result = await Get.dialog(
+      FaceResultDialog(data: data),
+      barrierDismissible: false,
+    );
+    return result == true;
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return VAlertDialog(
+      title: "人脸识别结果",
+      width: 400,
+      contentPadding: const EdgeInsets.symmetric(horizontal: 36, vertical: 12),
+      showCancel: false, // 目前销售确认只要确定,不需要取消
+      onConfirm: () {
+        Get.back(result: true);
+      },
+      content: Column(
+        mainAxisSize: MainAxisSize.min,
+        children: [
+          _buildRow("姓名", data.patientName!),
+          _buildRow("性别", RpcEnumLabels.gender[data.patientGender]!),
+          // _buildRow("出生日期", DateFormat('yyyy-MM-dd').format(data.birthday!)),
+          _buildRow("年龄", DataTimeUtils.calculateAge(data.birthday!)),
+          _buildRow("身份证", data.cardNo!),
+        ],
+      ),
+    );
+  }
+
+  Widget _buildRow(String label, String content) {
+    return Padding(
+      padding: const EdgeInsets.symmetric(vertical: 4),
+      child: Row(
+        children: [
+          SizedBox(
+            width: 90,
+            child: Text(
+              label,
+              style: const TextStyle(color: Colors.grey, fontSize: 20),
+            ),
+          ),
+          const SizedBox(width: 12),
+          Expanded(
+            child: Text(
+              content,
+              style: const TextStyle(color: Colors.black, fontSize: 20),
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+}

+ 2 - 2
pubspec.lock

@@ -932,8 +932,8 @@ packages:
     dependency: "direct main"
     description:
       path: "."
-      ref: ef6ccfbef4
-      resolved-ref: ef6ccfbef4dae5e3a2cd43848bf850538c11fb4b
+      ref: d86200d
+      resolved-ref: d86200d9348adb8c3c647f2b029d5e9750ca6774
       url: "http://git.ius.plus/Project-Vital/FlutterDevicePlugin.git"
     source: git
     version: "0.0.1"