add prescription to procedure type

merge-requests/711/head
mosazaid 5 years ago
parent ea0658c05c
commit b36ddf9317

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
// const BASE_URL = 'https://hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -1003,7 +1003,9 @@ const Map<String, Map<String, String>> localizedValues = {
"verified": {"en": "Verified", "ar": "تم التحقق"}, "verified": {"en": "Verified", "ar": "تم التحقق"},
"endCall": {"en": "End Call", "ar": "انهاء"}, "endCall": {"en": "End Call", "ar": "انهاء"},
"favoriteTemplates": {"en": "Favorite Templates", "ar": "القوالب المفضلة"}, "favoriteTemplates": {"en": "Favorite Templates", "ar": "القوالب المفضلة"},
"allProcedures": {"en": "All Procedures", "ar": "كل الإجراءات"}, "allProcedures": {"en": "All Procedures", "ar": "جميع الإجراءات"},
"allRadiology": {"en": "All Radiology", "ar": "كل الأشعة"}, "allRadiology": {"en": "All Radiology", "ar": "جميع الأشعة"},
"allLab": {"en": "All Lab", "ar": "كل المختبرات"}, "allLab": {"en": "All Lab", "ar": "جميع المختبرات"},
"allPrescription": {"en": "All Prescription", "ar": "جميع الوصفات"},
"addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"},
}; };

