Ver Fonte

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

finlay há 1 ano atrás
pai
commit
14bd3d1446

+ 1 - 16
lib/managers/patient.dart

@@ -105,22 +105,7 @@ class PatientManager implements IPatientManager {
           var isNotUploadedPatient =
               await db.repositories.patient.isNotUploadedPatient(element.code!);
           if (isNotUploadedPatient) {
-            if (kIsOnline) {
-              continue;
-            } else {
-              patientModel.isExistLocalData = true;
-            }
-          } else {
-            int localCount = 0;
-            localCount = await db.repositories.diagnosis
-                .getNotUploadedCountByPatientCode(
-              element.code!,
-              Store.user.userCode!,
-            );
-
-            if (localCount > 0) {
-              patientModel.isExistLocalData = true;
-            }
+            patientModel.isExistLocalData = true;
           }
         }
 

+ 6 - 6
lib/managers/registration.dart

@@ -36,12 +36,12 @@ class RegistrationManager implements IRegistrationManager {
   }) async {
     try {
       GetRegiterInfoPageRequest request = GetRegiterInfoPageRequest(
-        pageSize: pageSize!,
-        pageIndex: pageIndex!,
-        keyword: keyword,
-        startTime: startTime?.toUtc(),
-        endTime: endTime?.toUtc(),
-      );
+          pageSize: pageSize!,
+          pageIndex: pageIndex!,
+          keyword: keyword,
+          startTime: startTime?.toUtc(),
+          endTime: endTime?.toUtc(),
+          projectType: VitalProjectTypeEnum.VitalCloud);
       request.token = Store.user.token;
 
       final getExamBookingByIDCard =

+ 6 - 6
lib/pages/check/examination/controller.dart

@@ -10,18 +10,18 @@ import 'package:vitalapp/global.dart';
 import 'package:vitalapp/managers/interfaces/exam.dart';
 import 'package:vitalapp/pages/check/examination/state.dart';
 import 'package:vitalapp/pages/check/models/form.dart';
-import 'package:vitalapp/store/store.dart';
 
 class ExaminationController extends GetxController {
-  ExaminationController();
+  ExaminationController({
+    required this.patientCode,
+  });
+  final String patientCode;
   final _examManager = Get.find<IExamManager>();
   final state = ExaminationState();
-  String? patientCode;
   String? batchNumber;
 
   _initData() {
-    // update(["examination"]);
-    patientCode = Store.user.currentSelectPatientInfo?.code ?? '';
+    update(["examination"]);
     getBatchNumber();
   }
 
@@ -82,7 +82,7 @@ class ExaminationController extends GetxController {
     if (result ?? false) {
       try {
         template.save(data);
-        PromptBox.toast('保存成功');
+        // PromptBox.toast('保存成功');
       } catch (err) {
         PromptBox.toast('保存失败');
       }

+ 64 - 51
lib/pages/check/examination/view.dart

@@ -1,10 +1,30 @@
+import 'package:fis_common/event/event_type.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
 import 'package:vitalapp/pages/check/examination/controller.dart';
 // import 'package:vitalapp/pages/check/widgets/configurable_card.dart';
 import 'package:vitalapp/pages/check/widgets/new_configurable_card.dart';
 
-class ExaminationPage extends GetView<ExaminationController> {
+class ExaminationPage extends StatefulWidget {
+  const ExaminationPage({
+    Key? key,
+    required this.idCard,
+    required this.onSubmitEvent,
+  }) : super(key: key);
+  final FEventHandler<bool> onSubmitEvent;
+  final String idCard;
+
+  @override
+  State<ExaminationPage> createState() => _ExaminationPageState();
+}
+
+class _ExaminationPageState extends State<ExaminationPage> {
+  final controller = Get.find<ExaminationController>();
+
+  String _cardKey = "ZZYBZK";
+  GlobalKey<NewConfigurableFormState> newConfigurableFormKey =
+      GlobalKey<NewConfigurableFormState>();
+
   @override
   Widget build(BuildContext context) {
     return Scaffold(
@@ -13,66 +33,59 @@ class ExaminationPage extends GetView<ExaminationController> {
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
         children: [
           _buildExamList(),
-          Obx(
-            () => _buildExamContent(controller.state.cardKey),
-          )
+          Expanded(
+            child: NewConfigurableCard(
+              key: UniqueKey(),
+              onSubmitEvent: widget.onSubmitEvent,
+              cardKey: _cardKey,
+              callBack: (key, templateCode, data) async {
+                await controller.createOrUpdateExam(key, templateCode, data);
+                return true;
+              },
+              patientCode: widget.idCard,
+            ),
+          ),
         ],
       ),
     );
   }
 
-  Widget _buildExamContent(String cardKey) {
-    if (cardKey.isEmpty) return Container();
-    return Expanded(
-      child: NewConfigurableCard(
-        cardKey: cardKey,
-        callBack: (key, templateCode, data) async {
-          await controller.createOrUpdateExam(key, templateCode, data);
-          return true;
-        },
-        patientCode: controller.patientCode,
-      ),
-    );
-  }
-
   Widget _buildExamList() {
-    return Obx(
-      () => Container(
-        margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
-        child: Column(
-          crossAxisAlignment: CrossAxisAlignment.start,
-          children: controller.menuList
-              .map(
-                (e) => InkWell(
-                  onTap: () {
-                    controller.state.cardKey = e.value;
-                  },
-                  child: Container(
-                    margin: EdgeInsets.all(8),
-                    padding: EdgeInsets.all(8),
-                    width: 200,
-                    decoration: BoxDecoration(
-                      color: controller.state.cardKey == e.value
-                          ? Colors.blue
-                          : Colors.white,
-                      borderRadius: BorderRadius.all(
-                        Radius.circular(8),
-                      ),
+    return Container(
+      margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: controller.menuList
+            .map(
+              (e) => InkWell(
+                onTap: () async {
+                  // await newConfigurableFormKey.currentState!.getFormValue();
+                  widget.onSubmitEvent.emit(this, true);
+                  _cardKey = e.value;
+
+                  setState(() {});
+                },
+                child: Container(
+                  margin: EdgeInsets.all(8),
+                  padding: EdgeInsets.all(8),
+                  width: 200,
+                  decoration: BoxDecoration(
+                    color: _cardKey == e.value ? Colors.blue : Colors.white,
+                    borderRadius: BorderRadius.all(
+                      Radius.circular(8),
                     ),
-                    child: Text(
-                      e.label,
-                      style: TextStyle(
-                        fontSize: 20,
-                        color: controller.state.cardKey == e.value
-                            ? Colors.white
-                            : Colors.black,
-                      ),
+                  ),
+                  child: Text(
+                    e.label,
+                    style: TextStyle(
+                      fontSize: 20,
+                      color: _cardKey == e.value ? Colors.white : Colors.black,
                     ),
                   ),
                 ),
-              )
-              .toList(),
-        ),
+              ),
+            )
+            .toList(),
       ),
     );
   }

+ 14 - 3
lib/pages/check/health_check_record/controllers/list_controller.dart

@@ -1,6 +1,7 @@
 import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
+import 'package:fis_common/event/event_type.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
 import 'package:vitalapp/components/appbar.dart';
@@ -106,14 +107,24 @@ class ListController {
   Widget _buildHealthCheck(ResidentModel rowData) {
     return TextButton(
       onPressed: () async {
-        Get.lazyPut(() => ExaminationController());
-        Get.dialog(
+        final FEventHandler<bool> onSubmitEvent = FEventHandler<bool>();
+
+        Get.lazyPut(
+          () => ExaminationController(
+            patientCode: rowData.idNumber,
+          ),
+        );
+        await Get.to(
           Scaffold(
-            body: ExaminationPage(),
+            body: ExaminationPage(
+              idCard: rowData.idNumber,
+              onSubmitEvent: onSubmitEvent,
+            ),
             appBar: VAppBar(
               titleText: "体检",
             ),
           ),
+          fullscreenDialog: true,
         );
       },
       child: const Text(

+ 0 - 142
lib/pages/check/widgets/exam_configurable/exam_body_weight.dart

@@ -1,18 +1,8 @@
 import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:vitalapp/managers/device_controller_manager.dart';
-import 'package:vitalapp/pages/medical/widgets/device_status_position.dart';
-import 'package:vnote_device_plugin/consts/types.dart';
-import 'package:vnote_device_plugin/devices/weight.dart';
-import 'package:vitalapp/managers/interfaces/models/device.dart';
 import 'package:vitalapp/pages/check/models/form.dart';
-import 'package:vitalapp/pages/check/widgets/device_controller.dart';
 import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_card.dart';
 
 import 'package:vitalapp/components/dialog_number.dart';
-import 'package:vitalapp/pages/medical/models/worker.dart';
-import 'package:vitalapp/pages/medical/widgets/device_status.dart';
-import 'package:fis_common/logger/logger.dart';
 
 // ignore: must_be_immutable
 class ExamBodyWeight extends StatefulWidget {
@@ -31,157 +21,25 @@ class ExamBodyWeight extends StatefulWidget {
 }
 
 class _ExamBodyWeightState extends State<ExamBodyWeight> {
-  final controller = Get.find<DeviceController>();
-  DeviceControllerManager? bmi;
-  WeightDeviceWorker? worker;
-  bool isConnectFail = false;
-
-  int errorCount = 0;
-
-  WorkerStatus connectStatus = WorkerStatus.connecting;
   @override
   void initState() {
-    currentDevice();
     super.initState();
   }
 
-  Future<void> currentDevice() async {
-    DeviceModel? device = await controller.getDevice(DeviceTypes.WEIGHT);
-    if (device == null) {
-      connectStatus = WorkerStatus.unboundDevice;
-      setState(() {});
-      return;
-    }
-    bmi = DeviceControllerManager(DeviceTypes.WEIGHT, device.model, device.mac);
-    worker = bmi!.worker as WeightDeviceWorker;
-    connectStatus = bmi!.connectStatus;
-
-    loadListeners();
-    connect();
-  }
-
-  void loadListeners() {
-    worker!.successEvent.addListener(_onSuccess);
-    worker!.connectErrorEvent.addListener(_onConnectFail);
-    worker!.connectedEvent.addListener(_onConnectSuccess);
-    worker!.disconnectedEvent.addListener(_onDisconnected);
-  }
-
-  void releaseListeners() {
-    worker!.connectErrorEvent.removeListener(_onConnectFail);
-    worker!.connectedEvent.removeListener(_onConnectSuccess);
-    worker!.successEvent.removeListener(_onSuccess);
-    worker!.disconnectedEvent.removeListener(_onDisconnected);
-  }
-
-  Future<void> connect() async {
-    if (worker != null) {
-      await worker!.connect();
-    }
-  }
-
-  /// 尝试重连
-  Future<void> tryReconnect() async {
-    if (worker != null) {
-      await disconnect();
-      await connect();
-    }
-  }
-
-  Future<void> disconnect() async {
-    if (worker != null) {
-      await worker!.disconnect();
-    }
-  }
-
   @override
   void dispose() {
-    bmi?.dispose();
-    releaseListeners();
-    disconnect();
-    worker?.dispose();
     super.dispose();
   }
 
-  void _onSuccess(_, double e) {
-    setState(() {
-      widget.currentInputValue = e.toString();
-      widget.bodyWeightInput!.call(widget.currentInputValue);
-      connectStatus = WorkerStatus.connected;
-    });
-  }
-
-  void _onConnectFail(sender, e) {
-    print('连接设备失败');
-    logger.i("连接设备失败:${worker!.mac}");
-    if (errorCount < 3) {
-      errorCount++;
-      tryReconnect();
-    } else {
-      isConnectFail = true;
-    }
-    connectStatus = WorkerStatus.connectionFailed;
-    setState(() {});
-  }
-
-  void _onConnectSuccess(sender, e) {
-    logger.i("设备连接成功:${worker!.mac}");
-    isConnectFail = false;
-    errorCount = 0;
-    connectStatus = WorkerStatus.connected;
-    setState(() {});
-  }
-
-  void _onDisconnected(sender, e) {
-    print('设备连接中断');
-    logger.i("设备连接中断:${worker!.mac}");
-    tryReconnect();
-    errorCount = 0;
-    connectStatus = WorkerStatus.disconnected;
-
-    setState(() {});
-  }
-
   @override
   Widget build(BuildContext context) {
     return Stack(
       children: [
         _buildBMI(),
-        if (!isConnectFail)
-          DeviceStatusPosition(
-            deviceStatus: DeviceStatus(connectStatus: connectStatus),
-          )
-        else
-          _buildErrorButton(),
       ],
     );
   }
 
-  /// 需要封装一下
-  Widget _buildErrorButton() {
-    return DeviceStatusPosition(
-      deviceStatus: Row(
-        children: [
-          const Text(
-            '请确认设备是否启动',
-            style: TextStyle(fontSize: 24, color: Colors.red),
-          ),
-          IconButton(
-            onPressed: () {
-              tryReconnect();
-              setState(() {
-                connectStatus = WorkerStatus.connecting;
-                isConnectFail = false;
-              });
-            },
-            icon: const Icon(Icons.refresh),
-            iconSize: 32,
-          ),
-        ],
-      ),
-    );
-  }
-
   Widget _buildBMI() {
     return ExamCard(
       title: widget.currentFormObject.label ?? '',

+ 2 - 217
lib/pages/check/widgets/exam_configurable/exam_urinalys.dart

@@ -1,21 +1,8 @@
 import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:vitalapp/architecture/utils/prompt_box.dart';
-import 'package:vitalapp/components/button.dart';
 import 'package:vitalapp/components/dialog_input.dart';
-import 'package:vitalapp/managers/device_controller_manager.dart';
-import 'package:vitalapp/pages/check/widgets/device_controller.dart';
-import 'package:vitalapp/pages/mappers/urine.dart';
-import 'package:vitalapp/pages/medical/widgets/device_status_position.dart';
 import 'package:vnote_device_plugin/consts/types.dart';
-import 'package:vitalapp/managers/interfaces/models/device.dart';
 import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_card.dart';
 import 'package:vitalapp/pages/medical/controller.dart';
-import 'package:vitalapp/pages/medical/models/worker.dart';
-import 'package:vitalapp/pages/medical/widgets/device_status.dart';
-import 'package:vnote_device_plugin/devices/urine.dart';
-import 'package:vnote_device_plugin/models/exams/urine.dart';
-import 'package:fis_common/logger/logger.dart';
 
 ///  尿常规
 class ExamUrinalysis extends StatefulWidget {
@@ -32,17 +19,8 @@ class ExamUrinalysis extends StatefulWidget {
 }
 
 class _ExamUrinalysisState extends State<ExamUrinalysis> {
-  final controller = Get.find<DeviceController>();
-  late DeviceControllerManager urinaly;
-  UrineDeviceWorker? worker;
-  UrineExamData? urineExamData;
-  bool isConnectFail = false;
-  bool isAutoTesting = false;
-  int errorCount = 0;
   String? deviceType = MedicalController.typeConvertMap[DeviceTypes.URINE];
 
-  WorkerStatus connectStatus = WorkerStatus.connecting;
-
   List<Map<String, String>> urinalysis = [
     {"name": '尿白细胞', "key": 'LEU'},
     {"name": '红细胞/潜血', "key": 'BLD'},
@@ -60,226 +38,33 @@ class _ExamUrinalysisState extends State<ExamUrinalysis> {
   Map _value = {};
   @override
   void initState() {
-    initTemperature();
-    currentDevice();
+    initUrinalys();
     super.initState();
   }
 
-  Future<void> currentDevice() async {
-    DeviceModel? device = await controller.getDevice(DeviceTypes.URINE);
-    if (device == null) {
-      connectStatus = WorkerStatus.unboundDevice;
-      setState(() {});
-      return;
-    }
-    urinaly =
-        DeviceControllerManager(DeviceTypes.URINE, device.model, device.mac);
-    worker = urinaly.worker as UrineDeviceWorker;
-    connectStatus = urinaly.connectStatus;
-    loadListeners();
-    worker!.connect();
-  }
-
-  Future<void> initTemperature() async {
+  Future<void> initUrinalys() async {
     await initData();
   }
 
-  void loadListeners() {
-    if (worker != null) {
-      worker!.successEvent.addListener(_onSuccess);
-      worker!.connectErrorEvent.addListener(_onConnectFail);
-      worker!.connectedEvent.addListener(_onConnectSuccess);
-      worker!.disconnectedEvent.addListener(_onDisconnected);
-      // worker!.errorEvent.addListener(_onError);
-    }
-  }
-
   Future<void> initData() async {
     _value = widget.currentValue;
     setState(() {});
   }
 
-  void releaseListeners() {
-    if (worker != null) {
-      worker!.connectErrorEvent.removeListener(_onConnectFail);
-      worker!.connectedEvent.removeListener(_onConnectSuccess);
-      worker!.successEvent.removeListener(_onSuccess);
-      worker!.disconnectedEvent.removeListener(_onDisconnected);
-      // worker!.errorEvent.removeListener(_onError);
-    }
-
-    // worker.tempTooLowEvent.removeListener(_onTempTooLowOrTooHeigh);
-    // worker.tempTooHighEvent.removeListener(_onTempTooLowOrTooHeigh);
-    // controller.deviceCloseSuccessEvent.removeListener(_onDeviceCloseSuccess);
-  }
-
-  /// 尝试重连
-  Future<void> tryReconnect() async {
-    //await worker.disconnect();
-    //5s后在执行,是为了防止重连与断开事件一直相互触发
-    Future.delayed(const Duration(seconds: 5), () async {
-      //如果5秒后仍然是未连接状态,则重试连接
-      if (connectStatus == WorkerStatus.disconnected ||
-          connectStatus == WorkerStatus.connectionFailed ||
-          connectStatus == WorkerStatus.connecting) {
-        await disconnect();
-        await connect();
-      }
-    });
-  }
-
-  Future<void> disconnect() async {
-    await worker?.disconnect();
-  }
-
-  Future<void> connect() async {
-    await worker?.connect();
-  }
-
   @override
   void dispose() {
-    urinaly.dispose();
-    releaseListeners();
-    disconnect();
-    worker?.dispose();
     super.dispose();
   }
 
-  void _onSuccess(_, UrineExamData e) {
-    setState(() {
-      // _value = e.toString();
-      isAutoTesting = false;
-      urineExamData = e;
-      _value = UrineExamDataMapper.convertUrineExamDataToMap(urineExamData!);
-      widget.urinalysis(_value);
-      connectStatus = WorkerStatus.connected;
-    });
-  }
-
-  void _onConnectFail(sender, e) {
-    print('连接设备失败');
-
-    logger.i("设备连接失败:${worker!.mac}");
-    if (errorCount < 3) {
-      errorCount++;
-      tryReconnect();
-    } else {
-      isConnectFail = true;
-    }
-
-    connectStatus = WorkerStatus.connectionFailed;
-    setState(() {});
-  }
-
-  void _onConnectSuccess(sender, e) {
-    logger.i("设备连接成功:${worker!.mac}");
-    isConnectFail = false;
-    errorCount = 0;
-    connectStatus = WorkerStatus.connected;
-    setState(() {});
-  }
-
-  void _onError(sender, e) async {
-    logger.i("测试失败,请确定放好试纸并且试纸已浸湿尿液");
-    PromptBox.toast("测试失败,请确定放好试纸并且试纸已浸湿尿液");
-    isAutoTesting = false;
-    setState(() {});
-  }
-
-  void _onDisconnected(sender, e) {
-    print('设备连接中断 errorCount:$errorCount');
-    logger.i("设备连接中断:${worker!.mac} errorCount:$errorCount");
-    if (errorCount < 3) {
-      errorCount++;
-
-      tryReconnect();
-    } else {
-      isConnectFail = true;
-    }
-    connectStatus = WorkerStatus.disconnected;
-    setState(() {});
-  }
-
   @override
   Widget build(BuildContext context) {
     return Stack(
       children: [
         _buildUrinalysis(),
-        if (!isConnectFail)
-          DeviceStatusPosition(
-            deviceStatus: DeviceStatus(connectStatus: connectStatus),
-          )
-        else
-          _buildErrorButton(),
-        // _buildAutoTest(),
       ],
     );
   }
 
-  Widget _buildErrorButton() {
-    return DeviceStatusPosition(
-      deviceStatus: Row(
-        children: [
-          const Text(
-            '请确认设备是否启动',
-            style: TextStyle(fontSize: 24, color: Colors.red),
-          ),
-          IconButton(
-            onPressed: () {
-              tryReconnect();
-              setState(() {
-                connectStatus = WorkerStatus.connecting;
-                isConnectFail = false;
-              });
-            },
-            icon: const Icon(Icons.refresh),
-            iconSize: 32,
-          ),
-        ],
-      ),
-    );
-  }
-
-  Widget _buildAutoTest() {
-    Widget autoTestStatus;
-
-    if (isAutoTesting) {
-      autoTestStatus = const SizedBox();
-      // CountdownPage(
-      //   seconds: 60,
-      //   title: "等待测试",
-      // );
-    } else {
-      autoTestStatus = VButton(
-        onTap: () {
-          worker!.autoTest();
-          isAutoTesting = true;
-          _value = {};
-          setState(() {});
-        },
-        child: const Center(
-          child: Text(
-            "采样",
-            style: TextStyle(fontSize: 24),
-          ),
-        ),
-      );
-    }
-    if (connectStatus == WorkerStatus.connected) {
-      return Positioned(
-        top: 16,
-        left: 120,
-        child: SizedBox(
-          width: 200,
-          height: 50,
-          child: autoTestStatus,
-        ),
-      );
-    } else {
-      return const SizedBox();
-    }
-  }
-
   Widget _buildUrinalysis() {
     return ExamCard(
       title: '尿常规',

+ 54 - 46
lib/pages/check/widgets/new_configurable_card.dart

@@ -1,9 +1,9 @@
 import 'dart:convert';
 
+import 'package:fis_common/event/event_type.dart';
 import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
-import 'package:vitalapp/components/button.dart';
 import 'package:vitalapp/components/dialog_input.dart';
 import 'package:vitalapp/components/dialog_number.dart';
 import 'package:vitalapp/components/dynamic_drawer.dart';
@@ -38,6 +38,8 @@ class NewConfigurableCard extends StatefulWidget {
   final Widget? followUpWidget;
   final String? patientCode;
   final String? examData;
+
+  final FEventHandler<bool>? onSubmitEvent;
   const NewConfigurableCard({
     super.key,
     required this.cardKey,
@@ -45,13 +47,14 @@ class NewConfigurableCard extends StatefulWidget {
     this.followUpWidget,
     this.patientCode,
     this.examData,
+    this.onSubmitEvent,
   });
 
   @override
-  State<NewConfigurableCard> createState() => _ConfigurableFormState();
+  State<NewConfigurableCard> createState() => NewConfigurableFormState();
 }
 
-class _ConfigurableFormState extends State<NewConfigurableCard> {
+class NewConfigurableFormState extends State<NewConfigurableCard> {
   /// 当前最新的模板的键值对
   Map<String, dynamic> templateRelation = {};
 
@@ -62,6 +65,7 @@ class _ConfigurableFormState extends State<NewConfigurableCard> {
   // int currentTitleIndex = 0;
 
   Map<String, dynamic> formValue = {};
+
   var scaffoldKey = GlobalKey<ScaffoldState>();
 
   final _templateManager = Get.find<ITemplateManager>();
@@ -93,6 +97,11 @@ class _ConfigurableFormState extends State<NewConfigurableCard> {
         initTemplate();
       }
     });
+    widget.onSubmitEvent?.addListener((sender, e) {
+      if (e) {
+        submit();
+      }
+    });
   }
 
   @override
@@ -100,16 +109,23 @@ class _ConfigurableFormState extends State<NewConfigurableCard> {
     super.dispose();
   }
 
+  Future<void> submit() async {
+    final result = await widget.callBack(
+      widget.cardKey,
+      templateRelation[widget.cardKey]!,
+      jsonEncode(formValue),
+    );
+    // if (result) {
+    //   Get.back();
+    // }
+  }
+
   Future<void> initTemplate() async {
     Get.find<DeviceController>().busy = true;
     await fetchTemplateIndex();
     await fetchTemplate(widget.cardKey);
     await fetchTemplateData();
-    // GlobalCacheHelper.setItem(GlobalCacheHelper.keys.followUpEditTemp, "");//TODO
     Get.find<DeviceController>().busy = false;
-    // if (!['GXY', 'TNB'].contains(widget.cardKey)) {
-    //   fetchTemplateData();
-    // }
   }
 
   /// 读取健康检测的缓存
@@ -236,37 +252,37 @@ class _ConfigurableFormState extends State<NewConfigurableCard> {
       resizeToAvoidBottomInset: false,
       body: Column(
         children: [
-          Row(
-            children: [
-              Container(
-                margin: const EdgeInsets.only(top: 8, right: 16),
-                width: 130,
-                height: 54,
-                child: VButton(
-                  onTap: () async {
-                    final result = await widget.callBack(
-                      widget.cardKey,
-                      templateRelation[widget.cardKey]!,
-                      jsonEncode(formValue),
-                    );
-                    if (result) {
-                      Get.back();
-                    }
-                  },
-                  child: Row(
-                    mainAxisAlignment: MainAxisAlignment.center,
-                    children: const [
-                      Icon(Icons.save, size: 24),
-                      SizedBox(
-                        width: 8,
-                      ),
-                      Text("保存", style: TextStyle(fontSize: 20)),
-                    ],
-                  ),
-                ),
-              ),
-            ],
-          ),
+          // Row(
+          //   children: [
+          //     Container(
+          //       margin: const EdgeInsets.only(top: 8, right: 16),
+          //       width: 130,
+          //       height: 54,
+          //       child: VButton(
+          //         onTap: () async {
+          //           final result = await widget.callBack(
+          //             widget.cardKey,
+          //             templateRelation[widget.cardKey]!,
+          //             jsonEncode(formValue),
+          //           );
+          //           if (result) {
+          //             Get.back();
+          //           }
+          //         },
+          //         child: Row(
+          //           mainAxisAlignment: MainAxisAlignment.center,
+          //           children: const [
+          //             Icon(Icons.save, size: 24),
+          //             SizedBox(
+          //               width: 8,
+          //             ),
+          //             Text("保存", style: TextStyle(fontSize: 20)),
+          //           ],
+          //         ),
+          //       ),
+          //     ),
+          //   ],
+          // ),
           Expanded(
             child: Stack(
               children: [
@@ -278,14 +294,6 @@ class _ConfigurableFormState extends State<NewConfigurableCard> {
                     _buildContent(),
                   ],
                 ),
-                // if (currentTitleIndex != currentTemplate.length - 1)
-                //   _buildPositionedButton(
-                //     () async {
-                //       currentTitleIndex++;
-                //       setState(() {});
-                //     },
-                //     right: -30,
-                //   ),
               ],
             ),
           )

+ 4 - 1
lib/pages/medical_checkup_station/registration/controller/form.dart

@@ -39,7 +39,10 @@ class RegistrationFormController {
       request: addRegiterInfo,
     );
     if (infoResult?.isNewPatient ?? false) {
-      _homeController.switchNavByName("/patient/create");
+      Get.toNamed(
+        "/patient/info",
+        parameters: {"code": patient?.cardNo ?? ''},
+      );
     }
   }
 

+ 13 - 15
lib/pages/medical_checkup_station/registration/controller/list.dart

@@ -1,3 +1,4 @@
+import 'package:fis_common/event/event_type.dart';
 import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
@@ -377,10 +378,19 @@ class RegistrationListController {
   Widget _buildHealthCheck(ResidentModel rowData) {
     return TextButton(
       onPressed: () async {
-        Get.lazyPut(() => ExaminationController());
+        Get.lazyPut(
+          () => ExaminationController(
+            patientCode: rowData.idNumber,
+          ),
+        );
+        final FEventHandler<bool> onSubmitEvent = FEventHandler<bool>();
+
         Get.dialog(
           Scaffold(
-            body: ExaminationPage(),
+            body: ExaminationPage(
+              idCard: rowData.idNumber,
+              onSubmitEvent: onSubmitEvent,
+            ),
             appBar: VAppBar(
               titleText: "体检",
               actions: [
@@ -388,19 +398,7 @@ class RegistrationListController {
                   margin: EdgeInsets.only(right: 10),
                   child: ElevatedButton(
                     onPressed: () async {
-                      final controller = Get.find<ExaminationController>();
-                      // controller.createOrUpdateExam(key, templateCode, data);
-                      // var result = await controller.updatePatientAsync();
-                      // if (result) {
-                      //   PromptBox.toast("保存成功");
-                      //   await controller.changePatient();
-                      //   Get.back();
-                      // }
-
-                      //         callBack: (key, templateCode, data) async {
-                      //   await controller.createOrUpdateExam(key, templateCode, data);
-                      //   return true;
-                      // },
+                      onSubmitEvent.emit(this, true);
                     },
                     child: Text('保存'),
                   ),

+ 0 - 5
lib/pages/settings/center/view.dart

@@ -45,11 +45,6 @@ class SettingCenterPage extends GetView<SettingCenterController> {
       title: "同步管理",
       icon: Icon(Icons.sync, color: Colors.grey.shade700),
       onTap: () {
-        if (!kIsOnline) {
-          PromptBox.toast("请检查网络连接");
-          return;
-        }
-        //Get.toNamed("/data_sync");
         Get.toNamed("/sync/center");
       },
     );

+ 2 - 2
pubspec.yaml

@@ -47,7 +47,7 @@ dependencies:
   fis_jsonrpc:
     git:
       url: http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git
-      ref: 41944c6
+      ref: fc87e31
   vnote_device_plugin:
     git:
       url: http://git.ius.plus/Project-Vital/FlutterDevicePlugin.git
@@ -155,7 +155,7 @@ dependency_overrides:
   fis_jsonrpc:
     git:
       url: http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git
-      ref: 41944c6
+      ref: fc87e31
     #path: ../fis_lib_jsonrpc
   fis_theme:
     git: