|
@@ -1,216 +1,125 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:vitalapp/pages/medical/controller.dart';
|
|
|
-
|
|
|
-class BiochemistryData {
|
|
|
- final String key;
|
|
|
- final String name;
|
|
|
- final String unit;
|
|
|
-
|
|
|
- const BiochemistryData({
|
|
|
- required this.key,
|
|
|
- required this.name,
|
|
|
- required this.unit,
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-class BiochemistryResult {
|
|
|
- final String key;
|
|
|
- final String result;
|
|
|
-
|
|
|
- const BiochemistryResult({
|
|
|
- required this.key,
|
|
|
- required this.result,
|
|
|
- });
|
|
|
-}
|
|
|
+import 'package:vitalapp/pages/medical/views/table_input_dialog/index.dart';
|
|
|
|
|
|
class BiochemistryTest extends GetView<MedicalController> {
|
|
|
const BiochemistryTest({super.key});
|
|
|
|
|
|
- final List<BiochemistryData> mockData = const [
|
|
|
- BiochemistryData(key: "0", name: "血清谷丙转氨酶", unit: "U/L"),
|
|
|
- BiochemistryData(key: "1", name: "血清谷草转氨酶", unit: "U/L"),
|
|
|
- BiochemistryData(key: "2", name: "总胆红素", unit: "umol/L"),
|
|
|
- BiochemistryData(key: "3", name: "白蛋白", unit: "g/L"),
|
|
|
- BiochemistryData(key: "4", name: "结合胆红素", unit: "umol/L"),
|
|
|
- ];
|
|
|
-
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- final TextEditingController biochemistryController =
|
|
|
- TextEditingController();
|
|
|
return Scaffold(
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
body: Container(
|
|
|
height: double.maxFinite,
|
|
|
color: Colors.white,
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- _buildTitle(),
|
|
|
- for (var item in mockData)
|
|
|
- _buildInputElement(
|
|
|
- item.name,
|
|
|
- biochemistryController,
|
|
|
- item.unit,
|
|
|
- ),
|
|
|
- // _buildInputElement(
|
|
|
- // mockData[0].name,
|
|
|
- // biochemistryController,
|
|
|
- // mockData[0].unit,
|
|
|
- // ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- // 构建表格标题 [项目名称|检查结果|单位]
|
|
|
- _buildTitle() {
|
|
|
- return Row(
|
|
|
- children: [
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- color: Colors.grey[300]!,
|
|
|
- width: 1,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- '项目名称',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- color: Colors.grey[800],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- color: Colors.grey[300]!,
|
|
|
- width: 1,
|
|
|
- ),
|
|
|
+ child: Center(
|
|
|
+ // button open dialog
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ ElevatedButton(
|
|
|
+ onPressed: () async {
|
|
|
+ TableInputResult? result = await Get.dialog<TableInputResult>(
|
|
|
+ TableInputDialog(
|
|
|
+ // FIXME 示例代码
|
|
|
+ tableDataConfig: [
|
|
|
+ TableElementConfig(
|
|
|
+ id: "0",
|
|
|
+ name: "血清谷丙转氨酶",
|
|
|
+ unit: "U/L",
|
|
|
+ ),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "1",
|
|
|
+ name: "血清谷草转氨酶",
|
|
|
+ unit: "U/L",
|
|
|
+ ),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "2",
|
|
|
+ name: "总胆红素",
|
|
|
+ unit: "umol/L",
|
|
|
+ ),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "3",
|
|
|
+ name: "白蛋白",
|
|
|
+ unit: "g/L",
|
|
|
+ ),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "4",
|
|
|
+ name: "结合胆红素",
|
|
|
+ unit: "umol/L",
|
|
|
+ ),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "5",
|
|
|
+ name: "血清谷丙转氨酶",
|
|
|
+ unit: "U/L",
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ // 如果不为空,print出来
|
|
|
+ if (result != null) {
|
|
|
+ result.data.forEach((key, value) {
|
|
|
+ print('$key: $value');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ print('已取消,无返回值');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: const Text('填写生化数据'),
|
|
|
),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- '检查结果',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- color: Colors.grey[800],
|
|
|
+ ElevatedButton(
|
|
|
+ onPressed: () async {
|
|
|
+ TableInputResult? result = await Get.dialog<TableInputResult>(
|
|
|
+ TableInputDialog(
|
|
|
+ // FIXME 示例代码
|
|
|
+ tableDataConfig: [
|
|
|
+ TableElementConfig(
|
|
|
+ id: "0",
|
|
|
+ name: "血清谷丙转氨酶",
|
|
|
+ unit: "U/L",
|
|
|
+ initValue: "100"),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "1",
|
|
|
+ name: "血清谷草转氨酶",
|
|
|
+ unit: "U/L",
|
|
|
+ initValue: "100"),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "2",
|
|
|
+ name: "总胆红素",
|
|
|
+ unit: "umol/L",
|
|
|
+ initValue: "100"),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "3",
|
|
|
+ name: "白蛋白",
|
|
|
+ unit: "g/L",
|
|
|
+ initValue: "100"),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "4",
|
|
|
+ name: "结合胆红素",
|
|
|
+ unit: "umol/L",
|
|
|
+ initValue: "100"),
|
|
|
+ TableElementConfig(
|
|
|
+ id: "5",
|
|
|
+ name: "血清谷丙转氨酶",
|
|
|
+ unit: "U/L",
|
|
|
+ initValue: "100"),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ // 如果不为空,print出来
|
|
|
+ if (result != null) {
|
|
|
+ result.data.forEach((key, value) {
|
|
|
+ print('$key: $value');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ print('已取消,无返回值');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: const Text('修改已有生化数据'),
|
|
|
),
|
|
|
- ),
|
|
|
+ ],
|
|
|
),
|
|
|
),
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- color: Colors.grey[300]!,
|
|
|
- width: 1,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- '单位',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- color: Colors.grey[800],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- // 构建输入框 [项目名称|检查结果(s输入框)|单位]
|
|
|
- _buildInputElement(
|
|
|
- String elementName,
|
|
|
- TextEditingController controller,
|
|
|
- String unit,
|
|
|
- ) {
|
|
|
- return Container(
|
|
|
- height: 40,
|
|
|
- child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
- children: [
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- color: Colors.grey[300]!,
|
|
|
- width: 1,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- elementName,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- color: Colors.grey[600],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- color: Colors.grey[300]!,
|
|
|
- width: 1,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: TextField(
|
|
|
- controller: controller,
|
|
|
- decoration: InputDecoration(
|
|
|
- border: InputBorder.none,
|
|
|
- hintText: '请输入检查结果',
|
|
|
- hintStyle: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- color: Colors.grey[400],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border(
|
|
|
- bottom: BorderSide(
|
|
|
- color: Colors.grey[300]!,
|
|
|
- width: 1,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- unit,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14,
|
|
|
- color: Colors.grey[600],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
),
|
|
|
);
|
|
|
}
|