|
|
|
|
@ -5,15 +5,16 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
|
|
|
|
|
class DoctorMapper{
|
|
|
|
|
static Future<RegionList> getMappedDoctor(List<DoctorList> doctorList) async {
|
|
|
|
|
static Future<RegionList> getMappedDoctor(List<DoctorList> doctorList,
|
|
|
|
|
{bool isArabic = false}) async {
|
|
|
|
|
RegionList regionList = RegionList();
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
for (var element in doctorList) {
|
|
|
|
|
if (element.region == null) continue;
|
|
|
|
|
String? region = element.getRegionName(isArabic);
|
|
|
|
|
if (region == null) continue;
|
|
|
|
|
|
|
|
|
|
var regionDoctorList = regionList.registeredDoctorMap?.putIfAbsent(
|
|
|
|
|
element.region!, () => PatientDoctorAppointmentListByRegion());
|
|
|
|
|
var regionDoctorList = regionList.registeredDoctorMap?.putIfAbsent(region, () => PatientDoctorAppointmentListByRegion());
|
|
|
|
|
|
|
|
|
|
List<PatientDoctorAppointmentList>? targetList = element.isHMC == true
|
|
|
|
|
? regionDoctorList?.hmcDoctorList
|
|
|
|
|
@ -62,7 +63,7 @@ class DoctorMapper{
|
|
|
|
|
regionDoctorList?.hmcSize = regionDoctorList.hmcDoctorList?.length ?? 0;
|
|
|
|
|
regionDoctorList?.hmgSize = regionDoctorList.hmgDoctorList?.length ?? 0;
|
|
|
|
|
|
|
|
|
|
regionList.registeredDoctorMap?[element.region!] = regionDoctorList;
|
|
|
|
|
regionList.registeredDoctorMap?[region] = regionDoctorList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return regionList;
|
|
|
|
|
|