done report service

merge-requests/34/merge
Amjad Amireh 5 years ago
parent 20ab170e7a
commit 97dbe62f93

@ -20,6 +20,11 @@ const GET_PRESCRIPTIONS_ALL_ORDERS = '/Patients.svc/REST/PatientER_GetPatientAl
const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport';
const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail';
///Reports
const REPORTS = '/Doctors.svc/REST/GetPatientMedicalReportStatusInfo';
//const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment
//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment

@ -1 +1,2 @@
enum FilterType { Clinic, Hospital }

@ -0,0 +1 @@
enum ReportFilterType { Requested, Ready,Completed,Cancelled }

@ -0,0 +1,137 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class Reports {
int status;
DateTime encounterDate;
int projectID;
int invoiceNo;
int encounterNo;
String procedureId;
int requestType;
String setupId;
int patientID;
int doctorID;
Null clinicID;
DateTime requestDate;
bool isRead;
DateTime isReadOn;
int actualDoctorRate;
String clinicDescription;
Null clinicDescriptionN;
String docName;
Null docNameN;
String doctorImageURL;
Null doctorName;
Null doctorNameN;
int doctorRate;
bool isDoctorAllowVedioCall;
bool isExecludeDoctor;
int noOfPatientsRate;
String projectName;
Null projectNameN;
Reports(
{this.status,
this.encounterDate,
this.projectID,
this.invoiceNo,
this.encounterNo,
this.procedureId,
this.requestType,
this.setupId,
this.patientID,
this.doctorID,
this.clinicID,
this.requestDate,
this.isRead,
this.isReadOn,
this.actualDoctorRate,
this.clinicDescription,
this.clinicDescriptionN,
this.docName,
this.docNameN,
this.doctorImageURL,
this.doctorName,
this.doctorNameN,
this.doctorRate,
this.isDoctorAllowVedioCall,
this.isExecludeDoctor,
this.noOfPatientsRate,
this.projectName,
this.projectNameN});
Reports.fromJson(Map<String, dynamic> json) {
status = json['Status'];
encounterDate = DateUtil.convertStringToDate(json['EncounterDate']);//json['EncounterDate'];
projectID = json['ProjectID'];
invoiceNo = json['InvoiceNo'];
encounterNo = json['EncounterNo'];
procedureId = json['ProcedureId'];
requestType = json['RequestType'];
setupId = json['SetupId'];
patientID = json['PatientID'];
doctorID = json['DoctorID'];
clinicID = json['ClinicID'];
requestDate = DateUtil.convertStringToDate(json['RequestDate']);//json['RequestDate'];
isRead = json['IsRead'];
isReadOn =DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn'];
actualDoctorRate = json['ActualDoctorRate'];
clinicDescription = json['ClinicDescription'];
clinicDescriptionN = json['ClinicDescriptionN'];
docName = json['DocName'];
docNameN = json['DocNameN'];
doctorImageURL = json['DoctorImageURL'];
doctorName = json['DoctorName'];
doctorNameN = json['DoctorNameN'];
doctorRate = json['DoctorRate'];
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
isExecludeDoctor = json['IsExecludeDoctor'];
noOfPatientsRate = json['NoOfPatientsRate'];
projectName = json['ProjectName'];
projectNameN = json['ProjectNameN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Status'] = this.status;
data['EncounterDate'] = this.encounterDate;
data['ProjectID'] = this.projectID;
data['InvoiceNo'] = this.invoiceNo;
data['EncounterNo'] = this.encounterNo;
data['ProcedureId'] = this.procedureId;
data['RequestType'] = this.requestType;
data['SetupId'] = this.setupId;
data['PatientID'] = this.patientID;
data['DoctorID'] = this.doctorID;
data['ClinicID'] = this.clinicID;
data['RequestDate'] = this.requestDate;
data['IsRead'] = this.isRead;
data['IsReadOn'] = this.isReadOn;
data['ActualDoctorRate'] = this.actualDoctorRate;
data['ClinicDescription'] = this.clinicDescription;
data['ClinicDescriptionN'] = this.clinicDescriptionN;
data['DocName'] = this.docName;
data['DocNameN'] = this.docNameN;
data['DoctorImageURL'] = this.doctorImageURL;
data['DoctorName'] = this.doctorName;
data['DoctorNameN'] = this.doctorNameN;
data['DoctorRate'] = this.doctorRate;
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
data['IsExecludeDoctor'] = this.isExecludeDoctor;
data['NoOfPatientsRate'] = this.noOfPatientsRate;
data['ProjectName'] = this.projectName;
data['ProjectNameN'] = this.projectNameN;
return data;
}
}
class ReportsList{
String filterName="";
// int filterName=1;
List<Reports>reportsList=List();
ReportsList({this.filterName,Reports reports}){
reportsList.add(reports);
}
}

@ -0,0 +1,76 @@
class RequestReports {
bool isReport;
int encounterType;
int requestType;
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;
RequestReports(
{this.isReport,
this.encounterType,
this.requestType,
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});
RequestReports.fromJson(Map<String, dynamic> json) {
isReport = json['IsReport'];
encounterType = json['EncounterType'];
requestType = json['RequestType'];
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['IsReport'] = this.isReport;
data['EncounterType'] = this.encounterType;
data['RequestType'] = this.requestType;
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;
}
}

