Medical Report change status

merge-requests/757/head
hussam al-habibeh 4 years ago
parent bec5eb82bc
commit 19548ccb1e

@ -23,6 +23,7 @@ class PatientMedicalReportService extends BaseService {
medicalReportList.add(MedicalReportModel.fromJson(v));
});
}
medicalReportList = medicalReportList.reversed.toList();
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error.toString();
@ -72,6 +73,10 @@ class PatientMedicalReportService extends BaseService {
body['AdmissionNo'] = patient.admissionNo;
body['InvoiceNo'] = medicalReport.invoiceNo;
body['LineItemNo'] = medicalReport.lineItemNo;
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID;
}
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {

@ -62,7 +62,8 @@ class PatientMedicalReportViewModel extends BaseViewModel {
error = _service.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
getMedicalReportList(patient);
setState(ViewState.Idle);
}
Future addMedicalReport(PatiantInformtion patient, String htmlText) async {
@ -72,7 +73,8 @@ class PatientMedicalReportViewModel extends BaseViewModel {
error = _service.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
getMedicalReportList(patient);
setState(ViewState.Idle);
}
Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async {
@ -82,6 +84,7 @@ class PatientMedicalReportViewModel extends BaseViewModel {
error = _service.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
getMedicalReportList(patient);
setState(ViewState.Idle);
}
}

@ -124,6 +124,6 @@ void setupLocator() {
locator.registerFactory(() => PatientSearchViewModel());
locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => LiveCarePatientViewModel());
locator.registerFactory(() => PatientMedicalReportViewModel());
locator.registerLazySingleton(() => PatientMedicalReportViewModel());
locator.registerFactory(() => ScanQrViewModel());
}

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
@ -26,12 +27,13 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatientMedicalReportViewModel patientMedicalReportViewModel = routeArgs['model'];
PatiantInformtion patient = routeArgs['patient'];
MedicalReportStatus status = routeArgs['status'];
MedicalReportStatus status = routeArgs['status'] as MedicalReportStatus;
MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport") ? routeArgs['medicalReport'] : null;
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) => model.getMedicalReportTemplate(),
onModelReady: (_) => patientMedicalReportViewModel.getMedicalReportTemplate(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
@ -99,6 +101,9 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
medicalReport != null ? medicalReport.lineItemNo : null,
medicalReport != null ? medicalReport.invoiceNo : null)
: model.addMedicalReport(patient, txtOfMedicalReport);
//model.getMedicalReportList(patient);
Navigator.pop(context);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
@ -123,6 +128,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
GifLoaderDialogUtils.showMyDialog(context);
await model.verifyMedicalReport(patient, medicalReport);
GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}

@ -23,7 +23,12 @@ import 'package:provider/provider.dart';
import '../../../../routes.dart';
import 'AddVerifyMedicalReport.dart';
class MedicalReportPage extends StatelessWidget {
class MedicalReportPage extends StatefulWidget {
@override
_MedicalReportPageState createState() => _MedicalReportPageState();
}
class _MedicalReportPageState extends State<MedicalReportPage> {
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -35,9 +40,6 @@ class MedicalReportPage extends StatelessWidget {
return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) async {
await model.getMedicalReportList(patient);
// if (model.state == ViewState.ErrorLocal) {
// DrAppToastMsg.showErrorToast(model.error);
// }
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
@ -81,7 +83,8 @@ class MedicalReportPage extends StatelessWidget {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD
'type': MedicalReportStatus.ADD,
'model': model,
});
},
label: TranslationBase.of(context).createNewMedicalReport,
@ -97,6 +100,7 @@ class MedicalReportPage extends StatelessWidget {
'patientType': patientType,
'arrivalType': arrivalType,
'medicalReport': model.medicalReportList[index],
'model': model,
});
} else {
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
@ -105,6 +109,7 @@ class MedicalReportPage extends StatelessWidget {
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD,
'medicalReport': model.medicalReportList[index],
'model': model,
});
}
},

Loading…
Cancel
Save