in patient list improve performace

merge-requests/829/head
Elham Rababh 5 years ago
parent 9317173c05
commit a1f9729091

@ -258,6 +258,14 @@ class PatientSearchViewModel extends BaseViewModel {
} }
} }
removeOnFilteredList() {
if (lastSubsetIndex-inPatientPageSize - 1 > 0) {
filteredInPatientItems
.removeAt(lastSubsetIndex-inPatientPageSize - 1);
setState(ViewState.Idle);
}
}
filterByHospital({int hospitalId}) { filterByHospital({int hospitalId}) {
filteredInPatientItems = []; filteredInPatientItems = [];
for (var i = 0; i < inPatientList.length; i++) { for (var i = 0; i < inPatientList.length; i++) {

@ -48,8 +48,9 @@ class _InPatientListPageState extends State<InPatientListPage> {
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if(!widget.isMyInPatient)
Container( Container(
margin: EdgeInsets.only(left: 10.0,right: 10, top: 10), margin: EdgeInsets.only(left: 10.0, right: 10, top: 10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -120,7 +121,7 @@ class _InPatientListPageState extends State<InPatientListPage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top:5), margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 5),
child: Stack( child: Stack(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
@ -155,8 +156,8 @@ class _InPatientListPageState extends State<InPatientListPage> {
// padding: EdgeInsets.only(bottom: 30), // padding: EdgeInsets.only(bottom: 30),
onPressed: () { onPressed: () {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
widget.patientSearchViewModel widget.patientSearchViewModel.sortInPatient(
.sortInPatient(isDes: isSortDes, isAllClinic:isAllClinic); isDes: isSortDes, isAllClinic: isAllClinic);
isSortDes = !isSortDes; isSortDes = !isSortDes;
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}, },
@ -286,11 +287,19 @@ class _InPatientListPageState extends State<InPatientListPage> {
}), }),
onNotification: (t) { onNotification: (t) {
if (isAllClinic && !hasQuery) if (t if (isAllClinic && !hasQuery) if (t
is ScrollUpdateNotification && is ScrollUpdateNotification) {
t.metrics.pixels >= if (t.metrics.pixels >=
t.metrics.maxScrollExtent - 50) { t.metrics.maxScrollExtent - 50) {
widget.patientSearchViewModel widget.patientSearchViewModel
.addOnFilteredList(); .addOnFilteredList();
}
if (t.metrics.pixels <=
t.metrics.minScrollExtent - 50) {
widget.patientSearchViewModel
.removeOnFilteredList();
}
} }
return; return;
}, },

@ -349,21 +349,22 @@ class PatientCard extends StatelessWidget {
), ),
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
CustomRow( CustomRow(
label: TranslationBase.of(context).fileNumber, label:
TranslationBase.of(context).fileNumber,
value: patientInfo.patientId.toString(), value: patientInfo.patientId.toString(),
), ),
CustomRow( CustomRow(
label: TranslationBase.of(context).age + " : ", label:
TranslationBase.of(context).age + " : ",
value: value:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
), ),
if (isInpatient) if (isInpatient)
CustomRow( CustomRow(
label: patientInfo.admissionDate == null label: patientInfo.admissionDate == null
@ -377,33 +378,46 @@ class PatientCard extends StatelessWidget {
), ),
if (patientInfo.admissionDate != null) if (patientInfo.admissionDate != null)
CustomRow( CustomRow(
label: TranslationBase.of(context).numOfDays + label: TranslationBase.of(context)
.numOfDays +
" : ", " : ",
value: value:
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
), ),
if (patientInfo.admissionDate != null)
CustomRow(
// TODO Elham* add translation
label:
"Clinic Name" +
" : ",
value: "${patientInfo.clinicDescription}",
),
if (patientInfo.admissionDate != null) if (patientInfo.admissionDate != null)
CustomRow( CustomRow(
label: label:
TranslationBase.of(context).roomNo + " : ", TranslationBase.of(context).roomNo +
" : ",
value: "${patientInfo.roomId}", value: "${patientInfo.roomId}",
), ),
if (isFromLiveCare) if (isFromLiveCare)
Column( Column(
children: [ children: [
CustomRow( CustomRow(
label: TranslationBase.of(context).clinic + label: TranslationBase.of(context)
.clinic +
" : ", " : ",
value: patientInfo.clinicName, value: patientInfo.clinicName,
), ),
], ],
), ),
]), ]),
), ),
Icon(Icons.arrow_forward, size: 24,), Icon(
], Icons.arrow_forward,
)) size: 24,
),
],
))
]), ]),
isFromLiveCare isFromLiveCare
? Row( ? Row(
@ -458,5 +472,3 @@ class PatientCard extends StatelessWidget {
)); ));
} }
} }

Loading…
Cancel
Save