Pārlūkot izejas kodu

Merge branch 'master' into chinese_offline

Melon 1 gadu atpakaļ
vecāks
revīzija
650b06a534

+ 19 - 15
lib/components/dialog_check.dart

@@ -116,21 +116,25 @@ class _VDialogCheckState<T, TValue> extends State<VDialogCheck<T, TValue>> {
               child: InkWell(
             onTap: () {
               final val = widget.valueGetter(data);
-              if (!(widget.MutexValue != null &&
-                      initialValue.contains(widget.MutexValue)) ||
-                  val == widget.MutexValue) {
-                setState(() {
-                  if (val == widget.MutexValue &&
-                      !initialValue.contains(widget.MutexValue)) {
-                    initialValue.clear();
-                  }
-                  if (initialValue.contains(val)) {
-                    initialValue.remove(val);
-                  } else {
-                    initialValue.add(val);
-                  }
-                });
-              }
+              // if (!(widget.MutexValue != null &&
+              //         initialValue.contains(widget.MutexValue)) ||
+              //     val == widget.MutexValue) {
+              setState(() {
+                if ((val == widget.MutexValue &&
+                    !initialValue.contains(widget.MutexValue))) {
+                  initialValue.clear();
+                }
+                if (val != widget.MutexValue &&
+                    initialValue.contains(widget.MutexValue)) {
+                  initialValue.remove(widget.MutexValue);
+                }
+                if (initialValue.contains(val)) {
+                  initialValue.remove(val);
+                } else {
+                  initialValue.add(val);
+                }
+              });
+              // }
             },
             child: widgetItem,
           )),

+ 6 - 0
lib/managers/data_sync.dart

@@ -201,6 +201,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);
@@ -222,6 +223,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 =

+ 1 - 1
lib/managers/patient.dart

@@ -55,7 +55,7 @@ class PatientManager implements IPatientManager {
       query.or((x) => x.code.like("%$keyword%"));
     }
     final entities =
-        await query.orderBy((x) => x.createTime, DbOrderByType.desc).toList();
+        await query.orderBy((x) => x.updateTime, DbOrderByType.desc).toList();
     final dtos = entities.map((e) {
       var patientModel = PatientModelDTO.fromJson(jsonDecode(e.dataJson));
       patientModel.isExistLocalData = true;

+ 1 - 1
lib/mock/services/patient.dart

@@ -134,7 +134,7 @@ class PatientServiceMock extends VitalPatientService {
     final entities = await query
         .offset(offset)
         .limit(request.pageSize)
-        .orderBy((x) => x.createTime, DbOrderByType.desc)
+        .orderBy((x) => x.updateTime, DbOrderByType.desc)
         .toList();
 
     final dtos = entities.map((e) {

+ 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),
       ),
     );

+ 11 - 0
lib/pages/patient_info/state.dart

@@ -125,6 +125,17 @@ class PatientInfomationState {
     _cardNo.updateValue(val);
     if (cardType == CardTypeEnum.Identity) {
       birthday = extractBirthDateFromIDCard(val);
+      gender = checkGenderFromID(val);
+    }
+  }
+
+  GenderEnum checkGenderFromID(String idNumber) {
+    int secondLastDigit = int.parse(idNumber[idNumber.length - 2]);
+
+    if (secondLastDigit % 2 == 0) {
+      return GenderEnum.Female;
+    } else {
+      return GenderEnum.Male;
     }
   }