NEW: Patient Manager Provider Setup pt2

This commit is contained in:
2025-10-29 13:59:09 +02:00
parent 79ed959b42
commit 99d0fa4aa8
6 changed files with 603 additions and 629 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; 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/files.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_objects/notes.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/notes.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart';
@@ -11,6 +12,7 @@ class PatientManagerProvider extends ChangeNotifier {
Patient? selectedPatient; Patient? selectedPatient;
List<Note>? consultationNotes; List<Note>? consultationNotes;
List<PFile>? patientDocuments; List<PFile>? patientDocuments;
List<ClaimStatementFile>? patientClaimsDocuments;
PatientManagerProvider({ PatientManagerProvider({
this.patientProfileIndex = 0, this.patientProfileIndex = 0,
@@ -60,4 +62,10 @@ class PatientManagerProvider extends ChangeNotifier {
this.patientDocuments = patientDocuments ?? []; this.patientDocuments = patientDocuments ?? [];
notifyListeners(); notifyListeners();
} }
void setClaimsDocuments(
{required List<ClaimStatementFile>? patientClaimsDocuments}) {
this.patientClaimsDocuments = patientClaimsDocuments ?? [];
notifyListeners();
}
} }

View File

@@ -1,5 +1,8 @@
import 'package:mzansi_innovation_hub/main.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_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_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_claim_statement_generation_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'; 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_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_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_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/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/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:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/icd10_search_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
class ClaimStatementWindow extends StatefulWidget { class ClaimStatementWindow extends StatefulWidget {
final Patient selectedPatient;
final AppUser signedInUser;
final Business? business;
final BusinessUser? businessUser;
final String env;
const ClaimStatementWindow({ const ClaimStatementWindow({
super.key, super.key,
required this.selectedPatient,
required this.signedInUser,
required this.business,
required this.businessUser,
required this.env,
}); });
@override @override
@@ -83,326 +73,356 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
} }
Widget getWindowBody(double width) { Widget getWindowBody(double width) {
return Padding( return Consumer2<MzansiProfileProvider, PatientManagerProvider>(
padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop" builder: (BuildContext context, MzansiProfileProvider profileProvider,
? EdgeInsets.symmetric(horizontal: width * 0.05) PatientManagerProvider patientManagerProvider, Widget? child) {
: const EdgeInsets.symmetric(horizontal: 0), return Padding(
child: Column( padding:
children: [ MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
MihForm( ? EdgeInsets.symmetric(horizontal: width * 0.05)
formKey: _formKey, : const EdgeInsets.symmetric(horizontal: 0),
formFields: [ child: Column(
MihRadioOptions( children: [
controller: _docTypeController, MihForm(
hintText: "Document Type", formKey: _formKey,
fillColor: MihColors.getSecondaryColor( formFields: [
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MihRadioOptions(
secondaryFillColor: MihColors.getPrimaryColor( controller: _docTypeController,
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), hintText: "Document Type",
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,
fillColor: MihColors.getSecondaryColor( fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
hintColor: MihColors.getPrimaryColor( secondaryFillColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
onPrefixIconTap: () { requiredText: true,
MIHIcd10CodeApis.getIcd10Codes( radioOptions: const ["Claim", "Statement"],
_icd10CodeController.text, context)
.then((result) {
icd10SearchWindow(result);
});
},
onClearIconTap: () {
_icd10CodeController.clear();
},
searchFocusNode: _searchFocusNode,
), ),
], const SizedBox(height: 10),
), Center(
const SizedBox(height: 10), child: Text(
MihTextFormField( "Service Details",
fillColor: MihColors.getSecondaryColor( textAlign: TextAlign.center,
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), style: TextStyle(
inputColor: MihColors.getPrimaryColor( fontSize: 25,
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), fontWeight: FontWeight.bold,
controller: _amountController, color: MihColors.getSecondaryColor(
multiLineInput: false, MzansiInnovationHub.of(context)!.theme.mode ==
requiredText: true, "Dark"),
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,
), ),
), ),
), 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; return true;
} }
String getUserTitle() { String getUserTitle(MzansiProfileProvider profileProvider) {
if (widget.businessUser!.title == "Doctor") { if (profileProvider.businessUser!.title == "Doctor") {
return "Dr."; return "Dr.";
} else { } else {
return widget.businessUser!.title; return profileProvider.businessUser!.title;
} }
} }
@@ -500,24 +520,32 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
PatientManagerProvider patientManagerProvider =
context.read<PatientManagerProvider>();
MzansiProfileProvider profileProvider =
context.read<MzansiProfileProvider>();
_serviceDescController.text = "Consultation"; _serviceDescController.text = "Consultation";
_serviceDescController.addListener(serviceDescriptionSelected); _serviceDescController.addListener(serviceDescriptionSelected);
serviceDesc.value = "Consultation"; serviceDesc.value = "Consultation";
_medAidController.addListener(hasMedAid); _medAidController.addListener(hasMedAid);
_fullNameController.text = _fullNameController.text =
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}"; "${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}";
_idController.text = widget.selectedPatient.id_no; _idController.text = patientManagerProvider.selectedPatient!.id_no;
_medAidController.text = widget.selectedPatient.medical_aid; _medAidController.text =
_medAidNameController.text = widget.selectedPatient.medical_aid_name; patientManagerProvider.selectedPatient!.medical_aid;
_medAidCodeController.text = widget.selectedPatient.medical_aid_code; _medAidNameController.text =
_medAidNoController.text = widget.selectedPatient.medical_aid_no; patientManagerProvider.selectedPatient!.medical_aid_name;
_medAidSchemeController.text = widget.selectedPatient.medical_aid_scheme; _medAidCodeController.text =
patientManagerProvider.selectedPatient!.medical_aid_code;
_medAidNoController.text =
patientManagerProvider.selectedPatient!.medical_aid_no;
_medAidSchemeController.text =
patientManagerProvider.selectedPatient!.medical_aid_scheme;
_serviceDateController.text = getTodayDate(); _serviceDateController.text = getTodayDate();
_providerNameController.text = _providerNameController.text =
"${getUserTitle()} ${widget.signedInUser.fname} ${widget.signedInUser.lname}"; "${getUserTitle(profileProvider)} ${profileProvider.user!.fname} ${profileProvider.user!.lname}";
_practiceNoController.text = widget.business!.practice_no; _practiceNoController.text = profileProvider.business!.practice_no;
_vatNoController.text = widget.business!.vat_no; _vatNoController.text = profileProvider.business!.vat_no;
hasMedAid(); hasMedAid();
} }

View File

@@ -5,44 +5,26 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.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_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_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_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_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_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_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.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_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/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:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_file_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:supertokens_flutter/http.dart' as http; import 'package:supertokens_flutter/http.dart' as http;
import 'package:http/http.dart' as http2; import 'package:http/http.dart' as http2;
import "package:universal_html/html.dart" as html; import "package:universal_html/html.dart" as html;
class BuildClaimStatementFileList extends StatefulWidget { 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({ const BuildClaimStatementFileList({
super.key, super.key,
required this.files,
required this.signedInUser,
required this.selectedPatient,
required this.business,
required this.businessUser,
required this.type,
required this.env,
}); });
@override @override
@@ -91,32 +73,32 @@ class _BuildClaimStatementFileListState
); );
} }
void deleteFilePopUp(String filePath, int fileID) { // void deleteFilePopUp(String filePath, int fileID) {
showDialog( // showDialog(
context: context, // context: context,
barrierDismissible: false, // barrierDismissible: false,
builder: (context) => MIHDeleteMessage( // builder: (context) => MIHDeleteMessage(
deleteType: "File", // deleteType: "File",
onTap: () async { // onTap: () async {
//API Call here // //API Call here
await MIHClaimStatementGenerationApi // await MIHClaimStatementGenerationApi
.deleteClaimStatementFilesByFileID( // .deleteClaimStatementFilesByFileID(
PatientViewArguments( // PatientViewArguments(
widget.signedInUser, // widget.signedInUser,
widget.selectedPatient, // widget.selectedPatient,
widget.businessUser, // widget.businessUser,
widget.business, // widget.business,
"business", // "business",
), // ),
widget.env, // widget.env,
filePath, // filePath,
fileID, // fileID,
context, // context,
); // );
}, // },
), // ),
); // );
} // }
String getFileName(String path) { String getFileName(String path) {
//print(pdfLink.split(".")[1]); //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; bool hasAccessToDelete = false;
if (widget.type == "business") { if (!patientManagerProvider.personalMode) {
hasAccessToDelete = true; hasAccessToDelete = true;
} }
@@ -263,7 +246,7 @@ class _BuildClaimStatementFileListState
backgroundColor: MihColors.getGreenColor( backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
onTap: () { onTap: () {
deleteFilePopUp(filePath, fileID); // deleteFilePopUp(filePath, fileID);
}, },
), ),
); );
@@ -332,135 +315,149 @@ class _BuildClaimStatementFileListState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (widget.files.isNotEmpty) { return Consumer2<MzansiProfileProvider, PatientManagerProvider>(
return ListView.separated( builder: (BuildContext context, MzansiProfileProvider profileProvider,
shrinkWrap: true, PatientManagerProvider patientManagerProvider, Widget? child) {
physics: const NeverScrollableScrollPhysics(), if (patientManagerProvider.patientClaimsDocuments!.isNotEmpty) {
separatorBuilder: (BuildContext context, int index) { return ListView.separated(
return Divider( shrinkWrap: true,
color: MihColors.getSecondaryColor( physics: const NeverScrollableScrollPhysics(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), separatorBuilder: (BuildContext context, int index) {
); return Divider(
},
itemCount: widget.files.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
widget.files[index].file_name,
style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), 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);
}, },
); itemCount: patientManagerProvider.patientClaimsDocuments!.length,
}, itemBuilder: (context, index) {
); return ListTile(
} else { title: Text(
return Padding( patientManagerProvider
padding: const EdgeInsets.symmetric(horizontal: 10.0), .patientClaimsDocuments![index].file_name,
child: Column( style: TextStyle(
mainAxisAlignment: MainAxisAlignment.center, color: MihColors.getSecondaryColor(
crossAxisAlignment: CrossAxisAlignment.center, MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
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"),
),
), ),
), ),
], subtitle: Text(
), patientManagerProvider
const SizedBox(height: 25), .patientClaimsDocuments![index].insert_date,
Visibility( style: TextStyle(
visible: widget.business != null, color: MihColors.getSecondaryColor(
child: Center( MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
child: RichText( ),
textAlign: TextAlign.center, ),
text: TextSpan( // trailing: Icon(
style: TextStyle( // Icons.arrow_forward,
fontSize: 20, // color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontWeight: FontWeight.normal, // ),
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( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"), "Dark"),
), ),
children: [ Icon(
TextSpan(text: "Press "), Icons.file_open_outlined,
WidgetSpan( size: 110,
alignment: PlaceholderAlignment.middle, color: MihColors.getSecondaryColor(
child: Icon( MzansiInnovationHub.of(context)!.theme.mode ==
Icons.menu, "Dark"),
size: 20, ),
],
),
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( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"), "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"),
],
),
),
), ),
), ),
), ],
), ),
], );
), }
); },
} );
} }
} }

