Kaynağa Gözat

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

finlay 1 yıl önce
ebeveyn
işleme
4873fda54c

+ 6 - 0
lib/managers/data_sync.dart

@@ -188,6 +188,7 @@ class DataSyncManager implements IDataSyncManager {
   @override
   Future<bool> syncPatient(PatientEntity entity) async {
     logger.i("DataSyncManager start sync patient info...");
+    logger.i("Patient info: ${entity.name}|${entity.code}.");
     bool syncResult = false;
     try {
       final jsonMap = jsonDecode(entity.dataJson);
@@ -209,6 +210,11 @@ class DataSyncManager implements IDataSyncManager {
 
       if (syncResult) {
         syncResult = await _syncPatientExt(entity);
+        if (!syncResult) {
+          logger.i("DataSyncManager sync patient ext info fail.");
+        }
+      } else {
+        logger.i("DataSyncManager sync patient base info fail.");
       }
 
       entity.syncState =

+ 13 - 14
lib/managers/patient.dart

@@ -32,27 +32,26 @@ class PatientManager implements IPatientManager {
     DateTime? endTime,
   ) async {
     final isKeywordQuery = keyword != null && keyword.isNotEmpty;
-    final query = db.repositories.patient.queryable.where((x) {
+    var query = db.repositories.patient.queryable.where((x) {
       final List<IDbColumnCondition> arr = [];
       arr.add(x.isValid.equals(true));
       arr.add(x.orgCode.equals(Store.user.organizationCode));
-      arr.add(x.syncState.notEquals(OfflineDataSyncState.success));
+      arr.add(x.overallSyncState.notEquals(OfflineDataSyncState.success));
 
-      if (!isKeywordQuery) {
-        if (startTime != null) {
-          arr.add(x.createTime.gte(startTime));
-        }
-        if (endTime != null) {
-          arr.add(x.createTime.lt(endTime));
-        }
-      }
+      if (!isKeywordQuery) {}
       return arr;
     });
     if (isKeywordQuery) {
-      // 姓名查询
-      query.and((x) => x.name.like("%$keyword%"));
-      // 身份照查询
-      query.or((x) => x.code.like("%$keyword%"));
+      // 根据 姓名or身份证号 模糊查询
+      query = query.whereCustom(
+          " AND ( name like '%$keyword%' OR code like '%$keyword%' ) ");
+    } else {
+      if (startTime != null) {
+        query = query.and((x) => x.createTime.gte(startTime));
+      }
+      if (endTime != null) {
+        query = query.and((x) => x.createTime.lt(endTime));
+      }
     }
     final entities =
         await query.orderBy((x) => x.updateTime, DbOrderByType.desc).toList();

+ 1 - 1
lib/pages/check/health_check_record/controllers/list_controller.dart

@@ -134,7 +134,7 @@ class ListController {
         );
       },
       child: const Text(
-        "体检",
+        "体检",
         style: TextStyle(fontSize: 18),
       ),
     );

+ 1 - 1
lib/pages/medical_checkup_station/registration/controller/list.dart

@@ -491,7 +491,7 @@ class RegistrationListController {
         _examDialog(rowData);
       },
       child: const Text(
-        "体检",
+        "体检",
         style: TextStyle(fontSize: 18),
       ),
     );