update medical file service

merge-requests/757/head
hussam al-habibeh 5 years ago
parent c652f40a89
commit bec5eb82bc

@ -99,19 +99,23 @@ class PatientMedicalReportService extends BaseService {
}, body: body, patient: patient); }, body: body, patient: patient);
} }
Future updateMedicalReport(PatiantInformtion patient, String htmlText) async { Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
// body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";
body['LineItemNo'] = limitNumber;
body['InvoiceNo'] = invoiceNumber;
body['SetupID'] = "91877"; body['SetupID'] = "91877";
body['AdmissionNo'] = int.parse(patient.admissionNo); //body['AdmissionNo'] = int.parse(patient.admissionNo);
body['MedicalReportHTML'] = htmlText; body['MedicalReportHTML'] = htmlText;
if (body['ProjectID'] == null) { if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID; body['ProjectID'] = doctorProfile?.projectID;
} }
if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID;
await baseAppClient.postPatient(INSERT_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, await baseAppClient.postPatient(UPDATE_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error.toString(); super.error = error.toString();

@ -74,4 +74,14 @@ class PatientMedicalReportViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async {
setState(ViewState.Busy);
await _service.updateMedicalReport(patient, htmlText, limitNumber, invoiceNumber);
if (_service.hasError) {
error = _service.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
} }

@ -92,9 +92,14 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
status == MedicalReportStatus.ADD medicalReport != null
? model.addMedicalReport(patient, txtOfMedicalReport) ? model.updateMedicalReport(
patient,
txtOfMedicalReport,
medicalReport != null ? medicalReport.lineItemNo : null,
medicalReport != null ? medicalReport.invoiceNo : null)
: model.addMedicalReport(patient, txtOfMedicalReport); : model.addMedicalReport(patient, txtOfMedicalReport);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);

@ -96,7 +96,7 @@ class MedicalReportPage extends StatelessWidget {
'patient': patient, 'patient': patient,
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'medicalReport': model.medicalReportList[index] 'medicalReport': model.medicalReportList[index],
}); });
} else { } else {
Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
@ -104,7 +104,7 @@ class MedicalReportPage extends StatelessWidget {
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD, 'type': MedicalReportStatus.ADD,
'medicalReport': model.medicalReportList[index] 'medicalReport': model.medicalReportList[index],
}); });
} }
}, },

Loading…
Cancel
Save