view.dart 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. import 'package:fis_jsonrpc/rpc.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:intl/intl.dart';
  5. import 'package:vitalapp/components/appbar.dart';
  6. import 'package:vitalapp/consts/styles.dart';
  7. import 'package:vitalapp/pages/check/follow_up_record/controller.dart';
  8. import 'package:vitalapp/pages/patient/list/widgets/status.dart';
  9. import 'package:vitalapp/pages/widgets/record_common_item.dart';
  10. class FollowUpRecordPage extends GetView<FollowUpRecordController> {
  11. const FollowUpRecordPage({Key? key}) : super(key: key);
  12. @override
  13. Widget build(BuildContext context) {
  14. return GetBuilder(
  15. init: FollowUpRecordController(),
  16. id: "FollowUpRecord",
  17. builder: (_) {
  18. return Scaffold(
  19. backgroundColor: const Color.fromRGBO(238, 238, 238, 1),
  20. appBar: VAppBar(
  21. titleWidget: const Text('随访记录'),
  22. ),
  23. body: Stack(
  24. children: [
  25. Row(
  26. mainAxisAlignment: MainAxisAlignment.start,
  27. crossAxisAlignment: CrossAxisAlignment.start,
  28. children: [
  29. _buildDiagram(),
  30. _buildListView(),
  31. ],
  32. )
  33. ],
  34. ),
  35. );
  36. });
  37. }
  38. Widget _buildDiagram() {
  39. return Expanded(
  40. flex: 1,
  41. child: Padding(
  42. padding: const EdgeInsets.all(16.0).copyWith(right: 0),
  43. child: Container(
  44. // color: Colors.white,
  45. padding: const EdgeInsets.all(16),
  46. decoration: BoxDecoration(
  47. color: Colors.white,
  48. border: Border.all(
  49. color: Colors.white,
  50. ),
  51. borderRadius: GlobalStyles.borderRadius,
  52. ),
  53. child: Image.asset(
  54. 'assets/images/exam/normalMeasurementChart.png',
  55. height: double.infinity,
  56. fit: BoxFit.fitWidth,
  57. ),
  58. ),
  59. ),
  60. );
  61. }
  62. Widget _buildListView() {
  63. return Expanded(
  64. flex: 2,
  65. child: Padding(
  66. padding: const EdgeInsets.all(16),
  67. child: RefreshIndicator(
  68. child: Obx(
  69. () {
  70. final list = controller.state.followUpDTOList;
  71. final children = <Widget>[];
  72. for (var followUpDTO in list) {
  73. for (var followUpRecordData
  74. in followUpDTO.followUpRecordDatas!) {
  75. var index = followUpDTO.followUpRecordDatas
  76. ?.indexOf(followUpRecordData);
  77. children.add(_followUpRecordCard(
  78. index: index ?? 0,
  79. dto: followUpDTO,
  80. dataDto: followUpRecordData,
  81. ));
  82. }
  83. }
  84. return list.isEmpty
  85. ? Container(
  86. margin: const EdgeInsets.only(top: 80),
  87. child: Column(
  88. children: [
  89. Center(
  90. child: Image.asset(
  91. "assets/images/no_data.png",
  92. width: 300,
  93. height: 300,
  94. fit: BoxFit.cover,
  95. ),
  96. ),
  97. const Text(
  98. "暂无数据,先看看别的吧",
  99. style: TextStyle(fontSize: 18),
  100. ),
  101. ],
  102. ),
  103. )
  104. : GridView(
  105. gridDelegate:
  106. const SliverGridDelegateWithFixedCrossAxisCount(
  107. crossAxisCount: 1,
  108. mainAxisSpacing: 16,
  109. crossAxisSpacing: 20,
  110. childAspectRatio: 900 / 180,
  111. ),
  112. children: children,
  113. );
  114. },
  115. ),
  116. onRefresh: () async {}),
  117. ));
  118. }
  119. }
  120. // ignore: camel_case_types
  121. class _followUpRecordCard extends StatelessWidget {
  122. final FollowUpRecordDTO dto;
  123. final FollowUpRecordDataDTO dataDto;
  124. final int index;
  125. _followUpRecordCard({
  126. required this.dto,
  127. required this.dataDto,
  128. required this.index,
  129. });
  130. final controller = Get.find<FollowUpRecordController>();
  131. @override
  132. Widget build(BuildContext context) {
  133. final body = Stack(
  134. children: [
  135. Row(
  136. children: [
  137. Expanded(
  138. flex: 10,
  139. child: Container(
  140. padding: const EdgeInsets.symmetric(
  141. horizontal: 30,
  142. vertical: 12,
  143. ),
  144. child: Column(
  145. crossAxisAlignment: CrossAxisAlignment.start,
  146. children: [
  147. const SizedBox(
  148. height: 8,
  149. ),
  150. LayoutBuilder(builder: (context, c) {
  151. final width = c.maxWidth - 100;
  152. return SizedBox(
  153. width: width,
  154. child: _buildBaseInfoRow(),
  155. );
  156. }),
  157. const SizedBox(
  158. height: 20,
  159. ),
  160. Wrap(
  161. alignment: WrapAlignment.start,
  162. spacing: 20,
  163. runSpacing: 8,
  164. children: [
  165. SizedBox(
  166. width: 300,
  167. child: RecordCommonItem(
  168. itemName: '姓名',
  169. itemValue: dto.patientName ?? "",
  170. fontSize: 18,
  171. ),
  172. ),
  173. RecordCommonItem(
  174. itemName: '随访类型',
  175. itemValue:
  176. controller.getFollowUpMode(dataDto.followUpMode),
  177. fontSize: 18,
  178. ),
  179. ],
  180. ),
  181. const SizedBox(
  182. height: 20,
  183. ),
  184. Wrap(
  185. alignment: WrapAlignment.start,
  186. spacing: 20,
  187. runSpacing: 8,
  188. children: [
  189. SizedBox(
  190. width: 300,
  191. child: RecordCommonItem(
  192. itemName: '随访医生',
  193. itemValue: dto.contractedDoctor ?? "",
  194. fontSize: 18,
  195. ),
  196. ),
  197. RecordCommonItem(
  198. itemName: '随访时间',
  199. itemValue: dataDto.followUpTime != null
  200. ? DateFormat("yyyy-MM-dd")
  201. .format(dataDto.followUpTime!.toLocal())
  202. : "",
  203. fontSize: 18,
  204. ),
  205. ],
  206. )
  207. ],
  208. ),
  209. ),
  210. ),
  211. Expanded(
  212. child: Icon(
  213. Icons.keyboard_arrow_right,
  214. size: 64,
  215. color: Colors.grey.shade400,
  216. ),
  217. )
  218. ],
  219. ),
  220. Positioned(
  221. top: 16,
  222. right: 0,
  223. child: _FollowUpRecordSignStatusTag(
  224. dataDto: dataDto,
  225. ),
  226. ),
  227. // Positioned(
  228. // bottom: 16,
  229. // right: 12,
  230. // child: IconButton(
  231. // icon: Icon(
  232. // Icons.edit,
  233. // size: 26,
  234. // color: Theme.of(context).primaryColor,
  235. // ),
  236. // onPressed: () {
  237. // controller.toCheckPage(dataDto); //跳转到随访页面
  238. // },
  239. // ),
  240. // ),
  241. ],
  242. );
  243. return Material(
  244. borderRadius: GlobalStyles.borderRadius,
  245. child: Ink(
  246. decoration: BoxDecoration(
  247. color: Colors.white,
  248. borderRadius: GlobalStyles.borderRadius,
  249. ),
  250. child: InkWell(
  251. borderRadius: GlobalStyles.borderRadius,
  252. onTap: () {
  253. // controller.toFollowUpDetailPage(index, dto);
  254. controller.toCheckPage(dataDto); //跳转到随访页面
  255. },
  256. child: body,
  257. ),
  258. ),
  259. );
  260. }
  261. Widget _buildBaseInfoRow() {
  262. return SizedBox(
  263. child: RecordCommonItem(
  264. itemName: '随访病症',
  265. itemValue: controller.getFollowUpValueByKey(dataDto.key ?? ""),
  266. fontSize: 20,
  267. ),
  268. );
  269. }
  270. }
  271. // ignore: camel_case_types
  272. class _FollowUpRecordSignStatusTag extends StatelessWidget {
  273. final FollowUpRecordDataDTO dataDto;
  274. _FollowUpRecordSignStatusTag({required this.dataDto});
  275. final controller = Get.find<FollowUpRecordController>();
  276. @override
  277. Widget build(BuildContext context) {
  278. return Container(
  279. alignment: Alignment.centerRight,
  280. width: 120,
  281. child: StatusLabel(
  282. title: controller.followUpStateTransition(dataDto.followUpState),
  283. color: controller.followUpStateColors(dataDto.followUpState),
  284. ),
  285. );
  286. }
  287. }