view.dart 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. import 'package:fis_jsonrpc/rpc.dart';
  2. import 'package:flutter/foundation.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:get/get.dart';
  5. import 'package:intl/intl.dart';
  6. import 'package:vitalapp/architecture/app_parameters.dart';
  7. import 'package:vitalapp/architecture/utils/advance_debounce.dart';
  8. import 'package:vitalapp/architecture/utils/datetime.dart';
  9. import 'package:vitalapp/architecture/utils/prompt_box.dart';
  10. import 'package:vitalapp/architecture/utils/sensitive.dart';
  11. import 'package:vitalapp/architecture/values/features.dart';
  12. import 'package:vitalapp/components/alert_dialog.dart';
  13. import 'package:vitalapp/components/button.dart';
  14. import 'package:vitalapp/components/dialog_date.dart';
  15. import 'package:vitalapp/components/dynamic_drawer.dart';
  16. import 'package:vitalapp/components/input.dart';
  17. import 'package:vitalapp/components/search_input.dart';
  18. import 'package:vitalapp/components/tag_widget.dart';
  19. import 'package:vitalapp/consts/rpc_enum_labels.dart';
  20. import 'package:vitalapp/consts/styles.dart';
  21. import 'package:vitalapp/global.dart';
  22. import 'package:vitalapp/managers/contract/index.dart';
  23. import 'package:vitalapp/managers/interfaces/diagnosis.dart';
  24. import 'package:vitalapp/managers/interfaces/exam.dart';
  25. import 'package:vitalapp/managers/interfaces/models/crowd_labels.dart';
  26. import 'package:vitalapp/managers/interfaces/models/patient_model_dto.dart';
  27. import 'package:vitalapp/pages/home/controller.dart';
  28. import 'package:vitalapp/pages/patient/list/widgets/crowd_select_label.dart';
  29. import 'package:vitalapp/pages/patient/list/widgets/status.dart';
  30. import 'package:vitalapp/pages/widgets/icon_button.dart';
  31. import 'package:vitalapp/store/store.dart';
  32. import 'controller.dart';
  33. class PatientListPage extends GetView<PatientListController> {
  34. const PatientListPage({super.key});
  35. @override
  36. Widget build(BuildContext context) {
  37. return Container(
  38. margin: const EdgeInsets.all(16),
  39. child: Column(
  40. children: [
  41. _HeaderWidget(
  42. onFilterPressed: () {
  43. VDynamicDrawerWrapper.show(
  44. scaffoldKey: Get.find<HomeController>().homeScaffoldKey,
  45. builder: (_) => _filterdrawer(context),
  46. );
  47. // scaffoldKey.currentState?.openEndDrawer();
  48. },
  49. ),
  50. const SizedBox(height: 20),
  51. Expanded(child: _buildListView()),
  52. ],
  53. ),
  54. );
  55. }
  56. VDrawer _filterdrawer(BuildContext context) {
  57. final scrollController = ScrollController();
  58. controller.crowdLabelsController.onReady();
  59. return VDrawer(
  60. width: 600,
  61. title: "筛选",
  62. scaffoldKey: Get.find<HomeController>().homeScaffoldKey,
  63. onConfirm: () {
  64. var state = controller.state;
  65. var startTime = state.startTime.value;
  66. var endTime = state.endTime.value;
  67. if (startTime != null &&
  68. endTime != null &&
  69. endTime.difference(startTime).inSeconds < 0) {
  70. PromptBox.toast('起始时间不能晚于结束时间');
  71. return;
  72. }
  73. controller.reloadList(isFilter: true);
  74. // Get.back();
  75. VDynamicDrawerWrapper.hide(
  76. scaffoldKey: Get.find<HomeController>().homeScaffoldKey,
  77. );
  78. },
  79. onCancel: () {
  80. // Get.back();
  81. VDynamicDrawerWrapper.hide(
  82. scaffoldKey: Get.find<HomeController>().homeScaffoldKey,
  83. );
  84. },
  85. child: Scrollbar(
  86. controller: scrollController,
  87. thumbVisibility: true,
  88. child: SingleChildScrollView(
  89. controller: scrollController,
  90. child: Padding(
  91. padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 20),
  92. child: Column(
  93. crossAxisAlignment: CrossAxisAlignment.start,
  94. children: [
  95. const Text(
  96. '居民创建时间:',
  97. style: TextStyle(fontSize: 20),
  98. ),
  99. const SizedBox(
  100. height: 20,
  101. ),
  102. Row(
  103. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  104. mainAxisSize: MainAxisSize.max,
  105. children: [
  106. Expanded(
  107. child: Obx(
  108. () => VInput(
  109. readOnly: true,
  110. controller: TextEditingController(
  111. text: DateFormat('yyyy-MM-dd').format(
  112. controller.state.startTime.value!.toLocal(),
  113. ),
  114. ),
  115. radius: 4,
  116. onTap: () async {
  117. DateTime? result;
  118. bool _isLocalStation =
  119. AppParameters.data.isLocalStation;
  120. if (kIsWeb || _isLocalStation) {
  121. result = await showDatePicker(
  122. context: Get.context!,
  123. initialDate: controller.state.startTime.value ??
  124. DateTime.now(),
  125. firstDate: DateTime(1900),
  126. lastDate: controller.state.endTime.value ??
  127. DateTime(2100),
  128. );
  129. } else {
  130. result = await VDialogDate(
  131. maxValue: controller.state.endTime.value,
  132. title: '起始时间',
  133. initialValue: controller.state.startTime.value,
  134. ).show();
  135. }
  136. controller.state.startTime.value = result;
  137. },
  138. ),
  139. ),
  140. ),
  141. Container(
  142. margin: const EdgeInsets.symmetric(horizontal: 16),
  143. child: const Text('一')),
  144. Expanded(
  145. child: Obx(
  146. () => VInput(
  147. readOnly: true,
  148. controller: TextEditingController(
  149. text: DateFormat('yyyy-MM-dd').format(
  150. controller.state.endTime.value!.toLocal(),
  151. ),
  152. ),
  153. radius: 4,
  154. onTap: () async {
  155. DateTime? result;
  156. bool _isLocalStation =
  157. AppParameters.data.isLocalStation;
  158. if (kIsWeb || _isLocalStation) {
  159. result = await showDatePicker(
  160. context: Get.context!,
  161. initialDate: controller.state.startTime.value ??
  162. DateTime.now(),
  163. firstDate: DateTime(1900),
  164. lastDate: controller.state.endTime.value ??
  165. DateTime(2100),
  166. );
  167. } else {
  168. result = await VDialogDate(
  169. title: '结束时间',
  170. initialValue: controller.state.endTime.value,
  171. ).show();
  172. }
  173. controller.state.endTime.value = result;
  174. },
  175. ),
  176. ),
  177. )
  178. ],
  179. ),
  180. const SizedBox(
  181. height: 20,
  182. ),
  183. const Text(
  184. '居民查询范围:',
  185. style: TextStyle(fontSize: 20),
  186. ),
  187. const SizedBox(
  188. height: 20,
  189. ),
  190. Obx(
  191. () => Row(
  192. children: [
  193. _tabRadio(title: "仅当前医生建档", value: 0),
  194. _tabRadio(title: "当前团队所有居民", value: 1)
  195. ],
  196. ),
  197. ),
  198. const SizedBox(
  199. height: 20,
  200. ),
  201. const Text(
  202. '人群分类:',
  203. style: TextStyle(fontSize: 20),
  204. ),
  205. const SizedBox(
  206. height: 20,
  207. ),
  208. CrowdSelectLabelView(
  209. controller: controller.crowdLabelsController,
  210. ),
  211. const SizedBox(
  212. height: 20,
  213. ),
  214. Row(
  215. children: [
  216. const Text(
  217. '签约状态:',
  218. style: TextStyle(fontSize: 20),
  219. ),
  220. const SizedBox(
  221. width: 20,
  222. ),
  223. Obx(
  224. () => DropdownButton<ContractStateEnum>(
  225. value: controller.state.contractStateSelectedItem,
  226. onChanged: (value) {
  227. controller.state.contractStateSelectedItem = value;
  228. },
  229. focusColor: Colors.white,
  230. items: [
  231. DropdownMenuItem<ContractStateEnum>(
  232. value: null,
  233. child: Text("全部选择"),
  234. ),
  235. ...ContractStateEnum.values
  236. .map<DropdownMenuItem<ContractStateEnum>>(
  237. (ContractStateEnum value) {
  238. return DropdownMenuItem<ContractStateEnum>(
  239. value: value,
  240. child: Text(
  241. controller.ContractStateMap[value.name]!),
  242. );
  243. }).toList()
  244. ],
  245. ),
  246. ),
  247. ],
  248. ),
  249. ],
  250. ),
  251. ),
  252. ),
  253. ),
  254. );
  255. }
  256. Widget _tabRadio({
  257. required String title,
  258. required dynamic value,
  259. }) {
  260. return InkWell(
  261. onTap: () {
  262. controller.changeFilterFounder(value);
  263. },
  264. child: Container(
  265. margin: EdgeInsets.only(right: 15),
  266. child: Row(
  267. children: [
  268. Radio(
  269. value: value,
  270. groupValue: controller.state.selectBoxFilterFounder,
  271. onChanged: (v) {
  272. controller.changeFilterFounder(value);
  273. },
  274. ),
  275. Text(
  276. title,
  277. style: TextStyle(
  278. color: controller.state.selectBoxFilterFounder == value
  279. ? const Color(0xff2c77e5)
  280. : const Color(0xff4c4948),
  281. ),
  282. ),
  283. ],
  284. ),
  285. ),
  286. );
  287. }
  288. Widget _buildListView() {
  289. final scrollController = ScrollController();
  290. scrollController.addListener(
  291. () {
  292. // 如果滑动到底部
  293. try {
  294. if (scrollController.position.atEdge) {
  295. if (scrollController.position.pixels != 0) {
  296. if (controller.state.hasNextPage) {
  297. controller.loadNextPageList();
  298. }
  299. }
  300. }
  301. } catch (e) {
  302. // logger.e("listViewScrollController exception:", e);
  303. }
  304. },
  305. );
  306. return RefreshIndicator(
  307. onRefresh: () async {
  308. controller.reloadList();
  309. },
  310. child: Obx(
  311. () {
  312. final list = controller.state.dataList;
  313. final children = <Widget>[];
  314. for (var i = 0; i < list.length; i++) {
  315. children.add(_PatientCard(dto: list[i]));
  316. }
  317. return children.isEmpty
  318. ? Container(
  319. margin: const EdgeInsets.only(top: 80),
  320. child: Column(
  321. children: [
  322. Center(
  323. child: Image.asset(
  324. "assets/images/no_data.png",
  325. width: 300,
  326. height: 300,
  327. fit: BoxFit.cover,
  328. ),
  329. ),
  330. const Text(
  331. "暂无数据,先看看别的吧",
  332. style: TextStyle(fontSize: 18),
  333. ),
  334. ],
  335. ),
  336. )
  337. : Scrollbar(
  338. trackVisibility: true,
  339. controller: scrollController,
  340. child: GridView(
  341. shrinkWrap: true,
  342. controller: scrollController,
  343. gridDelegate:
  344. const SliverGridDelegateWithFixedCrossAxisCount(
  345. crossAxisCount: 3,
  346. mainAxisSpacing: 16,
  347. crossAxisSpacing: 20,
  348. childAspectRatio: 360 / 200,
  349. ),
  350. children: children,
  351. ),
  352. );
  353. },
  354. ),
  355. );
  356. }
  357. }
  358. class _HeaderWidget extends GetView<PatientListController> {
  359. final searchTextEditingController = TextEditingController();
  360. final VoidCallback onFilterPressed;
  361. _HeaderWidget({
  362. required this.onFilterPressed,
  363. });
  364. @override
  365. Widget build(BuildContext context) {
  366. return SizedBox(
  367. height: 76,
  368. child: Row(
  369. children: [
  370. _PatientStatisticWidget(),
  371. if (Store.user.hasFeature(FeatureKeys.FaceRecognition))
  372. VIconButton(
  373. iconData: Icons.sensor_occupied,
  374. textString: '人脸识别',
  375. voidCallback: () {
  376. if (!kIsOnline) {
  377. PromptBox.toast("当前为离线模式,不支持此功能");
  378. return;
  379. }
  380. Debouncer.run(
  381. controller.onFaceIdLoginClicked,
  382. );
  383. },
  384. ),
  385. if (Store.user.hasFeature(FeatureKeys.IdCardPhotoOCR))
  386. VIconButton(
  387. iconData: Icons.perm_contact_cal_rounded,
  388. textString: '拍照识别',
  389. voidCallback: () {
  390. if (!Store.user
  391. .hasFeature(FeatureKeys.IdCardOfflineRecognition)) {
  392. if (!kIsOnline) {
  393. PromptBox.toast("当前为离线模式,不支持此功能");
  394. return;
  395. }
  396. }
  397. Debouncer.run(
  398. controller.onIdCardScanClickedToDetail,
  399. );
  400. },
  401. ),
  402. if (Store.user.hasFeature(FeatureKeys.IDCardReader))
  403. VIconButton(
  404. iconData: Icons.chrome_reader_mode,
  405. textString: '读卡识别',
  406. voidCallback: () {
  407. Debouncer.run(
  408. controller.onReadCardClickedToDetail,
  409. );
  410. },
  411. ),
  412. VIconButton(
  413. iconData: Icons.edit_document,
  414. textString: '手动录入',
  415. voidCallback: () {
  416. Debouncer.run(
  417. controller.onManualInputPatient,
  418. );
  419. },
  420. ),
  421. Expanded(
  422. child: SizedBox(
  423. height: 70,
  424. child: Obx(
  425. () => VSearchInput(
  426. textEditingController: searchTextEditingController,
  427. placeholder:
  428. "身份证号码/姓名${controller.state.isOnline ? '/手机号/地址' : ''}",
  429. clearable: true,
  430. onClear: () {},
  431. onSearch: (value) {
  432. controller.state.searchString = value;
  433. controller.reloadList();
  434. },
  435. ),
  436. ),
  437. ),
  438. ),
  439. const SizedBox(width: 8),
  440. SizedBox(
  441. width: 180,
  442. height: 70,
  443. child: VButton(
  444. onTap: onFilterPressed,
  445. child: Row(
  446. mainAxisAlignment: MainAxisAlignment.center,
  447. children: const [
  448. Icon(Icons.filter_alt, size: 24),
  449. Text("筛选", style: TextStyle(fontSize: 20)),
  450. ],
  451. ),
  452. ),
  453. ),
  454. ],
  455. ),
  456. );
  457. }
  458. }
  459. class _PatientCard extends StatelessWidget {
  460. final PatientModelDTO dto;
  461. const _PatientCard({required this.dto});
  462. @override
  463. Widget build(BuildContext context) {
  464. final body = Stack(
  465. children: [
  466. Container(
  467. padding: const EdgeInsets.symmetric(
  468. horizontal: 16,
  469. vertical: 12,
  470. ),
  471. child: Column(
  472. crossAxisAlignment: CrossAxisAlignment.start,
  473. children: [
  474. const SizedBox(height: 8),
  475. SizedBox(
  476. child: Text(
  477. dto.patientName!,
  478. overflow: TextOverflow.ellipsis,
  479. style: const TextStyle(
  480. color: Colors.black,
  481. fontSize: 26,
  482. fontWeight: FontWeight.bold,
  483. ),
  484. ),
  485. ),
  486. const SizedBox(height: 8),
  487. LayoutBuilder(
  488. builder: (context, c) {
  489. final width = c.maxWidth - 80;
  490. // 不和状态标签重叠,并保持一定距离
  491. return SizedBox(width: width, child: _buildBaseInfoRow());
  492. },
  493. ),
  494. const SizedBox(height: 4),
  495. _buildPhone(),
  496. const SizedBox(height: 4),
  497. _buildCardNo(),
  498. if (Store.user.hasFeature(FeatureKeys.CrowdClassification) &&
  499. (dto.labelNames?.isNotEmpty ?? false)) ...[
  500. const Expanded(child: SizedBox()),
  501. _buildClassTags(),
  502. ],
  503. ],
  504. ),
  505. ),
  506. Positioned(
  507. top: 0,
  508. right: 0,
  509. child: _PatientSignStatusTag(
  510. dto: dto,
  511. ),
  512. ),
  513. if (kIsOnline || dto.isExistLocalData == true)
  514. Positioned(
  515. right: 0,
  516. bottom: 0,
  517. child: _PatientRemoveMarkButton(dto: dto),
  518. ),
  519. ],
  520. );
  521. return Material(
  522. borderRadius: GlobalStyles.borderRadius,
  523. child: Ink(
  524. decoration: BoxDecoration(
  525. color: Colors.white,
  526. borderRadius: GlobalStyles.borderRadius,
  527. border: Border.all(color: Colors.grey.shade400),
  528. ),
  529. child: InkWell(
  530. borderRadius: GlobalStyles.borderRadius,
  531. onTap: () {
  532. // Get.back();
  533. Get.find<PatientListController>().patientListGotoDetail(dto);
  534. },
  535. child: body,
  536. ),
  537. ),
  538. );
  539. }
  540. Widget _buildBaseInfoRow() {
  541. final birthday = dto.birthday!.toLocal();
  542. final age = DataTimeUtils.calculateAge(birthday);
  543. return Row(
  544. mainAxisSize: MainAxisSize.max,
  545. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  546. children: [
  547. Expanded(
  548. child: Row(
  549. mainAxisSize: MainAxisSize.max,
  550. mainAxisAlignment: MainAxisAlignment.start,
  551. children: [
  552. Expanded(
  553. flex: 1,
  554. child: Text(
  555. RpcEnumLabels.gender[dto.patientGender] ?? "未知",
  556. style: const TextStyle(
  557. color: Colors.grey,
  558. fontSize: 20,
  559. fontWeight: FontWeight.bold,
  560. ),
  561. ),
  562. ),
  563. Expanded(
  564. flex: 1,
  565. child: Text(
  566. "$age岁",
  567. style: const TextStyle(
  568. color: Colors.grey,
  569. fontSize: 20,
  570. ),
  571. ),
  572. ),
  573. ],
  574. ),
  575. ),
  576. ],
  577. );
  578. }
  579. Widget _buildClassTags() {
  580. return Column(
  581. children: [
  582. ConstrainedBox(
  583. constraints: const BoxConstraints(
  584. minWidth: double.infinity,
  585. maxHeight: 28,
  586. ),
  587. child: ListView(
  588. controller: ScrollController(),
  589. scrollDirection: Axis.horizontal,
  590. children: [
  591. Row(
  592. children: dto.labelNames!
  593. .map(
  594. (e) => TagWidget(
  595. height: 50,
  596. label: e,
  597. borderColor: (e == CrowdLabels.CHILDREN ||
  598. e == CrowdLabels.ELDERLY)
  599. ? Colors.blue
  600. : Colors.orange,
  601. backgroundColor: Colors.transparent,
  602. textColor: Colors.black,
  603. padding: EdgeInsets.only(
  604. top: 2,
  605. bottom: 2,
  606. right: 8,
  607. left: 4,
  608. ),
  609. ),
  610. )
  611. .toList(),
  612. )
  613. ]),
  614. ),
  615. ],
  616. );
  617. }
  618. Widget _buildPhone() {
  619. if (dto.phone != null && dto.phone!.isNotEmpty) {
  620. String phone = dto.phone!;
  621. if (Store.app.enableEncryptSensitiveInfo) {
  622. phone = SensitiveUtils.desensitizeMobilePhone(phone);
  623. }
  624. return Text(
  625. '手机号:$phone',
  626. style: const TextStyle(color: Colors.grey, fontSize: 18),
  627. );
  628. } else {
  629. return const SizedBox();
  630. }
  631. }
  632. Widget _buildCardNo() {
  633. if (dto.cardNo != null && dto.cardNo!.isNotEmpty) {
  634. String cardNo = dto.cardNo!;
  635. if (Store.app.enableEncryptSensitiveInfo) {
  636. cardNo = SensitiveUtils.desensitizeIdCard(cardNo);
  637. }
  638. return Text(
  639. '证件号码:$cardNo',
  640. style: const TextStyle(color: Colors.grey, fontSize: 18),
  641. );
  642. } else {
  643. return const SizedBox();
  644. }
  645. }
  646. }
  647. class _PatientSignStatusTag extends StatelessWidget {
  648. final PatientModelDTO dto;
  649. _PatientSignStatusTag({required this.dto});
  650. final ContractUtils _contractUtils = ContractUtils();
  651. @override
  652. Widget build(BuildContext context) {
  653. return Container(
  654. alignment: Alignment.centerRight,
  655. width: 120,
  656. padding: const EdgeInsets.only(top: 18),
  657. child: StatusLabel(
  658. title: _contractUtils.dataOfflineStatus(dto.isExistLocalData!),
  659. color: _contractUtils.dataOfflineColor(dto.isExistLocalData!),
  660. ),
  661. );
  662. }
  663. }
  664. class _PatientRemoveMarkButton extends StatelessWidget {
  665. final PatientModelDTO dto;
  666. const _PatientRemoveMarkButton({required this.dto});
  667. @override
  668. Widget build(BuildContext context) {
  669. return GestureDetector(
  670. onTap: () async {
  671. var message = await _getDeleteShowMessage();
  672. Get.dialog(
  673. VAlertDialog(
  674. title: "提示",
  675. width: 300,
  676. content: Container(
  677. height: 64,
  678. padding: const EdgeInsets.symmetric(horizontal: 24),
  679. alignment: Alignment.center,
  680. child: Text(
  681. " “${dto.patientName}”$message是否确定删除?",
  682. style: TextStyle(fontSize: 20),
  683. ),
  684. ),
  685. onConfirm: () async {
  686. Get.find<PatientListController>().removePatient(dto.code!);
  687. Get.back();
  688. },
  689. ),
  690. barrierDismissible: false,
  691. barrierColor: Colors.black.withOpacity(.4),
  692. );
  693. },
  694. child: Container(
  695. padding: EdgeInsets.only(top: 10, left: 10, right: 2, bottom: 2),
  696. decoration: BoxDecoration(
  697. color: Colors.red,
  698. borderRadius: BorderRadius.only(
  699. topLeft: Radius.circular(32),
  700. bottomRight: Radius.circular(4),
  701. ),
  702. ),
  703. child: Icon(
  704. Icons.delete_forever,
  705. size: 26,
  706. color: Colors.white,
  707. ),
  708. ),
  709. );
  710. }
  711. Future<String> _getDeleteShowMessage() async {
  712. String message = "";
  713. var diagnosisManager = Get.find<IDiagnosisManager>();
  714. var diagnosisList = await diagnosisManager.getDiagnosisAggregationPageAsync(
  715. dto.code!, 1, 10);
  716. var listRecords = await diagnosisManager.getListByPatientCode(dto.code!);
  717. if ((diagnosisList != null && diagnosisList.dataCount > 0) ||
  718. (listRecords != null && listRecords.length > 0)) {
  719. message += "检测记录";
  720. }
  721. var examManager = Get.find<IExamManager>();
  722. var examList =
  723. await examManager.getPatientExamByPageAsync(dto.code!, "HEITCMC");
  724. if (examList != null && examList.length > 0) {
  725. if (message.length > 0) {
  726. message += "和中医体质记录";
  727. } else {
  728. message += "中医体质记录";
  729. }
  730. }
  731. if (message.length > 0) {
  732. message = "有" + message + ",";
  733. }
  734. return message;
  735. }
  736. }
  737. class _PatientStatisticWidget extends StatelessWidget {
  738. @override
  739. Widget build(BuildContext context) {
  740. final controller = Get.find<PatientListController>();
  741. final state = controller.state;
  742. return Container(
  743. width: 160,
  744. alignment: Alignment.centerLeft,
  745. child: Obx(() {
  746. return Column(
  747. mainAxisAlignment: MainAxisAlignment.center,
  748. crossAxisAlignment: CrossAxisAlignment.start,
  749. children: [
  750. _buildItem(context, "当日建档数量: ", state.statisticTodayCount),
  751. const SizedBox(height: 8),
  752. _buildItem(context, "总共建档数量: ", state.statisticTotalCount),
  753. const SizedBox(height: 8),
  754. _buildItem(context, "查询结果数量: ", state.queryResultTotalCount),
  755. ],
  756. );
  757. }),
  758. );
  759. }
  760. Widget _buildItem(BuildContext context, String label, int count) {
  761. return Expanded(
  762. child: RichText(
  763. text: TextSpan(
  764. style: TextStyle(
  765. fontSize: 16,
  766. color: Colors.black,
  767. fontFamily: "NotoSansSC",
  768. fontFamilyFallback: const ["NotoSansSC"],
  769. ),
  770. children: [
  771. TextSpan(text: label),
  772. TextSpan(text: " "),
  773. TextSpan(
  774. text: "${count}",
  775. style: TextStyle(
  776. fontSize: 16,
  777. color: Theme.of(context).primaryColor,
  778. ),
  779. ),
  780. ],
  781. ),
  782. ),
  783. );
  784. }
  785. }