|
|
|
|
@ -394,17 +394,51 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
: lItems == null || lItems.length == 0
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (int.parse(patientType) == 7)
|
|
|
|
|
Column(children: <Widget>[
|
|
|
|
|
SizedBox(height: 18.5),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10),
|
|
|
|
|
child: ClinicList(
|
|
|
|
|
clinicId: clinicId,
|
|
|
|
|
onClinicChange: (newValue) {
|
|
|
|
|
clinicId = newValue;
|
|
|
|
|
changeClinic(newValue, context, model);
|
|
|
|
|
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: _locationBar(context)
|
|
|
|
|
child:
|
|
|
|
|
SERVICES_PATIANT2[int.parse(patientType)] ==
|
|
|
|
|
"patientArrivalList"
|
|
|
|
|
? _locationBar(context, model)
|
|
|
|
|
: Container(),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
top: MediaQuery.of(context).size.height * 0.10),
|
|
|
|
|
@ -423,14 +457,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
// : Center(
|
|
|
|
|
// child: DrAppEmbeddedError(
|
|
|
|
|
// error: TranslationBase.of(
|
|
|
|
|
// context)
|
|
|
|
|
// .youDontHaveAnyPatient),
|
|
|
|
|
// ),
|
|
|
|
|
,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
@ -505,7 +532,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
child: SERVICES_PATIANT2[
|
|
|
|
|
int.parse(patientType)] ==
|
|
|
|
|
"patientArrivalList"
|
|
|
|
|
? _locationBar(context)
|
|
|
|
|
? _locationBar(context, model)
|
|
|
|
|
: Container(),
|
|
|
|
|
),
|
|
|
|
|
// Row(
|
|
|
|
|
@ -778,7 +805,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _locationBar(BuildContext _context) {
|
|
|
|
|
Widget _locationBar(BuildContext _context, model) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.0619,
|
|
|
|
|
width: SizeConfig.screenWidth * 0.94,
|
|
|
|
|
@ -829,7 +856,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
setState(() {
|
|
|
|
|
_activeLocation = _locations.indexOf(item);
|
|
|
|
|
});
|
|
|
|
|
filterPatient(item.toString());
|
|
|
|
|
filterPatient(item.toString(), model);
|
|
|
|
|
}),
|
|
|
|
|
_isActive
|
|
|
|
|
? Container(
|
|
|
|
|
@ -849,7 +876,7 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filterPatient(item) {
|
|
|
|
|
filterPatient(item, model) {
|
|
|
|
|
if (item == 'Tomorrow') {
|
|
|
|
|
_patientSearchFormValues.To = DateUtils.convertDateToFormat(
|
|
|
|
|
DateTime(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
@ -869,13 +896,123 @@ class _PatientsScreenState extends State<PatientsScreen> {
|
|
|
|
|
DateTime(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
DateTime.now().day + 6),
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
} else {
|
|
|
|
|
_patientSearchFormValues.From = DateUtils.convertDateToFormat(
|
|
|
|
|
DateTime(
|
|
|
|
|
DateTime.now().year, DateTime.now().month, DateTime.now().day),
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
_patientSearchFormValues.To = DateUtils.convertDateToFormat(
|
|
|
|
|
DateTime(
|
|
|
|
|
DateTime.now().year, DateTime.now().month, DateTime.now().day),
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
}
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS, arguments: {
|
|
|
|
|
"patientSearchForm": _patientSearchFormValues,
|
|
|
|
|
"selectedType": "7",
|
|
|
|
|
"arrivalType": "1",
|
|
|
|
|
"activeFilter": _activeLocation
|
|
|
|
|
searchPatient(model);
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// Navigator.of(context).pushNamed(PATIENTS, arguments: {
|
|
|
|
|
// "patientSearchForm": _patientSearchFormValues,
|
|
|
|
|
// "selectedType": "7",
|
|
|
|
|
// "arrivalType": "1",
|
|
|
|
|
// "activeFilter": _activeLocation
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchPatient(model) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
int val2 = int.parse(patientType);
|
|
|
|
|
GetPatientArrivalListRequestModel getPatientArrivalListRequestModel;
|
|
|
|
|
if (val2 == 7) {
|
|
|
|
|
getPatientArrivalListRequestModel = GetPatientArrivalListRequestModel(
|
|
|
|
|
from: _patientSearchFormValues.From,
|
|
|
|
|
to: _patientSearchFormValues.To,
|
|
|
|
|
pageIndex: 0,
|
|
|
|
|
pageSize: 0,
|
|
|
|
|
patientMRN: patient.getPatientID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model
|
|
|
|
|
.getPatientList(
|
|
|
|
|
val2 == 7 ? getPatientArrivalListRequestModel.toJson() : patient,
|
|
|
|
|
patientType,
|
|
|
|
|
isView: isView)
|
|
|
|
|
.then((res) {
|
|
|
|
|
setState(() {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
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 {
|
|
|
|
|
if (isView == false && val2 == 1) {
|
|
|
|
|
lItems = res['GetPatientFileInformation_PRMList']
|
|
|
|
|
.where((i) => i['PatientTypeDescription'] == 'Permanent File')
|
|
|
|
|
.toList();
|
|
|
|
|
} else {
|
|
|
|
|
lItems = res[SERVICES_PATIANT2[val2]];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var adate = convertDateFormat(a.appointmentDate);
|
|
|
|
|
var bdate = convertDateFormat(b.appointmentDate);
|
|
|
|
|
return bdate.compareTo(adate);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
responseModelList2 = responseModelList;
|
|
|
|
|
_isError = false;
|
|
|
|
|
} else {
|
|
|
|
|
_isError = true;
|
|
|
|
|
error =
|
|
|
|
|
model.error ?? res['ErrorEndUserMessage'] ?? res['ErrorMessage'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}).catchError((error) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_isError = true;
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
this.error = error.toString();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|