import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:get/get.dart'; import 'package:vitalapp/components/cell.dart'; import 'package:vitalapp/components/dialog_input.dart'; import 'package:vitalapp/components/dialog_select.dart'; import 'package:vitalapp/pages/patient/info/controller.dart'; import 'package:fis_common/index.dart'; import 'package:vitalapp/pages/patient_info/controller.dart'; import '../entitys/patientInfo_record.dart'; class DetailInfomations extends GetView { @override Widget build(BuildContext context) { return Obx(() { final data = controller.state.detailInfo; final state = controller.state; return VListFormCellGroup( formTitle: "详细信息", children: [ VListFormCell( label: "工作单位", content: data.workUnit ?? '', onTap: () async { final result = await VDialogInput( title: "工作单位", initialValue: data.workUnit, placeholder: '请输入') .show(); if (result != null) { data.workUnit = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "联系人姓名", content: data.contactName, onTap: () async { final result = await VDialogInput( title: "联系人姓名", initialValue: data.contactName, placeholder: '请输入') .show(); if (result != null) { data.contactName = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "联系人电话", content: data.contactPhone, onTap: () async { final result = await VDialogInput( title: "联系人电话", initialValue: data.contactPhone, placeholder: '请输入') .show(); if (result != null) { data.contactPhone = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "常住类型", content: data.permanentlyResideType.isNotNullOrEmpty ? PatientInfoRecord.permanentlyResideTypeList .firstWhere( (element) => element.key == data.permanentlyResideType) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "常住类型", source: PatientInfoRecord.permanentlyResideTypeList.toList(), valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.permanentlyResideType, ).show(); if (result != null) { data.permanentlyResideType = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "血型", content: data.bloodType.isNotNullOrEmpty ? PatientInfoRecord.bloodTypeList .firstWhere((element) => element.key == data.bloodType) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "血型", source: PatientInfoRecord.bloodTypeList, valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.bloodType, ).show(); if (result != null) { data.bloodType = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "RH", content: data.rh.isNotNullOrEmpty ? PatientInfoRecord.rhList .firstWhere((element) => element.key == data.rh) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "RH", source: PatientInfoRecord.rhList, valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.rh, ).show(); if (result != null) { data.rh = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "文化程度", content: data.educationLevel.isNotNullOrEmpty ? PatientInfoRecord.educationLevelList .firstWhere((element) => element.key == data.educationLevel) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "文化程度", source: PatientInfoRecord.educationLevelList, valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.educationLevel, ).show(); if (result != null) { data.educationLevel = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "职业", content: data.career.isNotNullOrEmpty ? PatientInfoRecord.careerList .firstWhere((element) => element.key == data.career) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "职业", source: PatientInfoRecord.careerList, valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.career, ).show(); if (result != null) { data.career = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "婚姻状况", content: data.maritalStatus.isNotNullOrEmpty ? PatientInfoRecord.maritalStatusList .firstWhere((element) => element.key == data.maritalStatus) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "婚姻状况", source: PatientInfoRecord.maritalStatusList, valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.maritalStatus, ).show(); if (result != null) { data.maritalStatus = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), VListFormCell( label: "医疗费用支付方式", content: data.providerPayments.isNotNullOrEmpty ? PatientInfoRecord.providerPaymentsList .firstWhere( (element) => element.key == data.providerPayments) .value : '', onTap: () async { final result = await VDialogSelect, String>( title: "医疗费用支付方式", source: PatientInfoRecord.providerPaymentsList, valueGetter: (data) => data.key, labelGetter: (data) => data.value, initialValue: data.providerPayments, ).show(); if (result != null) { data.providerPayments = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), if (data.providerPayments?.contains('8') ?? false) VListFormCell( label: "其他支付方式", content: data.providerPaymentsOther, onTap: () async { final result = await VDialogInput( title: "其他支付方式", initialValue: data.providerPaymentsOther, placeholder: '请输入', ).show(); if (result != null) { data.providerPaymentsOther = result; state.refreshDetailInfo(); } }, endIcon: _buildEndIcon(), ), ], ); }); } Widget _buildEndIcon({bool isEdit = true}) { return Container( margin: EdgeInsets.only(left: isEdit ? 15 : 35), child: isEdit ? Icon(Icons.edit_outlined) : SizedBox(), ); } }