|
|
|
|
@ -16,6 +16,7 @@ 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/Text.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';
|
|
|
|
|
@ -83,7 +84,26 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
final _controller = TextEditingController();
|
|
|
|
|
|
|
|
|
|
PatientModel patient;
|
|
|
|
|
|
|
|
|
|
var _patientSearchFormValues = PatientModel(
|
|
|
|
|
FirstName: "0",
|
|
|
|
|
MiddleName: "0",
|
|
|
|
|
LastName: "0",
|
|
|
|
|
PatientMobileNumber: "0",
|
|
|
|
|
PatientIdentificationID: "0",
|
|
|
|
|
PatientID: 0,
|
|
|
|
|
From: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
|
|
|
|
|
.toString(),
|
|
|
|
|
To: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
|
|
|
|
|
.toString(),
|
|
|
|
|
LanguageID: 2,
|
|
|
|
|
stamp: "2020-03-02T13:56:39.170Z",
|
|
|
|
|
IPAdress: "11.11.11.11",
|
|
|
|
|
VersionID: 1.2,
|
|
|
|
|
Channel: 9,
|
|
|
|
|
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
|
|
|
|
|
SessionID: "5G0yXn0Jnq",
|
|
|
|
|
IsLoginForDoctorApp: true,
|
|
|
|
|
PatientOutSA: false);
|
|
|
|
|
searchData(String str) {
|
|
|
|
|
this.responseModelList = this.responseModelList2;
|
|
|
|
|
var strExist = str.length > 0 ? true : false;
|
|
|
|
|
@ -250,7 +270,10 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
}
|
|
|
|
|
if (routeArgs != null && routeArgs.containsKey("isSearch")) {
|
|
|
|
|
isView = routeArgs['isView'];
|
|
|
|
|
patient.Searchtype = 1;
|
|
|
|
|
//patient.Searchtype = 1;
|
|
|
|
|
}
|
|
|
|
|
if (routeArgs != null && routeArgs.containsKey('activeFilter')) {
|
|
|
|
|
_activeLocation = routeArgs['activeFilter'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!projectsProvider.isArabic)
|
|
|
|
|
@ -310,34 +333,34 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
}
|
|
|
|
|
parsed = lItems;
|
|
|
|
|
responseModelList = new ModelResponse.fromJson(parsed).list;
|
|
|
|
|
//if (val2 == 7) {
|
|
|
|
|
responseModelList.sort((a, b) {
|
|
|
|
|
if (b.startTime != null && b.startTime != null) {
|
|
|
|
|
try {
|
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
|
DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm");
|
|
|
|
|
String formattedDate =
|
|
|
|
|
DateFormat('yyyy-MM-dd ' + a.startTime).format(now);
|
|
|
|
|
DateTime dateTimeA = dateFormat.parse(formattedDate);
|
|
|
|
|
String formattedDateB =
|
|
|
|
|
DateFormat('yyyy-MM-dd ' + b.startTime).format(now);
|
|
|
|
|
DateTime dateTimeB = dateFormat.parse(formattedDateB);
|
|
|
|
|
var adate = dateTimeA; //a.startTime;
|
|
|
|
|
var bdate = dateTimeB;
|
|
|
|
|
return adate.compareTo(bdate);
|
|
|
|
|
} on Exception catch (_) {
|
|
|
|
|
print('never reached');
|
|
|
|
|
var adate = a.startTime; //a.startTime;
|
|
|
|
|
var bdate = b.startTime;
|
|
|
|
|
return adate.compareTo(bdate);
|
|
|
|
|
if (val2 == 7) {
|
|
|
|
|
responseModelList.sort((a, b) {
|
|
|
|
|
if (b.startTime != null && b.startTime != null) {
|
|
|
|
|
try {
|
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
|
DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm");
|
|
|
|
|
String formattedDate =
|
|
|
|
|
DateFormat('yyyy-MM-dd ' + a.startTime).format(now);
|
|
|
|
|
DateTime dateTimeA = dateFormat.parse(formattedDate);
|
|
|
|
|
String formattedDateB =
|
|
|
|
|
DateFormat('yyyy-MM-dd ' + b.startTime).format(now);
|
|
|
|
|
DateTime dateTimeB = dateFormat.parse(formattedDateB);
|
|
|
|
|
var adate = dateTimeA; //a.startTime;
|
|
|
|
|
var bdate = dateTimeB;
|
|
|
|
|
return adate.compareTo(bdate);
|
|
|
|
|
} on Exception catch (_) {
|
|
|
|
|
print('never reached');
|
|
|
|
|
var adate = a.startTime; //a.startTime;
|
|
|
|
|
var bdate = b.startTime;
|
|
|
|
|
return adate.compareTo(bdate);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var adate = convertDateFormat(a.appointmentDate);
|
|
|
|
|
var bdate = convertDateFormat(b.appointmentDate);
|
|
|
|
|
return bdate.compareTo(adate);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var adate = convertDateFormat(a.appointmentDate);
|
|
|
|
|
var bdate = convertDateFormat(b.appointmentDate);
|
|
|
|
|
return bdate.compareTo(adate);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
responseModelList2 = responseModelList;
|
|
|
|
|
_isError = false;
|
|
|
|
|
} else {
|
|
|
|
|
@ -540,48 +563,74 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
// 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,
|
|
|
|
|
"arrivalType":
|
|
|
|
|
arrivalType,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: DrAppEmbeddedError(
|
|
|
|
|
error: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.youDontHaveAnyPatient),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// 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,
|
|
|
|
|
"arrivalType":
|
|
|
|
|
arrivalType,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment
|
|
|
|
|
.center,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
'assets/images/no-data.png'),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets
|
|
|
|
|
.all(8.0),
|
|
|
|
|
child: Texts(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.youDontHaveAnyPatient),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
// : Center(
|
|
|
|
|
// child: DrAppEmbeddedError(
|
|
|
|
|
// error: TranslationBase.of(
|
|
|
|
|
// context)
|
|
|
|
|
// .youDontHaveAnyPatient),
|
|
|
|
|
// ),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -752,11 +801,12 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
filterBooking(item.toString());
|
|
|
|
|
//filterBooking(item.toString());
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
_activeLocation = _locations.indexOf(item);
|
|
|
|
|
});
|
|
|
|
|
filterPatient(item.toString());
|
|
|
|
|
}),
|
|
|
|
|
_isActive
|
|
|
|
|
? Container(
|
|
|
|
|
@ -775,4 +825,25 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filterPatient(item) {
|
|
|
|
|
if (item == 'Tomorrow') {
|
|
|
|
|
_patientSearchFormValues.To = DateUtils.convertDateToFormat(
|
|
|
|
|
DateTime(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
DateTime.now().day + 1),
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
} else if (item == 'Next Week') {
|
|
|
|
|
_patientSearchFormValues.To = DateUtils.convertDateToFormat(
|
|
|
|
|
DateTime(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
DateTime.now().day + 6),
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
}
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS, arguments: {
|
|
|
|
|
"patientSearchForm": _patientSearchFormValues,
|
|
|
|
|
"selectedType": "7",
|
|
|
|
|
"arrivalType": "1",
|
|
|
|
|
"activeFilter": _activeLocation
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|