From 3229a1ff99647fae33556cef27ddfbdf877b8f18 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 2 Nov 2021 09:57:27 +0200 Subject: [PATCH 1/4] remove red color --- lib/screens/patients/register_patient/RegisterPatientPage.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index 85e46185..abd74d9c 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -161,8 +161,6 @@ class _RegisterPatientPageState extends State ); default: return Container( - // height: 100, - color: Colors.red, padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Row( children: [ From 4f123b0af2770e8b6e7a36393365a87aaac5378f Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 2 Nov 2021 17:19:48 +0200 Subject: [PATCH 2/4] first step form register patient service --- lib/config/config.dart | 9 +- .../GetPatientInfoRequestModel.dart | 60 +++ .../GetPatientInfoResponseModel.dart | 374 ++++++++++++++++++ .../service/PatientRegistrationService.dart | 17 + .../PatientRegistrationViewModel.dart | 25 +- .../RegisterConfirmationPatientPage.dart | 89 ++++- .../register_patient/RegisterPatientPage.dart | 6 +- .../RegisterSearchPatientPage.dart | 140 ++++++- 8 files changed, 684 insertions(+), 36 deletions(-) create mode 100644 lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart create mode 100644 lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index a1e8d2ca..04a6d7bc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -372,12 +372,13 @@ const GET_ADMISSION_ORDERS = ///Patient Registration Services const CHECK_PATIENT_FOR_REGISTRATION = - "Authentication.svc/REST/CheckPatientForRegisteration"; + "Services/Authentication.svc/REST/CheckPatientForRegisteration"; const SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE = - "Authentication.svc/REST/SendActivationCodebyOTPNotificationType"; + "Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType"; const CHECK_ACTIVATION_CODE_FOR_PATIENT = - "Authentication.svc/REST/CheckActivationCode"; -const PATIENT_REGISTRATION = "Authentication.svc/REST/PatientRegistration"; + "Services/Authentication.svc/REST/CheckActivationCode"; +const PATIENT_REGISTRATION = "Services/Authentication.svc/REST/PatientRegistration"; +const GET_PATIENT_INFO= "Services/NHIC.svc/REST/GetPatientInfo"; var selectedPatientType = 1; diff --git a/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart b/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart new file mode 100644 index 00000000..f05131ef --- /dev/null +++ b/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart @@ -0,0 +1,60 @@ +class GetPatientInfoRequestModel { + String patientIdentificationID; + String dOB; + int isHijri; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + GetPatientInfoRequestModel( + {this.patientIdentificationID, + this.dOB, + this.isHijri, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + GetPatientInfoRequestModel.fromJson(Map json) { + patientIdentificationID = json['PatientIdentificationID']; + dOB = json['DOB']; + isHijri = json['IsHijri']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientIdentificationID'] = this.patientIdentificationID; + data['DOB'] = this.dOB; + data['IsHijri'] = this.isHijri; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart b/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart new file mode 100644 index 00000000..158bd1e2 --- /dev/null +++ b/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart @@ -0,0 +1,374 @@ +class GetPatientInfoResponseModel { + dynamic date; + int languageID; + int serviceName; + dynamic time; + dynamic androidLink; + dynamic authenticationTokenID; + dynamic data; + bool dataw; + int dietType; + dynamic errorCode; + dynamic errorEndUserMessage; + dynamic errorEndUserMessageN; + dynamic errorMessage; + int errorType; + int foodCategory; + dynamic iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + dynamic patientBlodType; + dynamic successMsg; + dynamic successMsgN; + dynamic vidaUpdatedResponse; + dynamic accessTokenObject; + int age; + dynamic clientIdentifierId; + int createdBy; + String dateOfBirth; + String firstNameAr; + String firstNameEn; + String gender; + dynamic genderAr; + dynamic genderEn; + String healthId; + String idNumber; + String idType; + bool isHijri; + int isInstertedOrUpdated; + int isNull; + int isPatientExistNHIC; + bool isRecordLockedByCurrentUser; + String lastNameAr; + String lastNameEn; + dynamic listActiveAccessToken; + String maritalStatus; + String maritalStatusCode; + String nationalDateOfBirth; + String nationality; + String nationalityCode; + String occupation; + dynamic pCDTransactionDataResultList; + dynamic pCDGetVidaPatientForManualVerificationList; + dynamic pCDNHICHMGPatientDetailsMatchCalulationList; + int pCDReturnValue; + String patientStatus; + String placeofBirth; + dynamic practitionerStatusCode; + dynamic practitionerStatusDescAr; + dynamic practitionerStatusDescEn; + int rowCount; + String secondNameAr; + String secondNameEn; + String thirdNameAr; + String thirdNameEn; + dynamic yakeenVidaPatientDataStatisticsByPatientIdList; + dynamic yakeenVidaPatientDataStatisticsList; + dynamic yakeenVidaPatientDataStatisticsPrefferedList; + dynamic accessToken; + int categoryCode; + dynamic categoryNameAr; + dynamic categoryNameEn; + int constraintCode; + dynamic constraintNameAr; + dynamic constraintNameEn; + dynamic content; + dynamic errorList; + dynamic licenseExpiryDate; + dynamic licenseIssuedDate; + dynamic licenseStatusCode; + dynamic licenseStatusDescAr; + dynamic licenseStatusDescEn; + dynamic organizations; + dynamic registrationNumber; + int specialtyCode; + dynamic specialtyNameAr; + dynamic specialtyNameEn; + + GetPatientInfoResponseModel( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.vidaUpdatedResponse, + this.accessTokenObject, + this.age, + this.clientIdentifierId, + this.createdBy, + this.dateOfBirth, + this.firstNameAr, + this.firstNameEn, + this.gender, + this.genderAr, + this.genderEn, + this.healthId, + this.idNumber, + this.idType, + this.isHijri, + this.isInstertedOrUpdated, + this.isNull, + this.isPatientExistNHIC, + this.isRecordLockedByCurrentUser, + this.lastNameAr, + this.lastNameEn, + this.listActiveAccessToken, + this.maritalStatus, + this.maritalStatusCode, + this.nationalDateOfBirth, + this.nationality, + this.nationalityCode, + this.occupation, + this.pCDTransactionDataResultList, + this.pCDGetVidaPatientForManualVerificationList, + this.pCDNHICHMGPatientDetailsMatchCalulationList, + this.pCDReturnValue, + this.patientStatus, + this.placeofBirth, + this.practitionerStatusCode, + this.practitionerStatusDescAr, + this.practitionerStatusDescEn, + this.rowCount, + this.secondNameAr, + this.secondNameEn, + this.thirdNameAr, + this.thirdNameEn, + this.yakeenVidaPatientDataStatisticsByPatientIdList, + this.yakeenVidaPatientDataStatisticsList, + this.yakeenVidaPatientDataStatisticsPrefferedList, + this.accessToken, + this.categoryCode, + this.categoryNameAr, + this.categoryNameEn, + this.constraintCode, + this.constraintNameAr, + this.constraintNameEn, + this.content, + this.errorList, + this.licenseExpiryDate, + this.licenseIssuedDate, + this.licenseStatusCode, + this.licenseStatusDescAr, + this.licenseStatusDescEn, + this.organizations, + this.registrationNumber, + this.specialtyCode, + this.specialtyNameAr, + this.specialtyNameEn}); + + GetPatientInfoResponseModel.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + vidaUpdatedResponse = json['VidaUpdatedResponse']; + accessTokenObject = json['AccessTokenObject']; + age = json['Age']; + clientIdentifierId = json['ClientIdentifierId']; + createdBy = json['CreatedBy']; + dateOfBirth = json['DateOfBirth']; + firstNameAr = json['FirstNameAr']; + firstNameEn = json['FirstNameEn']; + gender = json['Gender']; + genderAr = json['GenderAr']; + genderEn = json['GenderEn']; + healthId = json['HealthId']; + idNumber = json['IdNumber']; + idType = json['IdType']; + isHijri = json['IsHijri']; + isInstertedOrUpdated = json['IsInstertedOrUpdated']; + isNull = json['IsNull']; + isPatientExistNHIC = json['IsPatientExistNHIC']; + isRecordLockedByCurrentUser = json['IsRecordLockedByCurrentUser']; + lastNameAr = json['LastNameAr']; + lastNameEn = json['LastNameEn']; + listActiveAccessToken = json['List_ActiveAccessToken']; + maritalStatus = json['MaritalStatus']; + maritalStatusCode = json['MaritalStatusCode']; + nationalDateOfBirth = json['NationalDateOfBirth']; + nationality = json['Nationality']; + nationalityCode = json['NationalityCode']; + occupation = json['Occupation']; + pCDTransactionDataResultList = json['PCDTransactionDataResultList']; + pCDGetVidaPatientForManualVerificationList = + json['PCD_GetVidaPatientForManualVerificationList']; + pCDNHICHMGPatientDetailsMatchCalulationList = + json['PCD_NHIC_HMG_PatientDetailsMatchCalulationList']; + pCDReturnValue = json['PCD_ReturnValue']; + patientStatus = json['PatientStatus']; + placeofBirth = json['PlaceofBirth']; + practitionerStatusCode = json['PractitionerStatusCode']; + practitionerStatusDescAr = json['PractitionerStatusDescAr']; + practitionerStatusDescEn = json['PractitionerStatusDescEn']; + rowCount = json['RowCount']; + secondNameAr = json['SecondNameAr']; + secondNameEn = json['SecondNameEn']; + thirdNameAr = json['ThirdNameAr']; + thirdNameEn = json['ThirdNameEn']; + yakeenVidaPatientDataStatisticsByPatientIdList = + json['YakeenVidaPatientDataStatisticsByPatientIdList']; + yakeenVidaPatientDataStatisticsList = + json['YakeenVidaPatientDataStatisticsList']; + yakeenVidaPatientDataStatisticsPrefferedList = + json['YakeenVidaPatientDataStatisticsPrefferedList']; + accessToken = json['accessToken']; + categoryCode = json['categoryCode']; + categoryNameAr = json['categoryNameAr']; + categoryNameEn = json['categoryNameEn']; + constraintCode = json['constraintCode']; + constraintNameAr = json['constraintNameAr']; + constraintNameEn = json['constraintNameEn']; + content = json['content']; + errorList = json['errorList']; + licenseExpiryDate = json['licenseExpiryDate']; + licenseIssuedDate = json['licenseIssuedDate']; + licenseStatusCode = json['licenseStatusCode']; + licenseStatusDescAr = json['licenseStatusDescAr']; + licenseStatusDescEn = json['licenseStatusDescEn']; + organizations = json['organizations']; + registrationNumber = json['registrationNumber']; + specialtyCode = json['specialtyCode']; + specialtyNameAr = json['specialtyNameAr']; + specialtyNameEn = json['specialtyNameEn']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['VidaUpdatedResponse'] = this.vidaUpdatedResponse; + data['AccessTokenObject'] = this.accessTokenObject; + data['Age'] = this.age; + data['ClientIdentifierId'] = this.clientIdentifierId; + data['CreatedBy'] = this.createdBy; + data['DateOfBirth'] = this.dateOfBirth; + data['FirstNameAr'] = this.firstNameAr; + data['FirstNameEn'] = this.firstNameEn; + data['Gender'] = this.gender; + data['GenderAr'] = this.genderAr; + data['GenderEn'] = this.genderEn; + data['HealthId'] = this.healthId; + data['IdNumber'] = this.idNumber; + data['IdType'] = this.idType; + data['IsHijri'] = this.isHijri; + data['IsInstertedOrUpdated'] = this.isInstertedOrUpdated; + data['IsNull'] = this.isNull; + data['IsPatientExistNHIC'] = this.isPatientExistNHIC; + data['IsRecordLockedByCurrentUser'] = this.isRecordLockedByCurrentUser; + data['LastNameAr'] = this.lastNameAr; + data['LastNameEn'] = this.lastNameEn; + data['List_ActiveAccessToken'] = this.listActiveAccessToken; + data['MaritalStatus'] = this.maritalStatus; + data['MaritalStatusCode'] = this.maritalStatusCode; + data['NationalDateOfBirth'] = this.nationalDateOfBirth; + data['Nationality'] = this.nationality; + data['NationalityCode'] = this.nationalityCode; + data['Occupation'] = this.occupation; + data['PCDTransactionDataResultList'] = this.pCDTransactionDataResultList; + data['PCD_GetVidaPatientForManualVerificationList'] = + this.pCDGetVidaPatientForManualVerificationList; + data['PCD_NHIC_HMG_PatientDetailsMatchCalulationList'] = + this.pCDNHICHMGPatientDetailsMatchCalulationList; + data['PCD_ReturnValue'] = this.pCDReturnValue; + data['PatientStatus'] = this.patientStatus; + data['PlaceofBirth'] = this.placeofBirth; + data['PractitionerStatusCode'] = this.practitionerStatusCode; + data['PractitionerStatusDescAr'] = this.practitionerStatusDescAr; + data['PractitionerStatusDescEn'] = this.practitionerStatusDescEn; + data['RowCount'] = this.rowCount; + data['SecondNameAr'] = this.secondNameAr; + data['SecondNameEn'] = this.secondNameEn; + data['ThirdNameAr'] = this.thirdNameAr; + data['ThirdNameEn'] = this.thirdNameEn; + data['YakeenVidaPatientDataStatisticsByPatientIdList'] = + this.yakeenVidaPatientDataStatisticsByPatientIdList; + data['YakeenVidaPatientDataStatisticsList'] = + this.yakeenVidaPatientDataStatisticsList; + data['YakeenVidaPatientDataStatisticsPrefferedList'] = + this.yakeenVidaPatientDataStatisticsPrefferedList; + data['accessToken'] = this.accessToken; + data['categoryCode'] = this.categoryCode; + data['categoryNameAr'] = this.categoryNameAr; + data['categoryNameEn'] = this.categoryNameEn; + data['constraintCode'] = this.constraintCode; + data['constraintNameAr'] = this.constraintNameAr; + data['constraintNameEn'] = this.constraintNameEn; + data['content'] = this.content; + data['errorList'] = this.errorList; + data['licenseExpiryDate'] = this.licenseExpiryDate; + data['licenseIssuedDate'] = this.licenseIssuedDate; + data['licenseStatusCode'] = this.licenseStatusCode; + data['licenseStatusDescAr'] = this.licenseStatusDescAr; + data['licenseStatusDescEn'] = this.licenseStatusDescEn; + data['organizations'] = this.organizations; + data['registrationNumber'] = this.registrationNumber; + data['specialtyCode'] = this.specialtyCode; + data['specialtyNameAr'] = this.specialtyNameAr; + data['specialtyNameEn'] = this.specialtyNameEn; + return data; + } +} diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart index fefa9021..c168494d 100644 --- a/lib/core/service/PatientRegistrationService.dart +++ b/lib/core/service/PatientRegistrationService.dart @@ -1,11 +1,15 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoResponseModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class PatientRegistrationService extends BaseService { + GetPatientInfoResponseModel getPatientInfoResponseModel; + checkPatientForRegistration( CheckPatientForRegistrationModel registrationModel) async { hasError = false; @@ -17,6 +21,19 @@ class PatientRegistrationService extends BaseService { }, body: registrationModel.toJson()); } + getPatientInfo(GetPatientInfoRequestModel getPatientInfoRequestMode) async { + hasError = false; + await baseAppClient.post(GET_PATIENT_INFO, + onSuccess: (dynamic response, int statusCode) { + getPatientInfoResponseModel = + GetPatientInfoResponseModel.fromJson(response); + print("ddd"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getPatientInfoRequestMode.toJson()); + } + sendActivationCodeByOTPNotificationType( SendActivationCodeByOTPNotificationTypeForRegistrationModel registrationModel) async { diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index 6dddffcd..93442120 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoResponseModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart'; import 'package:doctor_app_flutter/core/service/PatientRegistrationService.dart'; @@ -12,14 +14,33 @@ class PatientRegistrationViewModel extends BaseViewModel { PatientRegistrationService _patientRegistrationService = locator(); + + GetPatientInfoResponseModel get getPatientInfoResponseModel =>_patientRegistrationService.getPatientInfoResponseModel; + + + CheckPatientForRegistrationModel checkPatientForRegistrationModel ; Future checkPatientForRegistration( CheckPatientForRegistrationModel registrationModel) async { - setState(ViewState.Busy); + + checkPatientForRegistrationModel =registrationModel; + setState(ViewState.BusyLocal); await _patientRegistrationService .checkPatientForRegistration(registrationModel); if (_patientRegistrationService.hasError) { error = _patientRegistrationService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getPatientInfo( + GetPatientInfoRequestModel getPatientInfoRequestModel) async { + setState(ViewState.BusyLocal); + await _patientRegistrationService. + getPatientInfo(getPatientInfoRequestModel); + if (_patientRegistrationService.hasError) { + error = _patientRegistrationService.error; + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } diff --git a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart index d6d07a6f..92587f46 100644 --- a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart @@ -2,10 +2,12 @@ import 'package:doctor_app_flutter/config/config.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/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/operation_report_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; @@ -36,15 +38,13 @@ import 'CustomEditableText.dart'; class RegisterConfirmationPatientPage extends StatefulWidget { final OperationReportViewModel operationReportViewModel; final PatiantInformtion patient; - final int visitType; - final bool isUpdate; + final PatientRegistrationViewModel model; + const RegisterConfirmationPatientPage( {Key key, this.operationReportViewModel, - this.patient, - this.visitType, - this.isUpdate}) + this.patient, this.model}) : super(key: key); @override @@ -54,11 +54,7 @@ class RegisterConfirmationPatientPage extends StatefulWidget { class _RegisterConfirmationPatientPageState extends State { - int selectedType; bool isSubmitted = false; - stt.SpeechToText speech = stt.SpeechToText(); - var reconizedWord; - var event = RobotProvider(); ProjectViewModel projectViewModel; TextEditingController firstName = TextEditingController(text: "Elham"); TextEditingController middleName = TextEditingController(text: "Ali"); @@ -66,11 +62,6 @@ class _RegisterConfirmationPatientPageState TextEditingController emailAddressController = TextEditingController(text: "Elham@Rababah.com"); - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } @override void initState() { @@ -308,6 +299,76 @@ class _RegisterConfirmationPatientPageState ), ), ), + bottomSheet: Container( + height: 60, + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).next, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + PatientRegistrationModel + patientRegistrationModel = + PatientRegistrationModel( + // patientIdentificationID: + // int.parse(_idController.text), + // patientMobileNumber: + // int.parse(_phoneController.text), + // zipCode: _phoneCode.text, + isHijri: 0, + isDentalAllowedBackend: false, + patientOutSA: 0, + generalid: GENERAL_ID, + // dOB: + // "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}" + ); + await widget.model.registrationPatient( + patientRegistrationModel); + if(widget.model.state == ViewState.ErrorLocal){ + Helpers.showErrorToast(widget.model.error); + } else { + Navigator.of(context).pop(); + } + + GifLoaderDialogUtils.hideDialog(context); + + }, + ), + ), + ), + ], + ), + ), ); } diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index abd74d9c..a2c5d788 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -98,8 +98,8 @@ class _RegisterPatientPageState extends State }, scrollDirection: Axis.horizontal, children: [ - RegisterSearchPatientPage(), - RegisterConfirmationPatientPage(), + // RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,), + RegisterConfirmationPatientPage(model: model,), ]), ), @@ -107,7 +107,7 @@ class _RegisterPatientPageState extends State ], ), )), - pagerButtons(model), + // pagerButtons(model), ], ), ), diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index 5260cc3b..756970f9 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -1,20 +1,30 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; class RegisterSearchPatientPage extends StatefulWidget { - const RegisterSearchPatientPage({Key key}) : super(key: key); + final Function changePageViewIndex; + + const RegisterSearchPatientPage({Key key, this.changePageViewIndex}) + : super(key: key); @override _RegisterSearchPatientPageState createState() => @@ -25,10 +35,12 @@ class _RegisterSearchPatientPageState extends State { String countryError; dynamic _selectedCountry; - final _phoneController = TextEditingController(); + TextEditingController _phoneController = TextEditingController(); + TextEditingController _phoneCode = TextEditingController(text: "966"); + String phoneError; - final _idController = TextEditingController(); + TextEditingController _idController = TextEditingController(); String idError; DateTime _birthDate; @@ -68,7 +80,7 @@ class _RegisterSearchPatientPageState extends State { validationError: countryError, dropDownText: _selectedCountry != null ? _selectedCountry['nameEn'] - : null, + : "Saudi Arabia", enabled: false, /*onClick: model.dietTypesList != null && model.dietTypesList.length > 0 ? () { @@ -99,12 +111,31 @@ class _RegisterSearchPatientPageState extends State { SizedBox( height: 10, ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: "Phone Number", - inputType: TextInputType.phone, - controller: _phoneController, - validationError: phoneError, + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.3, + child: AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Code", + inputType: TextInputType.phone, + controller: _phoneCode, + validationError: phoneError, + ), + ), + Expanded( + child: Container( + // width: MediaQuery.of(context).size.width*0.7, + child: AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: "Phone Number", + inputType: TextInputType.phone, + controller: _phoneController, + validationError: phoneError, + ), + ), + ), + ], ), SizedBox( height: 10, @@ -131,7 +162,7 @@ class _RegisterSearchPatientPageState extends State { height: screenSize.height * 0.075, hintText: "Birthdate", dropDownText: _birthDate != null - ? "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy-MM-dd")}" + ? "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}" : null, enabled: false, isTextFieldHasSuffix: true, @@ -161,6 +192,89 @@ class _RegisterSearchPatientPageState extends State { ), ], ), + bottomSheet: Container( + height: 60, + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFeaeaea), + color: Color(0xFFeaeaea), + fontColor: Colors.black, + fontSize: 2.2, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).next, + hasBorder: true, + vPadding: 12, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + CheckPatientForRegistrationModel + checkPatientForRegistrationModel = + CheckPatientForRegistrationModel( + patientIdentificationID: + int.parse(_idController.text), + patientMobileNumber: + int.parse(_phoneController.text), + zipCode: _phoneCode.text, + isHijri: 0, + patientID: 0, + isRegister: false, + isDentalAllowedBackend: false, + patientOutSA: 0, + generalid: GENERAL_ID, + dOB: + "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}"); + await model.checkPatientForRegistration( + checkPatientForRegistrationModel); + GetPatientInfoRequestModel getPatientInfoRequestModel = + GetPatientInfoRequestModel( + //TODO Elham* this return the static to dynamic + patientIdentificationID:"1062938285", //_idController.text, + isHijri: 0, + isDentalAllowedBackend: false, + patientOutSA: 0, + generalid: GENERAL_ID, + sessionID: null, + dOB:"31/07/1988",//"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}" + + ); + await model.getPatientInfo(getPatientInfoRequestModel); + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + } else { + widget.changePageViewIndex(1); + } + + GifLoaderDialogUtils.hideDialog(context); + }, + ), + ), + ), + ], + ), + ), ), ); } @@ -170,8 +284,8 @@ class _RegisterSearchPatientPageState extends State { final DateTime picked = await showDatePicker( context: context, initialDate: dateTime, - firstDate: DateTime.now(), - lastDate: DateTime(2040), + firstDate: DateTime(DateTime.now().year - 150), + lastDate: DateTime(DateTime.now().year + 150), initialEntryMode: DatePickerEntryMode.calendar, ); if (picked != null && picked != dateTime) { From f4311b410635e9a4a1a4937da0478cccf039366a Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 2 Nov 2021 17:31:39 +0200 Subject: [PATCH 3/4] first step form register patient service --- .../register_patient/RegisterConfirmationPatientPage.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart index 92587f46..9fb9aeec 100644 --- a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart @@ -65,6 +65,9 @@ class _RegisterConfirmationPatientPageState @override void initState() { + firstName = TextEditingController(text: widget.model.getPatientInfoResponseModel.firstNameEn); + middleName = TextEditingController(text: ""); + lastName = TextEditingController(text: widget.model.getPatientInfoResponseModel.lastNameEn); super.initState(); } From 324f515253a2d28e682ab1948aec709893665490 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 2 Nov 2021 17:32:46 +0200 Subject: [PATCH 4/4] first step form register patient service --- lib/screens/patients/register_patient/RegisterPatientPage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index a2c5d788..687b231d 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -98,7 +98,7 @@ class _RegisterPatientPageState extends State }, scrollDirection: Axis.horizontal, children: [ - // RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,), + RegisterSearchPatientPage(changePageViewIndex: changePageViewIndex,), RegisterConfirmationPatientPage(model: model,), ]),