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 = [];
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);
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) {
error = _labsService.error!;
// setState(ViewState.Error);
setState(ViewState.Error);
} else {
// setState(ViewState.Idle);
setState(ViewState.Idle);
}
}
getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async {
setState(ViewState.Busy);
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) {
error = _labsService.error!;
setState(ViewState.Error);
@ -199,7 +208,13 @@ class LabsViewModel extends BaseViewModel {
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 : 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++;
} catch (e) {}
});
@ -217,15 +232,21 @@ class LabsViewModel extends BaseViewModel {
completeeGraphValues.clear();
setState(ViewState.Busy);
double counter = 1;
threshold = _labsService.getThresholdValue();
threshold = _labsService.getThresholdValue();
_labsService.labOrdersResultsList.reversed.forEach((element) {
try {
var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!);
if(double.parse(element.resultValue!)> maxYForCompleteGraph){
if (double.parse(element.resultValue!) > maxYForCompleteGraph) {
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 : 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) {
print("the mapping is having exception $e");
}
@ -242,6 +263,7 @@ class LabsViewModel extends BaseViewModel {
String year = date.year.toString().substring(2);
return '$month/$year';
}
sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes, AuthenticatedUser? userObj, required bool isVidaPlus, bool isDownload = false}) async {
setState(ViewState.Busy);

@ -24,15 +24,16 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
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!)),
),
onModelReady: (model) {},
// 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!,
@ -45,27 +46,24 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
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,
labmodel: model
),
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,
labmodel: model),
],
),
),

@ -22,7 +22,8 @@ class LaboratoryResultWidget extends StatefulWidget {
final bool showConfirmMessageDialog;
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
_LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState();
@ -40,21 +41,20 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
super.initState();
this.model = widget.labmodel;
labSpecialResult = widget.details;
// labSpecialResult = widget.details;
labSpecialResult = widget.details ?? "No Data Available";
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
var oldStateTablateScreenState = isTabletScreen;
isTabletScreen = isTablet(context);
if(isTabletScreen != oldStateTablateScreenState);
isTabletScreen = isTablet(context);
if (isTabletScreen != oldStateTablateScreenState) ;
{
model?.recalculatePercentage(isTabletScreen);
}
}
bool isTablet(BuildContext context) {
@ -71,9 +71,10 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
onModelReady: (_) {
print("the length of in on model Ready ${model?.patientLabSpecialResult.length}");
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(
baseViewModel: widget.labmodel,

Loading…
Cancel
Save