|
|
@ -6,6 +6,7 @@ import 'package:geolocator/geolocator.dart';
|
|
|
|
import 'package:healthcare_user/common/settings.dart';
|
|
|
|
import 'package:healthcare_user/common/settings.dart';
|
|
|
|
import 'package:healthcare_user/common/zoom_image.dart';
|
|
|
|
import 'package:healthcare_user/common/zoom_image.dart';
|
|
|
|
import 'package:healthcare_user/models/pharmacies_model.dart';
|
|
|
|
import 'package:healthcare_user/models/pharmacies_model.dart';
|
|
|
|
|
|
|
|
import 'package:healthcare_user/models/reports_model.dart';
|
|
|
|
import 'package:healthcare_user/prescriptions/add_prescriptions.dart';
|
|
|
|
import 'package:healthcare_user/prescriptions/add_prescriptions.dart';
|
|
|
|
import 'package:healthcare_user/prescriptions/oreder_medicines.dart';
|
|
|
|
import 'package:healthcare_user/prescriptions/oreder_medicines.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
@ -23,8 +24,8 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
final ImagePicker _picker = ImagePicker();
|
|
|
|
final ImagePicker _picker = ImagePicker();
|
|
|
|
String Url = '';
|
|
|
|
String Url = '';
|
|
|
|
List<PharmaciesModel> pharmaciesList = [];
|
|
|
|
List<PharmaciesModel> pharmaciesList = [];
|
|
|
|
List<PrescriptionsModel> prescriptionsList = [];
|
|
|
|
List<ReportsModel> reportsList = [];
|
|
|
|
List<PrescriptionsModel> prescriptionsListOriginal = [];
|
|
|
|
List<ReportsModel> reportsListOriginal = [];
|
|
|
|
List<PharmaciesModel> FilteredList = [];
|
|
|
|
List<PharmaciesModel> FilteredList = [];
|
|
|
|
bool isPharmacyDataLoading = false;
|
|
|
|
bool isPharmacyDataLoading = false;
|
|
|
|
bool isPrescriptionsDataLoading = false;
|
|
|
|
bool isPrescriptionsDataLoading = false;
|
|
|
@ -81,7 +82,7 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getAllPrescriptions() async {
|
|
|
|
/*Future<void> getAllPrescriptions() async {
|
|
|
|
isPrescriptionsDataLoading=true;
|
|
|
|
isPrescriptionsDataLoading=true;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var response = await AppSettings.getAllPrescriptions();
|
|
|
|
var response = await AppSettings.getAllPrescriptions();
|
|
|
@ -100,6 +101,28 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
isSereverIssue = true;
|
|
|
|
isSereverIssue = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getAllRecords() async {
|
|
|
|
|
|
|
|
isPrescriptionsDataLoading=true;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
var response = await AppSettings.getAllRecords();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
reportsListOriginal = ((jsonDecode(response)) as List)
|
|
|
|
|
|
|
|
.map((dynamic model) {
|
|
|
|
|
|
|
|
return ReportsModel.fromJson(model);
|
|
|
|
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
reportsList=reportsListOriginal.reversed.toList();
|
|
|
|
|
|
|
|
isPrescriptionsDataLoading = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
isPrescriptionsDataLoading = false;
|
|
|
|
|
|
|
|
isSereverIssue = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
@ -107,7 +130,7 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
lat = AppSettings.userLatitude;
|
|
|
|
lat = AppSettings.userLatitude;
|
|
|
|
lng = AppSettings.userLongitude;
|
|
|
|
lng = AppSettings.userLongitude;
|
|
|
|
userAddress = AppSettings.userAddress;
|
|
|
|
userAddress = AppSettings.userAddress;
|
|
|
|
getAllPrescriptions();
|
|
|
|
getAllRecords();
|
|
|
|
//getAllPharmaciesData(dropdownArea);
|
|
|
|
//getAllPharmaciesData(dropdownArea);
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -451,7 +474,7 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
height: MediaQuery.of(context).size.height * .20,
|
|
|
|
height: MediaQuery.of(context).size.height * .20,
|
|
|
|
child: ListView.builder(
|
|
|
|
child: ListView.builder(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
itemCount: obj.prescriptionUrls.length,
|
|
|
|
itemCount: obj.prescriptionImages.length,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
@ -462,7 +485,7 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new ImageZoomPage(imageName:'Prescriptions',imageDetails:obj.prescriptionUrls[index]['url'])));
|
|
|
|
builder: (__) => new ImageZoomPage(imageName:'Prescriptions',imageDetails:obj.prescriptionImages[index]['url'])));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -474,20 +497,13 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
image: DecorationImage(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: NetworkImage(
|
|
|
|
image: NetworkImage(
|
|
|
|
obj.prescriptionUrls[index]
|
|
|
|
obj.prescriptionImages[index]
|
|
|
|
['url'])
|
|
|
|
['url'])
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
fit: BoxFit.fill)),
|
|
|
|
fit: BoxFit.fill)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
/*Expanded(child:IconButton(
|
|
|
|
|
|
|
|
icon: const Icon(Icons.remove,color: Colors.red,),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),)*/
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
@ -496,15 +512,17 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget _allPrescriptions(){
|
|
|
|
Widget _allPrescriptions(){
|
|
|
|
if (prescriptionsList.length != 0) {
|
|
|
|
if (reportsList.length != 0) {
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(child:ListView.builder(
|
|
|
|
Expanded(child:ListView.builder(
|
|
|
|
padding: EdgeInsets.all(0),
|
|
|
|
padding: EdgeInsets.all(0),
|
|
|
|
itemCount: prescriptionsList.length,
|
|
|
|
itemCount: reportsList.length,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return Card(
|
|
|
|
return Visibility(
|
|
|
|
|
|
|
|
visible: reportsList[index].prescriptionImages.length!=0,
|
|
|
|
|
|
|
|
child: Card(
|
|
|
|
|
|
|
|
|
|
|
|
//color: prescriptionsList[index].cardColor,
|
|
|
|
//color: prescriptionsList[index].cardColor,
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
@ -512,7 +530,43 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
prescriptions(prescriptionsList[index]),
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .55,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text('Problem: '+reportsList[index].problem.toString().toUpperCase(),style: problemTextStyle()),
|
|
|
|
|
|
|
|
Text(reportsList[index].doctorName.toString().toUpperCase(),style: valuesTextStyle()),
|
|
|
|
|
|
|
|
Text(reportsList[index].hospitalName.toString().toUpperCase(),style: valuesTextStyle()),
|
|
|
|
|
|
|
|
Text(reportsList[index].date.toString().toUpperCase(),style: valuesTextStyle()),
|
|
|
|
|
|
|
|
Text(reportsList[index].patient_name.toString().toUpperCase(),style: valuesTextStyle()),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(reportsList[index].gender.toString().toUpperCase(),style: valuesTextStyle()),
|
|
|
|
|
|
|
|
SizedBox(width:MediaQuery.of(context).size.width * .05,),
|
|
|
|
|
|
|
|
Text(reportsList[index].age.toString().toUpperCase()+" Yrs",style: valuesTextStyle()),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prescriptions(reportsList[index]),
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
'Order Medicines',
|
|
|
|
'Order Medicines',
|
|
|
@ -523,52 +577,15 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
new MaterialPageRoute(
|
|
|
|
new MaterialPageRoute(
|
|
|
|
builder: (__) => new OrderMedicines(prescriptionDetails:prescriptionsList[index])));
|
|
|
|
builder: (__) => new OrderMedicines(prescriptionDetails:reportsList[index])));
|
|
|
|
//signup screen
|
|
|
|
//signup screen
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
));
|
|
|
|
}) ),
|
|
|
|
}) ),
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
|
|
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
|
|
|
radius: 40,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
iconSize: 40,
|
|
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
|
|
Icons.add,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
/*await Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => AddPrescription()),
|
|
|
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => AddPrescription())).then((value) {
|
|
|
|
|
|
|
|
getAllPrescriptions();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//showBoreAddingDialog();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
/* Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
'Add Tanks ',
|
|
|
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)*/
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
@ -579,7 +596,7 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
|
|
|
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
|
|
|
Text('Click below icon to add new prescription'),
|
|
|
|
Text('No prescriptions added as of now'),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 20,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -589,13 +606,10 @@ class _PrescriptionsState extends State<Prescriptions> {
|
|
|
|
child: IconButton(
|
|
|
|
child: IconButton(
|
|
|
|
iconSize: 40,
|
|
|
|
iconSize: 40,
|
|
|
|
icon: const Icon(
|
|
|
|
icon: const Icon(
|
|
|
|
Icons.add,
|
|
|
|
Icons.info,
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => AddPrescription())).then((value) {
|
|
|
|
|
|
|
|
getAllPrescriptions();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|