face_result_dialog.dart 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import 'package:fis_jsonrpc/rpc.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:vitalapp/architecture/utils/datetime.dart';
  5. import 'package:vitalapp/components/alert_dialog.dart';
  6. import 'package:vitalapp/consts/rpc_enum_labels.dart';
  7. class FaceResultDialog extends StatelessWidget {
  8. final PatientBaseDTO data;
  9. /// 是否已建档
  10. final bool? hasCreateRecord;
  11. const FaceResultDialog({
  12. super.key,
  13. required this.data,
  14. this.hasCreateRecord = true,
  15. });
  16. static Future<bool> show(
  17. PatientBaseDTO data,
  18. bool hasCreateRecord,
  19. ) async {
  20. final result = await Get.dialog(
  21. FaceResultDialog(
  22. data: data,
  23. hasCreateRecord: hasCreateRecord,
  24. ),
  25. barrierDismissible: false,
  26. );
  27. return result == true;
  28. }
  29. @override
  30. Widget build(BuildContext context) {
  31. return _buildContent();
  32. }
  33. Widget _buildContent() {
  34. final title = hasCreateRecord! ? "识别结果-已建档" : "识别结果-未建档";
  35. return VAlertDialog(
  36. title: title,
  37. width: 400,
  38. contentPadding: const EdgeInsets.symmetric(horizontal: 36, vertical: 12),
  39. showCancel: false, // 目前销售确认只要确定,不需要取消
  40. onConfirm: () {
  41. Get.back(result: true);
  42. },
  43. content: Column(
  44. mainAxisSize: MainAxisSize.min,
  45. children: [
  46. _buildRow("姓名", data.patientName!),
  47. _buildRow("性别", RpcEnumLabels.gender[data.patientGender]!),
  48. _buildRow("年龄", DataTimeUtils.calculateAge(data.birthday!)),
  49. _buildRow("身份证", data.cardNo!),
  50. if (hasCreateRecord!) _buildRow("建档机构", data.createdOrgName ?? ''),
  51. if (hasCreateRecord!) _buildRow("建档医生", data.createdDoctorName ?? ''),
  52. ],
  53. ),
  54. );
  55. }
  56. Widget _buildRow(String label, String content) {
  57. return Padding(
  58. padding: const EdgeInsets.symmetric(vertical: 4),
  59. child: Row(
  60. children: [
  61. SizedBox(
  62. width: 90,
  63. child: Text(
  64. '$label:',
  65. style: const TextStyle(color: Colors.black, fontSize: 20),
  66. ),
  67. ),
  68. const SizedBox(width: 12),
  69. Expanded(
  70. child: Text(
  71. content,
  72. style: const TextStyle(color: Colors.black, fontSize: 20),
  73. ),
  74. ),
  75. ],
  76. ),
  77. );
  78. }
  79. }