|
|
|
|
@ -20,9 +20,14 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
import '../../widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
|
import '../service/patient/patient_service.dart';
|
|
|
|
|
|
|
|
|
|
class PrescriptionViewModel extends BaseViewModel {
|
|
|
|
|
FilterType filterType = FilterType.Clinic;
|
|
|
|
|
bool hasError = false;
|
|
|
|
|
PatientService _patientService = locator<PatientService>();
|
|
|
|
|
|
|
|
|
|
PrescriptionService _prescriptionService = locator<PrescriptionService>();
|
|
|
|
|
|
|
|
|
|
List<GetMedicationResponseModel> get allMedicationList =>
|
|
|
|
|
@ -65,6 +70,26 @@ class PrescriptionViewModel extends BaseViewModel {
|
|
|
|
|
List<PrescriotionInPatient> get inPatientPrescription =>
|
|
|
|
|
_prescriptionsService.prescriptionInPatientList;
|
|
|
|
|
|
|
|
|
|
Future getOutPatientPrescriptions(patient, {bool isLocalBusy = false, BuildContext context, PatiantInformtion patientInformation}) async {
|
|
|
|
|
if (isLocalBusy) {
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
} else {
|
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
|
}
|
|
|
|
|
await _patientService.getOutPatientPrescriptions(patient);
|
|
|
|
|
if (_patientService.hasError) {
|
|
|
|
|
error = _patientService.error;
|
|
|
|
|
if (isLocalBusy) {
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else {
|
|
|
|
|
setState(ViewState.Error);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getPrescriptionsInPatient(PatiantInformtion patient) async {
|
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
|
error = "";
|
|
|
|
|
|