|
|
|
@ -27,7 +27,7 @@ class RequestUtils {
|
|
|
|
}) {
|
|
|
|
}) {
|
|
|
|
bool fileNo = false;
|
|
|
|
bool fileNo = false;
|
|
|
|
if (nationId.isNotEmpty) {
|
|
|
|
if (nationId.isNotEmpty) {
|
|
|
|
final numericRegex = RegExp(r'^[0-9]+$');
|
|
|
|
final numericRegex = RegExp(r'^[0-9]+$');
|
|
|
|
fileNo = nationId.length < 10 && numericRegex.hasMatch(nationId);
|
|
|
|
fileNo = nationId.length < 10 && numericRegex.hasMatch(nationId);
|
|
|
|
//fileNo = nationId.length < 10 && nationId.isNumericOnly() ;
|
|
|
|
//fileNo = nationId.length < 10 && nationId.isNumericOnly() ;
|
|
|
|
if (fileNo) {
|
|
|
|
if (fileNo) {
|
|
|
|
@ -40,14 +40,23 @@ class RequestUtils {
|
|
|
|
if (zipCode == "0") {
|
|
|
|
if (zipCode == "0") {
|
|
|
|
request.patientMobileNumberOthers = phoneNumber;
|
|
|
|
request.patientMobileNumberOthers = phoneNumber;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
request.patientMobileNumber = int.parse(phoneNumber);
|
|
|
|
// Remove any non-numeric characters before parsing
|
|
|
|
|
|
|
|
final numericPhone = phoneNumber.replaceAll(RegExp(r'[^0-9]'), '');
|
|
|
|
|
|
|
|
final parsedPhone = int.tryParse(numericPhone);
|
|
|
|
|
|
|
|
if (parsedPhone != null) {
|
|
|
|
|
|
|
|
request.patientMobileNumber = parsedPhone;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// If parsing fails, use as string in Others field
|
|
|
|
|
|
|
|
request.patientMobileNumberOthers = phoneNumber;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request.oTPSendType = otpTypeEnum.toInt(); // could map OTPTypeEnum if needed
|
|
|
|
request.oTPSendType = otpTypeEnum.toInt(); // could map OTPTypeEnum if needed
|
|
|
|
request.zipCode = zipCode; // or countryCode if defined elsewhere
|
|
|
|
request.zipCode = zipCode; // or countryCode if defined elsewhere
|
|
|
|
|
|
|
|
|
|
|
|
if (isForRegister) {
|
|
|
|
if (isForRegister) {
|
|
|
|
request.patientIdentificationID = int.parse(nationId);
|
|
|
|
final parsedNationId = int.tryParse(nationId.replaceAll(RegExp(r'[^0-9]'), ''));
|
|
|
|
|
|
|
|
request.patientIdentificationID = parsedNationId ?? 0;
|
|
|
|
request.searchType = 1;
|
|
|
|
request.searchType = 1;
|
|
|
|
request.isHijri = calenderType.toInt;
|
|
|
|
request.isHijri = calenderType.toInt;
|
|
|
|
request.patientID = patientId;
|
|
|
|
request.patientID = patientId;
|
|
|
|
@ -56,7 +65,7 @@ class RequestUtils {
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (fileNo) {
|
|
|
|
if (fileNo) {
|
|
|
|
request.patientID = patientId ?? int.parse(nationId);
|
|
|
|
request.patientID = patientId ?? (int.tryParse(nationId.replaceAll(RegExp(r'[^0-9]'), '')) ?? 0);
|
|
|
|
request.patientIdentificationID = request.nationalID;
|
|
|
|
request.patientIdentificationID = request.nationalID;
|
|
|
|
request.searchType = 2;
|
|
|
|
request.searchType = 2;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -71,15 +80,15 @@ class RequestUtils {
|
|
|
|
|
|
|
|
|
|
|
|
static dynamic getCommonRequestWelcome(
|
|
|
|
static dynamic getCommonRequestWelcome(
|
|
|
|
{required String phoneNumber,
|
|
|
|
{required String phoneNumber,
|
|
|
|
required OTPTypeEnum otpTypeEnum,
|
|
|
|
required OTPTypeEnum otpTypeEnum,
|
|
|
|
required String? deviceToken,
|
|
|
|
required String? deviceToken,
|
|
|
|
required bool patientOutSA,
|
|
|
|
required bool patientOutSA,
|
|
|
|
required String? loginTokenID,
|
|
|
|
required String? loginTokenID,
|
|
|
|
RegistrationDataModelPayload? registeredData,
|
|
|
|
RegistrationDataModelPayload? registeredData,
|
|
|
|
int? patientId,
|
|
|
|
int? patientId,
|
|
|
|
required String nationIdText,
|
|
|
|
required String nationIdText,
|
|
|
|
required String countryCode,
|
|
|
|
required String countryCode,
|
|
|
|
required int loginType}) {
|
|
|
|
required int loginType}) {
|
|
|
|
bool fileNo = false;
|
|
|
|
bool fileNo = false;
|
|
|
|
if (nationIdText.isNotEmpty) {
|
|
|
|
if (nationIdText.isNotEmpty) {
|
|
|
|
final numericRegex = RegExp(r'^[0-9]+$');
|
|
|
|
final numericRegex = RegExp(r'^[0-9]+$');
|
|
|
|
@ -91,8 +100,17 @@ class RequestUtils {
|
|
|
|
request.patientMobileNumberOthers = phoneNumber;
|
|
|
|
request.patientMobileNumberOthers = phoneNumber;
|
|
|
|
request.mobileNo = phoneNumber;
|
|
|
|
request.mobileNo = phoneNumber;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
request.patientMobileNumber = int.parse(phoneNumber);
|
|
|
|
// Remove any non-numeric characters before parsing
|
|
|
|
request.mobileNo = '0$phoneNumber';
|
|
|
|
final numericPhone = phoneNumber.replaceAll(RegExp(r'[^0-9]'), '');
|
|
|
|
|
|
|
|
final parsedPhone = int.tryParse(numericPhone);
|
|
|
|
|
|
|
|
if (parsedPhone != null) {
|
|
|
|
|
|
|
|
request.patientMobileNumber = parsedPhone;
|
|
|
|
|
|
|
|
request.mobileNo = '0$numericPhone';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// If parsing fails, use as string in Others field
|
|
|
|
|
|
|
|
request.patientMobileNumberOthers = phoneNumber;
|
|
|
|
|
|
|
|
request.mobileNo = phoneNumber;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request.deviceToken = deviceToken;
|
|
|
|
request.deviceToken = deviceToken;
|
|
|
|
request.projectOutSA = patientOutSA;
|
|
|
|
request.projectOutSA = patientOutSA;
|
|
|
|
@ -106,8 +124,8 @@ class RequestUtils {
|
|
|
|
request.searchType = registeredData.searchType != null
|
|
|
|
request.searchType = registeredData.searchType != null
|
|
|
|
? registeredData.searchType
|
|
|
|
? registeredData.searchType
|
|
|
|
: fileNo
|
|
|
|
: fileNo
|
|
|
|
? 1
|
|
|
|
? 1
|
|
|
|
: 2;
|
|
|
|
: 2;
|
|
|
|
request.patientID = registeredData.patientId ?? 0;
|
|
|
|
request.patientID = registeredData.patientId ?? 0;
|
|
|
|
request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0);
|
|
|
|
request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0);
|
|
|
|
request.dob = registeredData.dob;
|
|
|
|
request.dob = registeredData.dob;
|
|
|
|
@ -115,7 +133,8 @@ class RequestUtils {
|
|
|
|
log("nationIdText: ${nationIdText}");
|
|
|
|
log("nationIdText: ${nationIdText}");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (fileNo) {
|
|
|
|
if (fileNo) {
|
|
|
|
request.patientID = patientId ?? int.parse(nationIdText);
|
|
|
|
final numericNationId = nationIdText.replaceAll(RegExp(r'[^0-9]'), '');
|
|
|
|
|
|
|
|
request.patientID = patientId ?? (int.tryParse(numericNationId) ?? 0);
|
|
|
|
request.patientIdentificationID = request.nationalID = '0';
|
|
|
|
request.patientIdentificationID = request.nationalID = '0';
|
|
|
|
request.searchType = 2;
|
|
|
|
request.searchType = 2;
|
|
|
|
//TODO: Issue HEre is Not Login
|
|
|
|
//TODO: Issue HEre is Not Login
|
|
|
|
@ -155,8 +174,17 @@ class RequestUtils {
|
|
|
|
request.patientMobileNumberOthers = mobileNumber;
|
|
|
|
request.patientMobileNumberOthers = mobileNumber;
|
|
|
|
request.mobileNo = mobileNumber;
|
|
|
|
request.mobileNo = mobileNumber;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
request.patientMobileNumber = int.parse(mobileNumber);
|
|
|
|
// Remove any non-numeric characters before parsing
|
|
|
|
request.mobileNo = '0$mobileNumber';
|
|
|
|
final numericMobile = mobileNumber.replaceAll(RegExp(r'[^0-9]'), '');
|
|
|
|
|
|
|
|
final parsedMobile = int.tryParse(numericMobile);
|
|
|
|
|
|
|
|
if (parsedMobile != null) {
|
|
|
|
|
|
|
|
request.patientMobileNumber = parsedMobile;
|
|
|
|
|
|
|
|
request.mobileNo = '0$numericMobile';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// If parsing fails, use as string in Others field
|
|
|
|
|
|
|
|
request.patientMobileNumberOthers = mobileNumber;
|
|
|
|
|
|
|
|
request.mobileNo = mobileNumber;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request.projectOutSA = patientOutSA;
|
|
|
|
request.projectOutSA = patientOutSA;
|
|
|
|
@ -240,16 +268,16 @@ class RequestUtils {
|
|
|
|
"Patientobject": {
|
|
|
|
"Patientobject": {
|
|
|
|
"TempValue": true,
|
|
|
|
"TempValue": true,
|
|
|
|
"PatientIdentificationType": (isDubai
|
|
|
|
"PatientIdentificationType": (isDubai
|
|
|
|
? appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1)
|
|
|
|
? appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1)
|
|
|
|
: appState.getNHICUserData.idNumber!.substring(0, 1)) ==
|
|
|
|
: appState.getNHICUserData.idNumber!.substring(0, 1)) ==
|
|
|
|
"1"
|
|
|
|
"1"
|
|
|
|
? 1
|
|
|
|
? 1
|
|
|
|
: 2,
|
|
|
|
: 2,
|
|
|
|
"PatientIdentificationNo":
|
|
|
|
"PatientIdentificationNo":
|
|
|
|
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
|
|
|
|
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
|
|
|
|
"MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0,
|
|
|
|
"MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0,
|
|
|
|
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
|
|
|
|
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
|
|
|
|
appState.getUserRegistrationPayload.zipCode == '+966')
|
|
|
|
appState.getUserRegistrationPayload.zipCode == '+966')
|
|
|
|
? 0
|
|
|
|
? 0
|
|
|
|
: 1,
|
|
|
|
: 1,
|
|
|
|
"FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr,
|
|
|
|
"FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr,
|
|
|
|
@ -266,31 +294,31 @@ class RequestUtils {
|
|
|
|
"DateofBirthN": date,
|
|
|
|
"DateofBirthN": date,
|
|
|
|
"EmailAddress": emailAddress,
|
|
|
|
"EmailAddress": emailAddress,
|
|
|
|
"SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
|
|
|
|
"SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
|
|
|
|
appState.getUserRegistrationPayload.zipCode == '+966')
|
|
|
|
appState.getUserRegistrationPayload.zipCode == '+966')
|
|
|
|
? "1"
|
|
|
|
? "1"
|
|
|
|
: "2",
|
|
|
|
: "2",
|
|
|
|
"PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2),
|
|
|
|
"PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2),
|
|
|
|
"Marital": isDubai
|
|
|
|
"Marital": isDubai
|
|
|
|
? (maritalStatus == MaritalStatusTypeEnum.single
|
|
|
|
? (maritalStatus == MaritalStatusTypeEnum.single
|
|
|
|
? '0'
|
|
|
|
? '0'
|
|
|
|
: maritalStatus == MaritalStatusTypeEnum.married
|
|
|
|
: maritalStatus == MaritalStatusTypeEnum.married
|
|
|
|
? '1'
|
|
|
|
? '1'
|
|
|
|
: '2')
|
|
|
|
: '2')
|
|
|
|
: (appState.getNHICUserData.maritalStatusCode == 'U'
|
|
|
|
: (appState.getNHICUserData.maritalStatusCode == 'U'
|
|
|
|
? '0'
|
|
|
|
? '0'
|
|
|
|
: appState.getNHICUserData.maritalStatusCode == 'M'
|
|
|
|
: appState.getNHICUserData.maritalStatusCode == 'M'
|
|
|
|
? '1'
|
|
|
|
? '1'
|
|
|
|
: '2'),
|
|
|
|
: '2'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"PatientIdentificationID":
|
|
|
|
"PatientIdentificationID":
|
|
|
|
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
|
|
|
|
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
|
|
|
|
"PatientMobileNumber": appState.getUserRegistrationPayload.patientMobileNumber.toString()[0] == '0'
|
|
|
|
"PatientMobileNumber": appState.getUserRegistrationPayload.patientMobileNumber.toString()[0] == '0'
|
|
|
|
? appState.getUserRegistrationPayload.patientMobileNumber
|
|
|
|
? appState.getUserRegistrationPayload.patientMobileNumber
|
|
|
|
: '0${appState.getUserRegistrationPayload.patientMobileNumber}',
|
|
|
|
: '0${appState.getUserRegistrationPayload.patientMobileNumber}',
|
|
|
|
"DOB": dob,
|
|
|
|
"DOB": dob,
|
|
|
|
"IsHijri": appState.getUserRegistrationPayload.isHijri,
|
|
|
|
"IsHijri": appState.getUserRegistrationPayload.isHijri,
|
|
|
|
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
|
|
|
|
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
|
|
|
|
appState.getUserRegistrationPayload.zipCode == '+966')
|
|
|
|
appState.getUserRegistrationPayload.zipCode == '+966')
|
|
|
|
? 0
|
|
|
|
? 0
|
|
|
|
: 1,
|
|
|
|
: 1,
|
|
|
|
"isDentalAllowedBackend": appState.getUserRegistrationPayload.isDentalAllowedBackend,
|
|
|
|
"isDentalAllowedBackend": appState.getUserRegistrationPayload.isDentalAllowedBackend,
|
|
|
|
@ -314,7 +342,9 @@ class RequestUtils {
|
|
|
|
request.sharedPatientId = 0;
|
|
|
|
request.sharedPatientId = 0;
|
|
|
|
request.sharedPatientIdentificationId = nationalIDorFile;
|
|
|
|
request.sharedPatientIdentificationId = nationalIDorFile;
|
|
|
|
} else if (loginType == 2) {
|
|
|
|
} else if (loginType == 2) {
|
|
|
|
request.sharedPatientId = int.parse(nationalIDorFile);
|
|
|
|
// Remove any non-numeric characters before parsing
|
|
|
|
|
|
|
|
final numericId = nationalIDorFile.replaceAll(RegExp(r'[^0-9]'), '');
|
|
|
|
|
|
|
|
request.sharedPatientId = int.tryParse(numericId) ?? 0;
|
|
|
|
request.sharedPatientIdentificationId = '';
|
|
|
|
request.sharedPatientIdentificationId = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request.searchType = loginType;
|
|
|
|
request.searchType = loginType;
|
|
|
|
@ -325,4 +355,4 @@ class RequestUtils {
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
return request;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|