Browse Source

医生签约路由

finlay 1 year ago
parent
commit
f3ac10e5be

BIN
assets/images/showPackage.png


+ 149 - 49
lib/pages/contract/package_info/view.dart

@@ -1,67 +1,167 @@
 import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
-import 'package:vnoteapp/components/appbar.dart';
-
-import 'controller.dart';
+import 'package:vnoteapp/components/cell.dart';
+import 'package:vnoteapp/pages/contract/package_list/controller.dart';
 
 /// 包详情
-class PackageInfoPage extends GetView<PackageInfoController> {
-  const PackageInfoPage({super.key});
-  Widget buildAlertDialog(ServicePackDTO servicePackDTO) {
+class PackageInfoPage extends StatelessWidget {
+  final ServicePackDTO? dto;
+  const PackageInfoPage({super.key, this.dto});
+  Widget buildAlertDialog(ServicePackDTO? servicePackDTO) {
     return Container(
-        alignment: Alignment.topLeft,
-        padding: const EdgeInsets.symmetric(horizontal: 15),
-        child: Column(
-          crossAxisAlignment: CrossAxisAlignment.start,
-          children: [
-            LayoutBuilder(
-              builder: (BuildContext context, BoxConstraints constraints) {
-                return ConstrainedBox(
-                  constraints: const BoxConstraints(
-                    maxHeight: 100,
-                  ),
-                  child: Scrollbar(
-                    thumbVisibility: true,
-                    child: ListView(
-                      shrinkWrap: true,
-                      children: [
-                        Text(
-                          servicePackDTO.content ?? "",
-                          style: const TextStyle(fontSize: 16),
-                        ),
-                      ],
-                    ),
-                  ),
-                );
-              },
-            ),
-            const SizedBox(
-              height: 5,
-            ),
-            const Text(
-              '服务项目',
-              style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
-            ),
-            const SizedBox(
-              height: 5,
+      margin: const EdgeInsets.only(left: 55),
+      alignment: Alignment.topLeft,
+      padding: const EdgeInsets.symmetric(horizontal: 15),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          const Text(
+            '服务名称',
+            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
+          ),
+          const SizedBox(
+            height: 10,
+          ),
+          Container(
+            color: const Color.fromARGB(255, 243, 240, 240),
+            child: _buildItemContent(servicePackDTO?.name ?? ""),
+          ),
+          const SizedBox(
+            height: 10,
+          ),
+          const Text(
+            '服务对象',
+            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
+          ),
+          const SizedBox(
+            height: 10,
+          ),
+          Container(
+            color: const Color.fromARGB(255, 243, 240, 240),
+            child: _buildItemContent("60岁以上老人"),
+          ),
+          const SizedBox(
+            height: 10,
+          ),
+          const Text(
+            '服务介绍',
+            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
+          ),
+          const SizedBox(
+            height: 10,
+          ),
+          Container(
+            color: const Color.fromARGB(255, 243, 240, 240),
+            child: _buildItemContent(servicePackDTO?.content ?? ""),
+          ),
+          const SizedBox(
+            height: 5,
+          ),
+          const Text(
+            '服务项目',
+            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
+          ),
+          const SizedBox(
+            height: 5,
+          ),
+          Expanded(
+            child: Column(
+              children: [
+                ...getServiceItemsName(
+                  servicePackDTO?.items ?? [],
+                ).map(
+                  (String e) => _buildServiceItem(e),
+                ),
+              ],
             ),
+          )
+        ],
+      ),
+    );
+  }
+
+  Widget _buildServiceItem(String itemName) {
+    return InkWell(
+      child: Container(
+        color: const Color.fromARGB(255, 243, 240, 240),
+        child: Row(
+          children: [
             Expanded(
-              child: Text(
-                controller.getServiceItemsName(
-                  servicePackDTO.items ?? [],
-                ),
+              child: VListFormCell(
+                labelWidget: _buildItemContent(itemName),
               ),
-            )
+            ),
           ],
-        ));
+        ),
+      ),
+    );
+  }
+
+  Widget _buildItemContent(String itemName) {
+    return LayoutBuilder(
+      builder: (BuildContext context, BoxConstraints constraints) {
+        return ConstrainedBox(
+          constraints: const BoxConstraints(
+            maxHeight: 100,
+          ),
+          child: Scrollbar(
+            thumbVisibility: true,
+            child: ListView(
+              shrinkWrap: true,
+              children: [
+                Container(
+                  margin: const EdgeInsets.only(left: 20),
+                  padding: const EdgeInsets.all(5),
+                  child: Text(
+                    itemName,
+                    style: const TextStyle(fontSize: 18),
+                  ),
+                ),
+              ],
+            ),
+          ),
+        );
+      },
+    );
+  }
+
+  List<String> getServiceItemsName(List<String> serviceItems) {
+    var controller = Get.find<ServicePackageContractController>();
+    List<String> serviceItemNames = [];
+    for (var element in controller.state.serviceItems) {
+      if (serviceItems.contains(element.code)) {
+        serviceItemNames.add(element.name ?? '');
+      }
+    }
+    if (serviceItemNames.isEmpty) {
+      return [];
+    }
+    return serviceItemNames;
   }
 
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-      appBar: VAppBar(titleText: "服务包详情"),
-      body: buildAlertDialog(controller.state.servicePack),
+      appBar: AppBar(
+        title: const Text(
+          "服务包详情",
+          style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
+        ),
+        // leading: Container(),
+        // leadingWidth: 0,
+        // actions: [
+        //   IconButton(
+        //       onPressed: () {
+        //         Navigator.pop(context);
+        //       },
+        //       icon: const Icon(
+        //         Icons.cancel,
+        //         size: 24,
+        //       ))
+        // ],
+      ),
+      body: buildAlertDialog(dto),
     );
   }
 }

