working on patient reservation feature

feature_reservation
mosazaid 4 years ago
parent 7436cdb5be
commit f7b52c2f74

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";
@ -242,6 +242,8 @@ const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/Docto
const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL";
const GET_MEDICATION_FOR_IN_PATIENT = "Services/DoctorApplication.svc/REST/Doctor_GetMedicationForInpatient";
const GET_EPISODE_FOR_INPATIENT = "/Services/DoctorApplication.svc/REST/DoctorApp_GetEpisodeForInpatient";
const GET_RESERVATION_DETAIL = "/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails";
const CREATE_UPDATE_OPERATION_REPORT = "/Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport";
var selectedPatientType = 1;

@ -629,6 +629,7 @@ const Map<String, Map<String, String>> localizedValues = {
"orderTestOr": {"en": "Order Test or", "ar": "اطلب اختبار أو"},
"applyForRadiologyOrder": {"en": "Apply for Radiology Order", "ar": "التقدم بطلب للحصول على طلب الأشعة "},
"applyForNewLabOrder": {"en": "Apply for New Lab Order", "ar": "تقدم بطلب جديد للمختبر الأشعة"},
"applyForNewOperationReport": {"en": "Apply for New Operation Report", "ar": "تقدم بطلب جديد لتقرير العملية"},
"addLabOrder": {"en": "Add Lab Order", "ar": "إضافة طلب مختبر"},
"addRadiologyOrder": {"en": "Add Radiology Order", "ar": "إضافة اشعة"},
"newRadiologyOrder": {"en": "New Radiology Order", "ar": "طلب أشعة جديد"},
@ -709,5 +710,6 @@ const Map<String, Map<String, String>> localizedValues = {
"en":"Request Type",
"ar":"نوع الطلب"},
"special": {"en": "Special", "ar": "خاص"},
"allClinic": {"en": "All Clinics", "ar": "جميع العيادات"}
"allClinic": {"en": "All Clinics", "ar": "جميع العيادات"},
"reservation": {"en": "Reservation", "ar": "حجز"}
};

@ -0,0 +1,38 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/reservation/ReservationDetails.dart';
class ReservationService extends BaseService {
List<ReservationDetails> reservationDetailsList;
Future getPatientReservationDetails(PatiantInformtion patient) async {
hasError = false;
Map<String, dynamic> body = Map();
await getDoctorProfile();
body['ProjectID'] = doctorProfile.projectID;
body['DoctorID'] = doctorProfile.doctorID;
body['ClinicID'] = doctorProfile.clinicID;
body['TokenID'] = "@dm!n";
await baseAppClient.postPatient(GET_RESERVATION_DETAIL,
onSuccess: (dynamic response, int statusCode) {
print("Success");
if (reservationDetailsList != null) {
reservationDetailsList.clear();
} else {
reservationDetailsList = new List();
}
response['List_OTReservationDetails'].forEach((v) {
reservationDetailsList.add(ReservationDetails.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, patient: patient, body: body);
}
}

@ -49,21 +49,6 @@ class BaseViewModel extends ChangeNotifier {
}
}
void getIsolateDoctorProfile(bool isGetProfile) async {
if (isGetProfile) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
}
}
if (doctorProfile == null) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
}
}
}
setDoctorProfile(DoctorProfileModel doctorProfile) async {
await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile);
this.doctorProfile = doctorProfile;

