diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8c99dddf..f915e9fe 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2147,8 +2147,8 @@ const Map localizedValues = { "readMore": {"en": "Read More", "ar": "اقرأ أكثر"}, "showLess": {"en": "Show Less", "ar": "عرض أقل"}, "change": {"en": "Change", "ar": "فرق"}, - "referenceRange": {"en": "Reference Range", "ar": "النطاق المرجعي"}, - "criticalLow": {"en": "Critical Low", "ar": "النطاق المرجعي"}, + "referenceRange": {"en": "Reference Range", "ar": "نطاق مرجعي"}, + "criticalLow": {"en": "Critical Low", "ar": "انخفاض حرج"}, "criticalHigh": {"en": "Critical High", "ar": "حرج مرتفع"}, "high": {"en": "High", "ar": "مرتفع"}, "normal": {"en": "Normal", "ar": "عادي"}, diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 732e4bc1..6ecdef8d 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -187,8 +187,8 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 3628599; //4609100 - // body['TokenID'] = "@dm!n"; + body['PatientID'] = 1018977; //4609100 + body['TokenID'] = "@dm!n"; // Patient ID: 3027574 // Mobile no.: 0502303285 diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index f6744491..313f82c6 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -32,8 +32,7 @@ class LabsViewModel extends BaseViewModel { List threshold = []; double maxYForThreeDots = 0.0; double maxYForCompleteGraph = 0.0; - List months = ['Jan','Feb','Mar','April','May','Jun','July','Aug','Sep','Oct','Nov','Dec']; - + List months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'Jun', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; String get labReportPDF => _labsService.labReportPDF; @@ -94,13 +93,13 @@ class LabsViewModel extends BaseViewModel { await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, invoiceType: invoiceType, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, 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 { + getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async { setState(ViewState.Busy); await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder, isVidaPlus: isVidaPlus); if (_labsService.hasError) { @@ -109,54 +108,48 @@ class LabsViewModel extends BaseViewModel { } else { _labsService.labResultList.forEach((element) { List patientLabOrdersClinic = labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList(); - element.percentage = - getPercentage(element.calculatedResultFlag?? ResultFlag.N, isTablet); + element.percentage = getPercentage(element.calculatedResultFlag ?? ResultFlag.N, isTablet); if (patientLabOrdersClinic.length != 0) { - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element); + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element); } else { - labResultLists.add(LabResultList( - filterName: element.testCode, - description: element.packageShortDescription, - lab: element)); + labResultLists.add(LabResultList(filterName: element.testCode, description: element.packageShortDescription, lab: element)); } }); setState(ViewState.Idle); } } - recalculatePercentage(isTablet){ - for(int i = 0;i maxYForThreeDots){ - debugPrint("the double.parse(element.resultValue!) is ${double.parse(element.resultValue!)}"); - + if (double.parse(element.resultValue!) > maxYForThreeDots) { 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: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime, referenceRangeValue:element.calculatedResultFlag ??"IRR")); + threePointGraphValue.add(DataPoint( + labelValue: counter, + value: double.parse(element.resultValue!), + actualValue: element.resultValue!, + label: "${months[dateTime.month - 1]} ${dateTime.year}", + date: dateTime, + referenceRangeValue: element.calculatedResultFlag ?? "IRR")); counter++; } catch (e) {} }); - debugPrint("the maxY is ${maxYForThreeDots}"); threePointGraphValue.last.label = "thisResult"; threePointGraphValue.last.isStringResource = true; @@ -227,33 +219,31 @@ class LabsViewModel extends BaseViewModel { /// This function is used to create a full graph data points for the lab results. /// @param onComplete: A callback function that is called when the data points are created. - createFullGraphDatPoints( - VoidCallback onComplete - ){ + createFullGraphDatPoints(VoidCallback onComplete) { maxYForCompleteGraph = 0.0; completeeGraphValues.clear(); setState(ViewState.Busy); double counter = 1; - threshold = _labsService.getThresholdValue(); + threshold = _labsService.getThresholdValue(); _labsService.labOrdersResultsList.reversed.forEach((element) { try { - print("the mapping is being done"); 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: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime,actualValue: element.resultValue!, referenceRangeValue:element.calculatedResultFlag??"IRR" )); + completeeGraphValues.add(DataPoint( + labelValue: counter, + value: double.parse(element.resultValue!), + label: "${months[dateTime.month - 1]} ${dateTime.year}", + date: dateTime, + actualValue: element.resultValue!, + referenceRangeValue: element.calculatedResultFlag ?? "IRR")); } catch (e) { print("the mapping is having exception $e"); - } ++counter; - }); - print("the label values are $counter"); - print("the completeeGraphValues length are ${completeeGraphValues.length}"); - print("the completeeGraphValues last value of label ias ${completeeGraphValues.last.labelValue}"); completeeGraphValues.last.label = "thisResult"; completeeGraphValues.last.isStringResource = true; setState(ViewState.Idle); @@ -287,8 +277,7 @@ class LabsViewModel extends BaseViewModel { Future _createFileFromString(String encodedStr, String ext) async { Uint8List bytes = base64.decode(encodedStr); String dir = (await getApplicationDocumentsDirectory()).path; - File file = File( - "$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); + File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); await file.writeAsBytes(bytes); return file.path; } diff --git a/lib/main.dart b/lib/main.dart index f2e12729..45efd593 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -34,7 +34,6 @@ void main() async { await Firebase.initializeApp(); await initLocalStorage(); - // Pass all uncaught "fatal" errors from the framework to Crashlytics // FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; @@ -117,8 +116,7 @@ class _MyApp extends State { void openAppLink(Uri uri) { print("the uri is $uri"); - DeepLinkHandler.instance.handleDeepLinkAndNavigation( - locator().navigatorKey.currentState, uri, context); + DeepLinkHandler.instance.handleDeepLinkAndNavigation(locator().navigatorKey.currentState, uri, context); } @override @@ -142,7 +140,8 @@ class _MyApp extends State { providers: [ ChangeNotifierProvider( create: (context) => PharmacyPagesViewModel(), - ), ChangeNotifierProvider( + ), + ChangeNotifierProvider( create: (context) => AuthProviderViewModel(), ), ChangeNotifierProvider( diff --git a/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart b/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart index bd3757c7..e0f9d997 100644 --- a/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart +++ b/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart @@ -31,144 +31,126 @@ class FlowChartPage extends StatelessWidget { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, - procedure: filterName, - isVidaPlus: Utils.isVidaPlusProject( - projectViewModel!, int.parse(patientLabOrder!.projectID!))), - builder: (context, model, w) { - print("the maxY in builder is ${model.maxYForCompleteGraph}"); - return SizedBox( - height: MediaQuery.sizeOf(context).height * .75, - child: (model.state == ViewState.Busy) - ? Material( - color: Colors.grey.withOpacity(0.6), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20))), - child: Center( - child: Container( - child: GifLoaderContainer(), - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.height * 0.09)), - ), - ) - : SingleChildScrollView( - child: model.labOrdersResultsList.isNotEmpty - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - - Padding( - padding: const EdgeInsets.only( - top: 16.0, right: 16.0, bottom: 10, left: 16.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(filterName??"", style: TextStyle( - fontSize: 21, - fontWeight: FontWeight.w700, - color: Colors.black, - letterSpacing: -0.64, - ),), - GestureDetector( - onTap: () => Navigator.pop(context), - child: Align( - alignment: Alignment.centerRight, - child: Icon( - Icons.close, - color: Colors.black, - size: 28, + onModelReady: (model) => + model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName, isVidaPlus: Utils.isVidaPlusProject(projectViewModel!, int.parse(patientLabOrder!.projectID!))), + builder: (context, model, w) { + return SizedBox( + height: MediaQuery.sizeOf(context).height * .75, + child: (model.state == ViewState.Busy) + ? Material( + color: Colors.grey.withOpacity(0.6), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), + child: Center( + child: Container(child: GifLoaderContainer(), margin: EdgeInsets.only(bottom: MediaQuery.of(context).size.height * 0.09)), + ), + ) + : SingleChildScrollView( + child: model.labOrdersResultsList.isNotEmpty + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.only(top: 16.0, right: 16.0, bottom: 10, left: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + filterName ?? "", + style: TextStyle( + fontSize: 21, + fontWeight: FontWeight.w700, + color: Colors.black, + letterSpacing: -0.64, + ), ), - ), + GestureDetector( + onTap: () => Navigator.pop(context), + child: Align( + alignment: Alignment.centerRight, + child: Icon( + Icons.close, + color: Colors.black, + size: 28, + ), + ), + ), + ], ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 17, top: 12, right: 13, bottom: 12), - margin: - EdgeInsets.only(left: 21, right: 21, top: 21), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - // child: LineChartCurved( - // title: filterName, - // labResult: model.labOrdersResultsList, - // ), - // child: ShowChart( - // title: filterName!, - // timeSeries: model.timeSeries, - // indexes: model.timeSeries.length ~/ 5.5 ?? 0, - // ), - child: Column( - children: [ - SizedBox( - height: MediaQuery.sizeOf(context).height / 4, - child: DynamicResultChart( - dataPoints: model.threePointGraphValue, - thresholds: model.threshold, - maxY: model.maxYForThreeDots, - width: MediaQuery.sizeOf(context).width - 77, - scrollDirection: Axis.horizontal, - height: MediaQuery.sizeOf(context).height / 4, + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12), + margin: EdgeInsets.only(left: 21, right: 21, top: 21), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - - InkWell( - onTap: () { - model.createFullGraphDatPoints(() { - Navigator.push(context, - MaterialPageRoute(builder: (_) { - return FullScreenGraph( - completeeGraphValues: model.completeeGraphValues, - threshold: model.threshold, - maxY : model.maxYForCompleteGraph - ); - })); - }); - }, - // child: Text(TranslationBase.of(context) - // .seeAllGraphValues), - child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false), - ) - ], + // child: LineChartCurved( + // title: filterName, + // labResult: model.labOrdersResultsList, + // ), + // child: ShowChart( + // title: filterName!, + // timeSeries: model.timeSeries, + // indexes: model.timeSeries.length ~/ 5.5 ?? 0, + // ), + child: Column( + children: [ + SizedBox( + height: MediaQuery.sizeOf(context).height / 4, + child: DynamicResultChart( + dataPoints: model.threePointGraphValue, + thresholds: model.threshold, + maxY: model.maxYForThreeDots, + width: MediaQuery.sizeOf(context).width - 77, + scrollDirection: Axis.horizontal, + height: MediaQuery.sizeOf(context).height / 4, + ), + ), + InkWell( + onTap: () { + model.createFullGraphDatPoints(() { + Navigator.push(context, MaterialPageRoute(builder: (_) { + return FullScreenGraph(completeeGraphValues: model.completeeGraphValues, threshold: model.threshold, maxY: model.maxYForCompleteGraph); + })); + }); + }, + // child: Text(TranslationBase.of(context) + // .seeAllGraphValues), + child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false), + ) + ], + ), + ), + LabResultChartAndDetails( + name: filterName!, + // labResult: model.labOrdersResultsList, + labResult: model.labOrdersResultsList.reversed.toList(), + ), + ], + ) + : Center( + child: Container( + padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.32), + child: Center( + child: getNoDataWidget(context), + ), ), ), - LabResultChartAndDetails( - name: filterName!, - // labResult: model.labOrdersResultsList, - labResult: model.labOrdersResultsList.reversed.toList(), - ), - ], - ) - : Center( - child: Container( - padding: EdgeInsets.only( - top: MediaQuery.of(context).size.height * 0.32), - child: Center( - child: getNoDataWidget(context), - ), - ), - ), - ), - );} - ); + ), + ); + }); } } diff --git a/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart b/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart index d8ff9c40..3510ee78 100644 --- a/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart +++ b/lib/widgets/data_display/medical/LabResult/lab_result_graph.dart @@ -20,13 +20,11 @@ class DynamicResultChart extends StatelessWidget { Widget build(BuildContext context) { var minY = 0.0; // var maxY = 0.0; - print("the maxY from parameter is $maxY"); double interval = 20; if((maxY??0)>10 &&(maxY??0)<=20) interval = 2; else if((maxY??0)>5 &&(maxY??0)<=10) interval = 1; else if((maxY??0)>=0 &&(maxY??0)<=5) interval = .4; // else if((maxY??0)>=100) interval = 20; - print("the interval parameter is $interval"); // if (thresholds.isNotEmpty) { // print("the thresholds are $thresholds"); @@ -198,7 +196,6 @@ class DynamicResultChart extends StatelessWidget { List _buildColoredLineSegments(List dataPoints, List thresholds) { List segments = []; Color getColor(String value) { - print("the value to compare is $value"); for (int i = thresholds.length - 1; i >= 0; i--) { if (value == thresholds[i].label) { return thresholds[i].lineColor; @@ -249,7 +246,6 @@ class DynamicResultChart extends StatelessWidget { final List allSpots = dataPoints.asMap().entries.map((entry) { return FlSpot(entry.key.toDouble(), entry.value.value); }).toList(); - print("the spots are $allSpots"); var data = [ // ...segments diff --git a/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart b/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart index ed4ed02e..822f83c5 100644 --- a/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart +++ b/lib/widgets/data_display/medical/LabResult/newUI/LabItem.dart @@ -141,8 +141,6 @@ class _LabItemState extends State { scrollControlDisabledMaxHeightRatio: .75, shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), builder: (context) { - print('builder: the bottom sheet is showing'); - return FlowChartPage( filterName: procedure, patientLabOrder: widget.patientLabOrders, diff --git a/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart b/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart index 4fbce744..36cd12ea 100644 --- a/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart +++ b/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart @@ -393,6 +393,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget { Text( "${TranslationBase.of(context).referenceRange} \n $referenceRange", style: TextStyle( + overflow: TextOverflow.clip, fontSize: 10, fontFamily: fontFamily, fontWeight: FontWeight.w600,