|
@@ -48,148 +48,157 @@ class _RegistrationFormDialogState extends State<RegistrationFormDialog> {
|
|
|
|
|
|
Widget _buildView() {
|
|
|
return Container(
|
|
|
- height: 450,
|
|
|
- child: Column(
|
|
|
+ child: ListView(
|
|
|
+ shrinkWrap: true,
|
|
|
children: [
|
|
|
- _buildInputItem(
|
|
|
- "身份证号",
|
|
|
- value: widget.patient?.cardNo ?? '',
|
|
|
- onTap: () async {
|
|
|
- var result = await VDialogInput(
|
|
|
- initialValue: widget.patient?.cardNo ?? '',
|
|
|
- title: "身份证号",
|
|
|
- onConfirmVerification: (v) {
|
|
|
- bool isValid = IdCardHelper.validateIDCard(v);
|
|
|
- if (!isValid) {
|
|
|
- PromptBox.showToast("请填写正确的证件号");
|
|
|
+ Column(
|
|
|
+ children: [
|
|
|
+ _buildInputItem(
|
|
|
+ "身份证号",
|
|
|
+ value: widget.patient?.cardNo ?? '',
|
|
|
+ onTap: () async {
|
|
|
+ var result = await VDialogInput(
|
|
|
+ initialValue: widget.patient?.cardNo ?? '',
|
|
|
+ title: "身份证号",
|
|
|
+ onConfirmVerification: (v) {
|
|
|
+ bool isValid = IdCardHelper.validateIDCard(v);
|
|
|
+ if (!isValid) {
|
|
|
+ PromptBox.showToast("请填写正确的证件号");
|
|
|
+ }
|
|
|
+ return isValid;
|
|
|
+ },
|
|
|
+ showCancel: true,
|
|
|
+ ).show();
|
|
|
+ if (result == null) {
|
|
|
+ return;
|
|
|
}
|
|
|
- return isValid;
|
|
|
+ if (widget.patient == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ final patient = widget.patient!;
|
|
|
+ patient.cardNo = result;
|
|
|
+ patient.birthday = _getBirthDayofIdNumber(result);
|
|
|
+ patient.patientGender = _checkGenderFromID(result);
|
|
|
+ final patientDto = await controller.getPatientByID(result);
|
|
|
+ if (patientDto != null) {
|
|
|
+ patient.patientName = patientDto.patientName;
|
|
|
+ patient.phone = patientDto.phone;
|
|
|
+ patient.patientAddress = patientDto.patientAddress;
|
|
|
+ }
|
|
|
+ controller.update(["registration_Form"]);
|
|
|
},
|
|
|
- showCancel: true,
|
|
|
- ).show();
|
|
|
- if (result == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (widget.patient == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- final patient = widget.patient!;
|
|
|
- patient.cardNo = result;
|
|
|
- patient.birthday = _getBirthDayofIdNumber(result);
|
|
|
- patient.patientGender = _checkGenderFromID(result);
|
|
|
- final patientDto = await controller.getPatientByID(result);
|
|
|
- if (patientDto != null) {
|
|
|
- patient.patientName = patientDto.patientName;
|
|
|
- patient.phone = patientDto.phone;
|
|
|
- patient.patientAddress = patientDto.patientAddress;
|
|
|
- }
|
|
|
- controller.update(["registration_Form"]);
|
|
|
- },
|
|
|
- ),
|
|
|
- _buildInputItem(
|
|
|
- "姓名",
|
|
|
- value: widget.patient?.patientName ?? '',
|
|
|
- onTap: () async {
|
|
|
- var result = await VDialogInput(
|
|
|
- initialValue: widget.patient?.patientName ?? '',
|
|
|
- title: "姓名",
|
|
|
- ).show();
|
|
|
- if (result != null) {
|
|
|
- widget.patient?.patientName = result;
|
|
|
- controller.update(["registration_Form"]);
|
|
|
- }
|
|
|
- },
|
|
|
- ),
|
|
|
- _buildInputItem(
|
|
|
- "性别",
|
|
|
- value: controller.formController.selectGenderList
|
|
|
- .firstWhereOrNull(
|
|
|
- (element) => element.code == widget.patient?.patientGender)
|
|
|
- ?.name,
|
|
|
- onTap: () async {
|
|
|
- String? result =
|
|
|
- await VDialogSelect<VSelectGenderEnumModel, String>(
|
|
|
- source: controller.formController.selectGenderList,
|
|
|
- labelGetter: (data) => data.name,
|
|
|
- valueGetter: (data) => data.code.index.toString(),
|
|
|
- initialValue: widget.patient?.patientGender?.index.toString(),
|
|
|
- title: "性别",
|
|
|
- ).show();
|
|
|
- if (result != null) {
|
|
|
- widget.patient?.patientGender =
|
|
|
- GenderEnum.values[int.parse(result)];
|
|
|
- controller.update(["registration_Form"]);
|
|
|
- }
|
|
|
- },
|
|
|
- suffixIcon: Icon(
|
|
|
- Icons.chevron_right_rounded,
|
|
|
- size: 30,
|
|
|
- ),
|
|
|
- ),
|
|
|
- _buildInputItem(
|
|
|
- "生日",
|
|
|
- value: getBirthDay(widget.patient?.birthday),
|
|
|
- onTap: () async {
|
|
|
- DateTime? result;
|
|
|
- bool _isLocalStation = AppParameters.data.isLocalStation;
|
|
|
- if (kIsWeb || _isLocalStation) {
|
|
|
- result = await showDatePicker(
|
|
|
- context: Get.context!,
|
|
|
- initialDate: widget.patient?.birthday ?? DateTime.now(),
|
|
|
- firstDate: DateTime(1900),
|
|
|
- lastDate: DateTime(2100),
|
|
|
- );
|
|
|
- } else {
|
|
|
- result = await VDialogDate(
|
|
|
- initialValue: widget.patient?.birthday,
|
|
|
- title: "生日",
|
|
|
- ).show();
|
|
|
- }
|
|
|
- if (result != null) {
|
|
|
- widget.patient?.birthday = result;
|
|
|
- controller.update(["registration_Form"]);
|
|
|
- }
|
|
|
- },
|
|
|
- suffixIcon: Icon(
|
|
|
- Icons.chevron_right_rounded,
|
|
|
- size: 30,
|
|
|
- ),
|
|
|
- ),
|
|
|
- _buildInputItem(
|
|
|
- "手机号",
|
|
|
- value: widget.patient?.phone,
|
|
|
- onTap: () async {
|
|
|
- var result = await VDialogInput(
|
|
|
- initialValue: widget.patient?.phone ?? '',
|
|
|
- title: "手机号",
|
|
|
- showCancel: true,
|
|
|
- onConfirmVerification: (v) {
|
|
|
- var isValid = (v.length == 11 && IdCardHelper.isNumeric(v));
|
|
|
- if (!isValid) {
|
|
|
- PromptBox.showToast("请填写正确的手机号");
|
|
|
+ ),
|
|
|
+ _buildInputItem(
|
|
|
+ "姓名",
|
|
|
+ value: widget.patient?.patientName ?? '',
|
|
|
+ onTap: () async {
|
|
|
+ var result = await VDialogInput(
|
|
|
+ initialValue: widget.patient?.patientName ?? '',
|
|
|
+ title: "姓名",
|
|
|
+ ).show();
|
|
|
+ if (result != null) {
|
|
|
+ widget.patient?.patientName = result;
|
|
|
+ controller.update(["registration_Form"]);
|
|
|
}
|
|
|
- return isValid;
|
|
|
},
|
|
|
- ).show();
|
|
|
- if (result != null) {
|
|
|
- widget.patient?.phone = result;
|
|
|
- controller.update(["registration_Form"]);
|
|
|
- }
|
|
|
- },
|
|
|
- ),
|
|
|
- _buildInputItem(
|
|
|
- "家庭住址",
|
|
|
- value: widget.patient?.patientAddress ?? '',
|
|
|
- onTap: () async {
|
|
|
- var result = await VDialogInput(
|
|
|
- initialValue: widget.patient?.patientAddress ?? '',
|
|
|
- title: "家庭住址",
|
|
|
- ).show();
|
|
|
- if (result != null) {
|
|
|
- widget.patient?.patientAddress = result;
|
|
|
- controller.update(["registration_Form"]);
|
|
|
- }
|
|
|
- },
|
|
|
+ ),
|
|
|
+ _buildInputItem(
|
|
|
+ "性别",
|
|
|
+ value: controller.formController.selectGenderList
|
|
|
+ .firstWhereOrNull((element) =>
|
|
|
+ element.code == widget.patient?.patientGender)
|
|
|
+ ?.name,
|
|
|
+ onTap: () async {
|
|
|
+ String? result =
|
|
|
+ await VDialogSelect<VSelectGenderEnumModel, String>(
|
|
|
+ source: controller.formController.selectGenderList,
|
|
|
+ labelGetter: (data) => data.name,
|
|
|
+ valueGetter: (data) => data.code.index.toString(),
|
|
|
+ initialValue:
|
|
|
+ widget.patient?.patientGender?.index.toString(),
|
|
|
+ title: "性别",
|
|
|
+ ).show();
|
|
|
+ if (result != null) {
|
|
|
+ widget.patient?.patientGender =
|
|
|
+ GenderEnum.values[int.parse(result)];
|
|
|
+ controller.update(["registration_Form"]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ suffixIcon: Icon(
|
|
|
+ Icons.chevron_right_rounded,
|
|
|
+ size: 30,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ _buildInputItem(
|
|
|
+ "生日",
|
|
|
+ value: getBirthDay(widget.patient?.birthday),
|
|
|
+ onTap: () async {
|
|
|
+ DateTime? result;
|
|
|
+ bool _isLocalStation = AppParameters.data.isLocalStation;
|
|
|
+ if (kIsWeb || _isLocalStation) {
|
|
|
+ result = await showDatePicker(
|
|
|
+ context: Get.context!,
|
|
|
+ initialDate: widget.patient?.birthday ?? DateTime.now(),
|
|
|
+ firstDate: DateTime(1900),
|
|
|
+ lastDate: DateTime(2100),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ result = await VDialogDate(
|
|
|
+ initialValue: widget.patient?.birthday,
|
|
|
+ title: "生日",
|
|
|
+ ).show();
|
|
|
+ }
|
|
|
+ if (result != null) {
|
|
|
+ widget.patient?.birthday = result;
|
|
|
+ controller.update(["registration_Form"]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ suffixIcon: Icon(
|
|
|
+ Icons.chevron_right_rounded,
|
|
|
+ size: 30,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ _buildInputItem(
|
|
|
+ "手机号",
|
|
|
+ value: widget.patient?.phone,
|
|
|
+ onTap: () async {
|
|
|
+ var result = await VDialogInput(
|
|
|
+ initialValue: widget.patient?.phone ?? '',
|
|
|
+ title: "手机号",
|
|
|
+ showCancel: true,
|
|
|
+ onConfirmVerification: (v) {
|
|
|
+ var isValid =
|
|
|
+ (v.length == 11 && IdCardHelper.isNumeric(v));
|
|
|
+ if (!isValid) {
|
|
|
+ PromptBox.showToast("请填写正确的手机号");
|
|
|
+ }
|
|
|
+ return isValid;
|
|
|
+ },
|
|
|
+ ).show();
|
|
|
+ if (result != null) {
|
|
|
+ widget.patient?.phone = result;
|
|
|
+ controller.update(["registration_Form"]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ _buildInputItem(
|
|
|
+ "家庭住址",
|
|
|
+ value: widget.patient?.patientAddress ?? '',
|
|
|
+ onTap: () async {
|
|
|
+ var result = await VDialogInput(
|
|
|
+ initialValue: widget.patient?.patientAddress ?? '',
|
|
|
+ title: "家庭住址",
|
|
|
+ ).show();
|
|
|
+ if (result != null) {
|
|
|
+ widget.patient?.patientAddress = result;
|
|
|
+ controller.update(["registration_Form"]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ height: 40,
|
|
|
+ )
|
|
|
+ ],
|
|
|
),
|
|
|
],
|
|
|
),
|