diff --git a/lib/config/config.dart b/lib/config/config.dart index d0ff0df9..c483f6f0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -125,6 +125,7 @@ const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLab const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail'; const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; +const GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION = 'Services/Patients.svc/REST/GetPatientLabOrdersResultsHistoryByDescription'; // SOAP diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 56b3fde8..fede6a45 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -709,5 +709,6 @@ const Map> localizedValues = { "Completed": {"en": "Completed", "ar": "مكتمل"}, "Locked": {"en": "Locked", "ar": "مقفل"}, "textCopiedSuccessfully": {"en": "Text copied successfully", "ar": "تم نسخ النص بنجاح"}, + "roomNo": {"en": "Room No", "ar": "رقم الغرفة"}, }; diff --git a/lib/core/model/labs/LabResultHistory.dart b/lib/core/model/labs/LabResultHistory.dart new file mode 100644 index 00000000..7c4221ca --- /dev/null +++ b/lib/core/model/labs/LabResultHistory.dart @@ -0,0 +1,108 @@ +class LabResultHistory { + String description; + String femaleInterpretativeData; + int gender; + bool isCertificateAllowed; + int lineItemNo; + String maleInterpretativeData; + String notes; + int orderLineItemNo; + int orderNo; + String packageID; + int patientID; + String projectID; + String referanceRange; + String resultValue; + int resultValueBasedLineItemNo; + String resultValueFlag; + String sampleCollectedOn; + String sampleReceivedOn; + String setupID; + String superVerifiedOn; + String testCode; + String uOM; + String verifiedOn; + String verifiedOnDateTime; + + LabResultHistory( + {this.description, + this.femaleInterpretativeData, + this.gender, + this.isCertificateAllowed, + this.lineItemNo, + this.maleInterpretativeData, + this.notes, + this.orderLineItemNo, + this.orderNo, + this.packageID, + this.patientID, + this.projectID, + this.referanceRange, + this.resultValue, + this.resultValueBasedLineItemNo, + this.resultValueFlag, + this.sampleCollectedOn, + this.sampleReceivedOn, + this.setupID, + this.superVerifiedOn, + this.testCode, + this.uOM, + this.verifiedOn, + this.verifiedOnDateTime}); + + LabResultHistory.fromJson(Map json) { + description = json['Description']; + femaleInterpretativeData = json['FemaleInterpretativeData']; + gender = json['Gender']; + isCertificateAllowed = json['IsCertificateAllowed']; + lineItemNo = json['LineItemNo']; + maleInterpretativeData = json['MaleInterpretativeData']; + notes = json['Notes']; + orderLineItemNo = json['OrderLineItemNo']; + orderNo = json['OrderNo']; + packageID = json['PackageID']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + referanceRange = json['ReferanceRange']; + resultValue = json['ResultValue']; + resultValueBasedLineItemNo = json['ResultValueBasedLineItemNo']; + resultValueFlag = json['ResultValueFlag']; + sampleCollectedOn = json['SampleCollectedOn']; + sampleReceivedOn = json['SampleReceivedOn']; + setupID = json['SetupID']; + superVerifiedOn = json['SuperVerifiedOn']; + testCode = json['TestCode']; + uOM = json['UOM']; + verifiedOn = json['VerifiedOn']; + verifiedOnDateTime = json['VerifiedOnDateTime']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['FemaleInterpretativeData'] = this.femaleInterpretativeData; + data['Gender'] = this.gender; + data['IsCertificateAllowed'] = this.isCertificateAllowed; + data['LineItemNo'] = this.lineItemNo; + data['MaleInterpretativeData'] = this.maleInterpretativeData; + data['Notes'] = this.notes; + data['OrderLineItemNo'] = this.orderLineItemNo; + data['OrderNo'] = this.orderNo; + data['PackageID'] = this.packageID; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ReferanceRange'] = this.referanceRange; + data['ResultValue'] = this.resultValue; + data['ResultValueBasedLineItemNo'] = this.resultValueBasedLineItemNo; + data['ResultValueFlag'] = this.resultValueFlag; + data['SampleCollectedOn'] = this.sampleCollectedOn; + data['SampleReceivedOn'] = this.sampleReceivedOn; + data['SetupID'] = this.setupID; + data['SuperVerifiedOn'] = this.superVerifiedOn; + data['TestCode'] = this.testCode; + data['UOM'] = this.uOM; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedOnDateTime'] = this.verifiedOnDateTime; + return data; + } +} \ No newline at end of file diff --git a/lib/core/service/patient_medical_file/lab_order/labs_service.dart b/lib/core/service/patient_medical_file/lab_order/labs_service.dart index c7bb9a78..87d72328 100644 --- a/lib/core/service/patient_medical_file/lab_order/labs_service.dart +++ b/lib/core/service/patient_medical_file/lab_order/labs_service.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; @@ -52,6 +53,7 @@ class LabsService extends BaseService { List patientLabSpecialResult = List(); List labResultList = List(); List labOrdersResultsList = List(); + List labOrdersResultHistoryList = List(); Future getLaboratoryResult( {String projectID, @@ -113,7 +115,8 @@ class LabsService extends BaseService { labResultList.add(LabResult.fromJson(hospital)); }); response['List_GetLabSpecial'].forEach((hospital) { - patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital)); + patientLabSpecialResult + .add(PatientLabSpecialResult.fromJson(hospital)); }); } else { response['ListPLR'].forEach((lab) { @@ -179,4 +182,30 @@ class LabsService extends BaseService { // super.error = error; // }, body: _requestSendLabReportEmail.toJson()); } + + Future getPatientLabOrdersResultHistoryByDescription( + {PatientLabOrders patientLabOrder, + String procedureDescription, + PatiantInformtion patient}) async { + hasError = false; + Map body = Map(); + if (patientLabOrder != null) { + body['SetupID'] = patientLabOrder.setupID; + body['ProjectID'] = 0; + body['ClinicID'] = 0; + } + body['isDentalAllowedBackend'] = false; + body['ProcedureDescription'] = procedureDescription; + await baseAppClient.postPatient( + GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION, + patient: patient, onSuccess: (dynamic response, int statusCode) { + labOrdersResultHistoryList.clear(); + response['ListGeneralResultHistory'].forEach((lab) { + labOrdersResultHistoryList.add(LabResultHistory.fromJson(lab)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index 5b4b7e4c..3fb74e0d 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabResultHistory.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; @@ -26,6 +27,8 @@ class LabsViewModel extends BaseViewModel { ? _patientLabOrdersListClinic : _patientLabOrdersListHospital; + List get labOrdersResultHistoryList => _labsService.labOrdersResultHistoryList; + void getLabs(PatiantInformtion patient) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersList(patient, true); @@ -132,7 +135,7 @@ class LabsViewModel extends BaseViewModel { } } - void setLabResultDependOnFilterName(){ + void setLabResultDependOnFilterName() { _labsService.labResultList.forEach((element) { List patientLabOrdersClinic = labResultLists .where( @@ -176,6 +179,23 @@ class LabsViewModel extends BaseViewModel { } } + getPatientLabResultHistoryByDescription( + {PatientLabOrders patientLabOrder, + String procedureDescription, + PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersResultHistoryByDescription( + patientLabOrder: patientLabOrder, + procedureDescription: procedureDescription, + patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async { await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); if (_labsService.hasError) { diff --git a/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart b/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart new file mode 100644 index 00000000..1142a4ec --- /dev/null +++ b/lib/screens/patients/profile/lab_result/LabResultHistoryPage.dart @@ -0,0 +1,132 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/viewModel/labs_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/translations_delegate_base.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/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +class LabResultHistoryPage extends StatelessWidget { + final PatientLabOrders patientLabOrder; + final String filterName; + final PatiantInformtion patient; + + LabResultHistoryPage({this.patientLabOrder, this.filterName, this.patient}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPatientLabResultHistoryByDescription( + patientLabOrder: patientLabOrder, + procedureDescription: filterName, + patient: patient), + builder: (context, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: filterName, + baseViewModel: model, + body: model.labOrdersResultHistoryList.length > 0 + ? SingleChildScrollView( + child: Column( + children: [ + ...List.generate(model.labOrdersResultHistoryList.length, + (index) { + return Container( + child: Column( + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context).description, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 1, + ), + AppText( + model.labOrdersResultHistoryList[index].description, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + isCopyable: true, + ), + ], + ), + Row( + children: [ + AppText( + "Reference Range", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 1, + ), + AppText( + model.labOrdersResultHistoryList[index].referanceRange, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + isCopyable: true, + ), + ], + ), + Row( + children: [ + AppText( + "Result Value", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 1, + ), + AppText( + model.labOrdersResultHistoryList[index].resultValue, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + isCopyable: true, + ), + ], + ), + Row( + children: [ + AppText( + "Verified On", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 1, + ), + AppText( + model.labOrdersResultHistoryList[index].verifiedOn, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + isCopyable: true, + ), + ], + ), + ], + ), + ); + }), + ], + ), + ) + : ErrorMessage( + error: "No data", + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index 26d85f62..82894002 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -10,6 +10,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'LabResultHistoryPage.dart'; + class LabResultWidget extends StatelessWidget { final String filterName; final List patientLabResultList; @@ -18,7 +20,12 @@ class LabResultWidget extends StatelessWidget { final bool isInpatient; LabResultWidget( - {Key key, this.filterName, this.patientLabResultList, this.patientLabOrder, this.patient, this.isInpatient}) + {Key key, + this.filterName, + this.patientLabResultList, + this.patientLabOrder, + this.patient, + this.isInpatient}) : super(key: key); ProjectViewModel projectViewModel; @@ -35,7 +42,30 @@ class LabResultWidget extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AppText(filterName), + Row( + children: [ + AppText(filterName), + InkWell( + onTap: (){ + Navigator.push( + context, + FadePage( + page: LabResultHistoryPage( + filterName: filterName, + patientLabOrder: patientLabOrder, + patient: patient, + ), + ), + ); + }, + child: AppText( + " (show details)", + color: Colors.blue, + fontSize: 12, + ), + ), + ], + ), InkWell( onTap: () { Navigator.push( @@ -117,7 +147,8 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - '${patientLabResultList[index].testCode}\n' + patientLabResultList[index].description, + '${patientLabResultList[index].testCode}\n' + + patientLabResultList[index].description, textAlign: TextAlign.center, isCopyable: true, ), @@ -131,7 +162,9 @@ class LabResultWidget extends StatelessWidget { child: Center( child: AppText( patientLabResultList[index].resultValue ?? - "" + " " + "${patientLabResultList[index].uOM ?? ""}", + "" + + " " + + "${patientLabResultList[index].uOM ?? ""}", textAlign: TextAlign.center, isCopyable: true, ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e104a01e..cbe7801a 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1371,6 +1371,7 @@ class TranslationBase { String get summeryReply => localizedValues['summeryReply'][locale.languageCode]; String get severityValidationError => localizedValues['severityValidationError'][locale.languageCode]; String get textCopiedSuccessfully => localizedValues['textCopiedSuccessfully'][locale.languageCode]; + String get roomNo => localizedValues['roomNo'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index b90eecd3..45f53b6d 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -35,7 +35,6 @@ class PatientCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( width: SizeConfig.screenWidth * 0.9, margin: EdgeInsets.all(6), @@ -260,9 +259,9 @@ class PatientCard extends StatelessWidget { patientInfo.fullName) : (Helpers.capitalize( patientInfo.firstName) + - " " + - Helpers.capitalize( - patientInfo.lastName)), + " " + + Helpers.capitalize( + patientInfo.lastName)), fontSize: 16, color: Color(0xff2e303a), fontWeight: FontWeight.w700, @@ -270,7 +269,6 @@ class PatientCard extends StatelessWidget { textOverflow: TextOverflow.ellipsis, ), ), - if (patientInfo.gender == 1) Icon( DoctorApp.male_2, @@ -281,9 +279,10 @@ class PatientCard extends StatelessWidget { DoctorApp.female_1, color: Colors.pink, ), - - if(isFromLiveCare) - ShowTimer(patientInfo: patientInfo,), + if (isFromLiveCare) + ShowTimer( + patientInfo: patientInfo, + ), ]), ), Row( @@ -447,6 +446,29 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w700, fontSize: 13)), ]))), + if (patientInfo.admissionDate != null) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: + 2.0 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: TranslationBase.of(context) + .roomNo + + " : ", + style: TextStyle(fontSize: 12)), + new TextSpan( + text: + "${patientInfo.roomId}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 13)), + ]))), if (isFromLiveCare) Column( children: [ @@ -454,19 +476,19 @@ class PatientCard extends StatelessWidget { child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, + fontSize: + 2.0 * SizeConfig.textMultiplier, color: Colors.black, fontFamily: 'Poppins', ), children: [ new TextSpan( - text: - TranslationBase.of(context).clinic + - " : ", + text: TranslationBase.of(context) + .clinic + + " : ", style: TextStyle(fontSize: 12)), new TextSpan( - text: - patientInfo.clinicName, + text: patientInfo.clinicName, style: TextStyle( fontWeight: FontWeight.w700, fontSize: 13)), @@ -522,14 +544,12 @@ class PatientCard extends StatelessWidget { height: 25, width: 35, )), - ]) - : SizedBox() + ]) + : SizedBox() ], ), onTap: onTap, )), )); } - - -} \ No newline at end of file +}