You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
4.8 KiB
Dart
114 lines
4.8 KiB
Dart
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/laboratory_result_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class LaboratoryResultPage extends StatefulWidget {
|
|
final PatientLabOrders? patientLabOrders;
|
|
|
|
LaboratoryResultPage({Key? key, this.patientLabOrders});
|
|
|
|
@override
|
|
_LaboratoryResultPageState createState() => _LaboratoryResultPageState();
|
|
}
|
|
|
|
class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
return BaseView<LabsViewModel>(
|
|
onModelReady: (model) => model.getLaboratoryResult(
|
|
invoiceNo: widget.patientLabOrders!.invoiceNo,
|
|
invoiceType: widget.patientLabOrders!.invoiceType,
|
|
clinicID: widget.patientLabOrders!.clinicID,
|
|
projectID: widget.patientLabOrders!.projectID,
|
|
orderNo: widget.patientLabOrders!.orderNo,
|
|
setupID: widget.patientLabOrders!.setupID,
|
|
isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)),
|
|
),
|
|
builder: (_, model, w) => AppScaffold(
|
|
isShowAppBar: true,
|
|
appBarTitle: widget.patientLabOrders!.doctorName!,
|
|
baseViewModel: model,
|
|
showNewAppBar: true,
|
|
showNewAppBarTitle: true,
|
|
backgroundColor: Color(0xffF8F8F8),
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
LaboratoryResultWidget(
|
|
onTap: () async {
|
|
await model.sendLabReportEmail(
|
|
patientLabOrder: widget.patientLabOrders,
|
|
mes: TranslationBase.of(context).sendSuc,
|
|
userObj: projectViewModel.user,
|
|
isVidaPlus: Utils.isVidaPlusProject(
|
|
projectViewModel,
|
|
int.parse(widget.patientLabOrders!.projectID!),
|
|
),
|
|
isDownload: true);
|
|
},
|
|
showConfirmMessageDialog: false,
|
|
billNo: widget.patientLabOrders!.invoiceNo,
|
|
// details: model.patientLabSpecialResult[index].resultDataHTML,
|
|
details: model.patientLabSpecialResult.isEmpty
|
|
? null
|
|
: getSpecialResults(model),
|
|
orderNo: widget.patientLabOrders!.orderNo,
|
|
patientLabOrder: widget.patientLabOrders,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// bottomSheet: Container(
|
|
// color: Colors.white,
|
|
// height: MediaQuery.of(context).size.height * 0.081,
|
|
// width: double.infinity,
|
|
// padding: EdgeInsets.all(12.0),
|
|
// child: Column(
|
|
// children: <Widget>[
|
|
// Container(
|
|
// width: MediaQuery.of(context).size.width * 0.9,
|
|
// child: DefaultButton(
|
|
// TranslationBase.of(context).downloadReport,
|
|
// () async {
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
// await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders, mes: TranslationBase.of(context).sendSuc, userObj: projectViewModel.user, isVidaPlus: Utils.isVidaPlusProject(projectViewModel, num.parse(widget.patientLabOrders.projectID)), isDownload: true);
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
// try {
|
|
// String path = await _createFileFromString(model.labReportPDF, "pdf");
|
|
// OpenFilex.open(path);
|
|
// } catch (ex) {
|
|
// AppToast.showErrorToast(message: "Cannot open file.");
|
|
// }
|
|
// },
|
|
// textColor: Colors.white,
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
),
|
|
);
|
|
}
|
|
|
|
String getSpecialResults(LabsViewModel model) {
|
|
String labResults = "";
|
|
model.patientLabSpecialResult.forEach((element) {
|
|
if (element.resultDataHTML != null) {
|
|
labResults += (element.resultDataHTML! + "<br/> <br/>");
|
|
} else {
|
|
labResults += ("<h6>No Result Available</h6>");
|
|
}
|
|
});
|
|
return labResults;
|
|
}
|
|
}
|