refactor the lab result structure

lab_result
Elham Rababh 3 years ago
parent c96939e6b0
commit 286dbe0a3f

@ -96,10 +96,6 @@ class LabsViewModel extends BaseViewModel {
List<LabResultList> labResultLists = List();
List<LabResultList> get labResultListsCoustom {
return labResultLists;
}
getLaboratoryResult(
{String projectID,
int clinicID,

@ -9,7 +9,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/admission-orders/adm
import 'package:doctor_app_flutter/screens/patients/profile/diabetic_chart/diabetic_chart.dart';
import 'package:doctor_app_flutter/screens/patients/profile/diagnosis/diagnosis_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/discharge_summary/discharge_summary.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/special_result/all_lab_special_result_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart';
import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportDetailPage.dart';

@ -1,163 +0,0 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
import 'package:flutter/material.dart';
class LabResultHistoryPage extends StatelessWidget {
final PatientLabOrders patientLabOrder;
final String filterName;
final PatiantInformtion patient;
LabResultHistoryPage({this.patientLabOrder, this.filterName, this.patient});
// TODO Elham* UI changes and add translation
@override
Widget build(BuildContext context) {
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabResultHistoryByDescription(
patientLabOrder: patientLabOrder,
procedureDescription: filterName,
patient: patient),
builder: (context, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: filterName,
baseViewModel: model,
body: model.labOrdersResultHistoryList.length > 0
? SingleChildScrollView(
child: Column(
children: [
...List.generate(model.labOrdersResultHistoryList.length,
(index) {
return Container(
margin: EdgeInsets.symmetric(
vertical: 8.0, horizontal: 16.0),
child: Column(
children: [
Row(
children: [
AppText(
TranslationBase.of(context).description,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
SizedBox(
width: 1,
),
AppText(
model.labOrdersResultHistoryList[index]
.description,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
isCopyable: true,
),
],
),
Row(
children: [
AppText(
"Reference Range",
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
SizedBox(
width: 1,
),
AppText(
model.labOrdersResultHistoryList[index]
.referanceRange,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
isCopyable: true,
),
],
),
Row(
children: [
AppText(
"Result Value",
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
SizedBox(
width: 1,
),
AppText(
model.labOrdersResultHistoryList[index]
.resultValue,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
isCopyable: true,
),
],
),
Row(
children: [
AppText(
"Verified On",
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF575757),
fontWeight: FontWeight.w600,
),
SizedBox(
width: 1,
),
AppText(
model.labOrdersResultHistoryList[index]
.verifiedOn,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700,
isCopyable: true,
),
],
),
Divider(
color: Colors.grey,
height: 0.75,
thickness: 0.75,
),
SizedBox(
height: 10,
),
],
),
);
}),
],
),
)
: ErrorMessage(
error: "No data",
),
),
);
}
}

@ -1,232 +0,0 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../../../../core/model/labs/LabOrderResult.dart';
class LineChartCurved extends StatefulWidget {
final String title;
final List<LabOrderResult> labResult;
LineChartCurved({this.title, this.labResult});
@override
State<StatefulWidget> createState() => LineChartCurvedState();
}
class LineChartCurvedState extends State<LineChartCurved> {
bool isShowingMainData;
List<int> xAxixs = List();
int indexes = 0;
@override
void initState() {
super.initState();
getXaxix();
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
Widget build(BuildContext context) {
return AspectRatio(
aspectRatio: 1.23,
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,
),
AppText(
widget.title,
fontSize: SizeConfig.textMultiplier * 2.1,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
textAlign: TextAlign.center,
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 16.0, left: 8.0),
child: LineChart(
sampleData1(),
swapAnimationDuration: const Duration(milliseconds: 250),
),
),
),
const SizedBox(
height: 10,
),
],
),
],
),
),
);
}
LineChartData sampleData1() {
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: (context, value) {
return TextStyle(
color: Colors.black,
fontSize: 10,
);
},
margin: 28,
rotateAngle: -65,
getTitles: (value) {
print(value);
DateTime date = AppDateUtils.convertStringToDate(
widget.labResult[value.toInt()].verifiedOnDateTime);
if (widget.labResult.length < 8) {
if (widget.labResult.length > value.toInt()) {
return '${date.day}/ ${date.year}';
} else
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(
showTitles: true,
getTextStyles: (context, value) {
return TextStyle(
color: Colors.black,
fontSize: 10,
);
},
getTitles: (value) {
return '${value.toInt()}';
},
margin: 8,
//reservedSize: 30,
),
),
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: (widget.labResult.length - 1).toDouble(),
maxY: getMaxY() + 2,
minY: getMinY(),
lineBarsData: getData(),
);
}
double getMaxY() {
double max = 0;
widget.labResult.forEach((element) {
try {
double resultValueDouble = double.parse(element.resultValue);
if (resultValueDouble > max) max = resultValueDouble;
} catch (e) {
print(e);
}
});
return max.roundToDouble();
}
double getMinY() {
double min = 0;
try {
min = double.parse(widget.labResult[0].resultValue);
widget.labResult.forEach((element) {
double resultValueDouble = double.parse(element.resultValue);
if (resultValueDouble < min) min = resultValueDouble;
});
} catch (e) {
print(e);
}
int value = min.toInt();
return value.toDouble();
}
List<LineChartBarData> getData() {
List<FlSpot> spots = List();
for (int index = 0; index < widget.labResult.length; index++) {
try {
var resultValueDouble =
double.parse(widget.labResult[index].resultValue);
spots.add(FlSpot(index.toDouble(), resultValueDouble));
} catch (e) {
print(e);
spots.add(FlSpot(index.toDouble(), 0.0));
}
}
final LineChartBarData lineChartBarData1 = LineChartBarData(
spots: spots,
isCurved: true,
colors: [Colors.red],
barWidth: 3,
isStrokeCapRound: true,
curveSmoothness: 0.12,
dotData: FlDotData(
show: false,
),
belowBarData: BarAreaData(
show: false,
),
);
return [
lineChartBarData1,
];
}
}

@ -4,8 +4,8 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'Lab_Result_history_details_wideget.dart';
import 'LineChartCurvedLabHistory.dart';
import 'lab_result_history_details_wideget.dart';
import 'line_chart_curved_lab_history.dart';
class LabResultHistoryChartAndDetails extends StatelessWidget {
LabResultHistoryChartAndDetails({

@ -1,63 +0,0 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'Lab_Result_details_wideget.dart';
import 'LineChartCurved.dart';
class LabResultChartAndDetails extends StatelessWidget {
LabResultChartAndDetails({
Key key,
@required this.labResult,
@required this.name,
}) : super(key: key);
final List<LabOrderResult> labResult;
final String name;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(12)),
child: LineChartCurved(
title: name,
labResult: labResult,
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
padding: EdgeInsets.only(top: 16, right: 18.0, left: 16.0),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(12)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).graphDetails,
fontSize: SizeConfig.textMultiplier * 2.1,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
SizedBox(
height: 8,
),
LabResultDetailsWidget(
labResult: labResult.reversed.toList(),
),
],
),
),
],
),
);
}
}

@ -1,86 +0,0 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/lab_orders/lab_orders_res_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/doctor/lab_result_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class LabResult extends StatefulWidget {
final LabOrdersResModel labOrders;
LabResult({Key key, this.labOrders});
@override
_LabResultState createState() => _LabResultState();
}
class _LabResultState extends State<LabResult> {
@override
Widget build(BuildContext context) {
return BaseView<PatientViewModel>(
onModelReady: (model) => model.getLabResult(widget.labOrders),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).labOrders,
body: model.labResultList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoLabOrders)
: Container(
margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05,
0, SizeConfig.realScreenWidth * 0.05, 0),
child: ListView(
children: <Widget>[
CardWithBgWidgetNew(
widget: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase.of(context).orderNo,
fontSize: 2 * SizeConfig.textMultiplier,
color: Colors.grey[800],
),
AppText(
' ${widget.labOrders.orderNo}',
fontSize: 2 * SizeConfig.textMultiplier,
color: Colors.grey[800],
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
AppText(
TranslationBase.of(context).invoiceNo,
fontSize: 2 * SizeConfig.textMultiplier,
color: Colors.grey[800],
),
AppText(
' ${widget.labOrders.invoiceNo}',
fontSize: 2 * SizeConfig.textMultiplier,
color: Colors.grey[800],
),
],
),
],
),
),
CardWithBgWidgetNew(
widget: LabResultWidget(
labResult: model.labResultList,
),
)
],
),
),
),
);
}
}

@ -7,8 +7,8 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../../widgets/shared/errors/error_message.dart';
import 'lab_result_history_chart_and_detials.dart';
import '../../../../../widgets/shared/errors/error_message.dart';
import '../history/lab_result_history_chart_and_detials.dart';
class FlowChartPage extends StatelessWidget {
final PatientLabOrders patientLabOrder;
@ -26,10 +26,6 @@ class FlowChartPage extends StatelessWidget {
patientLabOrder: patientLabOrder,
procedureDescription: filterName,
patient: patient),
// onModelReady: (model) => model.getPatientLabOrdersResults(
// patientLabOrder: patientLabOrder,
// procedure: filterName,
// patient: patient),
builder: (context, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: filterName,
@ -41,10 +37,6 @@ class FlowChartPage extends StatelessWidget {
name: filterName,
labResultHistory: model.labOrdersResultHistoryList,
),
// child: LabResultChartAndDetails(
// name: filterName,
// labResult: model.labOrdersResultsList,
// ),
),
)
: Container(

@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/core/model/labs/lab_result.dart';
import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/FlowChartPage.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
@ -50,26 +50,6 @@ class LabResultWidget extends StatelessWidget {
),
],
),
// InkWell(
// onTap: () {
// Navigator.push(
// context,
// FadePage(
// page: FlowChartPage(
// filterName: filterName,
// patientLabOrder: patientLabOrder,
// patient: patient,
// isInpatient: isInpatient,
// ),
// ),
// );
// },
// // child: AppText(
// // TranslationBase.of(context).showMoreBtn,
// // textDecoration: TextDecoration.underline,
// // color: Colors.blue,
// // ),
// ),
],
),
SizedBox(
@ -148,7 +128,6 @@ class LabResultWidget extends StatelessWidget {
padding: EdgeInsets.all(10),
child: Center(
child: AppText(
/*'${patientLabResultList[index].testCode}\n' +*/
patientLabResultList[index].description,
textAlign: TextAlign.center,
fontSize: SizeConfig.textMultiplier * 1.8,
@ -168,9 +147,6 @@ class LabResultWidget extends StatelessWidget {
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red.shade700,
// borderRadius: BorderRadius.all(
// Radius.circular(25.0),
// ),
),
child: Icon(
patientLabResultList[index]
@ -233,11 +209,6 @@ class LabResultWidget extends StatelessWidget {
patient: patient,
isInpatient: isInpatient,
),
// page: LabResultHistoryPage(
// filterName: patientLabResultList[index].description,
// patientLabOrder: patientLabOrder,
// patient: patient,
// ),
),
);
},
@ -269,12 +240,6 @@ class LabResultWidget extends StatelessWidget {
height: 8,
),
Divider(),
// Table(
// border: TableBorder.symmetric(
// inside: BorderSide(width: 2.0, color: Colors.grey[300],style: BorderStyle.solid),
// ),
// children: fullData(patientLabResultList,context),
// ),
],
),
);

@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/LabResultWidget.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result/lab_result_widget.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';

@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart';
import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
@ -68,14 +68,9 @@ class _LabsHomePageState extends State<LabsHomePage> {
SizedBox(
height: 12,
),
if (model.patientLabOrdersList.isNotEmpty &&
patient.patientStatusType != 43)
ServiceTitle(
title: TranslationBase.of(context).lab,
subTitle: TranslationBase.of(context).result,
),
if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
if ((model.patientLabOrdersList.isNotEmpty &&
patient.patientStatusType != 43)|| (patient.patientStatusType != null &&
patient.patientStatusType == 43))
ServiceTitle(
title: TranslationBase.of(context).lab,
subTitle: TranslationBase.of(context).result,

@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/special_lab_result_details_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/lab_result/special_result/special_lab_result_details_page.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
@ -15,7 +15,7 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../../widgets/shared/errors/error_message.dart';
import '../../../../../widgets/shared/errors/error_message.dart';
class AllLabSpecialResult extends StatefulWidget {
const AllLabSpecialResult({Key key}) : super(key: key);

@ -65,8 +65,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
bool visibilityPrescriptionForm = false;
bool visibilitySearch = true;
final myController = TextEditingController();
DateTime selectedDate;
DateTime selectedDate = DateTime.now();
int strengthChar;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();

Loading…
Cancel
Save