@ -18,7 +18,8 @@ class AddFavPrescription extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String categoryID; final String categoryID;
const AddFavPrescription({Key key, this.model, this.patient, this.categoryID}) : super(key: key); const AddFavPrescription({Key key, this.model, this.patient, this.categoryID})
: super(key: key);
@override @override
_AddFavPrescriptionState createState() => _AddFavPrescriptionState(); _AddFavPrescriptionState createState() => _AddFavPrescriptionState();
@ -30,11 +31,14 @@ class _AddFavPrescriptionState extends State<AddFavPrescription> {
List<ProcedureTempleteDetailsModel> entityList = List(); List<ProcedureTempleteDetailsModel> entityList = List();
ProcedureTempleteDetailsModel groupProcedures; ProcedureTempleteDetailsModel groupProcedures;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
onModelReady: (model) => model.getProcedureTemplate(categoryID: widget.categoryID), onModelReady: (model) =>
builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( model.getProcedureTemplate(categoryID: widget.categoryID),
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: false, isShowAppBar: false,
baseViewModel: model, baseViewModel: model,
body: Column( body: Column(
@ -59,7 +63,8 @@ class _AddFavPrescriptionState extends State<AddFavPrescription> {
entityList.add(history); entityList.add(history);
}); });
}, },
isEntityFavListSelected: (master) => isEntityListSelected(master), isEntityFavListSelected: (master) =>
isEntityListSelected(master),
groupProcedures: groupProcedures, groupProcedures: groupProcedures,
selectProcedures: (valasd) { selectProcedures: (valasd) {
setState(() { setState(() {
@ -109,7 +114,9 @@ class _AddFavPrescriptionState extends State<AddFavPrescription> {
bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) {
Iterable<ProcedureTempleteDetailsModel> history = entityList.where( Iterable<ProcedureTempleteDetailsModel> history = entityList.where(
(element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); (element) =>
masterKey.templateID == element.templateID &&
masterKey.procedureName == element.procedureName);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.da
import 'package:doctor_app_flutter/screens/prescription/prescription_home_screen.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_item_in_patient_page.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_items_page.dart';
import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart';
import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart';
import 'package:doctor_app_flutter/util/date-utils.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/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/add-order/addNewOrder.dart';
@ -50,7 +52,8 @@ class PrescriptionsPage extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
if (model.prescriptionsList.isNotEmpty && patient.patientStatusType != 43) if (model.prescriptionsList.isNotEmpty &&
patient.patientStatusType != 43)
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
@ -70,7 +73,8 @@ class PrescriptionsPage extends StatelessWidget {
], ],
), ),
), ),
if (patient.patientStatusType != null && patient.patientStatusType == 43) if (patient.patientStatusType != null &&
patient.patientStatusType == 43)
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
@ -90,20 +94,25 @@ class PrescriptionsPage extends StatelessWidget {
], ],
), ),
), ),
if ((patient.patientStatusType != null && patient.patientStatusType == 43) || if ((patient.patientStatusType != null &&
patient.patientStatusType == 43) ||
(isFromLiveCare && patient.appointmentNo != null)) (isFromLiveCare && patient.appointmentNo != null))
AddNewOrder( AddNewOrder(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => PrescriptionHomeScreen( builder: (context) =>
BaseAddProcedureTabPage(
patient: patient, patient: patient,
model: model, prescriptionModel: model,
procedureType:
ProcedureType.PRESCRIPTION,
)), )),
); );
}, },
label: TranslationBase.of(context).applyForNewPrescriptionsOrder, label: TranslationBase.of(context)
.applyForNewPrescriptionsOrder,
), ),
...List.generate( ...List.generate(
model.prescriptionsList.length, model.prescriptionsList.length,
@ -112,7 +121,8 @@ class PrescriptionsPage extends StatelessWidget {
context, context,
FadePage( FadePage(
page: PrescriptionItemsPage( page: PrescriptionItemsPage(
prescriptions: model.prescriptionsList[index], prescriptions:
model.prescriptionsList[index],
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -120,16 +130,22 @@ class PrescriptionsPage extends StatelessWidget {
), ),
), ),
child: DoctorCard( child: DoctorCard(
doctorName: model.prescriptionsList[index].doctorName, doctorName:
profileUrl: model.prescriptionsList[index].doctorImageURL, model.prescriptionsList[index].doctorName,
profileUrl: model
.prescriptionsList[index].doctorImageURL,
branch: model.prescriptionsList[index].name, branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index].clinicDescription, clinic: model.prescriptionsList[index]
.clinicDescription,
isPrescriptions: true, isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat( appointmentDate:
model.prescriptionsList[index].appointmentDate, AppDateUtils.getDateTimeFromServerFormat(
model.prescriptionsList[index]
.appointmentDate,
), ),
))), ))),
if (model.prescriptionsList.isEmpty && patient.patientStatusType != 43) if (model.prescriptionsList.isEmpty &&
patient.patientStatusType != 43)
Center( Center(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -140,7 +156,8 @@ class PrescriptionsPage extends StatelessWidget {
Image.asset('assets/images/no-data.png'), Image.asset('assets/images/no-data.png'),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context).noPrescriptionsFound), child: AppText(TranslationBase.of(context)
.noPrescriptionsFound),
) )
], ],
), ),
@ -165,29 +182,38 @@ class PrescriptionsPage extends StatelessWidget {
FadePage( FadePage(
page: PrescriptionItemsInPatientPage( page: PrescriptionItemsInPatientPage(
prescriptionIndex: index, prescriptionIndex: index,
prescriptions: model.inPatientPrescription[index], prescriptions: model
.inPatientPrescription[index],
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
startOn: AppDateUtils.getDateTimeFromServerFormat( startOn: AppDateUtils
model.inPatientPrescription[index].startDatetime, .getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.startDatetime,
), ),
stopOn: AppDateUtils.getDateTimeFromServerFormat( stopOn: AppDateUtils
model.inPatientPrescription[index].stopDatetime, .getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.stopDatetime,
), ),
), ),
), ),
), ),
child: InPatientDoctorCard( child: InPatientDoctorCard(
doctorName: model.inPatientPrescription[index].itemDescription, doctorName: model.inPatientPrescription[index]
.itemDescription,
profileUrl: 'sss', profileUrl: 'sss',
branch: 'hamza', branch: 'hamza',
clinic: 'basheer', clinic: 'basheer',
isPrescriptions: true, isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat( appointmentDate:
model.inPatientPrescription[index].prescriptionDatetime, AppDateUtils.getDateTimeFromServerFormat(
model.inPatientPrescription[index]
.prescriptionDatetime,
), ),
createdBy: model.inPatientPrescription[index].createdByName, createdBy: model.inPatientPrescription[index]
.createdByName,
))), ))),
if (model.inPatientPrescription.length == 0) if (model.inPatientPrescription.length == 0)
Center( Center(
@ -200,7 +226,8 @@ class PrescriptionsPage extends StatelessWidget {
Image.asset('assets/images/no-data.png'), Image.asset('assets/images/no-data.png'),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context).noPrescriptionsFound), child: AppText(TranslationBase.of(context)
.noPrescriptionsFound),
) )
], ],
), ),

