Finish prescription refactoring

merge-requests/967/head
RoaaGhali98 4 years ago
parent 34f658a166
commit cdc0d2f4a9

@ -1,19 +1,19 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/enum/viewstate.dart';
import '../../../core/model/Prescriptions/prescription_model.dart';
import '../../../core/model/patient/patiant_info_model.dart';
import '../../../core/model/search_drug/get_medication_response_model.dart';
import '../../../core/viewModel/prescription_view_model.dart';
import '../../../util/dr_app_toast_msg.dart';
import '../../../util/helpers.dart';
import '../../patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart';
import 'drug_to_drug.dart';
class AddDrugWidget extends StatefulWidget {

@ -26,7 +26,7 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
import '../../../widgets/transitions/slide_up_page.dart';
import 'add_drug_widget.dart';
import 'add_drug/add_drug_widget.dart';
class PrescriptionFormWidget extends StatefulWidget {
final PatiantInformtion patient;
@ -122,13 +122,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
// void requestPermissions() async {
// void requestPermissions() async {
// Map<Permission, PermissionStatus> statuses = await [
// Permission.microphone,
// ].request();
// }
void resultListener(result) {
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
@ -514,8 +507,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
);
// Navigator.pop(context);
// openDrugToDrug(model, prescriptionViewModel);
}
} else {
setState(() {

@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.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/user-guid/CusomRow.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -84,129 +85,89 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
AppText(
TranslationBase.of(context).direction,
color: Colors.grey,
),
Expanded(
child: AppText(" " +
prescriptions
.directionDescription
.toString() ??
'')),
],
CustomRow(
label: TranslationBase.of(context).direction + ' :',
value: " " + prescriptions.directionDescription.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).route,
color: Colors.grey,
),
AppText(" " +
prescriptions.routeDescription
.toString() ??
''),
],
CustomRow(
label: TranslationBase.of(context).route + ' :',
value: " " + prescriptions.routeDescription ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).refill,
color: Colors.grey,
),
Expanded(
child: AppText(" " +
prescriptions
.refillDescription
.toString() ??
'')),
],
CustomRow(
label: TranslationBase.of(context).refill + ' :',
value: " " + prescriptions.refillDescription ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).startDate,
color: Colors.grey,
),
Expanded(
child: AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
CustomRow(
label: TranslationBase.of(context).startDate + ' :',
value: " " + AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic) ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).stopDate,
color: Colors.grey,
),
Expanded(
child: AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
CustomRow(
label: TranslationBase.of(context).stopDate + ' :',
value: " " + AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic) ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
'UOM',
color: Colors.grey,
),
AppText(" " +
prescriptions.uomDescription
.toString() ??
''),
],
CustomRow(
label: 'UOM' + ' :',
value: " " + prescriptions.uomDescription.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).dailyDoses,
color: Colors.grey,
),
AppText(
" " + prescriptions.dose.toString() ??
''),
],
CustomRow(
label: TranslationBase.of(context).dailyDoses,
value: " " + prescriptions.dose.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).status,
color: Colors.grey,
),
AppText(" " +
prescriptions.statusDescription
.toString() ??
''),
],
CustomRow(
label: TranslationBase.of(context).status,
value: " " + prescriptions.statusDescription.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
Row(
children: [
AppText(
TranslationBase.of(context).processed,
color: Colors.grey,
),
AppText(" " +
prescriptions.doctorName
.toString() ??
''),
],
CustomRow(
label: TranslationBase.of(context).processed,
value: " " + prescriptions.doctorName.toString() ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
SizedBox(
height: 12,
),
AppText(prescriptions.comments ?? ''),
CustomRow(
label: '',
value: prescriptions.comments ?? '',
isCopyable: false,
isExpanded: false,
valueSize: 13,
labelSize: 13,
),
],
),
)

