health_infos.dart 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208
  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:intl/intl.dart';
  5. import 'package:vitalapp/architecture/app_parameters.dart';
  6. import 'package:vitalapp/components/cell.dart';
  7. import 'package:vitalapp/components/dialog_check.dart';
  8. import 'package:vitalapp/components/dialog_date.dart';
  9. import 'package:vitalapp/components/dialog_input.dart';
  10. import 'package:vitalapp/components/dialog_profile_time_input.dart';
  11. import 'package:vitalapp/components/dialog_select.dart';
  12. import 'package:fis_common/index.dart';
  13. import 'package:vitalapp/pages/patient_info/controller.dart';
  14. import 'package:vitalapp/pages/patient_info/entitys/patientInfo_record.dart';
  15. class HealthInfomations extends GetView<PatientInfomationController> {
  16. @override
  17. Widget build(BuildContext context) {
  18. return Obx(() {
  19. final data = controller.state.healthInfo;
  20. final state = controller.state;
  21. return VListFormCellGroup(
  22. formTitle: "健康信息",
  23. children: [
  24. Row(
  25. children: [
  26. Text(
  27. "过敏史",
  28. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  29. ),
  30. Expanded(child: SizedBox()),
  31. Text(
  32. "全选",
  33. style: TextStyle(
  34. fontSize: 20,
  35. fontWeight: FontWeight.w700,
  36. ),
  37. ),
  38. Switch(
  39. value: controller.state.selectedAllergyHistory,
  40. onChanged: (v) {
  41. controller.state.selectedAllergyHistory = v;
  42. if (v) {
  43. data.historyDrugAllergies = ["1"];
  44. data.historyExposure = ["1"];
  45. } else {
  46. data.historyDrugAllergies = [];
  47. data.historyExposure = [];
  48. }
  49. },
  50. ),
  51. ],
  52. ),
  53. VListFormCell(
  54. label: "药物过敏史",
  55. content: data.historyDrugAllergies?.map(
  56. (index) {
  57. return PatientInfoRecord.historyDrugAllergiesList
  58. .firstWhere((element) => element.key == index)
  59. .value;
  60. },
  61. ).join(',') ??
  62. "",
  63. onTap: () async {
  64. final result =
  65. await VDialogCheck<MapEntry<String, String>, String>(
  66. title: "药物过敏史",
  67. source: PatientInfoRecord.historyDrugAllergiesList,
  68. initialValue: data.historyDrugAllergies ?? [],
  69. valueGetter: (data) => data.key,
  70. labelGetter: (data) => data.value,
  71. MutexValue: '1',
  72. ).show();
  73. if (result != null) {
  74. data.historyDrugAllergies = result;
  75. state.refreshHealthInfo();
  76. }
  77. },
  78. endIcon: _buildEndIcon(),
  79. ),
  80. if (data.historyDrugAllergies?.contains("5") ?? false)
  81. VListFormCell(
  82. label: "药物过敏史-其他",
  83. content: data.historyDrugAllergiesOther,
  84. onTap: () async {
  85. final result = await VDialogInput(
  86. title: "药物过敏史-其他",
  87. initialValue: data.historyDrugAllergiesOther,
  88. placeholder: '请输入')
  89. .show();
  90. if (result != null) {
  91. data.historyDrugAllergiesOther = result;
  92. state.refreshHealthInfo();
  93. }
  94. },
  95. endIcon: _buildEndIcon(),
  96. ),
  97. VListFormCell(
  98. label: "暴露史",
  99. content: data.historyExposure?.map((index) {
  100. return PatientInfoRecord.historyExposureList
  101. .firstWhere((element) => element.key == index)
  102. .value;
  103. }).join(',') ??
  104. '',
  105. onTap: () async {
  106. final result =
  107. await VDialogCheck<MapEntry<String, String>, String>(
  108. title: "暴露史",
  109. source: PatientInfoRecord.historyExposureList,
  110. initialValue: data.historyExposure ?? [],
  111. valueGetter: (data) => data.key,
  112. labelGetter: (data) => data.value,
  113. MutexValue: '1',
  114. ).show();
  115. if (result != null) {
  116. data.historyExposure = result;
  117. state.refreshHealthInfo();
  118. }
  119. },
  120. endIcon: _buildEndIcon(),
  121. ),
  122. Row(
  123. children: [
  124. Text(
  125. "既往史",
  126. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  127. ),
  128. Expanded(child: SizedBox()),
  129. Text(
  130. "全选",
  131. style: TextStyle(
  132. fontSize: 20,
  133. fontWeight: FontWeight.w700,
  134. ),
  135. ),
  136. Switch(
  137. value: controller.state.selectedAllMedicalHistory,
  138. onChanged: (v) {
  139. controller.state.selectedAllMedicalHistory = v;
  140. if (v) {
  141. data.operation = "1";
  142. data.trauma = "1";
  143. data.transfusion = "1";
  144. data.historyPreviousDisease = ["1"];
  145. } else {
  146. data.operation = null;
  147. data.trauma = null;
  148. data.transfusion = null;
  149. data.historyPreviousDisease = null;
  150. }
  151. },
  152. ),
  153. ],
  154. ),
  155. Column(
  156. children: [
  157. VListFormCell(
  158. label: "疾病",
  159. content: data.historyPreviousDisease?.map((index) {
  160. return PatientInfoRecord.historyPreviousDiseaseList
  161. .firstWhere((element) => element.key == index)
  162. .value;
  163. }).join(','),
  164. onTap: () async {
  165. final result =
  166. await VDialogCheck<MapEntry<String, String>, String>(
  167. title: "疾病",
  168. source: PatientInfoRecord.historyPreviousDiseaseList,
  169. initialValue: data.historyPreviousDisease ?? [],
  170. valueGetter: (data) => data.key,
  171. labelGetter: (data) => data.value,
  172. MutexValue: '1',
  173. ).show();
  174. if (result != null) {
  175. data.historyPreviousDisease = result;
  176. state.refreshHealthInfo();
  177. }
  178. },
  179. endIcon: _buildEndIcon(),
  180. ),
  181. if (data.historyPreviousDisease?.contains("6") ?? false)
  182. VListFormCell(
  183. label: " 疾病-恶性肿瘤",
  184. content: data.historyPreviousDiseaseMalignancy,
  185. onTap: () async {
  186. final result = await VDialogInput(
  187. title: "疾病-恶性肿瘤",
  188. initialValue: data.historyPreviousDiseaseMalignancy,
  189. placeholder: '请输入恶性肿瘤详情')
  190. .show();
  191. if (result != null) {
  192. data.historyPreviousDiseaseMalignancy = result;
  193. state.refreshHealthInfo();
  194. }
  195. },
  196. endIcon: _buildEndIcon(),
  197. ),
  198. if (data.historyPreviousDisease?.contains("12") ?? false)
  199. VListFormCell(
  200. label: " 疾病-职业病",
  201. content: data.historyPreviousDiseaseOccupationalDisease,
  202. onTap: () async {
  203. final result = await VDialogInput(
  204. title: "疾病-职业病",
  205. initialValue:
  206. data.historyPreviousDiseaseOccupationalDisease,
  207. placeholder: '请输入职业病详情')
  208. .show();
  209. if (result != null) {
  210. data.historyPreviousDiseaseOccupationalDisease = result;
  211. state.refreshHealthInfo();
  212. }
  213. },
  214. endIcon: _buildEndIcon(),
  215. ),
  216. if (data.historyPreviousDisease?.contains("13") ?? false)
  217. VListFormCell(
  218. label: " 疾病-其他",
  219. content: data.historyPreviousDiseaseOther,
  220. onTap: () async {
  221. final result = await VDialogInput(
  222. title: "疾病-其他",
  223. initialValue: data.historyPreviousDiseaseOther,
  224. placeholder: '请输入其他疾病详情')
  225. .show();
  226. if (result != null) {
  227. data.historyPreviousDiseaseOther = result;
  228. state.refreshHealthInfo();
  229. }
  230. },
  231. endIcon: _buildEndIcon(),
  232. ),
  233. if ((data.historyPreviousDisease?.isNotEmpty ?? false) &&
  234. !(data.historyPreviousDisease?.contains("1") ?? false))
  235. ...data.historyPreviousDisease!
  236. .map(
  237. (e) => VListFormCell(
  238. label:
  239. ' ${PatientInfoRecord.historyPreviousDiseaseList.firstWhere((element) => element.key == e).value} 确诊时间',
  240. content: data.diseaseDiagnosisTime[e] != null
  241. ? DateFormat('yyyy-MM-dd')
  242. .format(data.diseaseDiagnosisTime[e]!)
  243. : '',
  244. onTap: () async {
  245. bool _isLocalStation =
  246. AppParameters.data.isLocalStation;
  247. DateTime? result;
  248. if (kIsWeb || _isLocalStation) {
  249. result = await showDatePicker(
  250. context: Get.context!,
  251. initialDate:
  252. controller.state.birthday ?? DateTime.now(),
  253. firstDate: DateTime(1900),
  254. lastDate: DateTime(2100),
  255. );
  256. } else {
  257. result = await VDialogDate(
  258. maxValue: DateTime.now(),
  259. ).show();
  260. }
  261. if (result != null) {
  262. data.diseaseDiagnosisTime[e] = result;
  263. state.refreshHealthInfo();
  264. }
  265. },
  266. endIcon: _buildEndIcon(),
  267. ),
  268. )
  269. .toList(),
  270. ],
  271. ),
  272. ///手术
  273. Column(
  274. children: [
  275. VListFormCell(
  276. label: "手术",
  277. content: data.operation.isNotNullOrEmpty
  278. ? PatientInfoRecord.historyPreviousOtherList
  279. .firstWhere((element) => element.key == data.operation)
  280. .value
  281. : '',
  282. onTap: () async {
  283. final result =
  284. await VDialogSelect<MapEntry<String, String>, String>(
  285. title: "既往史-手术",
  286. source: PatientInfoRecord.historyPreviousOtherList,
  287. initialValue: data.operation,
  288. valueGetter: (data) => data.key,
  289. labelGetter: (data) => data.value,
  290. ).show();
  291. if (result != null) {
  292. data.operation = result;
  293. state.refreshHealthInfo();
  294. }
  295. },
  296. endIcon: _buildEndIcon(),
  297. ),
  298. if (data.operation?.contains("2") ?? false)
  299. Row(
  300. children: [
  301. const SizedBox(
  302. width: 16,
  303. ),
  304. Expanded(
  305. child: InkWell(
  306. onTap: () async {
  307. final result = await VDialogProfileTimeInput(
  308. title: "手术1",
  309. initialValue: data.operationOne,
  310. ).show();
  311. if (result != null) {
  312. data.operationOne = result;
  313. state.refreshHealthInfo();
  314. }
  315. },
  316. child: Card(
  317. elevation: 0,
  318. child: Container(
  319. decoration: BoxDecoration(
  320. border: Border.all(
  321. color: Colors.grey.shade300,
  322. ),
  323. borderRadius: BorderRadius.circular(8)),
  324. padding: const EdgeInsets.all(16),
  325. child: Column(
  326. crossAxisAlignment: CrossAxisAlignment.start,
  327. children: [
  328. const Text(
  329. '手术1',
  330. style: TextStyle(
  331. fontSize: 24,
  332. ),
  333. ),
  334. Text(
  335. '名称:${data.operationOne?.name ?? ''}',
  336. style: const TextStyle(
  337. fontSize: 20,
  338. ),
  339. ),
  340. Text(
  341. '时间:${data.operationOne?.time != null ? DateFormat('yyyy-MM-dd').format(data.operationOne!.time!) : ''}',
  342. style: const TextStyle(
  343. fontSize: 20,
  344. ),
  345. ),
  346. const SizedBox(
  347. height: 4,
  348. )
  349. ],
  350. ),
  351. ),
  352. ),
  353. ),
  354. ),
  355. Expanded(
  356. child: InkWell(
  357. onTap: () async {
  358. final result = await VDialogProfileTimeInput(
  359. title: "手术2",
  360. initialValue: data.operationTwo,
  361. ).show();
  362. if (result != null) {
  363. data.operationTwo = result;
  364. state.refreshHealthInfo();
  365. }
  366. },
  367. child: Card(
  368. elevation: 0,
  369. child: Container(
  370. decoration: BoxDecoration(
  371. border: Border.all(
  372. color: Colors.grey.shade300,
  373. ),
  374. borderRadius: BorderRadius.circular(8)),
  375. padding: const EdgeInsets.all(16),
  376. child: Column(
  377. crossAxisAlignment: CrossAxisAlignment.start,
  378. children: [
  379. const Text(
  380. '手术2',
  381. style: TextStyle(
  382. fontSize: 24,
  383. ),
  384. ),
  385. Text(
  386. '名称:${data.operationTwo?.name ?? ''}',
  387. style: const TextStyle(
  388. fontSize: 20,
  389. ),
  390. ),
  391. Text(
  392. '时间:${data.operationTwo?.time != null ? DateFormat('yyyy-MM-dd').format(data.operationTwo!.time!) : ''}',
  393. style: const TextStyle(
  394. fontSize: 20,
  395. ),
  396. ),
  397. const SizedBox(
  398. height: 4,
  399. )
  400. ],
  401. ),
  402. ),
  403. ),
  404. ),
  405. ),
  406. const SizedBox(
  407. width: 16,
  408. ),
  409. ],
  410. ),
  411. ],
  412. ),
  413. ///外伤
  414. Column(
  415. children: [
  416. VListFormCell(
  417. label: "外伤",
  418. content: data.trauma.isNotNullOrEmpty
  419. ? PatientInfoRecord.historyPreviousOtherList
  420. .firstWhere((element) => element.key == data.trauma)
  421. .value
  422. : '',
  423. onTap: () async {
  424. final result =
  425. await VDialogSelect<MapEntry<String, String>, String>(
  426. title: "既往史-外伤",
  427. source: PatientInfoRecord.historyPreviousOtherList,
  428. initialValue: data.trauma,
  429. valueGetter: (data) => data.key,
  430. labelGetter: (data) => data.value,
  431. ).show();
  432. if (result != null) {
  433. data.trauma = result;
  434. state.refreshHealthInfo();
  435. }
  436. },
  437. endIcon: _buildEndIcon(),
  438. ),
  439. if (data.trauma?.contains('2') ?? false)
  440. Row(
  441. children: [
  442. const SizedBox(
  443. width: 16,
  444. ),
  445. Expanded(
  446. child: InkWell(
  447. onTap: () async {
  448. final result = await VDialogProfileTimeInput(
  449. title: "外伤1",
  450. initialValue: data.traumaOne,
  451. ).show();
  452. if (result != null) {
  453. data.traumaOne = result;
  454. state.refreshHealthInfo();
  455. }
  456. },
  457. child: Card(
  458. elevation: 0,
  459. child: Container(
  460. decoration: BoxDecoration(
  461. border: Border.all(
  462. color: Colors.grey.shade300,
  463. ),
  464. borderRadius: BorderRadius.circular(8)),
  465. padding: const EdgeInsets.all(16),
  466. child: Column(
  467. crossAxisAlignment: CrossAxisAlignment.start,
  468. children: [
  469. const Text(
  470. '外伤1',
  471. style: TextStyle(
  472. fontSize: 24,
  473. ),
  474. ),
  475. Text(
  476. '名称:${data.traumaOne?.name ?? ''}',
  477. style: const TextStyle(
  478. fontSize: 20,
  479. ),
  480. ),
  481. Text(
  482. '时间:${data.traumaOne?.time != null ? DateFormat('yyyy-MM-dd').format(data.traumaOne!.time!) : ''}',
  483. style: const TextStyle(
  484. fontSize: 20,
  485. ),
  486. ),
  487. const SizedBox(
  488. height: 4,
  489. )
  490. ],
  491. ),
  492. ),
  493. ),
  494. ),
  495. ),
  496. Expanded(
  497. child: InkWell(
  498. onTap: () async {
  499. final result = await VDialogProfileTimeInput(
  500. title: "外伤2",
  501. initialValue: data.traumaTwo,
  502. ).show();
  503. if (result != null) {
  504. data.traumaTwo = result;
  505. state.refreshHealthInfo();
  506. }
  507. },
  508. child: Card(
  509. elevation: 0,
  510. child: Container(
  511. decoration: BoxDecoration(
  512. border: Border.all(
  513. color: Colors.grey.shade300,
  514. ),
  515. borderRadius: BorderRadius.circular(8)),
  516. padding: const EdgeInsets.all(16),
  517. child: Column(
  518. crossAxisAlignment: CrossAxisAlignment.start,
  519. children: [
  520. const Text(
  521. '外伤2',
  522. style: TextStyle(
  523. fontSize: 24,
  524. ),
  525. ),
  526. Text(
  527. '名称:${data.traumaTwo?.name ?? ''}',
  528. style: const TextStyle(
  529. fontSize: 20,
  530. ),
  531. ),
  532. Text(
  533. '时间:${data.traumaTwo?.time != null ? DateFormat('yyyy-MM-dd').format(data.traumaTwo!.time!) : ''}',
  534. style: const TextStyle(
  535. fontSize: 20,
  536. ),
  537. ),
  538. const SizedBox(
  539. height: 4,
  540. )
  541. ],
  542. ),
  543. ),
  544. ),
  545. ),
  546. ),
  547. const SizedBox(
  548. width: 16,
  549. ),
  550. ],
  551. ),
  552. ],
  553. ),
  554. ///输血项目
  555. Column(
  556. children: [
  557. VListFormCell(
  558. label: "输血",
  559. content: data.transfusion.isNotNullOrEmpty
  560. ? PatientInfoRecord.historyPreviousOtherList
  561. .firstWhere(
  562. (element) => element.key == data.transfusion)
  563. .value
  564. : '',
  565. onTap: () async {
  566. final result =
  567. await VDialogSelect<MapEntry<String, String>, String>(
  568. title: "既往史-输血",
  569. source: PatientInfoRecord.historyPreviousOtherList,
  570. initialValue: data.transfusion,
  571. valueGetter: (data) => data.key,
  572. labelGetter: (data) => data.value,
  573. ).show();
  574. if (result != null) {
  575. data.transfusion = result;
  576. state.refreshHealthInfo();
  577. }
  578. },
  579. endIcon: _buildEndIcon(),
  580. ),
  581. if (data.transfusion?.contains('2') ?? false)
  582. Row(
  583. children: [
  584. const SizedBox(
  585. width: 16,
  586. ),
  587. Expanded(
  588. child: InkWell(
  589. onTap: () async {
  590. final result = await VDialogProfileTimeInput(
  591. title: "输血1",
  592. initialValue: data.transfusionOne,
  593. ).show();
  594. if (result != null) {
  595. data.transfusionOne = result;
  596. state.refreshHealthInfo();
  597. }
  598. },
  599. child: Card(
  600. elevation: 0,
  601. child: Container(
  602. decoration: BoxDecoration(
  603. border: Border.all(
  604. color: Colors.grey.shade300,
  605. ),
  606. borderRadius: BorderRadius.circular(8)),
  607. padding: const EdgeInsets.all(16),
  608. child: Column(
  609. crossAxisAlignment: CrossAxisAlignment.start,
  610. children: [
  611. const Text(
  612. '输血1',
  613. style: TextStyle(
  614. fontSize: 24,
  615. ),
  616. ),
  617. Text(
  618. '名称:${data.transfusionOne?.name ?? ''}',
  619. style: const TextStyle(
  620. fontSize: 20,
  621. ),
  622. ),
  623. Text(
  624. '时间:${data.transfusionOne?.time != null ? DateFormat('yyyy-MM-dd').format(data.transfusionOne!.time!) : ''}',
  625. style: const TextStyle(
  626. fontSize: 20,
  627. ),
  628. ),
  629. const SizedBox(
  630. height: 4,
  631. )
  632. ],
  633. ),
  634. ),
  635. ),
  636. ),
  637. ),
  638. Expanded(
  639. child: InkWell(
  640. onTap: () async {
  641. final result = await VDialogProfileTimeInput(
  642. title: "输血2",
  643. initialValue: data.transfusionTwo,
  644. ).show();
  645. if (result != null) {
  646. data.transfusionTwo = result;
  647. state.refreshHealthInfo();
  648. }
  649. },
  650. child: Card(
  651. elevation: 0,
  652. child: Container(
  653. decoration: BoxDecoration(
  654. border: Border.all(
  655. color: Colors.grey.shade300,
  656. ),
  657. borderRadius: BorderRadius.circular(8)),
  658. padding: const EdgeInsets.all(16),
  659. child: Column(
  660. crossAxisAlignment: CrossAxisAlignment.start,
  661. children: [
  662. const Text(
  663. '输血2',
  664. style: TextStyle(
  665. fontSize: 24,
  666. ),
  667. ),
  668. Text(
  669. '名称:${data.transfusionTwo?.name ?? ''}',
  670. style: const TextStyle(
  671. fontSize: 20,
  672. ),
  673. ),
  674. Text(
  675. '时间:${data.transfusionTwo?.time != null ? DateFormat('yyyy-MM-dd').format(data.transfusionTwo!.time!) : ''}',
  676. style: const TextStyle(
  677. fontSize: 20,
  678. ),
  679. ),
  680. const SizedBox(
  681. height: 4,
  682. )
  683. ],
  684. ),
  685. ),
  686. ),
  687. ),
  688. ),
  689. const SizedBox(
  690. width: 16,
  691. ),
  692. ],
  693. ),
  694. ],
  695. ),
  696. Row(
  697. children: [
  698. Text(
  699. "家族病史",
  700. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  701. ),
  702. Expanded(child: SizedBox()),
  703. Text(
  704. "全选",
  705. style: TextStyle(
  706. fontSize: 20,
  707. fontWeight: FontWeight.w700,
  708. ),
  709. ),
  710. Switch(
  711. value: controller.state.selectedAllFamilyMedicalHistory,
  712. onChanged: (v) {
  713. controller.state.selectedAllFamilyMedicalHistory = v;
  714. if (v) {
  715. data.father = ["1"];
  716. data.mother = ["1"];
  717. data.sibling = ["1"];
  718. data.children = ["1"];
  719. } else {
  720. data.father = [];
  721. data.mother = [];
  722. data.sibling = [];
  723. data.children = [];
  724. }
  725. },
  726. ),
  727. ],
  728. ),
  729. VListFormCell(
  730. label: "父亲",
  731. content: data.father?.map((index) {
  732. return PatientInfoRecord.historyFamilyList
  733. .firstWhere((element) => element.key == index)
  734. .value;
  735. }).join(','),
  736. onTap: () async {
  737. final result =
  738. await VDialogCheck<MapEntry<String, String>, String>(
  739. title: "父亲",
  740. source: PatientInfoRecord.historyFamilyList,
  741. initialValue: data.father ?? [],
  742. valueGetter: (data) => data.key,
  743. labelGetter: (data) => data.value,
  744. MutexValue: '1',
  745. ).show();
  746. if (result != null) {
  747. data.father = result;
  748. state.refreshHealthInfo();
  749. }
  750. },
  751. endIcon: _buildEndIcon(),
  752. ),
  753. if (data.father?.contains("12") ?? false)
  754. VListFormCell(
  755. label: "父亲-其他",
  756. content: data.fatherOther,
  757. onTap: () async {
  758. final result = await VDialogInput(
  759. title: "父亲-其他",
  760. initialValue: data.fatherOther,
  761. placeholder: '请输入')
  762. .show();
  763. if (result != null) {
  764. data.fatherOther = result;
  765. state.refreshHealthInfo();
  766. }
  767. },
  768. endIcon: _buildEndIcon(),
  769. ),
  770. VListFormCell(
  771. label: "母亲",
  772. content: data.mother?.map((index) {
  773. return PatientInfoRecord.historyFamilyList
  774. .firstWhere((element) => element.key == index)
  775. .value;
  776. }).join(','),
  777. onTap: () async {
  778. final result =
  779. await VDialogCheck<MapEntry<String, String>, String>(
  780. title: "母亲",
  781. source: PatientInfoRecord.historyFamilyList,
  782. initialValue: data.mother ?? [],
  783. valueGetter: (data) => data.key,
  784. labelGetter: (data) => data.value,
  785. MutexValue: '1',
  786. ).show();
  787. if (result != null) {
  788. data.mother = result;
  789. state.refreshHealthInfo();
  790. }
  791. },
  792. endIcon: _buildEndIcon(),
  793. ),
  794. if (data.mother?.contains("12") ?? false)
  795. VListFormCell(
  796. label: "母亲-其他",
  797. content: data.motherOther,
  798. onTap: () async {
  799. final result = await VDialogInput(
  800. title: "母亲-其他",
  801. initialValue: data.motherOther,
  802. placeholder: '请输入')
  803. .show();
  804. if (result != null) {
  805. data.motherOther = result;
  806. state.refreshHealthInfo();
  807. }
  808. },
  809. endIcon: _buildEndIcon(),
  810. ),
  811. VListFormCell(
  812. label: "兄弟姐妹",
  813. content: data.sibling?.map((index) {
  814. return PatientInfoRecord.historyFamilyList
  815. .firstWhere((element) => element.key == index)
  816. .value;
  817. }).join(','),
  818. onTap: () async {
  819. final result =
  820. await VDialogCheck<MapEntry<String, String>, String>(
  821. title: "兄弟姐妹",
  822. source: PatientInfoRecord.historyFamilyList,
  823. initialValue: data.sibling ?? [],
  824. valueGetter: (data) => data.key,
  825. labelGetter: (data) => data.value,
  826. MutexValue: '1',
  827. ).show();
  828. if (result != null) {
  829. data.sibling = result;
  830. state.refreshHealthInfo();
  831. }
  832. },
  833. endIcon: _buildEndIcon(),
  834. ),
  835. if (data.sibling?.contains("12") ?? false)
  836. VListFormCell(
  837. label: "兄弟姐妹-其他",
  838. content: data.siblingOther,
  839. onTap: () async {
  840. final result = await VDialogInput(
  841. title: "兄弟姐妹-其他",
  842. initialValue: data.siblingOther,
  843. placeholder: '请输入')
  844. .show();
  845. if (result != null) {
  846. data.siblingOther = result;
  847. state.refreshHealthInfo();
  848. }
  849. },
  850. endIcon: _buildEndIcon(),
  851. ),
  852. VListFormCell(
  853. label: "子女",
  854. content: data.children?.map((index) {
  855. return PatientInfoRecord.historyFamilyList
  856. .firstWhere((element) => element.key == index)
  857. .value;
  858. }).join(','),
  859. onTap: () async {
  860. final result =
  861. await VDialogCheck<MapEntry<String, String>, String>(
  862. title: "子女",
  863. source: PatientInfoRecord.historyFamilyList,
  864. initialValue: data.children ?? [],
  865. valueGetter: (data) => data.key,
  866. labelGetter: (data) => data.value,
  867. MutexValue: '1',
  868. ).show();
  869. if (result != null) {
  870. data.children = result;
  871. state.refreshHealthInfo();
  872. }
  873. },
  874. endIcon: _buildEndIcon(),
  875. ),
  876. if (data.children?.contains("12") ?? false)
  877. VListFormCell(
  878. label: "子女-其他",
  879. content: data.childrenOther,
  880. onTap: () async {
  881. final result = await VDialogInput(
  882. title: "子女-其他",
  883. initialValue: data.childrenOther,
  884. placeholder: '请输入')
  885. .show();
  886. if (result != null) {
  887. data.childrenOther = result;
  888. state.refreshHealthInfo();
  889. }
  890. },
  891. endIcon: _buildEndIcon(),
  892. ),
  893. Row(
  894. children: [
  895. Text(
  896. "遗传病史",
  897. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  898. ),
  899. Expanded(child: SizedBox()),
  900. Text(
  901. "全选",
  902. style: TextStyle(
  903. fontSize: 20,
  904. fontWeight: FontWeight.w700,
  905. ),
  906. ),
  907. Switch(
  908. value: controller.state.selectAllGeneticHistory,
  909. onChanged: (v) {
  910. controller.state.selectAllGeneticHistory = v;
  911. if (v) {
  912. data.historyGenetic = "1";
  913. data.disabilitySituation = ["1"];
  914. } else {
  915. data.historyGenetic = null;
  916. data.disabilitySituation = [];
  917. }
  918. },
  919. ),
  920. ],
  921. ),
  922. VListFormCell(
  923. label: "遗传病史",
  924. content: data.historyGenetic.isNotNullOrEmpty
  925. ? PatientInfoRecord.historyPreviousOtherList
  926. .firstWhere((element) => element.key == data.historyGenetic)
  927. .value
  928. : '',
  929. onTap: () async {
  930. final result =
  931. await VDialogSelect<MapEntry<String, String>, String>(
  932. title: "遗传病史",
  933. source: PatientInfoRecord.historyPreviousOtherList,
  934. initialValue: data.historyGenetic,
  935. valueGetter: (data) => data.key,
  936. labelGetter: (data) => data.value,
  937. ).show();
  938. if (result != null) {
  939. data.historyGenetic = result;
  940. state.refreshHealthInfo();
  941. }
  942. },
  943. endIcon: _buildEndIcon(),
  944. ),
  945. if (data.historyGenetic?.contains("2") ?? false)
  946. VListFormCell(
  947. label: "疾病名称",
  948. content: data.historyGeneticName,
  949. onTap: () async {
  950. final result = await VDialogInput(
  951. title: "疾病名称",
  952. initialValue: data.historyGeneticName,
  953. placeholder: '请输入')
  954. .show();
  955. if (result != null) {
  956. data.historyGeneticName = result;
  957. state.refreshHealthInfo();
  958. }
  959. },
  960. endIcon: _buildEndIcon(),
  961. ),
  962. Column(
  963. children: [
  964. VListFormCell(
  965. label: "残疾情况",
  966. content: data.disabilitySituation?.map((index) {
  967. return PatientInfoRecord.disabilitySituationList
  968. .firstWhere((element) => element.key == index)
  969. .value;
  970. }).join(','),
  971. onTap: () async {
  972. final result =
  973. await VDialogCheck<MapEntry<String, String>, String>(
  974. title: "残疾情况",
  975. source: PatientInfoRecord.disabilitySituationList,
  976. initialValue: data.disabilitySituation ?? [],
  977. valueGetter: (data) => data.key,
  978. labelGetter: (data) => data.value,
  979. MutexValue: '1',
  980. ).show();
  981. if (result != null) {
  982. data.disabilitySituation = result;
  983. state.refreshHealthInfo();
  984. }
  985. },
  986. endIcon: _buildEndIcon(),
  987. ),
  988. if (data.disabilitySituation?.contains("8") ?? false)
  989. VListFormCell(
  990. label: "其他残疾-疾病名称",
  991. content: data.disabilitySituationOther,
  992. onTap: () async {
  993. final result = await VDialogInput(
  994. title: "其他残疾-疾病名称",
  995. initialValue: data.disabilitySituationOther,
  996. placeholder: '请输入')
  997. .show();
  998. if (result != null) {
  999. data.disabilitySituationOther = result;
  1000. state.refreshHealthInfo();
  1001. }
  1002. },
  1003. endIcon: _buildEndIcon(),
  1004. ),
  1005. ],
  1006. ),
  1007. Row(
  1008. children: [
  1009. Text(
  1010. "生活环境",
  1011. style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
  1012. ),
  1013. Expanded(child: SizedBox()),
  1014. Text(
  1015. "全选",
  1016. style: TextStyle(
  1017. fontSize: 20,
  1018. fontWeight: FontWeight.w700,
  1019. ),
  1020. ),
  1021. Switch(
  1022. value: controller.state.livingEnvironment,
  1023. onChanged: (v) {
  1024. controller.state.livingEnvironment = v;
  1025. if (v) {
  1026. data.fuel = "1";
  1027. data.drinkingWater = "1";
  1028. data.toilet = "1";
  1029. data.animalPen = "1";
  1030. data.kitchenExhaustFacilities = "1";
  1031. } else {
  1032. data.fuel = null;
  1033. data.toilet = null;
  1034. data.animalPen = null;
  1035. data.kitchenExhaustFacilities = null;
  1036. data.drinkingWater = null;
  1037. }
  1038. },
  1039. ),
  1040. ],
  1041. ),
  1042. VListFormCell(
  1043. label: "厨房排风设施",
  1044. content: data.kitchenExhaustFacilities.isNotNullOrEmpty
  1045. ? PatientInfoRecord.kitchenExhaustFacilitiesList
  1046. .firstWhere((element) =>
  1047. element.key == data.kitchenExhaustFacilities)
  1048. .value
  1049. : '',
  1050. onTap: () async {
  1051. final result =
  1052. await VDialogSelect<MapEntry<String, String>, String>(
  1053. title: "厨房排风设施",
  1054. source: PatientInfoRecord.kitchenExhaustFacilitiesList,
  1055. initialValue: data.kitchenExhaustFacilities,
  1056. valueGetter: (data) => data.key,
  1057. labelGetter: (data) => data.value,
  1058. ).show();
  1059. if (result != null) {
  1060. data.kitchenExhaustFacilities = result;
  1061. state.refreshHealthInfo();
  1062. }
  1063. },
  1064. endIcon: _buildEndIcon(),
  1065. ),
  1066. VListFormCell(
  1067. label: "燃气类型",
  1068. content: data.fuel.isNotNullOrEmpty
  1069. ? PatientInfoRecord.fuelList
  1070. .firstWhere((element) => element.key == data.fuel)
  1071. .value
  1072. : '',
  1073. onTap: () async {
  1074. final result =
  1075. await VDialogSelect<MapEntry<String, String>, String>(
  1076. title: "燃气类型",
  1077. source: PatientInfoRecord.fuelList,
  1078. initialValue: data.fuel,
  1079. valueGetter: (data) => data.key,
  1080. labelGetter: (data) => data.value,
  1081. ).show();
  1082. if (result != null) {
  1083. data.fuel = result;
  1084. state.refreshHealthInfo();
  1085. }
  1086. },
  1087. endIcon: _buildEndIcon(),
  1088. ),
  1089. if (data.fuel?.contains("6") ?? false)
  1090. VListFormCell(
  1091. label: "燃气类型-其他",
  1092. content: data.fuelOther,
  1093. onTap: () async {
  1094. final result = await VDialogInput(
  1095. title: "燃气类型-其他",
  1096. initialValue: data.fuelOther,
  1097. placeholder: '请输入')
  1098. .show();
  1099. if (result != null) {
  1100. data.fuelOther = result;
  1101. state.refreshHealthInfo();
  1102. }
  1103. },
  1104. endIcon: _buildEndIcon(),
  1105. ),
  1106. VListFormCell(
  1107. label: "饮水",
  1108. content: data.drinkingWater.isNotNullOrEmpty
  1109. ? PatientInfoRecord.drinkingWaterList
  1110. .firstWhere((element) => element.key == data.drinkingWater)
  1111. .value
  1112. : '',
  1113. onTap: () async {
  1114. final result =
  1115. await VDialogSelect<MapEntry<String, String>, String>(
  1116. title: "饮水",
  1117. source: PatientInfoRecord.drinkingWaterList,
  1118. initialValue: data.drinkingWater,
  1119. valueGetter: (data) => data.key,
  1120. labelGetter: (data) => data.value,
  1121. ).show();
  1122. if (result != null) {
  1123. data.drinkingWater = result;
  1124. state.refreshHealthInfo();
  1125. }
  1126. },
  1127. endIcon: _buildEndIcon(),
  1128. ),
  1129. if (data.drinkingWater?.contains("6") ?? false)
  1130. VListFormCell(
  1131. label: "饮水-其他",
  1132. content: data.drinkingWaterOther,
  1133. onTap: () async {
  1134. final result = await VDialogInput(
  1135. title: "饮水-其他",
  1136. initialValue: data.drinkingWaterOther,
  1137. placeholder: '请输入')
  1138. .show();
  1139. if (result != null) {
  1140. data.drinkingWaterOther = result;
  1141. state.refreshHealthInfo();
  1142. }
  1143. },
  1144. endIcon: _buildEndIcon(),
  1145. ),
  1146. VListFormCell(
  1147. label: "厕所",
  1148. content: data.toilet.isNotNullOrEmpty
  1149. ? PatientInfoRecord.toiletList
  1150. .firstWhere((element) => element.key == data.toilet)
  1151. .value
  1152. : '',
  1153. onTap: () async {
  1154. final result =
  1155. await VDialogSelect<MapEntry<String, String>, String>(
  1156. title: "厕所",
  1157. source: PatientInfoRecord.toiletList,
  1158. initialValue: data.toilet,
  1159. valueGetter: (data) => data.key,
  1160. labelGetter: (data) => data.value,
  1161. ).show();
  1162. if (result != null) {
  1163. data.toilet = result;
  1164. state.refreshHealthInfo();
  1165. }
  1166. },
  1167. endIcon: _buildEndIcon(),
  1168. ),
  1169. VListFormCell(
  1170. label: "禽兽栏",
  1171. content: data.animalPen.isNotNullOrEmpty
  1172. ? PatientInfoRecord.animalPenList
  1173. .firstWhere((element) => element.key == data.animalPen)
  1174. .value
  1175. : '',
  1176. onTap: () async {
  1177. final result =
  1178. await VDialogSelect<MapEntry<String, String>, String>(
  1179. title: "禽兽栏",
  1180. source: PatientInfoRecord.animalPenList,
  1181. initialValue: data.animalPen,
  1182. valueGetter: (data) => data.key,
  1183. labelGetter: (data) => data.value,
  1184. ).show();
  1185. if (result != null) {
  1186. data.animalPen = result;
  1187. state.refreshHealthInfo();
  1188. }
  1189. },
  1190. endIcon: _buildEndIcon(),
  1191. ),
  1192. ],
  1193. );
  1194. });
  1195. }
  1196. Widget _buildEndIcon({bool isEdit = true}) {
  1197. return Container(
  1198. margin: EdgeInsets.only(left: isEdit ? 15 : 35),
  1199. child: isEdit ? Icon(Icons.edit_outlined) : SizedBox(),
  1200. );
  1201. }
  1202. }