Patient occupation selection implemented

merge-update-with-lab-changes
haroon amjad 1 year ago
parent 545cfcd6d9
commit baa7790b89

@ -692,6 +692,8 @@ var CHECK_PATIENT_ER_ADVANCE_BALANCE = 'Services/OUTPs.svc/Rest/getPatientAdvanc
var GET_PROJECT_FROM_NFC = 'Services/OUTPs.svc/Rest/GetProjectByNFC';
var GET_PATIENT_OCCUPATION_LIST = 'Services/Authentication.svc/REST/GetPatientOccupation';
//PAYFORT
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";

@ -2119,4 +2119,6 @@ const Map localizedValues = {
},
"incorrectNationalId": {"en": "Incorrect National ID", "ar": "رقم الهوية غير صحيحة"},
"labResultFlag": {"en": "Flag", "ar": "Flag"},
"selectOccupation": {"en": "Select Occupation", "ar": "اختر المهنة"},
"selectOccupationError": {"en": "Please select your occupation.", "ar": "الرجاء تحديد مهنتك."},
};

@ -44,3 +44,4 @@ const COVID_QA_LIST = 'COVID_QA_LIST';
const IS_COVID_CONSENT_SHOWN = 'IS_COVID_CONSENT_SHOWN';
const REGISTER_INFO_DUBAI ='register-info-dubai';
const IS_LAST_APPOINTMENT_RATE_SHOWN ='is-last-appointment-rate-shown';
const PATIENT_OCCUPATION_LIST ='patient-occupation-list';

