From 9d00440789b084ecd2e8ec61223a857b4926b6fa Mon Sep 17 00:00:00 2001 From: mosazaid Date: Fri, 23 Apr 2021 16:35:05 +0300 Subject: [PATCH] referral -re design --- .../patient-vital-sign-viewmodel.dart | 12 ++-- .../my_referred_patient_model.dart | 8 +++ .../profile/patient_profile_screen.dart | 2 +- .../referral/referred-patient-screen.dart | 24 ++++--- .../patient-referral-item-widget.dart | 71 ++++++++++++------- ...-profile-header-new-design_in_patient.dart | 2 +- 6 files changed, 74 insertions(+), 45 deletions(-) diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index 14aa1f06..2f1c1c68 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -37,8 +37,8 @@ class VitalSignsViewModel extends BaseViewModel { } } - Future getPatientVitalSignHistory( - PatiantInformtion patient, String from, String to, bool isInPatient) async { + Future getPatientVitalSignHistory(PatiantInformtion patient, String from, + String to, bool isInPatient) async { setState(ViewState.Busy); if (from == null || from == "0") { from = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); @@ -47,11 +47,11 @@ class VitalSignsViewModel extends BaseViewModel { to = DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } - // if(isInPatient){ + if (isInPatient) { await _vitalSignService.getInPatientVitalSignHistory(patient); - // }else { - // await _vitalSignService.getPatientVitalSignsHistory(patient, from, to); - // } + } else { + await _vitalSignService.getPatientVitalSignsHistory(patient, from, to); + } if (_vitalSignService.hasError) { error = _vitalSignService.error; diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index f7d48c60..129a1bb5 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -62,6 +62,8 @@ class MyReferredPatientModel { String nursingStationName; String priorityDescription; String referringClinicDescription; + String referralDoctorName; + String referralClinicDescription; String referringDoctorName; bool isReferralDoctorSameBranch; @@ -127,6 +129,8 @@ class MyReferredPatientModel { this.referringClinicDescription, this.referringDoctorName, this.isReferralDoctorSameBranch, + this.referralDoctorName, + this.referralClinicDescription, }); MyReferredPatientModel.fromJson(Map json) { @@ -190,6 +194,8 @@ class MyReferredPatientModel { priorityDescription = json['PriorityDescription']; referringClinicDescription = json['ReferringClinicDescription']; referringDoctorName = json['ReferringDoctorName']; + referralDoctorName = json['ReferralDoctorName']; + referralClinicDescription = json['ReferralClinicDescription']; } Map toJson() { @@ -254,6 +260,8 @@ class MyReferredPatientModel { data['PriorityDescription'] = this.priorityDescription; data['ReferringClinicDescription'] = this.referringClinicDescription; data['ReferringDoctorName'] = this.referringDoctorName; + data['ReferralDoctorName'] = this.referralDoctorName; + data['ReferralClinicDescription'] = this.referralClinicDescription; return data; } } diff --git a/lib/screens/patients/profile/patient_profile_screen.dart b/lib/screens/patients/profile/patient_profile_screen.dart index a14f96e8..fd4c5719 100644 --- a/lib/screens/patients/profile/patient_profile_screen.dart +++ b/lib/screens/patients/profile/patient_profile_screen.dart @@ -58,7 +58,7 @@ class PatientProfileScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - !isFromSearch && patientType == "1" + !isFromSearch && isInpatient/*patientType == "1"*/ ? PatientProfileHeaderNewDesignInPatient( patient, patientType, arrivalType) : PatientProfileHeaderNewDesign( diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 0bacb1d8..b859d965 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -23,7 +23,7 @@ class ReferredPatientScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( + Container( height: 100, ), Image.asset('assets/images/no-data.png'), @@ -37,22 +37,24 @@ class ReferredPatientScreen extends StatelessWidget { ], ), ) - : SingleChildScrollView( + : SingleChildScrollView(// DoctorApplication.svc/REST/GtMyReferredPatient child: Container( + margin: EdgeInsets.only(top: 70), child: Column( children: [ - const Divider( - color: Color(0xffCCCCCC), - height: 1, - thickness: 2, - indent: 0, - endIndent: 0, - ), + // const Divider( + // color: Color(0xffCCCCCC), + // height: 1, + // thickness: 2, + // indent: 0, + // endIndent: 0, + // ), ...List.generate( model.listMyReferredPatientModel.length, (index) => PatientReferralItemWidget( referralStatus: "${model.getReferralStatusNameByCode(model.getReferredPatientItem(index).referralStatus, context)}", + referralStatusCode: model.getReferredPatientItem(index).referralStatus, patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", patientGender: model.getReferredPatientItem(index).gender, referredDate: DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy"), @@ -70,8 +72,8 @@ class ReferredPatientScreen extends StatelessWidget { model.getReferredPatientItem(index).nationalityFlagURL, doctorAvatar: model.getReferredPatientItem(index).doctorImageURL, - referralDoctorName: "${model.getReferredPatientItem(index).referringDoctorName}(${model.getReferredPatientItem(index).referringClinicDescription})", - clinicDescription: null, + referralDoctorName: "Dr. ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model.getReferredPatientItem(index).referralClinicDescription, ), ), ], diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index faddc7f6..0bad54a2 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -12,6 +12,7 @@ import 'package:provider/provider.dart'; class PatientReferralItemWidget extends StatelessWidget { final String referralStatus; + final int referralStatusCode; final String patientName; final int patientGender; final String referredDate; @@ -29,6 +30,7 @@ class PatientReferralItemWidget extends StatelessWidget { PatientReferralItemWidget( {this.referralStatus, + this.referralStatusCode, this.patientName, this.patientGender, this.referredDate, @@ -54,11 +56,11 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Container( child: CardWithBgWidget( - bgColor: referralStatus != null - ? referralStatus == 'Pending' - ? Color(0xffc4aa54) - : Colors.red[800] - : Colors.grey[500], + bgColor: referralStatusCode == 1 + ? Color(0xffc4aa54) + : referralStatusCode == 46 + ? Colors.green[700] + : Colors.red[700], hasBorder: false, widget: Container( // padding: EdgeInsets.only(left: 20, right: 0, bottom: 0), @@ -74,13 +76,11 @@ class PatientReferralItemWidget extends StatelessWidget { fontFamily: 'Poppins', fontSize: 1.9 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, - color: referralStatus != null - ? referralStatus == 'Pending' - ? Color(0xffc4aa54) - : referralStatus == 'Accepted' - ? Colors.green[700] - : Colors.red[700] - : Colors.grey[500], + color: referralStatusCode == 1 + ? Color(0xffc4aa54) + : referralStatusCode == 46 + ? Colors.green[700] + : Colors.red[700], ), AppText( referredDate, @@ -222,6 +222,7 @@ class PatientReferralItemWidget extends StatelessWidget { fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), + maxLines: 1, ), ), ], @@ -246,18 +247,27 @@ class PatientReferralItemWidget extends StatelessWidget { child: Container( width: 40, height: 40, - child: doctorAvatar !=null?ClipRRect( - borderRadius: BorderRadius.circular(20.0), - child: Image.network( - doctorAvatar, - height: 25, - width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return Text('No Image'); - }, - )):Container(), + child: doctorAvatar != null + ? ClipRRect( + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + doctorAvatar, + height: 25, + width: 30, + errorBuilder: (BuildContext context, + Object exception, + StackTrace stackTrace) { + return Text('No Image'); + }, + )) + : Container( + child: Image.asset( + patientGender == 1 + ? 'assets/images/male_avatar.png' + : 'assets/images/female_avatar.png', + fit: BoxFit.cover, + ), + ), ), ), Expanded( @@ -266,14 +276,23 @@ class PatientReferralItemWidget extends StatelessWidget { margin: EdgeInsets.only( left: 10, top: 25, right: 10, bottom: 0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( referralDoctorName, fontFamily: 'Poppins', - fontWeight: FontWeight.w700, + fontWeight: FontWeight.w800, fontSize: 1.7 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), + color: Colors.black, ), + if (clinicDescription != null) + AppText( + clinicDescription, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + fontSize: 1.4 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), + ), ], ), ), diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart index ca6910ae..b10533f9 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart @@ -185,7 +185,7 @@ class PatientProfileHeaderNewDesignInPatient extends StatelessWidget { fontSize: 1.2 * SizeConfig.textMultiplier, ), AppText( - "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.createdOn)).inDays + 1}", + "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays}", fontSize: 1.4 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700), ],