|
|
|
|
@ -17,8 +17,8 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'ShowTimer.dart';
|
|
|
|
|
|
|
|
|
|
class PatientCard extends StatelessWidget {
|
|
|
|
|
final PatiantInformtion patientInfo;
|
|
|
|
|
final Function onTap;
|
|
|
|
|
final PatiantInformtion? patientInfo;
|
|
|
|
|
final Function? onTap;
|
|
|
|
|
final String patientType;
|
|
|
|
|
final String arrivalType;
|
|
|
|
|
final bool isInpatient;
|
|
|
|
|
@ -27,12 +27,12 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
final bool isFromLiveCare;
|
|
|
|
|
|
|
|
|
|
PatientCard(
|
|
|
|
|
{Key key,
|
|
|
|
|
{Key? key,
|
|
|
|
|
this.patientInfo,
|
|
|
|
|
this.onTap,
|
|
|
|
|
this.patientType,
|
|
|
|
|
this.arrivalType,
|
|
|
|
|
this.isInpatient,
|
|
|
|
|
this.patientType = '',
|
|
|
|
|
this.arrivalType = '',
|
|
|
|
|
this.isInpatient = false,
|
|
|
|
|
this.isMyPatient = false,
|
|
|
|
|
this.isFromSearch = false,
|
|
|
|
|
this.isFromLiveCare = false})
|
|
|
|
|
@ -41,16 +41,16 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
String nationalityName = patientInfo.nationalityName != null
|
|
|
|
|
? patientInfo.nationalityName.trim()
|
|
|
|
|
: patientInfo.nationality != null
|
|
|
|
|
? patientInfo.nationality.trim()
|
|
|
|
|
: patientInfo.nationalityId != null
|
|
|
|
|
? patientInfo.nationalityId
|
|
|
|
|
String nationalityName = patientInfo!.nationalityName != null
|
|
|
|
|
? patientInfo!.nationalityName!.trim()
|
|
|
|
|
: patientInfo!.nationality != null
|
|
|
|
|
? patientInfo!.nationality!.trim()
|
|
|
|
|
: patientInfo!.nationalityId != null
|
|
|
|
|
? patientInfo!.nationalityId!
|
|
|
|
|
: "";
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.9,
|
|
|
|
|
width: SizeConfig.screenWidth! * 0.9,
|
|
|
|
|
margin: EdgeInsets.all(6),
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: projectViewModel.isArabic ? 5 : 0,
|
|
|
|
|
@ -67,14 +67,14 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
? Colors.white
|
|
|
|
|
: (isMyPatient && !isFromSearch)
|
|
|
|
|
? AppGlobal.appGreenColor
|
|
|
|
|
: patientInfo.patientStatusType == 43
|
|
|
|
|
: patientInfo!.patientStatusType == 43
|
|
|
|
|
? AppGlobal.appGreenColor
|
|
|
|
|
: isMyPatient
|
|
|
|
|
? AppGlobal.appGreenColor
|
|
|
|
|
: isInpatient
|
|
|
|
|
? Colors.white
|
|
|
|
|
: !isFromSearch
|
|
|
|
|
? Colors.red[800]
|
|
|
|
|
? Colors.red[800]!
|
|
|
|
|
: Colors.white,
|
|
|
|
|
widget: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
@ -95,7 +95,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
patientInfo.patientStatusType == 43
|
|
|
|
|
patientInfo!.patientStatusType == 43
|
|
|
|
|
? Row(
|
|
|
|
|
children: [
|
|
|
|
|
PatientStatus(
|
|
|
|
|
@ -117,23 +117,23 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
PatientStatus(
|
|
|
|
|
label: patientInfo.status == 2
|
|
|
|
|
label: patientInfo!.status == 2
|
|
|
|
|
? 'Confirmed'
|
|
|
|
|
: 'Booked',
|
|
|
|
|
color: patientInfo.status == 2
|
|
|
|
|
color: patientInfo!.status == 2
|
|
|
|
|
? AppGlobal.appGreenColor
|
|
|
|
|
: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: patientInfo.patientStatusType == 42
|
|
|
|
|
: patientInfo!.patientStatusType == 42
|
|
|
|
|
? Row(
|
|
|
|
|
children: [
|
|
|
|
|
PatientStatus(
|
|
|
|
|
label:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.notArrived,
|
|
|
|
|
color: Colors.red[800],
|
|
|
|
|
color: Colors.red[800]!,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
@ -149,10 +149,10 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
PatientStatus(
|
|
|
|
|
label: patientInfo.status == 2
|
|
|
|
|
label: patientInfo!.status == 2
|
|
|
|
|
? 'Confirmed'
|
|
|
|
|
: 'Booked',
|
|
|
|
|
color: patientInfo.status == 2
|
|
|
|
|
color: patientInfo!.status == 2
|
|
|
|
|
? AppGlobal.appGreenColor
|
|
|
|
|
: Colors.grey,
|
|
|
|
|
)
|
|
|
|
|
@ -160,7 +160,8 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
)
|
|
|
|
|
: !isFromSearch &&
|
|
|
|
|
!isFromLiveCare &&
|
|
|
|
|
patientInfo.patientStatusType ==
|
|
|
|
|
patientInfo!
|
|
|
|
|
.patientStatusType ==
|
|
|
|
|
null
|
|
|
|
|
? Row(
|
|
|
|
|
children: [
|
|
|
|
|
@ -185,11 +186,11 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
PatientStatus(
|
|
|
|
|
label:
|
|
|
|
|
patientInfo.status == 2
|
|
|
|
|
patientInfo!.status == 2
|
|
|
|
|
? 'Booked'
|
|
|
|
|
: 'Confirmed',
|
|
|
|
|
color:
|
|
|
|
|
patientInfo.status == 2
|
|
|
|
|
patientInfo!.status == 2
|
|
|
|
|
? Colors.grey
|
|
|
|
|
: AppGlobal
|
|
|
|
|
.appGreenColor,
|
|
|
|
|
@ -199,32 +200,32 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
this.arrivalType == '1'
|
|
|
|
|
? AppText(
|
|
|
|
|
patientInfo.startTime != null
|
|
|
|
|
? patientInfo.startTime
|
|
|
|
|
: patientInfo.startTimes,
|
|
|
|
|
patientInfo!.startTime != null
|
|
|
|
|
? patientInfo!.startTime!
|
|
|
|
|
: patientInfo!.startTimes!,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
)
|
|
|
|
|
: patientInfo.arrivedOn != null
|
|
|
|
|
: patientInfo!.arrivedOn != null
|
|
|
|
|
? Container(
|
|
|
|
|
padding: EdgeInsets.only(right: 9),
|
|
|
|
|
child: AppText(
|
|
|
|
|
"${AppDateUtils.getStartTime(patientInfo.startTime)}",
|
|
|
|
|
"${AppDateUtils.getStartTime(patientInfo!.startTime!)}",
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: (patientInfo.appointmentDate !=
|
|
|
|
|
: (patientInfo!.appointmentDate !=
|
|
|
|
|
null &&
|
|
|
|
|
patientInfo
|
|
|
|
|
.appointmentDate.isNotEmpty)
|
|
|
|
|
patientInfo!.appointmentDate!
|
|
|
|
|
.isNotEmpty)
|
|
|
|
|
? Container(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(right: 9),
|
|
|
|
|
child: AppText(
|
|
|
|
|
" ${AppDateUtils.getStartTime(patientInfo.startTime)}",
|
|
|
|
|
" ${AppDateUtils.getStartTime(patientInfo!.startTime!)}",
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
@ -261,12 +262,12 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
AppText(
|
|
|
|
|
isFromLiveCare
|
|
|
|
|
? Utils.capitalize(
|
|
|
|
|
patientInfo.fullName)
|
|
|
|
|
patientInfo!.fullName)
|
|
|
|
|
: (Utils.capitalize(
|
|
|
|
|
patientInfo.firstName) +
|
|
|
|
|
patientInfo!.firstName) +
|
|
|
|
|
" " +
|
|
|
|
|
Utils.capitalize(
|
|
|
|
|
patientInfo.lastName)),
|
|
|
|
|
patientInfo!.lastName)),
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -274,7 +275,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
|
textOverflow: TextOverflow.ellipsis,
|
|
|
|
|
),
|
|
|
|
|
if (patientInfo.gender == 1)
|
|
|
|
|
if (patientInfo!.gender == 1)
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 4, vertical: 2),
|
|
|
|
|
@ -290,7 +291,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
if (isFromLiveCare)
|
|
|
|
|
ShowTimer(
|
|
|
|
|
patientInfo: patientInfo,
|
|
|
|
|
patientInfo: patientInfo!,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
@ -313,8 +314,8 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
patientInfo.nationality != null ||
|
|
|
|
|
patientInfo.nationalityId != null
|
|
|
|
|
patientInfo!.nationality != null ||
|
|
|
|
|
patientInfo!.nationalityId != null
|
|
|
|
|
? Container(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
right: 7, top: 5),
|
|
|
|
|
@ -322,11 +323,11 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(20.0),
|
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
|
imageUrl: patientInfo
|
|
|
|
|
imageUrl: patientInfo!
|
|
|
|
|
.nationalityFlagURL !=
|
|
|
|
|
null
|
|
|
|
|
? patientInfo
|
|
|
|
|
.nationalityFlagURL
|
|
|
|
|
? patientInfo!
|
|
|
|
|
.nationalityFlagURL!
|
|
|
|
|
: '',
|
|
|
|
|
height: 16,
|
|
|
|
|
width: 22,
|
|
|
|
|
@ -357,7 +358,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
height: 60,
|
|
|
|
|
//TODO Elham* create widget for this to make it use every where
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
patientInfo.gender == 1
|
|
|
|
|
patientInfo!.gender == 1
|
|
|
|
|
? 'assets/images/svgs/male avatar.svg'
|
|
|
|
|
: 'assets/images/svgs/female avatar.svg',
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
@ -380,16 +381,17 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context)
|
|
|
|
|
.fileNumber,
|
|
|
|
|
value: patientInfo.patientId.toString(),
|
|
|
|
|
value:
|
|
|
|
|
patientInfo!.patientId.toString(),
|
|
|
|
|
),
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context).age +
|
|
|
|
|
" : ",
|
|
|
|
|
value:
|
|
|
|
|
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
|
|
|
|
|
"${AppDateUtils.getAgeByBirthday(patientInfo!.dateofBirth!, context, isServerFormat: !isFromLiveCare)}",
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
patientInfo.arrivedOn != null
|
|
|
|
|
patientInfo!.arrivedOn != null
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.end,
|
|
|
|
|
@ -401,7 +403,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
// .getDayMonthYearDateFormatted(
|
|
|
|
|
// AppDateUtils
|
|
|
|
|
// .convertStringToDate(
|
|
|
|
|
// patientInfo.arrivedOn,
|
|
|
|
|
// patientInfo!.arrivedOn,
|
|
|
|
|
// ),
|
|
|
|
|
// isMonthShort: true,
|
|
|
|
|
// ),
|
|
|
|
|
@ -420,16 +422,16 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
.getDayMonthYearDateFormatted(
|
|
|
|
|
AppDateUtils
|
|
|
|
|
.convertStringToDate(
|
|
|
|
|
patientInfo.arrivedOn,
|
|
|
|
|
patientInfo!.arrivedOn!,
|
|
|
|
|
),
|
|
|
|
|
isMonthShort: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: (patientInfo.appointmentDate !=
|
|
|
|
|
: (patientInfo!.appointmentDate !=
|
|
|
|
|
null &&
|
|
|
|
|
patientInfo.appointmentDate
|
|
|
|
|
patientInfo!.appointmentDate!
|
|
|
|
|
.isNotEmpty)
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
@ -443,8 +445,8 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
.appointmentDate +
|
|
|
|
|
" : ",
|
|
|
|
|
value: "${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(
|
|
|
|
|
patientInfo
|
|
|
|
|
.appointmentDate,
|
|
|
|
|
patientInfo!
|
|
|
|
|
.appointmentDate!,
|
|
|
|
|
), isMonthShort: true)}",
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -454,38 +456,38 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
if (isInpatient)
|
|
|
|
|
CustomRow(
|
|
|
|
|
label:
|
|
|
|
|
patientInfo.admissionDate == null
|
|
|
|
|
patientInfo!.admissionDate == null
|
|
|
|
|
? ""
|
|
|
|
|
: TranslationBase.of(context)
|
|
|
|
|
.admissionDate +
|
|
|
|
|
" : ",
|
|
|
|
|
value: patientInfo.admissionDate ==
|
|
|
|
|
value: patientInfo!.admissionDate ==
|
|
|
|
|
null
|
|
|
|
|
? ""
|
|
|
|
|
: "${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate.toString()), isMonthShort: true)}",
|
|
|
|
|
: "${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(patientInfo!.admissionDate.toString()), isMonthShort: true)}",
|
|
|
|
|
),
|
|
|
|
|
if (patientInfo.admissionDate != null)
|
|
|
|
|
if (patientInfo!.admissionDate != null)
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context)
|
|
|
|
|
.numOfDays +
|
|
|
|
|
" : ",
|
|
|
|
|
value:
|
|
|
|
|
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
|
|
|
|
|
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo!.admissionDate!)).inDays + 1}",
|
|
|
|
|
),
|
|
|
|
|
if (patientInfo.admissionDate != null)
|
|
|
|
|
if (patientInfo!.admissionDate != null)
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context)
|
|
|
|
|
.clinicName +
|
|
|
|
|
" : ",
|
|
|
|
|
value:
|
|
|
|
|
"${patientInfo.clinicDescription}",
|
|
|
|
|
"${patientInfo!.clinicDescription}",
|
|
|
|
|
),
|
|
|
|
|
if (patientInfo.admissionDate != null)
|
|
|
|
|
if (patientInfo!.admissionDate != null)
|
|
|
|
|
CustomRow(
|
|
|
|
|
label: TranslationBase.of(context)
|
|
|
|
|
.roomNo +
|
|
|
|
|
" : ",
|
|
|
|
|
value: "${patientInfo.roomId}",
|
|
|
|
|
value: "${patientInfo!.roomId}",
|
|
|
|
|
),
|
|
|
|
|
if (isFromLiveCare)
|
|
|
|
|
Column(
|
|
|
|
|
@ -494,7 +496,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
label: TranslationBase.of(context)
|
|
|
|
|
.clinic +
|
|
|
|
|
" : ",
|
|
|
|
|
value: patientInfo.clinicName,
|
|
|
|
|
value: patientInfo!.clinicName!,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -534,11 +536,12 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 9, right: 9, bottom: 9),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
patientInfo.appointmentType ==
|
|
|
|
|
patientInfo!.appointmentType ==
|
|
|
|
|
'Regular' &&
|
|
|
|
|
patientInfo.visitTypeId == 100
|
|
|
|
|
patientInfo!.visitTypeId ==
|
|
|
|
|
100
|
|
|
|
|
? 'assets/images/svgs/profile_screen/livecare.svg'
|
|
|
|
|
: patientInfo.appointmentType ==
|
|
|
|
|
: patientInfo!.appointmentType ==
|
|
|
|
|
'Walkin'
|
|
|
|
|
? 'assets/images/svgs/profile_screen/walkin.svg'
|
|
|
|
|
: 'assets/images/svgs/profile_screen/booked.svg',
|
|
|
|
|
@ -564,7 +567,7 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
: SizedBox()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
onTap: onTap!(),
|
|
|
|
|
)),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
@ -572,12 +575,12 @@ class PatientCard extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
class PatientStatus extends StatelessWidget {
|
|
|
|
|
PatientStatus({
|
|
|
|
|
Key key,
|
|
|
|
|
this.label,
|
|
|
|
|
Key? key,
|
|
|
|
|
required this.label,
|
|
|
|
|
this.color,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
final String label;
|
|
|
|
|
final Color color;
|
|
|
|
|
final Color? color;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|