|
|
|
@ -9,10 +9,9 @@ import 'package:hmg_patient_app_new/services/logger_service.dart';
|
|
|
|
|
|
|
|
|
|
|
|
abstract class MyAppointmentsRepo {
|
|
|
|
abstract class MyAppointmentsRepo {
|
|
|
|
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments(
|
|
|
|
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments(
|
|
|
|
{required String patientId, required bool isActiveAppointment, required bool isArrivedAppointments});
|
|
|
|
{required bool isActiveAppointment, required bool isArrivedAppointments});
|
|
|
|
|
|
|
|
|
|
|
|
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment(
|
|
|
|
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment({required int projectID, required int clinicID, required String appointmentNo});
|
|
|
|
{required String patientId, required int projectID, required int clinicID, required String appointmentNo});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> createAdvancePayment(
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> createAdvancePayment(
|
|
|
|
{required String paymentMethodName,
|
|
|
|
{required String paymentMethodName,
|
|
|
|
@ -26,7 +25,9 @@ abstract class MyAppointmentsRepo {
|
|
|
|
|
|
|
|
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, required String appointmentNo});
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, required String appointmentNo});
|
|
|
|
|
|
|
|
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> generateAppointmentQR({required String clinicID, required String projectID, required String appointmentNo, required int isFollowUp});
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> generateAppointmentQR({required int clinicID, required int projectID, required String appointmentNo, required int isFollowUp});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<Either<Failure, GenericApiModel<dynamic>>> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
@ -37,8 +38,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments(
|
|
|
|
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments(
|
|
|
|
{required String patientId, required bool isActiveAppointment, required bool isArrivedAppointments}) async {
|
|
|
|
{required bool isActiveAppointment, required bool isArrivedAppointments}) async {
|
|
|
|
final mapDevice = {
|
|
|
|
Map<String, dynamic> mapDevice = {
|
|
|
|
"IsActiveAppointment": isActiveAppointment,
|
|
|
|
"IsActiveAppointment": isActiveAppointment,
|
|
|
|
"isDentalAllowedBackend": false,
|
|
|
|
"isDentalAllowedBackend": false,
|
|
|
|
"PatientTypeID": 1,
|
|
|
|
"PatientTypeID": 1,
|
|
|
|
@ -61,9 +62,9 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
|
|
|
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
final list = response['AppoimentAllHistoryResultList'];
|
|
|
|
final list = response['AppoimentAllHistoryResultList'];
|
|
|
|
if (list == null || list.isEmpty) {
|
|
|
|
// if (list == null || list.isEmpty) {
|
|
|
|
throw Exception("Appointments list is empty");
|
|
|
|
// throw Exception("Appointments list is empty");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
final appointmentsList = list.map((item) => PatientAppointmentHistoryResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientAppointmentHistoryResponseModel>();
|
|
|
|
final appointmentsList = list.map((item) => PatientAppointmentHistoryResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientAppointmentHistoryResponseModel>();
|
|
|
|
|
|
|
|
|
|
|
|
@ -87,19 +88,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment(
|
|
|
|
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment({required int projectID, required int clinicID, required String appointmentNo}) async {
|
|
|
|
{required String patientId, required int projectID, required int clinicID, required String appointmentNo}) async {
|
|
|
|
Map<String, dynamic> mapRequest = {"ProjectID": projectID, "ClinicID": clinicID, "AppointmentNo": appointmentNo, "IsActiveAppointment": true};
|
|
|
|
final mapRequest = {
|
|
|
|
|
|
|
|
"ProjectID": projectID,
|
|
|
|
|
|
|
|
"ClinicID": clinicID,
|
|
|
|
|
|
|
|
"AppointmentNo": appointmentNo,
|
|
|
|
|
|
|
|
"IsActiveAppointment": true,
|
|
|
|
|
|
|
|
"PatientOutSA": 0,
|
|
|
|
|
|
|
|
"isDentalAllowedBackend": false,
|
|
|
|
|
|
|
|
"PatientID": patientId,
|
|
|
|
|
|
|
|
"PatientTypeID": 1,
|
|
|
|
|
|
|
|
"PatientType": 1,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse;
|
|
|
|
GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse;
|
|
|
|
@ -139,8 +129,6 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
return Left(UnknownFailure(e.toString()));
|
|
|
|
return Left(UnknownFailure(e.toString()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
throw UnimplementedError();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -154,7 +142,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
required String patientID,
|
|
|
|
required String patientID,
|
|
|
|
required int patientType,
|
|
|
|
required int patientType,
|
|
|
|
}) async {
|
|
|
|
}) async {
|
|
|
|
final requestBody = {
|
|
|
|
Map<String, dynamic> requestBody = {
|
|
|
|
"ProjectID": projectID,
|
|
|
|
"ProjectID": projectID,
|
|
|
|
"OnlineCheckInAppointment": {
|
|
|
|
"OnlineCheckInAppointment": {
|
|
|
|
"AppointmentNo": appointmentNo,
|
|
|
|
"AppointmentNo": appointmentNo,
|
|
|
|
@ -202,7 +190,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Future<Either<Failure, GenericApiModel>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, required String appointmentNo}) async {
|
|
|
|
Future<Either<Failure, GenericApiModel>> addAdvanceNumberRequest({required String advanceNumber, required String paymentReference, required String appointmentNo}) async {
|
|
|
|
final requestBody = {
|
|
|
|
Map<String, dynamic> requestBody = {
|
|
|
|
"AdvanceNumber": advanceNumber,
|
|
|
|
"AdvanceNumber": advanceNumber,
|
|
|
|
"AdvanceNumber_VP": advanceNumber,
|
|
|
|
"AdvanceNumber_VP": advanceNumber,
|
|
|
|
"PaymentReferenceNumber": paymentReference,
|
|
|
|
"PaymentReferenceNumber": paymentReference,
|
|
|
|
@ -240,8 +228,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Future<Either<Failure, GenericApiModel>> generateAppointmentQR({required String clinicID, required String projectID, required String appointmentNo, required int isFollowUp}) async {
|
|
|
|
Future<Either<Failure, GenericApiModel>> generateAppointmentQR({required int clinicID, required int projectID, required String appointmentNo, required int isFollowUp}) async {
|
|
|
|
final requestBody = {
|
|
|
|
Map<String, dynamic> requestBody = {
|
|
|
|
"AppointmentNo": appointmentNo,
|
|
|
|
"AppointmentNo": appointmentNo,
|
|
|
|
"ClinicID": clinicID,
|
|
|
|
"ClinicID": clinicID,
|
|
|
|
"ProjectID": projectID,
|
|
|
|
"ProjectID": projectID,
|
|
|
|
@ -277,4 +265,49 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
|
|
|
|
return Left(UnknownFailure(e.toString()));
|
|
|
|
return Left(UnknownFailure(e.toString()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
Future<Either<Failure, GenericApiModel>> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}) async {
|
|
|
|
|
|
|
|
Map<String, dynamic> requestBody = {
|
|
|
|
|
|
|
|
"AppointmentID": patientAppointmentHistoryResponseModel.appointmentNo,
|
|
|
|
|
|
|
|
"ClinicID": patientAppointmentHistoryResponseModel.clinicID,
|
|
|
|
|
|
|
|
"ProjectID": patientAppointmentHistoryResponseModel.projectID,
|
|
|
|
|
|
|
|
"CancelToReschadual": false,
|
|
|
|
|
|
|
|
"EndTime": patientAppointmentHistoryResponseModel.endTime,
|
|
|
|
|
|
|
|
"StartTime": patientAppointmentHistoryResponseModel.startTime,
|
|
|
|
|
|
|
|
"DoctorID": patientAppointmentHistoryResponseModel.doctorID,
|
|
|
|
|
|
|
|
"IsForLiveCare": patientAppointmentHistoryResponseModel.isLiveCareAppointment,
|
|
|
|
|
|
|
|
"OriginalClinicID": patientAppointmentHistoryResponseModel.originalClinicID,
|
|
|
|
|
|
|
|
"OriginalProjectID": patientAppointmentHistoryResponseModel.originalProjectID
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
GenericApiModel<dynamic>? apiResponse;
|
|
|
|
|
|
|
|
Failure? failure;
|
|
|
|
|
|
|
|
await apiClient.post(
|
|
|
|
|
|
|
|
CANCEL_APPOINTMENT,
|
|
|
|
|
|
|
|
body: requestBody,
|
|
|
|
|
|
|
|
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
|
|
|
|
|
|
|
failure = failureType;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
apiResponse = GenericApiModel<dynamic>(
|
|
|
|
|
|
|
|
messageStatus: messageStatus,
|
|
|
|
|
|
|
|
statusCode: statusCode,
|
|
|
|
|
|
|
|
errorMessage: null,
|
|
|
|
|
|
|
|
data: response,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
failure = DataParsingFailure(e.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (failure != null) return Left(failure!);
|
|
|
|
|
|
|
|
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
|
|
|
|
|
|
|
return Right(apiResponse!);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
return Left(UnknownFailure(e.toString()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|