@ -13,7 +13,6 @@ import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-prof
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_card.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
import 'package:flutter/cupertino.dart';
@ -121,17 +120,11 @@ class PrescriptionsPage extends StatelessWidget {
DoctorCard(
doctorName:
Helpers.convertToTitleCase(model.prescriptionsList[index].doctorName),
profileUrl: model
.prescriptionsList[index].doctorImageURL,
profileUrl: model.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index]
.clinicDescription,
clinic: model.prescriptionsList[index].clinicDescription,
isPrescriptions: true,
appointmentDate:
AppDateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index]
.appointmentDate,
),
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.prescriptionsList[index].appointmentDate,),
),
],
))),
@ -160,53 +153,31 @@ class PrescriptionsPage extends StatelessWidget {
itemBuilder: (context, index) {
//model.medicationForInPatient.length,
return InkWell(
child: DoctorCard(
doctorName: Helpers.convertToTitleCase(model.medicationForInPatient[index].pHRItemDescription,),
profileUrl: model.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index].clinicDescription,
isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].prescriptionDatetime,),
),
onTap: () => Navigator.push(
context,
FadePage(
page:
PrescriptionItemsInPatientPage(
prescriptionIndex: index,
prescriptions:
model.medicationForInPatient[
index],
prescriptions: model.medicationForInPatient[index],
patient: patient,
patientType: patientType,
arrivalType: arrivalType,
startOn: AppDateUtils
.getDateTimeFromServerFormat(
model
.medicationForInPatient[
index]
.startDatetime,
),
stopOn: AppDateUtils
.getDateTimeFromServerFormat(
model
.medicationForInPatient[
index]
.stopDatetime,
startOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].startDatetime,),
stopOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].stopDatetime,
),
),
),
),
child: InPatientDoctorCard(
doctorName: model
.medicationForInPatient[index]
.pHRItemDescription,
profileUrl: 'sss',
branch: 'hamza',
clinic: 'basheer',
isPrescriptions: true,
appointmentDate: AppDateUtils
.getDateTimeFromServerFormat(
model.medicationForInPatient[index]
.prescriptionDatetime,
),
createdBy: model
.medicationForInPatient[index]
.doctorName
.toString(),
));
);
}),
if (model.medicationForInPatient.length == 0)
Center(

@ -1,196 +0,0 @@
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class InPatientDoctorCard extends StatelessWidget {
final String doctorName;
final String branch;
final DateTime appointmentDate;
final String profileUrl;
final String invoiceNO;
final String orderNo;
final Function onTap;
final bool isPrescriptions;
final String clinic;
final createdBy;
InPatientDoctorCard(
{this.doctorName,
this.branch,
this.profileUrl,
this.invoiceNO,
this.onTap,
this.appointmentDate,
this.orderNo,
this.isPrescriptions = false,
this.clinic,
this.createdBy});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(
width: 0.5,
color: Colors.white,
),
borderRadius: BorderRadius.all(
Radius.circular(15.0),
),
color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: InkWell(
onTap: onTap,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
Expanded(
child: AppText(
doctorName,
bold: true,
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
if (!isPrescriptions)
AppText(
'${AppDateUtils.getHour(appointmentDate)}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
),
),
],
),
Row(
children: [
AppText(
'CreatedBy ',
//bold: true,
),
Expanded(
child: AppText(
createdBy,
bold: true,
),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// Container(
// child: LargeAvatar(
// name: doctorName,
// url: profileUrl,
// ),
// width: 55,
// height: 55,
// ),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Container(
margin: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// if (orderNo != null && !isPrescriptions)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context).orderNo +
// ": ",
// color: Colors.grey[500],
// fontSize: 14,
// ),
// AppText(
// orderNo ?? '',
// fontSize: 14,
// )
// ],
// ),
// if (invoiceNO != null && !isPrescriptions)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context)
// .invoiceNo +
// ": ",
// fontSize: 14,
// color: Colors.grey[500],
// ),
// AppText(
// invoiceNO,
// fontSize: 14,
// )
// ],
// ),
// if (clinic != null)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context).clinic +
// ": ",
// color: Colors.grey[500],
// fontSize: 14,
// ),
// AppText(
// clinic,
// fontSize: 14,
// )
// ],
// ),
// if (branch != null)
// Row(
// children: <Widget>[
// AppText(
// TranslationBase.of(context).branch +
// ": ",
// fontSize: 14,
// color: Colors.grey[500],
// ),
// AppText(
// branch,
// fontSize: 14,
// )
// ],
// )
]),
),
),
Icon(
EvaIcons.eye,
)
],
),
),
],
),
],
),
),
),
);
}
}
Loading…
Cancel
Save