|
@@ -1,6 +1,7 @@
|
|
|
import 'dart:convert';
|
|
|
|
|
|
import 'package:fis_common/event/event_type.dart';
|
|
|
+import 'package:fis_common/index.dart';
|
|
|
import 'package:fis_common/logger/logger.dart';
|
|
|
import 'package:fis_jsonrpc/rpc.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
@@ -13,6 +14,7 @@ import 'package:vitalapp/managers/interfaces/cachedRecord.dart';
|
|
|
import 'package:vitalapp/managers/interfaces/registration.dart';
|
|
|
import 'package:vitalapp/managers/interfaces/template.dart';
|
|
|
import 'package:vitalapp/pages/check/models/form.dart';
|
|
|
+import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_abnormal.dart';
|
|
|
import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_blood_pressure.dart';
|
|
|
import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_blood_sugar.dart';
|
|
|
import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_body_temperature.dart';
|
|
@@ -424,6 +426,7 @@ class NewConfigurableFormState extends State<NewConfigurableCard> {
|
|
|
'safetyPrecautions': _buildToxicSubstance,
|
|
|
'urinalys': _buildUrinalysis,
|
|
|
"dentition": _buildDentition,
|
|
|
+ "abnormal": _buildAbnormal,
|
|
|
};
|
|
|
Widget Function(FormObject) builder =
|
|
|
widgetMap[currentFormObject?.type] ?? _buildInput;
|
|
@@ -1106,4 +1109,40 @@ class NewConfigurableFormState extends State<NewConfigurableCard> {
|
|
|
currentFormObject: currentFormObject,
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ Widget _buildAbnormal(FormObject currentFormObject) {
|
|
|
+ List<dynamic> currentValue = [];
|
|
|
+ var value = formValue[currentFormObject.key!];
|
|
|
+ if (value is String) {
|
|
|
+ currentValue.add(value);
|
|
|
+ } else {
|
|
|
+ currentValue = value ?? [];
|
|
|
+ }
|
|
|
+
|
|
|
+ Future<void> addAbnormalData() async {
|
|
|
+ String? result = await VDialogInput(
|
|
|
+ title: currentFormObject.label,
|
|
|
+ ).show();
|
|
|
+ if (result.isNotNullOrEmpty) {
|
|
|
+ currentValue.add(result);
|
|
|
+ formValue[currentFormObject.key!] = null;
|
|
|
+ formValue[currentFormObject.key!] = currentValue;
|
|
|
+ }
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ Future<void> deleteAbnormalData(int index) async {
|
|
|
+ currentValue.removeAt(index);
|
|
|
+ formValue[currentFormObject.key!] = null;
|
|
|
+ formValue[currentFormObject.key!] = currentValue;
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ return ExamAbnormal(
|
|
|
+ currentFormObject: currentFormObject,
|
|
|
+ currentValue: currentValue,
|
|
|
+ addAbnormal: addAbnormalData,
|
|
|
+ deleteAbnormal: deleteAbnormalData,
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|