WIP: doctor list by region
parent
c72892b1a6
commit
cd460ee31b
@ -0,0 +1,9 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="22.438" height="22.438" viewBox="0 0 22.438 22.438">
|
||||||
|
<g id="Clinic" transform="translate(-1 -1)">
|
||||||
|
<path id="Path_5237" data-name="Path 5237" d="M25,24h3.9v7.8H25Z" transform="translate(-12.293 -11.781)" fill="#2d343d"/>
|
||||||
|
<path id="Path_5238" data-name="Path 5238" d="M23.487,28.731V18H3V28.731H7.878V20.439a.488.488,0,0,1,.488-.488h9.756a.488.488,0,0,1,.488.488v8.292Z" transform="translate(-1.024 -8.708)" fill="#2d343d"/>
|
||||||
|
<path id="Path_5239" data-name="Path 5239" d="M15,24h3.9v7.8H15Z" transform="translate(-7.171 -11.781)" fill="#2d343d"/>
|
||||||
|
<path id="Path_5240" data-name="Path 5240" d="M22.463,5.878H16.122v-3.9A.977.977,0,0,0,15.146,1H9.292a.977.977,0,0,0-.976.976v3.9H1.976A.977.977,0,0,0,1,6.854v.488a.977.977,0,0,0,.976.976H22.463a.977.977,0,0,0,.976-.976V6.854a.977.977,0,0,0-.976-.976ZM13.683,4.9h-.976v.976a.488.488,0,0,1-.976,0V4.9h-.976a.488.488,0,0,1,0-.976h.976V2.951a.488.488,0,0,1,.976,0v.976h.976a.488.488,0,1,1,0,.976Z" transform="translate(0 0)" fill="#2d343d"/>
|
||||||
|
<path id="Path_5241" data-name="Path 5241" d="M22.951,42H1.488A.488.488,0,0,0,1,42.488v.488a1.465,1.465,0,0,0,1.463,1.463H21.975a1.465,1.465,0,0,0,1.463-1.463v-.488A.488.488,0,0,0,22.951,42Z" transform="translate(0 -21)" fill="#2d343d"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,12 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="23.656" height="23.656" viewBox="0 0 23.656 23.656">
|
||||||
|
<g id="hospital" transform="translate(0)">
|
||||||
|
<g id="Group_8363" data-name="Group 8363" transform="translate(0 8.612)">
|
||||||
|
<path id="Path_5242" data-name="Path 5242" d="M3.1,186.392H.693a.693.693,0,0,0-.693.693v14.351H3.1Z" transform="translate(0 -186.392)" fill="#2d343d"/>
|
||||||
|
<path id="Path_5243" data-name="Path 5243" d="M447.357,186.392h-2.4v15.044h3.1V187.085A.693.693,0,0,0,447.357,186.392Z" transform="translate(-424.394 -186.392)" fill="#2d343d"/>
|
||||||
|
</g>
|
||||||
|
<g id="Group_8364" data-name="Group 8364" transform="translate(4.484)">
|
||||||
|
<path id="Path_5244" data-name="Path 5244" d="M0,0H4.631V2.41H0Z" transform="translate(8.549 19.025) rotate(90)" fill="#2d343d"/>
|
||||||
|
<path id="Path_5245" data-name="Path 5245" d="M111.043,2.847h-2.182V.693A.693.693,0,0,0,108.168,0h-7.454a.693.693,0,0,0-.693.693V2.847h-2.28a.693.693,0,0,0-.693.693V23.656H101.8V18.332a.693.693,0,0,1,.693-.693h3.8a.693.693,0,0,1,.693.693v5.324h4.753V3.54a.693.693,0,0,0-.693-.693Zm-9.789,12.4h-.746a.693.693,0,0,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm0-2.772h-.746a.693.693,0,0,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm0-2.772h-.746a.693.693,0,0,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm3.511,5.544h-.746a.693.693,0,1,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm0-2.772h-.746a.693.693,0,0,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm0-2.772h-.746a.693.693,0,1,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm1.024-4.145h-.7v.7a.693.693,0,1,1-1.386,0v-.7H103a.693.693,0,1,1,0-1.386h.7v-.7a.693.693,0,1,1,1.386,0v.7h.7a.693.693,0,1,1,0,1.386Zm2.488,9.689h-.746a.693.693,0,1,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm0-2.772h-.746a.693.693,0,0,1,0-1.386h.746a.693.693,0,0,1,0,1.386Zm0-2.772h-.746a.693.693,0,1,1,0-1.386h.746a.693.693,0,0,1,0,1.386Z" transform="translate(-97.048)" fill="#2d343d"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,268 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
|
||||||
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class SearchResultsByRegion extends StatelessWidget {
|
||||||
|
List<DoctorList> doctorsList = [];
|
||||||
|
RegionList patientDoctorAppointmentListHospital;
|
||||||
|
bool isLiveCareAppointment;
|
||||||
|
bool isObGyneAppointment;
|
||||||
|
bool isDoctorNameSearch;
|
||||||
|
OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
||||||
|
bool isDoctorSearchResult;
|
||||||
|
|
||||||
|
SearchResultsByRegion(
|
||||||
|
{required this.doctorsList,
|
||||||
|
required this.patientDoctorAppointmentListHospital,
|
||||||
|
this.isObGyneAppointment = false,
|
||||||
|
this.isDoctorNameSearch = false,
|
||||||
|
required this.isLiveCareAppointment,
|
||||||
|
required this.isDoctorSearchResult,
|
||||||
|
this.obGyneProcedureListResponse});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).bookAppo,
|
||||||
|
isShowDecPage: false,
|
||||||
|
isShowAppBar: true,
|
||||||
|
showNewAppBarTitle: true,
|
||||||
|
showNewAppBar: true,
|
||||||
|
backgroundColor: CustomColors.appBackgroudGrey2Color,
|
||||||
|
body: patientDoctorAppointmentListHospital
|
||||||
|
.registeredDoctorMap?.isNotEmpty ==
|
||||||
|
true
|
||||||
|
? ListView.separated(
|
||||||
|
addAutomaticKeepAlives: true,
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
height: 12,
|
||||||
|
margin: EdgeInsets.only(left: 21, right: 21),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
String key = patientDoctorAppointmentListHospital
|
||||||
|
.registeredDoctorMap?.keys
|
||||||
|
.toList()[index] ??
|
||||||
|
'';
|
||||||
|
return AppExpandableNotifier(
|
||||||
|
title: key,
|
||||||
|
isTitleSingleLine: false,
|
||||||
|
isDoctorSearchResult: isDoctorSearchResult,
|
||||||
|
bodyWidget: Column(
|
||||||
|
children: [
|
||||||
|
AppExpandableNotifier(
|
||||||
|
headerWidget: HospitalTitle(
|
||||||
|
iconUrl: 'assets/images/svg/HMG.svg',
|
||||||
|
title: TranslationBase.of(context).hmgHospital,
|
||||||
|
isHMC: false,
|
||||||
|
),
|
||||||
|
showDropDownIconWithCustomHeader: true,
|
||||||
|
bodyWidget: HospitalBodyWidget(
|
||||||
|
patientDoctorAppointmentListHospital:
|
||||||
|
patientDoctorAppointmentListHospital
|
||||||
|
.registeredDoctorMap?[key]?.hmgDoctorList,
|
||||||
|
isLiveCareAppointment: isLiveCareAppointment,
|
||||||
|
isObGyneAppointment: isObGyneAppointment,
|
||||||
|
isDoctorNameSearch: isDoctorNameSearch,
|
||||||
|
isDoctorSearchResult: isDoctorSearchResult,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
AppExpandableNotifier(
|
||||||
|
headerWidget: HospitalTitle(
|
||||||
|
iconUrl: 'assets/images/svg/HMC.svg',
|
||||||
|
title: TranslationBase.of(context).hmcHospital,
|
||||||
|
isHMC: true,
|
||||||
|
),
|
||||||
|
showDropDownIconWithCustomHeader: true,
|
||||||
|
bodyWidget: HospitalBodyWidget(
|
||||||
|
patientDoctorAppointmentListHospital:
|
||||||
|
patientDoctorAppointmentListHospital
|
||||||
|
.registeredDoctorMap?[key]?.hmcDoctorList,
|
||||||
|
isLiveCareAppointment: isLiveCareAppointment,
|
||||||
|
isObGyneAppointment: isObGyneAppointment,
|
||||||
|
isDoctorNameSearch: isDoctorNameSearch,
|
||||||
|
isDoctorSearchResult: isDoctorSearchResult,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
// return AppExpandableNotifier(
|
||||||
|
// title: (patientDoctorAppointmentListHospital[index].distanceInKMs != "0")
|
||||||
|
// ? patientDoctorAppointmentListHospital[index].filterName! + " - " + patientDoctorAppointmentListHospital[index].distanceInKMs! + " " + TranslationBase.of(context).km
|
||||||
|
// : patientDoctorAppointmentListHospital[index].filterName,
|
||||||
|
// projectTitleTop: patientDoctorAppointmentListHospital[index].projectTopName,
|
||||||
|
// projectTitleBottom: (patientDoctorAppointmentListHospital[index].distanceInKMs != "0")
|
||||||
|
// ? patientDoctorAppointmentListHospital[index].projectBottomName.toString() +
|
||||||
|
// " - " +
|
||||||
|
// patientDoctorAppointmentListHospital[index].distanceInKMs! +
|
||||||
|
// " " +
|
||||||
|
// TranslationBase.of(context).km
|
||||||
|
// : patientDoctorAppointmentListHospital[index].projectBottomName.toString(),
|
||||||
|
// isTitleSingleLine: false,
|
||||||
|
// isDoctorSearchResult: isDoctorSearchResult,
|
||||||
|
// isExpand: patientDoctorAppointmentListHospital.length == 1 ? true : false,
|
||||||
|
// bodyWidget: ListView.separated(
|
||||||
|
// shrinkWrap: true,
|
||||||
|
// physics: NeverScrollableScrollPhysics(),
|
||||||
|
// padding: EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21),
|
||||||
|
// itemBuilder: (context, _index) {
|
||||||
|
// final doctor = patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList![_index];
|
||||||
|
// return DoctorView(
|
||||||
|
// doctor: doctor,
|
||||||
|
// isLiveCareAppointment: isLiveCareAppointment,
|
||||||
|
// isObGyneAppointment: isObGyneAppointment,
|
||||||
|
// isDoctorNameSearch: isDoctorNameSearch,
|
||||||
|
// obGyneProcedureListResponse: obGyneProcedureListResponse,
|
||||||
|
// isShowDate: false,
|
||||||
|
// onTap: () {
|
||||||
|
// context.read<ProjectViewModel>().analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor);
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// separatorBuilder: (context, index) => SizedBox(height: 14),
|
||||||
|
// itemCount: patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList!.length),
|
||||||
|
// );
|
||||||
|
},
|
||||||
|
itemCount: patientDoctorAppointmentListHospital
|
||||||
|
.registeredDoctorMap?.length ??
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
: getNoDataWidget(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HospitalBodyWidget extends StatelessWidget {
|
||||||
|
final List<PatientDoctorAppointmentList>?
|
||||||
|
patientDoctorAppointmentListHospital;
|
||||||
|
final bool isLiveCareAppointment;
|
||||||
|
final bool isObGyneAppointment;
|
||||||
|
final bool isDoctorNameSearch;
|
||||||
|
final bool isDoctorSearchResult;
|
||||||
|
final OBGyneProcedureListResponse? obGyneProcedureListResponse;
|
||||||
|
|
||||||
|
const HospitalBodyWidget({
|
||||||
|
super.key,
|
||||||
|
this.patientDoctorAppointmentListHospital,
|
||||||
|
required this.isLiveCareAppointment,
|
||||||
|
required this.isObGyneAppointment,
|
||||||
|
required this.isDoctorNameSearch,
|
||||||
|
required this.isDoctorSearchResult,
|
||||||
|
this.obGyneProcedureListResponse,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView.separated(
|
||||||
|
addAutomaticKeepAlives: true,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: patientDoctorAppointmentListHospital?.length ?? 0,
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
height: 12,
|
||||||
|
margin: EdgeInsets.only(left: 21, right: 21),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return AppExpandableNotifier(
|
||||||
|
title: (patientDoctorAppointmentListHospital?[index].distanceInKMs !=
|
||||||
|
"0")
|
||||||
|
? patientDoctorAppointmentListHospital![index].filterName! +
|
||||||
|
" - " +
|
||||||
|
patientDoctorAppointmentListHospital![index].distanceInKMs! +
|
||||||
|
" " +
|
||||||
|
TranslationBase.of(context).km
|
||||||
|
: patientDoctorAppointmentListHospital![index].filterName,
|
||||||
|
projectTitleTop:
|
||||||
|
patientDoctorAppointmentListHospital![index].projectTopName,
|
||||||
|
projectTitleBottom: (patientDoctorAppointmentListHospital![index]
|
||||||
|
.distanceInKMs !=
|
||||||
|
"0")
|
||||||
|
? patientDoctorAppointmentListHospital![index]
|
||||||
|
.projectBottomName
|
||||||
|
.toString() +
|
||||||
|
" - " +
|
||||||
|
patientDoctorAppointmentListHospital![index].distanceInKMs! +
|
||||||
|
" " +
|
||||||
|
TranslationBase.of(context).km
|
||||||
|
: patientDoctorAppointmentListHospital![index]
|
||||||
|
.projectBottomName
|
||||||
|
.toString(),
|
||||||
|
isTitleSingleLine: false,
|
||||||
|
isDoctorSearchResult: isDoctorSearchResult,
|
||||||
|
isExpand:
|
||||||
|
patientDoctorAppointmentListHospital?.length == 1 ? true : false,
|
||||||
|
bodyWidget: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21),
|
||||||
|
itemBuilder: (context, _index) {
|
||||||
|
print("the index of patientDoctorAppointmentList is ${_index}");
|
||||||
|
print("the index of parent is ${index}");
|
||||||
|
final doctor = patientDoctorAppointmentListHospital![index]
|
||||||
|
.patientDoctorAppointmentList![_index];
|
||||||
|
print('the doctor is ${doctor.toJson()}');
|
||||||
|
return DoctorView(
|
||||||
|
doctor: doctor,
|
||||||
|
isLiveCareAppointment: isLiveCareAppointment,
|
||||||
|
isObGyneAppointment: isObGyneAppointment,
|
||||||
|
isDoctorNameSearch: isDoctorNameSearch,
|
||||||
|
obGyneProcedureListResponse: obGyneProcedureListResponse,
|
||||||
|
isShowDate: false,
|
||||||
|
onTap: () {
|
||||||
|
context
|
||||||
|
.read<ProjectViewModel>()
|
||||||
|
.analytics
|
||||||
|
.appointment
|
||||||
|
.book_appointment_select_doctor(
|
||||||
|
appointment_type: 'regular', doctor: doctor);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) => SizedBox(height: 14),
|
||||||
|
itemCount: patientDoctorAppointmentListHospital?[index].patientDoctorAppointmentList?.length ?? 0),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HospitalTitle extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String iconUrl;
|
||||||
|
final bool isHMC;
|
||||||
|
|
||||||
|
const HospitalTitle({super.key, required this.title, required this.iconUrl, required this.isHMC});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(iconUrl),
|
||||||
|
SizedBox(width: 8,),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18, color:isHMC? Colors.greenAccent : Colors.red, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||||
|
|
||||||
|
class DoctorMapper{
|
||||||
|
static RegionList getMappedDoctor( List<DoctorList> doctorList ){
|
||||||
|
RegionList regionList = RegionList();
|
||||||
|
|
||||||
|
doctorList.forEach((element) {
|
||||||
|
var regionDoctorList = regionList.registeredDoctorMap?[element.region];
|
||||||
|
regionDoctorList ??= PatientDoctorAppointmentListByRegion();
|
||||||
|
List<PatientDoctorAppointmentList> doctorByHospital = [];
|
||||||
|
if(element.isHMC == true ){
|
||||||
|
doctorByHospital = regionDoctorList.hmcDoctorList?.where((elementClinic) => elementClinic.filterName == element.getProjectCompleteName()).toList() ?? [];
|
||||||
|
}else{
|
||||||
|
doctorByHospital = regionDoctorList.hmcDoctorList?.where((elementClinic) => elementClinic.filterName == element.getProjectCompleteName()).toList() ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(doctorByHospital.isNotEmpty){
|
||||||
|
doctorByHospital.first.patientDoctorAppointmentList?.add(element);
|
||||||
|
}else{
|
||||||
|
doctorByHospital.add(
|
||||||
|
PatientDoctorAppointmentList(
|
||||||
|
filterName: element.getProjectCompleteName(),
|
||||||
|
distanceInKMs: element.projectDistanceInKiloMeters.toString(),
|
||||||
|
projectTopName: element.projectTopName,
|
||||||
|
projectBottomName: element.projectBottomName,
|
||||||
|
patientDoctorAppointment: element)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(element.isHMC == true ){
|
||||||
|
regionDoctorList.hmcDoctorList = doctorByHospital;
|
||||||
|
}else{
|
||||||
|
regionDoctorList.hmgDoctorList = doctorByHospital;
|
||||||
|
}
|
||||||
|
|
||||||
|
regionList.registeredDoctorMap?[element.region!] = regionDoctorList;
|
||||||
|
|
||||||
|
});
|
||||||
|
return regionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue