From 2f65546ff64d1e98b6731a16928714dbc6ec2485 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 3 Oct 2021 12:10:38 +0300 Subject: [PATCH] fix in-patient prescription --- .../all_lab_special_result_page.dart | 71 ++++++++++++----- .../prescription/prescriptions_page.dart | 78 +++++++++++++------ 2 files changed, 105 insertions(+), 44 deletions(-) diff --git a/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart b/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart index 443534ea..9a7ffd63 100644 --- a/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart +++ b/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart @@ -44,7 +44,8 @@ class _AllLabSpecialResultState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getAllSpecialLabResult(patientId: patient.patientMRN), + onModelReady: (model) => + model.getAllSpecialLabResult(patientId: patient.patientMRN), builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, backgroundColor: Colors.grey[100], @@ -69,7 +70,9 @@ class _AllLabSpecialResultState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).special + " " + TranslationBase.of(context).lab, + TranslationBase.of(context).special + + " " + + TranslationBase.of(context).lab, style: "caption2", color: Colors.black, fontSize: 13, @@ -105,26 +108,44 @@ class _AllLabSpecialResultState extends State { width: 20, height: 160, decoration: BoxDecoration( - color: model.allSpecialLabList[index].isLiveCareAppointment + color: model.allSpecialLabList[index] + .isLiveCareAppointment ? Colors.red[900] - : !model.allSpecialLabList[index].isInOutPatient + : !model.allSpecialLabList[index] + .isInOutPatient ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), - topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0), - bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)), + topLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + bottomLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + topRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + bottomRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0)), ), child: RotatedBox( quarterTurns: 3, child: Center( child: Text( - model.allSpecialLabList[index].isLiveCareAppointment - ? TranslationBase.of(context).liveCare.toUpperCase() - : !model.allSpecialLabList[index].isInOutPatient - ? TranslationBase.of(context).inPatientLabel.toUpperCase() - : TranslationBase.of(context).outpatient.toUpperCase(), + model.allSpecialLabList[index] + .isLiveCareAppointment + ? TranslationBase.of(context) + .liveCare + .toUpperCase() + : !model.allSpecialLabList[index] + .isInOutPatient + ? TranslationBase.of(context) + .inPatientLabel + .toUpperCase() + : TranslationBase.of(context) + .outpatient + .toUpperCase(), style: TextStyle(color: Colors.white), ), )), @@ -136,17 +157,24 @@ class _AllLabSpecialResultState extends State { context, FadePage( page: SpecialLabResultDetailsPage( - resultData: model.allSpecialLabList[index].resultDataHTML, + resultData: model.allSpecialLabList[index] + .resultDataHTML, patient: patient, ), ), ), - doctorName: model.allSpecialLabList[index].doctorName, - invoiceNO: ' ${model.allSpecialLabList[index].invoiceNo}', - profileUrl: model.allSpecialLabList[index].doctorImageURL, - branch: model.allSpecialLabList[index].projectName, - clinic: model.allSpecialLabList[index].clinicDescription, - appointmentDate: model.allSpecialLabList[index].orderDate, + doctorName: + model.allSpecialLabList[index].doctorName, + invoiceNO: + ' ${model.allSpecialLabList[index].invoiceNo}', + profileUrl: model + .allSpecialLabList[index].doctorImageURL, + branch: + model.allSpecialLabList[index].projectName, + clinic: model + .allSpecialLabList[index].clinicDescription, + appointmentDate: + model.allSpecialLabList[index].orderDate, orderNo: model.allSpecialLabList[index].orderNo, isShowTime: false, ), @@ -155,7 +183,8 @@ class _AllLabSpecialResultState extends State { ), ); }), - if (model.allSpecialLabList.isEmpty && patient.patientStatusType != 43) + if (model.allSpecialLabList.isEmpty && + patient.patientStatusType != 43) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 801669cb..b3cb4ec0 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -50,7 +50,8 @@ class PrescriptionsPage extends StatelessWidget { SizedBox( height: 12, ), - if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43) + if (model.prescriptionsList.isNotEmpty && + patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -70,7 +71,8 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if (patient.patientStatusType != null && patient.patientStatusType == 43) + if (patient.patientStatusType != null && + patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -90,7 +92,8 @@ class PrescriptionsPage extends StatelessWidget { ], ), ), - if ((patient.patientStatusType != null && patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { @@ -105,7 +108,8 @@ class PrescriptionsPage extends StatelessWidget { settingRoute: 'AddProcedureTabPage'), ); }, - label: TranslationBase.of(context).applyForNewPrescriptionsOrder, + label: TranslationBase.of(context) + .applyForNewPrescriptionsOrder, ), ...List.generate( model.prescriptionsList.length, @@ -114,7 +118,8 @@ class PrescriptionsPage extends StatelessWidget { context, FadePage( page: PrescriptionItemsPage( - prescriptions: model.prescriptionsList[index], + prescriptions: + model.prescriptionsList[index], patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -122,16 +127,22 @@ class PrescriptionsPage extends StatelessWidget { ), ), child: DoctorCard( - doctorName: model.prescriptionsList[index].doctorName, - profileUrl: model.prescriptionsList[index].doctorImageURL, + doctorName: + model.prescriptionsList[index].doctorName, + profileUrl: model + .prescriptionsList[index].doctorImageURL, branch: model.prescriptionsList[index].name, - clinic: model.prescriptionsList[index].clinicDescription, + clinic: model.prescriptionsList[index] + .clinicDescription, isPrescriptions: true, - appointmentDate: AppDateUtils.getDateTimeFromServerFormat( - model.prescriptionsList[index].appointmentDate, + appointmentDate: + AppDateUtils.getDateTimeFromServerFormat( + model.prescriptionsList[index] + .appointmentDate, ), ))), - if (model.prescriptionsList.isEmpty && patient.patientStatusType != 43) + if (model.prescriptionsList.isEmpty && + patient.patientStatusType != 43) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -142,7 +153,8 @@ class PrescriptionsPage extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noPrescriptionsFound), + child: AppText(TranslationBase.of(context) + .noPrescriptionsFound), ) ], ), @@ -163,6 +175,7 @@ class PrescriptionsPage extends StatelessWidget { ListView.builder( scrollDirection: Axis.vertical, + physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: model.medicationForInPatient.length, itemBuilder: (context, index) { @@ -171,31 +184,49 @@ class PrescriptionsPage extends StatelessWidget { onTap: () => Navigator.push( context, FadePage( - page: PrescriptionItemsInPatientPage( + page: + PrescriptionItemsInPatientPage( prescriptionIndex: index, - prescriptions: model.medicationForInPatient[index], + prescriptions: + model.medicationForInPatient[ + index], patient: patient, patientType: patientType, arrivalType: arrivalType, - startOn: AppDateUtils.getDateTimeFromServerFormat( - model.medicationForInPatient[index].startDatetime, + startOn: AppDateUtils + .getDateTimeFromServerFormat( + model + .medicationForInPatient[ + index] + .startDatetime, ), - stopOn: AppDateUtils.getDateTimeFromServerFormat( - model.medicationForInPatient[index].stopDatetime, + stopOn: AppDateUtils + .getDateTimeFromServerFormat( + model + .medicationForInPatient[ + index] + .stopDatetime, ), ), ), ), child: InPatientDoctorCard( - doctorName: model.medicationForInPatient[index].pHRItemDescription, + doctorName: model + .medicationForInPatient[index] + .pHRItemDescription, profileUrl: 'sss', branch: 'hamza', clinic: 'basheer', isPrescriptions: true, - appointmentDate: AppDateUtils.getDateTimeFromServerFormat( - model.medicationForInPatient[index].prescriptionDatetime, + appointmentDate: AppDateUtils + .getDateTimeFromServerFormat( + model.medicationForInPatient[index] + .prescriptionDatetime, ), - createdBy: model.medicationForInPatient[index].doctorName.toString(), + createdBy: model + .medicationForInPatient[index] + .doctorName + .toString(), )); }), if (model.medicationForInPatient.length == 0) @@ -209,7 +240,8 @@ class PrescriptionsPage extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).noPrescriptionsFound), + child: AppText(TranslationBase.of(context) + .noPrescriptionsFound), ) ], ),