From 954402fe52c372b5dbef1a41a2ac15bc6de89c31 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 16 Feb 2022 12:27:13 +0200 Subject: [PATCH] show the list of prescription --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 1 + .../prescription_entity_model.dart | 145 ++++++++ .../Prescriptions/prescription_model.dart | 154 +-------- .../prescription/prescription_service.dart | 12 + .../prescription/prescription_view_model.dart | 3 + lib/screens/live_care/end_call_screen.dart | 2 +- .../profile/UCAF/UCAF-detail-screen.dart | 3 +- ...l.dart => patient_profile_card_model.dart} | 0 .../profile_gird_for_InPatient.dart | 6 +- .../profile_gird_for_other.dart | 6 +- .../profile_gird_for_search.dart | 6 +- .../prescription/new_prescriptions_page.dart | 321 ++++++++---------- lib/util/translations_delegate_base.dart | 1 + ...rofile_medical_info_widget_in_patient.dart | 4 +- 15 files changed, 327 insertions(+), 341 deletions(-) create mode 100644 lib/core/model/Prescriptions/prescription_entity_model.dart rename lib/screens/patients/profile/profile_screen/{PatientProfileCardModel.dart => patient_profile_card_model.dart} (100%) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4d7f3828..11c6dfbc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index bb8b1b1c..6dcf5968 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1135,4 +1135,5 @@ const Map> localizedValues = { "sorryNoMatch": {"en": "Sorry No Match", "ar": "عذرا لا يوجد تطابق"}, "thousandIsTheMAXForTheStrength": {"en": "1000 Is The MAX For The Strength", "ar": "ألف هو القيمة الأعلى"}, "strengthCanNotBeZero": {"en": "Strength Can't Be Zero", "ar": "القوة لا يمكن أن تكون صفر "}, + "old": {"en": "Old", "ar":"القديمه"}, }; diff --git a/lib/core/model/Prescriptions/prescription_entity_model.dart b/lib/core/model/Prescriptions/prescription_entity_model.dart new file mode 100644 index 00000000..166cd599 --- /dev/null +++ b/lib/core/model/Prescriptions/prescription_entity_model.dart @@ -0,0 +1,145 @@ +class PrescriptionEntityModel { + dynamic appointmentNo; + dynamic clinicName; + dynamic createdBy; + dynamic createdOn; + dynamic doctorName; + dynamic doseDailyQuantity; + dynamic doseDailyUnitID; + dynamic doseDetail; + dynamic doseDurationDays; + dynamic doseTimingID; + dynamic episodeID; + dynamic frequencyID; + dynamic icdCode10ID; + dynamic indication; + dynamic isDispensed; + dynamic isMedicineCovered; + dynamic isSIG; + dynamic medicationName; + dynamic medicationPrice; + dynamic medicineCode; + dynamic orderTypeDescription; + dynamic qty; + dynamic quantity; + dynamic remarks; + dynamic routeID; + dynamic startDate; + dynamic status; + dynamic stopDate; + dynamic uom; + dynamic pharmacistRemarks; + dynamic pharmacyInervention; + dynamic refill; + dynamic mediSpanGPICode; + + PrescriptionEntityModel( + {this.appointmentNo, + this.clinicName, + this.createdBy, + this.createdOn, + this.doctorName, + this.doseDailyQuantity, + this.doseDailyUnitID, + this.doseDetail, + this.doseDurationDays, + this.doseTimingID, + this.episodeID, + this.frequencyID, + this.icdCode10ID, + this.indication, + this.isDispensed, + this.isMedicineCovered, + this.isSIG, + this.medicationName, + this.medicationPrice, + this.medicineCode, + this.orderTypeDescription, + this.qty, + this.quantity, + this.remarks, + this.routeID, + this.startDate, + this.status, + this.stopDate, + this.uom, + this.pharmacistRemarks, + this.mediSpanGPICode, + this.pharmacyInervention, + this.refill}); + + PrescriptionEntityModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + clinicName = json['clinicName']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + doctorName = json['doctorName']; + doseDailyQuantity = json['doseDailyQuantity']; + doseDailyUnitID = json['doseDailyUnitID']; + doseDetail = json['doseDetail']; + doseDurationDays = json['doseDurationDays']; + doseTimingID = json['doseTimingID']; + episodeID = json['episodeID']; + frequencyID = json['frequencyID']; + icdCode10ID = json['icdCode10ID']; + indication = json['indication']; + isDispensed = json['isDispensed']; + isMedicineCovered = json['isMedicineCovered']; + isSIG = json['isSIG']; + medicationName = json['medicationName']; + medicationPrice = json['medicationPrice']; + medicineCode = json['medicineCode']; + orderTypeDescription = json['orderTypeDescription']; + qty = json['qty']; + quantity = json['quantity']; + remarks = json['remarks']; + routeID = json['routeID']; + startDate = json['startDate']; + status = json['status']; + stopDate = json['stopDate']; + uom = json['uom']; + pharmacistRemarks = json['pharmacistRemarks']; + mediSpanGPICode = json['mediSpanGPICode']; + refill = json['refill']; + pharmacyInervention = json['interventionID']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['clinicName'] = this.clinicName; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['doctorName'] = this.doctorName; + data['doseDailyQuantity'] = this.doseDailyQuantity; + data['doseDailyUnitID'] = this.doseDailyUnitID; + data['doseDetail'] = this.doseDetail; + data['doseDurationDays'] = this.doseDurationDays; + data['doseTimingID'] = this.doseTimingID; + data['episodeID'] = this.episodeID; + data['frequencyID'] = this.frequencyID; + data['icdCode10ID'] = this.icdCode10ID; + data['indication'] = this.indication; + data['isDispensed'] = this.isDispensed; + data['isMedicineCovered'] = this.isMedicineCovered; + data['isSIG'] = this.isSIG; + data['medicationName'] = this.medicationName; + data['medicationPrice'] = this.medicationPrice; + data['medicineCode'] = this.medicineCode; + data['orderTypeDescription'] = this.orderTypeDescription; + data['qty'] = this.qty; + data['quantity'] = this.quantity; + data['remarks'] = this.remarks; + data['routeID'] = this.routeID; + data['startDate'] = this.startDate; + data['status'] = this.status; + data['stopDate'] = this.stopDate; + data['uom'] = this.uom; + data['pharmacistRemarks'] = this.pharmacistRemarks; + data['mediSpanGPICode'] = this.mediSpanGPICode; + data['refill'] = this.refill; + data['interventionID'] = this.pharmacyInervention; + + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/Prescriptions/prescription_model.dart b/lib/core/model/Prescriptions/prescription_model.dart index 52c3edec..a286908f 100644 --- a/lib/core/model/Prescriptions/prescription_model.dart +++ b/lib/core/model/Prescriptions/prescription_model.dart @@ -1,5 +1,7 @@ +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; + class PrescriptionModel { - List entityList; + List entityList; dynamic rowcount; dynamic statusMessage; @@ -7,9 +9,9 @@ class PrescriptionModel { PrescriptionModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = new List(); json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList.add(new PrescriptionEntityModel.fromJson(v)); }); } rowcount = json['rowcount']; @@ -26,149 +28,3 @@ class PrescriptionModel { return data; } } - -class EntityList { - dynamic appointmentNo; - dynamic clinicName; - dynamic createdBy; - dynamic createdOn; - dynamic doctorName; - dynamic doseDailyQuantity; - dynamic doseDailyUnitID; - dynamic doseDetail; - dynamic doseDurationDays; - dynamic doseTimingID; - dynamic episodeID; - dynamic frequencyID; - dynamic icdCode10ID; - dynamic indication; - dynamic isDispensed; - dynamic isMedicineCovered; - dynamic isSIG; - dynamic medicationName; - dynamic medicationPrice; - dynamic medicineCode; - dynamic orderTypeDescription; - dynamic qty; - dynamic quantity; - dynamic remarks; - dynamic routeID; - dynamic startDate; - dynamic status; - dynamic stopDate; - dynamic uom; - dynamic pharmacistRemarks; - dynamic pharmacyInervention; - dynamic refill; - dynamic mediSpanGPICode; - - EntityList( - {this.appointmentNo, - this.clinicName, - this.createdBy, - this.createdOn, - this.doctorName, - this.doseDailyQuantity, - this.doseDailyUnitID, - this.doseDetail, - this.doseDurationDays, - this.doseTimingID, - this.episodeID, - this.frequencyID, - this.icdCode10ID, - this.indication, - this.isDispensed, - this.isMedicineCovered, - this.isSIG, - this.medicationName, - this.medicationPrice, - this.medicineCode, - this.orderTypeDescription, - this.qty, - this.quantity, - this.remarks, - this.routeID, - this.startDate, - this.status, - this.stopDate, - this.uom, - this.pharmacistRemarks, - this.mediSpanGPICode, - this.pharmacyInervention, - this.refill}); - - EntityList.fromJson(Map json) { - appointmentNo = json['appointmentNo']; - clinicName = json['clinicName']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - doctorName = json['doctorName']; - doseDailyQuantity = json['doseDailyQuantity']; - doseDailyUnitID = json['doseDailyUnitID']; - doseDetail = json['doseDetail']; - doseDurationDays = json['doseDurationDays']; - doseTimingID = json['doseTimingID']; - episodeID = json['episodeID']; - frequencyID = json['frequencyID']; - icdCode10ID = json['icdCode10ID']; - indication = json['indication']; - isDispensed = json['isDispensed']; - isMedicineCovered = json['isMedicineCovered']; - isSIG = json['isSIG']; - medicationName = json['medicationName']; - medicationPrice = json['medicationPrice']; - medicineCode = json['medicineCode']; - orderTypeDescription = json['orderTypeDescription']; - qty = json['qty']; - quantity = json['quantity']; - remarks = json['remarks']; - routeID = json['routeID']; - startDate = json['startDate']; - status = json['status']; - stopDate = json['stopDate']; - uom = json['uom']; - pharmacistRemarks = json['pharmacistRemarks']; - mediSpanGPICode = json['mediSpanGPICode']; - refill = json['refill']; - pharmacyInervention = json['interventionID']; - } - - Map toJson() { - final Map data = new Map(); - data['appointmentNo'] = this.appointmentNo; - data['clinicName'] = this.clinicName; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['doctorName'] = this.doctorName; - data['doseDailyQuantity'] = this.doseDailyQuantity; - data['doseDailyUnitID'] = this.doseDailyUnitID; - data['doseDetail'] = this.doseDetail; - data['doseDurationDays'] = this.doseDurationDays; - data['doseTimingID'] = this.doseTimingID; - data['episodeID'] = this.episodeID; - data['frequencyID'] = this.frequencyID; - data['icdCode10ID'] = this.icdCode10ID; - data['indication'] = this.indication; - data['isDispensed'] = this.isDispensed; - data['isMedicineCovered'] = this.isMedicineCovered; - data['isSIG'] = this.isSIG; - data['medicationName'] = this.medicationName; - data['medicationPrice'] = this.medicationPrice; - data['medicineCode'] = this.medicineCode; - data['orderTypeDescription'] = this.orderTypeDescription; - data['qty'] = this.qty; - data['quantity'] = this.quantity; - data['remarks'] = this.remarks; - data['routeID'] = this.routeID; - data['startDate'] = this.startDate; - data['status'] = this.status; - data['stopDate'] = this.stopDate; - data['uom'] = this.uom; - data['pharmacistRemarks'] = this.pharmacistRemarks; - data['mediSpanGPICode'] = this.mediSpanGPICode; - data['refill'] = this.refill; - data['interventionID'] = this.pharmacyInervention; - - return data; - } -} diff --git a/lib/core/service/patient_medical_file/prescription/prescription_service.dart b/lib/core/service/patient_medical_file/prescription/prescription_service.dart index d2ad393e..99d24fb4 100644 --- a/lib/core/service/patient_medical_file/prescription/prescription_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescription_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_i import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; @@ -31,6 +32,11 @@ class PrescriptionService extends LookupService { List _prescriptionList = List(); List get prescriptionList => _prescriptionList; + + List _prescriptionListNew = List(); + + List get prescriptionListNew => _prescriptionListNew; + List _drugsList = List(); List get drugsList => _drugsList; @@ -99,10 +105,16 @@ class PrescriptionService extends LookupService { ); hasError = false; _prescriptionList.clear(); + _prescriptionListNew.clear(); await baseAppClient.post(GET_PRESCRIPTION_LIST, onSuccess: (dynamic response, int statusCode) { _prescriptionList .add(PrescriptionModel.fromJson(response['PrescriptionList'])); + if(response['PrescriptionList']!=null){ + response['PrescriptionList']["entityList"].forEach((prescriptions) { + _prescriptionListNew.add(PrescriptionEntityModel.fromJson(prescriptions)); + }); + } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModel/prescription/prescription_view_model.dart b/lib/core/viewModel/prescription/prescription_view_model.dart index 5fc44a77..3c2b38a6 100644 --- a/lib/core/viewModel/prescription/prescription_view_model.dart +++ b/lib/core/viewModel/prescription/prescription_view_model.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; @@ -29,6 +30,8 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionList => _prescriptionService.prescriptionList; + List get prescriptionListNew => + _prescriptionService.prescriptionListNew; List get prescriptionReportList => _prescriptionService.prescriptionReportList; diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index 6cd610c7..a68eff56 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/core/model/livecare/session_status_model.dart import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/live_care/live-care_transfer_to_admin.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart'; import 'package:doctor_app_flutter/util/VideoChannel.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 658b99e4..c7b51da3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart'; @@ -339,7 +340,7 @@ class DiagnosisWidget extends StatelessWidget { class MedicationWidget extends StatelessWidget { final UcafViewModel model; - final EntityList prescription; + final PrescriptionEntityModel prescription; MedicationWidget(this.model, this.prescription); diff --git a/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart b/lib/screens/patients/profile/profile_screen/patient_profile_card_model.dart similarity index 100% rename from lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart rename to lib/screens/patients/profile/profile_screen/patient_profile_card_model.dart diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 4382bca7..ed9e2c1d 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:flutter/material.dart'; @@ -60,13 +60,13 @@ class ProfileGridForInPatient extends StatelessWidget { isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).patient, - TranslationBase.of(context).prescription, + TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).patient, - TranslationBase.of(context).prescription +"Elham", + TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW_By_Elham, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index cfe0cb8a..0ff600a6 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:flutter/material.dart'; @@ -58,13 +58,13 @@ class ProfileGridForOther extends StatelessWidget { isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).orders, - TranslationBase.of(context).prescription, + TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).patient, - TranslationBase.of(context).prescription +"Elham", + TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW_By_Elham, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart index 3f9ae85c..21f5823e 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart @@ -1,5 +1,5 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:flutter/material.dart'; @@ -55,13 +55,13 @@ class ProfileGridForSearch extends StatelessWidget { isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).orders, - TranslationBase.of(context).prescription, + TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).patient, - TranslationBase.of(context).prescription +"Elham", + TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW_By_Elham, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), diff --git a/lib/screens/prescription/new_prescriptions_page.dart b/lib/screens/prescription/new_prescriptions_page.dart index d672ad7c..71653de9 100644 --- a/lib/screens/prescription/new_prescriptions_page.dart +++ b/lib/screens/prescription/new_prescriptions_page.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -11,8 +12,10 @@ import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.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/card_with_bg_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/CusomRow.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'; @@ -26,188 +29,152 @@ class NewPrescriptionsPage extends StatelessWidget { Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; bool isInpatient = routeArgs['isInpatient']; bool isFromLiveCare = routeArgs['isFromLiveCare']; return BaseView( - onModelReady: (model) async { - model.getPrescriptionListNew( - mrn: patient.patientMRN, appNo: patient.appointmentNo); - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - backgroundColor: Colors.grey[100], - appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, - ), - body: patient.admissionNo == null - ? FractionallySizedBox( - widthFactor: 1.0, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ServiceTitle( - title: TranslationBase.of(context).orders, - subTitle: - TranslationBase.of(context).prescriptions, - ), - ], - ), - ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || - (isFromLiveCare && patient.appointmentNo != null)) - AddNewOrder( - onTap: () { - Navigator.push( - context, - SlideUpPageRoute( - widget: BaseAddProcedureTabPage( - patient: patient, - prescriptionModel: model, - procedureType: - ProcedureType.PRESCRIPTION, - ), - settingRoute: 'AddProcedureTabPage'), - ); - }, - label: TranslationBase.of(context) - .applyForNewPrescriptionsOrder, - ), - ListView.builder( - physics: BouncingScrollPhysics(), - itemCount: model.prescriptionsList.length, - shrinkWrap: true, - itemBuilder: (BuildContext ctxt, int index) { - return InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionItemsPage( - prescriptions: model - .prescriptionsList[index], - patient: patient, - arrivalType: arrivalType, - ), - ), - ), - child: Column( - children: [ - DoctorCard( - doctorName: - Helpers.convertToTitleCase(model - .prescriptionsList[index] - .doctorName), - profileUrl: model - .prescriptionsList[index] - .doctorImageURL, - branch: model - .prescriptionsList[index].name, - clinic: model.prescriptionsList[index] - .clinicDescription, - isPrescriptions: true, - appointmentDate: AppDateUtils - .getDateTimeFromServerFormat( - model.prescriptionsList[index] - .appointmentDate, - ), - ), - ], - )); - }), - if (model.prescriptionsList.isEmpty && - patient.patientStatusType != 43) - Center( - child: ErrorMessage( - error: TranslationBase.of(context) - .noPrescriptionsFound, - )) - ], - ), + onModelReady: (model) async { + model.getPrescriptionListNew( + mrn: patient.patientMRN, appNo: patient.appointmentNo); + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + backgroundColor: Colors.grey[100], + appBar: PatientProfileAppBar( + patient, + isInpatient: isInpatient, + ), + body: FractionallySizedBox( + widthFactor: 1.0, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ServiceTitle( + title: TranslationBase.of(context).orders, + subTitle: TranslationBase.of(context).prescriptions, + ), + ], + ), + ), + if ((patient.patientStatusType != null && + patient.patientStatusType == 43) || + (isFromLiveCare && patient.appointmentNo != null)) + AddNewOrder( + onTap: () { + Navigator.push( + context, + SlideUpPageRoute( + widget: BaseAddProcedureTabPage( + patient: patient, + prescriptionModel: model, + procedureType: ProcedureType.PRESCRIPTION, + ), + settingRoute: 'AddProcedureTabPage'), + ); + }, + label: TranslationBase.of(context) + .applyForNewPrescriptionsOrder, ), - ) - : NetworkBaseView( - baseViewModel: model, + Center( child: FractionallySizedBox( - widthFactor: 1.0, - child: ListView( - physics: BouncingScrollPhysics(), - children: [ - model.medicationForInPatient.length == 0 - ? Center( - child: ErrorMessage( - error: TranslationBase.of(context) - .noPrescriptionsFound, - )) - : ListView.builder( - scrollDirection: Axis.vertical, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: - model.medicationForInPatient.length, - itemBuilder: (context, index) { - //model.medicationForInPatient.length, - return InkWell( - child: InPatientDoctorCard( - doctorName: Helpers.convertToTitleCase( - model.medicationForInPatient[index] - .pHRItemDescription), - profileUrl: 'sss', - branch: 'hamza', - clinic: 'basheer', - isPrescriptions: true, - appointmentDate: AppDateUtils - .getDateTimeFromServerFormat( - model.medicationForInPatient[index] - .prescriptionDatetime, - ), - createdBy: Helpers.convertToTitleCase( - model.medicationForInPatient[index] - .doctorName - .toString()), - ), - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionItemsInPatientPage( - prescriptionIndex: 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, - ), - ), - ), - ), - ); - }), - ], - ), + widthFactor: 0.92, + child: ListView.builder( + physics: BouncingScrollPhysics(), + itemCount: model.prescriptionListNew.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return InkWell( + child: CardWithBgWidget( + bgColor: Colors.transparent, + widget: Column( + children: [ + CustomRow( + label: "", + value: Helpers.convertToTitleCase(model + .prescriptionListNew[index] + .medicationName), + valueSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.5, + ), + SizedBox( + height: 10, + ), + CustomRow( + label: "Doctor Name :", + value: model + .prescriptionListNew[index].doctorName, + ), + CustomRow( + label: "Order Type Description :", + value: model.prescriptionListNew[index] + .orderTypeDescription, + ), + CustomRow( + label: "status :", + value: + model.prescriptionListNew[index].status, + ), + CustomRow( + label: "indication :", + value: model + .prescriptionListNew[index].indication, + ), + CustomRow( + label: "doseDetail :", + value: model + .prescriptionListNew[index].doseDetail, + ), + CustomRow( + label: "quantity :", + value: model + .prescriptionListNew[index].quantity + .toString(), + ),CustomRow( + label: "start Date :", + value: model + .prescriptionListNew[index].startDate + .toString(), + ),CustomRow( + label: "stop Date :", + value: model + .prescriptionListNew[index].stopDate + .toString(), + ), + if(model + .prescriptionListNew[index].remarks != null&& model + .prescriptionListNew[index].remarks!= "") + CustomRow( + label: "Remark :", + value: model + .prescriptionListNew[index].remarks + .toString(), + ), + ], + ), + )); + }), ), - ))); + ), + if (model.prescriptionListNew.isEmpty && + patient.patientStatusType != 43) + Center( + child: ErrorMessage( + error: TranslationBase.of(context).noPrescriptionsFound, + )) + ], + ), + ), + )), + ); } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index f2382a88..43ae8e56 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1709,6 +1709,7 @@ class TranslationBase { String get thousandIsTheMAXForTheStrength => localizedValues['thousandIsTheMAXForTheStrength'][locale.languageCode]; String get strengthCanNotBeZero => localizedValues['strengthCanNotBeZero'][locale.languageCode]; + String get old => localizedValues['old'][locale.languageCode]; } diff --git a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart index 21618fd7..48a96bf0 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_in_patient.dart @@ -77,7 +77,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { arrivalType: arrivalType, route: ORDER_PRESCRIPTION_NEW, nameLine1: TranslationBase.of(context).patient, - nameLine2: TranslationBase.of(context).prescription, + nameLine2:TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', icon: 'assets/images/svgs/profile_screen/order prescription.svg'), PatientProfileButton( key: key, @@ -86,7 +86,7 @@ class ProfileMedicalInfoWidgetInPatient extends StatelessWidget { arrivalType: arrivalType, route: ORDER_PRESCRIPTION_NEW_By_Elham, nameLine1: TranslationBase.of(context).patient, - nameLine2: TranslationBase.of(context).prescription +"Elham", + nameLine2: TranslationBase.of(context).prescription, icon: 'assets/images/svgs/profile_screen/order prescription.svg'), PatientProfileButton( key: key,