|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patient_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/routes.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/clinic_list_dropdwon.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_button.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../config/size_config.dart';
|
|
|
|
import '../../widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
|
|
|
class PatientsScreen extends StatefulWidget {
|
|
|
|
final patientSearchForm;
|
|
|
|
final selectedType;
|
|
|
|
final isAppbar;
|
|
|
|
final arrivalType;
|
|
|
|
PatientsScreen(
|
|
|
|
{this.patientSearchForm,
|
|
|
|
this.selectedType,
|
|
|
|
this.isAppbar = true,
|
|
|
|
this.arrivalType});
|
|
|
|
@override
|
|
|
|
_PatientsScreenState createState() => _PatientsScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
List<dynamic> lItems;
|
|
|
|
|
|
|
|
List parsed;
|
|
|
|
|
|
|
|
List date;
|
|
|
|
List unFilterDate;
|
|
|
|
|
|
|
|
int clinicId;
|
|
|
|
AuthViewModel authProvider;
|
|
|
|
|
|
|
|
Color sideColor = Colors.black;
|
|
|
|
List<PatiantInformtion> responseModelList;
|
|
|
|
List<PatiantInformtion> responseModelList2;
|
|
|
|
final String url = "assets/images/";
|
|
|
|
final String avatarMale = "user_male.svg"; //'working_male.svg';//'user.svg';
|
|
|
|
final String avatarFemale = 'user_female.svg';
|
|
|
|
final String assetName = 'assets/image.svg';
|
|
|
|
|
|
|
|
List<String> _locations = []; //['All', 'Today', 'Tomorrow', 'Next Week'];
|
|
|
|
|
|
|
|
int _activeLocation = 0;
|
|
|
|
|
|
|
|
bool _isInit = true;
|
|
|
|
String patientType;
|
|
|
|
bool isSearch = false;
|
|
|
|
String patientTypeTitle;
|
|
|
|
var _isLoading = true;
|
|
|
|
var selectedFilter = 1;
|
|
|
|
bool _isError = false;
|
|
|
|
String error = "";
|
|
|
|
String arrivalType;
|
|
|
|
ProjectViewModel projectsProvider;
|
|
|
|
|
|
|
|
final _controller = TextEditingController();
|
|
|
|
|
|
|
|
PatientModel patient;
|
|
|
|
|
|
|
|
searchData(String str) {
|
|
|
|
this.responseModelList = this.responseModelList2;
|
|
|
|
var strExist = str.length > 0 ? true : false;
|
|
|
|
if (strExist) {
|
|
|
|
List<PatiantInformtion> filterData = [];
|
|
|
|
|
|
|
|
for (var i = 0; i < responseModelList2.length; i++) {
|
|
|
|
String firstName = responseModelList[i].firstName.toUpperCase();
|
|
|
|
String lastName = responseModelList[i].lastName.toUpperCase();
|
|
|
|
String mobile = responseModelList[i].mobileNumber.toUpperCase();
|
|
|
|
String patientID = responseModelList[i].patientId.toString();
|
|
|
|
|
|
|
|
if (firstName.contains(str.toUpperCase()) ||
|
|
|
|
lastName.contains(str.toUpperCase()) ||
|
|
|
|
mobile.contains(str) ||
|
|
|
|
patientID.contains(str)) {
|
|
|
|
filterData.add(responseModelList[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
this.responseModelList = filterData;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
this.responseModelList = this.responseModelList2;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
convertDate(String str) {
|
|
|
|
String timeConvert;
|
|
|
|
const start = "/Date(";
|
|
|
|
|
|
|
|
const end = "+0300)";
|
|
|
|
|
|
|
|
final startIndex = str.indexOf(start);
|
|
|
|
|
|
|
|
final endIndex = str.indexOf(end, startIndex + start.length);
|
|
|
|
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(str.substring(startIndex + start.length, endIndex)));
|
|
|
|
|
|
|
|
String newDateformat = date.year.toString() +
|
|
|
|
"/" +
|
|
|
|
date.month.toString().padLeft(2, '0') +
|
|
|
|
"/" +
|
|
|
|
date.day.toString().padLeft(2, '0') +
|
|
|
|
" " +
|
|
|
|
"-" +
|
|
|
|
" " +
|
|
|
|
date.hour.toString().padLeft(2, '0') +
|
|
|
|
":" +
|
|
|
|
date.minute.toString().toString().padLeft(2, '0');
|
|
|
|
|
|
|
|
return newDateformat.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
convertDateFormat(String str) {
|
|
|
|
String timeConvert;
|
|
|
|
const start = "/Date(";
|
|
|
|
const end = "+0300)";
|
|
|
|
|
|
|
|
final startIndex = str.indexOf(start);
|
|
|
|
final endIndex = str.indexOf(end, startIndex + start.length);
|
|
|
|
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(str.substring(startIndex + start.length, endIndex)));
|
|
|
|
String newDate = date.year.toString() +
|
|
|
|
"-" +
|
|
|
|
date.month.toString().padLeft(2, '0') +
|
|
|
|
"-" +
|
|
|
|
date.day.toString().padLeft(2, '0');
|
|
|
|
|
|
|
|
return newDate.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
filterBooking(String str) {
|
|
|
|
this.responseModelList = this.responseModelList2;
|
|
|
|
|
|
|
|
var strExist = str.length > 0 ? true : false;
|
|
|
|
if (true) {
|
|
|
|
List<PatiantInformtion> filterDate = [];
|
|
|
|
|
|
|
|
for (var i = 0; i < responseModelList2.length; i++) {
|
|
|
|
String patiantAppointment =
|
|
|
|
convertDateFormat(responseModelList[i].appointmentDate);
|
|
|
|
|
|
|
|
String dateAppointment = checkDate(patiantAppointment);
|
|
|
|
|
|
|
|
if (dateAppointment.contains(str)) {
|
|
|
|
filterDate.add(responseModelList[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
this.responseModelList = filterDate;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
this.responseModelList = this.responseModelList2;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String checkDate(String dateString) {
|
|
|
|
DateTime checkedTime = DateTime.parse(dateString);
|
|
|
|
DateTime currentTime = DateTime.now();
|
|
|
|
|
|
|
|
if ((currentTime.year == checkedTime.year) &&
|
|
|
|
(currentTime.month == checkedTime.month) &&
|
|
|
|
(currentTime.day == checkedTime.day)) {
|
|
|
|
return TranslationBase.of(context).today;
|
|
|
|
} else if ((currentTime.year == checkedTime.year) &&
|
|
|
|
(currentTime.month == checkedTime.month)) {
|
|
|
|
if ((currentTime.day - checkedTime.day) == 1) {
|
|
|
|
return TranslationBase.of(context).yesterday;
|
|
|
|
} else if ((currentTime.day - checkedTime.day) == -1) {
|
|
|
|
return TranslationBase.of(context).tomorrow;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((currentTime.day - checkedTime.day) <= -2) {
|
|
|
|
return TranslationBase.of(context).nextWeek;
|
|
|
|
} else {
|
|
|
|
return TranslationBase.of(context).all;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TranslationBase.of(context).all;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
authProvider = Provider.of(context);
|
|
|
|
_locations = [
|
|
|
|
TranslationBase.of(context).all,
|
|
|
|
TranslationBase.of(context).today,
|
|
|
|
TranslationBase.of(context).tomorrow,
|
|
|
|
TranslationBase.of(context).nextWeek,
|
|
|
|
];
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
|
|
|
patient = widget.patientSearchForm != null
|
|
|
|
? widget.patientSearchForm
|
|
|
|
: routeArgs['patientSearchForm'];
|
|
|
|
|
|
|
|
patientType = widget.selectedType != null
|
|
|
|
? widget.selectedType
|
|
|
|
: routeArgs['selectedType'];
|
|
|
|
arrivalType = widget.arrivalType != null
|
|
|
|
? widget.arrivalType
|
|
|
|
: routeArgs['arrivalType'];
|
|
|
|
if (routeArgs != null && routeArgs.containsKey("isSearch")) {
|
|
|
|
isSearch = routeArgs['isSearch'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!projectsProvider.isArabic)
|
|
|
|
patientTypeTitle = SERVICES_PATIANT_HEADER[int.parse(patientType)];
|
|
|
|
else
|
|
|
|
patientTypeTitle = SERVICES_PATIANT_HEADER_AR[int.parse(patientType)];
|
|
|
|
|
|
|
|
return BaseView<PatientViewModel>(
|
|
|
|
onModelReady: (model) {
|
|
|
|
// TODO : change all the logic here to make it work with the model and remove future
|
|
|
|
int val2 = int.parse(patientType);
|
|
|
|
GetPatientArrivalListRequestModel getPatientArrivalListRequestModel;
|
|
|
|
if (val2 == 7) {
|
|
|
|
getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel(
|
|
|
|
from: patient.From,
|
|
|
|
to: patient.To,
|
|
|
|
pageIndex: 0,
|
|
|
|
pageSize: 0,
|
|
|
|
patientMRN: patient.getPatientID);
|
|
|
|
}
|
|
|
|
|
|
|
|
model
|
|
|
|
.getPatientList(
|
|
|
|
val2 == 7
|
|
|
|
? getPatientArrivalListRequestModel.toJson()
|
|
|
|
: patient,
|
|
|
|
patientType)
|
|
|
|
.then((res) {
|
|
|
|
setState(() {
|
|
|
|
if (res != null && res['MessageStatus'] == 1) {
|
|
|
|
if (val2 == 7) {
|
|
|
|
if (res[SERVICES_PATIANT2[val2]] == null) {
|
|
|
|
_isError = true;
|
|
|
|
_isLoading = false;
|
|
|
|
this.error = error.toString();
|
|
|
|
} else {
|
|
|
|
var localList = [];
|
|
|
|
if (res["patientArrivalList"]["entityList"] == null) {
|
|
|
|
res["patientArrivalList"]["entityList"] = [];
|
|
|
|
}
|
|
|
|
res["patientArrivalList"]["entityList"].forEach((v) {
|
|
|
|
Map<String, dynamic> mergedPatient = {
|
|
|
|
...v,
|
|
|
|
...v["patientDetails"]
|
|
|
|
};
|
|
|
|
localList.add(mergedPatient);
|
|
|
|
});
|
|
|
|
lItems = localList;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
lItems = res[SERVICES_PATIANT2[val2]];
|
|
|
|
}
|
|
|
|
parsed = lItems;
|
|
|
|
responseModelList = new ModelResponse.fromJson(parsed).list;
|
|
|
|
responseModelList2 = responseModelList;
|
|
|
|
_isError = false;
|
|
|
|
} else {
|
|
|
|
_isError = true;
|
|
|
|
error = model.error ??
|
|
|
|
res['ErrorEndUserMessage'] ??
|
|
|
|
res['ErrorMessage'];
|
|
|
|
}
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
});
|
|
|
|
}).catchError((error) {
|
|
|
|
setState(() {
|
|
|
|
_isError = true;
|
|
|
|
_isLoading = false;
|
|
|
|
this.error = error.toString();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
appBarTitle: patientTypeTitle,
|
|
|
|
isShowAppBar: widget.isAppbar,
|
|
|
|
isLoading: _isLoading,
|
|
|
|
body: _isLoading
|
|
|
|
? Container()
|
|
|
|
: _isError
|
|
|
|
? DrAppEmbeddedError(error: error)
|
|
|
|
: lItems == null || lItems.length == 0
|
|
|
|
? Column(
|
|
|
|
children: [
|
|
|
|
if (int.parse(patientType) == 7)
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
child: ClinicList(
|
|
|
|
clinicId: clinicId,
|
|
|
|
onClinicChange: (newValue) {
|
|
|
|
clinicId = newValue;
|
|
|
|
changeClinic(newValue, context, model);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
top: MediaQuery.of(context).size.height * 0.35),
|
|
|
|
child: DrAppEmbeddedError(
|
|
|
|
error: TranslationBase.of(context)
|
|
|
|
.youDontHaveAnyPatient),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
color: Colors.grey[200],
|
|
|
|
child: ListView(
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
child: lItems == null
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
child: Center(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(
|
|
|
|
0, 0, 0, 0), //250
|
|
|
|
child:
|
|
|
|
DrAppCircularProgressIndeicator(),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
SizedBox(height: 18.5),
|
|
|
|
Container(
|
|
|
|
width: SizeConfig.screenWidth * 0.9,
|
|
|
|
height:
|
|
|
|
SizeConfig.screenHeight * 0.08,
|
|
|
|
child: TextField(
|
|
|
|
controller: _controller,
|
|
|
|
onChanged: (String str) {
|
|
|
|
this.searchData(str);
|
|
|
|
},
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
context,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.searchPatientName),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 10.0,
|
|
|
|
),
|
|
|
|
if (int.parse(patientType) == 7)
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
border: Border.all(
|
|
|
|
color: Colors.grey),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
10)),
|
|
|
|
child: ClinicList(
|
|
|
|
clinicId: clinicId,
|
|
|
|
onClinicChange: (newValue) {
|
|
|
|
clinicId = newValue;
|
|
|
|
changeClinic(
|
|
|
|
newValue, context, model);
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.03),
|
|
|
|
child: SERVICES_PATIANT2[
|
|
|
|
int.parse(patientType)] ==
|
|
|
|
"List_MyOutPatient"
|
|
|
|
? _locationBar(context)
|
|
|
|
: Container(),
|
|
|
|
),
|
|
|
|
// Row(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.spaceEvenly,
|
|
|
|
// children: [
|
|
|
|
// AppButton(
|
|
|
|
// title: TranslationBase.of(context)
|
|
|
|
// .all,
|
|
|
|
// onPressed: () {
|
|
|
|
// setState(() {
|
|
|
|
// selectedFilter = 1;
|
|
|
|
// filterPatients();
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// color: selectedFilter == 1
|
|
|
|
// ? Colors.red[800]
|
|
|
|
// : Colors.grey[300],
|
|
|
|
// fontColor: selectedFilter == 1
|
|
|
|
// ? Colors.white
|
|
|
|
// : Colors.black,
|
|
|
|
// ),
|
|
|
|
// AppButton(
|
|
|
|
// title: TranslationBase.of(context)
|
|
|
|
// .today,
|
|
|
|
// onPressed: () {
|
|
|
|
// setState(() {
|
|
|
|
// selectedFilter = 2;
|
|
|
|
// filterPatients();
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// color: selectedFilter == 2
|
|
|
|
// ? Colors.red[800]
|
|
|
|
// : Colors.grey[300],
|
|
|
|
// fontColor: selectedFilter == 2
|
|
|
|
// ? Colors.white
|
|
|
|
// : Colors.black,
|
|
|
|
// ),
|
|
|
|
// AppButton(
|
|
|
|
// title: TranslationBase.of(context)
|
|
|
|
// .tomorrow,
|
|
|
|
// onPressed: () {
|
|
|
|
// setState(() {
|
|
|
|
// selectedFilter = 3;
|
|
|
|
// filterPatients();
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// color: selectedFilter == 3
|
|
|
|
// ? Colors.red[800]
|
|
|
|
// : Colors.grey[300],
|
|
|
|
// fontColor: selectedFilter == 3
|
|
|
|
// ? Colors.white
|
|
|
|
// : Colors.black,
|
|
|
|
// ),
|
|
|
|
// AppButton(
|
|
|
|
// title: TranslationBase.of(context)
|
|
|
|
// .nextWeek,
|
|
|
|
// onPressed: () {
|
|
|
|
// setState(() {
|
|
|
|
// selectedFilter = 4;
|
|
|
|
// // filterPatients();
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// color: selectedFilter == 4
|
|
|
|
// ? Colors.red[800]
|
|
|
|
// : Colors.grey[300],
|
|
|
|
// fontColor: selectedFilter == 4
|
|
|
|
// ? Colors.white
|
|
|
|
// : Colors.black,
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
SizedBox(
|
|
|
|
height: 10.0,
|
|
|
|
),
|
|
|
|
// Divider(
|
|
|
|
// thickness: 0.8,
|
|
|
|
// color: Color(0xffCCCCCC),
|
|
|
|
// ),
|
|
|
|
Container(
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// color: Color(0Xffffffff),
|
|
|
|
// borderRadius:
|
|
|
|
// BorderRadius.circular(20)),
|
|
|
|
child: (responseModelList.length > 0)
|
|
|
|
? Column(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: responseModelList
|
|
|
|
.map((PatiantInformtion
|
|
|
|
item) {
|
|
|
|
return PatientCard(
|
|
|
|
patientInfo: item,
|
|
|
|
patientType: patientType,
|
|
|
|
arrivalType: arrivalType,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed(
|
|
|
|
PATIENTS_PROFILE,
|
|
|
|
arguments: {
|
|
|
|
"patient": item,
|
|
|
|
"patientType":
|
|
|
|
patientType,
|
|
|
|
"from": patient
|
|
|
|
.getFrom,
|
|
|
|
"to":
|
|
|
|
patient.getTo,
|
|
|
|
"isSearch":isSearch
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
)
|
|
|
|
: Center(
|
|
|
|
child: DrAppEmbeddedError(
|
|
|
|
error: TranslationBase.of(
|
|
|
|
context)
|
|
|
|
.youDontHaveAnyPatient),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
changeClinic(clinicId, BuildContext context, model) async {
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
|
|
|
|
ProfileReqModel docInfo = new ProfileReqModel(
|
|
|
|
doctorID: doctorProfile.doctorID,
|
|
|
|
clinicID: clinicId,
|
|
|
|
license: true,
|
|
|
|
projectID: doctorProfile.projectID,
|
|
|
|
tokenID: '',
|
|
|
|
languageID: 2);
|
|
|
|
|
|
|
|
authProvider
|
|
|
|
.getDocProfiles(docInfo.toJson(), allowChangeProfile: false)
|
|
|
|
.then((profileList) async {
|
|
|
|
print(profileList['DoctorProfileList'][0]);
|
|
|
|
int val2 = int.parse(patientType);
|
|
|
|
|
|
|
|
GetPatientArrivalListRequestModel getPatientArrivalListRequestModel =
|
|
|
|
GetPatientArrivalListRequestModel(
|
|
|
|
from: patient.From,
|
|
|
|
to: patient.To,
|
|
|
|
clinicID: profileList['DoctorProfileList'][0]['ClinicID'],
|
|
|
|
doctorID:
|
|
|
|
profileList['DoctorProfileList'][0]['DoctorID'].toString(),
|
|
|
|
patientMRN: patient.getPatientID,
|
|
|
|
pageIndex: 0,
|
|
|
|
pageSize: 0);
|
|
|
|
|
|
|
|
model
|
|
|
|
.getPatientList(
|
|
|
|
getPatientArrivalListRequestModel.toJson(), patientType)
|
|
|
|
.then((res) {
|
|
|
|
setState(() {
|
|
|
|
if (res != null && res['MessageStatus'] == 1) {
|
|
|
|
if (val2 == 7) {
|
|
|
|
if (res[SERVICES_PATIANT2[val2]] == null) {
|
|
|
|
_isError = true;
|
|
|
|
_isLoading = false;
|
|
|
|
this.error = error.toString();
|
|
|
|
} else {
|
|
|
|
var localList = [];
|
|
|
|
if (res["patientArrivalList"]["entityList"] == null) {
|
|
|
|
res["patientArrivalList"]["entityList"] = [];
|
|
|
|
}
|
|
|
|
res["patientArrivalList"]["entityList"].forEach((v) {
|
|
|
|
Map<String, dynamic> mergedPatient = {
|
|
|
|
...v,
|
|
|
|
...v["patientDetails"]
|
|
|
|
};
|
|
|
|
localList.add(mergedPatient);
|
|
|
|
});
|
|
|
|
lItems = localList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parsed = lItems;
|
|
|
|
responseModelList = new ModelResponse.fromJson(parsed).list;
|
|
|
|
responseModelList.sort((a, b) {
|
|
|
|
var adate = a.arrivedOn;
|
|
|
|
var bdate = b.arrivedOn; //before -> var bdate = b.expiry;
|
|
|
|
return adate.compareTo(bdate);
|
|
|
|
});
|
|
|
|
responseModelList2 = responseModelList;
|
|
|
|
_isError = false;
|
|
|
|
} else {
|
|
|
|
_isError = true;
|
|
|
|
error = model.error ??
|
|
|
|
res['ErrorEndUserMessage'] ??
|
|
|
|
res['ErrorMessage'];
|
|
|
|
}
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
});
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
}).catchError((error) {
|
|
|
|
helpers.showErrorToast(error.toString());
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
});
|
|
|
|
}).catchError((err) {
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
helpers.showErrorToast(err);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
InputDecoration buildInputDecoration(BuildContext context, hint) {
|
|
|
|
return InputDecoration(
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
icon: Icon(DoctorApp.search_patient),
|
|
|
|
color: Colors.grey,
|
|
|
|
onPressed: () {},
|
|
|
|
iconSize: 30,
|
|
|
|
),
|
|
|
|
filled: true,
|
|
|
|
fillColor: Colors.white,
|
|
|
|
hintText: hint,
|
|
|
|
hintStyle: TextStyle(fontSize: 1.66 * SizeConfig.textMultiplier),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
borderSide: BorderSide(color: HexColor('#CCCCCC')),
|
|
|
|
),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
borderSide: BorderSide(color: Colors.grey), //),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _locationBar(BuildContext _context) {
|
|
|
|
return Container(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.0619,
|
|
|
|
width: SizeConfig.screenWidth * 0.94,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0Xffffffff),
|
|
|
|
borderRadius: BorderRadius.circular(12.5),
|
|
|
|
// border: Border.all(
|
|
|
|
// width: 0.5,
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: _locations.map((item) {
|
|
|
|
bool _isActive = _locations[_activeLocation] == item ? true : false;
|
|
|
|
return Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
|
|
|
InkWell(
|
|
|
|
child: Center(
|
|
|
|
child: Container(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.058,
|
|
|
|
width: SizeConfig.screenWidth * 0.2334,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
bottomRight: Radius.circular(12.5),
|
|
|
|
topRight: Radius.circular(12.5),
|
|
|
|
topLeft: Radius.circular(9.5),
|
|
|
|
bottomLeft: Radius.circular(9.5)),
|
|
|
|
color: _isActive ? HexColor("#B8382B") : Colors.white,
|
|
|
|
),
|
|
|
|
child: Center(
|
|
|
|
child: Text(
|
|
|
|
item,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
color: _isActive
|
|
|
|
? Colors.white
|
|
|
|
: Colors.black, //Colors.black,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
filterBooking(item.toString());
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
_activeLocation = _locations.indexOf(item);
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
_isActive
|
|
|
|
? Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
bottomRight: Radius.circular(10),
|
|
|
|
topRight: Radius.circular(10)),
|
|
|
|
color: Colors.white),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
height: 1,
|
|
|
|
width: SizeConfig.screenWidth * 0.23,
|
|
|
|
)
|
|
|
|
: Container()
|
|
|
|
]);
|
|
|
|
}).toList(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|