@ -5,10 +5,10 @@ enum ProcedureType {
PROCEDURE, PROCEDURE,
LAB_RESULT, LAB_RESULT,
RADIOLOGY, RADIOLOGY,
PRESCRIPTION,
} }
extension procedureType on ProcedureType { extension procedureType on ProcedureType {
String getFavouriteTabName(BuildContext context) { String getFavouriteTabName(BuildContext context) {
return TranslationBase.of(context).favoriteTemplates; return TranslationBase.of(context).favoriteTemplates;
} }
@ -21,6 +21,8 @@ extension procedureType on ProcedureType {
return TranslationBase.of(context).allLab; return TranslationBase.of(context).allLab;
case ProcedureType.RADIOLOGY: case ProcedureType.RADIOLOGY:
return TranslationBase.of(context).allRadiology; return TranslationBase.of(context).allRadiology;
case ProcedureType.PRESCRIPTION:
return TranslationBase.of(context).allPrescription;
default: default:
return ""; return "";
} }
@ -34,6 +36,8 @@ extension procedureType on ProcedureType {
return TranslationBase.of(context).addLabOrder; return TranslationBase.of(context).addLabOrder;
case ProcedureType.RADIOLOGY: case ProcedureType.RADIOLOGY:
return TranslationBase.of(context).addRadiologyOrder; return TranslationBase.of(context).addRadiologyOrder;
case ProcedureType.PRESCRIPTION:
return TranslationBase.of(context).addPrescription;
default: default:
return ""; return "";
} }
@ -47,6 +51,8 @@ extension procedureType on ProcedureType {
return TranslationBase.of(context).addLabOrder; return TranslationBase.of(context).addLabOrder;
case ProcedureType.RADIOLOGY: case ProcedureType.RADIOLOGY:
return TranslationBase.of(context).addRadiologyOrder; return TranslationBase.of(context).addRadiologyOrder;
case ProcedureType.PRESCRIPTION:
return TranslationBase.of(context).addPrescription;
default: default:
return ""; return "";
} }
@ -58,8 +64,8 @@ extension procedureType on ProcedureType {
return null; return null;
case ProcedureType.LAB_RESULT: case ProcedureType.LAB_RESULT:
return "02"; return "02";
case ProcedureType.RADIOLOGY: case ProcedureType.PRESCRIPTION:
return "03"; return "55";
default: default:
return null; return null;
} }
@ -77,5 +83,4 @@ extension procedureType on ProcedureType {
return null; return null;
} }
} }
} }

