瀏覽代碼

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

finlay 10 月之前
父節點
當前提交
8d8698d4be

+ 20 - 17
lib/pages/patient/detail/widgets/last_record.dart

@@ -75,8 +75,26 @@ class LastRecordTable extends StatelessWidget {
     // var controller = Get.find<HealthCheckListController>();
     var tableRows = <TableRow>[];
     for (var i = 0; i < tableData.length; i++) {
-      final rowData = tableData[i];
+      final List<String> rowData = tableData[i];
       final label = rowData[0];
+      List<Widget> children = [];
+      for (String child in rowData) {
+        if (rowData.indexOf(child) == 3) {
+          continue;
+        }
+        if (checkKey == "HEITCMC") {
+          children.add(_buildConstitutionDataCell(child));
+        }
+        if (label == '心电测量') {
+          children.add(_buildImageDataCell(child));
+        } else if (label == '十二导心电(30秒)') {
+          children.add(_buildImageDataCell(child));
+        } else if (label == '十二导分析结果') {
+          children.add(_buildEcg12DataCell(child));
+        } else {
+          children.add(_buildDataCell(child));
+        }
+      }
       tableRows.add(
         TableRow(
           decoration: i % 2 == 0
@@ -84,22 +102,7 @@ class LastRecordTable extends StatelessWidget {
               : const BoxDecoration(
                   color: Color.fromRGBO(233, 244, 255, 1),
                 ),
-          children: tableData[i].map(
-            (cellData) {
-              if (checkKey == "HEITCMC") {
-                return _buildConstitutionDataCell(cellData);
-              }
-              if (label == '心电测量') {
-                return _buildImageDataCell(cellData);
-              } else if (label == '十二导心电(30秒)') {
-                return _buildImageDataCell(cellData);
-              } else if (label == '十二导分析结果') {
-                return _buildEcg12DataCell(cellData);
-              }
-
-              return _buildDataCell(cellData);
-            },
-          ).toList(),
+          children: children,
         ),
       );
     }

+ 14 - 12
lib/pages/self_care_ability_assessment/view.dart

@@ -20,24 +20,26 @@ class SelfCareAbilityAssessmentView
     super.key,
     this.physicalExamNumber,
   });