View File

@@ -1,35 +1,18 @@
import 'package:flutter_speed_dial/flutter_speed_dial.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.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_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_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_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/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:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/list_builders/build_claim_statement_files_list.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PatientClaimOrStatement extends StatefulWidget { class PatientClaimOrStatement extends StatefulWidget {
final int patientIndex;
final Patient selectedPatient;
final AppUser signedInUser;
final Business? business;
final BusinessUser? businessUser;
final String type;
const PatientClaimOrStatement({ const PatientClaimOrStatement({
super.key, super.key,
required this.patientIndex,
required this.selectedPatient,
required this.signedInUser,
required this.business,
required this.businessUser,
required this.type,
}); });
@override @override
@@ -38,39 +21,16 @@ class PatientClaimOrStatement extends StatefulWidget {
} }
class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> { class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
late Future<List<ClaimStatementFile>> futueFiles;
late String env;
void claimOrStatementWindow() { void claimOrStatementWindow() {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) => ClaimStatementWindow( builder: (context) => ClaimStatementWindow(),
selectedPatient: widget.selectedPatient,
signedInUser: widget.signedInUser,
business: widget.business,
businessUser: widget.businessUser,
env: env,
),
); );
} }
@override @override
void initState() { 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(); super.initState();
} }
@@ -83,72 +43,57 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
} }
Widget getBody() { Widget getBody() {
return Stack( return Consumer2<MzansiProfileProvider, PatientManagerProvider>(
children: [ builder: (BuildContext context, MzansiProfileProvider profileProvider,
FutureBuilder( PatientManagerProvider patientManagerProvider, Widget? child) {
future: futueFiles, return Stack(
builder: (context, snapshot) { children: [
if (snapshot.connectionState == ConnectionState.waiting) { Column(
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,
children: [ children: [
SpeedDialChild( //const Placeholder(),
child: Icon( BuildClaimStatementFileList(),
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();
},
)
], ],
), ),
), 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();
},
)
],
),
),
),
],
);
},
); );
} }
} }

