InPatient check added in Family file switch

merge-update-with-lab-changes
haroon amjad 11 months ago
parent 04413aa7d6
commit a24582a578

@ -14,6 +14,8 @@ import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list;
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_request_info_response_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
import 'package:diplomaticquarterapp/routes.dart';
@ -467,6 +469,42 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
});
}
checkIfIsInPatient(BuildContext context) {
bool isAdmitted = false;
bool hasAdmissionRequest = false;
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel;
GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel;
ClinicListService service = new ClinicListService();
service.checkIfInPatientAPI(context).then((res) {
if (res['MessageStatus'] == 1) {
isAdmitted = res['isAdmitted'];
hasAdmissionRequest = res['hasAdmissionRequests'];
print("IS ADMITTED: $isAdmitted");
print("Has Admission Request: $hasAdmissionRequest");
if (isAdmitted) {
if (res['PatientAdmittedInformation'].length != 0) {
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]);
projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
projectViewModel.setIsPatientAdmitted(true);
}
}
if (hasAdmissionRequest) {
if (res['MedicalInstruction'].length != 0) {
getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]);
// projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']);
projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['projectId']);
projectViewModel.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel);
projectViewModel.setPatientHasAdmissionRequest(true);
}
}
} else {}
}).catchError((err) {
projectViewModel.setIsPatientAdmitted(false);
projectViewModel.setPatientHasAdmissionRequest(false);
});
}
loginAfter(result, context) async {
var currentLang = await sharedPref.getString(APP_LANGUAGE);
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true);
@ -501,6 +539,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
try {
// await appointmentRateViewModel.getIsLastAppointmentRatedList();
checkIfIsInPatient(context);
await getToDoCount();
if (appointmentRateViewModel.isHaveAppointmentNotRate) {
Navigator.pushAndRemoveUntil(

@ -709,37 +709,37 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
checkIfUserAgreedBefore(CheckActivationCode result) {
this.authService.checkIfUserAgreed().then((result) {
if (result['IsPatientAlreadyAgreed']) {
goToHome();
} else {
this.authService.getUserAgreementContent().then((result) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
Navigator.pushAndRemoveUntil(
context,
FadePage(
page: UserLoginAgreementPage(
userAgreementText: result['UserAgreementContent'],
authenticatedUserObject: authenticatedUserObject,
appointmentRateViewModel: appointmentRateViewModel,
selectedOption: selectedOption,
),
),
(r) => false);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
// this.authService.checkIfUserAgreed().then((result) {
// if (result['IsPatientAlreadyAgreed']) {
// goToHome();
// } else {
// this.authService.getUserAgreementContent().then((result) {
// GifLoaderDialogUtils.hideDialog(AppGlobal.context);
// Navigator.pushAndRemoveUntil(
// context,
// FadePage(
// page: UserLoginAgreementPage(
// userAgreementText: result['UserAgreementContent'],
// authenticatedUserObject: authenticatedUserObject,
// appointmentRateViewModel: appointmentRateViewModel,
// selectedOption: selectedOption,
// ),
// ),
// (r) => false);
// }).catchError((err) {
// GifLoaderDialogUtils.hideDialog(context);
// print(err);
// });
// }
// }).catchError((err) {
// GifLoaderDialogUtils.hideDialog(context);
// print(err);
// });
// if (result.isNeedUserAgreement == true) {
// // move to agreement page.
// } else {
// goToHome();
goToHome();
// }
}

@ -15,6 +15,8 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_request_info_response_model.dart';
import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
@ -700,6 +702,42 @@ class _AppDrawerState extends State<AppDrawer> {
});
}
checkIfIsInPatient(BuildContext context) {
bool isAdmitted = false;
bool hasAdmissionRequest = false;
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel;
GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel;
ClinicListService service = new ClinicListService();
service.checkIfInPatientAPI(context).then((res) {
if (res['MessageStatus'] == 1) {
isAdmitted = res['isAdmitted'];
hasAdmissionRequest = res['hasAdmissionRequests'];
print("IS ADMITTED: $isAdmitted");
print("Has Admission Request: $hasAdmissionRequest");
if (isAdmitted) {
if (res['PatientAdmittedInformation'].length != 0) {
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]);
projectProvider?.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']);
projectProvider?.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
projectProvider?.setIsPatientAdmitted(true);
}
}
if (hasAdmissionRequest) {
if (res['MedicalInstruction'].length != 0) {
getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]);
// projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']);
projectProvider?.setInPatientProjectID(res['MedicalInstruction'][0]['projectId']);
projectProvider?.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel);
projectProvider?.setPatientHasAdmissionRequest(true);
}
}
} else {}
}).catchError((err) {
projectProvider?.setIsPatientAdmitted(false);
projectProvider?.setPatientHasAdmissionRequest(false);
});
}
loginAfter(result, context, isMainUser) async {
Utils.hideProgressDialog();
String APNSToken = "";
@ -741,6 +779,8 @@ class _AppDrawerState extends State<AppDrawer> {
await this.sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL);
checkIfIsInPatient(context);
appointmentRateViewModel
.getIsLastAppointmentRatedList(languageID)
.then((value) => {

Loading…
Cancel
Save