Merge pull request #174 from yaso-meth/BUG--File-uploud-in-Dev
BUG--File-uploud-in-Dev
This commit is contained in:
@@ -21,6 +21,7 @@ class MIHClaimStatementGenerationApi {
|
|||||||
Future<void> generateClaimStatement(
|
Future<void> generateClaimStatement(
|
||||||
ClaimStatementGenerationArguments data,
|
ClaimStatementGenerationArguments data,
|
||||||
PatientViewArguments args,
|
PatientViewArguments args,
|
||||||
|
String env,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
) async {
|
) async {
|
||||||
//start loading circle
|
//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(
|
var response1 = await http.post(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/claim-statement/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/claim-statement/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@@ -39,7 +45,9 @@ class MIHClaimStatementGenerationApi {
|
|||||||
body: jsonEncode(<String, dynamic>{
|
body: jsonEncode(<String, dynamic>{
|
||||||
"document_type": data.document_type,
|
"document_type": data.document_type,
|
||||||
"patient_app_id": data.patient_app_id,
|
"patient_app_id": data.patient_app_id,
|
||||||
|
"env": env,
|
||||||
"patient_full_name": data.patient_full_name,
|
"patient_full_name": data.patient_full_name,
|
||||||
|
"fileName": fileName,
|
||||||
"patient_id_no": data.patient_id_no,
|
"patient_id_no": data.patient_id_no,
|
||||||
"has_med_aid": data.has_med_aid,
|
"has_med_aid": data.has_med_aid,
|
||||||
"med_aid_no": data.med_aid_no,
|
"med_aid_no": data.med_aid_no,
|
||||||
@@ -66,10 +74,6 @@ class MIHClaimStatementGenerationApi {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
//print(response1.statusCode);
|
//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) {
|
if (response1.statusCode == 200) {
|
||||||
//Update this API
|
//Update this API
|
||||||
var response2 = await http.post(
|
var response2 = await http.post(
|
||||||
@@ -176,6 +180,7 @@ class MIHClaimStatementGenerationApi {
|
|||||||
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
||||||
static Future<void> deleteClaimStatementFilesByFileID(
|
static Future<void> deleteClaimStatementFilesByFileID(
|
||||||
PatientViewArguments args,
|
PatientViewArguments args,
|
||||||
|
String env,
|
||||||
String filePath,
|
String filePath,
|
||||||
int fileID,
|
int fileID,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
@@ -192,7 +197,10 @@ class MIHClaimStatementGenerationApi {
|
|||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"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("Here4");
|
||||||
//print(response.statusCode);
|
//print(response.statusCode);
|
||||||
@@ -203,7 +211,8 @@ class MIHClaimStatementGenerationApi {
|
|||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"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) {
|
if (response2.statusCode == 200) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class MihFileApi {
|
|||||||
|
|
||||||
static Future<int> uploadFile(
|
static Future<int> uploadFile(
|
||||||
String app_id,
|
String app_id,
|
||||||
|
String env,
|
||||||
String folderName,
|
String folderName,
|
||||||
PlatformFile? file,
|
PlatformFile? file,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
@@ -69,6 +70,7 @@ class MihFileApi {
|
|||||||
request.headers['Authorization'] = 'Bearer $token';
|
request.headers['Authorization'] = 'Bearer $token';
|
||||||
request.headers['Content-Type'] = 'multipart/form-data';
|
request.headers['Content-Type'] = 'multipart/form-data';
|
||||||
request.fields['app_id'] = app_id;
|
request.fields['app_id'] = app_id;
|
||||||
|
request.fields['env'] = env;
|
||||||
request.fields['folder'] = folderName;
|
request.fields['folder'] = folderName;
|
||||||
request.files.add(await http2.MultipartFile.fromBytes('file', file!.bytes!,
|
request.files.add(await http2.MultipartFile.fromBytes('file', file!.bytes!,
|
||||||
filename: file.name.replaceAll(RegExp(r' '), '-')));
|
filename: file.name.replaceAll(RegExp(r' '), '-')));
|
||||||
@@ -79,6 +81,7 @@ class MihFileApi {
|
|||||||
|
|
||||||
static Future<int> deleteFile(
|
static Future<int> deleteFile(
|
||||||
String app_id,
|
String app_id,
|
||||||
|
String env,
|
||||||
String folderName,
|
String folderName,
|
||||||
String fileName,
|
String fileName,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
@@ -91,7 +94,10 @@ class MihFileApi {
|
|||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, dynamic>{"file_path": filePath}),
|
body: jsonEncode(<String, dynamic>{
|
||||||
|
"file_path": filePath,
|
||||||
|
"env": env,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
Navigator.of(context).pop(); // Pop loading dialog
|
Navigator.of(context).pop(); // Pop loading dialog
|
||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.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_success_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
|
|
||||||
class MihBusinessDetails extends StatefulWidget {
|
class MihBusinessDetails extends StatefulWidget {
|
||||||
@@ -38,6 +39,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
final contactController = TextEditingController();
|
final contactController = TextEditingController();
|
||||||
final emailController = TextEditingController();
|
final emailController = TextEditingController();
|
||||||
final locationController = TextEditingController();
|
final locationController = TextEditingController();
|
||||||
|
late String env;
|
||||||
|
|
||||||
Future<void> submitForm() async {
|
Future<void> submitForm() async {
|
||||||
if (!isEmailValid()) {
|
if (!isEmailValid()) {
|
||||||
@@ -136,6 +138,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
widget.arguments.business!.business_id,
|
widget.arguments.business!.business_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
imageFile!,
|
imageFile!,
|
||||||
context,
|
context,
|
||||||
@@ -144,6 +147,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
int deleteStatusCode = 0;
|
int deleteStatusCode = 0;
|
||||||
deleteStatusCode = await MihFileApi.deleteFile(
|
deleteStatusCode = await MihFileApi.deleteFile(
|
||||||
widget.arguments.business!.logo_path.split("/").first,
|
widget.arguments.business!.logo_path.split("/").first,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
widget.arguments.business!.logo_path.split("/").last,
|
widget.arguments.business!.logo_path.split("/").last,
|
||||||
context,
|
context,
|
||||||
@@ -220,6 +224,11 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
emailController.text = widget.arguments.business!.bus_email;
|
emailController.text = widget.arguments.business!.bus_email;
|
||||||
locationController.text = widget.arguments.business!.gps_location;
|
locationController.text = widget.arguments.business!.gps_location;
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
|||||||
late String oldLogoPath;
|
late String oldLogoPath;
|
||||||
late String oldSigPath;
|
late String oldSigPath;
|
||||||
String logoUri = "";
|
String logoUri = "";
|
||||||
|
late String env;
|
||||||
|
|
||||||
Future<void> updateBusinessProfileAPICall(String business_id) async {
|
Future<void> updateBusinessProfileAPICall(String business_id) async {
|
||||||
print("inside update business profile api call");
|
print("inside update business profile api call");
|
||||||
@@ -145,6 +146,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
|||||||
print("Inside upload selected file");
|
print("Inside upload selected file");
|
||||||
var response = await MihFileApi.uploadFile(
|
var response = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
file,
|
file,
|
||||||
context,
|
context,
|
||||||
@@ -160,6 +162,7 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
|||||||
// delete file from minio
|
// delete file from minio
|
||||||
var response = await MihFileApi.deleteFile(
|
var response = await MihFileApi.deleteFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
filePath.split("/").last,
|
filePath.split("/").last,
|
||||||
context,
|
context,
|
||||||
@@ -309,6 +312,11 @@ class _MihBusinessProfileState extends State<MihBusinessProfile> {
|
|||||||
});
|
});
|
||||||
logoPreview = NetworkImage(logoUri);
|
logoPreview = NetworkImage(logoUri);
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_image_display.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_image_display.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_success_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
|
|
||||||
class MihMyBusinessUser extends StatefulWidget {
|
class MihMyBusinessUser extends StatefulWidget {
|
||||||
@@ -41,6 +42,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
final lnameController = TextEditingController();
|
final lnameController = TextEditingController();
|
||||||
final accessController = TextEditingController();
|
final accessController = TextEditingController();
|
||||||
final signtureController = TextEditingController();
|
final signtureController = TextEditingController();
|
||||||
|
late String env;
|
||||||
|
|
||||||
bool isFormFilled() {
|
bool isFormFilled() {
|
||||||
if (signtureController.text.isEmpty ||
|
if (signtureController.text.isEmpty ||
|
||||||
@@ -60,6 +62,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
userSignatureFile!,
|
userSignatureFile!,
|
||||||
context,
|
context,
|
||||||
@@ -68,6 +71,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
int deleteStatusCode = 0;
|
int deleteStatusCode = 0;
|
||||||
deleteStatusCode = await MihFileApi.deleteFile(
|
deleteStatusCode = await MihFileApi.deleteFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
widget.arguments.businessUser!.sig_path.split("/").last,
|
widget.arguments.businessUser!.sig_path.split("/").last,
|
||||||
context,
|
context,
|
||||||
@@ -192,6 +196,11 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
lnameController.text = widget.arguments.signedInUser.lname;
|
lnameController.text = widget.arguments.signedInUser.lname;
|
||||||
accessController.text = widget.arguments.businessUser!.access;
|
accessController.text = widget.arguments.businessUser!.access;
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
PlatformFile? selectedSignature;
|
PlatformFile? selectedSignature;
|
||||||
|
|
||||||
final ValueNotifier<String> busType = ValueNotifier("");
|
final ValueNotifier<String> busType = ValueNotifier("");
|
||||||
|
late String env;
|
||||||
|
|
||||||
// Future<void> uploadSelectedFile(
|
// Future<void> uploadSelectedFile(
|
||||||
// PlatformFile file, TextEditingController controller) async {
|
// PlatformFile file, TextEditingController controller) async {
|
||||||
@@ -85,6 +86,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
int uploadStatusCode = 0;
|
int uploadStatusCode = 0;
|
||||||
uploadStatusCode = await MihFileApi.uploadFile(
|
uploadStatusCode = await MihFileApi.uploadFile(
|
||||||
id,
|
id,
|
||||||
|
env,
|
||||||
"business_files",
|
"business_files",
|
||||||
selectedFile,
|
selectedFile,
|
||||||
context,
|
context,
|
||||||
@@ -632,6 +634,11 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
lnameController.text = widget.signedInUser.lname;
|
lnameController.text = widget.signedInUser.lname;
|
||||||
accessController.text = "Full";
|
accessController.text = "Full";
|
||||||
});
|
});
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
late ImageProvider<Object>? propicPreview;
|
late ImageProvider<Object>? propicPreview;
|
||||||
late bool businessUser;
|
late bool businessUser;
|
||||||
late String oldProPicName;
|
late String oldProPicName;
|
||||||
|
late String env;
|
||||||
|
|
||||||
Future<void> submitForm() async {
|
Future<void> submitForm() async {
|
||||||
// print("============\nsubmiit form\n=================");
|
// print("============\nsubmiit form\n=================");
|
||||||
@@ -82,6 +83,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
Future<void> uploadSelectedFile(PlatformFile? file) async {
|
Future<void> uploadSelectedFile(PlatformFile? file) async {
|
||||||
var response = await MihFileApi.uploadFile(
|
var response = await MihFileApi.uploadFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"profile_files",
|
"profile_files",
|
||||||
file,
|
file,
|
||||||
context,
|
context,
|
||||||
@@ -144,6 +146,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
Future<void> deleteFileApiCall(String filename) async {
|
Future<void> deleteFileApiCall(String filename) async {
|
||||||
var response = await MihFileApi.deleteFile(
|
var response = await MihFileApi.deleteFile(
|
||||||
widget.arguments.signedInUser.app_id,
|
widget.arguments.signedInUser.app_id,
|
||||||
|
env,
|
||||||
"profile_files",
|
"profile_files",
|
||||||
filename,
|
filename,
|
||||||
context,
|
context,
|
||||||
@@ -200,6 +203,11 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
if (widget.arguments.signedInUser.pro_pic_path.isNotEmpty) {
|
if (widget.arguments.signedInUser.pro_pic_path.isNotEmpty) {
|
||||||
proPicName = widget.arguments.signedInUser.pro_pic_path.split("/").last;
|
proPicName = widget.arguments.signedInUser.pro_pic_path.split("/").last;
|
||||||
}
|
}
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
propicPreview = widget.arguments.propicFile;
|
propicPreview = widget.arguments.propicFile;
|
||||||
oldProPicName = proPicName;
|
oldProPicName = proPicName;
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ class ClaimStatementWindow extends StatefulWidget {
|
|||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final Business? business;
|
final Business? business;
|
||||||
final BusinessUser? businessUser;
|
final BusinessUser? businessUser;
|
||||||
|
final String env;
|
||||||
const ClaimStatementWindow({
|
const ClaimStatementWindow({
|
||||||
super.key,
|
super.key,
|
||||||
required this.selectedPatient,
|
required this.selectedPatient,
|
||||||
required this.signedInUser,
|
required this.signedInUser,
|
||||||
required this.business,
|
required this.business,
|
||||||
required this.businessUser,
|
required this.businessUser,
|
||||||
|
required this.env,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -265,6 +267,7 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
|||||||
widget.business,
|
widget.business,
|
||||||
"business",
|
"business",
|
||||||
),
|
),
|
||||||
|
widget.env,
|
||||||
context);
|
context);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class PrescripInput extends StatefulWidget {
|
|||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final Business? business;
|
final Business? business;
|
||||||
final BusinessUser? businessUser;
|
final BusinessUser? businessUser;
|
||||||
|
final String env;
|
||||||
const PrescripInput({
|
const PrescripInput({
|
||||||
super.key,
|
super.key,
|
||||||
required this.medicineController,
|
required this.medicineController,
|
||||||
@@ -44,6 +45,7 @@ class PrescripInput extends StatefulWidget {
|
|||||||
required this.signedInUser,
|
required this.signedInUser,
|
||||||
required this.business,
|
required this.business,
|
||||||
required this.businessUser,
|
required this.businessUser,
|
||||||
|
required this.env,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -98,6 +100,11 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
return const Mihloadingcircle();
|
return const Mihloadingcircle();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
DateTime now = new DateTime.now();
|
||||||
|
// DateTime date = new DateTime(now.year, now.month, now.day);
|
||||||
|
String fileName =
|
||||||
|
"Perscription-${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}-${now.toString().substring(0, 19)}.pdf"
|
||||||
|
.replaceAll(RegExp(r' '), '-');
|
||||||
|
|
||||||
var response1 = await http.post(
|
var response1 = await http.post(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/perscription/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/perscription/"),
|
||||||
@@ -106,8 +113,10 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
},
|
},
|
||||||
body: jsonEncode(<String, dynamic>{
|
body: jsonEncode(<String, dynamic>{
|
||||||
"app_id": widget.selectedPatient.app_id,
|
"app_id": widget.selectedPatient.app_id,
|
||||||
"fullName":
|
"env": widget.env,
|
||||||
|
"patient_full_name":
|
||||||
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}",
|
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}",
|
||||||
|
"fileName": fileName,
|
||||||
"id_no": widget.selectedPatient.id_no,
|
"id_no": widget.selectedPatient.id_no,
|
||||||
"docfname":
|
"docfname":
|
||||||
"DR. ${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
"DR. ${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
||||||
@@ -121,13 +130,9 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
//print(response1.statusCode);
|
//print(response1.statusCode);
|
||||||
DateTime now = new DateTime.now();
|
|
||||||
DateTime date = new DateTime(now.year, now.month, now.day);
|
|
||||||
String fileName =
|
|
||||||
"Perscription-${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}-${date.toString().substring(0, 10)}.pdf";
|
|
||||||
if (response1.statusCode == 200) {
|
if (response1.statusCode == 200) {
|
||||||
var response2 = await http.post(
|
var response2 = await http.post(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/files/insert/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/patient_files/insert/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
},
|
},
|
||||||
@@ -155,6 +160,7 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
// end loading circle
|
// end loading circle
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pushNamed('/patient-manager/patient',
|
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||||
arguments: PatientViewArguments(
|
arguments: PatientViewArguments(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
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_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_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_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';
|
||||||
@@ -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_objects/patients.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_file_view.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:flutter/material.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
|
||||||
|
|
||||||
class BuildClaimStatementFileList extends StatefulWidget {
|
class BuildClaimStatementFileList extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
@@ -24,6 +22,7 @@ class BuildClaimStatementFileList extends StatefulWidget {
|
|||||||
final Business? business;
|
final Business? business;
|
||||||
final BusinessUser? businessUser;
|
final BusinessUser? businessUser;
|
||||||
final String type;
|
final String type;
|
||||||
|
final String env;
|
||||||
const BuildClaimStatementFileList({
|
const BuildClaimStatementFileList({
|
||||||
super.key,
|
super.key,
|
||||||
required this.files,
|
required this.files,
|
||||||
@@ -32,6 +31,7 @@ class BuildClaimStatementFileList extends StatefulWidget {
|
|||||||
required this.business,
|
required this.business,
|
||||||
required this.businessUser,
|
required this.businessUser,
|
||||||
required this.type,
|
required this.type,
|
||||||
|
required this.env,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -47,27 +47,14 @@ class _BuildClaimStatementFileListState
|
|||||||
String fileUrl = "";
|
String fileUrl = "";
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
var url = "$baseAPI/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
String teporaryFileUrl = "";
|
||||||
//print(url);
|
await MihFileApi.getMinioFileUrl(
|
||||||
var response = await http.get(Uri.parse(url));
|
filePath,
|
||||||
// print("here1");
|
context,
|
||||||
//print(response.statusCode);
|
).then((value) {
|
||||||
|
teporaryFileUrl = value;
|
||||||
if (response.statusCode == 200) {
|
});
|
||||||
//print("here2");
|
return teporaryFileUrl;
|
||||||
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}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void internetConnectionPopUp() {
|
void internetConnectionPopUp() {
|
||||||
@@ -108,6 +95,7 @@ class _BuildClaimStatementFileListState
|
|||||||
widget.business,
|
widget.business,
|
||||||
"business",
|
"business",
|
||||||
),
|
),
|
||||||
|
widget.env,
|
||||||
filePath,
|
filePath,
|
||||||
fileID,
|
fileID,
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.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_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_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';
|
||||||
@@ -24,6 +25,7 @@ class BuildFilesList extends StatefulWidget {
|
|||||||
final Business? business;
|
final Business? business;
|
||||||
final BusinessUser? businessUser;
|
final BusinessUser? businessUser;
|
||||||
final String type;
|
final String type;
|
||||||
|
final String env;
|
||||||
const BuildFilesList({
|
const BuildFilesList({
|
||||||
super.key,
|
super.key,
|
||||||
required this.files,
|
required this.files,
|
||||||
@@ -32,6 +34,7 @@ class BuildFilesList extends StatefulWidget {
|
|||||||
required this.business,
|
required this.business,
|
||||||
required this.businessUser,
|
required this.businessUser,
|
||||||
required this.type,
|
required this.type,
|
||||||
|
required this.env,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -45,81 +48,56 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
String fileUrl = "";
|
String fileUrl = "";
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
var url = "$baseAPI/minio/pull/file/${AppEnviroment.getEnv()}/$filePath";
|
String teporaryFileUrl = "";
|
||||||
//print(url);
|
await MihFileApi.getMinioFileUrl(
|
||||||
var response = await http.get(Uri.parse(url));
|
filePath,
|
||||||
// print("here1");
|
context,
|
||||||
//print(response.statusCode);
|
).then((value) {
|
||||||
|
teporaryFileUrl = value;
|
||||||
if (response.statusCode == 200) {
|
});
|
||||||
//print("here2");
|
return teporaryFileUrl;
|
||||||
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}");
|
|
||||||
}
|
|
||||||
|
|
||||||
//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}");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteFileApiCall(String filePath, int fileID) async {
|
Future<void> deleteFileApiCall(String filePath, int fileID) async {
|
||||||
|
var response = await MihFileApi.deleteFile(
|
||||||
|
widget.selectedPatient.app_id,
|
||||||
|
widget.env,
|
||||||
|
"patient_files",
|
||||||
|
filePath.split("/").last,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
if (response == 200) {
|
||||||
|
// delete file from database
|
||||||
|
await deletePatientFileLocationToDB(fileID);
|
||||||
|
} else {
|
||||||
|
String message =
|
||||||
|
"The File has not been deleted successfully. Please try again.";
|
||||||
|
successPopUp(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deletePatientFileLocationToDB(int fileID) async {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const Mihloadingcircle();
|
return const Mihloadingcircle();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// delete file from minio
|
|
||||||
var response = await http.delete(
|
|
||||||
Uri.parse("$baseAPI/minio/delete/file/"),
|
|
||||||
headers: <String, String>{
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
},
|
|
||||||
body: jsonEncode(<String, dynamic>{"file_path": filePath}),
|
|
||||||
);
|
|
||||||
//print("Here4");
|
|
||||||
//print(response.statusCode);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
//SQL delete
|
|
||||||
var response2 = await http.delete(
|
var response2 = await http.delete(
|
||||||
Uri.parse("$baseAPI/files/delete/"),
|
Uri.parse("$baseAPI/patient_files/delete/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, dynamic>{"idpatient_files": fileID}),
|
body: jsonEncode(<String, dynamic>{
|
||||||
|
"idpatient_files": fileID,
|
||||||
|
"env": widget.env,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
if (response2.statusCode == 200) {
|
if (response2.statusCode == 200) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop(); //Remove Loading Dialog
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop(); //Remove Delete Dialog
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop(); //Remove File View Dialog
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop(); //Remove File List Dialog
|
||||||
//print(widget.business);
|
//print(widget.business);
|
||||||
if (widget.business == null) {
|
if (widget.business == null) {
|
||||||
Navigator.of(context).pushNamed('/patient-manager/patient',
|
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||||
@@ -138,19 +116,12 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
widget.business,
|
widget.business,
|
||||||
"business"));
|
"business"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Navigator.of(context)
|
|
||||||
// .pushNamed('/patient-profile', arguments: widget.signedInUser);
|
|
||||||
// setState(() {});
|
|
||||||
String message =
|
String message =
|
||||||
"The File has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
|
"The File has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
|
||||||
successPopUp(message);
|
successPopUp(message);
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
internetConnectionPopUp();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void internetConnectionPopUp() {
|
void internetConnectionPopUp() {
|
||||||
|
|||||||
@@ -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-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_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_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/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/business_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business_user.dart';
|
||||||
@@ -37,6 +38,7 @@ class PatientClaimOrStatement extends StatefulWidget {
|
|||||||
|
|
||||||
class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
||||||
late Future<List<ClaimStatementFile>> futueFiles;
|
late Future<List<ClaimStatementFile>> futueFiles;
|
||||||
|
late String env;
|
||||||
|
|
||||||
void claimOrStatementWindow() {
|
void claimOrStatementWindow() {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -47,6 +49,7 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
|||||||
signedInUser: widget.signedInUser,
|
signedInUser: widget.signedInUser,
|
||||||
business: widget.business,
|
business: widget.business,
|
||||||
businessUser: widget.businessUser,
|
businessUser: widget.businessUser,
|
||||||
|
env: env,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -100,6 +103,11 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
|||||||
MIHClaimStatementGenerationApi.getClaimStatementFilesByBusiness(
|
MIHClaimStatementGenerationApi.getClaimStatementFilesByBusiness(
|
||||||
widget.business!.business_id);
|
widget.business!.business_id);
|
||||||
}
|
}
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +162,7 @@ class _PatientClaimOrStatementState extends State<PatientClaimOrStatement> {
|
|||||||
business: widget.business,
|
business: widget.business,
|
||||||
businessUser: widget.businessUser,
|
businessUser: widget.businessUser,
|
||||||
type: widget.type,
|
type: widget.type,
|
||||||
|
env: env,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
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_apis/mih_file_api.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/med_cert_input.dart';
|
import 'package:mzansi_innovation_hub/mih_components/med_cert_input.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_file_input.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_file_input.dart';
|
||||||
@@ -22,9 +23,7 @@ import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/c
|
|||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_files_list.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_files_list.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:supertokens_flutter/supertokens.dart';
|
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
import 'package:http/http.dart' as http2;
|
|
||||||
|
|
||||||
class PatientDocuments extends StatefulWidget {
|
class PatientDocuments extends StatefulWidget {
|
||||||
final int patientIndex;
|
final int patientIndex;
|
||||||
@@ -61,10 +60,24 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
final noRepeatsController = TextEditingController();
|
final noRepeatsController = TextEditingController();
|
||||||
final outputController = TextEditingController();
|
final outputController = TextEditingController();
|
||||||
late PlatformFile? selected;
|
late PlatformFile? selected;
|
||||||
|
late String env;
|
||||||
|
|
||||||
|
Future<void> submitDocUploadForm() async {
|
||||||
|
if (isFileFieldsFilled()) {
|
||||||
|
await uploadSelectedFile(selected);
|
||||||
|
} else {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHErrorMessage(errorType: "Input Error");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<List<PFile>> fetchFiles() async {
|
Future<List<PFile>> fetchFiles() async {
|
||||||
final response = await http.get(Uri.parse(
|
final response = await http.get(Uri.parse(
|
||||||
"${AppEnviroment.baseApiUrl}/files/patients/${widget.selectedPatient.app_id}"));
|
"${AppEnviroment.baseApiUrl}/patient_files/get/${widget.selectedPatient.app_id}"));
|
||||||
//print(response.statusCode);
|
//print(response.statusCode);
|
||||||
//print(response.body);
|
//print(response.body);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
@@ -78,39 +91,17 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> uploadSelectedFile(PlatformFile? file) async {
|
Future<void> addPatientFileLocationToDB(PlatformFile? file) async {
|
||||||
print("File: $file");
|
|
||||||
//var strem = new http.ByteStream.fromBytes(file.bytes.)
|
|
||||||
//start loading circle
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const Mihloadingcircle();
|
return const Mihloadingcircle();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
var token = await SuperTokens.getAccessToken();
|
var fname = file!.name.replaceAll(RegExp(r' '), '-');
|
||||||
//print(t);
|
|
||||||
print("here1");
|
|
||||||
var request = http2.MultipartRequest(
|
|
||||||
'POST', Uri.parse("${AppEnviroment.baseApiUrl}/minio/upload/file/"));
|
|
||||||
request.headers['accept'] = 'application/json';
|
|
||||||
request.headers['Authorization'] = 'Bearer $token';
|
|
||||||
request.headers['Content-Type'] = 'multipart/form-data';
|
|
||||||
request.fields['app_id'] = widget.selectedPatient.app_id;
|
|
||||||
request.fields['folder'] = "patient_files";
|
|
||||||
request.files.add(await http2.MultipartFile.fromBytes('file', file!.bytes!,
|
|
||||||
filename: file.name.replaceAll(RegExp(r' '), '-')));
|
|
||||||
print("here2");
|
|
||||||
var response1 = await request.send();
|
|
||||||
print("here3");
|
|
||||||
print(response1.statusCode);
|
|
||||||
print(response1.toString());
|
|
||||||
if (response1.statusCode == 200) {
|
|
||||||
//print("here3");
|
|
||||||
var fname = file.name.replaceAll(RegExp(r' '), '-');
|
|
||||||
var filePath = "${widget.selectedPatient.app_id}/patient_files/$fname";
|
var filePath = "${widget.selectedPatient.app_id}/patient_files/$fname";
|
||||||
var response2 = await http.post(
|
var response2 = await http.post(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/files/insert/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/patient_files/insert/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
},
|
},
|
||||||
@@ -135,6 +126,18 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> uploadSelectedFile(PlatformFile? file) async {
|
||||||
|
var response = await MihFileApi.uploadFile(
|
||||||
|
widget.selectedPatient.app_id,
|
||||||
|
env,
|
||||||
|
"patient_files",
|
||||||
|
file,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
if (response == 200) {
|
||||||
|
await addPatientFileLocationToDB(file);
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
}
|
}
|
||||||
@@ -148,6 +151,11 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
return const Mihloadingcircle();
|
return const Mihloadingcircle();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
// DateTime date = new DateTime(now.year, now.month, now.day);
|
||||||
|
String fileName =
|
||||||
|
"Med-Cert-${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}-${now.toString().substring(0, 19)}.pdf"
|
||||||
|
.replaceAll(RegExp(r' '), '-');
|
||||||
var response1 = await http.post(
|
var response1 = await http.post(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/med-cert/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/minio/generate/med-cert/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@@ -155,8 +163,10 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
},
|
},
|
||||||
body: jsonEncode(<String, dynamic>{
|
body: jsonEncode(<String, dynamic>{
|
||||||
"app_id": widget.selectedPatient.app_id,
|
"app_id": widget.selectedPatient.app_id,
|
||||||
"fullName":
|
"env": env,
|
||||||
|
"patient_full_name":
|
||||||
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}",
|
"${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}",
|
||||||
|
"fileName": fileName,
|
||||||
"id_no": widget.selectedPatient.id_no,
|
"id_no": widget.selectedPatient.id_no,
|
||||||
"docfname":
|
"docfname":
|
||||||
"DR. ${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
"DR. ${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
||||||
@@ -172,13 +182,9 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
print(response1.statusCode);
|
print(response1.statusCode);
|
||||||
DateTime now = new DateTime.now();
|
|
||||||
DateTime date = new DateTime(now.year, now.month, now.day);
|
|
||||||
String fileName =
|
|
||||||
"Med-Cert-${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}-${date.toString().substring(0, 10)}.pdf";
|
|
||||||
if (response1.statusCode == 200) {
|
if (response1.statusCode == 200) {
|
||||||
var response2 = await http.post(
|
var response2 = await http.post(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/files/insert/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/patient_files/insert/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
},
|
},
|
||||||
@@ -256,7 +262,8 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (isFileFieldsFilled()) {
|
if (isFileFieldsFilled()) {
|
||||||
uploadSelectedFile(selected);
|
submitDocUploadForm();
|
||||||
|
// uploadSelectedFile(selected);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -350,6 +357,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
signedInUser: widget.signedInUser,
|
signedInUser: widget.signedInUser,
|
||||||
business: widget.business,
|
business: widget.business,
|
||||||
businessUser: widget.businessUser,
|
businessUser: widget.businessUser,
|
||||||
|
env: env,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -576,6 +584,11 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
futueFiles = fetchFiles();
|
futueFiles = fetchFiles();
|
||||||
|
if (AppEnviroment.getEnv() == "Prod") {
|
||||||
|
env = "Prod";
|
||||||
|
} else {
|
||||||
|
env = "Dev";
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,6 +642,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
business: widget.business,
|
business: widget.business,
|
||||||
businessUser: widget.businessUser,
|
businessUser: widget.businessUser,
|
||||||
type: widget.type,
|
type: widget.type,
|
||||||
|
env: env,
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -31,10 +31,13 @@ class minioPullRequest(BaseModel):
|
|||||||
|
|
||||||
class minioDeleteRequest(BaseModel):
|
class minioDeleteRequest(BaseModel):
|
||||||
file_path: str
|
file_path: str
|
||||||
|
env: str
|
||||||
|
|
||||||
class medCertUploud(BaseModel):
|
class medCertUploud(BaseModel):
|
||||||
app_id: str
|
app_id: str
|
||||||
fullName: str
|
env: str
|
||||||
|
patient_full_name: str
|
||||||
|
fileName: str
|
||||||
id_no: str
|
id_no: str
|
||||||
docfname: str
|
docfname: str
|
||||||
busName: str
|
busName: str
|
||||||
@@ -60,7 +63,9 @@ class perscription(BaseModel):
|
|||||||
|
|
||||||
class perscriptionList(BaseModel):
|
class perscriptionList(BaseModel):
|
||||||
app_id: str
|
app_id: str
|
||||||
fullName: str
|
env: str
|
||||||
|
patient_full_name: str
|
||||||
|
fileName: str
|
||||||
id_no: str
|
id_no: str
|
||||||
docfname: str
|
docfname: str
|
||||||
busName: str
|
busName: str
|
||||||
@@ -74,7 +79,9 @@ class perscriptionList(BaseModel):
|
|||||||
class claimStatementUploud(BaseModel):
|
class claimStatementUploud(BaseModel):
|
||||||
document_type: str
|
document_type: str
|
||||||
patient_app_id: str
|
patient_app_id: str
|
||||||
|
env: str
|
||||||
patient_full_name: str
|
patient_full_name: str
|
||||||
|
fileName: str
|
||||||
patient_id_no: str
|
patient_id_no: str
|
||||||
has_med_aid: str
|
has_med_aid: str
|
||||||
med_aid_no: str
|
med_aid_no: str
|
||||||
@@ -131,11 +138,11 @@ async def pull_File_from_user(app_id: str, folder: str, file_name: str, env: str
|
|||||||
}
|
}
|
||||||
|
|
||||||
@router.post("/minio/upload/file/", tags=["Minio"])
|
@router.post("/minio/upload/file/", tags=["Minio"])
|
||||||
async def upload_File_to_user(file: UploadFile = File(...), app_id: str= Form(...), folder: str= Form(...), session: SessionContainer = Depends(verify_session())):
|
async def upload_File_to_user(file: UploadFile = File(...), app_id: str= Form(...), env: str= Form(...), folder: str= Form(...), session: SessionContainer = Depends(verify_session())):
|
||||||
extension = file.filename.split(".")
|
extension = file.filename.split(".")
|
||||||
content = file.file
|
content = file.file
|
||||||
try:
|
try:
|
||||||
uploudFile(app_id, folder, file.filename, extension[1], content)
|
uploudFile(app_id, env, folder, file.filename, extension[1], content)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
raise HTTPException(status_code=404, detail="Failed to Uploud Record")
|
raise HTTPException(status_code=404, detail="Failed to Uploud Record")
|
||||||
return {"message": f"Successfully Uploaded {file.filename}"}
|
return {"message": f"Successfully Uploaded {file.filename}"}
|
||||||
@@ -152,7 +159,7 @@ async def delete_File_of_user(requestItem: minioDeleteRequest, session: SessionC
|
|||||||
path = requestItem.file_path
|
path = requestItem.file_path
|
||||||
try:
|
try:
|
||||||
# uploudFile(app_id, file.filename, extension[1], content)
|
# uploudFile(app_id, file.filename, extension[1], content)
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
|
|
||||||
minioError = client.remove_object("mih", path)
|
minioError = client.remove_object("mih", path)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
@@ -182,8 +189,8 @@ async def upload_perscription_to_user(requestItem: claimStatementUploud, session
|
|||||||
uploudClaimStatement(requestItem)
|
uploudClaimStatement(requestItem)
|
||||||
return {"message": "Successfully Generated File"}
|
return {"message": "Successfully Generated File"}
|
||||||
|
|
||||||
def uploudFile(app_id, folder, fileName, extension, content):
|
def uploudFile(app_id, env, folder, fileName, extension, content):
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(env)
|
||||||
found = client.bucket_exists("mih")
|
found = client.bucket_exists("mih")
|
||||||
if not found:
|
if not found:
|
||||||
client.make_bucket("mih")
|
client.make_bucket("mih")
|
||||||
@@ -198,7 +205,7 @@ def uploudFile(app_id, folder, fileName, extension, content):
|
|||||||
content_type=f"application/{extension}")
|
content_type=f"application/{extension}")
|
||||||
|
|
||||||
def uploudMedCert(requestItem: medCertUploud):
|
def uploudMedCert(requestItem: medCertUploud):
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
generateMedCertPDF(requestItem)
|
generateMedCertPDF(requestItem)
|
||||||
today = datetime.today().strftime('%Y-%m-%d')
|
today = datetime.today().strftime('%Y-%m-%d')
|
||||||
found = client.bucket_exists("mih")
|
found = client.bucket_exists("mih")
|
||||||
@@ -206,11 +213,11 @@ def uploudMedCert(requestItem: medCertUploud):
|
|||||||
client.make_bucket("mih")
|
client.make_bucket("mih")
|
||||||
else:
|
else:
|
||||||
print("Bucket already exists")
|
print("Bucket already exists")
|
||||||
fileName = f"{requestItem.app_id}/patient_files/Med-Cert-{requestItem.fullName}-{today}.pdf"
|
fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}"
|
||||||
client.fput_object("mih", fileName, "temp-med-cert.pdf")
|
client.fput_object("mih", fileName, "temp-med-cert.pdf")
|
||||||
|
|
||||||
def generateMedCertPDF(requestItem: medCertUploud):
|
def generateMedCertPDF(requestItem: medCertUploud):
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
new_logo_path = requestItem.logo_path.replace(" ","-")
|
new_logo_path = requestItem.logo_path.replace(" ","-")
|
||||||
new_sig_path = requestItem.sig_path.replace(" ","-")
|
new_sig_path = requestItem.sig_path.replace(" ","-")
|
||||||
minioLogo = client.get_object("mih", new_logo_path).read()
|
minioLogo = client.get_object("mih", new_logo_path).read()
|
||||||
@@ -243,7 +250,7 @@ def generateMedCertPDF(requestItem: medCertUploud):
|
|||||||
#Body
|
#Body
|
||||||
myCanvas.setFont('Helvetica', 12)
|
myCanvas.setFont('Helvetica', 12)
|
||||||
body = ""
|
body = ""
|
||||||
body += "This is to certify that " + requestItem.fullName.upper() + " (" + requestItem.id_no+ ") was seen by " + requestItem.docfname.upper() + " on " + requestItem.startDate + "."
|
body += "This is to certify that " + requestItem.patient_full_name.upper() + " (" + requestItem.id_no+ ") was seen by " + requestItem.docfname.upper() + " on " + requestItem.startDate + "."
|
||||||
body += "\nHe/She is unfit to attend work/school from " + requestItem.startDate + " up to and including " + requestItem.endDate + "."
|
body += "\nHe/She is unfit to attend work/school from " + requestItem.startDate + " up to and including " + requestItem.endDate + "."
|
||||||
body += "\nHe/She will return on " + requestItem.returnDate + "."
|
body += "\nHe/She will return on " + requestItem.returnDate + "."
|
||||||
|
|
||||||
@@ -261,7 +268,7 @@ def generateMedCertPDF(requestItem: medCertUploud):
|
|||||||
myCanvas.drawString(50, h-720, requestItem.docfname.upper())
|
myCanvas.drawString(50, h-720, requestItem.docfname.upper())
|
||||||
|
|
||||||
#QR Verification
|
#QR Verification
|
||||||
qrText = requestItem.fullName.upper() + " booked off from " + requestItem.startDate + " to " + requestItem.endDate + " by " + requestItem.docfname.upper() + ".\nPowered by Mzansi Innovation Hub."
|
qrText = requestItem.patient_full_name.upper() + " booked off from " + requestItem.startDate + " to " + requestItem.endDate + " by " + requestItem.docfname.upper() + ".\nPowered by Mzansi Innovation Hub."
|
||||||
qrText = qrText.replace(" ","+")
|
qrText = qrText.replace(" ","+")
|
||||||
|
|
||||||
url = f"https://api.qrserver.com/v1/create-qr-code/?data={qrText}&size=100x100"
|
url = f"https://api.qrserver.com/v1/create-qr-code/?data={qrText}&size=100x100"
|
||||||
@@ -275,7 +282,7 @@ def generateMedCertPDF(requestItem: medCertUploud):
|
|||||||
myCanvas.save()
|
myCanvas.save()
|
||||||
|
|
||||||
def uploudPerscription(requestItem: perscriptionList):
|
def uploudPerscription(requestItem: perscriptionList):
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
generatePerscriptionPDF(requestItem)
|
generatePerscriptionPDF(requestItem)
|
||||||
today = datetime.today().strftime('%Y-%m-%d')
|
today = datetime.today().strftime('%Y-%m-%d')
|
||||||
found = client.bucket_exists("mih")
|
found = client.bucket_exists("mih")
|
||||||
@@ -283,11 +290,11 @@ def uploudPerscription(requestItem: perscriptionList):
|
|||||||
client.make_bucket("mih")
|
client.make_bucket("mih")
|
||||||
else:
|
else:
|
||||||
print("Bucket already exists")
|
print("Bucket already exists")
|
||||||
fileName = f"{requestItem.app_id}/patient_files/Perscription-{requestItem.fullName}-{today}.pdf"
|
fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}"
|
||||||
client.fput_object("mih", fileName, "temp-perscription.pdf")
|
client.fput_object("mih", fileName, "temp-perscription.pdf")
|
||||||
|
|
||||||
def generatePerscriptionPDF(requestItem: perscriptionList):
|
def generatePerscriptionPDF(requestItem: perscriptionList):
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
new_logo_path = requestItem.logo_path.replace(" ","-")
|
new_logo_path = requestItem.logo_path.replace(" ","-")
|
||||||
new_sig_path = requestItem.sig_path.replace(" ","-")
|
new_sig_path = requestItem.sig_path.replace(" ","-")
|
||||||
minioLogo = client.get_object("mih", new_logo_path).read()
|
minioLogo = client.get_object("mih", new_logo_path).read()
|
||||||
@@ -297,7 +304,7 @@ def generatePerscriptionPDF(requestItem: perscriptionList):
|
|||||||
w,h = A4
|
w,h = A4
|
||||||
|
|
||||||
|
|
||||||
myCanvas = canvas.Canvas("temp-claim.pdf", pagesize=A4)
|
myCanvas = canvas.Canvas("temp-perscription.pdf", pagesize=A4)
|
||||||
|
|
||||||
#Business Logo
|
#Business Logo
|
||||||
myCanvas.drawImage(imageLogo, 50, h - 125,100,100, mask='auto')
|
myCanvas.drawImage(imageLogo, 50, h - 125,100,100, mask='auto')
|
||||||
@@ -321,7 +328,7 @@ def generatePerscriptionPDF(requestItem: perscriptionList):
|
|||||||
|
|
||||||
#Body
|
#Body
|
||||||
myCanvas.setFont('Helvetica-Bold', 12)
|
myCanvas.setFont('Helvetica-Bold', 12)
|
||||||
myCanvas.drawString(50, h-250, f"Patient: {requestItem.fullName}")
|
myCanvas.drawString(50, h-250, f"Patient: {requestItem.patient_full_name}")
|
||||||
myCanvas.drawString(50, h-270, f"Patient ID: {requestItem.id_no}")
|
myCanvas.drawString(50, h-270, f"Patient ID: {requestItem.id_no}")
|
||||||
|
|
||||||
#boday headings
|
#boday headings
|
||||||
@@ -362,7 +369,7 @@ def generatePerscriptionPDF(requestItem: perscriptionList):
|
|||||||
myCanvas.drawString(50, h-y-30, requestItem.docfname.upper())
|
myCanvas.drawString(50, h-y-30, requestItem.docfname.upper())
|
||||||
|
|
||||||
#QR Verification
|
#QR Verification
|
||||||
qrText = f"Perscription generated on {issueDate} by {requestItem.docfname} for {requestItem.fullName}.\nPowered by Mzansi Innovation Hub."
|
qrText = f"Perscription generated on {issueDate} by {requestItem.docfname} for {requestItem.patient_full_name}.\nPowered by Mzansi Innovation Hub."
|
||||||
qrText = qrText.replace(" ","+")
|
qrText = qrText.replace(" ","+")
|
||||||
|
|
||||||
url = f"https://api.qrserver.com/v1/create-qr-code/?data={qrText}&size=100x100"
|
url = f"https://api.qrserver.com/v1/create-qr-code/?data={qrText}&size=100x100"
|
||||||
@@ -377,7 +384,7 @@ def generatePerscriptionPDF(requestItem: perscriptionList):
|
|||||||
|
|
||||||
def uploudClaimStatement(requestItem: claimStatementUploud):
|
def uploudClaimStatement(requestItem: claimStatementUploud):
|
||||||
try:
|
try:
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
print("connected")
|
print("connected")
|
||||||
except Exception:
|
except Exception:
|
||||||
print("error")
|
print("error")
|
||||||
@@ -389,11 +396,11 @@ def uploudClaimStatement(requestItem: claimStatementUploud):
|
|||||||
client.make_bucket("mih")
|
client.make_bucket("mih")
|
||||||
else:
|
else:
|
||||||
print("Bucket already exists")
|
print("Bucket already exists")
|
||||||
fileName = f"{requestItem.patient_app_id}/claims-statements/{requestItem.document_type}-{requestItem.patient_full_name}-{today}.pdf"
|
fileName = f"{requestItem.patient_app_id}/claims-statements/{requestItem.fileName}"
|
||||||
client.fput_object("mih", fileName, "temp-claim-statement.pdf")
|
client.fput_object("mih", fileName, "temp-claim-statement.pdf")
|
||||||
|
|
||||||
def generateClaimStatementPDF(requestItem: claimStatementUploud):
|
def generateClaimStatementPDF(requestItem: claimStatementUploud):
|
||||||
client = Minio_Storage.minioConnection.minioConnect("Prod")
|
client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
|
||||||
# print("buckets: " + client.list_buckets)
|
# print("buckets: " + client.list_buckets)
|
||||||
new_logo_path = requestItem.logo_path.replace(" ","-")
|
new_logo_path = requestItem.logo_path.replace(" ","-")
|
||||||
new_sig_path = requestItem.sig_path.replace(" ","-")
|
new_sig_path = requestItem.sig_path.replace(" ","-")
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class fileInsertRequest(BaseModel):
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Get List of all files by patient
|
# Get List of all files by patient
|
||||||
@router.get("/files/patients/{app_id}", tags=["Patients Files"])
|
@router.get("/patient_files/get/{app_id}", tags=["Patients Files"])
|
||||||
async def read_all_patient_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
|
async def read_all_patient_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbPatientManagerConnect()
|
db = database.dbConnection.dbPatientManagerConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
@@ -89,7 +89,7 @@ async def read_all_patient_files_by_app_id(app_id: str, session: SessionContaine
|
|||||||
# return items
|
# return items
|
||||||
|
|
||||||
# Delete Patient note on table
|
# Delete Patient note on table
|
||||||
@router.delete("/files/delete/", tags=["Patients Files"])
|
@router.delete("/patient_files/delete/", tags=["Patients Files"])
|
||||||
async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionContainer = Depends(verify_session())): #session: SessionContainer = Depends(verify_session())
|
async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionContainer = Depends(verify_session())): #session: SessionContainer = Depends(verify_session())
|
||||||
# today = date.today()
|
# today = date.today()
|
||||||
db = database.dbConnection.dbPatientManagerConnect()
|
db = database.dbConnection.dbPatientManagerConnect()
|
||||||
@@ -108,7 +108,7 @@ async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionC
|
|||||||
return {"message": "Successfully deleted Record"}
|
return {"message": "Successfully deleted Record"}
|
||||||
|
|
||||||
# Insert Patient note into table
|
# Insert Patient note into table
|
||||||
@router.post("/files/insert/", tags=["Patients Files"], status_code=201)
|
@router.post("/patient_files/insert/", tags=["Patients Files"], status_code=201)
|
||||||
async def insert_Patient_Files(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())):
|
async def insert_Patient_Files(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
today = date.today()
|
today = date.today()
|
||||||
db = database.dbConnection.dbPatientManagerConnect()
|
db = database.dbConnection.dbPatientManagerConnect()
|
||||||
|
|||||||
Reference in New Issue
Block a user