fix birthOfDate

html_editor
Elham Rababah 3 years ago
parent 8e140abee9
commit d49d52458b

@ -328,4 +328,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69
COCOAPODS: 1.10.1 COCOAPODS: 1.10.0.rc.1

@ -143,6 +143,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
"isInpatient": false, "isInpatient": false,
"arrivalType": "0", "arrivalType": "0",
"isSearchAndOut": false, "isSearchAndOut": false,
"isFromLiveCare":true
}); });
}, },
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,

@ -97,18 +97,16 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Column( Column(
children: [ children: [
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
patient, patient, arrivalType ?? '0', patientType,
arrivalType ?? '0',
patientType,
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null && height: (patient.patientStatusType != null &&
patient.patientStatusType == 43) patient.patientStatusType == 43)
? 210 ? 210
: isDischargedPatient : isDischargedPatient
? 240 ? 240
: 0, : 0,
isDischargedPatient:isDischargedPatient isDischargedPatient: isDischargedPatient),
),
Container( Container(
height: !isSearchAndOut height: !isSearchAndOut
? isDischargedPatient ? isDischargedPatient

@ -305,12 +305,13 @@ class AppDateUtils {
return DateFormat('hh:mm a').format(dateTime); return DateFormat('hh:mm a').format(dateTime);
} }
static String getAgeByBirthday(dynamic birthday, BuildContext context, { bool isServerFormat = true}) { static String getAgeByBirthday(String birthOfDate, BuildContext context, { bool isServerFormat = true}) {
// https://leechy.dev/calculate-dates-diff-in-dart // https://leechy.dev/calculate-dates-diff-in-dart
DateTime birthDate; DateTime birthDate;
if(isServerFormat){ birthDate = AppDateUtils.getDateTimeFromServerFormat(birthday); if(birthOfDate.contains("/Date")) {
birthDate = AppDateUtils.getDateTimeFromServerFormat(birthOfDate);
}else{ }else{
birthDate = DateTime.parse('1986-08-15'); birthDate = DateTime.parse(birthOfDate);
} }
final now = DateTime.now(); final now = DateTime.now();
int years = now.year - birthDate.year; int years = now.year - birthDate.year;

@ -19,9 +19,10 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final double height; final double height;
final bool isInpatient; final bool isInpatient;
final bool isDischargedPatient; final bool isDischargedPatient;
final bool isFromLiveCare;
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false}); this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -152,7 +153,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
)) ))
: SizedBox(), : SizedBox(),
if (SERVICES_PATIANT2[int.parse(patientType)] == if (SERVICES_PATIANT2[int.parse(patientType)] ==
"List_MyOutPatient") "List_MyOutPatient" && !isFromLiveCare)
Container( Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -182,7 +183,6 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
SizedBox( SizedBox(
width: 3.5, width: 3.5,
), ),
Container( Container(
child: AppText( child: AppText(
convertDateFormat2( convertDateFormat2(
@ -261,7 +261,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
style: TextStyle(fontSize: 14)), style: TextStyle(fontSize: 14)),
new TextSpan( new TextSpan(
text: text:
"${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,)}", "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,isServerFormat: !isFromLiveCare)}",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700, fontSize: 14)), fontWeight: FontWeight.w700, fontSize: 14)),
], ],

Loading…
Cancel
Save