123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- import 'package:fis_common/index.dart';
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:intl/intl.dart';
- import 'package:vitalapp/architecture/utils/datetime.dart';
- import 'package:vitalapp/architecture/utils/prompt_box.dart';
- import 'package:vitalapp/components/cell.dart';
- import 'package:vitalapp/components/dialog_check.dart';
- import 'package:vitalapp/components/dialog_date.dart';
- import 'package:vitalapp/components/dialog_input.dart';
- import 'package:vitalapp/components/dialog_profile_time_input.dart';
- import 'package:vitalapp/components/dialog_select.dart';
- import 'package:vitalapp/consts/nations.dart';
- import 'package:vitalapp/consts/rpc_enum_labels.dart';
- import 'package:vitalapp/helper/id_card_helper.dart';
- import 'package:vitalapp/pages/patient/info/controller.dart';
- import 'package:vitalapp/pages/patient/info/patientInfoRecord.dart';
- import 'package:fis_common/index.dart';
- import 'detail_infos.dart';
- import 'health_infos.dart';
- class PatientInfoBaseView extends GetView<PatientInfoController> {
- const PatientInfoBaseView({super.key});
- @override
- Widget build(BuildContext context) {
- final scrollerController = ScrollController();
- return Scrollbar(
- child: SingleChildScrollView(
- controller: scrollerController,
- padding: const EdgeInsets.only(left: 16, right: 16, bottom: 50),
- child: _HealthInfoPanel(),
- ),
- );
- }
- }
- class _HealthInfoPanel extends GetView<PatientInfoController> {
- @override
- Widget build(BuildContext context) {
- return VListFormCellGroup(
- children: [
- VListFormCellGroup(
- formTitle: "基本信息",
- children: _buildBaseInfo(),
- ),
- DetailInfos(),
- HealthInfos(),
- ],
- );
- }
- List<Widget> _buildBaseInfo() {
- final state = controller.state;
- return [
- Obx(
- () => VListFormCell(
- label: "姓名",
- content: controller.state.name,
- onTap: () async {
- final result = await VDialogInput(
- title: "姓名",
- initialValue: controller.state.name,
- placeholder: "请填写姓名",
- ).show();
- if (result != null) {
- controller.state.name = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "手机号码",
- content: controller.state.phoneNo,
- onTap: () async {
- final result = await VDialogInput(
- title: "手机号码",
- initialValue: controller.state.phoneNo,
- placeholder: "请填写手机号码",
- ).show();
- if (result != null) {
- controller.state.phoneNo = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "紧急联系手机号",
- content: controller.state.emergencyPhone,
- onTap: () async {
- final result = await VDialogInput(
- title: "紧急联系手机号",
- initialValue: controller.state.emergencyPhone,
- placeholder: "请填写紧急联系手机号",
- ).show();
- if (result != null) {
- controller.state.emergencyPhone = result;
- }
- },
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "性别",
- content: RpcEnumLabels.gender[state.gender],
- onTap: () async {
- final result = await VDialogSelect<GenderEnum, GenderEnum>(
- title: "选择性别",
- source: const [
- GenderEnum.Male,
- GenderEnum.Female,
- GenderEnum.Unknown,
- GenderEnum.Unspecified
- ],
- valueGetter: (data) => data,
- labelGetter: (data) => RpcEnumLabels.gender[data] ?? "",
- initialValue: state.gender,
- ).show();
- if (result != null) {
- controller.state.gender = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "民族",
- content: state.nation,
- onTap: () async {
- final result = await VDialogSelect<String, String>(
- title: "选择民族",
- source: Nations.china,
- valueGetter: (data) => data,
- labelGetter: (data) => data,
- initialValue: state.nation,
- ).show();
- if (result != null) {
- controller.state.nation = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "证件号",
- content: controller.state.cardNo,
- onTap: () async {
- // print("点击修改证件号");
- // final result = await VDialogInput(
- // title: "证件号",
- // initialValue: controller.state.cardNo,
- // placeholder: "请填写证件号",
- // ).show();
- // if (result != null && result is String) {
- // // 校验身份证号
- // bool validate = IdCardHelper.validateIDCard(result);
- // if (!validate) {
- // PromptBox.toast("身份证号码格式错误");
- // return;
- // }
- // controller.state.cardNo = result;
- // }
- },
- endIcon: _buildEndIcon(isEdit: false),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "出生日期",
- content: controller.state.birthday != null
- ? DataTimeUtils.formatDateString(controller.state.birthday!)
- : "",
- onTap: () async {
- final result = await VDialogDate(
- title: "设置出生日期",
- initialValue: controller.state.birthday,
- maxValue: DateTime.now(),
- ).show();
- if (result != null) {
- controller.state.birthday = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "年龄",
- content: controller.state.age,
- endIcon: _buildEndIcon(isEdit: false),
- onTap: () {},
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "现住地址",
- content: controller.state.address,
- onTap: () async {
- final result = await VDialogInput(
- title: "现住地址",
- initialValue: controller.state.address,
- placeholder: "请填写现住地址",
- ).show();
- if (result != null) {
- controller.state.address = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "户籍地址",
- content: controller.state.permanentResidenceAddress,
- onTap: () async {
- final result = await VDialogInput(
- title: "户籍地址",
- initialValue: controller.state.permanentResidenceAddress,
- placeholder: "请填写户籍地址",
- ).show();
- if (result != null) {
- controller.state.permanentResidenceAddress = result;
- }
- },
- endIcon: _buildEndIcon(),
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "建档单位",
- content: controller.state.createdOrgName,
- endIcon: _buildEndIcon(isEdit: false),
- onTap: () {},
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "建档人",
- content: controller.state.createdDoctorName,
- endIcon: _buildEndIcon(isEdit: false),
- onTap: () {},
- ),
- ),
- Obx(
- () => VListFormCell(
- label: "建档时间",
- content: controller.state.createTime,
- endIcon: _buildEndIcon(isEdit: false),
- onTap: () {},
- ),
- ),
- ];
- }
- Widget _buildEndIcon({bool isEdit = true}) {
- return Container(
- margin: EdgeInsets.only(left: isEdit ? 15 : 35),
- child: isEdit ? Icon(Icons.edit_outlined) : SizedBox(),
- );
- }
- }
|