From ec9f628b67d7749e6c40e505737b65674a3c7fe0 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 7 Jun 2021 17:00:46 +0300 Subject: [PATCH 1/3] Merge branch 'development' into procedure_refactoring # Conflicts: # lib/core/service/patient/LiveCarePatientServices.dart --- lib/config/config.dart | 8 +- lib/core/enum/PatientType.dart | 4 + .../patient/MyReferralPatientService.dart | 36 +++ .../patient-doctor-referral-service.dart | 31 +++ .../patient/referred_patient_service.dart | 36 --- .../viewModel/patient-referral-viewmodel.dart | 31 ++- lib/core/viewModel/referred_view_model.dart | 24 -- lib/locator.dart | 4 - .../my-referral-inpatient-screen.dart | 4 +- .../referral/referred-patient-screen.dart | 257 +++++++++++------- .../patient-referral-item-widget.dart | 2 +- 11 files changed, 273 insertions(+), 164 deletions(-) create mode 100644 lib/core/enum/PatientType.dart delete mode 100644 lib/core/service/patient/referred_patient_service.dart delete mode 100644 lib/core/viewModel/referred_view_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index bd701836..91f8bc9d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; @@ -56,6 +56,8 @@ const ADD_REFERRED_DOCTOR_REMARKS = 'Services/DoctorApplication.svc/REST/AddRefe const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; +const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient'; + const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals'; const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; @@ -179,6 +181,8 @@ const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; +const GET_MY_REFERRAL_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferredOutPatient"; + const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; diff --git a/lib/core/enum/PatientType.dart b/lib/core/enum/PatientType.dart new file mode 100644 index 00000000..96fd9ae5 --- /dev/null +++ b/lib/core/enum/PatientType.dart @@ -0,0 +1,4 @@ +enum PatientType{ + IN_PATIENT, + OUT_PATIENT, +} \ No newline at end of file diff --git a/lib/core/service/patient/MyReferralPatientService.dart b/lib/core/service/patient/MyReferralPatientService.dart index 536e68a7..05a937ee 100644 --- a/lib/core/service/patient/MyReferralPatientService.dart +++ b/lib/core/service/patient/MyReferralPatientService.dart @@ -42,6 +42,42 @@ class MyReferralInPatientService extends BaseService { ); } + Future getMyReferralOutPatientService() async { + hasError = false; + Map body = Map(); + await getDoctorProfile(); + body['DoctorID'] = doctorProfile.doctorID; + body['FirstName'] = "0"; + body['MiddleName'] = "0"; + body['LastName'] = "0"; + body['PatientMobileNumber'] = "0"; + body['PatientIdentificationID'] = "0"; + body['PatientID'] = 0; + body['From'] = "0"; + body['To'] = "0"; + body['stamp'] = DateTime.now().toIso8601String(); + body['IsLoginForDoctorApp'] = true; + body['IPAdress'] = "11.11.11.11"; + body['PatientOutSA'] = false; + body['PatientTypeID'] = 1; + myReferralPatients.clear(); + await baseAppClient.post( + GET_MY_REFERRAL_OUTPATIENT, + onSuccess: (dynamic response, int statusCode) { + if (response['List_MyReferredOutPatient'] != null) { + response['List_MyReferredOutPatient'].forEach((v) { + myReferralPatients.add(MyReferralPatientModel.fromJson(v)); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } + Future replay( String referredDoctorRemarks, MyReferralPatientModel referral) async { hasError = false; diff --git a/lib/core/service/patient/patient-doctor-referral-service.dart b/lib/core/service/patient/patient-doctor-referral-service.dart index c83c74c9..c9126845 100644 --- a/lib/core/service/patient/patient-doctor-referral-service.dart +++ b/lib/core/service/patient/patient-doctor-referral-service.dart @@ -157,6 +157,37 @@ class PatientReferralService extends LookupService { ); } + Future getMyReferredOutPatient() async { + hasError = false; + RequestMyReferralPatientModel _requestMyReferralPatient = + RequestMyReferralPatientModel(); + // _requestMyReferralPatient.doctorID = 1002; + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + await baseAppClient.post( + GET_MY_REFERRED_OUT_PATIENT, + onSuccess: (dynamic response, int statusCode) { + listMyReferredPatientModel.clear(); + + response['List_MyOutPatientReferral'].forEach((v) { + MyReferredPatientModel item = MyReferredPatientModel.fromJson(v); + if (doctorProfile != null) { + item.isReferralDoctorSameBranch = + doctorProfile.projectID == item.projectID; + } else { + item.isReferralDoctorSameBranch = false; + } + listMyReferredPatientModel.add(item); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestMyReferralPatient.toJson(), + ); + } + Future getPendingReferralList() async { hasError = false; DoctorProfileModel doctorProfile = await getDoctorProfile(); diff --git a/lib/core/service/patient/referred_patient_service.dart b/lib/core/service/patient/referred_patient_service.dart deleted file mode 100644 index 0af9b077..00000000 --- a/lib/core/service/patient/referred_patient_service.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -import 'package:doctor_app_flutter/models/doctor/verify_referral_doctor_remarks.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; -import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; - -class ReferredPatientService extends BaseService { - List _listMyReferredPatientModel = []; - - List get listMyReferredPatientModel => - _listMyReferredPatientModel; - - RequestMyReferralPatientModel _requestMyReferralPatient = - RequestMyReferralPatientModel(); - VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = - VerifyReferralDoctorRemarks(); - - Future getMyReferredPatient() async { - await baseAppClient.post( - GET_MY_REFERRED_PATIENT, - onSuccess: (dynamic response, int statusCode) { - _listMyReferredPatientModel.clear(); - response['List_MyReferredPatient'].forEach((v) { - listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); - }); - // print(response['List_MyReferredPatient']); - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: _requestMyReferralPatient.toJson(), - ); - } - -} diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index a414c200..6e3e310e 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -28,6 +28,7 @@ class PatientReferralViewModel extends BaseViewModel { DischargedPatientService _dischargedPatientService = locator(); + List get myDischargeReferralPatient => _dischargedPatientService.myDischargeReferralPatients; @@ -133,8 +134,11 @@ class PatientReferralViewModel extends BaseViewModel { return null; } - Future getMyReferredPatient() async { - setState(ViewState.Busy); + Future getMyReferredPatient({bool isFirstTime = true}) async { + if (isFirstTime) + setState(ViewState.Busy); + else + setState(ViewState.BusyLocal); await _referralPatientService.getMyReferredPatient(); if (_referralPatientService.hasError) { error = _referralPatientService.error; @@ -143,6 +147,19 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getMyReferredOutPatient({bool isFirstTime = true}) async { + if (isFirstTime) + setState(ViewState.Busy); + else + setState(ViewState.BusyLocal); + await _referralPatientService.getMyReferredOutPatient(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + MyReferredPatientModel getReferredPatientItem(int index) { return listMyReferredPatientModel[index]; } @@ -167,6 +184,16 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getMyReferralOutPatientService() async { + setState(ViewState.Busy); + await _myReferralService.getMyReferralOutPatientService(); + if (_myReferralService.hasError) { + error = _myReferralService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future replay( String referredDoctorRemarks, MyReferralPatientModel referral) async { setState(ViewState.Busy); diff --git a/lib/core/viewModel/referred_view_model.dart b/lib/core/viewModel/referred_view_model.dart deleted file mode 100644 index 173aa60a..00000000 --- a/lib/core/viewModel/referred_view_model.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/service/patient/referred_patient_service.dart'; -import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; - -import '../../locator.dart'; -import 'base_view_model.dart'; - -class ReferredPatientViewModel extends BaseViewModel { - ReferredPatientService _referralPatientService = - locator(); - - List get listMyReferredPatientModel => - _referralPatientService.listMyReferredPatientModel; - - Future getMyReferredPatient() async { - setState(ViewState.Busy); - await _referralPatientService.getMyReferredPatient(); - if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } -} diff --git a/lib/locator.dart b/lib/locator.dart index 66ec9161..5ee46b4d 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -35,7 +35,6 @@ import 'core/service/patient/patientInPatientService.dart'; import 'core/service/patient_medical_file/prescription/prescriptions_service.dart'; import 'core/service/patient_medical_file/radiology/radiology_service.dart'; import 'core/service/patient/referral_patient_service.dart'; -import 'core/service/patient/referred_patient_service.dart'; import 'core/service/home/schedule_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; @@ -54,7 +53,6 @@ import 'core/viewModel/patient-vital-sign-viewmodel.dart'; import 'core/viewModel/prescriptions_view_model.dart'; import 'core/viewModel/radiology_view_model.dart'; import 'core/viewModel/referral_view_model.dart'; -import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; GetIt locator = GetIt.instance; @@ -65,7 +63,6 @@ void setupLocator() { locator.registerLazySingleton(() => DoctorReplyService()); locator.registerLazySingleton(() => ScheduleService()); locator.registerLazySingleton(() => ReferralPatientService()); - locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); locator.registerLazySingleton(() => DashboardService()); @@ -97,7 +94,6 @@ void setupLocator() { locator.registerFactory(() => DoctorReplayViewModel()); locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ReferralPatientViewModel()); - locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => DashboardViewModel()); diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index fcbd11b7..5665a30f 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -42,12 +42,10 @@ class MyReferralInPatientScreen extends StatelessWidget { : SingleChildScrollView( child: Container( margin: EdgeInsets.only(top: 70), - // color: Colors.white, - // height: MediaQuery.of(context).size.height, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // SizedBox(height: 50), + ...List.generate( model.myReferralPatients.length, (index) => InkWell( diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index dc2bf798..c95a28d8 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/enum/PatientType.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referred_patient_detail_in-paint.dart'; @@ -6,12 +7,15 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ReferredPatientScreen extends StatelessWidget { - // previous design page is: MyReferredPatient + + PatientType patientType = PatientType.IN_PATIENT; + @override Widget build(BuildContext context) { return BaseView( @@ -20,103 +24,172 @@ class ReferredPatientScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: false, appBarTitle: TranslationBase.of(context).referredPatient, - body: model.listMyReferredPatientModel == null || - model.listMyReferredPatientModel.length == 0 - ? Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 100, + body: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 70), + child: PatientTypeRadioWidget( + (patientType) async { + this.patientType = patientType; + GifLoaderDialogUtils.showMyDialog(context); + if (patientType == PatientType.IN_PATIENT) { + await model.getMyReferredPatient(isFirstTime: false); + } else { + await model.getMyReferredOutPatient(isFirstTime: false); + } + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ), + model.listMyReferredPatientModel == null || + model.listMyReferredPatientModel.length == 0 + ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + ], ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).referralEmptyMsg, - color: Theme.of(context).errorColor, - ), - ) - ], - ), - ) - : SingleChildScrollView( - // DoctorApplication.svc/REST/GtMyReferredPatient - child: Container( - margin: EdgeInsets.only(top: 70), - child: Column( - children: [ - // const Divider( - // color: Color(0xffCCCCCC), - // height: 1, - // thickness: 2, - // indent: 0, - // endIndent: 0, - // ), - ...List.generate( - model.listMyReferredPatientModel.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferredPatientDetailScreen( - model.getReferredPatientItem(index)), + ) + : Expanded( + child: SingleChildScrollView( + // DoctorApplication.svc/REST/GtMyReferredPatient + child: Container( + child: Column( + children: [ + ...List.generate( + model.listMyReferredPatientModel.length, + (index) => InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferredPatientDetailScreen( + model.getReferredPatientItem(index)), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model + .getReferredPatientItem(index) + .referralStatusDesc, + referralStatusCode: model + .getReferredPatientItem(index) + .referralStatus, + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: + model.getReferredPatientItem(index).gender, + referredDate: + AppDateUtils.convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "dd/MM/yyyy"), + referredTime: + AppDateUtils.convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "hh:mm a"), + patientID: + "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + isReferral: false, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + nationality: model + .getReferredPatientItem(index) + .nationalityName, + nationalityFlag: model + .getReferredPatientItem(index) + .nationalityFlagURL, + doctorAvatar: model + .getReferredPatientItem(index) + .doctorImageURL, + referralDoctorName: + "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), + ), ), - ); - }, - child: PatientReferralItemWidget( - referralStatus:model.getReferredPatientItem(index).referralStatusDesc, - referralStatusCode: model - .getReferredPatientItem(index) - .referralStatus, - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - patientGender: - model.getReferredPatientItem(index).gender, - referredDate: AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "dd/MM/yyyy"), - referredTime: AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "hh:mm a"), - patientID: - "${model.getReferredPatientItem(index).patientID}", - isSameBranch: model - .getReferredPatientItem(index) - .isReferralDoctorSameBranch, - isReferral: false, - remark: model - .getReferredPatientItem(index) - .referringDoctorRemarks, - nationality: model - .getReferredPatientItem(index) - .nationalityName, - nationalityFlag: model - .getReferredPatientItem(index) - .nationalityFlagURL, - doctorAvatar: model - .getReferredPatientItem(index) - .doctorImageURL, - referralDoctorName: - "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", - clinicDescription: model - .getReferredPatientItem(index) - .referralClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), - ), + ), + ], ), ), - ], - ), + ), ), - ), + ], + ), ), ); } } + +class PatientTypeRadioWidget extends StatefulWidget { + final Function(PatientType) radioOnChange; + + PatientTypeRadioWidget(this.radioOnChange); + + @override + _PatientTypeRadioWidgetState createState() => + _PatientTypeRadioWidgetState(this.radioOnChange); +} + +class _PatientTypeRadioWidgetState extends State { + final Function(PatientType) radioOnChange; + + _PatientTypeRadioWidgetState(this.radioOnChange); + + PatientType patientType = PatientType.IN_PATIENT; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: RadioListTile( + title: AppText(TranslationBase.of(context).inPatient), + value: PatientType.IN_PATIENT, + groupValue: patientType, + onChanged: (PatientType value) { + setState(() { + patientType = value; + radioOnChange(value); + }); + }, + ), + ), + Expanded( + child: RadioListTile( + title: AppText(TranslationBase.of(context).outpatient), + value: PatientType.OUT_PATIENT, + groupValue: patientType, + onChanged: (PatientType value) { + setState(() { + patientType = value; + radioOnChange(value); + }); + }, + ), + ), + ], + ); + } +} diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index a08282c0..6e581954 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -215,7 +215,7 @@ class PatientReferralItemWidget extends StatelessWidget { ), Expanded( child: AppText( - remark, + remark??"", fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.8 * SizeConfig.textMultiplier, From 72966c32695e737e95fddc51e9f1dd295b4b7456 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 8 Jun 2021 13:05:08 +0300 Subject: [PATCH 2/3] fix referral patient services --- lib/config/config.dart | 8 +- .../referral/MyReferralPatientModel.dart | 4 +- .../MyReferralPatientRequestModel.dart | 104 +++++++++++++ .../patient/MyReferralPatientService.dart | 69 ++++----- .../patient-doctor-referral-service.dart | 3 +- .../viewModel/patient-referral-viewmodel.dart | 12 +- .../my_referred_patient_model.dart | 2 +- .../my-referral-inpatient-screen.dart | 141 +++++++++++------- .../referral_patient_detail_in-paint.dart | 13 +- .../referred_patient_detail_in-paint.dart | 11 +- lib/util/date-utils.dart | 18 +++ 11 files changed, 270 insertions(+), 115 deletions(-) create mode 100644 lib/core/model/referral/MyReferralPatientRequestModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 91f8bc9d..e2f9eb6a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; @@ -56,7 +56,7 @@ const ADD_REFERRED_DOCTOR_REMARKS = 'Services/DoctorApplication.svc/REST/AddRefe const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; -const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient'; +const GET_MY_REFERRED_OUT_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredOutPatient'; const GET_PENDING_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/PendingReferrals'; @@ -181,7 +181,7 @@ const GET_ECG = "Services/Patients.svc/REST/HIS_GetPatientMuseResults"; const GET_MY_REFERRAL_INPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralPatient"; -const GET_MY_REFERRAL_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferredOutPatient"; +const GET_MY_REFERRAL_OUTPATIENT = "Services/DoctorApplication.svc/REST/GtMyReferralForOutPatient"; const GET_MY_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargeReferralPatient"; const GET_DISCHARGE_PATIENT = "Services/DoctorApplication.svc/REST/GtMyDischargePatient"; diff --git a/lib/core/model/referral/MyReferralPatientModel.dart b/lib/core/model/referral/MyReferralPatientModel.dart index 797109dd..7aa375b8 100644 --- a/lib/core/model/referral/MyReferralPatientModel.dart +++ b/lib/core/model/referral/MyReferralPatientModel.dart @@ -158,8 +158,8 @@ class MyReferralPatientModel { referringDoctor = json['ReferringDoctor']; referralClinic = json['ReferralClinic']; referringClinic = json['ReferringClinic']; - referralStatus = json['ReferralStatus']; - referralDate = AppDateUtils.convertStringToDate(json['ReferralDate']); + referralStatus = json["ReferralStatus"] is String ?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0: json["ReferralStatus"]; + referralDate = AppDateUtils.getDateTimeFromString(json['ReferralDate']); referringDoctorRemarks = json['ReferringDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks']; referralResponseOn = json['ReferralResponseOn']; diff --git a/lib/core/model/referral/MyReferralPatientRequestModel.dart b/lib/core/model/referral/MyReferralPatientRequestModel.dart new file mode 100644 index 00000000..08b98a99 --- /dev/null +++ b/lib/core/model/referral/MyReferralPatientRequestModel.dart @@ -0,0 +1,104 @@ +class MyReferralPatientRequestModel { + int channel; + int clinicID; + int doctorID; + int editedBy; + String firstName; + String from; + String iPAdress; + bool isLoginForDoctorApp; + int languageID; + String lastName; + String middleName; + int patientID; + String patientIdentificationID; + String patientMobileNumber; + bool patientOutSA; + int patientTypeID; + int projectID; + String sessionID; + String stamp; + String to; + String tokenID; + double versionID; + String vidaAuthTokenID; + + MyReferralPatientRequestModel( + {this.channel, + this.clinicID, + this.doctorID, + this.editedBy, + this.firstName, + this.from, + this.iPAdress, + this.isLoginForDoctorApp, + this.languageID, + this.lastName, + this.middleName, + this.patientID, + this.patientIdentificationID, + this.patientMobileNumber, + this.patientOutSA, + this.patientTypeID, + this.projectID, + this.sessionID, + this.stamp, + this.to, + this.tokenID, + this.versionID, + this.vidaAuthTokenID}); + + MyReferralPatientRequestModel.fromJson(Map json) { + channel = json['Channel']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + editedBy = json['EditedBy']; + firstName = json['FirstName']; + from = json['From']; + iPAdress = json['IPAdress']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + languageID = json['LanguageID']; + lastName = json['LastName']; + middleName = json['MiddleName']; + patientID = json['PatientID']; + patientIdentificationID = json['PatientIdentificationID']; + patientMobileNumber = json['PatientMobileNumber']; + patientOutSA = json['PatientOutSA']; + patientTypeID = json['PatientTypeID']; + projectID = json['ProjectID']; + sessionID = json['SessionID']; + stamp = json['stamp']; + to = json['To']; + tokenID = json['TokenID']; + versionID = json['VersionID']; + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['Channel'] = this.channel; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EditedBy'] = this.editedBy; + data['FirstName'] = this.firstName; + data['From'] = this.from; + data['IPAdress'] = this.iPAdress; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['LanguageID'] = this.languageID; + data['LastName'] = this.lastName; + data['MiddleName'] = this.middleName; + data['PatientID'] = this.patientID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientOutSA'] = this.patientOutSA; + data['PatientTypeID'] = this.patientTypeID; + data['ProjectID'] = this.projectID; + data['SessionID'] = this.sessionID; + data['stamp'] = this.stamp; + data['To'] = this.to; + data['TokenID'] = this.tokenID; + data['VersionID'] = this.versionID; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/service/patient/MyReferralPatientService.dart b/lib/core/service/patient/MyReferralPatientService.dart index 05a937ee..9f29c4dc 100644 --- a/lib/core/service/patient/MyReferralPatientService.dart +++ b/lib/core/service/patient/MyReferralPatientService.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientRequestModel.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/request_add_referred_doctor_remarks.dart'; @@ -8,22 +9,22 @@ class MyReferralInPatientService extends BaseService { Future getMyReferralPatientService() async { hasError = false; - Map body = Map(); await getDoctorProfile(); - body['DoctorID'] = doctorProfile.doctorID; - body['FirstName'] = "0"; - body['MiddleName'] = "0"; - body['LastName'] = "0"; - body['PatientMobileNumber'] = "0"; - body['PatientIdentificationID'] = "0"; - body['PatientID'] = 0; - body['From'] = "0"; - body['To'] = "0"; - body['stamp'] = DateTime.now().toIso8601String(); - body['IsLoginForDoctorApp'] = true; - body['IPAdress'] = "11.11.11.11"; - body['PatientOutSA'] = false; - body['PatientTypeID'] = 1; + + MyReferralPatientRequestModel myReferralPatientRequestModel = + MyReferralPatientRequestModel( + doctorID: doctorProfile.doctorID, + firstName: "0", + middleName: "0", + lastName: "0", + patientMobileNumber: "0", + patientIdentificationID: "0", + patientID: 0, + from: "0", + to: "0", + stamp: DateTime.now().toIso8601String(), + isLoginForDoctorApp: true, + patientTypeID: 1); myReferralPatients.clear(); await baseAppClient.post( GET_MY_REFERRAL_INPATIENT, @@ -38,34 +39,34 @@ class MyReferralInPatientService extends BaseService { hasError = true; super.error = error; }, - body: body, + body: myReferralPatientRequestModel.toJson(), ); } Future getMyReferralOutPatientService() async { hasError = false; - Map body = Map(); await getDoctorProfile(); - body['DoctorID'] = doctorProfile.doctorID; - body['FirstName'] = "0"; - body['MiddleName'] = "0"; - body['LastName'] = "0"; - body['PatientMobileNumber'] = "0"; - body['PatientIdentificationID'] = "0"; - body['PatientID'] = 0; - body['From'] = "0"; - body['To'] = "0"; - body['stamp'] = DateTime.now().toIso8601String(); - body['IsLoginForDoctorApp'] = true; - body['IPAdress'] = "11.11.11.11"; - body['PatientOutSA'] = false; - body['PatientTypeID'] = 1; + + MyReferralPatientRequestModel myReferralPatientRequestModel = + MyReferralPatientRequestModel( + doctorID: doctorProfile.doctorID, + firstName: "0", + middleName: "0", + lastName: "0", + patientMobileNumber: "0", + patientIdentificationID: "0", + patientID: 0, + from: "0", + to: "0", + stamp: DateTime.now().toIso8601String(), + isLoginForDoctorApp: true, + patientTypeID: 1); myReferralPatients.clear(); await baseAppClient.post( GET_MY_REFERRAL_OUTPATIENT, onSuccess: (dynamic response, int statusCode) { - if (response['List_MyReferredOutPatient'] != null) { - response['List_MyReferredOutPatient'].forEach((v) { + if (response['List_MyOutPatientReferral'] != null) { + response['List_MyOutPatientReferral'].forEach((v) { myReferralPatients.add(MyReferralPatientModel.fromJson(v)); }); } @@ -74,7 +75,7 @@ class MyReferralInPatientService extends BaseService { hasError = true; super.error = error; }, - body: body, + body: myReferralPatientRequestModel.toJson(), ); } diff --git a/lib/core/service/patient/patient-doctor-referral-service.dart b/lib/core/service/patient/patient-doctor-referral-service.dart index c9126845..81529590 100644 --- a/lib/core/service/patient/patient-doctor-referral-service.dart +++ b/lib/core/service/patient/patient-doctor-referral-service.dart @@ -161,7 +161,6 @@ class PatientReferralService extends LookupService { hasError = false; RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); - // _requestMyReferralPatient.doctorID = 1002; DoctorProfileModel doctorProfile = await getDoctorProfile(); await baseAppClient.post( @@ -169,7 +168,7 @@ class PatientReferralService extends LookupService { onSuccess: (dynamic response, int statusCode) { listMyReferredPatientModel.clear(); - response['List_MyOutPatientReferral'].forEach((v) { + response['List_MyReferredOutPatient'].forEach((v) { MyReferredPatientModel item = MyReferredPatientModel.fromJson(v); if (doctorProfile != null) { item.isReferralDoctorSameBranch = diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 6e3e310e..01d40e62 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -174,22 +174,22 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getMyReferralPatientService() async { - setState(ViewState.Busy); + Future getMyReferralPatientService({bool localBusy = false}) async { + if(localBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); await _myReferralService.getMyReferralPatientService(); if (_myReferralService.hasError) { error = _myReferralService.error; - setState(ViewState.Error); + if(localBusy) setState(ViewState.ErrorLocal); else setState(ViewState.Error); } else setState(ViewState.Idle); } - Future getMyReferralOutPatientService() async { - setState(ViewState.Busy); + Future getMyReferralOutPatientService({bool localBusy = false}) async { + if(localBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); await _myReferralService.getMyReferralOutPatientService(); if (_myReferralService.hasError) { error = _myReferralService.error; - setState(ViewState.Error); + if(localBusy) setState(ViewState.ErrorLocal); else setState(ViewState.Error); } else setState(ViewState.Idle); } diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index 44a427f7..5a755fe8 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -166,7 +166,7 @@ class MyReferredPatientModel { referringDoctor = json['ReferringDoctor']; referralClinic = json['ReferralClinic']; referringClinic = json['ReferringClinic']; - referralStatus = json['ReferralStatus']; + referralStatus = json["ReferralStatus"] is String?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0 : json['ReferralStatus'];// TODO Elham json['ReferralStatus']; referralDate = json['ReferralDate']; referringDoctorRemarks = json['ReferringDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks']; diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index 5665a30f..9813286e 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -1,16 +1,21 @@ +import 'package:doctor_app_flutter/core/enum/PatientType.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/referral_patient_detail_in-paint.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class MyReferralInPatientScreen extends StatelessWidget { + PatientType patientType = PatientType.IN_PATIENT; + @override Widget build(BuildContext context) { @@ -20,70 +25,90 @@ class MyReferralInPatientScreen extends StatelessWidget { baseViewModel: model, isShowAppBar: false, appBarTitle: TranslationBase.of(context).referPatient, - body: model.myReferralPatients.isEmpty - ? Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 100, + body: Column( + children: [ + + Container( + margin: EdgeInsets.only(top: 70), + child: PatientTypeRadioWidget( + (patientType) async { + this.patientType = patientType; + GifLoaderDialogUtils.showMyDialog(context); + if (patientType == PatientType.IN_PATIENT) { + await model.getMyReferralPatientService(localBusy: true); + } else { + await model.getMyReferralOutPatientService(localBusy: true); + } + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ), + model.myReferralPatients.isEmpty + ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).referralEmptyMsg, + color: Theme.of(context).errorColor, + ), + ) + ], ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).referralEmptyMsg, - color: Theme.of(context).errorColor, - ), - ) - ], - ), - ) - : SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(top: 70), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + ) + : SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(top: 70), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ - ...List.generate( - model.myReferralPatients.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferralPatientDetailScreen(model.myReferralPatients[index],model), + ...List.generate( + model.myReferralPatients.length, + (index) => InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferralPatientDetailScreen(model.myReferralPatients[index],model), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context), + referralStatusCode: model.myReferralPatients[index].referralStatus, + patientName: model.myReferralPatients[index].patientName, + patientGender: model.myReferralPatients[index].gender, + referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate), + referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), + patientID: "${model.myReferralPatients[index].patientID}", + isSameBranch: false, + isReferral: true, + isReferralClinic: true, + referralClinic:"${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index].referringDoctorRemarks, + nationality: model.myReferralPatients[index].nationalityName, + nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, + doctorAvatar: model.myReferralPatients[index].doctorImageURL, + referralDoctorName: model.myReferralPatients[index].referringDoctorName, + clinicDescription: model.myReferralPatients[index].referringClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus,context), - referralStatusCode: model.myReferralPatients[index].referralStatus, - patientName: model.myReferralPatients[index].patientName, - patientGender: model.myReferralPatients[index].gender, - referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate), - referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), - patientID: "${model.myReferralPatients[index].patientID}", - isSameBranch: false, - isReferral: true, - isReferralClinic: true, - referralClinic:"${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index].referringDoctorRemarks, - nationality: model.myReferralPatients[index].nationalityName, - nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, - doctorAvatar: model.myReferralPatients[index].doctorImageURL, - referralDoctorName: model.myReferralPatients[index].referringDoctorName, - clinicDescription: model.myReferralPatients[index].referringClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), + ), ), - ), + ], ), - ], + ), ), - ), - ), + ], + ), ), ); } diff --git a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart index a949036b..0e7b214b 100644 --- a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart @@ -237,6 +237,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ], ), + if(referredPatient.frequency != null) Row( mainAxisAlignment: MainAxisAlignment.start, @@ -256,7 +257,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { Expanded( child: AppText( referredPatient - .frequencyDescription, + .frequencyDescription??'', fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.8 * @@ -303,6 +304,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ) ], ), + if(referredPatient.priorityDescription != null) Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -317,7 +319,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - referredPatient.priorityDescription, + referredPatient.priorityDescription??'', fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: @@ -327,6 +329,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ], ), + if(referredPatient.mAXResponseTime != null) Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -342,9 +345,9 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - AppDateUtils.convertDateFromServerFormat( + referredPatient.mAXResponseTime != null? AppDateUtils.convertDateFromServerFormat( referredPatient.mAXResponseTime, - "dd MMM,yyyy"), + "dd MMM,yyyy"):'', fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: @@ -469,7 +472,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { color: Color(0XFF2E303A), ), AppText( - referredPatient.referringDoctorRemarks, + referredPatient.referringDoctorRemarks??'', fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, diff --git a/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart index b4e1ddc5..b3f11c51 100644 --- a/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart @@ -236,6 +236,8 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), ], ), + if(referredPatient + .frequencyDescription != null) Row( mainAxisAlignment: MainAxisAlignment.start, @@ -301,6 +303,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ) ], ), + if(referredPatient.priorityDescription != null) Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -322,6 +325,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), ], ), + if(referredPatient.mAXResponseTime != null) Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -337,9 +341,9 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - AppDateUtils.convertDateFromServerFormat( + referredPatient.mAXResponseTime != null?AppDateUtils.convertDateFromServerFormat( referredPatient.mAXResponseTime, - "dd MMM,yyyy"), + "dd MMM,yyyy"):'', fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: @@ -515,6 +519,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), AppText( referredPatient + .referredDoctorRemarks == null ?'':referredPatient .referredDoctorRemarks.isNotEmpty ? referredPatient.referredDoctorRemarks : TranslationBase.of(context).notRepliedYet, @@ -543,7 +548,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontSize: 1.8, hPadding: 8, vPadding: 12, - disabled: referredPatient.referredDoctorRemarks.isNotEmpty + disabled: referredPatient.referredDoctorRemarks == null? true: referredPatient.referredDoctorRemarks.isNotEmpty ? false : true, onPressed: () async { diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index a7d03076..2839c86f 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -371,4 +371,22 @@ class AppDateUtils { else return ""; } + + + // handel date like "09/05/2021 17:00" + static DateTime getDateTimeFromString(String str) { + List array = str.split('/'); + int day = int.parse(array[0]); + int month = int.parse(array[1]); + + List array2 = array[2].split(' '); + int year = int.parse(array2[0]); + String hour = array2[1]; + List hourList = hour.split(":"); + + DateTime date = DateTime(year, month, day, int.parse(hourList[0]), int.parse(hourList[1])); + + + return date; + } } From 3df6a55dadf9cd11f0ec96786ee0f5ee0d885257 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 8 Jun 2021 13:07:33 +0300 Subject: [PATCH 3/3] remove comment --- lib/models/patient/my_referral/my_referred_patient_model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index 5a755fe8..cb61975a 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -166,7 +166,7 @@ class MyReferredPatientModel { referringDoctor = json['ReferringDoctor']; referralClinic = json['ReferralClinic']; referringClinic = json['ReferringClinic']; - referralStatus = json["ReferralStatus"] is String?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0 : json['ReferralStatus'];// TODO Elham json['ReferralStatus']; + referralStatus = json["ReferralStatus"] is String?json['ReferralStatus']== "Accepted"?46:json['ReferralStatus']=="Pending"?1:0 : json['ReferralStatus']; referralDate = json['ReferralDate']; referringDoctorRemarks = json['ReferringDoctorRemarks']; referredDoctorRemarks = json['ReferredDoctorRemarks'];