From ced1c9b3927513bddf9950f5f5d36d028f745c6e Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 21 Nov 2021 16:16:41 +0200 Subject: [PATCH] first step from fix service --- lib/core/service/NavigationService.dart | 4 ++-- lib/core/service/PatientRegistrationService.dart | 12 ++++++------ lib/core/service/base/base_service.dart | 1 + .../service/patient/LiveCarePatientServices.dart | 12 ++++++------ .../profile/discharge_summary_servive.dart | 2 +- .../profile/operation_report_servive.dart | 6 +++--- .../lab_order/labs_service.dart | 4 ++-- .../PatientMedicalReportService.dart | 2 +- .../prescription/prescriptions_service.dart | 4 ++-- .../procedure/procedure_service.dart | 2 +- .../patient_medical_file/soap/SOAP_service.dart | 6 +++--- .../ucaf/patient-ucaf-service.dart | 16 ++++++++-------- lib/core/service/pending_order_service.dart | 12 ++++++------ 13 files changed, 42 insertions(+), 41 deletions(-) diff --git a/lib/core/service/NavigationService.dart b/lib/core/service/NavigationService.dart index f32c2c0d..182adb6c 100644 --- a/lib/core/service/NavigationService.dart +++ b/lib/core/service/NavigationService.dart @@ -17,10 +17,10 @@ class NavigationService { } Future pushAndRemoveUntil(Route newRoute) { - return navigatorKey.currentState.pushAndRemoveUntil(newRoute,(asd)=>false); + return navigatorKey.currentState!.pushAndRemoveUntil(newRoute,(asd)=>false); } pop() { - return navigatorKey.currentState.pop(); + return navigatorKey.currentState!.pop(); } } \ No newline at end of file diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart index 236bcd42..14e2c3df 100644 --- a/lib/core/service/PatientRegistrationService.dart +++ b/lib/core/service/PatientRegistrationService.dart @@ -9,8 +9,8 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; class PatientRegistrationService extends BaseService { - GetPatientInfoResponseModel getPatientInfoResponseModel; - String logInTokenID; + late GetPatientInfoResponseModel getPatientInfoResponseModel; + late String logInTokenID; checkPatientForRegistration( CheckPatientForRegistrationModel registrationModel) async { @@ -39,11 +39,11 @@ class PatientRegistrationService extends BaseService { } sendActivationCodeByOTPNotificationType( - {SendActivationCodeByOTPNotificationTypeForRegistrationModel + {required SendActivationCodeByOTPNotificationTypeForRegistrationModel registrationModel, - int otpType, - PatientRegistrationViewModel model, - CheckPatientForRegistrationModel + required int otpType, + required PatientRegistrationViewModel model, + required CheckPatientForRegistrationModel checkPatientForRegistrationModel}) async { registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel( diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index a8a87c8f..05d1d1ab 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index b0bf13e1..b390556d 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -47,7 +47,7 @@ class LiveCarePatientServices extends BaseService { /// add new items. localPatientList.forEach((element) { - if ((_patientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { + if ((_patientList.singleWhere((it) => it.patientId == element.patientId)) == null) { _patientList.add(element); } }); @@ -55,7 +55,7 @@ class LiveCarePatientServices extends BaseService { /// remove items. List removedPatientList = []; _patientList.forEach((element) { - if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { + if ((localPatientList.singleWhere((it) => it.patientId == element.patientId)) == null) { removedPatientList.add(element); } }); @@ -155,12 +155,12 @@ class LiveCarePatientServices extends BaseService { }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); } - Future addPatientToDoctorList({int vcID}) async { + Future addPatientToDoctorList({required int vcID}) async { hasError = false; await getDoctorProfile(); AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); - addPatientToDoctorListRequestModel.doctorId = super.doctorProfile.doctorID; + addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID!; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; @@ -173,11 +173,11 @@ class LiveCarePatientServices extends BaseService { }, body: addPatientToDoctorListRequestModel.toJson(), isLiveCare: _isLive); } - Future removePatientFromDoctorList({int vcID}) async { + Future removePatientFromDoctorList({required int vcID}) async { hasError = false; AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); await getDoctorProfile(); - addPatientToDoctorListRequestModel.doctorId = super.doctorProfile.doctorID; + addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID!; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; diff --git a/lib/core/service/patient/profile/discharge_summary_servive.dart b/lib/core/service/patient/profile/discharge_summary_servive.dart index daea1b42..52c15e79 100644 --- a/lib/core/service/patient/profile/discharge_summary_servive.dart +++ b/lib/core/service/patient/profile/discharge_summary_servive.dart @@ -13,7 +13,7 @@ class DischargeSummaryService extends BaseService { List get pendingDischargeSummaryList => _pendingDischargeSummaryList; Future getPendingDischargeSummary( - {GetDischargeSummaryReqModel getDischargeSummaryReqModel}) async { + {required GetDischargeSummaryReqModel getDischargeSummaryReqModel}) async { hasError = false; await baseAppClient.post(GET_PENDING_DISCHARGE_SUMMARY, diff --git a/lib/core/service/patient/profile/operation_report_servive.dart b/lib/core/service/patient/profile/operation_report_servive.dart index 7ac4ade7..b3a43717 100644 --- a/lib/core/service/patient/profile/operation_report_servive.dart +++ b/lib/core/service/patient/profile/operation_report_servive.dart @@ -14,8 +14,8 @@ class OperationReportService extends BaseService { List get operationDetailsList => _operationDetailsList; Future getReservations( - {GetReservationsRequestModel getReservationsRequestModel, - int patientId}) async { + {required GetReservationsRequestModel getReservationsRequestModel, + required int patientId}) async { getReservationsRequestModel = GetReservationsRequestModel(patientID: patientId, doctorID: ""); @@ -36,7 +36,7 @@ class OperationReportService extends BaseService { } Future getOperationReportDetails( - {GetOperationDetailsRequestModel getOperationReportRequestModel, + {required GetOperationDetailsRequestModel getOperationReportRequestModel, }) async { hasError = false; diff --git a/lib/core/service/patient_medical_file/lab_order/labs_service.dart b/lib/core/service/patient_medical_file/lab_order/labs_service.dart index 1fe088c0..84861d5b 100644 --- a/lib/core/service/patient_medical_file/lab_order/labs_service.dart +++ b/lib/core/service/patient_medical_file/lab_order/labs_service.dart @@ -179,7 +179,7 @@ class LabsService extends BaseService { } Future getPatientLabOrdersResultHistoryByDescription( - {PatientLabOrders patientLabOrder, String procedureDescription, PatiantInformtion patient}) async { + {required PatientLabOrders patientLabOrder, required String procedureDescription, required PatiantInformtion patient}) async { hasError = false; Map body = Map(); if (patientLabOrder != null) { @@ -201,7 +201,7 @@ class LabsService extends BaseService { }, body: body); } - Future getAllSpecialLabResult({int mrn}) async { + Future getAllSpecialLabResult({required int mrn}) async { _allSpecialLabResultRequestModel = AllSpecialLabResultRequestModel( patientID: mrn, patientType: 1, 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 98536476..1af15e10 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -94,7 +94,7 @@ class PatientMedicalReportService extends BaseService { ? body['SetupID'] : SETUP_ID : SETUP_ID; - body['AdmissionNo'] = int.parse(patient.admissionNo); + body['AdmissionNo'] = int.parse(patient!.admissionNo!); body['MedicalReportHTML'] = htmlText; if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; diff --git a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart index 55ab7a89..bf3100c5 100644 --- a/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescriptions_service.dart @@ -192,9 +192,9 @@ class PrescriptionsService extends BaseService { hasError = false; _getMedicationForInPatientRequestModel = GetMedicationForInPatientRequestModel( isDentalAllowedBackend: false, - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient!.admissionNo!), tokenID: "@dm!n", - projectID: patient.projectId, + projectID: patient!.projectId!, ); await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 576c593d..5708b6b3 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -104,7 +104,7 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteDetailsRequestModel.toJson()); } - Future getProcedure({int? mrn, int appointmentNo}) async { + Future getProcedure({int? mrn, required int appointmentNo}) async { _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel( patientMRN: mrn, ); diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index d206de77..dbdb3855 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -83,7 +83,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = super.error+ "\n"+error; + super.error = super.error!+ "\n"+error; }, body: postAllergyRequestModel.toJson()); } @@ -93,7 +93,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error =super.error + "\n"+error; + super.error =super.error! + "\n"+error; }, body: postHistoriesRequestModel.toJson()); } @@ -155,7 +155,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = super.error +"\n"+error; + super.error = super.error! +"\n"+error; }, body: patchHistoriesRequestModel.toJson()); } diff --git a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart index 535a5b49..2028ed6b 100644 --- a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart +++ b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart @@ -8,8 +8,8 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-history.dart'; class UcafService extends LookupService { - List patientChiefComplaintList; - List patientVitalSignsHistory; + late List patientChiefComplaintList; + late List patientVitalSignsHistory; List patientAssessmentList = []; List orderProcedureList = []; PrescriptionModel? prescriptionList; @@ -22,13 +22,13 @@ class UcafService extends LookupService { body['EpisodeID'] = patient.episodeNo; body['DoctorID'] = ""; - patientChiefComplaintList = null; + patientChiefComplaintList = []; await baseAppClient.post(GET_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); if (patientChiefComplaintList != null) { patientChiefComplaintList.clear(); } else { - patientChiefComplaintList = new List(); + patientChiefComplaintList = []; } response['List_ChiefComplaint']['entityList'].forEach((v) { patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); @@ -50,14 +50,14 @@ class UcafService extends LookupService { body['InOutPatientType'] = 2; } - patientVitalSignsHistory = null; + patientVitalSignsHistory = []; await baseAppClient.post( GET_PATIENT_VITAL_SIGN, onSuccess: (dynamic response, int statusCode) { if (patientVitalSignsHistory != null) { patientVitalSignsHistory.clear(); } else { - patientVitalSignsHistory = new List(); + patientVitalSignsHistory = []; } if (response['List_DoctorPatientVitalSign'] != null) { response['List_DoctorPatientVitalSign'].forEach((v) { @@ -86,14 +86,14 @@ class UcafService extends LookupService { body['From'] = fromDate; body['To'] = toDate; - patientVitalSignsHistory = null; + patientVitalSignsHistory = []; await baseAppClient.post( GET_PATIENT_VITAL_SIGN_DATA, onSuccess: (dynamic response, int statusCode) { if (patientVitalSignsHistory != null) { patientVitalSignsHistory.clear(); } else { - patientVitalSignsHistory = new List(); + patientVitalSignsHistory = []; } if (response['VitalSignsHistory'] != null) { response['VitalSignsHistory'].forEach((v) { diff --git a/lib/core/service/pending_order_service.dart b/lib/core/service/pending_order_service.dart index f0bcf5e9..09ca517e 100644 --- a/lib/core/service/pending_order_service.dart +++ b/lib/core/service/pending_order_service.dart @@ -13,9 +13,9 @@ class PendingOrderService extends BaseService { List get admissionOrderList => _admissionOrderList; Future getPendingOrders( - {PendingOrderRequestModel pendingOrderRequestModel, - int patientId, - int admissionNo}) async { + {required PendingOrderRequestModel pendingOrderRequestModel, + required int patientId, + required int admissionNo}) async { pendingOrderRequestModel = PendingOrderRequestModel( patientID: patientId, admissionNo: admissionNo, @@ -40,9 +40,9 @@ class PendingOrderService extends BaseService { } Future getAdmissionOrders( - {AdmissionOrdersRequestModel admissionOrdersRequestModel, - int patientId, - int admissionNo}) async { + {required AdmissionOrdersRequestModel admissionOrdersRequestModel, + required int patientId, + required int admissionNo}) async { admissionOrdersRequestModel = AdmissionOrdersRequestModel( patientID: patientId, admissionNo: admissionNo,