diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index e203c142..c1438159 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -71,9 +71,14 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - body['VidaRefreshTokenID'] = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + if (body['VidaAuthTokenID'] == null) { + body['VidaAuthTokenID'] = + await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + } + if (body['VidaRefreshTokenID'] == null) { + body['VidaRefreshTokenID'] = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + } print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/config/config.dart b/lib/config/config.dart index 29ddfed6..1a25afa0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -92,6 +92,8 @@ const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp'; +const SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN = + 'Services/DoctorApplication.svc/REST/SendVerificationCode'; const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; @@ -167,7 +169,8 @@ const GET_CHIEF_COMPLAINT = const GET_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/GetPhysicalExam'; const GET_PROGRESS_NOTE = 'Services/DoctorApplication.svc/REST/GetProgressNote'; const GET_ASSESSMENT = 'Services/DoctorApplication.svc/REST/GetAssessment'; -const GET_ORDER_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; +const GET_ORDER_PROCEDURE = + 'Services/DoctorApplication.svc/REST/GetOrderedProcedure'; const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetProcedure'; @@ -175,7 +178,8 @@ const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; const UPDATE_PRESCRIPTION = 'Services/DoctorApplication.svc/REST/PatchPrescription'; const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; - +const DRUG_TO_DRUG = + 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; var selectedPatientType = 1; diff --git a/lib/core/model/imei_details.dart b/lib/core/model/imei_details.dart index 2cb0cd97..614ce67a 100644 --- a/lib/core/model/imei_details.dart +++ b/lib/core/model/imei_details.dart @@ -1,26 +1,36 @@ class GetIMEIDetailsModel { + int iD; String iMEI; int logInTypeID; bool outSA; String mobile; - String identificationNo; + Null identificationNo; int doctorID; String doctorName; String doctorNameN; int clinicID; String clinicDescription; - String clnicDescriptionN; + Null clinicDescriptionN; + int projectID; String projectName; String genderDescription; - String genderDescriptionN; + Null genderDescriptionN; String titleDescription; - String titleDescriptionN; + Null titleDescriptionN; + Null zipCode; + String createdOn; + Null createdBy; + String editedOn; + int editedBy; bool biometricEnabled; - int preferredLanguage; + Null preferredLanguage; bool isActive; + String vidaAuthTokenID; + String vidaRefreshTokenID; GetIMEIDetailsModel( - {this.iMEI, + {this.iD, + this.iMEI, this.logInTypeID, this.outSA, this.mobile, @@ -30,17 +40,26 @@ class GetIMEIDetailsModel { this.doctorNameN, this.clinicID, this.clinicDescription, - this.clnicDescriptionN, + this.clinicDescriptionN, + this.projectID, this.projectName, this.genderDescription, this.genderDescriptionN, this.titleDescription, this.titleDescriptionN, + this.zipCode, + this.createdOn, + this.createdBy, + this.editedOn, + this.editedBy, this.biometricEnabled, this.preferredLanguage, - this.isActive}); + this.isActive, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); GetIMEIDetailsModel.fromJson(Map json) { + iD = json['ID']; iMEI = json['IMEI']; logInTypeID = json['LogInTypeID']; outSA = json['OutSA']; @@ -51,19 +70,28 @@ class GetIMEIDetailsModel { doctorNameN = json['DoctorNameN']; clinicID = json['ClinicID']; clinicDescription = json['ClinicDescription']; - clnicDescriptionN = json['ClnicDescriptionN']; + clinicDescriptionN = json['ClinicDescriptionN']; + projectID = json['ProjectID']; projectName = json['ProjectName']; genderDescription = json['Gender_Description']; genderDescriptionN = json['Gender_DescriptionN']; titleDescription = json['Title_Description']; titleDescriptionN = json['Title_DescriptionN']; + zipCode = json['ZipCode']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; biometricEnabled = json['BiometricEnabled']; preferredLanguage = json['PreferredLanguage']; isActive = json['IsActive']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; } Map toJson() { final Map data = new Map(); + data['ID'] = this.iD; data['IMEI'] = this.iMEI; data['LogInTypeID'] = this.logInTypeID; data['OutSA'] = this.outSA; @@ -74,15 +102,23 @@ class GetIMEIDetailsModel { data['DoctorNameN'] = this.doctorNameN; data['ClinicID'] = this.clinicID; data['ClinicDescription'] = this.clinicDescription; - data['ClnicDescriptionN'] = this.clnicDescriptionN; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['ProjectID'] = this.projectID; data['ProjectName'] = this.projectName; data['Gender_Description'] = this.genderDescription; data['Gender_DescriptionN'] = this.genderDescriptionN; data['Title_Description'] = this.titleDescription; data['Title_DescriptionN'] = this.titleDescriptionN; + data['ZipCode'] = this.zipCode; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; data['BiometricEnabled'] = this.biometricEnabled; data['PreferredLanguage'] = this.preferredLanguage; data['IsActive'] = this.isActive; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; return data; } } diff --git a/lib/core/model/insert_imei_model.dart b/lib/core/model/insert_imei_model.dart index c2285d92..40668dba 100644 --- a/lib/core/model/insert_imei_model.dart +++ b/lib/core/model/insert_imei_model.dart @@ -1,30 +1,42 @@ class InsertIMEIDetailsModel { String iMEI; int logInTypeID; - bool outSA; - String mobileNo; - String identificationNo; + Null outSA; + Null mobile; + Null identificationNo; int doctorID; String doctorName; String doctorNameN; int clinicID; String clinicDescription; - String clinicDescriptionN; + Null clinicDescriptionN; String projectName; - int projectID; String genderDescription; - String genderDescriptionN; + Null genderDescriptionN; String titleDescription; - String titleDescriptionN; + Null titleDescriptionN; bool bioMetricEnabled; - int preferredLanguage; + Null preferredLanguage; bool isActive; + int editedBy; + int projectID; + String tokenID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String sessionID; + bool isLoginForDoctorApp; + int patientOutSA; + String vidaAuthTokenID; + String vidaRefreshTokenID; InsertIMEIDetailsModel( {this.iMEI, this.logInTypeID, this.outSA, - this.mobileNo, + this.mobile, this.identificationNo, this.doctorID, this.doctorName, @@ -33,20 +45,32 @@ class InsertIMEIDetailsModel { this.clinicDescription, this.clinicDescriptionN, this.projectName, - this.projectID, this.genderDescription, this.genderDescriptionN, this.titleDescription, this.titleDescriptionN, this.bioMetricEnabled, this.preferredLanguage, - this.isActive}); + this.isActive, + this.editedBy, + this.projectID, + this.tokenID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); InsertIMEIDetailsModel.fromJson(Map json) { iMEI = json['IMEI']; logInTypeID = json['LogInTypeID']; outSA = json['OutSA']; - mobileNo = json['MobileNo']; + mobile = json['Mobile']; identificationNo = json['IdentificationNo']; doctorID = json['DoctorID']; doctorName = json['DoctorName']; @@ -55,14 +79,26 @@ class InsertIMEIDetailsModel { clinicDescription = json['ClinicDescription']; clinicDescriptionN = json['ClinicDescriptionN']; projectName = json['ProjectName']; - projectID = json['ProjectID']; genderDescription = json['GenderDescription']; genderDescriptionN = json['GenderDescriptionN']; titleDescription = json['TitleDescription']; - titleDescriptionN = json['TitleDescriptionN']; + titleDescriptionN = json['Title_DescriptionN']; bioMetricEnabled = json['BioMetricEnabled']; preferredLanguage = json['PreferredLanguage']; isActive = json['IsActive']; + editedBy = json['EditedBy']; + projectID = json['ProjectID']; + tokenID = json['TokenID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; } Map toJson() { @@ -70,7 +106,7 @@ class InsertIMEIDetailsModel { data['IMEI'] = this.iMEI; data['LogInTypeID'] = this.logInTypeID; data['OutSA'] = this.outSA; - data['MobileNo'] = this.mobileNo; + data['Mobile'] = this.mobile; data['IdentificationNo'] = this.identificationNo; data['DoctorID'] = this.doctorID; data['DoctorName'] = this.doctorName; @@ -79,14 +115,26 @@ class InsertIMEIDetailsModel { data['ClinicDescription'] = this.clinicDescription; data['ClinicDescriptionN'] = this.clinicDescriptionN; data['ProjectName'] = this.projectName; - data['ProjectID'] = this.projectID; data['GenderDescription'] = this.genderDescription; data['GenderDescriptionN'] = this.genderDescriptionN; data['TitleDescription'] = this.titleDescription; - data['TitleDescriptionN'] = this.titleDescriptionN; + data['Title_DescriptionN'] = this.titleDescriptionN; data['BioMetricEnabled'] = this.bioMetricEnabled; data['PreferredLanguage'] = this.preferredLanguage; data['IsActive'] = this.isActive; + data['EditedBy'] = this.editedBy; + data['ProjectID'] = this.projectID; + data['TokenID'] = this.tokenID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; return data; } } diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 8d0cfc31..a5e3a107 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -5,8 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; -class VitalSignsService extends BaseService{ - +class VitalSignsService extends BaseService { List patientVitalSignList = []; List patientVitalSignOrderdSubList = []; VitalSignData patientVitalSigns; @@ -15,16 +14,17 @@ class VitalSignsService extends BaseService{ patientVitalSigns = null; hasError = false; Map body = Map(); - body['PatientMRN'] = patient.patientMRN; - body['AppointmentNo'] = patient.appointmentNo; - body['EpisodeID'] = patient.episodeNo; - + body['PatientMRN'] = 2954208; //patient.patientMRN; + body['AppointmentNo'] = "2016055308"; //patient.appointmentNo; + body['EpisodeID'] = 210011002; //patient.episodeNo; await baseAppClient.post( GET_PATIENT_VITAL_SIGN_DATA, onSuccess: (dynamic response, int statusCode) { - if(response['VitalSignsList'] != null){ - if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ - patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); + if (response['VitalSignsList'] != null) { + if (response['VitalSignsList']['entityList'] != null && + (response['VitalSignsList']['entityList'] as List).length > 0) { + patientVitalSigns = VitalSignData.fromJson( + response['VitalSignsList']['entityList'][0]); } } }, @@ -35,4 +35,4 @@ class VitalSignsService extends BaseService{ body: body, ); } -} \ No newline at end of file +} diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 25aa98ea..14ae072d 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -5,6 +5,9 @@ import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; class PrescriptionService extends BaseService { List _prescriptionList = List(); @@ -13,6 +16,7 @@ class PrescriptionService extends BaseService { List get drugsList => _drugsList; List doctorsList = []; List specialityList = []; + List drugToDrug = []; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( //patientMRN: 3120877, @@ -20,8 +24,8 @@ class PrescriptionService extends BaseService { ); SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( search: ["Acetaminophen"], - vidaAuthTokenID: - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", + // vidaAuthTokenID: + // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", ); PostPrescriptionReqModel _postPrescriptionReqModel = @@ -87,4 +91,18 @@ class PrescriptionService extends BaseService { body: updatePrescriptionReqModel.toJson(), ); } + + Future getDrugToDrug( + VitalSignData vital, List allergy) async { + hasError = false; + var request = {}; + await baseAppClient.post(DRUG_TO_DRUG, + onSuccess: (dynamic response, int statusCode) { + drugToDrug = []; + //drugToDrug = //response['MedicationList']['entityList']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _drugRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index 00089ef9..960462cd 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -92,7 +93,9 @@ class AuthViewModel extends BaseViewModel { nRequest.titleDescription = request['Title_Description']; nRequest.titleDescriptionN = request['Title_DescriptionN']; nRequest.projectID = await sharedPref.getInt(PROJECT_ID); - + nRequest.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + nRequest.vidaRefreshTokenID = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); try { var localRes; await baseAppClient.post(INSERT_DEVICE_IMEI, @@ -210,4 +213,21 @@ class AuthViewModel extends BaseViewModel { throw error; } } + + Future sendActivationCodeVerificationScreen( + ActivationCodeModel2 activationCodeModel) async { + try { + var localRes; + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: activationCodeModel.toJson()); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } } diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 3380d8c2..d7b8f409 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -5,6 +5,9 @@ import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; class PrescriptionViewModel extends BaseViewModel { bool hasError = false; @@ -67,4 +70,16 @@ class PrescriptionViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getDrugToDrug( + VitalSignData vital, List allergy) async { + hasError = false; + setState(ViewState.Busy); + await _prescriptionService.getDrugToDrug(vital, allergy); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/models/auth/send_activation_code_model2.dart b/lib/models/auth/send_activation_code_model2.dart new file mode 100644 index 00000000..794887b3 --- /dev/null +++ b/lib/models/auth/send_activation_code_model2.dart @@ -0,0 +1,60 @@ +class ActivationCodeModel2 { + int oTPSendType; + String mobileNumber; + String zipCode; + int channel; + int languageID; + double versionID; + int memberID; + int facilityId; + String generalid; + int isMobileFingerPrint; + String vidaAuthTokenID; + String vidaRefreshTokenID; + + ActivationCodeModel2( + {this.oTPSendType, + this.mobileNumber, + this.zipCode, + this.channel, + this.languageID, + this.versionID, + this.memberID, + this.facilityId, + this.generalid, + this.isMobileFingerPrint, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); + + ActivationCodeModel2.fromJson(Map json) { + oTPSendType = json['OTP_SendType']; + mobileNumber = json['MobileNumber']; + zipCode = json['ZipCode']; + channel = json['Channel']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + memberID = json['MemberID']; + facilityId = json['facilityId']; + generalid = json['generalid']; + isMobileFingerPrint = json['IsMobileFingerPrint']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['OTP_SendType'] = this.oTPSendType; + data['MobileNumber'] = this.mobileNumber; + data['ZipCode'] = this.zipCode; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['MemberID'] = this.memberID; + data['facilityId'] = this.facilityId; + data['generalid'] = this.generalid; + data['IsMobileFingerPrint'] = this.isMobileFingerPrint; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + return data; + } +} diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 7b105148..8787eb42 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -20,6 +20,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -48,6 +49,7 @@ class DashboardScreen extends StatefulWidget { } class _DashboardScreenState extends State { + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); HospitalViewModel hospitalProvider; AuthViewModel authProvider; bool isLoading = false; @@ -62,13 +64,17 @@ class _DashboardScreenState extends State { projectsProvider = Provider.of(context); projectsProvider.getDoctorClinicsList(); - if (DEVICE_TOKEN != '') { - var request = await sharedPref.getObj(DOCTOR_PROFILE); - authProvider.insertDeviceImei(request).then((value) { - print(value['ReturnValue']); - changeIsLoading(false); - }); - } + _firebaseMessaging.setAutoInitEnabled(true); + _firebaseMessaging.getToken().then((String token) async { + if (token != '') { + DEVICE_TOKEN = token; + var request = await sharedPref.getObj(DOCTOR_PROFILE); + authProvider.insertDeviceImei(request).then((value) { + print(value['ReturnValue']); + changeIsLoading(false); + }); + } + }); } _isInit = false; } @@ -96,8 +102,10 @@ class _DashboardScreenState extends State { PatientMobileNumber: "0", PatientIdentificationID: "0", PatientID: 0, - From: DateUtils.convertDateToFormat(DateTime. now(), 'yyyy-MM-dd').toString(), - To: DateUtils.convertDateToFormat(DateTime. now(), 'yyyy-MM-dd').toString(), + From: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') + .toString(), + To: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') + .toString(), LanguageID: 2, stamp: "2020-03-02T13:56:39.170Z", IPAdress: "11.11.11.11", @@ -679,7 +687,7 @@ class _DashboardScreenState extends State { AppText( model.dashboardItemsList.length > 0 ? getPatientCount( - model.dashboardItemsList[7]) + model.dashboardItemsList[5]) : "", fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, @@ -723,7 +731,7 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase.of(context).radiology, + TranslationBase.of(context).clinic, color: Colors.white, ) ], @@ -1017,7 +1025,9 @@ class _DashboardScreenState extends State { ); }, ), - SizedBox(width: 8,), + SizedBox( + width: 8, + ), DashboardItem( child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -1035,7 +1045,8 @@ class _DashboardScreenState extends State { ), hasBorder: true, onTap: () { - Navigator.of(context).pushNamed(PATIENTS, arguments: { + Navigator.of(context) + .pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, "selectedType": "7" }); diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 10b779e6..afd4136d 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/prescription/drugtodrug.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -693,7 +694,8 @@ class _PrescriptionFormWidgetState extends State { .addMedication, onPressed: () { formKey.currentState.save(); - + // Navigator.pop(context); + // openDrugToDrug(); if (strength == null || route == null || frequency == null || @@ -708,26 +710,8 @@ class _PrescriptionFormWidgetState extends State { } if (formKey.currentState.validate()) { - postProcedure( - patient: widget.patient, - doseTimeIn: - doseTime['id'].toString(), - model: widget.model, - duration: - duration['id'].toString(), - frequency: - frequency['id'].toString(), - route: route['id'].toString(), - drugId: selectedDrug['ItemId'] - .toString(), - strength: - strength['id'].toString(), - indication: - indicationController.text, - instruction: - instructionController.text, - doseTime: selectedDate); Navigator.pop(context); + openDrugToDrug(); } { // Navigator.push( @@ -804,4 +788,44 @@ class _PrescriptionFormWidgetState extends State { ), ); } + + openDrugToDrug() { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: SizeConfig.realScreenHeight * .5, + width: SizeConfig.realScreenWidth, + child: SingleChildScrollView( + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + DrugToDrug(widget.patient), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: AppButton( + title: TranslationBase.of(context).addMedication, + onPressed: () { + postProcedure( + patient: widget.patient, + doseTimeIn: doseTime['id'].toString(), + model: widget.model, + duration: duration['id'].toString(), + frequency: frequency['id'].toString(), + route: route['id'].toString(), + drugId: selectedDrug['ItemId'].toString(), + strength: strength['id'].toString(), + indication: indicationController.text, + instruction: instructionController.text, + doseTime: selectedDate); + }, + )) + ], + )), + + //], + //) + ); + }); + } } diff --git a/lib/screens/prescription/drugtodrug.dart b/lib/screens/prescription/drugtodrug.dart new file mode 100644 index 00000000..8f51da80 --- /dev/null +++ b/lib/screens/prescription/drugtodrug.dart @@ -0,0 +1,89 @@ +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/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_req_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.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/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class DrugToDrug extends StatefulWidget { + final PatiantInformtion patient; + DrugToDrug(this.patient); + @override + _DrugToDrug createState() => _DrugToDrug(); +} + +class _DrugToDrug extends State { + int typeID = 1; + List> expandableList = [ + {'name': 'CRITICAL'}, + {'name': 'HIGH'}, + {'name': 'MODERATE'}, + {'name': 'LOW'}, + {'name': 'INFO'}, + ]; + + @override + void initState() { + getTypeID(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( + patientMRN: 2954208, //widget.patient.patientMRN, + episodeId: 210011002, //widget.patient.episodeNo, + appointmentNo: 2016055308, //widget.patient.appointmentNo, + doctorID: '', + editedBy: ''); + + return BaseView( + onModelReady: (model) => model.getPatientVitalSign(widget.patient), + builder: (BuildContext context, model, Widget child) { + return BaseView( + onModelReady: (model2) => + model2.getPatientAllergy(generalGetReqForSOAP), + builder: (BuildContext context, model2, Widget child) { + return BaseView( + onModelReady: (model3) => model3.getDrugToDrug( + model.patientVitalSigns, model2.patientAllergiesList), + builder: (BuildContext context, + PrescriptionViewModel model3, Widget child) => + NetworkBaseView( + baseViewModel: model3, + child: Container( + height: SizeConfig.realScreenHeight * .45, + child: new ListView.builder( + itemCount: expandableList.length, + itemBuilder: (context, i) { + return new ExpansionTile( + title: new Text( + expandableList[i]['name'], + style: new TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + fontStyle: FontStyle.italic), + ), + children: [Text('Hi')], + ); + })))); + }); + }); + } + + getTypeID() async { + var type = await sharedPref.getString(SLECTED_PATIENT_TYPE) == '0' ? 2 : 1; + setState(() { + typeID = type; + }); + } +} diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 0de81fdf..caee190d 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/model/imei_details.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; @@ -330,20 +331,7 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(true); int projectID = await sharedPref.getInt(PROJECT_ID); ActivationCodeModel activationCodeModel = ActivationCodeModel( - // facilityId: projectID != null ? projectID : 15, //user.projectID, - // generalid: "Cs2020@2016\$2958", - // memberID: _loggedUser != null - // ? _loggedUser['List_MemberInformation'][0]['MemberID'] - // : user.doctorID, - // zipCode: _loggedUser != null - // ? _loggedUser['ZipCode'] - // : user.outSA == true - // ? '966' - // : '971', - // mobileNumber: - // _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, facilityId: projectID, - generalid: "Cs2020@2016\$2958", memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], zipCode: _loggedUser['ZipCode'], mobileNumber: _loggedUser['MobileNumber'], @@ -389,6 +377,60 @@ class _VerificationMethodsState extends State { } } + sendActivationCodeVerificationScreen( + oTPSendType, AuthViewModel authProv) async { + // TODO : build enum for verfication method + if (oTPSendType == 1 || oTPSendType == 2) { + widget.changeLoadingStata(true); + ActivationCodeModel2 activationCodeModel = ActivationCodeModel2( + facilityId: user.projectID, + memberID: user.doctorID, + zipCode: user.outSA == true ? '971' : '966', + mobileNumber: user.mobile, + oTPSendType: oTPSendType, + isMobileFingerPrint: 1, + vidaAuthTokenID: user.vidaAuthTokenID, + vidaRefreshTokenID: user.vidaRefreshTokenID); + + try { + authProv + .sendActivationCodeVerificationScreen(activationCodeModel) + .then((res) { + widget.changeLoadingStata(false); + + if (res['MessageStatus'] == 1) { + print("VerificationCode : " + res["VerificationCode"]); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); + sharedPref.setString( + VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); + sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); + this.startSMSService(oTPSendType, authProv); + } else { + print(res['ErrorEndUserMessage']); + helpers.showErrorToast(res['ErrorEndUserMessage']); + } + }).catchError((err) { + print('$err'); + widget.changeLoadingStata(false); + + helpers.showErrorToast(); + }); + } catch (e) {} + } else { + // TODO route to this page with parameters to inicate we should present 2 option + if (Platform.isAndroid && oTPSendType == 3) { + helpers.showErrorToast('Your device not support this feature'); + } else { + // Navigator.of(context).push(MaterialPageRoute( + // builder: (BuildContext context) => + // VerificationMethodsScreen(password: widget.password,))); + + // Navigator.of(context).pushNamed(VERIFICATION_METHODS, + // arguments: {'verificationMethod': oTPSendType}); + } + } + } + Widget getButton(flag, authProv) { switch (flag) { case 2: @@ -679,7 +721,11 @@ class _VerificationMethodsState extends State { } sendActivationCode(type, authProv) async { - sendActivationCodeByOtpNotificationType(type, authProv); + if (user != null) { + sendActivationCodeVerificationScreen(type, authProv); + } else { + sendActivationCodeByOtpNotificationType(type, authProv); + } } startSMSService(type, authProv) {