@ -37,6 +37,9 @@ VitalSignService _vitalSignService = locator<VitalSignService>();
class BaseAppClient {
final _analytics = locator<GAnalytics>();
var sampleNHICResponse =
'{"Date":null,"LanguageID":0,"ServiceName":0,"Time":null,"AndroidLink":null,"AuthenticationTokenID":null,"Data":null,"Dataw":false,"DietType":0,"DietTypeID":0,"ErrorCode":null,"ErrorEndUserMessage":null,"ErrorEndUserMessageN":null,"ErrorMessage":null,"ErrorStatusCode":0,"ErrorType":0,"FoodCategory":0,"IOSLink":null,"IsAuthenticated":false,"MealOrderStatus":0,"MealType":0,"MessageStatus":1,"NumberOfResultRecords":0,"PatientBlodType":null,"SuccessMsg":null,"SuccessMsgN":null,"VidaUpdatedResponse":null,"AccessTokenObject":null,"Age":23,"ClientIdentifierId":null,"CreatedBy":0,"DateOfBirth":"05\/20\/2001","FirstNameAr":"عميرخان","FirstNameEn":"UMAIR KHAN","Gender":"M","GenderAr":null,"GenderEn":null,"HealthId":"30000411002276","IdNumber":"2188030163","IdType":"Iqama","IsHijri":false,"IsInstertedOrUpdated":0,"IsNull":0,"IsPatientExistNHIC":0,"IsRecordLockedByCurrentUser":false,"LastNameAr":"خان","LastNameEn":"KHAN","List_ActiveAccessToken":null,"MaritalStatus":"غير معروف","MaritalStatusCode":"U","NationalDateOfBirth":"26\/02\/1422","Nationality":"باكستان","NationalityCode":"PAK","Occupation":"-","PCDTransactionDataResultList":null,"PCD_GetVidaPatientForManualVerificationList":null,"PCD_NHIC_HMG_PatientDetailsMatchCalulationList":null,"PCD_ReturnValue":0,"PatientStatus":"-","PlaceofBirth":"-","PractitionerStatusCode":null,"PractitionerStatusDescAr":null,"PractitionerStatusDescEn":null,"RowCount":0,"SecondNameAr":"عظيم","SecondNameEn":"AZEEM","ThirdNameAr":"خان عمر","ThirdNameEn":"KHAN UMAR","YakeenDoctorData_GetSourceList":null,"YakeenVidaPatientDataStatisticsByPatientIdList":null,"YakeenVidaPatientDataStatisticsList":null,"YakeenVidaPatientDataStatisticsPrefferedList":null,"accessToken":null,"categoryCode":0,"categoryNameAr":null,"categoryNameEn":null,"constraintCode":0,"constraintNameAr":null,"constraintNameEn":null,"content":null,"errorList":null,"licenseExpiryDate":null,"licenseIssuedDate":null,"licenseStatusCode":null,"licenseStatusDescAr":null,"licenseStatusDescEn":null,"organizations":null,"registrationNumber":null,"specialtyCode":0,"specialtyNameAr":null,"specialtyNameEn":null}';
post(String endPoint,
{required Map<String, dynamic> body,
required Function(dynamic response, int statusCode) onSuccess,
@ -184,8 +187,8 @@ class BaseAppClient {
// body['IdentificationNo'] = 1023854217;
// body['MobileNo'] = "531940021"; //0560717232
body['PatientID'] = 1231755; //4609100
body['TokenID'] = "@dm!n";
// body['PatientID'] = 1231755; //4609100
// body['TokenID'] = "@dm!n";
// Patient ID: 3027574
// Mobile no.: 0502303285
@ -212,7 +215,12 @@ class BaseAppClient {
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
} else {
// var decoded = utf8.decode(response.bodyBytes);
var parsed = json.decode(utf8.decode(response.bodyBytes));
var parsed;
// if (url.contains('Services/NHIC.svc/REST/GetPatientInfo')) {
// parsed = json.decode(sampleNHICResponse);
// } else {
parsed = json.decode(utf8.decode(response.bodyBytes));
// }
// print("Response: $parsed");

@ -0,0 +1,22 @@
class GetPatientOccupationListResponse {
String? occupationID;
String? description;
String? descriptionN;
GetPatientOccupationListResponse(
{this.occupationID, this.description, this.descriptionN});
GetPatientOccupationListResponse.fromJson(Map<String, dynamic> json) {
occupationID = json['OccupationID'];
description = json['Description'];
descriptionN = json['DescriptionN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['OccupationID'] = this.occupationID;
data['Description'] = this.description;
data['DescriptionN'] = this.descriptionN;
return data;
}
}

@ -75,6 +75,7 @@ class RegisterInfoResponse {
int? specialtyCode;
dynamic specialtyNameAr;
dynamic specialtyNameEn;
String? occupationID;
RegisterInfoResponse(
{this.date,
@ -152,7 +153,8 @@ class RegisterInfoResponse {
this.registrationNumber,
this.specialtyCode,
this.specialtyNameAr,
this.specialtyNameEn});
this.specialtyNameEn,
this.occupationID});
RegisterInfoResponse.fromJson(Map<String, dynamic> json) {
date = json['Date'];
@ -231,6 +233,7 @@ class RegisterInfoResponse {
specialtyCode = json['specialtyCode'];
specialtyNameAr = json['specialtyNameAr'];
specialtyNameEn = json['specialtyNameEn'];
occupationID = json['OccupationID'];
}
Map<String, dynamic> toJson() {
@ -311,6 +314,7 @@ class RegisterInfoResponse {
data['specialtyCode'] = this.specialtyCode;
data['specialtyNameAr'] = this.specialtyNameAr;
data['specialtyNameEn'] = this.specialtyNameEn;
data['OccupationID'] = this.occupationID;
return data;
}
}

@ -16,6 +16,8 @@ class RegisterUserRequest {
int? isHijri;
String? healthId;
String? zipCode;
String? occupationID;
RegisterUserRequest(
{this.patientobject,
this.patientIdentificationID,
@ -33,7 +35,8 @@ class RegisterUserRequest {
this.dob,
this.isHijri,
this.healthId,
this.zipCode});
this.zipCode,
this.occupationID});
RegisterUserRequest.fromJson(Map<String, dynamic> json) {
patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null;
@ -53,6 +56,7 @@ class RegisterUserRequest {
isHijri = json['IsHijri'];
healthId = json['HealthId'];
zipCode = json['ZipCode'];
occupationID = json['OccupationID'];
}
Map<String, dynamic> toJson() {
@ -76,6 +80,7 @@ class RegisterUserRequest {
data['IsHijri'] = this.isHijri;
data['HealthId'] = this.healthId;
data['ZipCode'] = this.zipCode;
data['OccupationID'] = this.occupationID;
return data;
}
}
@ -102,6 +107,7 @@ class Patientobject {
String? sourceType;
String? preferredLanguage;
String? marital;
String? occupationID;
Patientobject(
{this.tempValue,
@ -124,7 +130,8 @@ class Patientobject {
this.emailAddress,
this.sourceType,
this.preferredLanguage,
this.marital});
this.marital,
this.occupationID});
Patientobject.fromJson(Map<String, dynamic> json) {
tempValue = json['TempValue'];
@ -149,6 +156,7 @@ class Patientobject {
preferredLanguage = json['PreferredLanguage'];
marital = json['Marital'];
occupationID = json['OccupationID'] ?? "";
}
Map<String, dynamic> toJson() {
@ -174,6 +182,7 @@ class Patientobject {
data['SourceType'] = this.sourceType;
data['PreferredLanguage'] = this.preferredLanguage;
data['Marital'] = this.marital;
data['OccupationID'] = this.occupationID;
return data;
}
}

@ -1,6 +1,10 @@
import 'dart:convert';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -9,7 +13,9 @@ import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as checkActivation;
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/countries_list.dart';
import 'package:diplomaticquarterapp/models/Authentication/get_patient_occupation_list_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/dialog/clinic_list_dialog.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
@ -84,11 +90,20 @@ class _RegisterInfo extends State<RegisterInfo> {
String gender = 'M';
String maritalStatus = 'M';
String nationality = 'SAU';
String selectedOccupationID = "";
List<GetPatientOccupationListResponse> patientOccupationList = [];
//
GetPatientOccupationListResponse? selectedPatientOccupation;
final GlobalKey projectDropdownKey = GlobalKey();
@override
void initState() {
if (widget.page == 1) {
getCountries();
// getPatientOccupationList();
}
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
getRegisterInfo();
@ -121,7 +136,7 @@ class _RegisterInfo extends State<RegisterInfo> {
Expanded(child: SizedBox())
],
),
SizedBox(height: 20),
SizedBox(height: 10),
(isDubai && page == 1)
? Column(
children: [
@ -232,13 +247,13 @@ class _RegisterInfo extends State<RegisterInfo> {
: (registerInfo.healthId != null && page == 1)
? Column(
children: [
SizedBox(height: 20),
SizedBox(height: 10),
getnameField(TranslationBase.of(context).identificationNumber, registerInfo.idNumber, TranslationBase.of(context).firstName,
registerInfo.firstNameEn == '-' ? registerInfo.firstNameAr : registerInfo.firstNameEn),
SizedBox(height: 20),
SizedBox(height: 10),
getnameField(TranslationBase.of(context).middleName, registerInfo.secondNameEn == '-' ? registerInfo.secondNameEn : registerInfo.secondNameEn,
TranslationBase.of(context).lastName, registerInfo.lastNameEn == '-' ? registerInfo.lastNameEn : registerInfo.lastNameEn),
SizedBox(height: 20),
SizedBox(height: 10),
getnameField(
TranslationBase.of(context).gender,
registerInfo.maritalStatusCode == 'U'
@ -248,17 +263,82 @@ class _RegisterInfo extends State<RegisterInfo> {
: 'Female',
TranslationBase.of(context).maritalStatus,
registerInfo.maritalStatus),
SizedBox(height: 20),
SizedBox(height: 10),
getnameField(TranslationBase.of(context).nationality, registerInfo.nationality, TranslationBase.of(context).mobileNumber, registerd_data.patientMobileNumber.toString()),
SizedBox(height: 20),
SizedBox(height: 10),
getnameField(TranslationBase.of(context).dateOfBirth, registerInfo.dateOfBirth, "", ""),
SizedBox(height: 20),
],
)
: widget.page == 2
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(!isDubai)
? Container(
width: double.infinity,
decoration: containerRadius(Colors.white, 12),
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).selectOccupation,
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
Container(
height: 18,
width: double.infinity,
child: DropdownButtonHideUnderline(
child: DropdownButton<GetPatientOccupationListResponse>(
key: projectDropdownKey,
hint: Text(TranslationBase.of(context).selectOccupation),
value: selectedPatientOccupation,
iconSize: 0,
isExpanded: true,
style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black),
items: patientOccupationList.map((GetPatientOccupationListResponse item) {
return DropdownMenuItem<GetPatientOccupationListResponse>(
value: item,
child: AutoSizeText(
projectViewModel.isArabic ? item.descriptionN! : item.description!,
maxLines: 1,
minFontSize: 10,
style: TextStyle(
fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600,
letterSpacing: -0.39,
height: 0.8,
),
),
// Text('${item.name!}'),
);
}).toList(),
onChanged: (GetPatientOccupationListResponse? newValue) {
setState(() {
selectedPatientOccupation = newValue!;
selectedOccupationID = selectedPatientOccupation!.occupationID!;
registerInfo.occupationID = selectedOccupationID;
});
debugPrint("Selected Occupation ID: ${registerInfo.occupationID}");
},
),
),
),
],
),
),
Icon(Icons.keyboard_arrow_down),
],
))
: SizedBox(),
mHeight(20),
Container(
width: double.infinity,
decoration: containerRadius(Colors.white, 12),
@ -407,6 +487,8 @@ class _RegisterInfo extends State<RegisterInfo> {
padding: EdgeInsets.all(10),
child: DefaultButton(TranslationBase.of(context).cancel, () {
Navigator.of(context).pop();
// widget.changePageViewIndex!(0);
// getPatientOccupationList();
locator<GAnalytics>().loginRegistration.registration_cancel(step: page == 1 ? 'personal info' : 'other details');
}, textColor: Colors.white, color: Color(0xffD02127))),
),
@ -431,7 +513,15 @@ class _RegisterInfo extends State<RegisterInfo> {
widget.changePageViewIndex!(2);
}
} else {
registerNow();
if (isDubai) {
registerNow();
} else {
if (selectedPatientOccupation != null) {
registerNow();
} else {
AppToast.showErrorToast(message: TranslationBase.of(context).selectOccupationError);
}
}
}
}
@ -445,12 +535,15 @@ class _RegisterInfo extends State<RegisterInfo> {
registerNow() {
dynamic request;
if (isDubai)
request = getTempUserRequestDubai();
else
request = getTempUserRequest();
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
print(request);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: true);
dynamic res;
this
.authService
@ -503,7 +596,7 @@ class _RegisterInfo extends State<RegisterInfo> {
okFunction: () => {ConfirmDialog.closeAlertDialog(context)},
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)});
dialog.showAlertDialog(context);
projectViewModel.analytics.loginRegistration.registration_fail(errorType: err);
projectViewModel.analytics.loginRegistration.registration_fail(errorType: "");
});
}
@ -530,6 +623,16 @@ class _RegisterInfo extends State<RegisterInfo> {
if (isDubai) location = '2';
});
}
try {
var patientOccupationListVal = json.decode(await sharedPref.getString(PATIENT_OCCUPATION_LIST));
patientOccupationListVal.forEach((v) {
patientOccupationList.add(new GetPatientOccupationListResponse.fromJson(v));
});
setState(() {});
} catch (ex) {
print(ex.toString());
}
}
getTempUserRequest() {
@ -559,6 +662,7 @@ class _RegisterInfo extends State<RegisterInfo> {
"EmailAddress": email,
"SourceType": location,
"PreferredLanguage": registerd_data.languageID.toString(),
"OccupationID": registerInfo.occupationID,
"Marital": registerInfo.maritalStatusCode == 'U'
? '0'
: registerInfo.maritalStatusCode == 'M'
@ -718,7 +822,7 @@ class _RegisterInfo extends State<RegisterInfo> {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
(Route<dynamic> route) => false,
);
Navigator.push(context, FadePage(page: InsuranceUpdate()));
},
@ -726,7 +830,7 @@ class _RegisterInfo extends State<RegisterInfo> {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
(Route<dynamic> route) => false,
);
});
dialog.showAlertDialog(context);
@ -911,6 +1015,25 @@ class _RegisterInfo extends State<RegisterInfo> {
),
);
}
void openDropdown(GlobalKey key) {
GestureDetector? detector;
void searchForGestureDetector(BuildContext element) {
element.visitChildElements((element) {
if (element.widget != null && element.widget is GestureDetector) {
detector = element.widget as GestureDetector?;
// return false;
} else {
searchForGestureDetector(element);
}
// return true;
});
}
searchForGestureDetector(key.currentContext!);
assert(detector != null);
detector!.onTap!();
}
}
class Language {

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:diplomaticquarterapp/analytics/flows/login_registration.dart';
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
@ -7,6 +9,7 @@ import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_user_status_reponse.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart';
import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart';
import 'package:diplomaticquarterapp/models/Authentication/get_patient_occupation_list_response.dart';
import 'package:diplomaticquarterapp/pages/login/confirm-login.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart';
@ -54,6 +57,16 @@ class _Register extends State<Register> {
late bool isLoading;
List<GetPatientOccupationListResponse> patientOccupationList = [];
GetPatientOccupationListResponse? selectedPatientOccupation;
@override
void initState() {
getPatientOccupationList();
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
@ -357,14 +370,14 @@ class _Register extends State<Register> {
nRequest['forRegister'] = true;
nRequest['isRegister'] = true;
nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString();
nRequest['dob'] = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
nRequest['dob'] = isHijri == 1 ? dob.text : dateFormat.format(selectedDate);
nRequest['isHijri'] = isHijri;
sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest);
sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']);
if(request.patientOutSA ==0 ) {
if (request.patientOutSA == 0) {
this.chekUserData(response['LogInTokenID']);
}else{
Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai:true)));
} else {
Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai: true)));
}
}
} else {
@ -405,6 +418,7 @@ class _Register extends State<Register> {
{
result = CheckUserStatusResponse.fromJson(result as Map<String, dynamic>),
sharedPref.setObject(NHIC_DATA, result),
// widget.changePageViewIndex!(1),
Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))),
}
else
@ -413,4 +427,13 @@ class _Register extends State<Register> {
}
});
}
getPatientOccupationList() async {
patientOccupationList.clear();
await authService.getPatientOccupationList().then((result) {
sharedPref.setString(PATIENT_OCCUPATION_LIST, json.encode(result['GetOccupationLst']));
}).catchError((err) {
AppToast.showErrorToast(message: err);
});
}
}

@ -1910,6 +1910,24 @@ class AuthProvider with ChangeNotifier {
}
}
Future getPatientOccupationList() async {
Map<String, dynamic> request = {"ProjectOutSA": false};
dynamic localRes;
try {
await new BaseAppClient().post(GET_PATIENT_OCCUPATION_LIST, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
return Future.value(error);
}, body: request);
// logout();
return Future.value(localRes);
} catch (error) {
throw error;
}
}
logout() async {
await sharedPref.remove(LOGIN_TOKEN_ID);
await sharedPref.remove(PHARMACY_CUSTOMER_ID);

@ -3023,6 +3023,8 @@ class TranslationBase {
String get incorrectNationalId => localizedValues["incorrectNationalId"][locale.languageCode];
String get resultStatus => localizedValues["resultStatus"][locale.languageCode];
String get labResultFlag => localizedValues["labResultFlag"][locale.languageCode];
String get selectOccupation => localizedValues["selectOccupation"][locale.languageCode];
String get selectOccupationError => localizedValues["selectOccupationError"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save