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.
PatientApp-KKUMC/lib/analytics/flows/appointments.dart

274 lines
10 KiB
Dart

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import '../google-analytics.dart';
class Appointment {
final GALogger logger;
Appointment(this.logger);
// R015
book_appointment() {
logger('book_appointment');
}
// R016.1, R017.2
book_appointment_by_clinic() {
logger('book_appointment_by_clinic');
}
// R016.2, R018.2
book_appointment_by_doctor() {
logger('book_appointment_by_doctor');
}
// R017.1
book_appointment_doctor_search({required String query}) {
// doctor_search_query : value
logger('book_appointment_doctor_search', parameters: {'doctor_search_query': query});
}
// R018.1
book_appointment_select_clinic({required String appointment_type, clinic}) {
// appointment_type: regular | livecare
// clinic_type : $clinic_type
logger('book_appointment_select_clinic', parameters: {'appointment_type': appointment_type, 'clinic_type': clinic});
}
// R019.1
book_appointment_livecare_accept() {
logger('book_appointment_livecare_accept');
}
// R019.2
book_appointment_livecare_decline() {
logger('book_appointment_livecare_decline');
}
// R020
book_appointment_chief_complaints({
required String appointment_type,
ListClinicCentralized? clinic,
HospitalsModel? hospital,
ListDentalChiefComplain? treatment,
}) {
GAnalytics.TREATMENT_TYPE = treatment!.name;
logger('book_appointment_chief_complaints', parameters: {
'appointment_type': appointment_type,
'clinic_type': clinic!.clinicDescription,
'hospital_name': hospital!.name,
'treatment_type': treatment.name,
});
}
// R021
book_appointment_select_doctor({required String appointment_type, required DoctorList doctor}) {
// appointment_type, clinic_type, hospital_name, treatment_type, doctor_name, doctor_nationality, doctor_gender
logger('book_appointment_select_doctor', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
});
}
// R022
book_appointment_schedule({required String appointment_type, required DoctorList doctor}) {
// appointment_type, clinic_type, hospital_name, treatment_type, doctor_name, doctor_nationality, doctor_gender
logger('book_appointment_schedule', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
});
}
// R023
book_appointment_date_selection({required String appointment_type, required day, required DoctorList doctor}) {
logger('book_appointment_date_selection', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
'appointment_day': day
});
}
// R024.1
book_appointment_time_selection({required String appointment_type, required DateTime? dateTime, required DoctorList doctor}) {
final day = DateUtil.getWeekDay(dateTime!.weekday);
final hour = DateFormat('HH').format(dateTime);
logger('book_appointment_time_selection', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
'appointment_day': day,
'appointment_hour': hour
});
}
// R024.2
book_appointment_review({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) {
final day = DateUtil.getWeekDay(dateTime.weekday);
final hour = DateFormat('HH').format(dateTime);
logger('book_appointment_review', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
'appointment_day': day,
'appointment_hour': hour
});
}
// R025
book_appointment_click_confirm({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) {
final day = DateUtil.getWeekDay(dateTime.weekday);
final hour = DateFormat('HH').format(dateTime);
logger('book_appointment_click_confirm', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
'appointment_day': day,
'appointment_hour': hour // '5-6'
});
}
// R026
book_appointment_confirmation_success({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) {
final day = DateUtil.getWeekDay(dateTime.weekday);
final hour = DateFormat('HH').format(dateTime);
logger('book_appointment_confirmation_success', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctor.clinicName,
'hospital_name': doctor.projectName,
'treatment_type': GAnalytics.TREATMENT_TYPE ?? '',
'doctor_name': doctor.name,
'doctor_nationality': doctor.nationalityName,
'doctor_gender': doctor.genderDescription,
'appointment_day': day,
'appointment_hour': hour
});
}
// R049.1 // should be for appointment flow
appointment_actions(AppoitmentAllHistoryResultList appointment, String action) {
logger('appointment_actions', parameters: {
'action_type': action,
'flow_type': GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE,
'appointment_type': appointment.appointmentType,
'clinic_type_online': appointment.clinicName,
'hospital_name': appointment.projectName,
'doctor_name': (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName,
'payment_type': 'appointment',
});
}
// R027
appointment_reminder(bool value) {
logger('appointment_reminder', parameters: {'reminder': value ? 'yes' : 'no'});
}
// R028
appointment_reminder_time({required String reminde_before}) {
logger('appointment_reminder_time', parameters: {'reminder_before': reminde_before});
}
// R053
// Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
pay_now_for_appointment({required String appointment_type, required DoctorList doctorDetail, bool payNow = true}) {
logger('pay_now_for_appointment', parameters: {
'appointment_type': appointment_type,
'clinic_type': doctorDetail.clinicName,
'hospital_name': doctorDetail.projectName,
'doctor_name': doctorDetail.name,
'payment_type': 'appointment'
});
}
// R033
payment_method({required String appointment_type, clinic, payment_method, payment_type}) {
logger('payment_method', parameters: {'appointment_type': appointment_type, 'clinic_type': clinic, 'payment_method': payment_method, 'payment_type': payment_type});
}
// R036
payment_success({required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}) {
logger('payment_success', parameters: {
'appointment_type': appointment_type,
'payment_method': payment_method,
'payment_type': payment_type,
'hospital_name': hospital,
'clinic_type_online': clinic,
'transaction_number': txn_number,
'transaction_amount': txn_amount,
'transaction_currency': txn_currency,
});
}
payment_fail({required String appointment_type, clinic, hospital, payment_method, payment_type, txn_amount, txn_currency, error_type}) {
logger('payment_fail', parameters: {
'appointment_type': appointment_type,
'payment_method': payment_method,
'payment_type': payment_type,
'hospital_name': hospital,
'clinic_type_online': clinic,
'transaction_amount': txn_amount,
'transaction_currency': txn_currency,
'error_type': error_type
});
}
// Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
appointment_detail_action({required AppoitmentAllHistoryResultList appointment, required String action}) {
logger('appointment_detail_action', parameters: {
'action_type': action,
'flow_type': GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE,
});
}
// Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
appointment_details_confirm({required AppoitmentAllHistoryResultList appointment}) {
logger('appointment_details_confirm', parameters: {});
}
// R053
// Note : - Payment flow beyond this step are same as listed under Advance Payment section of this document
appointment_details_cancel({required AppoitmentAllHistoryResultList appointment, appointment_type}) {
logger('cancel_appointment', parameters: {
'flow_type': GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE,
'appointment_type': appointment_type,
'clinic_type_online': appointment.clinicName,
'hospital_name': appointment.projectName,
'doctor_name': (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName
});
}
}