forked from yaso_meth/mih-project
Claim and statement fix
This commit is contained in:
@@ -21,6 +21,7 @@ class MIHClaimStatementGenerationApi {
|
||||
Future<void> generateClaimStatement(
|
||||
ClaimStatementGenerationArguments data,
|
||||
PatientViewArguments args,
|
||||
String env,
|
||||
BuildContext context,
|
||||
) async {
|
||||
//start loading circle
|
||||
@@ -31,6 +32,11 @@ class MIHClaimStatementGenerationApi {
|
||||
},
|
||||
);
|
||||
|
||||
DateTime now = new DateTime.now();
|
||||
// DateTime date = new DateTime(now.year, now.month, now.day);
|
||||
String fileName =
|
||||
"${data.document_type}-${data.patient_full_name}-${now.toString().substring(0, 19)}.pdf"
|
||||
.replaceAll(RegExp(r' '), '-');
|
||||
var response1 = await http.post(
|
||||
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/claim-statement/"),
|
||||
headers: <String, String>{
|
||||
@@ -39,7 +45,9 @@ class MIHClaimStatementGenerationApi {
|
||||
body: jsonEncode(<String, dynamic>{
|
||||
"document_type": data.document_type,
|
||||
"patient_app_id": data.patient_app_id,
|
||||
"env": env,
|
||||
"patient_full_name": data.patient_full_name,
|
||||
"fileName": fileName,
|
||||
"patient_id_no": data.patient_id_no,
|
||||
"has_med_aid": data.has_med_aid,
|
||||
"med_aid_no": data.med_aid_no,
|
||||
@@ -66,10 +74,6 @@ class MIHClaimStatementGenerationApi {
|
||||
}),
|
||||
);
|
||||
//print(response1.statusCode);
|
||||
DateTime now = new DateTime.now();
|
||||
DateTime date = new DateTime(now.year, now.month, now.day);
|
||||
String fileName =
|
||||
"${data.document_type}-${data.patient_full_name}-${date.toString().substring(0, 10)}.pdf";
|
||||
if (response1.statusCode == 200) {
|
||||
//Update this API
|
||||
var response2 = await http.post(
|
||||
@@ -176,6 +180,7 @@ class MIHClaimStatementGenerationApi {
|
||||
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
||||
static Future<void> deleteClaimStatementFilesByFileID(
|
||||
PatientViewArguments args,
|
||||
String env,
|
||||
String filePath,
|
||||
int fileID,
|
||||
BuildContext context,
|
||||
@@ -192,7 +197,10 @@ class MIHClaimStatementGenerationApi {
|
||||
headers: <String, String>{
|
||||
"Content-Type": "application/json; charset=UTF-8"
|
||||
},
|
||||
body: jsonEncode(<String, dynamic>{"file_path": filePath}),
|
||||
body: jsonEncode(<String, dynamic>{
|
||||
"file_path": filePath,
|
||||
"env": env,
|
||||
}),
|
||||
);
|
||||
//print("Here4");
|
||||
//print(response.statusCode);
|
||||
@@ -203,7 +211,8 @@ class MIHClaimStatementGenerationApi {
|
||||
headers: <String, String>{
|
||||
"Content-Type": "application/json; charset=UTF-8"
|
||||
},
|
||||
body: jsonEncode(<String, dynamic>{"idclaim_statement_file": fileID}),
|
||||
body: jsonEncode(
|
||||
<String, dynamic>{"idclaim_statement_file": fileID, "env": env}),
|
||||
);
|
||||
if (response2.statusCode == 200) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -23,12 +23,14 @@ class ClaimStatementWindow extends StatefulWidget {
|
||||
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
|
||||
@@ -265,6 +267,7 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
||||
widget.business,
|
||||
"business",
|
||||
),
|
||||
widget.env,
|
||||
context);
|
||||
} else {
|
||||
showDialog(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_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';
|
||||
@@ -15,7 +14,6 @@ import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_file_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
|
||||
class BuildClaimStatementFileList extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
@@ -24,6 +22,7 @@ class BuildClaimStatementFileList extends StatefulWidget {
|
||||
final Business? business;
|
||||
final BusinessUser? businessUser;
|
||||
final String type;
|
||||
final String env;
|
||||
const BuildClaimStatementFileList({
|
||||
super.key,
|
||||
required this.files,
|
||||
@@ -32,6 +31,7 @@ class BuildClaimStatementFileList extends StatefulWidget {
|
||||
required this.business,
|
||||
required this.businessUser,
|
||||
required this.type,
|
||||
required this.env,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -47,27 +47,14 @@ class _BuildClaimStatementFileListState
|
||||
String fileUrl = "";
|
||||
|
||||
Future<String> getFileUrlApiCall(String filePath) async {
|
||||
var url = "$baseAPI/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
||||
//print(url);
|
||||
var response = await http.get(Uri.parse(url));
|
||||
// print("here1");
|
||||
//print(response.statusCode);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
//print("here2");
|
||||
String body = response.body;
|
||||
//print(body);
|
||||
//print("here3");
|
||||
var decodedData = jsonDecode(body);
|
||||
//print("Dedoced: ${decodedData['minioURL']}");
|
||||
|
||||
return decodedData['minioURL'];
|
||||
//AppUser u = AppUser.fromJson(decodedData);
|
||||
// print(u.email);
|
||||
//return "AlometThere";
|
||||
} else {
|
||||
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||
}
|
||||
String teporaryFileUrl = "";
|
||||
await MihFileApi.getMinioFileUrl(
|
||||
filePath,
|
||||
context,
|
||||
).then((value) {
|
||||
teporaryFileUrl = value;
|
||||
});
|
||||
return teporaryFileUrl;
|
||||
}
|
||||
|
||||
void internetConnectionPopUp() {
|
||||
@@ -108,6 +95,7 @@ class _BuildClaimStatementFileListState
|
||||
widget.business,
|
||||
"business",
|
||||
),
|
||||
widget.env,
|
||||
filePath,
|
||||
fileID,
|
||||
context,
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_ap
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih-app_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_env/env.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business_user.dart';
|
||||
@@ -37,6 +38,7 @@ class PatientClaimOrStatement extends StatefulWidget {
|
||||
|
||||
class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||
late Future<List<ClaimStatementFile>> futueFiles;
|
||||
late String env;
|
||||
|
||||
void claimOrStatementWindow() {
|
||||
showDialog(
|
||||
@@ -47,6 +49,7 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||
signedInUser: widget.signedInUser,
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
env: env,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -100,6 +103,11 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||
MIHClaimStatementGenerationApi.getClaimStatementFilesByBusiness(
|
||||
widget.business!.business_id);
|
||||
}
|
||||
if (AppEnviroment.getEnv() == "Prod") {
|
||||
env = "Prod";
|
||||
} else {
|
||||
env = "Dev";
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -154,6 +162,7 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
type: widget.type,
|
||||
env: env,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user