exam_radio.dart 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. import 'package:flutter/material.dart';
  2. import 'package:vitalapp/pages/check/models/form.dart';
  3. import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_radio_and_select.dart';
  4. import 'package:vitalapp/pages/check/widgets/exam_title.dart';
  5. class ExamRadio extends StatelessWidget {
  6. const ExamRadio({
  7. super.key,
  8. required this.currentFormObject,
  9. required this.options,
  10. required this.selectRaidoChange,
  11. required this.currentSelected,
  12. });
  13. final FormObject currentFormObject;
  14. final List<Option> options;
  15. final Function selectRaidoChange;
  16. final String currentSelected;
  17. @override
  18. Widget build(BuildContext context) {
  19. if (currentFormObject.showLimit ?? true) {
  20. return ExamCardRadioSelect(
  21. titleText: ExamTitle(
  22. label: currentFormObject.label,
  23. titleType: '(单选)',
  24. ),
  25. title: currentFormObject.label ?? '',
  26. content: Container(
  27. padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 16)
  28. .copyWith(top: 0),
  29. alignment: currentFormObject.span == 24
  30. ? Alignment.centerLeft
  31. : Alignment.center,
  32. width: double.infinity,
  33. child: Wrap(
  34. children: options
  35. .map(
  36. (e) => Container(
  37. padding: const EdgeInsets.all(7),
  38. child: InkWell(
  39. onTap: () => selectRaidoChange(e),
  40. borderRadius: BorderRadius.circular(50),
  41. child: Ink(
  42. decoration: BoxDecoration(
  43. border: Border.all(
  44. color: currentSelected == e.value
  45. ? Colors.blue
  46. : Colors.black26,
  47. ),
  48. borderRadius: const BorderRadius.all(
  49. Radius.circular(50),
  50. ),
  51. color: currentSelected == e.value
  52. ? Colors.blue
  53. : Colors.transparent,
  54. ),
  55. child: Container(
  56. padding: const EdgeInsets.all(15),
  57. alignment: Alignment.center,
  58. width: 250,
  59. child: FittedBox(
  60. child: Text(
  61. e.label ?? '',
  62. style: TextStyle(
  63. fontSize: 20,
  64. color: currentSelected == e.value
  65. ? Colors.white
  66. : Colors.black54,
  67. ),
  68. ),
  69. ),
  70. ),
  71. ),
  72. ),
  73. ),
  74. )
  75. .toList(),
  76. ),
  77. ),
  78. );
  79. } else {
  80. return Container();
  81. }
  82. }
  83. }
  84. class ExamRadioHospitalization extends StatelessWidget {
  85. const ExamRadioHospitalization({
  86. super.key,
  87. required this.currentFormObject,
  88. required this.options,
  89. required this.selectRaidoChange,
  90. required this.currentSelected,
  91. this.commonInput,
  92. required this.dateOfDischarge,
  93. });
  94. final FormObject currentFormObject;
  95. final List<Option> options;
  96. final Function selectRaidoChange;
  97. final String currentSelected;
  98. final Function? commonInput;
  99. final String dateOfDischarge;
  100. @override
  101. Widget build(BuildContext context) {
  102. if (currentFormObject.showLimit ?? true) {
  103. return ExamCardRadioSelect(
  104. titleText: ExamTitle(
  105. label: currentFormObject.label,
  106. titleType: '(单选)',
  107. ),
  108. title: currentFormObject.label ?? '',
  109. content: Container(
  110. padding: const EdgeInsets.symmetric(horizontal: 6),
  111. alignment: currentFormObject.span == 24
  112. ? Alignment.centerLeft
  113. : Alignment.center,
  114. width: double.infinity,
  115. child: Column(
  116. children: [
  117. Wrap(
  118. children: options
  119. .map(
  120. (e) => Container(
  121. padding: const EdgeInsets.all(7),
  122. child: InkWell(
  123. onTap: () => selectRaidoChange(e),
  124. borderRadius: BorderRadius.circular(50),
  125. child: Ink(
  126. decoration: BoxDecoration(
  127. border: Border.all(
  128. color: currentSelected == e.value
  129. ? Colors.blue
  130. : Colors.black26,
  131. ),
  132. borderRadius: const BorderRadius.all(
  133. Radius.circular(50),
  134. ),
  135. color: currentSelected == e.value
  136. ? Colors.blue
  137. : Colors.transparent,
  138. ),
  139. child: Container(
  140. padding: const EdgeInsets.all(15),
  141. alignment: Alignment.center,
  142. width: 250,
  143. child: FittedBox(
  144. child: Text(
  145. e.label ?? '',
  146. style: TextStyle(
  147. fontSize: 20,
  148. color: currentSelected == e.value
  149. ? Colors.white
  150. : Colors.black54,
  151. ),
  152. ),
  153. ),
  154. ),
  155. ),
  156. ),
  157. ),
  158. )
  159. .toList(),
  160. ),
  161. if (currentSelected == "2")
  162. Container(
  163. padding: EdgeInsets.only(
  164. top: 20,
  165. left: 30,
  166. bottom: 15,
  167. ),
  168. child: Row(
  169. mainAxisAlignment: MainAxisAlignment.center,
  170. crossAxisAlignment: CrossAxisAlignment.center,
  171. children: [
  172. Text(
  173. "末次出院时间",
  174. style: const TextStyle(fontSize: 26),
  175. ),
  176. Expanded(
  177. child: TextField(
  178. readOnly: true,
  179. textAlign: TextAlign.center,
  180. controller: TextEditingController(
  181. text: dateOfDischarge,
  182. ),
  183. style: const TextStyle(fontSize: 24),
  184. onTap: commonInput != null
  185. ? () => commonInput!.call()
  186. : null,
  187. ),
  188. ),
  189. ],
  190. )),
  191. ],
  192. ),
  193. ),
  194. );
  195. } else {
  196. return Container();
  197. }
  198. }
  199. }
  200. class ExamRadioReferral extends StatelessWidget {
  201. const ExamRadioReferral({
  202. super.key,
  203. required this.currentFormObject,
  204. required this.options,
  205. required this.selectRaidoChange,
  206. required this.currentSelected,
  207. this.commonInput,
  208. required this.reasonReferral,
  209. required this.organizationSection,
  210. });
  211. final FormObject currentFormObject;
  212. final List<Option> options;
  213. final Function selectRaidoChange;
  214. final String currentSelected;
  215. final Function? commonInput;
  216. final String reasonReferral;
  217. final String organizationSection;
  218. @override
  219. Widget build(BuildContext context) {
  220. if (currentFormObject.showLimit ?? true) {
  221. return ExamCardRadioSelect(
  222. titleText: ExamTitle(
  223. label: currentFormObject.label,
  224. titleType: '(单选)',
  225. ),
  226. title: currentFormObject.label ?? '',
  227. content: Container(
  228. padding: const EdgeInsets.symmetric(
  229. horizontal: 5,
  230. ),
  231. alignment: currentFormObject.span == 24
  232. ? Alignment.centerLeft
  233. : Alignment.center,
  234. width: double.infinity,
  235. child: Column(
  236. children: [
  237. Wrap(
  238. children: options
  239. .map(
  240. (e) => Container(
  241. padding: const EdgeInsets.all(7),
  242. child: InkWell(
  243. onTap: () => selectRaidoChange(e),
  244. borderRadius: BorderRadius.circular(50),
  245. child: Ink(
  246. decoration: BoxDecoration(
  247. border: Border.all(
  248. color: currentSelected == e.value
  249. ? Colors.blue
  250. : Colors.black26,
  251. ),
  252. borderRadius: const BorderRadius.all(
  253. Radius.circular(50),
  254. ),
  255. color: currentSelected == e.value
  256. ? Colors.blue
  257. : Colors.transparent,
  258. ),
  259. child: Container(
  260. padding: const EdgeInsets.all(15),
  261. alignment: Alignment.center,
  262. width: 250,
  263. child: FittedBox(
  264. child: Text(
  265. e.label ?? '',
  266. style: TextStyle(
  267. fontSize: 20,
  268. color: currentSelected == e.value
  269. ? Colors.white
  270. : Colors.black54,
  271. ),
  272. ),
  273. ),
  274. ),
  275. ),
  276. ),
  277. ),
  278. )
  279. .toList(),
  280. ),
  281. if (currentSelected == "2")
  282. Column(
  283. children: [
  284. Container(
  285. padding: EdgeInsets.only(
  286. top: 20,
  287. left: 30,
  288. bottom: 15,
  289. ),
  290. child: Row(
  291. mainAxisAlignment: MainAxisAlignment.center,
  292. crossAxisAlignment: CrossAxisAlignment.center,
  293. children: [
  294. Text(
  295. "转诊原因:",
  296. style: const TextStyle(fontSize: 26),
  297. ),
  298. Expanded(
  299. child: TextField(
  300. readOnly: true,
  301. textAlign: TextAlign.center,
  302. controller: TextEditingController(
  303. text: reasonReferral,
  304. ),
  305. style: const TextStyle(fontSize: 24),
  306. onTap: commonInput != null
  307. ? () => commonInput!.call(true)
  308. : null,
  309. ),
  310. ),
  311. ],
  312. ),
  313. ),
  314. Container(
  315. padding: EdgeInsets.only(
  316. top: 20,
  317. left: 30,
  318. bottom: 15,
  319. ),
  320. child: Row(
  321. mainAxisAlignment: MainAxisAlignment.center,
  322. crossAxisAlignment: CrossAxisAlignment.center,
  323. children: [
  324. Text(
  325. "转诊机构及科室:",
  326. style: const TextStyle(fontSize: 26),
  327. ),
  328. Expanded(
  329. child: TextField(
  330. readOnly: true,
  331. textAlign: TextAlign.center,
  332. controller: TextEditingController(
  333. text: organizationSection,
  334. ),
  335. style: const TextStyle(fontSize: 24),
  336. onTap: commonInput != null
  337. ? () => commonInput!.call(false)
  338. : null,
  339. ),
  340. ),
  341. ],
  342. )),
  343. ],
  344. ),
  345. ],
  346. ),
  347. ),
  348. );
  349. } else {
  350. return Container();
  351. }
  352. }
  353. }
  354. ///知情同意
  355. class ExamRadioInformedConsent extends StatelessWidget {
  356. const ExamRadioInformedConsent({
  357. super.key,
  358. required this.currentFormObject,
  359. required this.options,
  360. required this.selectRaidoChange,
  361. required this.currentSelected,
  362. this.commonInput,
  363. this.commonInputDate,
  364. required this.sign,
  365. required this.signingTime,
  366. });
  367. final FormObject currentFormObject;
  368. final List<Option> options;
  369. final Function selectRaidoChange;
  370. final String currentSelected;
  371. final String sign;
  372. final String signingTime;
  373. final Function? commonInput;
  374. final Function? commonInputDate;
  375. @override
  376. Widget build(BuildContext context) {
  377. if (currentFormObject.showLimit ?? true) {
  378. return ExamCardRadioSelect(
  379. titleText: ExamTitle(
  380. label: currentFormObject.label,
  381. titleType: '(单选)',
  382. ),
  383. title: currentFormObject.label ?? '',
  384. content: Container(
  385. padding: const EdgeInsets.symmetric(
  386. horizontal: 5,
  387. ),
  388. alignment: currentFormObject.span == 24
  389. ? Alignment.centerLeft
  390. : Alignment.center,
  391. width: double.infinity,
  392. child: Column(
  393. children: [
  394. Wrap(
  395. children: options
  396. .map(
  397. (e) => Container(
  398. padding: const EdgeInsets.all(7),
  399. child: InkWell(
  400. onTap: () => selectRaidoChange(e),
  401. borderRadius: BorderRadius.circular(50),
  402. child: Ink(
  403. decoration: BoxDecoration(
  404. border: Border.all(
  405. color: currentSelected == e.value
  406. ? Colors.blue
  407. : Colors.black26,
  408. ),
  409. borderRadius: const BorderRadius.all(
  410. Radius.circular(50),
  411. ),
  412. color: currentSelected == e.value
  413. ? Colors.blue
  414. : Colors.transparent,
  415. ),
  416. child: Container(
  417. padding: const EdgeInsets.all(15),
  418. alignment: Alignment.center,
  419. width: 250,
  420. child: FittedBox(
  421. child: Text(
  422. e.label ?? '',
  423. style: TextStyle(
  424. fontSize: 20,
  425. color: currentSelected == e.value
  426. ? Colors.white
  427. : Colors.black54,
  428. ),
  429. ),
  430. ),
  431. ),
  432. ),
  433. ),
  434. ),
  435. )
  436. .toList(),
  437. ),
  438. if (currentSelected == "1")
  439. Column(
  440. children: [
  441. Container(
  442. padding: EdgeInsets.only(
  443. top: 20,
  444. left: 30,
  445. bottom: 15,
  446. ),
  447. child: Row(
  448. mainAxisAlignment: MainAxisAlignment.center,
  449. crossAxisAlignment: CrossAxisAlignment.center,
  450. children: [
  451. Text(
  452. "签字:",
  453. style: const TextStyle(fontSize: 26),
  454. ),
  455. Expanded(
  456. child: TextField(
  457. readOnly: true,
  458. textAlign: TextAlign.center,
  459. controller: TextEditingController(
  460. text: sign,
  461. ),
  462. style: const TextStyle(fontSize: 24),
  463. onTap: () {
  464. if (commonInput != null) {
  465. commonInput!.call();
  466. }
  467. },
  468. ),
  469. ),
  470. ],
  471. ),
  472. ),
  473. Container(
  474. padding: EdgeInsets.only(
  475. top: 20,
  476. left: 30,
  477. bottom: 15,
  478. ),
  479. child: Row(
  480. mainAxisAlignment: MainAxisAlignment.center,
  481. crossAxisAlignment: CrossAxisAlignment.center,
  482. children: [
  483. Text(
  484. "签字时间:",
  485. style: const TextStyle(fontSize: 26),
  486. ),
  487. Expanded(
  488. child: TextField(
  489. readOnly: true,
  490. textAlign: TextAlign.center,
  491. controller: TextEditingController(
  492. text: signingTime,
  493. ),
  494. style: const TextStyle(fontSize: 24),
  495. onTap: commonInputDate != null
  496. ? () => commonInputDate!.call()
  497. : null,
  498. ),
  499. ),
  500. ],
  501. )),
  502. ],
  503. ),
  504. ],
  505. ),
  506. ),
  507. );
  508. } else {
  509. return Container();
  510. }
  511. }
  512. }