You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
6.9 KiB
Dart
160 lines
6.9 KiB
Dart
import 'package:doctor_app_flutter/models/patient/reauest_prescription_report_for_in_patient.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../../../config/shared_pref_kay.dart';
|
|
import '../../../../config/size_config.dart';
|
|
import '../../../../models/patient/patiant_info_model.dart';
|
|
import '../../../../models/patient/prescription_req_model.dart';
|
|
import '../../../../providers/patients_provider.dart';
|
|
import '../../../../util/dr_app_shared_pref.dart';
|
|
import '../../../../widgets/shared/app_scaffold_widget.dart';
|
|
import '../../../../widgets/shared/app_texts_widget.dart';
|
|
import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
import '../../../../widgets/shared/errors/dr_app_embedded_error.dart';
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
/*
|
|
*@author: Elham Rababah
|
|
*@Date:26/4/2020
|
|
*@param:
|
|
*@return:PrescriptionScreen
|
|
*@desc: PrescriptionScreen class
|
|
*/
|
|
|
|
class PrescriptionScreen extends StatefulWidget {
|
|
@override
|
|
_PrescriptionScreenState createState() => _PrescriptionScreenState();
|
|
}
|
|
|
|
class _PrescriptionScreenState extends State<PrescriptionScreen> {
|
|
PatientsProvider patientsProv;
|
|
var _isInit = true;
|
|
|
|
/*
|
|
*@author: Elham Rababah
|
|
*@Date:28/4/2020
|
|
*@param: context
|
|
*@return:
|
|
*@desc: getPrescriptionsList Function
|
|
*/
|
|
getPrescriptionsList(context) async {
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
String token = await sharedPref.getString(TOKEN);
|
|
String type = await sharedPref.getString(SLECTED_PATIENT_TYPE);
|
|
|
|
if (type == '1') {
|
|
RequestPrescriptionReportForInPatient prescriptionReqModel =
|
|
RequestPrescriptionReportForInPatient(
|
|
patientID: patient.patientId,
|
|
patientTypeID: patient.patientType,
|
|
admissionNo: int.parse(patient.admissionNo));
|
|
patientsProv.getInPatientPrescriptions(prescriptionReqModel.toJson());
|
|
} else {
|
|
PrescriptionReqModel prescriptionReqModel = PrescriptionReqModel(
|
|
patientID: patient.patientId,
|
|
projectID: patient.projectId,
|
|
tokenID: token,
|
|
patientTypeID: patient.patientType,
|
|
languageID: 2,
|
|
setupID: 0);
|
|
patientsProv.getOutPatientPrescriptions(prescriptionReqModel.toJson());
|
|
}
|
|
}
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
if (_isInit) {
|
|
patientsProv = Provider.of<PatientsProvider>(context);
|
|
getPrescriptionsList(context);
|
|
}
|
|
_isInit = false;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: "Prescriptions",
|
|
body: patientsProv.isLoading
|
|
? DrAppCircularProgressIndeicator()
|
|
: patientsProv.isError
|
|
? DrAppEmbeddedError(error: patientsProv.error)
|
|
: patientsProv.patientPrescriptionsList.length == 0
|
|
? DrAppEmbeddedError(
|
|
error: 'You don\'t have any Prescriptions')
|
|
: Container(
|
|
margin: EdgeInsets.fromLTRB(
|
|
SizeConfig.realScreenWidth * 0.05,
|
|
0,
|
|
SizeConfig.realScreenWidth * 0.05,
|
|
0),
|
|
child: ListView.builder(
|
|
itemCount:
|
|
patientsProv.patientPrescriptionsList.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return InkWell(
|
|
child: CardWithBgWidgetNew(
|
|
widget: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Row(
|
|
children: <Widget>[
|
|
LargeAvatar(
|
|
url: patientsProv
|
|
.patientPrescriptionsList[index]
|
|
.doctorImageURL,
|
|
name: patientsProv
|
|
.patientPrescriptionsList[index]
|
|
.doctorName,
|
|
radius: 10,
|
|
width: 70,
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
margin: EdgeInsets.only(
|
|
left: 15, right: 15),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'${patientsProv.patientPrescriptionsList[index].name}',
|
|
fontSize: 2.5 *
|
|
SizeConfig.textMultiplier,
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
AppText(
|
|
'${patientsProv.patientPrescriptionsList[index].clinicDescription}',
|
|
fontSize: 2.5 *
|
|
SizeConfig
|
|
.textMultiplier,
|
|
color: Theme.of(context)
|
|
.primaryColor),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {},
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|