diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 45b73329..816918cd 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -19,6 +19,32 @@ class PatientSearchViewModel extends BaseViewModel{ List get patientList => _outPatientService.patientList; + List 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 { if(isLocalBusy) { setState(ViewState.BusyLocal); @@ -37,6 +63,7 @@ class PatientSearchViewModel extends BaseViewModel{ } setState(ViewState.Error); } else { + filterData = _outPatientService.patientList; setState(ViewState.Idle); } } @@ -49,6 +76,7 @@ class PatientSearchViewModel extends BaseViewModel{ error = _outPatientService.error; setState(ViewState.Error); } else { + filterData = _outPatientService.patientList; setState(ViewState.Idle); } } @@ -103,12 +131,9 @@ class PatientSearchViewModel extends BaseViewModel{ if(isSearchWithKeyInfo) { await getPatientFileInformation(currentModel); } else { - if(selectedPatientType == PatientType.OutPatient) { await getOutPatient(currentModel, isLocalBusy: true); - } else { - // TODO handel inPatient case } - } + filterData = _outPatientService.patientList; } diff --git a/lib/screens/patients/patient_search/header.dart b/lib/screens/patients/patient_search/header.dart index eb404e70..0fbcdf1a 100644 --- a/lib/screens/patients/patient_search/header.dart +++ b/lib/screens/patients/patient_search/header.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -class HeaderInSearch extends StatelessWidget { +class HeaderInSearch extends StatelessWidget with PreferredSizeWidget { final String title; const HeaderInSearch({Key key, this.title}) : super(key: key); @@ -16,7 +16,7 @@ class HeaderInSearch extends StatelessWidget { ), child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), + margin: EdgeInsets.only(top: 35), child: Row(children: [ IconButton( icon: Icon(Icons.arrow_back_ios), @@ -36,4 +36,8 @@ class HeaderInSearch extends StatelessWidget { ), ); } + + @override + + Size get preferredSize => Size(double.maxFinite,65); } diff --git a/lib/screens/patients/patient_search/patients_screen_new.dart b/lib/screens/patients/patient_search/patients_screen_new.dart index 1e5f7339..8786bc48 100644 --- a/lib/screens/patients/patient_search/patients_screen_new.dart +++ b/lib/screens/patients/patient_search/patients_screen_new.dart @@ -206,7 +206,7 @@ class _PatientsScreenNewState extends State { bottom: 30), ), onChanged: (String str) { - // this.searchData(str); + model.searchData(str); }), ])), SizedBox( @@ -216,10 +216,10 @@ class _PatientsScreenNewState extends State { height: 10.0, ), Container( - child: (model.patientList.isNotEmpty) + child: model.patientList.isNotEmpty ? Column( // mainAxisAlignment: MainAxisAlignment.center, - children: model.patientList + children: model.filterData .map((PatiantInformtion item) { return PatientCard( diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index 4e1c288f..9cb8a0d4 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -378,7 +378,6 @@ class _PatientProfileScreenState extends Statewith SingleT if (patient.appointmentNo != null && patient.appointmentNo != 0) PatientProfileButton( - patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -388,26 +387,7 @@ class _PatientProfileScreenState extends Statewith SingleT nameLine1: TranslationBase.of(context).admission, nameLine2: TranslationBase.of(context).request, 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'), ], ), ], diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index 43a4b79d..f7f39d95 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -35,18 +35,18 @@ class PatientCard extends StatelessWidget { color: Colors.white, ), child: Stack(children: [ - // if (SERVICES_PATIANT2[int.parse(patientType)] != "List_MyInPatient") - // Container( - // height: MediaQuery.of(context).size.height * .20, - // width: 5, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.only( - // topLeft: Radius.circular(10), - // bottomLeft: Radius.circular(10)), - // color: patientInfo.patientStatusType == 43 - // ? Colors.green[500] - // : Colors.red[800], - // )), + if (isInpatient) + Container( + height: MediaQuery.of(context).size.height * .20, + width: 5, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + bottomLeft: Radius.circular(10)), + color: patientInfo.patientStatusType == 43 + ? Colors.green[500] + : Colors.red[800], + )), Container( padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), child: InkWell( @@ -55,48 +55,47 @@ class PatientCard extends StatelessWidget { SizedBox( height: 10, ), - // SERVICES_PATIANT2[int.parse(patientType)] == - // "List_MyOutPatient" - // ? Padding( - // padding: EdgeInsets.only(left: 12.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // patientInfo.patientStatusType == 43 - // ? AppText( - // TranslationBase.of(context).arrivedP, - // color: Colors.green, - // fontWeight: FontWeight.bold, - // fontFamily: 'Poppins', - // fontSize: 12, - // ) - // : AppText( - // TranslationBase.of(context).notArrived, - // color: Colors.red[800], - // fontWeight: FontWeight.bold, - // fontFamily: 'Poppins', - // fontSize: 12, - // ), - // this.arrivalType == '1' - // ? AppText( - // patientInfo.startTime != null - // ? patientInfo.startTime - // : patientInfo.startTimes, - // fontFamily: 'Poppins', - // fontWeight: FontWeight.w600, - // ) - // : patientInfo.arrivedOn != null - // ? AppText( - // DateUtils.convertStringToDateFormat( - // patientInfo.arrivedOn, - // 'MM-dd-yyyy HH:mm'), - // fontFamily: 'Poppins', - // fontWeight: FontWeight.w600, - // ) - // : SizedBox() - // ], - // )) - // : SizedBox(), + !isInpatient + ? Padding( + padding: EdgeInsets.only(left: 12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + patientInfo.patientStatusType == 43 + ? AppText( + TranslationBase.of(context).arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ) + : AppText( + TranslationBase.of(context).notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + this.arrivalType == '1' + ? AppText( + patientInfo.startTime != null + ? patientInfo.startTime + : patientInfo.startTimes, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + : patientInfo.arrivedOn != null + ? AppText( + DateUtils.getDayMonthYearDateFormatted(DateUtils.convertStringToDate( + patientInfo.arrivedOn, + )), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ) + : SizedBox() + ], + )) + : SizedBox(), Padding( padding: EdgeInsets.only(left: 12.0), child: Row( @@ -213,33 +212,32 @@ class PatientCard extends StatelessWidget { ), ), ), - // if (SERVICES_PATIANT2[int.parse(patientType)] != - // "List_MyInPatient") - // Container( - // child: RichText( - // text: new TextSpan( - // style: new TextStyle( - // fontSize: 2.0 * SizeConfig.textMultiplier, - // color: Colors.black, - // fontFamily: 'Poppins', - // ), - // children: [ - // new TextSpan( - // text: - // TranslationBase.of(context).age + - // " : ", - // style: TextStyle(fontSize: 14)), - // new TextSpan( - // text: - // "${DateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}", - // style: TextStyle( - // fontWeight: FontWeight.w700, - // fontSize: 15)), - // ], - // ), - // ), - // ), - if (isInpatient == true) + if (isInpatient) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: + TranslationBase.of(context).age + + " : ", + style: TextStyle(fontSize: 14)), + new TextSpan( + text: + "${DateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15)), + ], + ), + ), + ), + if (isInpatient ) Container( child: RichText( text: new TextSpan( @@ -370,28 +368,26 @@ class PatientCard extends StatelessWidget { //) ])) ]), - // SERVICES_PATIANT2[int.parse(patientType)] == - // "List_MyOutPatient" - // ? Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Container( - // padding: EdgeInsets.all(4), - // child: Image.asset( - // patientInfo.appointmentType == - // 'Regular' && - // patientInfo.visitTypeId == 100 - // ? 'assets/images/livecare.png' - // : patientInfo.appointmentType == - // 'Walkin' - // ? 'assets/images/walkin.png' - // : 'assets/images/booked.png', - // height: 25, - // width: 35, - // )), - // ]) - // : - (isInpatient == true) + !isInpatient + ? Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(4), + child: Image.asset( + patientInfo.appointmentType == + 'Regular' && + patientInfo.visitTypeId == 100 + ? 'assets/images/livecare.png' + : patientInfo.appointmentType == + 'Walkin' + ? 'assets/images/walkin.png' + : 'assets/images/booked.png', + height: 25, + width: 35, + )), + ]) + : (isInpatient == true) ? Row( mainAxisAlignment: MainAxisAlignment.end, children: [