You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/widgets/patients/patient_card/PatientCard.dart

598 lines
32 KiB
Dart

import 'package:doctor_app_flutter/config/config.dart';
5 years ago
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
5 years ago
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
5 years ago
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
5 years ago
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
5 years ago
import '../../../util/extenstions.dart';
5 years ago
import 'ShowTimer.dart';
5 years ago
class PatientCard extends StatelessWidget {
final PatiantInformtion patientInfo;
final GestureTapCallback onTap;
5 years ago
final String patientType;
final String arrivalType;
5 years ago
final bool isInpatient;
5 years ago
final bool isMyPatient;
final bool isFromSearch;
final bool isFromLiveCare;
5 years ago
5 years ago
PatientCard(
{Key? key,
required this.patientInfo,
required this.onTap,
required this.patientType,
required this.arrivalType,
required this.isInpatient,
this.isMyPatient = false,
this.isFromSearch = false,
this.isFromLiveCare = false})
: super(key: key);
5 years ago
@override
Widget build(BuildContext context) {
String? nationalityName = patientInfo.nationalityName != null
? patientInfo.nationalityName!.trim()
5 years ago
: patientInfo.nationality != null
? patientInfo.nationality!.trim()
5 years ago
: patientInfo.nationalityId !=
null
? patientInfo.nationalityId
: "";
4 years ago
ProjectViewModel projectViewModel = Provider.of(context);
5 years ago
return Container(
width: SizeConfig.screenWidth * 0.9,
margin: EdgeInsets.all(6),
4 years ago
padding: EdgeInsets.only(
left: projectViewModel.isArabic ? 5 : 0,
right: projectViewModel.isArabic ? 0 : 5,
bottom: 0,
top: 0),
decoration: Helpers.getCardBoxDecoration(),
child: CardWithBgWidget(
padding: 0,
marginLeft: (!isMyPatient && isInpatient) || isFromLiveCare ? 0 : 10,
5 years ago
marginSymmetric: isFromSearch ? 10 : 0.0,
hasBorder: false,
5 years ago
bgColor: isFromLiveCare
? Colors.white
: (isMyPatient && !isFromSearch)
? AppGlobal.appGreenColor
5 years ago
: patientInfo.patientStatusType == 43
? AppGlobal.appGreenColor
5 years ago
: isMyPatient
? AppGlobal.appGreenColor
5 years ago
: isInpatient
? Colors.white
5 years ago
: !isFromSearch
4 years ago
? Colors.red[800]!
: Colors.white,
widget: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
5 years ago
// padding: EdgeInsets.only(left: 10, right: 0, bottom: 0),
child: InkWell(
child: Column(
children: [
SizedBox(
height: 10,
),
5 years ago
!(isInpatient && !isFromSearch)
? Padding(
padding: EdgeInsets.only(left: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
patientInfo.patientStatusType == 43
5 years ago
? Row(
5 years ago
children: [
4 years ago
PatientStatus(
label: TranslationBase.of(context)
.arrivedP,
color: AppGlobal.appGreenColor,
5 years ago
),
5 years ago
SizedBox(
width: 8,
),
SizedBox(
height: 12,
width: 1.5,
child: Container(
color: Colors.grey,
),
),
SizedBox(
width: 8,
),
4 years ago
PatientStatus(
label: patientInfo.status == 2
? 'Confirmed'
: 'Booked',
color: patientInfo.status == 2
? AppGlobal.appGreenColor
: Colors.grey,
5 years ago
),
5 years ago
],
)
: patientInfo.patientStatusType == 42
? Row(
children: [
4 years ago
PatientStatus(
label:
TranslationBase.of(context)
4 years ago
.notArrived!,
color: Colors.red[800]!,
5 years ago
),
SizedBox(
width: 8,
),
SizedBox(
height: 12,
width: 1.5,
child: Container(
color: Colors.grey,
),
),
SizedBox(
width: 8,
),
4 years ago
PatientStatus(
label: patientInfo.status == 2
? 'Confirmed'
: 'Booked',
color: patientInfo.status == 2
? AppGlobal.appGreenColor
: Colors.grey,
)
5 years ago
],
)
: !isFromSearch &&
!isFromLiveCare &&
patientInfo.patientStatusType ==
null
5 years ago
? Row(
children: [
4 years ago
PatientStatus(
label: TranslationBase.of(
context)
4 years ago
.notArrived!,
color: Colors.red[800]!,
5 years ago
),
SizedBox(
width: 8,
),
SizedBox(
height: 12,
width: 1.5,
child: Container(
color: Colors.grey,
),
),
SizedBox(
width: 8,
),
4 years ago
PatientStatus(
label:
patientInfo.status == 2
? 'Booked'
: 'Confirmed',
color:
patientInfo.status == 2
? Colors.grey
: AppGlobal
.appGreenColor,
5 years ago
)
],
)
: SizedBox(),
this.arrivalType == '1'
? AppText(
patientInfo.startTime != null
4 years ago
? patientInfo.startTime!
: patientInfo.startTimes!,
fontFamily: 'Poppins',
5 years ago
fontWeight: FontWeight.w400,
)
5 years ago
: patientInfo.arrivedOn != null
? Container(
padding: EdgeInsets.only(right: 9),
child: AppText(
4 years ago
"${AppDateUtils.getStartTime(patientInfo.startTime!)}",
5 years ago
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 11,
letterSpacing: -0.64,
),
)
: (patientInfo.appointmentDate !=
null &&
patientInfo
4 years ago
.appointmentDate!.isNotEmpty!)
? Container(
padding: EdgeInsets.only(right: 9),
child: AppText(
4 years ago
" ${AppDateUtils.getStartTime(patientInfo!.startTime!)}",
5 years ago
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 11,
letterSpacing: -0.64,
4 years ago
),
)
5 years ago
: SizedBox()
],
))
: SizedBox(),
5 years ago
if (isInpatient && isMyPatient && !isFromSearch)
5 years ago
Row(
children: [
5 years ago
SizedBox(
width: 12,
),
4 years ago
PatientStatus(
label: 'My Patient',
5 years ago
),
],
),
Padding(
padding: EdgeInsets.only(left: 12.0),
child: Row(
5 years ago
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
5 years ago
flex: 2,
child: Row(
4 years ago
crossAxisAlignment: CrossAxisAlignment.center,
4 years ago
mainAxisAlignment: MainAxisAlignment.start,
children: [
4 years ago
AppText(
isFromLiveCare
? Helpers.capitalize(
patientInfo.fullName)
: (Helpers.capitalize(
patientInfo.firstName) +
" " +
Helpers.capitalize(
patientInfo.lastName)),
fontSize: 16,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
letterSpacing: -0.64,
textOverflow: TextOverflow.ellipsis,
),
if (patientInfo.gender == 1)
Container(
padding: EdgeInsets.symmetric(
horizontal: 4, vertical: 2),
child: SvgPicture.asset(
"assets/images/svgs/male.svg"),
)
else
Container(
padding: EdgeInsets.symmetric(
horizontal: 4, vertical: 2),
child: SvgPicture.asset(
"assets/images/svgs/female.svg"),
),
if (isFromLiveCare)
ShowTimer(
patientInfo: patientInfo,
),
]),
),
4 years ago
if (nationalityName!.isNotEmpty)
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(top: 5),
alignment: Alignment.centerRight,
child: AppText(
nationalityName.truncate(14),
fontWeight: FontWeight.w600,
fontSize: 10,
color: Color(0xFF2E303A),
textOverflow: TextOverflow.ellipsis,
),
5 years ago
),
),
patientInfo.nationality != null ||
patientInfo.nationalityId != null
? Container(
padding: EdgeInsets.only(
right: 7, top: 5),
child: ClipRRect(
borderRadius:
BorderRadius.circular(20.0),
child: CachedNetworkImage(
imageUrl: patientInfo
.nationalityFlagURL !=
null
? patientInfo
Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into dev_v2.8  Conflicts:  ios/Runner.xcodeproj/project.pbxproj  ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme  lib/core/viewModel/PatientRegistrationViewModel.dart  lib/core/viewModel/project_view_model.dart  lib/models/SOAP/selected_items/my_selected_history.dart  lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart  lib/screens/home/home_screen.dart  lib/screens/live_care/end_call_screen.dart  lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart  lib/screens/patients/In_patient/InPatientHeader.dart  lib/screens/patients/In_patient/in_patient_screen.dart  lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart  lib/screens/patients/profile/UCAF/UCAF-input-screen.dart  lib/screens/patients/profile/UCAF/page-stepper-widget.dart  lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart  lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart  lib/screens/patients/profile/lab_result/LineChartCurved.dart  lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart  lib/screens/patients/profile/operation_report/operation_report.dart  lib/screens/patients/profile/operation_report/update_operation_report.dart  lib/screens/patients/profile/pending_orders/pending_orders_screen.dart  lib/screens/patients/profile/profile_screen/patient_profile_screen.dart  lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart  lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart  lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart  lib/screens/patients/profile/referral/my-referral-detail-screen.dart  lib/screens/patients/profile/referral/refer-patient-screen.dart  lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart  lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart  lib/screens/patients/profile/soap_update/plan/update_plan_page.dart  lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart  lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart  lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart  lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart  lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart  lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart  lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart  lib/screens/patients/profile/vital_sign/LineChartCurved.dart  lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart  lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart  lib/screens/patients/register_patient/CustomEditableText.dart  lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart  lib/screens/patients/register_patient/RegisterSearchPatientPage.dart  lib/screens/prescription/add_prescription_form.dart  lib/screens/prescription/prescription_text_filed.dart  lib/screens/reschedule-leaves/reschedule_leave.dart  lib/util/dr_app_toast_msg.dart  lib/widgets/patients/patient_card/PatientCard.dart  lib/widgets/patients/profile/patient-profile-app-bar.dart  lib/widgets/patients/profile/profile_medical_info_widget_search.dart  lib/widgets/shared/TextFields.dart  lib/widgets/shared/bottom_navigation_item.dart  lib/widgets/shared/text_fields/app-textfield-custom.dart  lib/widgets/shared/text_fields/app_text_field_custom_serach.dart  lib/widgets/shared/text_fields/new_text_Field.dart  pubspec.yaml
4 years ago
.nationalityFlagURL!
: '',
height: 16,
width: 22,
errorWidget:
(context, url, error) =>
AppText(
'No Image',
fontSize: 10,
),
)),
)
: SizedBox()
],
),
)
],
)),
4 years ago
SizedBox(
height: 10,
),
4 years ago
Row(
4 years ago
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
4 years ago
padding: EdgeInsets.only(left: 12.0, top: 5),
child: Container(
width: 60,
height: 60,
//TODO Elham* create widget for this to make it use every where
child: SvgPicture.asset(
patientInfo.gender == 1
? 'assets/images/svgs/male avatar.svg'
: 'assets/images/svgs/female avatar.svg',
fit: BoxFit.cover,
),
),
5 years ago
),
4 years ago
SizedBox(
width: 10,
5 years ago
),
Expanded(
4 years ago
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
// SizedBox(height: 10,),
CustomRow(
label: TranslationBase.of(context)
4 years ago
.fileNumber!,
4 years ago
value: patientInfo.patientId.toString(),
),
CustomRow(
4 years ago
label: TranslationBase.of(context).age! +
4 years ago
" : ",
value:
4 years ago
"${AppDateUtils.getAgeByBirthday(patientInfo!.dateofBirth!, context, isServerFormat: !isFromLiveCare)}",
4 years ago
),
patientInfo.arrivedOn != null
? Column(
crossAxisAlignment:
CrossAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
// AppText(
// AppDateUtils
// .getDayMonthYearDateFormatted(
// AppDateUtils
// .convertStringToDate(
// patientInfo.arrivedOn,
// ),
// isMonthShort: true,
// ),
// fontFamily: 'Poppins',
// fontWeight: FontWeight.w600,
// fontSize: 11,
// letterSpacing: -0.64,
// ),
CustomRow(
label: TranslationBase.of(
context)
4 years ago
.arrivedP! +
" : ",
value: AppDateUtils
.getDayMonthYearDateFormatted(
AppDateUtils
.convertStringToDate(
4 years ago
patientInfo!.arrivedOn!,
),
isMonthShort: true,
),
),
],
)
: (patientInfo.appointmentDate !=
null &&
4 years ago
patientInfo!.appointmentDate!
.isNotEmpty)
? Column(
crossAxisAlignment:
CrossAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
CustomRow(
label: TranslationBase.of(
context)
4 years ago
.appointmentDate! +
" : ",
value: "${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(
4 years ago
patientInfo!
.appointmentDate!,
), isMonthShort: true)}",
),
],
)
: SizedBox(),
4 years ago
if (isInpatient)
CustomRow(
label:
patientInfo.admissionDate == null
? ""
: TranslationBase.of(context)
4 years ago
.admissionDate! +
4 years ago
" : ",
value: patientInfo.admissionDate ==
null
? ""
: "${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate.toString()), isMonthShort: true)}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context)
4 years ago
.numOfDays!+
5 years ago
" : ",
4 years ago
value:
4 years ago
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo!.admissionDate!)).inDays + 1}",
4 years ago
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context)
4 years ago
.clinicName! +
" : ",
4 years ago
value:
"${patientInfo.clinicDescription}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context)
4 years ago
.roomNo! +
" : ",
4 years ago
value: "${patientInfo.roomId}",
),
4 years ago
if (isFromLiveCare)
Column(
children: [
CustomRow(
label: TranslationBase.of(context)
4 years ago
.clinic! +
4 years ago
" : ",
4 years ago
value: patientInfo!.clinicName!,
4 years ago
),
],
),
]),
),
Padding(
padding: const EdgeInsets.only(right: 8),
child: Icon(
Icons.arrow_forward,
size: 24,
),
4 years ago
),
],
))
]),
5 years ago
isFromLiveCare
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
5 years ago
Container(
padding: EdgeInsets.only(
left: 9, right: 9, bottom: 9),
child: SvgPicture.asset(
'assets/images/svgs/profile_screen/livecare.svg',
height: 20,
width: 20,
// color: Colors.grey.shade700,
5 years ago
)),
],
)
: !isInpatient && !isFromSearch
? Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
5 years ago
Container(
padding: EdgeInsets.only(
left: 9, right: 9, bottom: 9),
child: SvgPicture.asset(
patientInfo.appointmentType ==
'Regular' &&
patientInfo.visitTypeId == 100
? 'assets/images/svgs/profile_screen/livecare.svg'
: patientInfo.appointmentType ==
'Walkin'
? 'assets/images/svgs/profile_screen/walkin.svg'
: 'assets/images/svgs/profile_screen/booked.svg',
5 years ago
height: 25,
width: 35,
)),
])
: (isInpatient == true)
? Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(
left: 9,
right: 9,
bottom: 9),
child: SvgPicture.asset(
'assets/images/svgs/inpatient.svg',
height: 25,
width: 35,
)),
])
5 years ago
: SizedBox()
],
),
onTap: onTap,
)),
));
5 years ago
}
}
4 years ago
class PatientStatus extends StatelessWidget {
4 years ago
PatientStatus({
Key ? key,
4 years ago
this.label,
this.color,
4 years ago
}) : super(key: key);
4 years ago
final String? label;
final Color? color;
4 years ago
@override
Widget build(BuildContext context) {
return AppText(
4 years ago
label??"",
4 years ago
color: color ?? AppGlobal.appGreenColor,
4 years ago
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
fontSize: 10,
);
}
}