@ -0,0 +1,66 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/reports/Reports.dart';
import 'package:diplomaticquarterapp/core/model/reports/request_reports.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class ReportsService extends BaseService{
List<Reports> reportsList = List();
RequestReports _requestReports=RequestReports(
isReport: true,
encounterType: 1,
requestType: 1,
versionID: 5.5,
channel: 3,
languageID: 2,
iPAdress: "10.20.10.20",
generalid: 'Cs2020@2016\$2958',
patientOutSA: 0,
sessionID: 'KIbLoqkytuKJEWECHQ',
isDentalAllowedBackend: false,
deviceTypeID: 2,
patientID: 1231755,
tokenID: '@dm!n',
patientTypeID: 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 getPrescriptions() async {
// hasError = false;
// await baseAppClient.post(PRESCRIPTIONS,
// onSuccess: (dynamic response, int statusCode) {
// prescriptionsList.clear();
// response['PatientPrescriptionList'].forEach((prescriptions) {
// prescriptionsList.add(Prescriptions.fromJson(prescriptions));
// });
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: _requestPrescriptions.toJson());
// }
}

@ -0,0 +1,127 @@
//import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../core/enum/reportfilter_type.dart';
import '../../../core/enum/viewstate.dart';
//import '../../../core/model/prescriptions/Prescriptions.dart';
import '../../../core/model/reports/Reports.dart';
//import '../../../core/service/medical/prescriptions_service.dart';
import '../../../core/service/medical/reports_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
class ReportsViewModel extends BaseViewModel {
ReportFilterType filterType = ReportFilterType.Requested;
ReportsService _reportsService = locator<ReportsService>();
List<ReportsList> _reportsOrderRequestList = List();
List<ReportsList> _reportsOrderReadyList = List();
List<ReportsList> _reportsOrderCompletedList = List();
List<ReportsList> _reportsOrderCanceledList = List();
List<Reports> get reportsList => _reportsService.reportsList;
/////
List<ReportsList> get reportsOrderList {
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 {
setState(ViewState.Busy);
await _reportsService.getReports();
if (_reportsService.hasError) {
error = _reportsService.error;
setState(ViewState.Error);
} else {
_filterList();
setState(ViewState.Idle);
}
}
////////////////////////
void _filterList() {
_reportsService.reportsList.forEach((element) {
/// ReportsList list sort Request
List<ReportsList> reportsByRequest = _reportsOrderRequestList
.where((elementStatus) => elementStatus.filterName == element.status)
.toList();
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) {
_reportsOrderCanceledList[
_reportsOrderCanceledList.indexOf(reportsByCompleated[0])]
.reportsList
.add(element);
} else {
_reportsOrderCanceledList.add(ReportsList(
filterName: element.clinicDescription, reports: element));
}
//****************************
});
}
///////////////////////
}

@ -1,11 +1,14 @@
import 'package:get_it/get_it.dart';
import 'core/service/hospital_service.dart';
import 'core/service/medical/my_doctor_service.dart';
import 'core/service/medical/prescriptions_service.dart';
import 'core/service/medical/reports_service.dart';
import 'core/viewModels/hospital_view_model.dart';
import 'core/viewModels/medical/my_doctor_view_model.dart';
import 'core/viewModels/medical/prescriptions_view_model.dart';
import 'core/viewModels/medical/reports_view_model.dart';
import 'core/viewModels/pharmacies_view_model.dart';
import 'core/service/pharmacies_service.dart';
@ -18,10 +21,12 @@ void setupLocator() {
locator.registerLazySingleton(() => PharmacyService());
locator.registerLazySingleton(() => MyDoctorService());
locator.registerLazySingleton(() => PrescriptionsService());
locator.registerLazySingleton(() => ReportsService());
/// View Model
locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => PharmacyViewModel());
locator.registerFactory(() => MyDoctorViewModel());
locator.registerFactory(() => PrescriptionsViewModel());
locator.registerFactory(() => ReportsViewModel());
}

@ -1,6 +1,7 @@
import 'dart:math';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart';
@ -122,11 +123,18 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
children: <Widget>[
Expanded(
flex: 1,
child:InkWell(
onTap: (){
Navigator.push(context, FadePage(page: HomeRepoertsPage()));
},
child: MedicalProfileItem(
title: 'Medical',
imagePath: 'medical_history_icon.png',
subTitle: 'Reports',
),
),
),
Expanded(
flex: 1,

@ -0,0 +1,142 @@
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/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class HomeRepoertsPage extends StatefulWidget {
@override
_HomeRepoertsPageState createState() => _HomeRepoertsPageState();
}
class _HomeRepoertsPageState extends State<HomeRepoertsPage>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 4, vsync: this);
}
@override
void dispose() {
super.dispose();
_tabController.dispose();
}
@override
Widget build(BuildContext context) {
return BaseView<ReportsViewModel>(
onModelReady: (model) =>model.getReports(), //model.getPrescriptions(),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: 'Request',
//bottomSheet: Container(),
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(65.0),
child: Stack(
children: <Widget>[
Positioned(
bottom: 1,
left: 0,
right: 0,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0,
),
),
),
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.7),
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: true,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts('Requested'),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts('Ready'),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts('Completed'),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts('Cancelled'),
),
),
],
),
),
),
),
],
),
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
// PrescriptionsPage(prescriptionsViewModel: model,),
// PrescriptionsHistory()
Icon(Icons.directions_car),
Icon(Icons.directions_transit),
Icon(Icons.directions_bike),
Icon(Icons.directions_bike),
],
),
)
],
),
),
),
);
}
}

@ -0,0 +1,10 @@
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.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/material.dart';
Loading…
Cancel
Save