Add filter in outpatient

merge-requests/601/head
Mohammad Aljammal 5 years ago
parent 3af47304b3
commit f4fd4b26d6

@ -19,6 +19,32 @@ class PatientSearchViewModel extends BaseViewModel{
List<PatiantInformtion> get patientList => _outPatientService.patientList; List<PatiantInformtion> get patientList => _outPatientService.patientList;
List<PatiantInformtion> filterData = [];
searchData(String str) {
var strExist = str.length > 0 ? true : false;
if (strExist) {
filterData = [];
for (var i = 0; i < _outPatientService.patientList.length; i++) {
String firstName = _outPatientService.patientList[i].firstName.toUpperCase();
String lastName = _outPatientService.patientList[i].lastName.toUpperCase();
String mobile = _outPatientService.patientList[i].mobileNumber.toUpperCase();
String patientID = _outPatientService.patientList[i].patientId.toString();
if (firstName.contains(str.toUpperCase()) ||
lastName.contains(str.toUpperCase()) ||
mobile.contains(str) ||
patientID.contains(str)) {
filterData.add(_outPatientService.patientList[i]);
}
}
notifyListeners();
} else {
filterData = _outPatientService.patientList;
notifyListeners();
}
}
getOutPatient(PatientSearchRequestModel patientSearchRequestModel , {bool isLocalBusy = false}) async { getOutPatient(PatientSearchRequestModel patientSearchRequestModel , {bool isLocalBusy = false}) async {
if(isLocalBusy) { if(isLocalBusy) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
@ -37,6 +63,7 @@ class PatientSearchViewModel extends BaseViewModel{
} }
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
filterData = _outPatientService.patientList;
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
@ -49,6 +76,7 @@ class PatientSearchViewModel extends BaseViewModel{
error = _outPatientService.error; error = _outPatientService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
filterData = _outPatientService.patientList;
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
@ -103,12 +131,9 @@ class PatientSearchViewModel extends BaseViewModel{
if(isSearchWithKeyInfo) { if(isSearchWithKeyInfo) {
await getPatientFileInformation(currentModel); await getPatientFileInformation(currentModel);
} else { } else {
if(selectedPatientType == PatientType.OutPatient) {
await getOutPatient(currentModel, isLocalBusy: true); await getOutPatient(currentModel, isLocalBusy: true);
} else {
// TODO handel inPatient case
} }
} filterData = _outPatientService.patientList;
} }

@ -219,10 +219,10 @@ class _PatientsScreenNewState extends State<PatientsScreenNew> {
height: 10.0, height: 10.0,
), ),
Container( Container(
child: (model.patientList.isNotEmpty) child: model.patientList.isNotEmpty
? Column( ? Column(
// mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: model.patientList children: model.filterData
.map((PatiantInformtion .map((PatiantInformtion
item) { item) {
return PatientCard( return PatientCard(

@ -378,7 +378,6 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>with SingleT
if (patient.appointmentNo != null && if (patient.appointmentNo != null &&
patient.appointmentNo != 0) patient.appointmentNo != 0)
PatientProfileButton( PatientProfileButton(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -388,26 +387,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>with SingleT
nameLine1: TranslationBase.of(context).admission, nameLine1: TranslationBase.of(context).admission,
nameLine2: TranslationBase.of(context).request, nameLine2: TranslationBase.of(context).request,
icon: 'patient/admission_req.png'), icon: 'patient/admission_req.png'),
if (isInpatient)
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: PROGRESS_NOTE,
nameLine1: TranslationBase.of(context).progress,
nameLine2: TranslationBase.of(context).note,
icon: 'patient/Progress_notes.png'),
if (isInpatient)
PatientProfileButton(
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
route: ORDER_NOTE,
nameLine1: "Order", //"Text",
nameLine2: "Sheet",
icon: 'patient/Progress_notes.png'),
], ],
), ),
], ],

Loading…
Cancel
Save