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.
RSGDoctorApp/lib/core/service/PatientRegistrationService....

92 lines
4.3 KiB
Dart

import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart';
import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart';
import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart';
import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoResponseModel.dart';
import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart';
import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart';
class PatientRegistrationService extends BaseService {
GetPatientInfoResponseModel? getPatientInfoResponseModel;
String? logInTokenID;
checkPatientForRegistration(CheckPatientForRegistrationModel registrationModel) async {
hasError = false;
await baseAppClient.post(CHECK_PATIENT_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) {
//TODO Elham* fix it
logInTokenID = "OjEi/qgRekGICZm5/a4jbQ=="; //response["LogInTokenID"];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: registrationModel.toJson());
}
getPatientInfo(GetPatientInfoRequestModel getPatientInfoRequestMode) async {
hasError = false;
await baseAppClient.post(GET_PATIENT_INFO, onSuccess: (dynamic response, int statusCode) {
getPatientInfoResponseModel = GetPatientInfoResponseModel.fromJson(response);
print("ddd");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: getPatientInfoRequestMode.toJson());
}
sendActivationCodeByOTPNotificationType(
{SendActivationCodeByOTPNotificationTypeForRegistrationModel? registrationModel,
int? otpType,
PatientRegistrationViewModel? model,
CheckPatientForRegistrationModel? checkPatientForRegistrationModel}) async {
registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel(
oTPSendType: otpType,
patientIdentificationID: checkPatientForRegistrationModel!.patientIdentificationID,
patientMobileNumber: checkPatientForRegistrationModel.patientMobileNumber,
zipCode: checkPatientForRegistrationModel.zipCode,
patientOutSA: 0,
healthId: model!.getPatientInfoResponseModel.healthId,
dOB: checkPatientForRegistrationModel.dOB,
isRegister: checkPatientForRegistrationModel.isRegister,
isHijri: checkPatientForRegistrationModel.isHijri,
sessionID: null,
generalid: GENERAL_ID,
isDentalAllowedBackend: false,
projectOutSA: 0,
searchType: 1,
versionID: 7.1,
channel: 3,
nationalID: model.checkPatientForRegistrationModel!.patientIdentificationID,
patientID: 0,
mobileNo: model.checkPatientForRegistrationModel!.patientMobileNumber.toString(),
loginType: otpType,
logInTokenID: logInTokenID);
hasError = false;
await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) {
registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: registrationModel.toJson());
}
checkActivationCode(CheckActivationCodeModel registrationModel) async {
hasError = false;
await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, onSuccess: (dynamic response, int statusCode) {
registrationModel = CheckActivationCodeModel.fromJson(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: registrationModel.toJson());
}
registrationPatient(PatientRegistrationModel registrationModel) async {
hasError = false;
await baseAppClient.post(PATIENT_REGISTRATION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: registrationModel.toJson());
}
}