View File

@@ -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_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/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_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_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_documents.dart';
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart'; import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/package_tools/patient_info.dart';
import 'package:flutter/material.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:mzansi_innovation_hub/mih_services/mih_patient_services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -48,6 +50,8 @@ class _PatientProfileState extends State<PatientProfile> {
await MihPatientServices() await MihPatientServices()
.getPatientConsultationNotes(patientManagerProvider); .getPatientConsultationNotes(patientManagerProvider);
await MihPatientServices().getPatientDocuments(patientManagerProvider); await MihPatientServices().getPatientDocuments(patientManagerProvider);
await MIHClaimStatementGenerationApi.getClaimStatementFilesByPatient(
patientManagerProvider);
} }
setState(() { setState(() {
isLoading = false; isLoading = false;
@@ -137,14 +141,7 @@ class _PatientProfileState extends State<PatientProfile> {
PatientInfo(), PatientInfo(),
PatientConsultation(), PatientConsultation(),
PatientDocuments(), PatientDocuments(),
// PatientClaimOrStatement( 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,
// ),
]; ];
return toolBodies; return toolBodies;
} }

View File

@@ -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/arguments.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_objects/claim_statement_file.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/claim_statement_file.dart';
import 'package:flutter/material.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 'package:supertokens_flutter/http.dart' as http;
import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -20,8 +22,9 @@ class MIHClaimStatementGenerationApi {
/// ///
/// Returns TBC. /// Returns TBC.
Future<void> generateClaimStatement( Future<void> generateClaimStatement(
MzansiProfileProvider profileProvider,
PatientManagerProvider patientManagerProvider,
ClaimStatementGenerationArguments data, ClaimStatementGenerationArguments data,
PatientViewArguments args,
String env, String env,
BuildContext context, BuildContext context,
) async { ) async {
@@ -84,19 +87,13 @@ class MIHClaimStatementGenerationApi {
}, },
body: jsonEncode(<String, dynamic>{ body: jsonEncode(<String, dynamic>{
"app_id": data.patient_app_id, "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_path": "${data.patient_app_id}/claims-statements/$fileName",
"file_name": fileName "file_name": fileName
}), }),
); );
if (response2.statusCode == 201) { if (response2.statusCode == 201) {
context.pop(); // end loading circle getClaimStatementFilesByPatient(patientManagerProvider);
context.pop();
context.pushNamed(
'patientManagerPatient',
extra: args,
);
String message = 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."; "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); successPopUp(message, context);
@@ -114,11 +111,11 @@ class MIHClaimStatementGenerationApi {
/// ///
/// Returns List<ClaimStatementFile>. /// Returns List<ClaimStatementFile>.
static Future<List<ClaimStatementFile>> getClaimStatementFilesByPatient( static Future<List<ClaimStatementFile>> getClaimStatementFilesByPatient(
String app_id, PatientManagerProvider patientManagerProvider,
) async { ) async {
//print("Patien manager page: $endpoint"); //print("Patien manager page: $endpoint");
final response = await http.get(Uri.parse( 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("Here");
// print("Body: ${response.body}"); // print("Body: ${response.body}");
// print("Code: ${response.statusCode}"); // print("Code: ${response.statusCode}");
@@ -132,7 +129,9 @@ class MIHClaimStatementGenerationApi {
List<ClaimStatementFile> docList = List<ClaimStatementFile>.from( List<ClaimStatementFile> docList = List<ClaimStatementFile>.from(
l.map((model) => ClaimStatementFile.fromJson(model))); l.map((model) => ClaimStatementFile.fromJson(model)));
//print("Here3"); //print("Here3");
//print(patientQueue); print(docList);
patientManagerProvider.setClaimsDocuments(
patientClaimsDocuments: docList);
return docList; return docList;
} else { } else {
throw Exception( throw Exception(