|
|
|
@ -1,14 +1,17 @@
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/labs/lab_result.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/labs/lab_result.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart';
|
|
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/utils/utils.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:open_filex/open_filex.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class LabResultWidget extends StatelessWidget {
|
|
|
|
class LabResultWidget extends StatelessWidget {
|
|
|
|
@ -17,8 +20,10 @@ class LabResultWidget extends StatelessWidget {
|
|
|
|
final PatientLabOrders patientLabOrder;
|
|
|
|
final PatientLabOrders patientLabOrder;
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
final bool isInpatient;
|
|
|
|
final bool isInpatient;
|
|
|
|
|
|
|
|
final LabsViewModel model;
|
|
|
|
|
|
|
|
|
|
|
|
LabResultWidget({Key? key, required this.filterName, required this.patientLabResultList, required this.patientLabOrder, required this.patient, required this.isInpatient}) : super(key: key);
|
|
|
|
LabResultWidget({Key? key, required this.filterName, required this.patientLabResultList, required this.patientLabOrder, required this.patient, required this.isInpatient, required this.model})
|
|
|
|
|
|
|
|
: super(key: key);
|
|
|
|
late ProjectViewModel projectViewModel;
|
|
|
|
late ProjectViewModel projectViewModel;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -177,8 +182,50 @@ class LabResultWidget extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible: patientLabResultList[index].IsLabTestAttachment ?? false,
|
|
|
|
child: InkWell(
|
|
|
|
child: InkWell(
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
var labAccessNumber = patientLabResultList[index].LabAccessionNo;
|
|
|
|
|
|
|
|
if (patientLabResultList[index].FileNameWithExtensionList?.isEmpty == true || patientLabResultList[index].FileNameWithExtensionList?.length == 1) {
|
|
|
|
|
|
|
|
await model.getLabAttachments(patient, labAccessNumber: labAccessNumber, FileName: patientLabResultList[index].FileNameWithExtensionList?.first);
|
|
|
|
|
|
|
|
model.openPDF();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (patientLabResultList[index].UploadedDocuments?.isEmpty == true || patientLabResultList[index].UploadedDocuments?.length == 1) {
|
|
|
|
|
|
|
|
await model.getLabAttachments(patient, labAccessNumber: labAccessNumber, uploadedDocument: patientLabResultList[index].UploadedDocuments?.first);
|
|
|
|
|
|
|
|
model.openPDF();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showUploadedDocumentsBottomSheet(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
documents: patientLabResultList[index].UploadedDocuments,
|
|
|
|
|
|
|
|
fileName: patientLabResultList[index].FileNameWithExtensionList,
|
|
|
|
|
|
|
|
labAccessNumber: labAccessNumber,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
AppText(
|
|
|
|
|
|
|
|
TranslationBase.of(context).showAttachment,
|
|
|
|
|
|
|
|
textDecoration: TextDecoration.underline,
|
|
|
|
|
|
|
|
color: Colors.red.shade700,
|
|
|
|
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.2,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
@ -199,12 +246,13 @@ class LabResultWidget extends StatelessWidget {
|
|
|
|
TranslationBase.of(context).showMoreBtn,
|
|
|
|
TranslationBase.of(context).showMoreBtn,
|
|
|
|
textDecoration: TextDecoration.underline,
|
|
|
|
textDecoration: TextDecoration.underline,
|
|
|
|
color: Colors.red.shade700,
|
|
|
|
color: Colors.red.shade700,
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.8,
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.4,
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -306,4 +354,111 @@ class LabResultWidget extends StatelessWidget {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return tableRow;
|
|
|
|
return tableRow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void showUploadedDocumentsBottomSheet(
|
|
|
|
|
|
|
|
BuildContext context, {
|
|
|
|
|
|
|
|
List<UploadedDocument>? documents,
|
|
|
|
|
|
|
|
List<String>? fileName,
|
|
|
|
|
|
|
|
String? labAccessNumber,
|
|
|
|
|
|
|
|
}) {
|
|
|
|
|
|
|
|
const double kItemHeight = 66.0; // ListTile with contentPadding: 10
|
|
|
|
|
|
|
|
final double screenHeight = MediaQuery.of(context).size.height;
|
|
|
|
|
|
|
|
final double maxSheetHeight = screenHeight * 0.5;
|
|
|
|
|
|
|
|
final double minSheetHeight = (kItemHeight + 100).clamp(0, maxSheetHeight);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
isScrollControlled: true, // lets the sheet respect custom height constraints
|
|
|
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
|
|
|
return ConstrainedBox(
|
|
|
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
|
|
|
minHeight: minSheetHeight,
|
|
|
|
|
|
|
|
maxHeight: maxSheetHeight,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
// Drag handle
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
margin: const EdgeInsets.symmetric(vertical: 8),
|
|
|
|
|
|
|
|
width: 40,
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
|
|
|
|
|
|
child: Align(
|
|
|
|
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
TranslationBase.of(context).selectAnAttachment,
|
|
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Flexible(
|
|
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
|
|
child: Material(
|
|
|
|
|
|
|
|
color: const Color(0X55F2F2F2),
|
|
|
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
|
|
|
itemCount: documents?.length ?? fileName?.length ?? 0,
|
|
|
|
|
|
|
|
separatorBuilder: (context, index) => Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
|
|
|
child: const Divider(height: 1, color: Colors.grey),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
final docName = documents?[index]?.fileName ?? fileName?[index];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ListTile(
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(10),
|
|
|
|
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
docName ?? "Unnamed Document",
|
|
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
trailing: const Icon(
|
|
|
|
|
|
|
|
Icons.chevron_right,
|
|
|
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
if (documents?.isNotEmpty == true) {
|
|
|
|
|
|
|
|
await model.getLabAttachments(patient, uploadedDocument: documents![index]);
|
|
|
|
|
|
|
|
model.openPDF();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fileName?.isNotEmpty == true) {
|
|
|
|
|
|
|
|
await model.getLabAttachments(patient, labAccessNumber: labAccessNumber, FileName: fileName![index]);
|
|
|
|
|
|
|
|
model.openPDF();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|