done medical report

merge-update-with-lab-changes
Mohammad Aljammal 6 years ago
parent b6319c558c
commit f6d30178bf

@ -47,6 +47,7 @@ const GET_PATIENT_VITAL_SIGN = '/Doctors.svc/REST/Doctor_GetPatientVitalSign';
///Reports ///Reports
const REPORTS = '/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const REPORTS = '/Doctors.svc/REST/GetPatientMedicalReportStatusInfo';
const INSERT_REQUEST_FOR_MEDICAL_REPORT = '/Doctors.svc/REST/InsertRequestForMedicalReport';
//const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment //const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class Reports { class Reports {
int status; int status;
DateTime encounterDate; DateTime encounterDate;
@ -31,37 +32,38 @@ class Reports {
Reports( Reports(
{this.status, {this.status,
this.encounterDate, this.encounterDate,
this.projectID, this.projectID,
this.invoiceNo, this.invoiceNo,
this.encounterNo, this.encounterNo,
this.procedureId, this.procedureId,
this.requestType, this.requestType,
this.setupId, this.setupId,
this.patientID, this.patientID,
this.doctorID, this.doctorID,
this.clinicID, this.clinicID,
this.requestDate, this.requestDate,
this.isRead, this.isRead,
this.isReadOn, this.isReadOn,
this.actualDoctorRate, this.actualDoctorRate,
this.clinicDescription, this.clinicDescription,
this.clinicDescriptionN, this.clinicDescriptionN,
this.docName, this.docName,
this.docNameN, this.docNameN,
this.doctorImageURL, this.doctorImageURL,
this.doctorName, this.doctorName,
this.doctorNameN, this.doctorNameN,
this.doctorRate, this.doctorRate,
this.isDoctorAllowVedioCall, this.isDoctorAllowVedioCall,
this.isExecludeDoctor, this.isExecludeDoctor,
this.noOfPatientsRate, this.noOfPatientsRate,
this.projectName, this.projectName,
this.projectNameN}); this.projectNameN});
Reports.fromJson(Map<String, dynamic> json) { Reports.fromJson(Map<String, dynamic> json) {
status = json['Status']; status = json['Status'];
encounterDate = DateUtil.convertStringToDate(json['EncounterDate']);//json['EncounterDate']; encounterDate = DateUtil.convertStringToDate(
json['EncounterDate']); //json['EncounterDate'];
projectID = json['ProjectID']; projectID = json['ProjectID'];
invoiceNo = json['InvoiceNo']; invoiceNo = json['InvoiceNo'];
encounterNo = json['EncounterNo']; encounterNo = json['EncounterNo'];
@ -71,9 +73,11 @@ class Reports {
patientID = json['PatientID']; patientID = json['PatientID'];
doctorID = json['DoctorID']; doctorID = json['DoctorID'];
clinicID = json['ClinicID']; clinicID = json['ClinicID'];
requestDate = DateUtil.convertStringToDate(json['RequestDate']);//json['RequestDate']; requestDate = DateUtil.convertStringToDate(
json['RequestDate']); //json['RequestDate'];
isRead = json['IsRead']; isRead = json['IsRead'];
isReadOn =DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; isReadOn =
DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn'];
actualDoctorRate = json['ActualDoctorRate']; actualDoctorRate = json['ActualDoctorRate'];
clinicDescription = json['ClinicDescription']; clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN']; clinicDescriptionN = json['ClinicDescriptionN'];
@ -124,14 +128,12 @@ class Reports {
} }
} }
class ReportsList {
String filterName = "";
List<Reports> reportsList = List();
class ReportsList{ ReportsList({this.filterName, Reports reports}) {
String filterName="";
// int filterName=1;
List<Reports>reportsList=List();
ReportsList({this.filterName,Reports reports}){
reportsList.add(reports); reportsList.add(reports);
} }
} }

@ -0,0 +1,76 @@
class RequestReportHistory {
int projectID;
int clinicID;
bool isForMedicalReport;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
int patientID;
String tokenID;
int patientTypeID;
int patientType;
RequestReportHistory(
{this.projectID,
this.clinicID,
this.isForMedicalReport,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.patientTypeID,
this.patientType});
RequestReportHistory.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
clinicID = json['ClinicID'];
isForMedicalReport = json['IsForMedicalReport'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID;
data['IsForMedicalReport'] = this.isForMedicalReport;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['PatientID'] = this.patientID;
data['TokenID'] = this.tokenID;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
return data;
}
}

@ -2,21 +2,20 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; import 'package:diplomaticquarterapp/core/model/reports/Reports.dart';
import 'package:diplomaticquarterapp/core/model/reports/request_reports.dart'; import 'package:diplomaticquarterapp/core/model/reports/request_reports.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart';
class ReportsService extends BaseService {
class ReportsService extends BaseService{
List<Reports> reportsList = List(); List<Reports> reportsList = List();
List<AppointmentHistory> appointHistoryList = List();
RequestReports _requestReports=RequestReports( RequestReports _requestReports = RequestReports(
isReport: true, isReport: true,
encounterType: 1, encounterType: 1,
requestType: 1, requestType: 1,
versionID: 5.5, versionID: 5.5,
channel: 3, channel: 3,
languageID: 2, languageID: 2,
iPAdress: "10.20.10.20", iPAdress: "10.20.10.20",
generalid: 'Cs2020@2016\$2958', generalid: 'Cs2020@2016\$2958',
patientOutSA: 0, patientOutSA: 0,
sessionID: 'KIbLoqkytuKJEWECHQ', sessionID: 'KIbLoqkytuKJEWECHQ',
@ -25,42 +24,60 @@ class ReportsService extends BaseService{
patientID: 1231755, patientID: 1231755,
tokenID: '@dm!n', tokenID: '@dm!n',
patientTypeID: 1, patientTypeID: 1,
patientType: 1 patientType: 1);
);
Future getReports() async {
hasError = false;
await baseAppClient.post(REPORTS,
onSuccess: (dynamic response, int statusCode)
{
reportsList.clear();
response['GetPatientMedicalStatus'].forEach((reports) {
reportsList.add(Reports.fromJson(reports));
});
},onFailure: (String error,int statusCode){
hasError = true;
super.error = error;
},body: _requestReports.toJson());
}
Future getReports() async {
hasError = false;
await baseAppClient.post(REPORTS,
onSuccess: (dynamic response, int statusCode) {
reportsList.clear();
response['GetPatientMedicalStatus'].forEach((reports) {
reportsList.add(Reports.fromJson(reports));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestReports.toJson());
}
// Future getPrescriptions() async { Future getPatentAppointmentHistory() async {
// hasError = false; hasError = false;
// await baseAppClient.post(PRESCRIPTIONS, Map<String, dynamic> body = new Map<String, dynamic>();
// onSuccess: (dynamic response, int statusCode) { body['IsForMedicalReport'] = true;
// prescriptionsList.clear(); await baseAppClient.post(GET_PATIENT_AppointmentHistory,
// response['PatientPrescriptionList'].forEach((prescriptions) { onSuccess: (dynamic response, int statusCode) {
// prescriptionsList.add(Prescriptions.fromJson(prescriptions)); appointHistoryList = [];
// }); response['AppoimentAllHistoryResultList'].forEach((appoint) {
// }, onFailure: (String error, int statusCode) { appointHistoryList.add(AppointmentHistory.fromJson(appoint));
// hasError = true; });
// super.error = error; }, onFailure: (String error, int statusCode) {
// }, body: _requestPrescriptions.toJson()); hasError = true;
// } super.error = error;
}, body: body);
}
} Future insertRequestForMedicalReport(
AppointmentHistory appointmentHistory) async {
Map<String, dynamic> body = new Map<String, dynamic>();
body['ClinicID'] = appointmentHistory.clinicID;
body['DoctorID'] = appointmentHistory.doctorID;
body['SetupID'] = appointmentHistory.setupID;
body['EncounterNo'] = appointmentHistory.appointmentNo;
body['EncounterType'] = 1;// appointmentHistory.appointmentType;
body['IsActive'] = appointmentHistory.isActiveDoctor;
body['ProjectID'] = appointmentHistory.projectID;
body['Remarks'] = "";
body['ProcedureId'] = "";
body['RequestType'] = 1;
body['Source'] = 2;
body['Status'] = 1;
body['CreatedBy'] = 102;
hasError = false;
await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT,
onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -125,7 +125,7 @@ class PrescriptionsViewModel extends BaseViewModel {
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
AppToast.showSuccessToast(message: error); AppToast.showErrorToast(message: error);
} else { } else {
AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail');
setState(ViewState.Idle); setState(ViewState.Idle);

@ -1,15 +1,10 @@
//import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../core/enum/reportfilter_type.dart'; import '../../../core/enum/reportfilter_type.dart';
import '../../../core/enum/viewstate.dart'; import '../../../core/enum/viewstate.dart';
//import '../../../core/model/prescriptions/Prescriptions.dart';
import '../../../core/model/reports/Reports.dart'; import '../../../core/model/reports/Reports.dart';
//import '../../../core/service/medical/prescriptions_service.dart';
import '../../../core/service/medical/reports_service.dart'; import '../../../core/service/medical/reports_service.dart';
import '../../../locator.dart'; import '../../../locator.dart';
import '../base_view_model.dart'; import '../base_view_model.dart';
@ -18,35 +13,20 @@ class ReportsViewModel extends BaseViewModel {
ReportsService _reportsService = locator<ReportsService>(); ReportsService _reportsService = locator<ReportsService>();
List<ReportsList> _reportsOrderRequestList = List(); List<Reports> reportsOrderRequestList = List();
List<ReportsList> _reportsOrderReadyList = List(); List<Reports> reportsOrderReadyList = List();
List<ReportsList> _reportsOrderCompletedList = List(); List<Reports> reportsOrderCompletedList = List();
List<ReportsList> _reportsOrderCanceledList = List(); List<Reports> reportsOrderCanceledList = List();
List<Reports> get reportsList => _reportsService.reportsList;
///// List<AppointmentHistory> get appointHistoryList =>
List<ReportsList> get reportsOrderList { _reportsService.appointHistoryList;
switch (filterType) {
case ReportFilterType.Requested:
return _reportsOrderRequestList;
break;
case ReportFilterType.Ready:
return _reportsOrderReadyList;
break;
case ReportFilterType.Completed:
return _reportsOrderCompletedList;
break;
default:
return _reportsOrderCanceledList;
}
}
getReports() async { getReports() async {
setState(ViewState.Busy); setState(ViewState.Busy);
reportsOrderRequestList.clear();
reportsOrderReadyList.clear();
reportsOrderCompletedList.clear();
reportsOrderCanceledList.clear();
await _reportsService.getReports(); await _reportsService.getReports();
if (_reportsService.hasError) { if (_reportsService.hasError) {
error = _reportsService.error; error = _reportsService.error;
@ -57,71 +37,48 @@ class ReportsViewModel extends BaseViewModel {
} }
} }
//////////////////////// getPatentAppointmentHistory() async {
void _filterList() { setState(ViewState.Busy);
_reportsService.reportsList.forEach((element) { await _reportsService.getPatentAppointmentHistory();
/// ReportsList list sort Request if (_reportsService.hasError) {
List<ReportsList> reportsByRequest = _reportsOrderRequestList error = _reportsService.error;
.where((elementStatus) => elementStatus.filterName == element.status) setState(ViewState.Error);
.toList(); } else {
setState(ViewState.Idle);
if (reportsByRequest.length != 0) { }
_reportsOrderRequestList[ }
_reportsOrderRequestList.indexOf(reportsByRequest[0])]
.reportsList
.add(element);
} else {
_reportsOrderRequestList.add(ReportsList(
filterName: element.clinicDescription, reports: element));
}
////////
/// ReportsList list sort Ready
List<ReportsList> reportsByReady = _reportsOrderReadyList
.where((elementStatus) => elementStatus.filterName == element.status)
.toList();
if (reportsByReady.length != 0) {
_reportsOrderReadyList[
_reportsOrderReadyList.indexOf(reportsByReady[0])]
.reportsList
.add(element);
} else {
_reportsOrderReadyList.add(ReportsList(
filterName: element.clinicDescription, reports: element));
}
/// ReportsList list sort Compleated
List<ReportsList> reportsByCompleated = _reportsOrderCompletedList
.where((elementStatus) => elementStatus.filterName == element.status)
.toList();
if (reportsByCompleated.length != 0) {
_reportsOrderCompletedList[
_reportsOrderCompletedList.indexOf(reportsByCompleated[0])]
.reportsList
.add(element);
} else {
_reportsOrderCompletedList.add(ReportsList(
filterName: element.clinicDescription, reports: element));
}
/// ReportsList list sort Cancelled
List<ReportsList> reportsByCancelled = _reportsOrderCanceledList
.where((elementStatus) => elementStatus.filterName == element.status)
.toList();
if (reportsByCancelled.length != 0) { void _filterList() {
_reportsOrderCanceledList[ _reportsService.reportsList.forEach((report) {
_reportsOrderCanceledList.indexOf(reportsByCompleated[0])] switch (report.status) {
.reportsList case 1:
.add(element); reportsOrderRequestList.add(report);
} else { break;
_reportsOrderCanceledList.add(ReportsList( case 2:
filterName: element.clinicDescription, reports: element)); reportsOrderReadyList.add(report);
break;
case 3:
reportsOrderCompletedList.add(report);
break;
case 4:
reportsOrderCanceledList.add(report);
break;
default:
} }
//****************************
}); });
} }
///////////////////////
insertRequestForMedicalReport(AppointmentHistory appointmentHistory)async{
setState(ViewState.Busy);
await _reportsService.insertRequestForMedicalReport(appointmentHistory);
if (_reportsService.hasError) {
error = _reportsService.error;
AppToast.showErrorToast(message: error);
setState(ViewState.ErrorLocal);
} else {
AppToast.showSuccessToast(message: 'The order was send ');
setState(ViewState.Idle);
}
}
} }

@ -25,7 +25,7 @@ class AppointmentHistory {
int confirmedBy; int confirmedBy;
String confirmedOn; String confirmedOn;
int arrivalChangedBy; int arrivalChangedBy;
String arrivedOn; DateTime arrivedOn;
Null editedBy; Null editedBy;
Null editedOn; Null editedOn;
Null doctorName; Null doctorName;
@ -159,7 +159,7 @@ class AppointmentHistory {
confirmedBy = json['ConfirmedBy']; confirmedBy = json['ConfirmedBy'];
confirmedOn = json['ConfirmedOn']; confirmedOn = json['ConfirmedOn'];
arrivalChangedBy = json['ArrivalChangedBy']; arrivalChangedBy = json['ArrivalChangedBy'];
arrivedOn = json['ArrivedOn']; arrivedOn = DateUtil.convertStringToDate(json['ArrivedOn']);
editedBy = json['EditedBy']; editedBy = json['EditedBy'];
editedOn = json['EditedOn']; editedOn = json['EditedOn'];
doctorName = json['DoctorName']; doctorName = json['DoctorName'];

@ -249,10 +249,10 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
Expanded( Expanded(
flex: 1, flex: 1,
child: InkWell( child: InkWell(
// onTap: () { onTap: () {
// Navigator.push( Navigator.push(
// context, FadePage(page: InsuranceApproval())); context, FadePage(page: HomeReportPage()));
// }, },
child: MedicalProfileItem( child: MedicalProfileItem(
title: 'Medical', title: 'Medical',
imagePath: 'insurance_approvals_icon.png', imagePath: 'insurance_approvals_icon.png',

@ -1,22 +1,22 @@
import 'dart:ui'; import 'dart:ui';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class HomeRepoertsPage extends StatefulWidget { class HomeReportPage extends StatefulWidget {
@override @override
_HomeRepoertsPageState createState() => _HomeRepoertsPageState(); _HomeReportPageState createState() => _HomeReportPageState();
} }
class _HomeRepoertsPageState extends State<HomeRepoertsPage> class _HomeReportPageState extends State<HomeReportPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
@ -32,15 +32,16 @@ class _HomeRepoertsPageState extends State<HomeRepoertsPage>
_tabController.dispose(); _tabController.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ReportsViewModel>( return BaseView<ReportsViewModel>(
onModelReady: (model) =>model.getReports(), //model.getPrescriptions(), onModelReady: (model) => model.getReports(), //model.getPrescriptions(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: 'Request', appBarTitle: 'Request',
baseViewModel: model,
//bottomSheet: Container(), //bottomSheet: Container(),
body: Scaffold( body: Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: PreferredSize( appBar: PreferredSize(
@ -81,30 +82,28 @@ class _HomeRepoertsPageState extends State<HomeRepoertsPage>
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Colors.red[800], indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
unselectedLabelColor: Colors.grey[800], unselectedLabelColor: Colors.grey[800],
tabs: [ tabs: [
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.22,
child: Center( child: Center(
child: Texts('Requested'), child: Texts('Requested'),
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.22,
child: Center( child: Center(
child: Texts('Ready'), child: Texts('Ready'),
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.22,
child: Center( child: Center(
child: Texts('Completed'), child: Texts('Completed'),
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.22,
child: Center( child: Center(
child: Texts('Cancelled'), child: Texts('Cancelled'),
), ),
@ -124,17 +123,39 @@ class _HomeRepoertsPageState extends State<HomeRepoertsPage>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: <Widget>[ children: <Widget>[
// PrescriptionsPage(prescriptionsViewModel: model,), ReportListWidget(
// PrescriptionsHistory() reportList: model.reportsOrderRequestList,
Icon(Icons.directions_car), ),
Icon(Icons.directions_transit), ReportListWidget(
Icon(Icons.directions_bike), reportList: model.reportsOrderReadyList,
Icon(Icons.directions_bike), ),
ReportListWidget(
reportList: model.reportsOrderCompletedList,
),
ReportListWidget(
reportList: model.reportsOrderCanceledList,
),
], ],
), ),
) ),
SizedBox(height: 110,)
], ],
), ),
bottomSheet: Container(
width: double.infinity,
height: 90,
margin: EdgeInsets.all(8.0),
child: Button(
label: 'Resend order & deliver',
backgroundColor: Colors.grey[800],
onTap: () => Navigator.push(
context,
FadePage(
page: MedicalReports(),
),
),
),
),
), ),
), ),
); );

@ -0,0 +1,64 @@
import 'package:diplomaticquarterapp/core/model/reports/Reports.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ReportListWidget extends StatelessWidget {
final List<Reports> reportList;
ReportListWidget({@required this.reportList});
@override
Widget build(BuildContext context) {
return Container(
child: ListView.builder(
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: double.infinity,margin: EdgeInsets.only(left: 8,right: 8,top: 3),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
)),
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: LargeAvatar(
name: reportList[index].doctorName,
url: reportList[index].doctorImageURL,
),
),
),
Expanded(
flex: 4,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 12,),
Texts(reportList[index].projectName),
Texts(reportList[index].clinicDescription),
Texts('invoice No: ${reportList[index].invoiceNo}'),
SizedBox(height: 12,),
],
),
),
)
],
),
),
),
itemCount: reportList.length,
),
);
}
}

@ -1,10 +1,208 @@
import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class MedicalReports extends StatelessWidget {
@override
Widget build(BuildContext context) {
void confirmBox(
AppointmentHistory model, ReportsViewModel reportsViewModel) {
showDialog(
context: context,
child: ConfirmDialog(
appointmentHistory: model,
onOkSelected: (model) => reportsViewModel.insertRequestForMedicalReport(model),
),
);
}
return BaseView<ReportsViewModel>(
onModelReady: (model) => model.getPatentAppointmentHistory(),
builder: (_, model, widget) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBarTitle: 'Medical Reports',
body: ListView.builder(
itemCount: model.appointHistoryList.length,
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: double.infinity,
margin: EdgeInsets.only(left: 8, right: 8, top: 3),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
)),
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(left: 5, right: 5),
child: LargeAvatar(
width: 50,
height: 50,
name: model.appointHistoryList[index].doctorNameObj,
url: model.appointHistoryList[index].doctorImageURL,
),
),
),
Expanded(
flex: 4,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 12,
),
Texts(model.appointHistoryList[index].projectName),
Texts(model.appointHistoryList[index].clinicName),
Texts(DateUtil.getMonthDayYearDateFormatted(
model.appointHistoryList[index].appointmentDate)),
StarRating(
totalAverage: model
.appointHistoryList[index].actualDoctorRate
.toDouble(),
forceStars: true),
SizedBox(
height: 12,
),
],
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () =>
confirmBox(model.appointHistoryList[index], model),
child: Container(
width: 80,
height: 50,
decoration: BoxDecoration(
color: Colors.black54,
border:
Border.all(color: Colors.transparent, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
),
child: Center(
child: Texts(
'Request',
fontSize: 12,
color: Colors.white,
),
),
),
),
),
SizedBox(
width: 12,
),
],
),
),
),
),
),
);
}
}
class ConfirmDialog extends StatefulWidget {
final Function(AppointmentHistory) onOkSelected;
final AppointmentHistory appointmentHistory;
ConfirmDialog({this.onOkSelected, this.appointmentHistory});
@override
_ConfirmDialogState createState() => _ConfirmDialogState();
}
class _ConfirmDialogState extends State<ConfirmDialog> {
@override
Widget build(BuildContext context) {
return SimpleDialog(
title: Text('Confirm'),
children: <Widget>[
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Texts('Request a medical report'),
SizedBox(
height: 5.0,
),
Divider(
height: 2.5,
color: Colors.grey[500],
),
SizedBox(
height: 5,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.pop(context),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Center(
child: Texts(
'cancel',
color: Colors.red,
),
),
),
),
),
),
Container(
width: 1,
height: 30,
color: Colors.grey[500],
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
widget.onOkSelected(widget.appointmentHistory);
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
'ok',
fontWeight: FontWeight.w400,
),
),
),
),
),
],
)
],
),
)
],
);
}
}

Loading…
Cancel
Save