+ 109 - 171
lib/pages/contract/package_list/widgets/family_doctor_service_package.dart

@@ -1,7 +1,8 @@
 import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
-import 'package:vnoteapp/components/alert_dialog.dart';
+import 'package:vnoteapp/components/cell.dart';
+import 'package:vnoteapp/pages/contract/package_info/view.dart';
 import 'package:vnoteapp/pages/contract/package_list/controller.dart';
 
 class FamilyDoctorServicePackagePage
@@ -13,74 +14,6 @@ class FamilyDoctorServicePackagePage
     return buildServicePackageList(context);
   }
 
-  Widget buildAlertDialog(ServicePackDTO servicePackDTO) {
-    return VAlertDialog(
-      title: '${servicePackDTO.name}详情',
-      content: Container(
-          height: 200,
-          alignment: Alignment.topLeft,
-          padding: const EdgeInsets.symmetric(horizontal: 15),
-          child: Column(
-            crossAxisAlignment: CrossAxisAlignment.start,
-            children: [
-              LayoutBuilder(
-                builder: (BuildContext context, BoxConstraints constraints) {
-                  return ConstrainedBox(
-                    constraints: const BoxConstraints(
-                      maxHeight: 100,
-                    ),
-                    child: Scrollbar(
-                      thumbVisibility: true,
-                      child: ListView(
-                        shrinkWrap: true,
-                        children: [
-                          Text(
-                            servicePackDTO.content ?? "",
-                            style: const TextStyle(fontSize: 16),
-                          ),
-                        ],
-                      ),
-                    ),
-                  );
-                },
-              ),
-              const SizedBox(
-                height: 5,
-              ),
-              const Text(
-                '服务项目',
-                style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
-              ),
-              const SizedBox(
-                height: 5,
-              ),
-              Expanded(
-                child: Text(
-                  controller.getServiceItemsName(
-                    servicePackDTO.items ?? [],
-                  ),
-                ),
-              )
-            ],
-          )),
-      // actions: <Widget>[
-      //   TextButton(
-      //     child: const Text('取消'),
-      //     onPressed: () {
-      //       Navigator.of(context).pop(); // 关闭对话框
-      //     },
-      //   ),
-      //   TextButton(
-      //     child: const Text('确定'),
-      //     onPressed: () {
-      //       // 在这里处理确定按钮的逻辑
-      //       Navigator.of(context).pop(); // 关闭对话框
-      //     },
-      //   ),
-      // ],
-    );
-  }
-
   Widget buildItem(ServicePackDTO servicePackDTO, BuildContext context) {
     return InkWell(
       onTap: () {
@@ -89,23 +22,7 @@ class FamilyDoctorServicePackagePage
       child: Container(
         margin: const EdgeInsets.symmetric(
           vertical: 10,
-          horizontal: 50,
-        ),
-        padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 15),
-        decoration: BoxDecoration(
-          color: Colors.white,
-          borderRadius: const BorderRadius.all(
-            Radius.circular(
-              8,
-            ),
-          ),
-          border: Border.all(
-            color:
-                controller.state.selectedServicePackage.contains(servicePackDTO)
-                    ? Theme.of(context).primaryColor
-                    : Colors.transparent,
-            width: 2,
-          ),
+         
         ),
         child: Row(
           children: [
@@ -123,90 +40,37 @@ class FamilyDoctorServicePackagePage
               ),
             ),
             Expanded(
-              child: Column(
-                children: [
-                  Row(
-                    children: [
-                      Expanded(
-                        child: Text(
-                          servicePackDTO.name ?? '',
-                          style: const TextStyle(
-                            fontSize: 25,
-                            fontWeight: FontWeight.bold,
-                          ),
-                        ),
-                      ),
-                      Expanded(
-                        child: Row(
-                          children: [
-                            const Text(
-                              '服务人群:',
-                              style: TextStyle(fontSize: 20),
-                            ),
-                            Text(
-                              controller.setNormalLabels(
-                                servicePackDTO.labels ?? [],
-                              ),
-                              style: const TextStyle(fontSize: 18),
-                            ),
-                          ],
-                        ),
-                      ),
-                    ],
-                  ),
-                  const SizedBox(
-                    height: 10,
-                  ),
-                  Row(
-                    mainAxisSize: MainAxisSize.max,
-                    children: [
-                      Expanded(
-                        child: Row(
-                          mainAxisSize: MainAxisSize.max,
-                          children: [
-                            const Text(
-                              '服务包介绍:',
-                              style: TextStyle(fontSize: 18),
-                            ),
-                            Expanded(
-                              child: Container(
-                                alignment: Alignment.centerLeft,
-                                height: 50,
-                                child: Text(
-                                  servicePackDTO.content ?? '',
-                                  overflow: TextOverflow.ellipsis,
-                                  maxLines: 2,
-                                  style: const TextStyle(fontSize: 18),
-                                ),
-                              ),
-                            ),
-                          ],
-                        ),
-                      ),
-                    ],
-                  ),
-                ],
+              child: VListFormCell(
+                label: servicePackDTO.name ?? '',
+                // contentWidget: Obx(
+                //   () => Switch(
+                //     value: controller.state.selectedServicePackage
+                //         .contains(servicePackDTO),
+                //     onChanged: (value) {
+                //       controller.changeServicePackage(servicePackDTO);
+                //     },
+                //     activeColor: Theme.of(context).primaryColor,
+                //     inactiveThumbColor: Colors.grey,
+                //     // inactiveTrackColor:Colors.grey,
+                //   ),
+                // ),
               ),
             ),
             Container(
-              padding: const EdgeInsets.only(left: 20),
-              child: TextButton(
-                child: const Text(
-                  '查看',
-                  style: TextStyle(fontSize: 18),
+              padding: const EdgeInsets.only(right: 50),
+              child: IconButton(
+                icon: Image.asset(
+                  "assets/images/showPackage.png",
+                  width: 30,
+                  height: 30,
+                  fit: BoxFit.cover,
                 ),
-                onPressed: () async {
-                  // await Get.toNamed(
-                  //   '/contract/package_info',
-                  //   parameters: {
-                  //     "servicePack": json.encode(servicePackDTO.toJson()),
-                  //   },
-                  // );
-                  showDialog(
-                    context: context,
-                    builder: (BuildContext context) {
-                      return buildAlertDialog(servicePackDTO);
-                    },
+                onPressed: () {
+                  Navigator.push(
+                    context,
+                    MaterialPageRoute(
+                        builder: (context) =>
+                            PackageInfoPage(dto: servicePackDTO)),
                   );
                 },
               ),
@@ -219,7 +83,7 @@ class FamilyDoctorServicePackagePage
 
   Widget buildServicePackageList(BuildContext context) {
     return Obx(
-      () => Expanded(
+      () => SingleChildScrollView(
         child: controller.state.servicePackageItems.isEmpty
             ? Container(
                 margin: const EdgeInsets.only(top: 80),
@@ -240,12 +104,86 @@ class FamilyDoctorServicePackagePage
                   ],
                 ),
               )
-            : ListView(
-                children: controller.state.servicePackageItems
-                    .map((ServicePackDTO e) => buildItem(e, context))
-                    .toList(),
+            : Column(
+                children: [
+                  VListFormCellGroup(
+                    children: [
+                      ...controller.state.servicePackageItems
+                          .map((ServicePackDTO e) => buildItem(e, context))
+                          .toList(),
+                    ],
+                  ),
+                ],
               ),
       ),
     );
   }
+
+  //  Widget buildAlertDialog(ServicePackDTO servicePackDTO) {
+  //   return VAlertDialog(
+  //     title: '${servicePackDTO.name}详情',
+  //     content: Container(
+  //         height: 200,
+  //         alignment: Alignment.topLeft,
+  //         padding: const EdgeInsets.symmetric(horizontal: 15),
+  //         child: Column(
+  //           crossAxisAlignment: CrossAxisAlignment.start,
+  //           children: [
+  //             LayoutBuilder(
+  //               builder: (BuildContext context, BoxConstraints constraints) {
+  //                 return ConstrainedBox(
+  //                   constraints: const BoxConstraints(
+  //                     maxHeight: 100,
+  //                   ),
+  //                   child: Scrollbar(
+  //                     thumbVisibility: true,
+  //                     child: ListView(
+  //                       shrinkWrap: true,
+  //                       children: [
+  //                         Text(
+  //                           servicePackDTO.content ?? "",
+  //                           style: const TextStyle(fontSize: 16),
+  //                         ),
+  //                       ],
+  //                     ),
+  //                   ),
+  //                 );
+  //               },
+  //             ),
+  //             const SizedBox(
+  //               height: 5,
+  //             ),
+  //             const Text(
+  //               '服务项目',
+  //               style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
+  //             ),
+  //             const SizedBox(
+  //               height: 5,
+  //             ),
+  //             Expanded(
+  //               child: Text(
+  //                 controller.getServiceItemsName(
+  //                   servicePackDTO.items ?? [],
+  //                 ),
+  //               ),
+  //             )
+  //           ],
+  //         )),
+  //     // actions: <Widget>[
+  //     //   TextButton(
+  //     //     child: const Text('取消'),
+  //     //     onPressed: () {
+  //     //       Navigator.of(context).pop(); // 关闭对话框
+  //     //     },
+  //     //   ),
+  //     //   TextButton(
+  //     //     child: const Text('确定'),
+  //     //     onPressed: () {
+  //     //       // 在这里处理确定按钮的逻辑
+  //     //       Navigator.of(context).pop(); // 关闭对话框
+  //     //     },
+  //     //   ),
+  //     // ],
+  //   );
+  // }
 }

+ 13 - 13
lib/pages/controllers/crowd_labels.dart

@@ -29,21 +29,21 @@ class CrowdLabelsController extends FControllerBase {
     state.selectedSpecialCareCodes = codes;
   }
 
-  void onItemCheckChanged(String code, bool isChecked) {
+  void onItemCheckChanged(String code) {
     bool result = false;
-    result = _updateNormalChecked(code, isChecked);
+    result = _updateNormalChecked(code);
     if (result) return;
-    result = _updateDiseaseChecked(code, isChecked);
+    result = _updateDiseaseChecked(code);
     if (result) return;
-    result = _updateSpecialCareChecked(code, isChecked);
+    result = _updateSpecialCareChecked(code);
   }
 
-  bool _updateNormalChecked(code, bool isChecked) {
+  bool _updateNormalChecked(code) {
     final item = state.normalOptions.firstWhereOrNull((e) => e.code == code);
     if (item == null) return false;
 
-    final arr = state.selectedNormalCodes;
-    if (isChecked) {
+    final arr = state.selectedNormalCodes.toList();
+    if (!arr.contains(code)) {
       if (arr.contains(code) == false) {
         arr.add(code);
       }
@@ -54,12 +54,12 @@ class CrowdLabelsController extends FControllerBase {
     return true;
   }
 
-  bool _updateDiseaseChecked(code, bool isChecked) {
+  bool _updateDiseaseChecked(code) {
     final item = state.diseaseOptions.firstWhereOrNull((e) => e.code == code);
     if (item == null) return false;
 
-    final arr = state.selectedDiseaseCodes;
-    if (isChecked) {
+    final arr = state.selectedDiseaseCodes.toList();
+    if (!arr.contains(code)) {
       if (arr.contains(code) == false) {
         arr.add(code);
       }
@@ -70,13 +70,13 @@ class CrowdLabelsController extends FControllerBase {
     return true;
   }
 
-  bool _updateSpecialCareChecked(code, bool isChecked) {
+  bool _updateSpecialCareChecked(code) {
     final item =
         state.specialCareOptions.firstWhereOrNull((e) => e.code == code);
     if (item == null) return false;
 
-    final arr = state.selectedSpecialCareCodes;
-    if (isChecked) {
+    final arr = state.selectedSpecialCareCodes.toList();
+    if (!arr.contains(code)) {
       if (arr.contains(code) == false) {
         arr.add(code);
       }

+ 32 - 32
lib/pages/patient/create/view.dart

@@ -4,13 +4,10 @@ import 'package:vnoteapp/components/button.dart';
 import 'package:vnoteapp/components/floating_window/floating_window.dart';
 import 'package:vnoteapp/components/side_nav/defines.dart';
 import 'package:vnoteapp/components/side_nav/side_nav.dart';
-import 'package:vnoteapp/pages/controllers/crowd_labels.dart';
 import 'package:vnoteapp/pages/patient/create/controller.dart';
 import 'package:vnoteapp/pages/patient/create/widgets/area.dart';
 import 'package:vnoteapp/pages/patient/create/widgets/crowd_label.dart';
 import 'package:vnoteapp/pages/patient/create/widgets/patient_info.dart';
-import 'package:vnoteapp/routes/nav_ids.dart';
-import 'package:vnoteapp/routes/route_setting.dart';
 
 class CreatePatientPage extends GetView<CreatePatientController> {
   const CreatePatientPage({super.key});
@@ -20,7 +17,7 @@ class CreatePatientPage extends GetView<CreatePatientController> {
     return Stack(
       children: [
         VSideNavView(
-          navId: NavIds.CREATE,
+          // navId: NavIds.CREATE,
           items: _buildItems(),
         ),
         Positioned(
@@ -63,15 +60,16 @@ class CreatePatientPage extends GetView<CreatePatientController> {
       title: "签约信息",
       icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
       // onTap: () {}
-      route: VRouteSetting(
-        "/area_panel",
-        () => const Area(),
-        binding: BindingsBuilder(
-          () {
-            Get.lazyPut(() => CreatePatientController());
-          },
-        ),
-      ),
+      pageBuilder: (_) => const Area(),
+      // route: VRouteSetting(
+      //   "/area_panel",
+      //   () => const Area(),
+      //   binding: BindingsBuilder(
+      //     () {
+      //       Get.lazyPut(() => CreatePatientController());
+      //     },
+      //   ),
+      // ),
     );
   }
 
@@ -80,16 +78,17 @@ class CreatePatientPage extends GetView<CreatePatientController> {
       title: "人群分类",
       isRequired: true,
       icon: Icon(Icons.info_outline, color: Colors.grey.shade700),
-      route: VRouteSetting(
-        "/crowd_label_panel",
-        () => CrowdLabel(),
-        binding: BindingsBuilder(
-          () {
-            Get.lazyPut(() => CrowdLabelsController());
-            Get.lazyPut(() => CreatePatientController());
-          },
-        ),
-      ),
+      pageBuilder: (_) => const CrowdLabelView(),
+      // route: VRouteSetting(
+      //   "/crowd_label_panel",
+      //   () => const CrowdLabelView(),
+      //   binding: BindingsBuilder(
+      //     () {
+      //       Get.lazyPut(() => CrowdLabelsController());
+      //       Get.lazyPut(() => CreatePatientController());
+      //     },
+      //   ),
+      // ),
       // route: VRouteSetting("/about", () => const AboutPage()),
     );
   }
@@ -98,15 +97,16 @@ class CreatePatientPage extends GetView<CreatePatientController> {
     return VSideNavMenuItem(
       title: "个人信息",
       icon: Icon(Icons.exit_to_app, color: Colors.grey.shade700),
-      route: VRouteSetting(
-        "/patient_info_panel",
-        () => const PatientInfo(),
-        binding: BindingsBuilder(
-          () {
-            Get.lazyPut(() => CreatePatientController());
-          },
-        ),
-      ),
+      pageBuilder: (_) => const PatientInfo(),
+      // route: VRouteSetting(
+      //   "/patient_info_panel",
+      //   () => const PatientInfo(),
+      //   binding: BindingsBuilder(
+      //     () {
+      //       Get.lazyPut(() => CreatePatientController());
+      //     },
+      //   ),
+      // ),
       // shouldRearrage: true, // TODO: 调整样式后启用
     );
   }

+ 49 - 138
lib/pages/patient/create/widgets/crowd_label.dart

@@ -2,159 +2,70 @@ import 'package:fis_jsonrpc/rpc.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
 import 'package:vnoteapp/components/cell.dart';
-import 'package:vnoteapp/components/checkbox_button.dart';
-import 'package:vnoteapp/components/dynamic_drawer.dart';
 import 'package:vnoteapp/pages/controllers/crowd_labels.dart';
-import 'package:vnoteapp/pages/patient/create/controller.dart';
 
-class CrowdLabel extends GetView<CrowdLabelsController> {
-  final createController = Get.find<CreatePatientController>();
-
-  CrowdLabel({super.key});
+class CrowdLabelView extends GetView<CrowdLabelsController> {
+  const CrowdLabelView({super.key});
   @override
   Widget build(BuildContext context) {
-    return Column(
-      children: [
-        VListFormCellGroup(
+    return Container(
+        padding: const EdgeInsets.only(bottom: 80),
+        child: buildCrowdLables(context));
+  }
+
+  Widget buildCrowdLables(BuildContext context) {
+    return Obx(() {
+      final state = controller.state;
+      return SingleChildScrollView(
+        child: Column(
           children: [
-            VListFormCell(
-              labelWidget: RichText(
-                text: const TextSpan(
-                  text: '* ',
-                  style: TextStyle(color: Colors.red, fontSize: 20),
-                  children: [
-                    TextSpan(
-                      text: '人群分类',
-                      style: TextStyle(color: Colors.black, fontSize: 20),
-                    ),
-                  ],
-                ),
-              ),
-              contentWidget: _buildContent(context),
-              onTap: () {
-                VDynamicDrawerWrapper.show(
-                  scaffoldKey: createController.homeScaffoldKey,
-                  builder: (_) => _buildDrawer(),
-                );
-              },
+            VListFormCellGroup(
+              children: [
+                ...state.normalOptions
+                    .map((LabelDTO e) => buildItem(e, context))
+                    .toList(),
+                ...state.diseaseOptions
+                    .map((LabelDTO e) => buildItem(e, context))
+                    .toList(),
+                ...state.specialCareOptions
+                    .map((LabelDTO e) => buildItem(e, context))
+                    .toList(),
+              ],
             ),
           ],
         ),
-      ],
-    );
+      );
+    });
   }
 
-  Widget _buildDrawer() {
-    final state = controller.state;
-    List<String> selectedNormalCodes = state.selectedNormalCodes;
-    List<String> selectedDiseaseCodes = state.selectedDiseaseCodes;
-    List<String> selectedSpecialCareCodes = state.selectedSpecialCareCodes;
-    final scrollController = ScrollController();
-    return VDrawer(
-      width: 600,
-      title: "设置人群分类",
-      scaffoldKey: createController.homeScaffoldKey,
-      onConfirm: () {
-        VDynamicDrawerWrapper.hide(
-          scaffoldKey: createController.homeScaffoldKey,
-        );
-        state.selectedNormalCodes = selectedNormalCodes;
-        state.selectedDiseaseCodes = selectedDiseaseCodes;
-        state.selectedSpecialCareCodes = selectedSpecialCareCodes;
+  Widget buildItem(LabelDTO dto, BuildContext context) {
+    return InkWell(
+      onTap: () {
+        controller.onItemCheckChanged(dto.code!);
       },
-      child: Scrollbar(
-        controller: scrollController,
-        thumbVisibility: true,
-        child: SingleChildScrollView(
-          controller: scrollController,
-          child: Padding(
-            padding: const EdgeInsets.symmetric(horizontal: 50),
-            child: Column(
-              children: [
-                const SizedBox(height: 24),
-                VCheckBoxButtonGroup<LabelDTO, String>(
-                  source: state.normalOptions,
-                  values: state.selectedNormalCodes,
-                  labelGetter: (LabelDTO data) => data.labelName!,
-                  valueGetter: (LabelDTO data) => data.code!,
-                  onChanged: (value) {
-                    selectedNormalCodes = value;
-                  },
-                ),
-                const SizedBox(height: 8),
-                Divider(
-                  indent: 32,
-                  endIndent: 32,
-                  thickness: 1,
-                  color: Colors.grey.shade300,
-                ),
-                const SizedBox(height: 8),
-                VCheckBoxButtonGroup<LabelDTO, String>(
-                  source: state.diseaseOptions,
-                  values: state.selectedDiseaseCodes,
-                  labelGetter: (LabelDTO data) => data.labelName!,
-                  valueGetter: (LabelDTO data) => data.code!,
-                  onChanged: (value) {
-                    selectedDiseaseCodes = value;
-                  },
-                ),
-                const SizedBox(height: 8),
-                Divider(
-                  indent: 32,
-                  endIndent: 32,
-                  thickness: 1,
-                  color: Colors.grey.shade300,
-                ),
-                const SizedBox(height: 8),
-                VCheckBoxButtonGroup<LabelDTO, String>(
-                  source: state.specialCareOptions,
-                  values: state.selectedSpecialCareCodes,
-                  labelGetter: (LabelDTO data) => data.labelName!,
-                  valueGetter: (LabelDTO data) => data.code!,
-                  onChanged: (value) {
-                    selectedSpecialCareCodes = value;
-                  },
+      child: Container(
+        margin: const EdgeInsets.symmetric(horizontal: 48, vertical: 8),
+        child: Row(
+          children: [
+            Expanded(
+              child: VListFormCell(
+                label: dto.labelName ?? '',
+                contentWidget: Obx(
+                  () => Switch(
+                    value: controller.state.selectedCodes.contains(dto.code),
+                    onChanged: (value) {
+                      controller.onItemCheckChanged(dto.code!);
+                    },
+                    activeColor: Theme.of(context).primaryColor,
+                    inactiveThumbColor: Colors.grey,
+                    // inactiveTrackColor:Colors.grey,
+                  ),
                 ),
-              ],
+              ),
             ),
-          ),
+          ],
         ),
       ),
     );
   }
-
-  Widget _buildContent(BuildContext context) {
-    return Obx(
-      () {
-        final themeData = Theme.of(context);
-        final color = themeData.secondaryHeaderColor;
-        final names = controller.state.selectedNames;
-        const itemHeight = 32.0;
-        const itemRadius = itemHeight / 2;
-        final itemTextStyle = TextStyle(
-          color: themeData.primaryColor,
-          fontSize: 14,
-        );
-        return Wrap(
-          spacing: 16,
-          runSpacing: 16,
-          children: names.map(
-            (e) {
-              return Container(
-                height: itemHeight,
-                alignment: Alignment.center,
-                padding: const EdgeInsets.symmetric(horizontal: 12),
-                decoration: BoxDecoration(
-                  color: color,
-                  border: Border.all(style: BorderStyle.none),
-                  borderRadius: BorderRadius.circular(itemRadius),
-                ),
-                child: Text(e, style: itemTextStyle),
-              );
-            },
-          ).toList(),
-        );
-      },
-    );
-  }
 }