@ -0,0 +1,25 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/ReservationService.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/reservation/ReservationDetails.dart';
import '../../locator.dart';
class ReservationViewModel extends BaseViewModel {
ReservationService _service = locator<ReservationService>();
List<ReservationDetails> get reservationDetailsList =>
_service.reservationDetailsList;
Future getPatientReservationDetails(PatiantInformtion patient) async {
setState(ViewState.Busy);
await _service.getPatientReservationDetails(patient);
if (_service.hasError) {
error = _service.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}

@ -1,11 +1,13 @@
import 'package:doctor_app_flutter/core/service/authentication_service.dart';
import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/ReservationService.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.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/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/viewModel/reservationViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart';
import 'package:get_it/get_it.dart';
@ -100,6 +102,7 @@ void setupLocator() {
locator.registerLazySingleton(() => SpecialClinicsService());
locator.registerLazySingleton(() => VideoCallService());
locator.registerLazySingleton(() => AnalyticsService());
locator.registerLazySingleton(() => ReservationService());
/// View Model
locator.registerFactory(() => DoctorReplayViewModel());
@ -128,4 +131,5 @@ void setupLocator() {
locator.registerFactory(() => LiveCarePatientViewModel());
locator.registerFactory(() => PatientMedicalReportViewModel());
locator.registerFactory(() => ScanQrViewModel());
locator.registerFactory(() => ReservationViewModel());
}

@ -0,0 +1,152 @@
class ReservationDetails {
String setupID;
int projectID;
int oTReservationID;
String oTReservationDate;
String oTReservationDateN;
int oTID;
int admissionRequestNo;
int admissionNo;
int primaryDoctorID;
int patientType;
int patientID;
int patientStatusType;
int clinicID;
int doctorID;
String operationDate;
int operationType;
String endDate;
String timeStart;
String timeEnd;
String remarks;
int status;
int createdBy;
String createdOn;
int editedBy;
String editedOn;
String patientName;
String patientNameN;
String gender;
String dateofBirth;
String mobileNumber;
String emailAddress;
String doctorName;
String doctorNameN;
String clinicDescription;
String clinicDescriptionN;
ReservationDetails(
{this.setupID,
this.projectID,
this.oTReservationID,
this.oTReservationDate,
this.oTReservationDateN,
this.oTID,
this.admissionRequestNo,
this.admissionNo,
this.primaryDoctorID,
this.patientType,
this.patientID,
this.patientStatusType,
this.clinicID,
this.doctorID,
this.operationDate,
this.operationType,
this.endDate,
this.timeStart,
this.timeEnd,
this.remarks,
this.status,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.patientName,
this.patientNameN,
this.gender,
this.dateofBirth,
this.mobileNumber,
this.emailAddress,
this.doctorName,
this.doctorNameN,
this.clinicDescription,
this.clinicDescriptionN});
ReservationDetails.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
oTReservationID = json['OTReservationID'];
oTReservationDate = json['OTReservationDate'];
oTReservationDateN = json['OTReservationDateN'];
oTID = json['OTID'];
admissionRequestNo = json['AdmissionRequestNo'];
admissionNo = json['AdmissionNo'];
primaryDoctorID = json['PrimaryDoctorID'];
patientType = json['PatientType'];
patientID = json['PatientID'];
patientStatusType = json['PatientStatusType'];
clinicID = json['ClinicID'];
doctorID = json['DoctorID'];
operationDate = json['OperationDate'];
operationType = json['OperationType'];
endDate = json['EndDate'];
timeStart = json['TimeStart'];
timeEnd = json['TimeEnd'];
remarks = json['Remarks'];
status = json['Status'];
createdBy = json['CreatedBy'];
createdOn = json['CreatedOn'];
editedBy = json['EditedBy'];
editedOn = json['EditedOn'];
patientName = json['PatientName'];
patientNameN = json['PatientNameN'];
gender = json['Gender'];
dateofBirth = json['DateofBirth'];
mobileNumber = json['MobileNumber'];
emailAddress = json['EmailAddress'];
doctorName = json['DoctorName'];
doctorNameN = json['DoctorNameN'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ProjectID'] = this.projectID;
data['OTReservationID'] = this.oTReservationID;
data['OTReservationDate'] = this.oTReservationDate;
data['OTReservationDateN'] = this.oTReservationDateN;
data['OTID'] = this.oTID;
data['AdmissionRequestNo'] = this.admissionRequestNo;
data['AdmissionNo'] = this.admissionNo;
data['PrimaryDoctorID'] = this.primaryDoctorID;
data['PatientType'] = this.patientType;
data['PatientID'] = this.patientID;
data['PatientStatusType'] = this.patientStatusType;
data['ClinicID'] = this.clinicID;
data['DoctorID'] = this.doctorID;
data['OperationDate'] = this.operationDate;
data['OperationType'] = this.operationType;
data['EndDate'] = this.endDate;
data['TimeStart'] = this.timeStart;
data['TimeEnd'] = this.timeEnd;
data['Remarks'] = this.remarks;
data['Status'] = this.status;
data['CreatedBy'] = this.createdBy;
data['CreatedOn'] = this.createdOn;
data['EditedBy'] = this.editedBy;
data['EditedOn'] = this.editedOn;
data['PatientName'] = this.patientName;
data['PatientNameN'] = this.patientNameN;
data['Gender'] = this.gender;
data['DateofBirth'] = this.dateofBirth;
data['MobileNumber'] = this.mobileNumber;
data['EmailAddress'] = this.emailAddress;
data['DoctorName'] = this.doctorName;
data['DoctorNameN'] = this.doctorNameN;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
return data;
}
}

@ -13,6 +13,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_s
import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/refer-patient-screen-in-patient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/reservation/PatientReservationPage.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/update_soap_index.dart';
import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart';
import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart';
@ -66,6 +67,7 @@ const String ORDER_PROCEDURE = 'procedure/procedure';
const String ADD_SICKLEAVE = 'add-sickleave';
const String RADIOLOGY_PATIENT = 'radiology-patient';
const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab';
const String PATIENT_RESERVATION = 'patient-reservation';
//todo: change the routing way.
var routes = {
@ -109,4 +111,5 @@ var routes = {
// PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(),
PATIENT_ECG: (_) => ECGPage(),
ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(),
PATIENT_RESERVATION: (_) => PatientReservationPage(),
};

@ -86,6 +86,13 @@ class ProfileGridForInPatient extends StatelessWidget {
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).reservation,
PATIENT_RESERVATION,
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
),
];
return Padding(

@ -87,6 +87,13 @@ class ProfileGridForOther extends StatelessWidget {
isDisable: isFromLiveCare
? patient.appointmentNo == null
: patient.patientStatusType != 43 || patient.appointmentNo == null),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).reservation,
PATIENT_RESERVATION,
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
),
];
return Column(

@ -64,6 +64,13 @@ class ProfileGridForSearch extends StatelessWidget {
PatientProfileCardModel(TranslationBase.of(context).admission, TranslationBase.of(context).request,
PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png',
isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false),
PatientProfileCardModel(
TranslationBase.of(context).patient,
TranslationBase.of(context).reservation,
PATIENT_RESERVATION,
'patient/patient_sick_leave.png',
isInPatient: isInpatient,
),
];
return Column(

@ -0,0 +1,139 @@
import 'package:doctor_app_flutter/core/viewModel/reservationViewModel.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/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.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/doctor_card.dart';
import 'package:flutter/material.dart';
class PatientReservationPage extends StatelessWidget {
const PatientReservationPage() : super();
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
return BaseView<ReservationViewModel>(
onModelReady: (model) => model.getPatientReservationDetails(patient),
builder: (_, model, widget) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileAppBar(patient),
appBarTitle: TranslationBase.of(context).reservation,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).patient,
style: "caption2",
color: Colors.black,
fontSize: 13,
),
AppText(
TranslationBase.of(context).reservation,
bold: true,
fontSize: 22,
),
],
),
),
AddNewOrder(
onTap: () {
/* Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BaseAddProcedureTabPage(
patient: patient,
model: model,
procedureType: ProcedureType.LAB_RESULT,
),
settings: RouteSettings(name: 'AddProcedureTabPage'),
),
);*/
},
label: TranslationBase.of(context).applyForNewOperationReport,
),
if (model.reservationDetailsList != null &&
model.reservationDetailsList.length > 0)
ListView.builder(
itemCount: model.reservationDetailsList.length,
scrollDirection: Axis.vertical,
physics: ScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(
width: 0.5,
color: Colors.white,
),
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
color: Colors.white),
child: DoctorCard(
isNoMargin: true,
// onTap: () => Navigator.push(
// context,
// FadePage(
// page: LaboratoryResultPage(
// patientLabOrders: model.patientLabOrdersList[index],
// patient: patient,
// isInpatient: isInpatient,
// arrivalType: arrivalType,
// patientType: patientType,
// ),
// ),
// ),
doctorName: model.reservationDetailsList[index].doctorName,
invoiceNO: ' ${model.reservationDetailsList[index].oTReservationID}',
profileUrl: '',
branch: '',
clinic: model.reservationDetailsList[index].clinicDescription,
appointmentDate: AppDateUtils.convertStringToDate(model.reservationDetailsList[index].oTReservationDate),
orderNo: "${model.reservationDetailsList[index].admissionRequestNo}",
isShowTime: false,
),
);
},
)
else
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
Image.asset('assets/images/no-data.png'),
Padding(
padding: const EdgeInsets.all(8.0),
child: AppText('No Reservation Found'),
)
],
),
),
],
),
),
),
);
}
}

@ -1029,6 +1029,7 @@ class TranslationBase {
String get orderTestOr => localizedValues["orderTestOr"][locale.languageCode];
String get applyForRadiologyOrder => localizedValues["applyForRadiologyOrder"][locale.languageCode];
String get applyForNewLabOrder => localizedValues["applyForNewLabOrder"][locale.languageCode];
String get applyForNewOperationReport => localizedValues["applyForNewOperationReport"][locale.languageCode];
String get addLabOrder => localizedValues["addLabOrder"][locale.languageCode];
String get addRadiologyOrder => localizedValues["addRadiologyOrder"][locale.languageCode];
String get newRadiologyOrder => localizedValues["newRadiologyOrder"][locale.languageCode];
@ -1105,6 +1106,7 @@ class TranslationBase {
String get requestType => localizedValues['requestType'][locale.languageCode];
String get allClinic => localizedValues['allClinic'][locale.languageCode];
String get notReplied => localizedValues['notReplied'][locale.languageCode];
String get reservation => localizedValues['reservation'][locale.languageCode];
}

Loading…
Cancel
Save