working on patient reservation feature
parent
7436cdb5be
commit
f7b52c2f74
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue