fix lab result

merge-update-with-lab-changes
Mohammad Aljmma 5 years ago
parent 770d28033d
commit a9b11a6b03

@ -32,7 +32,7 @@ const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders';
const GET_Patient_LAB_SPECIAL_RESULT =
'Services/Patients.svc/REST/GetPatientLabSpecialResults';
const GET_Patient_LAB_RESULT =
'/Services/Patients.svc/REST/GetPatientLabResults';
'Services/Patients.svc/REST/GetPatientLabResults';
///
const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders';

@ -86,3 +86,14 @@ class LabResult {
return data;
}
}
class LabResultList {
String filterName = "";
List<LabResult> patientLabResultList = List();
LabResultList(
{this.filterName, LabResult lab}) {
patientLabResultList.add(lab);
}
}

@ -65,7 +65,6 @@ class LabsService extends BaseService {
body['SetupID'] = patientLabOrder.setupID;
body['ProjectID'] = patientLabOrder.projectID;
body['ClinicID'] = patientLabOrder.clinicID;
//TODO Check the res
await baseAppClient.post(GET_Patient_LAB_RESULT,
onSuccess: (dynamic response, int statusCode) {
patientLabSpecialResult.clear();

@ -82,6 +82,8 @@ class LabsViewModel extends BaseViewModel {
List<LabResult> get labResultList => _labsService.labResultList;
List<LabResultList> labResultLists = List();
getLaboratoryResult(
{String projectID,
int clinicID,
@ -110,6 +112,24 @@ class LabsViewModel extends BaseViewModel {
error = _labsService.error;
setState(ViewState.Error);
} else {
_labsService.labResultList.forEach((element) {
List<LabResultList> patientLabOrdersClinic =
labResultLists
.where((elementClinic) =>
elementClinic.filterName == element.testCode)
.toList();
if (patientLabOrdersClinic.length != 0) {
labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])]
.patientLabResultList
.add(element);
} else {
labResultLists.add(LabResultList(
filterName: element.testCode,
lab: element));
}
});
setState(ViewState.Idle);
}
}

@ -0,0 +1,160 @@
import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../text.dart';
class LabResultWidget extends StatelessWidget {
final String filterName ;
final List<LabResult> patientLabResultList;
LabResultWidget({Key key, this.filterName, this.patientLabResultList}) : super(key: key);
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(filterName),
InkWell(
onTap: () {
//TODO model.getPatientLabResult(patientLabOrder: widget.patientLabOrder);
},
child: Texts(
'Flow Chart',
decoration: TextDecoration.underline,
color: Colors.blue,
),
),
],
),
Table(
border: TableBorder.symmetric(
inside: BorderSide(
width: 2.0, color: Colors.grey[300]),
),
children: fullData(patientLabResultList),
),
],
),
);
}
List<TableRow> fullData(List<LabResult> labResultList) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Container(
child: Container(
decoration: BoxDecoration(
color: Color(0xff515B5D),
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
),
),
child: Center(
child: Texts(
'Description',
color: Colors.white,
),
),
height: 60,
),
),
Container(
child: Container(
decoration: BoxDecoration(
color: Color(0xff515B5D),
),
child: Center(
child: Texts('Value', color: Colors.white),
),
height: 60),
),
Container(
child: Container(
decoration: BoxDecoration(
color: Color(0xff515B5D),
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
),
),
child: Center(
child: Texts('Range', color: Colors.white),
),
height: 60),
),
],
),
);
labResultList.forEach((lab) {
tableRow.add(
TableRow(
children: [
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.description,
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.resultValue,
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.referanceRange,
textAlign: TextAlign.center,
),
),
),
),
],
),
);
});
return tableRow;
}
}

@ -11,6 +11,7 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import '../text.dart';
import 'LabResultWidget.dart';
class LaboratoryResultWidget extends StatefulWidget {
final GestureTapCallback onTap;
@ -155,9 +156,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
child: Container(
width: double.infinity,
child: Html(
// data:"<html><head><style type='text/css'>.Test {list-style-image:url('http://10.50.100.198:4444/Images/Bullet_List_Small.png');}</style></head><body><table><tr align='left'><td align='left'>BCG</td></tr><tr align='left'><td align='left'>HEPATITIS B</td></tr></table></body></html>"//model.creteVaccinationTableModelList[index].vaccinesDescription
data:widget.details ?? 'No Data',
data: widget.details ?? 'No Data',
)),
),
SizedBox(
@ -227,32 +226,16 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts('U/A'),
InkWell(
onTap: () {
model.getPatientLabResult(
patientLabOrder:
widget.patientLabOrder);
},
child: Texts(
'Flow Chart',
decoration: TextDecoration.underline,
color: Colors.blue,
),
),
],
),
Table(
border: TableBorder.symmetric(
inside: BorderSide(
width: 2.0, color: Colors.grey[300]),
...List.generate(
model.labResultLists.length,
(index) => LabResultWidget(
filterName: model
.labResultLists[index].filterName,
patientLabResultList: model
.labResultLists[index]
.patientLabResultList,
),
children: fullData(model.labResultList),
),
)
],
),
),
@ -269,108 +252,5 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
);
}
List<TableRow> fullData(List<LabResult> labResultList) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
),
),
child: Center(
child: Texts(
'Description',
color: Colors.white,
),
),
height: 60,
),
),
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
),
child: Center(
child: Texts('Value', color: Colors.white),
),
height: 60),
),
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
),
),
child: Center(
child: Texts('Range', color: Colors.white),
),
height: 60),
),
],
),
);
labResultList.forEach((lab) {
tableRow.add(
TableRow(
children: [
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.description,
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.resultValue,
textAlign: TextAlign.center,
),
),
),
),
Container(
child: Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Texts(
lab.referanceRange,
textAlign: TextAlign.center,
),
),
),
),
],
),
);
});
return tableRow;
}
}

Loading…
Cancel
Save