123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- 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/dialog_input.dart';
- import 'package:vnoteapp/components/dialog_select.dart';
- import 'package:vnoteapp/components/dynamic_drawer.dart.dart';
- import 'package:vnoteapp/pages/controllers/crowd_labels.dart';
- import 'package:vnoteapp/pages/patient/create/controller.dart';
- class CreatePatientPageNew extends GetView<CreatePatientController> {
- const CreatePatientPageNew({super.key});
- @override
- Widget build(BuildContext context) {
- return Stack(
- children: [
- Scrollbar(
- thumbVisibility: true,
- child: SingleChildScrollView(
- child: Container(
- alignment: Alignment.topCenter,
- margin: const EdgeInsets.only(bottom: 24),
- child: SizedBox(
- width: 800,
- child: Column(
- children: [
- _AreaPanel(),
- const SizedBox(height: 12),
- _PatientInfoPanel(),
- const SizedBox(height: 12),
- _AddressPanel(),
- const SizedBox(height: 12),
- _CrowdLabelPanel(),
- ],
- ),
- ),
- ),
- ),
- ),
- Positioned(
- top: 20,
- right: 20,
- child: SizedBox(
- width: 90,
- height: 90,
- child: ElevatedButton(
- style: ButtonStyle(
- shape: MaterialStatePropertyAll(
- RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(45),
- side: BorderSide(color: Theme.of(context).primaryColor),
- ),
- ),
- ),
- onPressed: () {
- Get.snackbar(
- "提示",
- "此功能尚未开发",
- duration: const Duration(seconds: 2),
- );
- },
- child: const Text(
- "读卡",
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- ),
- ),
- ),
- ],
- );
- }
- }
- class _PatientInfoPanel extends GetView<CreatePatientController> {
- @override
- Widget build(BuildContext context) {
- return VListFormCellGroup(
- children: [
- VListFormCell(
- label: "证件类型",
- ),
- VListFormCell(
- label: "证件号",
- ),
- VListFormCell(
- label: "姓名",
- ),
- VListFormCell(
- label: "性别",
- ),
- VListFormCell(
- label: "民族",
- ),
- VListFormCell(
- label: "出生日期",
- ),
- VListFormCell(
- label: "年龄",
- ),
- VListFormCell(
- label: "手机号码",
- ),
- ],
- );
- }
- }
- class _AddressPanel extends GetView<CreatePatientController> {
- @override
- Widget build(BuildContext context) {
- return VListFormCellGroup(
- children: [
- VListFormCell(
- label: "同步户籍地址到现住地址",
- labelWidth: 250,
- contentWidget: Container(
- child: Obx(
- () => Switch(
- onChanged: (value) {
- controller.state.isSyncAddresses = value;
- },
- value: controller.state.isSyncAddresses,
- ),
- ),
- ),
- ),
- VListFormCell(
- label: "户籍地址",
- content: controller.state.censusRegister,
- onTap: () {},
- ),
- VListFormCell(
- label: "现住地址",
- content: controller.state.address,
- onTap: () {},
- ),
- ],
- );
- }
- }
- class _AreaPanel extends GetView<CreatePatientController> {
- @override
- Widget build(BuildContext context) {
- String area = "阳光社区";
- return VListFormCellGroup(
- children: [
- VListFormCell(
- label: "签约区域",
- content: "重庆市沙坪坝区童家桥街道",
- ),
- VListFormCell(
- label: "所在村",
- content: area,
- onTap: () async {
- final result = await VDialogSelect<String, String>(
- title: "选择签约所在村",
- source: const ["阳光社区", "磁器口社区", "烈士墓社区"],
- valueGetter: (data) => data,
- labelGetter: (data) => data,
- initialValue: area,
- ).show();
- if (result != null) {
- // TODO:
- area = result;
- }
- },
- ),
- ],
- );
- }
- }
- class _CrowdLabelPanel extends GetView<CrowdLabelsController> {
- final createController = Get.find<CreatePatientController>();
- @override
- Widget build(BuildContext context) {
- return VListFormCellGroup(
- children: [
- Obx(
- () => VListFormCell(
- label: "个人编号",
- content: createController.state.personalNo,
- onTap: () async {
- final result = await VDialogInput(
- title: "个人编号",
- initialValue: createController.state.personalNo,
- placeholder: "请填写个人编号",
- ).show();
- if (result != null) {
- createController.state.personalNo = result;
- }
- },
- ),
- ),
- VListFormCell(
- label: "人群分类",
- contentWidget: _buildContent(context),
- onTap: () {
- VDynamicDrawerWrapper.show(
- scaffoldKey: createController.homeScaffoldKey,
- builder: (_) => _buildDrawer(),
- );
- },
- ),
- ],
- );
- }
- 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;
- },
- 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;
- },
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- 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(),
- );
- },
- );
- }
- }
|