浏览代码

0018560: 【健康一体机】【新需求】糖尿病随访必填

finlay 11 月之前
父节点
当前提交
3f45be851b

+ 9 - 0
lib/pages/check/follow_up/controller.dart

@@ -107,6 +107,15 @@ class FollowUpController extends GetxController {
       "TNB"
     ].contains(key);
 
+    if (["GXY", "TNB"].contains(key)) {
+      if (state.followUpTime == null ||
+          state.nextFollowUpTime == null ||
+          state.followUpMode == null) {
+        PromptBox.toast("有必填项未填写,请检查");
+        return false;
+      }
+    }
+
     ///校验随访和处方数据
     if (data.length < 7) {
       if (!isCalibrationPrescriptions ||

+ 3 - 0
lib/pages/check/follow_up/widgets/follow_up_from.dart

@@ -106,6 +106,7 @@ class FollowUpFrom extends GetView<FollowUpController> {
                 : Store.user.displayName,
           ),
           VListFormCell(
+            isRequired: ["GXY", "TNB"].contains(cardKey) ? true : false,
             label: '本次随访日期',
             labelWidth: 130,
             endIcon: Icon(
@@ -136,6 +137,7 @@ class FollowUpFrom extends GetView<FollowUpController> {
             },
           ),
           VListFormCell(
+            isRequired: ["GXY", "TNB"].contains(cardKey) ? true : false,
             label: '下次随访日期',
             labelWidth: 130,
             endIcon: Icon(
@@ -193,6 +195,7 @@ class FollowUpFrom extends GetView<FollowUpController> {
           //   ),
           // if (cardKey != "ET_3SETJKJCLB")
           VListFormCell(
+            isRequired: ["GXY", "TNB"].contains(cardKey) ? true : false,
             label: '随访方式',
             labelWidth: 130,
             endIcon: Icon(

+ 14 - 0
lib/pages/check/widgets/configurable_card.dart

@@ -385,6 +385,19 @@ class _ConfigurableFormState extends State<ConfigurableCard> {
                 height: 54,
                 child: VButton(
                   onTap: () async {
+                    if (["TNB", "GXY"].contains(widget.cardKey)) {
+                      for (var element in currentTemplate) {
+                        for (var child in element.children!) {
+                          if (child.required ?? false) {
+                            var value = formValue[child.key];
+                            if (value == null || value.length <= 0) {
+                              PromptBox.toast("有必填项未填写,请检查");
+                              return;
+                            }
+                          }
+                        }
+                      }
+                    }
                     final result = await widget.callBack(
                       widget.cardKey,
                       templateRelation[widget.cardKey]!,
@@ -1095,6 +1108,7 @@ class _ConfigurableFormState extends State<ConfigurableCard> {
     return FollowBloodPressure(
       currentValue: currentValue,
       bloodPressure: bloodPressure,
+      currentFormObject: currentFormObject,
     );
   }
 

+ 19 - 3
lib/pages/check/widgets/exam_configurable/exam_card.dart

@@ -13,6 +13,7 @@ class ExamCard extends StatelessWidget {
     this.bottomPadding = 15,
     this.isSelect = false,
     this.color = Colors.white,
+    this.required,
   });
   final String? title;
   final Widget content;
@@ -22,6 +23,7 @@ class ExamCard extends StatelessWidget {
   final double bottomPadding;
   final bool isSelect;
   final Color color;
+  final bool? required;
   @override
   Widget build(BuildContext context) {
     return Card(
@@ -44,9 +46,23 @@ class ExamCard extends StatelessWidget {
   Widget _buildTitle() {
     Widget titleContent = const SizedBox();
     if (title?.isNotEmpty ?? false) {
-      titleContent = Text(
-        title!,
-        style: const TextStyle(fontSize: 26),
+      titleContent = RichText(
+        text: TextSpan(
+          text: title ?? '',
+          style: TextStyle(
+            fontSize: 26,
+            color: Colors.black,
+            fontFamily: "NotoSansSC",
+            fontFamilyFallback: const ["NotoSansSC"],
+          ),
+          children: [
+            if (required ?? false)
+              TextSpan(
+                text: "*",
+                style: const TextStyle(color: Colors.red, fontSize: 20),
+              ),
+          ],
+        ),
       );
     }
     return titleText ??

+ 1 - 0
lib/pages/check/widgets/exam_configurable/exam_check_box.dart

@@ -29,6 +29,7 @@ class ExamCheckBox extends StatelessWidget {
     return ExamCardRadioSelect(
       titleText: ExamTitle(
         label: label,
+        required: currentFormObject.required,
         titleType: '(多选)',
       ),
       title: label,

+ 1 - 0
lib/pages/check/widgets/exam_configurable/exam_input.dart

@@ -32,6 +32,7 @@ class _ExamInputState extends State<ExamInput> {
   Widget build(BuildContext context) {
     return ExamCard(
       title: widget.currentFormObject.label ?? '',
+      required: widget.currentFormObject.required,
       clickCard: () {
         widget.commonInput?.call();
       },

+ 1 - 0
lib/pages/check/widgets/exam_configurable/exam_radio.dart

@@ -22,6 +22,7 @@ class ExamRadio extends StatelessWidget {
       return ExamCardRadioSelect(
         titleText: ExamTitle(
           label: currentFormObject.label,
+          required: currentFormObject.required,
           titleType: '(单选)',
         ),
         title: currentFormObject.label ?? '',

+ 19 - 3
lib/pages/check/widgets/exam_configurable/exam_radio_and_select.dart

@@ -10,12 +10,14 @@ class ExamCardRadioSelect extends StatelessWidget {
     this.clickCard,
     this.titleText,
     this.topPadding = 20,
+    this.required,
   });
   final String? title;
   final Widget content;
   final Widget? titleText;
   final Function? clickCard;
   final double topPadding;
+  final bool? required;
   @override
   Widget build(BuildContext context) {
     return Card(
@@ -45,9 +47,23 @@ class ExamCardRadioSelect extends StatelessWidget {
   Widget _buildTitle() {
     Widget titleContent = const SizedBox();
     if (title?.isNotEmpty ?? false) {
-      titleContent = Text(
-        title!,
-        style: const TextStyle(fontSize: 25),
+      titleContent = RichText(
+        text: TextSpan(
+          text: title ?? '',
+          style: TextStyle(
+            fontSize: 24,
+            color: Colors.black,
+            fontFamily: "NotoSansSC",
+            fontFamilyFallback: const ["NotoSansSC"],
+          ),
+          children: [
+            if (required ?? false)
+              TextSpan(
+                text: "*",
+                style: const TextStyle(color: Colors.red, fontSize: 20),
+              ),
+          ],
+        ),
       );
     }
     return titleText ??

+ 22 - 4
lib/pages/check/widgets/exam_configurable/follow_blood_pressure.dart

@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
 import 'package:get/get.dart';
 
 import 'package:vitalapp/components/alert_dialog.dart';
+import 'package:vitalapp/pages/check/models/form.dart';
 import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_card.dart';
 import 'package:vitalapp/pages/medical/models/item.dart';
 import 'package:vnote_device_plugin/models/exams/nibp.dart';
@@ -164,9 +165,11 @@ class FollowBloodPressure extends StatefulWidget {
     super.key,
     required this.currentValue,
     required this.bloodPressure,
+    required this.currentFormObject,
   });
   Map currentValue;
   Function(Map) bloodPressure;
+  final FormObject currentFormObject;
   @override
   State<FollowBloodPressure> createState() => _FollowBloodPressureState();
 }
@@ -226,6 +229,7 @@ class _FollowBloodPressureState extends State<FollowBloodPressure> {
                   title: '血压',
                   value: _buildResult(_nibpExamValue),
                   unit: 'mmHg',
+                  required: widget.currentFormObject.required,
                 ),
                 onTap: () async {
                   String? result = await VDialogBloodPressure(
@@ -290,11 +294,13 @@ class SideBar extends StatelessWidget {
   final String title;
   final Widget value;
   final String unit;
+  final bool? required;
 
   const SideBar({
     required this.title,
     required this.value,
     required this.unit,
+    this.required,
   });
 
   @override
@@ -305,10 +311,22 @@ class SideBar extends StatelessWidget {
       children: [
         Container(
           // padding: const EdgeInsets.symmetric(horizontal: 30),
-          child: Text(
-            title,
-            style: const TextStyle(
-              fontSize: 26,
+          child: RichText(
+            text: TextSpan(
+              text: title,
+              style: TextStyle(
+                fontSize: 26,
+                color: Colors.black,
+                fontFamily: "NotoSansSC",
+                fontFamilyFallback: const ["NotoSansSC"],
+              ),
+              children: [
+                if (required ?? false)
+                  TextSpan(
+                    text: "*",
+                    style: const TextStyle(color: Colors.red, fontSize: 20),
+                  ),
+              ],
             ),
           ),
         ),

+ 7 - 0
lib/pages/check/widgets/exam_title.dart

@@ -5,10 +5,12 @@ class ExamTitle extends StatelessWidget {
     super.key,
     required this.titleType,
     this.label,
+    this.required,
   });
 
   final String? label;
   final String titleType;
+  final bool? required;
 
   @override
   Widget build(BuildContext context) {
@@ -28,6 +30,11 @@ class ExamTitle extends StatelessWidget {
             fontFamilyFallback: const ["NotoSansSC"],
           ),
           children: [
+            if (required ?? false)
+              TextSpan(
+                text: "*",
+                style: const TextStyle(color: Colors.red, fontSize: 20),
+              ),
             TextSpan(
               text: titleType,
               style: const TextStyle(fontSize: 25, color: Colors.grey),

+ 1 - 0
lib/pages/check/widgets/follow_up_configurable/follow_up_medication.dart

@@ -25,6 +25,7 @@ class FollowUpGxyAndTnbMedication extends StatelessWidget {
       children: [
         ExamCardRadioSelect(
           title: currentFormObject.label ?? "",
+          required: currentFormObject.required,
           clickCard: null,
           content: Container(
             alignment: Alignment.centerLeft,