diff --git a/lib/core/model/patient_muse/PatientSearchRequestModel.dart b/lib/core/model/patient_muse/PatientSearchRequestModel.dart index e8d32cf0..dcb9b31c 100644 --- a/lib/core/model/patient_muse/PatientSearchRequestModel.dart +++ b/lib/core/model/patient_muse/PatientSearchRequestModel.dart @@ -64,7 +64,7 @@ class PatientSearchRequestModel { data['SearchType'] = this.searchType; data['MobileNo'] = this.mobileNo; data['IdentificationNo'] = this.identificationNo; - //data['NursingStationID'] = this.nursingStationID; + data['NursingStationID'] = this.nursingStationID; data['ClinicID'] = this.clinicID; data['ProjectID'] = this.projectID; return data; diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 0ee76cb4..29bbc6aa 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -155,7 +155,7 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Error); } } else { - // setDefaultInPatientList(); + setDefaultInPatientList(); setState(ViewState.Idle); } } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 7df01bf9..8346e33d 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -106,7 +106,7 @@ class DashboardViewModel extends BaseViewModel { GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ GetSpecialClinicalCareListResponseModel special ; specialClinicalCareList.forEach((element) { - if(element.clinicID == 1){ + if(element.clinicID == clinicId){ special = element; } }); diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 3efd0243..42f8e7f3 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -71,7 +71,7 @@ class _HomeScreenState extends State { await model.getDashboard(); await model.getDoctorProfile(isGetProfile: true); await model.checkDoctorHasLiveCare(); - // await model.getSpecialClinicalCareList(); + await model.getSpecialClinicalCareList(); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index a88d3007..2a41414a 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -16,14 +16,16 @@ import '../../routes.dart'; class InPatientPage extends StatefulWidget { final bool isMyInPatient; + final PatientSearchViewModel patientSearchViewModel; - InPatientPage(this.isMyInPatient); + InPatientPage(this.isMyInPatient, this.patientSearchViewModel); @override _InPatientPageState createState() => _InPatientPageState(); } class _InPatientPageState extends State { + TextEditingController _searchController = TextEditingController(); bool isSortDes = false; @@ -36,166 +38,159 @@ class _InPatientPageState extends State { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) async { - await model.setDefaultInPatientList(); - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Container( - margin: EdgeInsets.all(16.0), - child: Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context).searchPatientName, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), - onPressed: () {}, - ), - controller: _searchController, - onChanged: (value) { - model.filterSearchResults(value); - }), - - Positioned( - right: 35, - top:5, - child: IconButton( + return AppScaffold( + baseViewModel: widget.patientSearchViewModel, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Container( + margin: EdgeInsets.all(16.0), + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( icon: Icon( - isSortDes - ? FontAwesomeIcons.sortAmountDown - : FontAwesomeIcons.sortAmountUp, + Icons.search, color: Colors.black, ), - iconSize: 20, - // padding: EdgeInsets.only(bottom: 30), - onPressed: () { - GifLoaderDialogUtils.showMyDialog(context); - model.sortInPatient(isDes: isSortDes); - isSortDes = !isSortDes; - GifLoaderDialogUtils.hideDialog(context); - }, + onPressed: () {}, ), - ) - ], - ), - ), - model.state == ViewState.Idle?model.filteredInPatientItems.length > 0 - ? Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...List.generate( - model.filteredInPatientItems.length, (index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: - model.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: model - .filteredInPatientItems[index] - .doctorId == - model.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": model - .filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else if (model.filteredInPatientItems[index] - .doctorId == - model.doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: - model.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: model - .filteredInPatientItems[index] - .doctorId == - model.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + controller: _searchController, + onChanged: (value) { + widget.patientSearchViewModel.filterSearchResults(value); + }), - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": model - .filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], - ), - ), - ), - ) - : Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: - TranslationBase.of(context).noDataAvailable)), - ), - ): Center( - child: Container( - height: 300, - width: 300, - child: Image.asset( - "assets/images/progress-loading-red.gif"), + Positioned( + right: 35, + top:5, + child: IconButton( + icon: Icon( + isSortDes + ? FontAwesomeIcons.sortAmountDown + : FontAwesomeIcons.sortAmountUp, + color: Colors.black, ), + iconSize: 20, + // padding: EdgeInsets.only(bottom: 30), + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); + isSortDes = !isSortDes; + GifLoaderDialogUtils.hideDialog(context); + }, ), - ], - ), + ) + ], + ), + ), + widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 + ? Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + widget.patientSearchViewModel.filteredInPatientItems.length, (index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: + widget.patientSearchViewModel.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget.patientSearchViewModel. + filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else if (widget.patientSearchViewModel.filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: + widget.patientSearchViewModel.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget.patientSearchViewModel + .filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget.patientSearchViewModel.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else + return SizedBox(); + }), + SizedBox( + height: 15, + ) + ], + ), + ), + ), + ) + : Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: + TranslationBase.of(context).noDataAvailable)), + ), + ): Center( + child: Container( + height: 300, + width: 300, + child: Image.asset( + "assets/images/progress-loading-red.gif"), + ), + ), + ], ), ); } diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index ae0fbb59..aaa50783 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -65,12 +65,12 @@ class _PatientInPatientScreenState extends State return BaseView( onModelReady: (model) async { model.clearPatientList(); - // if (widget.specialClinic != null) { - // await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); - // requestModel.nursingStationID = - // model.specialClinicalCareMappingList[0].nursingStationID; - // requestModel.clinicID = 0; - // } + if (widget.specialClinic != null) { + await model.getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); + requestModel.nursingStationID = + model.specialClinicalCareMappingList[0].nursingStationID; + requestModel.clinicID = 0; + } model.getInPatientList(requestModel); }, builder: (_, model, w) => @@ -265,8 +265,8 @@ class _PatientInPatientScreenState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - InPatientPage(false), - InPatientPage(true), + InPatientPage(false, model), + InPatientPage(true,model), DischargedPatient(), ], ),