merge-update-with-lab-changes
haroon amjad 3 years ago
parent 01ee9a2710
commit 078482c21d

@ -599,6 +599,9 @@ var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo';
// Get General Instructions API // Get General Instructions API
var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions'; var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions';
var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder';
class AppGlobal { class AppGlobal {
static var context; static var context;

@ -9,14 +9,15 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart';
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
var isAppArabic = false; var isAppArabic = false;
class ProjectViewModel extends BaseViewModel {
class ProjectViewModel extends BaseViewModel {
GAnalytics get analytics => locator<GAnalytics>(); GAnalytics get analytics => locator<GAnalytics>();
// Platform Bridge // Platform Bridge
@ -37,14 +38,19 @@ class ProjectViewModel extends BaseViewModel {
int laserSelectionDuration; int laserSelectionDuration;
bool isPatientAdmitted = false; bool isPatientAdmitted = false;
int inPatientProjectID = 0; int inPatientProjectID = 0;
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel;
double _latitude; double _latitude;
double _longitude; double _longitude;
RegisterInfoResponse _registerInfo =RegisterInfoResponse(); RegisterInfoResponse _registerInfo = RegisterInfoResponse();
double get latitude => _latitude; double get latitude => _latitude;
double get longitude => _longitude; double get longitude => _longitude;
RegisterInfoResponse get registerInfo=> _registerInfo;
RegisterInfoResponse get registerInfo => _registerInfo;
dynamic get searchValue => searchvalue; dynamic get searchValue => searchvalue;
Locale get appLocal => _appLocale; Locale get appLocal => _appLocale;
@ -57,8 +63,7 @@ class ProjectViewModel extends BaseViewModel {
List<PrivilegeModel> privilegeRootUser = List(); List<PrivilegeModel> privilegeRootUser = List();
List<PrivilegeModel> privilegeChildUser = List(); List<PrivilegeModel> privilegeChildUser = List();
List<PrivilegeModel> get privileges => List<PrivilegeModel> get privileges => isLoginChild ? privilegeChildUser : privilegeChildUser;
isLoginChild ? privilegeChildUser : privilegeChildUser;
List<LaserBodyPart> selectedBodyPartList = []; List<LaserBodyPart> selectedBodyPartList = [];
@ -66,9 +71,7 @@ class ProjectViewModel extends BaseViewModel {
ProjectViewModel() { ProjectViewModel() {
loadSharedPrefLanguage(); loadSharedPrefLanguage();
subscription = Connectivity() subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
.onConnectivityChanged
.listen((ConnectivityResult result) {
switch (result) { switch (result) {
case ConnectivityResult.wifi: case ConnectivityResult.wifi:
isInternetConnection = true; isInternetConnection = true;
@ -91,8 +94,7 @@ class ProjectViewModel extends BaseViewModel {
} }
Future loadSharedPrefLanguage() async { Future loadSharedPrefLanguage() async {
currentLanguage = currentLanguage = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
_appLocale = Locale(currentLanguage); _appLocale = Locale(currentLanguage);
isAppArabic = _isArabic = currentLanguage == 'ar'; isAppArabic = _isArabic = currentLanguage == 'ar';
notifyListeners(); notifyListeners();
@ -124,6 +126,11 @@ class ProjectViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
setInPatientAdmissionInfo(GetAdmissionInfoResponseModel _getAdmissionInfoResponseModel) {
this.getAdmissionInfoResponseModel = _getAdmissionInfoResponseModel;
notifyListeners();
}
setPrivilegeModelList({List<PrivilegeModel> privilege}) { setPrivilegeModelList({List<PrivilegeModel> privilege}) {
this.isLoginChild = isLoginChild; this.isLoginChild = isLoginChild;
privilegeRootUser = privilege; privilegeRootUser = privilege;
@ -178,8 +185,9 @@ class ProjectViewModel extends BaseViewModel {
searchvalue = data; searchvalue = data;
notifyListeners(); notifyListeners();
} }
setRegisterData(RegisterInfoResponse data){
_registerInfo =data; setRegisterData(RegisterInfoResponse data) {
_registerInfo = data;
notifyListeners(); notifyListeners();
} }
} }

@ -0,0 +1,60 @@
class GetAdmissionInfoResponseModel {
int admissionNo;
String admissionDate;
String infotainmentIBMSLink;
String infotainmentIBMSLinkAr;
int projectID;
String roomID;
String bedID;
int clinicID;
int doctorID;
int patientID;
String bMIUrl;
String mOPUrl;
GetAdmissionInfoResponseModel(
{this.admissionNo,
this.admissionDate,
this.infotainmentIBMSLink,
this.infotainmentIBMSLinkAr,
this.projectID,
this.roomID,
this.bedID,
this.clinicID,
this.doctorID,
this.patientID,
this.bMIUrl,
this.mOPUrl});
GetAdmissionInfoResponseModel.fromJson(Map<String, dynamic> json) {
admissionNo = json['AdmissionNo'];
admissionDate = json['AdmissionDate'];
infotainmentIBMSLink = json['InfotainmentIBMSLink'];
infotainmentIBMSLinkAr = json['InfotainmentIBMSLinkAr'];
projectID = json['ProjectID'];
roomID = json['RoomID'];
bedID = json['BedID'];
clinicID = json['ClinicID'];
doctorID = json['DoctorID'];
patientID = json['PatientID'];
bMIUrl = json['BMIUrl'];
mOPUrl = json['MOPUrl'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['AdmissionNo'] = this.admissionNo;
data['AdmissionDate'] = this.admissionDate;
data['InfotainmentIBMSLink'] = this.infotainmentIBMSLink;
data['InfotainmentIBMSLinkAr'] = this.infotainmentIBMSLinkAr;
data['ProjectID'] = this.projectID;
data['RoomID'] = this.roomID;
data['BedID'] = this.bedID;
data['ClinicID'] = this.clinicID;
data['DoctorID'] = this.doctorID;
data['PatientID'] = this.patientID;
data['BMIUrl'] = this.bMIUrl;
data['MOPUrl'] = this.mOPUrl;
return data;
}
}

@ -1,7 +1,13 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class HelpPRO extends StatefulWidget { class HelpPRO extends StatefulWidget {
const HelpPRO({Key key}) : super(key: key); const HelpPRO({Key key}) : super(key: key);
@ -11,11 +17,12 @@ class HelpPRO extends StatefulWidget {
} }
class _HelpPROState extends State<HelpPRO> { class _HelpPROState extends State<HelpPRO> {
TextEditingController assistText = new TextEditingController(); TextEditingController assistText = new TextEditingController();
ProjectViewModel projectViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
@ -43,6 +50,17 @@ class _HelpPROState extends State<HelpPRO> {
), ),
mHeight(16), mHeight(16),
inputWidget(TranslationBase.of(context).enterDetails, "", assistText), inputWidget(TranslationBase.of(context).enterDetails, "", assistText),
mHeight(16),
DefaultButton(
TranslationBase.of(context).send,
() {
if (assistText.text.isNotEmpty) {
callReceivePrescriptionAPI(context);
} else {
Utils.showErrorToast(TranslationBase.of(context).emptyMessage);
}
},
),
], ],
), ),
), ),
@ -107,15 +125,15 @@ class _HelpPROState extends State<HelpPRO> {
prefixIcon: prefix == null prefixIcon: prefix == null
? null ? null
: Text( : Text(
"+" + prefix, "+" + prefix,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
height: 21 / 14, height: 21 / 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xff2E303A), color: Color(0xff2E303A),
letterSpacing: -0.56, letterSpacing: -0.56,
), ),
), ),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@ -132,4 +150,15 @@ class _HelpPROState extends State<HelpPRO> {
); );
} }
void callReceivePrescriptionAPI(BuildContext context) {
ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context);
service
.insertInPatientOrder(projectViewModel.getAdmissionInfoResponseModel, 1, (projectViewModel.user.firstName + " " + projectViewModel.user.lastName),
(projectViewModel.user.firstNameN + " " + projectViewModel.user.lastNameN), projectViewModel.user.mobileNumber, assistText.text, context)
.then((res) {})
.catchError((err) {
print(err);
});
}
} }

@ -216,6 +216,20 @@ class InPatientServicesHome extends StatelessWidget {
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} }
void callReceivePrescriptionAPI(BuildContext context) {
ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context);
service
.insertInPatientOrder(projectViewModel.getAdmissionInfoResponseModel, 2, (projectViewModel.user.firstName + " " + projectViewModel.user.lastName),
(projectViewModel.user.firstNameN + " " + projectViewModel.user.lastNameN), projectViewModel.user.mobileNumber, "I need my medicines", context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
void openGeneralInstructions(BuildContext context) { void openGeneralInstructions(BuildContext context) {
ClinicListService service = new ClinicListService(); ClinicListService service = new ClinicListService();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_activation_code
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/login/register_new.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
@ -671,13 +672,16 @@ class _ConfirmLogin extends State<ConfirmLogin> {
} }
checkIfIsInPatient() { checkIfIsInPatient() {
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel;
ClinicListService service = new ClinicListService(); ClinicListService service = new ClinicListService();
service.checkIfInPatientAPI(context).then((res) { service.checkIfInPatientAPI(context).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
if (res['List_PatientAdmissionInfo'].length != 0) { if (res['List_PatientAdmissionInfo'].length != 0) {
print("INPATIENT!!!"); print("INPATIENT!!!");
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['List_PatientAdmissionInfo'][0]);
projectViewModel.setIsPatientAdmitted(true); projectViewModel.setIsPatientAdmitted(true);
projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']); projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
} else { } else {
print("OUTPATIENT!!!"); print("OUTPATIENT!!!");
projectViewModel.setIsPatientAdmitted(false); projectViewModel.setIsPatientAdmitted(false);

@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart';
@ -393,13 +394,16 @@ class _Login extends State<Login> {
} }
checkIfIsInPatient() { checkIfIsInPatient() {
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel;
ClinicListService service = new ClinicListService(); ClinicListService service = new ClinicListService();
service.checkIfInPatientAPI(context).then((res) { service.checkIfInPatientAPI(context).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
if (res['List_PatientAdmissionInfo'].length != 0) { if (res['List_PatientAdmissionInfo'].length != 0) {
print("INPATIENT!!!"); print("INPATIENT!!!");
getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['List_PatientAdmissionInfo'][0]);
projectViewModel.setIsPatientAdmitted(true); projectViewModel.setIsPatientAdmitted(true);
projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']); projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']);
projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel);
} else { } else {
print("OUTPATIENT!!!"); print("OUTPATIENT!!!");
projectViewModel.setIsPatientAdmitted(false); projectViewModel.setIsPatientAdmitted(false);

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart';
import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -79,9 +80,7 @@ class ClinicListService extends BaseService {
Future<Map> getGeneralInstructions(int projectID, context) async { Future<Map> getGeneralInstructions(int projectID, context) async {
Map<String, dynamic> request; Map<String, dynamic> request;
request = { request = {"ProjectID": projectID};
"ProjectID": projectID
};
dynamic localRes; dynamic localRes;
@ -199,14 +198,41 @@ class ClinicListService extends BaseService {
}, body: request); }, body: request);
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> getCountries() async { Future<Map> getCountries() async {
Map<String, dynamic> request ={}; Map<String, dynamic> request = {};
dynamic localRes; dynamic localRes;
await baseAppClient.post(GET_NATIONALITY, onSuccess: (response, statusCode) async { await baseAppClient.post(GET_NATIONALITY, onSuccess: (response, statusCode) async {
localRes = response; localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: request); }, body: request);
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> insertInPatientOrder(
GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, int typeID, String patientName, String patientNameAR, String patientMobileNo, String comments, context) async {
Map<String, dynamic> request;
request = {
"ProjectID": getAdmissionInfoResponseModel.projectID,
"TypeID": typeID,
"RoomNo": getAdmissionInfoResponseModel.roomID,
"GenderId": 2,
"AdmissionNo": getAdmissionInfoResponseModel.admissionNo,
"prescriptionNo": 250420,
"patientName": patientName,
"patientNameN": patientNameAR,
"PatientMobileNumber": patientMobileNo,
"comments": comments
};
dynamic localRes;
await baseAppClient.post(INSERT_INPATIENT_ORDER, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request, isAllowAny: true);
return Future.value(localRes);
}
} }

Loading…
Cancel
Save