You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
5.9 KiB
Dart

import 'dart:convert';
import 'package:hmg_flutter_template/exceptions/api_exception.dart';
import 'package:hmg_flutter_template/main.dart';
import 'package:hmg_flutter_template/model/base/generic_response_model2.dart';
import 'package:hmg_flutter_template/model/login/member_login_model.dart';
import 'package:hmg_flutter_template/model/login/project_info_model.dart';
import 'package:hmg_flutter_template/services/api_client.dart';
import 'package:hmg_flutter_template/classes/consts.dart';
import 'package:hmg_flutter_template/model/base/generic_response_model.dart';
import 'package:hmg_flutter_template/model/login/imei_details_model.dart';
import 'package:hmg_flutter_template/services/firebase_service.dart';
import 'package:injector/injector.dart';
abstract class IDashboardApiRepo {
Future<GenericResponseModel2> getDoctorProfile();
Future insertDoctorProfile();
}
class DashboardApiRepo implements IDashboardApiRepo {
@override
Future<GenericResponseModel2> getDoctorProfile() async {
String url = "${ApiConsts.baseUrlServices}Doctors.svc/REST/GetDocProfiles";
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["ProjectID"] = appState.projectID;
postParams["ClinicID"] = appState.clinicId;
postParams["doctorID"] = appState.memberBeforeLogin!.doctorId;
postParams["IsRegistered"] = true;
postParams["License"] = true;
postParams["TokenID"] = appState.authenticationTokenID;
postParams["DoctorID"] = appState.memberBeforeLogin!.doctorId;
postParams["PatientOutSA"] = false;
GenericResponseModel2 response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel2.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
return response;
}
@override
Future insertDoctorProfile() async {
String url = "${ApiConsts.baseUrlServices}DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails";
Map<String, dynamic> postParams = {};
postParams.addAll(appState.postParamsJson);
postParams["IMEI"] = appState.imei;
postParams["LogInTypeID"] = appState.lastLoginTyp;
postParams["OutSA"] = null;
postParams["MobileNo"] = appState.doctorProfile!.doctorProfileList!.first.doctorMobileNumber;
postParams["IdentificationNo"] = null;
postParams["DoctorID"] = appState.doctorUserId;
postParams["DoctorName"] = appState.doctorProfile!.doctorProfileList!.first.doctorName;
postParams["DoctorNameN"] = appState.doctorProfile!.doctorProfileList!.first.doctorNameN;
postParams["ClinicID"] = appState.doctorProfile!.doctorProfileList!.first.clinicId;
postParams["ClinicDescription"] = appState.doctorProfile!.doctorProfileList!.first.clinicDescription;
postParams["ClinicDescriptionN"] = appState.doctorProfile!.doctorProfileList!.first.clinicDescriptionN;
postParams["ProjectName"] = appState.doctorProfile!.doctorProfileList!.first.projectName;
postParams["GenderDescription"] = appState.doctorProfile!.doctorProfileList!.first.genderDescription;
postParams["GenderDescriptionN"] = appState.doctorProfile!.doctorProfileList!.first.genderDescriptionN;
postParams["TitleDescription"] = appState.doctorProfile!.doctorProfileList!.first.titleDescription;
postParams["Title_DescriptionN"] = appState.doctorProfile!.doctorProfileList!.first.titleDescriptionN;
postParams["BioMetricEnabled"] = true;
postParams["PreferredLanguage"] = null;
postParams["IsActive"] = appState.doctorProfile!.doctorProfileList!.first.isActive;
postParams["EditedBy"] = appState.doctorProfile!.doctorProfileList!.first.doctorId;
postParams["ProjectID"] = appState.doctorProfile!.doctorProfileList!.first.projectId;
postParams["TokenID"] = appState.authenticationTokenID;
postParams["LoginDoctorID"] = appState.doctorProfile!.doctorProfileList!.first.doctorId;
postParams["Password"] = appState.password;
logger.d(jsonEncode(postParams));
GenericResponseModel response;
try {
response = await Injector.appInstance.get<IApiClient>().postJsonForObject((json) => GenericResponseModel.fromJson(json), url, postParams);
} catch (e) {
rethrow;
}
return null;
}
}
// {
// "IMEI": "es6V9NcpSzCXR665uSDWGo:APA91bGF_FjdOf8ZOZmw5FU7pkDfzNOvkz-IsSBRrJE6OR0ZE2lyeTxzFtvjZEajUEC_ssD6ytKNEm74lm30KpZEvPdrNgSRR8idlGrRqJ6qK2Lp2lrLtgA1OLMjkkQS1bcpvXcdnEg_",
// "LogInTypeID": 1,
// "OutSA": null,
// "MobileNo": "0553755378",
// "IdentificationNo": null,
// "DoctorID": 13777,
// "DoctorName": "EYAD ISMAIL ABU-JAYAB",
// "DoctorNameN": null,
// "ClinicID": 1,
// "ClinicDescription": "INTERNAL MEDICINE CLINIC",
// "ClinicDescriptionN": null,
// "ProjectName": "Olaya Hospital",
// "GenderDescription": "Male",
// "GenderDescriptionN": null,
// "TitleDescription": "Dr.",
// "Title_DescriptionN": null,
// "BioMetricEnabled": true,
// "PreferredLanguage": null,
// "IsActive": false,
// "EditedBy": 2477,
// "ProjectID": 12,
// "TokenID": "W7qObFELE0+VAtKJoTeq+w==",
// "LanguageID": 2,
// "stamp": "2022-11-27T10:50:25.345098",
// "IPAdress": "9.9.9.9",
// "VersionID": 9,
// "Channel": 9,
// "SessionID": "BlUSkYymTt",
// "IsLoginForDoctorApp": true,
// "PatientOutSA": false,
// "VidaAuthTokenID": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzc3NyIsImp0aSI6IjNiM2U5MTU4LTJhNmEtNGM4MS04OTk5LWU3ZTRhYzUzMmFiOCIsImVtYWlsIjoiUndhaWQuQWxtYWxsYWhAY2xvdWRzb2x1dGlvbnMuY29tLnNhIiwiaWQiOiIxMzc3NyIsIk5hbWUiOiJSd2FpZCBGb3VkIEhhc3NhbiBBbE1hbGxhaCIsIkVtcGxveWVlSWQiOiIyNDc3IiwiRmFjaWxpdHlHcm91cElkIjoiOTE4NzciLCJGYWNpbGl0eUlkIjoiMTIiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NiIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjI0NzciLCJTRVNTSU9OSUQiOiIyMDYzNDY2OCIsIkNsaW5pY0lkIjoiMSIsIm5iZiI6MTY2OTUzNTQxMSwiZXhwIjoxNjcwMzk5NDExLCJpYXQiOjE2Njk1MzU0MTF9.LkZMiDAt9F4yjbuNyMSIcZYIgct6VuPed7uPOw0PTVw",
// "VidaRefreshTokenID": "sm30FcA2iL0lJmSCAVlNJJ8e0AbfYzHxg+wMGTBSoP9VM9do55BRxjATjBtOJyo60u8tLRk9LHrmmH8Xn+B25A==",
// "Password": "Rr123456",
// "LoginDoctorID": 2477,
// "DeviceTypeID": 1
// }