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);
}
Future updateMedicalReport(PatiantInformtion patient, String htmlText) async {
Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async {
hasError = false;
Map<String, dynamic> body = Map();
// body['TokenID'] = "@dm!n";
body['LineItemNo'] = limitNumber;
body['InvoiceNo'] = invoiceNumber;
body['SetupID'] = "91877";
body['AdmissionNo'] = int.parse(patient.admissionNo);
//body['AdmissionNo'] = int.parse(patient.admissionNo);
body['MedicalReportHTML'] = htmlText;
if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID;
}
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) {
hasError = true;
super.error = error.toString();

@ -74,4 +74,14 @@ class PatientMedicalReportViewModel extends BaseViewModel {
} else
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) {
GifLoaderDialogUtils.showMyDialog(context);
status == MedicalReportStatus.ADD
? model.addMedicalReport(patient, txtOfMedicalReport)
medicalReport != null
? model.updateMedicalReport(
patient,
txtOfMedicalReport,
medicalReport != null ? medicalReport.lineItemNo : null,
medicalReport != null ? medicalReport.invoiceNo : null)
: model.addMedicalReport(patient, txtOfMedicalReport);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);

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

Loading…
Cancel
Save