bottom-sheet updated.
commit
0a544ab725
@ -0,0 +1,57 @@
|
||||
class InterventionHistoryList{
|
||||
List<InterventionHistory>? history = [];
|
||||
InterventionHistoryList.fromJson(Map<String, dynamic> json){
|
||||
var entryList = json['entityList'] ?? {};
|
||||
List<InterventionHistory> tempList = [];
|
||||
for(var item in entryList){
|
||||
var medication = InterventionHistory.fromJson(item);
|
||||
tempList.add(medication);
|
||||
}
|
||||
history?.addAll(tempList);
|
||||
}
|
||||
}
|
||||
|
||||
class InterventionHistory {
|
||||
String? authizationFormText;
|
||||
int? authorizedAction;
|
||||
int? commentedBy;
|
||||
String? commentedByName;
|
||||
String? interventionDesc;
|
||||
int? interventionId;
|
||||
String? remark;
|
||||
|
||||
InterventionHistory({
|
||||
this.authizationFormText,
|
||||
this.authorizedAction,
|
||||
this.commentedBy,
|
||||
this.commentedByName,
|
||||
this.interventionDesc,
|
||||
this.interventionId,
|
||||
this.remark,
|
||||
});
|
||||
|
||||
factory InterventionHistory.fromJson(Map<String, dynamic> json) {
|
||||
print('the remark is ${json['remark']}');
|
||||
return InterventionHistory(
|
||||
authizationFormText: json['authizationFormText'] ?? '',
|
||||
authorizedAction: json['authorizedAction'] ?? '',
|
||||
commentedBy: json['commentedBy'] ?? '',
|
||||
commentedByName: json['commentedByName'] ?? '',
|
||||
interventionDesc: json['interventionDesc'] ?? '',
|
||||
interventionId: json['interventionId'] ?? '',
|
||||
remark: json['remark'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'authizationFormText': authizationFormText,
|
||||
'authorizedAction': authorizedAction,
|
||||
'commentedBy': commentedBy,
|
||||
'commentedByName': commentedByName,
|
||||
'interventionDesc': interventionDesc,
|
||||
'interventionId': interventionId,
|
||||
'remark': remark,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
class NursingStation {
|
||||
final List<NursingStationEntity>? entityList;
|
||||
final int? rowcount;
|
||||
final String? statusMessage;
|
||||
final bool? success;
|
||||
|
||||
NursingStation({
|
||||
this.entityList,
|
||||
this.rowcount,
|
||||
this.statusMessage,
|
||||
this.success,
|
||||
});
|
||||
|
||||
factory NursingStation.fromJson(Map<String, dynamic> json) {
|
||||
return NursingStation(
|
||||
entityList: (json['entityList'] as List<dynamic>?)
|
||||
?.map((e) => NursingStationEntity.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
rowcount: json['rowcount'] as int?,
|
||||
statusMessage: json['statusMessage'] as String?,
|
||||
success: json['success'] as bool?,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'entityList': entityList?.map((e) => e.toJson()).toList(),
|
||||
'rowcount': rowcount,
|
||||
'statusMessage': statusMessage,
|
||||
'success': success,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class NursingStationEntity {
|
||||
final int? categoryID;
|
||||
final String? description;
|
||||
final String? descriptionN;
|
||||
final int? floorID;
|
||||
final bool? isActive;
|
||||
final int? nursingStationID;
|
||||
|
||||
NursingStationEntity({
|
||||
this.categoryID,
|
||||
this.description,
|
||||
this.descriptionN,
|
||||
this.floorID,
|
||||
this.isActive,
|
||||
this.nursingStationID,
|
||||
});
|
||||
|
||||
factory NursingStationEntity.fromJson(Map<String, dynamic> json) {
|
||||
return NursingStationEntity(
|
||||
categoryID: json['categoryID'] as int?,
|
||||
description: json['description'] ??'${json['nursingStationID']}',
|
||||
descriptionN: json['descriptionN'] as String?,
|
||||
floorID: json['floorID'] as int?,
|
||||
isActive: json['isActive'] as bool?,
|
||||
nursingStationID: json['nursingStationID'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'categoryID': categoryID,
|
||||
'description': description,
|
||||
'descriptionN': descriptionN,
|
||||
'floorID': floorID,
|
||||
'isActive': isActive,
|
||||
'nursingStationID': nursingStationID,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
class MedicationList{
|
||||
List<Medication>? medication = [];
|
||||
MedicationList.fromJson(Map<String, dynamic> json){
|
||||
var entryList = json['entityList'] ?? {};
|
||||
List<Medication> tempList = [];
|
||||
for(var item in entryList){
|
||||
var medication = Medication.fromJson(item);
|
||||
tempList.add(medication);
|
||||
}
|
||||
medication?.addAll(tempList);
|
||||
}
|
||||
}
|
||||
|
||||
class Medication {
|
||||
int? accessLevel;
|
||||
int? admissionNo;
|
||||
String? createdBy;
|
||||
String? doctorComments;
|
||||
String? doctorName;
|
||||
String? dosageDetail;
|
||||
int? itemID;
|
||||
int? lineItemNo;
|
||||
String? medication;
|
||||
String? nursingStation;
|
||||
int? orderNo;
|
||||
int? patientID;
|
||||
String? patientName;
|
||||
String? pharmacyRemarks;
|
||||
int? prescriptionNo;
|
||||
DateTime? startDatetime;
|
||||
int? status;
|
||||
String? statusName;
|
||||
String? accessLevelDescription;
|
||||
DateTime? stopDatetime;
|
||||
|
||||
Medication({
|
||||
this.accessLevel,
|
||||
this.admissionNo,
|
||||
this.createdBy,
|
||||
this.doctorComments,
|
||||
this.doctorName,
|
||||
this.dosageDetail,
|
||||
this.itemID,
|
||||
this.lineItemNo,
|
||||
this.medication,
|
||||
this.nursingStation,
|
||||
this.orderNo,
|
||||
this.patientID,
|
||||
this.patientName,
|
||||
this.pharmacyRemarks,
|
||||
this.prescriptionNo,
|
||||
this.startDatetime,
|
||||
this.status,
|
||||
this.statusName,
|
||||
this.stopDatetime,
|
||||
this.accessLevelDescription,
|
||||
});
|
||||
|
||||
factory Medication.fromJson(Map<String, dynamic> json) {
|
||||
return Medication(
|
||||
admissionNo: json['admissionNo']?? '',
|
||||
createdBy: json['createdBy']?? '',
|
||||
doctorComments: json['doctorComments']?? '',
|
||||
doctorName: json['doctorName']?? '',
|
||||
dosageDetail: json['dosageDetail']?? '',
|
||||
itemID: json['itemID']?? '',
|
||||
lineItemNo: json['lineItemNo']?? '',
|
||||
medication: json['medication']?? '',
|
||||
nursingStation: json['nursingStation']?? '',
|
||||
orderNo: json['orderNo']?? '',
|
||||
patientID: json['patientID']?? '',
|
||||
patientName: json['patientName']?? '',
|
||||
pharmacyRemarks: json['pharmacyRemarks']?? '-',
|
||||
prescriptionNo: json['prescriptionNo']?? '',
|
||||
startDatetime: json['startDatetime'] != null ? DateTime.parse(json['startDatetime']) : null,
|
||||
status: json['status']?? '',
|
||||
statusName: json['statusName']?? '',
|
||||
accessLevelDescription: json['accessLevelDescription']?? '',
|
||||
stopDatetime: json['stopDatetime'] != null ? DateTime.parse(json['stopDatetime']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'accessLevel': accessLevel,
|
||||
'admissionNo': admissionNo,
|
||||
'createdBy': createdBy,
|
||||
'doctorComments': doctorComments,
|
||||
'doctorName': doctorName,
|
||||
'dosageDetail': dosageDetail,
|
||||
'itemID': itemID,
|
||||
'lineItemNo': lineItemNo,
|
||||
'medication': medication,
|
||||
'nursingStation': nursingStation,
|
||||
'orderNo': orderNo,
|
||||
'patientID': patientID,
|
||||
'patientName': patientName,
|
||||
'pharmacyRemarks': pharmacyRemarks,
|
||||
'prescriptionNo': prescriptionNo,
|
||||
'startDatetime': startDatetime?.toIso8601String(),
|
||||
'status': status,
|
||||
'statusName': statusName,
|
||||
'stopDatetime': stopDatetime?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,188 @@
|
||||
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/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/InterventionCardItem.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/InterventionHistoryBottomSheet.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/NoInveterventionFound.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/PharmacyInterventionDialog.dart';
|
||||
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
||||
import 'viewmodel/pharmacy_intervention_view_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PharmacyIntervention extends StatefulWidget {
|
||||
@override
|
||||
State<PharmacyIntervention> createState() => _PharmacyInterventionState();
|
||||
}
|
||||
|
||||
class _PharmacyInterventionState extends State<PharmacyIntervention> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PharmacyInterventionViewModel>(onModelReady: (model) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Future.wait([
|
||||
model.getNursingStations(),
|
||||
model.getPharmacyIntervention(),
|
||||
]);
|
||||
});
|
||||
}, builder: (_, model, __) {
|
||||
if (model.interventionHistoryList != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showBottomSheet(
|
||||
context,
|
||||
model,
|
||||
model.interventionHistoryList!.history!,
|
||||
);
|
||||
});
|
||||
}
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
isLoading: model.state == ViewState.BusyLocal,
|
||||
appBar: PatientSearchHeader(
|
||||
title: TranslationBase.of(context).pharmacyApproval,
|
||||
fontSize: 18,
|
||||
showSearchIcon: true,
|
||||
onSearchPressed: () {
|
||||
SearchDialog(context, model);
|
||||
},
|
||||
),
|
||||
appBarTitle: TranslationBase.of(context).pharmacyApproval,
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
if (model.medicationList == null || model.medicationList?.medication?.isEmpty == true) ...{
|
||||
Expanded(
|
||||
child:
|
||||
NoInterventionFound()
|
||||
,
|
||||
)
|
||||
} else ...{
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: model.medicationList?.medication?.length ?? 0,
|
||||
itemBuilder: (context, index) => InterventionCardItem(
|
||||
medication:
|
||||
model.medicationList!.medication![index],
|
||||
model: model,
|
||||
)))
|
||||
}
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
final _sheet = GlobalKey();
|
||||
|
||||
final _controller = DraggableScrollableController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller.addListener(_onChanged);
|
||||
}
|
||||
|
||||
void _onChanged() {
|
||||
final currentSize = _controller.size;
|
||||
if (currentSize <= 0.05) _collapse();
|
||||
}
|
||||
|
||||
void _collapse() => _animateSheet(sheet.snapSizes!.first);
|
||||
|
||||
void _animateSheet(double size) {
|
||||
_controller.animateTo(
|
||||
size,
|
||||
duration: const Duration(milliseconds: 50),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
DraggableScrollableSheet get sheet =>
|
||||
(_sheet.currentWidget as DraggableScrollableSheet);
|
||||
|
||||
void showBottomSheet(
|
||||
BuildContext context,
|
||||
PharmacyInterventionViewModel model,
|
||||
List<InterventionHistory> interventionHistory,
|
||||
) {
|
||||
showModalBottomSheet(
|
||||
isDismissible: true,
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
builder: (_) {
|
||||
return DraggableScrollableSheet(
|
||||
key: _sheet,
|
||||
initialChildSize: 0.7,
|
||||
minChildSize: 0.7,
|
||||
maxChildSize: 1,
|
||||
snapSizes: [
|
||||
0.7, // constraints.maxHeight,
|
||||
1,
|
||||
],
|
||||
expand: false,
|
||||
controller: _controller,
|
||||
builder: (_, controller) => InterventionHistoryBottomSheet(
|
||||
interventionList: interventionHistory,
|
||||
model: model,
|
||||
controller: controller,
|
||||
));
|
||||
},
|
||||
).then((value) => model.toggleShowBottomSheetValue());
|
||||
}
|
||||
|
||||
void SearchDialog(BuildContext context, PharmacyInterventionViewModel model) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
builder: (_) {
|
||||
return PharmacyInterventionDialog(
|
||||
dateFrom: model.fromDate,
|
||||
dateTo: model.toDate,
|
||||
admissionNumber: model.admissionId,
|
||||
nursingStation: model.entity,
|
||||
patientID: model.patientID,
|
||||
station: model.nursingStations,
|
||||
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;
|
||||
}
|
||||
if (dateFrom.isEmpty && dateTo.isNotEmpty) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
TranslationBase.of(context).dateFromCanNotBeEmpty);
|
||||
return;
|
||||
}
|
||||
if (dateFrom.isNotEmpty && dateTo.isEmpty) {
|
||||
DrAppToastMsg.showErrorToast(
|
||||
TranslationBase.of(context).dateToCanNotBeEmpty);
|
||||
return;
|
||||
}
|
||||
model.getPharmacyIntervention(
|
||||
admissionId: admissionNumber,
|
||||
patientID: patientId,
|
||||
nursingStationId:
|
||||
"${nursingStation?.nursingStationID ?? '0'}",
|
||||
toDate: dateTo,
|
||||
fromDate: dateFrom,
|
||||
entity: nursingStation);
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,166 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class PharmacyInterventionService extends BaseService {
|
||||
Future<MedicationList?> getMedicationList(
|
||||
{String nursingStationId = '0',
|
||||
String admissionId = '0',
|
||||
String patientID = '0',
|
||||
String fromDate = '',
|
||||
String toDate = ''}) async {
|
||||
Map<String,dynamic> request = {
|
||||
"NursingStationID": nursingStationId.isEmpty?'0':nursingStationId,
|
||||
"AdmissionNo": admissionId.isEmpty ?'0': admissionId,
|
||||
"PatientID": num.parse((patientID.isEmpty)?'0':patientID),
|
||||
};
|
||||
|
||||
print("the date is ${convertToISO8601(fromDate).toString()}");
|
||||
print("the to Date is ${convertToISO8601(fromDate).toString()}");
|
||||
if(fromDate.isNotEmpty){
|
||||
var temp = {
|
||||
"InterventionFromDate": convertToISO8601(fromDate).toString(),
|
||||
"InterventionToDate": convertToISO8601(toDate).toString(),
|
||||
};
|
||||
request.addAll(temp);
|
||||
}
|
||||
|
||||
hasError = false;
|
||||
MedicationList? result;
|
||||
await baseAppClient.post(GET_MEDICINE_WITH_INTERVAL,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
result = MedicationList.fromJson(response['List_MedicineWithIntervention']);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
DrAppToastMsg.showErrorToast(error);
|
||||
super.error = super.error??'' + "\n" + error;
|
||||
|
||||
}, body: request);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
String convertToISO8601(String dateString) {
|
||||
try {
|
||||
DateFormat inputFormat = DateFormat('yyyy-MM-dd'); // Adjust format if needed
|
||||
DateTime parsedDate = inputFormat.parse(dateString);
|
||||
String iso8601String = parsedDate.toIso8601String().toString();
|
||||
print('the data is $iso8601String');
|
||||
return iso8601String; // Remove milliseconds
|
||||
} catch (e) {
|
||||
return "Invalid date format: $e";
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// it will be called only for the doctor that are associated to vida plus
|
||||
/// project
|
||||
///
|
||||
Future<bool> getInfectiousDiseaseConsultantStatus() async {
|
||||
String vidaToken = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
|
||||
|
||||
if(vidaToken.isEmpty){
|
||||
return false;
|
||||
}
|
||||
hasError = false;
|
||||
var success = false;
|
||||
await baseAppClient.post(IS_INFECTIOUS_DISEASE_CONSULTANT,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
success = response['IsInfectiousDiseases'];
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
DrAppToastMsg.showErrorToast(error);
|
||||
super.error = super.error ?? "" + "\n" + error;
|
||||
|
||||
}, body: {});
|
||||
return success;
|
||||
}
|
||||
|
||||
Future<bool> getPendingInterventionDiseaseStatus() async {
|
||||
String vidaToken = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
|
||||
if(vidaToken.isEmpty){
|
||||
return false;
|
||||
}
|
||||
hasError = false;
|
||||
var success = false;
|
||||
await baseAppClient.post(IS_INFECTIOUS_DISEASE_PENDING,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
success = response['IsPending'];
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
DrAppToastMsg.showErrorToast(error);
|
||||
|
||||
super.error = super.error! + "\n" + error;
|
||||
}, body: {});
|
||||
return success;
|
||||
}
|
||||
|
||||
Future<InterventionHistoryList?> getInfectiousDiseaseHistory({
|
||||
String admissionNumber = '',
|
||||
String prescriptionNumber = '',
|
||||
String orderNumber = '',
|
||||
String itemID = '',
|
||||
}) async {
|
||||
var request = {
|
||||
"AdmissionNo": admissionNumber,
|
||||
"PrescriptionNo": prescriptionNumber,
|
||||
"OrderNo": orderNumber,
|
||||
"ItemID": itemID,
|
||||
};
|
||||
|
||||
hasError = false;
|
||||
InterventionHistoryList? result;
|
||||
await baseAppClient.post(INFECTIOUS_HISTORY,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
result = InterventionHistoryList.fromJson(
|
||||
response['List_MedicineInterventionHistory']);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
DrAppToastMsg.showErrorToast(error);
|
||||
|
||||
super.error = super.error! + "\n" + error;
|
||||
|
||||
}, body: request);
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<bool> updateInterventionStatus(
|
||||
Map<String, dynamic> request
|
||||
) async {
|
||||
hasError = false;
|
||||
var result = false;
|
||||
await baseAppClient.post(UPDATE_INFECTIOUS_STATUS,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
result = response['IsAccepted'];
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
DrAppToastMsg.showErrorToast(error);
|
||||
super.error = super.error! + "\n" + error;
|
||||
}, body: request);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Future<NursingStation?> getNursingStation() async{
|
||||
hasError = false;
|
||||
NursingStation? station;
|
||||
await baseAppClient.post(GET_NURSING_STATIONS,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
station = NursingStation.fromJson(response['AdmissionMasterList']);
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
DrAppToastMsg.showErrorToast(error);
|
||||
|
||||
super.error = super.error! + "\n" + error;
|
||||
}, body: {});
|
||||
return station;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,627 @@
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
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/nursing_station.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/locator.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart';
|
||||
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class PharmacyInterventionViewModel extends BaseViewModel {
|
||||
PharmacyInterventionService _service = locator<PharmacyInterventionService>();
|
||||
MedicationList? medicationList;
|
||||
|
||||
// MedicationList? medicationList = MedicationList.fromJson({
|
||||
// "entityList": [
|
||||
// {
|
||||
// "accessLevel": 4,
|
||||
// "admissionNo": 2020000098,
|
||||
// "authorizedby": null,
|
||||
// "authorizedbyName": null,
|
||||
// "createdBy": "1485",
|
||||
// "doctorComments": "asdf",
|
||||
// "doctorName": null,
|
||||
// "dosageDetail": "0/VIALS/BID/Parenteral",
|
||||
// "itemID": 107476,
|
||||
// "lineItemNo": 1,
|
||||
// "medication": "TARGOPLANIN 200 MG INJ VIAL 1'S",
|
||||
// "nursingStation": "New Pediatric Building 1st Floor ",
|
||||
// "orderNo": 1448172,
|
||||
// "patientID": 3120412,
|
||||
// "patientName": "HABAB AABER CHINAN",
|
||||
// "pharmacyRemarks": null,
|
||||
// "prescriptionNo": 2686564,
|
||||
// "startDatetime": "2024-12-24T10:33:18",
|
||||
// "status": 62,
|
||||
// "statusName": "RejectWithIntervention",
|
||||
// "stopDatetime": "2024-12-24T20:00:00"
|
||||
// },{
|
||||
// "accessLevel": 4,
|
||||
// "patientID": 3648880,
|
||||
// "patientName": "JEHAD BADEI ALI",
|
||||
// "nursingStation": "New Pediatric Building 3rd Floor ",
|
||||
// "admissionNo": 2022000100,
|
||||
// "orderNo": 1447979,
|
||||
// "prescriptionNo": 2686333,
|
||||
// "lineItemNo": 3,
|
||||
// "itemID": 67507,
|
||||
// "medication": "DIPEPTIVEN 20% CONCENTRATED -100ML",
|
||||
// "dosageDetail": "1 MG/BOTTLE/As Directed/Oral",
|
||||
// "doctorComments": "Test PHR: (Pharmacy Intervention Accepted)Test",
|
||||
// "startDatetime": "2024-05-08T12:56:00",
|
||||
// "stopDatetime": "2024-05-08T12:57:00",
|
||||
// "status": 52,
|
||||
// "statusName": "Discontinue",
|
||||
// "createdBy": "2804",
|
||||
// "authorizedby": null,
|
||||
// "doctorName": null,
|
||||
// "authorizedbyName": null,
|
||||
// "pharmacyRemarks": null
|
||||
// },
|
||||
// {
|
||||
// "accessLevel": 4,
|
||||
// "patientID": 3648880,
|
||||
// "patientName": "JEHAD BADEI ALI",
|
||||
// "nursingStation": "New Pediatric Building 3rd Floor ",
|
||||
// "admissionNo": 2022000100,
|
||||
// "orderNo": 1447979,
|
||||
// "prescriptionNo": 2686333,
|
||||
// "lineItemNo": 3,
|
||||
// "itemID": 67507,
|
||||
// "medication": "DIPEPTIVEN 20% CONCENTRATED -100ML",
|
||||
// "dosageDetail": "1 MG/BOTTLE/As Directed/Oral",
|
||||
// "doctorComments": "Test PHR: (Pharmacy Intervention Accepted)Test",
|
||||
// "startDatetime": "2024-05-08T12:56:00",
|
||||
// "stopDatetime": "2024-05-08T12:57:00",
|
||||
// "status": 52,
|
||||
// "statusName": "Discontinue",
|
||||
// "createdBy": "2804",
|
||||
// "authorizedby": null,
|
||||
// "doctorName": null,
|
||||
// "authorizedbyName": null,
|
||||
// "pharmacyRemarks": null
|
||||
// }
|
||||
// ],
|
||||
// "rowcount": 1,
|
||||
// "statusMessage": null,
|
||||
// "success": null
|
||||
// });
|
||||
|
||||
Medication? currentlySelectedMedication;
|
||||
|
||||
InterventionHistoryList? interventionHistoryList;
|
||||
|
||||
NursingStation? nursingStations;
|
||||
|
||||
// InterventionHistoryList? interventionHistoryList = InterventionHistoryList.fromJson({
|
||||
// "entityList": [
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// }, {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 1005,
|
||||
// "commentedByName": "TEMP - PHARMACIST ",
|
||||
// "interventionDesc": "Drug information :administration related",
|
||||
// "interventionId": 29,
|
||||
// "remark": "asdfasdf"
|
||||
// },
|
||||
// {
|
||||
// "authizationFormText": "Intervention Approval Level 3",
|
||||
// "authorizedAction": 51,
|
||||
// "commentedBy": 0,
|
||||
// "commentedByName": "lorem ipsum1 ",
|
||||
// "interventionDesc": "",
|
||||
// "interventionId": 1485,
|
||||
// "remark": "loremIpsum"
|
||||
// },
|
||||
// ],
|
||||
// "rowcount": 2,
|
||||
// "statusMessage": null,
|
||||
// "success": null
|
||||
// });
|
||||
|
||||
bool isInfectiousDiseaseConsultant = false;
|
||||
|
||||
String nursingStationId = '';
|
||||
String admissionId = '';
|
||||
String patientID = '';
|
||||
String fromDate = '';
|
||||
String toDate = '';
|
||||
NursingStationEntity? entity;
|
||||
|
||||
String getDate(String dateTime) {
|
||||
if (dateTime.isEmpty) return '';
|
||||
DateTime now = DateTime.now();
|
||||
return DateFormat('dd MMM yyyy').format(now);
|
||||
}
|
||||
|
||||
Future getNursingStations() async {
|
||||
nursingStations = await _service.getNursingStation();
|
||||
}
|
||||
|
||||
Future getPharmacyIntervention(
|
||||
{String nursingStationId = '0',
|
||||
String admissionId = '0',
|
||||
String patientID = '0',
|
||||
String fromDate = '',
|
||||
String toDate = '',
|
||||
NursingStationEntity? entity,
|
||||
}) async {
|
||||
setState(ViewState.BusyLocal);
|
||||
|
||||
MedicationList? result = await _service.getMedicationList(
|
||||
nursingStationId: nursingStationId,
|
||||
admissionId: admissionId,
|
||||
patientID: patientID,
|
||||
fromDate: fromDate,
|
||||
toDate: toDate);
|
||||
|
||||
this.nursingStationId = nursingStationId;
|
||||
this.admissionId = admissionId;
|
||||
this.patientID = patientID;
|
||||
this.fromDate = fromDate;
|
||||
this.toDate = toDate;
|
||||
this.entity = entity;
|
||||
|
||||
if (_service.hasError || result == null) {
|
||||
error = _service.error;
|
||||
medicationList = null;
|
||||
setState(ViewState.ErrorLocal);
|
||||
return;
|
||||
}
|
||||
medicationList = result;
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future getInfectiousDiseaseConsultantStatus() async {
|
||||
setState(ViewState.BusyLocal);
|
||||
bool result = await _service.getInfectiousDiseaseConsultantStatus();
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
return;
|
||||
}
|
||||
isInfectiousDiseaseConsultant = result;
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future updateInterventionDiseaseStatus({
|
||||
bool isAccepted = false,
|
||||
String remarks = '',
|
||||
String interventionID = '',
|
||||
String errorMessage = '',
|
||||
String successMessage = ''
|
||||
}) async {
|
||||
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
|
||||
var userId = user?['List_MemberInformation'][0]['MemberID'];
|
||||
|
||||
var requestJson = {
|
||||
"PatientID":currentlySelectedMedication?.patientID ?? '',
|
||||
'AdmissionNo': currentlySelectedMedication?.admissionNo.toString() ?? '',
|
||||
"PrescriptionNo":
|
||||
currentlySelectedMedication?.prescriptionNo.toString() ?? '',
|
||||
"OrderNo": currentlySelectedMedication?.orderNo.toString() ?? '',
|
||||
"ItemID": currentlySelectedMedication?.itemID.toString() ?? '',
|
||||
"LineItemNo": currentlySelectedMedication?.lineItemNo.toString() ?? '',
|
||||
"Remarks": remarks ?? '',
|
||||
"InterventionID": interventionID,
|
||||
"AuthorizeID": userId,
|
||||
"Status": currentlySelectedMedication?.status.toString() ?? '',
|
||||
"IsAccepted": isAccepted
|
||||
};
|
||||
setState(ViewState.BusyLocal);
|
||||
bool result = await _service.updateInterventionStatus(requestJson);
|
||||
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
DrAppToastMsg.showErrorToast(errorMessage);
|
||||
return;
|
||||
}
|
||||
if(result) {
|
||||
DrAppToastMsg.showSuccesToast(successMessage);
|
||||
await getPharmacyIntervention();
|
||||
}
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future getInterventionHistory({
|
||||
Medication? medication,
|
||||
}) async {
|
||||
currentlySelectedMedication = null;
|
||||
setState(ViewState.BusyLocal);
|
||||
InterventionHistoryList? result =
|
||||
await _service.getInfectiousDiseaseHistory(
|
||||
admissionNumber: medication?.admissionNo?.toString() ?? '',
|
||||
prescriptionNumber: medication?.prescriptionNo?.toString() ?? '',
|
||||
orderNumber: medication?.orderNo?.toString() ?? '',
|
||||
itemID: medication?.itemID?.toString() ?? '');
|
||||
if (_service.hasError) {
|
||||
error = _service.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
return;
|
||||
}
|
||||
currentlySelectedMedication = medication;
|
||||
interventionHistoryList = result;
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
toggleShowBottomSheetValue() {
|
||||
interventionHistoryList = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,175 @@
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/PharmacyIntervention.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/InterventionDetails.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InterventionCardBody extends StatelessWidget {
|
||||
final Medication medication;
|
||||
final PharmacyInterventionViewModel model;
|
||||
|
||||
const InterventionCardBody(
|
||||
{super.key, required this.medication, required this.model});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.accessLevel,
|
||||
data: medication.accessLevelDescription ?? '',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.patientID,
|
||||
data: medication.patientID.toString() ?? '',
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.patientName,
|
||||
data: medication.patientName.toString() ?? '',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.nursingStation,
|
||||
data: medication.nursingStation.toString() ?? '',
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.admissionNumber,
|
||||
data: medication.admissionNo.toString() ?? '',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.medication,
|
||||
data: medication.medication.toString() ?? '',
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.dosageDetails,
|
||||
data: medication.dosageDetail.toString() ?? '',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.doctorComments,
|
||||
data: medication.doctorComments.toString() ?? '',
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.startDate,
|
||||
data: model.getDate(medication.startDatetime.toString() ?? ''),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.stopDate,
|
||||
data: model.getDate(medication.stopDatetime.toString() ?? ''),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.status,
|
||||
data: medication.statusName ?? '',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.doctor,
|
||||
data: medication.doctorName.toString() ?? '',
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InterventionDetails(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.pharmacyRemarks,
|
||||
data: medication.pharmacyRemarks.toString() ?? '-',
|
||||
),
|
||||
),
|
||||
Expanded(child: SizedBox.shrink())
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InterventionCardFooter extends StatelessWidget {
|
||||
final PharmacyInterventionViewModel model;
|
||||
final Medication medication;
|
||||
|
||||
const InterventionCardFooter(
|
||||
{super.key, required this.model, required this.medication});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: [
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.details,
|
||||
hasBorder: true,
|
||||
borderColor: AppGlobal.appGreenColor,
|
||||
color: AppGlobal.appGreenColor,
|
||||
fontColor: Colors.white,
|
||||
onPressed: () async {
|
||||
model.getInterventionHistory(
|
||||
medication: medication
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/pharmacy_intervention_item.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/InterventionCardBody.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/InterventionCardFooter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InterventionCardItem extends StatelessWidget {
|
||||
final Medication medication;
|
||||
final PharmacyInterventionViewModel model;
|
||||
|
||||
const InterventionCardItem(
|
||||
{super.key, required this.medication, required this.model});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
elevation: 5,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
InterventionCardBody(
|
||||
medication: medication,
|
||||
model: model,
|
||||
),
|
||||
InterventionCardFooter(
|
||||
model: model,
|
||||
medication: medication,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InterventionDetails extends StatelessWidget {
|
||||
final String title;
|
||||
final String data;
|
||||
|
||||
const InterventionDetails(
|
||||
{super.key, required this.title, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
data,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/PharmacyIntervention.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/pharmacy_intervention/widgets/intervention_history_item.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InterventionHistoryBottomSheet extends StatelessWidget {
|
||||
final List<InterventionHistory> interventionList;
|
||||
final ScrollController controller;
|
||||
final PharmacyInterventionViewModel model;
|
||||
|
||||
const InterventionHistoryBottomSheet(
|
||||
{super.key, required this.interventionList, required this.controller, required this.model});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Color(0xFFF7F7F7),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 32),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase
|
||||
.of(context)
|
||||
.histories,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 24,
|
||||
color: Color(0xFF2B353E),
|
||||
),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
controller: controller,
|
||||
itemCount: interventionList.length,
|
||||
itemBuilder: (context, index) =>
|
||||
Material(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
color: Colors.white,
|
||||
child: InterventionHistoryItem(
|
||||
interventionHistory: interventionList[index],
|
||||
onAcceptClick: (intervention) {
|
||||
model.updateInterventionDiseaseStatus(
|
||||
isAccepted: true,
|
||||
interventionID: interventionList[index].interventionId.toString(),
|
||||
successMessage: TranslationBase.of(context).interventionRejectedSuccessfully,
|
||||
errorMessage: TranslationBase.of(context).unableToPerformTheAction
|
||||
);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
onRejectClick: (intervention) {
|
||||
model.updateInterventionDiseaseStatus(
|
||||
interventionID: interventionList[index].interventionId.toString(),
|
||||
successMessage: TranslationBase.of(context).interventionAcceptedSuccessfully,
|
||||
errorMessage: TranslationBase.of(context).unableToPerformTheAction
|
||||
);
|
||||
Navigator.pop(context);
|
||||
|
||||
},
|
||||
),
|
||||
),
|
||||
separatorBuilder: (_, __) => Divider(),
|
||||
))
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NoInterventionFound extends StatelessWidget{
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Text(
|
||||
TranslationBase.of(context).noInterventionFound,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,354 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:dropdown_search/dropdown_search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../widgets/shared/app_texts_widget.dart';
|
||||
import '../../patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart';
|
||||
|
||||
class PharmacyInterventionDialog extends StatefulWidget {
|
||||
final Function(
|
||||
String, // dataFrom
|
||||
String, // dateTo
|
||||
String, // admissionNumber
|
||||
String, // patient ID
|
||||
NursingStationEntity?, // nursingStation
|
||||
) onDispose;
|
||||
|
||||
final String dateFrom;
|
||||
final String dateTo;
|
||||
final String admissionNumber;
|
||||
final String patientID;
|
||||
final NursingStationEntity? nursingStation;
|
||||
final NursingStation? station;
|
||||
|
||||
const PharmacyInterventionDialog({super.key,
|
||||
required this.onDispose,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
required this.admissionNumber,
|
||||
required this.patientID,
|
||||
required this.nursingStation,
|
||||
required this.station,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PharmacyInterventionDialog> createState() =>
|
||||
_PharmacyInterventionDialogState();
|
||||
}
|
||||
|
||||
class _PharmacyInterventionDialogState
|
||||
extends State<PharmacyInterventionDialog> {
|
||||
final TextEditingController admissionNumber = TextEditingController();
|
||||
NursingStationEntity? nursingStation = null;
|
||||
|
||||
final TextEditingController patientId = TextEditingController();
|
||||
|
||||
String dateFrom = '';
|
||||
|
||||
String dateTo = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
initData();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void initData() {
|
||||
admissionNumber.text = (widget.admissionNumber == '0')?'':widget.admissionNumber;
|
||||
nursingStation = widget.nursingStation;
|
||||
patientId.text = (widget.patientID == '0' )?'':widget.patientID;
|
||||
dateTo = getDateString(widget.dateTo);
|
||||
dateFrom = getDateString(widget.dateFrom);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
nursingStationView,
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
_titleAndTextField(TranslationBase
|
||||
.of(context)
|
||||
.admissionNumber,
|
||||
admissionNumber, TextInputType.text),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
_titleAndTextField(TranslationBase
|
||||
.of(context)
|
||||
.patientID, patientId,
|
||||
TextInputType.number),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
_dateSelection(TranslationBase
|
||||
.of(context)
|
||||
.dateFrom, (date) {
|
||||
DateTime? fromDate = getDate(date);
|
||||
DateTime? toDate = getDate(dateTo);
|
||||
if (toDate == null) {
|
||||
setState(() {
|
||||
dateFrom = date;
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (fromDate!.compareTo(toDate!) == 1) {
|
||||
setState(() {
|
||||
dateFrom = date;
|
||||
dateTo = '';
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
dateFrom = date;
|
||||
});
|
||||
}, dateFrom, false),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
_dateSelection(TranslationBase
|
||||
.of(context)
|
||||
.dateTo, (date) {
|
||||
setState(() {
|
||||
dateTo = date;
|
||||
});
|
||||
}, dateTo, true, selectedFromDate: dateFrom),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.search,
|
||||
hasBorder: true,
|
||||
borderColor: Color(0xFFB8382B),
|
||||
color: AppGlobal.appRedColor,
|
||||
fontColor: Colors.white,
|
||||
onPressed: () async {
|
||||
//(dateFrom, dateTo, admissionNumber, patientId, nursingStation)
|
||||
widget.onDispose(dateFrom, dateTo, admissionNumber.text,
|
||||
patientId.text, nursingStation);
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _dateSelection(String title, Function(String) onDateSelected,
|
||||
String selectedDate, bool isToDateSelection,{String? selectedFromDate}) {
|
||||
return GestureDetector(
|
||||
onTap: () => _selectDate(onDateSelected,
|
||||
(isToDateSelection == true) ? selectedDate : "", isToDateSelection,
|
||||
selectedFromDate: selectedFromDate),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(title),
|
||||
Expanded(
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
selectedDate,
|
||||
),
|
||||
trailing: Icon(Icons.arrow_drop_down_outlined),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future _selectDate(Function(String) updateDate , String date, bool toDateSelection, {String? selectedFromDate}) async {
|
||||
DateTime? dateTime = getDate(date);
|
||||
DateTime? fromDate = getDate(selectedFromDate??'');
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: date.isNotEmpty ? getDate(date) : fromDate != null
|
||||
? fromDate
|
||||
: DateTime.now(),
|
||||
firstDate: (toDateSelection && fromDate != null) ? fromDate : ((date
|
||||
.isNotEmpty && dateTime != null)) ? dateTime : DateTime(DateTime
|
||||
.now()
|
||||
.year - 150),
|
||||
lastDate: DateTime(DateTime
|
||||
.now()
|
||||
.year + 150),
|
||||
initialEntryMode: DatePickerEntryMode.calendar,
|
||||
builder: (_, child) {
|
||||
return Theme(
|
||||
data: ThemeData.light().copyWith(
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
primarySwatch: Colors.red,
|
||||
accentColor: AppGlobal.appRedColor,
|
||||
),
|
||||
dialogBackgroundColor: Colors.white,
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
});
|
||||
if (picked != null) {
|
||||
updateDate(getFormattedDate(picked));
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
Widget _titleAndTextField(String title, TextEditingController controller,
|
||||
TextInputType? inputType) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(title),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
keyboardType: inputType,
|
||||
decoration: InputDecoration(
|
||||
hintText: '',
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
contentPadding: EdgeInsetsDirectional.only(start: 10.0),
|
||||
),
|
||||
textAlign: TextAlign.end,
|
||||
controller: controller,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void initFromDate() {
|
||||
var time = DateTime.now();
|
||||
dateFrom = getFormattedDate(time);
|
||||
}
|
||||
|
||||
String getFormattedDate(DateTime time) {
|
||||
return DateFormat('yyyy-MM-dd').format(time);
|
||||
}
|
||||
|
||||
String getDateString(String dateTime) {
|
||||
if (dateTime.isEmpty) return '';
|
||||
DateTime? now = getDate(dateTime);
|
||||
if(now == null ) return '';
|
||||
return DateFormat('yyyy-MM-dd').format(now);
|
||||
}
|
||||
|
||||
DateTime? getDate(String dateTime){
|
||||
if (dateTime.isEmpty) return null;
|
||||
List<String> splitedDate = dateTime.split('-');
|
||||
DateTime now = DateTime(int.parse(splitedDate[0]),
|
||||
int.parse(splitedDate[1]), int.parse(splitedDate[2]));
|
||||
return now;
|
||||
}
|
||||
|
||||
Widget get nursingStationView =>
|
||||
Row(
|
||||
children: [
|
||||
Text(TranslationBase
|
||||
.of(context)
|
||||
.nursingStation,),
|
||||
SizedBox(width: 10,),
|
||||
widget.station?.entityList?.isEmpty == true ? Expanded(
|
||||
child: EmptyDropDown())
|
||||
: Expanded(
|
||||
child: DropdownSearch<NursingStationEntity>(
|
||||
itemAsString:(item){
|
||||
return item.description??'';
|
||||
} ,
|
||||
items: widget.station?.entityList ?? [],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true,
|
||||
searchDelay: Duration(microseconds: 100),
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
border: UnderlineInputBorder(),
|
||||
hintText: TranslationBase.of(context).search
|
||||
)
|
||||
)
|
||||
),
|
||||
dropdownButtonProps: DropdownButtonProps(color: AppGlobal.appRedColor,),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none
|
||||
),
|
||||
baseStyle: TextStyle(
|
||||
fontSize: 14
|
||||
)
|
||||
),
|
||||
|
||||
selectedItem: nursingStation == null
|
||||
? widget.station?.entityList?.first
|
||||
: nursingStation,
|
||||
onChanged: (newValue) async {
|
||||
if (newValue != null)
|
||||
setState(() {
|
||||
nursingStation = newValue ;
|
||||
});
|
||||
},
|
||||
)
|
||||
// DropdownButtonHideUnderline(
|
||||
// child: DropdownButton(
|
||||
// dropdownColor: Colors.white,
|
||||
// iconEnabledColor: Colors.black,
|
||||
// icon: Icon(Icons.keyboard_arrow_down),
|
||||
// isExpanded: true,
|
||||
// value: nursingStation == null
|
||||
// ? widget.station?.entityList?.first
|
||||
// : nursingStation,
|
||||
// iconSize: 25,
|
||||
// elevation: 16,
|
||||
// onChanged: (newValue) async {
|
||||
// if (newValue != null)
|
||||
// setState(() {
|
||||
// nursingStation = newValue ;
|
||||
// });
|
||||
// },
|
||||
// items:
|
||||
// widget.station?.entityList?.map((item) {
|
||||
// return DropdownMenuItem(
|
||||
// child: AppText(
|
||||
// item.description ?? '',
|
||||
// fontSize: 14,
|
||||
// letterSpacing: -0.96,
|
||||
// color: AppGlobal.appTextColor,
|
||||
// fontWeight: FontWeight.normal,
|
||||
// textAlign: TextAlign.left,
|
||||
// ),
|
||||
// value: item,
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
// ),
|
||||
)
|
||||
]);
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
|
||||
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InterventionHistoryItem extends StatelessWidget {
|
||||
final InterventionHistory interventionHistory;
|
||||
final Function(InterventionHistory) onAcceptClick;
|
||||
|
||||
// string is index here
|
||||
final Function(InterventionHistory) onRejectClick;
|
||||
|
||||
const InterventionHistoryItem({
|
||||
super.key,
|
||||
required this.interventionHistory,
|
||||
required this.onAcceptClick,
|
||||
required this.onRejectClick,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
interventionHistory.interventionDesc ?? '',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
color: Color(0xFF2B353E),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.commentedBy}: ${interventionHistory.commentedByName}",
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
color: Color(0xFF2B353E),
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase
|
||||
.of(context)
|
||||
.remarks}: ${interventionHistory.remark?.isNotEmpty == true
|
||||
? interventionHistory.remark
|
||||
: TranslationBase
|
||||
.of(context)
|
||||
.noRemarks}",
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
color: Color(0xFF2B353E),
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 48,
|
||||
child: AppButton(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.reject,
|
||||
hasBorder: true,
|
||||
borderColor: Color(0xFFB8382B),
|
||||
color: AppGlobal.appRedColor,
|
||||
fontColor: Colors.white,
|
||||
onPressed: () async {
|
||||
onRejectClick(interventionHistory);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 48,
|
||||
child: AppButton(
|
||||
title: TranslationBase
|
||||
.of(context)
|
||||
.accept,
|
||||
hasBorder: true,
|
||||
borderColor: AppGlobal.appGreenColor,
|
||||
color: AppGlobal.appGreenColor,
|
||||
fontColor: Colors.white,
|
||||
onPressed: () async {
|
||||
onAcceptClick(interventionHistory);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(height: 4,),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue