diff --git a/lib/models/patient/prescription_report_for_in_patient.dart b/lib/models/patient/prescription_report_for_in_patient.dart index d4452e32..9b88279e 100644 --- a/lib/models/patient/prescription_report_for_in_patient.dart +++ b/lib/models/patient/prescription_report_for_in_patient.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + class PrescriptionReportForInPatient { int admissionNo; int authorizedBy; @@ -25,7 +27,7 @@ class PrescriptionReportForInPatient { int orderNo; int patientID; String pharmacyRemarks; - String prescriptionDatetime; + DateTime prescriptionDatetime; int prescriptionNo; String processedBy; int projectID; @@ -38,11 +40,11 @@ class PrescriptionReportForInPatient { int routeId; Null routeN; Null setupID; - String startDatetime; + DateTime startDatetime; int status; String statusDescription; Null statusDescriptionN; - String stopDatetime; + DateTime stopDatetime; int unitofMeasurement; String unitofMeasurementDescription; Null unitofMeasurementDescriptionN; @@ -123,7 +125,7 @@ class PrescriptionReportForInPatient { orderNo = json['OrderNo']; patientID = json['PatientID']; pharmacyRemarks = json['PharmacyRemarks']; - prescriptionDatetime = json['PrescriptionDatetime']; + prescriptionDatetime = Helpers.convertStringToDate(json['PrescriptionDatetime']); prescriptionNo = json['PrescriptionNo']; processedBy = json['ProcessedBy']; projectID = json['ProjectID']; @@ -136,11 +138,11 @@ class PrescriptionReportForInPatient { routeId = json['RouteId']; routeN = json['RouteN']; setupID = json['SetupID']; - startDatetime = json['StartDatetime']; + startDatetime = Helpers.convertStringToDate(json['StartDatetime']) ; status = json['Status']; statusDescription = json['StatusDescription']; statusDescriptionN = json['StatusDescriptionN']; - stopDatetime = json['StopDatetime']; + stopDatetime = Helpers.convertStringToDate(json['StopDatetime']); unitofMeasurement = json['UnitofMeasurement']; unitofMeasurementDescription = json['UnitofMeasurementDescription']; unitofMeasurementDescriptionN = json['UnitofMeasurementDescriptionN']; diff --git a/lib/models/prescription_report.dart b/lib/models/prescription_report.dart new file mode 100644 index 00000000..05d28bdc --- /dev/null +++ b/lib/models/prescription_report.dart @@ -0,0 +1,140 @@ +class PrescriptionReport { + String address; + int appointmentNo; + String clinic; + String companyName; + int days; + String doctorName; + int doseDailyQuantity; + String frequency; + int frequencyNumber; + Null imageExtension; + Null imageSRCUrl; + Null imageString; + Null imageThumbUrl; + String isCovered; + String itemDescription; + int itemID; + String orderDate; + int patientID; + String patientName; + String phoneOffice1; + Null prescriptionQR; + int prescriptionTimes; + Null productImage; + String productImageBase64; + String productImageString; + int projectID; + String projectName; + String remarks; + String route; + String sKU; + int scaleOffset; + String startDate; + + PrescriptionReport( + {this.address, + this.appointmentNo, + this.clinic, + this.companyName, + this.days, + this.doctorName, + this.doseDailyQuantity, + this.frequency, + this.frequencyNumber, + this.imageExtension, + this.imageSRCUrl, + this.imageString, + this.imageThumbUrl, + this.isCovered, + this.itemDescription, + this.itemID, + this.orderDate, + this.patientID, + this.patientName, + this.phoneOffice1, + this.prescriptionQR, + this.prescriptionTimes, + this.productImage, + this.productImageBase64, + this.productImageString, + this.projectID, + this.projectName, + this.remarks, + this.route, + this.sKU, + this.scaleOffset, + this.startDate}); + + PrescriptionReport.fromJson(Map json) { + address = json['Address']; + appointmentNo = json['AppointmentNo']; + clinic = json['Clinic']; + companyName = json['CompanyName']; + days = json['Days']; + doctorName = json['DoctorName']; + doseDailyQuantity = json['DoseDailyQuantity']; + frequency = json['Frequency']; + frequencyNumber = json['FrequencyNumber']; + imageExtension = json['ImageExtension']; + imageSRCUrl = json['ImageSRCUrl']; + imageString = json['ImageString']; + imageThumbUrl = json['ImageThumbUrl']; + isCovered = json['IsCovered']; + itemDescription = json['ItemDescription']; + itemID = json['ItemID']; + orderDate = json['OrderDate']; + patientID = json['PatientID']; + patientName = json['PatientName']; + phoneOffice1 = json['PhoneOffice1']; + prescriptionQR = json['PrescriptionQR']; + prescriptionTimes = json['PrescriptionTimes']; + productImage = json['ProductImage']; + productImageBase64 = json['ProductImageBase64']; + productImageString = json['ProductImageString']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + route = json['Route']; + sKU = json['SKU']; + scaleOffset = json['ScaleOffset']; + startDate = json['StartDate']; + } + + Map toJson() { + final Map data = new Map(); + data['Address'] = this.address; + data['AppointmentNo'] = this.appointmentNo; + data['Clinic'] = this.clinic; + data['CompanyName'] = this.companyName; + data['Days'] = this.days; + data['DoctorName'] = this.doctorName; + data['DoseDailyQuantity'] = this.doseDailyQuantity; + data['Frequency'] = this.frequency; + data['FrequencyNumber'] = this.frequencyNumber; + data['ImageExtension'] = this.imageExtension; + data['ImageSRCUrl'] = this.imageSRCUrl; + data['ImageString'] = this.imageString; + data['ImageThumbUrl'] = this.imageThumbUrl; + data['IsCovered'] = this.isCovered; + data['ItemDescription'] = this.itemDescription; + data['ItemID'] = this.itemID; + data['OrderDate'] = this.orderDate; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PhoneOffice1'] = this.phoneOffice1; + data['PrescriptionQR'] = this.prescriptionQR; + data['PrescriptionTimes'] = this.prescriptionTimes; + data['ProductImage'] = this.productImage; + data['ProductImageBase64'] = this.productImageBase64; + data['ProductImageString'] = this.productImageString; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['Route'] = this.route; + data['SKU'] = this.sKU; + data['ScaleOffset'] = this.scaleOffset; + data['StartDate'] = this.startDate; + return data; + } +} diff --git a/lib/models/request_prescription_report.dart b/lib/models/request_prescription_report.dart new file mode 100644 index 00000000..0581692e --- /dev/null +++ b/lib/models/request_prescription_report.dart @@ -0,0 +1,68 @@ +class RequestPrescriptionReport { + int projectID; + int appointmentNo; + int episodeID; + String setupID; + int patientTypeID; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + RequestPrescriptionReport( + {this.projectID, + this.appointmentNo, + this.episodeID, + this.setupID, + this.patientTypeID, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA}); + + RequestPrescriptionReport.fromJson(Map json) { + projectID = json['ProjectID']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + setupID = json['SetupID']; + patientTypeID = json['PatientTypeID']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['SetupID'] = this.setupID; + data['PatientTypeID'] = this.patientTypeID; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index c7e48afa..493cb472 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/models/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; import 'package:flutter/cupertino.dart'; - class DoctorReplyProvider with ChangeNotifier { List listDoctorWorkingHoursTable = []; @@ -18,20 +17,21 @@ class DoctorReplyProvider with ChangeNotifier { getDoctorReply() async { try { - await BaseAppClient.post('DoctorApplication.svc/REST/GtMyPatientsQuestions', - body: _requestDoctorReply.toJson(), - onSuccess: (dynamic response, int statusCode) { - response['List_GtMyPatientsQuestions'].forEach((v) { - listDoctorWorkingHoursTable.add(ListGtMyPatientsQuestions.fromJson(v)); - isError = false; - isLoading = false; - }); - }, - onFailure: (String error, int statusCode) { - isError = true; + await BaseAppClient.post( + 'DoctorApplication.svc/REST/GtMyPatientsQuestions', + body: _requestDoctorReply.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_GtMyPatientsQuestions'].forEach((v) { + listDoctorWorkingHoursTable + .add(ListGtMyPatientsQuestions.fromJson(v)); + isError = false; isLoading = false; - this.error= error; }); + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }); notifyListeners(); } catch (error) { diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 9aa35093..e93c2ceb 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/models/patient/prescription_report_for_in_pat import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart'; +import 'package:doctor_app_flutter/models/prescription_report.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart'; @@ -42,6 +43,7 @@ class PatientsProvider with ChangeNotifier { List patientPrescriptionsList = []; List patientRadiologyList = []; List prescriptionReportForInPatientList = []; + List prescriptionReport = []; /*@author: ibrahe albitar *@Date:2/6/2020 @@ -66,7 +68,7 @@ class PatientsProvider with ChangeNotifier { ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest(); Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); + HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); PatiantInformtion _selectedPatient; @@ -237,7 +239,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { final response = - await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); + await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -291,15 +293,38 @@ class PatientsProvider with ChangeNotifier { isLoading = false; }, onFailure: (String error, int statusCode) { isError = true; + isLoading = false; this.error = error; }, body: patient); notifyListeners(); - } catch (err) { handelCatchErrorCase(err); } } + getPrescriptionReport(prescriptionReqModel) async{ + prescriptionReport = []; + isLoading = true; + isError = false; + error = ""; + notifyListeners(); + await BaseAppClient.post( + 'Patients.svc/REST/GetPrescriptionReport', + onSuccess: (dynamic response, int statusCode) { + response['ListPRM'].forEach((v) { + prescriptionReport + .add(PrescriptionReport.fromJson(v)); + }); + isError = false; + isLoading = false; + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, body: prescriptionReqModel); + notifyListeners(); + } + /*@author: Elham Rababah *@Date:12/5/2020 *@param: patient diff --git a/lib/routes.dart b/lib/routes.dart index 94b325a7..34d3224d 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -6,6 +6,8 @@ import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; + import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; import './screens/auth/login_screen.dart'; @@ -66,6 +68,7 @@ const String PATIENT_ORDERS = 'patients/patient_orders'; const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; +const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; var routes = { HOME: (_) => LandingPage(), @@ -98,5 +101,6 @@ var routes = { PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), - BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen() + BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), + IN_PATIENT_PRESCRIPTIONS_DETAILS:(_)=> InpatientPrescriptionDetailsScreen() }; diff --git a/lib/screens/auth/verify_account_screen.dart b/lib/screens/auth/verify_account_screen.dart index 61d58306..b7eee5df 100644 --- a/lib/screens/auth/verify_account_screen.dart +++ b/lib/screens/auth/verify_account_screen.dart @@ -1,5 +1,3 @@ -import 'dart:async'; - import 'package:flutter/material.dart'; import '../../lookups/auth_lookup.dart'; diff --git a/lib/screens/patients/out_patient_prescription_details_screen.dart b/lib/screens/patients/out_patient_prescription_details_screen.dart new file mode 100644 index 00000000..a8f97290 --- /dev/null +++ b/lib/screens/patients/out_patient_prescription_details_screen.dart @@ -0,0 +1,67 @@ +import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; +import 'package:doctor_app_flutter/models/request_prescription_report.dart'; +import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.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 'package:provider/provider.dart'; + +class OutPatientPrescriptionDetailsScreen extends StatefulWidget { + final PrescriptionResModel prescriptionResModel; + + OutPatientPrescriptionDetailsScreen({Key key, this.prescriptionResModel}); + + @override + _OutPatientPrescriptionDetailsScreenState createState() => + _OutPatientPrescriptionDetailsScreenState(); +} + +class _OutPatientPrescriptionDetailsScreenState + extends State { + bool _isInit = true; + PatientsProvider patientsProvider; + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + patientsProvider = Provider.of(context); + + RequestPrescriptionReport prescriptionReqModel = + RequestPrescriptionReport( + appointmentNo: widget.prescriptionResModel.appointmentNo, + episodeID: widget.prescriptionResModel.episodeID, + setupID: widget.prescriptionResModel.setupID, + patientTypeID: widget.prescriptionResModel.patientID); + patientsProvider.getPrescriptionReport(prescriptionReqModel.toJson()); + } + _isInit = false; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Prescription Details', + body: patientsProvider.isLoading + ? DrAppCircularProgressIndeicator() + : patientsProvider.isError + ? DrAppEmbeddedError(error: patientsProvider.error) + : CardWithBgWidgetNew( + widget: ListView.builder( + itemCount: patientsProvider.prescriptionReport.length, + itemBuilder: (BuildContext context, int index) { + return OutPatientPrescriptionDetailsItem( + prescriptionReport: + patientsProvider.prescriptionReport[index], + ); + }), + ), + ); + } +} + + diff --git a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart new file mode 100644 index 00000000..f4a8a395 --- /dev/null +++ b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart @@ -0,0 +1,192 @@ +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/util/helpers.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_bgNew_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class InpatientPrescriptionDetailsScreen extends StatefulWidget { + @override + _InpatientPrescriptionDetailsScreenState createState() => + _InpatientPrescriptionDetailsScreenState(); +} + +class _InpatientPrescriptionDetailsScreenState + extends State { + bool _showDetails = false; + String error; + TextEditingController answerController; + bool _isInit = true; + PrescriptionReportForInPatient prescription; + + @override + void initState() { + super.initState(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + prescription = routeArgs['prescription']; + } + _isInit = false; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Prescription info', + body: CardWithBgWidgetNew( + widget: Container( + child: ListView( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + prescription.itemDescription, + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + ), + children: [ + buildTableRow( + des: '${prescription.direction}', + key: 'Direction'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Refill'), + buildTableRow( + des: '${prescription.dose}', key: 'Dose'), + buildTableRow( + des: '${prescription.unitofMeasurement}', + key: 'UOM'), + buildTableRow( + des: + '${Helpers.getDate(prescription.startDatetime)}', + key: 'Start Date'), + buildTableRow( + des: + '${Helpers.getDate(prescription.stopDatetime)}', + key: 'Stop Date'), + buildTableRow( + des: '${prescription.noOfDoses}', + key: 'No of Doses'), + buildTableRow( + des: '${prescription.route}', key: 'Route'), + buildTableRow( + des: '${prescription.comments}', + key: 'Comments'), + buildTableRow( + des: '${prescription.pharmacyRemarks}', + key: 'Pharmacy Remarks'), + buildTableRow( + des: + '${Helpers.getDate(prescription.prescriptionDatetime)}', + key: 'Prescription Date'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Status'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Created By'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Processed By'), + buildTableRow( + des: '${prescription.refillID}', + key: 'Authorized By'), + ], + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + SizedBox( + height: 5, + ), + ], + ), + ) + ], + ), + ), + ), + ); + } + + TableRow buildTableRow({des, key}) { + print('$key: $des'); + return TableRow(children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Row( + children: [ + Expanded( + child: Container( + child: AppText( + key, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + '${des}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + textAlign: TextAlign.center, + ) + ], + ), + ), + ), + ], + ), + ), + ]); + } +} diff --git a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart new file mode 100644 index 00000000..fc212afe --- /dev/null +++ b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart @@ -0,0 +1,138 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/prescription_report.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class OutPatientPrescriptionDetailsItem extends StatefulWidget { + final PrescriptionReport prescriptionReport; + + OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); + + @override + _OutPatientPrescriptionDetailsItemState createState() => + _OutPatientPrescriptionDetailsItemState(); +} + +class _OutPatientPrescriptionDetailsItemState + extends State { + bool _showDetails = false; + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + flex: 5, + child: AppText( + '${widget.prescriptionReport.itemDescription} ', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + ), + children: [ + buildTableRow( + key: 'Route', + des: widget.prescriptionReport.route), + buildTableRow( + key: 'Frequency Timing', + des: widget.prescriptionReport.frequency), + buildTableRow(key: 'Insurance Covered', des: ''), + buildTableRow( + key: 'Duration Days', + des: widget.prescriptionReport.days), + buildTableRow( + key: 'IDoctor Remarks', + des: widget.prescriptionReport.remarks), + ], + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + ], + ), + ) + ], + ), + ); + } + + TableRow buildTableRow({des, key}) { + print('$key: $des'); + return TableRow(children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Row( + children: [ + Expanded( + child: Container( + child: AppText( + key, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + '${des}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + textAlign: TextAlign.center, + ) + ], + ), + ), + ), + ], + ), + ), + ]); + } +} \ No newline at end of file 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/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart index 3ee67312..1b77fd9a 100644 --- a/lib/widgets/auth/show_timer_text.dart +++ b/lib/widgets/auth/show_timer_text.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/auth_provider.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -34,6 +35,8 @@ class _ShowTimerTextState extends State { setState(() { sec = sec - 1; if (sec == 0 && min == 0) { + Navigator.of(context).pushNamed(LOGIN); + min = 0; sec = 0; } else if (sec == 0) { @@ -72,11 +75,10 @@ class _ShowTimerTextState extends State { resendActivatioinCode(); }, child: Text( - min == 0 && sec == 0 ? 'Resend Login Code' : timerText, + timerText, style: TextStyle( fontSize: 3.0 * SizeConfig.textMultiplier, - color: - min == 0 && sec == 0 ? Colors.blue : Hexcolor('#B8382C'), + color: Hexcolor('#B8382C'), fontWeight: FontWeight.bold), ), ), diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 9a4ad85c..feae82ce 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -100,6 +100,7 @@ class _VerifyAccountState extends State { child: TextFormField( textInputAction: TextInputAction.next, style: buildTextStyle(), + autofocus: true, maxLength: 1, textAlign: TextAlign.center, keyboardType: TextInputType.number, 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..cafa6290 --- /dev/null +++ b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart @@ -0,0 +1,87 @@ +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/routes.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: () { + Navigator.of(context).pushNamed(IN_PATIENT_PRESCRIPTIONS_DETAILS, arguments: { + 'prescription': prescriptionReportForInPatientList[index] + }); + }, + 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..bedd6427 --- /dev/null +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -0,0 +1,94 @@ +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/screens/patients/out_patient_prescription_details_screen.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: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + OutPatientPrescriptionDetailsScreen( + prescriptionResModel: + patientPrescriptionsList[index], + ), + ), + ); + }, + 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, + ), + ], + ), + ), + ) + ], + ), + ], + ), + )); + }, + ), + ), + ); + } +}