+
   final _examManager = Get.find<IExamManager>();
   ExamDTO? currentSelfCareAbilityAssessmentExam;
   final String? physicalExamNumber;
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-        body: FutureBuilder(
-      future: getExamData(physicalExamNumber ?? ''),
-      builder: (context, snapshot) {
-        if (snapshot.connectionState == ConnectionState.waiting) {
-          return Center(child: CircularProgressIndicator());
-        } else if (snapshot.hasError) {
-          return Center(child: Text('Error: ${snapshot.error}'));
-        } else {
-          return buildContent("LNRZLNLPG");
-        }
-      },
-    ));
+      body: FutureBuilder(
+        future: getExamData(physicalExamNumber ?? ''),
+        builder: (context, snapshot) {
+          if (snapshot.connectionState == ConnectionState.waiting) {
+            return Center(child: CircularProgressIndicator());
+          } else if (snapshot.hasError) {
+            return Center(child: Text('Error: ${snapshot.error}'));
+          } else {
+            return buildContent("LNRZLNLPG");
+          }
+        },
+      ),
+    );
   }
 
   Widget buildContent(String key) {

+ 30 - 9
lib/pages/self_care_ability_assessment/widget/assessment_module.dart

@@ -1,7 +1,9 @@
 import 'dart:convert';
 
+import 'package:fis_common/index.dart';
 import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
 import 'package:get/get.dart';
 import 'package:vitalapp/architecture/storage/text_storage.dart';
 import 'package:vitalapp/architecture/utils/prompt_box.dart';
@@ -35,6 +37,8 @@ class _SelfCareAssessmentModule extends State<SelfCareAssessmentModule> {
   ///当前最新的模版键值对
   Map<String, dynamic> templateRelation = {};
 
+  String templateCode = '';
+
   ///是否首次进入页面
   bool isFirstEnter = true;
 
@@ -119,15 +123,25 @@ class _SelfCareAssessmentModule extends State<SelfCareAssessmentModule> {
     try {
       if (templateRelation[key] == null) {
         currentTemplate = [];
-        return;
+        if (!FPlatform.isWindows) {
+          return;
+        }
       }
 
-      var template =
-          await _templateManager.readTemplate(templateRelation[key]!);
-      String templateContent =
-          TemplateDTO.fromJson(jsonDecode(template!)).templateContent!;
-      List<Map<String, dynamic>> list =
-          jsonDecode(templateContent).cast<Map<String, dynamic>>();
+      String? template;
+      if (templateRelation.containsKey(key)) {
+        templateCode = templateRelation[key]!;
+        template = await _templateManager.readTemplate(templateCode);
+      }
+      List<Map<String, dynamic>> list = [];
+      if (template == null) {
+        var json = await loadJsonFromAssets('assets/templates/${key}.json');
+        list = jsonDecode(json)["Content"].cast<Map<String, dynamic>>();
+      } else {
+        var templateContent =
+            TemplateDTO.fromJson(jsonDecode(template)).templateContent!;
+        list = jsonDecode(templateContent).cast<Map<String, dynamic>>();
+      }
       for (var i in list) {
         if (i["children"] != null) {
           List<FormObject> currentChildren = [];
@@ -149,6 +163,11 @@ class _SelfCareAssessmentModule extends State<SelfCareAssessmentModule> {
     }
   }
 
+  Future<String> loadJsonFromAssets(String filePath) async {
+    String jsonString = await rootBundle.loadString(filePath);
+    return jsonString;
+  }
+
   @override
   Widget build(BuildContext context) {
     return Scaffold(
@@ -177,14 +196,16 @@ class _SelfCareAssessmentModule extends State<SelfCareAssessmentModule> {
               }
               final result = await widget.callBack(
                 widget.cardKey,
-                templateRelation[widget.cardKey]!,
+                templateCode,
                 jsonEncode(formValue),
               );
 
               Get.back(result: formValue["SelfCareScore"]);
               if (result) {
                 if (!widget.isEdit) formValue.clear();
-                deleteDirectory();
+                if (!FPlatform.isWindows) {
+                  deleteDirectory();
+                }
                 PromptBox.toast('提交成功');
                 setState(() {});
               }

+ 13 - 5
lib/pages/traditional_chinese_medicine_constitution/widget/tcm_card.dart

@@ -51,6 +51,8 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
 
   bool isFirstEnter = true;
 
+  String templateCode = '';
+
   /// 当前模板数据
   List<FormObject> currentTemplate = [];
 
@@ -171,6 +173,9 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
   }
 
   Future<void> getResourceInfo() async {
+    if (FPlatform.isWindows) {
+      return;
+    }
     TextStorage resourceInfoCacheRecord = TextStorage(
       fileName: "healthGuidance",
       directory: "HealthGuidance/temlpate",
@@ -437,14 +442,16 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
                         onTap: () async {
                           final result = await widget.callBack(
                             widget.cardKey,
-                            templateRelation[widget.cardKey]!,
+                            templateCode,
                             jsonEncode(formValue),
                           );
                           if (result) {
                             setState(() {
                               if (!widget.isEdit!) formValue.clear();
                               currentTitleIndex = 0;
-                              deleteDirectory();
+                              if (!FPlatform.isWindows) {
+                                deleteDirectory();
+                              }
                             });
                           }
                           Get.back();
@@ -462,8 +469,8 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
 
   String getHealthGuidance(String key) {
     String? value =
-        resourceInfo.firstWhere((element) => element.key == key).value;
-    return value;
+        resourceInfo.firstWhereOrNull((element) => element.key == key)?.value;
+    return value ?? '';
   }
 
   /// 主页面
@@ -553,7 +560,8 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
       List<Map<String, dynamic>> list = [];
       String? template;
       if (templateRelation.containsKey(key)) {
-        template = await _templateManager.readTemplate(templateRelation[key]!);
+        templateCode = templateRelation[key]!;
+        template = await _templateManager.readTemplate(templateCode);
       }
       if (template == null) {
         var json = await loadJsonFromAssets('assets/templates/${key}.json');