lab result fixes

update-to-3.32-sdk
Haroon Amjad 2 months ago
parent d1978ec7d1
commit 818a1f8205

@ -87,20 +87,29 @@ class LabsViewModel extends BaseViewModel {
List<LabResultList> labResultLists = []; List<LabResultList> labResultLists = [];
getLaboratoryResult({String? projectID, int? clinicID, String? invoiceNo, String? invoiceType, String? orderNo, String? setupID, bool? isVidaPlus}) async { getLaboratoryResult({required PatientLabOrders patientLabOrder, String? projectID, int? clinicID, String? invoiceNo, String? invoiceType, String? orderNo, String? setupID, bool? isVidaPlus}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, invoiceType: invoiceType, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, isVidaPlus: isVidaPlus); await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, invoiceType: invoiceType, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, isVidaPlus: isVidaPlus);
// await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder, isVidaPlus: isVidaPlus);
if (_labsService.hasError) { if (_labsService.hasError) {
error = _labsService.error!; error = _labsService.error!;
// setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
// setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async { getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder, isVidaPlus: isVidaPlus); await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder, isVidaPlus: isVidaPlus);
await _labsService.getLaboratoryResult(
invoiceNo: patientLabOrder.invoiceNo,
invoiceType: patientLabOrder.invoiceType,
orderNo: patientLabOrder.orderNo,
projectID: patientLabOrder.projectID,
clinicID: patientLabOrder.clinicID,
setupID: patientLabOrder.setupID,
isVidaPlus: isVidaPlus);
if (_labsService.hasError) { if (_labsService.hasError) {
error = _labsService.error!; error = _labsService.error!;
setState(ViewState.Error); setState(ViewState.Error);
@ -199,7 +208,13 @@ class LabsViewModel extends BaseViewModel {
maxYForThreeDots = double.parse(element.resultValue!); maxYForThreeDots = double.parse(element.resultValue!);
} }
// threePointGraphValue.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime)); // threePointGraphValue.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime));
threePointGraphValue.add(DataPoint( labelValue: counter,value : double.parse(element.resultValue!), actualValue: element.resultValue!,label: formatDateAsMMYY(dateTime), date: dateTime, referenceRangeValue:element.calculatedResultFlag ??"IRR")); threePointGraphValue.add(DataPoint(
labelValue: counter,
value: double.parse(element.resultValue!),
actualValue: element.resultValue!,
label: formatDateAsMMYY(dateTime),
date: dateTime,
referenceRangeValue: element.calculatedResultFlag ?? "IRR"));
counter++; counter++;
} catch (e) {} } catch (e) {}
}); });
@ -217,15 +232,21 @@ class LabsViewModel extends BaseViewModel {
completeeGraphValues.clear(); completeeGraphValues.clear();
setState(ViewState.Busy); setState(ViewState.Busy);
double counter = 1; double counter = 1;
threshold = _labsService.getThresholdValue(); threshold = _labsService.getThresholdValue();
_labsService.labOrdersResultsList.reversed.forEach((element) { _labsService.labOrdersResultsList.reversed.forEach((element) {
try { try {
var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!); var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!);
if(double.parse(element.resultValue!)> maxYForCompleteGraph){ if (double.parse(element.resultValue!) > maxYForCompleteGraph) {
maxYForCompleteGraph = double.parse(element.resultValue!); maxYForCompleteGraph = double.parse(element.resultValue!);
} }
// completeeGraphValues.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime)); // completeeGraphValues.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime));
completeeGraphValues.add(DataPoint( labelValue: counter,value : double.parse(element.resultValue!), label: formatDateAsMMYY(dateTime), date: dateTime,actualValue: element.resultValue!, referenceRangeValue:element.calculatedResultFlag??"IRR" )); completeeGraphValues.add(DataPoint(
labelValue: counter,
value: double.parse(element.resultValue!),
label: formatDateAsMMYY(dateTime),
date: dateTime,
actualValue: element.resultValue!,
referenceRangeValue: element.calculatedResultFlag ?? "IRR"));
} catch (e) { } catch (e) {
print("the mapping is having exception $e"); print("the mapping is having exception $e");
} }
@ -242,6 +263,7 @@ class LabsViewModel extends BaseViewModel {
String year = date.year.toString().substring(2); String year = date.year.toString().substring(2);
return '$month/$year'; return '$month/$year';
} }
sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes, AuthenticatedUser? userObj, required bool isVidaPlus, bool isDownload = false}) async { sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes, AuthenticatedUser? userObj, required bool isVidaPlus, bool isDownload = false}) async {
setState(ViewState.Busy); setState(ViewState.Busy);

@ -24,15 +24,16 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => model.getLaboratoryResult( onModelReady: (model) {},
invoiceNo: widget.patientLabOrders!.invoiceNo, // onModelReady: (model) => model.getLaboratoryResult(
invoiceType: widget.patientLabOrders!.invoiceType, // invoiceNo: widget.patientLabOrders!.invoiceNo,
clinicID: widget.patientLabOrders!.clinicID, // invoiceType: widget.patientLabOrders!.invoiceType,
projectID: widget.patientLabOrders!.projectID, // clinicID: widget.patientLabOrders!.clinicID,
orderNo: widget.patientLabOrders!.orderNo, // projectID: widget.patientLabOrders!.projectID,
setupID: widget.patientLabOrders!.setupID, // orderNo: widget.patientLabOrders!.orderNo,
isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)), // setupID: widget.patientLabOrders!.setupID,
), // isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)),
// ),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: widget.patientLabOrders!.doctorName!, appBarTitle: widget.patientLabOrders!.doctorName!,
@ -45,27 +46,24 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
child: Column( child: Column(
children: [ children: [
LaboratoryResultWidget( LaboratoryResultWidget(
onTap: () async { onTap: () async {
await model.sendLabReportEmail( await model.sendLabReportEmail(
patientLabOrder: widget.patientLabOrders, patientLabOrder: widget.patientLabOrders,
mes: TranslationBase.of(context).sendSuc, mes: TranslationBase.of(context).sendSuc,
userObj: projectViewModel.user, userObj: projectViewModel.user,
isVidaPlus: Utils.isVidaPlusProject( isVidaPlus: Utils.isVidaPlusProject(
projectViewModel, projectViewModel,
int.parse(widget.patientLabOrders!.projectID!), int.parse(widget.patientLabOrders!.projectID!),
), ),
isDownload: true); isDownload: true);
}, },
showConfirmMessageDialog: false, showConfirmMessageDialog: false,
billNo: widget.patientLabOrders!.invoiceNo, billNo: widget.patientLabOrders!.invoiceNo,
// details: model.patientLabSpecialResult[index].resultDataHTML, // details: model.patientLabSpecialResult[index].resultDataHTML,
details: model.patientLabSpecialResult.isEmpty details: model.patientLabSpecialResult.isEmpty ? null : getSpecialResults(model),
? null orderNo: widget.patientLabOrders!.orderNo,
: getSpecialResults(model), patientLabOrder: widget.patientLabOrders,
orderNo: widget.patientLabOrders!.orderNo, labmodel: model),
patientLabOrder: widget.patientLabOrders,
labmodel: model
),
], ],
), ),
), ),

