From e42f953bd15d2ebfc352a8ead0c9d1972eb9611e Mon Sep 17 00:00:00 2001 From: Mohammad Aljmma Date: Wed, 4 Nov 2020 16:40:30 +0200 Subject: [PATCH] fix prescription report issues --- lib/config/localized_values.dart | 2 +- lib/core/service/AuthenticatedUserObject.dart | 1 + lib/core/service/insurance_service.dart | 44 ++----------------- .../medical/prescriptions_service.dart | 6 ++- .../medical/prescriptions_view_model.dart | 4 +- .../insurance/insurance_update_screen.dart | 7 +-- lib/pages/landing/home_page.dart | 11 +++-- lib/pages/login/login.dart | 24 +++++----- .../medical/patient_sick_leave_page.dart | 4 +- .../prescription_details_page.dart | 10 +++-- .../prescription_items_page.dart | 10 +++-- .../prescriptions/prescriptions_page.dart | 3 +- .../data_display/medical/doctor_card.dart | 9 ++-- lib/widgets/others/StarRating.dart | 2 +- 14 files changed, 55 insertions(+), 82 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8a934bf6..1cc87c20 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -341,7 +341,7 @@ const Map> localizedValues = { "MyMedicalFile": {"en": "My Medical File", 'ar': 'ملف الطبي الالكتروني'}, "myMedicalFileSubTitle": { "en": "All your medical records", - 'ar': 'جميع سجلاتك البية' + 'ar': 'جميع سجلاتك الطبية' }, "viewMore": {"en": "View More", 'ar': 'عرض المزيد'}, "homeHealthCareService": { diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index 600e17e1..25005b3a 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -23,5 +23,6 @@ class AuthenticatedUserObject { logout() async { isLogin = false; + var asd =""; } } diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 7fee6615..02061612 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -31,48 +31,9 @@ class InsuranceCardService extends BaseService { _cardUpdated.clear(); } - InsuranceCardModel _insuranceCardModel = InsuranceCardModel( - channel: 3, - deviceTypeID: 2, - generalid: "Cs2020@2016\$2958", - iPAdress: "10.20.10.20", - isDentalAllowedBackend: false, - languageID: 1, - patientID: 1231755, - patientOutSA: 0, - patientType: 1, - patientTypeID: 1, - sessionID: "uoKFXSLUwEaHYPwKZNA", - tokenID: "@dm!n", - versionID: 5.5, - ); - - InsuranceUpdateModel _insuranceUpdateModel = InsuranceUpdateModel( - channel: 3, - deviceTypeID: 2, - generalid: "Cs2020@2016\$2958", - iPAdress: "10.20.10.20", - isDentalAllowedBackend: false, - patientID: 1231755, - patientType: 1, - versionID: 5.5, - languageID: 2, - patientOutSA: 0, - sessionID: "ENRSJBKXnzCuuVQ", - ); InsuranceApprovalModel _insuranceApprovalModel = InsuranceApprovalModel( - versionID: 5.5, - channel: 3, - languageID: LANGUAGE_ID, - iPAdress: "10.20.10.20", - generalid: "Cs2020@2016\$2958", - patientOutSA: 0, - sessionID: "DypNmtMkivzURHjeYg", isDentalAllowedBackend: false, - deviceTypeID: 2, - patientID: 1231755, - tokenID: "@dm!n", patientTypeID: 1, patientType: 1, eXuldAPPNO: 0, @@ -89,7 +50,7 @@ class InsuranceCardService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _insuranceCardModel.toJson()); + }, body: Map()); } Future getInsuranceUpdate() async { @@ -97,13 +58,14 @@ class InsuranceCardService extends BaseService { // _cardList.clear(); await baseAppClient.post(GET_PAtIENTS_INSURANCE_UPDATED, onSuccess: (dynamic response, int statusCode) { + _cardUpdated.clear(); response['List_PatientInsuranceCardHistory'].forEach((item) { _cardUpdated.add(InsuranceUpdateModel.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _insuranceUpdateModel.toJson()); + }, body: Map()); } Future getInsuranceApproval({int appointmentNo}) async { diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index 294ef897..f4a6c766 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -95,9 +95,13 @@ class PrescriptionsService extends BaseService { isDentalAllowedBackend: false); List prescriptionReportList = List(); - Future getPrescriptionReport({int dischargeNo}) async { + Future getPrescriptionReport({int dischargeNo,int projectId,int clinicID,String setupID}) async { hasError = false; _requestPrescriptionReport.dischargeNo = dischargeNo; + _requestPrescriptionReport.projectID = projectId; + _requestPrescriptionReport.clinicID = clinicID; + _requestPrescriptionReport.setupID = setupID; + await baseAppClient.post(GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) { prescriptionReportList.clear(); diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 27b954d4..9d74fd88 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -102,9 +102,9 @@ class PrescriptionsViewModel extends BaseViewModel { notifyListeners(); } - getPrescriptionReport({int dischargeNo}) async { + getPrescriptionReport({int dischargeNo,int projectId,int clinicID,String setupID}) async { setState(ViewState.Busy); - await _prescriptionsService.getPrescriptionReport(dischargeNo: dischargeNo); + await _prescriptionsService.getPrescriptionReport(dischargeNo: dischargeNo,projectId: projectId,clinicID: clinicID,setupID: setupID); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 2fa291df..1e616108 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -98,12 +98,7 @@ class _InsuranceUpdateState extends State children: [ Container( child: ListView.builder( - itemCount: model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList == - null - ? 0 - : model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList.length, + itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, itemBuilder: (BuildContext context, int index) { return Container( margin: EdgeInsets.all(10.0), diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 34aa2fe2..82fd6d22 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -27,6 +28,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../locator.dart'; + class HomePage extends StatefulWidget { final Function goToMyProfile; @@ -46,6 +49,8 @@ class _HomePageState extends State { }); super.initState(); } + AuthenticatedUserObject authenticatedUserObject = locator(); + @override Widget build(BuildContext context) { @@ -105,7 +110,7 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!model.isLogin && projectViewModel.user == null) + child: (!authenticatedUserObject.isLogin && projectViewModel.user == null) ? Container( width: double.infinity, height: 160, @@ -145,8 +150,8 @@ class _HomePageState extends State { ), Align( alignment: projectViewModel.isArabic - ? Alignment.bottomRight - : Alignment.bottomLeft, + ? Alignment.bottomLeft + : Alignment.bottomRight, child: InkWell( onTap: () { widget.goToMyProfile(); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 91d356de..458924e3 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -228,21 +228,21 @@ class _Login extends State { GifLoaderDialogUtils.hideDialog(context), if (appointmentRateViewModel.isHaveAppointmentNotRate) { - Navigator.pushReplacement( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - ) + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) } else { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ) + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) } }) .catchError((err) { diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index dab3d6cf..d12573f0 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -31,8 +31,8 @@ class _PatientSickLeavePageState extends State { profileUrl: model.sickLeaveList[index].doctorImageURL, rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), subName: model.sickLeaveList[index].projectName, - isInOutPatientDescription: - model.sickLeaveList[index].isInOutPatientDescription, + isInOutPatient: + model.sickLeaveList[index].isInOutPatient, onEmailTap: () { model.sendSickLeaveEmail( message: TranslationBase.of(context).emailSentSuccessfully, diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 72c82c55..43dc398b 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -46,9 +46,13 @@ class PrescriptionDetailsPage extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts(prescriptionReport.itemDescription)), + child: Texts( + prescriptionReport.itemDescription.isNotEmpty + ? prescriptionReport.itemDescription + : prescriptionReport.itemDescriptionN), + ), ), - ), + ) ], ), ), @@ -169,7 +173,7 @@ class PrescriptionDetailsPage extends StatelessWidget { SizedBox( height: 5, ), - Texts(' '), + Texts(prescriptionReport.remarks), ], ), ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index c84be7bd..297d8333 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -19,10 +20,10 @@ class PrescriptionItemsPage extends StatelessWidget { Widget build(BuildContext context) { return BaseView( onModelReady: (model) => - model.getPrescriptionReport(dischargeNo: prescriptions.dischargeNo), + model.getPrescriptionReport(dischargeNo: prescriptions.dischargeNo,setupID:prescriptions.setupID,clinicID: prescriptions.clinicID,projectId: prescriptions.projectID), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Items', + appBarTitle: TranslationBase.of(context).prescriptions, baseViewModel: model, body: Container( height: MediaQuery.of(context).size.height * 0.8, @@ -62,8 +63,9 @@ class PrescriptionItemsPage extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts(model - .prescriptionReportList[index].itemDescription)), + child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty? + model.prescriptionReportList[index].itemDescription :model + .prescriptionReportList[index].itemDescriptionN)), )), Icon( Icons.arrow_forward_ios, diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index e6e90d9e..6b852db9 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -86,8 +86,9 @@ class PrescriptionsPage extends StatelessWidget { child: DoctorCard( name: prescriptions.doctorName, profileUrl: prescriptions.doctorImageURL, - rat: prescriptions.doctorRate.toDouble(), + rat: prescriptions.actualDoctorRate.toDouble(), subName: prescriptions.name, + isInOutPatient: prescriptions.isInOutPatient, date: DateUtil.getMonthDayYearDateFormatted( prescriptions.dischargeDate), ), diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index b9143682..4fdaa1ab 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -15,8 +15,7 @@ class DoctorCard extends StatelessWidget { final String billNo; final Function onTap; final Function onEmailTap; - - final String isInOutPatientDescription; + final bool isInOutPatient; DoctorCard( {this.name, @@ -27,7 +26,7 @@ class DoctorCard extends StatelessWidget { this.billNo, this.onTap, this.onEmailTap, - this.isInOutPatientDescription}); + this.isInOutPatient}); @override Widget build(BuildContext context) { @@ -54,7 +53,7 @@ class DoctorCard extends StatelessWidget { width: 20, height: date == null ? 100 : 130, decoration: BoxDecoration( - color: Colors.red[900], + color: !isInOutPatient? Colors.red[900]: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(8), bottomLeft: Radius.circular(8))), @@ -62,7 +61,7 @@ class DoctorCard extends StatelessWidget { quarterTurns: 3, child: Center( child: Text( - isInOutPatientDescription ?? "Calendar", + !isInOutPatient? 'In Patient'.toUpperCase():'OutPatient'.toUpperCase(), style: TextStyle(color: Colors.white), ), )), diff --git a/lib/widgets/others/StarRating.dart b/lib/widgets/others/StarRating.dart index f33ced32..2eaa7f91 100644 --- a/lib/widgets/others/StarRating.dart +++ b/lib/widgets/others/StarRating.dart @@ -9,7 +9,7 @@ class StarRating extends StatelessWidget { final int totalCount; final bool forceStars; - StarRating({Key key, this.totalAverage: 0.0, this.size: 16.0, this.totalCount, this.forceStars = false}) : super(key: key); + StarRating({Key key, this.totalAverage: 0.0, this.size: 16.0, this.totalCount=5, this.forceStars = false}) : super(key: key); @override Widget build(BuildContext context) {