From 492cfa084be5983d66a34b3ea55a61d6bec1a2b8 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 11 Aug 2020 09:20:38 +0300 Subject: [PATCH] insurance card and insurance update and insurance approval --- lib/config/config.dart | 14 +- .../ReauestInsuranceApprovalModel.dart | 72 ++++ .../model/insurance/insurance_approval.dart | 129 ++++++ lib/core/model/insurance/insurance_card.dart | 90 ++++ .../insurance/insurance_card_update.dart | 66 +++ lib/core/service/insurance_service.dart | 112 +++++ .../viewModels/insurance_card_View_model.dart | 57 +++ lib/locator.dart | 4 + .../insurance/insurance_approval_screen.dart | 395 ++++++++++++++++++ .../insurance/insurance_card_screen.dart | 151 +++++++ .../insurance/insurance_update_screen.dart | 311 ++++++++++++++ lib/pages/medical/medical_profile_page.dart | 66 ++- .../prescriptions_home_page.dart | 6 +- 13 files changed, 1445 insertions(+), 28 deletions(-) create mode 100644 lib/core/model/insurance/ReauestInsuranceApprovalModel.dart create mode 100644 lib/core/model/insurance/insurance_approval.dart create mode 100644 lib/core/model/insurance/insurance_card.dart create mode 100644 lib/core/model/insurance/insurance_card_update.dart create mode 100644 lib/core/service/insurance_service.dart create mode 100644 lib/core/viewModels/insurance_card_View_model.dart create mode 100644 lib/pages/insurance/insurance_approval_screen.dart create mode 100644 lib/pages/insurance/insurance_card_screen.dart create mode 100644 lib/pages/insurance/insurance_update_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 643a2ec9..96f891d2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,12 +13,12 @@ const GET_MY_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; const GET_DOCTOR_PROFILE = '/Doctors.svc/REST/GetDocProfiles'; const GET_DOCTOR_RATING = '/Doctors.svc/REST/dr_GetAvgDoctorRating'; - ///Prescriptions const PRESCRIPTIONS = '/Patients.svc/REST/GetPrescriptionApptList'; -const GET_PRESCRIPTIONS_ALL_ORDERS = '/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport'; -const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail'; +const GET_PRESCRIPTIONS_ALL_ORDERS = + '/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail'; //const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment //const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment @@ -37,6 +37,10 @@ var DeviceTypeID = Platform.isIOS ? 1 : 2; const GET_PHARMCY_ITEMS = "/Lists.svc/REST/GetPharmcyItems_Region"; const GET_PHARMACY_LIST = "/Patients.svc/REST/GetPharmcyList"; +const GET_PAtIENTS_INSURANCE = "/Patients.svc/REST/Get_PatientInsuranceDetails"; +const GET_PAtIENTS_INSURANCE_UPDATED = + "/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; +const GET_PAtIENTS_INSURANCE_APPROVALS = "/Patients.svc/REST/GetApprovalStatus"; class AppGlobal { static var context; @@ -59,5 +63,3 @@ class AppGlobal { return request; } } - - diff --git a/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart b/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart new file mode 100644 index 00000000..5f41f878 --- /dev/null +++ b/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart @@ -0,0 +1,72 @@ +class ReauestInsuranceApprovalModel { + 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; + int eXuldAPPNO; + int projectID; + + ReauestInsuranceApprovalModel( + {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, + this.eXuldAPPNO, + this.projectID}); + + ReauestInsuranceApprovalModel.fromJson(Map json) { + 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']; + eXuldAPPNO = json['EXuldAPPNO']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + 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; + data['EXuldAPPNO'] = this.eXuldAPPNO; + data['ProjectID'] = this.projectID; + return data; + } +} diff --git a/lib/core/model/insurance/insurance_approval.dart b/lib/core/model/insurance/insurance_approval.dart new file mode 100644 index 00000000..4df6d882 --- /dev/null +++ b/lib/core/model/insurance/insurance_approval.dart @@ -0,0 +1,129 @@ +class InsuranceApprovalDetails { + String procedureName; + String status; + String isInvoicedDesc; + + InsuranceApprovalDetails({ + this.procedureName, + this.status, + this.isInvoicedDesc, + }); + + InsuranceApprovalDetails.fromJson(Map json) { + try { + isInvoicedDesc = json['IsInvoicedDesc']; + status = json['Status']; + procedureName = json['ProcedureName']; + } catch (e) { + print(e); + } + } +} + +class InsuranceApprovalModel { + InsuranceApprovalDetails approvalDetails; + 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; + int eXuldAPPNO; + int projectID; + String doctorName; + String clinicName; + String patientDescription; + int approvalNo; + String approvalStatusDescption; + int unUsedCount; + //String companyName; + String expiryDate; + String rceiptOn; + + InsuranceApprovalModel( + {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, + this.eXuldAPPNO, + this.projectID, + this.doctorName, + this.clinicName, + this.patientDescription, + this.approvalNo, + this.approvalStatusDescption, + this.unUsedCount, + //this.companyName, + this.expiryDate, + this.rceiptOn, + this.approvalDetails}); + InsuranceApprovalDetails x = InsuranceApprovalDetails(); + InsuranceApprovalModel.fromJson(Map json) { + try { + rceiptOn = json['ReceiptOn']; + expiryDate = json['ExpiryDate']; + //companyName = json['CompanyName']; + unUsedCount = json['TotaUnUsedCount']; + approvalStatusDescption = json['ApprovalStatusDescption']; + approvalNo = json['ApprovalNo']; + patientDescription = json['IsInOutPatientDescription']; + 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']; + eXuldAPPNO = json['EXuldAPPNO']; + projectID = json['ProjectID']; + doctorName = json['DoctorName']; + clinicName = json['ClinicName']; + approvalDetails = + InsuranceApprovalDetails.fromJson(json['ApporvalDetails'][0]); + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + 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; + data['EXuldAPPNO'] = this.eXuldAPPNO; + data['ProjectID'] = this.projectID; + return data; + } +} diff --git a/lib/core/model/insurance/insurance_card.dart b/lib/core/model/insurance/insurance_card.dart new file mode 100644 index 00000000..1c02705b --- /dev/null +++ b/lib/core/model/insurance/insurance_card.dart @@ -0,0 +1,90 @@ +import 'dart:convert'; + +class InsuranceCardModel { + 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; + String groupName; + String companyName; + String subCategoryDesc; + String patientCardID; + String insurancePolicyNumber; + bool isActive; + String cardValidTo; + + InsuranceCardModel({ + this.insurancePolicyNumber, + this.subCategoryDesc, + 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, + this.groupName, + this.companyName, + this.patientCardID, + this.isActive, + this.cardValidTo, + }); + + InsuranceCardModel.fromJson(Map json) { + isActive = json['IsActive']; + insurancePolicyNumber = json['InsurancePolicyNo']; + patientCardID = json['PatientCardID']; + companyName = json['CompanyName']; + groupName = json['GroupName']; + 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']; + subCategoryDesc = json['SubCategoryDesc']; + cardValidTo = json['CardValidTo']; + } + + Map toJson() { + final Map data = new Map(); + + 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; + } +} diff --git a/lib/core/model/insurance/insurance_card_update.dart b/lib/core/model/insurance/insurance_card_update.dart new file mode 100644 index 00000000..fd5e0db5 --- /dev/null +++ b/lib/core/model/insurance/insurance_card_update.dart @@ -0,0 +1,66 @@ +import 'dart:convert'; + +import 'package:intl/intl.dart'; + +class InsuranceUpdateModel { + int patientID; + int patientType; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String createdOn; + String statusDescription; + + InsuranceUpdateModel( + {this.patientID, + this.patientType, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.createdOn, + this.statusDescription}); + + InsuranceUpdateModel.fromJson(Map json) { + statusDescription = json['StatusDescription']; + patientID = json['PatientID']; + patientType = json['PatientType']; + 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']; + createdOn = json['CreatedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + 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; + return data; + } +} diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart new file mode 100644 index 00000000..9550507a --- /dev/null +++ b/lib/core/service/insurance_service.dart @@ -0,0 +1,112 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; + +class InsuranceCardService extends BaseService { + List _cardList = List(); + List _cardUpdated = List(); + List _insuranceApproval = List(); + + List get cardList => _cardList; + List get updatedCard => _cardUpdated; + List get insuranceApproval => _insuranceApproval; + + clearInsuranceCard() { + _cardList.clear(); + } + + clearUpdatedList() { + _cardUpdated.clear(); + } + + InsuranceCardModel _insuranceCardModel = InsuranceCardModel( + channel: 3, + deviceTypeID: 2, + generalid: "Cs2020@2016\$2958", + iPAdress: "10.20.10.20", + isDentalAllowedBackend: false, + languageID: 1, + patientID: 1231755, + patientOutSA: 0, + patientType: 1, + patientTypeID: 1, + sessionID: "uoKFXSLUwEaHYPwKZNA", + tokenID: "@dm!n", + versionID: 5.5, + ); + + InsuranceUpdateModel _insuranceUpdateModel = InsuranceUpdateModel( + channel: 3, + deviceTypeID: 2, + generalid: "Cs2020@2016\$2958", + iPAdress: "10.20.10.20", + isDentalAllowedBackend: false, + patientID: 1231755, + patientType: 1, + versionID: 5.5, + languageID: 2, + patientOutSA: 0, + sessionID: "ENRSJBKXnzCuuVQ", + ); + + InsuranceApprovalModel _insuranceApprovalModel = InsuranceApprovalModel( + versionID: 5.5, + channel: 3, + languageID: 2, + iPAdress: "10.20.10.20", + generalid: "Cs2020@2016\$2958", + patientOutSA: 0, + sessionID: "DypNmtMkivzURHjeYg", + isDentalAllowedBackend: false, + deviceTypeID: 2, + patientID: 1231755, + tokenID: "@dm!n", + patientTypeID: 1, + patientType: 1, + eXuldAPPNO: 0, + projectID: 0); + + Future getInsurance() async { + hasError = false; + _cardList.clear(); + await baseAppClient.post(GET_PAtIENTS_INSURANCE, + onSuccess: (dynamic response, int statusCode) { + response['List_PatientInsuranceCard'].forEach((item) { + _cardList.add(InsuranceCardModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _insuranceCardModel.toJson()); + } + + Future getInsuranceUpdate() async { + hasError = false; + // _cardList.clear(); + await baseAppClient.post(GET_PAtIENTS_INSURANCE_UPDATED, + onSuccess: (dynamic response, int statusCode) { + response['List_PatientInsuranceCardHistory'].forEach((item) { + _cardUpdated.add(InsuranceUpdateModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _insuranceUpdateModel.toJson()); + } + + Future getInsuranceApproval() async { + hasError = false; + // _cardList.clear(); + await baseAppClient.post(GET_PAtIENTS_INSURANCE_APPROVALS, + onSuccess: (dynamic response, int statusCode) { + response['HIS_Approval_List'].forEach((item) { + _insuranceApproval.add(InsuranceApprovalModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _insuranceApprovalModel.toJson()); + } +} diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart new file mode 100644 index 00000000..1d13257f --- /dev/null +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -0,0 +1,57 @@ +import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; + +import 'base_view_model.dart'; +import '../../locator.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; + +class InsuranceViewModel extends BaseViewModel { + bool hasError = false; + + InsuranceCardService _insuranceCardService = locator(); + + List get insurance => _insuranceCardService.cardList; + List get insuranceUpdate => + _insuranceCardService.updatedCard; + List get insuranceApproval => + _insuranceCardService.insuranceApproval; + + Future getInsurance() async { + hasError = false; + _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _insuranceCardService.getInsurance(); + if (_insuranceCardService.hasError) { + error = _insuranceCardService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getInsuranceUpdated() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _insuranceCardService.getInsuranceUpdate(); + if (_insuranceCardService.hasError) { + error = _insuranceCardService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getInsuranceApproval() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _insuranceCardService.getInsuranceApproval(); + if (_insuranceCardService.hasError) { + error = _insuranceCardService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index c1a2a170..f63b14b2 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -8,6 +8,8 @@ import 'core/viewModels/medical/my_doctor_view_model.dart'; import 'core/viewModels/medical/prescriptions_view_model.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; +import 'core/service/insurance_service.dart'; +import 'core/viewModels/insurance_card_View_model.dart'; GetIt locator = GetIt.instance; @@ -18,10 +20,12 @@ void setupLocator() { locator.registerLazySingleton(() => PharmacyService()); locator.registerLazySingleton(() => MyDoctorService()); locator.registerLazySingleton(() => PrescriptionsService()); + locator.registerLazySingleton(() => InsuranceCardService()); /// View Model locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => PharmacyViewModel()); locator.registerFactory(() => MyDoctorViewModel()); locator.registerFactory(() => PrescriptionsViewModel()); + locator.registerFactory(() => InsuranceViewModel()); } diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart new file mode 100644 index 00000000..4bcd7ac9 --- /dev/null +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -0,0 +1,395 @@ +import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:flutter/cupertino.dart'; +import '../base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; + +class InsuranceApproval extends StatefulWidget { + @override + _InsuranceApprovalState createState() => _InsuranceApprovalState(); +} + +class _InsuranceApprovalState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getInsuranceApproval(), + builder: (BuildContext context, InsuranceViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBarTitle: 'Approvals', + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04, + ), + child: Column( + children: [ + Container( + width: double.infinity, + height: SizeConfig.screenHeight * 0.09, + color: Color(0xffEEEEEE), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + 'Total approval unused', + style: TextStyle( + color: Color(0xff60688B), + fontSize: 19.5, + fontWeight: FontWeight.w600, + ), + ), + if (model.insuranceApproval.length > 0) + Container( + width: SizeConfig.widthMultiplier * 18.0, + height: SizeConfig.heightMultiplier * 2.8, + decoration: BoxDecoration( + color: Color(0xffC5272D), + borderRadius: BorderRadius.circular(19.0)), + child: Center( + child: Text( + model.insuranceApproval[0].unUsedCount + .toString(), + style: TextStyle( + color: Colors.white, fontSize: 19.0), + ), + )) + ], + )), + ...List.generate( + model.insuranceApproval.length, + (index) => RoundedContainer( + backgroundColor: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Container( + height: 85.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + model.insuranceApproval[index] + .patientDescription == + "In Patient" + ? Container( + decoration: BoxDecoration( + color: Color(0xffB8372C), + borderRadius: + BorderRadius.circular( + 16.0)), + width: 95.0, + padding: + EdgeInsets.only(left: 11.5), + child: Text( + model.insuranceApproval[index] + .patientDescription == + null + ? '' + : model + .insuranceApproval[ + index] + .patientDescription, + style: TextStyle( + color: Colors.white), + ), + ) + : Container( + decoration: BoxDecoration( + color: Color(0xff505A5D), + borderRadius: + BorderRadius.circular( + 16.0)), + width: 95.0, + padding: + EdgeInsets.only(left: 11.5), + child: Text( + model.insuranceApproval[index] + .patientDescription == + null + ? '' + : model + .insuranceApproval[ + index] + .patientDescription, + style: TextStyle( + color: Colors.white), + ), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0), + child: Text( + model.insuranceApproval[index] + .clinicName, + style: TextStyle( + fontSize: 20.0, + color: Color(0xff60686B), + fontWeight: FontWeight.w600, + ), + ), + ), + Text( + model.insuranceApproval[index] + .doctorName, + style: TextStyle( + fontSize: 15.0, + fontStyle: FontStyle.italic), + ), + ], + ), + ), + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 12.0, horizontal: 12.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Approval No.: ' + + model.insuranceApproval[index] + .approvalNo + .toString(), + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.w600, + ), + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Text( + 'Procedure Status: ' + + model.insuranceApproval[index] + .approvalStatusDescption, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 17.5), + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Text( + 'Unused Count: ' + + model.insuranceApproval[index] + .unUsedCount + .toString(), + style: TextStyle( + fontSize: 17.5, + fontWeight: FontWeight.w600), + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), +// Text( +// 'Company Name: ' + +// model.insuranceApproval[index] +// .companyName == +// null +// ? '000' +// : model +// .insuranceApproval[index].companyName, +// style: TextStyle( +// fontSize: 17.5, +// fontWeight: FontWeight.w600), +// ), + Text( + 'Company Name', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 17.5, + ), + ), + + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Text( + 'Receipt on: ' + + convertDateFormat(model + .insuranceApproval[index] + .rceiptOn), + style: TextStyle( + fontSize: 17.5, + fontWeight: FontWeight.w600, + ), + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + Text( + 'expiryDate: ' + + convertDateFormat(model + .insuranceApproval[index] + .expiryDate), + style: TextStyle( + fontSize: 17.5, + fontWeight: FontWeight.w600, + ), + ), + Divider( + color: Colors.black, + height: 55.0, + thickness: 1.2, + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Column( + children: [ + Text('Procedure Name '), + Padding( + padding: EdgeInsets.only( + top: SizeConfig + .heightMultiplier * + 3.0), + child: Text( + model + .insuranceApproval[ + index] + .approvalDetails == + null + ? '' + : model + .insuranceApproval[ + index] + .approvalDetails + .procedureName, + style: TextStyle( + fontWeight: + FontWeight.w600, + fontSize: 15.5), + ), + ), + ], + ), + ), + VerticalDivider( + width: 10.0, + ), + Expanded( + flex: 1, + child: Column( + children: [ + Text('Procedure Status '), + Padding( + padding: EdgeInsets.only( + top: SizeConfig + .heightMultiplier * + 3.0), + child: Text( + model + .insuranceApproval[ + index] + .approvalDetails == + null + ? '' + : model + .insuranceApproval[ + index] + .approvalDetails + .status, + style: TextStyle( + fontSize: 17.5, + fontWeight: + FontWeight.w600), + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Column( + children: [ + Text('Usage Status '), + Padding( + padding: EdgeInsets.only( + top: SizeConfig + .heightMultiplier * + 3.0), + child: Text( + model + .insuranceApproval[ + index] + .approvalDetails == + null + ? '' + : model + .insuranceApproval[ + index] + .approvalDetails + .isInvoicedDesc, + style: TextStyle( + fontWeight: + FontWeight.w600, + fontSize: 17.5), + ), + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 1.0, + ), + ], + ), + ), + ], + ), + ], + ), + )), + ], + ), + ), + ), + ), + ); + } + + convertDateFormat(String Date) { + const start = "/Date("; + const end = "+0300)"; + + final startIndex = Date.indexOf(start); + final endIndex = Date.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(Date.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "-" + + date.month.toString().padLeft(2, '0') + + "-" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } +} diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart new file mode 100644 index 00000000..f1082ec6 --- /dev/null +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -0,0 +1,151 @@ +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:flutter/cupertino.dart'; +import '../base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; +import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; + +class InsuranceCard extends StatefulWidget { + @override + _InsuranceCardState createState() => _InsuranceCardState(); +} + +class _InsuranceCardState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getInsurance(), + builder: (BuildContext context, InsuranceViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBarTitle: 'Insurance Cards', + body: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04), + child: ListView.builder( + itemCount: model.insurance == null ? 0 : model.insurance.length, + itemBuilder: (BuildContext context, int index) { + return RoundedContainer( + backgroundColor: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Container( + height: 65.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 15.0), + child: Texts( + model.insurance[index].groupName, + ), + ), + ], + ), + ), + children: [ + Divider( + color: Colors.black, + height: 25.0, + thickness: 0.5, + ), + Texts( + 'Company Name: ' + + model.insurance[index].companyName, + fontSize: 20.0, + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 0.5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + 'Category: ' + + model.insurance[index].subCategoryDesc, + style: TextStyle(fontSize: 18.5), + ), + Text( + 'Expiration Date: ' + + convertDateFormat( + model.insurance[index].cardValidTo), + style: TextStyle(fontSize: 18.5), + ), + Text( + 'Patient Card ID : ' + + model.insurance[index].patientCardID, + style: TextStyle(fontSize: 18.5), + ), + Text( + 'Policy Number : ' + + model + .insurance[index].insurancePolicyNumber, + style: TextStyle(fontSize: 18.5), + ), + ], + ), + Column( + children: [ + model.insurance[index].isActive == true + ? Text('Active', + style: TextStyle( + color: Colors.green, + fontWeight: FontWeight.w900, + fontSize: 17.9)) + : Text('Not Active', + style: TextStyle( + color: Colors.red, + fontWeight: FontWeight.w900, + fontSize: 17.9)) + ], + ), + SizedBox( + height: 14.5, + ), + Container( + child: Button( + label: 'SEE DETAILS', + ), + width: 400.0, + ), + ], + ), + ], + ), + ); + }), + ), + ), + ); + } + + convertDateFormat(String exDate) { + const start = "/Date("; + const end = "+0300)"; + + final startIndex = exDate.indexOf(start); + final endIndex = exDate.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(exDate.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "-" + + date.month.toString().padLeft(2, '0') + + "-" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } +} diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart new file mode 100644 index 00000000..9ef7c524 --- /dev/null +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -0,0 +1,311 @@ +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:flutter/cupertino.dart'; +import '../base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; + +class InsuranceUpdate extends StatefulWidget { + @override + _InsuranceUpdateState createState() => _InsuranceUpdateState(); +} + +class _InsuranceUpdateState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getInsuranceUpdated(), + builder: (BuildContext context, InsuranceViewModel model, Widget child) => + AppScaffold( + appBarTitle: 'Insurance Cards', + isShowAppBar: true, + baseViewModel: model, + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(70.0), + child: Stack( + children: [ + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 1.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 5.7, + ), + ), + color: Colors.white, + ), + child: Center( + child: TabBar( + controller: _tabController, + isScrollable: true, + indicatorWeight: 4.0, + indicatorColor: Colors.red, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.symmetric( + horizontal: 13.0, vertical: 2.0), + unselectedLabelColor: Colors.grey, + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Texts('Card'), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Texts('History'), + ), + ), + ], + ), + ), + ), + ) + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + Container( + child: ListView.builder( + itemCount: model.insuranceUpdate == null + ? 0 + : model.insuranceUpdate.length, + itemBuilder: (BuildContext context, int index) { + return Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 2.0, + left: 10.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text("TAMER FANASHEH ", + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.w500, + letterSpacing: 1.0)), + Text( + 'File No.' + + model + .insuranceUpdate[ + index] + .patientID + .toString(), + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.w500, + letterSpacing: 1.0)), + Text( + model.insuranceUpdate[index] + .createdOn, + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.w500, + letterSpacing: 1.0)), + ], + ), + ), + ), + Expanded( + flex: 1, + child: Container( +// height: MediaQuery.of(context).size.height * 0.12, + margin: EdgeInsets.only(top: 20.0), + child: Column( + children: [ + Container( + child: Button( + label: 'Fetch', + ), + height: SizeConfig + .heightMultiplier * + 3.8, + width: + SizeConfig.screenWidth * + 4.2, + ), + ], + ), + ), + ) + ], + ), + ], + ), + ), + ), + ); + }), + ), + Container( + child: ListView.builder( + itemCount: model.insuranceUpdate == null + ? 0 + : model.insuranceUpdate.length, + itemBuilder: (BuildContext context, int index) { + return Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 2.0, + left: 10.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text("TAMER FANASHEH ", + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.w500, + letterSpacing: 1.0)), + Text( + 'File No.' + + model + .insuranceUpdate[ + index] + .patientID + .toString(), + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.w500, + letterSpacing: 1.0)), + Text( + model.insuranceUpdate[index] + .createdOn, + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: + FontWeight.w500, + letterSpacing: 1.0)), + ], + ), + ), + ), + Expanded( + flex: 1, + child: Container( +// height: MediaQuery.of(context).size.height * 0.12, + margin: EdgeInsets.only(top: 20.0), + child: Column( + children: [ + Image.asset( + "assets/images/new-design/confirm_button.png", + width: 30.0, + height: 30.0), + Container( + margin: EdgeInsets.only( + top: 13.5, left: 2.0), + child: Text( + model + .insuranceUpdate[ + index] + .statusDescription, + textAlign: + TextAlign.center, + style: TextStyle( + fontSize: 12.0)), + ), + ], + ), + ), + ) + ], + ), + ], + ), + ), + ), + ); + }), + ), + //////////////// + ], + )) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index ceacaed4..fbacf528 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -7,8 +7,10 @@ import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - +import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'doctor/doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; class MedicalProfilePage extends StatefulWidget { @override @@ -47,8 +49,9 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: (){ - Navigator.push(context, FadePage(page: DoctorHomePage())); + onTap: () { + Navigator.push( + context, FadePage(page: DoctorHomePage())); }, child: MedicalProfileItem( title: 'My Doctor', @@ -60,9 +63,7 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: (){ - - }, + onTap: () {}, child: MedicalProfileItem( title: 'Lab', imagePath: 'lab_result_icon.png', @@ -85,9 +86,9 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: (){ - Navigator.push(context, FadePage(page: HomePrescriptionsPage())); - + onTap: () { + Navigator.push(context, + FadePage(page: HomePrescriptionsPage())); }, child: MedicalProfileItem( title: 'Medicines', @@ -102,20 +103,32 @@ class _MedicalProfilePageState extends State { children: [ Expanded( flex: 1, - child: MedicalProfileItem( - title: 'Insurance', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + child: InkWell( + onTap: () { + Navigator.push( + context, FadePage(page: InsuranceCard())); + }, + child: MedicalProfileItem( + title: 'Insurance', + imagePath: 'insurance_card_icon.png', + subTitle: 'Card', + ), ), ), Expanded( flex: 1, - child: MedicalProfileItem( - title: 'Insurance', - imagePath: 'insurance_approvals_icon.png', - subTitle: 'Approvals', + child: InkWell( + onTap: () { + Navigator.push( + context, FadePage(page: InsuranceApproval())); + }, + child: MedicalProfileItem( + title: 'Insurance Approval', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Card', + ), ), - ) + ), ], ), Row( @@ -130,10 +143,23 @@ class _MedicalProfilePageState extends State { ), Expanded( flex: 1, - child: Container(), - ) + child: InkWell( + onTap: () { + Navigator.push( + context, FadePage(page: InsuranceUpdate())); + }, + child: MedicalProfileItem( + title: 'Insurance Update', + imagePath: 'insurance_card_icon.png', + subTitle: 'Card', + ), + ), + ), ], ), + Row( + children: [], + ) ], ), ), diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index e4c6ca9f..e0f3dcaf 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -66,7 +66,7 @@ class _HomePrescriptionsPageState extends State border: Border( bottom: BorderSide( color: Theme.of(context).dividerColor, - width: 0.7), + width: 5.7), ), color: Colors.white), child: Center( @@ -108,7 +108,9 @@ class _HomePrescriptionsPageState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - PrescriptionsPage(prescriptionsViewModel: model,), + PrescriptionsPage( + prescriptionsViewModel: model, + ), PrescriptionsHistory() ], ),