|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
@ -28,6 +29,10 @@ class MyAppointments extends StatefulWidget {
|
|
|
|
|
List();
|
|
|
|
|
List<PatientAppointmentList> _patientArrivedAppointmentListHospital = List();
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> _patientBookedAppointmentListClinic = List();
|
|
|
|
|
List<PatientAppointmentList> _patientConfirmedAppointmentListClinic = List();
|
|
|
|
|
List<PatientAppointmentList> _patientArrivedAppointmentListClinic = List();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_MyAppointmentsState createState() => _MyAppointmentsState();
|
|
|
|
|
}
|
|
|
|
@ -43,9 +48,12 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
|
|
|
|
|
List<ImagesInfo> imagesInfo = List();
|
|
|
|
|
|
|
|
|
|
FilterType filterType;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_tabController = new TabController(length: 3, vsync: this);
|
|
|
|
|
filterType = FilterType.Clinic;
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin)
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
@ -84,6 +92,42 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
color: Colors.grey[600],
|
|
|
|
|
thickness: 0.5,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => setFilterType(FilterType.Clinic),
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: Text(TranslationBase.of(context).clinic),
|
|
|
|
|
leading: Radio(
|
|
|
|
|
value: FilterType.Clinic,
|
|
|
|
|
groupValue: filterType,
|
|
|
|
|
activeColor: Theme.of(context).primaryColor,
|
|
|
|
|
onChanged: (FilterType value) {
|
|
|
|
|
setFilterType(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => setFilterType(FilterType.Hospital),
|
|
|
|
|
child: ListTile(
|
|
|
|
|
title: Text(TranslationBase.of(context).hospital),
|
|
|
|
|
leading: Radio(
|
|
|
|
|
value: FilterType.Hospital,
|
|
|
|
|
groupValue: filterType,
|
|
|
|
|
activeColor: Theme.of(context).primaryColor,
|
|
|
|
|
onChanged: (FilterType value) => setFilterType(value),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
isDataLoaded
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: new TabBarView(
|
|
|
|
@ -114,6 +158,10 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital.clear();
|
|
|
|
|
widget._patientArrivedAppointmentListHospital.clear();
|
|
|
|
|
|
|
|
|
|
widget._patientBookedAppointmentListClinic.clear();
|
|
|
|
|
widget._patientConfirmedAppointmentListClinic.clear();
|
|
|
|
|
widget._patientArrivedAppointmentListClinic.clear();
|
|
|
|
|
|
|
|
|
|
service.getPatientAppointmentHistory(false, context).then((res) {
|
|
|
|
|
print(res['AppoimentAllHistoryResultList'].length);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
@ -123,7 +171,8 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
if (res['AppoimentAllHistoryResultList'].length != 0) {
|
|
|
|
|
// isDataLoaded = true;
|
|
|
|
|
res['AppoimentAllHistoryResultList'].forEach((v) {
|
|
|
|
|
widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
|
|
|
|
widget.appoList
|
|
|
|
|
.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
sortAppointmentList();
|
|
|
|
|
} else {}
|
|
|
|
@ -169,11 +218,31 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.bookedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByClinic =
|
|
|
|
|
widget._patientBookedAppointmentListClinic
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByClinic.length != 0) {
|
|
|
|
|
widget
|
|
|
|
|
._patientBookedAppointmentListClinic[widget
|
|
|
|
|
._patientBookedAppointmentListClinic
|
|
|
|
|
.indexOf(doctorByClinic[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName, patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> doctorByHospital =
|
|
|
|
|
widget._patientBookedAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
@ -186,16 +255,39 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName, patientDoctorAppointment: element));
|
|
|
|
|
filterName: element.projectName,
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.confirmedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByClinic =
|
|
|
|
|
widget._patientConfirmedAppointmentListClinic
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByClinic.length != 0) {
|
|
|
|
|
widget
|
|
|
|
|
._patientConfirmedAppointmentListClinic[widget
|
|
|
|
|
._patientConfirmedAppointmentListClinic
|
|
|
|
|
.indexOf(doctorByClinic[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientConfirmedAppointmentListClinic.add(
|
|
|
|
|
PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName,
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> doctorByHospital =
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
@ -209,17 +301,37 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital.add(
|
|
|
|
|
PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName,
|
|
|
|
|
filterName: element.projectName,
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.arrivedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByClinic =
|
|
|
|
|
widget._patientArrivedAppointmentListClinic
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByClinic.length != 0) {
|
|
|
|
|
widget
|
|
|
|
|
._patientArrivedAppointmentListClinic[widget
|
|
|
|
|
._patientArrivedAppointmentListClinic
|
|
|
|
|
.indexOf(doctorByClinic[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName, patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> doctorByHospital =
|
|
|
|
|
widget._patientArrivedAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
@ -233,9 +345,10 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientArrivedAppointmentListHospital.add(
|
|
|
|
|
PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName,
|
|
|
|
|
filterName: element.projectName,
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openAppointmentsTab();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -250,11 +363,11 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
} else if (flag == 3) {
|
|
|
|
|
_tabController.index = 2;
|
|
|
|
|
} else {
|
|
|
|
|
if (widget._patientBookedAppointmentListHospital.length != 0) {
|
|
|
|
|
if (widget._patientBookedAppointmentListClinic.length != 0) {
|
|
|
|
|
_tabController.index = 0;
|
|
|
|
|
} else if (widget._patientConfirmedAppointmentListHospital.length != 0) {
|
|
|
|
|
} else if (widget._patientConfirmedAppointmentListClinic.length != 0) {
|
|
|
|
|
_tabController.index = 1;
|
|
|
|
|
} else if (widget._patientArrivedAppointmentListHospital.length != 0) {
|
|
|
|
|
} else if (widget._patientArrivedAppointmentListClinic.length != 0) {
|
|
|
|
|
_tabController.index = 2;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -270,24 +383,42 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget._patientBookedAppointmentListHospital.length,
|
|
|
|
|
filterType == FilterType.Clinic
|
|
|
|
|
? widget._patientBookedAppointmentListClinic.length
|
|
|
|
|
: widget._patientBookedAppointmentListHospital.length,
|
|
|
|
|
(index) => AppExpandableNotifier(
|
|
|
|
|
title: widget
|
|
|
|
|
._patientBookedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
title: filterType == FilterType.Clinic
|
|
|
|
|
? widget
|
|
|
|
|
._patientBookedAppointmentListClinic[index]
|
|
|
|
|
.filterName
|
|
|
|
|
: widget
|
|
|
|
|
._patientBookedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget
|
|
|
|
|
._patientBookedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
children: filterType == FilterType.Clinic
|
|
|
|
|
? widget
|
|
|
|
|
._patientBookedAppointmentListClinic[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList()
|
|
|
|
|
: widget
|
|
|
|
|
._patientBookedAppointmentListHospital[
|
|
|
|
|
index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
@ -325,24 +456,43 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital.length,
|
|
|
|
|
filterType == FilterType.Clinic
|
|
|
|
|
? widget._patientConfirmedAppointmentListClinic.length
|
|
|
|
|
: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital.length,
|
|
|
|
|
(index) => AppExpandableNotifier(
|
|
|
|
|
title: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
title: filterType == FilterType.Clinic
|
|
|
|
|
? widget
|
|
|
|
|
._patientConfirmedAppointmentListClinic[index]
|
|
|
|
|
.filterName
|
|
|
|
|
: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
children: filterType == FilterType.Clinic
|
|
|
|
|
? widget
|
|
|
|
|
._patientConfirmedAppointmentListClinic[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList()
|
|
|
|
|
: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[
|
|
|
|
|
index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
@ -378,24 +528,38 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget._patientArrivedAppointmentListHospital.length,
|
|
|
|
|
filterType == FilterType.Clinic
|
|
|
|
|
? widget._patientArrivedAppointmentListClinic.length
|
|
|
|
|
: widget._patientArrivedAppointmentListHospital.length,
|
|
|
|
|
(index) => AppExpandableNotifier(
|
|
|
|
|
title: widget
|
|
|
|
|
._patientArrivedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
title: filterType == FilterType.Clinic
|
|
|
|
|
? widget._patientArrivedAppointmentListClinic[index]
|
|
|
|
|
.filterName
|
|
|
|
|
: widget._patientArrivedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget
|
|
|
|
|
._patientArrivedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
children: filterType == FilterType.Clinic
|
|
|
|
|
? widget._patientArrivedAppointmentListClinic[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList()
|
|
|
|
|
: widget
|
|
|
|
|
._patientArrivedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -422,4 +586,10 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setFilterType(FilterType filterType) {
|
|
|
|
|
setState(() {
|
|
|
|
|
this.filterType = filterType;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|