Merge branch 'textfield-validation' into 'development'

make referral changes

See merge request Cloud_Solution/doctor_app_flutter!498
merge-requests/499/head
Mohammad Aljammal 5 years ago
commit 85a01edd5e

@ -18,6 +18,10 @@ const PATIENT_REFER_TO_DOCTOR_URL =
"Services/DoctorApplication.svc/REST/ReferToDoctor"; "Services/DoctorApplication.svc/REST/ReferToDoctor";
const PATIENT_GET_DOCTOR_BY_CLINIC_URL = const PATIENT_GET_DOCTOR_BY_CLINIC_URL =
"Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID";
const PATIENT_GET_DOCTOR_BY_CLINIC_Hospital =
"Services/Doctors.svc/REST/SearchDoctorsByTime";
const GET_CLINICS_FOR_DOCTOR = const GET_CLINICS_FOR_DOCTOR =
'Services/DoctorApplication.svc/REST/GetClinicsForDoctor'; 'Services/DoctorApplication.svc/REST/GetClinicsForDoctor';
const PATIENT_GET_LIST_REFERAL_URL = const PATIENT_GET_LIST_REFERAL_URL =

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart';
import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart';
import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/clinic-doctor.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart';
@ -15,7 +16,7 @@ import 'base/lookup-service.dart';
class PatientReferralService extends LookupService { class PatientReferralService extends LookupService {
List<dynamic> projectsList = []; List<dynamic> projectsList = [];
List<dynamic> clinicsList = []; List<dynamic> clinicsList = [];
List<dynamic> doctorsList = []; List<ClinicDoctor> doctorsList = List();
List<MyReferredPatientModel> listMyReferredPatientModel = []; List<MyReferredPatientModel> listMyReferredPatientModel = [];
List<PendingReferral> pendingReferralList = []; List<PendingReferral> pendingReferralList = [];
List<PendingReferral> patientReferralList = []; List<PendingReferral> patientReferralList = [];
@ -101,25 +102,31 @@ class PatientReferralService extends LookupService {
); );
} }
Future getDoctorsList(String clinicId, int branchId) async { Future getDoctorsList(PatiantInformtion patient ,int clinicId, int branchId) async {
hasError = false; hasError = false;
DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
DoctorsByClinicIdRequest(); DoctorsByClinicIdRequest();
_doctorsByClinicIdRequest.projectID = branchId; _doctorsByClinicIdRequest.projectID = branchId;
_doctorsByClinicIdRequest.clinicID = clinicId; _doctorsByClinicIdRequest.clinicID = clinicId;
_doctorsByClinicIdRequest.patientID = patient.patientId;
_doctorsByClinicIdRequest.gender = patient.gender;
await baseAppClient.post(
PATIENT_GET_DOCTOR_BY_CLINIC_URL, await baseAppClient.postPatient(
PATIENT_GET_DOCTOR_BY_CLINIC_Hospital,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
doctorsList = []; doctorsList.clear();
doctorsList = response['List_Doctors_All']; response['DoctorList'].forEach((v) {
doctorsList.add(ClinicDoctor.fromJson(v));
});
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, },
body: _doctorsByClinicIdRequest.toJson(), body: _doctorsByClinicIdRequest.toJson(),
patient: patient
); );
} }

