urine_check.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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_check/view.dart';
  8. import 'package:vitalapp/pages/medical/widgets/urinalysis.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. class UrineAnalysisCheck extends GetView<MedicalController> {
  13. const UrineAnalysisCheck({super.key});
  14. @override
  15. Widget build(BuildContext context) {
  16. controller.state.currentTab = DeviceTypes.URINE;
  17. return Scaffold(
  18. resizeToAvoidBottomInset: false,
  19. body: Container(
  20. height: double.maxFinite,
  21. color: Colors.white,
  22. child: HealthCheck(
  23. checkDialog: UrineAnalysisCheckDialog(),
  24. checkKey: "HEIUrinalysis",
  25. ),
  26. ),
  27. );
  28. }
  29. }
  30. class UrineAnalysisCheckDialog extends GetView<MedicalController> {
  31. @override
  32. Widget build(BuildContext context) {
  33. String name = "";
  34. if (Get.arguments != null) {
  35. name = Get.arguments["name"] ?? '';
  36. }
  37. return Scaffold(
  38. appBar: VAppBar(
  39. titleText: "体检尿常规",
  40. actions: [
  41. if (name.isNotEmpty)
  42. Container(
  43. margin: EdgeInsets.only(right: 16),
  44. child: Text(
  45. name,
  46. style: TextStyle(fontSize: 25, color: Colors.white),
  47. ),
  48. ),
  49. ],
  50. ),
  51. body: Container(
  52. color: Colors.white,
  53. child: Stack(
  54. children: [
  55. Row(
  56. children: [
  57. _buildDeviceImage(DeviceTypes.URINE),
  58. _buildMedicalInput(DeviceTypes.URINE),
  59. ],
  60. ),
  61. Positioned(
  62. right: 16,
  63. bottom: 16,
  64. child: _buildSaveButton(),
  65. ),
  66. ],
  67. ),
  68. ),
  69. );
  70. }
  71. Widget _buildDeviceImage(String? currentTab) {
  72. if (currentTab == DeviceTypes.TWELVEHEART) {
  73. return const SizedBox();
  74. }
  75. return Expanded(
  76. flex: 7,
  77. child: Container(
  78. alignment: Alignment.topCenter,
  79. margin: const EdgeInsets.all(16).copyWith(top: 10),
  80. child: Obx(
  81. () => ClipRect(
  82. child: Align(
  83. alignment: Alignment.bottomCenter,
  84. heightFactor: 0.8,
  85. child: controller.state.currentTab != null
  86. ? Image.asset(
  87. _deviceImageUrl(controller.state.currentTab),
  88. height: double.infinity,
  89. fit: BoxFit.contain, // 设置图像的适应方式
  90. )
  91. : Container(),
  92. ),
  93. ),
  94. ),
  95. ),
  96. );
  97. }
  98. Widget _buildSaveButton() {
  99. return Obx(() {
  100. if (Store.user.currentSelectRegisterPersonInfo == null) {
  101. return const SizedBox();
  102. }
  103. return VButton(
  104. // backgroundColor: Theme.of(context).primaryColor,
  105. onTap: () {
  106. Debouncer.run(
  107. () => controller.createCheckup(
  108. Store.user.currentSelectRegisterPersonInfo?.physicalExamNumber ??
  109. '',
  110. 'HEIUrinalysis',
  111. ),
  112. );
  113. },
  114. child: const SizedBox(
  115. width: 240,
  116. height: 60,
  117. child: Center(
  118. child: Text(
  119. '提交',
  120. style: TextStyle(
  121. fontSize: 26,
  122. color: Colors.white,
  123. ),
  124. ),
  125. ),
  126. ),
  127. );
  128. });
  129. }
  130. Widget _buildMedicalInput(String? currentTab) {
  131. String? examData;
  132. if (Get.arguments != null) {
  133. examData = Get.arguments["examData"] ?? '';
  134. }
  135. return Expanded(
  136. flex: currentTab == DeviceTypes.TWELVEHEART ? 18 : 11,
  137. child: Stack(
  138. children: [
  139. Container(
  140. padding: const EdgeInsets.all(16),
  141. child: Column(
  142. children: [
  143. Urinalysis(
  144. examData: examData,
  145. ),
  146. ],
  147. ),
  148. ),
  149. ],
  150. ),
  151. );
  152. }
  153. String _deviceImageUrl(String? currentTab) {
  154. switch (currentTab) {
  155. case DeviceTypes.TEMP:
  156. return 'assets/images/healthCheck/temp.png';
  157. case DeviceTypes.SUGAR:
  158. return 'assets/images/healthCheck/sugar.png';
  159. case DeviceTypes.NIBP:
  160. return 'assets/images/healthCheck/nibp.png';
  161. case DeviceTypes.SPO2:
  162. return 'assets/images/healthCheck/spo2.png';
  163. case DeviceTypes.WEIGHT:
  164. return 'assets/images/healthCheck/bmi.png';
  165. case DeviceTypes.URINE:
  166. return 'assets/images/healthCheck/urine.png';
  167. case DeviceTypes.WAIST:
  168. return 'assets/images/healthCheck/whb.png';
  169. default:
  170. return 'assets/images/exam/normalMeasurementChart.png';
  171. }
  172. }
  173. }