Merge branch 'refactor' into 'development'
Refactor See merge request Cloud_Solution/doctor_app_flutter!181pull/184/head
commit
512036f9a6
@ -1,23 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/hospitals_model.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
|
||||
///This service just an example
|
||||
class HospitalService extends BaseService {
|
||||
List<HospitalsModel> _hospitals = List();
|
||||
|
||||
List<HospitalsModel> get hospitals => _hospitals;
|
||||
|
||||
Future getHospitals() async {
|
||||
await baseAppClient.post(GET_PROJECTS,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
_hospitals.clear();
|
||||
response['ListProject'].forEach((hospital) {
|
||||
_hospitals.add(HospitalsModel.fromJson(hospital));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: Map());
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,31 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/hospitals_model.dart';
|
||||
import 'package:doctor_app_flutter/core/service/hospital/hospitals_service.dart';
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
import 'base_view_model.dart';
|
||||
// TODO change it when change login
|
||||
class HospitalViewModel with ChangeNotifier {
|
||||
BaseAppClient baseAppClient = BaseAppClient();
|
||||
|
||||
///This View Model just an example
|
||||
class HospitalViewModel extends BaseViewModel {
|
||||
HospitalService _hospitalService = locator<HospitalService>();
|
||||
Future<Map> getProjectsList() async {
|
||||
const url = GET_PROJECTS;
|
||||
// TODO create model or remove it if no info need
|
||||
var info = {
|
||||
"LanguageID": 1,
|
||||
"stamp": "2020-02-26T13:51:44.111Z",
|
||||
"IPAdress": "11.11.11.11",
|
||||
"VersionID": 1.2,
|
||||
"Channel": 9,
|
||||
"TokenID": "",
|
||||
"SessionID": "i1UJwCTSqt",
|
||||
"IsLoginForDoctorApp": true
|
||||
};
|
||||
dynamic localRes;
|
||||
|
||||
List<HospitalsModel> get hospitals => _hospitalService.hospitals;
|
||||
|
||||
Future getHospitals() async {
|
||||
setState(ViewState.Busy);
|
||||
await _hospitalService.getHospitals();
|
||||
if (_hospitalService.hasError) {
|
||||
error = _hospitalService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
await baseAppClient.post(url, onSuccess: (response, statusCode) async {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
throw error;
|
||||
}, body: info);
|
||||
return Future.value(localRes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class HospitalProvider with ChangeNotifier {
|
||||
BaseAppClient baseAppClient = BaseAppClient();
|
||||
|
||||
Future<Map> getProjectsList() async {
|
||||
const url = GET_PROJECTS;
|
||||
var info = {
|
||||
"LanguageID": 1,
|
||||
"stamp": "2020-02-26T13:51:44.111Z",
|
||||
"IPAdress": "11.11.11.11",
|
||||
"VersionID": 1.2,
|
||||
"Channel": 9,
|
||||
"TokenID": "",
|
||||
"SessionID": "i1UJwCTSqt",
|
||||
"IsLoginForDoctorApp": true
|
||||
};
|
||||
dynamic localRes;
|
||||
|
||||
await baseAppClient.post(url, onSuccess: (response, statusCode) async {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
throw error;
|
||||
}, body: info);
|
||||
return Future.value(localRes);
|
||||
}
|
||||
}
|
||||
@ -1,282 +0,0 @@
|
||||
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.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';
|
||||
import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequency_request.dart';
|
||||
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/patiant_info_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';
|
||||
import 'package:doctor_app_flutter/models/patient/radiology/radiology_res_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../config/config.dart';
|
||||
import '../models/patient/lab_orders/lab_orders_res_model.dart';
|
||||
import '../models/patient/patiant_info_model.dart';
|
||||
import '../models/patient/patient_model.dart';
|
||||
import '../models/patient/prescription/prescription_res_model.dart';
|
||||
import '../models/patient/radiology/radiology_res_model.dart';
|
||||
import '../models/patient/vital_sign/vital_sign_res_model.dart';
|
||||
import '../util/helpers.dart';
|
||||
|
||||
Helpers helpers = Helpers();
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
class PatientsProvider with ChangeNotifier {
|
||||
bool isLoading = false;
|
||||
bool isError = false;
|
||||
String error = '';
|
||||
List<VitalSignResModel> patientVitalSignList = [];
|
||||
List<VitalSignResModel> patientVitalSignOrderdSubList = [];
|
||||
List<LabOrdersResModel> patientLabResultOrdersList = [];
|
||||
List<PrescriptionResModel> patientPrescriptionsList = [];
|
||||
List<RadiologyResModel> patientRadiologyList = [];
|
||||
List<PrescriptionReportForInPatient> prescriptionReportForInPatientList = [];
|
||||
List<PrescriptionReport> prescriptionReport = [];
|
||||
BaseAppClient baseAppClient = BaseAppClient();
|
||||
|
||||
/*@author: ibrahe albitar
|
||||
*@Date:2/6/2020
|
||||
*@desc: getPatientPrescriptions
|
||||
*/
|
||||
|
||||
List<LabResult> labResultList = [];
|
||||
|
||||
var patientProgressNoteList = [];
|
||||
var insuranceApporvalsList = [];
|
||||
|
||||
var doctorsList = [];
|
||||
var clinicsList = [];
|
||||
var referalFrequancyList = [];
|
||||
|
||||
DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
|
||||
DoctorsByClinicIdRequest();
|
||||
STPReferralFrequencyRequest _referralFrequencyRequest =
|
||||
STPReferralFrequencyRequest();
|
||||
ClinicByProjectIdRequest _clinicByProjectIdRequest =
|
||||
ClinicByProjectIdRequest();
|
||||
ReferToDoctorRequest _referToDoctorRequest;
|
||||
|
||||
PatiantInformtion _selectedPatient;
|
||||
|
||||
Future<dynamic> getPatientList(PatientModel patient, patientType) async {
|
||||
int val = int.parse(patientType);
|
||||
|
||||
try {
|
||||
dynamic localRes;
|
||||
await baseAppClient.post(GET_PATIENT + SERVICES_PATIANT[val],
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
localRes = response;
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
throw 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);
|
||||
} catch (error) {
|
||||
print(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
setBasicData() {
|
||||
isLoading = true;
|
||||
isError = false;
|
||||
error = '';
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*@author: Elham Rababah
|
||||
*@Date:12/5/2020
|
||||
*@param: patient
|
||||
*@return:
|
||||
*@desc: getPatientRadiology
|
||||
*/
|
||||
handelCatchErrorCase(err) {
|
||||
isLoading = false;
|
||||
isError = true;
|
||||
error = helpers.generateContactAdminMsg(err);
|
||||
notifyListeners();
|
||||
throw err;
|
||||
}
|
||||
|
||||
// /*@author: ibrahem albitar
|
||||
// *@Date:3/6/2020
|
||||
// *@desc: getDoctorsList
|
||||
// */
|
||||
// getDoctorsList(String clinicId) async {
|
||||
// setBasicData();
|
||||
// try {
|
||||
// _doctorsByClinicIdRequest.clinicID = clinicId;
|
||||
// await baseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL,
|
||||
// onSuccess: (dynamic response, int statusCode) {
|
||||
// doctorsList = response['List_Doctors_All'];
|
||||
// isLoading = false;
|
||||
// isError = false;
|
||||
// this.error = '';
|
||||
// }, onFailure: (String error, int statusCode) {
|
||||
// isLoading = false;
|
||||
// isError = true;
|
||||
// this.error = error;
|
||||
// }, body: _doctorsByClinicIdRequest.toJson());
|
||||
// notifyListeners();
|
||||
// } catch (err) {
|
||||
// handelCatchErrorCase(err);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List getDoctorNameList() {
|
||||
// var doctorNamelist =
|
||||
// doctorsList.map((value) => value['DoctorName'].toString()).toList();
|
||||
// return doctorNamelist;
|
||||
// }
|
||||
//
|
||||
// /*@author: ibrahem albitar
|
||||
// *@Date:3/6/2020
|
||||
// *@desc: getClinicsList
|
||||
// */
|
||||
// getClinicsList() async {
|
||||
// setBasicData();
|
||||
// try {
|
||||
// await baseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL,
|
||||
// onSuccess: (dynamic response, int statusCode) {
|
||||
// clinicsList = response['List_Clinic_All'];
|
||||
// isLoading = false;
|
||||
// isError = false;
|
||||
// this.error = '';
|
||||
// }, onFailure: (String error, int statusCode) {
|
||||
// isLoading = false;
|
||||
// isError = true;
|
||||
// this.error = error;
|
||||
// }, body: _clinicByProjectIdRequest.toJson());
|
||||
// notifyListeners();
|
||||
// } catch (err) {
|
||||
// handelCatchErrorCase(err);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List getClinicNameList() {
|
||||
// var clinicsNameslist = clinicsList
|
||||
// .map((value) => value['ClinicDescription'].toString())
|
||||
// .toList();
|
||||
// return clinicsNameslist;
|
||||
// }
|
||||
//
|
||||
// /*@author: ibrahem albitar
|
||||
// *@Date:3/6/2020
|
||||
// *@desc: getReferralFrequancyList
|
||||
// */
|
||||
// getReferralFrequancyList() async {
|
||||
// setBasicData();
|
||||
// try {
|
||||
// await baseAppClient.post(PATIENT_GET_LIST_REFERAL_URL,
|
||||
// onSuccess: (dynamic response, int statusCode) {
|
||||
// referalFrequancyList = response['list_STPReferralFrequency'];
|
||||
// isLoading = false;
|
||||
// isError = false;
|
||||
// this.error = '';
|
||||
// }, onFailure: (String error, int statusCode) {
|
||||
// isLoading = false;
|
||||
// isError = true;
|
||||
// this.error = error;
|
||||
// }, body: _referralFrequencyRequest.toJson());
|
||||
// notifyListeners();
|
||||
// } catch (err) {
|
||||
// handelCatchErrorCase(err);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List getReferralNamesList() {
|
||||
// var referralNamesList = referalFrequancyList
|
||||
// .map((value) => value['Description'].toString())
|
||||
// .toList();
|
||||
// return referralNamesList;
|
||||
// }
|
||||
|
||||
/*@author: ibrahem albitar
|
||||
*@Date:3/6/2020
|
||||
*@desc: referToDoctor
|
||||
*/
|
||||
// referToDoctor(context,
|
||||
// {String selectedDoctorID,
|
||||
// String selectedClinicID,
|
||||
// int admissionNo,
|
||||
// String extension,
|
||||
// String priority,
|
||||
// String frequency,
|
||||
// String referringDoctorRemarks,
|
||||
// int patientID,
|
||||
// int patientTypeID,
|
||||
// String roomID,
|
||||
// int projectID}) async {
|
||||
// setBasicData();
|
||||
// try {
|
||||
// String token = await sharedPref.getString(TOKEN);
|
||||
// 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,
|
||||
// tokenID: token);
|
||||
// await baseAppClient.post(PATIENT_REFER_TO_DOCTOR_URL,
|
||||
// onSuccess: (dynamic response, int statusCode) {
|
||||
// // print('Done : \n $res');
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// onFailure: (String error, int statusCode) {
|
||||
// isLoading = false;
|
||||
// isError = true;
|
||||
// this.error = error;
|
||||
// },
|
||||
// body: _referToDoctorRequest.toJson());
|
||||
// notifyListeners();
|
||||
//
|
||||
// } catch (err) {
|
||||
// handelCatchErrorCase(err);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue