call service after accept or reject

merge-requests/953/head
Elham Rababh 3 years ago
parent 211990518f
commit a829532717

@ -44,10 +44,14 @@ class InterventionMedicationViewModel extends BaseViewModel {
}) async {
InterventionMedicationReqModel interventionMedicationReqModel =
InterventionMedicationReqModel(
projectID: 15, //projectId,
patientID: 79941, //patientId,
fromDate: "\/Date(1488322922)\/",//AppDateUtils.convertDateToServerFormat(fromDate),
toDate: "\/Date(1635886800000)\/",//AppDateUtils.convertDateToServerFormat(toDate),
projectID: 15,
//projectId,
patientID: 79941,
//patientId,
fromDate: "\/Date(1488322922)\/",
//AppDateUtils.convertDateToServerFormat(fromDate),
toDate:
"\/Date(1635886800000)\/", //AppDateUtils.convertDateToServerFormat(toDate),
);
hasError = false;
setState(ViewState.Busy);
@ -61,30 +65,40 @@ class InterventionMedicationViewModel extends BaseViewModel {
}
}
Future getInterventionMedicationHistory({
int projectId,
int patientId,
int admissionNo,
int prescriptionNo,
int orderNo,
}) async {
Future getInterventionMedicationHistory(
{int projectId,
int patientId,
int admissionNo,
int prescriptionNo,
int orderNo,
bool isBusyLocal = false}) async {
InterventionMedicationHistoryReqModel
interventionMedicationHistoryReqModel =
InterventionMedicationHistoryReqModel(
projectID: 15, //projectId,
patientID: 79941, //patientId,
admissionNo: 2018013900,//admissionNo,
prescriptionNo: 2045165, //prescriptionNo,
projectID: 15,
//projectId,
patientID: 79941,
//patientId,
admissionNo: 2018013900,
//admissionNo,
prescriptionNo: 2045165,
//prescriptionNo,
orderNo: 1171570, //orderNo,
);
hasError = false;
setState(ViewState.Busy);
if (isBusyLocal)
setState(ViewState.Busy);
else
setState(ViewState.Busy);
await _interventionMedicationService.getInterventionMedicationHistory(
interventionMedicationHistoryReqModel:
interventionMedicationHistoryReqModel);
if (_interventionMedicationService.hasError) {
error = _interventionMedicationService.error;
setState(ViewState.Error);
if (isBusyLocal)
setState(ViewState.ErrorLocal);
else
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
@ -101,15 +115,21 @@ class InterventionMedicationViewModel extends BaseViewModel {
int interventionStatus,
}) async {
AcceptOrRejectReqModel acceptOrRejectReqModel = AcceptOrRejectReqModel(
projectID: 15, //projectId,
patientID: 79941, //patientID,
admissionNo: 2018013900, //admissionNo,
prescriptionNo: 2045165, //prescriptionNo,
orderNo: 1171570, //orderNo,
projectID: 15,
//projectId,
patientID: 79941,
//patientID,
admissionNo: 2018013900,
//admissionNo,
prescriptionNo: 2045165,
//prescriptionNo,
orderNo: 1171570,
//orderNo,
accessLevel: 4,
lineItemNo: 1,
remarks: remarks,
memberID: 2804, //memberId,
memberID: 2804,
//memberId,
interventionStatus: interventionStatus,
);
hasError = false;

@ -234,10 +234,17 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
admissionNo: model.allInterventionHistoryList[index].admissionNo,
interventionStatus: 1,
);
GifLoaderDialogUtils.hideDialog(context);
if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
await model.getInterventionMedicationHistory(patientId: widget.patient.patientId,
projectId: widget.interventionMedication.projectID,
admissionNo: widget.interventionMedication.admissionNo,
prescriptionNo: widget.interventionMedication.prescriptionNo,
orderNo: widget.interventionMedication.orderNo,);
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast(
"Has been Successfully accepted");
}
@ -283,10 +290,18 @@ class _InterventionMedicationHistoryScreenState extends State<InterventionMedica
admissionNo: model.allInterventionHistoryList[index].admissionNo,
interventionStatus: 2
);
GifLoaderDialogUtils.hideDialog(context);
if(model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
await model.getInterventionMedicationHistory(patientId: widget.patient.patientId,
projectId: widget.interventionMedication.projectID,
admissionNo: widget.interventionMedication.admissionNo,
prescriptionNo: widget.interventionMedication.prescriptionNo,
orderNo: widget.interventionMedication.orderNo,);
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast(
"Has been Successfully Rejected");
}

Loading…
Cancel
Save