fix in patient_service

merge-requests/997/head
Elham Rababh 4 years ago
parent 10798f73de
commit d717d9e0cf

@ -14,6 +14,8 @@ class PatientSearchRequestModel {
String identificationNo;
int nursingStationID;
int clinicID = 0;
int loginDoctorID;
PatientSearchRequestModel(
{this.doctorID,
@ -30,7 +32,7 @@ class PatientSearchRequestModel {
this.to = "0",
this.clinicID,
this.nursingStationID = 0,
this.projectID});
this.projectID, this.loginDoctorID});
PatientSearchRequestModel.fromJson(Map<String, dynamic> json) {
doctorID = json['DoctorID'];
@ -48,6 +50,7 @@ class PatientSearchRequestModel {
nursingStationID = json['NursingStationID'];
clinicID = json['ClinicID'];
projectID = json['ProjectID'];
loginDoctorID = json['LoginDoctorID'];
}
Map<String, dynamic> toJson() {
@ -67,6 +70,7 @@ class PatientSearchRequestModel {
data['NursingStationID'] = this.nursingStationID;
data['ClinicID'] = this.clinicID;
data['ProjectID'] = this.projectID;
data['LoginDoctorID'] = this.loginDoctorID;
return data;
}
}

@ -11,8 +11,8 @@ class ScanQrService extends BaseService {
PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
requestModel.loginDoctorID = doctorProfile.doctorID;
requestModel.doctorID = 0;
await baseAppClient.post(
GET_PATIENT_IN_PATIENT_LIST,
onSuccess: (dynamic response, int statusCode) {

@ -11,7 +11,7 @@ class PatientInPatientService extends BaseService {
PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile(isGetProfile: true);
requestModel.loginDoctorID = doctorProfile.doctorID;
if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID;
} else {

@ -168,8 +168,9 @@ class PatientService extends BaseService {
Future getInPatient(
PatientSearchRequestModel requestModel, bool isMyInpatient) async {
hasError = false;
await getDoctorProfile();
await getDoctorProfile();
requestModel.loginDoctorID = doctorProfile.doctorID;
if (isMyInpatient) {
requestModel.doctorID = doctorProfile.doctorID;
} else {

@ -70,6 +70,7 @@ class PatientSearchViewModel extends BaseViewModel {
setState(ViewState.Busy);
}
await getDoctorProfile(isGetProfile: true);
patientSearchRequestModel.loginDoctorID = doctorProfile.doctorID;
patientSearchRequestModel.doctorID = doctorProfile.doctorID;
await _outPatientService.getOutPatient(patientSearchRequestModel);
if (_outPatientService.hasError) {

@ -112,7 +112,8 @@ class AuthenticationViewModel extends BaseViewModel {
insertIMEIDetailsModel.vidaRefreshTokenID =
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
insertIMEIDetailsModel.password = userInfo.password;
insertIMEIDetailsModel.loginDoctorID = loggedUser.listMemberInformation[0].employeeID;
insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser.listMemberInformation[0].employeeID
: int.parse(user.editedBy);
await _authService.insertDeviceImei(insertIMEIDetailsModel);
if (_authService.hasError) {
@ -148,14 +149,15 @@ class AuthenticationViewModel extends BaseViewModel {
iMEI: user.iMEI,
facilityId: user.projectID,
memberID: user.doctorID,
//TODO Elham* return it dynamic
loginDoctorID: 4709,//int.parse(user.editedBy.toString()),
loginDoctorID: int.parse(user.editedBy.toString()),
zipCode: user.outSA == true ? '971' : '966',
mobileNumber: user.mobile,
oTPSendType: authMethodType.getTypeIdService(),
isMobileFingerPrint: 1,
vidaAuthTokenID: user.vidaAuthTokenID,
vidaRefreshTokenID: user.vidaRefreshTokenID);
await sharedPref.setString(DOCTOR_ID, user.editedBy.toString());
await _authService
.sendActivationCodeVerificationScreen(activationCodeModel);
if (_authService.hasError) {
@ -213,7 +215,7 @@ class AuthenticationViewModel extends BaseViewModel {
oTPSendType: await sharedPref.getInt(OTP_TYPE),
iMEI: localToken,
loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation[0].employeeID
: int.parse(user.editedBy),///loggedUser.listMemberInformation[0].employeeID,
: int.parse(user.editedBy.toString()),///loggedUser.listMemberInformation[0].employeeID,
// loggedUser.listMemberInformation[0].employeeID,
isForSilentLogin: isSilentLogin,
generalid: "Cs2020@2016\$2958");

@ -59,8 +59,7 @@ class DashboardViewModel extends BaseViewModel {
_firebaseMessaging.getToken().then((String token) async {
if (token != '') {
// DEVICE_TOKEN = token;
///TODO Elham* return back
// authProvider.insertDeviceImei(token);
authProvider.insertDeviceImei(token);
}
});
}

@ -1,6 +1,8 @@
import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
@ -86,7 +88,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
_scanQrAndGetPatient(BuildContext context, ScanQrViewModel model) async {
var result = (await BarcodeScanner.scan()).rawContent;
if (result != "") {
List<String> listOfParams = result.split(',');
DoctorProfileModel doctorProfile =await getDoctorProfile(isGetProfile: true);
List<String> listOfParams = result.split(',');
int patientID = 0;
if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]);
PatientSearchRequestModel patientSearchRequestModel =
@ -96,6 +99,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
doctorID: 0,
projectID: int.parse(listOfParams[0]));
patientSearchRequestModel.loginDoctorID = doctorProfile.doctorID;
await model
.getInPatientList(patientSearchRequestModel, isMyInpatient: false)
.then((d) {
@ -115,4 +120,31 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
});
}
}
Future<DoctorProfileModel> getDoctorProfile(
{bool isGetProfile = false}) async {
DoctorProfileModel doctorProfile;
if (isGetProfile) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (doctorProfile != null) {
return doctorProfile;
}
}
}
if (doctorProfile == null) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (doctorProfile != null) {
return doctorProfile;
}
}
return null;
} else {
return doctorProfile;
}
}
}

Loading…
Cancel
Save