|
@@ -1,4 +1,5 @@
|
|
|
import 'dart:convert';
|
|
|
+import 'dart:math';
|
|
|
|
|
|
import 'package:fis_jsonrpc/rpc.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
@@ -199,13 +200,17 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
initialValue: formValue["PhysicalConclusion"],
|
|
|
).show();
|
|
|
if (result != null) {
|
|
|
+ Random random = Random();
|
|
|
+ formValue.clear();
|
|
|
formValue["PhysicalConclusion"] = result;
|
|
|
if (result == "Ping_Score") {
|
|
|
for (var i = 1; i < 34; i++) {
|
|
|
if (i == 1) {
|
|
|
- formValue["qusition$i"] = "5";
|
|
|
+ int randomNumber = 3 + random.nextInt(3);
|
|
|
+ formValue["qusition$i"] = randomNumber.toString();
|
|
|
} else {
|
|
|
- formValue["qusition$i"] = "1";
|
|
|
+ int randomNumber = 1 + random.nextInt(2);
|
|
|
+ formValue["qusition$i"] = randomNumber.toString();
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -213,9 +218,11 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
var questions =
|
|
|
storeTypeMapDefaultTitle[result] as List<int>;
|
|
|
if (questions.contains(i)) {
|
|
|
- formValue["qusition$i"] = "5";
|
|
|
+ int randomNumber = 3 + random.nextInt(3);
|
|
|
+ formValue["qusition$i"] = randomNumber.toString();
|
|
|
} else {
|
|
|
- formValue["qusition$i"] = "1";
|
|
|
+ int randomNumber = 1 + random.nextInt(2);
|
|
|
+ formValue["qusition$i"] = randomNumber.toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -224,6 +231,10 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
optionUpdate(currentFormObject,
|
|
|
formValue[currentFormObject.key]);
|
|
|
}
|
|
|
+ var currentFormObject =
|
|
|
+ currentTemplate[currentTitleIndex].children!.first;
|
|
|
+ optionUpdate(
|
|
|
+ currentFormObject, formValue[currentFormObject.key]);
|
|
|
}
|
|
|
setState(() {});
|
|
|
},
|
|
@@ -231,7 +242,7 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
"选择体质",
|
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
|
- fontSize: 20,
|
|
|
+ fontSize: 24,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -783,61 +794,11 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
|
|
|
String? hasGuidanceBeenProvided() {
|
|
|
var formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == 'Peaceful_Quality')
|
|
|
+ .where((entry) => entry.key == 'PhysicalConclusion')
|
|
|
.toList();
|
|
|
if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Peaceful_Quality"];
|
|
|
+ return formValues.first.value;
|
|
|
}
|
|
|
-
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Yang_Deficiency_Substance")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Yang_Deficiency_Substance"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Idiosyncratic_Quality")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Idiosyncratic_Quality"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Qi_Stagnation_Constitution")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Qi_Stagnation_Constitution"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Blood_Stasis_Substance")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Blood_Stasis_Substance"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Damp-heat_constitution")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Damp-heat_constitution"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Phlegm-dampness_constitution")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Phlegm-dampness_constitution"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Yin_Deficiency_Substance")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Yin_Deficiency_Substance"];
|
|
|
- }
|
|
|
- formValues = formValue.entries
|
|
|
- .where((entry) => entry.key == "Qi_Deficiency_Constitution")
|
|
|
- .toList();
|
|
|
- if (formValues.isNotEmpty) {
|
|
|
- return typeMap["Qi_Deficiency_Constitution"];
|
|
|
- }
|
|
|
-
|
|
|
return "";
|
|
|
}
|
|
|
|