@ -1,8 +1,10 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_checkout_screen.dart';
import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart';
import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -17,12 +19,14 @@ import 'ProcedureType.dart';
class AddFavouriteProcedure extends StatefulWidget { class AddFavouriteProcedure extends StatefulWidget {
final ProcedureViewModel model; final ProcedureViewModel model;
final PrescriptionViewModel prescriptionModel;
final PatiantInformtion patient; final PatiantInformtion patient;
final ProcedureType procedureType; final ProcedureType procedureType;
AddFavouriteProcedure({ AddFavouriteProcedure({
Key key, Key key,
this.model, this.model,
this.prescriptionModel,
this.patient, this.patient,
@required this.procedureType, @required this.procedureType,
}); });
@ -37,6 +41,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
ProcedureViewModel model; ProcedureViewModel model;
PatiantInformtion patient; PatiantInformtion patient;
List<ProcedureTempleteDetailsModel> entityList = List(); List<ProcedureTempleteDetailsModel> entityList = List();
ProcedureTempleteDetailsModel groupProcedures;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -55,6 +60,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
if (model.templateList.length != 0) if (model.templateList.length != 0)
Expanded( Expanded(
child: EntityListCheckboxSearchFavProceduresWidget( child: EntityListCheckboxSearchFavProceduresWidget(
isProcedure: !(widget.procedureType == ProcedureType.PRESCRIPTION),
model: model, model: model,
removeFavProcedure: (item) { removeFavProcedure: (item) {
setState(() { setState(() {
@ -68,6 +74,12 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
}, },
isEntityFavListSelected: (master) => isEntityFavListSelected: (master) =>
isEntityListSelected(master), isEntityListSelected(master),
groupProcedures: groupProcedures,
selectProcedures: (valasd) {
setState(() {
groupProcedures = valasd;
});
},
), ),
), ),
Container( Container(
@ -81,26 +93,45 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
color: Color(0xff359846), color: Color(0xff359846),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () { onPressed: () {
if (entityList.isEmpty == true) { if(widget.procedureType == ProcedureType.PRESCRIPTION){
DrAppToastMsg.showErrorToast( if (groupProcedures == null) {
TranslationBase.of(context) DrAppToastMsg.showErrorToast(
.fillTheMandatoryProcedureDetails, 'Please Select item ',
); );
return; return;
} }
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ProcedureCheckOutScreen( builder: (context) => PrescriptionCheckOutScreen(
items: entityList, patient: widget.patient,
model: model, model: widget.prescriptionModel,
patient: widget.patient, groupProcedures: groupProcedures,
addButtonTitle: widget.procedureType.getAddButtonTitle(context), ),
toolbarTitle: widget.procedureType.getToolbarLabel(context),
), ),
), );
); } else {
if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.fillTheMandatoryProcedureDetails,
);
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProcedureCheckOutScreen(
items: entityList,
model: model,
patient: widget.patient,
addButtonTitle: widget.procedureType.getAddButtonTitle(context),
toolbarTitle: widget.procedureType.getToolbarLabel(context),
),
),
);
}
}, },
), ),
], ],

@ -1,8 +1,9 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.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/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
@ -15,11 +16,16 @@ import 'add-procedure-page.dart';
class BaseAddProcedureTabPage extends StatefulWidget { class BaseAddProcedureTabPage extends StatefulWidget {
final ProcedureViewModel model; final ProcedureViewModel model;
final PrescriptionViewModel prescriptionModel;
final PatiantInformtion patient; final PatiantInformtion patient;
final ProcedureType procedureType; final ProcedureType procedureType;
const BaseAddProcedureTabPage( const BaseAddProcedureTabPage(
{Key key, this.model, this.patient, this.procedureType}) {Key key,
this.model,
this.prescriptionModel,
this.patient,
@required this.procedureType})
: super(key: key); : super(key: key);
@override @override
@ -153,15 +159,25 @@ class _BaseAddProcedureTabPageState extends State<BaseAddProcedureTabPage>
controller: _tabController, controller: _tabController,
children: [ children: [
AddFavouriteProcedure( AddFavouriteProcedure(
model: model, model: this.model,
patient: patient, prescriptionModel:
procedureType: procedureType, widget.prescriptionModel,
),
AddProcedurePage(
model: model,
patient: patient, patient: patient,
procedureType: procedureType, procedureType: procedureType,
), ),
if (widget.procedureType ==
ProcedureType.PRESCRIPTION)
PrescriptionFormWidget(
widget.prescriptionModel,
widget.patient,
widget.prescriptionModel
.prescriptionList)
else
AddProcedurePage(
model: this.model,
patient: patient,
procedureType: procedureType,
),
], ],
), ),
), ),

@ -1361,6 +1361,8 @@ class TranslationBase {
String get allProcedures => localizedValues['allProcedures'][locale.languageCode]; String get allProcedures => localizedValues['allProcedures'][locale.languageCode];
String get allRadiology => localizedValues['allRadiology'][locale.languageCode]; String get allRadiology => localizedValues['allRadiology'][locale.languageCode];
String get allLab => localizedValues['allLab'][locale.languageCode]; String get allLab => localizedValues['allLab'][locale.languageCode];
String get allPrescription => localizedValues['allPrescription'][locale.languageCode];
String get addPrescription => localizedValues['addPrescription'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save