From c3ac50a859db60fbf56b24f78c8257aac8de1c7f Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 26 Apr 2021 23:19:25 +0300 Subject: [PATCH] hot fixes --- .../viewModel/PatientSearchViewModel.dart | 1 + lib/models/patient/patiant_info_model.dart | 4 +- .../patients/PatientsInPatientScreen.dart | 1 + .../patient_search_screen_new.dart | 2 +- .../patient_search/patients_screen_new.dart | 3 +- .../profile/patient_profile_screen.dart | 4 + lib/util/date-utils.dart | 9 ++ lib/widgets/patients/PatientCard.dart | 131 ++++++++++++++---- 8 files changed, 126 insertions(+), 29 deletions(-) diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 816918cd..59f8c9c6 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -147,6 +147,7 @@ class PatientSearchViewModel extends BaseViewModel{ Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false, bool isFirstTime = true}) async { + await getDoctorProfile(); if (isFirstTime) setState(ViewState.Busy); else diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index a794cf29..cd21f911 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -61,6 +61,7 @@ class PatiantInformtion { int visitTypeId; String startTimes; String dischargeDate; + int status; PatiantInformtion( {this.patientDetails, this.projectId, @@ -120,7 +121,7 @@ class PatiantInformtion { this.nationalityFlagURL, this.patientStatusType, this.visitTypeId, - this.startTimes,this.dischargeDate}); + this.startTimes,this.dischargeDate,this.status}); factory PatiantInformtion.fromJson(Map json) => PatiantInformtion( @@ -197,5 +198,6 @@ class PatiantInformtion { visitTypeId: json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'], startTimes: json['StartTime'] ?? json['StartTime'], dischargeDate: json['DischargeDate'] , + status: json['Status'] , ); } diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index ba8b5f0a..2a3f3839 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -107,6 +107,7 @@ class _PatientInPatientScreenState extends State { patientType: "1", arrivalType: "1", isInpatient: true, + isMyPatient: _activeTab!=0? false:item.doctorId==model.doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { diff --git a/lib/screens/patients/patient_search/patient_search_screen_new.dart b/lib/screens/patients/patient_search/patient_search_screen_new.dart index 14d65831..c101567a 100644 --- a/lib/screens/patients/patient_search/patient_search_screen_new.dart +++ b/lib/screens/patients/patient_search/patient_search_screen_new.dart @@ -296,7 +296,7 @@ class _PatientSearchScreenNewState extends State { patientFileInfoController.text.isNotEmpty ? true : false, isSearch: true, searchKey: patientFileInfoController.text, - isInpatient: selectedPatientType == PatientType.OutPatient && patientFileInfoController.text.isEmpty?false: true, + isInpatient: selectedPatientType != PatientType.OutPatient, ), ), ); diff --git a/lib/screens/patients/patient_search/patients_screen_new.dart b/lib/screens/patients/patient_search/patients_screen_new.dart index 8786bc48..ab1e9594 100644 --- a/lib/screens/patients/patient_search/patients_screen_new.dart +++ b/lib/screens/patients/patient_search/patients_screen_new.dart @@ -108,7 +108,7 @@ class _PatientsScreenNewState extends State { Container( child: Column( children: [ - if(!widget.isInpatient) + if(!widget.isInpatient && !widget.isSearch) Container( // color: Colors.red, height: screenSize.height * 0.070, @@ -249,6 +249,7 @@ class _PatientsScreenNewState extends State { "7", }); }, + isFromSearch: widget.isSearch, ); }).toList(), ) diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index 9cb8a0d4..5bfb84db 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -58,6 +58,10 @@ class _PatientProfileScreenState extends Statewith SingleT if (routeArgs.containsKey("isDischargedPatient")) { isDischargedPatient = routeArgs['isDischargedPatient']; } + if(isInpatient) + _tabController.index =0; + else + _tabController.index = 1; } @override diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index d380ee93..78c2a3b9 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -290,6 +290,15 @@ class DateUtils { return ""; } + /// get data formatted like 26/4/2020 + /// [dateTime] convert DateTime to data formatted + static String getDayMonthYearDate(DateTime dateTime,{bool isArabic = false}) { + if (dateTime != null) + return dateTime.day.toString()+"/"+ "${dateTime.month}"+ "/" + dateTime.year.toString(); + else + return ""; + } + /// get data formatted like 10:45 PM /// [dateTime] convert DateTime to data formatted static String getHour(DateTime dateTime) { diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index f7f39d95..251f7653 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -16,13 +16,16 @@ class PatientCard extends StatelessWidget { final String patientType; final String arrivalType; final bool isInpatient; + final bool isMyPatient; + final bool isFromSearch; + const PatientCard( {Key key, this.patientInfo, this.onTap, this.patientType, this.arrivalType, - this.isInpatient}) + this.isInpatient, this.isMyPatient = false, this.isFromSearch = false}) : super(key: key); @override Widget build(BuildContext context) { @@ -35,9 +38,9 @@ class PatientCard extends StatelessWidget { color: Colors.white, ), child: Stack(children: [ - if (isInpatient) + if (!isInpatient&& !isMyPatient && !isFromSearch) Container( - height: MediaQuery.of(context).size.height * .20, + height: 160, width: 5, decoration: BoxDecoration( borderRadius: BorderRadius.only( @@ -47,6 +50,16 @@ class PatientCard extends StatelessWidget { ? Colors.green[500] : Colors.red[800], )), + if(isMyPatient && !isFromSearch) + Container( + height: 180, + width: 5, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), + bottomLeft: Radius.circular(10)), + color: Colors.green[500] + )), Container( padding: EdgeInsets.only(left: 10, right: 0, bottom: 0), child: InkWell( @@ -55,47 +68,113 @@ class PatientCard extends StatelessWidget { SizedBox( height: 10, ), - !isInpatient + !(isInpatient && !isFromSearch) ? 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, - ), + ? Row( + children: [ + AppText( + TranslationBase.of(context).arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + SizedBox(width: 8,), + SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), + SizedBox(width: 8,), + AppText( + patientInfo.status==2? 'Confirmed':'Booked', + color: patientInfo.status==2? Colors.green:Colors.grey , + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], + ) + : patientInfo.patientStatusType == 42?Row( + children: [ + AppText( + TranslationBase.of(context).notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + SizedBox(width: 8,), + SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), + SizedBox(width: 8,), + AppText( + patientInfo.status==2? 'Confirmed':'Booked', + color: patientInfo.status==2? Colors.green:Colors.grey , + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], + ): !isFromSearch?Row( + children: [ + AppText( + TranslationBase.of(context).notArrived, + color: Colors.red[800], + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + SizedBox(width: 8,), + SizedBox(height: 12,width: 1.5,child: Container(color: Colors.grey,),), + SizedBox(width: 8,), + AppText( + patientInfo.status==2? 'Confirmed':'Booked', + color: patientInfo.status==2? Colors.green:Colors.grey , + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ) + ], + ):SizedBox(), this.arrivalType == '1' ? AppText( patientInfo.startTime != null ? patientInfo.startTime : patientInfo.startTimes, fontFamily: 'Poppins', - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, ) : patientInfo.arrivedOn != null ? AppText( - DateUtils.getDayMonthYearDateFormatted(DateUtils.convertStringToDate( - patientInfo.arrivedOn, - )), + DateUtils.getDayMonthYearDate(DateUtils.convertStringToDate(patientInfo.arrivedOn,) + )+" "+ DateUtils.getTimeHHMMA(DateUtils.convertStringToDate(patientInfo.arrivedOn,)), fontFamily: 'Poppins', - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, ) - : SizedBox() + : (patientInfo.appointmentDate != null && patientInfo.appointmentDate.isNotEmpty)? + AppText( + DateUtils.getDayMonthYearDate(DateUtils.convertStringToDate(patientInfo.appointmentDate,) + )+" "+ DateUtils.getTimeHHMMA(DateUtils.convertStringToDate(patientInfo.appointmentDate,)), + fontFamily: 'Poppins', + fontWeight: FontWeight.w400, + ):SizedBox() ], )) : SizedBox(), + if(isInpatient && isMyPatient && !isFromSearch) + Row( + children: [ + SizedBox(width: 12,), + AppText( + 'My Patient', + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 12, + ), + ], + ), Padding( padding: EdgeInsets.only(left: 12.0), child: Row( @@ -212,7 +291,7 @@ class PatientCard extends StatelessWidget { ), ), ), - if (isInpatient) + //if (isInpatient) Container( child: RichText( text: new TextSpan( @@ -368,7 +447,7 @@ class PatientCard extends StatelessWidget { //) ])) ]), - !isInpatient + !isInpatient && !isFromSearch ? Row( mainAxisAlignment: MainAxisAlignment.end, children: [