fix charts and vital sign

dq_and_master
Mohammad Aljammal 4 years ago committed by Mohammad Aljammal
parent 92e6275162
commit de1e352e98

@ -1161,5 +1161,9 @@ const Map localizedValues = {
"update-email": { "update-email": {
"en": "Update Email", "en": "Update Email",
"ar": "تحديث البريد الالكتروني" "ar": "تحديث البريد الالكتروني"
} },
"noDataAvailable": {
"en": "No data available",
"ar": " لا يوجد بيانات متاحة "
},
}; };

@ -90,7 +90,7 @@ class BaseAppClient {
body['PatientID'] = body['PatientID'] =
body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientID'] != null ? body['PatientID'] : user['PatientID'];
body['PatientOutSA'] = user['OutSA']; body['PatientOutSA'] = user['OutSA'];
body['SessionID'] = SESSION_ID; //getSessionId(token); body['SessionID'] = getSessionId(token);
} }
} }
@ -172,6 +172,6 @@ class BaseAppClient {
String getSessionId(String id) { String getSessionId(String id) {
///return id.replaceAll(RegExp('/[^\w\s]/'), ''); ///return id.replaceAll(RegExp('/[^\w\s]/'), '');
// return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); return id.replaceAll(RegExp('/[^a-zA-Z ]'), '');
} }
} }

