Browse Source

Merge branch 'master' of http://git.ius.plus/Project-Vital/VitalApp

Melon 1 year ago
parent
commit
bfc4238ed2

+ 29 - 24
lib/pages/facial_recognition/controller.dart

@@ -365,7 +365,7 @@ class FacialRecognitionController extends GetxController
   /// 人脸识别逻辑
   void doFacialRecognition() async {
     doFacialRecognitionTimes++;
-    if (doFacialRecognitionTimes == 10) {
+    if (doFacialRecognitionTimes >= 10) {
       // 尝试十次后宣告失败
       state.isRunningFaceRecognition = false;
       PromptBox.toast('人脸识别失败,请先录入人脸信息或更新人脸信息');
@@ -487,33 +487,38 @@ class FacialRecognitionController extends GetxController
               /// 询问是否需要解绑原身份证并绑定当前身份证
               /// 原身份证:result.bindCardNo
               /// 当前身份证:idCardInfo.idCardNumber
-              await Get.dialog(VAlertDialog(
-                title: '提示',
-                content: Container(
-                  margin: const EdgeInsets.only(bottom: 20),
-                  child: const Text(
-                    '该人脸已绑定其他身份证,是否解绑并绑定当前身份证?',
-                    style: TextStyle(fontSize: 20),
-                    textAlign: TextAlign.center,
+              await Get.dialog(
+                VAlertDialog(
+                  title: '提示',
+                  width: 600,
+                  content: Container(
+                    margin:
+                        const EdgeInsets.only(bottom: 20, left: 20, right: 20),
+                    child: Text(
+                      '该人脸已绑定身份证(${result.bindCardNo})\n是否解绑并绑定当前身份证(${idCardInfo.idCardNumber})?',
+                      style: const TextStyle(fontSize: 20),
+                      textAlign: TextAlign.left,
+                    ),
                   ),
+                  showCancel: true,
+                  onConfirm: () async {
+                    bool success = await unbindAndCreateByFaceImageAsync(
+                      result.bindCardNo!,
+                      idCardInfo.idCardNumber,
+                      url,
+                    );
+                    if (success) {
+                      Get.back(result: true);
+                    } else {
+                      PromptBox.toast('人脸数据存入失败');
+                    }
+                  },
                 ),
-                showCancel: true,
-                onConfirm: () async {
-                  bool success = await unbindAndCreateByFaceImageAsync(
-                    result.bindCardNo!,
-                    idCardInfo.idCardNumber,
-                    url,
-                  );
-                  if (success) {
-                    Get.back(result: true);
-                  } else {
-                    PromptBox.toast('人脸数据存入失败');
-                  }
-                },
-              ));
+              );
             }
+          } else {
+            PromptBox.toast('人脸数据存入失败: ${result.errMessage}');
           }
-          PromptBox.toast('人脸数据存入失败: ${result.errMessage}');
         }
       } catch (e) {
         logger.e("savePatientBaseByFaceImageAsync failed: $e", e);

+ 4 - 0
lib/pages/home/personal_center/controller.dart

@@ -61,6 +61,10 @@ class PersonalCenterController extends FControllerBase {
       return;
     }
     var newPassword = FEncryptHelper.symmetryEncrypt(state.newPassword);
+    if (oldPasswordEncrypt == newPassword) {
+      PromptBox.toast('新密码不能与旧密码相同!');
+      return;
+    }
     final result = await _accountManager.updateUserPasswordAsync(newPassword);
     if (result) {
       PromptBox.toast("密码更新成功!");

+ 28 - 7
lib/pages/home/view.dart

@@ -1,6 +1,11 @@
+import 'dart:io';
+
 import 'package:fis_jsonrpc/rpc.dart';
+import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
+import 'package:path_provider/path_provider.dart';
+import 'package:vitalapp/architecture/utils/prompt_box.dart';
 import 'package:vitalapp/components/dynamic_drawer.dart';
 import 'package:vitalapp/pages/home/controller.dart';
 import 'package:vitalapp/pages/home/widgets/avatar.dart';
@@ -259,13 +264,29 @@ class HomePage extends GetView<HomeController> {
         const SizedBox(width: 10),
         Column(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: const [
-            Text(
-              "杏聆荟健康平台",
-              style: TextStyle(
-                color: Colors.white,
-                fontSize: 24,
-                fontWeight: FontWeight.bold,
+          children: [
+            GestureDetector(
+              onDoubleTap: () async {
+                if (kDebugMode) {
+                  var sPath =
+                      "/data/user/0/com.vinno.vitalapp/databases/vital.db";
+                  final directory = await getExternalStorageDirectory();
+                  final path = directory?.path;
+                  final sourceFile = File(sPath);
+                  final destFile = File('$path/vital.db');
+
+                  await destFile.create(recursive: true);
+                  await sourceFile.copy(destFile.path);
+                  PromptBox.toast('Copy成功');
+                }
+              },
+              child: const Text(
+                "杏聆荟健康平台",
+                style: TextStyle(
+                  color: Colors.white,
+                  fontSize: 24,
+                  fontWeight: FontWeight.bold,
+                ),
               ),
             ),
           ],

+ 3 - 3
lib/pages/medical/controller.dart

@@ -257,7 +257,7 @@ class MedicalController extends FControllerBase {
         .convertDiagnosisDataToList(diagnosisDataValue);
 
     if (diagnosisItems.isEmpty) {
-      if (patientCode.isNotEmpty) {
+      if (patientCode.isNotEmpty && kIsOnline) {
         bool submitHistory = await _submitHistory();
         if (submitHistory) {
           PromptBox.toast('提交成功');
@@ -327,7 +327,7 @@ class MedicalController extends FControllerBase {
           if (patientInfo == null) {
             ///如果Server没有,则从本地读取
             var patientEntity = await db.repositories.patient.singleByCode(
-              data.code,
+              data.patientCode,
             );
             if (patientEntity != null) {
               patientInfo =
@@ -349,7 +349,7 @@ class MedicalController extends FControllerBase {
               crowdLabels: patientInfo?.crowdLabels,
               cardType: patientInfo?.cardType ?? CardTypeEnum.Identity,
               contractedDoctor: patientInfo?.contractedDoctor,
-              appDataId: appDataId,
+              appDataId: data.code,
               diagnosisTime: data.updateTime ?? data.createTime,
               diagnosisItems: diagnosisItems,
             ),