ソースを参照

报告模板新增选择词条入口和撤销词条及超声描述入口

loki.wu 2 年 前
コミット
b1d4403989

+ 2 - 0
lib/main.dart

@@ -4,6 +4,8 @@ import 'package:fis_lib_report/converts/event_type.dart';
 import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
 import 'package:fis_lib_report/pages/components/vid_image.dart';
 import 'package:fis_lib_report/report_edit.dart';
+import 'package:fis_lib_report/report_info/element_tag_names.dart';
+import 'package:fis_lib_report/report_info/input_text_info.dart';
 import 'package:fis_lib_report/report_info/report_info.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';

+ 60 - 28
lib/pages/components/input_text.dart

@@ -1,7 +1,9 @@
 import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
 import 'package:fis_lib_report/converts/text_size_converter.dart';
 import 'package:fis_lib_report/converts/alignment_convert.dart';
+import 'package:fis_lib_report/report/element_tag.dart';
 import 'package:fis_lib_report/report/inputText.dart';
+import 'package:fis_lib_report/report_info/element_tag_names.dart';
 import 'package:fis_lib_report/report_info/input_text_info.dart';
 import 'package:fis_lib_report/report_info/report_info.dart';
 import 'package:flutter/material.dart';
@@ -63,35 +65,65 @@ class _RInputTextState extends State<RInputText> {
     } catch (e) {
       print(e);
     }
-    return Container(
-      //constraints: BoxConstraints(minWidth: _lineWidth!, maxWidth: 480),
-      width: _lineWidth,
-      height: _textWrap! ? _height! * 4 : (_height! - 2),
-      padding: const EdgeInsets.only(right: 5, left: 5),
-      decoration: BoxDecoration(
-        border: Border.all(
-          width: 1,
-          color: _isReadOnly ? Colors.transparent : Colors.grey,
+    return Column(
+      children: [
+        Container(
+          width: _lineWidth,
+          height: _textWrap! ? _height! * 4 : (_height! - 2),
+          padding: const EdgeInsets.only(right: 5, left: 5),
+          decoration: BoxDecoration(
+            border: Border.all(
+              width: 1,
+              color: _isReadOnly ? Colors.transparent : Colors.grey,
+            ),
+            color: _backgroundColor,
+          ),
+          child: TextField(
+              focusNode: _focusNode,
+              readOnly: _isReadOnly,
+              decoration: null,
+              textAlignVertical: AlignmentConvert.verticalAlignmentConvert(
+                  widget.inputText.verticalAlignment),
+              minLines: 1,
+              maxLines: _textWrap! ? 6 : 1,
+              controller: _controller,
+              textAlign: TextAlign.start,
+              style: _textStyle,
+              onChanged: (v) {
+                //  _onInputChanged(_textStyle!, v);
+              },
+              onEditingComplete: () {
+                _onInputChanged(_textStyle!, _controller.text);
+              }),
         ),
-        color: _backgroundColor,
-      ),
-      child: TextField(
-          focusNode: _focusNode,
-          readOnly: _isReadOnly,
-          decoration: null,
-          textAlignVertical: AlignmentConvert.verticalAlignmentConvert(
-              widget.inputText.verticalAlignment),
-          minLines: 1,
-          maxLines: _textWrap! ? 6 : 1,
-          controller: _controller,
-          textAlign: TextAlign.start,
-          style: _textStyle,
-          onChanged: (v) {
-            //  _onInputChanged(_textStyle!, v);
-          },
-          onEditingComplete: () {
-            _onInputChanged(_textStyle!, _controller.text);
-          }),
+        const SizedBox(height: 5),
+        if (_inputTextInfo!.tag != null &&
+            _inputTextInfo!.tag!.elementTagType ==
+                ElementTagType.DiagnosticEntry) ...[
+          Row(
+            mainAxisAlignment: MainAxisAlignment.end,
+            children: [
+              ElevatedButton(
+                onPressed: () {
+                  ReportInfo.instance.onDiagnosticTap
+                      .emit(this, _inputTextInfo!.tag!.name ?? '');
+                },
+                child: const Text('选择词条'),
+              ),
+              const SizedBox(width: 10),
+              ElevatedButton(
+                onPressed: () {
+                  setState(() {
+                    _inputTextInfo!.text = '';
+                  });
+                },
+                child: const Text('撤销'),
+              ),
+              const SizedBox(width: 5),
+            ],
+          ),
+        ],
+      ],
     );
   }
 

+ 6 - 0
lib/report_info/element_tag_names.dart

@@ -10,4 +10,10 @@ class TagNames {
 
   ///病人ID
   static const String PATIENT_ID_TAG = "PatientId";
+
+  ///超声描述
+  static const String REPORTDES = "ReportDescription";
+
+  ///超声提示
+  static const String REPORTSUMARY = "ReportSummary";
 }

+ 0 - 4
lib/report_info/input_image_list_info.dart

@@ -1,9 +1,5 @@
 import 'package:fis_lib_report/converts/event_type.dart';
-import 'package:fis_lib_report/report/element.dart';
 import 'package:fis_lib_report/report/inputImageList.dart';
-import 'package:fis_lib_report/report/interfaces/block_element.dart';
-import 'package:fis_lib_report/report/interfaces/element.dart';
-import 'package:fis_lib_report/report/interfaces/inputImageList.dart';
 import 'package:fis_lib_report/report_info/block_element_info_interface.dart';
 import 'package:fis_lib_report/report_info/element_info.dart';
 

+ 30 - 0
lib/report_info/report_info.dart

@@ -4,6 +4,7 @@ import 'package:fis_lib_report/report/interfaces/block_element.dart';
 import 'package:fis_lib_report/report/interfaces/element.dart';
 import 'package:fis_lib_report/report_info/block_element_info_interface.dart';
 import 'package:fis_lib_report/report_info/element_info.dart';
+import 'package:fis_lib_report/report_info/element_tag_names.dart';
 import 'package:fis_lib_report/report_info/input_image_info.dart';
 import 'package:fis_lib_report/report_info/input_image_list_info.dart';
 import 'package:fis_lib_report/report_info/input_text_info.dart';
@@ -20,6 +21,9 @@ class ReportInfo extends ReportBaseInfo {
 
   ReportInfo._internal();
 
+  ///选择词条按钮点击时触发
+  FEventHandler<String> onDiagnosticTap = FEventHandler();
+
   ///ReportInfo全局单例
   static ReportInfo get instance {
     _reportInfo ??= ReportInfo._internal();
@@ -48,6 +52,32 @@ class ReportInfo extends ReportBaseInfo {
     }
   }
 
+  ///插入报告描述&超声提示
+  void insertDiagnostic(String desc, String tips) {
+    try {
+      if (desc.isNotEmpty) {
+        final descInfo =
+            getElementInfoByTagName(TagNames.REPORTDES) as InputTextInfo;
+        if (descInfo.text.isEmpty) {
+          descInfo.text = desc;
+        } else {
+          descInfo.text = descInfo.text + '\r\n' + desc;
+        }
+      }
+      if (tips.isNotEmpty) {
+        final tipsInfo =
+            getElementInfoByTagName(TagNames.REPORTSUMARY) as InputTextInfo;
+        if (tipsInfo.text.isEmpty) {
+          tipsInfo.text = tips;
+        } else {
+          tipsInfo.text = tipsInfo.text + '\r\n' + tips;
+        }
+      }
+    } catch (e) {
+      print(e);
+    }
+  }
+
   ///ReportInfo转为Json,用于报告存储至Server
   Map<String, dynamic> toJson() {
     final map = <String, dynamic>{};