@ -70,6 +70,7 @@ class LabsService extends BaseService {
await baseAppClient.post(GET_Patient_LAB_RESULT, await baseAppClient.post(GET_Patient_LAB_RESULT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear(); patientLabSpecialResult.clear();
labResultList.clear();
response['ListPLR'].forEach((lab) { response['ListPLR'].forEach((lab) {
labResultList.add(LabResult.fromJson(lab)); labResultList.add(LabResult.fromJson(lab));
}); });
@ -121,7 +122,7 @@ class LabsService extends BaseService {
await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
AppToast.showSuccessToast(message: 'A copy has been sent to the email');
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;

@ -5,14 +5,14 @@ import '../base_service.dart';
class VitalSignService extends BaseService { class VitalSignService extends BaseService {
List<VitalSignResModel> vitalSignResModelList = List(); List<VitalSignResModel> vitalSignResModelList = List();
Map<String, dynamic> body = Map();
String weightKg = ""; String weightKg = "";
String heightCm = ""; String heightCm = "";
String bloadType = ""; String bloadType = "";
Future getPatientRadOrders({int appointmentNo, int projectID}) async { Future getPatientRadOrders({int appointmentNo, int projectID}) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map();
if (appointmentNo != null && projectID != null) { if (appointmentNo != null && projectID != null) {
body['TransNo'] = appointmentNo; body['TransNo'] = appointmentNo;
body['ProjectID'] = projectID; body['ProjectID'] = projectID;

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart';
import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../locator.dart'; import '../../../locator.dart';
import '../base_view_model.dart'; import '../base_view_model.dart';
@ -143,14 +144,11 @@ class LabsViewModel extends BaseViewModel {
} }
} }
sendLabReportEmail({PatientLabOrders patientLabOrder}) async { sendLabReportEmail({PatientLabOrders patientLabOrder,String mes}) async {
setState(ViewState.Busy);
await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder);
if (_labsService.hasError) { if (_labsService.hasError) {
error = _labsService.error; error = _labsService.error;
setState(ViewState.Error); }else
} else { AppToast.showSuccessToast(message: mes);
setState(ViewState.Idle);
}
} }
} }

@ -3,6 +3,7 @@ import 'dart:ui';
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
@ -33,7 +34,9 @@ import 'package:provider/provider.dart';
class MyFamily extends StatefulWidget { class MyFamily extends StatefulWidget {
final bool isAppbarVisible; final bool isAppbarVisible;
MyFamily({this.isAppbarVisible = true}); MyFamily({this.isAppbarVisible = true});
@override @override
_MyFamily createState() => _MyFamily(); _MyFamily createState() => _MyFamily();
} }
@ -51,6 +54,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
locator<AppointmentRateViewModel>(); locator<AppointmentRateViewModel>();
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
AuthenticatedUser user; AuthenticatedUser user;
VitalSignService _vitalSignService = locator<VitalSignService>();
@override @override
void initState() { void initState() {
_tabController = new TabController(length: 2, vsync: this, initialIndex: 0); _tabController = new TabController(length: 2, vsync: this, initialIndex: 0);
@ -106,7 +111,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: Container( child: Container(
height: 60.0, height: 60.0,
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.92, // 0.9, width: MediaQuery.of(context).size.width * 0.92,
// 0.9,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
@ -660,8 +666,11 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
.familyFileProvider .familyFileProvider
.silentLoggin(user is AuthenticatedUser ? null : user, .silentLoggin(user is AuthenticatedUser ? null : user,
mainUser: user is AuthenticatedUser) mainUser: user is AuthenticatedUser)
.then((value) => loginAfter(value, context)) .then((value) {
.catchError((err) { _vitalSignService.heightCm = "";
_vitalSignService.weightKg = "";
loginAfter(value, context);
}).catchError((err) {
print(err); print(err);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
Navigator.of(context).pop(); Navigator.of(context).pop();

@ -54,6 +54,7 @@ class _HomePageState extends State<HomePage> {
return BaseView<DashboardViewModel>( return BaseView<DashboardViewModel>(
onModelReady: (model) => model.getPatientRadOrders(), onModelReady: (model) => model.getPatientRadOrders(),
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
isShowDecPage: false, isShowDecPage: false,
body: Container( body: Container(
width: double.infinity, width: double.infinity,

@ -1,37 +1,50 @@
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.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/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/data_display/medical/LabResult/laboratory_result_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class LaboratoryResultPage extends StatelessWidget { class LaboratoryResultPage extends StatefulWidget {
final PatientLabOrders patientLabOrders; final PatientLabOrders patientLabOrders;
LaboratoryResultPage({Key key, this.patientLabOrders}); LaboratoryResultPage({Key key, this.patientLabOrders});
@override
_LaboratoryResultPageState createState() => _LaboratoryResultPageState();
}
class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => model.getLaboratoryResult( onModelReady: (model) => model.getLaboratoryResult(
invoiceNo: patientLabOrders.invoiceNo, invoiceNo: widget.patientLabOrders.invoiceNo,
clinicID: patientLabOrders.clinicID, clinicID: widget.patientLabOrders.clinicID,
projectID: patientLabOrders.projectID, projectID: widget.patientLabOrders.projectID,
orderNo: patientLabOrders.orderNo), orderNo: widget.patientLabOrders.orderNo),
builder: (_, model, widget) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).labResults, appBarTitle: TranslationBase.of(context).labResults,
baseViewModel: model, baseViewModel: model,
body: Scaffold( body: Scaffold(
body: ListView.builder( body: ListView.builder(
itemBuilder: (context, index) => LaboratoryResultWidget( itemBuilder: (context, index) => LaboratoryResultWidget(
onTap: () => model.sendLabReportEmail(patientLabOrder: patientLabOrders), onTap: ()async {
billNo: patientLabOrders.invoiceNo, GifLoaderDialogUtils.showMyDialog(context);
await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders,mes: TranslationBase.of(context).sendSuc);
GifLoaderDialogUtils.hideDialog(context);
},
billNo: widget.patientLabOrders.invoiceNo,
details: model.patientLabSpecialResult[index].resultDataHTML, details: model.patientLabSpecialResult[index].resultDataHTML,
orderNo: patientLabOrders.orderNo, orderNo: widget.patientLabOrders.orderNo,
patientLabOrder: patientLabOrders, patientLabOrder: widget.patientLabOrders,
), ),
itemCount: model.patientLabSpecialResult.length, itemCount: model.patientLabSpecialResult.length,
), ),

@ -12,7 +12,7 @@ import 'package:diplomaticquarterapp/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 'confirm_send_email_dialog.dart'; import '../../../widgets/dialogs/confirm_send_email_dialog.dart';
class PrescriptionItemsPage extends StatelessWidget { class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions; final Prescriptions prescriptions;

@ -0,0 +1,194 @@
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class LineChartCurved extends StatelessWidget {
final String title;
final List<TimeSeriesSales2> timeSeries;
final int indexes;
LineChartCurved({this.title, this.timeSeries, this.indexes});
List<int> xAxixs = List();
@override
Widget build(BuildContext context) {
getXaxix();
return AspectRatio(
aspectRatio: 1.1,
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18)),
// color: Colors.white,
),
child: Stack(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const SizedBox(
height: 4,
),
Text(
title,
style: TextStyle(
color: Colors.black,
fontSize: 32,
fontWeight: FontWeight.bold,
letterSpacing: 2),
textAlign: TextAlign.center,
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 18.0, left: 16.0),
child: LineChart(
sampleData1(context),
swapAnimationDuration: const Duration(milliseconds: 250),
),
),
),
const SizedBox(
height: 10,
),
],
),
],
),
),
);
}
getXaxix() {
for (int index = 0; index < timeSeries.length; index++) {
int mIndex = indexes * index;
if (mIndex < timeSeries.length) {
xAxixs.add(mIndex);
}
}
}
LineChartData sampleData1(context) {
return LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.white,
),
touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(
show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
color: Colors.black,
fontSize: 10,
),
//rotateAngle:-65,
//rotateAngle:-65,
margin: 14,
getTitles: (value) {
if (timeSeries.length < 8) {
if (timeSeries.length > value.toInt()) {
return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}';
} else
return '';
} else {
if (value.toInt() == 0)
return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}';
if (value.toInt() == timeSeries.length - 1)
return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}';
if (xAxixs.contains(value.toInt())) {
return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.year}';
}
}
return '';
},
),
leftTitles: SideTitles(
showTitles: true,
getTextStyles: (value) => const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 11,
),
getTitles: (value) {
return '${value.toInt()}';
},
margin: 12,
),
),
borderData: FlBorderData(
show: true,
border: const Border(
bottom: BorderSide(
color: Colors.black,
width: 0.5,
),
left: BorderSide(
color: Colors.black,
),
right: BorderSide(
color: Colors.black,
),
top: BorderSide(
color: Colors.transparent,
),
),
),
minX: 0,
maxX: (timeSeries.length - 1).toDouble(),
maxY: getMaxY(),
minY: getMinY(),
lineBarsData: getData(context),
);
}
double getMaxY() {
double max = 0;
timeSeries.forEach((element) {
double resultValueDouble = element.sales;
if (resultValueDouble > max) max = resultValueDouble;
});
return max.roundToDouble() + 10;
}
double getMinY() {
double min = timeSeries[0].sales;
timeSeries.forEach((element) {
double resultValueDouble = element.sales;
if (resultValueDouble < min) min = resultValueDouble;
});
int value = min.toInt();
return value.toDouble();
}
List<LineChartBarData> getData(context) {
List<FlSpot> spots = List();
for (int index = 0; index < timeSeries.length; index++) {
spots.add(FlSpot(index.toDouble(), timeSeries[index].sales));
}
final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots,
isCurved: true,
colors: [Theme.of(context).primaryColor],
barWidth: 5,
isStrokeCapRound: true,
dotData: FlDotData(
show: false,
),
belowBarData: BarAreaData(
show: false,
),
);
return [
lineChartBarData1,
];
}
}

