diff --git a/lib/config/config.dart b/lib/config/config.dart index 657ac507..35446d66 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -238,7 +238,8 @@ const GET_PAtIENTS_INSURANCE_APPROVALS = const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; -const GET_IN_PATIENT_ORDERS = 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; +const GET_IN_PATIENT_ORDERS = + 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; ///Prescriptions const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; @@ -257,6 +258,9 @@ const CREATE_PROGRESS_NOTE_FOR_INPATIENT = "Services/DoctorApplication.svc/REST/ const GET_PRESCRIPTION_IN_PATIENT = 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; +const GET_INSURANCE_IN_PATIENT = + "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/core/insurance_approval_request_model.dart b/lib/core/insurance_approval_request_model.dart new file mode 100644 index 00000000..02f71ecb --- /dev/null +++ b/lib/core/insurance_approval_request_model.dart @@ -0,0 +1,64 @@ +class InsuranceApprovalInPatientRequestModel { + int patientID; + int patientTypeID; + int eXuldAPPNO; + int projectID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + InsuranceApprovalInPatientRequestModel( + {this.patientID, + this.patientTypeID, + this.eXuldAPPNO, + this.projectID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA}); + + InsuranceApprovalInPatientRequestModel.fromJson(Map json) { + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + eXuldAPPNO = json['EXuldAPPNO']; + projectID = json['ProjectID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + data['EXuldAPPNO'] = this.eXuldAPPNO; + data['ProjectID'] = this.projectID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/core/model/insurance_approval_in_patient_model.dart b/lib/core/model/insurance_approval_in_patient_model.dart new file mode 100644 index 00000000..798affc9 --- /dev/null +++ b/lib/core/model/insurance_approval_in_patient_model.dart @@ -0,0 +1,273 @@ +class InsuranceApprovalInPatientModel { + String setupID; + int projectID; + int approvalNo; + int status; + String approvalDate; + int patientType; + int patientID; + int companyID; + bool subCategoryID; + int doctorID; + int clinicID; + int approvalType; + int inpatientApprovalSubType; + dynamic isApprovalOnGross; + String companyApprovalNo; + dynamic progNoteOrderNo; + String submitOn; + String receiptOn; + String expiryDate; + int admissionNo; + int admissionRequestNo; + String approvalStatusDescption; + dynamic approvalStatusDescptionN; + dynamic remarks; + List apporvalDetails; + String clinicName; + dynamic companyName; + String doctorName; + String projectName; + int totaUnUsedCount; + int unUsedCount; + + InsuranceApprovalInPatientModel( + {this.setupID, + this.projectID, + this.approvalNo, + this.status, + this.approvalDate, + this.patientType, + this.patientID, + this.companyID, + this.subCategoryID, + this.doctorID, + this.clinicID, + this.approvalType, + this.inpatientApprovalSubType, + this.isApprovalOnGross, + this.companyApprovalNo, + this.progNoteOrderNo, + this.submitOn, + this.receiptOn, + this.expiryDate, + this.admissionNo, + this.admissionRequestNo, + this.approvalStatusDescption, + this.approvalStatusDescptionN, + this.remarks, + this.apporvalDetails, + this.clinicName, + this.companyName, + this.doctorName, + this.projectName, + this.totaUnUsedCount, + this.unUsedCount}); + + InsuranceApprovalInPatientModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + approvalNo = json['ApprovalNo']; + status = json['Status']; + approvalDate = json['ApprovalDate']; + patientType = json['PatientType']; + patientID = json['PatientID']; + companyID = json['CompanyID']; + subCategoryID = json['SubCategoryID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + approvalType = json['ApprovalType']; + inpatientApprovalSubType = json['InpatientApprovalSubType']; + isApprovalOnGross = json['IsApprovalOnGross']; + companyApprovalNo = json['CompanyApprovalNo']; + progNoteOrderNo = json['ProgNoteOrderNo']; + submitOn = json['SubmitOn']; + receiptOn = json['ReceiptOn']; + expiryDate = json['ExpiryDate']; + admissionNo = json['AdmissionNo']; + admissionRequestNo = json['AdmissionRequestNo']; + approvalStatusDescption = json['ApprovalStatusDescption']; + approvalStatusDescptionN = json['ApprovalStatusDescptionN']; + remarks = json['Remarks']; + if (json['ApporvalDetails'] != null) { + apporvalDetails = new List(); + json['ApporvalDetails'].forEach((v) { + apporvalDetails.add(new ApporvalDetails.fromJson(v)); + }); + } + clinicName = json['ClinicName']; + companyName = json['CompanyName']; + doctorName = json['DoctorName']; + projectName = json['ProjectName']; + totaUnUsedCount = json['TotaUnUsedCount']; + unUsedCount = json['UnUsedCount']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ApprovalNo'] = this.approvalNo; + data['Status'] = this.status; + data['ApprovalDate'] = this.approvalDate; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['CompanyID'] = this.companyID; + data['SubCategoryID'] = this.subCategoryID; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['ApprovalType'] = this.approvalType; + data['InpatientApprovalSubType'] = this.inpatientApprovalSubType; + data['IsApprovalOnGross'] = this.isApprovalOnGross; + data['CompanyApprovalNo'] = this.companyApprovalNo; + data['ProgNoteOrderNo'] = this.progNoteOrderNo; + data['SubmitOn'] = this.submitOn; + data['ReceiptOn'] = this.receiptOn; + data['ExpiryDate'] = this.expiryDate; + data['AdmissionNo'] = this.admissionNo; + data['AdmissionRequestNo'] = this.admissionRequestNo; + data['ApprovalStatusDescption'] = this.approvalStatusDescption; + data['ApprovalStatusDescptionN'] = this.approvalStatusDescptionN; + data['Remarks'] = this.remarks; + if (this.apporvalDetails != null) { + data['ApporvalDetails'] = + this.apporvalDetails.map((v) => v.toJson()).toList(); + } + data['ClinicName'] = this.clinicName; + data['CompanyName'] = this.companyName; + data['DoctorName'] = this.doctorName; + data['ProjectName'] = this.projectName; + data['TotaUnUsedCount'] = this.totaUnUsedCount; + data['UnUsedCount'] = this.unUsedCount; + return data; + } +} + +class ApporvalDetails { + Null setupID; + Null projectID; + int approvalNo; + Null lineItemNo; + Null orderType; + Null procedureID; + Null toothNo; + Null price; + Null approvedAmount; + Null unapprovedPatientShare; + Null waivedAmount; + Null discountType; + Null discountValue; + Null shareType; + Null patientShareTypeValue; + Null companyShareTypeValue; + Null patientShare; + Null companyShare; + Null deductableAmount; + String disapprovedRemarks; + Null progNoteOrderNo; + Null progNoteLineItemNo; + Null invoiceTransactionType; + Null invoiceNo; + String procedureName; + String procedureNameN; + String status; + Null isInvoiced; + String isInvoicedDesc; + + ApporvalDetails( + {this.setupID, + this.projectID, + this.approvalNo, + this.lineItemNo, + this.orderType, + this.procedureID, + this.toothNo, + this.price, + this.approvedAmount, + this.unapprovedPatientShare, + this.waivedAmount, + this.discountType, + this.discountValue, + this.shareType, + this.patientShareTypeValue, + this.companyShareTypeValue, + this.patientShare, + this.companyShare, + this.deductableAmount, + this.disapprovedRemarks, + this.progNoteOrderNo, + this.progNoteLineItemNo, + this.invoiceTransactionType, + this.invoiceNo, + this.procedureName, + this.procedureNameN, + this.status, + this.isInvoiced, + this.isInvoicedDesc}); + + ApporvalDetails.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + approvalNo = json['ApprovalNo']; + lineItemNo = json['LineItemNo']; + orderType = json['OrderType']; + procedureID = json['ProcedureID']; + toothNo = json['ToothNo']; + price = json['Price']; + approvedAmount = json['ApprovedAmount']; + unapprovedPatientShare = json['UnapprovedPatientShare']; + waivedAmount = json['WaivedAmount']; + discountType = json['DiscountType']; + discountValue = json['DiscountValue']; + shareType = json['ShareType']; + patientShareTypeValue = json['PatientShareTypeValue']; + companyShareTypeValue = json['CompanyShareTypeValue']; + patientShare = json['PatientShare']; + companyShare = json['CompanyShare']; + deductableAmount = json['DeductableAmount']; + disapprovedRemarks = json['DisapprovedRemarks']; + progNoteOrderNo = json['ProgNoteOrderNo']; + progNoteLineItemNo = json['ProgNoteLineItemNo']; + invoiceTransactionType = json['InvoiceTransactionType']; + invoiceNo = json['InvoiceNo']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + status = json['Status']; + isInvoiced = json['IsInvoiced']; + isInvoicedDesc = json['IsInvoicedDesc']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ApprovalNo'] = this.approvalNo; + data['LineItemNo'] = this.lineItemNo; + data['OrderType'] = this.orderType; + data['ProcedureID'] = this.procedureID; + data['ToothNo'] = this.toothNo; + data['Price'] = this.price; + data['ApprovedAmount'] = this.approvedAmount; + data['UnapprovedPatientShare'] = this.unapprovedPatientShare; + data['WaivedAmount'] = this.waivedAmount; + data['DiscountType'] = this.discountType; + data['DiscountValue'] = this.discountValue; + data['ShareType'] = this.shareType; + data['PatientShareTypeValue'] = this.patientShareTypeValue; + data['CompanyShareTypeValue'] = this.companyShareTypeValue; + data['PatientShare'] = this.patientShare; + data['CompanyShare'] = this.companyShare; + data['DeductableAmount'] = this.deductableAmount; + data['DisapprovedRemarks'] = this.disapprovedRemarks; + data['ProgNoteOrderNo'] = this.progNoteOrderNo; + data['ProgNoteLineItemNo'] = this.progNoteLineItemNo; + data['InvoiceTransactionType'] = this.invoiceTransactionType; + data['InvoiceNo'] = this.invoiceNo; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + data['Status'] = this.status; + data['IsInvoiced'] = this.isInvoiced; + data['IsInvoicedDesc'] = this.isInvoicedDesc; + return data; + } +} diff --git a/lib/core/service/InsuranceCardService.dart b/lib/core/service/InsuranceCardService.dart index de7ee433..b736c34f 100644 --- a/lib/core/service/InsuranceCardService.dart +++ b/lib/core/service/InsuranceCardService.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/insurance_approval_request_model.dart'; import 'package:doctor_app_flutter/core/model/insurance_approval.dart'; +import 'package:doctor_app_flutter/core/model/insurance_approval_in_patient_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -10,27 +12,55 @@ class InsuranceCardService extends BaseService { patientType: 1, eXuldAPPNO: 0, projectID: 0); + InsuranceApprovalInPatientRequestModel + _insuranceApprovalInPatientRequestModel = + InsuranceApprovalInPatientRequestModel(); List _insuranceApproval = List(); - List get insuranceApproval => _insuranceApproval; - Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo , int projectId}) async { + List _insuranceApprovalInPatient = List(); + List get insuranceApprovalInPatient => + _insuranceApprovalInPatient; + + Future getInsuranceApprovalInPatient({int mrn}) async { + _insuranceApprovalInPatientRequestModel = + InsuranceApprovalInPatientRequestModel( + patientID: mrn, + patientTypeID: 1, + ); + hasError = false; + insuranceApprovalInPatient.clear(); + + await baseAppClient.post(GET_INSURANCE_IN_PATIENT, + onSuccess: (dynamic response, int statusCode) { + //prescriptionsList.clear(); + response['List_ApprovalMain_InPatient'].forEach((prescriptions) { + insuranceApprovalInPatient + .add(InsuranceApprovalInPatientModel.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _insuranceApprovalInPatientRequestModel.toJson()); + } + + Future getInsuranceApproval(PatiantInformtion patient, + {int appointmentNo, int projectId}) async { hasError = false; // _cardList.clear(); - // if (appointmentNo != null) { - // _insuranceApprovalModel.appointmentNo = appointmentNo; - // _insuranceApprovalModel.eXuldAPPNO = null; + // if (appointmentNo != null) { + // _insuranceApprovalModel.appointmentNo = appointmentNo; + // _insuranceApprovalModel.eXuldAPPNO = null; // _insuranceApprovalModel.projectID = projectId; - // } else { - _insuranceApprovalModel.appointmentNo = null; - _insuranceApprovalModel.eXuldAPPNO = 0; - _insuranceApprovalModel.projectID = 0; - // } + // } else { + _insuranceApprovalModel.appointmentNo = null; + _insuranceApprovalModel.eXuldAPPNO = 0; + _insuranceApprovalModel.projectID = 0; + // } await baseAppClient.postPatient(GET_PAtIENTS_INSURANCE_APPROVALS, - patient: patient, - onSuccess: (dynamic response, int statusCode) { + patient: patient, onSuccess: (dynamic response, int statusCode) { print(response['HIS_Approval_List'].length); _insuranceApproval.clear(); _insuranceApproval.length = 0; diff --git a/lib/core/viewModel/InsuranceViewModel.dart b/lib/core/viewModel/InsuranceViewModel.dart index 941abcfb..54e61635 100644 --- a/lib/core/viewModel/InsuranceViewModel.dart +++ b/lib/core/viewModel/InsuranceViewModel.dart @@ -1,31 +1,45 @@ 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/model/insurance_approval_in_patient_model.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{ - +class InsuranceViewModel extends BaseViewModel { InsuranceCardService _insuranceCardService = locator(); - List get insuranceApproval => _insuranceCardService.insuranceApproval; + List get insuranceApprovalInPatient => + _insuranceCardService.insuranceApprovalInPatient; - Future getInsuranceApproval(PatiantInformtion patient,{int appointmentNo, int projectId}) async { + Future getInsuranceApproval(PatiantInformtion patient, + {int appointmentNo, int projectId}) async { error = ""; setState(ViewState.Busy); if (appointmentNo != null) await _insuranceCardService.getInsuranceApproval(patient, - appointmentNo: appointmentNo,projectId: projectId); + appointmentNo: appointmentNo, projectId: projectId); else await _insuranceCardService.getInsuranceApproval(patient); if (_insuranceCardService.hasError) { error = "No Insurance Approval Found"; - setState(ViewState.Error); + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getInsuranceInPatient({int mrn}) async { + //hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _insuranceCardService.getInsuranceApprovalInPatient(mrn: mrn); + if (_insuranceCardService.hasError) { + error = _insuranceCardService.error; + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } -} \ No newline at end of file +} diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index 605d61b3..7baa1330 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -40,11 +40,13 @@ class _InsuranceApprovalScreenNewState String patientType = routeArgs['patientType']; return BaseView( - onModelReady: patient.appointmentNo != null - ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo, - projectId: patient.projectId) - : (model) => model.getInsuranceApproval(patient), + onModelReady: patientType == "1" + ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) + : patient.appointmentNo != null + ? (model) => model.getInsuranceApproval(patient, + appointmentNo: patient.appointmentNo, + projectId: patient.projectId) + : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( appBar: PatientProfileHeaderNewDesignAppBar( @@ -52,97 +54,200 @@ class _InsuranceApprovalScreenNewState 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: model.insuranceApproval.length != 0 - ? Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( + body: patientType == "1" + ? SingleChildScrollView( + child: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04, + ), + child: model.insuranceApprovalInPatient.length != 0 + ? Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( children: [ - AppText( - 'Insurance', - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', + Row( + children: [ + AppText( + 'Insurance', + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + 'Approvals', + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], ), ], ), - Row( - children: [ - AppText( - 'Approvals', - fontSize: 30.0, - fontWeight: FontWeight.w700, + ), + ...List.generate( + model.insuranceApprovalInPatient.length, + (index) => Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + InsuranceApprovalsDetails( + patient: patient, + indexInsurance: index, + patientType: patientType, + )), + ); + }, + child: DoctorCardInsurance( + patientOut: "In Patient", + profileUrl: + 'https://previews.123rf.com/images/ihorbiliavskyi/ihorbiliavskyi1812/ihorbiliavskyi181200077/114296311-doctor-avatar-icon-profession-logo-male-character-a-man-in-professional-clothes-people-specialists-f.jpg', + clinic: model + .insuranceApprovalInPatient[index] + .clinicName, + doctorName: model + .insuranceApprovalInPatient[index] + .doctorName, + branch: model + .insuranceApprovalInPatient[index] + .approvalNo + .toString(), + isPrescriptions: true, + approvalStatus: model + .insuranceApprovalInPatient[index] + .approvalStatusDescption ?? + '', + branch2: model + .insuranceApprovalInPatient[index] + .projectName, ), - ], + ), + ), + ), + ], + ) + : Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText('No Insurance Approval Found'), + ), + SizedBox( + height: 150.0, + ) ], ), ), - ...List.generate( - model.insuranceApproval.length, - (index) => Container( - child: InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - InsuranceApprovalsDetails( - patient: patient, - indexInsurance: index, - )), - ); - }, - child: DoctorCardInsurance( - patientOut: model.insuranceApproval[index] - .patientDescription, - profileUrl: - model.insuranceApproval[index].doctorImage, - clinic: - model.insuranceApproval[index].clinicName, - doctorName: - model.insuranceApproval[index].doctorName, - branch: model - .insuranceApproval[index].approvalNo - .toString(), - isPrescriptions: true, - approvalStatus: model.insuranceApproval[index] - .approvalStatusDescption ?? - '', - branch2: - model.insuranceApproval[index].projectName, + ), + ) + : SingleChildScrollView( + child: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04, + ), + child: model.insuranceApproval.length != 0 + ? Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + children: [ + AppText( + 'Insurance', + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + 'Approvals', + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], + ), + ], + ), ), - ), - ), - ), - ], - ) - : Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 100, - ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText('No Insurance Approval Found'), + ...List.generate( + model.insuranceApproval.length, + (index) => Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + InsuranceApprovalsDetails( + patient: patient, + indexInsurance: index, + patientType: patientType, + )), + ); + }, + child: DoctorCardInsurance( + patientOut: model.insuranceApproval[index] + .patientDescription, + profileUrl: model + .insuranceApproval[index].doctorImage, + clinic: model + .insuranceApproval[index].clinicName, + doctorName: model + .insuranceApproval[index].doctorName, + branch: model + .insuranceApproval[index].approvalNo + .toString(), + isPrescriptions: true, + approvalStatus: model + .insuranceApproval[index] + .approvalStatusDescption ?? + '', + branch2: model + .insuranceApproval[index].projectName, + ), + ), + ), + ), + ], ) - ], - ), - )), - ), + : Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText('No Insurance Approval Found'), + ) + ], + ), + )), + ), ), ); } diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index bcb8e7d5..1fb13465 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -16,18 +16,25 @@ import 'package:provider/provider.dart'; class InsuranceApprovalsDetails extends StatefulWidget { PatiantInformtion patient; int indexInsurance; - InsuranceApprovalsDetails({this.patient, this.indexInsurance}); + String patientType; + + InsuranceApprovalsDetails( + {this.patient, this.indexInsurance, this.patientType}); @override _InsuranceApprovalsDetailsState createState() => _InsuranceApprovalsDetailsState( - patient: patient, indexInsurance: indexInsurance); + patient: patient, + indexInsurance: indexInsurance, + patientType: patientType); } class _InsuranceApprovalsDetailsState extends State { PatiantInformtion patient; int indexInsurance; + String patientType; - _InsuranceApprovalsDetailsState({this.patient, this.indexInsurance}); + _InsuranceApprovalsDetailsState( + {this.patient, this.indexInsurance, this.patientType}); @override Widget build(BuildContext context) { @@ -35,350 +42,732 @@ class _InsuranceApprovalsDetailsState extends State { final routeArgs = ModalRoute.of(context).settings.arguments as Map; return BaseView( - onModelReady: patient.appointmentNo != null - ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo, - projectId: patient.projectId) - : (model) => model.getInsuranceApproval(patient), + onModelReady: (model) => model.insuranceApprovalInPatient.length == 0 + ? patientType == "1" + ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) + : patient.appointmentNo != null + ? (model) => model.getInsuranceApproval(patient, + appointmentNo: patient.appointmentNo, + projectId: patient.projectId) + : (model) => model.getInsuranceApproval(patient) + : null, builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( isShowAppBar: true, baseViewModel: model, appBar: PatientProfileHeaderNewDesignAppBar( patient, patient.patientType.toString(), patient.arrivedOn), - body: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), + body: patientType == "1" + ? SingleChildScrollView( + child: Container( child: Column( children: [ - Row( - children: [ - AppText( - 'Insurance', - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - ), - ], - ), - Row( - children: [ - AppText( - 'Approvals', - fontSize: 30.0, - fontWeight: FontWeight.w700, - ), - ], - ), - ], - ), - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( children: [ - AppText( - model.insuranceApproval[indexInsurance] - .approvalStatusDescption != - null - ? model - .insuranceApproval[ - indexInsurance] - .approvalStatusDescption ?? - "" - : "", - color: model - .insuranceApproval[ - indexInsurance] - .approvalStatusDescption != - null - ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == - "Approved" - ? Color(0xff359846) - : Color(0xffD02127) - : Color(0xffD02127), + Row( + children: [ + AppText( + 'Insurance', + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + 'Approvals', + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], ), ], ), - Row( - children: [ - AppText( - model.insuranceApproval[indexInsurance] - .doctorName - .toUpperCase(), - color: Colors.black, - fontSize: 18, - fontWeight: FontWeight.bold, - ) - ], - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 8.0), - child: Row( + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( children: [ - Column( + Row( children: [ - Container( - height: 85.0, - width: 85.0, - child: CircleAvatar( - radius: - SizeConfig.imageSizeMultiplier * - 12, - // radius: (52) - child: ClipRRect( - borderRadius: - BorderRadius.circular(50), - child: Image.network( - model - .insuranceApproval[ - indexInsurance] - .doctorImage, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: Colors.transparent, - ), + AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalStatusDescption != + null + ? model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalStatusDescption ?? + "" + : "", + color: model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalStatusDescption != + null + ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == + "Approved" + ? Color(0xff359846) + : Color(0xffD02127) + : Color(0xffD02127), ), ], ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - height: 25.0, + Row( + children: [ + AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .doctorName + .toUpperCase(), + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( + children: [ + Column( + children: [ + Container( + height: 85.0, + width: 85.0, + child: CircleAvatar( + radius: SizeConfig + .imageSizeMultiplier * + 12, + // radius: (52) + child: ClipRRect( + borderRadius: + BorderRadius.circular( + 50), + child: Image.network( + 'https://previews.123rf.com/images/ihorbiliavskyi/ihorbiliavskyi1812/ihorbiliavskyi181200077/114296311-doctor-avatar-icon-profession-logo-male-character-a-man-in-professional-clothes-people-specialists-f.jpg', + fit: BoxFit.fill, + width: 700, + ), + ), + backgroundColor: + Colors.transparent, + ), + ), + ], + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25.0, + ), + Row( + children: [ + AppText( + 'Clinic: ', + color: Colors.grey[500], + fontSize: 14, + ), + Expanded( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .clinicName, + fontSize: 14, + ), + ) + ], + ), + Row( + children: [ + AppText( + 'Approval No: ', + color: Colors.grey[500], + fontSize: 14, + ), + AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .approvalNo + .toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + 'Unused Count:', + color: Colors.grey[500], + fontSize: 14, + ), + AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + .unUsedCount + .toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + 'Company Name :', + color: Colors.grey[500], + ), + AppText('Sample') + ], + ), + Row( + children: [ + AppText( + 'Receipt on: ', + color: Colors.grey[500], + ), + Expanded( + child: AppText( + '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: + FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + AppText( + 'Exp on: ', + color: Colors.grey[500], + ), + AppText( + '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: + FontWeight.w600, + ), + ], + ), + ], + ), ), - Row( + ), + ], + ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( children: [ - AppText( - 'Clinic: ', - color: Colors.grey[500], - fontSize: 14, - ), Expanded( child: AppText( - model - .insuranceApproval[ - indexInsurance] - .clinicName, - fontSize: 14, + 'Procedure', + fontWeight: FontWeight.w700, ), - ) - ], - ), - Row( - children: [ - AppText( - 'Approval No: ', - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model - .insuranceApproval[ - indexInsurance] - .approvalNo - .toString(), - fontSize: 14, - ) - ], - ), - Row( - children: [ - AppText( - 'Unused Count:', - color: Colors.grey[500], - fontSize: 14, - ), - AppText(model - .insuranceApproval[ - indexInsurance] - .unUsedCount - .toString(), - fontSize: 14, - ) - - ], - ), - Row( - children: [ - AppText( - 'Company Name :', - color: Colors.grey[500], - ), - AppText('Sample') - ], - ), - Row( - children: [ - AppText( - 'Receipt on: ', - color: Colors.grey[500], ), Expanded( child: AppText( - '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, + 'Status', + fontWeight: FontWeight.w700, ), ), + Expanded( + child: AppText( + 'Usage Status', + fontWeight: FontWeight.w700, + ), + ) ], ), - Row( - children: [ - AppText( - 'Exp on: ', - color: Colors.grey[500], - ), - AppText( - '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - ), - ], - ), - ], - ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model + .insuranceApprovalInPatient[ + indexInsurance] + .apporvalDetails + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.procedureName ?? + "", + textAlign: + TextAlign + .start, + ), + ), + ), + Expanded( + child: Container( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.status ?? + "", + textAlign: + TextAlign + .center, + ), + ), + ), + Expanded( + child: Container( + child: AppText( + model + .insuranceApprovalInPatient[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.isInvoicedDesc ?? + "", + textAlign: + TextAlign + .center, + ), + ), + ), + ], + ), + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, + ), + ], + ), + ); + }), + ), + ], ), ), ], ), ), - SizedBox( - height: 20.0, + ), + ], + ), + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + children: [ + AppText( + 'Insurance', + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + 'Approvals', + fontSize: 30.0, + fontWeight: FontWeight.w700, + ), + ], + ), + ], ), - Container( + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), child: Column( children: [ + Row( + children: [ + AppText( + model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption != + null + ? model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption ?? + "" + : "", + color: model + .insuranceApproval[ + indexInsurance] + .approvalStatusDescption != + null + ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == + "Approved" + ? Color(0xff359846) + : Color(0xffD02127) + : Color(0xffD02127), + ), + ], + ), + Row( + children: [ + AppText( + model + .insuranceApproval[indexInsurance] + .doctorName + .toUpperCase(), + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + ], + ), Padding( padding: const EdgeInsets.symmetric( horizontal: 8.0), child: Row( children: [ - Expanded( - child: AppText( - 'Procedure', - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - 'Status', - fontWeight: FontWeight.w700, - ), + Column( + children: [ + Container( + height: 85.0, + width: 85.0, + child: CircleAvatar( + radius: SizeConfig + .imageSizeMultiplier * + 12, + // radius: (52) + child: ClipRRect( + borderRadius: + BorderRadius.circular( + 50), + child: Image.network( + model + .insuranceApproval[ + indexInsurance] + .doctorImage, + fit: BoxFit.fill, + width: 700, + ), + ), + backgroundColor: + Colors.transparent, + ), + ), + ], ), Expanded( - child: AppText( - 'Usage Status', - fontWeight: FontWeight.w700, - ), - ) - ], - ), - ), - Divider( - color: Colors.black, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model - .insuranceApproval[indexInsurance] - .apporvalDetails - .length, - itemBuilder: (BuildContext context, - int index) { - return Container( + child: Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 8.0), child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, children: [ + SizedBox( + height: 25.0, + ), Row( - children: [ - Expanded( - child: Container( - - child: AppText(model - .insuranceApproval[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.procedureName ?? - "",textAlign: TextAlign.start,), - ), + AppText( + 'Clinic: ', + color: Colors.grey[500], + fontSize: 14, ), Expanded( - child: Container( - - child: AppText(model - .insuranceApproval[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.status ?? - "",textAlign: TextAlign.center,), + child: AppText( + model + .insuranceApproval[ + indexInsurance] + .clinicName, + fontSize: 14, ), + ) + ], + ), + Row( + children: [ + AppText( + 'Approval No: ', + color: Colors.grey[500], + fontSize: 14, + ), + AppText( + model + .insuranceApproval[ + indexInsurance] + .approvalNo + .toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + 'Unused Count:', + color: Colors.grey[500], + fontSize: 14, + ), + AppText( + model + .insuranceApproval[ + indexInsurance] + .unUsedCount + .toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + 'Company Name :', + color: Colors.grey[500], + ), + AppText('Sample') + ], + ), + Row( + children: [ + AppText( + 'Receipt on: ', + color: Colors.grey[500], ), Expanded( - child: Container( - child: AppText(model - .insuranceApproval[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.isInvoicedDesc ?? - "",textAlign: TextAlign.center,), + child: AppText( + '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: + FontWeight.w600, ), ), ], ), - SizedBox(width: 5,), - Divider( - color: Colors.black38, + Row( + children: [ + AppText( + 'Exp on: ', + color: Colors.grey[500], + ), + AppText( + '${DateUtils.getDayMonthYearDateFormatted(DateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: + FontWeight.w600, + ), + ], ), ], ), - ); - }), + ), + ), + ], + ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + 'Procedure', + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + 'Status', + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + 'Usage Status', + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model + .insuranceApproval[ + indexInsurance] + .apporvalDetails + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.procedureName ?? + "", + textAlign: + TextAlign + .start, + ), + ), + ), + Expanded( + child: Container( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.status ?? + "", + textAlign: + TextAlign + .center, + ), + ), + ), + Expanded( + child: Container( + child: AppText( + model + .insuranceApproval[ + indexInsurance] + ?.apporvalDetails[ + index] + ?.isInvoicedDesc ?? + "", + textAlign: + TextAlign + .center, + ), + ), + ), + ], + ), + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, + ), + ], + ), + ); + }), + ), + ], + ), ), - ], ), ), - ], - ), + ), + ], ), ), - ], - ), - ), - )), + )), ); } } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart index c1f746aa..138b5922 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart @@ -82,14 +82,14 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { nameLine2: TranslationBase.of(context).prescription, icon: 'patient/order_prescription.png'), PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - route: PROGRESS_NOTE, - nameLine1: TranslationBase.of(context).progress, - nameLine2: TranslationBase.of(context).note, - icon: 'patient/Progress_notes.png'), + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + route: PROGRESS_NOTE, + nameLine1: TranslationBase.of(context).progress, + nameLine2: TranslationBase.of(context).note, + icon: 'patient/Progress_notes.png'), PatientProfileButton( key: key, patient: patient, @@ -149,15 +149,15 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { nameLine2: TranslationBase.of(context).approvals, icon: 'patient/vital_signs.png'), PatientProfileButton( - key: key, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - isDisable: true, - route: null, - nameLine1: "Discharge", - nameLine2: "Summery", - icon: 'patient/patient_sick_leave.png'), + key: key, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + isDisable: true, + route: null, + nameLine1: "Discharge", + nameLine2: "Summery", + icon: 'patient/patient_sick_leave.png'), ], ), ); diff --git a/lib/widgets/shared/doctor_card_insurance.dart b/lib/widgets/shared/doctor_card_insurance.dart index 44d102db..7eb2b522 100644 --- a/lib/widgets/shared/doctor_card_insurance.dart +++ b/lib/widgets/shared/doctor_card_insurance.dart @@ -41,7 +41,7 @@ class DoctorCardInsurance extends StatelessWidget { ProjectViewModel projectViewModel = Provider.of(context); return Container( width: double.maxFinite, - height: 160, + //height: 160, margin: EdgeInsets.all(10), padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration(