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/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/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/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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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'; import 'drug_to_drug.dart';
class AddDrugWidget extends StatefulWidget { 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_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:speech_to_text/speech_to_text.dart' as stt;
import '../../../widgets/transitions/slide_up_page.dart'; import '../../../widgets/transitions/slide_up_page.dart';
import 'add_drug_widget.dart'; import 'add_drug/add_drug_widget.dart';
class PrescriptionFormWidget extends StatefulWidget { class PrescriptionFormWidget extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
@ -122,13 +122,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....'; recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
} }
// void requestPermissions() async {
// void requestPermissions() async {
// Map<Permission, PermissionStatus> statuses = await [
// Permission.microphone,
// ].request();
// }
void resultListener(result) { void resultListener(result) {
recognizedWord = result.recognizedWords; recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord}); event.setValue({"searchText": recognizedWord});
@ -514,8 +507,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
), ),
), ),
); );
// Navigator.pop(context);
// openDrugToDrug(model, prescriptionViewModel);
} }
} else { } else {
setState(() { 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/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_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -84,129 +85,89 @@ class PrescriptionItemsInPatientPage extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( CustomRow(
children: [ label: TranslationBase.of(context).direction + ' :',
AppText( value: " " + prescriptions.directionDescription.toString() ?? '',
TranslationBase.of(context).direction, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
Expanded( labelSize: 13,
child: AppText(" " +
prescriptions
.directionDescription
.toString() ??
'')),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).route + ' :',
AppText( value: " " + prescriptions.routeDescription ?? '',
TranslationBase.of(context).route, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
AppText(" " + labelSize: 13,
prescriptions.routeDescription
.toString() ??
''),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).refill + ' :',
AppText( value: " " + prescriptions.refillDescription ?? '',
TranslationBase.of(context).refill, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
Expanded( labelSize: 13,
child: AppText(" " +
prescriptions
.refillDescription
.toString() ??
'')),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).startDate + ' :',
AppText( value: " " + AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic) ?? '',
TranslationBase.of(context).startDate, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
Expanded( labelSize: 13,
child: AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).stopDate + ' :',
AppText( value: " " + AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic) ?? '',
TranslationBase.of(context).stopDate, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
Expanded( labelSize: 13,
child: AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
), ),
Row( CustomRow(
children: [ label: 'UOM' + ' :',
AppText( value: " " + prescriptions.uomDescription.toString() ?? '',
'UOM', isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
AppText(" " + labelSize: 13,
prescriptions.uomDescription
.toString() ??
''),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).dailyDoses,
AppText( value: " " + prescriptions.dose.toString() ?? '',
TranslationBase.of(context).dailyDoses, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
AppText( labelSize: 13,
" " + prescriptions.dose.toString() ??
''),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).status,
AppText( value: " " + prescriptions.statusDescription.toString() ?? '',
TranslationBase.of(context).status, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
AppText(" " + labelSize: 13,
prescriptions.statusDescription
.toString() ??
''),
],
), ),
Row( CustomRow(
children: [ label: TranslationBase.of(context).processed,
AppText( value: " " + prescriptions.doctorName.toString() ?? '',
TranslationBase.of(context).processed, isCopyable: false,
color: Colors.grey, isExpanded: false,
), valueSize: 13,
AppText(" " + labelSize: 13,
prescriptions.doctorName
.toString() ??
''),
],
), ),
SizedBox( SizedBox(
height: 12, 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/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/doctor_card.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/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/fade_page.dart';
import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -121,17 +120,11 @@ class PrescriptionsPage extends StatelessWidget {
DoctorCard( DoctorCard(
doctorName: doctorName:
Helpers.convertToTitleCase(model.prescriptionsList[index].doctorName), Helpers.convertToTitleCase(model.prescriptionsList[index].doctorName),
profileUrl: model profileUrl: model.prescriptionsList[index].doctorImageURL,
.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name, branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index] clinic: model.prescriptionsList[index].clinicDescription,
.clinicDescription,
isPrescriptions: true, isPrescriptions: true,
appointmentDate: appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.prescriptionsList[index].appointmentDate,),
AppDateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index]
.appointmentDate,
),
), ),
], ],
))), ))),
@ -160,53 +153,31 @@ class PrescriptionsPage extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
//model.medicationForInPatient.length, //model.medicationForInPatient.length,
return InkWell( 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( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: page:
PrescriptionItemsInPatientPage( PrescriptionItemsInPatientPage(
prescriptionIndex: index, prescriptionIndex: index,
prescriptions: prescriptions: model.medicationForInPatient[index],
model.medicationForInPatient[
index],
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
startOn: AppDateUtils startOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].startDatetime,),
.getDateTimeFromServerFormat( stopOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].stopDatetime,
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) if (model.medicationForInPatient.length == 0)
Center( 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