Browse Source

fixed: 0018715: 【张森反馈】打开2型糖尿病记录,点击症状、体征,用药情况、处方,最后点击“生活方式指导”,app白屏

loki.wu 10 months ago
parent
commit
109afc8f98
1 changed files with 23 additions and 5 deletions
  1. 23 5
      lib/pages/check/widgets/configurable_card.dart

+ 23 - 5
lib/pages/check/widgets/configurable_card.dart

@@ -1137,8 +1137,21 @@ class _ConfigurableFormState extends State<ConfigurableCard> {
     String currentInputValue = formValue[currentFormObject.key!] ?? '';
     DateTime currentDateValue = DateTime.now();
     if (currentInputValue.isNotNullOrEmpty) {
-      DateFormat format = DateFormat('yyyy-MM-dd');
-      currentDateValue = format.parse(currentInputValue);
+      bool parseResult = false;
+      try {
+        DateFormat format = DateFormat('yyyy-MM-dd');
+        currentDateValue = format.parse(currentInputValue);
+        parseResult = true;
+      } catch (e) {
+        logger.e("_buildDate yyyy-MM-dd error:", e);
+      }
+      try {
+        DateFormat format = DateFormat('yyyyMMdd');
+        currentDateValue = format.parse(currentInputValue);
+        parseResult = true;
+      } catch (e) {
+        logger.e("_buildDate yyyyMMdd error:", e);
+      }
     }
 
     Future<void> commonInput() async {
@@ -1255,10 +1268,15 @@ class _ConfigurableFormState extends State<ConfigurableCard> {
   Widget _buildGxyAndTnbMedication(FormObject currentFormObject) {
     List<dynamic> currentValue = [];
     var value = formValue[currentFormObject.key!];
-    if (value is String) {
+    if (value is String && currentFormObject.key != "Appraisal") {
       return Container();
-    } else {
-      if (value != null) currentValue = value;
+    } else if (value != null && value is List) {
+      currentValue = value;
+    } else if (currentFormObject.key == "Appraisal" && value is String) {
+      ///老版本的用药情况就是字符串
+      currentValue = [
+        {"name": value}
+      ];
     }
 
     Future<void> addVeterinaryDrug() async {