heart_check_new.dart 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /// 心电的列表
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:vitalapp/architecture/utils/advance_debounce.dart';
  5. import 'package:vitalapp/components/appbar.dart';
  6. import 'package:vitalapp/components/button.dart';
  7. import 'package:vitalapp/pages/medical/widgets/health_heart_check/view.dart';
  8. import 'package:vitalapp/pages/medical/widgets/twelve_ecg.dart';
  9. import 'package:vnote_device_plugin/consts/types.dart';
  10. import 'package:vitalapp/pages/medical/controller.dart';
  11. import 'package:vitalapp/store/store.dart';
  12. import 'table_input_dialog/widgets/physical_exam_electrocardiogram.dart';
  13. class HeartCheckNew extends GetView<MedicalController> {
  14. const HeartCheckNew({super.key});
  15. @override
  16. Widget build(BuildContext context) {
  17. return Scaffold(
  18. resizeToAvoidBottomInset: false,
  19. body: Container(
  20. height: double.maxFinite,
  21. color: Colors.white,
  22. child: HeartTableCheck(
  23. checkDialog: PhysicalExamElectrocardiogram(
  24. _buildDeviceImage(DeviceTypes.TWELVEHEART),
  25. _buildMedicalInput(DeviceTypes.TWELVEHEART),
  26. _buildSaveButton()),
  27. checkKey: "HEIECG",
  28. ),
  29. ),
  30. );
  31. }
  32. Widget _buildMedicalInput(String? currentTab) {
  33. return Expanded(
  34. flex: currentTab == DeviceTypes.TWELVEHEART ? 18 : 11,
  35. child: Stack(
  36. children: [
  37. Container(
  38. padding: const EdgeInsets.all(16),
  39. child: Column(
  40. children: [
  41. _buildContent(),
  42. ],
  43. ),
  44. ),
  45. ],
  46. ),
  47. );
  48. }
  49. String _deviceImageUrl(String? currentTab) {
  50. switch (currentTab) {
  51. case DeviceTypes.TEMP:
  52. return 'assets/images/healthCheck/temp.png';
  53. case DeviceTypes.SUGAR:
  54. return 'assets/images/healthCheck/sugar.png';
  55. case DeviceTypes.NIBP:
  56. return 'assets/images/healthCheck/nibp.png';
  57. case DeviceTypes.SPO2:
  58. return 'assets/images/healthCheck/spo2.png';
  59. case DeviceTypes.WEIGHT:
  60. return 'assets/images/healthCheck/bmi.png';
  61. case DeviceTypes.URINE:
  62. return 'assets/images/healthCheck/urine.png';
  63. case DeviceTypes.WAIST:
  64. return 'assets/images/healthCheck/whb.png';
  65. default:
  66. return 'assets/images/exam/normalMeasurementChart.png';
  67. }
  68. }
  69. Widget _buildDeviceImage(String? currentTab) {
  70. if (currentTab == DeviceTypes.TWELVEHEART) {
  71. return const SizedBox();
  72. }
  73. return Expanded(
  74. flex: 7,
  75. child: Container(
  76. alignment: Alignment.topCenter,
  77. margin: const EdgeInsets.all(16).copyWith(top: 10),
  78. child: Obx(
  79. () => ClipRect(
  80. child: Align(
  81. alignment: Alignment.bottomCenter,
  82. heightFactor: 0.8,
  83. child: controller.state.currentTab != null
  84. ? Image.asset(
  85. _deviceImageUrl(controller.state.currentTab),
  86. height: double.infinity,
  87. fit: BoxFit.contain, // 设置图像的适应方式
  88. )
  89. : Container(),
  90. ),
  91. ),
  92. ),
  93. ),
  94. );
  95. }
  96. Widget _buildSaveButton() {
  97. return Obx(() {
  98. if (Store.user.currentSelectRegisterPersonInfo == null) {
  99. return const SizedBox();
  100. }
  101. return VButton(
  102. // backgroundColor: Theme.of(context).primaryColor,
  103. onTap: () {
  104. Debouncer.run(
  105. () => controller.createHeart(
  106. Store.user.currentSelectRegisterPersonInfo?.physicalExamNumber ??
  107. '',
  108. 'HEIECG',
  109. ),
  110. );
  111. },
  112. child: const SizedBox(
  113. width: 240,
  114. height: 60,
  115. child: Center(
  116. child: Text(
  117. '提交',
  118. style: TextStyle(
  119. fontSize: 26,
  120. color: Colors.white,
  121. ),
  122. ),
  123. ),
  124. ),
  125. );
  126. });
  127. }
  128. Widget _buildContent() {
  129. return const TwelveHeartRate();
  130. }
  131. }