working on medical-profile
parent
08a210241c
commit
6192d9a84f
@ -0,0 +1,65 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||||
|
|
||||||
|
class PatientMedicalReportService extends BaseService {
|
||||||
|
List<MedicalReportModel> medicalReportList = [];
|
||||||
|
|
||||||
|
Future getMedicalReportList(PatiantInformtion patient) async {
|
||||||
|
hasError = false;
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['TokenID'] = "@dm!n";
|
||||||
|
body['SetupID'] = "91877";
|
||||||
|
body['AdmissionNo'] = patient.admissionNo;
|
||||||
|
|
||||||
|
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
|
||||||
|
medicalReportList.clear();
|
||||||
|
if (response['DAPP_ListMedicalReportList'] != null) {
|
||||||
|
response['DAPP_ListMedicalReportList'].forEach((v) {
|
||||||
|
medicalReportList.add(MedicalReportModel.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error.toString();
|
||||||
|
}, body: body, patient: patient);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future insertMedicalReport(PatiantInformtion patient, String htmlText) async {
|
||||||
|
hasError = false;
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['TokenID'] = "@dm!n";
|
||||||
|
body['SetupID'] = "91877";
|
||||||
|
body['AdmissionNo'] = patient.admissionNo;
|
||||||
|
body['MedicalReportHTML'] = htmlText;
|
||||||
|
|
||||||
|
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error.toString();
|
||||||
|
}, body: body, patient: patient);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
|
||||||
|
hasError = false;
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['TokenID'] = "@dm!n";
|
||||||
|
body['SetupID'] = "91877";
|
||||||
|
body['AdmissionNo'] = patient.admissionNo;
|
||||||
|
body['InvoiceNo'] = medicalReport.invoiceNo;
|
||||||
|
body['LineItemNo'] = medicalReport.lineItemNo;
|
||||||
|
|
||||||
|
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error.toString();
|
||||||
|
}, body: body, patient: patient);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/base_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 '../../locator.dart';
|
||||||
|
|
||||||
|
class PatientMedicalReportViewModel extends BaseViewModel {
|
||||||
|
PatientMedicalReportService _service = locator<PatientMedicalReportService>();
|
||||||
|
|
||||||
|
List<MedicalReportModel> get medicalReportList => _service.medicalReportList;
|
||||||
|
|
||||||
|
Future getMedicalReportList(PatiantInformtion patient) async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _service.getMedicalReportList(patient);
|
||||||
|
if (_service.hasError) {
|
||||||
|
error = _service.error;
|
||||||
|
setState(ViewState.ErrorLocal); // ViewState.Error
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future insertMedicalReport(PatiantInformtion patient, String htmlText)async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _service.insertMedicalReport(patient, htmlText);
|
||||||
|
if (_service.hasError) {
|
||||||
|
error = _service.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _service.verifyMedicalReport(patient, medicalReport);
|
||||||
|
if (_service.hasError) {
|
||||||
|
error = _service.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
class MedicalReportModel {
|
||||||
|
String reportData;
|
||||||
|
String setupID;
|
||||||
|
int projectID;
|
||||||
|
int patientID;
|
||||||
|
String invoiceNo;
|
||||||
|
int status;
|
||||||
|
String verifiedOn;
|
||||||
|
int verifiedBy;
|
||||||
|
String editedOn;
|
||||||
|
int editedBy;
|
||||||
|
int lineItemNo;
|
||||||
|
String reportDataHtml;
|
||||||
|
|
||||||
|
MedicalReportModel(
|
||||||
|
{this.reportData,
|
||||||
|
this.setupID,
|
||||||
|
this.projectID,
|
||||||
|
this.patientID,
|
||||||
|
this.invoiceNo,
|
||||||
|
this.status,
|
||||||
|
this.verifiedOn,
|
||||||
|
this.verifiedBy,
|
||||||
|
this.editedOn,
|
||||||
|
this.editedBy,
|
||||||
|
this.lineItemNo,
|
||||||
|
this.reportDataHtml});
|
||||||
|
|
||||||
|
MedicalReportModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
reportData = json['ReportData'];
|
||||||
|
setupID = json['SetupID'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
invoiceNo = json['InvoiceNo'];
|
||||||
|
status = json['Status'];
|
||||||
|
verifiedOn = json['VerifiedOn'];
|
||||||
|
verifiedBy = json['VerifiedBy'];
|
||||||
|
editedOn = json['EditedOn'];
|
||||||
|
editedBy = json['EditedBy'];
|
||||||
|
lineItemNo = json['LineItemNo'];
|
||||||
|
reportDataHtml = json['ReportDataHtml'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ReportData'] = this.reportData;
|
||||||
|
data['SetupID'] = this.setupID;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['InvoiceNo'] = this.invoiceNo;
|
||||||
|
data['Status'] = this.status;
|
||||||
|
data['VerifiedOn'] = this.verifiedOn;
|
||||||
|
data['VerifiedBy'] = this.verifiedBy;
|
||||||
|
data['EditedOn'] = this.editedOn;
|
||||||
|
data['EditedBy'] = this.editedBy;
|
||||||
|
data['LineItemNo'] = this.lineItemNo;
|
||||||
|
data['ReportDataHtml'] = this.reportDataHtml;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue