From 5f8d44ae40a9ffaa46bb9cb83a595b9b5f051638 Mon Sep 17 00:00:00 2001 From: "taha.alam@cloudsolutions.com.sa" Date: Mon, 15 Dec 2025 09:31:59 +0300 Subject: [PATCH] bug fixes of age multiple entries of OR and progress report. --- lib/core/service/patient/patient_service.dart | 5 ++++- .../medical_report/PatientMedicalReportService.dart | 6 +++--- lib/core/service/pending_order_service.dart | 2 +- lib/core/viewModel/patient_view_model.dart | 10 ++++++++++ .../patients/profile/notes/note/update_note.dart | 3 +++ .../profile/operation_report/operation_report.dart | 2 +- lib/utils/date-utils.dart | 2 +- lib/utils/utils.dart | 3 ++- 8 files changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index 26a6e40d..b14c9669 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -631,7 +631,10 @@ class PatientService extends BaseService { response['ListPatientConditionProgress']['resultData'].forEach((v) => v['PATIENT_CONDITION'].forEach((item) { - stpMasterList.add(item); + stpMasterList.add({ + "ParameterCode": int.tryParse(item['code']), + "Description": item['name'], + }); })); success = false; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart index 86fadbad..9899bfea 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -12,7 +12,7 @@ class PatientMedicalReportService extends BaseService { Future getMedicalReportList(PatiantInformtion patient, bool isVidaPlusProject) async { hasError = false; Map body = Map(); - await getDoctorProfile(); + await getDoctorProfile(isGetProfile: true); body['AdmissionNo'] = isVidaPlusProject ?patient.admissionID : patient.admissionNo; body['SetupID'] = doctorProfile!.setupID; body['ProjectID'] = doctorProfile!.projectID; @@ -92,9 +92,9 @@ class PatientMedicalReportService extends BaseService { body['AdmissionNo'] = isVidaPlusProject == true? patient.admissionID ?? -1 :int.parse(patient.admissionNo!); print('the admission no is ${body['AdmissionNo']}'); body['MedicalReportHTML'] = htmlText; - body['ProjectID'] = patient.projectId; + body['ProjectID'] = doctorProfile?.projectID; body['PatientID'] = patient.patientId; - body['DoctorID'] = patient.doctorId; + body['DoctorID'] = doctorProfile?.doctorID; if(isVidaPlusProject == true) { body['PatientType'] = patient.patientType; } diff --git a/lib/core/service/pending_order_service.dart b/lib/core/service/pending_order_service.dart index cb950223..6b0ed878 100644 --- a/lib/core/service/pending_order_service.dart +++ b/lib/core/service/pending_order_service.dart @@ -72,7 +72,7 @@ class PendingOrderService extends BaseService { hasError = false; await baseAppClient.post(GET_ADMISSION_ORDERS, onSuccess: (dynamic response, int statusCode) { print("Success"); - //admissionOrderList.clear(); + admissionOrderList.clear(); response['List_AdmissionOrders'].forEach( (v) { _admissionOrderList.add(AdmissionOrdersModel.fromJson(v)); diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 4ff5854b..a24412bf 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -416,4 +416,14 @@ class PatientViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + void getProgressNoteCondition() async { + setState(ViewState.BusyLocal); + await _patientService.getPatientCondition(); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/patients/profile/notes/note/update_note.dart b/lib/screens/patients/profile/notes/note/update_note.dart index 07305a78..07ede8e4 100644 --- a/lib/screens/patients/profile/notes/note/update_note.dart +++ b/lib/screens/patients/profile/notes/note/update_note.dart @@ -92,6 +92,9 @@ class _UpdateNoteOrderState extends State { return BaseView( onModelReady: (model) { + if(widget.isVidaPlusProject){ + model.getProgressNoteCondition(); + }else model.getStpMasterList(isLocalBusy: false); }, builder: (_, model, w) => AppScaffold( diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index f6dd8dbc..340c5e74 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -180,7 +180,7 @@ class _ProgressNoteState extends State { if (model.reservationList[index].remarks != null) Row(mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).remarks, + "${TranslationBase.of(context).remarks} :", fontSize: 10, ), Expanded( diff --git a/lib/utils/date-utils.dart b/lib/utils/date-utils.dart index a6f3b9e4..4f02b146 100644 --- a/lib/utils/date-utils.dart +++ b/lib/utils/date-utils.dart @@ -360,7 +360,7 @@ class AppDateUtils { if (days < 0) { - final int lastDayOfPreviousMonth = DateTime(now.year, now.month, 0).day; + final int lastDayOfPreviousMonth = DateTime(birthDate.year, birthDate.month+1, 0).day; days += lastDayOfPreviousMonth; months--; } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 096722c9..e5bf32a8 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -142,7 +142,8 @@ class Utils { static Future checkConnection() async { List result = await (Connectivity().checkConnectivity()); - return result.contains(ConnectivityResult.wifi)||result.contains(ConnectivityResult.mobile); + return true; + // return result.contains(ConnectivityResult.wifi)||result.contains(ConnectivityResult.mobile); } static List getWorkingHours(String workingHours) {