Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into sultan
commit
5585274b18
@ -1,8 +1,59 @@
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.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/util/dr_app_shared_pref.dart';
|
||||
|
||||
class BaseService {
|
||||
String error;
|
||||
bool hasError = false;
|
||||
BaseAppClient baseAppClient = BaseAppClient();
|
||||
//TODO add the user login model when we need it
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
DoctorProfileModel doctorProfile;
|
||||
|
||||
List<PatientArrivalEntity> patientArrivalList = [];
|
||||
|
||||
//TODO add the user login model when we need it
|
||||
Future<DoctorProfileModel> getDoctorProfile() async {
|
||||
if (doctorProfile == null) {
|
||||
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||
if (profile != null) {
|
||||
doctorProfile = DoctorProfileModel.fromJson(profile);
|
||||
if (doctorProfile != null) {
|
||||
return doctorProfile;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return doctorProfile;
|
||||
}
|
||||
}
|
||||
|
||||
Future getPatientArrivalList(String date) async{
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
body['From'] = date;
|
||||
body['To'] = date;
|
||||
body['PageIndex'] = 0;
|
||||
body['PageSize'] = 0;
|
||||
|
||||
await baseAppClient.post(
|
||||
GET_PATIENT_ARRIVAL_LIST,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
patientArrivalList.clear();
|
||||
|
||||
response['patientArrivalList']['entityList'].forEach((v) {
|
||||
PatientArrivalEntity item = PatientArrivalEntity.fromJson(v);
|
||||
patientArrivalList.add(item);
|
||||
});
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
this.error = error;
|
||||
},
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,206 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
import 'package:doctor_app_flutter/lookups/hospital_lookup.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/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/my_referral/PendingReferral.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart';
|
||||
|
||||
import 'base/lookup-service.dart';
|
||||
|
||||
class PatientReferralService extends LookupService {
|
||||
List<dynamic> projectsList = [];
|
||||
List<dynamic> clinicsList = [];
|
||||
List<dynamic> doctorsList = [];
|
||||
List<MyReferredPatientModel> listMyReferredPatientModel = [];
|
||||
List<PendingReferral> pendingReferralList = [];
|
||||
String setupID = "0";
|
||||
|
||||
Future getProjectsList() async {
|
||||
hasError = false;
|
||||
const url = GET_PROJECTS;
|
||||
var info = {
|
||||
"LanguageID": 1,
|
||||
"stamp": "2020-02-26T13:51:44.111Z",
|
||||
"IPAdress": "11.11.11.11",
|
||||
"VersionID": 1.2,
|
||||
"Channel": 9,
|
||||
"TokenID": "",
|
||||
"SessionID": "i1UJwCTSqt",
|
||||
"IsLoginForDoctorApp": true
|
||||
};
|
||||
dynamic localRes;
|
||||
|
||||
await baseAppClient.post(url, onSuccess: (response, statusCode) async {
|
||||
if (response['MessageStatus'] == 1) {
|
||||
projectsList = response['ListProject'];
|
||||
} else {
|
||||
// handel error
|
||||
projectsList = ListProject;
|
||||
}
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
projectsList = ListProject;
|
||||
}, body: info);
|
||||
}
|
||||
|
||||
Future getProjectInfo(int projectId) async {
|
||||
Map<String, dynamic> body = Map();
|
||||
body['ProjectID'] = projectId;
|
||||
|
||||
await baseAppClient.post(
|
||||
PROJECT_GET_INFO,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
setupID = response['ProjectInfo'][0]['facilityGroupId'];
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
|
||||
Future getClinicsList(int projectId) async {
|
||||
hasError = false;
|
||||
ClinicByProjectIdRequest _clinicByProjectIdRequest =
|
||||
ClinicByProjectIdRequest();
|
||||
_clinicByProjectIdRequest.projectID = projectId;
|
||||
|
||||
await baseAppClient.post(
|
||||
PATIENT_GET_CLINIC_BY_PROJECT_URL,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
clinicsList = [];
|
||||
clinicsList = response['List_Clinic_All'];
|
||||
print(response['List_Clinic_All']);
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: _clinicByProjectIdRequest.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
Future getDoctorsList(String clinicId) async {
|
||||
hasError = false;
|
||||
DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
|
||||
DoctorsByClinicIdRequest();
|
||||
|
||||
_doctorsByClinicIdRequest.clinicID = clinicId;
|
||||
await baseAppClient.post(
|
||||
PATIENT_GET_DOCTOR_BY_CLINIC_URL,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
doctorsList = [];
|
||||
doctorsList = response['List_Doctors_All'];
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: _doctorsByClinicIdRequest.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
Future getMyReferredPatient() async {
|
||||
hasError = false;
|
||||
RequestMyReferralPatientModel _requestMyReferralPatient =
|
||||
RequestMyReferralPatientModel();
|
||||
DoctorProfileModel doctorProfile = await getDoctorProfile();
|
||||
|
||||
await baseAppClient.post(
|
||||
GET_MY_REFERRED_PATIENT,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
listMyReferredPatientModel.clear();
|
||||
|
||||
response['List_MyReferredPatient'].forEach((v) {
|
||||
MyReferredPatientModel item = MyReferredPatientModel.fromJson(v);
|
||||
if (doctorProfile != null) {
|
||||
item.isReferralDoctorSameBranch =
|
||||
doctorProfile.projectID == item.projectId;
|
||||
} else {
|
||||
item.isReferralDoctorSameBranch = false;
|
||||
}
|
||||
listMyReferredPatientModel.add(item);
|
||||
});
|
||||
// print(response['List_MyReferredPatient']);
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: _requestMyReferralPatient.toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
Future getPendingReferralList() async {
|
||||
hasError = false;
|
||||
DoctorProfileModel doctorProfile = await getDoctorProfile();
|
||||
Map<String, dynamic> body = Map();
|
||||
body['ClinicID'] = 0;
|
||||
body['DoctorID'] = doctorProfile.doctorID;
|
||||
|
||||
await baseAppClient.post(
|
||||
GET_PENDING_REFERRAL_PATIENT,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
pendingReferralList.clear();
|
||||
|
||||
response['PendingReferralList'].forEach((v) {
|
||||
PendingReferral item = PendingReferral.fromJson(v);
|
||||
item.isReferralDoctorSameBranch =
|
||||
item.targetProjectId == item.sourceProjectId;
|
||||
pendingReferralList.add(item);
|
||||
});
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
|
||||
Future makeReferral(
|
||||
PatientArrivalEntity patientArrivalEntity,
|
||||
String isoStringDate,
|
||||
int projectID,
|
||||
int clinicID,
|
||||
int doctorID,
|
||||
String remarks) async {
|
||||
hasError = false;
|
||||
Map<String, dynamic> body = Map();
|
||||
|
||||
List<dynamic> physiotheraphyGoalsList = [];
|
||||
listOfPhysiotherapyGoals.forEach((element) {
|
||||
physiotheraphyGoalsList
|
||||
.add({"goalId": element.id, "remarks": element.remarks});
|
||||
});
|
||||
|
||||
body['PatientMRN'] = patientArrivalEntity.patientMRN;
|
||||
body['AppointmentNo'] = patientArrivalEntity.appointmentNo;
|
||||
body['SetupID'] = setupID;
|
||||
body['appointmentDate'] = isoStringDate;
|
||||
body['SlotStart'] = isoStringDate;
|
||||
body['SlotEnd'] = isoStringDate;
|
||||
body['Remarks'] = remarks;
|
||||
body['ProjectID'] = projectID;
|
||||
body['ClinicID'] = clinicID;
|
||||
body['DoctorID'] = doctorID;
|
||||
body['noOfSessions'] = 1;
|
||||
body['physiotheraphyGoalsList'] = physiotheraphyGoalsList;
|
||||
|
||||
await baseAppClient.post(
|
||||
CREATE_REFERRAL_PATIENT,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
print(response.toString());
|
||||
},
|
||||
onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
},
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
}
|
@ -1,17 +1,39 @@
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BaseViewModel extends ChangeNotifier {
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
DoctorProfileModel doctorProfile;
|
||||
|
||||
ViewState _state = ViewState.Idle;
|
||||
bool isInternetConnection = true;
|
||||
|
||||
ViewState get state => _state;
|
||||
|
||||
String error = "";
|
||||
|
||||
//TODO add the user login model when we need it
|
||||
|
||||
void setState(ViewState viewState) {
|
||||
_state = viewState;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<DoctorProfileModel> getDoctorProfile() async {
|
||||
if (doctorProfile == null) {
|
||||
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||
if (profile != null) {
|
||||
doctorProfile = DoctorProfileModel.fromJson(profile);
|
||||
if (doctorProfile != null) {
|
||||
return doctorProfile;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return doctorProfile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,146 @@
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/service/patient-doctor-referral-service.dart';
|
||||
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/patient/PatientArrivalEntity.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
class PatientReferralViewModel extends BaseViewModel {
|
||||
PatientReferralService _referralPatientService =
|
||||
locator<PatientReferralService>();
|
||||
|
||||
List<dynamic> get branchesList => _referralPatientService.projectsList;
|
||||
|
||||
List<dynamic> get clinicsList => _referralPatientService.clinicsList;
|
||||
|
||||
List<dynamic> get doctorsList => _referralPatientService.doctorsList;
|
||||
|
||||
List<MyReferredPatientModel> get listMyReferredPatientModel =>
|
||||
_referralPatientService.listMyReferredPatientModel;
|
||||
|
||||
List<PendingReferral> get pendingReferral =>
|
||||
_referralPatientService.pendingReferralList;
|
||||
|
||||
List<PatientArrivalEntity> get patientArrivalList =>
|
||||
_referralPatientService.patientArrivalList;
|
||||
|
||||
Future getMasterLookup(MasterKeysService masterKeys) async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getMasterLookup(masterKeys);
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
await getBranches();
|
||||
}
|
||||
|
||||
Future getBranches() async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getProjectsList();
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
Future getClinics(int projectId) async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getClinicsList(projectId);
|
||||
await _referralPatientService.getProjectInfo(projectId);
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future getClinicDoctors(String clinicId) async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getDoctorsList(clinicId);
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future<dynamic> getDoctorBranch() async {
|
||||
DoctorProfileModel doctorProfile = await getDoctorProfile();
|
||||
if (doctorProfile != null) {
|
||||
dynamic _selectedBranch = {
|
||||
"ID": doctorProfile.projectID,
|
||||
"Desciption": doctorProfile.projectName
|
||||
};
|
||||
return _selectedBranch;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future getMyReferredPatient() async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getMyReferredPatient();
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
MyReferredPatientModel getReferredPatientItem(int index) {
|
||||
return listMyReferredPatientModel[index];
|
||||
}
|
||||
|
||||
Future getPendingReferralPatients() async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getPendingReferralList();
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future getPatientArrivalList(String date) async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.getPatientArrivalList(date);
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
List<dynamic> getAppointmentsByPatientName(String patientName) {
|
||||
List<dynamic> appointments = [];
|
||||
patientArrivalList.forEach((element) {
|
||||
if (element.patientName == patientName) {
|
||||
appointments.add(element.toJson());
|
||||
}
|
||||
});
|
||||
return appointments;
|
||||
}
|
||||
|
||||
Future makeReferral(PatientArrivalEntity patientArrivalEntity,
|
||||
String isoStringDate,
|
||||
int projectID,
|
||||
int clinicID,
|
||||
int doctorID,
|
||||
String remarks) async {
|
||||
setState(ViewState.Busy);
|
||||
await _referralPatientService.makeReferral(patientArrivalEntity, isoStringDate, projectID, clinicID, doctorID, remarks);
|
||||
if (_referralPatientService.hasError) {
|
||||
error = _referralPatientService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
class PatientArrivalEntity {
|
||||
String age;
|
||||
String appointmentDate;
|
||||
int appointmentNo;
|
||||
String appointmentType;
|
||||
String arrivedOn;
|
||||
String companyName;
|
||||
String endTime;
|
||||
int episodeNo;
|
||||
int fallRiskScore;
|
||||
String gender;
|
||||
int medicationOrders;
|
||||
String mobileNumber;
|
||||
String nationality;
|
||||
int patientMRN;
|
||||
String patientName;
|
||||
int rowCount;
|
||||
String startTime;
|
||||
String visitType;
|
||||
|
||||
PatientArrivalEntity(
|
||||
{this.age,
|
||||
this.appointmentDate,
|
||||
this.appointmentNo,
|
||||
this.appointmentType,
|
||||
this.arrivedOn,
|
||||
this.companyName,
|
||||
this.endTime,
|
||||
this.episodeNo,
|
||||
this.fallRiskScore,
|
||||
this.gender,
|
||||
this.medicationOrders,
|
||||
this.mobileNumber,
|
||||
this.nationality,
|
||||
this.patientMRN,
|
||||
this.patientName,
|
||||
this.rowCount,
|
||||
this.startTime,
|
||||
this.visitType});
|
||||
|
||||
PatientArrivalEntity.fromJson(Map<String, dynamic> json) {
|
||||
age = json['age'];
|
||||
appointmentDate = json['appointmentDate'];
|
||||
appointmentNo = json['appointmentNo'];
|
||||
appointmentType = json['appointmentType'];
|
||||
arrivedOn = json['arrivedOn'];
|
||||
companyName = json['companyName'];
|
||||
endTime = json['endTime'];
|
||||
episodeNo = json['episodeNo'];
|
||||
fallRiskScore = json['fallRiskScore'];
|
||||
gender = json['gender'];
|
||||
medicationOrders = json['medicationOrders'];
|
||||
mobileNumber = json['mobileNumber'];
|
||||
nationality = json['nationality'];
|
||||
patientMRN = json['patientMRN'];
|
||||
patientName = json['patientName'];
|
||||
rowCount = json['rowCount'];
|
||||
startTime = json['startTime'];
|
||||
visitType = json['visitType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['age'] = this.age;
|
||||
data['appointmentDate'] = this.appointmentDate;
|
||||
data['appointmentNo'] = this.appointmentNo;
|
||||
data['appointmentType'] = this.appointmentType;
|
||||
data['arrivedOn'] = this.arrivedOn;
|
||||
data['companyName'] = this.companyName;
|
||||
data['endTime'] = this.endTime;
|
||||
data['episodeNo'] = this.episodeNo;
|
||||
data['fallRiskScore'] = this.fallRiskScore;
|
||||
data['gender'] = this.gender;
|
||||
data['medicationOrders'] = this.medicationOrders;
|
||||
data['mobileNumber'] = this.mobileNumber;
|
||||
data['nationality'] = this.nationality;
|
||||
data['patientMRN'] = this.patientMRN;
|
||||
data['patientName'] = this.patientName;
|
||||
data['rowCount'] = this.rowCount;
|
||||
data['startTime'] = this.startTime;
|
||||
data['visitType'] = this.visitType;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
class PendingReferral {
|
||||
String responded;
|
||||
String answerFromTarget;
|
||||
String createdOn;
|
||||
int data;
|
||||
String editedOn;
|
||||
int interBranchReferral;
|
||||
int patientID;
|
||||
String patientName;
|
||||
int patientType;
|
||||
int referralNo;
|
||||
String referralStatus;
|
||||
String referredByDoctorInfo;
|
||||
String referredFromBranchName;
|
||||
String referredOn;
|
||||
String referredType;
|
||||
String remarksFromSource;
|
||||
String respondedOn;
|
||||
int sourceAppointmentNo;
|
||||
int sourceProjectId;
|
||||
String sourceSetupID;
|
||||
String startDate;
|
||||
int targetAppointmentNo;
|
||||
String targetClinicID;
|
||||
String targetDoctorID;
|
||||
int targetProjectId;
|
||||
String targetSetupID;
|
||||
bool isReferralDoctorSameBranch;
|
||||
|
||||
PendingReferral(
|
||||
{this.responded,
|
||||
this.answerFromTarget,
|
||||
this.createdOn,
|
||||
this.data,
|
||||
this.editedOn,
|
||||
this.interBranchReferral,
|
||||
this.patientID,
|
||||
this.patientName,
|
||||
this.patientType,
|
||||
this.referralNo,
|
||||
this.referralStatus,
|
||||
this.referredByDoctorInfo,
|
||||
this.referredFromBranchName,
|
||||
this.referredOn,
|
||||
this.referredType,
|
||||
this.remarksFromSource,
|
||||
this.respondedOn,
|
||||
this.sourceAppointmentNo,
|
||||
this.sourceProjectId,
|
||||
this.sourceSetupID,
|
||||
this.startDate,
|
||||
this.targetAppointmentNo,
|
||||
this.targetClinicID,
|
||||
this.targetDoctorID,
|
||||
this.targetProjectId,
|
||||
this.targetSetupID,
|
||||
this.isReferralDoctorSameBranch,
|
||||
});
|
||||
|
||||
PendingReferral.fromJson(Map<String, dynamic> json) {
|
||||
responded = json['Responded'];
|
||||
answerFromTarget = json['answerFromTarget'];
|
||||
createdOn = json['createdOn'];
|
||||
data = json['data'];
|
||||
editedOn = json['editedOn'];
|
||||
interBranchReferral = json['interBranchReferral'];
|
||||
patientID = json['patientID'];
|
||||
patientName = json['patientName'];
|
||||
patientType = json['patientType'];
|
||||
referralNo = json['referralNo'];
|
||||
referralStatus = json['referralStatus'];
|
||||
referredByDoctorInfo = json['referredByDoctorInfo'];
|
||||
referredFromBranchName = json['referredFromBranchName'];
|
||||
referredOn = json['referredOn'];
|
||||
referredType = json['referredType'];
|
||||
remarksFromSource = json['remarksFromSource'];
|
||||
respondedOn = json['respondedOn'];
|
||||
sourceAppointmentNo = json['sourceAppointmentNo'];
|
||||
sourceProjectId = json['sourceProjectId'];
|
||||
sourceSetupID = json['sourceSetupID'];
|
||||
startDate = json['startDate'];
|
||||
targetAppointmentNo = json['targetAppointmentNo'];
|
||||
targetClinicID = json['targetClinicID'];
|
||||
targetDoctorID = json['targetDoctorID'];
|
||||
targetProjectId = json['targetProjectId'];
|
||||
targetSetupID = json['targetSetupID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['Responded'] = this.responded;
|
||||
data['answerFromTarget'] = this.answerFromTarget;
|
||||
data['createdOn'] = this.createdOn;
|
||||
data['data'] = this.data;
|
||||
data['editedOn'] = this.editedOn;
|
||||
data['interBranchReferral'] = this.interBranchReferral;
|
||||
data['patientID'] = this.patientID;
|
||||
data['patientName'] = this.patientName;
|
||||
data['patientType'] = this.patientType;
|
||||
data['referralNo'] = this.referralNo;
|
||||
data['referralStatus'] = this.referralStatus;
|
||||
data['referredByDoctorInfo'] = this.referredByDoctorInfo;
|
||||
data['referredFromBranchName'] = this.referredFromBranchName;
|
||||
data['referredOn'] = this.referredOn;
|
||||
data['referredType'] = this.referredType;
|
||||
data['remarksFromSource'] = this.remarksFromSource;
|
||||
data['respondedOn'] = this.respondedOn;
|
||||
data['sourceAppointmentNo'] = this.sourceAppointmentNo;
|
||||
data['sourceProjectId'] = this.sourceProjectId;
|
||||
data['sourceSetupID'] = this.sourceSetupID;
|
||||
data['startDate'] = this.startDate;
|
||||
data['targetAppointmentNo'] = this.targetAppointmentNo;
|
||||
data['targetClinicID'] = this.targetClinicID;
|
||||
data['targetDoctorID'] = this.targetDoctorID;
|
||||
data['targetProjectId'] = this.targetProjectId;
|
||||
data['targetSetupID'] = this.targetSetupID;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.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:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyReferralDetailScreen extends StatelessWidget {
|
||||
PendingReferral pendingReferral;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
|
||||
|
||||
AuthViewModel authProvider = Provider.of(context);
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
pendingReferral = routeArgs['referral'];
|
||||
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referPatient,
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ProfileWelcomeWidget(
|
||||
AppText(
|
||||
authProvider.selectedClinicName != null
|
||||
? authProvider.selectedClinicName
|
||||
: authProvider.doctorProfile.clinicDescription,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
color: Colors.white,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
height: 100,
|
||||
),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: AppText(
|
||||
TranslationBase.of(context).myReferralPatient,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
PatientReferralItemWidget(
|
||||
patientName: pendingReferral.patientName,
|
||||
referralStatus: null,
|
||||
isReferredTo: false,
|
||||
isSameBranch: pendingReferral.isReferralDoctorSameBranch,
|
||||
referralDoctorName: pendingReferral.referredByDoctorInfo,
|
||||
clinicDescription: null,
|
||||
remark: pendingReferral.remarksFromSource,
|
||||
),
|
||||
SizedBox(
|
||||
child: GridView.count(
|
||||
childAspectRatio: 1.8,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 10,
|
||||
controller: new ScrollController(keepScrollOffset: false),
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
crossAxisCount: 2,
|
||||
children: [
|
||||
PatientProfileButton(
|
||||
key: key,
|
||||
// patient: patient,
|
||||
// route: RADIOLOGY,
|
||||
nameLine1: TranslationBase.of(context).previewHealth,
|
||||
nameLine2: TranslationBase.of(context).summaryReport,
|
||||
icon: 'radiology-1.png'),
|
||||
PatientProfileButton(
|
||||
key: key,
|
||||
// patient: patient,
|
||||
// route: LAB_ORDERS,
|
||||
nameLine1: TranslationBase.of(context).lab,
|
||||
nameLine2: TranslationBase.of(context).result,
|
||||
icon: 'lab.png'),
|
||||
PatientProfileButton(
|
||||
key: key,
|
||||
// patient: patient,
|
||||
// route: VITAL_SIGN_DETAILS,
|
||||
nameLine1: TranslationBase.of(context).vital,
|
||||
nameLine2: TranslationBase.of(context).signs,
|
||||
icon: 'heartbeat.png'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).accept,
|
||||
backgroundColor: Color(0xFF4BA821),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: null,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: BorderedButton(
|
||||
TranslationBase.of(context).reject,
|
||||
backgroundColor: Color(0xFFB9382C),
|
||||
textColor: Colors.white,
|
||||
fontSize: 16,
|
||||
hPadding: 8,
|
||||
vPadding: 12,
|
||||
handler: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.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:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../../routes.dart';
|
||||
|
||||
class MyReferralPatientScreen extends StatelessWidget {
|
||||
// previous design page is: MyReferralPatient
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AuthViewModel authProvider = Provider.of(context);
|
||||
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
onModelReady: (model) => model.getPendingReferralPatients(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referPatient,
|
||||
body: model.pendingReferral == null ||
|
||||
model.pendingReferral.length == 0
|
||||
? Center(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).errorNoSchedule,
|
||||
color: Theme.of(context).errorColor,
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ProfileWelcomeWidget(
|
||||
AppText(
|
||||
authProvider.selectedClinicName != null
|
||||
? authProvider.selectedClinicName
|
||||
: authProvider.doctorProfile.clinicDescription,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
color: Colors.white,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
height: 100,
|
||||
),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: AppText(
|
||||
TranslationBase.of(context).myReferralPatient,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
...List.generate(
|
||||
model.pendingReferral.length,
|
||||
(index) => PatientReferralItemWidget(
|
||||
patientName: model.pendingReferral[index].patientName,
|
||||
referralStatus: null,
|
||||
isReferredTo: false,
|
||||
isSameBranch: model.pendingReferral[index]
|
||||
.isReferralDoctorSameBranch,
|
||||
referralDoctorName:
|
||||
model.pendingReferral[index].referredByDoctorInfo,
|
||||
clinicDescription: null,
|
||||
remark:
|
||||
model.pendingReferral[index].remarksFromSource,
|
||||
infoIcon: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
MY_REFERRAL_DETAIL,
|
||||
arguments: {
|
||||
'referral': model.pendingReferral[index]
|
||||
});
|
||||
},
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
color: Colors.black,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,459 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.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/util/date-utils.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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/dialogs/dailog-list-select.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import '../../../QR_reader_screen.dart';
|
||||
|
||||
class PatientMakeReferralScreen extends StatefulWidget {
|
||||
// previous design page is: ReferPatientScreen
|
||||
@override
|
||||
_PatientMakeReferralScreenState createState() =>
|
||||
_PatientMakeReferralScreenState();
|
||||
}
|
||||
|
||||
class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
|
||||
PatiantInformtion patient;
|
||||
List<dynamic> referToList;
|
||||
dynamic _referTo;
|
||||
dynamic _selectedBranch;
|
||||
dynamic _selectedClinic;
|
||||
dynamic _selectedDoctor;
|
||||
DateTime appointmentDate;
|
||||
final _remarksController = TextEditingController();
|
||||
PatientArrivalEntity _selectedPatientArrivalEntity;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
referToList = List();
|
||||
dynamic sameBranch = {"id": 1, "name": "Same Branch"};
|
||||
dynamic otherBranch = {"id": 2, "name": "Other Branch"};
|
||||
referToList.add(sameBranch);
|
||||
referToList.add(otherBranch);
|
||||
appointmentDate = DateTime.now();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
patient = routeArgs['patient'];
|
||||
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
onModelReady: (model) => model.getBranches(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referPatient,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 75,
|
||||
child: AppText(
|
||||
"This is where upper view for avatar.. etc placed",
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xffCCCCCC),
|
||||
height: 1,
|
||||
thickness: 2,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context).referPatient,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: referToList != null
|
||||
? () {
|
||||
ListSelectDialog dialog =
|
||||
ListSelectDialog(
|
||||
list: referToList,
|
||||
attributeName: 'name',
|
||||
attributeValueId: 'id',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_referTo = selectedValue;
|
||||
_selectedBranch = null;
|
||||
_selectedClinic = null;
|
||||
_selectedDoctor = null;
|
||||
model
|
||||
.getDoctorBranch()
|
||||
.then((value) {
|
||||
_selectedBranch = value;
|
||||
if (_referTo['id'] == 1) {
|
||||
model.getClinics(
|
||||
_selectedBranch['ID']);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).referTo,
|
||||
_referTo != null ? _referTo['name'] : null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.branchesList != null &&
|
||||
model.branchesList.length > 0 &&
|
||||
_referTo != null &&
|
||||
_referTo['id'] == 2
|
||||
? () {
|
||||
ListSelectDialog dialog =
|
||||
ListSelectDialog(
|
||||
list: model.branchesList,
|
||||
attributeName: 'Desciption',
|
||||
attributeValueId: 'ID',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedBranch = selectedValue;
|
||||
_selectedClinic = null;
|
||||
_selectedDoctor = null;
|
||||
model.getClinics(
|
||||
_selectedBranch['ID']);
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).branch,
|
||||
_selectedBranch != null
|
||||
? _selectedBranch['Desciption']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: _selectedBranch != null &&
|
||||
model.clinicsList != null &&
|
||||
model.clinicsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog =
|
||||
ListSelectDialog(
|
||||
list: model.clinicsList,
|
||||
attributeName: 'ClinicDescription',
|
||||
attributeValueId: 'ClinicID',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedDoctor = null;
|
||||
_selectedClinic = selectedValue;
|
||||
model.getClinicDoctors(
|
||||
_selectedClinic['ClinicID']
|
||||
.toString());
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).clinic,
|
||||
_selectedClinic != null
|
||||
? _selectedClinic['ClinicDescription']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: _selectedClinic != null &&
|
||||
model.doctorsList != null &&
|
||||
model.doctorsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog =
|
||||
ListSelectDialog(
|
||||
list: model.doctorsList,
|
||||
attributeName: 'DoctorName',
|
||||
attributeValueId: 'DoctorID',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedDoctor = selectedValue;
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).doctor,
|
||||
_selectedDoctor != null
|
||||
? _selectedDoctor['DoctorName']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: () => _selectDate(context, model),
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context)
|
||||
.chooseAppointment,
|
||||
_selectedPatientArrivalEntity != null
|
||||
? "${TranslationBase.of(context).appointmentNo} ${_selectedPatientArrivalEntity.appointmentNo}"
|
||||
: null,
|
||||
true,
|
||||
suffixIcon: Icon(
|
||||
Icons.calendar_today,
|
||||
color: Colors.black,
|
||||
)),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).remarks,
|
||||
null,
|
||||
false),
|
||||
enabled: true,
|
||||
controller: _remarksController,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(ONLY_LETTERS))
|
||||
],
|
||||
keyboardType: TextInputType.text,
|
||||
minLines: 4,
|
||||
maxLines: 6,
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).refer,
|
||||
color: HexColor("#B8382B"),
|
||||
onPressed: () {
|
||||
if (_selectedPatientArrivalEntity == null ||
|
||||
_selectedBranch == null ||
|
||||
_selectedClinic == null ||
|
||||
_selectedDoctor == null ||
|
||||
_remarksController.text == null) return;
|
||||
model.makeReferral(
|
||||
_selectedPatientArrivalEntity,
|
||||
appointmentDate.toIso8601String(),
|
||||
_selectedBranch['ID'],
|
||||
_selectedClinic['ClinicID'],
|
||||
_selectedDoctor['DoctorID'],
|
||||
_remarksController.text).then((_) => Navigator.pop(context));
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_selectDate(BuildContext context, PatientReferralViewModel model) async {
|
||||
// https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference
|
||||
// https://stackoverflow.com/a/63147062/6246772 to customize a date picker
|
||||
final DateTime picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: appointmentDate,
|
||||
firstDate: appointmentDate.add(Duration(hours: 2)),
|
||||
lastDate: DateTime(2040),
|
||||
initialEntryMode: DatePickerEntryMode.calendar,
|
||||
);
|
||||
if (picked != null && picked != appointmentDate) {
|
||||
appointmentDate = picked;
|
||||
model
|
||||
.getPatientArrivalList(DateUtils.convertStringToDateFormat(
|
||||
appointmentDate.toString(), "yyyy-MM-dd"))
|
||||
.then((_) {
|
||||
if (model.patientArrivalList != null &&
|
||||
model.patientArrivalList.length > 0) {
|
||||
List<dynamic> appointments = model.getAppointmentsByPatientName(
|
||||
"${patient.firstName} ${patient.middleName} ${patient.lastName}");
|
||||
if (appointments.length > 0) {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: appointments,
|
||||
attributeName: 'appointmentNo',
|
||||
attributeValueId: 'appointmentNo',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedPatientArrivalEntity =
|
||||
PatientArrivalEntity.fromJson(selectedValue);
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
setState(() {
|
||||
_selectedPatientArrivalEntity = null;
|
||||
});
|
||||
DrAppToastMsg.showErrorToast(
|
||||
TranslationBase.of(context).noAppointmentsErrorMsg);
|
||||
}
|
||||
} else {
|
||||
setState(() {
|
||||
_selectedPatientArrivalEntity = null;
|
||||
});
|
||||
DrAppToastMsg.showErrorToast(
|
||||
TranslationBase.of(context).noAppointmentsErrorMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
InputDecoration textFieldSelectorDecoration(
|
||||
String hintText, String selectedText, bool isDropDown,
|
||||
{Icon suffixIcon}) {
|
||||
return InputDecoration(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
hintText: selectedText != null ? selectedText : hintText,
|
||||
suffixIcon: isDropDown
|
||||
? suffixIcon != null
|
||||
? suffixIcon
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: Colors.black,
|
||||
)
|
||||
: null,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
BoxDecoration containerBorderDecoration(
|
||||
Color containerColor, Color borderColor) {
|
||||
return BoxDecoration(
|
||||
color: containerColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: borderColor,
|
||||
width: 2.0,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.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:flutter/material.dart';
|
||||
|
||||
class ReferredPatientScreen extends StatelessWidget {
|
||||
// previous design page is: MyReferredPatient
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PatientReferralViewModel>(
|
||||
onModelReady: (model) => model.getMyReferredPatient(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referPatient,
|
||||
body: model.listMyReferredPatientModel == null ||
|
||||
model.listMyReferredPatientModel.length == 0
|
||||
? Center(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).errorNoSchedule,
|
||||
color: Theme.of(context).errorColor,
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 75,
|
||||
child: AppText(
|
||||
"This is where upper view for avatar.. etc placed",
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xffCCCCCC),
|
||||
height: 1,
|
||||
thickness: 2,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
...List.generate(
|
||||
model.listMyReferredPatientModel.length,
|
||||
(index) => PatientReferralItemWidget(
|
||||
patientName:
|
||||
"${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
|
||||
referralStatus:
|
||||
"${model.getReferredPatientItem(index).referralStatus}",
|
||||
isReferredTo: true,
|
||||
isSameBranch: model
|
||||
.getReferredPatientItem(index)
|
||||
.isReferralDoctorSameBranch,
|
||||
referralDoctorName: model
|
||||
.getReferredPatientItem(index)
|
||||
.referralDoctorName,
|
||||
clinicDescription: model
|
||||
.getReferredPatientItem(index)
|
||||
.referralClinicDescription,
|
||||
remark: model
|
||||
.getReferredPatientItem(index)
|
||||
.referringDoctorRemarks,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PatientReferralItemWidget extends StatelessWidget {
|
||||
final String patientName;
|
||||
final String referralStatus;
|
||||
final isReferredTo;
|
||||
final isSameBranch;
|
||||
final String referralDoctorName;
|
||||
final String clinicDescription;
|
||||
final String remark;
|
||||
final Widget infoIcon;
|
||||
|
||||
PatientReferralItemWidget({
|
||||
this.patientName,
|
||||
this.referralStatus,
|
||||
this.isReferredTo = false,
|
||||
this.isSameBranch,
|
||||
this.referralDoctorName,
|
||||
this.clinicDescription,
|
||||
this.remark,
|
||||
this.infoIcon,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: AppText(
|
||||
patientName,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
if (referralStatus != null)
|
||||
Container(
|
||||
color: Color(0xFF4BA821),
|
||||
padding: EdgeInsets.all(4),
|
||||
child: AppText(
|
||||
referralStatus == "46"
|
||||
? TranslationBase.of(context).approved
|
||||
: TranslationBase.of(context).rejected,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
AppText(
|
||||
isReferredTo
|
||||
? "${TranslationBase.of(context).referTo}: "
|
||||
: "${TranslationBase.of(context).referredFrom}: ",
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
AppText(
|
||||
isSameBranch
|
||||
? TranslationBase.of(context).sameBranch
|
||||
: TranslationBase.of(context).otherBranch,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).dr} $referralDoctorName",
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
if (clinicDescription != null)
|
||||
Row(
|
||||
children: [
|
||||
AppText(
|
||||
"${TranslationBase.of(context).clinic}: ",
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
AppText(
|
||||
clinicDescription,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
AppText(
|
||||
remark,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (infoIcon != null) infoIcon,
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: Color(0xffCCCCCC),
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
indent: 0,
|
||||
endIndent: 0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PatientProfileButton extends StatelessWidget {
|
||||
final String nameLine1;
|
||||
final String nameLine2;
|
||||
final String icon;
|
||||
final dynamic route;
|
||||
final PatiantInformtion patient;
|
||||
final String url = "assets/images/";
|
||||
PatientProfileButton(
|
||||
{Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route})
|
||||
: super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
margin: new EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
navigator(context, this.route);
|
||||
},
|
||||
child: Column(children: <Widget>[
|
||||
Container(
|
||||
alignment: Alignment.topLeft,
|
||||
padding: EdgeInsets.all(5),
|
||||
child:
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
this.nameLine1,
|
||||
color: Color(0xFFB9382C),
|
||||
fontWeight: FontWeight.w600,
|
||||
textAlign: TextAlign.left,
|
||||
fontSize: SizeConfig.textMultiplier * 2,
|
||||
),
|
||||
AppText(
|
||||
this.nameLine2,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
textAlign: TextAlign.left,
|
||||
fontSize: SizeConfig.textMultiplier * 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: new Image.asset(url + icon))
|
||||
],
|
||||
)),
|
||||
)
|
||||
]),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
// border: Border.all(),
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: Color(0xffBBBBBB),
|
||||
width: 1,
|
||||
)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
offset: Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(5, 10, 5, 5),
|
||||
);
|
||||
}
|
||||
|
||||
void navigator(BuildContext context, route) {
|
||||
Navigator.of(context).pushNamed(route, arguments: {'patient': patient});
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ProfileWelcomeWidget extends StatelessWidget {
|
||||
|
||||
final Widget clinicWidget;
|
||||
final double height;
|
||||
|
||||
ProfileWelcomeWidget(this.clinicWidget, {this.height = 140});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AuthViewModel authProvider = Provider.of(context);
|
||||
|
||||
return Container(
|
||||
height: height,
|
||||
color: HexColor('#515B5D'),
|
||||
width: double.infinity,
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 0.9,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
TranslationBase.of(context).welcome,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
color: Colors.white,
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
'Dr. ${authProvider.doctorProfile.doctorName}',
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: SizeConfig.textMultiplier * 2.5,
|
||||
color: Colors.white,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
clinicWidget,
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
height: 50,
|
||||
width: 60,
|
||||
child: Image.network(
|
||||
authProvider.doctorProfile.doctorImageURL,
|
||||
// fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BorderedButton extends StatelessWidget {
|
||||
final String text;
|
||||
final Function handler;
|
||||
final Color textColor;
|
||||
final bool hasBorder;
|
||||
final Color borderColor;
|
||||
final Color backgroundColor;
|
||||
final double vPadding;
|
||||
final double hPadding;
|
||||
final double radius;
|
||||
final double lPadding;
|
||||
final double tPadding;
|
||||
final double rPadding;
|
||||
final double bPadding;
|
||||
final double fontSize;
|
||||
final Widget icon;
|
||||
final FontWeight fontWeight;
|
||||
|
||||
BorderedButton(
|
||||
this.text, {
|
||||
this.handler,
|
||||
this.textColor,
|
||||
this.hasBorder = false,
|
||||
this.borderColor,
|
||||
this.backgroundColor,
|
||||
this.vPadding = 0,
|
||||
this.hPadding = 0,
|
||||
this.radius = 4.0,
|
||||
this.lPadding = 4.0,
|
||||
this.tPadding = 0.0,
|
||||
this.rPadding = 4.0,
|
||||
this.bPadding = 0.0,
|
||||
this.fontSize = 0,
|
||||
this.icon,
|
||||
this.fontWeight,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
handler();
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: backgroundColor ?? Colors.white,
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: hasBorder ? borderColor : Colors.white,
|
||||
width: 0.8,
|
||||
)),
|
||||
),
|
||||
child: Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon != null ? icon : Container(),
|
||||
Container(
|
||||
padding: (hPadding > 0 || vPadding > 0)
|
||||
? EdgeInsets.symmetric(
|
||||
vertical: vPadding, horizontal: hPadding)
|
||||
: EdgeInsets.fromLTRB(
|
||||
lPadding, tPadding, rPadding, bPadding),
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize,
|
||||
fontWeight: fontWeight != null ? fontWeight : FontWeight.normal,
|
||||
color: textColor ?? Color(0xffc4aa54)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue