diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index f2985d97..49e693f3 100755 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -43,7 +43,14 @@ class BaseAppClient { bool callLog = true; try { Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); - if (body?['MemberID'] == null) body?['MemberID'] = HospitalsService.memberId; // changed from null; because create update episode not working + + if (profile != null) { + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + if (body?['MemberID'] == null) + body?['MemberID'] = HospitalsService.memberId.isNotEmpty ? HospitalsService.memberId : doctorProfile.doctorID; // changed from null; because create update episode not working + } + + // if (body?['MemberID'] == null) body?['MemberID'] = HospitalsService.memberId; // changed from null; because create update episode not working String? token = await sharedPref.getString(TOKEN); if(!isCustomRequest) { diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 2ac5973d..0656f73f 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -65,6 +65,7 @@ class PatientSearchViewModel extends BaseViewModel { await getDoctorProfile(isGetProfile: true); patientSearchRequestModel.loginDoctorID = doctorProfile!.doctorID; patientSearchRequestModel.doctorID = doctorProfile!.doctorID; + patientSearchRequestModel.clinicID = doctorProfile!.clinicID; // Added clinic filter to avoid fetching all based on DoctorIDh await _outPatientService.getOutPatient(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error;