|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'dart:ui';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
@ -40,6 +41,7 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
|
|
|
|
|
}
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isLoading: model.state == ViewState.BusyLocal,
|
|
|
|
|
appBar: PatientSearchHeader(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
@ -47,7 +49,7 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
showSearchIcon: true,
|
|
|
|
|
onSearchPressed: () {
|
|
|
|
|
SearchDialog(context);
|
|
|
|
|
SearchDialog(context, model);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
appBarTitle: TranslationBase
|
|
|
|
|
@ -100,6 +102,7 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
|
|
|
|
|
curve: Curves.easeInOut,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
@ -120,32 +123,54 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
|
|
|
|
|
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return DraggableScrollableSheet(
|
|
|
|
|
key: _sheet,
|
|
|
|
|
key: _sheet,
|
|
|
|
|
initialChildSize: 0.5,
|
|
|
|
|
minChildSize: 0.5,
|
|
|
|
|
maxChildSize: 1,
|
|
|
|
|
snapSizes: [
|
|
|
|
|
0.5 ,// constraints.maxHeight,
|
|
|
|
|
0.5, // constraints.maxHeight,
|
|
|
|
|
0.9,
|
|
|
|
|
],
|
|
|
|
|
expand: false,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
builder:(_, controller) =>
|
|
|
|
|
InterventionHistoryBottomSheet(
|
|
|
|
|
interventionList: interventionHistory,
|
|
|
|
|
controller: controller,
|
|
|
|
|
));
|
|
|
|
|
builder: (_, controller) =>
|
|
|
|
|
InterventionHistoryBottomSheet(
|
|
|
|
|
interventionList: interventionHistory,
|
|
|
|
|
controller: controller,
|
|
|
|
|
));
|
|
|
|
|
},
|
|
|
|
|
).then((value) => model.toggleShowBottomSheetValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SearchDialog(BuildContext context) {
|
|
|
|
|
void SearchDialog(BuildContext context, PharmacyInterventionViewModel model) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierDismissible: true, // user must tap button!
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return PharmacyInterventionDialog(
|
|
|
|
|
onDispose: (dateFrom, dateTo, admissionNumber, patientId) {});
|
|
|
|
|
dateFrom: model.fromDate,
|
|
|
|
|
dateTo: model.toDate,
|
|
|
|
|
admissionNumber: model.admissionId,
|
|
|
|
|
nursingStation: model.nursingStationId,
|
|
|
|
|
patientID: model.patientID,
|
|
|
|
|
onDispose: (dateFrom, dateTo, admissionNumber, patientId,
|
|
|
|
|
nursingStation) {
|
|
|
|
|
if (dateFrom == model.fromDate && dateTo == model.toDate &&
|
|
|
|
|
admissionNumber == model.admissionId && patientId == model.patientID &&
|
|
|
|
|
nursingStation == model.nursingStationId) {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.getPharmacyIntervention(
|
|
|
|
|
admissionId: admissionNumber,
|
|
|
|
|
patientID: patientId,
|
|
|
|
|
nursingStationId: nursingStation,
|
|
|
|
|
toDate: dateTo,
|
|
|
|
|
fromDate: dateFrom
|
|
|
|
|
);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -173,7 +198,7 @@ class InterventionCardItem extends StatelessWidget {
|
|
|
|
|
medication: medication,
|
|
|
|
|
model: model,
|
|
|
|
|
),
|
|
|
|
|
InterventionCardFooter(model: model)
|
|
|
|
|
InterventionCardFooter(model: model, medication: medication,)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -184,8 +209,8 @@ class InterventionCardItem extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
class InterventionCardFooter extends StatelessWidget {
|
|
|
|
|
final PharmacyInterventionViewModel model;
|
|
|
|
|
|
|
|
|
|
const InterventionCardFooter({super.key, required this.model});
|
|
|
|
|
final Medication medication;
|
|
|
|
|
const InterventionCardFooter({super.key, required this.model, required this.medication});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -200,7 +225,14 @@ class InterventionCardFooter extends StatelessWidget {
|
|
|
|
|
borderColor: Colors.grey,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
onPressed: () async {},
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
model.getInterventionHistory(
|
|
|
|
|
admissionNumber: medication.admissionNo?.toString() ?? '',
|
|
|
|
|
prescriptionNumber: medication.prescriptionNo?.toString() ?? '',
|
|
|
|
|
orderNumber: medication.orderNo?.toString() ?? '',
|
|
|
|
|
itemID: medication.itemID?.toString() ?? '',
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
@ -217,7 +249,18 @@ class InterventionCardFooter extends StatelessWidget {
|
|
|
|
|
borderColor: Color(0xFFB8382B),
|
|
|
|
|
color: AppGlobal.appRedColor,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
onPressed: () async {},
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
model.updateInterventionDiseaseStatus(
|
|
|
|
|
admissionNo: medication.admissionNo?.toString() ?? '',
|
|
|
|
|
prescriptionNo: medication.prescriptionNo?.toString() ?? '',
|
|
|
|
|
orderNo: medication.orderNo?.toString() ?? '',
|
|
|
|
|
itemID: medication.itemID?.toString() ?? '',
|
|
|
|
|
interventionID: medication.?.toString() ?? '',
|
|
|
|
|
prescriptionNo: medication.prescriptionNo?.toString() ?? '',
|
|
|
|
|
orderNo: medication.orderNo?.toString() ?? '',
|
|
|
|
|
itemID: medication.itemID?.toString() ?? '',
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -1008,13 +1051,20 @@ class _TableExampleState extends State<TableExample> {
|
|
|
|
|
|
|
|
|
|
class PharmacyInterventionDialog extends StatefulWidget {
|
|
|
|
|
final Function(
|
|
|
|
|
String,
|
|
|
|
|
String,
|
|
|
|
|
String,
|
|
|
|
|
String,
|
|
|
|
|
String, // dataFrom
|
|
|
|
|
String, // dateTo
|
|
|
|
|
String, // admissionNumber
|
|
|
|
|
String, // patient ID
|
|
|
|
|
String, // nursingStation
|
|
|
|
|
) onDispose;
|
|
|
|
|
|
|
|
|
|
const PharmacyInterventionDialog({super.key, required this.onDispose});
|
|
|
|
|
final String dateFrom;
|
|
|
|
|
final String dateTo;
|
|
|
|
|
final String admissionNumber;
|
|
|
|
|
final String patientID;
|
|
|
|
|
final String nursingStation;
|
|
|
|
|
|
|
|
|
|
const PharmacyInterventionDialog({super.key, required this.onDispose, required this.dateFrom, required this.dateTo, required this.admissionNumber, required this.patientID, required this.nursingStation});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<PharmacyInterventionDialog> createState() =>
|
|
|
|
|
@ -1034,8 +1084,16 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
initData();
|
|
|
|
|
super.initState();
|
|
|
|
|
// initFromDate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initData() {
|
|
|
|
|
admissionNumber.text = widget.admissionNumber;
|
|
|
|
|
nursingStation.text = widget.nursingStation;
|
|
|
|
|
patientId.text = widget.patientID;
|
|
|
|
|
dateTo = getDate(widget.dateTo);
|
|
|
|
|
dateFrom = getDate(widget.dateFrom);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -1101,7 +1159,15 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
borderColor: Color(0xFFB8382B),
|
|
|
|
|
color: AppGlobal.appRedColor,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
onPressed: () async {},
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
//(dateFrom, dateTo, admissionNumber, patientId, nursingStation)
|
|
|
|
|
widget.onDispose(
|
|
|
|
|
dateFrom,
|
|
|
|
|
dateTo,
|
|
|
|
|
nursingStation.text,
|
|
|
|
|
patientId.text,
|
|
|
|
|
nursingStation.text);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
@ -1191,6 +1257,13 @@ class _PharmacyInterventionDialogState
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getFormattedDate(DateTime time) {
|
|
|
|
|
return DateFormat('MM/dd/yyyy').format(time);
|
|
|
|
|
return DateFormat('yyyy-MM-dd').format(time);
|
|
|
|
|
}
|
|
|
|
|
String getDate(String dateTime) {
|
|
|
|
|
if (dateTime.isEmpty) return '';
|
|
|
|
|
List<String> splitedDate = dateTime.split('-');
|
|
|
|
|
DateTime now = DateTime(int.parse(splitedDate[0]), int.parse(splitedDate[1]), int.parse(splitedDate[2]));
|
|
|
|
|
return DateFormat('yyyy-MM-dd').format(now);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|