|
@@ -8,6 +8,8 @@ import 'package:vitalapp/architecture/utils/verify_permissions.dart';
|
|
|
import 'package:vitalapp/architecture/values/features.dart';
|
|
|
import 'package:vitalapp/components/button.dart';
|
|
|
import 'package:vitalapp/components/search_input.dart';
|
|
|
+import 'package:vitalapp/managers/interfaces/device.dart';
|
|
|
+import 'package:vitalapp/managers/interfaces/models/device.dart';
|
|
|
import 'package:vitalapp/managers/interfaces/patient.dart';
|
|
|
import 'package:vitalapp/pages/facial_recognition/controller.dart';
|
|
|
import 'package:vitalapp/pages/facial_recognition/view.dart';
|
|
@@ -17,9 +19,12 @@ import 'package:vitalapp/pages/id_card_scan/view.dart';
|
|
|
import 'package:vitalapp/pages/medical_checkup_station/registration/controller.dart';
|
|
|
import 'package:vitalapp/pages/medical_checkup_station/registration/widgets/card_reader/view.dart';
|
|
|
import 'package:vitalapp/pages/medical_checkup_station/registration/widgets/form/index.dart';
|
|
|
+import 'package:vitalapp/pages/patient/bluetooth_card_reader/index.dart';
|
|
|
+import 'package:vitalapp/pages/patient/card_reader/index.dart';
|
|
|
import 'package:vitalapp/pages/patient/create/widgets/face_result_dialog.dart';
|
|
|
import 'package:vitalapp/pages/widgets/icon_button.dart';
|
|
|
import 'package:vitalapp/store/store.dart';
|
|
|
+import 'package:vnote_device_plugin/consts/types.dart';
|
|
|
|
|
|
import 'filter_time.dart';
|
|
|
|
|
@@ -145,18 +150,53 @@ class RegistrationFilter extends GetView<RegistrationController> {
|
|
|
|
|
|
/// 读卡逻辑
|
|
|
void onReadCardClicked() async {
|
|
|
- PatientDTO? result;
|
|
|
+ final card = await onReadCardClickedBothBleAndUsb();
|
|
|
+ if (card == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- result = await Get.dialog<PatientDTO>(
|
|
|
- const RegistrationCardReaderDialog(),
|
|
|
- barrierDismissible: false,
|
|
|
+ final patientDto = PatientDTO(
|
|
|
+ cardNo: card.cardNo,
|
|
|
+ patientName: card.name,
|
|
|
+ nationality: card.nation,
|
|
|
+ patientGender: card.gender,
|
|
|
+ birthday: card.birthday,
|
|
|
+ patientAddress: card.address,
|
|
|
);
|
|
|
- if (result != null) {
|
|
|
- controller.formController.confirmSubmit(
|
|
|
- patient: result,
|
|
|
- isVital: isVital!,
|
|
|
- );
|
|
|
+ controller.formController.confirmSubmit(
|
|
|
+ patient: patientDto,
|
|
|
+ isVital: isVital!,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 读卡器读卡
|
|
|
+ Future<CardReaderResult?> onReadCardClickedBothBleAndUsb() async {
|
|
|
+ CardReaderResult? result;
|
|
|
+ // 蓝牙
|
|
|
+ final DeviceModel? device = await getDevice(DeviceTypes.IC_READER);
|
|
|
+ if (device != null) {
|
|
|
+ final bleEnvPassed = await controller.checkDeviceConnectEnv();
|
|
|
+ if (bleEnvPassed) {
|
|
|
+ result = await Get.dialog<CardReaderResult>(
|
|
|
+ const BluetoothCardReaderDialog(),
|
|
|
+ barrierDismissible: false,
|
|
|
+ );
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
+ // USB
|
|
|
+ result = await Get.dialog<CardReaderResult>(
|
|
|
+ const CardReaderDialog(),
|
|
|
+ barrierDismissible: false,
|
|
|
+ );
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ Future<DeviceModel?> getDevice(String type) async {
|
|
|
+ List<DeviceModel> devices =
|
|
|
+ await Get.find<IDeviceManager>().getDeviceList();
|
|
|
+
|
|
|
+ return devices.firstWhereOrNull((element) => element.type == type);
|
|
|
}
|
|
|
|
|
|
/// 点击人脸识别
|