Add insurance approval services
parent
e515265f11
commit
7dae41513f
@ -0,0 +1,140 @@
|
||||
class InsuranceApprovalDetails {
|
||||
String procedureName;
|
||||
String status;
|
||||
String isInvoicedDesc;
|
||||
|
||||
InsuranceApprovalDetails({
|
||||
this.procedureName,
|
||||
this.status,
|
||||
this.isInvoicedDesc,
|
||||
});
|
||||
|
||||
InsuranceApprovalDetails.fromJson(Map<String, dynamic> 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;
|
||||
int appointmentNo;
|
||||
|
||||
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,
|
||||
this.appointmentNo});
|
||||
|
||||
InsuranceApprovalDetails x = InsuranceApprovalDetails();
|
||||
|
||||
InsuranceApprovalModel.fromJson(Map<String, dynamic> 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]);
|
||||
appointmentNo = json['AppointmentNo'];
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
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;
|
||||
if (appointmentNo == null) {
|
||||
data['EXuldAPPNO'] = this.eXuldAPPNO;
|
||||
data['ProjectID'] = this.projectID;
|
||||
}
|
||||
if (appointmentNo != null) {
|
||||
data['AppointmentNo'] = this.appointmentNo;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/model/insurance_approval.dart';
|
||||
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
class InsuranceCardService extends BaseService {
|
||||
InsuranceApprovalModel _insuranceApprovalModel = InsuranceApprovalModel(
|
||||
isDentalAllowedBackend: false,
|
||||
patientTypeID: 1,
|
||||
patientType: 1,
|
||||
eXuldAPPNO: 0,
|
||||
projectID: 0);
|
||||
|
||||
List<InsuranceApprovalModel> _insuranceApproval = List();
|
||||
|
||||
List<InsuranceApprovalModel> get insuranceApproval => _insuranceApproval;
|
||||
|
||||
Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo}) async {
|
||||
hasError = false;
|
||||
// _cardList.clear();
|
||||
if (appointmentNo != null) {
|
||||
_insuranceApprovalModel.appointmentNo = appointmentNo;
|
||||
_insuranceApprovalModel.eXuldAPPNO = null;
|
||||
_insuranceApprovalModel.projectID = null;
|
||||
} else {
|
||||
_insuranceApprovalModel.appointmentNo = null;
|
||||
_insuranceApprovalModel.eXuldAPPNO = 0;
|
||||
_insuranceApprovalModel.projectID = 0;
|
||||
}
|
||||
|
||||
await baseAppClient.postPatient(GET_PAtIENTS_INSURANCE_APPROVALS,
|
||||
patient: patient,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
print(response['HIS_Approval_List'].length);
|
||||
_insuranceApproval.clear();
|
||||
_insuranceApproval.length = 0;
|
||||
response['HIS_Approval_List'].forEach((item) {
|
||||
_insuranceApproval.add(InsuranceApprovalModel.fromJson(item));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: _insuranceApprovalModel.toJson());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
import 'package:doctor_app_flutter/core/model/insurance_approval.dart';
|
||||
import 'package:doctor_app_flutter/core/service/InsuranceCardService.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
class InsuranceViewModel extends BaseViewModel{
|
||||
|
||||
InsuranceCardService _insuranceCardService = locator<InsuranceCardService>();
|
||||
|
||||
|
||||
List<InsuranceApprovalModel> get insuranceApproval =>
|
||||
_insuranceCardService.insuranceApproval;
|
||||
|
||||
Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo}) async {
|
||||
error = "";
|
||||
setState(ViewState.Busy);
|
||||
if (appointmentNo != null)
|
||||
await _insuranceCardService.getInsuranceApproval(patient,
|
||||
appointmentNo: appointmentNo);
|
||||
else
|
||||
await _insuranceCardService.getInsuranceApproval(patient);
|
||||
if (_insuranceCardService.hasError) {
|
||||
error = _insuranceCardService.error;
|
||||
setState(ViewState.ErrorLocal);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,428 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/InsuranceViewModel.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../base/base_view.dart';
|
||||
|
||||
class InsuranceApprovalScreenNew extends StatefulWidget {
|
||||
final int appointmentNo;
|
||||
|
||||
InsuranceApprovalScreenNew({this.appointmentNo});
|
||||
|
||||
@override
|
||||
_InsuranceApprovalScreenNewState createState() => _InsuranceApprovalScreenNewState();
|
||||
}
|
||||
|
||||
class _InsuranceApprovalScreenNewState extends State<InsuranceApprovalScreenNew> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
|
||||
return BaseView<InsuranceViewModel>(
|
||||
onModelReady: widget.appointmentNo != null
|
||||
? (model) =>
|
||||
model.getInsuranceApproval(patient,appointmentNo: widget.appointmentNo)
|
||||
: (model) => model.getInsuranceApproval(patient),
|
||||
builder: (BuildContext context, InsuranceViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: true,
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).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: <Widget>[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: SizeConfig.screenHeight * 0.09,
|
||||
color: Color(0xffEEEEEE),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).totalApproval,
|
||||
color: Color(0xff60688B),
|
||||
fontSize: 19.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
if (model.insuranceApproval.length > 0)
|
||||
Container(
|
||||
width: 60,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(19.0)),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
model.insuranceApproval[0].unUsedCount
|
||||
.toString(),
|
||||
color: Colors.white, fontSize: 17.0,
|
||||
),
|
||||
))
|
||||
],
|
||||
)),
|
||||
...List.generate(
|
||||
model.insuranceApproval.length,
|
||||
(index) => RoundedContainer(
|
||||
backgroundColor: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ExpansionTile(
|
||||
title: Container(
|
||||
//height: 120.0,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
model.insuranceApproval[index].patientDescription == "In Patient"
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
16.0)),
|
||||
width: 115.0,
|
||||
padding:
|
||||
EdgeInsets.only(left: 11.5),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).inPatient,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xff505A5D),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
16.0)),
|
||||
width: 115.0,
|
||||
padding:
|
||||
EdgeInsets.only(left: 11.5),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).outpatient,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.0),
|
||||
child: Texts(
|
||||
model.insuranceApproval[index]
|
||||
.clinicName,
|
||||
fontSize: 20.0,
|
||||
color: Color(0xff60686B),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
model.insuranceApproval[index]
|
||||
.doctorName,
|
||||
fontSize: 17.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 12.0, horizontal: 12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).approvalNo,
|
||||
fontSize: 18.0,
|
||||
),
|
||||
Texts(model.insuranceApproval[index].approvalNo.toString(),
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w600,),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.black,
|
||||
height: 25.0,
|
||||
thickness: 1.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).procedureStatus ,
|
||||
fontSize: 17.5,
|
||||
),
|
||||
SizedBox(width: 12,),
|
||||
Expanded(
|
||||
child: Texts(
|
||||
model.insuranceApproval[index].approvalStatusDescption,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 17.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.black,
|
||||
height: 25.0,
|
||||
thickness: 1.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).unusedCount,
|
||||
fontSize: 17.5,
|
||||
),
|
||||
Texts(
|
||||
model.insuranceApproval[index].unUsedCount.toString(),
|
||||
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),
|
||||
// ),
|
||||
Texts(
|
||||
TranslationBase.of(context).companyName,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 17.5,
|
||||
),
|
||||
|
||||
Divider(
|
||||
color: Colors.black,
|
||||
height: 25.0,
|
||||
thickness: 1.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).receiptOn ,
|
||||
fontSize: 17.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
),
|
||||
Texts(
|
||||
convertDateFormat(model.insuranceApproval[index].rceiptOn),
|
||||
fontSize: 17.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.black,
|
||||
height: 25.0,
|
||||
thickness: 1.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).expiryDate,
|
||||
fontSize: 17.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
),
|
||||
Texts(
|
||||
convertDateFormat(model.insuranceApproval[index].expiryDate),
|
||||
fontSize: 17.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.black,
|
||||
height: 55.0,
|
||||
thickness: 1.2,
|
||||
),
|
||||
IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(TranslationBase.of(
|
||||
context)
|
||||
.procedureName),
|
||||
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,
|
||||
thickness: 1.2,
|
||||
color: Colors.black,
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(TranslationBase.of(
|
||||
context)
|
||||
.procedureStatus),
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
VerticalDivider(
|
||||
width: 2.3,
|
||||
thickness: 1.2,
|
||||
color: Colors.black,
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(TranslationBase.of(
|
||||
context)
|
||||
.usageStatus),
|
||||
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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue