123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vnoteapp/components/button.dart';
- import 'package:vnoteapp/components/checkbox.dart';
- import 'package:vnoteapp/components/date_picker.dart';
- import 'package:vnoteapp/components/form.dart';
- import 'package:vnoteapp/components/input.dart';
- import 'package:vnoteapp/components/panel.dart';
- import 'package:vnoteapp/components/select.dart';
- import 'package:vnoteapp/consts/nations.dart';
- import 'package:vnoteapp/consts/rpc_enum_labels.dart';
- import 'package:vnoteapp/pages/controllers/crowd_labels.dart';
- import 'package:vnoteapp/pages/patient/create/controller.dart';
- export './view_new.dart';
- class CreatePatientPage extends GetView<CreatePatientController> {
- const CreatePatientPage({super.key});
- @override
- Widget build(BuildContext context) {
- const panelSpace = SizedBox(height: 10);
- return Container(
- padding: const EdgeInsets.all(8),
- color: Colors.grey.shade200,
- alignment: Alignment.bottomLeft,
- child: Scrollbar(
- thumbVisibility: true,
- child: ListView(
- shrinkWrap: true,
- children: [
- VPanel(child: _SignDistrict()),
- panelSpace,
- VPanel(child: _InfoFormView()),
- panelSpace,
- VPanel(
- padding: const EdgeInsets.only(top: 16, bottom: 8),
- child: _PersonTagsView(),
- ),
- const SizedBox(height: 30),
- _buildOpRow(),
- ],
- ),
- ),
- );
- }
- Widget _buildOpRow() {
- return Obx(
- () {
- if (controller.state.isCreateOnly) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- VButton(
- label: "返 回",
- type: VButtonType.cancel,
- onTap: () {
- Get.back(id: 1001);
- },
- ),
- VButton(
- label: "保 存",
- type: VButtonType.primary,
- onTap: controller.gotoPatientDetail,
- ),
- ],
- );
- }
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- VButton(
- label: "下一步",
- type: VButtonType.primary,
- onTap: controller.gotoSignContract,
- ),
- VButton(
- label: "存为档案",
- type: VButtonType.primary,
- onTap: controller.gotoPatientDetail,
- ),
- ],
- );
- },
- );
- }
- }
- class _InfoFormView extends GetView<CreatePatientController> {
- static const labelWidth = 85.0;
- static const itemWidth = 200.0;
- static const cellSpace = SizedBox(width: 25);
- @override
- Widget build(BuildContext context) {
- const rowSpace = SizedBox(height: 20);
- return Container(
- alignment: Alignment.bottomLeft,
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _buildCardRow(),
- rowSpace,
- _buildRow(
- Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- _buildName(),
- cellSpace,
- _buildGender(),
- cellSpace,
- _buildNation(),
- ],
- ),
- ),
- rowSpace,
- _buildBirthdayRow(),
- rowSpace,
- _buildCensusRegisterRow(),
- rowSpace,
- _buildAddressRow(),
- rowSpace,
- _buildRow(
- Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- _buildPhoneNo(),
- const SizedBox(width: 5),
- _buildPersonalNo(),
- ],
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildCardRow() {
- return _buildRow(
- VFormCell(
- labelWidth: labelWidth,
- label: "证件号:",
- isExpanded: false,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- width: itemWidth,
- child: VInput(
- placeholder: "请输入证件号",
- onChanged: (value) {
- controller.state.cardNo = value;
- },
- ),
- ),
- cellSpace,
- SizedBox(
- width: 140,
- child: VSelect<CardTypeEnum, CardTypeEnum>(
- source: CardTypeEnum.values,
- value: CardTypeEnum.Identity,
- labelGetter: (e) => RpcEnumLabels.cardType[e]!,
- valueGetter: (e) => e,
- onChanged: (value) {
- controller.state.cardType = value;
- },
- ),
- ),
- cellSpace,
- SizedBox(
- width: 90,
- child: VButton(
- label: "读卡",
- onTap: () {
- controller.onReadCardClicked();
- },
- ),
- ),
- ],
- ),
- ),
- );
- }
- Widget _buildName() {
- return VFormCell(
- labelWidth: labelWidth,
- isExpanded: false,
- label: "姓名:",
- child: SizedBox(
- width: itemWidth,
- height: 40,
- child: VInput(
- placeholder: "请输入姓名",
- onChanged: (value) {
- controller.state.name = value;
- },
- ),
- ),
- );
- }
- Widget _buildGender() {
- return VFormCell(
- labelWidth: 60,
- isExpanded: false,
- label: "性别:",
- child: SizedBox(
- width: itemWidth,
- child: VSelect<GenderEnum, GenderEnum>(
- source: const [
- GenderEnum.Male,
- GenderEnum.Female,
- GenderEnum.Unknown,
- GenderEnum.Unspecified
- ],
- value: GenderEnum.Male,
- labelGetter: (e) => RpcEnumLabels.gender[e]!,
- valueGetter: (e) => e,
- onChanged: (value) {
- controller.state.gender = value;
- },
- ),
- ),
- );
- }
- Widget _buildNation() {
- return VFormCell(
- labelWidth: 60,
- isExpanded: false,
- label: "民族:",
- child: SizedBox(
- width: itemWidth,
- child: VSelect<String, String>(
- source: Nations.china,
- value: Nations.china.first,
- labelGetter: (e) => e,
- valueGetter: (e) => e,
- onChanged: (value) {
- controller.state.nation = value;
- },
- ),
- ),
- );
- }
- Widget _buildPhoneNo() {
- return VFormCell(
- labelWidth: labelWidth,
- isExpanded: false,
- label: "手机号码:",
- child: SizedBox(
- width: itemWidth,
- child: VInput(
- placeholder: "请输入手机号码",
- onChanged: (value) {
- controller.state.phoneNo = value;
- },
- ),
- ),
- );
- }
- Widget _buildPersonalNo() {
- return VFormCell(
- labelWidth: 85,
- isExpanded: false,
- label: "个人编号:",
- child: SizedBox(
- width: itemWidth,
- child: VInput(
- placeholder: "请输入个人编号",
- onChanged: (value) {
- controller.state.personalNo = value;
- },
- ),
- ),
- );
- }
- Widget _buildBirthdayRow() {
- return _buildRow(
- Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- VFormCell(
- labelWidth: labelWidth,
- isExpanded: false,
- label: "出生日期:",
- child: SizedBox(
- width: itemWidth,
- child: Obx(
- () => VDatePicker(
- value: controller.state.birthday,
- onChanged: (value) {
- controller.state.birthday = value;
- },
- ),
- ),
- ),
- ),
- cellSpace,
- VFormCell(
- labelWidth: 60,
- isExpanded: false,
- label: "年龄:",
- child: SizedBox(
- width: itemWidth,
- child: Obx(
- () => VInput(
- initialValue: controller.state.age.toString(),
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildAddressRow() {
- return _buildRow(
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- VFormCell(
- labelWidth: labelWidth,
- isExpanded: false,
- label: "现 住 址:",
- child: SizedBox(
- width: 400,
- child: Obx(
- () => VInput(
- initialValue: controller.state.address,
- placeholder: "请输入现住址",
- onChanged: (value) {
- controller.state.address = value;
- },
- ),
- ),
- ),
- ),
- const SizedBox(width: 8),
- VCheckBox(
- label: "同户籍地址",
- onChanged: (value) {
- controller.onSyncAddressCheckChanged(value);
- },
- ),
- ],
- ),
- );
- }
- Widget _buildCensusRegisterRow() {
- return _buildRow(
- VFormCell(
- labelWidth: labelWidth,
- isExpanded: false,
- label: "户籍地址:",
- child: SizedBox(
- width: 400,
- child: VInput(
- initialValue: controller.state.censusRegister,
- placeholder: "请输入户籍地址",
- onChanged: (value) {
- controller.onCensusRegisterChanged(value);
- },
- ),
- ),
- ),
- );
- }
- Widget _buildRow(Widget cell) {
- return SizedBox(
- height: 40,
- child: cell,
- );
- }
- }
- class _PersonTagsView extends GetView<CrowdLabelsController> {
- @override
- Widget build(BuildContext context) {
- return Container(
- alignment: Alignment.bottomLeft,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.only(left: 12, bottom: 8),
- child: Text(
- "人群分类",
- style: TextStyle(
- color: Theme.of(context).primaryColor,
- fontSize: 24,
- ),
- ),
- ),
- Divider(thickness: 1, color: Colors.grey.shade300),
- Padding(
- padding: const EdgeInsets.all(12.0),
- child: _buildBaseClassRow(),
- ),
- Padding(
- padding: const EdgeInsets.all(12.0),
- child: _buildDiseaseRow(),
- ),
- ],
- ),
- );
- }
- /// 基本人群分类
- Widget _buildBaseClassRow() {
- return Obx(
- () => VCheckBoxGroup<LabelDTO, String>(
- source: controller.state.normalOptions,
- labelGetter: (data) => data.labelName!,
- valueGetter: (data) => data.code!,
- itemSpace: 36,
- onChanged: (value) {
- controller.onNormalSelectedChanged(value);
- },
- ),
- );
- }
- /// 特殊病分类
- Widget _buildDiseaseRow() {
- return Obx(
- () => VCheckBoxGroup<LabelDTO, String>(
- source: controller.state.diseaseOptions,
- labelGetter: (data) => data.labelName!,
- valueGetter: (data) => data.code!,
- itemSpace: 36,
- onChanged: (value) {
- controller.onDiseaseSelectedChanged(value);
- },
- ),
- );
- }
- }
- class _SignDistrict extends GetView<CreatePatientController> {
- @override
- Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- "签约区域",
- style: TextStyle(
- color: Theme.of(context).primaryColor,
- fontSize: 28,
- fontWeight: FontWeight.bold,
- ),
- ),
- const SizedBox(width: 24),
- Column(
- children: [
- Text(
- "重庆市沙坪坝区童家桥街道",
- style: TextStyle(
- color: Theme.of(context).primaryColor,
- fontSize: 16,
- ),
- ),
- const SizedBox(height: 4),
- ],
- ),
- ],
- ),
- SizedBox(
- width: 140,
- height: 40,
- child: VSelect(
- source: const [
- "磁器口社区",
- "蝴蝶湾社区",
- "尖沙咀社区",
- ],
- value: "尖沙咀社区",
- labelGetter: (e) => e,
- valueGetter: (e) => e,
- onChanged: (value) {
- //TODO:
- },
- ),
- ),
- ],
- ),
- );
- }
- }
|