forked from yaso_meth/mih-project
NEW: Patient Manager Provider Setup pt2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/claim_statement_file.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/files.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/notes.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart';
|
||||
@@ -11,6 +12,7 @@ class PatientManagerProvider extends ChangeNotifier {
|
||||
Patient? selectedPatient;
|
||||
List<Note>? consultationNotes;
|
||||
List<PFile>? patientDocuments;
|
||||
List<ClaimStatementFile>? patientClaimsDocuments;
|
||||
|
||||
PatientManagerProvider({
|
||||
this.patientProfileIndex = 0,
|
||||
@@ -60,4 +62,10 @@ class PatientManagerProvider extends ChangeNotifier {
|
||||
this.patientDocuments = patientDocuments ?? [];
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setClaimsDocuments(
|
||||
{required List<ClaimStatementFile>? patientClaimsDocuments}) {
|
||||
this.patientClaimsDocuments = patientClaimsDocuments ?? [];
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_icd10_code_services.dart';
|
||||
@@ -12,29 +15,16 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_search_bar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_text_form_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/icd10_code.dart.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/icd10_search_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ClaimStatementWindow extends StatefulWidget {
|
||||
final Patient selectedPatient;
|
||||
final AppUser signedInUser;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final String env;
|
||||
const ClaimStatementWindow({
|
||||
super.key,
|
||||
required this.selectedPatient,
|
||||
required this.signedInUser,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.env,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -83,326 +73,356 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
||||
}
|
||||
|
||||
Widget getWindowBody(double width) {
|
||||
return Padding(
|
||||
padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||
? EdgeInsets.symmetric(horizontal: width * 0.05)
|
||||
: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
MihForm(
|
||||
formKey: _formKey,
|
||||
formFields: [
|
||||
MihRadioOptions(
|
||||
controller: _docTypeController,
|
||||
hintText: "Document Type",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
requiredText: true,
|
||||
radioOptions: const ["Claim", "Statement"],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: Text(
|
||||
"Service Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")),
|
||||
const SizedBox(height: 10),
|
||||
MihDateField(
|
||||
controller: _serviceDateController,
|
||||
labelText: "Date of Service",
|
||||
required: true,
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihRadioOptions(
|
||||
controller: _serviceDescController,
|
||||
hintText: "Serviced Description",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
requiredText: true,
|
||||
radioOptions: const [
|
||||
"Consultation",
|
||||
"Procedure",
|
||||
"Other",
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: serviceDesc,
|
||||
builder: (BuildContext context, String value, Widget? child) {
|
||||
Widget returnWidget;
|
||||
switch (value) {
|
||||
case 'Consultation':
|
||||
returnWidget = Column(
|
||||
key: const ValueKey('consultation_fields'), // Added key
|
||||
children: [
|
||||
MihRadioOptions(
|
||||
key: const ValueKey('consultation_type_dropdown'),
|
||||
controller: _serviceDescOptionsController,
|
||||
hintText: "Consultation Type",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
requiredText: true,
|
||||
radioOptions: const [
|
||||
"General Consultation",
|
||||
"Follow-Up Consultation",
|
||||
"Specialist Consultation",
|
||||
"Emergency Consultation",
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
);
|
||||
break;
|
||||
case 'Procedure':
|
||||
returnWidget = Column(
|
||||
key: const ValueKey('procedure_fields'), // Added key
|
||||
children: [
|
||||
MihTextFormField(
|
||||
key: const ValueKey(
|
||||
'procedure_name_field'), // Added key
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: _prcedureNameController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Procedure Name",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
key: const ValueKey(
|
||||
'procedure_additional_info_field'), // Added key
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: _proceedureAdditionalInfoController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Additional Procedure Information",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
],
|
||||
);
|
||||
break;
|
||||
case 'Other':
|
||||
returnWidget = Column(
|
||||
key: const ValueKey('other_fields'), // Added key
|
||||
children: [
|
||||
MihTextFormField(
|
||||
key: const ValueKey(
|
||||
'other_service_description_field'), // Added key
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: _serviceDescOptionsController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Service Description Details",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
);
|
||||
break;
|
||||
default:
|
||||
returnWidget = const SizedBox(
|
||||
key: const ValueKey('empty_fields')); // Added key
|
||||
}
|
||||
return returnWidget;
|
||||
},
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("ICD-10 Code & Description",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
)),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
MihSearchBar(
|
||||
controller: _icd10CodeController,
|
||||
hintText: "ICD-10 Search",
|
||||
prefixIcon: Icons.search,
|
||||
return Consumer2<MzansiProfileProvider, PatientManagerProvider>(
|
||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||
PatientManagerProvider patientManagerProvider, Widget? child) {
|
||||
return Padding(
|
||||
padding:
|
||||
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||
? EdgeInsets.symmetric(horizontal: width * 0.05)
|
||||
: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
MihForm(
|
||||
formKey: _formKey,
|
||||
formFields: [
|
||||
MihRadioOptions(
|
||||
controller: _docTypeController,
|
||||
hintText: "Document Type",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
hintColor: MihColors.getPrimaryColor(
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
onPrefixIconTap: () {
|
||||
MIHIcd10CodeApis.getIcd10Codes(
|
||||
_icd10CodeController.text, context)
|
||||
.then((result) {
|
||||
icd10SearchWindow(result);
|
||||
});
|
||||
},
|
||||
onClearIconTap: () {
|
||||
_icd10CodeController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
requiredText: true,
|
||||
radioOptions: const ["Claim", "Statement"],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
controller: _amountController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
numberMode: true,
|
||||
hintText: "Service Cost",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: Text(
|
||||
"Additional Infomation",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
controller: _preauthNoController,
|
||||
multiLineInput: false,
|
||||
requiredText: false,
|
||||
hintText: "Pre-authorisation No.",
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: MihButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (isInputValid()) {
|
||||
MIHClaimStatementGenerationApi().generateClaimStatement(
|
||||
ClaimStatementGenerationArguments(
|
||||
_docTypeController.text,
|
||||
widget.selectedPatient.app_id,
|
||||
_fullNameController.text,
|
||||
_idController.text,
|
||||
_medAidController.text,
|
||||
_medAidNoController.text,
|
||||
_medAidCodeController.text,
|
||||
_medAidNameController.text,
|
||||
_medAidSchemeController.text,
|
||||
widget.business!.Name,
|
||||
"*To-Be Added*",
|
||||
widget.business!.contact_no,
|
||||
widget.business!.bus_email,
|
||||
_providerNameController.text,
|
||||
_practiceNoController.text,
|
||||
_vatNoController.text,
|
||||
_serviceDateController.text,
|
||||
_serviceDescController.text,
|
||||
_serviceDescOptionsController.text,
|
||||
_prcedureNameController.text,
|
||||
_proceedureAdditionalInfoController.text,
|
||||
_icd10CodeController.text,
|
||||
_amountController.text,
|
||||
_preauthNoController.text,
|
||||
widget.business!.logo_path,
|
||||
widget.businessUser!.sig_path,
|
||||
),
|
||||
PatientViewArguments(
|
||||
widget.signedInUser,
|
||||
widget.selectedPatient,
|
||||
widget.businessUser,
|
||||
widget.business,
|
||||
"business",
|
||||
),
|
||||
widget.env,
|
||||
context);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const MIHErrorMessage(
|
||||
errorType: "Input Error");
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
MihAlertServices().formNotFilledCompletely(context);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Generate",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: Text(
|
||||
"Service Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark")),
|
||||
const SizedBox(height: 10),
|
||||
MihDateField(
|
||||
controller: _serviceDateController,
|
||||
labelText: "Date of Service",
|
||||
required: true,
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihRadioOptions(
|
||||
controller: _serviceDescController,
|
||||
hintText: "Serviced Description",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
requiredText: true,
|
||||
radioOptions: const [
|
||||
"Consultation",
|
||||
"Procedure",
|
||||
"Other",
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: serviceDesc,
|
||||
builder:
|
||||
(BuildContext context, String value, Widget? child) {
|
||||
Widget returnWidget;
|
||||
switch (value) {
|
||||
case 'Consultation':
|
||||
returnWidget = Column(
|
||||
key: const ValueKey(
|
||||
'consultation_fields'), // Added key
|
||||
children: [
|
||||
MihRadioOptions(
|
||||
key: const ValueKey(
|
||||
'consultation_type_dropdown'),
|
||||
controller: _serviceDescOptionsController,
|
||||
hintText: "Consultation Type",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
requiredText: true,
|
||||
radioOptions: const [
|
||||
"General Consultation",
|
||||
"Follow-Up Consultation",
|
||||
"Specialist Consultation",
|
||||
"Emergency Consultation",
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
);
|
||||
break;
|
||||
case 'Procedure':
|
||||
returnWidget = Column(
|
||||
key:
|
||||
const ValueKey('procedure_fields'), // Added key
|
||||
children: [
|
||||
MihTextFormField(
|
||||
key: const ValueKey(
|
||||
'procedure_name_field'), // Added key
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
controller: _prcedureNameController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Procedure Name",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
key: const ValueKey(
|
||||
'procedure_additional_info_field'), // Added key
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
controller: _proceedureAdditionalInfoController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Additional Procedure Information",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
],
|
||||
);
|
||||
break;
|
||||
case 'Other':
|
||||
returnWidget = Column(
|
||||
key: const ValueKey('other_fields'), // Added key
|
||||
children: [
|
||||
MihTextFormField(
|
||||
key: const ValueKey(
|
||||
'other_service_description_field'), // Added key
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
controller: _serviceDescOptionsController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Service Description Details",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
);
|
||||
break;
|
||||
default:
|
||||
returnWidget = const SizedBox(
|
||||
key: const ValueKey('empty_fields')); // Added key
|
||||
}
|
||||
return returnWidget;
|
||||
},
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("ICD-10 Code & Description",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
)),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
MihSearchBar(
|
||||
controller: _icd10CodeController,
|
||||
hintText: "ICD-10 Search",
|
||||
prefixIcon: Icons.search,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
hintColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
onPrefixIconTap: () {
|
||||
MIHIcd10CodeApis.getIcd10Codes(
|
||||
_icd10CodeController.text, context)
|
||||
.then((result) {
|
||||
icd10SearchWindow(result);
|
||||
});
|
||||
},
|
||||
onClearIconTap: () {
|
||||
_icd10CodeController.clear();
|
||||
},
|
||||
searchFocusNode: _searchFocusNode,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
controller: _amountController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
numberMode: true,
|
||||
hintText: "Service Cost",
|
||||
validator: (value) {
|
||||
return MihValidationServices().isEmpty(value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: Text(
|
||||
"Additional Infomation",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark")),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
controller: _preauthNoController,
|
||||
multiLineInput: false,
|
||||
requiredText: false,
|
||||
hintText: "Pre-authorisation No.",
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: MihButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (isInputValid()) {
|
||||
MIHClaimStatementGenerationApi()
|
||||
.generateClaimStatement(
|
||||
profileProvider,
|
||||
patientManagerProvider,
|
||||
ClaimStatementGenerationArguments(
|
||||
_docTypeController.text,
|
||||
patientManagerProvider
|
||||
.selectedPatient!.app_id,
|
||||
_fullNameController.text,
|
||||
_idController.text,
|
||||
_medAidController.text,
|
||||
_medAidNoController.text,
|
||||
_medAidCodeController.text,
|
||||
_medAidNameController.text,
|
||||
_medAidSchemeController.text,
|
||||
profileProvider.business!.Name,
|
||||
"*To-Be Added*",
|
||||
profileProvider.business!.contact_no,
|
||||
profileProvider.business!.bus_email,
|
||||
_providerNameController.text,
|
||||
_practiceNoController.text,
|
||||
_vatNoController.text,
|
||||
_serviceDateController.text,
|
||||
_serviceDescController.text,
|
||||
_serviceDescOptionsController.text,
|
||||
_prcedureNameController.text,
|
||||
_proceedureAdditionalInfoController.text,
|
||||
_icd10CodeController.text,
|
||||
_amountController.text,
|
||||
_preauthNoController.text,
|
||||
profileProvider.business!.logo_path,
|
||||
profileProvider.businessUser!.sig_path,
|
||||
),
|
||||
AppEnviroment.getEnv(),
|
||||
context);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const MIHErrorMessage(
|
||||
errorType: "Input Error");
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
MihAlertServices().formNotFilledCompletely(context);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Generate",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -457,11 +477,11 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
||||
return true;
|
||||
}
|
||||
|
||||
String getUserTitle() {
|
||||
if (widget.businessUser!.title == "Doctor") {
|
||||
String getUserTitle(MzansiProfileProvider profileProvider) {
|
||||
if (profileProvider.businessUser!.title == "Doctor") {
|
||||
return "Dr.";
|
||||
} else {
|
||||
return widget.businessUser!.title;
|
||||
return profileProvider.businessUser!.title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,24 +520,32 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
PatientManagerProvider patientManagerProvider =
|
||||
context.read<PatientManagerProvider>();
|
||||
MzansiProfileProvider profileProvider =
|
||||
context.read<MzansiProfileProvider>();
|
||||
_serviceDescController.text = "Consultation";
|
||||
_serviceDescController.addListener(serviceDescriptionSelected);
|
||||
serviceDesc.value = "Consultation";
|
||||
_medAidController.addListener(hasMedAid);
|
||||
_fullNameController.text =
|
||||
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}";
|
||||
_idController.text = widget.selectedPatient.id_no;
|
||||
_medAidController.text = widget.selectedPatient.medical_aid;
|
||||
_medAidNameController.text = widget.selectedPatient.medical_aid_name;
|
||||
_medAidCodeController.text = widget.selectedPatient.medical_aid_code;
|
||||
_medAidNoController.text = widget.selectedPatient.medical_aid_no;
|
||||
_medAidSchemeController.text = widget.selectedPatient.medical_aid_scheme;
|
||||
"${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}";
|
||||
_idController.text = patientManagerProvider.selectedPatient!.id_no;
|
||||
_medAidController.text =
|
||||
patientManagerProvider.selectedPatient!.medical_aid;
|
||||
_medAidNameController.text =
|
||||
patientManagerProvider.selectedPatient!.medical_aid_name;
|
||||
_medAidCodeController.text =
|
||||
patientManagerProvider.selectedPatient!.medical_aid_code;
|
||||
_medAidNoController.text =
|
||||
patientManagerProvider.selectedPatient!.medical_aid_no;
|
||||
_medAidSchemeController.text =
|
||||
patientManagerProvider.selectedPatient!.medical_aid_scheme;
|
||||
_serviceDateController.text = getTodayDate();
|
||||
_providerNameController.text =
|
||||
"${getUserTitle()} ${widget.signedInUser.fname} ${widget.signedInUser.lname}";
|
||||
_practiceNoController.text = widget.business!.practice_no;
|
||||
_vatNoController.text = widget.business!.vat_no;
|
||||
"${getUserTitle(profileProvider)} ${profileProvider.user!.fname} ${profileProvider.user!.lname}";
|
||||
_practiceNoController.text = profileProvider.business!.practice_no;
|
||||
_vatNoController.text = profileProvider.business!.vat_no;
|
||||
hasMedAid();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,44 +5,26 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/claim_statement_file.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
import 'package:http/http.dart' as http2;
|
||||
import "package:universal_html/html.dart" as html;
|
||||
|
||||
class BuildClaimStatementFileList extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final List<ClaimStatementFile> files;
|
||||
final Patient selectedPatient;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final String type;
|
||||
final String env;
|
||||
const BuildClaimStatementFileList({
|
||||
super.key,
|
||||
required this.files,
|
||||
required this.signedInUser,
|
||||
required this.selectedPatient,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.type,
|
||||
required this.env,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -91,32 +73,32 @@ class _BuildClaimStatementFileListState
|
||||
);
|
||||
}
|
||||
|
||||
void deleteFilePopUp(String filePath, int fileID) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => MIHDeleteMessage(
|
||||
deleteType: "File",
|
||||
onTap: () async {
|
||||
//API Call here
|
||||
await MIHClaimStatementGenerationApi
|
||||
.deleteClaimStatementFilesByFileID(
|
||||
PatientViewArguments(
|
||||
widget.signedInUser,
|
||||
widget.selectedPatient,
|
||||
widget.businessUser,
|
||||
widget.business,
|
||||
"business",
|
||||
),
|
||||
widget.env,
|
||||
filePath,
|
||||
fileID,
|
||||
context,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
// void deleteFilePopUp(String filePath, int fileID) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// barrierDismissible: false,
|
||||
// builder: (context) => MIHDeleteMessage(
|
||||
// deleteType: "File",
|
||||
// onTap: () async {
|
||||
// //API Call here
|
||||
// await MIHClaimStatementGenerationApi
|
||||
// .deleteClaimStatementFilesByFileID(
|
||||
// PatientViewArguments(
|
||||
// widget.signedInUser,
|
||||
// widget.selectedPatient,
|
||||
// widget.businessUser,
|
||||
// widget.business,
|
||||
// "business",
|
||||
// ),
|
||||
// widget.env,
|
||||
// filePath,
|
||||
// fileID,
|
||||
// context,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
String getFileName(String path) {
|
||||
//print(pdfLink.split(".")[1]);
|
||||
@@ -159,9 +141,10 @@ class _BuildClaimStatementFileListState
|
||||
}
|
||||
}
|
||||
|
||||
void viewFilePopUp(String fileName, String filePath, int fileID, String url) {
|
||||
void viewFilePopUp(PatientManagerProvider patientManagerProvider,
|
||||
String fileName, String filePath, int fileID, String url) {
|
||||
bool hasAccessToDelete = false;
|
||||
if (widget.type == "business") {
|
||||
if (!patientManagerProvider.personalMode) {
|
||||
hasAccessToDelete = true;
|
||||
}
|
||||
|
||||
@@ -263,7 +246,7 @@ class _BuildClaimStatementFileListState
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
onTap: () {
|
||||
deleteFilePopUp(filePath, fileID);
|
||||
// deleteFilePopUp(filePath, fileID);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -332,135 +315,149 @@ class _BuildClaimStatementFileListState
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.files.isNotEmpty) {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
},
|
||||
itemCount: widget.files.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
widget.files[index].file_name,
|
||||
style: TextStyle(
|
||||
return Consumer2<MzansiProfileProvider, PatientManagerProvider>(
|
||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||
PatientManagerProvider patientManagerProvider, Widget? child) {
|
||||
if (patientManagerProvider.patientClaimsDocuments!.isNotEmpty) {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
widget.files[index].insert_date,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
// trailing: Icon(
|
||||
// Icons.arrow_forward,
|
||||
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// ),
|
||||
onTap: () async {
|
||||
await getFileUrlApiCall(widget.files[index].file_path)
|
||||
.then((urlHere) {
|
||||
//print(url);
|
||||
setState(() {
|
||||
fileUrl = urlHere;
|
||||
});
|
||||
});
|
||||
|
||||
viewFilePopUp(
|
||||
widget.files[index].file_name,
|
||||
widget.files[index].file_path,
|
||||
widget.files[index].idclaim_statement_file,
|
||||
fileUrl);
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
const SizedBox(height: 50),
|
||||
Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: [
|
||||
Icon(
|
||||
MihIcons.mihRing,
|
||||
size: 165,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
Icon(
|
||||
Icons.file_open_outlined,
|
||||
size: 110,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"No Claims or Statements have been added to this profile.",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
itemCount: patientManagerProvider.patientClaimsDocuments!.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
patientManagerProvider
|
||||
.patientClaimsDocuments![index].file_name,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Visibility(
|
||||
visible: widget.business != null,
|
||||
child: Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
subtitle: Text(
|
||||
patientManagerProvider
|
||||
.patientClaimsDocuments![index].insert_date,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
// trailing: Icon(
|
||||
// Icons.arrow_forward,
|
||||
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// ),
|
||||
onTap: () async {
|
||||
await getFileUrlApiCall(patientManagerProvider
|
||||
.patientClaimsDocuments![index].file_path)
|
||||
.then((urlHere) {
|
||||
//print(url);
|
||||
setState(() {
|
||||
fileUrl = urlHere;
|
||||
});
|
||||
});
|
||||
|
||||
viewFilePopUp(
|
||||
patientManagerProvider,
|
||||
patientManagerProvider
|
||||
.patientClaimsDocuments![index].file_name,
|
||||
patientManagerProvider
|
||||
.patientClaimsDocuments![index].file_path,
|
||||
patientManagerProvider.patientClaimsDocuments![index]
|
||||
.idclaim_statement_file,
|
||||
fileUrl);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
const SizedBox(height: 50),
|
||||
Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: [
|
||||
Icon(
|
||||
MihIcons.mihRing,
|
||||
size: 165,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
children: [
|
||||
TextSpan(text: "Press "),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
Icons.menu,
|
||||
size: 20,
|
||||
Icon(
|
||||
Icons.file_open_outlined,
|
||||
size: 110,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"No Claims or Statements have been added to this profile.",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
TextSpan(text: " to generate the first document"),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Visibility(
|
||||
visible: !patientManagerProvider.personalMode,
|
||||
child: Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
children: [
|
||||
TextSpan(text: "Press "),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Icon(
|
||||
Icons.menu,
|
||||
size: 20,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
TextSpan(text: " to generate the first document"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,18 @@
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/claim_statement_file.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/claim_statement_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_claim_statement_files_list.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PatientClaimOrStatement extends StatefulWidget {
|
||||
final int patientIndex;
|
||||
final Patient selectedPatient;
|
||||
final AppUser signedInUser;
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final String type;
|
||||
const PatientClaimOrStatement({
|
||||
super.key,
|
||||
required this.patientIndex,
|
||||
required this.selectedPatient,
|
||||
required this.signedInUser,
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -38,39 +21,16 @@ class PatientClaimOrStatement extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||
late Future<List<ClaimStatementFile>> futueFiles;
|
||||
late String env;
|
||||
|
||||
void claimOrStatementWindow() {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => ClaimStatementWindow(
|
||||
selectedPatient: widget.selectedPatient,
|
||||
signedInUser: widget.signedInUser,
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
env: env,
|
||||
),
|
||||
builder: (context) => ClaimStatementWindow(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.business == null) {
|
||||
futueFiles =
|
||||
MIHClaimStatementGenerationApi.getClaimStatementFilesByPatient(
|
||||
widget.signedInUser.app_id);
|
||||
} else {
|
||||
futueFiles =
|
||||
MIHClaimStatementGenerationApi.getClaimStatementFilesByBusiness(
|
||||
widget.business!.business_id);
|
||||
}
|
||||
if (AppEnviroment.getEnv() == "Prod") {
|
||||
env = "Prod";
|
||||
} else {
|
||||
env = "Dev";
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -83,72 +43,57 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||
}
|
||||
|
||||
Widget getBody() {
|
||||
return Stack(
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: futueFiles,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: Mihloadingcircle(),
|
||||
);
|
||||
} else if (snapshot.hasData) {
|
||||
final filesList = snapshot.data!;
|
||||
return Column(
|
||||
children: [
|
||||
//const Placeholder(),
|
||||
BuildClaimStatementFileList(
|
||||
files: filesList,
|
||||
signedInUser: widget.signedInUser,
|
||||
selectedPatient: widget.selectedPatient,
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
type: widget.type,
|
||||
env: env,
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return const Center(
|
||||
child: Text("Error Loading Notes"),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
Visibility(
|
||||
visible: widget.type != "personal",
|
||||
child: Positioned(
|
||||
right: 10,
|
||||
bottom: 10,
|
||||
child: MihFloatingMenu(
|
||||
icon: Icons.file_copy,
|
||||
animatedIcon: AnimatedIcons.menu_close,
|
||||
return Consumer2<MzansiProfileProvider, PatientManagerProvider>(
|
||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||
PatientManagerProvider patientManagerProvider, Widget? child) {
|
||||
return Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SpeedDialChild(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
label: "Generate Claim/ Statement",
|
||||
labelBackgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
labelStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
onTap: () {
|
||||
claimOrStatementWindow();
|
||||
},
|
||||
)
|
||||
//const Placeholder(),
|
||||
BuildClaimStatementFileList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Visibility(
|
||||
visible: patientManagerProvider.personalMode,
|
||||
child: Positioned(
|
||||
right: 10,
|
||||
bottom: 10,
|
||||
child: MihFloatingMenu(
|
||||
icon: Icons.file_copy,
|
||||
animatedIcon: AnimatedIcons.menu_close,
|
||||
children: [
|
||||
SpeedDialChild(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
label: "Generate Claim/ Statement",
|
||||
labelBackgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
labelStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
onTap: () {
|
||||
claimOrStatementWindow();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_claim_or_statement.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_consultation.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_documents.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -48,6 +50,8 @@ class _PatientProfileState extends State<PatientProfile> {
|
||||
await MihPatientServices()
|
||||
.getPatientConsultationNotes(patientManagerProvider);
|
||||
await MihPatientServices().getPatientDocuments(patientManagerProvider);
|
||||
await MIHClaimStatementGenerationApi.getClaimStatementFilesByPatient(
|
||||
patientManagerProvider);
|
||||
}
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
@@ -137,14 +141,7 @@ class _PatientProfileState extends State<PatientProfile> {
|
||||
PatientInfo(),
|
||||
PatientConsultation(),
|
||||
PatientDocuments(),
|
||||
// PatientClaimOrStatement(
|
||||
// patientIndex: widget.arguments.selectedPatient!.idpatients,
|
||||
// selectedPatient: widget.arguments.selectedPatient!,
|
||||
// signedInUser: widget.arguments.signedInUser,
|
||||
// business: widget.arguments.business,
|
||||
// businessUser: widget.arguments.businessUser,
|
||||
// type: widget.arguments.type,
|
||||
// ),
|
||||
PatientClaimOrStatement(),
|
||||
];
|
||||
return toolBodies;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loa
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/claim_statement_file.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
|
||||
import '../mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||
@@ -20,8 +22,9 @@ class MIHClaimStatementGenerationApi {
|
||||
///
|
||||
/// Returns TBC.
|
||||
Future<void> generateClaimStatement(
|
||||
MzansiProfileProvider profileProvider,
|
||||
PatientManagerProvider patientManagerProvider,
|
||||
ClaimStatementGenerationArguments data,
|
||||
PatientViewArguments args,
|
||||
String env,
|
||||
BuildContext context,
|
||||
) async {
|
||||
@@ -84,19 +87,13 @@ class MIHClaimStatementGenerationApi {
|
||||
},
|
||||
body: jsonEncode(<String, dynamic>{
|
||||
"app_id": data.patient_app_id,
|
||||
"business_id": args.business!.business_id,
|
||||
"business_id": profileProvider.business!.business_id,
|
||||
"file_path": "${data.patient_app_id}/claims-statements/$fileName",
|
||||
"file_name": fileName
|
||||
}),
|
||||
);
|
||||
if (response2.statusCode == 201) {
|
||||
context.pop(); // end loading circle
|
||||
context.pop();
|
||||
|
||||
context.pushNamed(
|
||||
'patientManagerPatient',
|
||||
extra: args,
|
||||
);
|
||||
getClaimStatementFilesByPatient(patientManagerProvider);
|
||||
String message =
|
||||
"The ${data.document_type}: $fileName has been successfully generated and added to ${data.patient_full_name}'s record. You can now access and download it for their use.";
|
||||
successPopUp(message, context);
|
||||
@@ -114,11 +111,11 @@ class MIHClaimStatementGenerationApi {
|
||||
///
|
||||
/// Returns List<ClaimStatementFile>.
|
||||
static Future<List<ClaimStatementFile>> getClaimStatementFilesByPatient(
|
||||
String app_id,
|
||||
PatientManagerProvider patientManagerProvider,
|
||||
) async {
|
||||
//print("Patien manager page: $endpoint");
|
||||
final response = await http.get(Uri.parse(
|
||||
"${AppEnviroment.baseApiUrl}/files/claim-statement/patient/$app_id"));
|
||||
"${AppEnviroment.baseApiUrl}/files/claim-statement/patient/${patientManagerProvider.selectedPatient!.app_id}"));
|
||||
// print("Here");
|
||||
// print("Body: ${response.body}");
|
||||
// print("Code: ${response.statusCode}");
|
||||
@@ -132,7 +129,9 @@ class MIHClaimStatementGenerationApi {
|
||||
List<ClaimStatementFile> docList = List<ClaimStatementFile>.from(
|
||||
l.map((model) => ClaimStatementFile.fromJson(model)));
|
||||
//print("Here3");
|
||||
//print(patientQueue);
|
||||
print(docList);
|
||||
patientManagerProvider.setClaimsDocuments(
|
||||
patientClaimsDocuments: docList);
|
||||
return docList;
|
||||
} else {
|
||||
throw Exception(
|
||||
|
||||
Reference in New Issue
Block a user