diff --git a/lib/config/config.dart b/lib/config/config.dart index 42d9f7c8..3cb95b24 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 = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; @@ -125,7 +125,8 @@ 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'; +const GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION = + 'Services/Patients.svc/REST/GetPatientLabOrdersResultsHistoryByDescription'; // SOAP @@ -237,6 +238,7 @@ const ADD_PATIENT_TO_DOCTOR = "LiveCareApi/DoctorApp/AssignPatientToDoctor"; const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue"; const CREATE_DOCTOR_RESPONSE = "Services/DoctorApplication.svc/REST/CreateDoctorResponse"; const GET_DOCTOR_NOT_REPLIED_COUNTS = "Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts"; +const ALL_SPECIAL_LAB_RESULT = "services/Patients.svc/REST/GetPatientLabSpecialResultsALL"; var selectedPatientType = 1; diff --git a/lib/core/model/labs/all_special_lab_result_model.dart b/lib/core/model/labs/all_special_lab_result_model.dart new file mode 100644 index 00000000..ed8d64da --- /dev/null +++ b/lib/core/model/labs/all_special_lab_result_model.dart @@ -0,0 +1,216 @@ +class AllSpecialLabResultModel { + int actualDoctorRate; + dynamic admissionDate; + dynamic admissionNumber; + dynamic appointmentDate; + dynamic appointmentNo; + dynamic appointmentTime; + String clinicDescription; + String clinicDescriptionEnglish; + dynamic clinicDescriptionN; + int clinicID; + dynamic createdOn; + double decimalDoctorRate; + int doctorID; + String doctorImageURL; + String doctorName; + String doctorNameEnglish; + dynamic doctorNameN; + int doctorRate; + int doctorStarsRate; + String doctorTitle; + int gender; + String genderDescription; + bool inOutPatient; + String invoiceNo; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + bool isInOutPatient; + dynamic isInOutPatientDescription; + dynamic isInOutPatientDescriptionN; + bool isLiveCareAppointment; + bool isRead; + bool isSendEmail; + String moduleID; + String nationalityFlagURL; + int noOfPatientsRate; + dynamic orderDate; + String orderNo; + dynamic patientID; + String projectID; + String projectName; + dynamic projectNameN; + String qR; + String resultData; + String resultDataHTML; + dynamic resultDataTxt; + String setupID; + //List speciality; + dynamic status; + dynamic statusDesc; + String strOrderDate; + + AllSpecialLabResultModel( + {this.actualDoctorRate, + this.admissionDate, + this.admissionNumber, + this.appointmentDate, + this.appointmentNo, + this.appointmentTime, + this.clinicDescription, + this.clinicDescriptionEnglish, + this.clinicDescriptionN, + this.clinicID, + this.createdOn, + this.decimalDoctorRate, + this.doctorID, + this.doctorImageURL, + this.doctorName, + this.doctorNameEnglish, + this.doctorNameN, + this.doctorRate, + this.doctorStarsRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.inOutPatient, + this.invoiceNo, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isInOutPatient, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.isLiveCareAppointment, + this.isRead, + this.isSendEmail, + this.moduleID, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.orderDate, + this.orderNo, + this.patientID, + this.projectID, + this.projectName, + this.projectNameN, + this.qR, + this.resultData, + this.resultDataHTML, + this.resultDataTxt, + this.setupID, + //this.speciality, + this.status, + this.statusDesc, + this.strOrderDate}); + + AllSpecialLabResultModel.fromJson(Map json) { + actualDoctorRate = json['ActualDoctorRate']; + admissionDate = json['AdmissionDate']; + admissionNumber = json['AdmissionNumber']; + appointmentDate = json['AppointmentDate']; + appointmentNo = json['AppointmentNo']; + appointmentTime = json['AppointmentTime']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionEnglish = json['ClinicDescriptionEnglish']; + clinicDescriptionN = json['ClinicDescriptionN']; + clinicID = json['ClinicID']; + createdOn = json['CreatedOn']; + decimalDoctorRate = json['DecimalDoctorRate']; + doctorID = json['DoctorID']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorNameEnglish = json['DoctorNameEnglish']; + doctorNameN = json['DoctorNameN']; + doctorRate = json['DoctorRate']; + doctorStarsRate = json['DoctorStarsRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + inOutPatient = json['InOutPatient']; + invoiceNo = json['InvoiceNo']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatient = json['IsInOutPatient']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + isLiveCareAppointment = json['IsLiveCareAppointment']; + isRead = json['IsRead']; + isSendEmail = json['IsSendEmail']; + moduleID = json['ModuleID']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + orderDate = json['OrderDate']; + orderNo = json['OrderNo']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + qR = json['QR']; + resultData = json['ResultData']; + resultDataHTML = json['ResultDataHTML']; + resultDataTxt = json['ResultDataTxt']; + setupID = json['SetupID']; + //speciality = json['Speciality'].cast(); + status = json['Status']; + statusDesc = json['StatusDesc']; + strOrderDate = json['StrOrderDate']; + } + + Map toJson() { + final Map data = new Map(); + data['ActualDoctorRate'] = this.actualDoctorRate; + data['AdmissionDate'] = this.admissionDate; + data['AdmissionNumber'] = this.admissionNumber; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentTime'] = this.appointmentTime; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionEnglish'] = this.clinicDescriptionEnglish; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['ClinicID'] = this.clinicID; + data['CreatedOn'] = this.createdOn; + data['DecimalDoctorRate'] = this.decimalDoctorRate; + data['DoctorID'] = this.doctorID; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['DoctorNameEnglish'] = this.doctorNameEnglish; + data['DoctorNameN'] = this.doctorNameN; + data['DoctorRate'] = this.doctorRate; + data['DoctorStarsRate'] = this.doctorStarsRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['InOutPatient'] = this.inOutPatient; + data['InvoiceNo'] = this.invoiceNo; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatient'] = this.isInOutPatient; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['IsLiveCareAppointment'] = this.isLiveCareAppointment; + data['IsRead'] = this.isRead; + data['IsSendEmail'] = this.isSendEmail; + data['ModuleID'] = this.moduleID; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['OrderDate'] = this.orderDate; + data['OrderNo'] = this.orderNo; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + data['QR'] = this.qR; + data['ResultData'] = this.resultData; + data['ResultDataHTML'] = this.resultDataHTML; + data['ResultDataTxt'] = this.resultDataTxt; + data['SetupID'] = this.setupID; + //data['Speciality'] = this.speciality; + data['Status'] = this.status; + data['StatusDesc'] = this.statusDesc; + data['StrOrderDate'] = this.strOrderDate; + return data; + } +} diff --git a/lib/core/model/labs/all_special_lab_result_request.dart b/lib/core/model/labs/all_special_lab_result_request.dart new file mode 100644 index 00000000..d5df1405 --- /dev/null +++ b/lib/core/model/labs/all_special_lab_result_request.dart @@ -0,0 +1,68 @@ +class AllSpecialLabResultRequestModel { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String tokenID; + int patientTypeID; + int patientType; + int patientID; + int projectID; + + AllSpecialLabResultRequestModel( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.patientID, + this.projectID}); + + AllSpecialLabResultRequestModel.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + return data; + } +} 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 87d72328..dd6b91d6 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,6 +1,8 @@ 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/all_special_lab_result_model.dart'; +import 'package:doctor_app_flutter/core/model/labs/all_special_lab_result_request.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'; @@ -12,9 +14,12 @@ import '../../base/base_service.dart'; class LabsService extends BaseService { List patientLabOrdersList = List(); + List _allSpecialLab = List(); + List get allSpecialLab => _allSpecialLab; - Future getPatientLabOrdersList( - PatiantInformtion patient, bool isInpatient) async { + AllSpecialLabResultRequestModel _allSpecialLabResultRequestModel = AllSpecialLabResultRequestModel(); + + Future getPatientLabOrdersList(PatiantInformtion patient, bool isInpatient) async { hasError = false; Map body = Map(); String url = ""; @@ -28,8 +33,7 @@ class LabsService extends BaseService { } patientLabOrdersList = []; patientLabOrdersList.clear(); - await baseAppClient.postPatient(url, patient: patient, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabOrdersList = []; if (!isInpatient) { response['ListPLO'].forEach((hospital) { @@ -47,8 +51,7 @@ class LabsService extends BaseService { }, body: body); } - RequestPatientLabSpecialResult _requestPatientLabSpecialResult = - RequestPatientLabSpecialResult(); + RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult(); List patientLabSpecialResult = List(); List labResultList = List(); @@ -71,8 +74,8 @@ class LabsService extends BaseService { _requestPatientLabSpecialResult.orderNo = orderNo; body = _requestPatientLabSpecialResult.toJson(); - await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, - patient: patient, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, patient: patient, + onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); response['ListPLSR'].forEach((hospital) { @@ -84,10 +87,7 @@ class LabsService extends BaseService { }, body: body); } - Future getPatientLabResult( - {PatientLabOrders patientLabOrder, - PatiantInformtion patient, - bool isInpatient}) async { + Future getPatientLabResult({PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async { hasError = false; String url = ""; @@ -105,8 +105,7 @@ class LabsService extends BaseService { body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID ?? 0; - await baseAppClient.postPatient(url, patient: patient, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult = []; labResultList = []; @@ -115,8 +114,7 @@ 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) { @@ -130,9 +128,7 @@ class LabsService extends BaseService { } Future getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + {PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async { hasError = false; Map body = Map(); if (patientLabOrder != null) { @@ -144,8 +140,8 @@ class LabsService extends BaseService { } body['isDentalAllowedBackend'] = false; body['Procedure'] = procedure; - await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, - patient: patient, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, patient: patient, + onSuccess: (dynamic response, int statusCode) { labOrdersResultsList.clear(); response['ListPLR'].forEach((lab) { labOrdersResultsList.add(LabOrderResult.fromJson(lab)); @@ -156,8 +152,7 @@ class LabsService extends BaseService { }, body: body); } - RequestSendLabReportEmail _requestSendLabReportEmail = - RequestSendLabReportEmail(); + RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail(); Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async { // _requestSendLabReportEmail.projectID = patientLabOrder.projectID; @@ -184,9 +179,7 @@ class LabsService extends BaseService { } Future getPatientLabOrdersResultHistoryByDescription( - {PatientLabOrders patientLabOrder, - String procedureDescription, - PatiantInformtion patient}) async { + {PatientLabOrders patientLabOrder, String procedureDescription, PatiantInformtion patient}) async { hasError = false; Map body = Map(); if (patientLabOrder != null) { @@ -196,9 +189,8 @@ class LabsService extends BaseService { } body['isDentalAllowedBackend'] = false; body['ProcedureDescription'] = procedureDescription; - await baseAppClient.postPatient( - GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION, - patient: patient, onSuccess: (dynamic response, int statusCode) { + 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)); @@ -208,4 +200,22 @@ class LabsService extends BaseService { super.error = error; }, body: body); } + + Future getAllSpecialLabResult({int mrn}) async { + _allSpecialLabResultRequestModel = AllSpecialLabResultRequestModel( + patientID: mrn, + patientType: 1, + patientTypeID: 1, + ); + hasError = false; + _allSpecialLab.clear(); + await baseAppClient.post(ALL_SPECIAL_LAB_RESULT, onSuccess: (dynamic response, int statusCode) { + response['ListPLSRALL'].forEach((lab) { + _allSpecialLab.add(AllSpecialLabResultModel.fromJson(lab)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _allSpecialLabResultRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index 3fb74e0d..d83aee2a 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -2,6 +2,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/all_special_lab_result_model.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'; @@ -16,18 +17,16 @@ class LabsViewModel extends BaseViewModel { FilterType filterType = FilterType.Clinic; LabsService _labsService = locator(); - List get labOrdersResultsList => - _labsService.labOrdersResultsList; + List get labOrdersResultsList => _labsService.labOrdersResultsList; + List get allSpecialLabList => _labsService.allSpecialLab; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); List get patientLabOrdersList => - filterType == FilterType.Clinic - ? _patientLabOrdersListClinic - : _patientLabOrdersListHospital; + filterType == FilterType.Clinic ? _patientLabOrdersListClinic : _patientLabOrdersListHospital; - List get labOrdersResultHistoryList => _labsService.labOrdersResultHistoryList; + List get labOrdersResultHistoryList => _labsService.labOrdersResultHistoryList; void getLabs(PatiantInformtion patient) async { setState(ViewState.Busy); @@ -37,41 +36,33 @@ class LabsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _labsService.patientLabOrdersList.forEach((element) { - List patientLabOrdersClinic = - _patientLabOrdersListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + List patientLabOrdersClinic = _patientLabOrdersListClinic + .where((elementClinic) => elementClinic.filterName == element.clinicDescription) + .toList(); if (patientLabOrdersClinic.length != 0) { - _patientLabOrdersListClinic[_patientLabOrdersListClinic - .indexOf(patientLabOrdersClinic[0])] + _patientLabOrdersListClinic[_patientLabOrdersListClinic.indexOf(patientLabOrdersClinic[0])] .patientLabOrdersList .add(element); } else { - _patientLabOrdersListClinic.add(PatientLabOrdersList( - filterName: element.clinicDescription, - patientDoctorAppointment: element)); + _patientLabOrdersListClinic + .add(PatientLabOrdersList(filterName: element.clinicDescription, patientDoctorAppointment: element)); } // doctor list sort via project - List patientLabOrdersHospital = - _patientLabOrdersListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List patientLabOrdersHospital = _patientLabOrdersListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (patientLabOrdersHospital.length != 0) { - _patientLabOrdersListHospital[_patientLabOrdersListHospital - .indexOf(patientLabOrdersHospital[0])] + _patientLabOrdersListHospital[_patientLabOrdersListHospital.indexOf(patientLabOrdersHospital[0])] .patientLabOrdersList .add(element); } else { - _patientLabOrdersListHospital.add(PatientLabOrdersList( - filterName: element.projectName, - patientDoctorAppointment: element)); + _patientLabOrdersListHospital + .add(PatientLabOrdersList(filterName: element.projectName, patientDoctorAppointment: element)); } }); @@ -84,8 +75,7 @@ class LabsViewModel extends BaseViewModel { notifyListeners(); } - List get patientLabSpecialResult => - _labsService.patientLabSpecialResult; + List get patientLabSpecialResult => _labsService.patientLabSpecialResult; List get labResultList => _labsService.labResultList; @@ -118,15 +108,10 @@ class LabsViewModel extends BaseViewModel { } } - getPatientLabResult( - {PatientLabOrders patientLabOrder, - PatiantInformtion patient, - bool isInpatient}) async { + getPatientLabResult({PatientLabOrders patientLabOrder, PatiantInformtion patient, bool isInpatient}) async { setState(ViewState.Busy); await _labsService.getPatientLabResult( - patientLabOrder: patientLabOrder, - patient: patient, - isInpatient: isInpatient); + patientLabOrder: patientLabOrder, patient: patient, isInpatient: isInpatient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -137,31 +122,21 @@ class LabsViewModel extends BaseViewModel { void setLabResultDependOnFilterName() { _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = labResultLists - .where( - (elementClinic) => elementClinic.filterName == element.testCode) - .toList(); + List patientLabOrdersClinic = + labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList(); if (patientLabOrdersClinic.length != 0) { - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .add(element); + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList.add(element); } else { - labResultLists - .add(LabResultList(filterName: element.testCode, lab: element)); + labResultLists.add(LabResultList(filterName: element.testCode, lab: element)); } }); } - getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure, PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, - procedure: procedure, - patient: patient); + patientLabOrder: patientLabOrder, procedure: procedure, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -169,9 +144,8 @@ class LabsViewModel extends BaseViewModel { bool isShouldClear = false; if (_labsService.labOrdersResultsList.length == 1) { labOrdersResultsList.forEach((element) { - if (element.resultValue.contains('/') || - element.resultValue.contains('*') || - element.resultValue.isEmpty) isShouldClear = true; + if (element.resultValue.contains('/') || element.resultValue.contains('*') || element.resultValue.isEmpty) + isShouldClear = true; }); } if (isShouldClear) _labsService.labOrdersResultsList.clear(); @@ -180,14 +154,10 @@ class LabsViewModel extends BaseViewModel { } getPatientLabResultHistoryByDescription( - {PatientLabOrders patientLabOrder, - String procedureDescription, - PatiantInformtion patient}) async { + {PatientLabOrders patientLabOrder, String procedureDescription, PatiantInformtion patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResultHistoryByDescription( - patientLabOrder: patientLabOrder, - procedureDescription: procedureDescription, - patient: patient); + patientLabOrder: patientLabOrder, procedureDescription: procedureDescription, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -203,4 +173,14 @@ class LabsViewModel extends BaseViewModel { } else DrAppToastMsg.showSuccesToast(mes); } + + Future getAllSpecialLabResult({int patientId}) async { + setState(ViewState.Busy); + await _labsService.getAllSpecialLabResult(mrn: patientId); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/routes.dart b/lib/routes.dart index 0826c76e..742ac118 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportDetailPage.dart'; @@ -48,8 +49,7 @@ const String ORDER_NOTE = 'patients/order-note'; const String MY_REFERRAL_DETAIL = 'my_referral_detail'; const String REFER_PATIENT_TO_DOCTOR = 'patients/refer-to-doctor'; const String REFER_IN_PATIENT_TO_DOCTOR = 'patients/refer-in-patient-to-doctor'; -const String PATIENT_INSURANCE_APPROVALS_NEW = - 'patients/patient_insurance_approvals_new'; +const String PATIENT_INSURANCE_APPROVALS_NEW = 'patients/patient_insurance_approvals_new'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String CREATE_EPISODE = 'patients/create-episode'; const String UPDATE_EPISODE = 'patients/update-episode'; @@ -68,6 +68,8 @@ const String ORDER_PROCEDURE = 'procedure/procedure'; const String ADD_SICKLEAVE = 'add-sickleave'; const String SHOW_SICKLEAVE = 'show-sickleave'; const String RADIOLOGY_PATIENT = 'radiology-patient'; +const String ALL_SPECIAL_LAB_RESULT = 'all-special_lab'; + //todo: change the routing way. var routes = { ROOT: (_) => RootPage(), @@ -77,8 +79,12 @@ var routes = { PATIENTS_PROFILE: (_) => PatientProfileScreen(), LAB_RESULT: (_) => LabsHomePage(), HEALTH_SUMMARY: (_) => HealthSummaryPage(), - PROGRESS_NOTE: (_) => ProgressNoteScreen(visitType: 5,), - ORDER_NOTE: (_) => ProgressNoteScreen(visitType: 3,), + PROGRESS_NOTE: (_) => ProgressNoteScreen( + visitType: 5, + ), + ORDER_NOTE: (_) => ProgressNoteScreen( + visitType: 3, + ), REFER_PATIENT_TO_DOCTOR: (_) => PatientMakeReferralScreen(), REFER_IN_PATIENT_TO_DOCTOR: (_) => PatientMakeInPatientReferralScreen(), PATIENT_INSURANCE_APPROVALS_NEW: (_) => InsuranceApprovalScreenNew(), @@ -106,4 +112,5 @@ var routes = { PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), PATIENT_ECG: (_) => ECGPage(), + ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), }; diff --git a/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart b/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart new file mode 100644 index 00000000..a0dc3b4a --- /dev/null +++ b/lib/screens/patients/profile/lab_result/all_lab_special_result_page.dart @@ -0,0 +1,219 @@ +import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.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/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.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/doctor_card.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class AllLabSpecialResult extends StatefulWidget { + const AllLabSpecialResult({Key key}) : super(key: key); + + @override + _AllLabSpecialResultState createState() => _AllLabSpecialResultState(); +} + +class _AllLabSpecialResultState extends State { + String patientType; + + String arrivalType; + PatiantInformtion patient; + bool isInpatient; + bool isFromLiveCare; + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + isInpatient = routeArgs['isInpatient']; + isFromLiveCare = routeArgs['isFromLiveCare']; + + print(arrivalType); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getAllSpecialLabResult(patientId: patient.patientMRN), + builder: (context, LabsViewModel model, widget) => AppScaffold( + baseViewModel: model, + backgroundColor: Colors.grey[100], + isShowAppBar: true, + appBar: PatientProfileAppBar( + patient, + isInpatient: isInpatient, + ), + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: FractionallySizedBox( + widthFactor: 1.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "Special " + TranslationBase.of(context).lab, + style: "caption2", + color: Colors.black, + fontSize: 13, + ), + AppText( + TranslationBase.of(context).result, + bold: true, + fontSize: 22, + ), + ], + ), + ), + // if (patient.patientStatusType != null && patient.patientStatusType == 43) + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // AppText( + // TranslationBase.of(context).lab, + // style: "caption2", + // color: Colors.black, + // fontSize: 13, + // ), + // AppText( + // TranslationBase.of(context).result, + // bold: true, + // fontSize: 22, + // ), + // ], + // ), + // ), + // if ((patient.patientStatusType != null && patient.patientStatusType == 43) || + // (isFromLiveCare && patient.appointmentNo != null)) + // AddNewOrder( + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => BaseAddProcedureTabPage( + // patient: patient, + // model: model, + // procedureType: ProcedureType.LAB_RESULT, + // ), + // settings: RouteSettings(name: 'AddProcedureTabPage'), + // ), + // ); + // }, + // label: TranslationBase.of(context).applyForNewLabOrder, + // ), + ...List.generate( + model.allSpecialLabList.length, + (index) => Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(8.0), + ), + color: Colors.white), + child: Row( + children: [ + Container( + width: 20, + height: 160, + decoration: BoxDecoration( + color: model.allSpecialLabList[index].isLiveCareAppointment + ? Colors.red[900] + : !model.allSpecialLabList[index].isInOutPatient + ? Colors.black + : Color(0xffa9a089), + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(8), + topRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0), + bottomRight: projectViewModel.isArabic ? Radius.circular(8) : Radius.circular(0)), + ), + child: RotatedBox( + quarterTurns: 3, + child: Center( + child: Text( + model.allSpecialLabList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toUpperCase() + : !model.allSpecialLabList[index].isInOutPatient + ? TranslationBase.of(context).inPatientLabel.toUpperCase() + : TranslationBase.of(context).outpatient.toUpperCase(), + style: TextStyle(color: Colors.white), + ), + )), + ), + Expanded( + child: DoctorCard( + isNoMargin: true, + // onTap: () => Navigator.push( + // context, + // FadePage( + // page: LaboratoryResultPage( + // patientLabOrders: model.patientLabOrdersList[index], + // patient: patient, + // isInpatient: isInpatient, + // arrivalType: arrivalType, + // patientType: patientType, + // ), + // ), + // ), + doctorName: model.allSpecialLabList[index].doctorName, + invoiceNO: ' ${model.allSpecialLabList[index].invoiceNo}', + profileUrl: model.allSpecialLabList[index].doctorImageURL, + branch: model.allSpecialLabList[index].projectName, + clinic: model.allSpecialLabList[index].clinicDescription, + appointmentDate: model.allSpecialLabList[index].orderDate, + orderNo: model.allSpecialLabList[index].orderNo, + isShowTime: false, + ), + ), + ], + ), + ), + ), + if (model.allSpecialLabList.isEmpty && patient.patientStatusType != 43) + Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText('No Lab Result Found'), + ) + ], + ), + ) + ], + ), + ), + ), + ), + ); + } +} 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 49fa8012..a3a78ef1 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 @@ -35,63 +35,36 @@ class ProfileGridForInPatient extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel( - TranslationBase.of(context).vital, - TranslationBase.of(context).signs, - VITAL_SIGN_DETAILS, + PatientProfileCardModel(TranslationBase.of(context).vital, TranslationBase.of(context).signs, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab, - TranslationBase.of(context).result, - LAB_RESULT, - 'patient/lab_results.png', + TranslationBase.of(context).lab, TranslationBase.of(context).result, LAB_RESULT, 'patient/lab_results.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).radiology, - TranslationBase.of(context).result, - RADIOLOGY_PATIENT, - 'patient/health_summary.png', + TranslationBase.of(context).lab, 'Special Rsult', ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).prescription, - ORDER_PRESCRIPTION_NEW, - 'patient/order_prescription.png', + PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).result, + RADIOLOGY_PATIENT, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).progress, - TranslationBase.of(context).note, - PROGRESS_NOTE, + PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription, + ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + isInPatient: isInpatient), + PatientProfileCardModel(TranslationBase.of(context).progress, TranslationBase.of(context).note, PROGRESS_NOTE, 'patient/Progress_notes.png', - isInPatient: isInpatient, - isDischargedPatient: isDischargedPatient), - PatientProfileCardModel( - TranslationBase.of(context).order, - TranslationBase.of(context).sheet, - ORDER_NOTE, + isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), + PatientProfileCardModel(TranslationBase.of(context).order, TranslationBase.of(context).sheet, ORDER_NOTE, 'patient/Progress_notes.png', - isInPatient: isInpatient, - isDischargedPatient: isDischargedPatient), - PatientProfileCardModel( - TranslationBase.of(context).orders, - TranslationBase.of(context).procedures, - ORDER_PROCEDURE, - 'patient/Order_Procedures.png', + isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), + PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).procedures, + ORDER_PROCEDURE, 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).health, - TranslationBase.of(context).summary, - HEALTH_SUMMARY, + PatientProfileCardModel(TranslationBase.of(context).health, TranslationBase.of(context).summary, HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).medical, - TranslationBase.of(context).report, - PATIENT_MEDICAL_REPORT, - 'patient/health_summary.png', - isInPatient: isInpatient, - isDisable: false), + PatientProfileCardModel(TranslationBase.of(context).medical, TranslationBase.of(context).report, + PATIENT_MEDICAL_REPORT, 'patient/health_summary.png', + isInPatient: isInpatient, isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, @@ -100,19 +73,12 @@ class ProfileGridForInPatient extends StatelessWidget { isInPatient: isInpatient, isDisable: isDischargedPatient || isFromSearch, ), - PatientProfileCardModel( - TranslationBase.of(context).insurance, - TranslationBase.of(context).approvals, - PATIENT_INSURANCE_APPROVALS_NEW, - 'patient/vital_signs.png', + PatientProfileCardModel(TranslationBase.of(context).insurance, TranslationBase.of(context).approvals, + PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).discharge, - TranslationBase.of(context).report, - null, + PatientProfileCardModel(TranslationBase.of(context).discharge, TranslationBase.of(context).report, null, 'patient/patient_sick_leave.png', - isInPatient: isInpatient, - isDisable: true), + isInPatient: isInpatient, isDisable: true), PatientProfileCardModel( TranslationBase.of(context).patientSick, TranslationBase.of(context).leave,