@ -108,7 +108,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
des: TranslationBase.of(context).body, des: TranslationBase.of(context).body,
icon: DQIcons.bmi, icon: DQIcons.bmi,
lastVal: mode lastVal: mode
.vitalSignResModelList[0].pulseBeatPerMinute .vitalSignResModelList[ mode.vitalSignResModelList.length - 1].pulseBeatPerMinute
.toString(), .toString(),
unit: TranslationBase.of(context).mass, unit: TranslationBase.of(context).mass,
), ),
@ -130,7 +130,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
des: TranslationBase.of(context).temperature, des: TranslationBase.of(context).temperature,
icon: DQIcons.thermometer, icon: DQIcons.thermometer,
lastVal: mode lastVal: mode
.vitalSignResModelList[0].temperatureCelcius .vitalSignResModelList[ mode.vitalSignResModelList.length - 1].temperatureCelcius
.toString(), .toString(),
unit: TranslationBase.of(context).tempC, unit: TranslationBase.of(context).tempC,
), ),

@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts; import 'package:charts_flutter/flutter.dart' as charts;
import 'LineChartCurved.dart';
class VitalSingChartAndDetials extends StatelessWidget { class VitalSingChartAndDetials extends StatelessWidget {
VitalSingChartAndDetials({ VitalSingChartAndDetials({
Key key, Key key,
@ -21,29 +23,16 @@ class VitalSingChartAndDetials extends StatelessWidget {
final String viewKey; final String viewKey;
final String title1; final String title1;
final String title2; final String title2;
List<TimeSeriesSales> timeSeriesData = []; List<TimeSeriesSales2> timeSeriesData = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
generateData();
return Column( return Column(
children: <Widget>[ children: <Widget>[
AppExpandableNotifier( AppExpandableNotifier(
headerWidget: AppTimeSeriesChart( isExpand: true,
seriesList: generateData(), headerWidget: LineChartCurved(title: name,timeSeries:timeSeriesData,indexes: timeSeriesData.length~/3.5,),
chartName: name,
startDate: DateTime(
vitalList[vitalList.length - 1]
.vitalSignDate
.year,
vitalList[vitalList.length - 1]
.vitalSignDate
.month +
3,
vitalList[vitalList.length - 1]
.vitalSignDate
.day),
endDate: vitalList[0].vitalSignDate,
),
bodyWidget: VitalSignDetailsWidget( bodyWidget: VitalSignDetailsWidget(
vitalList: vitalList, vitalList: vitalList,
title1: title1, title1: title1,
@ -61,23 +50,14 @@ class VitalSingChartAndDetials extends StatelessWidget {
(element) { (element) {
if( element.toJson()[viewKey]?.toInt()!=0) if( element.toJson()[viewKey]?.toInt()!=0)
timeSeriesData.add( timeSeriesData.add(
TimeSeriesSales( TimeSeriesSales2(
new DateTime(element.vitalSignDate.year, new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day),
element.vitalSignDate.month, element.vitalSignDate.day), element.toJson()[viewKey].toDouble(),
element.toJson()[viewKey]?.toInt(),
), ),
); );
}, },
); );
} }
return [ return timeSeriesData.reversed.toList();
new charts.Series<TimeSeriesSales, DateTime>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
domainFn: (TimeSeriesSales sales, _) => sales.time,
measureFn: (TimeSeriesSales sales, _) => sales.sales,
data: timeSeriesData,
)
];
} }
} }

@ -1017,6 +1017,7 @@ class TranslationBase {
String get later => localizedValues['later'][locale.languageCode]; String get later => localizedValues['later'][locale.languageCode];
String get sendConfEmail => localizedValues['send-email'][locale.languageCode]; String get sendConfEmail => localizedValues['send-email'][locale.languageCode];
String get updateEmail => localizedValues['update-email'][locale.languageCode]; String get updateEmail => localizedValues['update-email'][locale.languageCode];
String get noDataAvailable => localizedValues['noDataAvailable'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -16,13 +16,26 @@ class LineChartCurved extends StatefulWidget {
class LineChartCurvedState extends State<LineChartCurved> { class LineChartCurvedState extends State<LineChartCurved> {
bool isShowingMainData; bool isShowingMainData;
List<int> xAxixs = List();
int indexes = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
getXaxix();
isShowingMainData = true; isShowingMainData = true;
} }
getXaxix() {
indexes = widget.labResult.length ~/ 3.5;
for (int index = 0; index < widget.labResult.length; index++) {
int mIndex = indexes * index;
if (mIndex < widget.labResult.length) {
xAxixs.add(mIndex);
}
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AspectRatio( return AspectRatio(
@ -49,7 +62,6 @@ class LineChartCurvedState extends State<LineChartCurved> {
letterSpacing: 2), letterSpacing: 2),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.only(right: 16.0, left: 6.0), padding: const EdgeInsets.only(right: 16.0, left: 6.0),
@ -79,7 +91,8 @@ class LineChartCurvedState extends State<LineChartCurved> {
touchCallback: (LineTouchResponse touchResponse) {}, touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData(show: true, drawVerticalLine: true,drawHorizontalLine: true), gridData: FlGridData(
show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: SideTitles(
showTitles: true, showTitles: true,
@ -90,20 +103,33 @@ class LineChartCurvedState extends State<LineChartCurved> {
margin: 10, margin: 10,
getTitles: (value) { getTitles: (value) {
print(value); print(value);
if(widget.labResult.length>value.toInt()) DateTime date = DateUtil.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime);
{ DateTime date = DateUtil.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime); if (widget.labResult.length < 8) {
return '${date.day}/ ${date.year}';} if (widget.labResult.length > value.toInt()) {
return '${date.day}/ ${date.year}';
} else
return ''; return '';
} else {
if (value.toInt() == 0)
return '${date.day}/ ${date.year}';
if (value.toInt() == widget.labResult.length - 1)
return '${date.day}/ ${date.year}';
if (xAxixs.contains(value.toInt())) {
return '${date.day}/ ${date.year}';
} }
}
,
return '';
},
), ),
leftTitles: SideTitles( leftTitles: SideTitles(
showTitles: true, showTitles: true,
getTextStyles: (value) => const TextStyle( getTextStyles: (value) => const TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 10,
), ),
getTitles: (value) { getTitles: (value) {
return '${value.toInt()}'; return '${value.toInt()}';
@ -142,8 +168,7 @@ class LineChartCurvedState extends State<LineChartCurved> {
double max = 0; double max = 0;
widget.labResult.forEach((element) { widget.labResult.forEach((element) {
double resultValueDouble = double.parse(element.resultValue); double resultValueDouble = double.parse(element.resultValue);
if(resultValueDouble>max) if (resultValueDouble > max) max = resultValueDouble;
max = resultValueDouble;
}); });
return max.roundToDouble(); return max.roundToDouble();
@ -152,11 +177,9 @@ class LineChartCurvedState extends State<LineChartCurved> {
double getMinY() { double getMinY() {
double min = double.parse(widget.labResult[0].resultValue); double min = double.parse(widget.labResult[0].resultValue);
widget.labResult.forEach((element) { widget.labResult.forEach((element) {
double resultValueDouble = double.parse(element.resultValue); double resultValueDouble = double.parse(element.resultValue);
if(resultValueDouble<min) if (resultValueDouble < min) min = resultValueDouble;
min = resultValueDouble;
}); });
int value = min.toInt(); int value = min.toInt();
@ -181,7 +204,6 @@ class LineChartCurvedState extends State<LineChartCurved> {
), ),
belowBarData: BarAreaData( belowBarData: BarAreaData(
show: false, show: false,
), ),
); );
@ -190,5 +212,3 @@ class LineChartCurvedState extends State<LineChartCurved> {
]; ];
} }
} }

@ -34,6 +34,7 @@ class LabResultChartAndDetails extends StatelessWidget {
bodyWidget: LabResultDetailsWidget( bodyWidget: LabResultDetailsWidget(
labResult: labResult, labResult: labResult,
), ),
isExpand: true,
), ),
], ],
); );

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dar
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -36,8 +37,8 @@ class LaboratoryResultWidget extends StatefulWidget {
} }
class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> { class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
bool _isShowMore = false; bool _isShowMore = true;
bool _isShowMoreGeneral = false; bool _isShowMoreGeneral = true;
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
@override @override
@ -55,8 +56,10 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.all(15), margin: EdgeInsets.all(8),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -80,7 +83,9 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
), ),
), ),
InkWell( InkWell(
onTap: widget.onTap, onTap: (){
showConfirmMessage(context,widget.onTap,projectViewModel.user.emailAddress);
},
child: Container( child: Container(
margin: EdgeInsets.only(left: 5, right: 5), margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -111,13 +116,19 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
), ),
), ),
SizedBox( SizedBox(
height: 10, height: 12,
), ),
if( model.labResultLists.isNotEmpty)
Container(
child: Column(
children: [
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(
_isShowMore = !_isShowMore; () {
}); _isShowMoreGeneral = !_isShowMoreGeneral;
},
);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
@ -130,14 +141,15 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
)), )),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(child: Texts(TranslationBase.of(context).specialResult)), Expanded(child: Texts(TranslationBase.of(context).generalResult)),
Container( Container(
width: 25, width: 25,
height: 25, height: 25,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, color: Theme.of(context).primaryColor), shape: BoxShape.circle,
color: Theme.of(context).primaryColor),
child: Icon( child: Icon(
_isShowMore _isShowMoreGeneral
? Icons.keyboard_arrow_up ? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down, : Icons.keyboard_arrow_down,
color: Colors.white, color: Colors.white,
@ -148,7 +160,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
), ),
), ),
), ),
if (_isShowMore) if (_isShowMoreGeneral)
AnimatedContainer( AnimatedContainer(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5), margin: EdgeInsets.only(left: 5, right: 5),
@ -158,27 +170,41 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(5.0), bottomLeft: Radius.circular(5.0),
bottomRight: Radius.circular(5.0), bottomRight: Radius.circular(5.0),
)), ),
),
duration: Duration(milliseconds: 7000), duration: Duration(milliseconds: 7000),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
child: Html( child: Column(
data: widget.details ?? 'No Data', crossAxisAlignment:
)), CrossAxisAlignment.start,
children: <Widget>[
...List.generate(
model.labResultLists.length,
(index) => LabResultWidget(
patientLabOrder: widget.patientLabOrder,
filterName: model
.labResultLists[index].filterName,
patientLabResultList: model
.labResultLists[index]
.patientLabResultList,
),
)
],
),
),
),
],
),
), ),
SizedBox( SizedBox(
height: 12, height: 10,
), ),
Container(
child: Column(
children: [
InkWell( InkWell(
onTap: () { onTap: () {
setState( setState(() {
() { _isShowMore = !_isShowMore;
_isShowMoreGeneral = !_isShowMoreGeneral; });
},
);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
@ -191,15 +217,14 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
)), )),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded(child: Texts(TranslationBase.of(context).generalResult)), Expanded(child: Texts(TranslationBase.of(context).specialResult)),
Container( Container(
width: 25, width: 25,
height: 25, height: 25,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle, color: Theme.of(context).primaryColor),
color: Theme.of(context).primaryColor),
child: Icon( child: Icon(
_isShowMoreGeneral _isShowMore
? Icons.keyboard_arrow_up ? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down, : Icons.keyboard_arrow_down,
color: Colors.white, color: Colors.white,
@ -210,7 +235,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
), ),
), ),
), ),
if (_isShowMoreGeneral) if (_isShowMore)
AnimatedContainer( AnimatedContainer(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
margin: EdgeInsets.only(left: 5, right: 5), margin: EdgeInsets.only(left: 5, right: 5),
@ -220,38 +245,31 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(5.0), bottomLeft: Radius.circular(5.0),
bottomRight: Radius.circular(5.0), bottomRight: Radius.circular(5.0),
), )),
),
duration: Duration(milliseconds: 7000), duration: Duration(milliseconds: 7000),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
child: Column( child: Html(
crossAxisAlignment: data: widget.details ?? TranslationBase.of(context).noDataAvailable,
CrossAxisAlignment.start, )),
children: <Widget>[
...List.generate(
model.labResultLists.length,
(index) => LabResultWidget(
patientLabOrder: widget.patientLabOrder,
filterName: model
.labResultLists[index].filterName,
patientLabResultList: model
.labResultLists[index]
.patientLabResultList,
),
)
],
),
),
), ),
], ],
), ),
)
], ],
), ),
],
), ),
), ),
);
}
void showConfirmMessage(BuildContext context, GestureTapCallback onTap,String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();
},
), ),
); );
} }

@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../routes.dart'; import '../../routes.dart';
class ConfirmSendEmailDialog extends StatefulWidget { class ConfirmSendEmailDialog extends StatefulWidget {
final String email; final String email;

@ -491,7 +491,10 @@ class _AppDrawerState extends State<AppDrawer> {
.familyFileProvider .familyFileProvider
.silentLoggin(user is AuthenticatedUser ? null : user, .silentLoggin(user is AuthenticatedUser ? null : user,
mainUser: user is AuthenticatedUser) mainUser: user is AuthenticatedUser)
.then((value) { .then((value) async{
await authenticatedUserObject.getUser();
_vitalSignService.heightCm = "";
_vitalSignService.weightKg = "";
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
loginAfter(value, context); loginAfter(value, context);
}).catchError((err) { }).catchError((err) {

@ -57,7 +57,8 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
header: Row( header: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Expanded(
child: Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Text( child: Text(
widget.title ?? TranslationBase.of(context).details, widget.title ?? TranslationBase.of(context).details,
@ -67,7 +68,8 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
), ),
), ),
), ),
new IconButton( ),
IconButton(
icon: new Container( icon: new Container(
height: 28.0, height: 28.0,
width: 30.0, width: 30.0,

Loading…
Cancel
Save