|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/request_schedule.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart';
|
|
|
|
@ -7,6 +10,7 @@ import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequenc
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/lab_result/lab_result_req_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patient_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart';
|
|
|
|
@ -42,22 +46,33 @@ class PatientService extends BaseService {
|
|
|
|
|
List<PrescriptionReport> get prescriptionReport => _prescriptionReport;
|
|
|
|
|
|
|
|
|
|
List<LabResult> _labResultList = [];
|
|
|
|
|
|
|
|
|
|
List<LabResult> get labResultList => _labResultList;
|
|
|
|
|
|
|
|
|
|
// TODO: replace var with model
|
|
|
|
|
var _patientProgressNoteList = [];
|
|
|
|
|
|
|
|
|
|
get patientProgressNoteList => _patientProgressNoteList;
|
|
|
|
|
|
|
|
|
|
// TODO: replace var with model
|
|
|
|
|
var _insuranceApporvalsList = [];
|
|
|
|
|
|
|
|
|
|
get insuranceApporvalsList => _insuranceApporvalsList;
|
|
|
|
|
|
|
|
|
|
// TODO: replace var with model
|
|
|
|
|
var doctorsList = [];
|
|
|
|
|
var _doctorsList = [];
|
|
|
|
|
|
|
|
|
|
get doctorsList => _doctorsList;
|
|
|
|
|
|
|
|
|
|
// TODO: replace var with model
|
|
|
|
|
var clinicsList = [];
|
|
|
|
|
var _clinicsList = [];
|
|
|
|
|
|
|
|
|
|
get clinicsList => _clinicsList;
|
|
|
|
|
|
|
|
|
|
// TODO: replace var with model
|
|
|
|
|
var referalFrequancyList = [];
|
|
|
|
|
var _referalFrequancyList = [];
|
|
|
|
|
|
|
|
|
|
get referalFrequancyList => _referalFrequancyList;
|
|
|
|
|
|
|
|
|
|
DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
|
|
|
|
|
DoctorsByClinicIdRequest();
|
|
|
|
@ -69,6 +84,47 @@ class PatientService extends BaseService {
|
|
|
|
|
|
|
|
|
|
RequestSchedule _requestSchedule = RequestSchedule();
|
|
|
|
|
|
|
|
|
|
Future<dynamic> getPatientList(PatientModel patient, patientType) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
int val = int.parse(patientType);
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
GET_PATIENT + SERVICES_PATIANT[val],
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
localRes = response;
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
},
|
|
|
|
|
body: {
|
|
|
|
|
"ProjectID": patient.ProjectID,
|
|
|
|
|
"ClinicID": patient.ClinicID,
|
|
|
|
|
"DoctorID": patient.DoctorID,
|
|
|
|
|
"FirstName": patient.FirstName,
|
|
|
|
|
"MiddleName": patient.MiddleName,
|
|
|
|
|
"LastName": patient.LastName,
|
|
|
|
|
"PatientMobileNumber": patient.PatientMobileNumber,
|
|
|
|
|
"PatientIdentificationID": patient.PatientIdentificationID,
|
|
|
|
|
"PatientID": patient.PatientID,
|
|
|
|
|
"From": patient.From,
|
|
|
|
|
"To": patient.To,
|
|
|
|
|
"LanguageID": patient.LanguageID,
|
|
|
|
|
"stamp": patient.stamp,
|
|
|
|
|
"IPAdress": patient.IPAdress,
|
|
|
|
|
"VersionID": patient.VersionID,
|
|
|
|
|
"Channel": patient.Channel,
|
|
|
|
|
"TokenID": patient.TokenID,
|
|
|
|
|
"SessionID": patient.SessionID,
|
|
|
|
|
"IsLoginForDoctorApp": patient.IsLoginForDoctorApp,
|
|
|
|
|
"PatientOutSA": patient.PatientOutSA
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return Future.value(localRes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getPatientVitalSign(patient) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
@ -219,6 +275,7 @@ class PatientService extends BaseService {
|
|
|
|
|
body: requestLabResult.toJson(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getPatientInsuranceApprovals(patient) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
@ -227,7 +284,6 @@ class PatientService extends BaseService {
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_insuranceApporvalsList = [];
|
|
|
|
|
_insuranceApporvalsList = response['List_ApprovalMain_InPatient'];
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
@ -236,6 +292,7 @@ class PatientService extends BaseService {
|
|
|
|
|
body: patient,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getPatientProgressNote(patient) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
@ -244,7 +301,6 @@ class PatientService extends BaseService {
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_patientProgressNoteList = [];
|
|
|
|
|
_patientProgressNoteList = response['List_GetPregressNoteForInPatient'];
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
@ -253,4 +309,104 @@ class PatientService extends BaseService {
|
|
|
|
|
body: patient,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future getClinicsList() async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
PATIENT_GET_CLINIC_BY_PROJECT_URL,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_clinicsList = [];
|
|
|
|
|
_clinicsList = response['List_Clinic_All'];
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
},
|
|
|
|
|
body: _clinicByProjectIdRequest.toJson(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future getReferralFrequancyList() async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
PATIENT_GET_LIST_REFERAL_URL,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_referalFrequancyList = [];
|
|
|
|
|
_referalFrequancyList = response['list_STPReferralFrequency'];
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
},
|
|
|
|
|
body: _referralFrequencyRequest.toJson(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getDoctorsList(String clinicId) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
_doctorsByClinicIdRequest.clinicID = clinicId;
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
PATIENT_GET_DOCTOR_BY_CLINIC_URL,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_doctorsList = [];
|
|
|
|
|
_doctorsList = response['List_Doctors_All'];
|
|
|
|
|
},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
},
|
|
|
|
|
body: _doctorsByClinicIdRequest.toJson(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO send the total model insted of each parameter
|
|
|
|
|
Future referToDoctor({String selectedDoctorID,
|
|
|
|
|
String selectedClinicID,
|
|
|
|
|
int admissionNo,
|
|
|
|
|
String extension,
|
|
|
|
|
String priority,
|
|
|
|
|
String frequency,
|
|
|
|
|
String referringDoctorRemarks,
|
|
|
|
|
int patientID,
|
|
|
|
|
int patientTypeID,
|
|
|
|
|
String roomID,
|
|
|
|
|
int projectID}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
// TODO Change it to use it when we implement authentication user
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
|
|
|
|
|
int doctorID = doctorProfile.doctorID;
|
|
|
|
|
int clinicId = doctorProfile.clinicID;
|
|
|
|
|
_referToDoctorRequest = ReferToDoctorRequest(
|
|
|
|
|
projectID: projectID,
|
|
|
|
|
admissionNo: admissionNo,
|
|
|
|
|
roomID: roomID,
|
|
|
|
|
referralClinic: selectedClinicID.toString(),
|
|
|
|
|
referralDoctor: selectedDoctorID.toString(),
|
|
|
|
|
createdBy: doctorID,
|
|
|
|
|
editedBy: doctorID,
|
|
|
|
|
patientID: patientID,
|
|
|
|
|
patientTypeID: patientTypeID,
|
|
|
|
|
referringClinic: clinicId,
|
|
|
|
|
referringDoctor: doctorID,
|
|
|
|
|
referringDoctorRemarks: referringDoctorRemarks,
|
|
|
|
|
priority: priority,
|
|
|
|
|
frequency: frequency,
|
|
|
|
|
extension: extension,
|
|
|
|
|
);
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
PATIENT_PROGRESS_NOTE_URL,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {},
|
|
|
|
|
onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
},
|
|
|
|
|
body: _referToDoctorRequest.toJson(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|