diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0bb783d9..c5460859 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -995,7 +995,7 @@ const Map> localizedValues = { "historyPhysicalFinding": {"en": "History and Physical Finding", "ar": "التاريخ والاكتشاف المادي"}, "laboratoryPhysicalData": {"en": "Laboratory and Physical Data", "ar": "المعامل والبيانات الفيزيائية"}, "impressionRecommendation": {"en": "Impression and Recommendation", "ar": "الانطباع والتوصية"}, - "onHold": {"en": "'On Hold'", "ar": "قيد الانتظار"}, - "verified": {"en": "Verified", "ar": "Verified"}, + "onHold": {"en": "On Hold", "ar": "قيد الانتظار"}, + "verified": {"en": "Verified", "ar": "تم التحقق"}, "endCall": {"en": "End Call", "ar": "انهاء"}, }; diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart index aa81e8a6..94933d7d 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -14,6 +14,7 @@ class PatientMedicalReportService extends BaseService { await getDoctorProfile(); body['AdmissionNo'] = patient.admissionNo; body['SetupID'] = doctorProfile.setupID; + body['ProjectID'] = doctorProfile.projectID; await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index 90e9b327..5b4b7e4c 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -128,25 +128,28 @@ class LabsViewModel extends BaseViewModel { error = _labsService.error; setState(ViewState.Error); } else { - _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = labResultLists - .where( - (elementClinic) => elementClinic.filterName == element.testCode) - .toList(); - - if (patientLabOrdersClinic.length != 0) { - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .add(element); - } else { - labResultLists - .add(LabResultList(filterName: element.testCode, lab: element)); - } - }); setState(ViewState.Idle); } } + void setLabResultDependOnFilterName(){ + _labsService.labResultList.forEach((element) { + List patientLabOrdersClinic = labResultLists + .where( + (elementClinic) => elementClinic.filterName == element.testCode) + .toList(); + + if (patientLabOrdersClinic.length != 0) { + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] + .patientLabResultList + .add(element); + } else { + labResultLists + .add(LabResultList(filterName: element.testCode, lab: element)); + } + }); + } + getPatientLabOrdersResults( {PatientLabOrders patientLabOrder, String procedure, diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart deleted file mode 100644 index bbc968b0..00000000 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ /dev/null @@ -1,307 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_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/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-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/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -import '../../../../routes.dart'; - -class AdmissionRequestDetailScreen extends StatefulWidget { - @override - _AdmissionRequestDetailScreenState createState() => - _AdmissionRequestDetailScreenState(); -} - -class _AdmissionRequestDetailScreenState - extends State { - DateTime selectedDate; - dynamic _selectedSpeciality; - dynamic _selectedDoctor; - - @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - final screenSize = MediaQuery.of(context).size; - ProjectViewModel projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) => model.getSpecialityList(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).admissionRequest, - body: model.doctorsList != null - ? Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PatientPageHeaderWidget(patient), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).patientDetails, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - decoration: - Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), - Color(0xFFCCCCCC), - borderWidth: 0.0), - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - "Pre Admission Number :01", - null, - false), - enabled: false, - // controller: _remarksController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () => _selectDate(context, model), - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).date, - selectedDate != null - ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .specialityAndDoctorDetail, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.speciality, - attributeName: - projectViewModel.isArabic - ? 'nameAr' - : 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedSpeciality = - selectedValue; - }); - }); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .speciality, - _selectedSpeciality != null - ? projectViewModel.isArabic - ? _selectedSpeciality[ - 'nameAr'] - : _selectedSpeciality[ - 'nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .doctorSearch, - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .doctor, - _selectedDoctor != null - ? _selectedDoctor[ - 'DoctorName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - decoration: Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), Color(0xFFCCCCCC), - borderWidth: 0.0), - child: InkWell( - onTap: () => null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .referringDate, - null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Color(0xFFCCCCCC), - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - decoration: - Helpers.containerBorderDecoration( - Color(0xFFEEEEEE), - Color(0xFFCCCCCC), - borderWidth: 0.0), - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .referringDoctor, - null, - true, - dropDownColor: Color(0xFFCCCCCC)), - enabled: false, - // controller: _remarksController, - keyboardType: TextInputType.text, - )), - ], - ), - ), - ], - ), - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () { - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_2, - arguments: {'patient': patient}); - }, - ), - ), - ], - ) - : Container(), - ), - ); - } - - _selectDate(BuildContext context, AdmissionRequestViewModel model) async { - selectedDate = DateTime.now(); - final DateTime picked = await showDatePicker( - context: context, - initialDate: selectedDate, - firstDate: DateTime.now().add(Duration(hours: 2)), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, - ); - if (picked != null && picked != selectedDate) { - setState(() { - selectedDate = picked; - }); - } - } -} diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart index d23397da..08a69907 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -453,20 +453,6 @@ class _AdmissionRequestThirdScreenState ); } - Future _selectDate(BuildContext context, DateTime dateTime, - Function(DateTime picked) updateDate) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: dateTime, - firstDate: DateTime.now(), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, - ); - if (picked != null && picked != dateTime) { - updateDate(picked); - } - } - void openListDialogField(String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index 4670e2d1..3aae6e69 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -61,18 +61,17 @@ class _LaboratoryResultPageState extends State { body: SingleChildScrollView( child: Column( children: [ - ...List.generate( - model.patientLabSpecialResult.length, - (index) => LaboratoryResultWidget( - onTap: () async {}, - billNo: widget.patientLabOrders.invoiceNo, - details: model - .patientLabSpecialResult[index].resultDataHTML, - orderNo: widget.patientLabOrders.orderNo, - patientLabOrder: widget.patientLabOrders, - patient: widget.patient, - isInpatient: widget.patientType == "1", - )), + LaboratoryResultWidget( + onTap: () async {}, + billNo: widget.patientLabOrders.invoiceNo, + details: model + .patientLabSpecialResult.length > 0 ? model + .patientLabSpecialResult[0].resultDataHTML : null, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, + patient: widget.patient, + isInpatient: widget.patientType == "1", + ), ], ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 1bdc49cf..08c247ee 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_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/patients/profile/lab_result/LabResultWidget.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; @@ -45,7 +46,8 @@ class _LaboratoryResultWidgetState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - // onModelReady: (model) => model.getPatientLabResult( + onModelReady: (model) => model.setLabResultDependOnFilterName(), + // model.getPatientLabResult( // patientLabOrder: widget.patientLabOrder, // patient: widget.patient, // isInpatient: widget.isInpatient), @@ -130,8 +132,11 @@ class _LaboratoryResultWidgetState extends State { model.labResultLists.length, (index) => LabResultWidget( patientLabOrder: widget.patientLabOrder, - filterName: model.labResultLists[index].filterName, - patientLabResultList: model.labResultLists[index].patientLabResultList, + filterName: model + .labResultLists[index].filterName, + patientLabResultList: model + .labResultLists[index] + .patientLabResultList, patient: widget.patient, isInpatient: widget.isInpatient, ), @@ -143,76 +148,85 @@ class _LaboratoryResultWidgetState extends State { ], ), ), - SizedBox(height: 15,), - if(widget.details!=null && widget.details.isNotEmpty) - Column( - children: [ - InkWell( - onTap: () { - setState(() { - _isShowMore = !_isShowMore; - }); - }, - child: Container( - padding: EdgeInsets.all(10.0), - margin: EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(5.0), - )), - child: Row( - children: [ - Expanded( - child: Container( - margin: EdgeInsets.only( - left: 10, right: 10), - child: AppText( - TranslationBase.of(context) - .specialResult, - bold: true, - ))), - Container( - width: 25, - height: 25, - child: Icon( - _isShowMore - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down, - color: Colors.grey[800], - size: 22, - ), - ) - ], + SizedBox( + height: 15, + ), + if (widget.details != null && widget.details.isNotEmpty) + Column( + children: [ + InkWell( + onTap: () { + setState(() { + _isShowMore = !_isShowMore; + }); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .specialResult, + bold: true, + ))), + Container( + width: 25, + height: 25, + child: Icon( + _isShowMore + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Colors.grey[800], + size: 22, + ), + ) + ], + ), ), ), - ), - if (_isShowMore) - AnimatedContainer( - padding: EdgeInsets.all(10.0), - margin: EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(5.0), - bottomRight: Radius.circular(5.0), - )), - duration: Duration(milliseconds: 7000), - child: Container( + if (_isShowMore) + AnimatedContainer( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + )), + duration: Duration(milliseconds: 7000), + child: Container( width: double.infinity, - child: Html( - data: widget.details ?? TranslationBase.of(context).noDataAvailable, - )), + child: !Helpers.isTextHtml(widget.details) + ? AppText( + widget.details ?? + TranslationBase.of(context) + .noDataAvailable, + ) + : Html( + data: widget.details ?? + TranslationBase.of(context) + .noDataAvailable, + ), + ), + ), + SizedBox( + height: 10, ), - SizedBox( - height: 10, - ), - ], - ), - - + ], + ), ], ), ], diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 5e71dbd6..b54d4837 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -14,7 +14,6 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head 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_bg_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -94,7 +93,7 @@ class MedicalReportPage extends StatelessWidget { model.medicalReportList.length, (index) => CardWithBgWidget( hasBorder: false, - bgColor: model.medicalReportList[index].status == 0 + bgColor: model.medicalReportList[index].status == 1 ? Colors.red[700] : Colors.green[700], widget: Column( @@ -106,10 +105,12 @@ class MedicalReportPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - model.medicalReportList[index].status == 0 + model.medicalReportList[index].status == 1 ? TranslationBase.of(context).onHold : TranslationBase.of(context).verified, - color: Colors.red, + color: model.medicalReportList[index].status == 1 + ? Colors.red[700] + : Colors.green[700], ), AppText( "Jammal" ?? "", @@ -123,13 +124,17 @@ class MedicalReportPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}', + '${AppDateUtils.convertDateFromServerFormat( + model.medicalReportList[index].editedOn, + "dd/MM/yyyy")}', color: Colors.black, fontWeight: FontWeight.w600, fontSize: 14, ), AppText( - '${AppDateUtils.getHour(DateTime.now())}', + '${AppDateUtils.convertDateFromServerFormat( + model.medicalReportList[index].editedOn, + "hh:mm a")}', fontWeight: FontWeight.w600, color: Colors.grey[700], fontSize: 14, @@ -154,7 +159,7 @@ class MedicalReportPage extends StatelessWidget { InkWell( onTap: () { if (model.medicalReportList[index].status == - 0) { + 1) { Navigator.of(context).pushNamed( PATIENT_MEDICAL_REPORT_INSERT, arguments: { @@ -178,7 +183,7 @@ class MedicalReportPage extends StatelessWidget { } }, child: Icon( - model.medicalReportList[index].status == 0 + model.medicalReportList[index].status == 1 ? EvaIcons.eye : DoctorApp.edit_1, ), diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 7f72435f..634abd02 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -50,7 +50,7 @@ class Helpers { color: Colors.green[600], ), AppButton( - onPressed: (){ + onPressed: () { Navigator.of(context).pop(); }, title: TranslationBase.of(context).cancel, @@ -265,4 +265,9 @@ class Helpers { return str; } } + + static bool isTextHtml(String text) { + var htmlRegex = RegExp("<(“[^”]*”|'[^’]*’|[^'”>])*>"); + return htmlRegex.hasMatch(text); + } }