|
@@ -1,7 +1,10 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:vitalapp/architecture/types/index.dart';
|
|
|
+import 'package:vitalapp/architecture/utils/prompt_box.dart';
|
|
|
+import 'package:vitalapp/components/alert_dialog.dart';
|
|
|
import 'package:vitalapp/components/button.dart';
|
|
|
+import 'package:vitalapp/managers/interfaces/prescription.dart';
|
|
|
import 'package:vitalapp/pages/check/models/form.dart';
|
|
|
import 'package:vitalapp/pages/check/prescription/examination_prescription.dart';
|
|
|
import 'package:vitalapp/pages/check/prescription/prescription_form_keys.dart';
|
|
@@ -20,6 +23,7 @@ class ExamCheckBoxGuidance extends StatelessWidget {
|
|
|
required this.physicalExamNumber,
|
|
|
required this.patientCode,
|
|
|
required this.createPrescription,
|
|
|
+ required this.removePrescription,
|
|
|
required this.prescriptionList,
|
|
|
this.disbaleOthers = false,
|
|
|
});
|
|
@@ -30,10 +34,12 @@ class ExamCheckBoxGuidance extends StatelessWidget {
|
|
|
final String? physicalExamNumber;
|
|
|
final String? patientCode;
|
|
|
final ValueCallback<Map> createPrescription;
|
|
|
+ final ValueCallback<Map> removePrescription;
|
|
|
final List prescriptionList;
|
|
|
|
|
|
/// 禁用其他选项(除已选)
|
|
|
final bool disbaleOthers;
|
|
|
+ final _prescriptionManager = Get.find<IPrescriptionManager>();
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
@@ -80,58 +86,118 @@ class ExamCheckBoxGuidance extends StatelessWidget {
|
|
|
),
|
|
|
),
|
|
|
if (prescriptionList.isNotEmpty)
|
|
|
- Wrap(
|
|
|
- children: [
|
|
|
- SizedBox(width: 30),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(bottom: 8, top: 8),
|
|
|
- child: Text(
|
|
|
- '处方列表',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 26,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
+ Container(
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ padding: EdgeInsets.only(left: 30),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 30),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(bottom: 8, top: 8),
|
|
|
+ child: Text(
|
|
|
+ '处方列表',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 26,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- SizedBox(width: 16),
|
|
|
- ...prescriptionList.map(
|
|
|
- (e) => InkWell(
|
|
|
- radius: 8,
|
|
|
- onTap: () async {
|
|
|
- var prescription = await Get.dialog(
|
|
|
- ExaminationPrescription(
|
|
|
- physicalExamNumber: physicalExamNumber,
|
|
|
- patientCode: patientCode,
|
|
|
- prescription: e['prescription'],
|
|
|
- prescriptionTitle:
|
|
|
- '${PrescriptionFormKeys.AllFormKeys[e['prescription']]}',
|
|
|
- isEdit: true,
|
|
|
- ),
|
|
|
- );
|
|
|
- if (prescription != null) {
|
|
|
- createPrescription.call(prescription);
|
|
|
- }
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border.all(
|
|
|
- color: Colors.black26,
|
|
|
- ),
|
|
|
- borderRadius: _borderRadius,
|
|
|
- ),
|
|
|
- margin: EdgeInsets.all(8),
|
|
|
- padding: const EdgeInsets.all(8),
|
|
|
- child: Text(
|
|
|
- '${PrescriptionFormKeys.AllFormKeys[e['prescription']]}',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 20,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
+ SizedBox(width: 16),
|
|
|
+ Wrap(
|
|
|
+ children: [
|
|
|
+ ...prescriptionList.map(
|
|
|
+ (e) => InkWell(
|
|
|
+ radius: 8,
|
|
|
+ onTap: () async {
|
|
|
+ var prescription = await Get.dialog(
|
|
|
+ ExaminationPrescription(
|
|
|
+ physicalExamNumber: physicalExamNumber,
|
|
|
+ patientCode: patientCode,
|
|
|
+ prescription: e['prescription'],
|
|
|
+ prescriptionTitle:
|
|
|
+ '${PrescriptionFormKeys.AllFormKeys[e['prescription']]}',
|
|
|
+ isEdit: true,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ if (prescription != null) {
|
|
|
+ createPrescription.call(prescription);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border.all(
|
|
|
+ color: Colors.black26,
|
|
|
+ ),
|
|
|
+ borderRadius: _borderRadius,
|
|
|
+ ),
|
|
|
+ margin: EdgeInsets.all(8),
|
|
|
+ padding:
|
|
|
+ const EdgeInsets.all(8).copyWith(left: 30),
|
|
|
+ child: Container(
|
|
|
+ width: 380,
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ '${PrescriptionFormKeys.AllFormKeys[e['prescription']]}',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 24,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ ),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ width: 40,
|
|
|
+ padding: EdgeInsets.only(right: 8),
|
|
|
+ child: IconButton(
|
|
|
+ onPressed: () {
|
|
|
+ Get.dialog(
|
|
|
+ VAlertDialog(
|
|
|
+ title: "提示",
|
|
|
+ onConfirm: () async {
|
|
|
+ bool? result =
|
|
|
+ await _prescriptionManager
|
|
|
+ .removePrescription(
|
|
|
+ prescriptionCode:
|
|
|
+ e['prescriptionCode'],
|
|
|
+ );
|
|
|
+ if (result ?? false) {
|
|
|
+ removePrescription.call(e);
|
|
|
+ } else {
|
|
|
+ PromptBox.toast("删除失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ content: Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ height: 60,
|
|
|
+ child: Text(
|
|
|
+ "确认是否删除当前 ${PrescriptionFormKeys.AllFormKeys[e['prescription']]}",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 24,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ icon: Icon(
|
|
|
+ Icons.close,
|
|
|
+ size: 36,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
],
|
|
|
),
|