From c9c18efd72bc41f93c6ff83ad64a92498a101488 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 26 Apr 2021 10:40:03 +0300 Subject: [PATCH 1/2] add in lab result get in and out patient --- lib/core/service/labs_service.dart | 2 +- .../profile/lab_result/labs_home_page.dart | 58 +++++++++++++++-- .../radiology/radiology_home_page.dart | 63 ++++++++++++++++--- lib/widgets/shared/app_texts_widget.dart | 10 ++- 4 files changed, 114 insertions(+), 19 deletions(-) diff --git a/lib/core/service/labs_service.dart b/lib/core/service/labs_service.dart index f38294b5..f89c66da 100644 --- a/lib/core/service/labs_service.dart +++ b/lib/core/service/labs_service.dart @@ -28,7 +28,7 @@ class LabsService extends BaseService { await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { - patientLabOrdersList.clear(); + patientLabOrdersList=[]; if (!isInpatient) { response['ListPLO'].forEach((hospital) { patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 02765c20..3dc771f5 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -12,18 +12,30 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class LabsHomePage extends StatelessWidget { +class LabsHomePage extends StatefulWidget { + @override + _LabsHomePageState createState() => _LabsHomePageState(); +} + +class _LabsHomePageState extends State { String patientType; + String arrivalType; + PatiantInformtion patient; + bool isInpatient; @override - Widget build(BuildContext context) { + void didChangeDependencies() { + super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; - - PatiantInformtion patient = routeArgs['patient']; + patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; - bool isInpatient = routeArgs['isInpatient']; + isInpatient = routeArgs['isInpatient']; print(arrivalType); + } + + @override + Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getLabs(patient, isInpatient: isInpatient), builder: (context, ProcedureViewModel model, widget) => AppScaffold( @@ -93,6 +105,42 @@ class LabsHomePage extends StatelessWidget { )), ); },label: 'Apply for New Lab Order',), + if(!isInpatient) + Container( + margin: EdgeInsets.only(right: 8), + width: double.maxFinite, + child: InkWell( + onTap: (){ + setState(() { + isInpatient= true; + }); + model.getLabs(patient, isInpatient: true); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Inpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), + if(isInpatient) + Container( + width: double.maxFinite, + margin: EdgeInsets.only(right: 8), + child: InkWell( + onTap: (){ + setState(() { + isInpatient= false; + }); + model.getLabs(patient, isInpatient: false); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Outpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), ...List.generate( model.patientLabOrdersList.length, (index) => Column( diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 90d22369..ec34bcd1 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -14,16 +14,29 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -class RadiologyHomePage extends StatelessWidget { +class RadiologyHomePage extends StatefulWidget { @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + _RadiologyHomePageState createState() => _RadiologyHomePageState(); +} + +class _RadiologyHomePageState extends State { + String patientType; + PatiantInformtion patient; + String arrivalType; + bool isInpatient; + @override + void didChangeDependencies() { + super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; - bool isInpatient = routeArgs['isInpatient']; + patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + isInpatient = routeArgs['isInpatient']; + print(arrivalType); + } + @override + Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getPatientRadOrders(patient, patientType: patientType, isInPatient: isInpatient), @@ -99,6 +112,42 @@ class RadiologyHomePage extends StatelessWidget { }, label: 'Apply for Radiology Order', ), + if(!isInpatient) + Container( + width: double.maxFinite, + margin: EdgeInsets.only(right: 8), + child: InkWell( + onTap: (){ + setState(() { + isInpatient = true; + }); + model.getPatientRadOrders(patient, patientType: patientType, isInPatient: true); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Inpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), + if(isInpatient) + Container( + margin: EdgeInsets.only(right: 8), + width: double.maxFinite, + child: InkWell( + onTap: (){ + setState(() { + isInpatient = false; + }); + model.getPatientRadOrders(patient, patientType: patientType, isInPatient: false); + }, + child: Align( + alignment: Alignment.centerRight, + child: AppText('View Outpatient Lab Result', + textDecoration:TextDecoration.underline,color: Colors.red,), + ), + ), + ), ...List.generate( model.radiologyList.length, (index) => InkWell( diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index d8d5a928..74acff8a 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -121,16 +121,14 @@ class _AppTextState extends State { style: widget.style != null ? _getFontStyle().copyWith( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color != null ? widget.color : null, + color: widget.color , fontWeight: widget.fontWeight ?? _getFontWeight(), ) : TextStyle( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.textDecoration == null - ? widget.color != null - ? widget.color - : Colors.black - : null, + color: widget.color != null + ? widget.color + : Colors.black, fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: widget.variant == "overline" ? 1.5 : null, From 55c63c95316654922100989b3406402defd630c5 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 26 Apr 2021 10:53:41 +0300 Subject: [PATCH 2/2] fix Discharged Patient --- lib/core/service/radiology_service.dart | 2 +- .../viewModel/DischargedPatientViewModel.dart | 16 +++++++--------- lib/screens/patients/DischargedPatientPage.dart | 2 +- .../profile/lab_result/labs_home_page.dart | 1 + lib/widgets/shared/doctor_card.dart | 5 +++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/core/service/radiology_service.dart b/lib/core/service/radiology_service.dart index b1c0fbd4..42a79098 100644 --- a/lib/core/service/radiology_service.dart +++ b/lib/core/service/radiology_service.dart @@ -39,7 +39,7 @@ class RadiologyService extends BaseService { await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { - finalRadiologyList.clear(); + finalRadiologyList = []; String label = "ListRAD"; if(isInPatient) { label ="List_GetRadOreders"; diff --git a/lib/core/viewModel/DischargedPatientViewModel.dart b/lib/core/viewModel/DischargedPatientViewModel.dart index 339e9505..1c1ed4d1 100644 --- a/lib/core/viewModel/DischargedPatientViewModel.dart +++ b/lib/core/viewModel/DischargedPatientViewModel.dart @@ -13,15 +13,12 @@ class DischargedPatientViewModel extends BaseViewModel { _dischargedPatientService.myDischargedPatients; - - List get filterData => filterData2.isNotEmpty? filterData2:myDischargedPatient; - - List filterData2 = []; + List filterData = []; searchData(String str) { var strExist = str.length > 0 ? true : false; if (strExist) { - filterData2 = []; + filterData = []; for (var i = 0; i < myDischargedPatient.length; i++) { String firstName = myDischargedPatient[i].firstName.toUpperCase(); String lastName = myDischargedPatient[i].lastName.toUpperCase(); @@ -32,12 +29,12 @@ class DischargedPatientViewModel extends BaseViewModel { lastName.contains(str.toUpperCase()) || mobile.contains(str) || patientID.contains(str)) { - filterData2.add(myDischargedPatient[i]); + filterData.add(myDischargedPatient[i]); } } notifyListeners(); } else { - filterData2 = myDischargedPatient; + filterData = myDischargedPatient; notifyListeners(); } } @@ -49,8 +46,9 @@ class DischargedPatientViewModel extends BaseViewModel { if (_dischargedPatientService.hasError) { error = _dischargedPatientService.error; setState(ViewState.Error); - } else - setState(ViewState.Idle); + } else{ + filterData = myDischargedPatient; + setState(ViewState.Idle);} } Future gtMyDischargeReferralPatient() async { diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 0ba791c6..0e61702d 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -30,7 +30,7 @@ class _DischargedPatientState extends State { backgroundColor: Colors.grey[200], isShowAppBar: true, baseViewModel: model, - body: model.filterData.isEmpty?Center( + body: model.myDischargedPatient.isEmpty?Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 3dc771f5..1cdc5987 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -168,6 +168,7 @@ class _LabsHomePageState extends State { clinic: labOrder.clinicDescription, appointmentDate: labOrder.orderDate, orderNo: labOrder.orderNo, + isShowTime: false, ); }).toList(), ), diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index a974c5f8..1c889d9d 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -19,6 +19,7 @@ class DoctorCard extends StatelessWidget { final bool isPrescriptions; final String clinic; final bool isShowEye; + final bool isShowTime; DoctorCard( {this.doctorName, @@ -30,7 +31,7 @@ class DoctorCard extends StatelessWidget { this.orderNo, this.isPrescriptions = false, this.clinic, - this.isShowEye = true}); + this.isShowEye = true, this.isShowTime= true}); @override Widget build(BuildContext context) { @@ -71,7 +72,7 @@ class DoctorCard extends StatelessWidget { fontWeight: FontWeight.w600, fontSize: 14, ), - if (!isPrescriptions) + if (!isPrescriptions&& isShowTime) AppText( '${DateUtils.getHour(appointmentDate)}', fontWeight: FontWeight.w600,