@ -357,7 +357,7 @@ class PatientService extends BaseService {
); );
} }
Future getDoctorsList(String clinicId) async { Future getDoctorsList(int clinicId) async {
hasError = false; hasError = false;
_doctorsByClinicIdRequest.clinicID = clinicId; _doctorsByClinicIdRequest.clinicID = clinicId;
await baseAppClient.post( await baseAppClient.post(

@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/clinic-doctor.dart';
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -21,7 +22,9 @@ class PatientReferralViewModel extends BaseViewModel {
List<dynamic> get clinicsList => _referralPatientService.clinicsList; List<dynamic> get clinicsList => _referralPatientService.clinicsList;
List<dynamic> get doctorsList => _referralPatientService.doctorsList; List<dynamic> doctorsList = [];
List<ClinicDoctor> get clinicDoctorsList => _referralPatientService.doctorsList;
List<MyReferredPatientModel> get listMyReferredPatientModel => List<MyReferredPatientModel> get listMyReferredPatientModel =>
_referralPatientService.listMyReferredPatientModel; _referralPatientService.listMyReferredPatientModel;
@ -82,14 +85,20 @@ class PatientReferralViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getClinicDoctors(String clinicId, int branchId) async { Future getClinicDoctors(PatiantInformtion patient ,int clinicId, int branchId) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _referralPatientService.getDoctorsList(clinicId, branchId); await _referralPatientService.getDoctorsList(patient, clinicId, branchId);
if (_referralPatientService.hasError) { if (_referralPatientService.hasError) {
error = _referralPatientService.error; error = _referralPatientService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else{
doctorsList.clear();
clinicDoctorsList.forEach((element) {
doctorsList.add(element.toJson());
});
setState(ViewState.Idle); setState(ViewState.Idle);
}
} }
Future<dynamic> getDoctorBranch() async { Future<dynamic> getDoctorBranch() async {

@ -170,7 +170,7 @@ class PatientViewModel extends BaseViewModel {
} }
} }
Future getDoctorsList(String clinicId) async { Future getDoctorsList(int clinicId) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _patientService.getDoctorsList(clinicId); await _patientService.getDoctorsList(clinicId);
if (_patientService.hasError) { if (_patientService.hasError) {

@ -1,86 +1,66 @@
class DoctorsByClinicIdRequest { class DoctorsByClinicIdRequest {
/* int clinicID;
*@author: Ibrahim Albitar
*@Date:03/06/2020
*@param:
*@return:
*@desc: DoctorsByClinicIdRequest
*/
int projectID; int projectID;
String clinicID; bool continueDentalPlan;
int languageID; bool isSearchAppointmnetByClinicID;
String stamp; int patientID;
String iPAdress; int gender;
double versionID; bool isGetNearAppointment;
int channel; bool isVoiceCommand;
String tokenID; int latitude;
String sessionID; int longitude;
bool isLoginForDoctorApp; bool license;
bool patientOutSA; bool isDentalAllowedBackend;
int patientTypeID;
/*
{
"ProjectID": 21,
"ClinicID": "0",
"LanguageID": 2,
"stamp": "2020-06-03T11:22:04.702Z",
"IPAdress": "11.11.11.11",
"VersionID": 1.2,
"Channel": 9,
"TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==",
"SessionID": "JBXRsDl37L",
"IsLoginForDoctorApp": true,
"PatientOutSA": false,
"PatientTypeID": 1
}
*/
DoctorsByClinicIdRequest( DoctorsByClinicIdRequest(
{this.projectID, {
this.clinicID, this.clinicID,
this.languageID = 2, this.projectID,
this.stamp = "2020-06-03T11:22:04.702Z", this.continueDentalPlan = false,
this.iPAdress = "11.11.11.11", this.isSearchAppointmnetByClinicID = true,
this.versionID = 1.2, this.patientID,
this.channel = 9, this.gender,
this.tokenID, this.isGetNearAppointment = false,
this.sessionID = "JBXRsDl37L", this.isVoiceCommand = true,
this.isLoginForDoctorApp = true, this.latitude = 0,
this.patientOutSA = false, this.longitude = 0,
this.patientTypeID = 1}); this.license = true,
this.isDentalAllowedBackend = false,
});
DoctorsByClinicIdRequest.fromJson(Map<String, dynamic> json) { DoctorsByClinicIdRequest.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
clinicID = json['ClinicID']; clinicID = json['ClinicID'];
languageID = json['LanguageID']; projectID = json['ProjectID'];
stamp = json['stamp']; continueDentalPlan = json['ContinueDentalPlan'];
iPAdress = json['IPAdress']; isSearchAppointmnetByClinicID = json['IsSearchAppointmnetByClinicID'];
versionID = json['VersionID']; patientID = json['PatientID'];
channel = json['Channel']; gender = json['gender'];
tokenID = json['TokenID']; isGetNearAppointment = json['IsGetNearAppointment'];
sessionID = json['SessionID']; isVoiceCommand = json['IsVoiceCommand'];
isLoginForDoctorApp = json['IsLoginForDoctorApp']; latitude = json['Latitude'];
patientOutSA = json['PatientOutSA']; longitude = json['Longitude'];
patientTypeID = json['PatientTypeID']; license = json['License'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID; data['ClinicID'] = this.clinicID;
data['LanguageID'] = this.languageID; data['ProjectID'] = this.projectID;
data['stamp'] = this.stamp; data['ContinueDentalPlan'] = this.continueDentalPlan;
data['IPAdress'] = this.iPAdress; data['IsSearchAppointmnetByClinicID'] = this.isSearchAppointmnetByClinicID;
data['VersionID'] = this.versionID; data['PatientID'] = this.patientID;
data['Channel'] = this.channel; data['gender'] = this.gender;
data['TokenID'] = this.tokenID; data['IsGetNearAppointment'] = this.isGetNearAppointment;
data['SessionID'] = this.sessionID; data['IsVoiceCommand'] = this.isVoiceCommand;
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; data['Latitude'] = this.latitude;
data['PatientOutSA'] = this.patientOutSA; data['Longitude'] = this.longitude;
data['PatientTypeID'] = this.patientTypeID; data['License'] = this.license;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
return data; return data;
} }
} }

@ -0,0 +1,169 @@
class ClinicDoctor {
int clinicID;
String clinicName;
String doctorTitle;
int iD;
String name;
int projectID;
String projectName;
int actualDoctorRate;
int clinicRoomNo;
String date;
String dayName;
int doctorID;
String doctorImageURL;
String doctorProfile;
String doctorProfileInfo;
int doctorRate;
int gender;
String genderDescription;
bool isAppointmentAllowed;
bool isDoctorAllowVedioCall;
bool isDoctorDummy;
bool isLiveCare;
String latitude;
String longitude;
String nationalityFlagURL;
String nationalityID;
String nationalityName;
String nearestFreeSlot;
int noOfPatientsRate;
String originalClinicID;
int personRate;
int projectDistanceInKiloMeters;
String qR;
String qRString;
int rateNumber;
String serviceID;
String setupID;
List<String> speciality;
String workingHours;
ClinicDoctor(
{this.clinicID,
this.clinicName,
this.doctorTitle,
this.iD,
this.name,
this.projectID,
this.projectName,
this.actualDoctorRate,
this.clinicRoomNo,
this.date,
this.dayName,
this.doctorID,
this.doctorImageURL,
this.doctorProfile,
this.doctorProfileInfo,
this.doctorRate,
this.gender,
this.genderDescription,
this.isAppointmentAllowed,
this.isDoctorAllowVedioCall,
this.isDoctorDummy,
this.isLiveCare,
this.latitude,
this.longitude,
this.nationalityFlagURL,
this.nationalityID,
this.nationalityName,
this.nearestFreeSlot,
this.noOfPatientsRate,
this.originalClinicID,
this.personRate,
this.projectDistanceInKiloMeters,
this.qR,
this.qRString,
this.rateNumber,
this.serviceID,
this.setupID,
this.speciality,
this.workingHours});
ClinicDoctor.fromJson(Map<String, dynamic> json) {
clinicID = json['ClinicID'];
clinicName = json['ClinicName'];
doctorTitle = json['DoctorTitle'];
iD = json['ID'];
name = json['Name'];
projectID = json['ProjectID'];
projectName = json['ProjectName'];
actualDoctorRate = json['ActualDoctorRate'];
clinicRoomNo = json['ClinicRoomNo'];
date = json['Date'];
dayName = json['DayName'];
doctorID = json['DoctorID'];
doctorImageURL = json['DoctorImageURL'];
doctorProfile = json['DoctorProfile'];
doctorProfileInfo = json['DoctorProfileInfo'];
doctorRate = json['DoctorRate'];
gender = json['Gender'];
genderDescription = json['GenderDescription'];
isAppointmentAllowed = json['IsAppointmentAllowed'];
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
isDoctorDummy = json['IsDoctorDummy'];
isLiveCare = json['IsLiveCare'];
latitude = json['Latitude'];
longitude = json['Longitude'];
nationalityFlagURL = json['NationalityFlagURL'];
nationalityID = json['NationalityID'];
nationalityName = json['NationalityName'];
nearestFreeSlot = json['NearestFreeSlot'];
noOfPatientsRate = json['NoOfPatientsRate'];
originalClinicID = json['OriginalClinicID'];
personRate = json['PersonRate'];
projectDistanceInKiloMeters = json['ProjectDistanceInKiloMeters'];
qR = json['QR'];
qRString = json['QRString'];
rateNumber = json['RateNumber'];
serviceID = json['ServiceID'];
setupID = json['SetupID'];
speciality = json['Speciality'].cast<String>();
workingHours = json['WorkingHours'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ClinicID'] = this.clinicID;
data['ClinicName'] = this.clinicName;
data['DoctorTitle'] = this.doctorTitle;
data['ID'] = this.iD;
data['Name'] = this.name;
data['ProjectID'] = this.projectID;
data['ProjectName'] = this.projectName;
data['ActualDoctorRate'] = this.actualDoctorRate;
data['ClinicRoomNo'] = this.clinicRoomNo;
data['Date'] = this.date;
data['DayName'] = this.dayName;
data['DoctorID'] = this.doctorID;
data['DoctorImageURL'] = this.doctorImageURL;
data['DoctorProfile'] = this.doctorProfile;
data['DoctorProfileInfo'] = this.doctorProfileInfo;
data['DoctorRate'] = this.doctorRate;
data['Gender'] = this.gender;
data['GenderDescription'] = this.genderDescription;
data['IsAppointmentAllowed'] = this.isAppointmentAllowed;
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
data['IsDoctorDummy'] = this.isDoctorDummy;
data['IsLiveCare'] = this.isLiveCare;
data['Latitude'] = this.latitude;
data['Longitude'] = this.longitude;
data['NationalityFlagURL'] = this.nationalityFlagURL;
data['NationalityID'] = this.nationalityID;
data['NationalityName'] = this.nationalityName;
data['NearestFreeSlot'] = this.nearestFreeSlot;
data['NoOfPatientsRate'] = this.noOfPatientsRate;
data['OriginalClinicID'] = this.originalClinicID;
data['PersonRate'] = this.personRate;
data['ProjectDistanceInKiloMeters'] = this.projectDistanceInKiloMeters;
data['QR'] = this.qR;
data['QRString'] = this.qRString;
data['RateNumber'] = this.rateNumber;
data['ServiceID'] = this.serviceID;
data['SetupID'] = this.setupID;
data['Speciality'] = this.speciality;
data['WorkingHours'] = this.workingHours;
return data;
}
}

@ -78,8 +78,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
_selectedDoctor = null; _selectedDoctor = null;
_selectedClinic = selectedValue; _selectedClinic = selectedValue;
model.getDoctorsList( model.getDoctorsList(
_selectedClinic['ClinicID'] _selectedClinic['ClinicID']);
.toString());
}); });
}, },
); );

@ -363,7 +363,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model
.getClinicDoctors( .getClinicDoctors(
_selectedClinic['ClinicID'].toString(), patient,
_selectedClinic['ClinicID'],
_selectedBranch['facilityId']) _selectedBranch['facilityId'])
.then((_) => .then((_) =>
GifLoaderDialogUtils.hideDialog(context)); GifLoaderDialogUtils.hideDialog(context));
@ -390,7 +391,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor, hintText: TranslationBase.of(context).doctor,
dropDownText: dropDownText:
_selectedDoctor != null ? _selectedDoctor['DoctorName'] : null, _selectedDoctor != null ? _selectedDoctor['Name'] : null,
enabled: false, enabled: false,
isDropDown: true, isDropDown: true,
validationError: doctorError, validationError: doctorError,
@ -400,7 +401,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.doctorsList, list: model.doctorsList,
attributeName: 'DoctorName', attributeName: 'Name',
attributeValueId: 'DoctorID', attributeValueId: 'DoctorID',
usingSearch: true, usingSearch: true,
hintSearchText: TranslationBase.of(context).doctorSearch, hintSearchText: TranslationBase.of(context).doctorSearch,

Loading…
Cancel
Save