From 2ad96dad88a6027def6a4704c54cd3fa8bc08122 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Mon, 8 Jun 2020 12:06:07 +0300 Subject: [PATCH] create Prescription In and Out Patient --- lib/config/config.dart | 4 +- .../prescriptions/prescriptions_screen.dart | 85 +++---------------- .../prescription_in_patinets_widget.dart | 82 ++++++++++++++++++ .../prescription_out_patinets_widget.dart | 82 ++++++++++++++++++ 4 files changed, 180 insertions(+), 73 deletions(-) create mode 100644 lib/widgets/patients/profile/prescription_in_patinets_widget.dart create mode 100644 lib/widgets/patients/profile/prescription_out_patinets_widget.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index dade19d6..886430ad 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,8 +2,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z]"; const ONLY_DATE = "[0-9/]"; -// const BASE_URL = 'https://hmgwebservices.com/Services/'; -const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; + const BASE_URL = 'https://hmgwebservices.com/Services/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart index 360ec776..b2ee2f48 100644 --- a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart +++ b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/models/patient/reauest_prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/prescription_in_patinets_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/prescription_out_patinets_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -33,9 +35,10 @@ class PrescriptionScreen extends StatefulWidget { class _PrescriptionScreenState extends State { PatientsProvider patientsProv; - var _isInit = true; + bool _isInit = true; + String type = '2'; - /* + /* *@author: Elham Rababah *@Date:28/4/2020 *@param: context @@ -46,7 +49,7 @@ class _PrescriptionScreenState extends State { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String token = await sharedPref.getString(TOKEN); - String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); + type = await sharedPref.getString(SLECTED_PATIENT_TYPE); if (type == '1') { RequestPrescriptionReportForInPatient prescriptionReqModel = @@ -85,74 +88,14 @@ class _PrescriptionScreenState extends State { ? DrAppCircularProgressIndeicator() : patientsProv.isError ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.patientPrescriptionsList.length == 0 - ? DrAppEmbeddedError( - error: 'You don\'t have any Prescriptions') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: ListView.builder( - itemCount: - patientsProv.patientPrescriptionsList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: CardWithBgWidgetNew( - widget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - LargeAvatar( - url: patientsProv - .patientPrescriptionsList[index] - .doctorImageURL, - name: patientsProv - .patientPrescriptionsList[index] - .doctorName, - radius: 10, - width: 70, - ), - Expanded( - child: Container( - margin: EdgeInsets.only( - left: 15, right: 15), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - '${patientsProv.patientPrescriptionsList[index].name}', - fontSize: 2.5 * - SizeConfig.textMultiplier, - ), - SizedBox( - height: 8, - ), - AppText( - '${patientsProv.patientPrescriptionsList[index].clinicDescription}', - fontSize: 2.5 * - SizeConfig - .textMultiplier, - color: Theme.of(context) - .primaryColor), - SizedBox( - height: 8, - ), - ], - ), - ), - ) - ], - ), - ], - ), - ), - onTap: () {}, - ); - }), + : type == '1' + ? PrescriptionInPatientWidget( + prescriptionReportForInPatientList: + patientsProv.prescriptionReportForInPatientList, + ) + : PrescriptionOutPatientWidget( + patientPrescriptionsList: + patientsProv.patientPrescriptionsList, ), ); } diff --git a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart new file mode 100644 index 00000000..75eef63c --- /dev/null +++ b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart @@ -0,0 +1,82 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/prescription_report_for_in_patient.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'large_avatar.dart'; + +class PrescriptionInPatientWidget extends StatelessWidget { + final List prescriptionReportForInPatientList; + + PrescriptionInPatientWidget( + {Key key, this.prescriptionReportForInPatientList}); + + @override + Widget build(BuildContext context) { + return Container( + child: prescriptionReportForInPatientList.length == 0 + ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + : Container( + margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, + SizeConfig.realScreenWidth * 0.05, 0), + child: ListView.builder( + itemCount: prescriptionReportForInPatientList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () {}, + child: CardWithBgWidgetNew( + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + LargeAvatar( + name: + prescriptionReportForInPatientList[index] + .createdByName, + radius: 10, + width: 70, + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 15, right: 15), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + '${prescriptionReportForInPatientList[index].createdByName}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText( + '${prescriptionReportForInPatientList[index].itemDescription}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + color: + Theme.of(context).primaryColor), + SizedBox( + height: 8, + ), + ], + ), + ), + ) + ], + ), + ], + ), + )); + }, + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart new file mode 100644 index 00000000..b4c75120 --- /dev/null +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -0,0 +1,82 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'large_avatar.dart'; + +class PrescriptionOutPatientWidget extends StatelessWidget { + final List patientPrescriptionsList; + + PrescriptionOutPatientWidget({Key key, this.patientPrescriptionsList}); + + @override + Widget build(BuildContext context) { + return Container( + child: patientPrescriptionsList.length == 0 + ? DrAppEmbeddedError(error: 'You don\'t have any Prescriptions') + : Container( + margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, + SizeConfig.realScreenWidth * 0.05, 0), + child: ListView.builder( + itemCount: patientPrescriptionsList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () {}, + child: CardWithBgWidgetNew( + widget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + LargeAvatar( + url: patientPrescriptionsList[index] + .doctorImageURL, + name: patientPrescriptionsList[index] + .doctorName, + radius: 10, + width: 70, + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 15, right: 15), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + '${patientPrescriptionsList[index].name}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + ), + SizedBox( + height: 8, + ), + AppText( + '${patientPrescriptionsList[index].clinicDescription}', + fontSize: + 2.5 * SizeConfig.textMultiplier, + color: + Theme.of(context).primaryColor), + SizedBox( + height: 8, + ), + ], + ), + ), + ) + ], + ), + ], + ), + )); + }, + ), + ), + ); + } +}