|
|
|
@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/MedicalReport/MedicalReportTemplate.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/MedicalReport/MedicalReportTemplate.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/MedicalReport/MeidcalReportModel.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/MedicalReport/MeidcalReportModel.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/utils/extenstions_utils.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class PatientMedicalReportService extends BaseService {
|
|
|
|
class PatientMedicalReportService extends BaseService {
|
|
|
|
List<MedicalReportModel> medicalReportList = [];
|
|
|
|
List<MedicalReportModel> medicalReportList = [];
|
|
|
|
@ -21,7 +23,11 @@ class PatientMedicalReportService extends BaseService {
|
|
|
|
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
if (response['DAPP_ListMedicalReportList'] != null) {
|
|
|
|
if (response['DAPP_ListMedicalReportList'] != null) {
|
|
|
|
response['DAPP_ListMedicalReportList'].forEach((v) {
|
|
|
|
response['DAPP_ListMedicalReportList'].forEach((v) {
|
|
|
|
|
|
|
|
if (isVidaPlusProject) {
|
|
|
|
|
|
|
|
medicalReportList.add(MedicalReportModel.fromJsonForVidaPlus(v));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
medicalReportList.add(MedicalReportModel.fromJson(v));
|
|
|
|
medicalReportList.add(MedicalReportModel.fromJson(v));
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
medicalReportList = medicalReportList.reversed.toList();
|
|
|
|
medicalReportList = medicalReportList.reversed.toList();
|
|
|
|
@ -64,11 +70,26 @@ class PatientMedicalReportService extends BaseService {
|
|
|
|
|
|
|
|
|
|
|
|
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport, bool? isVidaPlusProject,) async {
|
|
|
|
Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport, bool? isVidaPlusProject,) async {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
print("the isVidaPlusProject flag in Service is $isVidaPlusProject");
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
|
|
|
if (isVidaPlusProject == true) {
|
|
|
|
|
|
|
|
body['SetupID'] = doctorProfile!.setupID;
|
|
|
|
|
|
|
|
} else
|
|
|
|
body['SetupID'] = "91877";
|
|
|
|
body['SetupID'] = "91877";
|
|
|
|
body['AdmissionNo'] = isVidaPlusProject == true? patient.admissionID : patient.admissionNo;
|
|
|
|
body['AdmissionNo'] = isVidaPlusProject == true? patient.admissionID : patient.admissionNo;
|
|
|
|
body['InvoiceNo'] = medicalReport.invoiceNo;
|
|
|
|
body['InvoiceNo'] = medicalReport.invoiceNo;
|
|
|
|
body['LineItemNo'] = medicalReport.lineItemNo;
|
|
|
|
body['LineItemNo'] = medicalReport.lineItemNo;
|
|
|
|
|
|
|
|
if (isVidaPlusProject == true) {
|
|
|
|
|
|
|
|
body['TemplateID'] = medicalReport.templateID ?? 0;
|
|
|
|
|
|
|
|
body['summaryId'] = medicalReport.summaryId ?? 0;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (body['InvoiceNo'].toString().isEmpty) {
|
|
|
|
|
|
|
|
body['InvoiceNo'] = "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
body['InvoiceNo'] = "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (body['ProjectID'] == null) {
|
|
|
|
if (body['ProjectID'] == null) {
|
|
|
|
body['ProjectID'] = doctorProfile?.projectID;
|
|
|
|
body['ProjectID'] = doctorProfile?.projectID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -83,14 +104,16 @@ class PatientMedicalReportService extends BaseService {
|
|
|
|
Future addMedicalReport(PatiantInformtion patient, String htmlText, bool? isVidaPlusProject) async {
|
|
|
|
Future addMedicalReport(PatiantInformtion patient, String htmlText, bool? isVidaPlusProject) async {
|
|
|
|
hasError = false;
|
|
|
|
hasError = false;
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
Map<String, dynamic> body = Map();
|
|
|
|
|
|
|
|
if (isVidaPlusProject == false) {
|
|
|
|
body['SetupID'] = body.containsKey('SetupID')
|
|
|
|
body['SetupID'] = body.containsKey('SetupID')
|
|
|
|
? body['SetupID'] != null
|
|
|
|
? body['SetupID'] != null
|
|
|
|
? body['SetupID']
|
|
|
|
? body['SetupID']
|
|
|
|
: SETUP_ID
|
|
|
|
: SETUP_ID
|
|
|
|
: SETUP_ID;
|
|
|
|
: SETUP_ID;
|
|
|
|
print("isVidaPlusProject $isVidaPlusProject");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body['AdmissionNo'] = isVidaPlusProject == true? patient.admissionID ?? -1 :int.parse(patient.admissionNo!);
|
|
|
|
body['AdmissionNo'] = isVidaPlusProject == true? patient.admissionID ?? -1 :int.parse(patient.admissionNo!);
|
|
|
|
print('the admission no is ${body['AdmissionNo']}');
|
|
|
|
|
|
|
|
body['MedicalReportHTML'] = htmlText;
|
|
|
|
body['MedicalReportHTML'] = htmlText;
|
|
|
|
body['ProjectID'] = doctorProfile?.projectID;
|
|
|
|
body['ProjectID'] = doctorProfile?.projectID;
|
|
|
|
body['PatientID'] = patient.patientId;
|
|
|
|
body['PatientID'] = patient.patientId;
|
|
|
|
@ -111,6 +134,11 @@ class PatientMedicalReportService extends BaseService {
|
|
|
|
|
|
|
|
|
|
|
|
body['LineItemNo'] = limitNumber;
|
|
|
|
body['LineItemNo'] = limitNumber;
|
|
|
|
body['InvoiceNo'] = invoiceNumber;
|
|
|
|
body['InvoiceNo'] = invoiceNumber;
|
|
|
|
|
|
|
|
if (ProjectViewModel.getVidaPlusStatus()) {
|
|
|
|
|
|
|
|
if (body['InvoiceNo'].toString().isEmpty) {
|
|
|
|
|
|
|
|
body['InvoiceNo'] = "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body['SetupID'] = body.containsKey('SetupID')
|
|
|
|
body['SetupID'] = body.containsKey('SetupID')
|
|
|
|
? body['SetupID'] != null
|
|
|
|
? body['SetupID'] != null
|
|
|
|
|