structure 1.2

main
mirza.shafique 3 years ago
parent 0939d77fec
commit 550c9e6105

@ -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<ILoginApiRepo>(() => LoginApiRepo());
injector.registerSingleton<IDashboardApiRepo>(() => DashboardApiRepo());
injector.registerSingleton<IPatientApiRepo>(() => PatientApiRepo());
}
}

@ -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<GenericResponseModel> getPatientInfo(int patientID);
Future<GenericResponseModel> getVitalSigns({int? patientID, int? patientTypeID, int? inOutPatientType, bool isDentalAllowedBackend, int? doctorID, int setupID, int? patientType});
}
class PatientApiRepo implements IPatientApiRepo {
@override
Future<GenericResponseModel> getPatientInfo(int patientID) async {
String url = "${ApiConsts.baseUrlServices}Patients.svc/REST/GetPatientInformation_PRM";
Map<String, dynamic> 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<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
return response;
}
@override
Future<GenericResponseModel> 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<String, dynamic> 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<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
return response;
}
}
Loading…
Cancel
Save