From 550c9e6105ed89ba4b3bc10cb1411250023e4d6f Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Wed, 21 Dec 2022 15:15:30 +0300 Subject: [PATCH] structure 1.2 --- lib/config/dependencies.dart | 3 +- lib/services/api_repo/patient_api_repo.dart | 80 --------------------- 2 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 lib/services/api_repo/patient_api_repo.dart diff --git a/lib/config/dependencies.dart b/lib/config/dependencies.dart index b9d0130..87e5398 100644 --- a/lib/config/dependencies.dart +++ b/lib/config/dependencies.dart @@ -4,7 +4,7 @@ import 'package:hmg_flutter_template/config/app_state.dart'; import 'package:hmg_flutter_template/services/api_client.dart'; import 'package:hmg_flutter_template/services/api_repo/dashboard_api_repo.dart'; import 'package:hmg_flutter_template/services/api_repo/login_api_repo.dart'; -import 'package:hmg_flutter_template/services/api_repo/patient_api_repo.dart'; + import 'package:hmg_flutter_template/services/firebase_service.dart'; import 'package:injector/injector.dart'; @@ -22,6 +22,5 @@ class AppDependencies { //repos injector.registerSingleton(() => LoginApiRepo()); injector.registerSingleton(() => DashboardApiRepo()); - injector.registerSingleton(() => PatientApiRepo()); } } diff --git a/lib/services/api_repo/patient_api_repo.dart b/lib/services/api_repo/patient_api_repo.dart deleted file mode 100644 index 4ca2310..0000000 --- a/lib/services/api_repo/patient_api_repo.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'dart:convert'; - -import 'package:hmg_flutter_template/classes/consts.dart'; -import 'package:hmg_flutter_template/main.dart'; -import 'package:hmg_flutter_template/model/base/generic_response_model.dart'; -import 'package:hmg_flutter_template/services/api_client.dart'; -import 'package:injector/injector.dart'; - -abstract class IPatientApiRepo { - Future getPatientInfo(int patientID); - - Future getVitalSigns({int? patientID, int? patientTypeID, int? inOutPatientType, bool isDentalAllowedBackend, int? doctorID, int setupID, int? patientType}); -} - -class PatientApiRepo implements IPatientApiRepo { - @override - Future getPatientInfo(int patientID) async { - String url = "${ApiConsts.baseUrlServices}Patients.svc/REST/GetPatientInformation_PRM"; - Map postParams = {}; - - postParams.addAll(appState.postParamsJson); - postParams["FirstName"] = "0"; - postParams["MiddleName"] = "0"; - postParams["LastName"] = "0"; - postParams["PatientMobileNumber"] = "0"; - postParams["PatientIdentificationID"] = "0"; - postParams["PatientID"] = patientID; - postParams["From"] = "0"; - postParams["To"] = "0"; - postParams["SearchType"] = 1; - postParams["MobileNo"] = ""; - postParams["IdentificationNo"] = "0"; - postParams["NursingStationID"] = "0"; - GenericResponseModel response; - print(jsonEncode(postParams)); - // return GenericResponseModel(); - try { - response = await Injector.appInstance.get().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams); - } catch (e) { - rethrow; - } - return response; - } - - @override - Future getVitalSigns({int? patientID, int? patientTypeID, int? inOutPatientType, bool? isDentalAllowedBackend, int? doctorID, int? setupID, int? patientType}) async { - String url = "${ApiConsts.baseUrlServices}Doctors.svc/REST/Doctor_GetPatientVitalSign"; - Map postParams = {}; - - // { - // "PatientID": 12, - // "PatientTypeID": 1, - // "InOutPatientType": 0, - // "isDentalAllowedBackend": false, - // "DoctorID": 2477, - // "SetupID": "91877", - // "PatientType": 1, - // } - - postParams.addAll(appState.postParamsJson); - postParams["PatientID"] = patientID; - postParams["PatientTypeID"] = patientTypeID; - postParams["InOutPatientType"] = inOutPatientType; - postParams["isDentalAllowedBackend"] = isDentalAllowedBackend; - postParams["DoctorID"] = doctorID; - postParams["SetupID"] = setupID; - postParams["PatientType"] = patientType; - postParams.remove("ProjectID"); - postParams.remove("ClinicID"); - - GenericResponseModel response; - // return GenericResponseModel(); - try { - response = await Injector.appInstance.get().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams); - } catch (e) { - rethrow; - } - return response; - } -}