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.
167 lines
8.6 KiB
Dart
167 lines
8.6 KiB
Dart
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart';
|
|
import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart';
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-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/card_with_bg_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
|
|
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../utils/utils.dart';
|
|
import '../../widgets/shared/errors/error_message.dart';
|
|
|
|
class NewPrescriptionsPage extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
|
|
PatiantInformtion patient = routeArgs['patient'];
|
|
bool isInpatient = routeArgs['isInpatient'];
|
|
bool isFromLiveCare = routeArgs['isFromLiveCare'];
|
|
return BaseView<PrescriptionViewModel>(
|
|
onModelReady: (model) async {
|
|
await model.getPrescriptionListNew(mrn: patient.patientMRN, appNo: patient.appointmentNo == null ? 0 : int.parse(patient.appointmentNo.toString()));
|
|
await model.isPrincipalCovered(patient: patient);
|
|
|
|
},
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
isShowAppBar: true,
|
|
backgroundColor: Colors.grey[100]!,
|
|
appBar: PatientProfileAppBar(
|
|
patient,
|
|
isInpatient: isInpatient,
|
|
),
|
|
body: FractionallySizedBox(
|
|
widthFactor: 1.0,
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
ServiceTitle(
|
|
title: TranslationBase.of(context).orders,
|
|
subTitle: TranslationBase.of(context).prescriptions,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
!model.isPrincipalCovered_
|
|
? Center(
|
|
child: AppText(
|
|
TranslationBase.of(context).principalCoveredOrNot,
|
|
color: Colors.red,
|
|
textAlign: TextAlign.center,
|
|
))
|
|
: SizedBox(),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null))
|
|
AddNewOrder(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
SlideUpPageRoute(
|
|
widget: BaseAddProcedureTabPage(
|
|
patient: patient,
|
|
prescriptionModel: model,
|
|
procedureType: ProcedureType.PRESCRIPTION,
|
|
),
|
|
settingRoute: 'AddProcedureTabPage'),
|
|
);
|
|
},
|
|
label: TranslationBase.of(context).applyForNewPrescriptionsOrder,
|
|
),
|
|
Center(
|
|
child: FractionallySizedBox(
|
|
widthFactor: 0.92,
|
|
child: ListView.builder(
|
|
physics: BouncingScrollPhysics(),
|
|
itemCount: model.prescriptionListNew.length,
|
|
shrinkWrap: true,
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
return InkWell(
|
|
child: CardWithBgWidget(
|
|
bgColor: Colors.transparent,
|
|
widget: Column(
|
|
children: [
|
|
CustomRow(
|
|
label: "",
|
|
value: Utils.convertToTitleCase(model.prescriptionListNew[index].medicationName),
|
|
valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).doctorName + ': ', //"Doctor Name :",
|
|
value: model.prescriptionListNew[index].doctorName,
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).orderTypeDescription + ': ', //"Order Type Description :",
|
|
value: model.prescriptionListNew[index].orderTypeDescription,
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).status + ': ',
|
|
value: model.prescriptionListNew[index].status,
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).indication + ': ', //"indication :",
|
|
value: model.prescriptionListNew[index].indication,
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).doseDetails + ': ', //"doseDetail :",
|
|
value: model.prescriptionListNew[index].doseDetail,
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).quantity + ': ', //"quantity :",
|
|
value: model.prescriptionListNew[index].quantity.toString(),
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).startDate + ': ', //"start Date :",
|
|
value: model.prescriptionListNew[index].startDate.toString(),
|
|
),
|
|
CustomRow(
|
|
label: TranslationBase.of(context).stopDate + ': ', //"stop Date :",
|
|
value: model.prescriptionListNew[index].stopDate.toString(),
|
|
),
|
|
if (model.prescriptionListNew[index].remarks != null && model.prescriptionListNew[index].remarks != "")
|
|
CustomRow(
|
|
label: TranslationBase.of(context).remarks + ': ', //"Remark :",
|
|
value: model.prescriptionListNew[index].remarks.toString(),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
if (model.prescriptionListNew.isEmpty && patient.patientStatusType != 43)
|
|
Center(
|
|
child: ErrorMessage(
|
|
error: TranslationBase.of(context).noPrescriptionsFound,
|
|
))
|
|
],
|
|
),
|
|
),
|
|
)),
|
|
);
|
|
}
|
|
}
|