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.
213 lines
11 KiB
Dart
213 lines
11 KiB
Dart
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart';
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_home_screen.dart';
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_item_in_patient_page.dart';
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart';
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.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/doctor_card.dart';
|
|
import '../../widgets/shared/in_patient_doctor_card.dart';
|
|
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class PrescriptionsPage extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
String patientType = routeArgs['patientType'];
|
|
String arrivalType = routeArgs['arrivalType'];
|
|
bool isInpatient = routeArgs['isInpatient'];
|
|
bool isFromLiveCare = routeArgs['isFromLiveCare'];
|
|
bool isSelectInpatient = routeArgs['isSelectInpatient'];
|
|
return BaseView<PrescriptionViewModel>(
|
|
onModelReady: (model) => isSelectInpatient
|
|
? model.getPrescriptionsInPatient(patient)
|
|
: model.getPrescriptions(patient, patientType: patientType),
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
isShowAppBar: true,
|
|
backgroundColor: Colors.grey[100],
|
|
appBar: PatientProfileHeaderNewDesignAppBar(
|
|
patient,
|
|
patientType ?? '0',
|
|
arrivalType,
|
|
isInpatient: isInpatient,
|
|
),
|
|
body: patient.admissionNo == null
|
|
? FractionallySizedBox(
|
|
widthFactor: 1.0,
|
|
child: ListView(
|
|
physics: BouncingScrollPhysics(),
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43)
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
TranslationBase.of(context).orders,
|
|
style: "caption2",
|
|
color: Colors.black,
|
|
fontSize: 13,
|
|
),
|
|
AppText(
|
|
TranslationBase.of(context).prescriptions,
|
|
bold: true,
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (patient.patientStatusType != null && patient.patientStatusType == 43)
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
TranslationBase.of(context).orders,
|
|
style: "caption2",
|
|
color: Colors.black,
|
|
fontSize: 13,
|
|
),
|
|
AppText(
|
|
TranslationBase.of(context).prescriptions,
|
|
bold: true,
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if ((patient.patientStatusType != null && patient.patientStatusType == 43) ||
|
|
(isFromLiveCare && patient.appointmentNo != null))
|
|
AddNewOrder(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => PrescriptionHomeScreen(
|
|
patient: patient,
|
|
model: model,
|
|
)),
|
|
);
|
|
},
|
|
label: TranslationBase.of(context).applyForNewPrescriptionsOrder ?? "",
|
|
),
|
|
...List.generate(
|
|
model.prescriptionsList.length,
|
|
(index) => InkWell(
|
|
onTap: () => Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: PrescriptionItemsPage(
|
|
prescriptions: model.prescriptionsList[index],
|
|
patient: patient,
|
|
patientType: patientType,
|
|
arrivalType: arrivalType,
|
|
),
|
|
),
|
|
),
|
|
child: DoctorCard(
|
|
doctorName: model.prescriptionsList[index].doctorName ?? "",
|
|
profileUrl: model.prescriptionsList[index].doctorImageURL ?? "",
|
|
branch: model.prescriptionsList[index].name ?? "",
|
|
clinic: model.prescriptionsList[index].clinicDescription ?? "",
|
|
isPrescriptions: true,
|
|
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
|
|
model.prescriptionsList[index].appointmentDate ?? "",
|
|
),
|
|
))),
|
|
if (model.prescriptionsList.isEmpty && patient.patientStatusType != 43)
|
|
Center(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
height: 100,
|
|
),
|
|
Image.asset('assets/images/no-data.png'),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: AppText(TranslationBase.of(context).noPrescriptionsFound),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
: FractionallySizedBox(
|
|
widthFactor: 1.0,
|
|
child: ListView(
|
|
physics: BouncingScrollPhysics(),
|
|
children: <Widget>[
|
|
// SizedBox(
|
|
// height: 12,
|
|
// ),
|
|
|
|
...List.generate(
|
|
model.inPatientPrescription.length,
|
|
(index) => InkWell(
|
|
onTap: () => Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: PrescriptionItemsInPatientPage(
|
|
prescriptionIndex: index,
|
|
prescriptions: model.inPatientPrescription[index],
|
|
patient: patient,
|
|
patientType: patientType,
|
|
arrivalType: arrivalType,
|
|
startOn: AppDateUtils.getDateTimeFromServerFormat(
|
|
model.inPatientPrescription[index].startDatetime ?? "",
|
|
),
|
|
stopOn: AppDateUtils.getDateTimeFromServerFormat(
|
|
model.inPatientPrescription[index].stopDatetime ?? "",
|
|
),
|
|
),
|
|
),
|
|
),
|
|
child: InPatientDoctorCard(
|
|
doctorName: model.inPatientPrescription[index].itemDescription,
|
|
profileUrl: 'sss',
|
|
branch: 'hamza',
|
|
clinic: 'basheer',
|
|
isPrescriptions: true,
|
|
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
|
|
model.inPatientPrescription[index].prescriptionDatetime ?? "",
|
|
),
|
|
createdBy: model.inPatientPrescription[index].createdByName,
|
|
))),
|
|
if (model.inPatientPrescription.length == 0)
|
|
Center(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
height: 100,
|
|
),
|
|
Image.asset('assets/images/no-data.png'),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: AppText(TranslationBase.of(context).noPrescriptionsFound),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)));
|
|
}
|
|
}
|