@ -22,7 +22,8 @@ class LaboratoryResultWidget extends StatefulWidget {
final bool showConfirmMessageDialog; final bool showConfirmMessageDialog;
final LabsViewModel labmodel; final LabsViewModel labmodel;
const LaboratoryResultWidget({Key? key, this.onTap, this.billNo, this.details, this.orderNo, this.projectName, this.patientLabOrder, this.showConfirmMessageDialog = true,required this.labmodel}) : super(key: key); const LaboratoryResultWidget({Key? key, this.onTap, this.billNo, this.details, this.orderNo, this.projectName, this.patientLabOrder, this.showConfirmMessageDialog = true, required this.labmodel})
: super(key: key);
@override @override
_LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState(); _LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState();
@ -40,21 +41,20 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
super.initState(); super.initState();
this.model = widget.labmodel; this.model = widget.labmodel;
labSpecialResult = widget.details; // labSpecialResult = widget.details;
labSpecialResult = widget.details ?? "No Data Available";
} }
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
var oldStateTablateScreenState = isTabletScreen; var oldStateTablateScreenState = isTabletScreen;
isTabletScreen = isTablet(context); isTabletScreen = isTablet(context);
if(isTabletScreen != oldStateTablateScreenState); if (isTabletScreen != oldStateTablateScreenState) ;
{ {
model?.recalculatePercentage(isTabletScreen); model?.recalculatePercentage(isTabletScreen);
} }
} }
bool isTablet(BuildContext context) { bool isTablet(BuildContext context) {
@ -71,9 +71,10 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
onModelReady: (_) { onModelReady: (_) {
print("the length of in on model Ready ${model?.patientLabSpecialResult.length}"); print("the length of in on model Ready ${model?.patientLabSpecialResult.length}");
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
model?.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!, isTablet: isTabletScreen); model?.getPatientLabResult(
isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!, isTablet: isTabletScreen);
labSpecialResult = widget.details ?? "No Data Available";
}); });
}, },
builder: (_, __, w) => NetworkBaseView( builder: (_, __, w) => NetworkBaseView(
baseViewModel: widget.labmodel, baseViewModel: widget.labmodel,

Loading…
Cancel
Save